@ran-sh/dsh-crew 0.3.8 → 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.
- package/README.md +17 -1
- package/README.zh.md +16 -1
- package/docs/gpt-relay-extension.md +103 -0
- package/docs/job-contracts.md +107 -0
- package/docs/readiness-matrix.md +73 -0
- package/official-web-bridge/lib/client.js +3446 -3446
- package/package.json +4 -1
- package/scripts/verify-official-bridge-e2e.mjs +34 -13
- package/src/extension-contract.mjs +78 -0
- package/src/failure-classification.mjs +29 -0
- package/src/hub/index.mjs +343 -62
- package/src/information-flow.mjs +67 -0
- package/src/install/npx-lifecycle.mjs +83 -3
- package/src/job-contracts.mjs +218 -0
- package/src/mcp-runtime.mjs +16 -8
- package/src/official-web-bridge.mjs +20 -5
- package/src/role-profiles.mjs +107 -0
- package/src/runtime-identity.mjs +6 -1
- package/src/server.mjs +141 -98
- package/src/workflow-runtime.mjs +109 -10
- package/src/workspace-context.mjs +146 -0
- package/src/workspace-readiness.mjs +32 -0
package/README.md
CHANGED
|
@@ -43,10 +43,25 @@ Use ds-reviewer to review the result.
|
|
|
43
43
|
|
|
44
44
|
Legacy `ds-flash` and `ds-pro` aliases remain compatible.
|
|
45
45
|
|
|
46
|
+
## Results and reviews
|
|
47
|
+
|
|
48
|
+
Crew returns a compact, machine-readable Result Contract by default: status,
|
|
49
|
+
tests, changed files, review verdict, model-selection trace, artifact references,
|
|
50
|
+
and canonical lifecycle events. Raw agent prose and full patches are not copied
|
|
51
|
+
through every hand-off. An automatic Reviewer receives a bounded evidence
|
|
52
|
+
capsule and inspects the isolated workspace directly.
|
|
53
|
+
|
|
54
|
+
MCP callers can request `detail: "full"` on `dsh_run_worker` or
|
|
55
|
+
`dsh_worker_result` for explicit debugging and recovery. Contract details are in
|
|
56
|
+
[Job contracts and information flow](./docs/job-contracts.md).
|
|
57
|
+
|
|
46
58
|
## Common commands
|
|
47
59
|
|
|
48
60
|
```bash
|
|
49
61
|
dsh-crew status # installation and integration health
|
|
62
|
+
dsh-crew inspect # machine-readable capabilities and readiness
|
|
63
|
+
dsh-crew jobs list # machine-readable jobs
|
|
64
|
+
dsh-crew jobs watch <job-id> --after 0
|
|
50
65
|
dsh-crew update # update and repair enabled integrations
|
|
51
66
|
dsh-crew integrate # connect official 3080 UI to isolated 3210 Crew
|
|
52
67
|
dsh-crew detach # remove only the 3080 bridge
|
|
@@ -87,7 +102,8 @@ pnpm run build:client
|
|
|
87
102
|
node scripts/setup.mjs uninstall
|
|
88
103
|
```
|
|
89
104
|
|
|
90
|
-
More detail: [Changelog](./CHANGELOG.md) · [Readiness matrix](./docs/readiness-matrix.md)
|
|
105
|
+
More detail: [Changelog](./CHANGELOG.md) · [Readiness matrix](./docs/readiness-matrix.md) · [Job contracts](./docs/job-contracts.md)
|
|
106
|
+
· [GPT-first extension](./docs/gpt-relay-extension.md)
|
|
91
107
|
|
|
92
108
|
## License
|
|
93
109
|
|
package/README.zh.md
CHANGED
|
@@ -43,10 +43,24 @@ npx -y @deepseek-ai/dsh web --host 127.0.0.1 --port 3080
|
|
|
43
43
|
|
|
44
44
|
旧的 `ds-flash`、`ds-pro` 别名仍可使用。
|
|
45
45
|
|
|
46
|
+
## 结果与复审信息流
|
|
47
|
+
|
|
48
|
+
Crew 默认返回紧凑、机器可读的 Result Contract:状态、测试、改动文件、
|
|
49
|
+
Reviewer 结论、模型选择轨迹、候选引用和规范化生命周期事件。Worker 的
|
|
50
|
+
整段原始回答和完整 patch 不会在每次交接时重复传递;自动 Reviewer 只接收
|
|
51
|
+
有大小上限的证据胶囊,并直接检查隔离工作区。
|
|
52
|
+
|
|
53
|
+
MCP 调用方如需排障或恢复,可以在 `dsh_run_worker` 或
|
|
54
|
+
`dsh_worker_result` 中显式传入 `detail: "full"`。完整契约见
|
|
55
|
+
[任务契约与信息流](./docs/job-contracts.md)。
|
|
56
|
+
|
|
46
57
|
## 常用命令
|
|
47
58
|
|
|
48
59
|
```bash
|
|
49
60
|
dsh-crew status # 查看安装与集成状态
|
|
61
|
+
dsh-crew inspect # 输出机器可读的能力与就绪度
|
|
62
|
+
dsh-crew jobs list # 输出机器可读的任务列表
|
|
63
|
+
dsh-crew jobs watch <job-id> --after 0
|
|
50
64
|
dsh-crew update # 更新并自动修复已启用的集成
|
|
51
65
|
dsh-crew integrate # 将官方 3080 界面连接到隔离的 3210 Crew
|
|
52
66
|
dsh-crew detach # 只移除 3080 桥接
|
|
@@ -87,7 +101,8 @@ pnpm run build:client
|
|
|
87
101
|
node scripts/setup.mjs uninstall
|
|
88
102
|
```
|
|
89
103
|
|
|
90
|
-
更多资料:[Changelog](./CHANGELOG.md) · [Readiness Matrix](./docs/readiness-matrix.md)
|
|
104
|
+
更多资料:[Changelog](./CHANGELOG.md) · [Readiness Matrix](./docs/readiness-matrix.md) · [任务契约](./docs/job-contracts.md)
|
|
105
|
+
· [GPT-first 扩展接入](./docs/gpt-relay-extension.md)
|
|
91
106
|
|
|
92
107
|
## License
|
|
93
108
|
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# GPT-first extension integration
|
|
2
|
+
|
|
3
|
+
DSH Crew is an optional DeepSeek Harness capability extension for Codex,
|
|
4
|
+
Claude Code, ZCode, or another top-level executor. It is not itself a top-level
|
|
5
|
+
executor and does not choose the next project-wide step.
|
|
6
|
+
|
|
7
|
+
## Discover
|
|
8
|
+
|
|
9
|
+
With the isolated Hub running on 3210:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
dsh-crew inspect
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The same versioned JSON is available at:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
GET http://127.0.0.1:3210/_dsh/dsh-crew/extension
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
An orchestrator should check `capabilities.deepseek.worker` or
|
|
22
|
+
`capabilities.deepseek.reviewer`, then inspect `readiness.status` and its
|
|
23
|
+
components. `DEGRADED` is not `READY`; a model catalog proves discoverability,
|
|
24
|
+
not successful authentication or execution.
|
|
25
|
+
|
|
26
|
+
## Dispatch and observe
|
|
27
|
+
|
|
28
|
+
Codex and Claude normally call the six MCP tools. `dsh_run_worker` and
|
|
29
|
+
`dsh_spawn_worker` accept the backward-compatible fields plus:
|
|
30
|
+
|
|
31
|
+
- `job_id`: optional caller id, echoed separately from Crew's internal id.
|
|
32
|
+
- `profile`: a Worker/Reviewer profile id.
|
|
33
|
+
- `workspace`: per-job `repo_root`, `branch`, and `worktree` policy.
|
|
34
|
+
- `constraints`: per-job timeout and fallback override.
|
|
35
|
+
- `workspace_id`: a registered Workspace Context id.
|
|
36
|
+
- `context_refs`: extra workspace-relative instruction references.
|
|
37
|
+
|
|
38
|
+
Poll `dsh_worker_result` with `after_sequence` to receive only newer canonical
|
|
39
|
+
events. HTTP consumers can use:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
POST /_dsh/dsh-crew/jobs
|
|
43
|
+
GET /_dsh/dsh-crew/jobs/:id/contract?after=0
|
|
44
|
+
GET /_dsh/dsh-crew/jobs/:id/events?after=0
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
CLI consumers use `dsh-crew jobs list|get|watch|cancel|submit`; `submit`
|
|
48
|
+
accepts a versioned JSON Job Request through `--request`.
|
|
49
|
+
|
|
50
|
+
The compact Contract is the automation surface. Full prose and patches require
|
|
51
|
+
an explicit `detail=full` recovery/debug request.
|
|
52
|
+
|
|
53
|
+
## Profiles
|
|
54
|
+
|
|
55
|
+
Profiles live in `~/.config/dsh-crew/profiles.json`:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"schema_version": 1,
|
|
60
|
+
"profiles": {
|
|
61
|
+
"worker-fast": {
|
|
62
|
+
"role": "worker",
|
|
63
|
+
"routing": "priority",
|
|
64
|
+
"isolation": "worktree",
|
|
65
|
+
"fallback": false,
|
|
66
|
+
"timeout_seconds": 300,
|
|
67
|
+
"review_strictness": "standard"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The built-ins are `worker-default` and `reviewer-default`. The registry can be
|
|
74
|
+
read or atomically replaced through loopback-only `GET/POST
|
|
75
|
+
/_dsh/dsh-crew/profiles`. Invalid documents are rejected before replacement.
|
|
76
|
+
|
|
77
|
+
## Workspace Context
|
|
78
|
+
|
|
79
|
+
Workspace facts live in `~/.config/dsh-crew/workspaces.json`:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"schema_version": 1,
|
|
84
|
+
"workspaces": {
|
|
85
|
+
"dsh-crew": {
|
|
86
|
+
"repo_root": "D:/work/dsh-crew",
|
|
87
|
+
"default_branch": "main",
|
|
88
|
+
"instruction_files": ["AGENTS.md"],
|
|
89
|
+
"validation_hints": ["node --test test/*.test.mjs", "pnpm run build:client"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Only bounded path references and hints cross the hand-off. Crew never copies
|
|
96
|
+
instruction-file contents into the registry. Use loopback-only `GET/POST
|
|
97
|
+
/_dsh/dsh-crew/workspaces` to read or atomically replace it.
|
|
98
|
+
|
|
99
|
+
## Failure handling
|
|
100
|
+
|
|
101
|
+
Every structured failure includes a `family` and `disposition`. Dispositions
|
|
102
|
+
are `retry`, `fallback`, `human`, or `terminal` (`none` for success), allowing
|
|
103
|
+
the GPT-first controller to decide the next step without parsing logs.
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
Per-job precedence is request `constraints` > Profile > session defaults.
|
|
84
|
+
`workspace.branch` pins the isolated base revision; `workspace.worktree` accepts
|
|
85
|
+
`auto`, `existing`, or `none`. Workspace preflight reports `READY`, `CONFLICT`,
|
|
86
|
+
`READ_ONLY`, or `UNAVAILABLE` before dispatch.
|
|
87
|
+
|
|
88
|
+
The CLI is a JSON projection of the same local HTTP surface:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
dsh-crew jobs list
|
|
92
|
+
dsh-crew jobs get <job-id> --detail compact
|
|
93
|
+
dsh-crew jobs watch <job-id> --after <sequence>
|
|
94
|
+
dsh-crew jobs cancel <job-id>
|
|
95
|
+
dsh-crew jobs submit --request job.json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Compatibility boundary
|
|
99
|
+
|
|
100
|
+
The internal legacy phase events remain in the explicit full view for current
|
|
101
|
+
debug consumers. Canonical events and the compact Result Contract are the
|
|
102
|
+
stable integration surface for new Codex, Claude, CLI, and HTTP consumers.
|
|
103
|
+
|
|
104
|
+
This design borrows the useful boundary from
|
|
105
|
+
[OpenMausBot](https://github.com/milind-soni/OpenMausBot)—a small provider
|
|
106
|
+
contract and one normalized event stream—without adopting its desktop chat,
|
|
107
|
+
bot roster, persona, connector, or general-purpose agent-platform scope.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# DSH Crew Readiness Matrix
|
|
2
|
+
|
|
3
|
+
The readiness matrix is a conservative diagnostic surface for release and environment confidence. Its primary rule is simple:
|
|
4
|
+
|
|
5
|
+
> Missing evidence is never PASS.
|
|
6
|
+
|
|
7
|
+
The matrix is emitted by `hubStatus()` and is therefore visible inside the existing `dsh_worker_config` response under `hub_compatibility.readiness_matrix`.
|
|
8
|
+
|
|
9
|
+
## Statuses
|
|
10
|
+
|
|
11
|
+
- `PASS` — direct evidence confirms the row.
|
|
12
|
+
- `FAIL` — a check actually ran and produced an incompatible or failed result.
|
|
13
|
+
- `BLOCKED` — the check could not run because required infrastructure or authorization was unavailable.
|
|
14
|
+
- `SKIP` — the row is intentionally not applicable for the active policy/path.
|
|
15
|
+
- `NOT_RUN` — no trusted evidence has been supplied for the row.
|
|
16
|
+
|
|
17
|
+
`BLOCKED` and `SKIP` are not failures. `NOT_RUN` is not success.
|
|
18
|
+
|
|
19
|
+
## Evidence classes
|
|
20
|
+
|
|
21
|
+
The matrix separates three kinds of evidence:
|
|
22
|
+
|
|
23
|
+
1. `live-runtime` — facts the current process can directly observe, such as Hub reachability and protocol compatibility.
|
|
24
|
+
2. `ci` — platform validation such as Linux deterministic, Windows regressions, and future macOS smoke.
|
|
25
|
+
3. `real-execution` — provider/model and workflow behavior that requires a genuine DSH execution.
|
|
26
|
+
|
|
27
|
+
Only live checks are populated automatically by the current runtime. CI and real-execution rows remain `NOT_RUN` until a trusted higher layer supplies explicit evidence.
|
|
28
|
+
|
|
29
|
+
## Target rows
|
|
30
|
+
|
|
31
|
+
- `linux_deterministic`
|
|
32
|
+
- `windows_regressions`
|
|
33
|
+
- `macos_smoke`
|
|
34
|
+
- `hub_compatibility`
|
|
35
|
+
- `provider_catalog`
|
|
36
|
+
- `deepseek_flash`
|
|
37
|
+
- `deepseek_pro`
|
|
38
|
+
- `opencode_go_mimo_qwen`
|
|
39
|
+
- `reviewer_pipeline`
|
|
40
|
+
- `cancellation_timeout_escalation`
|
|
41
|
+
- `standalone_official`
|
|
42
|
+
|
|
43
|
+
## Provider/catalog rule
|
|
44
|
+
|
|
45
|
+
The Hub client does not know the active worker provider mode, so its embedded matrix leaves `provider_catalog` as `NOT_RUN` with `PROVIDER_MODE_UNKNOWN` rather than guessing.
|
|
46
|
+
|
|
47
|
+
When a higher layer knows the provider mode and has actually read the Harness catalog, it may build a more specific matrix:
|
|
48
|
+
|
|
49
|
+
- DeepSeek Official strict mode: catalog row may be `SKIP` / `PROVIDER_CATALOG_NOT_REQUIRED`.
|
|
50
|
+
- Follow-DSH with successful catalog read: `PASS` / `PROVIDER_CATALOG_RESOLVED`.
|
|
51
|
+
- Follow-DSH with an attempted but failed catalog read: `FAIL` / `PROVIDER_CATALOG_UNAVAILABLE`.
|
|
52
|
+
- Hub unavailable/incompatible before catalog access: `BLOCKED`, not `FAIL`.
|
|
53
|
+
|
|
54
|
+
## Credential safety
|
|
55
|
+
|
|
56
|
+
The matrix never reads or returns credential values, provider configuration payloads, quota data, pricing, cookies, tokens, or raw exception dumps. The standalone row defaults to `NOT_RUN` / `CREDENTIAL_STATUS_NOT_PROBED` unless an authorized real-environment validation explicitly reports evidence.
|
|
57
|
+
|
|
58
|
+
## Trusted evidence
|
|
59
|
+
|
|
60
|
+
`buildReadinessMatrix()` accepts an optional evidence map so CI/report aggregation can be added later without changing row semantics. Evidence can set only the existing status vocabulary. Invalid statuses are ignored rather than broadening the contract.
|
|
61
|
+
|
|
62
|
+
An evidence record may contain:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"status": "PASS",
|
|
67
|
+
"reason_code": "CI_GREEN",
|
|
68
|
+
"evidence_source": "github-actions",
|
|
69
|
+
"evidence_ref": "run-123"
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The matrix does not fetch or trust arbitrary remote data by itself. Loading and authenticating an evidence source is the responsibility of the higher layer that calls the builder.
|