@dsmm/dsmm 0.3.23 → 0.3.25
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/agent-presets/dsmm-builder/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-code-search/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-coding/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-complex/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-creative/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-deep/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-documenting/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-frontend/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-oracle/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-planner/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-quick/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-research/agent.cordis.yml +0 -10
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +0 -10
- package/docs/agent-presets.md +3 -1
- package/docs/maintenance.md +30 -5
- package/docs/settings-status.md +2 -2
- package/dsh-plugin.json +1 -1
- package/lib/child-capture.d.ts +1 -1
- package/lib/child-capture.js +3 -1
- package/lib/client/DeploymentFields.js +1 -1
- package/lib/client/RoleToolView-locales.d.ts +5 -0
- package/lib/client/RoleToolView-locales.js +2 -0
- package/lib/client/RoleToolView.js +3 -1
- package/lib/client/deployment-locales.d.ts +1 -0
- package/lib/client/deployment-locales.js +3 -1
- package/lib/client/index.js +32 -2
- package/lib/client/role-call-observations.d.ts +13 -1
- package/lib/client/role-call-observations.js +71 -14
- package/lib/client.js +117 -17
- package/lib/model-family.d.ts +3 -1
- package/lib/model-family.js +23 -5
- package/lib/profile-diagnostics.js +1 -1
- package/lib/prompt-content.js +1 -1
- package/lib/prompts.js +15 -10
- package/lib/role-identity.js +19 -3
- package/lib/role-subagents.js +5 -3
- package/lib/settings.d.ts +1 -0
- package/lib/settings.js +2 -1
- package/package.json +1 -1
- package/prompts/deepwork.md +3 -24
- package/prompts/source/deepwork/default.md +3 -14
- package/prompts/source/deepwork/gemini.md +3 -13
- package/prompts/source/deepwork/glm.md +3 -13
- package/prompts/source/deepwork/kimi-k3-1.md +65 -0
- package/skills/avoid-ai-slop/SKILL.md +2 -0
- package/skills/frontend/references/design/interaction-skill.md +14 -0
- package/skills/remove-ai-slops/SKILL.md +4 -4
- package/skills/report-fidelity/SKILL.md +3 -0
- package/prompts/source/shared/dsh-host-contract.md +0 -7
package/lib/client.js
CHANGED
|
@@ -2710,7 +2710,7 @@ var configFields = {
|
|
|
2710
2710
|
roleRouting: "role-routing",
|
|
2711
2711
|
runtimePolicy: { strategy: null, rateLimit },
|
|
2712
2712
|
presets: { materialize: null, root: null },
|
|
2713
|
-
subagents: { toolTopology: null, allowRouteOverride: null, enableRunInBackground: null, backgroundMode: null, maxDepth: null },
|
|
2713
|
+
subagents: { toolTopology: null, allowRouteOverride: null, enableRunInBackground: null, forceBackground: null, backgroundMode: null, maxDepth: null },
|
|
2714
2714
|
workflow: { policy: null, strictGates: null, reviewCap: null, finalReviewPolicy: null },
|
|
2715
2715
|
guards: { scope: null, shellCommandSafety: null, gitWriteGuard: null, gitWriteScope: null, toolOutputTruncation: { enabled: null, maxInlineBytes: null }, planFormatValidation: null, questionLabelHelper: { enabled: null, maxLabelChars: null }, todoDisciplineHelper: null },
|
|
2716
2716
|
runtimeRecovery: { enabled: null, retryOnStatusCodes: [null], retryOnCodes: [null], fallbackRoutes: [route], maxFallbackAttempts: null, idleContinuation: { enabled: null, maxContinuations: null, prompt: null } },
|
|
@@ -7841,6 +7841,7 @@ var deploymentEn = {
|
|
|
7841
7841
|
core: "Core",
|
|
7842
7842
|
coreHint: "Core-owned desired settings. Model-parameter passthrough is ordinary config, not a subplugin. The permission-control enabled flag is startup-pinned. Save does not change current-session admission; inspect desired, startup and admitted values below. Unavailable admission stays unknown.",
|
|
7843
7843
|
modelParametersHint: "Off sends no custom parameters and uses native reasoning defaults. Saved values and the selected model stay unchanged.",
|
|
7844
|
+
forceBackgroundHint: "Takes priority over Allow background runs: every delegation uses native parent delivery, whether run_in_background is omitted, true or false. Returns accepted child/message IDs without waiting for completion.",
|
|
7844
7845
|
permissionControlHint: "Permission-control mounting is startup-pinned. Saved configuration does not prove runtime coverage or remove current protections. Root rules keep their independent authority inside Permissions.",
|
|
7845
7846
|
modules: "Configuration sections",
|
|
7846
7847
|
scope: "Configuration scope",
|
|
@@ -7946,6 +7947,7 @@ var deploymentZh = {
|
|
|
7946
7947
|
core: "Core 核心配置",
|
|
7947
7948
|
coreHint: "Core 所有的 desired 意图配置。模型参数透传为普通配置,非子插件;权限控制 enabled 仅启动时捕获。保存不改变当前会话准入;下方可检查意图、启动与准入值,不可用的准入仍为未知。",
|
|
7948
7949
|
modelParametersHint: "关闭后不发送自定义参数,改用原生推理默认值;已保存值与所选模型不变。",
|
|
7950
|
+
forceBackgroundHint: "优先于“允许后台执行”:run_in_background 无论省略、true 或 false,所有委派都使用原生父级后台交付,不等待任务完成,返回已接收的 child/message 标识。",
|
|
7949
7951
|
permissionControlHint: "权限控制挂载仅启动时捕获。保存配置不证明运行时覆盖,也不移除当前保护;Root 规则在权限模块内保持独立权限。",
|
|
7950
7952
|
modules: "配置分区",
|
|
7951
7953
|
scope: "配置范围",
|
|
@@ -8069,6 +8071,7 @@ var deploymentFieldLabels = {
|
|
|
8069
8071
|
maxLabelChars: ["Label character limit", "标签字符上限"],
|
|
8070
8072
|
todoDisciplineHelper: ["Todo discipline", "待办纪律"],
|
|
8071
8073
|
enableRunInBackground: ["Allow background runs", "允许后台执行"],
|
|
8074
|
+
forceBackground: ["Force all delegations into background", "强制所有委派后台执行"],
|
|
8072
8075
|
backgroundMode: ["Background mode", "后台模式"],
|
|
8073
8076
|
maxDepth: ["Maximum depth", "最大深度"],
|
|
8074
8077
|
policy: ["Policy", "策略"],
|
|
@@ -8895,6 +8898,7 @@ function Field({ schema, path, controller, initiallyOpen = false, disclosures, t
|
|
|
8895
8898
|
] })
|
|
8896
8899
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScalarField, { schema, path, controller, inherited, t }),
|
|
8897
8900
|
name2 === "modelParameters.passthrough" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "dsmm-hint", children: t("modelParametersHint") }),
|
|
8901
|
+
name2 === "subagents.forceBackground" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "dsmm-hint", children: t("forceBackgroundHint") }),
|
|
8898
8902
|
name2 === "permissionControl.enabled" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "dsmm-hint", children: permissionText(t)("coldHint") })
|
|
8899
8903
|
] });
|
|
8900
8904
|
}
|
|
@@ -10235,6 +10239,11 @@ var roleToolEn = {
|
|
|
10235
10239
|
error: "Failed",
|
|
10236
10240
|
stopped: "Interrupted",
|
|
10237
10241
|
technicalDetails: "Technical details",
|
|
10242
|
+
observation: "Route observation",
|
|
10243
|
+
observationUnavailable: "Unavailable",
|
|
10244
|
+
observationConnecting: "Connecting",
|
|
10245
|
+
observationLive: "Live",
|
|
10246
|
+
observationStale: "Connection lost",
|
|
10238
10247
|
args: "Original arguments",
|
|
10239
10248
|
preparingArgs: "Arguments received so far",
|
|
10240
10249
|
output: "Complete result content",
|
|
@@ -10275,6 +10284,11 @@ var roleToolZh = {
|
|
|
10275
10284
|
error: "失败",
|
|
10276
10285
|
stopped: "已中断",
|
|
10277
10286
|
technicalDetails: "技术详情",
|
|
10287
|
+
observation: "路由观测",
|
|
10288
|
+
observationUnavailable: "不可用",
|
|
10289
|
+
observationConnecting: "连接中",
|
|
10290
|
+
observationLive: "实时",
|
|
10291
|
+
observationStale: "连接已断开",
|
|
10278
10292
|
args: "原始参数",
|
|
10279
10293
|
preparingArgs: "目前已收到的参数",
|
|
10280
10294
|
output: "完整结果内容",
|
|
@@ -10338,6 +10352,8 @@ function RoleToolView(props) {
|
|
|
10338
10352
|
const raw = props.phase === "preparing" ? partial.preview : props.phase === "start" ? props.block.argsRaw : props.block.call?.argsRaw ?? "";
|
|
10339
10353
|
const requested = partial?.requested ?? requestedRoleTool(props.toolName, raw);
|
|
10340
10354
|
const observation = props.useRoleCalls((state2) => state2.calls.get(props.callId));
|
|
10355
|
+
const observationStatus = props.useRoleCalls((state2) => state2.status);
|
|
10356
|
+
const observationIssue2 = props.useRoleCalls((state2) => state2.issue);
|
|
10341
10357
|
const result = props.phase === "result" ? props.block : void 0;
|
|
10342
10358
|
const failed = result !== void 0 && (result.isError || result.error != null);
|
|
10343
10359
|
const persisted = result === void 0 ? void 0 : actualRoleTool(props.toolName, result.meta, failed);
|
|
@@ -10456,6 +10472,12 @@ function RoleToolView(props) {
|
|
|
10456
10472
|
t("routeUnknown")
|
|
10457
10473
|
] })
|
|
10458
10474
|
] }),
|
|
10475
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "dsmm-role-identity", "data-observation-status": observationStatus, children: [
|
|
10476
|
+
t("observation"),
|
|
10477
|
+
": ",
|
|
10478
|
+
t({ unavailable: "observationUnavailable", connecting: "observationConnecting", live: "observationLive", stale: "observationStale" }[observationStatus]),
|
|
10479
|
+
observationIssue2 !== void 0 && ` · ${observationIssue2.kind}/${observationIssue2.code}`
|
|
10480
|
+
] }),
|
|
10459
10481
|
requested.description !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-task", children: requested.description }),
|
|
10460
10482
|
result?.error != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "dsmm-role-failure", children: [
|
|
10461
10483
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "dsmm-role-section-title", children: t("failure") }),
|
|
@@ -10512,20 +10534,51 @@ function registerRoleToolViews(ctx, observations) {
|
|
|
10512
10534
|
});
|
|
10513
10535
|
}
|
|
10514
10536
|
|
|
10537
|
+
// node_modules/.pnpm/@deepseek-ai+dsh-typert-protocol@0.2.1-rc.2_@deepseek-ai+cordis@4.0.5/node_modules/@deepseek-ai/dsh-typert-protocol/lib/index.js
|
|
10538
|
+
function remoteErrorOf(value) {
|
|
10539
|
+
if (typeof value === "object" && value !== null && value.isDSHRemoteError === true && typeof value.code === "string") return value;
|
|
10540
|
+
}
|
|
10541
|
+
var TYPERT_OWNED_VALUE = Symbol.for("dsh.typert.owned-value");
|
|
10542
|
+
|
|
10515
10543
|
// src/client/role-call-observations.ts
|
|
10544
|
+
var ObservationProtocolError = class extends Error {
|
|
10545
|
+
constructor(code) {
|
|
10546
|
+
super(code);
|
|
10547
|
+
this.code = code;
|
|
10548
|
+
}
|
|
10549
|
+
};
|
|
10550
|
+
function observationIssue(error) {
|
|
10551
|
+
if (error instanceof ObservationProtocolError) return { kind: "protocol", code: error.code };
|
|
10552
|
+
const remote = remoteErrorOf(error);
|
|
10553
|
+
if (remote?.code === "dsmm-children/refused") {
|
|
10554
|
+
try {
|
|
10555
|
+
return { kind: "domain", ...parseRoleControlErrorInfo(remote.details) };
|
|
10556
|
+
} catch {
|
|
10557
|
+
return { kind: "protocol", code: "invalid-error" };
|
|
10558
|
+
}
|
|
10559
|
+
}
|
|
10560
|
+
return { kind: "transport", code: remote?.code === "gateway/cancelled" ? "cancelled" : remote?.code === "gateway/internal" ? "internal" : "unavailable" };
|
|
10561
|
+
}
|
|
10516
10562
|
var RoleCallObservationController = class {
|
|
10517
10563
|
binding = null;
|
|
10518
10564
|
sources = /* @__PURE__ */ new Map();
|
|
10565
|
+
disposed = false;
|
|
10519
10566
|
source(sessionId2) {
|
|
10520
10567
|
let source = this.sources.get(sessionId2);
|
|
10521
10568
|
if (source === void 0) {
|
|
10522
10569
|
source = new RoleCallObservationSource(sessionId2);
|
|
10523
|
-
|
|
10570
|
+
if (this.disposed) source.dispose();
|
|
10571
|
+
else source.bind(this.binding);
|
|
10524
10572
|
this.sources.set(sessionId2, source);
|
|
10525
10573
|
}
|
|
10526
10574
|
return source;
|
|
10527
10575
|
}
|
|
10576
|
+
observeSessionAvailability(sessionId2, available) {
|
|
10577
|
+
if (!this.disposed && available) this.sources.get(sessionId2)?.observeAvailability();
|
|
10578
|
+
}
|
|
10528
10579
|
bindConnection(factory, open) {
|
|
10580
|
+
if (this.disposed) return () => {
|
|
10581
|
+
};
|
|
10529
10582
|
const binding = { identity: {}, factory, open };
|
|
10530
10583
|
this.binding = binding;
|
|
10531
10584
|
for (const source of this.sources.values()) source.bind(binding);
|
|
@@ -10536,6 +10589,7 @@ var RoleCallObservationController = class {
|
|
|
10536
10589
|
};
|
|
10537
10590
|
}
|
|
10538
10591
|
dispose() {
|
|
10592
|
+
this.disposed = true;
|
|
10539
10593
|
this.binding = null;
|
|
10540
10594
|
for (const source of this.sources.values()) source.dispose();
|
|
10541
10595
|
this.sources.clear();
|
|
@@ -10551,25 +10605,38 @@ var RoleCallObservationSource = class {
|
|
|
10551
10605
|
binding = null;
|
|
10552
10606
|
revision = 0;
|
|
10553
10607
|
stream;
|
|
10608
|
+
hint = 0;
|
|
10609
|
+
consumedHint = 0;
|
|
10610
|
+
disposed = false;
|
|
10554
10611
|
getSnapshot() {
|
|
10555
10612
|
return this.snapshot;
|
|
10556
10613
|
}
|
|
10614
|
+
observeAvailability() {
|
|
10615
|
+
if (this.disposed || this.binding === null || this.listeners.size === 0) return;
|
|
10616
|
+
this.hint++;
|
|
10617
|
+
if (this.snapshot.status === "live") this.consumedHint = this.hint;
|
|
10618
|
+
else this.start();
|
|
10619
|
+
}
|
|
10557
10620
|
subscribe(listener) {
|
|
10621
|
+
if (this.disposed) return () => {
|
|
10622
|
+
};
|
|
10558
10623
|
this.listeners.add(listener);
|
|
10559
10624
|
if (this.listeners.size === 1) this.start();
|
|
10560
10625
|
return () => {
|
|
10561
10626
|
this.listeners.delete(listener);
|
|
10562
10627
|
if (this.listeners.size !== 0) return;
|
|
10563
10628
|
this.revision++;
|
|
10629
|
+
this.consumedHint = this.hint;
|
|
10564
10630
|
const stream = this.stream;
|
|
10565
10631
|
this.stream = void 0;
|
|
10566
10632
|
if (stream !== void 0) void stream.dispose();
|
|
10567
10633
|
};
|
|
10568
10634
|
}
|
|
10569
10635
|
bind(binding) {
|
|
10570
|
-
if (this.binding?.identity === binding?.identity) return;
|
|
10636
|
+
if (this.disposed || this.binding?.identity === binding?.identity) return;
|
|
10571
10637
|
this.binding = binding;
|
|
10572
10638
|
this.revision++;
|
|
10639
|
+
this.consumedHint = this.hint;
|
|
10573
10640
|
const stream = this.stream;
|
|
10574
10641
|
this.stream = void 0;
|
|
10575
10642
|
if (stream !== void 0) void stream.dispose();
|
|
@@ -10577,8 +10644,10 @@ var RoleCallObservationSource = class {
|
|
|
10577
10644
|
if (this.listeners.size > 0) this.start();
|
|
10578
10645
|
}
|
|
10579
10646
|
dispose() {
|
|
10647
|
+
this.disposed = true;
|
|
10580
10648
|
this.binding = null;
|
|
10581
10649
|
this.revision++;
|
|
10650
|
+
this.consumedHint = this.hint;
|
|
10582
10651
|
const stream = this.stream;
|
|
10583
10652
|
this.stream = void 0;
|
|
10584
10653
|
if (stream !== void 0) void stream.dispose();
|
|
@@ -10586,18 +10655,19 @@ var RoleCallObservationSource = class {
|
|
|
10586
10655
|
}
|
|
10587
10656
|
start() {
|
|
10588
10657
|
const binding = this.binding;
|
|
10589
|
-
if (binding === null || this.listeners.size === 0 || this.stream !== void 0) return;
|
|
10658
|
+
if (this.disposed || binding === null || this.listeners.size === 0 || this.stream !== void 0) return;
|
|
10590
10659
|
const revision2 = ++this.revision;
|
|
10591
|
-
this.
|
|
10660
|
+
this.consumedHint = this.hint;
|
|
10592
10661
|
const stream = binding.factory.$stream({
|
|
10593
10662
|
name: `DSMM role calls for ${this.sessionId}`,
|
|
10594
10663
|
open: (signal) => binding.open(this.sessionId, signal),
|
|
10595
10664
|
ended: (accepted) => new Error(`DSMM role call stream ended ${accepted ? "after" : "before"} its snapshot`),
|
|
10596
10665
|
carrierFailed: () => {
|
|
10597
|
-
if (this.revision === revision2 && this.stream === stream) this.invalidate("stale");
|
|
10666
|
+
if (this.revision === revision2 && this.stream === stream) this.invalidate("stale", { kind: "transport", code: "unavailable" });
|
|
10598
10667
|
}
|
|
10599
10668
|
});
|
|
10600
10669
|
this.stream = stream;
|
|
10670
|
+
this.invalidate("connecting", this.snapshot.issue);
|
|
10601
10671
|
void this.consume(stream, revision2);
|
|
10602
10672
|
}
|
|
10603
10673
|
async consume(stream, revision2) {
|
|
@@ -10606,38 +10676,42 @@ var RoleCallObservationSource = class {
|
|
|
10606
10676
|
for await (const item of stream) {
|
|
10607
10677
|
if (this.revision !== revision2 || this.stream !== stream) return;
|
|
10608
10678
|
const frame = item.value;
|
|
10609
|
-
if (frame.sessionId !== this.sessionId) throw new
|
|
10679
|
+
if (frame.sessionId !== this.sessionId) throw new ObservationProtocolError("invalid-frame");
|
|
10610
10680
|
if (item.generation !== generation) {
|
|
10611
|
-
if (frame.type !== "snapshot") throw new
|
|
10681
|
+
if (frame.type !== "snapshot") throw new ObservationProtocolError("invalid-frame");
|
|
10612
10682
|
generation = item.generation;
|
|
10613
10683
|
admissionEpoch = frame.admissionEpoch;
|
|
10684
|
+
this.consumedHint = this.hint;
|
|
10685
|
+
item.accept();
|
|
10614
10686
|
this.publish({
|
|
10615
10687
|
sessionId: this.sessionId,
|
|
10616
10688
|
status: "live",
|
|
10617
10689
|
admissionEpoch,
|
|
10618
10690
|
calls: new Map(frame.calls.map((call) => [call.callId, call]))
|
|
10619
10691
|
});
|
|
10620
|
-
item.accept();
|
|
10621
10692
|
continue;
|
|
10622
10693
|
}
|
|
10623
|
-
if (frame.type === "snapshot" || frame.admissionEpoch !== admissionEpoch) throw new
|
|
10694
|
+
if (frame.type === "snapshot" || frame.admissionEpoch !== admissionEpoch) throw new ObservationProtocolError("invalid-frame");
|
|
10624
10695
|
const calls = new Map(this.snapshot.calls);
|
|
10625
10696
|
if (frame.type === "update") calls.set(frame.call.callId, frame.call);
|
|
10626
10697
|
else calls.delete(frame.callId);
|
|
10627
10698
|
this.publish({ sessionId: this.sessionId, status: "live", admissionEpoch, calls });
|
|
10628
10699
|
}
|
|
10629
|
-
} catch {
|
|
10630
|
-
if (this.revision === revision2 && this.stream === stream) this.invalidate("unavailable");
|
|
10700
|
+
} catch (error) {
|
|
10701
|
+
if (this.revision === revision2 && this.stream === stream) this.invalidate("unavailable", observationIssue(error));
|
|
10631
10702
|
} finally {
|
|
10632
|
-
if (this.revision === revision2 && this.stream === stream)
|
|
10703
|
+
if (this.revision === revision2 && this.stream === stream) {
|
|
10704
|
+
this.stream = void 0;
|
|
10705
|
+
if (this.hint > this.consumedHint) this.start();
|
|
10706
|
+
}
|
|
10633
10707
|
}
|
|
10634
10708
|
}
|
|
10635
|
-
invalidate(status) {
|
|
10709
|
+
invalidate(status, issue) {
|
|
10636
10710
|
const calls = new Map([...this.snapshot.calls].map(([callId, call]) => [callId, call.phase === "settled" ? call : Object.freeze({
|
|
10637
10711
|
...call,
|
|
10638
10712
|
actualRoute: Object.freeze({ status: "unknown", reason: "not-observed" })
|
|
10639
10713
|
})]));
|
|
10640
|
-
this.publish({ ...this.snapshot, status, calls });
|
|
10714
|
+
this.publish({ ...this.snapshot, status, issue, calls });
|
|
10641
10715
|
}
|
|
10642
10716
|
publish(snapshot4) {
|
|
10643
10717
|
this.snapshot = snapshot4;
|
|
@@ -11297,8 +11371,6 @@ async function apply(ctx) {
|
|
|
11297
11371
|
ctx.effect(() => ctx.locale.register(PERMISSIONS_NS, { en: permissionEn, zh: permissionZh }), "dsmm: permission locale");
|
|
11298
11372
|
void ctx.inject(["connection"], (connectionCtx) => {
|
|
11299
11373
|
const handle = connectionCtx.connection, invoke = permissionClient(handle);
|
|
11300
|
-
const unbindRoleCalls = roleCalls.bindConnection(connectionCtx.remote, (sessionId2, signal) => connectionCtx.remote.dsmmChildren.observe(sessionId2, signal));
|
|
11301
|
-
connectionCtx.effect(() => unbindRoleCalls, "dsmm: role call connection withdrawal");
|
|
11302
11374
|
const update = () => {
|
|
11303
11375
|
const generation = handle.generation.getSnapshot();
|
|
11304
11376
|
permissions.bindConnection(generation === void 0 ? null : invoke, generation);
|
|
@@ -11307,6 +11379,34 @@ async function apply(ctx) {
|
|
|
11307
11379
|
connectionCtx.effect(() => handle.generation.subscribe(update));
|
|
11308
11380
|
connectionCtx.effect(() => () => permissions.bindConnection(null), "dsmm: permission connection withdrawal");
|
|
11309
11381
|
});
|
|
11382
|
+
void ctx.inject(["connection", "remote.dsmmChildren"], (connectionCtx) => {
|
|
11383
|
+
const handle = connectionCtx.connection;
|
|
11384
|
+
let active = true, observedGeneration;
|
|
11385
|
+
let unbindRoleCalls, stopReady;
|
|
11386
|
+
const update = () => {
|
|
11387
|
+
if (!active) return;
|
|
11388
|
+
const generation = handle.generation.getSnapshot();
|
|
11389
|
+
if (generation === observedGeneration) return;
|
|
11390
|
+
stopReady?.();
|
|
11391
|
+
unbindRoleCalls?.();
|
|
11392
|
+
stopReady = void 0;
|
|
11393
|
+
unbindRoleCalls = void 0;
|
|
11394
|
+
observedGeneration = generation;
|
|
11395
|
+
if (generation === void 0) return;
|
|
11396
|
+
unbindRoleCalls = roleCalls.bindConnection(connectionCtx.remote, (sessionId2, signal) => connectionCtx.remote.dsmmChildren.observe(sessionId2, signal));
|
|
11397
|
+
stopReady = connectionCtx.remote.$on("api-session/added", (summary) => {
|
|
11398
|
+
if (!active || observedGeneration !== generation || handle.generation.getSnapshot() !== generation) return;
|
|
11399
|
+
roleCalls.observeSessionAvailability(summary.sessionId, summary.agentAvailable);
|
|
11400
|
+
});
|
|
11401
|
+
};
|
|
11402
|
+
update();
|
|
11403
|
+
connectionCtx.effect(() => handle.generation.subscribe(update));
|
|
11404
|
+
connectionCtx.effect(() => () => {
|
|
11405
|
+
active = false;
|
|
11406
|
+
stopReady?.();
|
|
11407
|
+
unbindRoleCalls?.();
|
|
11408
|
+
}, "dsmm: role call connection withdrawal");
|
|
11409
|
+
});
|
|
11310
11410
|
void ctx.inject(["uiSession", "sessions"], (sessionCtx) => {
|
|
11311
11411
|
const source = sessionCtx.uiSession.adapter.current, sessions = sessionCtx.sessions;
|
|
11312
11412
|
sessionCtx.effect(() => bindPermissionSession(source, sessions, permissions), "dsmm: permission native session withdrawal");
|
package/lib/model-family.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ interface ModelNameRecognition {
|
|
|
11
11
|
gemini4: boolean;
|
|
12
12
|
}
|
|
13
13
|
/** Model fields are complete names here; route owners separate provider metadata. */
|
|
14
|
-
export declare function recognizeModelName(model: string
|
|
14
|
+
export declare function recognizeModelName(model: string, options?: {
|
|
15
|
+
promptAliases?: boolean;
|
|
16
|
+
}): ModelNameRecognition | undefined;
|
|
15
17
|
export declare function classifyModelFamily(input: {
|
|
16
18
|
providerID?: string;
|
|
17
19
|
modelID?: string;
|
package/lib/model-family.js
CHANGED
|
@@ -15,7 +15,7 @@ function versionStartsAt(name, start) {
|
|
|
15
15
|
const token = /^[a-z0-9]+/u.exec(name.slice(start))?.[0] ?? "";
|
|
16
16
|
return /^\d/u.test(token) && !suffixNumber(token);
|
|
17
17
|
}
|
|
18
|
-
function readVersion(name, start, family) {
|
|
18
|
+
function readVersion(name, start, family, kimiPVersion = false) {
|
|
19
19
|
const parts = [];
|
|
20
20
|
let end = start;
|
|
21
21
|
let cursor = start;
|
|
@@ -26,6 +26,10 @@ function readVersion(name, start, family) {
|
|
|
26
26
|
const numberEnd = cursor + digits.length;
|
|
27
27
|
parts.push(Number(digits));
|
|
28
28
|
end = numberEnd;
|
|
29
|
+
if (kimiPVersion && parts.length === 1 && /^p(?=\d)/u.test(name.slice(numberEnd))) {
|
|
30
|
+
cursor = numberEnd + 1;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
29
33
|
if (/^[a-z]/u.test(name.slice(numberEnd))) {
|
|
30
34
|
series = seriesAt(name, numberEnd, family);
|
|
31
35
|
if (series === undefined || versionStartsAt(name, skipSeparators(name, numberEnd + series.length))) {
|
|
@@ -64,9 +68,9 @@ function identifierFor(marker) {
|
|
|
64
68
|
return marker;
|
|
65
69
|
}
|
|
66
70
|
/** Model fields are complete names here; route owners separate provider metadata. */
|
|
67
|
-
export function recognizeModelName(model) {
|
|
71
|
+
export function recognizeModelName(model, options = {}) {
|
|
68
72
|
const name = model.trim().toLowerCase();
|
|
69
|
-
const markers = name.matchAll(/(?<![a-z0-9])(?:(?:chatgpt|gpt|codex|claude|fable|gemini|glm|deepseek|kimi|opus|sonnet|haiku|sol|terra|astra|luna)(?=\d|[^a-z0-9]|$)|(?:k2[-_.\s/]*p[5-8]|swe[-_.\s/]+2)(?![a-z0-9])|\d+)/gu);
|
|
73
|
+
const markers = name.matchAll(/(?<![a-z0-9])(?:(?:chatgpt|gpt|codex|claude|fable|gemini|glm|deepseek|kimi|opus|sonnet|haiku|sol|terra|astra|luna)(?=\d|[^a-z0-9]|$)|(?:k2[-_.\s/]*p[5-8]|swe[-_.\s/]+2)(?![a-z0-9])|k(?=\d)|\d+)/gu);
|
|
70
74
|
let first;
|
|
71
75
|
let consumedEnd = 0;
|
|
72
76
|
for (const marker of markers) {
|
|
@@ -76,7 +80,15 @@ export function recognizeModelName(model) {
|
|
|
76
80
|
let parsed;
|
|
77
81
|
let wildcardGemini4 = false;
|
|
78
82
|
let series = seriesAt(name, marker.index);
|
|
79
|
-
if (
|
|
83
|
+
if (marker[0] === "k") {
|
|
84
|
+
if (!options.promptAliases || marker.index > 0 && name[marker.index - 1] !== "/")
|
|
85
|
+
continue;
|
|
86
|
+
identifier = "kimi";
|
|
87
|
+
parsed = readVersion(name, marker.index + 1, identifier, true);
|
|
88
|
+
if (parsed.version === undefined || parsed.version[0] < 3)
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
else if (/^\d/u.test(marker[0])) {
|
|
80
92
|
// Numeric spans include malformed segments; never restart at their later digits.
|
|
81
93
|
if (/(?:\d|(?<![a-z0-9])\d[a-z0-9]*)[-_.\s/]+$/u.test(name.slice(consumedEnd, marker.index)))
|
|
82
94
|
continue;
|
|
@@ -97,6 +109,9 @@ export function recognizeModelName(model) {
|
|
|
97
109
|
identifier = identifierFor(marker[0]);
|
|
98
110
|
const markerEnd = marker.index + marker[0].length;
|
|
99
111
|
let start = skipSeparators(name, markerEnd);
|
|
112
|
+
const kimiKVersion = options.promptAliases && identifier === "kimi" && /^k(?=\d)/u.test(name.slice(start));
|
|
113
|
+
if (kimiKVersion)
|
|
114
|
+
start++;
|
|
100
115
|
series = start > markerEnd ? seriesAt(name, start, identifier) : undefined;
|
|
101
116
|
if (series !== undefined)
|
|
102
117
|
start = skipSeparators(name, start + series.length);
|
|
@@ -109,7 +124,10 @@ export function recognizeModelName(model) {
|
|
|
109
124
|
const compactGemini4 = identifier === "gemini" && /^4(?=[^a-z0-9]|$)/u.test(name.slice(start));
|
|
110
125
|
parsed = start === markerEnd && identifier !== "gpt" && !compactGemini4
|
|
111
126
|
? { version: undefined, versionParts: undefined, series: undefined, end: markerEnd }
|
|
112
|
-
: readVersion(name, start, identifier);
|
|
127
|
+
: readVersion(name, start, identifier, options.promptAliases && identifier === "kimi");
|
|
128
|
+
}
|
|
129
|
+
if (kimiKVersion && /^27(?=[^a-z0-9]|$)/u.test(name.slice(start))) {
|
|
130
|
+
parsed = { ...parsed, version: [2, 7, 0], versionParts: 2 };
|
|
113
131
|
}
|
|
114
132
|
series ??= parsed.series;
|
|
115
133
|
}
|
|
@@ -39,7 +39,7 @@ const configFields = {
|
|
|
39
39
|
deepseekV4ProMaxReasoningPresets: null, deepseekFlashMaxReasoningPresets: null,
|
|
40
40
|
modules: { deepwork: { enabled: null } },
|
|
41
41
|
skills: "skills", roles: "roles", roleRouting: "role-routing", runtimePolicy: { strategy: null, rateLimit },
|
|
42
|
-
presets: { materialize: null, root: null }, subagents: { toolTopology: null, allowRouteOverride: null, enableRunInBackground: null, backgroundMode: null, maxDepth: null },
|
|
42
|
+
presets: { materialize: null, root: null }, subagents: { toolTopology: null, allowRouteOverride: null, enableRunInBackground: null, forceBackground: null, backgroundMode: null, maxDepth: null },
|
|
43
43
|
workflow: { policy: null, strictGates: null, reviewCap: null, finalReviewPolicy: null },
|
|
44
44
|
guards: { scope: null, shellCommandSafety: null, gitWriteGuard: null, gitWriteScope: null, toolOutputTruncation: { enabled: null, maxInlineBytes: null }, planFormatValidation: null, questionLabelHelper: { enabled: null, maxLabelChars: null }, todoDisciplineHelper: null },
|
|
45
45
|
runtimeRecovery: { enabled: null, retryOnStatusCodes: [null], retryOnCodes: [null], fallbackRoutes: [route], maxFallbackAttempts: null, idleContinuation: { enabled: null, maxContinuations: null, prompt: null } },
|
package/lib/prompt-content.js
CHANGED
|
@@ -35,6 +35,6 @@ export function splitCategory(text) {
|
|
|
35
35
|
export function buildRolePersona(role) {
|
|
36
36
|
const source = role.promptArtifact === null ? role.description : readPromptAsset(role.promptArtifact.replace("prompts/source/", ""));
|
|
37
37
|
const body = role.kind === "category" ? splitCategory(source).base : source;
|
|
38
|
-
return [readPromptAsset("shared/locale.md"), body, readPromptAsset(
|
|
38
|
+
return [readPromptAsset("shared/locale.md"), body, readPromptAsset(role.terminalArtifact.replace("prompts/source/", ""))].filter(Boolean).join("\n\n---\n\n");
|
|
39
39
|
}
|
|
40
40
|
//# sourceMappingURL=prompt-content.js.map
|
package/lib/prompts.js
CHANGED
|
@@ -9,13 +9,15 @@ Use this workflow only while the \`{{modeName}}\` mode is effectively active. Th
|
|
|
9
9
|
Skills are native metadata and lazy bodies, never automatically injected. Load matching skills only through the actual native skill catalog. Treat \`[dsmm safety]\` messages as binding feedback. Implementing does not authorize a commit; a commit does not authorize push/tag/rebase/release.
|
|
10
10
|
Understand the requested outcome and relevant facts first. Load the full \`brainstorming\` skill through the native catalog when material uncertainty needs discovery or design; clear, authorized work proceeds directly through the applicable workflow. Ask only for a material scope, acceptance, security, data, API/protocol, permission or irreversible-action decision, missing input that would materially change delivery, or an explicit checkpoint. Role-first boundaries and orchestrator-owned planner/critic responsibilities remain unchanged.
|
|
11
11
|
</dsmm-deepwork-mode>`;
|
|
12
|
-
const commonDeepworkPrompt = [activation, asset("deepwork/default.md"), asset("shared/shell-safety.md")
|
|
12
|
+
const commonDeepworkPrompt = [activation, asset("deepwork/default.md"), asset("shared/shell-safety.md")].join("\n\n---\n\n");
|
|
13
13
|
export const BASE_DEEPWORK_PROMPT = [commonDeepworkPrompt, readSharedPromptAsset("avoid-ai-slop.md")].join("\n\n---\n\n");
|
|
14
14
|
export function promptModelVariants(role, model) {
|
|
15
|
-
const recognized = recognizeModelName(model);
|
|
15
|
+
const recognized = recognizeModelName(model, { promptAliases: true });
|
|
16
16
|
const identifier = recognized?.identifier;
|
|
17
17
|
const gpt = identifier === "gpt" || identifier === "codex";
|
|
18
|
-
const
|
|
18
|
+
const version = recognized?.version;
|
|
19
|
+
const kimi = version !== undefined && (version[0] > 3 || version[0] === 3 && version[1] >= 1) ? "kimi-k3-1" : "kimi";
|
|
20
|
+
const additive = gpt ? ["gpt"] : identifier === "kimi" ? [kimi] : recognized?.gemini4 ? ["gemini-4"] : identifier === "swe-2" ? ["swe-2"] : [];
|
|
19
21
|
const base = role === "planner" ? "planner" : role === "orchestrator" && recognized?.opus5 ? "claude-opus-5"
|
|
20
22
|
: recognized?.family === "codex" ? "codex" : gpt ? "gpt" : identifier === "gemini" ? "gemini" : identifier === "glm" ? "glm" : "default";
|
|
21
23
|
return [...new Set([base, ...additive])].filter((variant) => variant !== "default");
|
|
@@ -25,12 +27,12 @@ export function roleModelCalibration(role, model) {
|
|
|
25
27
|
const layers = variants.map((variant) => asset(`deepwork/${variant}.md`));
|
|
26
28
|
if (role?.kind === "category" && role.promptArtifact !== null) {
|
|
27
29
|
const category = splitCategory(asset(role.promptArtifact.replace("prompts/source/", "")));
|
|
28
|
-
const identifier = recognizeModelName(model)?.identifier;
|
|
30
|
+
const identifier = recognizeModelName(model, { promptAliases: true })?.identifier;
|
|
29
31
|
const family = identifier === "gpt" || identifier === "codex" ? "gpt"
|
|
30
32
|
: identifier === "gemini" || identifier === "glm" || identifier === "claude" ? identifier : "unknown";
|
|
31
33
|
// Categories carry only their own family layer + additive model calibration,
|
|
32
34
|
// not the base-agent Gemini/GLM/planner workflow variants.
|
|
33
|
-
return [category.calibrations.get(family), ...layers.filter((_layer, index) => ["gpt", "kimi", "gemini-4", "swe-2"].includes(variants[index]))].filter(Boolean).join("\n\n---\n\n");
|
|
35
|
+
return [category.calibrations.get(family), ...layers.filter((_layer, index) => ["gpt", "kimi", "kimi-k3-1", "gemini-4", "swe-2"].includes(variants[index]))].filter(Boolean).join("\n\n---\n\n");
|
|
34
36
|
}
|
|
35
37
|
return layers.join("\n\n---\n\n");
|
|
36
38
|
}
|
|
@@ -48,6 +50,7 @@ function projectInvocation({ routeKind, view }) {
|
|
|
48
50
|
}
|
|
49
51
|
/** Render callable delegation and lifecycle observations without repeating Agent locale. */
|
|
50
52
|
export function buildDsmmDelegationGuidance(settings, observed) {
|
|
53
|
+
const backgroundEnabled = settings.subagents.enableRunInBackground || settings.subagents.forceBackground;
|
|
51
54
|
const availability = new Map(observed.roleAvailability?.map(row => [row.id, row]));
|
|
52
55
|
const delegation = observed.delegation.flatMap(entry => {
|
|
53
56
|
const tool = observed.tools.find(tool => tool.name === entry.name);
|
|
@@ -64,9 +67,10 @@ export function buildDsmmDelegationGuidance(settings, observed) {
|
|
|
64
67
|
targets: targets.map(id => ({ id, ...(properties.level === undefined ? {} : { levels: ["normal", "low", "high", "max"]
|
|
65
68
|
.filter(level => Array.isArray(levelEnum) && levelEnum.includes(level) && (level === "normal" || settings.roleRouting[id]?.levels?.[level] !== undefined)) }) })),
|
|
66
69
|
parameters: Object.keys(properties).filter(name => (name !== "route" || settings.subagents.allowRouteOverride)
|
|
67
|
-
&& (name !== "run_in_background" ||
|
|
70
|
+
&& (name !== "run_in_background" || backgroundEnabled)),
|
|
68
71
|
routeOverride: settings.subagents.allowRouteOverride && properties.route !== undefined,
|
|
69
|
-
background:
|
|
72
|
+
background: backgroundEnabled && properties.run_in_background !== undefined,
|
|
73
|
+
forceBackground: settings.subagents.forceBackground && properties.run_in_background !== undefined }];
|
|
70
74
|
});
|
|
71
75
|
const controls = observed.tools.filter(tool => ["send_message", "interrupt_agent", "job_output", "job_list", "job_kill", "dsmm_children"].includes(tool.name));
|
|
72
76
|
const runtime = observed.runtimeAdmission === undefined ? undefined : {
|
|
@@ -77,7 +81,8 @@ export function buildDsmmDelegationGuidance(settings, observed) {
|
|
|
77
81
|
const ready = runtime?.binding === "stock" && runtime.deliveryFenceReady;
|
|
78
82
|
const liveDelivery = ready && observed.capabilities?.nativeChildDelivery === true;
|
|
79
83
|
const lifecycle = {
|
|
80
|
-
backgroundEnabled
|
|
84
|
+
backgroundEnabled,
|
|
85
|
+
forceBackground: settings.subagents.forceBackground,
|
|
81
86
|
continuable: observed.capabilities?.continuable === true && ready,
|
|
82
87
|
nativeChildDelivery: liveDelivery,
|
|
83
88
|
sendMessage: liveDelivery && controls.some(tool => tool.name === "send_message"),
|
|
@@ -96,8 +101,8 @@ Only the listed callable entries and target enums are observed here. Role availa
|
|
|
96
101
|
sections.push(`<dsmm-observed-invocation>\n${JSON.stringify(projectInvocation(observed.invocation), null, 2)}\n</dsmm-observed-invocation>\nThe routeKind labels this observation: initial is preflighted start, not a claim about the current fallback route; actual is supplied by observed native request/status. Level is resource selection, never added permissions or a smaller verification obligation.`);
|
|
97
102
|
sections.push(`<dsmm-child-lifecycle>
|
|
98
103
|
<dsmm-child-lifecycle-state>\n${JSON.stringify(lifecycle, null, 2)}\n</dsmm-child-lifecycle-state>
|
|
99
|
-
${settings.subagents.enableRunInBackground ? "Background is enabled in this Agent's captured deployment policy; only tools that expose run_in_background may request it." : "Background is disabled in this Agent's captured policy; do not request it."}
|
|
100
|
-
Role calls wait for the native activation result by default. Explicit run_in_background:true chooses native parent delivery before starting and returns accepted child/message identity, not a completion or a job handle. Running calls cannot transfer foreground/background ownership. Partial output with a non-completed stop reason is not success and must not be replayed automatically.
|
|
104
|
+
${settings.subagents.forceBackground ? "This Agent's captured deployment policy forces all admitted role/category calls into background parent delivery, whether run_in_background is omitted, true or false. This takes priority over enableRunInBackground." : backgroundEnabled ? "Background is enabled in this Agent's captured deployment policy; only tools that expose run_in_background may request it." : "Background is disabled in this Agent's captured policy; do not request it."}
|
|
105
|
+
${settings.subagents.forceBackground ? "Forced background calls choose native parent delivery before starting and return accepted child/message identity, not a completion or a job handle." : "Role calls wait for the native activation result by default. Explicit run_in_background:true chooses native parent delivery before starting and returns accepted child/message identity, not a completion or a job handle."} Running calls cannot transfer foreground/background ownership. Partial output with a non-completed stop reason is not success and must not be replayed automatically.
|
|
101
106
|
${lifecycle.sendMessage ? "Exposed send_message can address a permitted exact live adjacent child. Running delivery reaches the nearest step; an idle live child can accept a next turn. Cold DSMM recovery is unavailable. An inbox receipt means accepted, not executed/completed. Each child retains its immutable admission; messages, metadata and later profile saves cannot grant authority." : "No live child messaging tool is observed here; do not invent one or infer it from role metadata."}
|
|
102
107
|
${lifecycle.browserPromptSurface !== null ? `The actual native user surface ${lifecycle.browserPromptSurface} uses queue/steer for continuable children, with native attachment validation. Its operator/connection/session/epoch/lifetime gate precedes inbox acceptance. Do not impersonate an Agent sender. After acceptance do not automatically retry; an unknown disconnect outcome needs verification, not a guessed idempotency guarantee.` : "No operator-gated native user queue/steer surface is established here; do not announce an unconnected DSMM RPC."}
|
|
103
108
|
${controls.some(tool => tool.name === "interrupt_agent") ? "Exposed interrupt_agent requests cancellation, not proof of completion or a message-delivery fence." : "No child interruption tool is observed here."}
|
package/lib/role-identity.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTraceable } from "@deepseek-ai/cordis";
|
|
2
2
|
import { nativeAgentContext } from "./native-scope.js";
|
|
3
|
-
import { buildRoleIdentity } from "./prompt-content.js";
|
|
4
|
-
import { DSMM_ROLES } from "./roles.js";
|
|
3
|
+
import { buildRoleIdentity, readPromptAsset } from "./prompt-content.js";
|
|
4
|
+
import { DSMM_ROLES, isDsmmRoleId } from "./roles.js";
|
|
5
5
|
/** The caller supplies the policy-admitted identity; only its Agent layer is changed. */
|
|
6
6
|
export function registerRoleHarnessIdentity(agent, role, child = false) {
|
|
7
7
|
const ctx = nativeAgentContext(agent);
|
|
@@ -9,12 +9,28 @@ export function registerRoleHarnessIdentity(agent, role, child = false) {
|
|
|
9
9
|
const definition = DSMM_ROLES.find(row => row.id === role);
|
|
10
10
|
const identity = prompt.section({ name: "harness:identity", order: prompt.getSectionOrder("HARNESS_IDENTITY"),
|
|
11
11
|
text: buildRoleIdentity(definition) });
|
|
12
|
+
let locale;
|
|
13
|
+
let neutralize;
|
|
12
14
|
try {
|
|
15
|
+
if (!child && !isDsmmRoleId(ctx.get("agentPresets")?.composedPreset(ctx))) {
|
|
16
|
+
locale = prompt.section({ name: "dsmm:locale-guidance", order: 48, interpolate: false, text: readPromptAsset("shared/locale.md") });
|
|
17
|
+
// The standard preset's model identity belongs to its persona, not harness:identity.
|
|
18
|
+
neutralize = ctx.on("system-prompt/assemble", async (_assembly, context, next) => {
|
|
19
|
+
const assembly = await next();
|
|
20
|
+
if (context.scope !== agent)
|
|
21
|
+
return assembly;
|
|
22
|
+
return { ...assembly, sections: assembly.sections.map(section => section.name === "deployment:persona-prefix" && section.interpolate !== false
|
|
23
|
+
? { ...section, text: section.text.replace("You are a coding agent powered by the {{model}} model.", "You are a coding agent.") }
|
|
24
|
+
: section) };
|
|
25
|
+
});
|
|
26
|
+
}
|
|
13
27
|
const persona = child ? prompt.section({ name: "deployment:persona-prefix", order: prompt.getSectionOrder("DEPLOYMENT_PERSONA_PREFIX"),
|
|
14
28
|
text: definition.persona }) : undefined;
|
|
15
|
-
return () => { persona?.(); identity(); };
|
|
29
|
+
return () => { persona?.(); neutralize?.(); locale?.(); identity(); };
|
|
16
30
|
}
|
|
17
31
|
catch (error) {
|
|
32
|
+
neutralize?.();
|
|
33
|
+
locale?.();
|
|
18
34
|
identity();
|
|
19
35
|
throw error;
|
|
20
36
|
}
|
package/lib/role-subagents.js
CHANGED
|
@@ -135,11 +135,13 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
135
135
|
const subagents = agentCtx.get("subagents");
|
|
136
136
|
if (subagents === undefined)
|
|
137
137
|
throw new Error("DSMM role tools require native subagents");
|
|
138
|
-
const
|
|
138
|
+
const forcedBackground = settings.subagents.forceBackground;
|
|
139
|
+
const background = settings.subagents.enableRunInBackground || forcedBackground;
|
|
139
140
|
const admittedProviders = new Map(entry.targets.map(target => [target, subagents.getProvider(roleProviderName(target))]));
|
|
140
141
|
const incomplete = new Map();
|
|
141
142
|
const definition = defineTool({
|
|
142
|
-
name: entry.name, description: `Delegate a bounded ${entry.kind} task through native activation. Waits for the useful result by default.${background ? " Set run_in_background to receive an accepted child/message receipt; native completion notifies the parent." : " Background execution is disabled."}`,
|
|
143
|
+
name: entry.name, description: `Delegate a bounded ${entry.kind} task through native activation.${forcedBackground ? " Deployment forces background parent delivery even when run_in_background is omitted or false. Returns an accepted child/message receipt; native completion notifies the parent." : ` Waits for the useful result by default.${background ? " Set run_in_background to receive an accepted child/message receipt; native completion notifies the parent." : " Background execution is disabled."}`}`,
|
|
144
|
+
isConcurrencySafe: () => true,
|
|
143
145
|
parameters: { description: { type: "string", required: true }, prompt: { type: "string", required: true },
|
|
144
146
|
...(entry.targetParameter === undefined ? {} : { [entry.targetParameter]: { type: "string", enum: entry.targets, required: true } }),
|
|
145
147
|
level: { type: "string", enum: ["normal", "low", "high", "max"] },
|
|
@@ -197,7 +199,7 @@ function registerRoleTool(agent, agentCtx, tools, entry, getSettings, policy, ad
|
|
|
197
199
|
throw new SubagentError("DSMM exact provider changed before delegation", "NO_PROVIDER");
|
|
198
200
|
};
|
|
199
201
|
signal.throwIfAborted();
|
|
200
|
-
const requestedBackground =
|
|
202
|
+
const requestedBackground = forcedBackground || settings.subagents.enableRunInBackground && args.run_in_background === true;
|
|
201
203
|
assertCurrent();
|
|
202
204
|
const pending = await admission.reserve(exec, invocation, provider, args.description, requestedBackground ? "parent" : "caller", request.maxDepth);
|
|
203
205
|
let activation;
|
package/lib/settings.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface DsmmSubagentSettings {
|
|
|
44
44
|
toolTopology: DsmmToolTopology;
|
|
45
45
|
allowRouteOverride: boolean;
|
|
46
46
|
enableRunInBackground: boolean;
|
|
47
|
+
forceBackground: boolean;
|
|
47
48
|
backgroundMode: "one-shot" | "continuable";
|
|
48
49
|
/** Omitted delegates to the native host limit (rc.2 default 1). */
|
|
49
50
|
maxDepth?: number;
|
package/lib/settings.js
CHANGED
|
@@ -26,7 +26,7 @@ export const DEFAULT_DSMM_SETTINGS = {
|
|
|
26
26
|
presets: {
|
|
27
27
|
materialize: false
|
|
28
28
|
},
|
|
29
|
-
subagents: { enableRunInBackground: false, backgroundMode: "one-shot", toolTopology: "per-role", allowRouteOverride: false },
|
|
29
|
+
subagents: { enableRunInBackground: false, forceBackground: false, backgroundMode: "one-shot", toolTopology: "per-role", allowRouteOverride: false },
|
|
30
30
|
workflow: {
|
|
31
31
|
policy: "risk-based",
|
|
32
32
|
strictGates: true,
|
|
@@ -129,6 +129,7 @@ const SUBAGENTS_SCHEMA = Schema.object({
|
|
|
129
129
|
toolTopology: Schema.union([Schema.const("per-role"), Schema.const("parameterized")]).default("per-role"),
|
|
130
130
|
allowRouteOverride: Schema.boolean().default(false),
|
|
131
131
|
enableRunInBackground: Schema.boolean().default(false),
|
|
132
|
+
forceBackground: Schema.boolean().default(false),
|
|
132
133
|
backgroundMode: Schema.union([Schema.const("one-shot"), Schema.const("continuable")]).default("one-shot"),
|
|
133
134
|
maxDepth: Schema.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER)
|
|
134
135
|
});
|