@try-works/dsh-recursive-mode 0.3.1 → 0.4.0

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 (117) hide show
  1. package/README.md +959 -0
  2. package/lib/client.js +9 -2
  3. package/lib/closeout-report.d.ts +113 -0
  4. package/lib/closeout-standards.d.ts +35 -0
  5. package/lib/closeout.d.ts +12 -0
  6. package/lib/commands.d.ts +1 -1
  7. package/lib/config.d.ts +202 -0
  8. package/lib/delegation.d.ts +123 -3
  9. package/lib/enforcement.d.ts +90 -1
  10. package/lib/errors.d.ts +168 -0
  11. package/lib/git-context.d.ts +17 -0
  12. package/lib/guard-log.d.ts +39 -0
  13. package/lib/handoff.d.ts +29 -0
  14. package/lib/hooks.d.ts +103 -0
  15. package/lib/identity.d.ts +61 -0
  16. package/lib/index.d.ts +32 -12
  17. package/lib/index.js +9819 -3858
  18. package/lib/job-log.d.ts +34 -0
  19. package/lib/jobs-runner.d.ts +105 -0
  20. package/lib/json-safe.d.ts +33 -0
  21. package/lib/lock.d.ts +42 -0
  22. package/lib/memory-feedback.d.ts +52 -0
  23. package/lib/memory-select.d.ts +78 -0
  24. package/lib/memory.d.ts +137 -0
  25. package/lib/model-inventory.d.ts +106 -0
  26. package/lib/phase-graph.d.ts +111 -0
  27. package/lib/phase-rules.d.ts +67 -8
  28. package/lib/plan-gate.d.ts +68 -0
  29. package/lib/policy-globs.d.ts +222 -0
  30. package/lib/policy-write.d.ts +42 -0
  31. package/lib/policy.d.ts +39 -0
  32. package/lib/recursive_ask.tool.d.ts +88 -0
  33. package/lib/recursive_closeout.tool.d.ts +1 -1
  34. package/lib/recursive_delegate.tool.d.ts +22 -0
  35. package/lib/recursive_preview.tool.d.ts +48 -0
  36. package/lib/recursive_review.tool.d.ts +28 -0
  37. package/lib/result-cap.d.ts +70 -0
  38. package/lib/review-round.d.ts +82 -0
  39. package/lib/review.d.ts +9 -0
  40. package/lib/role-route.d.ts +122 -0
  41. package/lib/router.d.ts +90 -5
  42. package/lib/runtime.d.ts +252 -12
  43. package/lib/settlement.d.ts +132 -0
  44. package/lib/skills-phase.d.ts +71 -0
  45. package/lib/status.d.ts +53 -1
  46. package/lib/teams-loop.d.ts +91 -2
  47. package/lib/training.d.ts +211 -0
  48. package/lib/ts-lint.d.ts +15 -0
  49. package/lib/types.d.ts +48 -0
  50. package/lib/workflow-audit.d.ts +207 -0
  51. package/package.json +29 -30
  52. package/preset/recursive.patch.yml +312 -0
  53. package/scripts/e2e-run.mjs +51 -0
  54. package/scripts/link-dsh.mjs +233 -0
  55. package/scripts/live/fake-llm.mjs +150 -0
  56. package/scripts/live-session-plugin.mjs +179 -0
  57. package/scripts/live-session-stock.mjs +106 -0
  58. package/scripts/live-session.mjs +139 -0
  59. package/src/client/derive.ts +18 -2
  60. package/src/closeout-report.ts +274 -0
  61. package/src/closeout-standards.ts +102 -0
  62. package/src/closeout.ts +39 -2
  63. package/src/commands.ts +116 -4
  64. package/src/config.ts +113 -0
  65. package/src/delegation.ts +336 -18
  66. package/src/enforcement.ts +262 -72
  67. package/src/errors.ts +197 -0
  68. package/src/git-context.ts +33 -2
  69. package/src/guard-log.ts +134 -0
  70. package/src/handoff.ts +62 -0
  71. package/src/hooks.ts +316 -0
  72. package/src/identity.ts +230 -0
  73. package/src/index.ts +385 -20
  74. package/src/job-log.ts +112 -0
  75. package/src/jobs-runner.ts +222 -0
  76. package/src/json-safe.ts +75 -0
  77. package/src/lock.ts +153 -16
  78. package/src/memory-feedback.ts +185 -0
  79. package/src/memory-select.ts +187 -0
  80. package/src/memory.ts +309 -0
  81. package/src/model-inventory.ts +196 -0
  82. package/src/phase-graph.ts +191 -0
  83. package/src/phase-rules.ts +236 -0
  84. package/src/plan-gate.ts +111 -0
  85. package/src/policy-globs.ts +636 -0
  86. package/src/policy-write.ts +210 -0
  87. package/src/policy.ts +70 -5
  88. package/src/recursive_ask.tool.ts +276 -0
  89. package/src/recursive_audit_team.tool.ts +7 -3
  90. package/src/recursive_closeout.tool.ts +36 -35
  91. package/src/recursive_delegate.tool.ts +194 -0
  92. package/src/recursive_init.tool.ts +4 -3
  93. package/src/recursive_lint.tool.ts +81 -6
  94. package/src/recursive_lock.tool.ts +21 -4
  95. package/src/recursive_phase.tool.ts +3 -2
  96. package/src/recursive_preview.tool.ts +142 -0
  97. package/src/recursive_review.tool.ts +190 -0
  98. package/src/recursive_scratch.tool.ts +5 -4
  99. package/src/recursive_status.tool.ts +3 -2
  100. package/src/recursive_worktree.tool.ts +6 -5
  101. package/src/result-cap.ts +130 -0
  102. package/src/review-round.ts +335 -0
  103. package/src/review.ts +17 -3
  104. package/src/role-route.ts +230 -0
  105. package/src/router.ts +128 -2
  106. package/src/runtime.ts +968 -39
  107. package/src/settlement.ts +355 -0
  108. package/src/skills-phase.ts +143 -0
  109. package/src/snapshot.ts +39 -8
  110. package/src/status.ts +209 -4
  111. package/src/teams-loop.ts +223 -9
  112. package/src/training.ts +565 -0
  113. package/src/ts-lint.ts +38 -4
  114. package/src/types.ts +51 -0
  115. package/src/workflow-audit.ts +288 -0
  116. package/scripts/install-preset.cmd +0 -7
  117. package/scripts/install-preset.js +0 -101
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@try-works/dsh-recursive-mode",
3
- "description": "recursive-mode workflow as a DeepSeek Harness bundle: RecursiveRuntime service + recursive_status tool",
4
- "version": "0.3.1",
3
+ "description": "recursive-mode workflow as a DeepSeek Harness bundle: RecursiveRuntime service + 13 recursive_* tools (recursive_status, recursive_init, recursive_lock, recursive_lint, recursive_closeout, recursive_scratch, recursive_worktree, recursive_phase, recursive_audit_team, recursive_review, recursive_delegate, recursive_ask, recursive_preview)",
4
+ "version": "0.4.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "./src/*": "./src/*",
18
18
  "./cordis.patch.yml": "./cordis.patch.yml",
19
+ "./preset/recursive.patch.yml": "./preset/recursive.patch.yml",
19
20
  "./package.json": "./package.json"
20
21
  },
21
22
  "files": [
@@ -30,12 +31,12 @@
30
31
  "license": "MIT",
31
32
  "dsh": {
32
33
  "bundle": {
33
- "patch": "./cordis.patch.yml"
34
+ "patch": ["./cordis.patch.yml", "./preset/recursive.patch.yml"]
34
35
  },
35
36
  "client": {
36
37
  "platform": "web",
37
38
  "inject": [
38
- "@deepseek-ai/dsh-client-runtime",
39
+ "@deepseek-ai/dsh-client-modules",
39
40
  "@deepseek-ai/dsh-client-ui-slots",
40
41
  "@deepseek-ai/dsh-client-ui-conversation",
41
42
  "@deepseek-ai/dsh-client-ui-sidebar",
@@ -46,29 +47,28 @@
46
47
  },
47
48
  "peerDependencies": {
48
49
  "@deepseek-ai/cordis": "^4.0.1",
49
- "@deepseek-ai/dsh-session": "0.1.1-rc.2",
50
- "@deepseek-ai/dsh-session-projection": "0.1.1-rc.2",
51
- "@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
52
- "@deepseek-ai/dsh-tools": "0.1.1-rc.2",
50
+ "@deepseek-ai/dsh-session": "0.2.0-rc.2",
51
+ "@deepseek-ai/dsh-session-projection": "0.2.0-rc.2",
52
+ "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
53
+ "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
53
54
  "react": "^18.2.0"
54
55
  },
55
56
  "devDependencies": {
56
- "@deepseek-ai/cordis": "file:D:/deepseek-harness/vendor/cordis",
57
- "@deepseek-ai/cosmokit": "file:D:/deepseek-harness/vendor/cosmokit",
58
- "@deepseek-ai/dsh-agent": "file:D:/deepseek-harness/packages/core/agent",
59
- "@deepseek-ai/dsh-attachment": "file:D:/deepseek-harness/packages/attachment/attachment",
60
- "@deepseek-ai/dsh-brand": "file:D:/deepseek-harness/packages/util/brand",
61
- "@deepseek-ai/dsh-code-runtime": "file:D:/deepseek-harness/packages/code-runtime/code-runtime",
62
- "@deepseek-ai/dsh-invariants": "file:D:/deepseek-harness/packages/runtime-diagnostics/invariants",
63
- "@deepseek-ai/dsh-llm": "file:D:/deepseek-harness/packages/llm/llm",
64
- "@deepseek-ai/dsh-scope": "file:D:/deepseek-harness/packages/core/scope",
65
- "@deepseek-ai/dsh-session": "file:D:/deepseek-harness/packages/core/session",
66
- "@deepseek-ai/dsh-session-projection": "file:D:/deepseek-harness/packages/session/session-projection",
67
- "@deepseek-ai/dsh-system-prompt": "file:D:/deepseek-harness/packages/core/system-prompt",
68
- "@deepseek-ai/dsh-timeout": "file:D:/deepseek-harness/packages/util/timeout",
69
- "@deepseek-ai/dsh-tools": "file:D:/deepseek-harness/packages/core/tools",
70
- "@deepseek-ai/dsh-user-approval": "file:D:/deepseek-harness/packages/interaction/user-approval",
71
- "@deepseek-ai/schemastery": "file:D:/deepseek-harness/vendor/schemastery",
57
+ "@deepseek-ai/cordis": "link:D:/deepseek-harness/vendor/cordis",
58
+ "@deepseek-ai/cosmokit": "link:D:/deepseek-harness/vendor/cosmokit",
59
+ "@deepseek-ai/dsh-agent": "link:D:/deepseek-harness/packages/core/agent",
60
+ "@deepseek-ai/dsh-attachment": "link:D:/deepseek-harness/packages/attachment/attachment",
61
+ "@deepseek-ai/dsh-brand": "link:D:/deepseek-harness/packages/util/brand",
62
+ "@deepseek-ai/dsh-llm": "link:D:/deepseek-harness/packages/llm/llm",
63
+ "@deepseek-ai/dsh-scope": "link:D:/deepseek-harness/packages/core/scope",
64
+ "@deepseek-ai/dsh-session": "link:D:/deepseek-harness/packages/core/session",
65
+ "@deepseek-ai/dsh-session-projection": "link:D:/deepseek-harness/packages/session/session-projection",
66
+ "@deepseek-ai/dsh-system-prompt": "link:D:/deepseek-harness/packages/core/system-prompt",
67
+ "@deepseek-ai/dsh-timeout": "link:D:/deepseek-harness/packages/util/timeout",
68
+ "@deepseek-ai/dsh-tools": "link:D:/deepseek-harness/packages/core/tools",
69
+ "@deepseek-ai/dsh-user-approval": "link:D:/deepseek-harness/packages/interaction/user-approval",
70
+ "@deepseek-ai/dsh-util-values": "link:D:/deepseek-harness/packages/util/values",
71
+ "@deepseek-ai/schemastery": "link:D:/deepseek-harness/vendor/schemastery",
72
72
  "@types/node": "^20.0.0",
73
73
  "@types/react": "^18.2.0",
74
74
  "@types/react-dom": "^18.2.0",
@@ -82,10 +82,12 @@
82
82
  "zod": "^4.4.3"
83
83
  },
84
84
  "scripts": {
85
- "build": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && tsdown",
85
+ "build": "node scripts/link-dsh.mjs && node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && tsdown",
86
86
  "bundle": "tsdown",
87
- "test": "vitest run",
88
- "typecheck": "tsc --noEmit",
87
+ "test": "node scripts/link-dsh.mjs && vitest run",
88
+ "e2e": "node scripts/e2e-run.mjs",
89
+ "typecheck": "node scripts/link-dsh.mjs && tsc --noEmit",
90
+ "link:dsh": "node scripts/link-dsh.mjs",
89
91
  "prepare": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && tsdown"
90
92
  },
91
93
  "peerDependenciesMeta": {
@@ -98,9 +100,6 @@
98
100
  "react": {
99
101
  "optional": true
100
102
  },
101
- "@deepseek-ai/dsh-client-runtime": {
102
- "optional": true
103
- },
104
103
  "@deepseek-ai/dsh-client-ui-slots": {
105
104
  "optional": true
106
105
  },
@@ -0,0 +1,312 @@
1
+ # The recursive-mode agent preset, declared the way DSH declares presets.
2
+ #
3
+ # A preset is not discovered from a directory. The registry documents its parameter as "Parsed
4
+ # configuration supplied by the declaring plugin", and this row IS that declaration: a row naming
5
+ # @deepseek-ai/dsh-agent-preset, whose config is the preset definition. The built-ins ship identically -
6
+ # see the harness bundle at packages/bundle/web-app/presets/*.patch.yml.
7
+ #
8
+ # Kept in step with preset/recursive/agent.cordis.yml, which remains the source composition; a spec
9
+ # proves the two agree rather than trusting two copies to stay identical.
10
+ #
11
+ # The platform-switch expressions below are preserved verbatim, as expressions. The agent-preset plugin
12
+ # sets EntryGroup.key, documented as preserving child expressions until their own plugins activate, so
13
+ # they are evaluated by the loader rather than at packaging time - baking them into static values would
14
+ # freeze one platform behaviour onto the other.
15
+ #
16
+ # The server-entry placeholder in the source is resolved HERE, to the package name, not to an absolute
17
+ # file URL: the loader resolves a package row from the profile node_modules, so no path is guessed and
18
+ # no post-install step is needed.
19
+ - insert:
20
+ - id: preset-recursive
21
+ name: '@deepseek-ai/dsh-agent-preset'
22
+ config:
23
+ id: recursive
24
+ name: Recursive mode
25
+ description: Audited 12-phase workflow with per-phase subagent delegation, receipts and run memory.
26
+ order: 25
27
+ plugins:
28
+ # The `recursive` agent preset: the full coding agent (standard surface), presented
29
+ # with BOTH tool modes (`mode: both`), plus the recursive-mode workflow surface.
30
+ # Everything in `standard` is here unchanged; see the recursive-mode surface rows
31
+ # added before the identity section (tool-presentation both, the isolated
32
+ # recursive-realm, and the recursive:policy prompt section).
33
+ #
34
+ # This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
35
+ # standing scope; every session naming it joins by scope parentage, so the
36
+ # tools and prompt sections registered here cover each joined agent while a
37
+ # session's own state stays keyed per Session/Agent inside the plugins. The
38
+ # host composition (`base.cordis.yml` + `web.cordis.yml`) keeps everything a
39
+ # preset must not own: the registries themselves, the sandbox and approval
40
+ # stack, persistence, and the model route.
41
+ #
42
+ # A service row here MUST sit inside a group carrying an `isolate` realm.
43
+ # Without one it publishes into the root realm, where it is process-global —
44
+ # another preset publishing the same name collides, and a host reader would
45
+ # resolve one preset's instance for every session; `dsh-agent-presets` rejects
46
+ # that at mount. `true` means an entry-local realm: this standing mount's own
47
+ # private instance, apart from every other preset's. (A shared label does NOT
48
+ # pool instances — `provide()` throws on the second registration under the
49
+ # same realm symbol; labels join REALMS, and are not what this file needs.)
50
+
51
+ # ── recursive-mode surface ─────────────────────────────────────────────────
52
+
53
+ # tool-presentation mode both (decision #12, PROPOSAL §7.4): the model sees
54
+ # native tools AND the run_code SDK.
55
+ - id: tool-presentation
56
+ name: '@deepseek-ai/dsh-agent-tool-presentation'
57
+ config:
58
+ mode: both
59
+
60
+ # The recursive workflow realm: per-session isolated RecursiveRuntime service +
61
+ # the recursive_* tools + the /recursive command + the policy prompt section.
62
+ # isolate.recursive keeps `provide('recursive')` from colliding across sessions.
63
+ #
64
+ # R2 (02-to-be-plan.addendum-r4-r2-mount-resolution.md): the server-surface row
65
+ # is a PLACEHOLDER here; scripts/install-preset.js replaces it with an ABSOLUTE
66
+ # file URL into the profile-installed package so its own @deepseek-ai/* imports
67
+ # resolve through the profile flat-fallback junctions (Service identity intact).
68
+ # commands.ts is bundled INTO lib/index.js, so a single row is sufficient.
69
+ - id: recursive-realm
70
+ name: cordis:group
71
+ group: true
72
+ isolate:
73
+ recursive: true
74
+ config:
75
+ - id: recursive
76
+ name: '@try-works/dsh-recursive-mode'
77
+
78
+ # The recursive:policy prompt section is registered in code (Stage A,
79
+ # src/index.ts via ctx.systemPrompt.section) — see plan-mode's pattern.
80
+
81
+ # ── identity ────────────────────────────────────────────────────────────────
82
+
83
+ # The preset's own persona, shadowing the deployment default for this agent.
84
+ # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
85
+ - id: persona
86
+ name: '@deepseek-ai/dsh-persona'
87
+ config:
88
+ text: >-
89
+ You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
90
+
91
+ - id: agent-instructions
92
+ name: '@deepseek-ai/dsh-agent-instructions'
93
+ config:
94
+ maxBytes: 65536
95
+
96
+ # ── shell ───────────────────────────────────────────────────────────────────
97
+
98
+ # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
99
+ # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
100
+ # the criterion for host-plane ownership — injection resolves before any session
101
+ # exists, so there is no agent to key by. Behind a preset realm those variables
102
+ # never reached the model's shell at all. Both shell tools consume the host
103
+ # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
104
+ # host-plane too.
105
+ - id: tool-bash
106
+ name: '@deepseek-ai/dsh-tool-bash'
107
+ disabled: !!js process.platform === 'win32'
108
+
109
+ - id: tool-pwsh
110
+ name: '@deepseek-ai/dsh-tool-pwsh'
111
+ disabled: !!js process.platform !== 'win32'
112
+
113
+ # ── filesystem ──────────────────────────────────────────────────────────────
114
+
115
+ # Both register into the host `tools` registry and provide nothing, so
116
+ # they need no realm. The `fs` service and its policy stay in the host.
117
+ - id: tool-fs
118
+ name: '@deepseek-ai/dsh-tool-fs'
119
+
120
+ - id: tool-fs-search
121
+ name: '@deepseek-ai/dsh-tool-fs-search'
122
+ config:
123
+ sampleOverCapGlobResults: false
124
+
125
+ # ── background jobs ────────────────────────────────────────────────────────
126
+
127
+ # Only the model-facing controls. The task REGISTRY stays on the host plane:
128
+ # its producers sit outside any realm this file could put it in — `tool-bash`
129
+ # above resolves it with `ctx.get`, and an entry-local realm here is invisible
130
+ # to every sibling row, so `run_in_background` would answer "background jobs
131
+ # unavailable" while these controls sat in the catalog. The registry is keyed by
132
+ # owning agent anyway, so one host instance serves every session. What a preset
133
+ # chooses is whether its agent can collect and stop background work at all.
134
+ - id: tool-jobs
135
+ name: '@deepseek-ai/dsh-tool-jobs'
136
+
137
+ # ── skills ──────────────────────────────────────────────────────────────────
138
+
139
+ # The skill REGISTRY lives in the host composition and is layered per scope:
140
+ # these rows register into THIS preset's layer of it, so they need no realm.
141
+ # `skill-filesystem` contributes local-root discovery for agents on this preset, and
142
+ # `tool-skill` gives them the catalog and loader; the merged catalog also
143
+ # carries whatever the deployment registered globally (repository plugins).
144
+ - id: skill-filesystem
145
+ name: '@deepseek-ai/dsh-skill-filesystem'
146
+
147
+ - id: tool-skill
148
+ name: '@deepseek-ai/dsh-tool-skill'
149
+
150
+ # ── goals ───────────────────────────────────────────────────────────────────
151
+
152
+ # Only the model-facing tool. The goal SERVICE, its session driver, and the
153
+ # `/goal` command stay on the host plane: the Gateway serves the goal domain as
154
+ # Remote endpoints whose receiver comes from a generated descriptor, so it
155
+ # resolves `goals` on the host and an entry-local realm here would hide it. The
156
+ # registry is keyed by session anyway, so one host instance serves every
157
+ # session. What a preset chooses is whether its agent can call the goal tool.
158
+ - id: tool-goal
159
+ name: '@deepseek-ai/dsh-tool-goal'
160
+
161
+ # ── plan mode ───────────────────────────────────────────────────────────────
162
+
163
+ # Plan state is per-agent by nature, so an entry-local realm is not a
164
+ # workaround here — it is the correct lifetime.
165
+ - id: planning
166
+ name: cordis:group
167
+ group: true
168
+ isolate:
169
+ planMode: true
170
+ config:
171
+ - id: plan-mode
172
+ name: '@deepseek-ai/dsh-plan-mode'
173
+ config:
174
+ section: |
175
+ You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
176
+
177
+ Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
178
+
179
+ The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
180
+
181
+ Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
182
+
183
+ Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
184
+
185
+ When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
186
+
187
+ # ── compaction ──────────────────────────────────────────────────────────────
188
+
189
+ # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
190
+ # share this realm rather than sit outside it.
191
+ #
192
+ # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
193
+ # plane, and the rows here resolve that one instance. It takes no configuration,
194
+ # keys every fold by Session, and owns the context-meter projection units the
195
+ # browser reads for every session — behind a realm those units would come and go
196
+ # with whichever presets happen to be mounted. What a preset chooses is whether
197
+ # its agent compacts at all, which is `compaction-basic` below.
198
+ - id: compaction
199
+ name: cordis:group
200
+ group: true
201
+ isolate:
202
+ compaction: true
203
+ toolResultPruner: true
204
+ config:
205
+ - id: compaction-basic
206
+ name: '@deepseek-ai/dsh-compaction-basic'
207
+
208
+ - id: command-compact
209
+ name: '@deepseek-ai/dsh-command-compact'
210
+
211
+ - id: tool-result-pruner
212
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
213
+ config:
214
+ thresholdChars: 8192
215
+ headChars: 4096
216
+ tailChars: 1024
217
+
218
+ # ── delegation and workflows ────────────────────────────────────────────────
219
+
220
+ # The `subagents` registry and its spawn/fork backends live in the HOST
221
+ # composition: the registry is a process singleton whose cross-session queries
222
+ # the api-proxy serves to the browser, and a provider name may only be
223
+ # registered once. This preset contributes the delegation TOOLS, which resolve
224
+ # that host registry.
225
+ #
226
+ # `workflows` is different — nothing outside an agent reads it — so every row
227
+ # that reaches it shares one entry-local realm here, and a consumer left
228
+ # outside would resolve a host registry this preset does not populate.
229
+ #
230
+ # `tool-subagent-report` is host-plane for the same reason as the registry,
231
+ # not because a preset may not want it: it registers a CONTINUABLE SETUP on
232
+ # that singleton rather than a tool this agent calls, and the setup list is
233
+ # not scope-aware — one copy per mounted preset means every child gets
234
+ # `report` registered once per live session, which throws on the second.
235
+ - id: delegation
236
+ name: cordis:group
237
+ group: true
238
+ isolate:
239
+ workflowEngine: true
240
+ config:
241
+ - id: tool-subagent-control
242
+ name: '@deepseek-ai/dsh-tool-subagent-control'
243
+
244
+ - id: tool-subagent-list-agents
245
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
246
+
247
+ - id: tool-subagent
248
+ name: '@deepseek-ai/dsh-tool-subagent'
249
+ config:
250
+ provider: spawn
251
+ toolName: subagent
252
+ backgroundMode: continuable
253
+
254
+ - id: tool-subagent-fork
255
+ name: '@deepseek-ai/dsh-tool-subagent'
256
+ config:
257
+ provider: fork
258
+ toolName: subagent_fork
259
+ backgroundMode: continuable
260
+
261
+ # Product providers are host-plane singletons. Copy this preset, then
262
+ # remove `disabled` from either ordinary tool row to expose that product
263
+ # only to agents composed from the copy.
264
+ - id: tool-subagent-codex
265
+ name: '@deepseek-ai/dsh-tool-subagent'
266
+ disabled: true
267
+ config:
268
+ provider: codex
269
+ toolName: subagent_codex
270
+ enableRunInBackground: false
271
+ maxDepth: provider-managed
272
+
273
+ - id: tool-subagent-claude-code
274
+ name: '@deepseek-ai/dsh-tool-subagent'
275
+ disabled: true
276
+ config:
277
+ provider: claude-code
278
+ toolName: subagent_claude_code
279
+ enableRunInBackground: false
280
+ maxDepth: provider-managed
281
+
282
+ - id: workflow-worker-thread
283
+ name: '@deepseek-ai/dsh-workflow-worker-thread'
284
+ config:
285
+ provider: spawn
286
+
287
+ - id: tool-workflow
288
+ name: '@deepseek-ai/dsh-tool-workflow'
289
+
290
+ - id: tool-ralph
291
+ name: '@deepseek-ai/dsh-tool-ralph'
292
+ config:
293
+ subagentProvider: spawn
294
+ maxRounds: 64
295
+
296
+ # ── remaining model-facing rows ─────────────────────────────────────────────
297
+
298
+ - id: tool-ask-user
299
+ name: '@deepseek-ai/dsh-tool-ask-user'
300
+
301
+ - id: tool-todo
302
+ name: '@deepseek-ai/dsh-tool-todo'
303
+ config:
304
+ allowParallelInProgress: true
305
+
306
+ # The `web` service and its search provider stay in the host composition; only
307
+ # the model-facing tool is per-session.
308
+ - id: tool-web
309
+ name: '@deepseek-ai/dsh-tool-web'
310
+ config:
311
+ fetch: false
312
+ searchTimeoutMs: 60000
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * FU-1 — the one-command end-to-end runner.
4
+ *
5
+ * Runs the E: harness (`tests/e2e-harness.spec.ts`) and then points at the run directory it produced, so
6
+ * a human can open the artifacts the workflow actually wrote. It KEEPS the run by default: a harness
7
+ * that deletes its own evidence is not debuggable, which is the whole reason this exists.
8
+ *
9
+ * Why a wrapper at all: the harness must import TypeScript sources, so it runs under vitest rather than
10
+ * bare node. This is the thin, repeatable entry point; the assertions live in the spec.
11
+ *
12
+ * Usage: pnpm e2e (keeps the run)
13
+ * E2E_RUN_ROOT=D:\x pnpm e2e
14
+ */
15
+ import { spawnSync } from 'node:child_process'
16
+ import { existsSync, readdirSync, statSync } from 'node:fs'
17
+ import { join } from 'node:path'
18
+
19
+ const preferred = process.env.E2E_RUN_ROOT ?? 'E:\\dsh-rm-e2e'
20
+ const root = existsSync('E:\\') ? preferred : join(process.env.TEMP ?? '.', 'dsh-rm-e2e')
21
+
22
+ console.log('[e2e] scratch root: ' + root)
23
+ const result = spawnSync(
24
+ 'pnpm',
25
+ ['exec', 'vitest', 'run', 'tests/e2e-harness.spec.ts'],
26
+ {
27
+ // ⚠ `shell: true` IS REQUIRED ON WINDOWS: spawning `pnpm.cmd` directly fails with EINVAL because
28
+ // Node cannot execute a batch file without a shell, and the failure is a NULL status with no output —
29
+ // the runner would exit 1 having printed nothing about why. The error is reported below for the same
30
+ // reason: a silent runner is worse than a failing one.
31
+ shell: true,
32
+ stdio: 'inherit',
33
+ env: { ...process.env, E2E_KEEP: '1', E2E_RUN_ROOT: root },
34
+ },
35
+ )
36
+ if (result.error) console.error('[e2e] could not run vitest: ' + result.error.message)
37
+ if (result.status !== 0 && !result.error) console.error('[e2e] vitest exited ' + result.status)
38
+
39
+ // Point at the newest run so the artifacts can be inspected without hunting for them.
40
+ if (existsSync(root)) {
41
+ const runs = readdirSync(root)
42
+ .map((name) => ({ name, path: join(root, name), at: statSync(join(root, name)).mtimeMs }))
43
+ .sort((a, b) => b.at - a.at)
44
+ if (runs.length > 0) {
45
+ console.log('\n[e2e] newest run: ' + runs[0].path)
46
+ console.log('[e2e] report: ' + join(runs[0].path, 'e2e-report.md'))
47
+ console.log('[e2e] run dir: ' + join(runs[0].path, '.recursive', 'run', 'e2e-run'))
48
+ }
49
+ }
50
+
51
+ process.exit(result.status ?? 1)