@morlay/dsh-subagent 0.0.1-alpha.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 morlay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @morlay/dsh-subagent
2
+
3
+ 上游 `@deepseek-ai/dsh-subagent` 的**薄壳 fork**:host 半只改一件事——continuable 子代理首条任务后面的
4
+ **回报指引换成中文**(上游是英文)。服务名(`ctx.subagents`)、providers、其余子路径(`./internal` 等)
5
+ 与装配位置都不变。设置页那张「子代理」卡片是本包自己的 client 半(见下),不是从上游 fork 来的。
6
+
7
+ 装配由本包的 bundle patch 完成(`cordis.patch.yml`):官方 `subagent` 行 `disabled: true` + insert
8
+ `subagent-fork`(`@morlay/dsh-subagent`),并停掉官方设置卡那两条行(`ui-settings-subagent` 与
9
+ `subagent-model-selection-settings`,理由见 [ADR](./.agents/adrs/20260923-设置页自建client半并停掉官方两条入口行.md));
10
+ app 的 `dsh.profile.bundles` 里引用本包。
11
+
12
+ ## 保留文件(3 个)
13
+
14
+ 薄壳 fork 只留**有意改过**的文件,其余上游文件不复制——保留文件里指向它们的 import 走相对路径指向
15
+ `vendor/deepseek-harness/packages/subagent/subagent/src/...`,构建时内联进 `dist/index.mjs`
16
+ (发布物自包含)。
17
+
18
+ | 保留文件(`src/`) | 保留什么 |
19
+ | -------------------------- | ------------------------------------------------------------------------------ |
20
+ | `continuation-messages.ts` | **唯一实质改动**:`withContinuableReturnGuidance` 的中文文案(保留父 id 插值) |
21
+ | `continuation.ts` | 只有一行接线不同:`continuation-messages.ts` 指向本包那一份 |
22
+ | `index.ts` | 接线 + 两处结构性偏离(见下) |
23
+
24
+ 静态 import 链决定了复制面:`continuation-messages` ← `continuation` ← `index`,要替换中间那一份就得
25
+ 连同引用它的两个文件一起接管。原因、被否掉的路线与后果见
26
+ [ADR 薄壳 fork 接管 subagent 行只改回报文案](./.agents/adrs/20260923-薄壳fork接管subagent行只改回报文案.md)。
27
+
28
+ ## 两处结构性偏离
29
+
30
+ - **`index.ts` 不复述 cordis 合并接口**:上游此处 `declare module '@deepseek-ai/cordis'` 声明
31
+ `Context.subagents` 与 `subagent/*` 事件;本包 `import type {} from '@deepseek-ai/dsh-subagent'`
32
+ 引用上游那一份(同形声明复述两遍会在同一个 program 里撞 `TS2717`)。
33
+ - **标准装饰器在构建期降级**:`@Remote(...)` 是 TC39 标准装饰器,rolldown/oxc 不降级它(上游管线里这步
34
+ 由 tsc 完成),所以 `tsdown.config.ts` 里有一个 esbuild 预转换(只在检测到装饰器语法时生效)。
35
+
36
+ 本包三个保留文件**不做格式化**(`.oxfmtrc.json` 的 `ignorePatterns`):它们与上游逐行对照是同步纪律的
37
+ 守护面,格式改了那条守护就失去意义。
38
+
39
+ ## 设置页(client 半)
40
+
41
+ `src/client/` 是**本包自己的代码**(不与上游对照,格式照常走 oxfmt):Plugins 页里那张「子代理」卡片,
42
+ 只有限额一段——递归深度(≥ 0)与并行上限(≥ 1),staged 编辑 + 保存/丢弃。
43
+
44
+ | 面 | 内容 |
45
+ | ----------------------------------------------- | ----------------------------------------------------------------------------- |
46
+ | `plugins.row.config`(key `@morlay/dsh-subagent#subagent-fork`) | `view: 'summary'` 给一句话说明;`view: 'page'` 给限额表单 |
47
+ | settings namespace `subagent-fork` | 本包 host 行 id 就是 namespace 名;可编辑字段是 `Config` 的两个 volatile 字段 |
48
+ | locale namespace `settings.subagent` | 卡片文案(zh + en,标题「子代理」) |
49
+
50
+ 装配只有两条:包声明了 `dsh.client`(`platform: 'web'`)与 `./client` 入口,client 半就随 app-boot 的
51
+ browser roster 一起装(**不需要额外的插行**);host 行被描述出来之后(`configForms.whileServed(['subagent-fork'])`)
52
+ 卡片才注册,行不在时卡片一起消失。表单原语来自 fork 的 `@morlay/dsh-client-ui-primitives/client`
53
+ (`SettingsForm` / `SettingsValueField` / `SettingsFormModel` / `settingsNumberField`)。
54
+
55
+ ## 文档
56
+
57
+ - 决策与理由:
58
+ [ADR 薄壳 fork 接管 subagent 行只改回报文案](./.agents/adrs/20260923-薄壳fork接管subagent行只改回报文案.md)、
59
+ [ADR 设置页自建 client 半并停掉官方两条入口行](./.agents/adrs/20260923-设置页自建client半并停掉官方两条入口行.md)
60
+ - 已知的债(两处 `continuation-messages` 实例、保留文件跟随方式):
61
+ [债务 continuation-messages 两份实例与保留文件跟随](./.agents/debts/20260923-continuation-messages两份实例与保留文件跟随.md)
62
+ - 测试落点与判据:[本包规范 how-to-verify](./.agents/standards/how-to-verify.md);薄壳 fork 的通用写法约束见
63
+ [`session/ui-conversation` 的 how-to-write](../../session/ui-conversation/.agents/standards/how-to-write.md)
64
+ (同一形态的包共享那份约束)。
65
+
66
+ 上游同步(patch / 裁剪 / 升级评估)走 `dsh-plugin-upstream-sync` 技能;发布走 CI,本地只构建验证。
@@ -0,0 +1,17 @@
1
+ # 上游 base bundle 的 `subagent` 行(`ctx.subagents` 服务定义)由本包接管:薄壳 fork 只改 continuable
2
+ # 子代理的回报文案,服务名、providers、其余子路径(./internal 等)与装配位置都不变。
3
+ - id: subagent
4
+ disabled: true
5
+
6
+ # 设置页那张「Subagent」卡片换成本包自己的 client 半(`src/client/` 读 `subagent-fork` 这个 namespace),
7
+ # 所以官方卡片行与它带的「模型白名单」服务行一起停掉:官方卡片读的是官方 `subagent` 行 id,本部署已没有
8
+ # 那个 namespace;模型白名单那套也不要——子代理模型统一由 session mode 的顶层 `models`(各模式的默认模型)决定。
9
+ - id: ui-settings-subagent
10
+ disabled: true
11
+
12
+ - id: subagent-model-selection-settings
13
+ disabled: true
14
+
15
+ - insert:
16
+ - id: subagent-fork
17
+ name: "@morlay/dsh-subagent"
@@ -0,0 +1,265 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "@morlay/dsh-subagent",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let react = require("react");
8
+ let _morlay_dsh_client_ui_primitives_client = require("@morlay/dsh-client-ui-primitives/client");
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ //#region src/client/SubagentLimitsCard.styles.ts
11
+ /** 卡片里那一段的样式。 */
12
+ const styles = {
13
+ section: {
14
+ display: "flex",
15
+ flexDirection: "column",
16
+ gap: "12px"
17
+ },
18
+ heading: {
19
+ margin: "0",
20
+ fontSize: "14px",
21
+ lineHeight: "20px",
22
+ fontWeight: "600",
23
+ color: "var(--dsw-alias-label-primary)"
24
+ },
25
+ limits: {
26
+ display: "grid",
27
+ gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
28
+ gap: "16px"
29
+ }
30
+ };
31
+ //#endregion
32
+ //#region src/client/locales.ts
33
+ /** 中文文案(部署语言偏好是 zh)。 */
34
+ const zh = {
35
+ overridden: "已覆盖",
36
+ reset: "恢复默认",
37
+ readOnly: "本部署的设置为只读。",
38
+ unavailable: "该插件当前未加载,暂时无法配置。",
39
+ save: "保存",
40
+ saving: "保存中…",
41
+ saveFailed: "本部署没有接受这些值,已保留供你修改。",
42
+ subagentTitle: "子代理",
43
+ subagentDescription: "设置子代理的递归深度与并行上限。",
44
+ subagentLimitsTitle: "运行限制",
45
+ subagentMaxDepth: "最大递归深度",
46
+ subagentDepthHelpLabel: "最大递归深度说明",
47
+ subagentDepthHelp: "限制 Agent 创建子代理的递归层级:「0」禁用子代理,「1」只允许主 Agent 创建子代理,更大的值放开到该层数。某个工具若自带最大深度,以该工具的设置为准。",
48
+ subagentMaxActive: "子代理并行数量上限",
49
+ subagentCapacityHelpLabel: "子代理并行数量上限说明",
50
+ subagentCapacityHelp: "同一主 Agent 下,所有递归层级同时存活的子代理总数,主 Agent 不计入。达到上限时,新的启动请求会被拒绝。",
51
+ subagentDepthInvalid: "请输入不小于 0 的整数。",
52
+ subagentCapacityInvalid: "请输入不小于 1 的整数。"
53
+ };
54
+ /** 英文文案。 */
55
+ const en = {
56
+ overridden: "Overridden",
57
+ reset: "Reset to default",
58
+ readOnly: "This deployment stores settings read-only.",
59
+ unavailable: "This plugin is not loaded, so it cannot be configured right now.",
60
+ save: "Save",
61
+ saving: "Saving…",
62
+ saveFailed: "The deployment did not accept these values; they were left for you to correct.",
63
+ subagentTitle: "Subagent",
64
+ subagentDescription: "Set Subagent recursion depth and parallelism limit.",
65
+ subagentLimitsTitle: "Limits",
66
+ subagentMaxDepth: "Maximum recursion depth",
67
+ subagentDepthHelpLabel: "About maximum recursion depth",
68
+ subagentDepthHelp: "Limits how many levels of Subagents an Agent can create: \"0\" disables Subagents, \"1\" lets only the main Agent create them, and a larger value opens that many levels. A tool that sets its own maximum depth takes precedence.",
69
+ subagentMaxActive: "Subagent parallelism limit",
70
+ subagentCapacityHelpLabel: "About the Subagent parallelism limit",
71
+ subagentCapacityHelp: "Total live Subagents under the same main Agent, across all recursion levels. The main Agent is excluded. New start requests are rejected when the limit is reached.",
72
+ subagentDepthInvalid: "Enter a whole number of 0 or more.",
73
+ subagentCapacityInvalid: "Enter a whole number of 1 or more."
74
+ };
75
+ /**
76
+ * 表单外框的文案,从本页字典里读。
77
+ * @param t - 本页的字典读取器。
78
+ * @returns 共享设置表单渲染用的标签。
79
+ */
80
+ function formLabels(t) {
81
+ return {
82
+ unavailable: t("unavailable"),
83
+ readOnly: t("readOnly"),
84
+ saveFailed: t("saveFailed"),
85
+ save: t("save"),
86
+ saving: t("saving")
87
+ };
88
+ }
89
+ //#endregion
90
+ //#region src/client/SubagentLimitsCard.tsx
91
+ /**
92
+ * 设置页的「子代理」卡片:限额一段(递归深度与并行上限)。
93
+ *
94
+ * 页面画标题与一句话说明,卡片只画控件与保存:`view: 'summary'` 时给那句话,`view: 'page'` 时给表单。
95
+ * 两个字段都是 staged 编辑——输入只改草稿,保存才写;非法草稿停在屏幕上并禁用保存。
96
+ */
97
+ /**
98
+ * 画限额那一段(或它的一句话说明)。
99
+ * @param props - 字典、限额快照、以及编辑与保存/丢弃动作。
100
+ * @returns 摘要文本,或带保存脚注的限额表单。
101
+ */
102
+ function SubagentLimitsCard(props) {
103
+ const { t } = props;
104
+ const state = props.useSubagentLimitsCard((snapshot) => snapshot);
105
+ const headingId = (0, react.useId)();
106
+ if (props.view === "summary") return t("subagentDescription");
107
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_morlay_dsh_client_ui_primitives_client.SettingsForm, {
108
+ labels: formLabels(t),
109
+ state,
110
+ onSave: props.save,
111
+ onDiscard: props.discard,
112
+ children: state.available ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
113
+ ..._morlay_dsh_client_ui_primitives_client.styling.props(styles.section),
114
+ "aria-labelledby": headingId,
115
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
116
+ ..._morlay_dsh_client_ui_primitives_client.styling.props(styles.heading),
117
+ id: headingId,
118
+ children: t("subagentLimitsTitle")
119
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
120
+ ..._morlay_dsh_client_ui_primitives_client.styling.props(styles.limits),
121
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_morlay_dsh_client_ui_primitives_client.SettingsValueField, {
122
+ id: "plugin-config-subagent-depth",
123
+ label: t("subagentMaxDepth"),
124
+ help: {
125
+ label: t("subagentDepthHelpLabel"),
126
+ content: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("subagentDepthHelp") })
127
+ },
128
+ overriddenLabel: t("overridden"),
129
+ resetLabel: t("reset"),
130
+ invalidLabel: t("subagentDepthInvalid"),
131
+ numeric: true,
132
+ disabled: !state.writable || state.saving,
133
+ ...state.maxDepth,
134
+ onEdit: (text) => {
135
+ props.edit("maxDepth", text);
136
+ },
137
+ onReset: () => {
138
+ props.resetField("maxDepth");
139
+ }
140
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_morlay_dsh_client_ui_primitives_client.SettingsValueField, {
141
+ id: "plugin-config-subagent-capacity",
142
+ label: t("subagentMaxActive"),
143
+ help: {
144
+ label: t("subagentCapacityHelpLabel"),
145
+ content: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("subagentCapacityHelp") })
146
+ },
147
+ overriddenLabel: t("overridden"),
148
+ resetLabel: t("reset"),
149
+ invalidLabel: t("subagentCapacityInvalid"),
150
+ numeric: true,
151
+ disabled: !state.writable || state.saving,
152
+ ...state.maxActiveSubagents,
153
+ onEdit: (text) => {
154
+ props.edit("maxActiveSubagents", text);
155
+ },
156
+ onReset: () => {
157
+ props.resetField("maxActiveSubagents");
158
+ }
159
+ })]
160
+ })]
161
+ }) : null
162
+ });
163
+ }
164
+ //#endregion
165
+ //#region src/client/subagent-limits-card-controller.ts
166
+ /** 本包 host 行 id:settings 的命名空间名与 `Config` 的 volatile 字段都在它下面。 */
167
+ const SUBAGENT_NS = "subagent-fork";
168
+ /**
169
+ * 一个整数限额字段:空草稿=清除(回到默认),其余草稿必须是该字段下限之上的安全整数。
170
+ * 上游的同名实现就是这样卡住非法输入的——非法草稿保留在屏幕上并阻止保存,而不是被悄悄丢弃。
171
+ * @param field - 命名空间段内的字段名。
172
+ * @param minimum - 该字段接受的最小值。
173
+ * @returns 该字段的转换规则。
174
+ */
175
+ function limitField(field, minimum) {
176
+ const numeric = (0, _morlay_dsh_client_ui_primitives_client.settingsNumberField)(field);
177
+ return {
178
+ ...numeric,
179
+ parse: (text) => {
180
+ const write = numeric.parse(text);
181
+ if (write?.kind !== "set") return write;
182
+ const value = write.value;
183
+ return Number.isSafeInteger(value) && value >= minimum && !Object.is(value, -0) ? write : void 0;
184
+ }
185
+ };
186
+ }
187
+ /** 把两个限额绑在一个 staged 表单上。 */
188
+ var SubagentLimitsCardController = class {
189
+ form;
190
+ store;
191
+ /**
192
+ * @param scope - 本包 host 行(`subagent-fork`)的共享配置表单。
193
+ */
194
+ constructor(scope) {
195
+ this.form = new _morlay_dsh_client_ui_primitives_client.SettingsFormModel(scope, [limitField("maxDepth", 0), limitField("maxActiveSubagents", 1)]);
196
+ this.store = this.form.bind(() => ({
197
+ ...this.form.shell(),
198
+ maxDepth: this.form.field("maxDepth"),
199
+ maxActiveSubagents: this.form.field("maxActiveSubagents")
200
+ }));
201
+ }
202
+ /**
203
+ * 把限额编辑器绑到槽位渲染器上。
204
+ * @returns 限额快照与 staged 写动作。
205
+ */
206
+ inject() {
207
+ return {
208
+ hooks: { subagentLimitsCard: this.store },
209
+ ...this.form.actions()
210
+ };
211
+ }
212
+ /** 释放对已接受值的订阅。 */
213
+ dispose() {
214
+ this.form.dispose();
215
+ }
216
+ };
217
+ //#endregion
218
+ //#region src/client/index.ts
219
+ /** 本页字典的命名空间。 */
220
+ const NS = "settings.subagent";
221
+ /**
222
+ * 本行的配置入口 key:`<bundle 包名>#<行 id>`。
223
+ *
224
+ * 页面侧由 `ui-plugin-manager` 的 `rowConfigKey(bundle, rowId)` 生成同一个串——bundle 是本包
225
+ * (`dsh.profile.bundles` 里那一项),行 id 是本包 patch 里插的 `subagent-fork`。
226
+ */
227
+ const SUBAGENT_ROW_CONFIG_KEY = "@morlay/dsh-subagent#subagent-fork";
228
+ /** 需要的服务:槽位(ui-renderer 提供的 registry)、字典、共享配置表单。 */
229
+ const inject = [
230
+ "slots",
231
+ "locale",
232
+ "configForms"
233
+ ];
234
+ /**
235
+ * 装上设置页那张卡片。
236
+ * @param ctx - 浏览器插件上下文。
237
+ */
238
+ function apply(ctx) {
239
+ const t = ctx.locale.bind(NS);
240
+ ctx.effect(() => ctx.locale.register(NS, {
241
+ zh,
242
+ en
243
+ }), "dsh-subagent: dictionaries");
244
+ const limits = new SubagentLimitsCardController(ctx.configForms.get(SUBAGENT_NS));
245
+ ctx.effect(() => () => {
246
+ limits.dispose();
247
+ }, "dsh-subagent: limits form subscription");
248
+ const face = limits.inject();
249
+ ctx.effect(() => ctx.configForms.whileServed([SUBAGENT_NS], () => ctx.slots.inject("plugins.row.config", () => ctx.slots.register({
250
+ name: "plugins.row.config",
251
+ key: SUBAGENT_ROW_CONFIG_KEY,
252
+ inject: () => ({
253
+ ...face,
254
+ t
255
+ })
256
+ }, SubagentLimitsCard))), "dsh-subagent: settings page");
257
+ }
258
+ //#endregion
259
+ exports.NS = NS;
260
+ exports.SUBAGENT_ROW_CONFIG_KEY = SUBAGENT_ROW_CONFIG_KEY;
261
+ exports.apply = apply;
262
+ exports.inject = inject;
263
+ return module.exports;
264
+ }
265
+ });
@@ -0,0 +1,78 @@
1
+ import { Context } from "@deepseek-ai/cordis";
2
+ import { SettingsFieldState, SettingsFormActions, SettingsFormShell } from "@morlay/dsh-client-ui-primitives/client";
3
+ import { InjectFace, PropsRuntime, TranslateNS } from "@deepseek-ai/dsh-client-ui-slots";
4
+ import { SnapshotStore } from "@deepseek-ai/dsh-client-store";
5
+ //#region src/client/locales.d.ts
6
+ /** 中文文案(部署语言偏好是 zh)。 */
7
+ declare const zh: {
8
+ overridden: string;
9
+ reset: string;
10
+ readOnly: string;
11
+ unavailable: string;
12
+ save: string;
13
+ saving: string;
14
+ saveFailed: string;
15
+ subagentTitle: string;
16
+ subagentDescription: string;
17
+ subagentLimitsTitle: string;
18
+ subagentMaxDepth: string;
19
+ subagentDepthHelpLabel: string;
20
+ subagentDepthHelp: string;
21
+ subagentMaxActive: string;
22
+ subagentCapacityHelpLabel: string;
23
+ subagentCapacityHelp: string;
24
+ subagentDepthInvalid: string;
25
+ subagentCapacityInvalid: string;
26
+ };
27
+ /** 本卡片渲染的文案 key。 */
28
+ type SubagentSettingsLocaleKey = keyof typeof zh;
29
+ //#endregion
30
+ //#region src/client/subagent-limits-card-controller.d.ts
31
+ /** host 侧的委派默认值与实时容量(`SubagentRuntime.Config` 的两个 volatile 字段)。 */
32
+ interface SubagentLimitsSettings {
33
+ maxDepth: number;
34
+ maxActiveSubagents: number;
35
+ }
36
+ /** 限额卡片呈现的生效值与草稿。 */
37
+ interface SubagentLimitsCardState extends SettingsFormShell {
38
+ maxDepth: SettingsFieldState;
39
+ maxActiveSubagents: SettingsFieldState;
40
+ }
41
+ /** 槽位渲染器绑定的动作与可观察状态。 */
42
+ interface SubagentLimitsCardFace extends SettingsFormActions {
43
+ hooks: {
44
+ subagentLimitsCard: SnapshotStore<SubagentLimitsCardState>;
45
+ };
46
+ }
47
+ //#endregion
48
+ //#region src/client/SubagentLimitsCard.d.ts
49
+ /** 槽位渲染器给卡片的 props:运行时面 + 限额表单与字典的注入面(`t` 由本包的 `inject` 面带进来)。 */
50
+ type SubagentLimitsCardProps = PropsRuntime<"plugins.row.config"> & InjectFace<SubagentLimitsCardFace & {
51
+ t: TranslateNS<"settings.subagent">;
52
+ }>;
53
+ //#endregion
54
+ //#region src/client/index.d.ts
55
+ declare module "@deepseek-ai/dsh-client-ui-slots" {
56
+ interface LocaleNamespaceMap {
57
+ /** 子代理设置卡的文案。 */
58
+ "settings.subagent": SubagentSettingsLocaleKey;
59
+ }
60
+ }
61
+ /** 本页字典的命名空间。 */
62
+ declare const NS = "settings.subagent";
63
+ /**
64
+ * 本行的配置入口 key:`<bundle 包名>#<行 id>`。
65
+ *
66
+ * 页面侧由 `ui-plugin-manager` 的 `rowConfigKey(bundle, rowId)` 生成同一个串——bundle 是本包
67
+ * (`dsh.profile.bundles` 里那一项),行 id 是本包 patch 里插的 `subagent-fork`。
68
+ */
69
+ declare const SUBAGENT_ROW_CONFIG_KEY = "@morlay/dsh-subagent#subagent-fork";
70
+ /** 需要的服务:槽位(ui-renderer 提供的 registry)、字典、共享配置表单。 */
71
+ declare const inject: string[];
72
+ /**
73
+ * 装上设置页那张卡片。
74
+ * @param ctx - 浏览器插件上下文。
75
+ */
76
+ declare function apply(ctx: Context): void;
77
+ //#endregion
78
+ export { NS, SUBAGENT_ROW_CONFIG_KEY, type SubagentLimitsCardFace, type SubagentLimitsCardProps, type SubagentLimitsCardState, type SubagentLimitsSettings, type SubagentSettingsLocaleKey, apply, inject };
@@ -0,0 +1,78 @@
1
+ import { SettingsFieldState, SettingsFormActions, SettingsFormShell } from "@morlay/dsh-client-ui-primitives/client";
2
+ import { Context } from "@deepseek-ai/cordis";
3
+ import { InjectFace, PropsRuntime, TranslateNS } from "@deepseek-ai/dsh-client-ui-slots";
4
+ import { SnapshotStore } from "@deepseek-ai/dsh-client-store";
5
+ //#region src/client/locales.d.ts
6
+ /** 中文文案(部署语言偏好是 zh)。 */
7
+ declare const zh: {
8
+ overridden: string;
9
+ reset: string;
10
+ readOnly: string;
11
+ unavailable: string;
12
+ save: string;
13
+ saving: string;
14
+ saveFailed: string;
15
+ subagentTitle: string;
16
+ subagentDescription: string;
17
+ subagentLimitsTitle: string;
18
+ subagentMaxDepth: string;
19
+ subagentDepthHelpLabel: string;
20
+ subagentDepthHelp: string;
21
+ subagentMaxActive: string;
22
+ subagentCapacityHelpLabel: string;
23
+ subagentCapacityHelp: string;
24
+ subagentDepthInvalid: string;
25
+ subagentCapacityInvalid: string;
26
+ };
27
+ /** 本卡片渲染的文案 key。 */
28
+ type SubagentSettingsLocaleKey = keyof typeof zh;
29
+ //#endregion
30
+ //#region src/client/subagent-limits-card-controller.d.ts
31
+ /** host 侧的委派默认值与实时容量(`SubagentRuntime.Config` 的两个 volatile 字段)。 */
32
+ interface SubagentLimitsSettings {
33
+ maxDepth: number;
34
+ maxActiveSubagents: number;
35
+ }
36
+ /** 限额卡片呈现的生效值与草稿。 */
37
+ interface SubagentLimitsCardState extends SettingsFormShell {
38
+ maxDepth: SettingsFieldState;
39
+ maxActiveSubagents: SettingsFieldState;
40
+ }
41
+ /** 槽位渲染器绑定的动作与可观察状态。 */
42
+ interface SubagentLimitsCardFace extends SettingsFormActions {
43
+ hooks: {
44
+ subagentLimitsCard: SnapshotStore<SubagentLimitsCardState>;
45
+ };
46
+ }
47
+ //#endregion
48
+ //#region src/client/SubagentLimitsCard.d.ts
49
+ /** 槽位渲染器给卡片的 props:运行时面 + 限额表单与字典的注入面(`t` 由本包的 `inject` 面带进来)。 */
50
+ type SubagentLimitsCardProps = PropsRuntime<"plugins.row.config"> & InjectFace<SubagentLimitsCardFace & {
51
+ t: TranslateNS<"settings.subagent">;
52
+ }>;
53
+ //#endregion
54
+ //#region src/client/index.d.ts
55
+ declare module "@deepseek-ai/dsh-client-ui-slots" {
56
+ interface LocaleNamespaceMap {
57
+ /** 子代理设置卡的文案。 */
58
+ "settings.subagent": SubagentSettingsLocaleKey;
59
+ }
60
+ }
61
+ /** 本页字典的命名空间。 */
62
+ declare const NS = "settings.subagent";
63
+ /**
64
+ * 本行的配置入口 key:`<bundle 包名>#<行 id>`。
65
+ *
66
+ * 页面侧由 `ui-plugin-manager` 的 `rowConfigKey(bundle, rowId)` 生成同一个串——bundle 是本包
67
+ * (`dsh.profile.bundles` 里那一项),行 id 是本包 patch 里插的 `subagent-fork`。
68
+ */
69
+ declare const SUBAGENT_ROW_CONFIG_KEY = "@morlay/dsh-subagent#subagent-fork";
70
+ /** 需要的服务:槽位(ui-renderer 提供的 registry)、字典、共享配置表单。 */
71
+ declare const inject: string[];
72
+ /**
73
+ * 装上设置页那张卡片。
74
+ * @param ctx - 浏览器插件上下文。
75
+ */
76
+ declare function apply(ctx: Context): void;
77
+ //#endregion
78
+ export { NS, SUBAGENT_ROW_CONFIG_KEY, type SubagentLimitsCardFace, type SubagentLimitsCardProps, type SubagentLimitsCardState, type SubagentLimitsSettings, type SubagentSettingsLocaleKey, apply, inject };