@dsmm/dsmm 0.3.22 → 0.3.24

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 (111) hide show
  1. package/agent-presets/dsmm-builder/agent.cordis.yml +1 -17
  2. package/agent-presets/dsmm-clarifier/agent.cordis.yml +1 -17
  3. package/agent-presets/dsmm-code-search/agent.cordis.yml +1 -17
  4. package/agent-presets/dsmm-coding/agent.cordis.yml +1 -17
  5. package/agent-presets/dsmm-complex/agent.cordis.yml +1 -17
  6. package/agent-presets/dsmm-creative/agent.cordis.yml +1 -17
  7. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +1 -17
  8. package/agent-presets/dsmm-deep/agent.cordis.yml +1 -17
  9. package/agent-presets/dsmm-doc-search/agent.cordis.yml +1 -17
  10. package/agent-presets/dsmm-documenting/agent.cordis.yml +1 -17
  11. package/agent-presets/dsmm-frontend/agent.cordis.yml +1 -17
  12. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +1 -17
  13. package/agent-presets/dsmm-media-reader/agent.cordis.yml +1 -17
  14. package/agent-presets/dsmm-normal-task/agent.cordis.yml +1 -17
  15. package/agent-presets/dsmm-oracle/agent.cordis.yml +1 -17
  16. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +1 -17
  17. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +1 -17
  18. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +1 -17
  19. package/agent-presets/dsmm-planner/agent.cordis.yml +1 -17
  20. package/agent-presets/dsmm-quick/agent.cordis.yml +1 -17
  21. package/agent-presets/dsmm-research/agent.cordis.yml +1 -17
  22. package/agent-presets/dsmm-reviewer/agent.cordis.yml +1 -17
  23. package/cordis.patch.yml +3 -0
  24. package/docs/agent-presets.md +1 -1
  25. package/docs/compatibility.md +13 -1
  26. package/docs/maintenance.md +48 -10
  27. package/docs/model-routing.md +25 -3
  28. package/docs/native-permissions.md +20 -4
  29. package/docs/releasing.md +3 -3
  30. package/docs/roadmap.md +33 -11
  31. package/docs/runtime-recovery.md +5 -3
  32. package/docs/settings-status.md +2 -2
  33. package/docs/testing.md +10 -0
  34. package/docs/web-fetch-fakeip.md +8 -2
  35. package/dsh-plugin.json +1 -1
  36. package/lib/agent-prompt-scope.d.ts +6 -0
  37. package/lib/agent-prompt-scope.js +66 -0
  38. package/lib/child-capture.d.ts +1 -1
  39. package/lib/child-capture.js +3 -1
  40. package/lib/client/DeploymentFields.js +1 -1
  41. package/lib/client/RoleToolView-data.d.ts +4 -2
  42. package/lib/client/RoleToolView-data.js +18 -4
  43. package/lib/client/RoleToolView-locales.d.ts +9 -0
  44. package/lib/client/RoleToolView-locales.js +4 -0
  45. package/lib/client/RoleToolView.d.ts +9 -3
  46. package/lib/client/RoleToolView.js +29 -8
  47. package/lib/client/children-locales.d.ts +4 -4
  48. package/lib/client/deployment-locales.d.ts +1 -0
  49. package/lib/client/deployment-locales.js +3 -1
  50. package/lib/client/index.js +36 -1
  51. package/lib/client/role-call-observations.d.ts +33 -0
  52. package/lib/client/role-call-observations.js +207 -0
  53. package/lib/client.js +501 -96
  54. package/lib/dsh-types.d.ts +15 -0
  55. package/lib/index.js +4 -1
  56. package/lib/live-pi-ai-owner.d.ts +1 -2
  57. package/lib/live-pi-ai-owner.js +10 -7
  58. package/lib/locale-guidance.d.ts +3 -0
  59. package/lib/locale-guidance.js +12 -0
  60. package/lib/model-family.d.ts +16 -0
  61. package/lib/model-family.js +156 -35
  62. package/lib/model-routing.d.ts +23 -2
  63. package/lib/model-routing.js +145 -7
  64. package/lib/native-admission.d.ts +36 -1
  65. package/lib/native-admission.js +408 -24
  66. package/lib/native-pi-ai-wire.js +17 -4
  67. package/lib/profile-diagnostics.js +1 -1
  68. package/lib/profile-remote.d.ts +2 -0
  69. package/lib/profile-remote.js +12 -3
  70. package/lib/profile-types.d.ts +5 -0
  71. package/lib/prompt-content.js +1 -1
  72. package/lib/prompts.d.ts +3 -2
  73. package/lib/prompts.js +32 -45
  74. package/lib/role-control-remote.d.ts +5 -2
  75. package/lib/role-control-remote.js +84 -4
  76. package/lib/role-control-rpc.d.ts +8 -1
  77. package/lib/role-control-rpc.js +122 -50
  78. package/lib/role-control-types.d.ts +62 -1
  79. package/lib/role-control-types.js +3 -0
  80. package/lib/role-invocation.js +1 -1
  81. package/lib/role-llm-runtime.js +2 -2
  82. package/lib/role-routing.d.ts +27 -7
  83. package/lib/role-routing.js +129 -16
  84. package/lib/role-subagents.js +13 -26
  85. package/lib/runtime-recovery.js +23 -6
  86. package/lib/session-metadata.d.ts +13 -1
  87. package/lib/session-metadata.js +21 -1
  88. package/lib/settings.d.ts +1 -0
  89. package/lib/settings.js +2 -1
  90. package/lib/web-fetch-address-policy.d.ts +6 -2
  91. package/lib/web-fetch-fakeip.d.ts +6 -0
  92. package/lib/web-fetch-fakeip.js +29 -2
  93. package/package.json +2 -2
  94. package/prompts/deepwork.md +3 -25
  95. package/prompts/source/deepwork/claude-opus-5.md +2 -8
  96. package/prompts/source/deepwork/codex.md +2 -8
  97. package/prompts/source/deepwork/default.md +3 -14
  98. package/prompts/source/deepwork/gemini-4.md +1 -7
  99. package/prompts/source/deepwork/gemini.md +3 -19
  100. package/prompts/source/deepwork/glm.md +6 -23
  101. package/prompts/source/deepwork/gpt.md +7 -15
  102. package/prompts/source/deepwork/kimi-k3-1.md +65 -0
  103. package/prompts/source/deepwork/kimi.md +1 -7
  104. package/prompts/source/deepwork/planner.md +0 -4
  105. package/prompts/source/deepwork/swe-2.md +2 -8
  106. package/prompts/source/shared/locale.md +1 -6
  107. package/skills/avoid-ai-slop/SKILL.md +2 -0
  108. package/skills/frontend/references/design/interaction-skill.md +14 -0
  109. package/skills/remove-ai-slops/SKILL.md +4 -4
  110. package/skills/report-fidelity/SKILL.md +3 -0
  111. package/prompts/source/shared/dsh-host-contract.md +0 -8
