@try-works/dsh-recursive-mode 0.3.0 → 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 (120) 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 +33 -12
  17. package/lib/index.js +10017 -3969
  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/skills.d.ts +70 -0
  46. package/lib/status.d.ts +53 -1
  47. package/lib/teams-loop.d.ts +91 -2
  48. package/lib/training.d.ts +211 -0
  49. package/lib/ts-lint.d.ts +15 -0
  50. package/lib/types.d.ts +48 -0
  51. package/lib/workflow-audit.d.ts +207 -0
  52. package/package.json +31 -31
  53. package/preset/recursive.patch.yml +312 -0
  54. package/scripts/e2e-run.mjs +51 -0
  55. package/scripts/link-dsh.mjs +233 -0
  56. package/scripts/live/fake-llm.mjs +150 -0
  57. package/scripts/live-session-plugin.mjs +179 -0
  58. package/scripts/live-session-stock.mjs +106 -0
  59. package/scripts/live-session.mjs +139 -0
  60. package/skills/recursive-mode/SKILL.md +66 -0
  61. package/src/client/derive.ts +18 -2
  62. package/src/closeout-report.ts +274 -0
  63. package/src/closeout-standards.ts +102 -0
  64. package/src/closeout.ts +39 -2
  65. package/src/commands.ts +116 -4
  66. package/src/config.ts +113 -0
  67. package/src/delegation.ts +336 -18
  68. package/src/enforcement.ts +262 -72
  69. package/src/errors.ts +197 -0
  70. package/src/git-context.ts +33 -2
  71. package/src/guard-log.ts +134 -0
  72. package/src/handoff.ts +62 -0
  73. package/src/hooks.ts +316 -0
  74. package/src/identity.ts +230 -0
  75. package/src/index.ts +394 -20
  76. package/src/job-log.ts +112 -0
  77. package/src/jobs-runner.ts +222 -0
  78. package/src/json-safe.ts +75 -0
  79. package/src/lock.ts +153 -16
  80. package/src/memory-feedback.ts +185 -0
  81. package/src/memory-select.ts +187 -0
  82. package/src/memory.ts +309 -0
  83. package/src/model-inventory.ts +196 -0
  84. package/src/phase-graph.ts +191 -0
  85. package/src/phase-rules.ts +236 -0
  86. package/src/plan-gate.ts +111 -0
  87. package/src/policy-globs.ts +636 -0
  88. package/src/policy-write.ts +210 -0
  89. package/src/policy.ts +70 -5
  90. package/src/recursive_ask.tool.ts +276 -0
  91. package/src/recursive_audit_team.tool.ts +7 -3
  92. package/src/recursive_closeout.tool.ts +36 -35
  93. package/src/recursive_delegate.tool.ts +194 -0
  94. package/src/recursive_init.tool.ts +4 -3
  95. package/src/recursive_lint.tool.ts +81 -6
  96. package/src/recursive_lock.tool.ts +21 -4
  97. package/src/recursive_phase.tool.ts +3 -2
  98. package/src/recursive_preview.tool.ts +142 -0
  99. package/src/recursive_review.tool.ts +190 -0
  100. package/src/recursive_scratch.tool.ts +5 -4
  101. package/src/recursive_status.tool.ts +3 -2
  102. package/src/recursive_worktree.tool.ts +6 -5
  103. package/src/result-cap.ts +130 -0
  104. package/src/review-round.ts +335 -0
  105. package/src/review.ts +17 -3
  106. package/src/role-route.ts +230 -0
  107. package/src/router.ts +128 -2
  108. package/src/runtime.ts +968 -39
  109. package/src/settlement.ts +355 -0
  110. package/src/skills-phase.ts +143 -0
  111. package/src/skills.ts +151 -0
  112. package/src/snapshot.ts +39 -8
  113. package/src/status.ts +209 -4
  114. package/src/teams-loop.ts +223 -9
  115. package/src/training.ts +565 -0
  116. package/src/ts-lint.ts +38 -4
  117. package/src/types.ts +51 -0
  118. package/src/workflow-audit.ts +288 -0
  119. package/scripts/install-preset.cmd +0 -7
  120. package/scripts/install-preset.js +0 -101
