@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.
Files changed (58) hide show
  1. package/agent-presets/dsmm-builder/agent.cordis.yml +0 -10
  2. package/agent-presets/dsmm-clarifier/agent.cordis.yml +0 -10
  3. package/agent-presets/dsmm-code-search/agent.cordis.yml +0 -10
  4. package/agent-presets/dsmm-coding/agent.cordis.yml +0 -10
  5. package/agent-presets/dsmm-complex/agent.cordis.yml +0 -10
  6. package/agent-presets/dsmm-creative/agent.cordis.yml +0 -10
  7. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +0 -10
  8. package/agent-presets/dsmm-deep/agent.cordis.yml +0 -10
  9. package/agent-presets/dsmm-doc-search/agent.cordis.yml +0 -10
  10. package/agent-presets/dsmm-documenting/agent.cordis.yml +0 -10
  11. package/agent-presets/dsmm-frontend/agent.cordis.yml +0 -10
  12. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +0 -10
  13. package/agent-presets/dsmm-media-reader/agent.cordis.yml +0 -10
  14. package/agent-presets/dsmm-normal-task/agent.cordis.yml +0 -10
  15. package/agent-presets/dsmm-oracle/agent.cordis.yml +0 -10
  16. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +0 -10
  17. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +0 -10
  18. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +0 -10
  19. package/agent-presets/dsmm-planner/agent.cordis.yml +0 -10
  20. package/agent-presets/dsmm-quick/agent.cordis.yml +0 -10
  21. package/agent-presets/dsmm-research/agent.cordis.yml +0 -10
  22. package/agent-presets/dsmm-reviewer/agent.cordis.yml +0 -10
  23. package/docs/agent-presets.md +3 -1
  24. package/docs/maintenance.md +30 -5
  25. package/docs/settings-status.md +2 -2
  26. package/dsh-plugin.json +1 -1
  27. package/lib/child-capture.d.ts +1 -1
  28. package/lib/child-capture.js +3 -1
  29. package/lib/client/DeploymentFields.js +1 -1
  30. package/lib/client/RoleToolView-locales.d.ts +5 -0
  31. package/lib/client/RoleToolView-locales.js +2 -0
  32. package/lib/client/RoleToolView.js +3 -1
  33. package/lib/client/deployment-locales.d.ts +1 -0
  34. package/lib/client/deployment-locales.js +3 -1
  35. package/lib/client/index.js +32 -2
  36. package/lib/client/role-call-observations.d.ts +13 -1
  37. package/lib/client/role-call-observations.js +71 -14
  38. package/lib/client.js +117 -17
  39. package/lib/model-family.d.ts +3 -1
  40. package/lib/model-family.js +23 -5
  41. package/lib/profile-diagnostics.js +1 -1
  42. package/lib/prompt-content.js +1 -1
  43. package/lib/prompts.js +15 -10
  44. package/lib/role-identity.js +19 -3
  45. package/lib/role-subagents.js +5 -3
  46. package/lib/settings.d.ts +1 -0
  47. package/lib/settings.js +2 -1
  48. package/package.json +1 -1
  49. package/prompts/deepwork.md +3 -24
  50. package/prompts/source/deepwork/default.md +3 -14
  51. package/prompts/source/deepwork/gemini.md +3 -13
  52. package/prompts/source/deepwork/glm.md +3 -13
  53. package/prompts/source/deepwork/kimi-k3-1.md +65 -0
  54. package/skills/avoid-ai-slop/SKILL.md +2 -0
  55. package/skills/frontend/references/design/interaction-skill.md +14 -0
  56. package/skills/remove-ai-slops/SKILL.md +4 -4
  57. package/skills/report-fidelity/SKILL.md +3 -0
  58. package/prompts/source/shared/dsh-host-contract.md +0 -7
@@ -41,13 +41,28 @@ base Deepwork prompt, run `pnpm run generate:roles`. CI uses
41
41
  `pnpm run check:roles` and fails if `agent-presets/` or `prompts/deepwork.md` is
42
42
  stale. Generated assets are package resources, not an alternate source of truth.
43
43
 
44
- Model guidance is subordinate to the selected role and native DSH host contract.
44
+ Model guidance is subordinate to the selected role and the current runtime's tools
45
+ and permissions. Role and workflow prompts contain usage guidance rather than a
46
+ static Host contract or duplicate skill/MCP inventories; availability comes from
47
+ the current runtime catalog.
45
48
  Model identifiers and families select resources in code; calibration text, headings
46
49
  and tags are model-neutral. Source filenames retain selector identities. Kimi
47
- models share `deepwork/kimi.md`; Gemini 4.x, including Argon, receives the selected
48
- `gemini-4` additive layer. No injected self-identification or textual model guard
49
- is needed. Prompt selection does not change provider, effort, fallback chains or
50
- DSH model capabilities.
50
+ K3 and earlier, and names without a determinate version, use `deepwork/kimi.md`.
51
+ K3.1 and later numeric generations, including K3.2 and K4+, exclusively use
52
+ `deepwork/kimi-k3-1.md`. Prompt-only K aliases such as `k3p1` leave reasoning-family
53
+ classification unchanged. Existing `kimi-k27` names retain their K2.7 meaning
54
+ and the old calibration. Selection preserves the first model identity and keeps
55
+ structured provider metadata outside model matching. Gemini 4.x, including Argon,
56
+ receives the selected `gemini-4` additive layer. No injected self-identification
57
+ or textual model guard is needed. Prompt selection does not change provider,
58
+ effort, fallback chains or DSH model capabilities.
59
+
60
+ The K3.1+ scope-and-delivery calibration selectively adapts Senpi `2026.11.3-3`'s
61
+ `kimi-k3-1.ts` at published source `29eedcbe7c0cdf1c89eac7c94d4093b485925303`.
62
+ Its source embeds the complete MIT copyright and permission notice, retained in
63
+ the packaged resource. The additive guidance prioritizes current intent, bounded
64
+ action, complete outcomes, evidence reuse, and truthful handoff under the local
65
+ role and workflow contracts; it adds no effort lock or workflow gate.
51
66
 
