@ran-sh/dsh-crew 1.0.2 → 1.1.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 (40) hide show
  1. package/README.md +4 -0
  2. package/README.zh.md +4 -0
  3. package/codex/AGENTS.md +101 -92
  4. package/docs/ui-surfaces.md +48 -21
  5. package/lib/client.js +235 -34
  6. package/official-web-bridge/lib/client.js +368 -4532
  7. package/official-web-bridge/package.json +1 -2
  8. package/package.json +130 -67
  9. package/scripts/build-client.mjs +30 -15
  10. package/scripts/remove-legacy-official-bridge.ps1 +89 -0
  11. package/scripts/setup.mjs +152 -140
  12. package/scripts/verify-npm-install.mjs +311 -310
  13. package/scripts/verify-official-bridge-e2e.mjs +12 -1
  14. package/src/client/host-readiness.mjs +62 -59
  15. package/src/client/index.tsx +117 -24
  16. package/src/client/quick-entry.tsx +10 -0
  17. package/src/client/quick-panel.tsx +295 -0
  18. package/src/client/surface-detection.mjs +43 -30
  19. package/src/credential-reference.mjs +38 -0
  20. package/src/dsh-cli-runtime.mjs +500 -40
  21. package/src/dsh-cohort.mjs +20 -0
  22. package/src/hub/index.mjs +1602 -1016
  23. package/src/install/npx-lifecycle.mjs +1983 -468
  24. package/src/install/official-web.mjs +36 -73
  25. package/src/jobs.mjs +20 -24
  26. package/src/model-catalog.mjs +8 -1
  27. package/src/official-web-bridge.mjs +329 -249
  28. package/src/provider-delete-adapters.mjs +165 -17
  29. package/src/provider-inventory.mjs +17 -3
  30. package/src/provider-layer-migration-adapters.mjs +759 -0
  31. package/src/provider-layer-migration.mjs +198 -0
  32. package/src/provider-lifecycle-state.mjs +4 -1
  33. package/src/provider-profile-store.mjs +193 -4
  34. package/src/provider-settings-store.mjs +82 -6
  35. package/src/provider-store-lock.mjs +67 -0
  36. package/src/runtime-identity.mjs +24 -1
  37. package/src/supervisor/restart-request.mjs +202 -0
  38. package/windows/start-dsh-crew.ps1 +783 -370
  39. package/worker.cordis.yml +32 -46
  40. package/zcode/AGENTS.md +35 -26
package/README.md CHANGED
@@ -49,6 +49,10 @@ silently falling back.
49
49
  dsh-crew inspect # live capabilities and readiness
50
50
  dsh-crew jobs list # jobs and Result Contracts
51
51
  dsh-crew providers list # 3210 Harness provider inventory (secret-free)
52
+ dsh-crew providers migration-status # detect legacy base providers; no automatic migration
53
+ dsh-crew providers migrate-plan <provider>
54
+ dsh-crew providers migrate <provider> --plan <id> --confirm # writes user layer, restarts 3210, verifies
55
+ dsh-crew providers rollback-migration <provider> --plan <id> --confirm
52
56
  dsh-crew providers probe <provider-id>
53
57
  curl http://127.0.0.1:3210/_dsh/dsh-crew/credential-references # references/orphans only
54
58
  dsh-crew credentials list # secret-free reference inventory
package/README.zh.md CHANGED
@@ -44,6 +44,10 @@ dsh-crew status
44
44
  dsh-crew inspect # 实时能力与就绪度
45
45
  dsh-crew jobs list # 任务与 Result Contract
46
46
  dsh-crew providers list # 3210 Harness Provider 清单(不含密钥)
47
+ dsh-crew providers migration-status # 检查旧 profile Provider,不会自动迁移
48
+ dsh-crew providers migrate-plan <provider>
49
+ dsh-crew providers migrate <provider> --plan <id> --confirm # 写入用户层,重启 3210 并验证
50
+ dsh-crew providers rollback-migration <provider> --plan <id> --confirm
47
51
  dsh-crew providers probe <provider-id>