package/docs/roadmap.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Version policy
4
4
 
5
- **DSMM 0.3.17 supports DSH `>=0.2.1-rc.2 <0.3.0`.** Official DSH rc.3 gives `engines.dsh` precedence over peer ranges; rc.2 remains the pinned development baseline. Each DSMM version declares its supported Host range independently of its development dependencies. Older SDKs and old configuration schemas aren't runtime compatibility targets. Loading sessions created by DSMM `0.2.x` is a required compatibility target, separate from retaining old runtime implementations or execution behavior. A dependency upgrade or support outside the declared range requires deliberate reassessment, not an automatic runtime switch.
5
+ **DSMM 0.3.22 supports DSH `>=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.3.0`.** Official DSH rc.3 gives `engines.dsh` precedence over peer ranges; rc.2 remains the pinned development baseline. The dual branch admits the 0.2.2 RC series starting at `0.2.2-rc.1` (the implemented adaptation target, verified against an installed exact-tag SDK anchor) while keeping 0.2.1 behavior identical; `0.2.2-alpha.*` is excluded. Each DSMM version declares its supported Host range independently of its development dependencies. Older SDKs and old configuration schemas aren't runtime compatibility targets. Loading sessions created by DSMM `0.2.x` is a required compatibility target, separate from retaining old runtime implementations or execution behavior. A dependency upgrade or support outside the declared range requires deliberate reassessment, not an automatic runtime switch.
6
6
 
7
7
  Published `0.3.0` retains its original rc.1 package, tag, assets and version-bound release identity.
8
8
 
@@ -20,13 +20,17 @@ Agent-scoped skills expose metadata and load bodies lazily, preserving non-DSMM
20
20
 
21
21
  Native call views show the target in collapsed rows, distinguish requested from actual identity, and retain that distinction for partial output, failure, interruption and current-format replay/PTC. Child labels use `Coding: task description`.
22
22
 
