@ran-sh/dsh-crew 1.9.0 → 1.9.1

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 (151) hide show
  1. package/.claude-plugin/marketplace.json +16 -16
  2. package/.claude-plugin/plugin.json +14 -14
  3. package/LICENSE +21 -21
  4. package/README.de.md +359 -359
  5. package/README.es.md +359 -359
  6. package/README.fr.md +359 -359
  7. package/README.hi.md +359 -359
  8. package/README.id.md +359 -359
  9. package/README.ja.md +359 -359
  10. package/README.ko.md +359 -359
  11. package/README.md +126 -126
  12. package/README.pt.md +359 -359
  13. package/README.ru.md +359 -359
  14. package/README.th.md +359 -359
  15. package/README.tr.md +359 -359
  16. package/README.vi.md +359 -359
  17. package/README.zh-TW.md +359 -359
  18. package/README.zh.md +116 -116
  19. package/agents/ds-flash.md +24 -24
  20. package/agents/ds-pro.md +24 -24
  21. package/agents/ds-reviewer.md +23 -23
  22. package/agents/ds-worker.md +23 -23
  23. package/bin/dsh-crew.mjs +16 -16
  24. package/codex/agents/ds-flash.toml +34 -34
  25. package/codex/agents/ds-pro.toml +34 -34
  26. package/codex/agents/ds-reviewer.toml +32 -32
  27. package/codex/agents/ds-worker.toml +32 -32
  28. package/codex/prompts/dsh-config.md +19 -19
  29. package/codex/prompts/dsh-status.md +5 -5
  30. package/commands/config.md +23 -23
  31. package/commands/off.md +5 -5
  32. package/commands/on.md +5 -5
  33. package/commands/status.md +9 -9
  34. package/cordis.patch.yml +4 -4
  35. package/docs/gpt-relay-extension.md +103 -103
  36. package/docs/installation.md +138 -138
  37. package/docs/job-contracts.md +103 -103
  38. package/docs/readiness-matrix.md +85 -85
  39. package/docs/ui-surfaces.md +107 -107
  40. package/official-web-bridge/cordis.patch.yml +4 -4
  41. package/official-web-bridge/entry.mjs +1 -1
  42. package/official-web-bridge/overlay-entry.mjs +59 -59
  43. package/official-web-bridge/package.json +25 -25
  44. package/package.json +1 -1
  45. package/scripts/build-client.mjs +49 -49
  46. package/scripts/live-crew-smoke.mjs +39 -39
  47. package/scripts/live-policy-matrix.mjs +177 -177
  48. package/scripts/policy-probe.mjs +101 -101
  49. package/scripts/remove-legacy-official-bridge.ps1 +89 -89
  50. package/scripts/setup.mjs +393 -393
  51. package/scripts/smoke-real.mjs +110 -110
  52. package/scripts/smoke.mjs +78 -78
  53. package/scripts/verify-crew-ui-polish.mjs +145 -145
  54. package/scripts/verify-history-ui.mjs +97 -97
  55. package/scripts/verify-installer-fix.mjs +26 -26
  56. package/scripts/verify-npm-install.mjs +311 -311
  57. package/scripts/verify-official-bridge-e2e.mjs +192 -192
  58. package/src/adaptive-routing.mjs +260 -260
  59. package/src/client/activation-summary.tsx +64 -64
  60. package/src/client/collapsible-sections.mjs +55 -55
  61. package/src/client/history-panel.tsx +108 -108
  62. package/src/client/host-readiness.mjs +71 -71
  63. package/src/client/index.tsx +1711 -1711
  64. package/src/client/model-callability-view.mjs +17 -17
  65. package/src/client/panel-chrome.tsx +40 -40
  66. package/src/client/quick-entry.tsx +10 -10
  67. package/src/client/quick-panel.tsx +275 -275
  68. package/src/client/readiness-envelope.mjs +34 -34
  69. package/src/client/surface-detection.mjs +43 -43
  70. package/src/config-readiness.mjs +226 -226
  71. package/src/credential-reference.mjs +38 -38
  72. package/src/delivery.mjs +205 -205
  73. package/src/dsh-cli-runtime.mjs +1021 -1021
  74. package/src/dsh-cohort.mjs +20 -20
  75. package/src/extension-contract.mjs +104 -104
  76. package/src/failure-classification.mjs +201 -201
  77. package/src/history/admission-gate.mjs +67 -67
  78. package/src/history/archive-store.mjs +272 -272
  79. package/src/history/cleanup-plan.mjs +89 -89
  80. package/src/history/http.mjs +32 -32
  81. package/src/history/operation.mjs +86 -86
  82. package/src/history/runner-detach.mjs +34 -34
  83. package/src/history/runner.mjs +52 -52
  84. package/src/history/runtime.mjs +36 -36
  85. package/src/history/service.mjs +177 -177
  86. package/src/history/state.mjs +27 -27
  87. package/src/hub/entry.mjs +104 -104
  88. package/src/hub/index.mjs +2694 -2694
  89. package/src/hub-client.mjs +154 -154
  90. package/src/hub-compatibility.mjs +42 -42
  91. package/src/i18n.mjs +19 -19
  92. package/src/information-flow.mjs +67 -67
  93. package/src/install/cli.mjs +28 -28
  94. package/src/install/install-legacy.mjs +711 -711
  95. package/src/install/install.mjs +483 -483
  96. package/src/install/npx-lifecycle.mjs +3456 -3456
  97. package/src/install/official-frontend-assets.mjs +78 -78
  98. package/src/install/official-web.mjs +95 -95
  99. package/src/install/payload-content.mjs +88 -88
  100. package/src/install/windows-startup.mjs +236 -236
  101. package/src/install/windows-supervisor-adapter.mjs +443 -443
  102. package/src/install/windows-supervisor-lifecycle.mjs +782 -782
  103. package/src/install/zcode.mjs +397 -397
  104. package/src/job-contracts.mjs +255 -255
  105. package/src/local-request-guard.mjs +60 -60
  106. package/src/mcp-runtime.mjs +340 -340
  107. package/src/model-callability-contract.mjs +79 -79
  108. package/src/model-catalog.mjs +180 -180
  109. package/src/model-routing.mjs +586 -586
  110. package/src/model-schedule.mjs +207 -207
  111. package/src/official-web-bridge.mjs +447 -447
  112. package/src/policy.mjs +235 -235
  113. package/src/provider-delete-adapters.mjs +1934 -1934
  114. package/src/provider-health.mjs +130 -130
  115. package/src/provider-inventory.mjs +182 -182
  116. package/src/provider-layer-migration-adapters.mjs +759 -759
  117. package/src/provider-layer-migration.mjs +198 -198
  118. package/src/provider-lifecycle-state.mjs +103 -103
  119. package/src/provider-lifecycle.mjs +252 -252
  120. package/src/provider-profile-store.mjs +390 -390
  121. package/src/provider-settings-store.mjs +633 -633
  122. package/src/provider-store-lock.mjs +67 -67
  123. package/src/readiness-matrix.mjs +181 -181
  124. package/src/removable-waiter.mjs +29 -29
  125. package/src/role-profiles.mjs +107 -107
  126. package/src/runtime-controls.mjs +84 -84
  127. package/src/runtime-identity-contract.mjs +34 -34
  128. package/src/runtime-identity.mjs +235 -235
  129. package/src/runtime-readiness-snapshot.mjs +285 -285
  130. package/src/server.mjs +581 -581
  131. package/src/session-origins.mjs +60 -60
  132. package/src/standalone-sdk.mjs +23 -23
  133. package/src/status-shard.mjs +63 -63
  134. package/src/structured-error-code.mjs +38 -38
  135. package/src/supervisor/restart-request.mjs +256 -256
  136. package/src/workflow-runtime.mjs +739 -739
  137. package/src/workflow.mjs +155 -155
  138. package/src/workspace-audit.mjs +231 -231
  139. package/src/workspace-context.mjs +146 -146
  140. package/src/workspace-isolation.mjs +455 -455
  141. package/src/workspace-readiness.mjs +32 -32
  142. package/statusline/statusline.sh +14 -14
  143. package/statusline/worker-segment.sh +35 -35
  144. package/windows/start-dsh-crew.cmd +57 -57
  145. package/windows/start-dsh-crew.ps1 +1302 -1302
  146. package/windows/supervisor-control.ps1 +467 -467
  147. package/worker.cordis.yml +67 -67
  148. package/zcode/agents/ds-reviewer.md +31 -31
  149. package/zcode/agents/ds-worker.md +31 -31
  150. package/zcode/commands/dsh-config.md +17 -17
  151. package/zcode/commands/dsh-status.md +5 -5