48
52
  curl http://127.0.0.1:3210/_dsh/dsh-crew/credential-references # 仅查看引用/孤儿报告
49
53
  dsh-crew credentials list # 不含密钥值的引用清单
package/codex/AGENTS.md CHANGED
@@ -1,92 +1,101 @@
1
- # Global capability-aware delegation policy
2
-
3
- The main Codex agent owns the user's task from planning through final delivery.
4
- DSH Crew is an execution and review capability that Codex may use after
5
- discovering what the current environment actually supports.
6
-
7
- ## Discover capabilities before delegation
8
-
9
- - Before delegating substantial work, query DSH Crew's authoritative live
10
- configuration, capability, and readiness surfaces.
11
- - Discover capabilities dynamically from the returned contracts. Do not rely
12
- on a hard-coded list of roles, models, providers, tools, modes, or optional
13
- features; newly added capabilities should be considered automatically.
14
- - For every relevant capability, respect its reported availability, activation
15
- state, invocation mode, constraints, dependencies, and readiness evidence.
16
- - Treat installed, configured, enabled, and callable as different states. Use a
17
- capability only when the complete live execution path is ready.
18
- - Keep the capability snapshot for the current plan, and refresh it after a
19
- relevant configuration change or an availability, routing, credential,
20
- compatibility, or activation failure.
21
- - If discovery is unavailable or evidence is incomplete, fail closed: do not
22
- invent capabilities or repeatedly dispatch blind retries. If DSH Crew was
23
- selected for the task, apply the operator decision gate below.
24
-
25
- ## Operator decision gate when DSH Crew is unavailable
26
-
27
- - Once Codex has selected DSH Crew for any work unit, any condition that makes
28
- the required Crew capability unavailable or non-callable is a mandatory
29
- pause point, regardless of cause.
30
- - At this pause point, do not continue implementation, silently fall back,
31
- choose another execution path, or repair/reconfigure DSH Crew without new
32
- operator direction. Perform only the read-only diagnosis needed to report
33
- the blocker accurately.
34
- - Report the unavailable capability, bounded reason and evidence, and completed
35
- work. Then wait for the operator to choose one direction:
36
- 1. Repair or restore DSH Crew, then continue through DSH Crew.
37
- 2. Do not repair DSH Crew; continue with the main Codex agent.
38
- - Resume only after the operator gives a new instruction. If repair is chosen,
39
- verify live capability again before dispatch. If local execution is chosen,
40
- state that the affected work is no longer independently delegated.
41
- - This gate applies only after DSH Crew has been selected or explicitly
42
- requested. It does not force a pause when initial planning decides DSH Crew
43
- provides no benefit and the task should remain with the main agent.
44
-
45
- ## Decide what to delegate
46
-
47
- - Decompose the request into bounded work units before choosing an executor.
48
- - Match each unit against discovered capabilities. Use DSH Crew only where it
49
- provides a clear execution, isolation, parallelism, specialization, or
50
- independent-review benefit.
51
- - Delegate the smallest coherent unit that can be completed and verified
52
- independently. Do not delegate an entire request merely because it is large.
53
- - Keep ambiguity, dependency ordering, cross-cutting decisions, conflict
54
- resolution, external side effects, final integration, and user communication
55
- in the main Codex agent.
56
- - Respect reported concurrency and isolation limits. Parallelize only
57
- independent units with explicit, non-overlapping ownership.
58
- - Simple questions, explanations, small read-only inspections, and genuinely
59
- trivial edits should normally remain in the main agent.
60
- - Explicit user instructions override default routing, but never safety or
61
- capability boundaries.
62
-
63
- ## Execute and verify
64
-
65
- - Give each delegated unit a concrete objective, owned scope, workspace
66
- context, constraints, and required validation evidence.
67
- - Prefer isolated execution for code changes when supported. Review work must
68
- remain read-only.
69
- - Consume compact structured results and canonical events. Do not move
70
- unbounded transcripts, raw provider payloads, credentials, or unnecessary
71
- patch content between agents.
72
- - The main agent must validate results, tests, changed scope, unresolved risks,
73
- and completion state before accepting delegated work.
74
-
75
- ## Review policy
76
-
77
- - Use available independent review for non-trivial code changes when its live
78
- invocation policy permits automatic use or the user requests manual use.
79
- - Never bypass a manual, disabled, unavailable, or restricted review boundary.
80
- - Treat requested changes, incomplete structured results, or missing direct
81
- evidence as not approved.
82
- - If selected DSH Crew review cannot run, apply the operator decision gate. The
83
- main agent may review locally only after the operator selects that path.
84
-
85
- ## Authority and completion
86
-
87
- - Delegation does not broaden authority. Publishing, pushing, messaging,
88
- credential changes, account actions, destructive operations, and other
89
- external effects still require authority from the user's request.
90
- - Do not present delegated work as complete until validation passes, structured
91
- results are complete, integration is checked, and permitted review
92
- requirements are satisfied or transparently reported as unavailable.
1
+ # Global capability-aware delegation policy
2
+
3
+ The main Codex agent owns the user's task from planning through final delivery.
4
+ DSH Crew is an execution and review capability that Codex may use after
5
+ discovering what the current environment actually supports.
6
+
7
+ ## Discover capabilities before delegation
8
+
9
+ - Before delegating substantial work, query DSH Crew's authoritative live
10
+ configuration, capability, and readiness surfaces.
11
+ - Discover capabilities dynamically from the returned contracts. Do not rely
12
+ on a hard-coded list of roles, models, providers, tools, modes, or optional
13
+ features; newly added capabilities should be considered automatically.
14
+ - For every relevant capability, respect its reported availability, activation
15
+ state, invocation mode, constraints, dependencies, and readiness evidence.
16
+ - Treat installed, configured, enabled, and callable as different states. Use a
17
+ capability only when the complete live execution path is ready.
18
+ - Keep the capability snapshot for the current plan, and refresh it after a
19
+ relevant configuration change or an availability, routing, credential,
20
+ compatibility, or activation failure.
21
+ - If discovery is unavailable or evidence is incomplete, fail closed: do not
22
+ invent capabilities or repeatedly dispatch blind retries. If DSH Crew was
23
+ selected for the task, apply the operator decision gate below.
24
+
25
+ ## Operator decision gate when DSH Crew is unavailable
26
+
27
+ - Once Codex has selected DSH Crew for any work unit, any condition that makes
28
+ the required Crew capability unavailable or non-callable is a mandatory
29
+ pause point, regardless of cause.
30
+ - At this pause point, do not continue implementation, silently fall back,
31
+ choose another execution path, or repair/reconfigure DSH Crew without new
32
+ operator direction. Perform only the read-only diagnosis needed to report
33
+ the blocker accurately.
34
+ - Report the unavailable capability, bounded reason and evidence, and completed
35
+ work. Then wait for the operator to choose one direction:
36
+ 1. Repair or restore DSH Crew, then continue through DSH Crew.
37
+ 2. Do not repair DSH Crew; continue with the main Codex agent.
38
+ - Resume only after the operator gives a new instruction. If repair is chosen,
39
+ verify live capability again before dispatch. If local execution is chosen,
40
+ state that the affected work is no longer independently delegated.
41
+ - This gate applies only after DSH Crew has been selected or explicitly
42
+ requested. It does not force a pause when initial planning decides DSH Crew
43
+ provides no benefit and the task should remain with the main agent.
44
+
45
+ ## Decide what to delegate
46
+
47
+ - Decompose the request into bounded work units before choosing an executor.
48
+ - Match each unit against discovered capabilities. Use DSH Crew only where it
49
+ provides a clear execution, isolation, parallelism, specialization, or
50
+ independent-review benefit.
51
+ - Delegate the smallest coherent unit that can be completed and verified
52
+ independently. Do not delegate an entire request merely because it is large.
53
+ - Keep ambiguity, dependency ordering, cross-cutting decisions, conflict
54
+ resolution, external side effects, final integration, and user communication
55
+ in the main Codex agent.
56
+ - Respect reported concurrency and isolation limits. Parallelize only
57
+ independent units with explicit, non-overlapping ownership.
58
+ - Simple questions, explanations, small read-only inspections, and genuinely
59
+ trivial edits should normally remain in the main agent.
60
+ - Explicit user instructions override default routing, but never safety or
61
+ capability boundaries.
62
+
63
+ ## Execute and verify
64
+
65
+ - Give each delegated unit a concrete objective, owned scope, workspace
66
+ context, constraints, and required validation evidence.
67
+ - Prefer isolated execution for code changes when supported. Review work must
68
+ remain read-only.
69
+ - Consume compact structured results and canonical events. Do not move
70
+ unbounded transcripts, raw provider payloads, credentials, or unnecessary
71
+ patch content between agents.
72
+ - The main agent must validate results, tests, changed scope, unresolved risks,
73
+ and completion state before accepting delegated work.
74
+
75
+ ## Review policy
76
+
77
+ - Use available independent review for non-trivial code changes when its live
78
+ invocation policy permits automatic use or the user requests manual use.
79
+ - Never bypass a manual, disabled, unavailable, or restricted review boundary.
80
+ - Treat requested changes, incomplete structured results, or missing direct
81
+ evidence as not approved.
82
+ - If selected DSH Crew review cannot run, apply the operator decision gate. The
83
+ main agent may review locally only after the operator selects that path.
84
+
85
+ ## Authority and completion
86
+
87
+ - Delegation does not broaden authority. Publishing, pushing, messaging,
88
+ credential changes, account actions, destructive operations, and other
89
+ external effects still require authority from the user's request.
90
+ - Do not present delegated work as complete until validation passes, structured
91
+ results are complete, integration is checked, and permitted review
92
+ requirements are satisfied or transparently reported as unavailable.
93
+
94
+ ## Harness upgrade redlines
95
+
96
+ - Never install, update, register, unlink, repair, or mutate anything under ~/.dsh.
97
+ - DSH Crew runtime upgrades must go through the Crew-owned installer and DSH_HOME.
98
+ - Never use direct pnpm/npm/dsh plugin operations against the official web profile.
99
+ - Preparing a Harness upgrade must not restart 3080 or 3210.
100
+ - Standalone workers launch through the official DSH SDK profile contract; dsh-sdk-jsonrpc-demo is obsolete.
101
+ - Legacy 3080 bridge must never be used for 3210 lifecycle/restart/rollback.
@@ -1,46 +1,66 @@
1
- # 3080 and 3210 UI responsibilities
1
+ # 3210 and 3080 UI responsibilities
2
2
 
