@ran-sh/dsh-crew 1.7.1 → 1.8.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-crew",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "Dispatch subtasks to DeepSeek Harness (DSH) agents as native subagents with live progress",
5
5
  "author": {
6
6
  "name": "ZSeven-W"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ran-sh/dsh-crew",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "type": "module",
5
5
  "main": "./src/hub/entry.mjs",
6
6
  "bin": {
@@ -32,10 +32,46 @@ same `dsh-crew` MCP server, so the behaviour below is identical from any host.
32
32
  | `dsh_worker_cancel` | cancel a workflow |
33
33
  | `dsh_worker_config` | read/update session settings: enable dispatch, tier, effort, timeout, presets, policy |
34
34
 
35
+ Dispatch takes `task` (make it self-contained — the worker sees nothing else),
36
+ `role` (`worker` for implementation, `reviewer` for an independent review pass),
37
+ `cwd` (the workspace; defaults to the current project) and `timeout_seconds`.
38
+ Use `dsh_spawn_worker` when you have other work to do meanwhile, then
39
+ `dsh_worker_result` with `wait_seconds` to collect it.
40
+
35
41
  `dsh_worker_config` with no arguments is the cheapest way to answer "what is
36
42
  Crew set to right now". Its settings last for the session only; persisted
37
43
  changes belong in the 3210 panel.
38
44
 
45
+ ## Reading a result
46
+
47
+ A result carries a `phase` and, when it did not succeed, a failure code. The
48
+ phases are `created`, `queued`, `running`, `verifying`, `escalating`,
49
+ `reviewing`, `ready`, `completed`, `failed`, `cancelled`, `interrupted`.
50
+
51
+ **`phase: failed` does not mean the worker broke.** Most often it means the
52
+ workflow's delivery gate rejected the result, and the reason code says which
53
+ gate. Read the code before reacting:
54
+
55
+ | Code | Means |
56
+ |---|---|
57
+ | `DELIVERY_INCOMPLETE` | the worker returned no change where the contract required one — a reply-only or question-only task lands here, and it is not a defect |
58
+ | `TESTS_FAILED` / `TESTS_NOT_RUN` | the worker's own test evidence is failing or absent |
59
+ | `REVIEW_CHANGES_REQUESTED` | the reviewer asked for changes; act on them |
60
+ | `REVIEW_INCONCLUSIVE` | the review could not reach a verdict |
61
+ | `WORKSPACE_MISMATCH` | the worker's changes are not in the workspace the job was meant to touch |
62
+ | `TASK_BLOCKED` / `TASK_PARTIAL` | the worker says it could not finish |
63
+ | `ATTEMPT_TIMEOUT` / `RUNTIME_FAILURE` / `EXECUTION_FAILED` | the run itself failed |
64
+ | `POLICY_REJECTED` | Crew's own policy refused the dispatch; change the request, not the worker |
65
+ | `PROVIDER_UNAVAILABLE` / `HUB_INCOMPATIBLE` | no model or no reachable hub |
66
+
67
+ `terminal_reason: escalation_disabled` is **not** a separate failure — it is the
68
+ escalation policy declining to retry after a failure. The failure code above it
69
+ is the real reason.
70
+
71
+ The selection trace names the model actually used and every candidate that was
72
+ skipped, with the reason. Reach for it whenever the chosen model is not the one
73
+ you expected.
74
+
39
75
  ## Choosing what to dispatch
40
76
 
41
77
  Delegate a bounded, independently verifiable unit when isolation,
@@ -48,6 +84,19 @@ Continue authorized work after a successful subtask; a returned workflow is a
48
84
  checkpoint, not the end of the task. If a worker's result is incomplete or its
49
85
  review asks for changes, that is a task result to act on — not approval.
50
86
 
87
+ ## Common ways a dispatch surprises you
88
+
89
+ - **A task that only asks a question fails.** The delivery contract wants a
90
+ change; a reply-only task returns `DELIVERY_INCOMPLETE`. That is the gate
91
+ working, not the worker failing.
92
+ - **Isolated workspaces need git.** The default `worktree` isolation fails with
93
+ `NOT_GIT_REPOSITORY` for a non-git workspace rather than silently sharing the
94
+ tree. Use `shared` deliberately if that is what you want.
95
+ - **Long tasks need a longer timeout.** `timeout_seconds` is per attempt and
96
+ caps at 7200; the default is far shorter than a real refactor.
97
+ - **A worker cannot see your conversation.** Anything it needs must be in
98
+ `task`, in the workspace, or in a file it can read.
99
+
51
100
  ## Configuration
52
101
 
53
102
  Two surfaces, and they are not equivalent:
@@ -7,7 +7,7 @@ import { createHash } from 'node:crypto';
7
7
  import { dirname, join, resolve, relative } from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { homedir } from 'node:os';
10
- import { normalizeModelPriority } from '../model-routing.mjs';
10
+ import { normalizeModelPriority } from '../model-routing.mjs';
11
11
  import { crewSkillFiles, installCrewSkill, readCrewSkill, removeCrewSkill } from './crew-skill.mjs';
12
12
  import { zcodeStatus } from './zcode.mjs';
13
13
 
@@ -70,17 +70,10 @@ function renderedCodexRole(root, file) {
70
70
  return source.replace(/args = \[.*server\.mjs"\]/, `args = ["${renderedPath}"]`);
71
71
  }
72
72
 
73
- function managedPolicyBlock(root) {
74
- const policy = readText(join(root, 'codex', 'AGENTS.md'))?.trim();
75
- if (!policy) return null;
76
- return `${POLICY_START}\n${policy}\n${POLICY_END}`;
77
- }
78
-
79
73
  export function codexLegacyPolicyDigest(text) {
80
74
  const canonical = typeof text === 'string' ? text.replace(/\r\n/g, '\n').trim() : '';
81
75
  return canonical ? createHash('sha256').update(canonical, 'utf8').digest('hex') : null;
82
76
  }
83
-
84
77
  export function stripKnownLegacyCodexPolicy(text, { knownHashes = CODEX_LEGACY_POLICY_HASHES } = {}) {
85
78
  if (typeof text !== 'string') return text;
86
79
  const start = POLICY_START.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
@@ -36,7 +36,7 @@ export {
36
36
  // included in the identity contract.
37
37
  const RUNTIME_ID = randomUUID();
38
38
 
39
- export const RUNTIME_VERSION = '1.7.1';
39
+ export const RUNTIME_VERSION = '1.8.0';
40
40
  export const HUB_PROTOCOL_VERSION = 1;
41
41
 
42
42
  export const HUB_CAPABILITIES = Object.freeze([
package/codex/AGENTS.md DELETED
@@ -1,53 +0,0 @@
1
- # Global capability-aware delegation policy
2
-
3
- The main Codex agent owns the task through final delivery. DSH Crew is an optional
4
- execution/review capability, not an automatic replacement for the main agent.
5
-
6
- ## Discover and choose
7
-
8
- Before substantial delegation, read the live Crew configuration, capability and
9
- readiness contracts. Discover roles, models, modes and constraints dynamically;
10
- installed, configured, enabled and callable are different states. Refresh the
11
- snapshot after relevant configuration or availability changes, not every small step.
12
-
13
- Delegate bounded, independently verifiable units when isolation, specialization,
14
- parallel work or independent review provides a benefit. Give each unit its objective,
15
- owned files, workspace, constraints and acceptance evidence. Respect concurrency
16
- limits and manual/disabled capabilities. Keep ambiguity, integration, external
17
- effects and final communication in the main agent. Trivial work stays local.
18
-
19
- ## Operator decision gate when DSH Crew is unavailable
20
-
21
- Once Crew is selected for a work unit, any required capability becoming unavailable
22
- or non-callable is a mandatory pause, regardless of cause. Do not implement further,
23
- repair/reconfigure Crew, silently fall back or switch execution paths. Perform only
24
- bounded read-only diagnosis, report the evidence and completed work, and wait for
25
- new operator direction: **repair Crew and continue through Crew**, or **do not repair
26
- Crew and continue with the main agent**. After repair, verify live readiness again;
27
- after local authorization, disclose that the affected work is not independently delegated.
28
-
29
- This gate does not apply when initial planning chooses local work without selecting
30
- Crew. A nonterminal wait is not an outage; continue the same workflow without duplicate
31
- dispatch. Review findings and failing code tests are task results to address, not by
32
- themselves evidence that Crew is unavailable.
33
-
34
- ## Verify and finish
35
-
36
- Consume compact structured results and canonical events. Check changed scope,
37
- delivery completeness, tests, risks and the actual review verdict. Use independent
38
- review for non-trivial code when available and its invocation policy allows it;
39
- never bypass manual/disabled review. Requested changes or missing evidence are not
40
- approval. If selected review cannot run, use the operator gate above.
41
-
42
- Continue authorized work after a successful subtask; do not stop at its checkpoint.
43
- Delegation grants no new authority to push, publish, message, change credentials or
44
- delete data. Do not forward credentials, raw provider payloads or unbounded transcripts.
45
-
46
- ## Harness upgrade redlines
47
-
48
- - Never install, update, register, unlink, repair, or mutate anything under ~/.dsh.
49
- - DSH Crew runtime upgrades must go through the Crew-owned installer and DSH_HOME.
50
- - Never use direct pnpm/npm/dsh plugin operations against the official web profile.
51
- - Preparing a Harness upgrade must not restart 3080 or 3210.
52
- - Standalone workers launch through the official DSH SDK profile contract; dsh-sdk-jsonrpc-demo is obsolete.
53
- - Legacy 3080 bridge must never be used for 3210 lifecycle/restart/rollback.
package/zcode/AGENTS.md DELETED
@@ -1,38 +0,0 @@
1
- # Global capability-aware delegation policy for ZCode
2
-
3
- ZCode is a host adapter for DSH Crew. Use the `dsh-crew` MCP server for Crew
4
- work only after its live capability and readiness surfaces have been checked.
5
-
6
- - Discover the current Crew configuration, capabilities, activation state and
7
- readiness before delegating substantial work. Installed, configured, enabled
8
- and callable are different states; do not infer one from another.
9
- - Match a bounded work unit to an available Crew role/model and preserve the
10
- repository/worktree and Result Contract boundaries. Keep planning, ambiguous
11
- requirements, integration, external side effects and final communication in
12
- the host agent.
13
- - Dispatch selected work asynchronously with `dsh_spawn_worker`, save its
14
- workflow ID, and poll that same workflow with `dsh_worker_result` using
15
- `wait_seconds: 10`. A bounded wait that returns a nonterminal state is not a
16
- failure when `dsh_worker_status` confirms that workflow is still running;
17
- continue polling it and never start a duplicate workflow.
18
- - If Crew is selected and any required capability is unavailable, non-callable,
19
- or returns an unknown/runtime/configuration/credential/routing/timeout error,
20
- pause. Report the evidence and wait for the operator to choose repair Crew or
21
- continue locally; do not repair/reconfigure, silently fall back or retry blindly
22
- before that decision. A nonterminal bounded wait is not a transport timeout.
23
- - Validate returned evidence, changed scope, tests and completion state before
24
- accepting delegated work. Do not expose credentials or raw provider payloads.
25
- - Continue the authorized task after a successful subtask; do not stop at its
26
- checkpoint. Missing evidence or requested review changes are not approval.
27
-
28
- ## Harness upgrade redlines
29
-
30
- - Never install, update, register, unlink, repair, or mutate anything under ~/.dsh.
31
- - DSH Crew runtime upgrades must go through the Crew-owned installer and DSH_HOME.
32
- - Never use direct pnpm/npm/dsh plugin operations against the official web profile.
33
- - Preparing a Harness upgrade must not restart 3080 or 3210.
34
- - Standalone workers launch through the official DSH SDK profile contract; dsh-sdk-jsonrpc-demo is obsolete.
35
- - Legacy 3080 bridge must never be used for 3210 lifecycle/restart/rollback.
36
-
37
- This file is installed as a managed block in `~/.zcode/AGENTS.md`; user-authored
38
- instructions outside the block are preserved.