| 1 |
import { contentList } from '@agent/abilities/content-list'; |
| 2 |
import { contentRead } from '@agent/abilities/content-read'; |
| 3 |
import { contentSearch } from '@agent/abilities/content-search'; |
| 4 |
import { media } from '@agent/abilities/media'; |
| 5 |
import { navigation } from '@agent/abilities/navigation'; |
| 6 |
import { options } from '@agent/abilities/options'; |
| 7 |
import { siteInfo } from '@agent/abilities/site-info'; |
| 8 |
import { taxonomies } from '@agent/abilities/taxonomies'; |
| 9 |
import { themeSettings } from '@agent/abilities/theme-settings'; |
| 10 |
|
| 11 |
// Not registered with WordPress — only the descriptor shape is shared. |
| 12 |
// Descriptions reach the model, not the screen, and a translated value name breaks the call. |
| 13 |
const collection = [ |
| 14 |
siteInfo, |
| 15 |
contentList, |
| 16 |
contentSearch, |
| 17 |
contentRead, |
| 18 |
options, |
| 19 |
taxonomies, |
| 20 |
media, |
| 21 |
navigation, |
| 22 |
themeSettings, |
| 23 |
]; |
| 24 |
|
| 25 |
export const getAbilities = (declared = []) => |
| 26 |
declared |
| 27 |
.map((entry) => |
| 28 |
typeof entry === 'string' |
| 29 |
? collection.find((ability) => ability.name === entry) |
| 30 |
: entry, |
| 31 |
) |
| 32 |
.filter(Boolean); |
| 33 |
|
| 34 |
export const abilityDescriptors = (abilities) => |
| 35 |
abilities.map(({ name, label, description, inputSchema, annotations }) => ({ |
| 36 |
name, |
| 37 |
label, |
| 38 |
description, |
| 39 |
inputSchema, |
| 40 |
annotations, |
| 41 |
})); |
| 42 |
|