3
- DSH Crew deliberately presents two different user experiences from one shared
4
- client build.
3
+ DSH Crew presents two different user experiences from two independently built
4
+ client bundles. The native 3210 page is the canonical full control plane;
5
+ the official 3080 page is an optional narrow quick-controls panel.
5
6
 
6
- ## 3080: daily Crew control plane
7
+ ## 3210: canonical full control plane
7
8
 
8
- The official Harness `web` profile on `127.0.0.1:3080` owns day-to-day Crew
9
- management:
9
+ The Crew-owned `dsh-crew` profile on `127.0.0.1:3210` owns day-to-day Crew
10
+ management AND model execution:
10
11
 
11
12
  - Crew workflow and global enablement
12
13
  - Worker and Reviewer policy
13
14
  - model priority, fallback, review, and adaptive routing
14
- - runtime and activation-boundary information
15
- - Codex, Claude, and ZCode installation actions and structured readiness
15
+ - multimodal (vision/imagegen) capability switches
16
+ - providers lifecycle (migrate/delete/rollback/quarantine)
17
+ - credential references lifecycle
18
+ - workspaces, presets, jobs
19
+ - installation integrations (Codex, Claude, ZCode)
16
20
  - task status and bounded model-invocation summaries
17
- - the link to the underlying 3210 Crew Harness
18
21
 
