@progress/kendo-react-webmcp 15.0.1-develop.3 → 15.0.1-develop.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebMcpProvider.js +1 -1
- package/WebMcpProvider.mjs +84 -80
- package/adapters/button.d.ts +1 -1
- package/adapters/button.js +1 -1
- package/adapters/button.mjs +12 -17
- package/adapters/{dashboard.d.ts → checkbox.d.ts} +5 -6
- package/adapters/checkbox.js +8 -0
- package/adapters/checkbox.mjs +60 -0
- package/adapters/dropdowntree.js +1 -1
- package/adapters/dropdowntree.mjs +78 -51
- package/adapters/editor.d.ts +0 -1
- package/adapters/editor.js +1 -1
- package/adapters/editor.mjs +38 -46
- package/adapters/form.d.ts +1 -0
- package/adapters/form.js +3 -3
- package/adapters/form.mjs +75 -49
- package/adapters/gantt.d.ts +2 -0
- package/adapters/gantt.js +1 -1
- package/adapters/gantt.mjs +188 -140
- package/adapters/grid.d.ts +0 -1
- package/adapters/grid.js +1 -1
- package/adapters/grid.mjs +52 -60
- package/adapters/multicolumncombobox.d.ts +20 -0
- package/adapters/multicolumncombobox.js +8 -0
- package/adapters/multicolumncombobox.mjs +75 -0
- package/adapters/multiselect.d.ts +2 -0
- package/adapters/multiselect.js +1 -1
- package/adapters/multiselect.mjs +46 -30
- package/adapters/notification.js +1 -1
- package/adapters/notification.mjs +14 -14
- package/adapters/pivotgrid.js +1 -1
- package/adapters/pivotgrid.mjs +39 -47
- package/adapters/scheduler.js +1 -1
- package/adapters/scheduler.mjs +137 -92
- package/adapters/spreadsheet.js +1 -1
- package/adapters/spreadsheet.mjs +3 -3
- package/adapters/switch.js +1 -1
- package/adapters/switch.mjs +29 -19
- package/adapters/treeview.js +2 -2
- package/adapters/treeview.mjs +79 -113
- package/adapters/window.d.ts +0 -2
- package/adapters/window.js +1 -1
- package/adapters/window.mjs +29 -63
- package/commands/form.d.ts +4 -1
- package/commands/form.js +1 -1
- package/commands/form.mjs +11 -7
- package/commands/gantt.js +1 -1
- package/commands/gantt.mjs +14 -10
- package/commands/grid.d.ts +0 -4
- package/commands/grid.js +1 -1
- package/commands/grid.mjs +18 -24
- package/commands/index.d.ts +0 -1
- package/commands/pivotgrid.d.ts +0 -4
- package/commands/pivotgrid.js +1 -1
- package/commands/pivotgrid.mjs +6 -12
- package/commands/scheduler.d.ts +10 -0
- package/commands/scheduler.js +1 -1
- package/commands/scheduler.mjs +16 -4
- package/commands/window.d.ts +0 -8
- package/commands/window.js +1 -1
- package/commands/window.mjs +8 -18
- package/dist/cdn/js/kendo-react-webmcp.js +1 -1
- package/index.d.mts +2 -1
- package/index.d.ts +2 -1
- package/index.js +1 -1
- package/index.mjs +248 -249
- package/package.json +3 -3
- package/schemas/gantt.d.ts +4 -0
- package/schemas/gantt.js +1 -1
- package/schemas/gantt.mjs +93 -8
- package/schemas/scheduler.d.ts +2 -0
- package/schemas/scheduler.js +1 -1
- package/schemas/scheduler.mjs +21 -5
- package/adapters/dashboard.js +0 -8
- package/adapters/dashboard.mjs +0 -41
- package/commands/dashboard.d.ts +0 -19
- package/commands/dashboard.js +0 -8
- package/commands/dashboard.mjs +0 -21
package/adapters/spreadsheet.mjs
CHANGED
|
@@ -147,13 +147,13 @@ const A = {
|
|
|
147
147
|
name: "get_cell",
|
|
148
148
|
description: `Get the value of a cell in the ${e.dataName} spreadsheet.`,
|
|
149
149
|
commandType: n.GetCell,
|
|
150
|
-
enabled: !
|
|
150
|
+
enabled: !1
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
name: "get_data",
|
|
154
154
|
description: `Get the full workbook data from the ${e.dataName} spreadsheet as JSON.`,
|
|
155
155
|
commandType: n.GetData,
|
|
156
|
-
enabled: !
|
|
156
|
+
enabled: !1
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
name: "set_data",
|
|
@@ -165,7 +165,7 @@ const A = {
|
|
|
165
165
|
name: "get_sheets",
|
|
166
166
|
description: `Get the names of all sheets in the ${e.dataName} spreadsheet.`,
|
|
167
167
|
commandType: n.GetSheets,
|
|
168
|
-
enabled: !
|
|
168
|
+
enabled: !1
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
name: "switch_sheet",
|
package/adapters/switch.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../commands/switch.js"),y={componentSuffix:"switch",createTools(u,i,r,p){const h=[],f=t=>`${r.groupName}_${t}`,l=i.current,m=[{name:"toggle",description:`Toggle the ${r.dataName} switch on or off.`,commandType:n.SwitchCommands.Toggle,enabled:!!l.onChange},{name:"set_value",description:`Set the ${r.dataName} switch to a specific on or off state.`,commandType:n.SwitchCommands.SetValue,enabled:!!l.onChange}],c=l.webMcp,d=typeof c=="object"&&c!==null&&typeof c.tools=="function"?c.tools:void 0,w=d?d(m):m,S=async(t,a)=>{var s,g;if(t===n.SwitchCommands.Toggle){const e=i.current,o=(g=(s=e.checked)!=null?s:e.value)!=null?g:!1;return e.onChange&&e.onChange({value:!o,syntheticEvent:null,target:u}),{content:[{type:"text",text:`Switch toggled to ${o?"off":"on"}.`}]}}if(t===n.SwitchCommands.SetValue){const e=i.current,o=!!a.value;return e.onChange&&e.onChange({value:o,syntheticEvent:null,target:u}),{content:[{type:"text",text:`Switch set to ${o?"on":"off"}.`}]}}return{content:[{type:"text",text:`Unknown command: ${t}`}],isError:!0}};for(const t of w){if(!t.enabled)continue;const a=t.commandType;try{h.push(p.registerTool({name:f(t.name),description:t.description,inputSchema:n.getSwitchToolSchema(a),execute:async s=>S(a,s||{})}))}catch{}}return h}};exports.switchAdapter=y;
|
package/adapters/switch.mjs
CHANGED
|
@@ -5,44 +5,54 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { SwitchCommands as
|
|
9
|
-
const
|
|
8
|
+
import { SwitchCommands as s, getSwitchToolSchema as x } from "../commands/switch.mjs";
|
|
9
|
+
const S = {
|
|
10
10
|
componentSuffix: "switch",
|
|
11
|
-
createTools(
|
|
12
|
-
const
|
|
11
|
+
createTools(u, r, i, g) {
|
|
12
|
+
const h = [], d = (t) => `${i.groupName}_${t}`, l = r.current, m = [
|
|
13
13
|
{
|
|
14
14
|
name: "toggle",
|
|
15
|
-
description: `Toggle the ${
|
|
16
|
-
commandType:
|
|
17
|
-
enabled: !!
|
|
15
|
+
description: `Toggle the ${i.dataName} switch on or off.`,
|
|
16
|
+
commandType: s.Toggle,
|
|
17
|
+
enabled: !!l.onChange
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "set_value",
|
|
21
|
+
description: `Set the ${i.dataName} switch to a specific on or off state.`,
|
|
22
|
+
commandType: s.SetValue,
|
|
23
|
+
enabled: !!l.onChange
|
|
24
|
+
}
|
|
25
|
+
], n = l.webMcp, p = typeof n == "object" && n !== null && typeof n.tools == "function" ? n.tools : void 0, w = p ? p(m) : m, y = async (t, c) => {
|
|
26
|
+
var a, f;
|
|
27
|
+
if (t === s.Toggle) {
|
|
28
|
+
const e = r.current, o = (f = (a = e.checked) != null ? a : e.value) != null ? f : !1;
|
|
29
|
+
return e.onChange && e.onChange({ value: !o, syntheticEvent: null, target: u }), { content: [{ type: "text", text: `Switch toggled to ${o ? "off" : "on"}.` }] };
|
|
18
30
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const n = s.current, g = (p = (e = n.checked) != null ? e : n.value) != null ? p : !1;
|
|
23
|
-
return n.onChange && n.onChange({ value: !g, syntheticEvent: null, target: f }), { content: [{ type: "text", text: `Switch toggled to ${g ? "off" : "on"}.` }] };
|
|
31
|
+
if (t === s.SetValue) {
|
|
32
|
+
const e = r.current, o = !!c.value;
|
|
33
|
+
return e.onChange && e.onChange({ value: o, syntheticEvent: null, target: u }), { content: [{ type: "text", text: `Switch set to ${o ? "on" : "off"}.` }] };
|
|
24
34
|
}
|
|
25
35
|
return { content: [{ type: "text", text: `Unknown command: ${t}` }], isError: !0 };
|
|
26
36
|
};
|
|
27
|
-
for (const t of
|
|
37
|
+
for (const t of w) {
|
|
28
38
|
if (!t.enabled)
|
|
29
39
|
continue;
|
|
30
40
|
const c = t.commandType;
|
|
31
41
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
h.push(
|
|
43
|
+
g.registerTool({
|
|
34
44
|
name: d(t.name),
|
|
35
45
|
description: t.description,
|
|
36
|
-
inputSchema:
|
|
37
|
-
execute: async (
|
|
46
|
+
inputSchema: x(c),
|
|
47
|
+
execute: async (a) => y(c, a || {})
|
|
38
48
|
})
|
|
39
49
|
);
|
|
40
50
|
} catch {
|
|
41
51
|
}
|
|
42
52
|
}
|
|
43
|
-
return
|
|
53
|
+
return h;
|
|
44
54
|
}
|
|
45
55
|
};
|
|
46
56
|
export {
|
|
47
|
-
|
|
57
|
+
S as switchAdapter
|
|
48
58
|
};
|
package/adapters/treeview.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
9
|
-
${JSON.stringify(
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../commands/treeview.js"),b=require("./utils.js");function h(c,n,e,t,a=""){for(let i=0;i<c.length;i++){const o=c[i],r=a?`${a}_${i}`:`${i}`;if(b.toText(o[e])===n)return{node:o,path:r};const d=o[t];if(d&&Array.isArray(d)&&d.length>0){const x=h(d,n,e,t,r);if(x)return x}}}function N(c,n){const e=c.nodeText;if(!e)return{content:[{type:"text",text:"Missing required argument: nodeText"}],isError:!0};const t=n.current,a=t.textField||"text",i=t.childrenField||"items",o=t.data;if(!o)return{content:[{type:"text",text:"TreeView has no data."}]};const r=h(o,e,a,i);return r?(t.onExpandChange&&t.onExpandChange({item:r.node,itemHierarchicalIndex:r.path,nativeEvent:null,target:null,syntheticEvent:null}),{content:[{type:"text",text:`Expanded node "${e}".`}]}):{content:[{type:"text",text:`Node "${e}" not found.`}],isError:!0}}function M(c,n){const e=c.nodeText;if(!e)return{content:[{type:"text",text:"Missing required argument: nodeText"}],isError:!0};const t=n.current,a=t.textField||"text",i=t.childrenField||"items",o=t.data;if(!o)return{content:[{type:"text",text:"TreeView has no data."}]};const r=h(o,e,a,i);return r?(t.onExpandChange&&t.onExpandChange({item:r.node,itemHierarchicalIndex:r.path,nativeEvent:null,target:null,syntheticEvent:null}),{content:[{type:"text",text:`Collapsed node "${e}".`}]}):{content:[{type:"text",text:`Node "${e}" not found.`}],isError:!0}}function _(c,n){const e=c.nodeText;if(!e)return{content:[{type:"text",text:"Missing required argument: nodeText"}],isError:!0};const t=n.current,a=t.textField||"text",i=t.childrenField||"items",o=t.data;if(!o)return{content:[{type:"text",text:"TreeView has no data."}]};const r=h(o,e,a,i);return r?(t.onItemClick&&t.onItemClick({item:r.node,itemHierarchicalIndex:r.path,nativeEvent:null,target:null,syntheticEvent:null}),{content:[{type:"text",text:`Selected node "${e}".`}]}):{content:[{type:"text",text:`Node "${e}" not found.`}],isError:!0}}function A(c,n,e){switch(c){case u.TreeViewCommands.Expand:return N(n,e);case u.TreeViewCommands.Collapse:return M(n,e);case u.TreeViewCommands.Select:return _(n,e);default:return{content:[{type:"text",text:`Unknown command: ${c}`}],isError:!0}}}const I={componentSuffix:"treeview",createTools(c,n,e,t){const a=[],i=s=>`${e.groupName}_${s}`,o=n.current,r=[{name:"expand_node",description:`Expand a node in the ${e.dataName} treeview`,commandType:u.TreeViewCommands.Expand,enabled:!!o.onExpandChange},{name:"collapse_node",description:`Collapse a node in the ${e.dataName} treeview`,commandType:u.TreeViewCommands.Collapse,enabled:!!o.onExpandChange},{name:"select_node",description:`Select a node in the ${e.dataName} treeview`,commandType:u.TreeViewCommands.Select,enabled:!!o.onItemClick}],d=n.current.webMcp,x=typeof d=="object"&&d!==null&&typeof d.tools=="function"?d.tools:void 0,F=x?x(r,{tname:i}):r,V=async(s,l)=>A(s,l,n);if(o.onFilterChange)try{a.push(t.registerTool({name:i("search"),description:`Search for nodes matching a text pattern in the ${e.dataName} treeview.`,inputSchema:{type:"object",properties:{query:{type:"string",description:"Text to search for (case-insensitive)"}},required:["query"]},async execute(s){const l=(s.query||"").toLowerCase();if(!l)return{content:[{type:"text",text:"Missing required argument: query"}],isError:!0};const m=n.current,y=m.textField||"text",S=m.childrenField||"items",C=m.data;if(!C)return{content:[{type:"text",text:"TreeView has no data."}]};const p=[],g=(q,w)=>{q.forEach((E,$)=>{const v=w?`${w}_${$}`:`${$}`,f=E[y]||"";typeof f=="string"&&f.toLowerCase().includes(l)&&p.push({text:f,path:v});const T=E[S];T&&Array.isArray(T)&&g(T,v)})};return g(C,""),p.length===0?{content:[{type:"text",text:`No nodes matching "${l}".`}]}:{content:[{type:"text",text:`${p.length} match(es):
|
|
9
|
+
${JSON.stringify(p,null,2)}`}]}}}))}catch{}for(const s of F){if(!s.enabled)continue;const l=u.getTreeViewToolSchema(s.commandType),m=s.commandType;try{a.push(t.registerTool({name:i(s.name),description:s.description,inputSchema:l,execute:async y=>V(m,y||{})}))}catch{}}return a}};exports.treeViewAdapter=I;
|
package/adapters/treeview.mjs
CHANGED
|
@@ -5,149 +5,115 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { TreeViewCommands as
|
|
9
|
-
import { toText as
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
const o = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}) : [];
|
|
20
|
-
}
|
|
21
|
-
function f(s, n, e, t, a = "") {
|
|
22
|
-
for (let r = 0; r < s.length; r++) {
|
|
23
|
-
const c = s[r], o = a ? `${a}_${r}` : `${r}`;
|
|
24
|
-
if (_(c[e]) === n)
|
|
25
|
-
return { node: c, path: o };
|
|
26
|
-
const d = c[t];
|
|
27
|
-
if (d && Array.isArray(d) && d.length > 0) {
|
|
28
|
-
const m = f(
|
|
29
|
-
d,
|
|
8
|
+
import { TreeViewCommands as u, getTreeViewToolSchema as b } from "../commands/treeview.mjs";
|
|
9
|
+
import { toText as V } from "./utils.mjs";
|
|
10
|
+
function h(c, n, e, t, a = "") {
|
|
11
|
+
for (let i = 0; i < c.length; i++) {
|
|
12
|
+
const o = c[i], r = a ? `${a}_${i}` : `${i}`;
|
|
13
|
+
if (V(o[e]) === n)
|
|
14
|
+
return { node: o, path: r };
|
|
15
|
+
const s = o[t];
|
|
16
|
+
if (s && Array.isArray(s) && s.length > 0) {
|
|
17
|
+
const x = h(
|
|
18
|
+
s,
|
|
30
19
|
n,
|
|
31
20
|
e,
|
|
32
21
|
t,
|
|
33
|
-
|
|
22
|
+
r
|
|
34
23
|
);
|
|
35
|
-
if (
|
|
36
|
-
return
|
|
24
|
+
if (x)
|
|
25
|
+
return x;
|
|
37
26
|
}
|
|
38
27
|
}
|
|
39
28
|
}
|
|
40
|
-
function
|
|
41
|
-
const e =
|
|
29
|
+
function _(c, n) {
|
|
30
|
+
const e = c.nodeText;
|
|
42
31
|
if (!e)
|
|
43
32
|
return { content: [{ type: "text", text: "Missing required argument: nodeText" }], isError: !0 };
|
|
44
|
-
const t = n.current, a = t.textField || "text",
|
|
45
|
-
if (!
|
|
33
|
+
const t = n.current, a = t.textField || "text", i = t.childrenField || "items", o = t.data;
|
|
34
|
+
if (!o)
|
|
46
35
|
return { content: [{ type: "text", text: "TreeView has no data." }] };
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
item:
|
|
50
|
-
itemHierarchicalIndex:
|
|
36
|
+
const r = h(o, e, a, i);
|
|
37
|
+
return r ? (t.onExpandChange && t.onExpandChange({
|
|
38
|
+
item: r.node,
|
|
39
|
+
itemHierarchicalIndex: r.path,
|
|
51
40
|
nativeEvent: null,
|
|
52
41
|
target: null,
|
|
53
42
|
syntheticEvent: null
|
|
54
43
|
}), { content: [{ type: "text", text: `Expanded node "${e}".` }] }) : { content: [{ type: "text", text: `Node "${e}" not found.` }], isError: !0 };
|
|
55
44
|
}
|
|
56
|
-
function I(
|
|
57
|
-
const e =
|
|
45
|
+
function I(c, n) {
|
|
46
|
+
const e = c.nodeText;
|
|
58
47
|
if (!e)
|
|
59
48
|
return { content: [{ type: "text", text: "Missing required argument: nodeText" }], isError: !0 };
|
|
60
|
-
const t = n.current, a = t.textField || "text",
|
|
61
|
-
if (!
|
|
49
|
+
const t = n.current, a = t.textField || "text", i = t.childrenField || "items", o = t.data;
|
|
50
|
+
if (!o)
|
|
62
51
|
return { content: [{ type: "text", text: "TreeView has no data." }] };
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
item:
|
|
66
|
-
itemHierarchicalIndex:
|
|
52
|
+
const r = h(o, e, a, i);
|
|
53
|
+
return r ? (t.onExpandChange && t.onExpandChange({
|
|
54
|
+
item: r.node,
|
|
55
|
+
itemHierarchicalIndex: r.path,
|
|
67
56
|
nativeEvent: null,
|
|
68
57
|
target: null,
|
|
69
58
|
syntheticEvent: null
|
|
70
59
|
}), { content: [{ type: "text", text: `Collapsed node "${e}".` }] }) : { content: [{ type: "text", text: `Node "${e}" not found.` }], isError: !0 };
|
|
71
60
|
}
|
|
72
|
-
function M(
|
|
73
|
-
const e =
|
|
61
|
+
function M(c, n) {
|
|
62
|
+
const e = c.nodeText;
|
|
74
63
|
if (!e)
|
|
75
64
|
return { content: [{ type: "text", text: "Missing required argument: nodeText" }], isError: !0 };
|
|
76
|
-
const t = n.current, a = t.textField || "text",
|
|
77
|
-
if (!
|
|
65
|
+
const t = n.current, a = t.textField || "text", i = t.childrenField || "items", o = t.data;
|
|
66
|
+
if (!o)
|
|
78
67
|
return { content: [{ type: "text", text: "TreeView has no data." }] };
|
|
79
|
-
const
|
|
80
|
-
return
|
|
81
|
-
item:
|
|
82
|
-
itemHierarchicalIndex:
|
|
68
|
+
const r = h(o, e, a, i);
|
|
69
|
+
return r ? (t.onItemClick && t.onItemClick({
|
|
70
|
+
item: r.node,
|
|
71
|
+
itemHierarchicalIndex: r.path,
|
|
83
72
|
nativeEvent: null,
|
|
84
73
|
target: null,
|
|
85
74
|
syntheticEvent: null
|
|
86
75
|
}), { content: [{ type: "text", text: `Selected node "${e}".` }] }) : { content: [{ type: "text", text: `Node "${e}" not found.` }], isError: !0 };
|
|
87
76
|
}
|
|
88
|
-
function k(
|
|
89
|
-
switch (
|
|
90
|
-
case
|
|
91
|
-
return
|
|
92
|
-
case
|
|
77
|
+
function k(c, n, e) {
|
|
78
|
+
switch (c) {
|
|
79
|
+
case u.Expand:
|
|
80
|
+
return _(n, e);
|
|
81
|
+
case u.Collapse:
|
|
93
82
|
return I(n, e);
|
|
94
|
-
case
|
|
83
|
+
case u.Select:
|
|
95
84
|
return M(n, e);
|
|
96
85
|
default:
|
|
97
|
-
return { content: [{ type: "text", text: `Unknown command: ${
|
|
86
|
+
return { content: [{ type: "text", text: `Unknown command: ${c}` }], isError: !0 };
|
|
98
87
|
}
|
|
99
88
|
}
|
|
100
|
-
const
|
|
89
|
+
const L = {
|
|
101
90
|
componentSuffix: "treeview",
|
|
102
|
-
createTools(
|
|
103
|
-
const a = [],
|
|
91
|
+
createTools(c, n, e, t) {
|
|
92
|
+
const a = [], i = (d) => `${e.groupName}_${d}`, o = n.current, r = [
|
|
104
93
|
{
|
|
105
94
|
name: "expand_node",
|
|
106
95
|
description: `Expand a node in the ${e.dataName} treeview`,
|
|
107
|
-
commandType:
|
|
108
|
-
enabled: !!
|
|
96
|
+
commandType: u.Expand,
|
|
97
|
+
enabled: !!o.onExpandChange
|
|
109
98
|
},
|
|
110
99
|
{
|
|
111
100
|
name: "collapse_node",
|
|
112
101
|
description: `Collapse a node in the ${e.dataName} treeview`,
|
|
113
|
-
commandType:
|
|
114
|
-
enabled: !!
|
|
102
|
+
commandType: u.Collapse,
|
|
103
|
+
enabled: !!o.onExpandChange
|
|
115
104
|
},
|
|
116
105
|
{
|
|
117
106
|
name: "select_node",
|
|
118
107
|
description: `Select a node in the ${e.dataName} treeview`,
|
|
119
|
-
commandType:
|
|
120
|
-
enabled: !!
|
|
108
|
+
commandType: u.Select,
|
|
109
|
+
enabled: !!o.onItemClick
|
|
121
110
|
}
|
|
122
|
-
],
|
|
123
|
-
|
|
124
|
-
a.push(
|
|
125
|
-
t.registerTool({
|
|
126
|
-
name: r("get_structure"),
|
|
127
|
-
description: `Get the tree structure of the ${e.dataName} treeview as JSON.`,
|
|
128
|
-
inputSchema: { type: "object", properties: {}, required: [] },
|
|
129
|
-
async execute() {
|
|
130
|
-
const i = n.current, u = i.textField || "text", l = i.childrenField || "items", y = i.expandField || "expanded", T = i.selectField || "selected", x = i.data;
|
|
131
|
-
if (!x || x.length === 0)
|
|
132
|
-
return { content: [{ type: "text", text: "TreeView has no data." }] };
|
|
133
|
-
const p = S(
|
|
134
|
-
x,
|
|
135
|
-
u,
|
|
136
|
-
l,
|
|
137
|
-
y,
|
|
138
|
-
T
|
|
139
|
-
);
|
|
140
|
-
return { content: [{ type: "text", text: JSON.stringify(p, null, 2) }] };
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
);
|
|
144
|
-
} catch {
|
|
145
|
-
}
|
|
146
|
-
if (c.onFilterChange)
|
|
111
|
+
], s = n.current.webMcp, x = typeof s == "object" && s !== null && typeof s.tools == "function" ? s.tools : void 0, F = x ? x(r, { tname: i }) : r, N = async (d, l) => k(d, l, n);
|
|
112
|
+
if (o.onFilterChange)
|
|
147
113
|
try {
|
|
148
114
|
a.push(
|
|
149
115
|
t.registerTool({
|
|
150
|
-
name:
|
|
116
|
+
name: i("search"),
|
|
151
117
|
description: `Search for nodes matching a text pattern in the ${e.dataName} treeview.`,
|
|
152
118
|
inputSchema: {
|
|
153
119
|
type: "object",
|
|
@@ -156,30 +122,30 @@ const J = {
|
|
|
156
122
|
},
|
|
157
123
|
required: ["query"]
|
|
158
124
|
},
|
|
159
|
-
async execute(
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
125
|
+
async execute(d) {
|
|
126
|
+
const l = (d.query || "").toLowerCase();
|
|
127
|
+
if (!l)
|
|
162
128
|
return {
|
|
163
129
|
content: [{ type: "text", text: "Missing required argument: query" }],
|
|
164
130
|
isError: !0
|
|
165
131
|
};
|
|
166
|
-
const
|
|
167
|
-
if (!
|
|
132
|
+
const p = n.current, y = p.textField || "text", S = p.childrenField || "items", g = p.data;
|
|
133
|
+
if (!g)
|
|
168
134
|
return { content: [{ type: "text", text: "TreeView has no data." }] };
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
typeof
|
|
173
|
-
const
|
|
174
|
-
|
|
135
|
+
const m = [], E = (q, C) => {
|
|
136
|
+
q.forEach(($, w) => {
|
|
137
|
+
const v = C ? `${C}_${w}` : `${w}`, f = $[y] || "";
|
|
138
|
+
typeof f == "string" && f.toLowerCase().includes(l) && m.push({ text: f, path: v });
|
|
139
|
+
const T = $[S];
|
|
140
|
+
T && Array.isArray(T) && E(T, v);
|
|
175
141
|
});
|
|
176
142
|
};
|
|
177
|
-
return
|
|
143
|
+
return E(g, ""), m.length === 0 ? { content: [{ type: "text", text: `No nodes matching "${l}".` }] } : {
|
|
178
144
|
content: [
|
|
179
145
|
{
|
|
180
146
|
type: "text",
|
|
181
|
-
text: `${
|
|
182
|
-
${JSON.stringify(
|
|
147
|
+
text: `${m.length} match(es):
|
|
148
|
+
${JSON.stringify(m, null, 2)}`
|
|
183
149
|
}
|
|
184
150
|
]
|
|
185
151
|
};
|
|
@@ -188,17 +154,17 @@ ${JSON.stringify(p, null, 2)}`
|
|
|
188
154
|
);
|
|
189
155
|
} catch {
|
|
190
156
|
}
|
|
191
|
-
for (const
|
|
192
|
-
if (!
|
|
157
|
+
for (const d of F) {
|
|
158
|
+
if (!d.enabled)
|
|
193
159
|
continue;
|
|
194
|
-
const
|
|
160
|
+
const l = b(d.commandType), p = d.commandType;
|
|
195
161
|
try {
|
|
196
162
|
a.push(
|
|
197
163
|
t.registerTool({
|
|
198
|
-
name:
|
|
199
|
-
description:
|
|
200
|
-
inputSchema:
|
|
201
|
-
execute: async (y) =>
|
|
164
|
+
name: i(d.name),
|
|
165
|
+
description: d.description,
|
|
166
|
+
inputSchema: l,
|
|
167
|
+
execute: async (y) => N(p, y || {})
|
|
202
168
|
})
|
|
203
169
|
);
|
|
204
170
|
} catch {
|
|
@@ -208,5 +174,5 @@ ${JSON.stringify(p, null, 2)}`
|
|
|
208
174
|
}
|
|
209
175
|
};
|
|
210
176
|
export {
|
|
211
|
-
|
|
177
|
+
L as treeViewAdapter
|
|
212
178
|
};
|
package/adapters/window.d.ts
CHANGED
package/adapters/window.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../commands/window.js")
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../commands/window.js"),h={componentSuffix:"window",createTools(C,i,o,w){const d=[],p=e=>`${o.groupName}_${e}`,s=i.current,m=[{name:"minimize",description:`Minimize the ${o.dataName} window`,commandType:n.WindowCommands.Minimize,enabled:!!s.onStageChange},{name:"maximize",description:`Maximize the ${o.dataName} window`,commandType:n.WindowCommands.Maximize,enabled:!!s.onStageChange},{name:"restore",description:`Restore the ${o.dataName} window to its default size`,commandType:n.WindowCommands.Restore,enabled:!!s.onStageChange}],a=i.current.webMcp,c=typeof a=="object"&&a!==null&&typeof a.tools=="function"?a.tools:void 0,l=c?c(m):m,u=async(e,r)=>{const t=i.current;switch(e){case n.WindowCommands.Minimize:return t.onStageChange&&t.onStageChange({state:"MINIMIZED"}),{content:[{type:"text",text:"Window minimized."}]};case n.WindowCommands.Maximize:return t.onStageChange&&t.onStageChange({state:"MAXIMIZED"}),{content:[{type:"text",text:"Window maximized."}]};case n.WindowCommands.Restore:return t.onStageChange&&t.onStageChange({state:"DEFAULT"}),{content:[{type:"text",text:"Window restored."}]};default:return{content:[{type:"text",text:`Unknown command: ${e}`}],isError:!0}}};for(const e of l){if(!e.enabled)continue;const r=n.getWindowToolSchema(e.commandType),t=e.commandType;try{d.push(w.registerTool({name:p(e.name),description:e.description,inputSchema:r,execute:async g=>u(t,g||{})}))}catch{}}return d}};exports.windowAdapter=h;
|
package/adapters/window.mjs
CHANGED
|
@@ -5,93 +5,59 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { WindowCommands as n, getWindowToolSchema as
|
|
9
|
-
function o(m, i) {
|
|
10
|
-
const a = m[i];
|
|
11
|
-
if (typeof a == "function")
|
|
12
|
-
return a;
|
|
13
|
-
const s = m.webMcp;
|
|
14
|
-
if (typeof s == "object" && s !== null && typeof s[i] == "function")
|
|
15
|
-
return s[i];
|
|
16
|
-
}
|
|
8
|
+
import { WindowCommands as n, getWindowToolSchema as h } from "../commands/window.mjs";
|
|
17
9
|
const C = {
|
|
18
10
|
componentSuffix: "window",
|
|
19
|
-
createTools(
|
|
20
|
-
const
|
|
21
|
-
{
|
|
22
|
-
name: "open",
|
|
23
|
-
description: `Open the ${a.dataName} window`,
|
|
24
|
-
commandType: n.Open,
|
|
25
|
-
enabled: !!o(r, "onOpen")
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "close",
|
|
29
|
-
description: `Close the ${a.dataName} window`,
|
|
30
|
-
commandType: n.Close,
|
|
31
|
-
enabled: !!o(r, "onClose")
|
|
32
|
-
},
|
|
11
|
+
createTools(x, i, o, p) {
|
|
12
|
+
const s = [], g = (e) => `${o.groupName}_${e}`, c = i.current, m = [
|
|
33
13
|
{
|
|
34
14
|
name: "minimize",
|
|
35
|
-
description: `Minimize the ${
|
|
15
|
+
description: `Minimize the ${o.dataName} window`,
|
|
36
16
|
commandType: n.Minimize,
|
|
37
|
-
enabled: !!
|
|
17
|
+
enabled: !!c.onStageChange
|
|
38
18
|
},
|
|
39
19
|
{
|
|
40
20
|
name: "maximize",
|
|
41
|
-
description: `Maximize the ${
|
|
21
|
+
description: `Maximize the ${o.dataName} window`,
|
|
42
22
|
commandType: n.Maximize,
|
|
43
|
-
enabled: !!
|
|
23
|
+
enabled: !!c.onStageChange
|
|
44
24
|
},
|
|
45
25
|
{
|
|
46
26
|
name: "restore",
|
|
47
|
-
description: `Restore the ${
|
|
27
|
+
description: `Restore the ${o.dataName} window to its default size`,
|
|
48
28
|
commandType: n.Restore,
|
|
49
|
-
enabled: !!
|
|
29
|
+
enabled: !!c.onStageChange
|
|
50
30
|
}
|
|
51
|
-
],
|
|
52
|
-
const
|
|
53
|
-
switch (
|
|
54
|
-
case n.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
case n.
|
|
59
|
-
|
|
60
|
-
return e && e({}), { content: [{ type: "text", text: "Window closed." }] };
|
|
61
|
-
}
|
|
62
|
-
case n.Minimize: {
|
|
63
|
-
const e = o(c, "onStageChange");
|
|
64
|
-
return e && e({ state: "MINIMIZED" }), { content: [{ type: "text", text: "Window minimized." }] };
|
|
65
|
-
}
|
|
66
|
-
case n.Maximize: {
|
|
67
|
-
const e = o(c, "onStageChange");
|
|
68
|
-
return e && e({ state: "MAXIMIZED" }), { content: [{ type: "text", text: "Window maximized." }] };
|
|
69
|
-
}
|
|
70
|
-
case n.Restore: {
|
|
71
|
-
const e = o(c, "onStageChange");
|
|
72
|
-
return e && e({ state: "DEFAULT" }), { content: [{ type: "text", text: "Window restored." }] };
|
|
73
|
-
}
|
|
31
|
+
], a = i.current.webMcp, r = typeof a == "object" && a !== null && typeof a.tools == "function" ? a.tools : void 0, l = r ? r(m) : m, u = async (e, d) => {
|
|
32
|
+
const t = i.current;
|
|
33
|
+
switch (e) {
|
|
34
|
+
case n.Minimize:
|
|
35
|
+
return t.onStageChange && t.onStageChange({ state: "MINIMIZED" }), { content: [{ type: "text", text: "Window minimized." }] };
|
|
36
|
+
case n.Maximize:
|
|
37
|
+
return t.onStageChange && t.onStageChange({ state: "MAXIMIZED" }), { content: [{ type: "text", text: "Window maximized." }] };
|
|
38
|
+
case n.Restore:
|
|
39
|
+
return t.onStageChange && t.onStageChange({ state: "DEFAULT" }), { content: [{ type: "text", text: "Window restored." }] };
|
|
74
40
|
default:
|
|
75
|
-
return { content: [{ type: "text", text: `Unknown command: ${
|
|
41
|
+
return { content: [{ type: "text", text: `Unknown command: ${e}` }], isError: !0 };
|
|
76
42
|
}
|
|
77
43
|
};
|
|
78
|
-
for (const
|
|
79
|
-
if (!
|
|
44
|
+
for (const e of l) {
|
|
45
|
+
if (!e.enabled)
|
|
80
46
|
continue;
|
|
81
|
-
const
|
|
47
|
+
const d = h(e.commandType), t = e.commandType;
|
|
82
48
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
name: g(
|
|
86
|
-
description:
|
|
87
|
-
inputSchema:
|
|
88
|
-
execute: async (
|
|
49
|
+
s.push(
|
|
50
|
+
p.registerTool({
|
|
51
|
+
name: g(e.name),
|
|
52
|
+
description: e.description,
|
|
53
|
+
inputSchema: d,
|
|
54
|
+
execute: async (w) => u(t, w || {})
|
|
89
55
|
})
|
|
90
56
|
);
|
|
91
57
|
} catch {
|
|
92
58
|
}
|
|
93
59
|
}
|
|
94
|
-
return
|
|
60
|
+
return s;
|
|
95
61
|
}
|
|
96
62
|
};
|
|
97
63
|
export {
|
package/commands/form.d.ts
CHANGED
|
@@ -14,7 +14,10 @@ export declare const FormCommands: {
|
|
|
14
14
|
* Fills one or more form fields with the specified values.
|
|
15
15
|
*
|
|
16
16
|
* Parameters:
|
|
17
|
-
* - `values` *(object,
|
|
17
|
+
* - `values` *(object, recommended)* — Key-value pairs of field names to values.
|
|
18
|
+
*
|
|
19
|
+
* The command also accepts a flat object payload where field names are passed directly
|
|
20
|
+
* as top-level properties (for example `{ firstName: 'John' }`).
|
|
18
21
|
*/
|
|
19
22
|
readonly Fill: "FormFill";
|
|
20
23
|
/**
|
package/commands/form.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../schemas/common.js"),e={Fill:"FormFill",Validate:"FormValidate",Submit:"FormSubmit",Reset:"FormReset"};function
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../schemas/common.js"),e={Fill:"FormFill",Validate:"FormValidate",Submit:"FormSubmit",Reset:"FormReset"};function i(r,t){switch(r){case e.Fill:return{type:"object",properties:{values:{type:"object",description:`Key-value pairs of field names to values.${t&&t.length>0?` Available fields: ${t.join(", ")}.`:""}`}},additionalProperties:!0,description:"Provide either a `values` object, or pass field/value pairs directly as top-level properties."};case e.Validate:case e.Submit:case e.Reset:return o.getEmptySchema();default:return o.getEmptySchema()}}exports.FormCommands=e;exports.getFormToolSchema=i;
|