@@ -0,0 +1,207 @@
1
+ /**
2
+ * T2 — fan the audit out through the native workflow engine's contract.
3
+ *
4
+ * WHY. A phase-3.5 audit over several reviewers is a natural fan-out, and the plugin reimplements
5
+ * that loop by hand. The engine already owns the shape: `phase(title)` to group work, `agent(prompt,
6
+ * opts)` to run one child, and `parallel(thunks)` to fan out and await all of them. Adopting it means
7
+ * one orchestration model instead of two that drift.
8
+ *
9
+ * ⚠ THE HOOK SHAPE IS A STRUCTURAL SEAM, not an import, because the engine runs against a live host
10
+ * context (the item calls it integration-grade). Modelling the three hooks this adapter uses keeps
11
+ * the CONTRACT testable without a host — and the contract is where the risk lives, not the plumbing.
12
+ *
13
+ * ⚠⚠ THE PROPERTY THIS ITEM'S OWN RESCOPE NAMED, and the reason the mapping is pure: **no
14
+ * cross-item null-dropping.** The engine's `agent()` and `parallel()` resolve `null` for a child
15
+ * that FAILED, and the obvious implementation — `results.filter(Boolean)` — silently turns a
16
+ * failed reviewer into a fan-out that simply looks smaller. An audit that dropped its dissenting
17
+ * reviewer would report a clean pass, which is the worst outcome this plugin can produce. So the
18
+ * result carries an entry for EVERY planned item, with `ok: false` where a child produced nothing,
19
+ * and `describeAuditFanOut` says how many failed.
20
+ */
21
+ /** One reviewer's assignment inside the fan-out. */
22
+ export interface AuditFanOutItem {
23
+ /** Stable label: what the board and the engine's progress show. */
24
+ label: string;
25
+ /** The reviewer role, for traceability back to the router. */
26
+ role: string;
27
+ prompt: string;
28
+ }
29
+ /** One phase of the fan-out: a titled group of items run in parallel. */
30
+ export interface AuditFanOutPhase {
31
+ title: string;
32
+ items: AuditFanOutItem[];
33
+ }
34
+ export interface AuditFanOutPlan {
35
+ runId: string;
36
+ phases: AuditFanOutPhase[];
37
+ }
38
+ /** One item's outcome, PRESENT whether or not the child produced anything. */
39
+ export interface AuditFanOutEntry {
40
+ label: string;
41
+ role: string;
42
+ /** False when the child failed or returned nothing — never inferred from a missing entry. */
43
+ ok: boolean;
44
+ value?: unknown;
45
+ /** Why it failed, when it did. */
46
+ reason?: string;
47
+ }
48
+ export interface AuditFanOutResult {
49
+ entries: AuditFanOutEntry[];
50
+ /** How many planned items produced nothing. Stated, so a partial audit cannot read as complete. */
51
+ failed: number;
52
+ }
53
+ /**
54
+ * The three hooks this adapter uses.
55
+ *
56
+ * `agent` and `parallel` resolve `null` rather than rejecting when a child fails — that is the
57
+ * engine's documented behaviour and the reason this module handles null explicitly instead of
58
+ * treating a resolved promise as success.
59
+ */
60
+ export interface WorkflowHooksLike {
61
+ phase(title: string): void;
62
+ agent(prompt: string, options?: {
63
+ label?: string;
64
+ phase?: string;
65
+ }): Promise<unknown>;
66
+ parallel(thunks: ReadonlyArray<() => Promise<unknown>>): Promise<unknown[]>;
67
+ log?(message: string): void;
68
+ }
69
+ /** The reviewers a plan is built from — the plugin's own audit inputs, not an engine concept. */
70
+ export interface AuditReviewerSpec {
71
+ role: string;
72
+ /** Extra instructions for this reviewer; the plan adds the contract around it. */
73
+ focus?: string;
74
+ }
75
+ export interface AuditPlanInput {
76
+ runId: string;
77
+ artifact: string;
78
+ phase: string;
79
+ reviewers: readonly AuditReviewerSpec[];
80
+ /** Questions every reviewer must answer, so the plan carries them rather than each caller. */
81
+ auditQuestions?: readonly string[];
82
+ }
83
+ /**
84
+ * Build the fan-out plan. PURE: same inputs, same plan — which is what makes the orchestration
85
+ * testable without a host and comparable between runs.
86
+ *
87
+ * One phase per ROLE, with one item per reviewer of that role, so the engine's progress reads as
88
+ * "audit phase X, reviewer Y" rather than a flat list of anonymous children.
89
+ */
90
+ export declare function buildAuditFanOutPlan(input: AuditPlanInput): AuditFanOutPlan;
91
+ /**
92
+ * Run a plan through the engine's hooks.
93
+ *
94
+ * ⚠ EVERY planned item yields an entry, whether or not its child produced a value. A missing entry
95
+ * and a failed child are different facts, and conflating them is how an audit reports a pass it did
96
+ * not earn: this returns `ok: false` with a reason instead of dropping the row.
97
+ */
98
+ export declare function orchestrateAudit(hooks: WorkflowHooksLike, plan: AuditFanOutPlan): Promise<AuditFanOutResult>;
99
+ /**
100
+ * A board-facing summary that STATES the failures.
101
+ *
102
+ * The count is explicit because an audit with three of five reviewers failed is not a smaller
103
+ * audit — it is an incomplete one, and a summary that only reported the successes would be the
104
+ * silent-drop defect wearing a friendlier face.
105
+ */
106
+ export declare function describeAuditFanOut(result: AuditFanOutResult): string;
107
+ /**
108
+ * T2 — the canonical script the ENGINE runs, and the request that starts it.
109
+ *
110
+ * ⚠⚠ MEASURED, AND IT CHANGES WHERE THE HOOKS LIVE. The engine is a service —
111
+ * `WorkflowEngine.start(request): WorkflowRun`, *"Parse and execute a workflow script"*, with the
112
+ * request carrying **the script, its `args`, the parent agent and an optional cancel signal** — and
113
+ * its `workflow/*` lifecycle events are documented as **"observe-only … never expose run control"**.
114
+ * So `phase()` / `agent()` / `parallel()` are hooks available to a SCRIPT, not functions the plugin
115
+ * may call directly: the plugin's job is to hand the engine a script plus the plan, and to read the
116
+ * frames afterwards. {@link orchestrateAudit} is therefore the shape a script (or a test double)
117
+ * drives, and this is the shape the plugin submits.
118
+ *
119
+ * ⚠ THE PLUGIN DOES NOT SHIP A GENERATED SCRIPT. A script built by string concatenation from a plan
120
+ * would put reviewer prompts into a program's source, where a stray quote becomes a syntax error in
121
+ * the orchestration layer — the worst place for one. The script is a CONSTANT that reads the plan
122
+ * from `args`, which also keeps the orchestration auditable: one script, reviewed once.
123
+ */
124
+ export declare const AUDIT_FANOUT_SCRIPT: string;
125
+ /**
126
+ * What the engine needs to start an audit fan-out. Mirrors `WorkflowStartRequest` structurally.
127
+ *
128
+ * ⚠ `meta` IS REQUIRED BY THE ENGINE, and this type originally omitted it — a defect found by READING the
129
+ * engine's declarations rather than by any test (T2's acceptance ran against a scripted engine that
130
+ * validated nothing). `packages/workflow/workflow/lib/types/runtime-types.d.ts` states the field is
131
+ * non-optional and its README lists *"a malformed meta block"* among the rejections, so a live engine
132
+ * would have refused this fan-out outright. `subagentProvider` and `maxTotalAgents` are carried too, since
133
+ * they are the engine's own child controls and a fan-out that ignores them cannot honour a host's limits.
134
+ */
135
+ export interface AuditWorkflowRequest {
136
+ script: string;
137
+ /** The engine-validated identity block: name, description, and one phase per reviewer role. */
138
+ meta: {
139
+ name: string;
140
+ description: string;
141
+ whenToUse?: string;
142
+ phases?: Array<{
143
+ title: string;
144
+ detail?: string;
145
+ provider?: string;
146
+ model?: string;
147
+ }>;
148
+ };
149
+ args: {
150
+ plan: AuditFanOutPlan;
151
+ };
152
+ parent: unknown;
153
+ signal?: unknown;
154
+ /** Optional engine-wide child-provider override for this run. */
155
+ subagentProvider?: string;
156
+ /** Optional per-run total-child ceiling, so a host's cap is respected rather than exceeded. */
157
+ maxTotalAgents?: number;
158
+ }
159
+ /**
160
+ * Build the engine request for a plan.
161
+ *
162
+ * `parent` is the exact live Agent, as the engine requires for child authority; it passes through
163
+ * untouched rather than reshaped, because the engine authenticates by object identity.
164
+ *
165
+ * ⚠ THE META IS DERIVED FROM THE PLAN, not hand-written: the engine's `phases` are `{title, detail?,
166
+ * provider?, model?}` and the plan already holds exactly that per reviewer role, so deriving it means the
167
+ * two can never disagree about what the run will do.
168
+ */
169
+ export declare function auditWorkflowRequest(plan: AuditFanOutPlan, options: {
170
+ parent: unknown;
171
+ signal?: unknown;
172
+ /** Overrides the derived identity block; the phases still come from the plan unless given. */
173
+ meta?: {
174
+ name?: string;
175
+ description?: string;
176
+ whenToUse?: string;
177
+ };
178
+ subagentProvider?: string;
179
+ maxTotalAgents?: number;
180
+ }): AuditWorkflowRequest;
181
+ /**
182
+ * T2 — the engine, as a structural seam.
183
+ *
184
+ * ⚠ START AND AWAIT ONLY. The engine's `workflow/*` lifecycle events are documented as
185
+ * **"observe-only … never expose run control"**, so a caller starts a run and awaits the script's
186
+ * `result`; it must not try to steer the run through the event stream.
187
+ */
188
+ export interface WorkflowEngineLike {
189
+ start(request: AuditWorkflowRequest): {
190
+ result: Promise<unknown>;
191
+ };
192
+ }
193
+ /**
194
+ * Start an audit fan-out and await the script's result.
195
+ *
196
+ * ⚠ NO ENGINE IS A STATED OUTCOME, not a silent empty audit: a fan-out that could not be
197
+ * orchestrated must never read as a fan-out that found nothing wrong. The caller gets
198
+ * `orchestrated: false` and a reason, in the same spirit as every other optional seam here.
199
+ */
200
+ export declare function startAuditFanOut(workflow: WorkflowEngineLike | null | undefined, plan: AuditFanOutPlan, options: {
201
+ parent: unknown;
202
+ signal?: unknown;
203
+ }): Promise<{
204
+ orchestrated: boolean;
205
+ reason?: string;
206
+ result?: unknown;
207
+ }>;
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.0",
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": [
@@ -24,17 +25,18 @@
24
25
  "src",
