dsh-agent-toolkit 0.1.0 → 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 +2 -2
- package/lib/client.js +259 -112
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +16 -0
- package/lib/index.js +377 -57
- package/lib/index.js.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@ DeepSeek Harness plugin: agent registry with layered prompts, parallel delegatio
|
|
|
15
15
|
## 安装
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
dsh plugin add dsh-agent-toolkit
|
|
18
|
+
dsh plugin --profile <profile 名> add dsh-agent-toolkit
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
`--profile` 为必填项;profile 是 `$DSH_HOME/profiles/<name>`(默认 `~/.dsh/profiles/<name>`)下的目录,可用 `dsh plugin --profile <name> list` 查看已有插件。包自带 `cordis.patch.yml`(bundles 层),装进 profile 后自动激活,无需手工添加 patch 条目。
|
|
22
22
|
|
|
23
23
|
## 配置
|
|
24
24
|
|
package/lib/client.js
CHANGED
|
@@ -42,29 +42,45 @@ window.__ModuleLoader__.load({
|
|
|
42
42
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
43
43
|
let react = require("react");
|
|
44
44
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
//#region src/client/delegate/api.ts
|
|
46
|
+
/** GET /delegate/active:运行中委派的已解析路由;404/失败 → null(不渲染 chip)。 */
|
|
47
|
+
async function fetchActiveRoute(sessionId, role) {
|
|
48
|
+
const res = await fetch(`/dsh-agent-toolkit/api/delegate/active?session=${encodeURIComponent(sessionId)}&role=${encodeURIComponent(role)}`);
|
|
49
|
+
if (!res.ok) return null;
|
|
50
|
+
return res.json();
|
|
51
|
+
}
|
|
52
|
+
/** GET /delegate/route:子会话的持久委派路由;404/失败 → null。 */
|
|
53
|
+
async function fetchChildRoute(sessionId) {
|
|
54
|
+
const res = await fetch(`/dsh-agent-toolkit/api/delegate/route?session=${encodeURIComponent(sessionId)}`);
|
|
55
|
+
if (!res.ok) return null;
|
|
56
|
+
return res.json();
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
45
59
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\delegate\delegate-card.module.css.mjs
|
|
46
|
-
const css$
|
|
47
|
-
const tagId$
|
|
48
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
60
|
+
const css$9 = "._8wQUq_root{margin:4px 0 4px 4px}._8wQUq_row{cursor:pointer;user-select:none;align-items:center;gap:6px;height:24px;display:flex}._8wQUq_row:hover{background:var(--dsw-alias-interactive-bg-hover-solid)}._8wQUq_chip{font:var(--dsw-font-xs-13);color:var(--dsw-alias-state-business-primary);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;flex:none;padding:0 6px}._8wQUq_summary{text-overflow:ellipsis;white-space:nowrap;font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary);flex:auto;overflow:hidden}._8wQUq_body{border-left:1px solid var(--dsw-alias-border-l1);max-height:260px;margin:4px 0 4px 16px;padding-left:8px;overflow-y:auto}._8wQUq_prompt{white-space:pre-wrap;word-break:break-word;font:var(--dsw-font-markdown-code-block-small);color:var(--dsw-alias-label-secondary);margin:0 0 6px}._8wQUq_result{color:var(--dsw-alias-label-primary)}._8wQUq_childLink{cursor:pointer;font:var(--dsw-font-xs-13);color:var(--dsw-alias-state-business-primary);border:1px solid var(--dsw-alias-border-l2);background:0 0;border-radius:999px;margin-top:6px;padding:2px 10px}._8wQUq_childLink:hover{background:var(--dsw-alias-interactive-bg-hover-solid)}._8wQUq_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}._8wQUq_root[data-state=error] ._8wQUq_summary{color:var(--dsw-alias-state-error-primary)}";
|
|
61
|
+
const tagId$9 = "dsh-agent-toolkit/delegate-card.module.css-c939fc26";
|
|
62
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$9) + "]") === null) {
|
|
49
63
|
const tag = document.createElement("style");
|
|
50
64
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
51
|
-
tag.dataset.pluginCss = tagId$
|
|
52
|
-
tag.textContent = css$
|
|
65
|
+
tag.dataset.pluginCss = tagId$9;
|
|
66
|
+
tag.textContent = css$9;
|
|
53
67
|
document.head.appendChild(tag);
|
|
54
68
|
}
|
|
55
69
|
var delegate_card_module_css_default = {
|
|
56
70
|
"chip": "_8wQUq_chip",
|
|
57
|
-
"root": "_8wQUq_root",
|
|
58
71
|
"summary": "_8wQUq_summary",
|
|
59
|
-
"row": "_8wQUq_row",
|
|
60
72
|
"result": "_8wQUq_result",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
73
|
+
"body": "_8wQUq_body",
|
|
74
|
+
"root": "_8wQUq_root",
|
|
63
75
|
"visuallyHidden": "_8wQUq_visuallyHidden",
|
|
64
|
-
"
|
|
76
|
+
"row": "_8wQUq_row",
|
|
77
|
+
"prompt": "_8wQUq_prompt",
|
|
78
|
+
"childLink": "_8wQUq_childLink"
|
|
65
79
|
};
|
|
66
80
|
//#endregion
|
|
67
81
|
//#region src/client/delegate/delegate-card.tsx
|
|
82
|
+
/** 运行中轮询间隔(命中/settled/卸载即停)。 */
|
|
83
|
+
const ACTIVE_POLL_MS = 1500;
|
|
68
84
|
function argsOf(block) {
|
|
69
85
|
const raw = "kind" in block && block.kind === "tool-result" ? block.call?.argsRaw : block.argsRaw;
|
|
70
86
|
if (typeof raw !== "string") return {};
|
|
@@ -85,6 +101,34 @@ window.__ModuleLoader__.load({
|
|
|
85
101
|
const args = argsOf(block);
|
|
86
102
|
const meta = settled ? block.meta : void 0;
|
|
87
103
|
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
104
|
+
const role = args.role;
|
|
105
|
+
const [activeRoute, setActiveRoute] = (0, react.useState)(null);
|
|
106
|
+
(0, react.useEffect)(() => {
|
|
107
|
+
if (settled || role === void 0) return;
|
|
108
|
+
let cancelled = false;
|
|
109
|
+
let timer;
|
|
110
|
+
const pull = () => {
|
|
111
|
+
fetchActiveRoute(String(sessionId), role).then((route) => {
|
|
112
|
+
if (cancelled || route === null) return;
|
|
113
|
+
setActiveRoute(route);
|
|
114
|
+
if (timer !== void 0) clearInterval(timer);
|
|
115
|
+
}).catch(() => void 0);
|
|
116
|
+
};
|
|
117
|
+
pull();
|
|
118
|
+
timer = setInterval(pull, ACTIVE_POLL_MS);
|
|
119
|
+
return () => {
|
|
120
|
+
cancelled = true;
|
|
121
|
+
if (timer !== void 0) clearInterval(timer);
|
|
122
|
+
};
|
|
123
|
+
}, [
|
|
124
|
+
settled,
|
|
125
|
+
sessionId,
|
|
126
|
+
role
|
|
127
|
+
]);
|
|
128
|
+
const route = settled ? typeof meta?.provider === "string" && typeof meta?.model === "string" ? {
|
|
129
|
+
provider: meta.provider,
|
|
130
|
+
model: meta.model
|
|
131
|
+
} : null : activeRoute;
|
|
88
132
|
const state = !settled ? "ongoing" : isError ? "error" : "done";
|
|
89
133
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
90
134
|
className: delegate_card_module_css_default.root,
|
|
@@ -107,6 +151,15 @@ window.__ModuleLoader__.load({
|
|
|
107
151
|
className: delegate_card_module_css_default.chip,
|
|
108
152
|
children: args.role
|
|
109
153
|
}),
|
|
154
|
+
route !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
155
|
+
className: delegate_card_module_css_default.chip,
|
|
156
|
+
"aria-label": t("card.modelAria", { route: `${route.provider} / ${route.model}` }),
|
|
157
|
+
children: [
|
|
158
|
+
route.provider,
|
|
159
|
+
" / ",
|
|
160
|
+
route.model
|
|
161
|
+
]
|
|
162
|
+
}),
|
|
110
163
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
111
164
|
className: delegate_card_module_css_default.summary,
|
|
112
165
|
children: args.description ?? ""
|
|
@@ -151,12 +204,16 @@ window.__ModuleLoader__.load({
|
|
|
151
204
|
const zh = {
|
|
152
205
|
"card.viewChild": "查看子对话",
|
|
153
206
|
"card.running": "成员执行中",
|
|
154
|
-
"card.failed": "委派失败"
|
|
207
|
+
"card.failed": "委派失败",
|
|
208
|
+
"card.modelAria": "子 Agent 使用模型 {route}",
|
|
209
|
+
"header.modelAria": "子会话模型 {route}"
|
|
155
210
|
};
|
|
156
211
|
const en = {
|
|
157
212
|
"card.viewChild": "View sub-conversation",
|
|
158
213
|
"card.running": "Member running",
|
|
159
|
-
"card.failed": "Delegation failed"
|
|
214
|
+
"card.failed": "Delegation failed",
|
|
215
|
+
"card.modelAria": "Subagent runs on {route}",
|
|
216
|
+
"header.modelAria": "Subagent session model {route}"
|
|
160
217
|
};
|
|
161
218
|
//#endregion
|
|
162
219
|
//#region src/client/delegate/index.ts
|
|
@@ -181,6 +238,53 @@ window.__ModuleLoader__.load({
|
|
|
181
238
|
}, DelegateCard));
|
|
182
239
|
}
|
|
183
240
|
//#endregion
|
|
241
|
+
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\subagent-model\subagent-model.module.css.mjs
|
|
242
|
+
const css$8 = ".LlymwG_chip{font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary);border:1px solid var(--dsw-alias-border-l2);white-space:nowrap;border-radius:6px;flex:none;padding:0 6px}";
|
|
243
|
+
const tagId$8 = "dsh-agent-toolkit/subagent-model.module.css-258be5cf";
|
|
244
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$8) + "]") === null) {
|
|
245
|
+
const tag = document.createElement("style");
|
|
246
|
+
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
247
|
+
tag.dataset.pluginCss = tagId$8;
|
|
248
|
+
tag.textContent = css$8;
|
|
249
|
+
document.head.appendChild(tag);
|
|
250
|
+
}
|
|
251
|
+
var subagent_model_module_css_default = { "chip": "LlymwG_chip" };
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/client/subagent-model/SubagentModelChip.tsx
|
|
254
|
+
/** 子会话头部模型 chip:仅子会话渲染;数据来自插件持久委派路由(委派时解析的值,全程一致)。 */
|
|
255
|
+
function SubagentModelChip({ sessionId, useSession, t }) {
|
|
256
|
+
const subagent = useSession((s) => s.subagent);
|
|
257
|
+
const [route, setRoute] = (0, react.useState)(null);
|
|
258
|
+
const isSubagent = subagent !== null;
|
|
259
|
+
(0, react.useEffect)(() => {
|
|
260
|
+
if (!isSubagent) return;
|
|
261
|
+
let cancelled = false;
|
|
262
|
+
fetchChildRoute(String(sessionId)).then((r) => {
|
|
263
|
+
if (!cancelled) setRoute(r);
|
|
264
|
+
}).catch(() => void 0);
|
|
265
|
+
return () => {
|
|
266
|
+
cancelled = true;
|
|
267
|
+
};
|
|
268
|
+
}, [sessionId, isSubagent]);
|
|
269
|
+
if (!isSubagent || route === null) return null;
|
|
270
|
+
const text = `${route.provider} / ${route.model}`;
|
|
271
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
272
|
+
className: subagent_model_module_css_default.chip,
|
|
273
|
+
"aria-label": t("header.modelAria", { route: text }),
|
|
274
|
+
children: text
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/client/subagent-model/index.ts
|
|
279
|
+
function setupSubagentModelClient(ctx) {
|
|
280
|
+
ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
|
|
281
|
+
name: "conversation.session.header.utilities",
|
|
282
|
+
id: "subagent-model",
|
|
283
|
+
order: 10,
|
|
284
|
+
locale: NS
|
|
285
|
+
}, SubagentModelChip));
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
184
288
|
//#region ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
185
289
|
function r(e) {
|
|
186
290
|
var t, f, n = "";
|
|
@@ -297,7 +401,7 @@ window.__ModuleLoader__.load({
|
|
|
297
401
|
const deleteAgent = (id) => request$2(`/dsh-agent-toolkit/api/agents/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
298
402
|
//#endregion
|
|
299
403
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\agents\agents.module.css.mjs
|
|
300
|
-
const css$6 = ".KsfSLW_dialog{width:860px}.KsfSLW_split{gap:16px;min-height:420px;display:flex}.KsfSLW_listPane{flex-direction:column;flex:none;gap:4px;width:240px;display:flex}.KsfSLW_agentRow{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;width:100%;font:inherit;color:inherit;text-align:left;background:0 0;border-radius:6px;flex-direction:column;gap:2px;padding:8px 10px;display:flex}.KsfSLW_agentRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.KsfSLW_agentRowActive{border-color:var(--dsw-alias-brand-primary);background:var(--dsw-alias-interactive-bg-hover)}.KsfSLW_agentName{align-items:center;gap:6px;font-size:14px;line-height:22px;display:flex}.KsfSLW_agentDesc{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.KsfSLW_builtinBadge{flex:none;align-self:flex-start}.KsfSLW_createButton{margin-top:8px}.KsfSLW_editorPane{flex:1;min-width:0;max-height:70vh;overflow-y:auto}.KsfSLW_editor{flex-direction:column;gap:16px;display:flex}.KsfSLW_block{flex-direction:column;gap:8px;display:flex}.KsfSLW_blockTitle{margin:0;font-size:14px;font-weight:600;line-height:22px}.KsfSLW_field{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;font-size:13px;line-height:20px;display:flex}.KsfSLW_input{box-sizing:border-box;width:100%}.KsfSLW_readonlyId{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:20px}.KsfSLW_select,.KsfSLW_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:12px;font-size:14px;line-height:22px}.KsfSLW_select{height:32px;padding:0 8px}.KsfSLW_textarea{resize:vertical;padding:4px 8px}.KsfSLW_select:focus,.KsfSLW_textarea:focus{border-color:var(--dsw-alias-brand-primary);outline:none}.KsfSLW_toolGrid{flex-wrap:wrap;gap:8px;display:flex}.KsfSLW_toolGroupTitle{color:var(--dsw-alias-label-tertiary);margin:4px 0 0;font-size:12px;line-height:18px}.KsfSLW_toolCheck{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:4px 8px;font-size:13px;line-height:20px;display:inline-flex}.KsfSLW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.KsfSLW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}.KsfSLW_actions{background:var(--dsw-alias-bg-layer-1);justify-content:flex-end;gap:8px;margin-top:4px;padding:8px 0;display:flex;position:sticky;bottom:0}.KsfSLW_dangerButton{color:var(--dsw-alias-state-error-primary)}";
|
|
404
|
+
const css$6 = ".KsfSLW_dialog{width:860px}.KsfSLW_split{gap:16px;min-height:420px;display:flex}.KsfSLW_listPane{flex-direction:column;flex:none;gap:4px;width:240px;display:flex}.KsfSLW_agentRow{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;width:100%;font:inherit;color:inherit;text-align:left;background:0 0;border-radius:6px;flex-direction:column;gap:2px;padding:8px 10px;display:flex}.KsfSLW_agentRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.KsfSLW_agentRowActive{border-color:var(--dsw-alias-brand-primary);background:var(--dsw-alias-interactive-bg-hover)}.KsfSLW_agentName{align-items:center;gap:6px;font-size:14px;line-height:22px;display:flex}.KsfSLW_agentDesc{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.KsfSLW_builtinBadge{flex:none;align-self:flex-start}.KsfSLW_createButton{margin-top:8px}.KsfSLW_editorPane{flex:1;min-width:0;max-height:70vh;overflow-y:auto}.KsfSLW_editor{flex-direction:column;gap:16px;display:flex}.KsfSLW_block{flex-direction:column;gap:8px;display:flex}.KsfSLW_blockTitle{margin:0;font-size:14px;font-weight:600;line-height:22px}.KsfSLW_field{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;font-size:13px;line-height:20px;display:flex}.KsfSLW_input{box-sizing:border-box;width:100%}.KsfSLW_readonlyId{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:20px}.KsfSLW_select,.KsfSLW_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:12px;font-size:14px;line-height:22px}.KsfSLW_select{height:32px;padding:0 8px}.KsfSLW_textarea{resize:vertical;padding:4px 8px}.KsfSLW_select:focus,.KsfSLW_textarea:focus{border-color:var(--dsw-alias-brand-primary);outline:none}.KsfSLW_toolMode{gap:8px;display:flex}.KsfSLW_toolGroupSet{border:none;flex-direction:column;gap:4px;min-width:0;margin:0;padding:0;display:flex}.KsfSLW_toolGroupSet:disabled{opacity:.55}.KsfSLW_toolGrid{flex-wrap:wrap;gap:8px;display:flex}.KsfSLW_toolGroupTitle{color:var(--dsw-alias-label-tertiary);margin:4px 0 0;font-size:12px;line-height:18px}.KsfSLW_toolCheck{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:4px 8px;font-size:13px;line-height:20px;display:inline-flex}.KsfSLW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.KsfSLW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}.KsfSLW_actions{background:var(--dsw-alias-bg-layer-1);justify-content:flex-end;gap:8px;margin-top:4px;padding:8px 0;display:flex;position:sticky;bottom:0}.KsfSLW_dangerButton{color:var(--dsw-alias-state-error-primary)}";
|
|
301
405
|
const tagId$6 = "dsh-agent-toolkit/agents.module.css-36f6ae02";
|
|
302
406
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
|
|
303
407
|
const tag = document.createElement("style");
|
|
@@ -307,31 +411,33 @@ window.__ModuleLoader__.load({
|
|
|
307
411
|
document.head.appendChild(tag);
|
|
308
412
|
}
|
|
309
413
|
var agents_module_css_default = {
|
|
310
|
-
"
|
|
311
|
-
"
|
|
414
|
+
"select": "KsfSLW_select",
|
|
415
|
+
"agentDesc": "KsfSLW_agentDesc",
|
|
416
|
+
"error": "KsfSLW_error",
|
|
312
417
|
"toolCheck": "KsfSLW_toolCheck",
|
|
313
|
-
"
|
|
314
|
-
"
|
|
315
|
-
"
|
|
418
|
+
"agentName": "KsfSLW_agentName",
|
|
419
|
+
"toolGroupSet": "KsfSLW_toolGroupSet",
|
|
420
|
+
"dialog": "KsfSLW_dialog",
|
|
316
421
|
"block": "KsfSLW_block",
|
|
317
|
-
"error": "KsfSLW_error",
|
|
318
422
|
"field": "KsfSLW_field",
|
|
319
|
-
"
|
|
320
|
-
"split": "KsfSLW_split",
|
|
321
|
-
"createButton": "KsfSLW_createButton",
|
|
322
|
-
"agentRowActive": "KsfSLW_agentRowActive",
|
|
423
|
+
"readonlyId": "KsfSLW_readonlyId",
|
|
323
424
|
"input": "KsfSLW_input",
|
|
425
|
+
"toolMode": "KsfSLW_toolMode",
|
|
426
|
+
"blockTitle": "KsfSLW_blockTitle",
|
|
427
|
+
"hint": "KsfSLW_hint",
|
|
428
|
+
"actions": "KsfSLW_actions",
|
|
324
429
|
"toolGrid": "KsfSLW_toolGrid",
|
|
325
|
-
"
|
|
326
|
-
"dialog": "KsfSLW_dialog",
|
|
430
|
+
"createButton": "KsfSLW_createButton",
|
|
327
431
|
"listPane": "KsfSLW_listPane",
|
|
328
|
-
"
|
|
432
|
+
"agentRowActive": "KsfSLW_agentRowActive",
|
|
433
|
+
"editor": "KsfSLW_editor",
|
|
434
|
+
"split": "KsfSLW_split",
|
|
435
|
+
"agentRow": "KsfSLW_agentRow",
|
|
329
436
|
"builtinBadge": "KsfSLW_builtinBadge",
|
|
330
|
-
"blockTitle": "KsfSLW_blockTitle",
|
|
331
|
-
"select": "KsfSLW_select",
|
|
332
437
|
"toolGroupTitle": "KsfSLW_toolGroupTitle",
|
|
333
|
-
"
|
|
334
|
-
"
|
|
438
|
+
"dangerButton": "KsfSLW_dangerButton",
|
|
439
|
+
"textarea": "KsfSLW_textarea",
|
|
440
|
+
"editorPane": "KsfSLW_editorPane"
|
|
335
441
|
};
|
|
336
442
|
//#endregion
|
|
337
443
|
//#region src/client/agents/AgentEditor.tsx
|
|
@@ -350,6 +456,7 @@ window.__ModuleLoader__.load({
|
|
|
350
456
|
const [providers, setProviders] = (0, react.useState)([]);
|
|
351
457
|
const [models, setModels] = (0, react.useState)([]);
|
|
352
458
|
const [tools, setTools] = (0, react.useState)(agent?.tools?.allow ?? []);
|
|
459
|
+
const [toolsMode, setToolsMode] = (0, react.useState)(agent === void 0 || agent.tools !== void 0 ? "custom" : "unrestricted");
|
|
353
460
|
const [catalog, setCatalog] = (0, react.useState)({
|
|
354
461
|
native: [],
|
|
355
462
|
global: []
|
|
@@ -418,7 +525,7 @@ window.__ModuleLoader__.load({
|
|
|
418
525
|
provider: provider.trim(),
|
|
419
526
|
model: model.trim()
|
|
420
527
|
} } : {},
|
|
421
|
-
...tools.length > 0 ? { tools: { allow: tools } } : {}
|
|
528
|
+
...toolsMode === "custom" && tools.length > 0 ? { tools: { allow: tools } } : {}
|
|
422
529
|
};
|
|
423
530
|
setSaving(true);
|
|
424
531
|
try {
|
|
@@ -560,49 +667,88 @@ window.__ModuleLoader__.load({
|
|
|
560
667
|
}),
|
|
561
668
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
562
669
|
className: agents_module_css_default.block,
|
|
563
|
-
children: [
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
className: agents_module_css_default.hint,
|
|
568
|
-
children: "暂无可用工具"
|
|
569
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
570
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
571
|
-
className: agents_module_css_default.toolGroupTitle,
|
|
572
|
-
children: "原生工具"
|
|
670
|
+
children: [
|
|
671
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
672
|
+
className: agents_module_css_default.blockTitle,
|
|
673
|
+
children: "工具白名单"
|
|
573
674
|
}),
|
|
574
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
575
|
-
className: agents_module_css_default.
|
|
576
|
-
children:
|
|
675
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
676
|
+
className: agents_module_css_default.toolMode,
|
|
677
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
577
678
|
className: agents_module_css_default.toolCheck,
|
|
578
679
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
579
|
-
type: "
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
680
|
+
type: "radio",
|
|
681
|
+
name: "agent-tools-mode",
|
|
682
|
+
checked: toolsMode === "unrestricted",
|
|
683
|
+
"aria-label": "不限制(继承会话全部工具)",
|
|
684
|
+
onChange: () => {
|
|
685
|
+
setToolsMode("unrestricted");
|
|
584
686
|
}
|
|
585
|
-
}),
|
|
586
|
-
},
|
|
587
|
-
}),
|
|
588
|
-
catalog.global.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
589
|
-
className: agents_module_css_default.toolGroupTitle,
|
|
590
|
-
children: "扩展工具"
|
|
591
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
592
|
-
className: agents_module_css_default.toolGrid,
|
|
593
|
-
children: catalog.global.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
687
|
+
}), "不限制(继承会话全部工具)"]
|
|
688
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
594
689
|
className: agents_module_css_default.toolCheck,
|
|
595
690
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
596
|
-
type: "
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
691
|
+
type: "radio",
|
|
692
|
+
name: "agent-tools-mode",
|
|
693
|
+
checked: toolsMode === "custom",
|
|
694
|
+
"aria-label": "自定义白名单",
|
|
695
|
+
onChange: () => {
|
|
696
|
+
setToolsMode("custom");
|
|
601
697
|
}
|
|
602
|
-
}),
|
|
603
|
-
}
|
|
604
|
-
})
|
|
605
|
-
|
|
698
|
+
}), "自定义白名单"]
|
|
699
|
+
})]
|
|
700
|
+
}),
|
|
701
|
+
catalog.native.length === 0 && catalog.global.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
702
|
+
className: agents_module_css_default.hint,
|
|
703
|
+
children: "暂无可用工具"
|
|
704
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
705
|
+
className: agents_module_css_default.toolGroupSet,
|
|
706
|
+
disabled: toolsMode !== "custom",
|
|
707
|
+
children: [
|
|
708
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
709
|
+
className: agents_module_css_default.toolGroupTitle,
|
|
710
|
+
children: "原生工具"
|
|
711
|
+
}),
|
|
712
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
713
|
+
className: agents_module_css_default.toolGrid,
|
|
714
|
+
children: catalog.native.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
715
|
+
className: agents_module_css_default.toolCheck,
|
|
716
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
717
|
+
type: "checkbox",
|
|
718
|
+
checked: tools.includes(t),
|
|
719
|
+
"aria-label": `工具 ${t}`,
|
|
720
|
+
disabled: toolsMode !== "custom",
|
|
721
|
+
onChange: (e) => {
|
|
722
|
+
toggleTool(t, e.target.checked);
|
|
723
|
+
}
|
|
724
|
+
}), t]
|
|
725
|
+
}, t))
|
|
726
|
+
}),
|
|
727
|
+
catalog.global.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
728
|
+
className: agents_module_css_default.toolGroupTitle,
|
|
729
|
+
children: "扩展工具"
|
|
730
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
731
|
+
className: agents_module_css_default.toolGrid,
|
|
732
|
+
children: catalog.global.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
733
|
+
className: agents_module_css_default.toolCheck,
|
|
734
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
735
|
+
type: "checkbox",
|
|
736
|
+
checked: tools.includes(t),
|
|
737
|
+
"aria-label": `工具 ${t}`,
|
|
738
|
+
disabled: toolsMode !== "custom",
|
|
739
|
+
onChange: (e) => {
|
|
740
|
+
toggleTool(t, e.target.checked);
|
|
741
|
+
}
|
|
742
|
+
}), t]
|
|
743
|
+
}, t))
|
|
744
|
+
})] })
|
|
745
|
+
]
|
|
746
|
+
}),
|
|
747
|
+
toolsMode === "custom" && tools.length === 0 && catalogLoaded && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
748
|
+
className: agents_module_css_default.hint,
|
|
749
|
+
children: "自定义白名单至少勾选一个工具,或改选不限制"
|
|
750
|
+
})
|
|
751
|
+
]
|
|
606
752
|
}),
|
|
607
753
|
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
608
754
|
role: "alert",
|
|
@@ -628,7 +774,7 @@ window.__ModuleLoader__.load({
|
|
|
628
774
|
}),
|
|
629
775
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
630
776
|
variant: "primary",
|
|
631
|
-
disabled: saving || creating && !catalogLoaded,
|
|
777
|
+
disabled: saving || creating && !catalogLoaded || toolsMode === "custom" && tools.length === 0,
|
|
632
778
|
onClick: () => {
|
|
633
779
|
save();
|
|
634
780
|
},
|
|
@@ -805,24 +951,24 @@ window.__ModuleLoader__.load({
|
|
|
805
951
|
document.head.appendChild(tag);
|
|
806
952
|
}
|
|
807
953
|
var prompt_module_css_default = {
|
|
808
|
-
"
|
|
809
|
-
"tabActive": "VZk1fa_tabActive",
|
|
810
|
-
"hint": "VZk1fa_hint",
|
|
811
|
-
"layerRowActive": "VZk1fa_layerRowActive",
|
|
954
|
+
"layerRow": "VZk1fa_layerRow",
|
|
812
955
|
"layerName": "VZk1fa_layerName",
|
|
956
|
+
"hint": "VZk1fa_hint",
|
|
957
|
+
"tabActive": "VZk1fa_tabActive",
|
|
813
958
|
"error": "VZk1fa_error",
|
|
814
|
-
"
|
|
815
|
-
"editorPane": "VZk1fa_editorPane",
|
|
816
|
-
"dialog": "VZk1fa_dialog",
|
|
817
|
-
"readonlyTag": "VZk1fa_readonlyTag",
|
|
818
|
-
"field": "VZk1fa_field",
|
|
819
|
-
"tabs": "VZk1fa_tabs",
|
|
820
|
-
"layerOrder": "VZk1fa_layerOrder",
|
|
959
|
+
"layerRowActive": "VZk1fa_layerRowActive",
|
|
821
960
|
"actions": "VZk1fa_actions",
|
|
822
961
|
"tab": "VZk1fa_tab",
|
|
823
|
-
"
|
|
962
|
+
"split": "VZk1fa_split",
|
|
963
|
+
"textarea": "VZk1fa_textarea",
|
|
964
|
+
"tabs": "VZk1fa_tabs",
|
|
965
|
+
"editor": "VZk1fa_editor",
|
|
824
966
|
"listPane": "VZk1fa_listPane",
|
|
825
|
-
"
|
|
967
|
+
"readonlyTag": "VZk1fa_readonlyTag",
|
|
968
|
+
"layerOrder": "VZk1fa_layerOrder",
|
|
969
|
+
"dialog": "VZk1fa_dialog",
|
|
970
|
+
"field": "VZk1fa_field",
|
|
971
|
+
"editorPane": "VZk1fa_editorPane"
|
|
826
972
|
};
|
|
827
973
|
//#endregion
|
|
828
974
|
//#region src/client/prompt/PromptLayersModal.tsx
|
|
@@ -1306,12 +1452,12 @@ window.__ModuleLoader__.load({
|
|
|
1306
1452
|
document.head.appendChild(tag);
|
|
1307
1453
|
}
|
|
1308
1454
|
var chart_module_css_default = {
|
|
1455
|
+
"swatchCached": "_8LXSJW_swatchCached",
|
|
1309
1456
|
"tooltipTotal": "_8LXSJW_tooltipTotal",
|
|
1310
1457
|
"tooltip": "_8LXSJW_tooltip",
|
|
1311
1458
|
"legend": "_8LXSJW_legend",
|
|
1312
|
-
"tooltipTitle": "_8LXSJW_tooltipTitle",
|
|
1313
|
-
"swatchCached": "_8LXSJW_swatchCached",
|
|
1314
1459
|
"chartTheme": "_8LXSJW_chartTheme",
|
|
1460
|
+
"tooltipTitle": "_8LXSJW_tooltipTitle",
|
|
1315
1461
|
"swatchFresh": "_8LXSJW_swatchFresh"
|
|
1316
1462
|
};
|
|
1317
1463
|
//#endregion
|
|
@@ -1326,14 +1472,14 @@ window.__ModuleLoader__.load({
|
|
|
1326
1472
|
document.head.appendChild(tag);
|
|
1327
1473
|
}
|
|
1328
1474
|
var ActivityHeatmap_module_css_default = {
|
|
1475
|
+
"level2": "hjrYrq_level2",
|
|
1476
|
+
"level4": "hjrYrq_level4",
|
|
1477
|
+
"level1": "hjrYrq_level1",
|
|
1329
1478
|
"level0": "hjrYrq_level0",
|
|
1330
1479
|
"grid": "hjrYrq_grid",
|
|
1331
|
-
"week": "hjrYrq_week",
|
|
1332
|
-
"level4": "hjrYrq_level4",
|
|
1333
|
-
"months": "hjrYrq_months",
|
|
1334
1480
|
"level3": "hjrYrq_level3",
|
|
1335
|
-
"
|
|
1336
|
-
"
|
|
1481
|
+
"week": "hjrYrq_week",
|
|
1482
|
+
"months": "hjrYrq_months"
|
|
1337
1483
|
};
|
|
1338
1484
|
//#endregion
|
|
1339
1485
|
//#region ../usage/src/client/usage/ActivityHeatmap.tsx
|
|
@@ -52370,19 +52516,19 @@ ${te.current.stack}
|
|
|
52370
52516
|
document.head.appendChild(tag);
|
|
52371
52517
|
}
|
|
52372
52518
|
var UsageModal_module_css_default = {
|
|
52373
|
-
"
|
|
52374
|
-
"rowCalls": "MODeXa_rowCalls",
|
|
52375
|
-
"tabActive": "MODeXa_tabActive",
|
|
52376
|
-
"total": "MODeXa_total",
|
|
52377
|
-
"sectionTitle": "MODeXa_sectionTitle",
|
|
52519
|
+
"pagerButton": "MODeXa_pagerButton",
|
|
52378
52520
|
"row": "MODeXa_row",
|
|
52521
|
+
"pager": "MODeXa_pager",
|
|
52379
52522
|
"tab": "MODeXa_tab",
|
|
52523
|
+
"tabs": "MODeXa_tabs",
|
|
52380
52524
|
"dateLabel": "MODeXa_dateLabel",
|
|
52381
|
-
"
|
|
52525
|
+
"sectionTitle": "MODeXa_sectionTitle",
|
|
52526
|
+
"rowName": "MODeXa_rowName",
|
|
52527
|
+
"rowCalls": "MODeXa_rowCalls",
|
|
52382
52528
|
"dialog": "MODeXa_dialog",
|
|
52383
|
-
"
|
|
52384
|
-
"
|
|
52385
|
-
"
|
|
52529
|
+
"total": "MODeXa_total",
|
|
52530
|
+
"compaction": "MODeXa_compaction",
|
|
52531
|
+
"tabActive": "MODeXa_tabActive"
|
|
52386
52532
|
};
|
|
52387
52533
|
//#endregion
|
|
52388
52534
|
//#region ../usage/src/client/usage/UsageModal.tsx
|
|
@@ -55007,28 +55153,28 @@ ${te.current.stack}
|
|
|
55007
55153
|
document.head.appendChild(tag);
|
|
55008
55154
|
}
|
|
55009
55155
|
var bots_module_css_default = {
|
|
55010
|
-
"status": "vTbXga_status",
|
|
55011
|
-
"tabs": "vTbXga_tabs",
|
|
55012
|
-
"textarea": "vTbXga_textarea",
|
|
55013
|
-
"input": "vTbXga_input",
|
|
55014
55156
|
"stepSeparator": "vTbXga_stepSeparator",
|
|
55015
|
-
"stepActive": "vTbXga_stepActive",
|
|
55016
|
-
"steps": "vTbXga_steps",
|
|
55017
|
-
"tab": "vTbXga_tab",
|
|
55018
|
-
"select": "vTbXga_select",
|
|
55019
55157
|
"formActions": "vTbXga_formActions",
|
|
55020
|
-
"
|
|
55158
|
+
"field": "vTbXga_field",
|
|
55021
55159
|
"botRow": "vTbXga_botRow",
|
|
55022
|
-
"
|
|
55023
|
-
"
|
|
55160
|
+
"tabs": "vTbXga_tabs",
|
|
55161
|
+
"step": "vTbXga_step",
|
|
55024
55162
|
"createButton": "vTbXga_createButton",
|
|
55025
55163
|
"tabActive": "vTbXga_tabActive",
|
|
55164
|
+
"textarea": "vTbXga_textarea",
|
|
55165
|
+
"select": "vTbXga_select",
|
|
55166
|
+
"channelBadge": "vTbXga_channelBadge",
|
|
55167
|
+
"status": "vTbXga_status",
|
|
55168
|
+
"stepActive": "vTbXga_stepActive",
|
|
55169
|
+
"input": "vTbXga_input",
|
|
55170
|
+
"scanSection": "vTbXga_scanSection",
|
|
55171
|
+
"dialog": "vTbXga_dialog",
|
|
55172
|
+
"groupTitle": "vTbXga_groupTitle",
|
|
55026
55173
|
"error": "vTbXga_error",
|
|
55027
|
-
"
|
|
55174
|
+
"steps": "vTbXga_steps",
|
|
55175
|
+
"group": "vTbXga_group",
|
|
55028
55176
|
"botName": "vTbXga_botName",
|
|
55029
|
-
"
|
|
55030
|
-
"scanSection": "vTbXga_scanSection",
|
|
55031
|
-
"step": "vTbXga_step"
|
|
55177
|
+
"tab": "vTbXga_tab"
|
|
55032
55178
|
};
|
|
55033
55179
|
//#endregion
|
|
55034
55180
|
//#region src/client/bots/BotForm.tsx
|
|
@@ -55606,6 +55752,7 @@ ${te.current.stack}
|
|
|
55606
55752
|
];
|
|
55607
55753
|
function apply(ctx) {
|
|
55608
55754
|
setupDelegateClient(ctx);
|
|
55755
|
+
setupSubagentModelClient(ctx);
|
|
55609
55756
|
setupAgentsClient(ctx);
|
|
55610
55757
|
setupPromptClient(ctx);
|
|
55611
55758
|
try {
|