23
+ On DSH `0.2.2-rc.1`, native multi-file patches are available through explicit `tool-fs.config.applyPatch: true`, with the default remaining off. DSMM forwards native configuration and retains role/tool ceilings, observation checks and native sandbox/approval ownership; sequential commit can partially succeed. See [native patches](native-permissions.md#native-multi-file-patches-on-dsh-022-rc1). Dynamic Pi-AI request headers retain the native hook across standard/raw paths and the original registration scope; see [request headers](model-routing.md#native-dynamic-request-headers). Gemini 4 series aliases share the existing additive calibration.
24
+
23
25
  ## Remaining capability boundaries
24
26
 
25
27
  | Capability | Current behavior | Requirement for broader support |
26
28
  | --- | --- | --- |
29
+ | Cross-route model fallback on 0.2.2 | 0.2.2 fixes the model selection per step; DSMM keeps same-route bounded retries and degrades `rate-limit-fallback` switching to a same-route retry with a one-time diagnostic. 0.2.1 switching is unchanged. | A public re-selection boundary within the failing step (or per-attempt selection); see [compatibility](compatibility.md#dsh-022-host-differences). |
27
30
  | Profile selection before execution | Existing blank roots can select saved profiles or deployment defaults. Without a session, explicit workspace/Profile selection obtains a native blank, blocks sending until selection is confirmed, then opens it. | Validate native new-session navigation, unsent text/references/attachments and first-send behavior in the target Host. No-session selection is implemented; browser acceptance is separate. |
28
31
  | Session overlay Apply | Eligible quiescent roots, including started/restored roots, can switch under native subtree maintenance and admission CAS. Active work, open turns, queued input and pending approvals/delegation prevent switching. Resident children retain their captures; new delegations use the selected configuration. | Switching during active work remains unsupported. Unprovable external-provider startup is refused; supported coverage uses the same Host lifecycle and agents registry. See [approval boundaries](deferred-native-approval-risk.md). |
29
32
  | Running-call background handoff | Deferred. Select waiting or native parent delivery before starting; existing background dispatch stays unchanged. | A supported same-activation native delivery handoff; see the deferred foreground delegation requirements below. |
33
+ | Granular sandbox access switches | Deferred for later investigation, including system-certificate access for Windows Schannel. No new switch or backend is supplied for this capability. | A supported per-process enforcement mechanism, identified necessary resources, and isolated on/off verification; see [granular sandbox extensions](#deferred-granular-sandbox-access-switches). |
30
34
  | Restricted-role continuation after restoration | Supported roots and continuable children receive fresh admission through awaited `agent/created`, with current role, parent, readonly, tool and depth checks. Historical approvals do not grant current authority. | Broader historical-format support needs public control of persisted persona/composition and pre-activation restoration boundaries. Cold-child image preflight can still inspect historical `agent.options` before current routing takes effect. Unresolvable presets and missing or unsafe identity remain refused; see [recovery boundaries](compatibility.md#native-history-composition). |
31
35
  | Non-disruptive hot update | No uninterrupted live-session guarantee. Retire admissions and let native owners cancel/dispose owned work; guards remain fail-closed. | Native lifecycle support that preserves active task/approval boundaries. |
32
36
  | Catalog-backed raw combinations | Rejected where the complete composition can't be reliably reproduced, regardless of native or DSMM parameter source. Standard calls aren't affected. | A public seam that can reproduce the full catalog composition and preserve native capability/effort semantics. |
@@ -36,15 +40,22 @@ Native call views show the target in collapsed rows, distinguish requested from
36
40
 
37
41
  Search/Fetch retain the explicitly configured native provider. DSMM doesn't automatically enable a direct API, change credentials or forward the recent human question. HTTP Fake-IP behavior and network limits are maintained in [Fake-IP fetch](web-fetch-fakeip.md).
38
42
 
39
- ## Deferred: foreground delegation controls and live model information
43
+ ## Current: live delegation route observation
44
+
45
+ A read-only native Gateway stream connects admitted role/level and initial versus observed provider/model/effort to the exact parent session and tool call. Actual route evidence comes from the current child's own request header; missing or invalidated active evidence is unknown, and missing effort is not filled from the initial route. Settled observations remain frozen. Descendant-session observation uses verified live lineage without widening root/direct-child mutation controls.
46
+
47
+ Repeated provider call IDs continue to execute normally. When the client cannot disambiguate a reused call ID, live observation for that key is removed; each final tool result retains its own child-bound metadata. Disconnects and observer disposal never transfer execution, cancel the child or create another completion owner.
48
+
49
+ The isolated rc.1 CLI/Gateway acceptance covers observation before foreground completion, independent-peer refusal, child read-only scope, observer disposal and repeated call IDs. Production browser WebSocket/DOM and visual card acceptance remain unverified.
50
+
51
+ ## Deferred: foreground delegation handoff
40
52
 
41
53
  Reassess after DSH updates. The pinned `0.2.1-rc.2` API fixes activation delivery to `caller` or `parent` at startup and exposes no public running-activation handoff. DSMM must not take over completion notification or patch Host internals to supply it.
42
54
 
43
55
  - Allow users to click **Run in background** on an active DSMM delegation started without `run_in_background: true`. Continue the same activation without cancellation, restart or duplicate dispatch; DSH retains execution, cancellation and completion-delivery ownership.
44
56
  - Add an option extending manual handoff to foreground delegations involving non-DW Agents while Deepwork is enabled, covering both non-DW callers and non-DW targets. Dispatches that already run in the background need no change; the current native `subagent` tool already uses parent delivery and returns immediately.
45
- - Show the role, level, provider/model and reasoning effort during foreground execution rather than waiting for the final tool result. Distinguish the captured initial route from the actual observed request route, including fallback changes; unavailable actual information must not be presented as confirmed.
46
- - On a candidate DSH update, check for a public same-activation handoff API and its completion/cancellation race semantics. Separately assess live invocation-to-tool-card correlation and updates through supported client channels: missing generic tool-progress metadata in rc.2 does not establish that all DSMM client-side reporting is impossible.
47
- - Acceptance requires one native completion delivery, no duplicate execution, unchanged permission and ownership checks, correct handling of completion racing a click, and timely model information before completion. Verify the non-DW option in both states and leave already-background calls untouched. Do not expose an ineffective switch or upgrade/install DSH automatically.
57
+ - On a candidate DSH update, check for a public same-activation handoff API and its completion/cancellation race semantics. Read-only live invocation metadata uses a separate supported client channel and does not transfer execution or delivery ownership.
58
+ - Acceptance requires one native completion delivery, no duplicate execution, unchanged permission and ownership checks, and correct handling of completion racing a click. Verify the non-DW option in both states and leave already-background calls untouched. Do not expose an ineffective switch or upgrade/install DSH automatically.
48
59
 
49
60
  ## Current: native history loading, including the DSMM 0.2.x compatibility target
50
61
 
@@ -118,13 +129,22 @@ The extension must preserve the existing interception scope. Native reads that d
118
129
  - The target is configuration-derived elevation only in actual standing `workspace-write`, with no configured writes in `read-only` and no redundant approval in standing full access. Preserve native deny/never/cancellation, independent approval requirements and the finality of manual approval for the same call. This mode-boundary correction is not delivered; existing permission behavior remains unchanged.
119
130
  - Reassess when a supported public source-binding contract becomes available. Verify direct native loading, scoped policy/executor differences, aliases, loading order and asynchronous mode changes through actual approvals and executor policy before implementing. Do not infer authority from tool names, reason text or a controller's unrelated scope, patch Host packages, or upgrade DSH automatically.
120
131
 
121
- ## Planned: external-path and temporary-directory grants
132
+ ## Planned: external-path grants and native temporary-directory policy
133
+
134
+ - Outside-workspace read policy and native external write/edit refusal already exist. Configurable exact-path/tree grants remain subject to enforcement shared by file tools and shell execution.
135
+ - Temporary-directory access follows the full default allowance of the selected DSH mode and backend. DSMM does not narrow that allowance to a dedicated `temp/dsh` subtree. Preserve readonly and explicit deny rules; permission to use temporary storage does not authorize deleting unrelated temporary files.
136
+ - Describe each backend's actual temporary-directory scope accurately. Windows child-process `TMP`/`TEMP` may point to a private session/workspace directory; native file-tool allowances and process confinement must not be presented as identical without evidence.
137
+ - DSH `0.2.1-rc.2` has no additional writable-root field. DSH `0.2.2-rc.1` exposes `additionalWritableRoots`, but its bundled Windows ACL backend rejects additional writable directories. Single-file and independent read/write grants remain separate capability gaps.
138
+ - Broader path support requires public Host enforcement, readonly preservation, path/link validation and rejection of adjacent unapproved locations. Unsupported scopes must not silently become full access or a private ACL framework.
122
139
 
123
- - Outside-workspace read policy and native external write/edit refusal already exist. The missing capability is configurable exact-path/tree grants, particularly external writes and dedicated temporary-directory writes, consistently enforced by file tools and shell execution.
124
- - Reassess the available public DSH interfaces before choosing an implementation. This capability remains deferred rather than blocking command-pattern or configuration improvements.
125
- - Target independent read and write permissions for exact paths or directory trees: normal workspace writes, configured external reads, and writes only to explicitly authorized external locations. A dedicated system-temp `dsh` subtree is a useful opt-in scope for creating, editing and cleaning Agent-owned temporary files; it must not grant access to the entire system temp directory or authorize deleting unrelated files.
126
- - DSH `0.2.1-rc.2` has no additional writable-root field in its standard execution policy. Its Windows backend supplies a private per-session/workspace `dsh-*` directory through child-process `TMP`/`TEMP`; this is neither a configurable fixed `temp/dsh` grant nor proof that native file tools share the same allowance.
127
- - Broader support depends on public Host path-grant interfaces consumed consistently by native file tools and shell confinement. Preserve readonly, resolve path/link boundaries, and verify that adjacent unapproved locations remain unwritable. Do not expose a nonfunctional setting, substitute full access, or implement a private ACL framework in DSMM.
140
+ ## Deferred: granular sandbox access switches
141
+
142
+ - Investigate independently controlled sandbox capability extensions in a later task. This capability is outside the current implementation scope; do not add configuration fields or UI switches that have no enforceable effect.
143
+ - The intended system-certificate compatibility extension is enabled by default once a supported, verified implementation exists. Disabling it must remove that extension for subsequent executions without changing unrelated sandbox policy. TLS certificate verification stays enabled in both states.
144
+ - First establish the cause of Windows curl/Git Schannel failures and the exact required objects, endpoints and access rights. `SEC_E_NO_CREDENTIALS` alone does not identify a missing certificate-store path or prove which permission is needed.
145
+ - DSH `0.2.2-rc.1` exposes file-effect modes and directory roots, not per-process certificate, CNG or RPC endpoint grants. A certificate extension requires a supported Host/runner/native-helper mechanism; adding a DSMM boolean or writable directory cannot supply it.
146
+ - Any Host/native-helper work is separately scoped. Do not modify the installed runtime, system-wide endpoint ACLs or certificate stores, silently change TLS backends, disable verification or broaden to full access as a default remedy.
147
+ - Acceptance requires isolated Windows curl and Git Schannel execution with the extension on and off, preserved TLS verification, rejection of unrelated external writes, readonly preservation and clear configured-versus-effective capability status. Unsupported backends remain explicit; no success claim comes from saving a setting alone.
128
148
 
129
149
  ## Upstream follow-up: Windows Git Schannel
130
150
 
@@ -140,6 +160,8 @@ The extension must preserve the existing interception scope. Native reads that d
140
160
 
141
161
  Reassess deferred capabilities against concrete public Host API changes. A newer release within the supported range does not by itself establish that the missing contracts or their acceptance evidence are available.
142
162
 
163
+ The [DSH 0.2.2-rc.1 adaptation summary](superpowers/plans/2026-11-05-dsh-0.2.2-rc1-adaptation.md) defines the delivered dual-Host behavior, verification and remaining limits. Later RC or stable releases require exact-version interface and runtime verification before broader compatibility claims. Deferred capabilities remain subject to their public Host contracts.
164
+
143
165
  ## Publication and Desktop installation
144
166
 
145
167
  0.3.17 publication uses the version-bound [release controls](releasing.md). Desktop plugin installation follows publication, uses the Desktop-owned carrier and requires DSH `>=0.2.1-rc.2 <0.3.0`. Installation doesn't authorize upgrading the Host, changing credentials or real sessions, altering unrelated configuration, or restarting active work. An incompatible Host or required data migration blocks installation rather than expanding its scope.
@@ -1,6 +1,6 @@
1
1
  # Runtime recovery and route strategies
2
2
 
3
- DSMM 0.3.16 targets exactly DSH `0.2.1-rc.2`.
3
+ DSMM recovery runs inside the native DSH request loop. See [Host compatibility](compatibility.md) for supported versions and same-step route-switch limitations.
4
4
 
5
5
  ## Independent role strategies
6
6
 
@@ -19,9 +19,11 @@ With the default deployment policy `rootModelPolicy: "native"`, root model and e
19
19
  | `switchAfterRateLimits` | 3 | 1 to 10 |
20
20
  | `maxSwitches` | 2 | 0 to 10 |
21
21
 
22
- `maxRetries` counts requests after the first on a route; the threshold includes the first distinct failure. Exhausted retry budget stops the attempt even before the switch threshold. Switches consume a finite scope budget. Invalid values refuse instead of becoming different defaults.
22
+ `maxRetries` limits same-route retries after the first request; `switchAfterRateLimits` counts the first distinct failure. Before the switch threshold, exhausted retry budget ends recovery. A permitted switch uses the separate switch budget; when the Host forbids same-step switching, recovery remains on the current route and obeys `maxRetries`. Invalid values refuse instead of becoming different defaults.
23
23
 
24
- `roleRouting.<role>.fallbackRoutes` owns its full route/parameter sets. Explicit `[]` suppresses inherited alternatives; omission inherits the applicable chain. A fallback doesn't inherit primary-only parameters. Omitted effort clears stale explicit effort. `runtimeRecovery.enabled` isn't the role strategy selector, and retained generic status/code lists don't authorize arbitrary transport/server retries or channel hopping.
24
+ `roleRouting.<role>.fallbackRoutes` owns its full route/parameter sets. Explicit `[]` suppresses inherited alternatives; omission inherits `runtimeRecovery.fallbackRoutes`. A fallback doesn't inherit primary-only parameters. Omitted effort clears stale explicit effort.
25
+
26
+ `runtimePolicy` and role-level `strategy` / `rateLimit` control DSMM request recovery. `runtimeRecovery.enabled` gates idle continuation, not role rate-limit retries. The retained `runtimeRecovery.retryOnStatusCodes` and `retryOnCodes` lists do not drive this request-error handler: adding a server status or failure code there does not enable retries for it. Other failures are passed to the native recovery chain, whose effective provider `retryPolicy` determines eligibility and bounds; forwarding alone does not establish that a retry will occur.
25
27
 
26
28
  ## Positive no-output proof and native execution
27
29
 
@@ -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/docs/testing.md CHANGED
@@ -55,9 +55,19 @@ serially.
55
55
  | Group | Primary coverage and prerequisites |
56
56
  | --- | --- |
57
57
  | `native-runtime` | Multi-step Host/runtime, resume, module admission, real shell safety and native SDK/CLI wrappers. Some cases require `DSMM_TEST_DSH_ENTRY` or `DSMM_COLD_PROFILE_SDK_ANCHOR`. |
58
+ | `host-boundaries` | Isolated installed-Host CLI routing, cold resume, native/DSMM LLM owners, default effort, tools, child admission and retry boundaries, plus the resolver-free Fake-IP adapter guard. Requires `DSMM_TEST_DSH_ENTRY`; uses a loopback model service and no real API credentials. |
59
+ | `adaptation-remaining` | Targeted dual-Host feature compatibility. Requires `DSMM_TEST_DSH_ENTRY`. Native patch tests run the built package through an isolated CLI, native tool-fs and filesystem sandbox, covering explicit configuration, observation, multi-path effects and permission/cancellation boundaries. Live-delegation tests load the built package in the selected Host and exercise its actual Gateway/Connection stream while loopback child HTTP is held, including observer disposal and repeated provider call IDs; this is not browser DOM acceptance. Dynamic-header tests resolve the selected SDK and run built DSMM owners/adapters through a real Cordis Loader/Pi-AI adapter with loopback HTTP and configuration/retirement checks; their dedicated resolver does not redirect `lib` back to source. Unsupported native capabilities explicitly skip; rc.2 retains its existing filesystem tool set. |
58
60
  | `frontend` | Real browser deployment/profile/editable-choice flows and native role cards. Browser cases require both `DSMM_TEST_DSH_ENTRY` and `DSMM_TEST_PLAYWRIGHT_ENTRY`. |
59
61
  | `delivery` | Actual package/frontend materialization and full native/ordinary module delivery. Native cases require an explicit DSH anchor. |
60
62
 
63
+ For the focused Host boundary suite, set `DSMM_TEST_DSH_ENTRY` to the installed
64
+ Host's package entry and run `pnpm run test:integration -- host-boundaries` after
65
+ building DSMM. Repeat with the other supported Host anchor for compatibility
66
+ coverage. Fixed-selection-only child and fault-injection cases explicitly skip
67
+ when `agent.model.select` is unavailable. The resolver-free Fake-IP case skips on
68
+ a resolver-capable Host; the existing address-policy/transport tests cover that
69
+ implementation.
70
+
61
71
  Missing anchors produce explicit skips. A skipped integration case is unavailable
62
72
  coverage, not a pass, and must be reported as such. The wrapper files remain the
63
73
  entry points for their `.mjs` fixtures so the underlying Host, CLI, approval and
@@ -1,6 +1,6 @@
1
1
  # 显式选择 Fake-IP HTTP fetch
2
2
 
3
- `@dsmm/dsmm/web-fetch-fakeip` 是独立 Cordis 插件,向原生 `ctx.web` 注册唯一 fetch provider ID `dsmm-http-fakeip`。它使用 rc.2 包根公开的 `new HttpFetchProvider(limits, resolver)`,不替换 WebRuntime,不注册 `http`,不改变 Search、工具审批、凭据或系统网络。只有用户主动挂载并选择该 provider 时才应启用;不要将它加入 DSMM 默认插件组合。原生 `http` 和 shell 的网络限制不因此得到修复。
3
+ `@dsmm/dsmm/web-fetch-fakeip` 是独立 Cordis 插件,向原生 `ctx.web` 注册唯一 fetch provider ID `dsmm-http-fakeip`。它在 DSH 0.2.1 使用包根公开的 `new HttpFetchProvider(limits, resolver)`;DSH 0.2.2 的无 resolver 路径按下述能力边界处理。它不替换 WebRuntime,不注册 `http`,不改变 Search、工具审批、凭据或系统网络。只有用户主动挂载并选择该 provider 时才应启用;不要将它加入 DSMM 默认插件组合。原生 `http` 和 shell 的网络限制不因此得到修复。
4
4
 
5
5
  ## 集成与选择
6
6
 
@@ -28,7 +28,13 @@ DSMM 包必须具备以下依赖和发布入口,才能使用此插件:
28
28
 
29
29
  `denyCidrs` 只增加本地拒绝,例如 `['198.18.0.1/16', '8.8.8.0/24']`;主机位不扩大 CIDR,前一项等价于拒绝固定 `198.18.0.0/16`。mapped IPv6 和对应 IPv4 的拒绝相互覆盖。没有任意 allow-CIDR 配置:唯一例外固定为 `198.18.0.0/16`,不是 `/15`,不是其他私网。
30
30
 
31
- ## 地址与代理边界
31
+ ## Host 能力边界
32
+
33
+ 以下 DNS answer、NAT64 发现和 pinned lookup 保证适用于仍公开 resolver 注入的 DSH 0.2.1。DSH 0.2.2 的原生 HTTP provider 通过进程 dispatcher 发送请求,不再调用该 resolver;DSMM 不安装替代 dispatcher,也不把入口检查称为 DNS pinning。
34
+
35
+ 0.2.2 下配置 `denyCidrs` 时,无法检查最终解析地址的域名路径及无法验证 NAT64 内嵌目的地址的非 mapped IPv6 literal 均 fail-closed。IPv4 和 mapped IPv4 literal 继续执行入口 deny 校验。没有本地 deny 时,DNS 应答级检查与 NAT64 内嵌地址检查仍不可用;原生传输和代理策略由 Host 负责。代理与 literal 的既有入口限制保持有效。
36
+
37
+ ## 地址与代理边界(DSH 0.2.1 resolver 路径)
32
38
 
33
39
  - 系统 DNS 使用 `all: true, order: 'verbatim'`。完整答案必须非空,每项 family 和地址须有效;任一地址被拒绝即拒绝整个请求,不筛掉坏答案继续连接。
34
40
  - 允许公网 unicast 和精确 Fake-IP `/16`;mapped IPv6 按内嵌 IPv4 判断。显式 deny 优先,loopback、私网、链路本地、`198.19.*` 及原生 transition/NAT64 特殊地址继续拒绝。
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.17",
6
+ "version": "0.3.24",
7
7
  "facets": {
8
8
  "host": {
9
9
  "entry": "lib/index.js",
@@ -0,0 +1,6 @@
1
+ import type { DshAgent, DshContext } from "./dsh-types.js";
2
+ import type { DsmmSettingsGetter } from "./settings.js";
3
+ import type { DsmmRolePolicy } from "./role-policy.js";
4
+ import type { DeepworkModeController } from "./state.js";
5
+ export declare function registerAgentPromptScope(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter, policy: DsmmRolePolicy, agent: DshAgent, signal: AbortSignal): void;
6
+ //# sourceMappingURL=agent-prompt-scope.d.ts.map
@@ -0,0 +1,66 @@
1
+ import { getTraceable, symbols } from "@deepseek-ai/cordis";
2
+ import { buildDsmmLocaleGuidance } from "./locale-guidance.js";
3
+ import { agentForScope, nativeAgentContext } from "./native-scope.js";
4
+ import { registerRoleHarnessIdentity } from "./role-identity.js";
5
+ const agentPrompts = new WeakMap();
6
+ export function registerAgentPromptScope(ctx, controller, getSettings, policy, agent, signal) {
7
+ signal.throwIfAborted();
8
+ const existing = agentPrompts.get(agent);
9
+ if (existing !== undefined) {
10
+ existing.reconcile();
11
+ return;
12
+ }
13
+ const agentCtx = nativeAgentContext(agent);
14
+ let retired = false;
15
+ const state = { reconcile() {
16
+ if (retired)
17
+ return;
18
+ const prompt = agentCtx.get("agentPresets")?.serviceFor({ ctx: agentCtx }, "systemPrompt") ?? agentCtx.get("systemPrompt");
19
+ const realm = Reflect.get(prompt, symbols.original) ?? prompt;
20
+ if (state.promptRealm !== realm) {
21
+ state.identity?.();
22
+ state.locale?.();
23
+ state.identity = undefined;
24
+ state.role = undefined;
25
+ state.child = undefined;
26
+ state.locale = getTraceable(agentCtx, prompt).section({ name: "dsmm:locale", order: 49, text(context) {
27
+ if (context.scope !== agent && agentForScope(ctx, context.scope) !== agent)
28
+ return "";
29
+ const settings = getSettings(agent);
30
+ return settings.locale === undefined ? "" : buildDsmmLocaleGuidance(settings);
31
+ } });
32
+ state.promptRealm = realm;
33
+ }
34
+ const identity = policy.identity(agent);
35
+ if (state.role === identity.role && state.child === identity.child)
36
+ return;
37
+ state.identity?.();
38
+ state.identity = identity.role === undefined ? undefined : registerRoleHarnessIdentity(agent, identity.role, identity.child);
39
+ state.role = identity.role;
40
+ state.child = identity.child;
41
+ } };
42
+ const retire = () => {
43
+ if (retired)
44
+ return;
45
+ retired = true;
46
+ signal.removeEventListener("abort", retire);
47
+ state.stopMode?.();
48
+ state.identity?.();
49
+ state.locale?.();
50
+ if (agentPrompts.get(agent) === state)
51
+ agentPrompts.delete(agent);
52
+ };
53
+ state.stopMode = controller.watch(changed => { if (changed === agent)
54
+ state.reconcile(); });
55
+ agentPrompts.set(agent, state);
56
+ signal.addEventListener("abort", retire, { once: true });
57
+ agentCtx.effect(() => retire);
58
+ try {
59
+ state.reconcile();
60
+ }
61
+ catch (error) {
62
+ retire();
63
+ throw error;
64
+ }
65
+ }
66
+ //# sourceMappingURL=agent-prompt-scope.js.map
@@ -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
@@ -1,4 +1,5 @@
1
1
  import type { DsmmInvocationView } from "../profile-types.js";
2
+ import type { RoleCallObservation } from "../role-control-types.js";
2
3
  import type { ToolArgs } from "@deepseek-ai/dsh-client-ui-conversation/client";
3
4
  /** Presentation keys only; this table does not describe callable admission. */
4
5
  export declare const roleToolKeys: {
@@ -31,12 +32,13 @@ export declare function preparingRoleTool(toolName: string, args: ToolArgs): {
31
32
  preview: string;
32
33
  };
33
34
  export declare function actualRoleTool(toolName: string, meta: unknown, failed: boolean): DsmmInvocationView | undefined;
35
+ export declare function observedRoleTool(toolName: string, observation: RoleCallObservation): DsmmInvocationView | undefined;
34
36
  export declare function roleToolDisplay(target: string): string;
35
37
  export interface TechnicalRow {
36
38
  property: string;
37
39
  value: unknown;
38
40
  isComplex: boolean;
39
41
  }
40
- export declare function technicalTableRows(toolName: string, callId: string, rawArgs: string, meta?: unknown, routeSource?: string): TechnicalRow[];
41
- export declare function technicalJsonData(toolName: string, callId: string, rawArgs: string, meta?: unknown, routeSource?: string): Record<string, unknown>;
42
+ export declare function technicalTableRows(toolName: string, callId: string, rawArgs: string, meta?: unknown, routeSource?: string, observation?: RoleCallObservation): TechnicalRow[];
43
+ export declare function technicalJsonData(toolName: string, callId: string, rawArgs: string, meta?: unknown, routeSource?: string, observation?: RoleCallObservation): Record<string, unknown>;
42
44
  //# sourceMappingURL=RoleToolView-data.d.ts.map
@@ -48,10 +48,21 @@ export function actualRoleTool(toolName, meta, failed) {
48
48
  return undefined;
49
49
  }
50
50
  }
51
+ export function observedRoleTool(toolName, observation) {
52
+ if (!(toolName === "dsmm_category" ? categories : roles).has(observation.role))
53
+ return undefined;
54
+ return { role: observation.role, label: roleToolDisplay(observation.role), level: observation.level,
55
+ routeSource: observation.routeSource, mode: "continuable", childId: observation.childId,
56
+ ...(observation.runId === undefined ? {} : { runId: observation.runId }),
57
+ ...(observation.initialRoute.status === "known" ? { route: { ...observation.initialRoute.route } } : {}),
58
+ routeComparison: { childId: observation.childId, initialRoute: observation.initialRoute, liveRoute: observation.actualRoute },
59
+ delivery: observation.delivery, phase: observation.phase,
60
+ ...(observation.stopReason === undefined ? {} : { stopReason: observation.stopReason }) };
61
+ }
51
62
  export function roleToolDisplay(target) {
52
63
  return target.slice("dsmm-".length).split("-").map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
53
64
  }
54
- export function technicalTableRows(toolName, callId, rawArgs, meta, routeSource) {
65
+ export function technicalTableRows(toolName, callId, rawArgs, meta, routeSource, observation) {
55
66
  const rows = [];
56
67
  rows.push({ property: "toolName", value: toolName, isComplex: false });
57
68
  rows.push({ property: "callId", value: callId, isComplex: false });
@@ -79,9 +90,11 @@ export function technicalTableRows(toolName, callId, rawArgs, meta, routeSource)
79
90
  rows.push({ property: "meta", value: meta, isComplex: typeof meta === "object" });
80
91
  }
81
92
  }
93
+ if (observation !== undefined)
94
+ rows.push({ property: "observation", value: observation, isComplex: true });
82
95
  return rows;
83
96
  }
84
- export function technicalJsonData(toolName, callId, rawArgs, meta, routeSource) {
97
+ export function technicalJsonData(toolName, callId, rawArgs, meta, routeSource, observation) {
85
98
  const parsedArgs = roleToolArguments(rawArgs);
86
99
  const data = {
87
100
  toolName,
@@ -91,9 +104,10 @@ export function technicalJsonData(toolName, callId, rawArgs, meta, routeSource)
91
104
  data.routeSource = routeSource;
92
105
  }
93
106
  data.args = parsedArgs !== undefined ? parsedArgs : rawArgs;
94
- if (meta !== undefined && meta !== null) {
107
+ if (meta !== undefined && meta !== null)
95
108
  data.meta = meta;
96
- }
109
+ if (observation !== undefined)
110
+ data.observation = observation;
97
111
  return data;
98
112
  }
99
113
  //# sourceMappingURL=RoleToolView-data.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";
@@ -29,6 +34,10 @@ export declare const roleToolEn: {
29
34
  readonly level: "Level";
30
35
  readonly route: "Reported route";
31
36
  readonly routeSource: "Route source";
37
+ readonly initialRoute: "Initial";
38
+ readonly actualRoute: "Actual";
39
+ readonly routeUnknown: "unknown";
40
+ readonly effortUnreported: "effort not reported";
32
41
  readonly table: "Table";
33
42
  readonly json: "JSON";
34
43
  readonly viewMode: "View mode";
@@ -6,9 +6,11 @@ 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",
13
+ initialRoute: "Initial", actualRoute: "Actual", routeUnknown: "unknown", effortUnreported: "effort not reported",
12
14
  table: "Table", json: "JSON", viewMode: "View mode", property: "Property", value: "Value",
13
15
  };
14
16
  export const roleToolZh = {
@@ -18,9 +20,11 @@ export const roleToolZh = {
18
20
  preparing: "准备中", running: "调用中", result: "已返回",
19
21
  background: "后台调用", error: "失败", stopped: "已中断",
20
22
  technicalDetails: "技术详情",
23
+ observation: "路由观测", observationUnavailable: "不可用", observationConnecting: "连接中", observationLive: "实时", observationStale: "连接已断开",
21
24
  args: "原始参数", preparingArgs: "目前已收到的参数", output: "完整结果内容", failure: "错误详情", metadata: "调用元数据",
22
25
  inspect: "查看调用详情", copy: "复制", copied: "已复制", emptyArgs: "参数尚不可用",
23
26
  unavailable: "实际身份不可用,仅显示请求身份", level: "等级", route: "报告的路由", routeSource: "路由来源",
27
+ initialRoute: "初始", actualRoute: "实际", routeUnknown: "未知", effortUnreported: "effort 未报告",
24
28
  table: "表格", json: "JSON", viewMode: "视图模式", property: "属性", value: "值",
25
29
  };
26
30
  //# sourceMappingURL=RoleToolView-locales.js.map
@@ -1,10 +1,16 @@
1
1
  import type { Context } from "@deepseek-ai/cordis";
2
2
  import type { ToolCallViewProps } from "@deepseek-ai/dsh-client-ui-tool/client";
3
- import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
3
+ import type { HostObservable, InjectFace, PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
4
4
  import { ROLE_TOOL_NS } from "./RoleToolView-locales.js";
5
- type Props = ToolCallViewProps & PropsLocale<typeof ROLE_TOOL_NS>;
5
+ import type { RoleCallObservationController, RoleCallObservationState } from "./role-call-observations.js";
6
+ type ObservationInject = {
7
+ hooks: {
8
+ roleCalls: HostObservable<RoleCallObservationState>;
9
+ };
10
+ };
11
+ type Props = ToolCallViewProps & PropsLocale<typeof ROLE_TOOL_NS> & InjectFace<ObservationInject>;
6
12
  export declare function RoleToolView(props: Props): import("react").JSX.Element;
7
13
  /** Called once by the parent client apply(ctx), alongside the other slot registrations. */
8
- export declare function registerRoleToolViews(ctx: Context): void;
14
+ export declare function registerRoleToolViews(ctx: Context, observations: RoleCallObservationController): void;
9
15
  export {};
10
16
  //# sourceMappingURL=RoleToolView.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { Button, CodeBlock, DisclosureRow, IconAgentPresetOutlineRegular, SegmentedControl, StateDot, TextShimmer } from "@deepseek-ai/dsh-client-ui-primitives";
4
- import { actualRoleTool, preparingRoleTool, requestedRoleTool, roleToolDisplay, roleToolKeys, technicalJsonData, technicalTableRows } from "./RoleToolView-data.js";
4
+ import { actualRoleTool, observedRoleTool, preparingRoleTool, requestedRoleTool, roleToolDisplay, roleToolKeys, technicalJsonData, technicalTableRows } from "./RoleToolView-data.js";
5
5
  import { ROLE_TOOL_NS, roleToolEn, roleToolZh } from "./RoleToolView-locales.js";
6
6
  const styles = `
7
7
  .dsmm-role-tool{min-width:0;color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);font-size:14px;line-height:22px}
@@ -39,16 +39,33 @@ export function RoleToolView(props) {
39
39
  const { t } = 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
+ 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);
42
45
  const result = props.phase === "result" ? props.block : undefined;
43
46
  const failed = result !== undefined && (result.isError || result.error != null);
44
- const actual = result === undefined ? undefined : actualRoleTool(props.toolName, result.meta, failed);
47
+ const persisted = result === undefined ? undefined : actualRoleTool(props.toolName, result.meta, failed);
48
+ const observed = observation === undefined ? undefined : observedRoleTool(props.toolName, observation);
49
+ const inactivePersisted = persisted === undefined || persisted.phase === "settled" ? persisted : persisted.childId === undefined
50
+ ? { ...persisted, routeComparison: undefined }
51
+ : { ...persisted, routeComparison: { childId: persisted.childId,
52
+ initialRoute: persisted.routeComparison?.initialRoute ?? (persisted.route === undefined
53
+ ? { status: "unknown", reason: "missing-invocation-capture" }
54
+ : { status: "known", source: "invocation-capture", route: persisted.route }),
55
+ liveRoute: { status: "unknown", reason: "not-observed" } } };
56
+ const actual = persisted?.phase === "settled" ? persisted : observed ?? inactivePersisted;
57
+ const comparison = actual?.routeComparison;
45
58
  const target = actual?.role ?? requested.target;
46
59
  const action = props.phase === "preparing" ? t("calling") : t("call");
47
60
  const targetLabel = target === undefined ? t("unknownTarget") : roleToolDisplay(target);
48
61
  const rawDesc = requested.description?.trim();
49
62
  const singleLineDesc = rawDesc ? rawDesc.replace(/\s+/gu, " ") : undefined;
50
63
  const title = `${action} ${targetLabel}`;
51
- const state = result?.error?.code === "interrupted" ? "stopped" : failed ? "error" : result === undefined ? props.phase === "preparing" ? "preparing" : "running" : actual?.jobId !== undefined || actual?.mode === "continuable" ? "background" : "result";
64
+ const observedStop = actual?.phase === "settled" ? actual.stopReason : undefined;
65
+ const state = result?.error?.code === "interrupted" || observedStop === "aborted" ? "stopped"
66
+ : failed || observedStop !== undefined && observedStop !== "completed" ? "error"
67
+ : result === undefined ? props.phase === "preparing" ? "preparing" : "running"
68
+ : actual?.delivery === "parent" && actual.phase !== "settled" ? "background" : "result";
52
69
  const isOngoing = state === "running" || props.phase === "preparing";
53
70
  const code = (value) => _jsx(CodeBlock, { code: value, copyLabel: t("copy"), copiedLabel: t("copied") });
54
71
  const [viewMode, setViewMode] = useState("table");
@@ -57,19 +74,22 @@ export function RoleToolView(props) {
57
74
  { value: "table", label: t("table") },
58
75
  { value: "json", label: t("json") },
59
76
  ];
60
- const tableRows = technicalTableRows(props.toolName, props.callId, raw, result?.meta, actual?.routeSource);
61
- const jsonData = technicalJsonData(props.toolName, props.callId, raw, result?.meta, actual?.routeSource);
77
+ const tableRows = technicalTableRows(props.toolName, props.callId, raw, result?.meta, actual?.routeSource, observation);
78
+ const jsonData = technicalJsonData(props.toolName, props.callId, raw, result?.meta, actual?.routeSource, observation);
62
79
  const roleDiffers = requested.target !== undefined && actual !== undefined && actual.role !== requested.target;
63
80
  const levelDiffers = requested.level !== undefined && actual !== undefined && actual.level !== requested.level;
64
81
  const showRequestedVsActual = roleDiffers || levelDiffers;
82
+ const initialRoute = comparison?.initialRoute ?? (actual?.route === undefined ? undefined : { status: "known", source: "invocation-capture", route: actual.route });
83
+ const actualRoute = comparison?.liveRoute;
84
+ const routeLabel = (route, missingEffort = false) => `${route.provider}/${route.model}${route.reasoningEffort === undefined ? missingEffort ? ` · ${t("effortUnreported")}` : "" : ` · ${route.reasoningEffort}`}`;
65
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;
66
86
  const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" : result === undefined ? "ongoing" : state === "background" ? "idle" : "done";
67
- return _jsxs("div", { className: "dsmm-role-tool", "data-dsmm-role-tool": props.toolName, "data-identity": actual === undefined ? "requested" : "actual", "data-state": state, "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 ? roleToolDisplay(actual.role) : requested.target === undefined ? t("unknownTarget") : roleToolDisplay(requested.target), (actual?.level ?? requested.level) !== undefined && ` · ${actual?.level ?? requested.level}`, result !== undefined && actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [" \u00B7 ", t("actualUnknown")] })] }), actual?.route !== undefined && _jsxs("span", { className: "dsmm-role-model", children: [" · ", actual.route.provider, "/", actual.route.model, actual.route.reasoningEffort ? ` · ${actual.route.reasoningEffort}` : ""] })] }), 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) })
68
88
  : typeof row.value === "string" ? _jsx("span", { className: "dsmm-role-cell-text", children: row.value })
69
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") })] })] });
70
90
  }
71
91
  /** Called once by the parent client apply(ctx), alongside the other slot registrations. */
72
- export function registerRoleToolViews(ctx) {
92
+ export function registerRoleToolViews(ctx, observations) {
73
93
  ctx.effect(() => ctx.locale.register(ROLE_TOOL_NS, { en: roleToolEn, zh: roleToolZh }), "dsmm: role tool locale");
74
94
  ctx.effect(() => {
75
95
  const style = document.createElement("style");
@@ -79,7 +99,8 @@ export function registerRoleToolViews(ctx) {
79
99
  return () => style.remove();
80
100
  }, "dsmm: role tool styles");
81
101
  ctx.slots.inject("tool.call.toolview", () => {
82
- const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map(key => ctx.slots.register({ name: "tool.call.toolview", key, locale: ROLE_TOOL_NS }, RoleToolView));
102
+ const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map(key => ctx.slots.register({ name: "tool.call.toolview", key, locale: ROLE_TOOL_NS,
103
+ inject: sessionId => ({ hooks: { roleCalls: observations.source(sessionId) } }) }, RoleToolView));
83
104
  return () => { for (const dispose of disposers.reverse())
84
105
  dispose(); };
85
106
  });