@sparkelf/dsh-plugin-subagent-settings 0.1.0-rc.10
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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +63 -0
- package/README.zh.md +63 -0
- package/lib/client.js +835 -0
- package/lib/index.js +371 -0
- package/lib/invariant.js +23 -0
- package/lib/startup.js +28 -0
- package/lib/types/client/SubagentCard.d.ts +20 -0
- package/lib/types/client/index.d.ts +17 -0
- package/lib/types/client/locales.d.ts +7 -0
- package/lib/types/client/subagent-store.d.ts +74 -0
- package/lib/types/index.d.ts +100 -0
- package/lib/types/invariant.d.ts +16 -0
- package/lib/types/startup.d.ts +20 -0
- package/package.json +94 -0
package/lib/client.js
ADDED
|
@@ -0,0 +1,835 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@sparkelf/dsh-plugin-subagent-settings",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
|
+
let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
|
|
11
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness-plus/deepseek-harness-plus/packages/plus/subagent-settings/src/client/SubagentCard.module.css.mjs
|
|
12
|
+
const css = ".KB3fBa_section{box-sizing:border-box;width:min(100%,680px);padding:0 24px 28px 0}.KB3fBa_heading{color:var(--dsw-alias-label-primary);margin:0;font-size:20px;font-weight:600;line-height:28px}.KB3fBa_intro{color:var(--dsw-alias-label-secondary);margin:6px 0 18px;font-size:14px;line-height:22px}.KB3fBa_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:8px;overflow:hidden}.KB3fBa_modeTabs{border-bottom:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;padding:4px;display:grid}.KB3fBa_modeTab{min-width:0;min-height:38px;color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;gap:7px;padding:7px 12px;font-size:14px;font-weight:500;line-height:22px;display:inline-flex;position:relative}.KB3fBa_modeTab:hover{background:var(--dsw-alias-interactive-bg-hover)}.KB3fBa_modeTab[data-active=true]{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.KB3fBa_modeTab:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.KB3fBa_unsavedDot{background:var(--dsw-alias-brand-primary);border-radius:50%;flex:none;width:6px;height:6px}.KB3fBa_panel{padding:18px}.KB3fBa_modeHeader{border-bottom:1px solid var(--dsw-alias-border-l2);justify-content:space-between;align-items:center;gap:20px;padding-bottom:16px;display:flex}.KB3fBa_modeCopy{min-width:0}.KB3fBa_modeCopy h3{color:var(--dsw-alias-label-primary);margin:0;font-size:15px;font-weight:600;line-height:22px}.KB3fBa_modeCopy p{color:var(--dsw-alias-label-tertiary);margin:3px 0 0;font-size:13px;line-height:20px}.KB3fBa_switchLabel{color:var(--dsw-alias-label-primary);cursor:pointer;flex:none;align-items:center;gap:10px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex;position:relative}.KB3fBa_switchInput{z-index:1;opacity:0;cursor:pointer;width:100%;height:100%;margin:0;position:absolute;inset:0}.KB3fBa_switchInput:disabled{cursor:not-allowed}.KB3fBa_switchTrack{background:var(--dsw-alias-border-l1);border-radius:10px;width:36px;height:20px;transition:background-color .12s;position:relative}.KB3fBa_switchTrack>span{background:var(--dsw-alias-bg-layer-1);width:16px;height:16px;box-shadow:var(--dsw-shadow-lv1);border-radius:50%;transition:transform .12s;position:absolute;top:2px;left:2px}.KB3fBa_switchInput:checked+.KB3fBa_switchTrack{background:var(--dsw-alias-brand-primary)}.KB3fBa_switchInput:checked+.KB3fBa_switchTrack>span{transform:translate(16px)}.KB3fBa_switchInput:focus-visible+.KB3fBa_switchTrack{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.KB3fBa_switchInput:disabled+.KB3fBa_switchTrack{opacity:.48}.KB3fBa_switchLabel:has(.KB3fBa_switchInput:disabled){cursor:not-allowed;color:var(--dsw-alias-label-tertiary)}.KB3fBa_readOnly,.KB3fBa_failed{margin:12px 0 0;font-size:13px;line-height:20px}.KB3fBa_readOnly{color:var(--dsw-alias-label-tertiary)}.KB3fBa_failed{color:var(--dsw-alias-label-error);flex:1}.KB3fBa_editor{gap:18px;padding-top:18px;display:grid}.KB3fBa_group{gap:8px;display:grid}.KB3fBa_group h3{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:500;line-height:22px}.KB3fBa_radioRow{min-height:24px;color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;font-size:14px;line-height:22px;display:flex}.KB3fBa_radioRow input{accent-color:var(--dsw-alias-brand-primary);flex:none;margin:0}.KB3fBa_field{color:var(--dsw-alias-label-secondary);gap:6px;font-size:13px;line-height:20px;display:grid}.KB3fBa_control{box-sizing:border-box;width:100%;display:flex!important}.KB3fBa_textarea{box-sizing:border-box;resize:vertical;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:112px;color:var(--dsw-alias-label-primary);font:inherit;border-radius:8px;padding:8px 10px;font-size:14px;line-height:22px}.KB3fBa_textarea:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.KB3fBa_select{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:36px;color:var(--dsw-alias-label-primary);cursor:pointer;font:inherit;text-align:left;border-radius:8px;justify-content:space-between;align-items:center;padding:0 10px;font-size:14px;line-height:22px;display:flex}.KB3fBa_select:hover:not(:disabled){border-color:var(--dsw-alias-label-dimmed)}.KB3fBa_select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.KB3fBa_select:disabled{cursor:not-allowed;opacity:.48}.KB3fBa_actions{justify-content:flex-start;padding-top:2px;display:flex}.KB3fBa_footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:10px;min-height:44px;margin-top:18px;padding-top:14px;display:flex}.KB3fBa_discard,.KB3fBa_save{cursor:pointer;min-height:34px;font:inherit;border-radius:8px;padding:5px 14px;font-size:14px;line-height:22px}.KB3fBa_discard{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);background:0 0}.KB3fBa_save{background:var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-layer-3);border:1px solid #0000}.KB3fBa_discard:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.KB3fBa_save:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}.KB3fBa_discard:disabled,.KB3fBa_save:disabled{cursor:not-allowed;opacity:.42}";
|
|
13
|
+
const tagId = "@sparkelf/dsh-plugin-subagent-settings/SubagentCard.module.css";
|
|
14
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
15
|
+
const tag = document.createElement("style");
|
|
16
|
+
tag.dataset.plugin = "@sparkelf/dsh-plugin-subagent-settings";
|
|
17
|
+
tag.dataset.pluginCss = tagId;
|
|
18
|
+
tag.textContent = css;
|
|
19
|
+
document.head.appendChild(tag);
|
|
20
|
+
}
|
|
21
|
+
var SubagentCard_module_css_default = {
|
|
22
|
+
"actions": "KB3fBa_actions",
|
|
23
|
+
"card": "KB3fBa_card",
|
|
24
|
+
"control": "KB3fBa_control",
|
|
25
|
+
"discard": "KB3fBa_discard",
|
|
26
|
+
"editor": "KB3fBa_editor",
|
|
27
|
+
"failed": "KB3fBa_failed",
|
|
28
|
+
"field": "KB3fBa_field",
|
|
29
|
+
"footer": "KB3fBa_footer",
|
|
30
|
+
"group": "KB3fBa_group",
|
|
31
|
+
"heading": "KB3fBa_heading",
|
|
32
|
+
"intro": "KB3fBa_intro",
|
|
33
|
+
"modeCopy": "KB3fBa_modeCopy",
|
|
34
|
+
"modeHeader": "KB3fBa_modeHeader",
|
|
35
|
+
"modeTab": "KB3fBa_modeTab",
|
|
36
|
+
"modeTabs": "KB3fBa_modeTabs",
|
|
37
|
+
"panel": "KB3fBa_panel",
|
|
38
|
+
"radioRow": "KB3fBa_radioRow",
|
|
39
|
+
"readOnly": "KB3fBa_readOnly",
|
|
40
|
+
"save": "KB3fBa_save",
|
|
41
|
+
"section": "KB3fBa_section",
|
|
42
|
+
"select": "KB3fBa_select",
|
|
43
|
+
"switchInput": "KB3fBa_switchInput",
|
|
44
|
+
"switchLabel": "KB3fBa_switchLabel",
|
|
45
|
+
"switchTrack": "KB3fBa_switchTrack",
|
|
46
|
+
"textarea": "KB3fBa_textarea",
|
|
47
|
+
"unsavedDot": "KB3fBa_unsavedDot"
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region lib/types/client/SubagentCard.js
|
|
51
|
+
/** Unified settings section for continuous and one-shot delegation modes. */
|
|
52
|
+
function without(value, key) {
|
|
53
|
+
const { [key]: _omitted, ...rest } = value;
|
|
54
|
+
return rest;
|
|
55
|
+
}
|
|
56
|
+
function namesOf(filter) {
|
|
57
|
+
return (filter?.allow ?? filter?.deny ?? []).join(", ");
|
|
58
|
+
}
|
|
59
|
+
function EntryEditor({ value: draft, writable, saving, t, onChange, onReset }) {
|
|
60
|
+
const [depthMenuOpen, setDepthMenuOpen] = (0, react.useState)(false);
|
|
61
|
+
const setDraft = (update) => {
|
|
62
|
+
onChange(update(draft));
|
|
63
|
+
};
|
|
64
|
+
const fixedModel = draft.agentOptions?.provider !== void 0 || draft.agentOptions?.model !== void 0;
|
|
65
|
+
const toolMode = draft.toolFilter?.allow !== void 0 ? "allow" : draft.toolFilter?.deny !== void 0 ? "deny" : "all";
|
|
66
|
+
const depthId = draft.maxDepth === "provider-managed" ? "provider-managed" : String(draft.maxDepth ?? 0);
|
|
67
|
+
const depthItems = (0, react.useMemo)(() => [
|
|
68
|
+
0,
|
|
69
|
+
1,
|
|
70
|
+
2,
|
|
71
|
+
3,
|
|
72
|
+
4,
|
|
73
|
+
5
|
|
74
|
+
].map((value) => ({
|
|
75
|
+
id: String(value),
|
|
76
|
+
label: String(value)
|
|
77
|
+
})).concat({
|
|
78
|
+
id: "provider-managed",
|
|
79
|
+
label: t("subagentProviderManaged")
|
|
80
|
+
}), [t]);
|
|
81
|
+
const setOptions = (change) => {
|
|
82
|
+
setDraft((current) => ({
|
|
83
|
+
...current,
|
|
84
|
+
agentOptions: {
|
|
85
|
+
...current.agentOptions,
|
|
86
|
+
...change
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
};
|
|
90
|
+
const followParent = () => {
|
|
91
|
+
setDraft((current) => {
|
|
92
|
+
const maxTokens = current.agentOptions?.maxTokens;
|
|
93
|
+
if (maxTokens === void 0) return without(current, "agentOptions");
|
|
94
|
+
return {
|
|
95
|
+
...current,
|
|
96
|
+
agentOptions: { maxTokens }
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const clearMaxTokens = () => {
|
|
101
|
+
setDraft((current) => {
|
|
102
|
+
const provider = current.agentOptions?.provider;
|
|
103
|
+
const model = current.agentOptions?.model;
|
|
104
|
+
if (provider === void 0 && model === void 0) return without(current, "agentOptions");
|
|
105
|
+
return {
|
|
106
|
+
...current,
|
|
107
|
+
agentOptions: {
|
|
108
|
+
...provider === void 0 ? {} : { provider },
|
|
109
|
+
...model === void 0 ? {} : { model }
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
const setToolMode = (mode) => {
|
|
115
|
+
setDraft((current) => {
|
|
116
|
+
if (mode === "all") return without(current, "toolFilter");
|
|
117
|
+
return mode === "allow" ? {
|
|
118
|
+
...current,
|
|
119
|
+
toolFilter: { allow: [] }
|
|
120
|
+
} : {
|
|
121
|
+
...current,
|
|
122
|
+
toolFilter: { deny: [] }
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
const setToolNames = (text) => {
|
|
127
|
+
const names = text.split(",").map((name) => name.trim()).filter(Boolean);
|
|
128
|
+
setDraft((current) => {
|
|
129
|
+
if (toolMode === "allow") return {
|
|
130
|
+
...current,
|
|
131
|
+
toolFilter: { allow: names }
|
|
132
|
+
};
|
|
133
|
+
if (toolMode === "deny") return {
|
|
134
|
+
...current,
|
|
135
|
+
toolFilter: { deny: names }
|
|
136
|
+
};
|
|
137
|
+
return current;
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
141
|
+
className: SubagentCard_module_css_default.editor,
|
|
142
|
+
children: [
|
|
143
|
+
(0, react_jsx_runtime.jsxs)("section", {
|
|
144
|
+
className: SubagentCard_module_css_default.group,
|
|
145
|
+
children: [
|
|
146
|
+
(0, react_jsx_runtime.jsx)("h3", { children: t("subagentModel") }),
|
|
147
|
+
(0, react_jsx_runtime.jsxs)("label", {
|
|
148
|
+
className: SubagentCard_module_css_default.radioRow,
|
|
149
|
+
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
150
|
+
type: "radio",
|
|
151
|
+
checked: !fixedModel,
|
|
152
|
+
disabled: !writable || saving,
|
|
153
|
+
onChange: followParent
|
|
154
|
+
}), t("subagentFollowParent")]
|
|
155
|
+
}),
|
|
156
|
+
(0, react_jsx_runtime.jsxs)("label", {
|
|
157
|
+
className: SubagentCard_module_css_default.radioRow,
|
|
158
|
+
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
159
|
+
type: "radio",
|
|
160
|
+
checked: fixedModel,
|
|
161
|
+
disabled: !writable || saving,
|
|
162
|
+
onChange: () => {
|
|
163
|
+
setOptions({
|
|
164
|
+
provider: draft.agentOptions?.provider ?? "",
|
|
165
|
+
model: draft.agentOptions?.model ?? ""
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}), t("subagentFixedModel")]
|
|
169
|
+
}),
|
|
170
|
+
fixedModel && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("label", {
|
|
171
|
+
className: SubagentCard_module_css_default.field,
|
|
172
|
+
children: [t("subagentProvider"), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
173
|
+
className: SubagentCard_module_css_default.control,
|
|
174
|
+
value: draft.agentOptions?.provider ?? "",
|
|
175
|
+
disabled: !writable || saving,
|
|
176
|
+
onChange: (event) => {
|
|
177
|
+
setOptions({ provider: event.target.value });
|
|
178
|
+
}
|
|
179
|
+
})]
|
|
180
|
+
}), (0, react_jsx_runtime.jsxs)("label", {
|
|
181
|
+
className: SubagentCard_module_css_default.field,
|
|
182
|
+
children: [t("subagentModelId"), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
183
|
+
className: SubagentCard_module_css_default.control,
|
|
184
|
+
value: draft.agentOptions?.model ?? "",
|
|
185
|
+
disabled: !writable || saving,
|
|
186
|
+
onChange: (event) => {
|
|
187
|
+
setOptions({ model: event.target.value });
|
|
188
|
+
}
|
|
189
|
+
})]
|
|
190
|
+
})] }),
|
|
191
|
+
(0, react_jsx_runtime.jsxs)("label", {
|
|
192
|
+
className: SubagentCard_module_css_default.field,
|
|
193
|
+
children: [t("subagentMaxTokens"), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
194
|
+
className: SubagentCard_module_css_default.control,
|
|
195
|
+
type: "number",
|
|
196
|
+
min: "1",
|
|
197
|
+
step: "1",
|
|
198
|
+
value: draft.agentOptions?.maxTokens ?? "",
|
|
199
|
+
disabled: !writable || saving,
|
|
200
|
+
onChange: (event) => {
|
|
201
|
+
if (event.target.value === "") clearMaxTokens();
|
|
202
|
+
else setOptions({ maxTokens: Number(event.target.value) });
|
|
203
|
+
}
|
|
204
|
+
})]
|
|
205
|
+
})
|
|
206
|
+
]
|
|
207
|
+
}),
|
|
208
|
+
(0, react_jsx_runtime.jsxs)("section", {
|
|
209
|
+
className: SubagentCard_module_css_default.group,
|
|
210
|
+
children: [
|
|
211
|
+
(0, react_jsx_runtime.jsx)("h3", { children: t("subagentPersona") }),
|
|
212
|
+
(0, react_jsx_runtime.jsxs)("label", {
|
|
213
|
+
className: SubagentCard_module_css_default.radioRow,
|
|
214
|
+
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
215
|
+
type: "radio",
|
|
216
|
+
checked: draft.persona === void 0,
|
|
217
|
+
disabled: !writable || saving,
|
|
218
|
+
onChange: () => {
|
|
219
|
+
setDraft((current) => without(current, "persona"));
|
|
220
|
+
}
|
|
221
|
+
}), t("subagentInheritPersona")]
|
|
222
|
+
}),
|
|
223
|
+
(0, react_jsx_runtime.jsxs)("label", {
|
|
224
|
+
className: SubagentCard_module_css_default.radioRow,
|
|
225
|
+
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
226
|
+
type: "radio",
|
|
227
|
+
checked: draft.persona !== void 0,
|
|
228
|
+
disabled: !writable || saving,
|
|
229
|
+
onChange: () => {
|
|
230
|
+
setDraft((current) => ({
|
|
231
|
+
...current,
|
|
232
|
+
persona: current.persona ?? ""
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
235
|
+
}), t("subagentOverridePersona")]
|
|
236
|
+
}),
|
|
237
|
+
draft.persona !== void 0 && (0, react_jsx_runtime.jsx)("textarea", {
|
|
238
|
+
"aria-label": t("subagentPersona"),
|
|
239
|
+
className: SubagentCard_module_css_default.textarea,
|
|
240
|
+
value: draft.persona,
|
|
241
|
+
disabled: !writable || saving,
|
|
242
|
+
placeholder: t("subagentPersonaPlaceholder"),
|
|
243
|
+
onChange: (event) => {
|
|
244
|
+
setDraft((current) => ({
|
|
245
|
+
...current,
|
|
246
|
+
persona: event.target.value
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
]
|
|
251
|
+
}),
|
|
252
|
+
(0, react_jsx_runtime.jsxs)("section", {
|
|
253
|
+
className: SubagentCard_module_css_default.group,
|
|
254
|
+
children: [
|
|
255
|
+
(0, react_jsx_runtime.jsx)("h3", { children: t("subagentTools") }),
|
|
256
|
+
(0, react_jsx_runtime.jsxs)("label", {
|
|
257
|
+
className: SubagentCard_module_css_default.radioRow,
|
|
258
|
+
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
259
|
+
type: "radio",
|
|
260
|
+
checked: toolMode === "all",
|
|
261
|
+
disabled: !writable || saving,
|
|
262
|
+
onChange: () => {
|
|
263
|
+
setToolMode("all");
|
|
264
|
+
}
|
|
265
|
+
}), t("subagentAllTools")]
|
|
266
|
+
}),
|
|
267
|
+
(0, react_jsx_runtime.jsxs)("label", {
|
|
268
|
+
className: SubagentCard_module_css_default.radioRow,
|
|
269
|
+
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
270
|
+
type: "radio",
|
|
271
|
+
checked: toolMode === "allow",
|
|
272
|
+
disabled: !writable || saving,
|
|
273
|
+
onChange: () => {
|
|
274
|
+
setToolMode("allow");
|
|
275
|
+
}
|
|
276
|
+
}), t("subagentAllowTools")]
|
|
277
|
+
}),
|
|
278
|
+
(0, react_jsx_runtime.jsxs)("label", {
|
|
279
|
+
className: SubagentCard_module_css_default.radioRow,
|
|
280
|
+
children: [(0, react_jsx_runtime.jsx)("input", {
|
|
281
|
+
type: "radio",
|
|
282
|
+
checked: toolMode === "deny",
|
|
283
|
+
disabled: !writable || saving,
|
|
284
|
+
onChange: () => {
|
|
285
|
+
setToolMode("deny");
|
|
286
|
+
}
|
|
287
|
+
}), t("subagentDenyTools")]
|
|
288
|
+
}),
|
|
289
|
+
toolMode !== "all" && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
290
|
+
className: SubagentCard_module_css_default.control,
|
|
291
|
+
"aria-label": t("subagentTools"),
|
|
292
|
+
value: namesOf(draft.toolFilter),
|
|
293
|
+
disabled: !writable || saving,
|
|
294
|
+
placeholder: t("subagentToolNamesPlaceholder"),
|
|
295
|
+
onChange: (event) => {
|
|
296
|
+
setToolNames(event.target.value);
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
]
|
|
300
|
+
}),
|
|
301
|
+
(0, react_jsx_runtime.jsx)("section", {
|
|
302
|
+
className: SubagentCard_module_css_default.group,
|
|
303
|
+
children: (0, react_jsx_runtime.jsxs)("label", {
|
|
304
|
+
className: SubagentCard_module_css_default.field,
|
|
305
|
+
children: [t("subagentDepth"), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
306
|
+
open: depthMenuOpen,
|
|
307
|
+
anchor: (0, react_jsx_runtime.jsxs)("button", {
|
|
308
|
+
type: "button",
|
|
309
|
+
className: SubagentCard_module_css_default.select,
|
|
310
|
+
"aria-label": t("subagentDepth"),
|
|
311
|
+
"aria-haspopup": "menu",
|
|
312
|
+
"aria-expanded": depthMenuOpen,
|
|
313
|
+
disabled: !writable || saving,
|
|
314
|
+
onClick: () => {
|
|
315
|
+
setDepthMenuOpen((current) => !current);
|
|
316
|
+
},
|
|
317
|
+
children: [depthItems.find((item) => item.id === depthId)?.label ?? depthId, (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, {})]
|
|
318
|
+
}),
|
|
319
|
+
items: depthItems,
|
|
320
|
+
selectedId: depthId,
|
|
321
|
+
onSelect: (id) => {
|
|
322
|
+
setDepthMenuOpen(false);
|
|
323
|
+
setDraft((current) => ({
|
|
324
|
+
...current,
|
|
325
|
+
maxDepth: id === "provider-managed" ? "provider-managed" : Number(id)
|
|
326
|
+
}));
|
|
327
|
+
},
|
|
328
|
+
onClose: () => {
|
|
329
|
+
setDepthMenuOpen(false);
|
|
330
|
+
},
|
|
331
|
+
dense: true
|
|
332
|
+
})]
|
|
333
|
+
})
|
|
334
|
+
}),
|
|
335
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
336
|
+
className: SubagentCard_module_css_default.actions,
|
|
337
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
338
|
+
variant: "outline",
|
|
339
|
+
size: "sm",
|
|
340
|
+
disabled: !writable || saving,
|
|
341
|
+
onClick: onReset,
|
|
342
|
+
children: t("reset")
|
|
343
|
+
})
|
|
344
|
+
})
|
|
345
|
+
]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
function descriptionKey(namespace) {
|
|
349
|
+
return namespace === "subagent" ? "subagentContinuousDescription" : "subagentOneShotDescription";
|
|
350
|
+
}
|
|
351
|
+
function enabledKey(namespace) {
|
|
352
|
+
return namespace === "subagent" ? "subagentEnableContinuous" : "subagentEnableOneShot";
|
|
353
|
+
}
|
|
354
|
+
/** Render one card whose mode tabs preserve independent settings namespaces. */
|
|
355
|
+
function SubagentSettingsSection(props) {
|
|
356
|
+
const { useSubagentSettings, t, ensure } = props;
|
|
357
|
+
const state = useSubagentSettings((snapshot) => snapshot);
|
|
358
|
+
const [requestedNamespace, setRequestedNamespace] = (0, react.useState)("subagent");
|
|
359
|
+
const tabsId = (0, react.useId)();
|
|
360
|
+
const tabRefs = (0, react.useRef)([]);
|
|
361
|
+
(0, react.useEffect)(() => {
|
|
362
|
+
ensure();
|
|
363
|
+
}, [ensure]);
|
|
364
|
+
const entry = state.entries.find((candidate) => candidate.ns === requestedNamespace) ?? state.entries[0];
|
|
365
|
+
if (entry === void 0) return null;
|
|
366
|
+
const draft = state.drafts[entry.ns] ?? entry.value;
|
|
367
|
+
const dirty = state.drafts[entry.ns] !== void 0;
|
|
368
|
+
const failed = state.saveErrors[entry.ns] !== void 0;
|
|
369
|
+
const blocked = !dirty || state.saving;
|
|
370
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
371
|
+
className: SubagentCard_module_css_default.section,
|
|
372
|
+
children: [
|
|
373
|
+
(0, react_jsx_runtime.jsx)("h2", {
|
|
374
|
+
className: SubagentCard_module_css_default.heading,
|
|
375
|
+
children: t("subagentTitle")
|
|
376
|
+
}),
|
|
377
|
+
(0, react_jsx_runtime.jsx)("p", {
|
|
378
|
+
className: SubagentCard_module_css_default.intro,
|
|
379
|
+
children: t("subagentIntro")
|
|
380
|
+
}),
|
|
381
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
382
|
+
className: SubagentCard_module_css_default.card,
|
|
383
|
+
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
384
|
+
className: SubagentCard_module_css_default.modeTabs,
|
|
385
|
+
role: "tablist",
|
|
386
|
+
"aria-label": t("subagentModes"),
|
|
387
|
+
children: state.entries.map((candidate, index) => {
|
|
388
|
+
const selected = candidate.ns === entry.ns;
|
|
389
|
+
return (0, react_jsx_runtime.jsxs)("button", {
|
|
390
|
+
ref: (element) => {
|
|
391
|
+
tabRefs.current[index] = element;
|
|
392
|
+
},
|
|
393
|
+
id: `${tabsId}-tab-${candidate.ns}`,
|
|
394
|
+
type: "button",
|
|
395
|
+
role: "tab",
|
|
396
|
+
className: SubagentCard_module_css_default.modeTab,
|
|
397
|
+
"aria-selected": selected,
|
|
398
|
+
"aria-controls": `${tabsId}-panel`,
|
|
399
|
+
tabIndex: selected ? 0 : -1,
|
|
400
|
+
"data-active": selected ? "true" : void 0,
|
|
401
|
+
onClick: () => {
|
|
402
|
+
setRequestedNamespace(candidate.ns);
|
|
403
|
+
},
|
|
404
|
+
onKeyDown: (event) => {
|
|
405
|
+
let nextIndex;
|
|
406
|
+
switch (event.key) {
|
|
407
|
+
case "ArrowRight":
|
|
408
|
+
nextIndex = (index + 1) % state.entries.length;
|
|
409
|
+
break;
|
|
410
|
+
case "ArrowLeft":
|
|
411
|
+
nextIndex = (index - 1 + state.entries.length) % state.entries.length;
|
|
412
|
+
break;
|
|
413
|
+
case "Home":
|
|
414
|
+
nextIndex = 0;
|
|
415
|
+
break;
|
|
416
|
+
case "End":
|
|
417
|
+
nextIndex = state.entries.length - 1;
|
|
418
|
+
break;
|
|
419
|
+
default: return;
|
|
420
|
+
}
|
|
421
|
+
event.preventDefault();
|
|
422
|
+
const next = state.entries[nextIndex];
|
|
423
|
+
setRequestedNamespace(next.ns);
|
|
424
|
+
tabRefs.current[nextIndex].focus();
|
|
425
|
+
},
|
|
426
|
+
children: [(0, react_jsx_runtime.jsx)("span", { children: t(candidate.label) }), state.drafts[candidate.ns] !== void 0 ? (0, react_jsx_runtime.jsx)("span", {
|
|
427
|
+
className: SubagentCard_module_css_default.unsavedDot,
|
|
428
|
+
title: t("unsaved"),
|
|
429
|
+
"aria-hidden": "true"
|
|
430
|
+
}) : null]
|
|
431
|
+
}, candidate.ns);
|
|
432
|
+
})
|
|
433
|
+
}), (0, react_jsx_runtime.jsxs)("div", {
|
|
434
|
+
id: `${tabsId}-panel`,
|
|
435
|
+
className: SubagentCard_module_css_default.panel,
|
|
436
|
+
role: "tabpanel",
|
|
437
|
+
"aria-labelledby": `${tabsId}-tab-${entry.ns}`,
|
|
438
|
+
children: [
|
|
439
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
440
|
+
className: SubagentCard_module_css_default.modeHeader,
|
|
441
|
+
children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
442
|
+
className: SubagentCard_module_css_default.modeCopy,
|
|
443
|
+
children: [(0, react_jsx_runtime.jsx)("h3", { children: t(entry.label) }), (0, react_jsx_runtime.jsx)("p", { children: t(descriptionKey(entry.ns)) })]
|
|
444
|
+
}), (0, react_jsx_runtime.jsxs)("label", {
|
|
445
|
+
className: SubagentCard_module_css_default.switchLabel,
|
|
446
|
+
children: [
|
|
447
|
+
(0, react_jsx_runtime.jsx)("span", { children: t(enabledKey(entry.ns)) }),
|
|
448
|
+
(0, react_jsx_runtime.jsx)("input", {
|
|
449
|
+
className: SubagentCard_module_css_default.switchInput,
|
|
450
|
+
type: "checkbox",
|
|
451
|
+
role: "switch",
|
|
452
|
+
checked: draft.enabled ?? false,
|
|
453
|
+
disabled: !state.writable || state.saving,
|
|
454
|
+
onChange: (event) => {
|
|
455
|
+
props.stage(entry, {
|
|
456
|
+
...draft,
|
|
457
|
+
enabled: event.target.checked
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}),
|
|
461
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
462
|
+
className: SubagentCard_module_css_default.switchTrack,
|
|
463
|
+
"aria-hidden": "true",
|
|
464
|
+
children: (0, react_jsx_runtime.jsx)("span", {})
|
|
465
|
+
})
|
|
466
|
+
]
|
|
467
|
+
})]
|
|
468
|
+
}),
|
|
469
|
+
!state.writable ? (0, react_jsx_runtime.jsx)("p", {
|
|
470
|
+
className: SubagentCard_module_css_default.readOnly,
|
|
471
|
+
role: "status",
|
|
472
|
+
children: t("readOnly")
|
|
473
|
+
}) : null,
|
|
474
|
+
(0, react_jsx_runtime.jsx)(EntryEditor, {
|
|
475
|
+
entry,
|
|
476
|
+
value: draft,
|
|
477
|
+
writable: state.writable,
|
|
478
|
+
saving: state.saving,
|
|
479
|
+
t,
|
|
480
|
+
onChange: (value) => {
|
|
481
|
+
props.stage(entry, value);
|
|
482
|
+
},
|
|
483
|
+
onReset: () => {
|
|
484
|
+
props.reset(entry);
|
|
485
|
+
}
|
|
486
|
+
}, entry.ns),
|
|
487
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
488
|
+
className: SubagentCard_module_css_default.footer,
|
|
489
|
+
children: [
|
|
490
|
+
failed ? (0, react_jsx_runtime.jsx)("p", {
|
|
491
|
+
className: SubagentCard_module_css_default.failed,
|
|
492
|
+
role: "status",
|
|
493
|
+
children: t("saveFailed")
|
|
494
|
+
}) : null,
|
|
495
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
496
|
+
type: "button",
|
|
497
|
+
className: SubagentCard_module_css_default.discard,
|
|
498
|
+
disabled: !dirty || state.saving,
|
|
499
|
+
onClick: () => {
|
|
500
|
+
props.discard(entry);
|
|
501
|
+
},
|
|
502
|
+
children: t("discard")
|
|
503
|
+
}),
|
|
504
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
505
|
+
type: "button",
|
|
506
|
+
className: SubagentCard_module_css_default.save,
|
|
507
|
+
disabled: blocked,
|
|
508
|
+
onClick: () => {
|
|
509
|
+
props.save(entry);
|
|
510
|
+
},
|
|
511
|
+
children: t(state.saving ? "saving" : "save")
|
|
512
|
+
})
|
|
513
|
+
]
|
|
514
|
+
})
|
|
515
|
+
]
|
|
516
|
+
})]
|
|
517
|
+
})
|
|
518
|
+
]
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
//#endregion
|
|
522
|
+
//#region lib/types/client/subagent-store.js
|
|
523
|
+
/** Shared Settings-scope state for the unified subagent settings section. */
|
|
524
|
+
const SUBAGENT_NAMESPACES = ["subagent", "subagent-fork"];
|
|
525
|
+
const ENTRY_META = {
|
|
526
|
+
subagent: {
|
|
527
|
+
kind: "spawn",
|
|
528
|
+
label: "subagentContinuous",
|
|
529
|
+
context: "fresh",
|
|
530
|
+
background: "continuable"
|
|
531
|
+
},
|
|
532
|
+
"subagent-fork": {
|
|
533
|
+
kind: "fork",
|
|
534
|
+
label: "subagentOneShot",
|
|
535
|
+
context: "forked",
|
|
536
|
+
background: "one-shot"
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
function replacementOperations(value) {
|
|
540
|
+
const agentOptions = {};
|
|
541
|
+
if (value.agentOptions?.provider !== void 0) agentOptions.provider = value.agentOptions.provider;
|
|
542
|
+
if (value.agentOptions?.model !== void 0) agentOptions.model = value.agentOptions.model;
|
|
543
|
+
if (value.agentOptions?.maxTokens !== void 0) agentOptions.maxTokens = value.agentOptions.maxTokens;
|
|
544
|
+
const toolFilter = {};
|
|
545
|
+
if (value.toolFilter?.allow !== void 0) toolFilter.allow = value.toolFilter.allow;
|
|
546
|
+
if (value.toolFilter?.deny !== void 0) toolFilter.deny = value.toolFilter.deny;
|
|
547
|
+
return [
|
|
548
|
+
value.enabled === void 0 ? {
|
|
549
|
+
op: "unset",
|
|
550
|
+
path: ["enabled"]
|
|
551
|
+
} : {
|
|
552
|
+
op: "set",
|
|
553
|
+
path: ["enabled"],
|
|
554
|
+
value: value.enabled
|
|
555
|
+
},
|
|
556
|
+
value.agentOptions === void 0 ? {
|
|
557
|
+
op: "unset",
|
|
558
|
+
path: ["agentOptions"]
|
|
559
|
+
} : {
|
|
560
|
+
op: "set",
|
|
561
|
+
path: ["agentOptions"],
|
|
562
|
+
value: agentOptions
|
|
563
|
+
},
|
|
564
|
+
value.persona === void 0 ? {
|
|
565
|
+
op: "unset",
|
|
566
|
+
path: ["persona"]
|
|
567
|
+
} : {
|
|
568
|
+
op: "set",
|
|
569
|
+
path: ["persona"],
|
|
570
|
+
value: value.persona
|
|
571
|
+
},
|
|
572
|
+
value.toolFilter === void 0 ? {
|
|
573
|
+
op: "unset",
|
|
574
|
+
path: ["toolFilter"]
|
|
575
|
+
} : {
|
|
576
|
+
op: "set",
|
|
577
|
+
path: ["toolFilter"],
|
|
578
|
+
value: toolFilter
|
|
579
|
+
},
|
|
580
|
+
value.maxDepth === void 0 ? {
|
|
581
|
+
op: "unset",
|
|
582
|
+
path: ["maxDepth"]
|
|
583
|
+
} : {
|
|
584
|
+
op: "set",
|
|
585
|
+
path: ["maxDepth"],
|
|
586
|
+
value: value.maxDepth
|
|
587
|
+
}
|
|
588
|
+
];
|
|
589
|
+
}
|
|
590
|
+
function withoutNamespace(record, namespace) {
|
|
591
|
+
const { [namespace]: _removed, ...remaining } = record;
|
|
592
|
+
return remaining;
|
|
593
|
+
}
|
|
594
|
+
/** Settings controller shared by both mode panels. */
|
|
595
|
+
var SubagentSettingsStore = class {
|
|
596
|
+
scopes;
|
|
597
|
+
/** Reactive state shared by both mode panels. */
|
|
598
|
+
store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({
|
|
599
|
+
writable: false,
|
|
600
|
+
entries: [],
|
|
601
|
+
drafts: {},
|
|
602
|
+
saving: false,
|
|
603
|
+
saveErrors: {}
|
|
604
|
+
});
|
|
605
|
+
unsubscribers = [];
|
|
606
|
+
started = false;
|
|
607
|
+
/**
|
|
608
|
+
* @param scopes - namespace scopes derived from the browser's shared Settings mirror.
|
|
609
|
+
*/
|
|
610
|
+
constructor(scopes) {
|
|
611
|
+
this.scopes = scopes;
|
|
612
|
+
}
|
|
613
|
+
/** Start following both scopes and load model choices once. */
|
|
614
|
+
ensure() {
|
|
615
|
+
if (this.started) return;
|
|
616
|
+
this.started = true;
|
|
617
|
+
for (const ns of SUBAGENT_NAMESPACES) this.unsubscribers.push(this.scopes[ns].subscribe(() => {
|
|
618
|
+
this.derive();
|
|
619
|
+
}));
|
|
620
|
+
this.derive();
|
|
621
|
+
}
|
|
622
|
+
/** Stop following the two Settings scopes. */
|
|
623
|
+
dispose() {
|
|
624
|
+
this.started = false;
|
|
625
|
+
for (const unsubscribe of this.unsubscribers.splice(0)) unsubscribe();
|
|
626
|
+
}
|
|
627
|
+
/** Stage one entry until its plugin card is saved.
|
|
628
|
+
* @param entry - entry being edited.
|
|
629
|
+
* @param value - complete staged user section.
|
|
630
|
+
*/
|
|
631
|
+
stage(entry, value) {
|
|
632
|
+
this.store.update((state) => {
|
|
633
|
+
state.drafts = {
|
|
634
|
+
...state.drafts,
|
|
635
|
+
[entry.ns]: value
|
|
636
|
+
};
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
/** Persist one staged entry through its Settings scope.
|
|
640
|
+
* @param entry - entry whose card initiated the save.
|
|
641
|
+
*/
|
|
642
|
+
async save(entry) {
|
|
643
|
+
const value = this.store.getSnapshot().drafts[entry.ns];
|
|
644
|
+
if (value === void 0) return;
|
|
645
|
+
this.store.update((state) => {
|
|
646
|
+
state.saving = true;
|
|
647
|
+
state.saveErrors = withoutNamespace(state.saveErrors, entry.ns);
|
|
648
|
+
});
|
|
649
|
+
try {
|
|
650
|
+
await this.scopes[entry.ns].mutate(replacementOperations(value));
|
|
651
|
+
this.store.update((state) => {
|
|
652
|
+
state.drafts = withoutNamespace(state.drafts, entry.ns);
|
|
653
|
+
});
|
|
654
|
+
} catch (_settingsWriteFailure) {
|
|
655
|
+
this.store.update((state) => {
|
|
656
|
+
state.saveErrors = {
|
|
657
|
+
...state.saveErrors,
|
|
658
|
+
[entry.ns]: true
|
|
659
|
+
};
|
|
660
|
+
});
|
|
661
|
+
} finally {
|
|
662
|
+
this.store.update((state) => {
|
|
663
|
+
state.saving = false;
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
/** Stage one entry back to its deployment defaults.
|
|
668
|
+
* @param entry - entry being reset.
|
|
669
|
+
*/
|
|
670
|
+
reset(entry) {
|
|
671
|
+
this.stage(entry, {});
|
|
672
|
+
}
|
|
673
|
+
/** Discard one card's staged edit without writing it.
|
|
674
|
+
* @param entry - entry whose draft is discarded.
|
|
675
|
+
*/
|
|
676
|
+
discard(entry) {
|
|
677
|
+
this.store.update((state) => {
|
|
678
|
+
state.drafts = withoutNamespace(state.drafts, entry.ns);
|
|
679
|
+
state.saveErrors = withoutNamespace(state.saveErrors, entry.ns);
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
derive() {
|
|
683
|
+
const entries = SUBAGENT_NAMESPACES.flatMap((ns) => {
|
|
684
|
+
const snapshot = this.scopes[ns].getSnapshot();
|
|
685
|
+
if (snapshot.status !== "ready") return [];
|
|
686
|
+
return [{
|
|
687
|
+
ns,
|
|
688
|
+
...ENTRY_META[ns],
|
|
689
|
+
value: snapshot.value
|
|
690
|
+
}];
|
|
691
|
+
});
|
|
692
|
+
const writable = entries.length > 0 && entries.every((entry) => this.scopes[entry.ns].getSnapshot().writable);
|
|
693
|
+
this.store.update((state) => {
|
|
694
|
+
state.entries = entries;
|
|
695
|
+
state.writable = writable;
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region lib/types/client/locales.js
|
|
701
|
+
/** Typed dictionaries owned by the Subagent settings capability. */
|
|
702
|
+
/** English product copy. */
|
|
703
|
+
const en = {
|
|
704
|
+
nav: "Subagents",
|
|
705
|
+
reset: "Reset to default",
|
|
706
|
+
readOnly: "This deployment stores settings read-only.",
|
|
707
|
+
save: "Save",
|
|
708
|
+
saving: "Saving...",
|
|
709
|
+
discard: "Discard",
|
|
710
|
+
unsaved: "Unsaved",
|
|
711
|
+
saveFailed: "The deployment did not accept these values; they were left for you to correct.",
|
|
712
|
+
subagentTitle: "Subagents",
|
|
713
|
+
subagentIntro: "Choose which delegation modes agents may use and configure each mode's child defaults.",
|
|
714
|
+
subagentModes: "Subagent modes",
|
|
715
|
+
subagentContinuous: "Continuous subagent",
|
|
716
|
+
subagentOneShot: "One-shot subagent",
|
|
717
|
+
subagentContinuousDescription: "Starts a fresh child conversation that can receive follow-up messages.",
|
|
718
|
+
subagentOneShotDescription: "Forks completed context for one task and returns its result.",
|
|
719
|
+
subagentEnableContinuous: "Enable continuous mode",
|
|
720
|
+
subagentEnableOneShot: "Enable one-shot mode",
|
|
721
|
+
subagentModel: "Model",
|
|
722
|
+
subagentFollowParent: "Follow the current agent",
|
|
723
|
+
subagentFixedModel: "Use a fixed model",
|
|
724
|
+
subagentProvider: "Provider",
|
|
725
|
+
subagentModelId: "Model ID",
|
|
726
|
+
subagentMaxTokens: "Maximum output tokens",
|
|
727
|
+
subagentPersona: "Role prompt",
|
|
728
|
+
subagentInheritPersona: "Use the parent role",
|
|
729
|
+
subagentOverridePersona: "Override the role for every child",
|
|
730
|
+
subagentPersonaPlaceholder: "Describe the child agent's role and output requirements.",
|
|
731
|
+
subagentTools: "Tool visibility",
|
|
732
|
+
subagentAllTools: "Use the parent tool set",
|
|
733
|
+
subagentAllowTools: "Allow only these tools",
|
|
734
|
+
subagentDenyTools: "Hide these tools",
|
|
735
|
+
subagentToolNamesPlaceholder: "Tool names separated by commas",
|
|
736
|
+
subagentDepth: "Maximum child depth",
|
|
737
|
+
subagentProviderManaged: "Provider managed"
|
|
738
|
+
};
|
|
739
|
+
/** Simplified Chinese product copy. */
|
|
740
|
+
const zh = {
|
|
741
|
+
nav: "子代理",
|
|
742
|
+
reset: "恢复默认",
|
|
743
|
+
readOnly: "本部署的设置为只读。",
|
|
744
|
+
save: "保存",
|
|
745
|
+
saving: "保存中...",
|
|
746
|
+
discard: "放弃修改",
|
|
747
|
+
unsaved: "未保存",
|
|
748
|
+
saveFailed: "本部署没有接受这些值,已保留供你修改。",
|
|
749
|
+
subagentTitle: "子代理",
|
|
750
|
+
subagentIntro: "选择智能体可使用的委派方式,并分别配置子代理默认值。",
|
|
751
|
+
subagentModes: "子代理模式",
|
|
752
|
+
subagentContinuous: "连续子代理",
|
|
753
|
+
subagentOneShot: "一次性子代理",
|
|
754
|
+
subagentContinuousDescription: "创建全新子会话,之后可以继续发送消息。",
|
|
755
|
+
subagentOneShotDescription: "继承已完成的对话内容,执行一次任务后返回结果。",
|
|
756
|
+
subagentEnableContinuous: "启用连续模式",
|
|
757
|
+
subagentEnableOneShot: "启用一次性模式",
|
|
758
|
+
subagentModel: "模型",
|
|
759
|
+
subagentFollowParent: "跟随当前智能体",
|
|
760
|
+
subagentFixedModel: "固定模型",
|
|
761
|
+
subagentProvider: "提供方",
|
|
762
|
+
subagentModelId: "模型 ID",
|
|
763
|
+
subagentMaxTokens: "最大输出 token",
|
|
764
|
+
subagentPersona: "角色提示词",
|
|
765
|
+
subagentInheritPersona: "沿用父智能体角色",
|
|
766
|
+
subagentOverridePersona: "为每个子代理覆盖角色",
|
|
767
|
+
subagentPersonaPlaceholder: "描述子代理的角色和输出要求。",
|
|
768
|
+
subagentTools: "工具可见范围",
|
|
769
|
+
subagentAllTools: "沿用父智能体工具集",
|
|
770
|
+
subagentAllowTools: "仅允许这些工具",
|
|
771
|
+
subagentDenyTools: "隐藏这些工具",
|
|
772
|
+
subagentToolNamesPlaceholder: "用逗号分隔工具名称",
|
|
773
|
+
subagentDepth: "最大子代理嵌套层数",
|
|
774
|
+
subagentProviderManaged: "由提供方管理"
|
|
775
|
+
};
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region lib/types/client/index.js
|
|
778
|
+
/** Browser Settings section for the two shipped settings-backed delegation entries. */
|
|
779
|
+
const NS = "settings.subagents";
|
|
780
|
+
/** Required browser services. */
|
|
781
|
+
const inject = [
|
|
782
|
+
"slots",
|
|
783
|
+
"locale",
|
|
784
|
+
"settingsScope"
|
|
785
|
+
];
|
|
786
|
+
/**
|
|
787
|
+
* Mount the dedicated Subagents Settings section.
|
|
788
|
+
* @param ctx - Browser plugin context.
|
|
789
|
+
*/
|
|
790
|
+
function apply(ctx) {
|
|
791
|
+
const t = ctx.locale.bind(NS);
|
|
792
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
793
|
+
zh,
|
|
794
|
+
en
|
|
795
|
+
}), "plus-subagent-settings: dictionaries");
|
|
796
|
+
const settings = new SubagentSettingsStore({
|
|
797
|
+
subagent: ctx.settingsScope.bind({ namespace: "subagent" }),
|
|
798
|
+
"subagent-fork": ctx.settingsScope.bind({ namespace: "subagent-fork" })
|
|
799
|
+
});
|
|
800
|
+
const injected = () => ({
|
|
801
|
+
hooks: { subagentSettings: settings.store },
|
|
802
|
+
ensure: () => {
|
|
803
|
+
settings.ensure();
|
|
804
|
+
},
|
|
805
|
+
stage: (entry, value) => {
|
|
806
|
+
settings.stage(entry, value);
|
|
807
|
+
},
|
|
808
|
+
save: (entry) => settings.save(entry),
|
|
809
|
+
reset: (entry) => {
|
|
810
|
+
settings.reset(entry);
|
|
811
|
+
},
|
|
812
|
+
discard: (entry) => {
|
|
813
|
+
settings.discard(entry);
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
ctx.effect(() => () => {
|
|
817
|
+
settings.dispose();
|
|
818
|
+
}, "plus-subagent-settings: settings scopes");
|
|
819
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
820
|
+
name: "settings.section",
|
|
821
|
+
id: "subagents",
|
|
822
|
+
order: 15,
|
|
823
|
+
label: () => t("nav"),
|
|
824
|
+
locale: NS,
|
|
825
|
+
inject: injected
|
|
826
|
+
}, SubagentSettingsSection));
|
|
827
|
+
}
|
|
828
|
+
//#endregion
|
|
829
|
+
exports.apply = apply;
|
|
830
|
+
exports.inject = inject;
|
|
831
|
+
return module.exports;
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
//# sourceMappingURL=client.js.map
|