52
67
  Locale guidance is registered in the exact Agent scope independently of Deepwork
53
68
  mode, the Deepwork module and subagent tools. It uses that Agent's captured
@@ -83,6 +98,16 @@ calculations, quotations and translation meaning, without mandatory ledgers or
83
98
  large-workflow requirements for simple questions. These local adaptations preserve
84
99
  DSH ownership of tasks, lifecycle, permissions and persistence.
85
100
 
101
+ Test guidance chooses checks by observable requirements, credible regressions,
102
+ and existing owner coverage, without test-only production interfaces. Report
103
+ fidelity compares extracted or converted numbers with originals, retains
104
+ chart/header/footnote context, and discloses partially applied edits. Interaction
105
+ guidance uses stable content slots and checks affected WCAG 2.2 A/AA criteria
106
+ with their exceptions; scoped evidence is not whole-product conformance. These
107
+ principles are independently expressed for the local workflow after comparison
108
+ with OMO shared-skills at `ed3693483e`; no mutation tool, research ledger, frontend
109
+ detection SDK, or third-party resource-pin update is included.
110
+
86
111
  The `report-fidelity` skill follows native metadata discovery, lazy body loading,
87
112
  and the normal skill setting. Historical child captures without that setting keep
88
113
  it disabled; new captures retain their captured value independently of later
@@ -72,7 +72,7 @@ Only relevant effective permission changes coordinate revocation. Unrelated loca
72
72
 
73
73
  ## Child runtime composition
74
74
 
75
- Default deployment waits for the native activation result: `enableRunInBackground:false`, and omitted `maxDepth` delegates to the native Host limit. Captured settings and actual native capabilities determine availability. A configured flag isn't execution or completion evidence.
75
+ Default deployment waits for the native activation result: `enableRunInBackground:false` and `forceBackground:false`; omitted `maxDepth` delegates to the native Host limit. Captured settings and actual native capabilities determine availability. A configured flag isn't execution or completion evidence.
76
76
 
77
77
  Official AgentRegistry, SubagentRuntime and JSONL namespace plugins own execution and storage. DSMM adds scoped admission and policy, not a replacement Registry/Runtime, manual owner selector, companion or separate result queue.
78
78
 
@@ -80,7 +80,7 @@ The [bundle patch](../cordis.patch.yml) adds DSMM to the native composition. Cor
80
80
 
81
81
  `subagentRuntime` projects native `binding: stock | unavailable`, DSMM admission readiness (`deliveryFenceReady`), restart requirement and a bounded reason. Readiness observes the native subagent service and activated, current DSMM admission owner. It doesn't certify every Agent, provider/control capability or restricted-role recovery across restoration. No experimental SDK API or global registry binding check is required. Saves retain actual native form revision/authorization and don't remount services.
82
82
 
83
- Enabled background work must choose `run_in_background:true` before `startActivation`, using `delivery:'parent'`; otherwise delivery is to the waiting caller. Accepted child/message IDs aren't completed results. Running waiting calls have no handoff action. Native receipt disposal handles cancellation after publication and waits for cleanup.
83
+ `subagents.forceBackground:true` forces native `delivery:'parent'` before `startActivation`, including omitted or false `run_in_background` and `enableRunInBackground:false`. Otherwise background delivery requires both `enableRunInBackground:true` and `run_in_background:true`; all other calls wait for their own native result. Both switches are deployment-only; forcing background leaves the saved enable switch unchanged. Independent foreground delegations in one model response use native scheduler concurrency. Accepted child/message IDs aren't completed results. Running waiting calls have no handoff action. Native receipt disposal handles cancellation after publication and waits for cleanup.
84
84
 
85
85
  Live direct-child Queue/Steer/interrupt require actual capabilities and exact parent/operator/lifetime authority. Read-only descendant inspection grants no control. Readiness loss closes DSMM execution; stale handles don't grant authority. Agent-scoped guards remain fail-closed after owner retirement. Hot replacement isn't a promise of uninterrupted live-session operation.
86
86
 
package/dsh-plugin.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "manifestVersion": "0.15",
4
4
  "id": "com.hugefiver.dsmm",
5
5
  "name": "DSMM",