19
- The lightweight official-web bridge keeps these requests same-origin and
20
- proxies only the `/_dsh/dsh-crew/*` contract to the isolated backend.
22
+ Bundle: `lib/client.js` (module `@ran-sh/dsh-crew`), built from
23
+ `src/client/entry.tsx`.
21
24
 
22
- ## 3210: isolated native Harness
25
+ ## 3080: optional quick-controls surface
23
26
 
24
- The Crew-owned `dsh-crew` profile on `127.0.0.1:3210` owns model execution and
25
- low-level Harness configuration. Its native Harness menus remain the place for
26
- Providers, Harness Models, Agent presets, and native runtime settings.
27
+ The official Harness `web` profile on `127.0.0.1:3080` may host a NARROW
28
+ quick-controls card — and nothing else:
27
29
 
28
- The DSH Crew settings entry on this surface is intentionally diagnostics-only:
29
- it shows bounded runtime identity and a link back to 3080. It does not duplicate
30
- Worker/Reviewer policy, host integrations, tasks, or orchestration controls.
30
+ - master switch (`subagents_enabled`)
31
+ - Flash / Pro model priority lists (add/remove/reorder only)
32
+ - vision / imagegen toggles + providers (restart-pending flow)
33
+ - deep link to the 3210 full control plane (`http://127.0.0.1:3210/`)
34
+
35
+ Bundle: `official-web-bridge/lib/client.js` (module
36
+ `@ran-sh/dsh-crew-web-bridge`), built from `src/client/quick-entry.tsx`.
37
+ It physically contains none of the full control-plane code (no credential
38
+ purge, no provider delete/migration, no install integration).
39
+
40
+ The 3080 bridge proxies ONLY four exact endpoints to 3210:
41
+ `quick-config`, `quick-status`, `runtime/restart-request`,
42
+ `runtime/restart-status`. Everything else on the Crew namespace is 404 on
43
+ 3080, and `/supervisor/restart` returns 410 Gone pointing at 3210.
44
+
45
+ The official `~/.dsh` tree is strictly read-only for Crew; the 3080 quick
46
+ surface itself is optional — Crew works fully with 3080 closed.
47
+
48
+ ## UNKNOWN: diagnostics only
49
+
50
+ Unknown surfaces render diagnostics and never gain write authority.
31
51
 