@@ -1,138 +1,138 @@
1
- # Installation plan
2
-
3
- DSH Crew is a plugin for the official DeepSeek Harness and uses an explicit
4
- installer. Merely installing the npm package does not mutate the host.
5
- The managed production supervisor is currently supported on Windows; Linux and
6
- macOS are not yet production runtime targets.
7
-
8
- ## Recommended path
9
-
10
- ```bash
11
- npm install -g @ran-sh/dsh-crew@latest
12
- dsh-crew install
13
- ```
14
-
15
- The installer registers the plugin in a dedicated official Harness
16
- `profile: dsh-crew` served on 3210. This is the canonical Crew control and
17
- execution surface; it is not a separate or forked Harness product.
18
-
19
- Desktop `--open` starts or reuses the separately installed official CLI's web
20
- frontend on 3080, then ensures Crew runs hidden on 3210. It never opens the 3210
21
- browser automatically. Install the official CLI separately so `dsh.cmd` is on
22
- PATH. Login startup and `--background` remain Crew-only.
23
- The launcher adds a Crew-owned overlay pointing to an immutable small frontend
24
- snapshot. It supplies the simple panel and the link to 3210; the backend links
25
- back to 3080. An already-running official instance without that overlay must be
26
- reloaded when idle; the desktop launcher does not terminate existing official work.
27
-
28
- To test GitHub `main` before an npm release:
29
-
30
- ```bash
31
- git clone https://github.com/Ran-sh/dsh-crew.git
32
- cd dsh-crew
33
- node scripts/setup.mjs install
34
- node scripts/setup.mjs status
35
- ```
36
-
37
- ## Managed surfaces
38
-
39
- | Surface | Installed behavior | Uninstall behavior |
40
- | --- | --- | --- |
41
- | Crew plugin runtime | Official DeepSeek Harness isolated in `~/.config/dsh-crew/harness`, profile: dsh-crew, with the Crew plugin registered | Plugin registration removed; config kept unless `--purge` |
42
- | Codex MCP and roles | Points Worker, Reviewer, and MCP to the installed release | Only DSH Crew entries are removed |
43
- | Global Codex policy | Managed block inside `~/.codex/AGENTS.md` | Only the managed block is removed |
44
- | ZCode MCP, agents and commands | Installs `~/.zcode/AGENTS.md`, `agents/{ds-worker,ds-reviewer}.md`, commands and a source-aware `dsh-crew` MCP entry | Only DSH Crew-owned files/entry are removed |
45
- | Windows login startup | `DSH Crew.vbs`, `start-dsh-crew.cmd`, `start-dsh-crew.ps1`, the exact process controller, and its hash manifest | Only DSH Crew-owned files are removed; foreign pre-existing content at those exact paths is preserved or fails closed |
46
- | Official 3080 UI | Desktop launch starts/reuses the official program; Crew installer does not register plugins in its profile | Left running and untouched by Crew uninstall |
47
-
48
- The Windows launcher supervises only the Crew-owned 3210 service, so provider
49
- restart and rollback operations have one verifiable supervisor. The official
50
- 3080 surface never starts, owns, or supervises 3210. The launcher does not
51
- store credentials.
52
-
53
- `dsh-crew install`, `update`, and `rollback` automatically perform an exact,
54
- crash-resumable watcher handoff after the payload transaction. The updater
55
- reserves handoff ownership before releasing its update lock, resumes any
56
- unfinished handoff first, and succeeds only after the isolated 3210 runtime
57
- reports the expected Crew and DSH versions.
58
-
59
- On Windows, installation registers login startup. To start immediately and
60
- open the Crew control:
61
-
62
- ```powershell
63
- & "$env:USERPROFILE\.config\dsh-crew\launchers\start-dsh-crew.cmd" --open
64
- ```
65
-
66
- Then verify <http://127.0.0.1:3210/> answers the Crew extension contract.
67
-
68
- ```bash
69
- dsh-crew status
70
- dsh-crew inspect
71
- ```
72
-
73
- ZCode uses `~/.zcode/cli/config.json` when it already has native MCP servers. If
74
- that native list is empty, the installer uses `~/.agents/mcp.json`; unrelated
75
- servers are preserved and a conflicting unowned `dsh-crew` entry fails closed.
76
-
77
- ## Verification
78
-
79
- ```bash
80
- dsh-crew status
81
- dsh-crew inspect
82
- dsh-crew jobs list
83
- ```
84
-
85
- Source checkout verification:
86
-
87
- ```bash
88
- node --test test/*.test.mjs
89
- pnpm run build:client
90
- npm pack --dry-run
91
- ```
92
-
93
- ## Harness CLI selection
94
-
95
- The Crew launcher and the 3210 Hub boot from one Crew-managed Harness entry,
96
- chosen in this order:
97
-
98
- 1. `DSH_CREW_DSH_CLI`, when set to an explicit `@deepseek-ai/dsh` entry.
99
- 2. The Crew-managed npm runtime at `<crew home>/runtime` (the normal install
100
- path, written by `dsh-crew update`). It carries whatever cohort the installed
101
- Crew release pinned; the launcher never substitutes a different version.
102
- 3. A Crew-managed source cohort, discovered through a
103
- `<crew home>/runtime-source-<label>.json` sidecar. The sidecar's recorded
104
- `version` must equal the checkout's own `apps/cli/package.json`, so a stale
105
- sidecar can never pin a half-updated tree.
106
-
107
- For the npm runtime the launcher uses the Crew home as `DSH_HOME`; a source
108
- cohort is its own home, because its profiles, sessions and settings live inside
109
- that tree. The launcher then derives `dsh_version` from the verified
110
- `@deepseek-ai/dsh` manifest and requires the Hub to report that same version, so
111
- a process left over from a previous cohort is never treated as healthy.
112
-
113
- Only override `DSH_CREW_DSH_CLI` deliberately — it wins over the managed runtime.
114
- Never point it at the official `~/.dsh` tree, which the Crew launcher treats as a
115
- read-only boundary.
116
-
117
- To build a source cohort instead of the npm runtime (for example to test an
118
- unpublished tag), clone the tag into `<crew home>/runtime-source-<label>`, build
119
- its CLI, and write the matching sidecar. On Windows a source install needs the
120
- native toolchain for its `fs-ext` dependency; a failed native build is reported
121
- as a runtime failure rather than silently falling back to another cohort.
122
-
123
- ## Rollback vs uninstall
124
-
125
- ```bash
126
- dsh-crew releases list
127
- dsh-crew rollback <version>
128
- ```
129
-
130
- Use `dsh-crew rollback <version>` to switch the retained payload and verify the
131
- 3210 runtime. Use `dsh-crew uninstall` only to remove managed files (backups and
132
- config are kept unless `--purge` is passed).
133
-
134
- ```bash
135
- dsh-crew uninstall
136
- ```
137
-
138
- Use `dsh-crew uninstall --purge` only when configuration and backups should also be deleted.
1
+ # Installation plan
2
+
3
+ DSH Crew is a plugin for the official DeepSeek Harness and uses an explicit
4
+ installer. Merely installing the npm package does not mutate the host.
5
+ The managed production supervisor is currently supported on Windows; Linux and
6
+ macOS are not yet production runtime targets.
7
+
8
+ ## Recommended path
9
+
10
+ ```bash
11
+ npm install -g @ran-sh/dsh-crew@latest
12
+ dsh-crew install
13
+ ```
14
+
15
+ The installer registers the plugin in a dedicated official Harness
16
+ `profile: dsh-crew` served on 3210. This is the canonical Crew control and
17
+ execution surface; it is not a separate or forked Harness product.
18
+
19
+ Desktop `--open` starts or reuses the separately installed official CLI's web
20
+ frontend on 3080, then ensures Crew runs hidden on 3210. It never opens the 3210
21
+ browser automatically. Install the official CLI separately so `dsh.cmd` is on
22
+ PATH. Login startup and `--background` remain Crew-only.
23
+ The launcher adds a Crew-owned overlay pointing to an immutable small frontend
24
+ snapshot. It supplies the simple panel and the link to 3210; the backend links
25
+ back to 3080. An already-running official instance without that overlay must be
26
+ reloaded when idle; the desktop launcher does not terminate existing official work.
27
+
28
+ To test GitHub `main` before an npm release:
29
+
30
+ ```bash
31
+ git clone https://github.com/Ran-sh/dsh-crew.git
32
+ cd dsh-crew
33
+ node scripts/setup.mjs install
34
+ node scripts/setup.mjs status
35
+ ```
36
+
37
+ ## Managed surfaces
38
+
39
+ | Surface | Installed behavior | Uninstall behavior |
40
+ | --- | --- | --- |
41
+ | Crew plugin runtime | Official DeepSeek Harness isolated in `~/.config/dsh-crew/harness`, profile: dsh-crew, with the Crew plugin registered | Plugin registration removed; config kept unless `--purge` |
42
+ | Codex MCP and roles | Points Worker, Reviewer, and MCP to the installed release | Only DSH Crew entries are removed |
43
+ | Global Codex policy | Managed block inside `~/.codex/AGENTS.md` | Only the managed block is removed |
44
+ | ZCode MCP, agents and commands | Installs `~/.zcode/AGENTS.md`, `agents/{ds-worker,ds-reviewer}.md`, commands and a source-aware `dsh-crew` MCP entry | Only DSH Crew-owned files/entry are removed |
45
+ | Windows login startup | `DSH Crew.vbs`, `start-dsh-crew.cmd`, `start-dsh-crew.ps1`, the exact process controller, and its hash manifest | Only DSH Crew-owned files are removed; foreign pre-existing content at those exact paths is preserved or fails closed |
46
+ | Official 3080 UI | Desktop launch starts/reuses the official program; Crew installer does not register plugins in its profile | Left running and untouched by Crew uninstall |
47
+
48
+ The Windows launcher supervises only the Crew-owned 3210 service, so provider
49
+ restart and rollback operations have one verifiable supervisor. The official
50
+ 3080 surface never starts, owns, or supervises 3210. The launcher does not
51
+ store credentials.
52
+
53
+ `dsh-crew install`, `update`, and `rollback` automatically perform an exact,
54
+ crash-resumable watcher handoff after the payload transaction. The updater
55
+ reserves handoff ownership before releasing its update lock, resumes any
56
+ unfinished handoff first, and succeeds only after the isolated 3210 runtime
57
+ reports the expected Crew and DSH versions.
58
+
59
+ On Windows, installation registers login startup. To start immediately and
60
+ open the Crew control:
61
+
62
+ ```powershell
63
+ & "$env:USERPROFILE\.config\dsh-crew\launchers\start-dsh-crew.cmd" --open
64
+ ```
65
+
66
+ Then verify <http://127.0.0.1:3210/> answers the Crew extension contract.
67
+
68
+ ```bash
69
+ dsh-crew status
70
+ dsh-crew inspect
71
+ ```
72
+
73
+ ZCode uses `~/.zcode/cli/config.json` when it already has native MCP servers. If
74
+ that native list is empty, the installer uses `~/.agents/mcp.json`; unrelated
75
+ servers are preserved and a conflicting unowned `dsh-crew` entry fails closed.
76
+
77
+ ## Verification
78
+
79
+ ```bash
80
+ dsh-crew status
81
+ dsh-crew inspect
82
+ dsh-crew jobs list
83
+ ```
84
+
85
+ Source checkout verification:
86
+
87
+ ```bash
88
+ node --test test/*.test.mjs
89
+ pnpm run build:client
90
+ npm pack --dry-run
91
+ ```
92
+
93
+ ## Harness CLI selection
94
+
95
+ The Crew launcher and the 3210 Hub boot from one Crew-managed Harness entry,
96
+ chosen in this order:
97
+
98
+ 1. `DSH_CREW_DSH_CLI`, when set to an explicit `@deepseek-ai/dsh` entry.
99
+ 2. The Crew-managed npm runtime at `<crew home>/runtime` (the normal install
100
+ path, written by `dsh-crew update`). It carries whatever cohort the installed
101
+ Crew release pinned; the launcher never substitutes a different version.
102
+ 3. A Crew-managed source cohort, discovered through a
103
+ `<crew home>/runtime-source-<label>.json` sidecar. The sidecar's recorded
104
+ `version` must equal the checkout's own `apps/cli/package.json`, so a stale
105
+ sidecar can never pin a half-updated tree.
106
+
107
+ For the npm runtime the launcher uses the Crew home as `DSH_HOME`; a source
108
+ cohort is its own home, because its profiles, sessions and settings live inside
109
+ that tree. The launcher then derives `dsh_version` from the verified
110
+ `@deepseek-ai/dsh` manifest and requires the Hub to report that same version, so
111
+ a process left over from a previous cohort is never treated as healthy.
112
+
113
+ Only override `DSH_CREW_DSH_CLI` deliberately — it wins over the managed runtime.
114
+ Never point it at the official `~/.dsh` tree, which the Crew launcher treats as a
115
+ read-only boundary.
116
+
117
+ To build a source cohort instead of the npm runtime (for example to test an
118
+ unpublished tag), clone the tag into `<crew home>/runtime-source-<label>`, build
119
+ its CLI, and write the matching sidecar. On Windows a source install needs the
120
+ native toolchain for its `fs-ext` dependency; a failed native build is reported
121
+ as a runtime failure rather than silently falling back to another cohort.
122
+
123
+ ## Rollback vs uninstall
124
+
125
+ ```bash
126
+ dsh-crew releases list
127
+ dsh-crew rollback <version>
128
+ ```
129
+
130
+ Use `dsh-crew rollback <version>` to switch the retained payload and verify the
131
+ 3210 runtime. Use `dsh-crew uninstall` only to remove managed files (backups and
132
+ config are kept unless `--purge` is passed).
133
+
134
+ ```bash
135
+ dsh-crew uninstall
136
+ ```
137
+
138
+ Use `dsh-crew uninstall --purge` only when configuration and backups should also be deleted.
@@ -1,85 +1,85 @@
1
- # Job contracts and information flow
2
-
3
- DSH Crew is a narrow bridge and scheduler. Codex or Claude owns the main task;
4
- Crew owns one delegated Worker/Reviewer workflow and reports auditable evidence
5
- back to the caller.
6
-
7
- ## Information flow
8
-
9
- ```text
10
- caller objective
11
- -> Worker in isolated workspace
12
- -> structured outcome + candidate reference
13
- -> optional Reviewer inspects the workspace directly
14
- -> compact Result Contract + canonical job events
15
- -> caller
16
- ```
17
-
18
- The Worker receives the complete delegated objective. After it finishes, Crew
19
- does not copy the Worker's raw prose or full patch into the Reviewer prompt.
20
- The Reviewer receives a bounded capsule containing the objective, reported
21
- changes/tests/risks, changed-file names, base revision, and candidate
22
- fingerprint. It opens the relevant files and runs `git diff` in the isolated
23
- workspace when deeper inspection is needed.
24
-
25
- The Hub keeps only the latest assistant message needed as the final Delivery
26
- Report. It does not retain an ever-growing list of intermediate assistant
27
- messages.
28
-
29
- ## Canonical events
30
-
31
- Every workflow result can expose a versioned, ordered `canonical_events` list.
32
- Each event has `schema_version`, `event_id`, `job_id`, `sequence`, `type`, `at`,
33
- `role`, `attempt`, and bounded structured `data`.
34
-
35
- Supported event types (the allow-list is versioned; `approval.required` is
36
- reserved for a future approval broker and is not emitted by the current
37
- runtime):
38
-
39
- - `job.created`, `job.started`
40
- - `model.selected`, `model.fallback`
41
- - `worker.started`, `worker.completed`
42
- - `review.started`, `review.completed`
43
- - `approval.required`
44
- - `job.completed`, `job.failed`, `job.cancelled`
45
-
46
- Events never carry a candidate patch, raw provider payload, credential, or full
47
- assistant response. `event_cursor` identifies the latest event in status views.
48
-
49
- ## Result Contract
50
-
51
- `dsh_run_worker` and `dsh_worker_result` default to `detail: "compact"`. Their
52
- `evidence` object contains:
53
-
54
- - `status`: `PASS`, `FAIL`, `PARTIAL`, or `BLOCKED`
55
- - structured execution/test/delivery/review summary
56
- - bounded model-selection trace
57
- - changed files, reported changes, tests, risks, and unverified checks
58
- - reviewer verdict and evidence when review ran
59
- - candidate fingerprint/base revision and workspace recovery state
60
- - bounded machine error code/message when execution failed
61
-
62
- Raw worker prose and candidate patch text are excluded. For an explicit debug
63
- or recovery operation, pass `detail: "full"`; this preserves the previous rich
64
- workflow view and adds the same evidence envelope.
65
-
66
- ## Profiles, Workspace Context, and watch
67
-
68
- Both blocking and asynchronous MCP dispatch accept optional `job_id`, `profile`,
69
- `workspace`, `constraints`, `workspace_id`, and `context_refs` fields. The
70
- caller id is echoed as `client_job_id`; it never replaces Crew's internal id.
71
- Profiles control role-compatible
72
- routing, isolation, timeout, fallback, and review strictness. Workspace Context
73
- adds bounded project facts by reference; instruction file contents are opened by
74
- the Agent in the workspace rather than copied through the hand-off.
75
-
76
- `dsh_worker_result` accepts `after_sequence`. The response includes only newer
77
- `canonical_events` plus the current numeric `event_cursor`, so callers can watch
78
- long jobs without replaying the entire event history.
79
-
80
- The isolated Hub also exposes `/extension`, `/profiles`, `/workspaces`,
81
- `/jobs/:id/contract`, and `/jobs/:id/events`. All remain loopback-only.
82
-
1
+ # Job contracts and information flow
2
+
3
+ DSH Crew is a narrow bridge and scheduler. Codex or Claude owns the main task;
4
+ Crew owns one delegated Worker/Reviewer workflow and reports auditable evidence
5
+ back to the caller.
6
+
7
+ ## Information flow
8
+
9
+ ```text
10
+ caller objective
11
+ -> Worker in isolated workspace
12
+ -> structured outcome + candidate reference
13
+ -> optional Reviewer inspects the workspace directly
14
+ -> compact Result Contract + canonical job events
15
+ -> caller
16
+ ```
17
+
18
+ The Worker receives the complete delegated objective. After it finishes, Crew
19
+ does not copy the Worker's raw prose or full patch into the Reviewer prompt.
20
+ The Reviewer receives a bounded capsule containing the objective, reported
21
+ changes/tests/risks, changed-file names, base revision, and candidate
22
+ fingerprint. It opens the relevant files and runs `git diff` in the isolated
23
+ workspace when deeper inspection is needed.
24
+
25
+ The Hub keeps only the latest assistant message needed as the final Delivery
26
+ Report. It does not retain an ever-growing list of intermediate assistant
27
+ messages.
28
+
29
+ ## Canonical events
30
+
31
+ Every workflow result can expose a versioned, ordered `canonical_events` list.
32
+ Each event has `schema_version`, `event_id`, `job_id`, `sequence`, `type`, `at`,
33
+ `role`, `attempt`, and bounded structured `data`.
34
+
35
+ Supported event types (the allow-list is versioned; `approval.required` is
36
+ reserved for a future approval broker and is not emitted by the current
37
+ runtime):
38
+
39
+ - `job.created`, `job.started`
40
+ - `model.selected`, `model.fallback`
41
+ - `worker.started`, `worker.completed`
42
+ - `review.started`, `review.completed`
43
+ - `approval.required`
44
+ - `job.completed`, `job.failed`, `job.cancelled`
45
+
46
+ Events never carry a candidate patch, raw provider payload, credential, or full
47
+ assistant response. `event_cursor` identifies the latest event in status views.
48
+
49
+ ## Result Contract
50
+
51
+ `dsh_run_worker` and `dsh_worker_result` default to `detail: "compact"`. Their
52
+ `evidence` object contains:
53
+
54
+ - `status`: `PASS`, `FAIL`, `PARTIAL`, or `BLOCKED`
55
+ - structured execution/test/delivery/review summary
56
+ - bounded model-selection trace
57
+ - changed files, reported changes, tests, risks, and unverified checks
58
+ - reviewer verdict and evidence when review ran
59
+ - candidate fingerprint/base revision and workspace recovery state
60
+ - bounded machine error code/message when execution failed
61
+
62
+ Raw worker prose and candidate patch text are excluded. For an explicit debug
63
+ or recovery operation, pass `detail: "full"`; this preserves the previous rich
64
+ workflow view and adds the same evidence envelope.
65
+
66
+ ## Profiles, Workspace Context, and watch
67
+
68
+ Both blocking and asynchronous MCP dispatch accept optional `job_id`, `profile`,
69
+ `workspace`, `constraints`, `workspace_id`, and `context_refs` fields. The
70
+ caller id is echoed as `client_job_id`; it never replaces Crew's internal id.
71
+ Profiles control role-compatible
72
+ routing, isolation, timeout, fallback, and review strictness. Workspace Context
73
+ adds bounded project facts by reference; instruction file contents are opened by
74
+ the Agent in the workspace rather than copied through the hand-off.
75
+
76
+ `dsh_worker_result` accepts `after_sequence`. The response includes only newer
77
+ `canonical_events` plus the current numeric `event_cursor`, so callers can watch
78
+ long jobs without replaying the entire event history.
79
+
80
+ The isolated Hub also exposes `/extension`, `/profiles`, `/workspaces`,
81
+ `/jobs/:id/contract`, and `/jobs/:id/events`. All remain loopback-only.
82
+
83
83
  Per-job precedence is request `constraints` > Profile > session defaults.
