PluginProbe
Extendify / 3.1.6
Extendify v3.1.6
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / abilities / abilities.js

abilities.js in Extendify 3.1.6, at src/Agent/abilities/abilities.js

42 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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