@openbkn/workshop 0.2.2-rc.5 → 0.2.2
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/README.md +83 -13
- package/component.d.ts +10 -0
- package/dist/ActionConfirm-DJ91X3ml.js +236 -0
- package/dist/ActionFailure-ZgPt_3B-.js +37 -0
- package/dist/AgentChat-CRYai8ge.js +1062 -0
- package/dist/AppFormModal-D73ucaHK.js +4282 -0
- package/dist/AppListPage-D87piiOw.js +1364 -0
- package/dist/AskDrawer-BUMYsRnt.js +38 -0
- package/dist/ComputedView-CgYrDbx1.js +3221 -0
- package/dist/ConclusionApply-sjGfoEBY.js +153 -0
- package/dist/CypherEditor-lus6FA5L.js +485 -0
- package/dist/LandingList-6JI6864C.js +230 -0
- package/dist/MenuUnfoldOutlined-Cdg24l2h.js +27 -0
- package/dist/ModelTrial-ClHFGTpQ.js +359 -0
- package/dist/PageRenderer-DBd_g6mN.js +85480 -0
- package/dist/README-DjRyTQSR.js +76 -0
- package/dist/ScenarioApply-DtW_hh47.js +590 -0
- package/dist/SimulateForm-C-i08Jjd.js +153 -0
- package/dist/Subgraph-CnrkH9AN.js +32586 -0
- package/dist/WorkshopLabPage-DiVXQL9e.js +11364 -0
- package/dist/WorkshopRunPage-6hjRUf64.js +253 -0
- package/dist/abnfDiagram-WEYOIA3C-beRNhN3c.js +87 -0
- package/dist/action-type-tool.service-B2B74fKC.js +1060 -0
- package/dist/actionButton-DA5CNEzx.js +94 -0
- package/dist/actionButton.en-US-qjeqA7hs.js +94 -0
- package/dist/agentChat-EoDznd58.js +116 -0
- package/dist/agentChat.en-US-B6-pFd9Y.js +116 -0
- package/dist/alertList-DqditwM8.js +84 -0
- package/dist/alertList.en-US-BAXAgltP.js +84 -0
- package/dist/architectureDiagram-ZHVYKT53-DY2l1qxx.js +4779 -0
- package/dist/asOfSlider-QPvHWUMV.js +83 -0
- package/dist/asOfSlider.en-US-BI4jVfSn.js +83 -0
- package/dist/bkn-agent-execution.service-DVh-SHyl.js +205 -0
- package/dist/blockDiagram-RJAE7QA3-DR0mjN2h.js +1435 -0
- package/dist/c4Diagram-XDPPPE54-DH5zsGug.js +1518 -0
- package/dist/channel-B034hcOF.js +5 -0
- package/dist/china-C6m7zXIv.js +9 -0
- package/dist/chunk-2E7WHVMD-Ba3svxgx.js +664 -0
- package/dist/chunk-2Q5K7J3B-rT4eU6_y.js +15 -0
- package/dist/chunk-4EMNKR2T-C1kQZYHK.js +262 -0
- package/dist/chunk-55XCU76K-dcpLOktb.js +68 -0
- package/dist/chunk-5VM5RSS4-BdpQuzmO.js +19 -0
- package/dist/chunk-JWPE2WC7-CDBrSjU7.js +8 -0
- package/dist/chunk-VQ5W62QI-BiVKc40w.js +19 -0
- package/dist/chunk-XXDRQBXY-CPYrcdVW.js +8 -0
- package/dist/chunk-ZCHMQSOR-BG8OLpvb.js +451 -0
- package/dist/classDiagram-v2-4MYWR3UA-DqbpQpwI.js +1564 -0
- package/dist/component.d-DFoMKuUv.js +179 -0
- package/dist/cose-bilkent-JH36ORCC-CdXk4sPf.js +2609 -0
- package/dist/customComponents-DasaZ6pq.js +4 -0
- package/dist/customComponents.en-US-CkabuCXg.js +79 -0
- package/dist/customParseFormat-C0uLEpdq.js +182 -0
- package/dist/cynefin-EF2NZ3EQ-D7MVnMHu.js +21746 -0
- package/dist/cynefinDiagram-WF24UDRP-BYT_KpDL.js +299 -0
- package/dist/cytoscape.esm-BCV9V6aO.js +18760 -0
- package/dist/d3-scale-DA8IHmf0.js +1841 -0
- package/dist/dagre-NK4GIZVX-l-ghPdM8.js +2154 -0
- package/dist/dateRange-BbkLMg8L.js +79 -0
- package/dist/dateRange.en-US-CV12Q02G.js +79 -0
- package/dist/dayjs.min-DZ-YV8Mv.js +284 -0
- package/dist/diagram-CBK3MWTC-Bt3HiwvA.js +542 -0
- package/dist/diagram-I5XIIV2D-DcbqfBjx.js +150 -0
- package/dist/diagram-ODIL2UCW-9PC1n3n5.js +346 -0
- package/dist/diagram-PFBEJUXE-DGhr2kc7.js +478 -0
- package/dist/diagram-RJA3I4VV-DwzpOjZ_.js +219 -0
- package/dist/diagram-TYUNFSNR-B3Bd3TDU.js +2583 -0
- package/dist/dropdownFilter-DOi_8-ZT.js +76 -0
- package/dist/dropdownFilter.en-US-BiXpvXtF.js +76 -0
- package/dist/ebnfDiagram-V4P3TTPT-E5NN2oKc.js +109 -0
- package/dist/elk-QONTBCTQ-dFjcujl_.js +49170 -0
- package/dist/erDiagram-KYQIGQAA-BMrasBzB.js +1061 -0
- package/dist/eventList-CnsAwfDS.js +115 -0
- package/dist/eventList.en-US-Cof3rCLq.js +115 -0
- package/dist/eventReport-XS-HegnH.js +76 -0
- package/dist/eventReport.en-US-DTx4vzWT.js +76 -0
- package/dist/flowDiagram-IUGLLWBU-BGIBH0q0.js +1769 -0
- package/dist/ganttChart-DEeSvTJA.js +77 -0
- package/dist/ganttChart.en-US-SwRKrnoD.js +77 -0
- package/dist/ganttDiagram-R7GPNTJY-C0tb1Lpp.js +1741 -0
- package/dist/generateCypher-Ch9_lQa6.js +399 -0
- package/dist/gitGraphDiagram-PDYL7XHY-DBqcOa-c.js +815 -0
- package/dist/graph-CKJmgLki.js +1541 -0
- package/dist/index-BA-GzCXt.js +441 -0
- package/dist/infoDiagram-MVDRKAX5-Bwuki4JA.js +24 -0
- package/dist/ishikawaDiagram-HPEHV2GE-Dz4d6ygx.js +622 -0
- package/dist/journeyDiagram-BOSHW7O7-C99m34Bb.js +834 -0
- package/dist/kanban-definition-FNSA4HC5-mdqjODsT.js +724 -0
- package/dist/katex-BsrBVQKd.js +11314 -0
- package/dist/manifest-BjV1PJ6u.js +41 -0
- package/dist/mermaid.core-yQghUlIz.js +17642 -0
- package/dist/metricCards-CSb-_cT2.js +104 -0
- package/dist/metricCards.en-US-BLLhRsQU.js +104 -0
- package/dist/mindmap-definition-6OY57UG3-BZhO2wX4.js +834 -0
- package/dist/modelTrial-Bvb-RhGt.js +137 -0
- package/dist/modelTrial.en-US-DYcuor-G.js +137 -0
- package/dist/models-DekiCOuZ.js +6 -0
- package/dist/object-metric-numeric-vs3BeDkH.js +42 -0
- package/dist/object-metric.service-flZgBMRX.js +233 -0
- package/dist/objectDetail-SQUbp4Py.js +117 -0
- package/dist/objectDetail.en-US-DW3mlONM.js +117 -0
- package/dist/objectList-D99wPtJH.js +97 -0
- package/dist/objectList.en-US-PBBNyVLW.js +97 -0
- package/dist/objectTable-0jsFFMN3.js +127 -0
- package/dist/objectTable.en-US-yWEs8qc_.js +127 -0
- package/dist/pegDiagram-ECIUJNBX-BDa5RfZt.js +95 -0
- package/dist/pieDiagram-GNMPY74T-DNVtzXPv.js +165 -0
- package/dist/pivotTable-CHmQw18-.js +102 -0
- package/dist/pivotTable.en-US-B4uv4P08.js +102 -0
- package/dist/prompt-DYrjlEFr.js +373 -0
- package/dist/quadrantDiagram-D57K4MC3-vK0f2OvQ.js +1023 -0
- package/dist/railroadDiagram-Y72NRBL7-j6ZrTmRp.js +77 -0
- package/dist/regionMap-Cme-JyV_.js +128 -0
- package/dist/regionMap.en-US-Bwr2_p32.js +128 -0
- package/dist/requirementDiagram-EQYSW5RA-DgfEyljA.js +886 -0
- package/dist/sankeyDiagram-SY24JHO5-CImx-IX0.js +1160 -0
- package/dist/scenarioBar-BV43p7n-.js +122 -0
- package/dist/scenarioBar.en-US-5KqMQ2Bg.js +122 -0
- package/dist/scheduleGantt-CTYO-zYP.js +180 -0
- package/dist/scheduleGantt.en-US-hE7mvVUW.js +180 -0
- package/dist/searchBox-Ca7w0f_6.js +67 -0
- package/dist/searchBox.en-US-ArS_XBvB.js +67 -0
- package/dist/segmentedFilter-MhjVcWo0.js +80 -0
- package/dist/segmentedFilter.en-US-BxNrQO5T.js +80 -0
- package/dist/sequenceDiagram-BLEHNHQU-nWmjd1ci.js +2969 -0
- package/dist/sizeCapture-INFHLROL-D3jlbt7h.js +46 -0
- package/dist/stageChain-BxBafwjD.js +74 -0
- package/dist/stageChain.en-US-CP0G27n8.js +74 -0
- package/dist/stateDiagram-v2-A6IESKWZ-DG1ZetEu.js +1514 -0
- package/dist/subgraph-7n4SwliR.js +71 -0
- package/dist/subgraph.en-US-BNvY18IW.js +71 -0
- package/dist/swimlanes-B3ENRKFQ-cCmJE8AU.js +4991 -0
- package/dist/swimlanesDiagram-AYQRV4AK-CtuhyguU.js +14 -0
- package/dist/taskInbox-DGWYeI2b.js +118 -0
- package/dist/taskInbox.en-US-B-OzDmVl.js +118 -0
- package/dist/text-BqSVQKS6.js +78 -0
- package/dist/text.en-US-BhAxy_LE.js +78 -0
- package/dist/timeline-definition-JXYKGLGB-Cc-INsOv.js +1057 -0
- package/dist/trendChart-BjEeRS5_.js +135 -0
- package/dist/trendChart.en-US-BBGqWUKM.js +135 -0
- package/dist/useLabData-Df-jEHKs.js +20470 -0
- package/dist/usecaseDiagram-WPOLBNNX-r8wVjopm.js +7920 -0
- package/dist/vennDiagram-Q3Y3IDCW-BZiOcgrj.js +1579 -0
- package/dist/wardleyDiagram-IVAIDKWA-16jd07C_.js +675 -0
- package/dist/workshop-app-DnHNjBqy.js +86038 -0
- package/dist/workshop-app.css +1 -0
- package/dist/workshop-app.js +4 -0
- package/dist/world-Djau1JyJ.js +9 -0
- package/dist/xychartDiagram-4URNHDU4-C8DwWQNh.js +1460 -0
- package/dist-cli/workshop.js +341 -218
- package/example/host.js +109 -0
- package/example/index.html +93 -0
- package/example/server.mjs +237 -0
- package/index.d.ts +48 -0
- package/lib/validate.js +47 -1
- package/package.json +17 -5
- package/runtime/frame-runtime.js +13 -1
- package/workshop-component.js +32 -12
- package/workshop.js +2 -0
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
import { n as c, ai as D, aj as S, ak as m } from "./workshop-app-DnHNjBqy.js";
|
|
2
|
+
const L = "item";
|
|
3
|
+
function u(e) {
|
|
4
|
+
return typeof e == "object" && e !== null && !Array.isArray(e) ? e : null;
|
|
5
|
+
}
|
|
6
|
+
function I(e) {
|
|
7
|
+
return u(e);
|
|
8
|
+
}
|
|
9
|
+
function R(e) {
|
|
10
|
+
const t = u(e), o = t ? u(t["application/json"]) : null;
|
|
11
|
+
return o ? I(o.schema) : null;
|
|
12
|
+
}
|
|
13
|
+
function z(e, t, o) {
|
|
14
|
+
const r = typeof t.type == "string" && t.type ? t.type : "string", s = {
|
|
15
|
+
name: e,
|
|
16
|
+
type: r,
|
|
17
|
+
description: t.description,
|
|
18
|
+
required: o
|
|
19
|
+
};
|
|
20
|
+
if (r === "object") {
|
|
21
|
+
const a = T(t);
|
|
22
|
+
return a.length > 0 && (s.sub_parameters = a), s;
|
|
23
|
+
}
|
|
24
|
+
if (r === "array") {
|
|
25
|
+
const a = I(t.items);
|
|
26
|
+
a && (s.sub_parameters = [z(L, a, !0)]);
|
|
27
|
+
}
|
|
28
|
+
return s;
|
|
29
|
+
}
|
|
30
|
+
function T(e) {
|
|
31
|
+
const t = e ? u(e.properties) : null;
|
|
32
|
+
if (!t)
|
|
33
|
+
return [];
|
|
34
|
+
const o = new Set(Array.isArray(e?.required) ? e.required : []);
|
|
35
|
+
return Object.entries(t).flatMap(([r, s]) => {
|
|
36
|
+
const a = I(s);
|
|
37
|
+
return a ? [z(r, a, o.has(r))] : [];
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function K(e) {
|
|
41
|
+
if (typeof e == "string")
|
|
42
|
+
try {
|
|
43
|
+
return u(JSON.parse(e));
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return u(e);
|
|
48
|
+
}
|
|
49
|
+
function J(e) {
|
|
50
|
+
const t = e.responses;
|
|
51
|
+
if (!Array.isArray(t))
|
|
52
|
+
return null;
|
|
53
|
+
const o = t.map(u).find((a) => a !== null && String(a.status_code) === "200"), r = o ? R(o.content) : null, s = r ? u(r.properties) : null;
|
|
54
|
+
return s ? I(s.result) : null;
|
|
55
|
+
}
|
|
56
|
+
function X(e) {
|
|
57
|
+
const t = K(e);
|
|
58
|
+
if (!t)
|
|
59
|
+
return {};
|
|
60
|
+
const o = u(t.request_body), r = T(o ? R(o.content) : null), s = T(J(t));
|
|
61
|
+
return {
|
|
62
|
+
inputs: r.length > 0 ? r : void 0,
|
|
63
|
+
outputs: s.length > 0 ? s : void 0
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function h(e) {
|
|
67
|
+
return typeof e == "object" && e !== null && typeof e.openapi == "string";
|
|
68
|
+
}
|
|
69
|
+
function G(e) {
|
|
70
|
+
if (!e.api_spec)
|
|
71
|
+
return;
|
|
72
|
+
const t = typeof e.api_spec == "string" ? JSON.parse(e.api_spec) : e.api_spec, o = t;
|
|
73
|
+
if (h(o))
|
|
74
|
+
return JSON.stringify(o, null, 2);
|
|
75
|
+
const r = e.path ?? "/", s = (e.method ?? "POST").toLowerCase(), a = e.summary ?? e.description ?? "Tool", p = e.description ?? a, n = e.server_url ?? "http://localhost:8080", i = {
|
|
76
|
+
summary: a,
|
|
77
|
+
description: p
|
|
78
|
+
};
|
|
79
|
+
t.parameters?.length && (i.parameters = t.parameters), t.request_body?.content && (i.requestBody = {
|
|
80
|
+
description: t.request_body.description ?? "",
|
|
81
|
+
required: t.request_body.required ?? !1,
|
|
82
|
+
content: t.request_body.content
|
|
83
|
+
});
|
|
84
|
+
const l = {};
|
|
85
|
+
for (const _ of t.responses ?? [])
|
|
86
|
+
_.status_code && (l[_.status_code] = {
|
|
87
|
+
description: _.description ?? "OK",
|
|
88
|
+
..._.content ? { content: _.content } : {}
|
|
89
|
+
});
|
|
90
|
+
Object.keys(l).length === 0 && (l[200] = {
|
|
91
|
+
description: "OK",
|
|
92
|
+
content: {
|
|
93
|
+
"application/json": {
|
|
94
|
+
schema: { type: "object" }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}), i.responses = l;
|
|
98
|
+
const d = {
|
|
99
|
+
openapi: "3.0.3",
|
|
100
|
+
info: {
|
|
101
|
+
title: a,
|
|
102
|
+
description: p,
|
|
103
|
+
version: "1.0.0"
|
|
104
|
+
},
|
|
105
|
+
servers: [{ url: n }],
|
|
106
|
+
paths: {
|
|
107
|
+
[r]: {
|
|
108
|
+
[s]: i
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
return t.components?.schemas && Object.keys(t.components.schemas).length > 0 && (d.components = t.components), JSON.stringify(d, null, 2);
|
|
113
|
+
}
|
|
114
|
+
function Y(e) {
|
|
115
|
+
if (e?.api_spec) {
|
|
116
|
+
if (typeof e.api_spec == "string")
|
|
117
|
+
try {
|
|
118
|
+
const t = JSON.parse(e.api_spec);
|
|
119
|
+
if (h(t))
|
|
120
|
+
return JSON.stringify(t, null, 2);
|
|
121
|
+
} catch {
|
|
122
|
+
return e.api_spec;
|
|
123
|
+
}
|
|
124
|
+
return h(e.api_spec) ? JSON.stringify(e.api_spec, null, 2) : G(e);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function H(e) {
|
|
128
|
+
return e === "python" || e === "cypher" ? e : void 0;
|
|
129
|
+
}
|
|
130
|
+
function V(e) {
|
|
131
|
+
const t = e?.function_content;
|
|
132
|
+
if (!t?.code)
|
|
133
|
+
return;
|
|
134
|
+
const o = X(e?.api_spec), r = H(t.script_type);
|
|
135
|
+
return r === "cypher" ? {
|
|
136
|
+
code: t.code,
|
|
137
|
+
script_type: "cypher",
|
|
138
|
+
kn_id: t.kn_id ?? "",
|
|
139
|
+
result_shape: t.result_shape === "table" ? "table" : "value",
|
|
140
|
+
inputs: t.inputs?.length ? t.inputs : o.inputs,
|
|
141
|
+
outputs: [],
|
|
142
|
+
dependencies: []
|
|
143
|
+
} : {
|
|
144
|
+
code: t.code,
|
|
145
|
+
script_type: r,
|
|
146
|
+
dependencies: t.dependencies,
|
|
147
|
+
inputs: t.inputs?.length ? t.inputs : o.inputs,
|
|
148
|
+
outputs: t.outputs?.length ? t.outputs : o.outputs
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function f(e) {
|
|
152
|
+
if (!(e == null || e === 0))
|
|
153
|
+
return e > 1e15 ? Math.floor(e / 1e6) : e;
|
|
154
|
+
}
|
|
155
|
+
const M = "/agent-operator-integration/v1";
|
|
156
|
+
function U(e) {
|
|
157
|
+
return {
|
|
158
|
+
toolId: e.tool_id,
|
|
159
|
+
name: e.name ?? e.tool_id,
|
|
160
|
+
description: e.description,
|
|
161
|
+
status: e.status ?? "disabled",
|
|
162
|
+
metadataType: e.metadata_type,
|
|
163
|
+
useRule: e.use_rule,
|
|
164
|
+
serverUrl: typeof e.metadata == "object" && e.metadata && "server_url" in e.metadata ? String(e.metadata.server_url ?? "") : void 0,
|
|
165
|
+
path: typeof e.metadata == "object" && e.metadata && "path" in e.metadata ? String(e.metadata.path ?? "") : void 0,
|
|
166
|
+
method: typeof e.metadata == "object" && e.metadata && "method" in e.metadata ? String(e.metadata.method ?? "") : void 0,
|
|
167
|
+
// List endpoints also return metadata.api_spec, so input/output can be calculated without loading each detail.
|
|
168
|
+
ioSpec: D(e.metadata),
|
|
169
|
+
createTime: f(e.create_time),
|
|
170
|
+
updateTime: f(e.update_time),
|
|
171
|
+
createUser: e.create_user,
|
|
172
|
+
createUserName: e.create_user_name,
|
|
173
|
+
updateUser: e.update_user,
|
|
174
|
+
updateUserName: e.update_user_name
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function W(e) {
|
|
178
|
+
if (!(!e?.name || !e.description || !e.in || !e.type))
|
|
179
|
+
return {
|
|
180
|
+
name: e.name,
|
|
181
|
+
description: e.description,
|
|
182
|
+
required: e.required,
|
|
183
|
+
in: e.in,
|
|
184
|
+
type: e.type,
|
|
185
|
+
value: e.value
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function Z(e) {
|
|
189
|
+
const t = e.metadata;
|
|
190
|
+
return {
|
|
191
|
+
...U(e),
|
|
192
|
+
apiSpec: t?.api_spec,
|
|
193
|
+
openapiSpec: Y(e.metadata),
|
|
194
|
+
functionInput: V(e.metadata),
|
|
195
|
+
globalParameters: W(e.global_parameters)
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
async function P(e, t) {
|
|
199
|
+
const o = await c.get(
|
|
200
|
+
`${M}/tool-box/${e}/tools/list`,
|
|
201
|
+
{
|
|
202
|
+
params: {
|
|
203
|
+
all: t.all || void 0,
|
|
204
|
+
box_id: e,
|
|
205
|
+
page: t.page,
|
|
206
|
+
page_size: t.pageSize,
|
|
207
|
+
name: t.keyword || void 0,
|
|
208
|
+
status: t.status,
|
|
209
|
+
sort_by: "update_time",
|
|
210
|
+
sort_order: "desc"
|
|
211
|
+
},
|
|
212
|
+
skipErrorToast: !0
|
|
213
|
+
}
|
|
214
|
+
), r = o.data.data ?? o.data;
|
|
215
|
+
return {
|
|
216
|
+
boxId: r.box_id ?? e,
|
|
217
|
+
items: (r.tools ?? []).map(U),
|
|
218
|
+
total: r.total ?? 0,
|
|
219
|
+
page: r.page ?? t.page,
|
|
220
|
+
pageSize: r.page_size ?? t.pageSize
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
async function N(e, t, o) {
|
|
224
|
+
const r = await c.get(
|
|
225
|
+
`${M}/tool-box/${e}/tool/${t}`,
|
|
226
|
+
{ skipErrorToast: o?.skipErrorToast }
|
|
227
|
+
);
|
|
228
|
+
return Z(r.data);
|
|
229
|
+
}
|
|
230
|
+
const A = "/agent-operator-integration/v1";
|
|
231
|
+
function Q(e) {
|
|
232
|
+
return {
|
|
233
|
+
toolId: e.tool_id,
|
|
234
|
+
name: e.name ?? e.tool_id,
|
|
235
|
+
description: e.description,
|
|
236
|
+
status: e.status
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function v(e) {
|
|
240
|
+
const t = Array.isArray(e.tools) ? e.tools.map(
|
|
241
|
+
(o) => typeof o == "string" ? { toolId: o, name: o, status: "disabled" } : Q(o)
|
|
242
|
+
) : void 0;
|
|
243
|
+
return {
|
|
244
|
+
operations: e.operations,
|
|
245
|
+
boxId: e.box_id,
|
|
246
|
+
name: e.box_name,
|
|
247
|
+
description: e.box_desc,
|
|
248
|
+
serviceUrl: e.box_svc_url,
|
|
249
|
+
status: e.status ?? "unpublish",
|
|
250
|
+
categoryType: e.category_type,
|
|
251
|
+
categoryName: e.category_name,
|
|
252
|
+
metadataType: e.metadata_type,
|
|
253
|
+
toolCount: t?.length ?? 0,
|
|
254
|
+
tools: t,
|
|
255
|
+
createTime: f(e.create_time),
|
|
256
|
+
updateTime: f(e.update_time),
|
|
257
|
+
createUser: e.create_user,
|
|
258
|
+
createUserName: e.create_user_name,
|
|
259
|
+
updateUser: e.update_user,
|
|
260
|
+
updateUserName: e.update_user_name,
|
|
261
|
+
releaseUser: e.release_user,
|
|
262
|
+
releaseUserName: e.release_user_name,
|
|
263
|
+
releaseTime: f(e.release_time),
|
|
264
|
+
isInternal: e.is_internal
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
async function ee(e, t) {
|
|
268
|
+
const r = (await c.get(e, {
|
|
269
|
+
params: {
|
|
270
|
+
all: t.all || void 0,
|
|
271
|
+
page: t.page,
|
|
272
|
+
page_size: t.pageSize,
|
|
273
|
+
name: t.keyword || void 0,
|
|
274
|
+
status: t.status,
|
|
275
|
+
category: t.category || void 0,
|
|
276
|
+
metadata_type: t.metadataType || void 0,
|
|
277
|
+
sort_by: "update_time",
|
|
278
|
+
sort_order: "desc"
|
|
279
|
+
},
|
|
280
|
+
skipErrorToast: !0
|
|
281
|
+
})).data;
|
|
282
|
+
return {
|
|
283
|
+
items: (r.data ?? []).map(v),
|
|
284
|
+
total: r.total ?? 0,
|
|
285
|
+
page: r.page ?? t.page,
|
|
286
|
+
pageSize: r.page_size ?? t.pageSize
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
async function $(e) {
|
|
290
|
+
return ee(`${A}/tool-box/market`, e);
|
|
291
|
+
}
|
|
292
|
+
async function te(e) {
|
|
293
|
+
const t = await c.get(`${A}/tool-box/market/${e}`, {
|
|
294
|
+
skipErrorToast: !0
|
|
295
|
+
});
|
|
296
|
+
return v(t.data);
|
|
297
|
+
}
|
|
298
|
+
async function j(e, t) {
|
|
299
|
+
const o = await c.get(`${A}/tool-box/${e}`, {
|
|
300
|
+
skipErrorToast: t?.skipErrorToast
|
|
301
|
+
});
|
|
302
|
+
return v(o.data);
|
|
303
|
+
}
|
|
304
|
+
const k = "/agent-operator-integration/v1";
|
|
305
|
+
function F(e) {
|
|
306
|
+
return {
|
|
307
|
+
operations: e.operations,
|
|
308
|
+
mcpId: String(e.mcp_id),
|
|
309
|
+
name: e.name,
|
|
310
|
+
description: e.description,
|
|
311
|
+
status: e.status ?? "unpublish",
|
|
312
|
+
mode: e.mode,
|
|
313
|
+
creationType: e.creation_type,
|
|
314
|
+
category: e.category,
|
|
315
|
+
url: e.url,
|
|
316
|
+
createUser: e.create_user,
|
|
317
|
+
createUserName: e.create_user_name,
|
|
318
|
+
updateUser: e.update_user,
|
|
319
|
+
updateUserName: e.update_user_name,
|
|
320
|
+
releaseUser: e.release_user,
|
|
321
|
+
releaseUserName: e.release_user_name,
|
|
322
|
+
releaseTime: f(e.release_time),
|
|
323
|
+
updateTime: f(e.update_time),
|
|
324
|
+
isInternal: e.is_internal
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
async function oe(e, t) {
|
|
328
|
+
const r = (await c.get(e, {
|
|
329
|
+
params: {
|
|
330
|
+
all: t.all || void 0,
|
|
331
|
+
page: t.page,
|
|
332
|
+
page_size: t.pageSize,
|
|
333
|
+
name: t.keyword || void 0,
|
|
334
|
+
status: t.status,
|
|
335
|
+
category: t.category || void 0,
|
|
336
|
+
sort_by: "update_time",
|
|
337
|
+
sort_order: "desc"
|
|
338
|
+
},
|
|
339
|
+
skipErrorToast: !0
|
|
340
|
+
})).data;
|
|
341
|
+
return {
|
|
342
|
+
items: (r.data ?? []).map(F),
|
|
343
|
+
total: r.total ?? 0,
|
|
344
|
+
page: r.page ?? t.page,
|
|
345
|
+
pageSize: r.page_size ?? t.pageSize
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
async function O(e) {
|
|
349
|
+
return oe(`${k}/mcp/market/list`, e);
|
|
350
|
+
}
|
|
351
|
+
async function re(e) {
|
|
352
|
+
const t = await c.get(`${k}/mcp/market/${e}`, {});
|
|
353
|
+
if (!t.data.base_info)
|
|
354
|
+
throw new Error("Market MCP not found");
|
|
355
|
+
return F(t.data.base_info);
|
|
356
|
+
}
|
|
357
|
+
async function se(e, t = {}) {
|
|
358
|
+
return ((await c.get(`${k}/mcp/proxy/${e}/tools`, {
|
|
359
|
+
params: {
|
|
360
|
+
all: t.all || void 0,
|
|
361
|
+
draft: t.draft || void 0,
|
|
362
|
+
page: t.page ?? 1,
|
|
363
|
+
page_size: t.pageSize ?? 100,
|
|
364
|
+
status: t.status
|
|
365
|
+
},
|
|
366
|
+
skipErrorToast: !0
|
|
367
|
+
})).data.tools ?? []).map((r) => ({
|
|
368
|
+
name: r.name ?? "unknown",
|
|
369
|
+
description: r.description,
|
|
370
|
+
inputSchema: r.inputSchema ?? r.input_schema,
|
|
371
|
+
outputSchema: r.outputSchema ?? r.output_schema
|
|
372
|
+
}));
|
|
373
|
+
}
|
|
374
|
+
const ae = [
|
|
375
|
+
{
|
|
376
|
+
boxId: "box-function-demo",
|
|
377
|
+
boxName: "Function Demo",
|
|
378
|
+
description: "Code functions for logical attributes.",
|
|
379
|
+
metadataType: "function",
|
|
380
|
+
tools: [
|
|
381
|
+
{
|
|
382
|
+
parameters: [{ name: "value", required: !0, type: "number" }],
|
|
383
|
+
toolId: "calculate_score",
|
|
384
|
+
toolName: "Calculate Score"
|
|
385
|
+
}
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
boxId: "box-data-analyst",
|
|
390
|
+
boxName: "数据分析员工具",
|
|
391
|
+
description: "包含数据分析工具,支持意图理解、问数、找数等功能",
|
|
392
|
+
tools: [
|
|
393
|
+
{
|
|
394
|
+
parameters: [{ name: "query", required: !0, type: "string" }],
|
|
395
|
+
toolId: "intent_understanding",
|
|
396
|
+
toolName: "意图理解"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
parameters: [{ name: "question", required: !0, type: "string" }],
|
|
400
|
+
toolId: "ask_data",
|
|
401
|
+
toolName: "问数"
|
|
402
|
+
}
|
|
403
|
+
]
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
boxId: "box-data-understanding",
|
|
407
|
+
boxName: "数据理解工具箱",
|
|
408
|
+
description: "数据理解 openbkn",
|
|
409
|
+
tools: [
|
|
410
|
+
{
|
|
411
|
+
parameters: [{ name: "dataset_id", required: !0, type: "string" }],
|
|
412
|
+
toolId: "openbkn_understand",
|
|
413
|
+
toolName: "openbkn 数据理解"
|
|
414
|
+
}
|
|
415
|
+
]
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
boxId: "box-sandbox",
|
|
419
|
+
boxName: "沙箱代码执行工具",
|
|
420
|
+
description: "执行 python 代码并返回执行结果",
|
|
421
|
+
tools: [
|
|
422
|
+
{
|
|
423
|
+
parameters: [{ name: "code", required: !0, type: "string" }],
|
|
424
|
+
toolId: "python_sandbox",
|
|
425
|
+
toolName: "Python 沙箱"
|
|
426
|
+
}
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
boxId: "box-agent-observability",
|
|
431
|
+
boxName: "Agent可观测数据查询API",
|
|
432
|
+
description: "查询 Agent/Session/Run 的可观测数据和配置信息",
|
|
433
|
+
tools: [
|
|
434
|
+
{
|
|
435
|
+
parameters: [{ name: "run_id", required: !0, type: "string" }],
|
|
436
|
+
toolId: "agent_observability_query",
|
|
437
|
+
toolName: "可观测数据查询"
|
|
438
|
+
}
|
|
439
|
+
]
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
boxId: "box-web-search",
|
|
443
|
+
boxName: "联网搜索添加引用工具",
|
|
444
|
+
description: "包含一个工具,用于联网搜索并添加引用",
|
|
445
|
+
tools: [
|
|
446
|
+
{
|
|
447
|
+
parameters: [{ name: "keyword", required: !0, type: "string" }],
|
|
448
|
+
toolId: "web_search_citation",
|
|
449
|
+
toolName: "联网搜索引用"
|
|
450
|
+
}
|
|
451
|
+
]
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
boxId: "box-data-agent-config",
|
|
455
|
+
boxName: "DataAgent配置相关工具",
|
|
456
|
+
description: "获取 agent 配置详情",
|
|
457
|
+
tools: [
|
|
458
|
+
{
|
|
459
|
+
parameters: [{ name: "agent_id", required: !0, type: "string" }],
|
|
460
|
+
toolId: "get_agent_config",
|
|
461
|
+
toolName: "获取 Agent 配置"
|
|
462
|
+
}
|
|
463
|
+
]
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
boxId: "box-memory",
|
|
467
|
+
boxName: "记忆管理",
|
|
468
|
+
description: "包含 记忆构建&召回 两个工具",
|
|
469
|
+
tools: [
|
|
470
|
+
{
|
|
471
|
+
parameters: [{ name: "content", required: !0, type: "string" }],
|
|
472
|
+
toolId: "memory_build",
|
|
473
|
+
toolName: "记忆构建"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
parameters: [{ name: "query", required: !0, type: "string" }],
|
|
477
|
+
toolId: "memory_recall",
|
|
478
|
+
toolName: "记忆召回"
|
|
479
|
+
}
|
|
480
|
+
]
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
boxId: "box-risk",
|
|
484
|
+
boxName: "Risk Tools",
|
|
485
|
+
description: "风险域行动工具箱",
|
|
486
|
+
tools: [
|
|
487
|
+
{
|
|
488
|
+
parameters: [{ name: "order_id", required: !0, type: "string" }],
|
|
489
|
+
toolId: "block_order_tool",
|
|
490
|
+
toolName: "Block Order"
|
|
491
|
+
}
|
|
492
|
+
]
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
boxId: "box-supply",
|
|
496
|
+
boxName: "Supply Tools",
|
|
497
|
+
description: "供应链通知工具箱",
|
|
498
|
+
tools: [
|
|
499
|
+
{
|
|
500
|
+
parameters: [
|
|
501
|
+
{ name: "supplier_id", required: !0, type: "string" },
|
|
502
|
+
{ name: "message", required: !1, type: "string" }
|
|
503
|
+
],
|
|
504
|
+
toolId: "notify_supplier",
|
|
505
|
+
toolName: "Notify Supplier"
|
|
506
|
+
}
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
], ne = [
|
|
510
|
+
{
|
|
511
|
+
description: "内置文件与检索 MCP 服务",
|
|
512
|
+
mcpId: "mcp-filesystem",
|
|
513
|
+
mcpName: "文件系统 MCP",
|
|
514
|
+
tools: [
|
|
515
|
+
{
|
|
516
|
+
parameters: [{ name: "path", required: !0, type: "string" }],
|
|
517
|
+
toolId: "read_file",
|
|
518
|
+
toolName: "read_file"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
parameters: [{ name: "query", required: !0, type: "string" }],
|
|
522
|
+
toolId: "search_docs",
|
|
523
|
+
toolName: "search_docs"
|
|
524
|
+
}
|
|
525
|
+
]
|
|
526
|
+
}
|
|
527
|
+
], pe = {
|
|
528
|
+
mcpServers: ne,
|
|
529
|
+
toolBoxes: ae
|
|
530
|
+
};
|
|
531
|
+
function ie(e, t) {
|
|
532
|
+
if (!t?.toolId)
|
|
533
|
+
return;
|
|
534
|
+
if (t.type === "mcp" && t.mcpId) {
|
|
535
|
+
const s = e.mcpServers.find((p) => p.mcpId === t.mcpId), a = s?.tools.find((p) => p.toolId === t.toolId);
|
|
536
|
+
if (s && a)
|
|
537
|
+
return { parameters: a.parameters, tool: a };
|
|
538
|
+
}
|
|
539
|
+
const o = e.toolBoxes.find((s) => s.boxId === t.boxId), r = o?.tools.find((s) => s.toolId === t.toolId);
|
|
540
|
+
if (o && r)
|
|
541
|
+
return { parameters: r.parameters, tool: r };
|
|
542
|
+
for (const s of e.mcpServers) {
|
|
543
|
+
const a = s.tools.find((p) => p.toolId === t.toolId);
|
|
544
|
+
if (a && (!t.mcpId || s.mcpId === t.mcpId))
|
|
545
|
+
return { parameters: a.parameters, tool: a };
|
|
546
|
+
}
|
|
547
|
+
for (const s of e.toolBoxes) {
|
|
548
|
+
const a = s.tools.find((p) => p.toolId === t.toolId);
|
|
549
|
+
if (a && (!t.boxId || s.boxId === t.boxId))
|
|
550
|
+
return { parameters: a.parameters, tool: a };
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
function w() {
|
|
554
|
+
const e = S(), t = {};
|
|
555
|
+
return e.currentUser.id && (t.user_id = e.currentUser.id), t;
|
|
556
|
+
}
|
|
557
|
+
const E = "/agent-operator-integration/v1", q = "unknown";
|
|
558
|
+
function C(e) {
|
|
559
|
+
return e ? e.charAt(0).toUpperCase() + e.slice(1).toLowerCase() : "Body";
|
|
560
|
+
}
|
|
561
|
+
function g(e, t) {
|
|
562
|
+
if (!e || typeof e != "object" || !("$ref" in e))
|
|
563
|
+
return e ?? {};
|
|
564
|
+
const o = e.$ref;
|
|
565
|
+
if (!o)
|
|
566
|
+
return {};
|
|
567
|
+
const r = o.split("/").slice(1);
|
|
568
|
+
let s = t;
|
|
569
|
+
for (const a of r) {
|
|
570
|
+
if (!s || typeof s != "object" || !(a in s))
|
|
571
|
+
return {};
|
|
572
|
+
s = s[a];
|
|
573
|
+
}
|
|
574
|
+
return g(s, t);
|
|
575
|
+
}
|
|
576
|
+
function x(e, t, o, r, s = "") {
|
|
577
|
+
if (e)
|
|
578
|
+
return Object.keys(e).sort((a, p) => a.localeCompare(p)).map((a) => {
|
|
579
|
+
const p = e[a], n = g(p, r), i = s ? `${s}.${a}` : a;
|
|
580
|
+
return {
|
|
581
|
+
name: a,
|
|
582
|
+
...typeof n.title == "string" ? { title: n.title } : {},
|
|
583
|
+
key: i,
|
|
584
|
+
type: typeof n.type == "string" ? n.type : q,
|
|
585
|
+
description: typeof n.description == "string" ? n.description : "",
|
|
586
|
+
required: Array.isArray(t) ? t.includes(a) : !1,
|
|
587
|
+
source: o,
|
|
588
|
+
children: x(
|
|
589
|
+
n.properties,
|
|
590
|
+
n.required ?? [],
|
|
591
|
+
o,
|
|
592
|
+
r,
|
|
593
|
+
i
|
|
594
|
+
)
|
|
595
|
+
};
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function le(e) {
|
|
599
|
+
if (!e || typeof e != "object")
|
|
600
|
+
return [];
|
|
601
|
+
const t = e, o = [], r = t.parameters;
|
|
602
|
+
if (Array.isArray(r))
|
|
603
|
+
for (const p of r) {
|
|
604
|
+
if (!p || typeof p != "object")
|
|
605
|
+
continue;
|
|
606
|
+
const n = g(p, t), i = typeof n.name == "string" ? n.name : "";
|
|
607
|
+
if (!i)
|
|
608
|
+
continue;
|
|
609
|
+
const l = n.schema && typeof n.schema == "object" ? n.schema : void 0;
|
|
610
|
+
o.push({
|
|
611
|
+
name: i,
|
|
612
|
+
...typeof l?.title == "string" ? { title: l.title } : {},
|
|
613
|
+
key: i,
|
|
614
|
+
type: typeof l?.type == "string" ? l.type : q,
|
|
615
|
+
description: typeof n.description == "string" ? n.description : "",
|
|
616
|
+
required: !!n.required,
|
|
617
|
+
source: C(
|
|
618
|
+
typeof n.in == "string" ? n.in : void 0
|
|
619
|
+
),
|
|
620
|
+
children: x(
|
|
621
|
+
n.properties ?? l?.properties,
|
|
622
|
+
n.required ?? [],
|
|
623
|
+
C(typeof n.in == "string" ? n.in : void 0),
|
|
624
|
+
t,
|
|
625
|
+
i
|
|
626
|
+
)
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
const a = t.request_body?.content?.["application/json"]?.schema;
|
|
630
|
+
if (a) {
|
|
631
|
+
const p = g(a, t), n = x(
|
|
632
|
+
p.properties,
|
|
633
|
+
p.required ?? [],
|
|
634
|
+
"Body",
|
|
635
|
+
t
|
|
636
|
+
);
|
|
637
|
+
n?.length && o.push(...n);
|
|
638
|
+
}
|
|
639
|
+
return o;
|
|
640
|
+
}
|
|
641
|
+
const y = 100, de = 3e3;
|
|
642
|
+
function b(e) {
|
|
643
|
+
return (e ?? []).reduce((t, o) => {
|
|
644
|
+
const r = o.toolId || o.name, s = o.name || o.toolId;
|
|
645
|
+
return !r || !s || t.push({
|
|
646
|
+
description: o.description ?? o.useRule,
|
|
647
|
+
parameters: [],
|
|
648
|
+
toolId: r,
|
|
649
|
+
toolName: s
|
|
650
|
+
}), t;
|
|
651
|
+
}, []);
|
|
652
|
+
}
|
|
653
|
+
function ce(e, t) {
|
|
654
|
+
const o = t.trim().toLowerCase();
|
|
655
|
+
if (!o)
|
|
656
|
+
return e;
|
|
657
|
+
const r = (s) => s.some((a) => a?.toLowerCase().includes(o));
|
|
658
|
+
return {
|
|
659
|
+
mcpServers: e.mcpServers.map((s) => {
|
|
660
|
+
const a = r([s.mcpName, s.description]), p = s.tools.filter(
|
|
661
|
+
(n) => a ? !0 : r([n.toolName, n.description, s.mcpName, s.description])
|
|
662
|
+
);
|
|
663
|
+
return a || p.length > 0 ? { ...s, tools: p } : null;
|
|
664
|
+
}).filter((s) => !!s),
|
|
665
|
+
toolBoxes: e.toolBoxes.map((s) => {
|
|
666
|
+
const a = r([s.boxName, s.description]), p = s.tools.filter(
|
|
667
|
+
(n) => a ? !0 : r([n.toolName, n.description, s.boxName, s.description])
|
|
668
|
+
);
|
|
669
|
+
return a || p.length > 0 ? { ...s, tools: p } : null;
|
|
670
|
+
}).filter((s) => !!s)
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
function ue(e, t) {
|
|
674
|
+
return t ? {
|
|
675
|
+
...e,
|
|
676
|
+
toolBoxes: e.toolBoxes.filter((o) => o.metadataType === t)
|
|
677
|
+
} : e;
|
|
678
|
+
}
|
|
679
|
+
async function me(e) {
|
|
680
|
+
const t = await c.get(
|
|
681
|
+
`${E}/tool-box/market/${e}/box_name,tools`,
|
|
682
|
+
{
|
|
683
|
+
headers: w(),
|
|
684
|
+
skipErrorToast: !0
|
|
685
|
+
}
|
|
686
|
+
);
|
|
687
|
+
return ((Array.isArray(t.data) ? t.data[0] : t.data)?.tools ?? []).filter((r) => r.tool_id).map((r) => ({
|
|
688
|
+
description: r.description ?? r.use_rule,
|
|
689
|
+
parameters: [],
|
|
690
|
+
toolId: r.tool_id,
|
|
691
|
+
toolName: r.name ?? r.tool_id
|
|
692
|
+
}));
|
|
693
|
+
}
|
|
694
|
+
async function ye(e) {
|
|
695
|
+
return ((await c.get(
|
|
696
|
+
`${E}/tool-box/market/tools`,
|
|
697
|
+
{
|
|
698
|
+
headers: w(),
|
|
699
|
+
params: {
|
|
700
|
+
all: !0,
|
|
701
|
+
sort_by: "create_time",
|
|
702
|
+
sort_order: "desc",
|
|
703
|
+
status: "enabled",
|
|
704
|
+
tool_name: e.trim()
|
|
705
|
+
},
|
|
706
|
+
skipErrorToast: !0
|
|
707
|
+
}
|
|
708
|
+
)).data.data ?? []).reduce((o, r) => {
|
|
709
|
+
if (!r.box_id || !r.box_name)
|
|
710
|
+
return o;
|
|
711
|
+
const s = (r.tools ?? []).filter((a) => a.tool_id).map((a) => ({
|
|
712
|
+
description: a.description,
|
|
713
|
+
parameters: [],
|
|
714
|
+
toolId: a.tool_id,
|
|
715
|
+
toolName: a.name ?? a.tool_id
|
|
716
|
+
}));
|
|
717
|
+
return o.push({
|
|
718
|
+
boxId: r.box_id,
|
|
719
|
+
boxName: r.box_name,
|
|
720
|
+
description: r.box_desc,
|
|
721
|
+
tools: s
|
|
722
|
+
}), o;
|
|
723
|
+
}, []);
|
|
724
|
+
}
|
|
725
|
+
async function fe(e = "", t) {
|
|
726
|
+
const o = e.trim();
|
|
727
|
+
if (o) {
|
|
728
|
+
const [a, p, n] = await Promise.all([
|
|
729
|
+
ye(o),
|
|
730
|
+
O({
|
|
731
|
+
all: !0,
|
|
732
|
+
page: 1,
|
|
733
|
+
pageSize: y,
|
|
734
|
+
keyword: o
|
|
735
|
+
}),
|
|
736
|
+
t ? $({
|
|
737
|
+
all: !0,
|
|
738
|
+
metadataType: t,
|
|
739
|
+
page: 1,
|
|
740
|
+
pageSize: y
|
|
741
|
+
}) : Promise.resolve(void 0)
|
|
742
|
+
]), i = new Map(
|
|
743
|
+
(n?.items ?? []).filter((d) => d.metadataType === t).map((d) => [d.boxId, d.metadataType])
|
|
744
|
+
), l = t ? a.filter((d) => i.has(d.boxId)).map((d) => ({
|
|
745
|
+
...d,
|
|
746
|
+
metadataType: i.get(d.boxId)
|
|
747
|
+
})) : a;
|
|
748
|
+
return {
|
|
749
|
+
mcpServers: p.items.map((d) => ({
|
|
750
|
+
description: d.description,
|
|
751
|
+
mcpId: d.mcpId,
|
|
752
|
+
mcpName: d.name,
|
|
753
|
+
tools: []
|
|
754
|
+
})),
|
|
755
|
+
toolBoxes: l
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
const [r, s] = await Promise.all([
|
|
759
|
+
$({
|
|
760
|
+
all: !0,
|
|
761
|
+
metadataType: t,
|
|
762
|
+
page: 1,
|
|
763
|
+
pageSize: y
|
|
764
|
+
}),
|
|
765
|
+
O({
|
|
766
|
+
all: !0,
|
|
767
|
+
page: 1,
|
|
768
|
+
pageSize: y
|
|
769
|
+
})
|
|
770
|
+
]);
|
|
771
|
+
return {
|
|
772
|
+
mcpServers: s.items.map((a) => ({
|
|
773
|
+
description: a.description,
|
|
774
|
+
mcpId: a.mcpId,
|
|
775
|
+
mcpName: a.name,
|
|
776
|
+
tools: []
|
|
777
|
+
})),
|
|
778
|
+
// Match Vega: market list only returns toolboxes; tools load on expand.
|
|
779
|
+
toolBoxes: r.items.map((a) => ({
|
|
780
|
+
boxId: a.boxId,
|
|
781
|
+
boxName: a.name,
|
|
782
|
+
description: a.description,
|
|
783
|
+
metadataType: a.metadataType,
|
|
784
|
+
tools: []
|
|
785
|
+
}))
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
async function _e(e) {
|
|
789
|
+
const t = [
|
|
790
|
+
async () => {
|
|
791
|
+
const o = await P(e, {
|
|
792
|
+
all: !0,
|
|
793
|
+
page: 1,
|
|
794
|
+
pageSize: y,
|
|
795
|
+
status: "enabled"
|
|
796
|
+
});
|
|
797
|
+
return b(o.items);
|
|
798
|
+
},
|
|
799
|
+
async () => {
|
|
800
|
+
const o = await P(e, {
|
|
801
|
+
all: !0,
|
|
802
|
+
page: 1,
|
|
803
|
+
pageSize: y
|
|
804
|
+
});
|
|
805
|
+
return b(o.items);
|
|
806
|
+
},
|
|
807
|
+
() => me(e),
|
|
808
|
+
async () => {
|
|
809
|
+
const o = await te(e);
|
|
810
|
+
return b(o.tools);
|
|
811
|
+
}
|
|
812
|
+
];
|
|
813
|
+
for (const [o, r] of t.entries())
|
|
814
|
+
try {
|
|
815
|
+
const s = await r();
|
|
816
|
+
if (s.length > 0)
|
|
817
|
+
return s;
|
|
818
|
+
} catch {
|
|
819
|
+
}
|
|
820
|
+
return [];
|
|
821
|
+
}
|
|
822
|
+
async function ge(e) {
|
|
823
|
+
try {
|
|
824
|
+
return (await se(e, {
|
|
825
|
+
all: !0,
|
|
826
|
+
page: 1,
|
|
827
|
+
pageSize: y,
|
|
828
|
+
status: "enabled"
|
|
829
|
+
})).map((o) => ({
|
|
830
|
+
description: o.description,
|
|
831
|
+
parameters: [],
|
|
832
|
+
toolId: o.name,
|
|
833
|
+
toolName: o.name
|
|
834
|
+
}));
|
|
835
|
+
} catch {
|
|
836
|
+
return [];
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
async function B(e = "", t) {
|
|
840
|
+
try {
|
|
841
|
+
const o = await fe(e, t);
|
|
842
|
+
return ce(
|
|
843
|
+
ue(o, t),
|
|
844
|
+
e
|
|
845
|
+
);
|
|
846
|
+
} catch {
|
|
847
|
+
return {
|
|
848
|
+
mcpServers: [],
|
|
849
|
+
toolBoxes: []
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
async function Ie(e, t) {
|
|
854
|
+
const s = ((await c.get(`${E}/mcp/proxy/${e}/tools`, {
|
|
855
|
+
headers: w(),
|
|
856
|
+
params: {
|
|
857
|
+
all: !0,
|
|
858
|
+
page: 1,
|
|
859
|
+
page_size: 100,
|
|
860
|
+
status: "enabled"
|
|
861
|
+
},
|
|
862
|
+
skipErrorToast: !0
|
|
863
|
+
})).data.tools ?? []).find((a) => a.name === t)?.inputSchema?.properties;
|
|
864
|
+
return s ? Object.keys(s).sort((a, p) => a.localeCompare(p)).map((a) => {
|
|
865
|
+
const p = s[a], n = p.properties ? Object.keys(p.properties).sort((i, l) => i.localeCompare(l)).map((i) => {
|
|
866
|
+
const l = p.properties?.[i];
|
|
867
|
+
return {
|
|
868
|
+
name: i,
|
|
869
|
+
key: `${a}.${i}`,
|
|
870
|
+
type: l?.type ?? "string",
|
|
871
|
+
description: l?.description,
|
|
872
|
+
...l?.title ? { title: l.title } : {},
|
|
873
|
+
source: "Body"
|
|
874
|
+
};
|
|
875
|
+
}) : void 0;
|
|
876
|
+
return {
|
|
877
|
+
name: a,
|
|
878
|
+
key: a,
|
|
879
|
+
type: p.type ?? "object",
|
|
880
|
+
description: p.description,
|
|
881
|
+
...p.title ? { title: p.title } : {},
|
|
882
|
+
source: "Body",
|
|
883
|
+
children: n
|
|
884
|
+
};
|
|
885
|
+
}) : [];
|
|
886
|
+
}
|
|
887
|
+
async function Ne(e, t) {
|
|
888
|
+
try {
|
|
889
|
+
const o = await N(e, t, { skipErrorToast: !0 });
|
|
890
|
+
return {
|
|
891
|
+
scriptType: o.functionInput?.script_type,
|
|
892
|
+
resultShape: o.functionInput?.result_shape
|
|
893
|
+
};
|
|
894
|
+
} catch {
|
|
895
|
+
return {};
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
async function be(e) {
|
|
899
|
+
if (ie(pe, e)?.parameters, e.type === "tool" && e.boxId && e.toolId)
|
|
900
|
+
try {
|
|
901
|
+
const t = await N(e.boxId, e.toolId, {
|
|
902
|
+
skipErrorToast: !0
|
|
903
|
+
}), o = le(t.apiSpec);
|
|
904
|
+
if (o.length > 0)
|
|
905
|
+
return o;
|
|
906
|
+
} catch (t) {
|
|
907
|
+
return m(
|
|
908
|
+
"resolveActionTypeToolInputSchema.toolDetail",
|
|
909
|
+
t,
|
|
910
|
+
`boxId=${e.boxId} toolId=${e.toolId}`
|
|
911
|
+
), [];
|
|
912
|
+
}
|
|
913
|
+
if (e.type === "mcp" && e.mcpId && e.toolName)
|
|
914
|
+
try {
|
|
915
|
+
const t = await Ie(e.mcpId, e.toolName);
|
|
916
|
+
if (t.length > 0)
|
|
917
|
+
return t;
|
|
918
|
+
} catch (t) {
|
|
919
|
+
return m(
|
|
920
|
+
"resolveActionTypeToolInputSchema.mcpProxy",
|
|
921
|
+
t,
|
|
922
|
+
`mcpId=${e.mcpId} toolName=${e.toolName}`
|
|
923
|
+
), [];
|
|
924
|
+
}
|
|
925
|
+
return [];
|
|
926
|
+
}
|
|
927
|
+
async function Ae(e, t = []) {
|
|
928
|
+
const o = await be(e);
|
|
929
|
+
return o.length > 0 ? o.map((r) => ({
|
|
930
|
+
name: r.key,
|
|
931
|
+
required: r.required,
|
|
932
|
+
type: r.type
|
|
933
|
+
})) : t;
|
|
934
|
+
}
|
|
935
|
+
function Te(e) {
|
|
936
|
+
return !e || e.type === "manual" ? !1 : e.type === "mcp" ? !!(e.mcpId && (!e.mcpName || e.toolId && !e.toolName)) : !!(e.boxId && (!e.boxName || e.toolId && !e.toolName));
|
|
937
|
+
}
|
|
938
|
+
async function ve(e) {
|
|
939
|
+
try {
|
|
940
|
+
return (await j(e, { skipErrorToast: !0 })).metadataType;
|
|
941
|
+
} catch {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
async function he(e) {
|
|
946
|
+
if (!Te(e))
|
|
947
|
+
return e;
|
|
948
|
+
if (e.type === "mcp" && e.mcpId) {
|
|
949
|
+
let t = e.mcpName, o = e.toolId, r = e.toolName;
|
|
950
|
+
if (!t)
|
|
951
|
+
try {
|
|
952
|
+
const s = await re(e.mcpId);
|
|
953
|
+
s && (t = s.name);
|
|
954
|
+
} catch (s) {
|
|
955
|
+
m(
|
|
956
|
+
"resolveActionTypeActionSourceDisplay.mcp.detail",
|
|
957
|
+
s,
|
|
958
|
+
`mcpId=${e.mcpId}`
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
try {
|
|
962
|
+
const a = (await B()).mcpServers.find((i) => i.mcpId === e.mcpId), n = (await ge(e.mcpId)).find(
|
|
963
|
+
(i) => i.toolId === e.toolId || i.toolId === e.toolName || i.toolName === e.toolName
|
|
964
|
+
);
|
|
965
|
+
t ||= a?.mcpName, o ||= n?.toolId, r ||= n?.toolName;
|
|
966
|
+
} catch (s) {
|
|
967
|
+
m(
|
|
968
|
+
"resolveActionTypeActionSourceDisplay.mcp.catalog",
|
|
969
|
+
s,
|
|
970
|
+
`mcpId=${e.mcpId} toolId=${e.toolId ?? ""}`
|
|
971
|
+
);
|
|
972
|
+
}
|
|
973
|
+
return {
|
|
974
|
+
...e,
|
|
975
|
+
mcpName: t,
|
|
976
|
+
toolId: o,
|
|
977
|
+
toolName: r
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
if (e.type === "tool" && e.boxId) {
|
|
981
|
+
let t = e.boxName, o = e.toolName;
|
|
982
|
+
if (!t || e.toolId && !o) {
|
|
983
|
+
const [r, s] = await Promise.allSettled([
|
|
984
|
+
j(e.boxId, { skipErrorToast: !0 }),
|
|
985
|
+
e.toolId ? N(e.boxId, e.toolId, {
|
|
986
|
+
skipErrorToast: !0
|
|
987
|
+
}) : Promise.resolve(void 0)
|
|
988
|
+
]);
|
|
989
|
+
r.status === "fulfilled" && r.value ? t ||= r.value.name : m(
|
|
990
|
+
"resolveActionTypeActionSourceDisplay.toolbox.detail",
|
|
991
|
+
r.status === "rejected" ? r.reason : new Error("Toolbox detail is empty"),
|
|
992
|
+
`boxId=${e.boxId}`
|
|
993
|
+
), s.status === "fulfilled" && s.value ? o ||= s.value?.name : m(
|
|
994
|
+
"resolveActionTypeActionSourceDisplay.tool.detail",
|
|
995
|
+
s.status === "rejected" ? s.reason : new Error("Tool detail is empty"),
|
|
996
|
+
`boxId=${e.boxId} toolId=${e.toolId ?? ""}`
|
|
997
|
+
);
|
|
998
|
+
}
|
|
999
|
+
if (!t || e.toolId && !o)
|
|
1000
|
+
try {
|
|
1001
|
+
const s = (await B()).toolBoxes.find((n) => n.boxId === e.boxId), p = (await _e(e.boxId)).find((n) => n.toolId === e.toolId);
|
|
1002
|
+
t ||= s?.boxName, o ||= p?.toolName;
|
|
1003
|
+
} catch (r) {
|
|
1004
|
+
m(
|
|
1005
|
+
"resolveActionTypeActionSourceDisplay.toolbox.catalog",
|
|
1006
|
+
r,
|
|
1007
|
+
`boxId=${e.boxId} toolId=${e.toolId ?? ""}`
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
return {
|
|
1011
|
+
...e,
|
|
1012
|
+
boxName: t,
|
|
1013
|
+
toolName: o
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
return e;
|
|
1017
|
+
}
|
|
1018
|
+
async function ke(e, t = de) {
|
|
1019
|
+
let o;
|
|
1020
|
+
const r = new Promise((s, a) => {
|
|
1021
|
+
o = setTimeout(
|
|
1022
|
+
() => a(new Error("Action source display resolution timed out")),
|
|
1023
|
+
t
|
|
1024
|
+
);
|
|
1025
|
+
});
|
|
1026
|
+
try {
|
|
1027
|
+
return await Promise.race([he(e), r]);
|
|
1028
|
+
} finally {
|
|
1029
|
+
o && clearTimeout(o);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
function we(e) {
|
|
1033
|
+
return e.kind === "mcp" ? {
|
|
1034
|
+
mcpId: e.mcpId,
|
|
1035
|
+
mcpName: e.mcpName,
|
|
1036
|
+
toolId: e.tool.toolId,
|
|
1037
|
+
toolName: e.tool.toolName,
|
|
1038
|
+
type: "mcp"
|
|
1039
|
+
} : {
|
|
1040
|
+
boxId: e.boxId,
|
|
1041
|
+
boxName: e.boxName,
|
|
1042
|
+
toolId: e.tool.toolId,
|
|
1043
|
+
toolName: e.tool.toolName,
|
|
1044
|
+
type: "tool"
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
export {
|
|
1048
|
+
de as ACTION_TYPE_ACTION_SOURCE_DISPLAY_TIMEOUT_MS,
|
|
1049
|
+
we as buildActionSourceFromCatalogSelection,
|
|
1050
|
+
ve as getActionTypeToolboxMetadataType,
|
|
1051
|
+
B as listActionTypeExecutionFactoryCatalog,
|
|
1052
|
+
ge as loadActionTypeMcpServerTools,
|
|
1053
|
+
_e as loadActionTypeToolBoxTools,
|
|
1054
|
+
Te as needsActionTypeActionSourceDisplayResolution,
|
|
1055
|
+
he as resolveActionTypeActionSourceDisplay,
|
|
1056
|
+
ke as resolveActionTypeActionSourceDisplayWithTimeout,
|
|
1057
|
+
be as resolveActionTypeToolInputSchema,
|
|
1058
|
+
Ae as resolveActionTypeToolParameters,
|
|
1059
|
+
Ne as resolveFunctionKind
|
|
1060
|
+
};
|