32
52
  ## Surface detection and failure behavior
33
53
 
34
54
  The client does not infer responsibility from a hard-coded browser port. It
35
55
  uses two same-origin, structured signals:
36
56
 
37
- 1. `/_dsh/dsh-crew/bridge-status` identifies the official bridge control plane.
57
+ 1. `/_dsh/dsh-crew/bridge-status` identifies the official quick bridge.
38
58
  2. `/_dsh/dsh-crew/runtime` identifies the native Crew-owned runtime.
39
59
 
40
60
  The bridge signal wins on 3080 because the proxied runtime response correctly
41
61
  describes the 3210 backend. If neither contract can be verified, the client
42
- fails closed to the minimal diagnostics view. Missing evidence never enables
43
- the full control plane and never becomes `READY`.
62
+ fails closed to the diagnostics view. Missing evidence never enables the
63
+ full control plane and never becomes `READY`.
44
64
 
45
65
  The split changes presentation only. Crew state, credentials, routing policy,
46
66
  and model execution remain isolated under the Crew-owned home and profile.
@@ -63,3 +83,10 @@ they do not authenticate local users. If a deployment ever needs to separate
63
83
  local principals, add a per-install random token to state-changing calls and
64
84
  inject it server-side in the bridge — do not use browser `Origin` as
65
85
  authentication.
86
+
87
+ ## Process ownership
88
+
89
+ The Windows launcher supervisor (`windows/start-dsh-crew.ps1` watch mode) is
90
+ the ONLY process authority for 3210. The 3080 bridge never spawns, owns, or
91
+ kills 3210. Restart and maintenance go through durable request files the hub
92
+ writes and the launcher executes (`supervisor/restart-request.mjs`).