25
26
  "preset",
26
27
  "scripts",
27
- "references"
28
+ "references",
29
+ "skills"
28
30
  ],
29
31
  "license": "MIT",
30
32
  "dsh": {
31
33
  "bundle": {
32
- "patch": "./cordis.patch.yml"
34
+ "patch": ["./cordis.patch.yml", "./preset/recursive.patch.yml"]
33
35
  },
34
36
  "client": {
35
37
  "platform": "web",
36
38
  "inject": [
37
- "@deepseek-ai/dsh-client-runtime",
39
+ "@deepseek-ai/dsh-client-modules",
38
40
  "@deepseek-ai/dsh-client-ui-slots",
39
41
  "@deepseek-ai/dsh-client-ui-conversation",
40
42
  "@deepseek-ai/dsh-client-ui-sidebar",
@@ -45,29 +47,28 @@
45
47
  },
46
48
  "peerDependencies": {
47
49
  "@deepseek-ai/cordis": "^4.0.1",
48
- "@deepseek-ai/dsh-session": "0.1.1-rc.2",
49
- "@deepseek-ai/dsh-session-projection": "0.1.1-rc.2",
50
- "@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
51
- "@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",
52
54
  "react": "^18.2.0"
53
55
  },
54
56
  "devDependencies": {
55
- "@deepseek-ai/cordis": "file:D:/deepseek-harness/vendor/cordis",
56
- "@deepseek-ai/cosmokit": "file:D:/deepseek-harness/vendor/cosmokit",
57
- "@deepseek-ai/dsh-agent": "file:D:/deepseek-harness/packages/core/agent",
58
- "@deepseek-ai/dsh-attachment": "file:D:/deepseek-harness/packages/attachment/attachment",
59
- "@deepseek-ai/dsh-brand": "file:D:/deepseek-harness/packages/util/brand",
60
- "@deepseek-ai/dsh-code-runtime": "file:D:/deepseek-harness/packages/code-runtime/code-runtime",
61
- "@deepseek-ai/dsh-invariants": "file:D:/deepseek-harness/packages/runtime-diagnostics/invariants",
62
- "@deepseek-ai/dsh-llm": "file:D:/deepseek-harness/packages/llm/llm",
63
- "@deepseek-ai/dsh-scope": "file:D:/deepseek-harness/packages/core/scope",
64
- "@deepseek-ai/dsh-session": "file:D:/deepseek-harness/packages/core/session",
65
- "@deepseek-ai/dsh-session-projection": "file:D:/deepseek-harness/packages/session/session-projection",
66
- "@deepseek-ai/dsh-system-prompt": "file:D:/deepseek-harness/packages/core/system-prompt",
67
- "@deepseek-ai/dsh-timeout": "file:D:/deepseek-harness/packages/util/timeout",
68
- "@deepseek-ai/dsh-tools": "file:D:/deepseek-harness/packages/core/tools",
69
- "@deepseek-ai/dsh-user-approval": "file:D:/deepseek-harness/packages/interaction/user-approval",
70
- "@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",
71
72
  "@types/node": "^20.0.0",
72
73
  "@types/react": "^18.2.0",
73
74
  "@types/react-dom": "^18.2.0",
@@ -81,10 +82,12 @@
81
82
  "zod": "^4.4.3"
82
83
  },
83
84
  "scripts": {
84
- "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",
85
86
  "bundle": "tsdown",
86
- "test": "vitest run",
87
- "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",
88
91
  "prepare": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && tsdown"
89
92
  },
90
93
  "peerDependenciesMeta": {
@@ -97,9 +100,6 @@
97
100
  "react": {
98
101
  "optional": true
99
102
  },
100
- "@deepseek-ai/dsh-client-runtime": {
101
- "optional": true
102
- },
103
103
  "@deepseek-ai/dsh-client-ui-slots": {
104
104
  "optional": true
105
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