84
84
  `workspace.branch` pins the isolated base revision; `workspace.worktree` accepts
85
85
  `auto`, `existing`, or `none`. Workspace preflight reports `READY`, `CONFLICT`,
@@ -92,24 +92,24 @@ changed files, a complete Delivery Report, at least one passing evidence check,
92
92
  and no failed check. If the Worker reports no changes but the workspace contains
93
93
  edits—or reports changes while the workspace is empty—the workflow fails closed
94
94
  with workspace-evidence mismatch.
95
-
96
- The CLI is a JSON projection of the same local HTTP surface:
97
-
98
- ```text
99
- dsh-crew jobs list
100
- dsh-crew jobs get <job-id> --detail compact
101
- dsh-crew jobs watch <job-id> --after <sequence>
102
- dsh-crew jobs cancel <job-id>
103
- dsh-crew jobs submit --request job.json
104
- ```
105
-
106
- ## Compatibility boundary
107
-
108
- The internal legacy phase events remain in the explicit full view for current
109
- debug consumers. Canonical events and the compact Result Contract are the
110
- stable integration surface for new Codex, Claude, CLI, and HTTP consumers.
111
-
112
- This design borrows the useful boundary from
113
- [OpenMausBot](https://github.com/milind-soni/OpenMausBot)—a small provider
114
- contract and one normalized event stream—without adopting its desktop chat,
115
- bot roster, persona, connector, or general-purpose agent-platform scope.
95
+
96
+ The CLI is a JSON projection of the same local HTTP surface:
97
+
98
+ ```text
99
+ dsh-crew jobs list
100
+ dsh-crew jobs get <job-id> --detail compact
101
+ dsh-crew jobs watch <job-id> --after <sequence>
102
+ dsh-crew jobs cancel <job-id>
103
+ dsh-crew jobs submit --request job.json
104
+ ```
105
+
106
+ ## Compatibility boundary
107
+
108
+ The internal legacy phase events remain in the explicit full view for current
109
+ debug consumers. Canonical events and the compact Result Contract are the
110
+ stable integration surface for new Codex, Claude, CLI, and HTTP consumers.
111
+
112
+ This design borrows the useful boundary from
113
+ [OpenMausBot](https://github.com/milind-soni/OpenMausBot)—a small provider
114
+ contract and one normalized event stream—without adopting its desktop chat,
115
+ bot roster, persona, connector, or general-purpose agent-platform scope.