6
- "version": "0.3.23",
6
+ "version": "0.3.25",
7
7
  "facets": {
8
8
  "host": {
9
9
  "entry": "lib/index.js",
@@ -20,7 +20,7 @@ export interface ChildAuthorityCeiling {
20
20
  }
21
21
  export type ChildRuntimePolicyCapture = Pick<DsmmSettings, "modules" | "roleRouting" | "runtimePolicy" | "workflow" | "guards" | "runtimeRecovery" | "defaultActive"> & {
22
22
  skills: Omit<DsmmSettings["skills"], "report-fidelity" | "avoid-ai-slop"> & Partial<Pick<DsmmSettings["skills"], "report-fidelity" | "avoid-ai-slop">>;
23
- subagents: Pick<DsmmSettings["subagents"], "enableRunInBackground" | "backgroundMode">;
23
+ subagents: Pick<DsmmSettings["subagents"], "enableRunInBackground" | "backgroundMode"> & Partial<Pick<DsmmSettings["subagents"], "forceBackground">>;
24
24
  };
25
25
  export type HistoricalChildRuntimePolicyCapture = ChildRuntimePolicyCapture & {
26
26
  deepseekV4ProCalibration: "off" | "auto" | "strict";
@@ -166,8 +166,10 @@ export function parseChildAdmissionCapture(input) {
166
166
  boolean(object(modules.deepwork, ["enabled"]).enabled);
167
167
  const skillMap = object(skills, CAPTURE_SKILLS, ["report-fidelity", "avoid-ai-slop"]);
168
168
  Object.values(skillMap).forEach(boolean);
169
- const background = object(subagents, ["enableRunInBackground", "backgroundMode"]);
169
+ const background = object(subagents, ["enableRunInBackground", "backgroundMode"], ["forceBackground"]);
170
170
  boolean(background.enableRunInBackground);
171
+ if (Object.hasOwn(background, "forceBackground"))
172
+ boolean(background.forceBackground);
171
173
  if (typeof background.backgroundMode !== "string" || !["one-shot", "continuable"].includes(background.backgroundMode))
172
174
  fail();
173
175
  const ceiling = object(row.authorityCeiling, ["roles", "readOnly", "allowRouteOverride", "maxDepth"], ["toolFilter"]);
@@ -98,6 +98,6 @@ export function Field({ schema, path, controller, initiallyOpen = false, disclos
98
98
  return _jsxs("details", { className: "dsmm-deployment-group", "data-field": name, open: open, onToggle: event => expand(event.currentTarget.open), children: [_jsx("summary", { className: "dsmm-group-summary-row", children: _jsxs("span", { className: "dsmm-group-summary", children: [_jsx("span", { className: "dsmm-group-summary-label", children: fieldLabel(path, t) }), _jsx(Button, { type: "button", variant: "outline", className: "dsmm-group-summary-action", "data-dsmm-unset": name, hidden: !open, disabled: disabled || explicit === undefined && !Object.keys(state.raw).some(key => key === name || key.startsWith(`${name}.`)), onClick: unsetGroup, children: unsetLabel })] }) }), _jsxs("div", { children: [name === "permissionControl" && _jsx("p", { className: "dsmm-hint", children: permissionText(t)("configPolicyHint") }), Object.entries(schema.fields).map(([key, node]) => _jsx(Field, { schema: node, path: [...path, key], controller: controller, disclosures: disclosures, t: t }, key))] })] });
99
99
  if (!["boolean", "string", "number"].includes(schema.type) && choices === null)
100
100
  return _jsx(AdvancedField, { schema: schema, path: path, controller: controller, inherited: inherited, upper: controller.layer === "global" ? at(snapshot.profile, path) : undefined, expanded: open, onExpandedChange: expand, t: t });
101
- return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", "data-field": name, children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsx("label", { htmlFor: id, children: fieldLabel(path, t) }), _jsxs("select", { id: id, disabled: disabled, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsx("option", { value: "inherit", children: `${unsetLabel} · ${choiceLabel(inherited)}` }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: choiceLabel(choice) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, inherited: inherited, t: t }), name === "modelParameters.passthrough" && _jsx("p", { className: "dsmm-hint", children: t("modelParametersHint") }), name === "permissionControl.enabled" && _jsx("p", { className: "dsmm-hint", children: permissionText(t)("coldHint") })] });
101
+ return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", "data-field": name, children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsx("label", { htmlFor: id, children: fieldLabel(path, t) }), _jsxs("select", { id: id, disabled: disabled, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsx("option", { value: "inherit", children: `${unsetLabel} · ${choiceLabel(inherited)}` }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: choiceLabel(choice) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, inherited: inherited, t: t }), name === "modelParameters.passthrough" && _jsx("p", { className: "dsmm-hint", children: t("modelParametersHint") }), name === "subagents.forceBackground" && _jsx("p", { className: "dsmm-hint", children: t("forceBackgroundHint") }), name === "permissionControl.enabled" && _jsx("p", { className: "dsmm-hint", children: permissionText(t)("coldHint") })] });
102
102
  }
103
103
  //# sourceMappingURL=DeploymentFields.js.map
@@ -16,6 +16,11 @@ export declare const roleToolEn: {
16
16
  readonly error: "Failed";
17
17
  readonly stopped: "Interrupted";
18
18
  readonly technicalDetails: "Technical details";
19
+ readonly observation: "Route observation";
20
+ readonly observationUnavailable: "Unavailable";
21
+ readonly observationConnecting: "Connecting";
22
+ readonly observationLive: "Live";
23
+ readonly observationStale: "Connection lost";
19
24
  readonly args: "Original arguments";
20
25
  readonly preparingArgs: "Arguments received so far";
21
26
  readonly output: "Complete result content";
@@ -6,6 +6,7 @@ export const roleToolEn = {
6
6
  preparing: "Preparing", running: "Calling", result: "Returned",
7
7
  background: "Background", error: "Failed", stopped: "Interrupted",
8
8
  technicalDetails: "Technical details",
9
+ observation: "Route observation", observationUnavailable: "Unavailable", observationConnecting: "Connecting", observationLive: "Live", observationStale: "Connection lost",
9
10
  args: "Original arguments", preparingArgs: "Arguments received so far", output: "Complete result content", failure: "Error details", metadata: "Invocation metadata",
10
11
  inspect: "View call details", copy: "Copy", copied: "Copied", emptyArgs: "Arguments not available yet",
11
12
  unavailable: "Actual identity unavailable; requested identity only", level: "Level", route: "Reported route", routeSource: "Route source",
@@ -19,6 +20,7 @@ export const roleToolZh = {
19
20
  preparing: "准备中", running: "调用中", result: "已返回",
20
21
  background: "后台调用", error: "失败", stopped: "已中断",
21
22
  technicalDetails: "技术详情",
23
+ observation: "路由观测", observationUnavailable: "不可用", observationConnecting: "连接中", observationLive: "实时", observationStale: "连接已断开",
22
24
  args: "原始参数", preparingArgs: "目前已收到的参数", output: "完整结果内容", failure: "错误详情", metadata: "调用元数据",
23
25
  inspect: "查看调用详情", copy: "复制", copied: "已复制", emptyArgs: "参数尚不可用",
24
26
  unavailable: "实际身份不可用,仅显示请求身份", level: "等级", route: "报告的路由", routeSource: "路由来源",
@@ -40,6 +40,8 @@ export function RoleToolView(props) {
40
40
  const raw = props.phase === "preparing" ? partial.preview : props.phase === "start" ? props.block.argsRaw : props.block.call?.argsRaw ?? "";
41
41
  const requested = partial?.requested ?? requestedRoleTool(props.toolName, raw);
42
42
  const observation = props.useRoleCalls(state => state.calls.get(props.callId));
43
+ const observationStatus = props.useRoleCalls(state => state.status);
44
+ const observationIssue = props.useRoleCalls(state => state.issue);
43
45
  const result = props.phase === "result" ? props.block : undefined;
44
46
  const failed = result !== undefined && (result.isError || result.error != null);
45
47
  const persisted = result === undefined ? undefined : actualRoleTool(props.toolName, result.meta, failed);
@@ -82,7 +84,7 @@ export function RoleToolView(props) {
82
84
  const routeLabel = (route, missingEffort = false) => `${route.provider}/${route.model}${route.reasoningEffort === undefined ? missingEffort ? ` · ${t("effortUnreported")}` : "" : ` · ${route.reasoningEffort}`}`;
83
85
  const collapsedContent = singleLineDesc ? _jsxs(_Fragment, { children: [_jsx("span", { className: "dsmm-role-sep", "aria-hidden": "true" }), _jsx("span", { className: "dsmm-role-summary", children: _jsx(TextShimmer, { active: isOngoing, children: singleLineDesc }) })] }) : undefined;
84
86
  const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" : result === undefined ? "ongoing" : state === "background" ? "idle" : "done";
85
- return _jsxs("div", { className: "dsmm-role-tool", "data-dsmm-role-tool": props.toolName, "data-identity": actual === undefined ? "requested" : "actual", "data-state": state, "data-delivery": actual?.delivery, "data-phase": actual?.phase, "data-expanded": expanded ? "true" : "false", children: [_jsx(DisclosureRow, { title: title, titleClassName: "dsmm-role-title", rowClassName: "dsmm-role-heading", contentClassName: "dsmm-role-text", icon: _jsx(IconAgentPresetOutlineRegular, { size: 14, className: "dsmm-role-icon" }), collapsedContent: collapsedContent, keepContentWhenOpen: true, running: isOngoing, open: expanded, expandable: true, onToggle: toggle, expandOnRowClick: true, children: _jsxs("div", { className: "dsmm-role-body", children: [_jsxs("p", { className: "dsmm-role-identity", children: [showRequestedVsActual ? _jsxs(_Fragment, { children: [_jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), _jsxs("span", { children: [requested.target === undefined ? t("unknown") : roleToolDisplay(requested.target), requested.level ? ` (${requested.level})` : ""] }), _jsx("span", { className: "dsmm-role-dim", children: " \u2192 " }), _jsxs("span", { className: "dsmm-role-dim", children: [t("actual"), ": "] }), _jsxs("span", { children: [roleToolDisplay(actual.role), " (", actual.level, ")"] })] }) : _jsxs("span", { children: [actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), actual !== undefined ? roleToolDisplay(actual.role) : requested.target === undefined ? t("unknownTarget") : roleToolDisplay(requested.target), (actual?.level ?? requested.level) !== undefined && ` · ${actual?.level ?? requested.level}`, props.phase !== "preparing" && actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [" \u00B7 ", t("actualUnknown")] })] }), initialRoute !== undefined && _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("initialRoute"), ": ", initialRoute.status === "known" ? routeLabel(initialRoute.route) : t("routeUnknown")] }), actualRoute !== undefined ? _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("actualRoute"), ": ", actualRoute.status === "known" ? routeLabel(actualRoute.route, true) : t("routeUnknown")] }) : props.phase !== "preparing" && _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("actualRoute"), ": ", t("routeUnknown")] })] }), requested.description !== undefined && _jsx("p", { className: "dsmm-role-task", children: requested.description }), result?.error != null && _jsxs("div", { className: "dsmm-role-failure", children: [_jsx("p", { className: "dsmm-role-section-title", children: t("failure") }), code(JSON.stringify(result.error, null, 2))] }), _jsxs("details", { className: "dsmm-role-details", children: [_jsx("summary", { children: t("technicalDetails") }), _jsxs("div", { className: "dsmm-role-details-body", children: [_jsx("div", { className: "dsmm-role-details-header", children: _jsx(SegmentedControl, { id: controlId, value: viewMode, options: viewOptions, onChange: setViewMode, label: t("viewMode"), className: "dsmm-role-view-switch" }) }), _jsx("div", { id: `${controlId}-table-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-table`, hidden: viewMode !== "table", tabIndex: 0, children: viewMode === "table" && _jsxs("table", { className: "dsmm-role-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: t("property") }), _jsx("th", { scope: "col", children: t("value") })] }) }), _jsx("tbody", { children: tableRows.map(row => _jsxs("tr", { children: [_jsx("td", { className: "dsmm-role-prop-cell", children: row.property }), _jsx("td", { className: "dsmm-role-val-cell", children: row.isComplex ? _jsx("pre", { className: "dsmm-role-cell-code", children: JSON.stringify(row.value, null, 2) })
87
+ return _jsxs("div", { className: "dsmm-role-tool", "data-dsmm-role-tool": props.toolName, "data-identity": actual === undefined ? "requested" : "actual", "data-state": state, "data-delivery": actual?.delivery, "data-phase": actual?.phase, "data-expanded": expanded ? "true" : "false", children: [_jsx(DisclosureRow, { title: title, titleClassName: "dsmm-role-title", rowClassName: "dsmm-role-heading", contentClassName: "dsmm-role-text", icon: _jsx(IconAgentPresetOutlineRegular, { size: 14, className: "dsmm-role-icon" }), collapsedContent: collapsedContent, keepContentWhenOpen: true, running: isOngoing, open: expanded, expandable: true, onToggle: toggle, expandOnRowClick: true, children: _jsxs("div", { className: "dsmm-role-body", children: [_jsxs("p", { className: "dsmm-role-identity", children: [showRequestedVsActual ? _jsxs(_Fragment, { children: [_jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), _jsxs("span", { children: [requested.target === undefined ? t("unknown") : roleToolDisplay(requested.target), requested.level ? ` (${requested.level})` : ""] }), _jsx("span", { className: "dsmm-role-dim", children: " \u2192 " }), _jsxs("span", { className: "dsmm-role-dim", children: [t("actual"), ": "] }), _jsxs("span", { children: [roleToolDisplay(actual.role), " (", actual.level, ")"] })] }) : _jsxs("span", { children: [actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), actual !== undefined ? roleToolDisplay(actual.role) : requested.target === undefined ? t("unknownTarget") : roleToolDisplay(requested.target), (actual?.level ?? requested.level) !== undefined && ` · ${actual?.level ?? requested.level}`, props.phase !== "preparing" && actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [" \u00B7 ", t("actualUnknown")] })] }), initialRoute !== undefined && _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("initialRoute"), ": ", initialRoute.status === "known" ? routeLabel(initialRoute.route) : t("routeUnknown")] }), actualRoute !== undefined ? _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("actualRoute"), ": ", actualRoute.status === "known" ? routeLabel(actualRoute.route, true) : t("routeUnknown")] }) : props.phase !== "preparing" && _jsxs("span", { className: "dsmm-role-model", children: [" · ", t("actualRoute"), ": ", t("routeUnknown")] })] }), _jsxs("p", { className: "dsmm-role-identity", "data-observation-status": observationStatus, children: [t("observation"), ": ", t({ unavailable: "observationUnavailable", connecting: "observationConnecting", live: "observationLive", stale: "observationStale" }[observationStatus]), observationIssue !== undefined && ` · ${observationIssue.kind}/${observationIssue.code}`] }), requested.description !== undefined && _jsx("p", { className: "dsmm-role-task", children: requested.description }), result?.error != null && _jsxs("div", { className: "dsmm-role-failure", children: [_jsx("p", { className: "dsmm-role-section-title", children: t("failure") }), code(JSON.stringify(result.error, null, 2))] }), _jsxs("details", { className: "dsmm-role-details", children: [_jsx("summary", { children: t("technicalDetails") }), _jsxs("div", { className: "dsmm-role-details-body", children: [_jsx("div", { className: "dsmm-role-details-header", children: _jsx(SegmentedControl, { id: controlId, value: viewMode, options: viewOptions, onChange: setViewMode, label: t("viewMode"), className: "dsmm-role-view-switch" }) }), _jsx("div", { id: `${controlId}-table-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-table`, hidden: viewMode !== "table", tabIndex: 0, children: viewMode === "table" && _jsxs("table", { className: "dsmm-role-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: t("property") }), _jsx("th", { scope: "col", children: t("value") })] }) }), _jsx("tbody", { children: tableRows.map(row => _jsxs("tr", { children: [_jsx("td", { className: "dsmm-role-prop-cell", children: row.property }), _jsx("td", { className: "dsmm-role-val-cell", children: row.isComplex ? _jsx("pre", { className: "dsmm-role-cell-code", children: JSON.stringify(row.value, null, 2) })
86
88
  : typeof row.value === "string" ? _jsx("span", { className: "dsmm-role-cell-text", children: row.value })
87
89
  : _jsx("span", { children: row.value === null ? "null" : row.value === undefined ? "undefined" : String(row.value) }) })] }, row.property)) })] }) }), _jsx("div", { id: `${controlId}-json-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-json`, hidden: viewMode !== "json", tabIndex: 0, children: viewMode === "json" && code(JSON.stringify(jsonData, null, 2)) })] })] })] }) }), _jsxs("div", { className: "dsmm-role-actions", children: [_jsx(StateDot, { state: stateDotState }), _jsx("p", { className: "dsmm-role-status", role: "status", children: t(state) }), props.inspect !== undefined && _jsx(Button, { variant: "ghost", size: "sm", onClick: props.inspect, children: t("inspect") })] })] });
