@adhdev/mesh-shared 1.0.82-rc.5 → 1.0.82-rc.51
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/dist/assistant-protocol.d.ts +163 -6
- package/dist/decision-push-relay.d.ts +20 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1637 -124
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1499 -124
- package/dist/index.mjs.map +1 -1
- package/dist/launch-defaults.d.ts +196 -0
- package/dist/light-task.d.ts +96 -0
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/mesh-vocabulary.d.ts +13 -4
- package/dist/mission-git-state.d.ts +83 -0
- package/dist/mission-items.d.ts +202 -0
- package/dist/node-facts.d.ts +61 -1
- package/dist/outbound-message.d.ts +9 -2
- package/dist/path-ownership.d.ts +1 -1
- package/dist/protocol/daemon-server.d.ts +42 -2
- package/dist/protocol/dashboard-daemon-p2p.d.ts +1 -1
- package/dist/protocol/dashboard-server.d.ts +20 -2
- package/dist/provider-approval.d.ts +36 -0
- package/dist/provider-question.d.ts +19 -0
- package/dist/quota-freshness.d.ts +4 -4
- package/dist/relay-reprobe.d.ts +52 -0
- package/dist/release.d.ts +90 -0
- package/dist/role-launch.d.ts +11 -0
- package/dist/session-launch.d.ts +10 -22
- package/dist/slot-proposal.d.ts +14 -0
- package/dist/task-source-phase.d.ts +83 -0
- package/dist/task-stages.d.ts +206 -0
- package/dist/turn-evidence.d.ts +43 -13
- package/dist/turn-ipc-mission.d.ts +72 -1
- package/dist/turn-ipc-queue.d.ts +30 -0
- package/dist/turn-ipc.d.ts +2 -2
- package/dist/types.d.ts +1 -0
- package/dist/worker-protocol.d.ts +33 -1
- package/package.json +1 -1
- package/src/assistant-protocol.ts +306 -6
- package/src/daemon-normalize.ts +7 -5
- package/src/decision-push-relay.ts +23 -0
- package/src/index.ts +13 -0
- package/src/keyed-doc-delta.ts +9 -1
- package/src/launch-defaults.ts +170 -0
- package/src/light-task.ts +116 -0
- package/src/mesh-tool-names.ts +22 -0
- package/src/mesh-vocabulary.ts +12 -2
- package/src/mission-git-state.ts +112 -0
- package/src/mission-items.ts +421 -0
- package/src/node-facts.ts +56 -1
- package/src/outbound-message.ts +19 -0
- package/src/path-ownership.ts +4 -6
- package/src/protocol/daemon-server.ts +37 -2
- package/src/protocol/dashboard-server.ts +13 -2
- package/src/provider-approval.ts +59 -0
- package/src/provider-question.ts +31 -0
- package/src/quota-freshness.ts +29 -13
- package/src/relay-reprobe.ts +117 -0
- package/src/release.ts +121 -0
- package/src/role-launch.ts +51 -0
- package/src/session-launch.ts +17 -1
- package/src/slot-proposal.ts +61 -2
- package/src/task-source-phase.ts +70 -0
- package/src/task-stages.ts +455 -0
- package/src/turn-evidence.ts +56 -20
- package/src/turn-ipc-mission.ts +127 -11
- package/src/turn-ipc-queue.ts +43 -2
- package/src/turn-ipc-turn.ts +1 -1
- package/src/turn-ipc.ts +1 -0
- package/src/types.ts +1 -0
- package/src/worker-protocol.ts +79 -0
package/src/worker-protocol.ts
CHANGED
|
@@ -40,6 +40,21 @@ export const WORKER_TOOLS = [
|
|
|
40
40
|
'git_status',
|
|
41
41
|
'git_log',
|
|
42
42
|
'git_diff',
|
|
43
|
+
'driver_list',
|
|
44
|
+
'driver_describe',
|
|
45
|
+
'driver_invoke',
|
|
46
|
+
'driver_scaffold',
|
|
47
|
+
'driver_validate',
|
|
48
|
+
'driver_export',
|
|
49
|
+
'driver_install',
|
|
50
|
+
'artifact_register',
|
|
51
|
+
'artifact_list',
|
|
52
|
+
'artifact_read',
|
|
53
|
+
// Contract versioning (Cut A): exact pinned-unit reads (E2), the explicit
|
|
54
|
+
// read claim (C1) and the authoritative head/notice pull.
|
|
55
|
+
'contract_read',
|
|
56
|
+
'contract_observe',
|
|
57
|
+
'contract_current',
|
|
43
58
|
] as const
|
|
44
59
|
|
|
45
60
|
export type WorkerTool = typeof WORKER_TOOLS[number]
|
|
@@ -71,8 +86,45 @@ export interface WorkerProtocolFooterInput {
|
|
|
71
86
|
* which is what every worker launched with the default gate receives.
|
|
72
87
|
*/
|
|
73
88
|
workerMcp?: boolean
|
|
89
|
+
/**
|
|
90
|
+
* Same-machine light task: the worker runs in a temporary light workspace.
|
|
91
|
+
* Renders the light-workspace rules (stay inside, commit there, no installs).
|
|
92
|
+
*/
|
|
93
|
+
light?: { workspace: string; baseSha: string; ossBaseSha?: string; ownedPaths: string[] }
|
|
94
|
+
/**
|
|
95
|
+
* Code-changing task on a shared (non-worktree) node checkout, not a light task: the worker commits on the
|
|
96
|
+
* branch that is currently checked out. Renders the "do not create or switch branches" rule.
|
|
97
|
+
*/
|
|
98
|
+
commitOnCurrentBranch?: boolean
|
|
99
|
+
/**
|
|
100
|
+
* Review-in-task (docs/design/2026-11-01-review-in-task.md §9.3): present when this
|
|
101
|
+
* dispatch is one stage of a stage pipeline. `workspace` is the reviewer's pinned
|
|
102
|
+
* workspace path when the daemon prepared one.
|
|
103
|
+
*/
|
|
104
|
+
stage?: { role: 'implement' | 'revise' | 'review'; round: number; maxRevisions: number; workspace?: string }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Light-workspace worker rules (design §9). */
|
|
108
|
+
export function renderLightWorkspaceRules(light: NonNullable<WorkerProtocolFooterInput['light']>): string[] {
|
|
109
|
+
const base = light.ossBaseSha ? `${light.baseSha} (oss ${light.ossBaseSha})` : light.baseSha
|
|
110
|
+
return [
|
|
111
|
+
`You are working in a temporary light workspace at \`${light.workspace}\` based on \`${base}\`. `
|
|
112
|
+
+ 'Work only inside it. Commit your change there (the branch is already set up); do not push.',
|
|
113
|
+
'Do not run `npm install`/`npm ci`/`npm rebuild`/`node-gyp`, do not change package.json or lockfiles — '
|
|
114
|
+
+ 'if the fix needs a dependency change, stop and report `blocked`.',
|
|
115
|
+
'Do not start long-running servers on fixed ports. Run the narrowest tests that cover your change and '
|
|
116
|
+
+ 'list them in `report_completion.testsRun`.',
|
|
117
|
+
light.ownedPaths.length
|
|
118
|
+
? `Stay inside \`owned_paths\` (${light.ownedPaths.join(', ')}); if you must touch more, say why in the summary.`
|
|
119
|
+
: 'Stay inside the paths the task names; if you must touch more, say why in the summary.',
|
|
120
|
+
]
|
|
74
121
|
}
|
|
75
122
|
|
|
123
|
+
/** Base-node code changes land on the branch the coordinator and review expect: the one already checked out. */
|
|
124
|
+
export const WORKER_CURRENT_BRANCH_RULE =
|
|
125
|
+
'Commit your change on the branch that is currently checked out in this workspace. Do not create or switch '
|
|
126
|
+
+ 'branches (no `git checkout -b` / `git switch`) unless the task explicitly says to; report the branch you committed on.'
|
|
127
|
+
|
|
76
128
|
export function hasWorkerProtocolFooter(body: string): boolean {
|
|
77
129
|
return typeof body === 'string' && body.includes(WORKER_PROTOCOL_FOOTER_MARKER)
|
|
78
130
|
}
|
|
@@ -108,6 +160,8 @@ export function renderWorkerProtocolFooter(input: WorkerProtocolFooterInput = {}
|
|
|
108
160
|
if (input.readonly) scope.push('read-only')
|
|
109
161
|
if (scope.length) lines.push(`You are a delegated worker (${scope.join(', ')}).`)
|
|
110
162
|
else lines.push('You are a delegated worker.')
|
|
163
|
+
if (input.light) lines.push(...renderLightWorkspaceRules(input.light))
|
|
164
|
+
else if (input.commitOnCurrentBranch && input.stage?.role !== 'review') lines.push(WORKER_CURRENT_BRANCH_RULE)
|
|
111
165
|
if (input.workerMcp === false) {
|
|
112
166
|
lines.push(
|
|
113
167
|
'This session has NO adhdev worker tools (`report_completion`, `progress_update`, `peer_context_pull`, '
|
|
@@ -144,6 +198,11 @@ export function renderWorkerProtocolFooter(input: WorkerProtocolFooterInput = {}
|
|
|
144
198
|
+ 'and a read-only task should omit it or send `[]`.',
|
|
145
199
|
'If `report_completion` is refused, the response carries `validationErrors` (or a `hint`) naming exactly '
|
|
146
200
|
+ 'what to fix — correct that field and call it again; a refusal records nothing.',
|
|
201
|
+
'Put substantial findings (a diagnosis, evidence, repro steps, review findings) in a workspace file and register it with '
|
|
202
|
+
+ '`artifact_register`, then cite the returned ids in `report_completion` `artifact_ids`. The next task in this mission '
|
|
203
|
+
+ 'inherits them as input artifacts instead of re-investigating — keep each artifact self-contained and factual.',
|
|
204
|
+
'`driver_invoke` results that carry an image or a large body arrive already registered: take `artifacts[].artifactId` from the '
|
|
205
|
+
+ 'result and cite it in `artifact_ids` — do not paste the body.',
|
|
147
206
|
)
|
|
148
207
|
if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
|
|
149
208
|
lines.push(
|
|
@@ -151,9 +210,29 @@ export function renderWorkerProtocolFooter(input: WorkerProtocolFooterInput = {}
|
|
|
151
210
|
+ 'honour their conflict guidance and add your own in `handoff_notes` when you report.',
|
|
152
211
|
)
|
|
153
212
|
}
|
|
213
|
+
if (input.stage) lines.push(...renderStageProtocolLines(input.stage))
|
|
154
214
|
return lines.join('\n')
|
|
155
215
|
}
|
|
156
216
|
|
|
217
|
+
/** The stage-pipeline paragraph of the worker footer (implement / revise / review). */
|
|
218
|
+
export function renderStageProtocolLines(stage: NonNullable<WorkerProtocolFooterInput['stage']>): string[] {
|
|
219
|
+
if (stage.role === 'review') {
|
|
220
|
+
return [
|
|
221
|
+
`STAGE: you are the independent reviewer (round ${stage.round} of at most ${stage.maxRevisions + 1}). Read the input artifacts first (diff, self-check log, previous verdict).`
|
|
222
|
+
+ (stage.workspace ? ` Your workspace ${stage.workspace} is pinned to the round head — you may run tests, but nothing you change lands; do not fix, record findings instead.` : ' Do not modify the workspace: read it, and record findings instead of fixing.'),
|
|
223
|
+
'Your `report_completion` MUST carry `review`: {verdict: approve | approve_with_nits | changes_requested | reject_approach, findings[{id, severity, category, claim, evidence, suggested_fix?}], checked[], not_checked[], tests_run?[]}. '
|
|
224
|
+
+ '`changes_requested` needs at least one blocking/major finding; `approve` allows none. From round 2 also give `prior_findings[{id, status}]` for every earlier blocking/major finding. '
|
|
225
|
+
+ '`reject_approach` is only for a wrong approach, not for fixable defects.',
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
return [
|
|
229
|
+
`STAGE: your \`report_completion\` is a stage report (${stage.role}, round ${stage.round}). An independent reviewer reads your diff next, so commit your work and leave the workspace clean before you report. You may receive review findings as a follow-up memo in this same session.`,
|
|
230
|
+
...(stage.role === 'revise'
|
|
231
|
+
? ['For every open blocking/major finding in the memo, fill `finding_responses[{id, response: fixed | disputed, note}]` — `disputed` needs your reasoning; the reviewer judges it next round.']
|
|
232
|
+
: []),
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
|
|
157
236
|
/**
|
|
158
237
|
* The authored text of a dispatched body: everything before the footer marker.
|
|
159
238
|
* Ledger descriptors, replay fixtures and tests compare authored text, never
|