88
90
  }
@@ -15,6 +15,7 @@ export declare const deploymentEn: {
15
15
  core: string;
16
16
  coreHint: string;
17
17
  modelParametersHint: string;
18
+ forceBackgroundHint: string;
18
19
  permissionControlHint: string;
19
20
  modules: string;
20
21
  scope: string;
@@ -11,6 +11,7 @@ export const deploymentEn = {
11
11
  boundaries: "Saved settings apply to new sessions; restart-required changes need a separate Host restart that may cancel sessions.",
12
12
  core: "Core", 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.",
13
13
  modelParametersHint: "Off sends no custom parameters and uses native reasoning defaults. Saved values and the selected model stay unchanged.",
14
+ 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.",
14
15
  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.",
15
16
  modules: "Configuration sections", scope: "Configuration scope", loading: "Loading configuration…", unset: "Use default configuration",
16
17
  "module:run": "Run and modules", "module:routes": "Model routes and recovery", "module:workflow": "Workflow, roles and subagents", "module:permissions": "Permissions and safety", "module:other": "Other / advanced", "module:state": "Configuration state",
@@ -55,6 +56,7 @@ export const deploymentZh = {
55
56
  boundaries: "保存的设置供新会话使用;需重启的更改须另行重启宿主,可能取消会话。",
56
57
  core: "Core 核心配置", coreHint: "Core 所有的 desired 意图配置。模型参数透传为普通配置,非子插件;权限控制 enabled 仅启动时捕获。保存不改变当前会话准入;下方可检查意图、启动与准入值,不可用的准入仍为未知。",
57
58
  modelParametersHint: "关闭后不发送自定义参数,改用原生推理默认值;已保存值与所选模型不变。",
59
+ forceBackgroundHint: "优先于“允许后台执行”:run_in_background 无论省略、true 或 false,所有委派都使用原生父级后台交付,不等待任务完成,返回已接收的 child/message 标识。",
58
60
  permissionControlHint: "权限控制挂载仅启动时捕获。保存配置不证明运行时覆盖,也不移除当前保护;Root 规则在权限模块内保持独立权限。",
59
61
  modules: "配置分区", scope: "配置范围", loading: "正在加载配置…", unset: "使用默认配置",
60
62
  "module:run": "运行与模块", "module:routes": "模型路由与恢复", "module:workflow": "工作流、角色与子 Agent", "module:permissions": "权限与安全", "module:other": "其他与高级", "module:state": "配置状态",
@@ -103,7 +105,7 @@ export const deploymentFieldLabels = {
103
105
  gitWriteScope: ["Git write protection scope", "Git 写操作保护范围"],
104
106
  toolOutputTruncation: ["Tool output truncation", "工具输出截断"], maxInlineBytes: ["Inline byte limit", "内联字节上限"],
105
107
  planFormatValidation: ["Plan format validation", "计划格式校验"], questionLabelHelper: ["Question labels", "提问标签"], maxLabelChars: ["Label character limit", "标签字符上限"], todoDisciplineHelper: ["Todo discipline", "待办纪律"],
106
- enableRunInBackground: ["Allow background runs", "允许后台执行"], backgroundMode: ["Background mode", "后台模式"], maxDepth: ["Maximum depth", "最大深度"],
108
+ enableRunInBackground: ["Allow background runs", "允许后台执行"], forceBackground: ["Force all delegations into background", "强制所有委派后台执行"], backgroundMode: ["Background mode", "后台模式"], maxDepth: ["Maximum depth", "最大深度"],
107
109
  policy: ["Policy", "策略"], strictGates: ["Strict gates", "严格关卡"], reviewCap: ["Review limit", "审查上限"], finalReviewPolicy: ["Final review policy", "最终审查策略"],
108
110
  retryOnStatusCodes: ["Retry HTTP statuses", "重试 HTTP 状态码"], retryOnCodes: ["Retry error codes", "重试错误码"], fallbackRoutes: ["Ordered fallback routes", "有序备用路由"], maxFallbackAttempts: ["Fallback attempt limit", "备用尝试上限"], idleContinuation: ["Idle continuation", "空闲继续"], maxContinuations: ["Continuation limit", "继续次数上限"], prompt: ["Continuation prompt", "继续提示词"],
109
111
  root: ["Materialization directory", "物化目录"], strategy: ["Routing strategy", "路由策略"], rateLimit: ["Bounded rate-limit retry", "有界限流重试"], maxRetries: ["Retry limit", "重试上限"], initialDelayMs: ["Initial delay (ms)", "初始延迟(毫秒)"], maxDelayMs: ["Delay limit (ms)", "延迟上限(毫秒)"], maxTotalDelayMs: ["Total wait budget (ms)", "累计等待上限(毫秒)"], switchAfterRateLimits: ["Rate limits before switching", "切换前限流次数"], maxSwitches: ["Switch limit", "切换上限"],
@@ -40,13 +40,43 @@ export async function apply(ctx) {
40
40
  ctx.effect(() => ctx.locale.register(PERMISSIONS_NS, { en: permissionEn, zh: permissionZh }), "dsmm: permission locale");
41
41
  void ctx.inject(["connection"], connectionCtx => {
42
42
  const handle = connectionCtx.connection, invoke = permissionClient(handle);
43
- const unbindRoleCalls = roleCalls.bindConnection(connectionCtx.remote, (sessionId, signal) => connectionCtx.remote.dsmmChildren.observe(sessionId, signal));
44
- connectionCtx.effect(() => unbindRoleCalls, "dsmm: role call connection withdrawal");
45
43
  const update = () => { const generation = handle.generation.getSnapshot(); permissions.bindConnection(generation === undefined ? null : invoke, generation); };
46
44
  update();
47
45
  connectionCtx.effect(() => handle.generation.subscribe(update));
48
46
  connectionCtx.effect(() => () => permissions.bindConnection(null), "dsmm: permission connection withdrawal");
49
47
  });
48
+ void ctx.inject(["connection", "remote.dsmmChildren"], connectionCtx => {
49
+ const handle = connectionCtx.connection;
50
+ let active = true, observedGeneration;
51
+ let unbindRoleCalls, stopReady;
52
+ const update = () => {
53
+ if (!active)
54
+ return;
55
+ const generation = handle.generation.getSnapshot();
56
+ if (generation === observedGeneration)
57
+ return;
58
+ stopReady?.();
59
+ unbindRoleCalls?.();
60
+ stopReady = undefined;
61
+ unbindRoleCalls = undefined;
62
+ observedGeneration = generation;
63
+ if (generation === undefined)
64
+ return;
65
+ unbindRoleCalls = roleCalls.bindConnection(connectionCtx.remote, (sessionId, signal) => connectionCtx.remote.dsmmChildren.observe(sessionId, signal));
66
+ stopReady = connectionCtx.remote.$on("api-session/added", summary => {
67
+ if (!active || observedGeneration !== generation || handle.generation.getSnapshot() !== generation)
68
+ return;
69
+ roleCalls.observeSessionAvailability(summary.sessionId, summary.agentAvailable);
70
+ });
71
+ };
72
+ update();
73
+ connectionCtx.effect(() => handle.generation.subscribe(update));
74
+ connectionCtx.effect(() => () => {
75
+ active = false;
76
+ stopReady?.();
77
+ unbindRoleCalls?.();
78
+ }, "dsmm: role call connection withdrawal");
79
+ });
50
80
  void ctx.inject(["uiSession", "sessions"], sessionCtx => {
51
81
  const source = sessionCtx.uiSession.adapter.current, sessions = sessionCtx.sessions;
52
82
  sessionCtx.effect(() => bindPermissionSession(source, sessions, permissions), "dsmm: permission native session withdrawal");
@@ -1,10 +1,20 @@
1
1
  import type { RemoteStream, RemoteStreamOptions } from "@deepseek-ai/dsh-api-gateway/client";
2
2
  import type { HostObservable } from "@deepseek-ai/dsh-client-ui-slots";
3
- import type { RoleCallObservation, RoleCallObservationFrame } from "../role-control-types.js";
3
+ import type { RoleCallObservation, RoleCallObservationFrame, RoleControlErrorInfo } from "../role-control-types.js";
4
+ export type RoleCallObservationIssue = ({
5
+ readonly kind: "domain";
6
+ } & RoleControlErrorInfo) | {
7
+ readonly kind: "transport";
8
+ readonly code: "unavailable" | "cancelled" | "internal";
9
+ } | {
10
+ readonly kind: "protocol";
11
+ readonly code: "invalid-frame" | "invalid-error";
12
+ };
4
13
  export interface RoleCallObservationState {
5
14
  readonly sessionId: string;
6
15
  readonly status: "unavailable" | "connecting" | "live" | "stale";
7
16
  readonly admissionEpoch?: string;
17
+ readonly issue?: RoleCallObservationIssue;
8
18
  readonly calls: ReadonlyMap<string, RoleCallObservation>;
9
19
  }
10
20
  export type RoleCallStreamOpen = (sessionId: string, signal: AbortSignal) => AsyncIterable<RoleCallObservationFrame>;
@@ -14,7 +24,9 @@ export interface RoleCallStreamFactory {
14
24
  export declare class RoleCallObservationController {
15
25
  private binding;
16
26
  private readonly sources;
27
+ private disposed;
17
28
  source(sessionId: string): HostObservable<RoleCallObservationState>;
29
+ observeSessionAvailability(sessionId: string, available: boolean): void;
18
30
  bindConnection(factory: RoleCallStreamFactory, open: RoleCallStreamOpen): () => void;
19
31
  dispose(): void;
20
32
  }
@@ -1,16 +1,49 @@
1
+ import { remoteErrorOf } from "@deepseek-ai/dsh-typert-protocol";
2
+ import { parseRoleControlErrorInfo } from "../role-control-remote.js";
3
+ class ObservationProtocolError extends Error {
4
+ code;
5
+ constructor(code) {
6
+ super(code);
7
+ this.code = code;
8
+ }
9
+ }
10
+ function observationIssue(error) {
11
+ if (error instanceof ObservationProtocolError)
12
+ return { kind: "protocol", code: error.code };
13
+ const remote = remoteErrorOf(error);
14
+ if (remote?.code === "dsmm-children/refused") {
15
+ try {
16
+ return { kind: "domain", ...parseRoleControlErrorInfo(remote.details) };
17
+ }
18
+ catch {
19
+ return { kind: "protocol", code: "invalid-error" };
20
+ }
21
+ }
22
+ return { kind: "transport", code: remote?.code === "gateway/cancelled" ? "cancelled" : remote?.code === "gateway/internal" ? "internal" : "unavailable" };
23
+ }
1
24
  export class RoleCallObservationController {
2
25
  binding = null;
3
26
  sources = new Map();
27
+ disposed = false;
4
28
  source(sessionId) {
5
29
  let source = this.sources.get(sessionId);
6
30
  if (source === undefined) {
7
31
  source = new RoleCallObservationSource(sessionId);
8
- source.bind(this.binding);
32
+ if (this.disposed)
33
+ source.dispose();
34
+ else
35
+ source.bind(this.binding);
9
36
  this.sources.set(sessionId, source);
10
37
  }
11
38
  return source;
12
39
  }
40
+ observeSessionAvailability(sessionId, available) {
41
+ if (!this.disposed && available)
42
+ this.sources.get(sessionId)?.observeAvailability();
43
+ }
13
44
  bindConnection(factory, open) {
45
+ if (this.disposed)
46
+ return () => { };
14
47
  const binding = { identity: {}, factory, open };
15
48
  this.binding = binding;
16
49
  for (const source of this.sources.values())
@@ -24,6 +57,7 @@ export class RoleCallObservationController {
24
57
  };
25
58
  }
26
59
  dispose() {
60
+ this.disposed = true;
27
61
  this.binding = null;
28
62
  for (const source of this.sources.values())
29
63
  source.dispose();
@@ -37,12 +71,26 @@ class RoleCallObservationSource {
37
71
  binding = null;
38
72
  revision = 0;
39
73
  stream;
74
+ hint = 0;
75
+ consumedHint = 0;
76
+ disposed = false;
40
77
  constructor(sessionId) {
41
78
  this.sessionId = sessionId;
42
79
  this.snapshot = { sessionId, status: "unavailable", calls: new Map() };
43
80
  }
44
81
  getSnapshot() { return this.snapshot; }
82
+ observeAvailability() {
83
+ if (this.disposed || this.binding === null || this.listeners.size === 0)
84
+ return;
85
+ this.hint++;
86
+ if (this.snapshot.status === "live")
87
+ this.consumedHint = this.hint;
88
+ else
89
+ this.start();
90
+ }
45
91
  subscribe(listener) {
92
+ if (this.disposed)
93
+ return () => { };
46
94
  this.listeners.add(listener);
47
95
  if (this.listeners.size === 1)
48
96
  this.start();
@@ -51,6 +99,7 @@ class RoleCallObservationSource {
51
99
  if (this.listeners.size !== 0)
52
100
  return;
53
101
  this.revision++;
102
+ this.consumedHint = this.hint;
54
103
  const stream = this.stream;
55
104
  this.stream = undefined;
56
105
  if (stream !== undefined)
@@ -58,10 +107,11 @@ class RoleCallObservationSource {
58
107
  };
59
108
  }
60
109
  bind(binding) {
61
- if (this.binding?.identity === binding?.identity)
110
+ if (this.disposed || this.binding?.identity === binding?.identity)
62
111
  return;
63
112
  this.binding = binding;
64
113
  this.revision++;
114
+ this.consumedHint = this.hint;
65
115
  const stream = this.stream;
66
116
  this.stream = undefined;
67
117
  if (stream !== undefined)
@@ -71,8 +121,10 @@ class RoleCallObservationSource {
71
121
  this.start();
72
122
  }
73
123
  dispose() {
124
+ this.disposed = true;
74
125
  this.binding = null;
75
126
  this.revision++;
127
+ this.consumedHint = this.hint;
76
128
  const stream = this.stream;
77
129
  this.stream = undefined;
78
130
  if (stream !== undefined)
@@ -81,20 +133,21 @@ class RoleCallObservationSource {
81
133
  }
82
134
  start() {
83
135
  const binding = this.binding;
84
- if (binding === null || this.listeners.size === 0 || this.stream !== undefined)
136
+ if (this.disposed || binding === null || this.listeners.size === 0 || this.stream !== undefined)
85
137
  return;
86
138
  const revision = ++this.revision;
87
- this.publish({ sessionId: this.sessionId, status: "connecting", calls: new Map() });
139
+ this.consumedHint = this.hint;
88
140
  const stream = binding.factory.$stream({
89
141
  name: `DSMM role calls for ${this.sessionId}`,
90
142
  open: signal => binding.open(this.sessionId, signal),
91
143
  ended: accepted => new Error(`DSMM role call stream ended ${accepted ? "after" : "before"} its snapshot`),
92
144
  carrierFailed: () => {
93
145
  if (this.revision === revision && this.stream === stream)
94
- this.invalidate("stale");
146
+ this.invalidate("stale", { kind: "transport", code: "unavailable" });
95
147
  },
96
148
  });
97
149
  this.stream = stream;
150
+ this.invalidate("connecting", this.snapshot.issue);
98
151
  void this.consume(stream, revision);
99
152
  }
100
153
  async consume(stream, revision) {
@@ -105,19 +158,20 @@ class RoleCallObservationSource {
105
158
  return;
106
159
  const frame = item.value;
107
160
  if (frame.sessionId !== this.sessionId)
108
- throw new Error("DSMM role call stream changed sessions");
161
+ throw new ObservationProtocolError("invalid-frame");
109
162
  if (item.generation !== generation) {
110
163
  if (frame.type !== "snapshot")
111
- throw new Error("DSMM role call generation omitted its snapshot");
164
+ throw new ObservationProtocolError("invalid-frame");
112
165
  generation = item.generation;
113
166
  admissionEpoch = frame.admissionEpoch;
167
+ this.consumedHint = this.hint;
168
+ item.accept();
114
169
  this.publish({ sessionId: this.sessionId, status: "live", admissionEpoch,
115
170
  calls: new Map(frame.calls.map(call => [call.callId, call])) });
116
- item.accept();
117
171
  continue;
118
172
  }
119
173
  if (frame.type === "snapshot" || frame.admissionEpoch !== admissionEpoch)
120
- throw new Error("DSMM role call update crossed its admission");
174
+ throw new ObservationProtocolError("invalid-frame");
121
175
  const calls = new Map(this.snapshot.calls);
122
176
  if (frame.type === "update")
123
177
  calls.set(frame.call.callId, frame.call);
@@ -126,20 +180,23 @@ class RoleCallObservationSource {
126
180
  this.publish({ sessionId: this.sessionId, status: "live", admissionEpoch, calls });
127
181
  }
128
182
  }
129
- catch {
183
+ catch (error) {
130
184
  if (this.revision === revision && this.stream === stream)
131
- this.invalidate("unavailable");
185
+ this.invalidate("unavailable", observationIssue(error));
132
186
  }
133
187
  finally {
134
- if (this.revision === revision && this.stream === stream)
188
+ if (this.revision === revision && this.stream === stream) {
135
189
  this.stream = undefined;
190
+ if (this.hint > this.consumedHint)
191
+ this.start();
192
+ }
136
193
  }
137
194
  }
138
- invalidate(status) {
195
+ invalidate(status, issue) {
139
196
  const calls = new Map([...this.snapshot.calls].map(([callId, call]) => [callId, call.phase === "settled" ? call : Object.freeze({
140
197
  ...call, actualRoute: Object.freeze({ status: "unknown", reason: "not-observed" }),
141
198
  })]));
142
- this.publish({ ...this.snapshot, status, calls });
199
+ this.publish({ ...this.snapshot, status, issue, calls });
143
200
  }
144
201
  publish(snapshot) {
145
202
  this.snapshot = snapshot;