@adhdev/mesh-shared 1.0.82-rc.47 → 1.0.82-rc.49
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 +3 -1
- package/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -6
- package/dist/index.mjs.map +1 -1
- package/dist/light-task.d.ts +7 -0
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/turn-ipc-queue.d.ts +7 -0
- package/dist/worker-protocol.d.ts +7 -0
- package/package.json +1 -1
- package/src/assistant-protocol.ts +5 -1
- package/src/light-task.ts +13 -0
- package/src/mesh-tool-names.ts +1 -0
- package/src/turn-ipc-queue.ts +7 -3
- package/src/worker-protocol.ts +13 -0
package/dist/light-task.d.ts
CHANGED
|
@@ -87,3 +87,10 @@ export interface LightLandRequest {
|
|
|
87
87
|
partial?: boolean;
|
|
88
88
|
approvedPublishShas?: string[];
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* True when a session record/state (or a bare settings object) belongs to a light-task worker, i.e.
|
|
92
|
+
* it was launched with `settings.lightWorkspaceId`. A light session is bound to ONE task's scratch
|
|
93
|
+
* workspace and, by the central claim rule, can never claim any other row — so it is never "the
|
|
94
|
+
* node's worker" for duplicate-launch guards, auto-launch gating or concurrency counts.
|
|
95
|
+
*/
|
|
96
|
+
export declare function isLightWorkerSession(session: unknown): boolean;
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
* Order mirrors mcp-server `ALL_MESH_TOOLS` for easy visual diffing, but the consistency
|
|
19
19
|
* checks are set-based (order-insensitive).
|
|
20
20
|
*/
|
|
21
|
-
export declare const CANONICAL_MESH_TOOL_NAMES: readonly ["mesh_status", "mesh_route_preview", "mesh_list_nodes", "mesh_enqueue_batch", "mesh_enqueue_task", "mesh_view_queue", "mesh_queue_cancel", "mesh_task_stage_decide", "mesh_direct_cancel", "mesh_queue_requeue", "mesh_queue_revise", "mesh_light_land", "mesh_light_discard", "mesh_send_task", "mesh_read_chat", "mesh_read_debug", "mesh_read_terminal", "mesh_send_keys", "mesh_launch_session", "mesh_git_status", "mesh_read_node_logs", "mesh_fast_forward_node", "mesh_restart_daemon", "mesh_checkpoint", "mesh_approve", "mesh_answer_question", "mesh_list_pending_approvals", "mesh_create", "mesh_add_node", "mesh_reattach_source_parent", "mesh_attach_remote", "mesh_clone_node", "mesh_remove_node", "mesh_retry_node_bootstrap", "mesh_cleanup_worktree_nodes", "mesh_refine_node", "mesh_refine_batch", "mesh_config", "mesh_init", "mesh_cleanup_sessions", "mesh_task_history", "mesh_ledger_query", "mesh_note", "mesh_reconcile_ledger", "mesh_mission_upsert", "mesh_mission_list", "mesh_mission_git_eval", "mesh_release_upsert", "mesh_release_scope", "mesh_release_list", "mesh_release_record_deploy", "mesh_release_changelog_draft", "mesh_review_inbox", "mesh_node_slots", "driver_list", "driver_describe", "artifact_list", "artifact_read", "artifact_register"];
|
|
21
|
+
export declare const CANONICAL_MESH_TOOL_NAMES: readonly ["mesh_status", "mesh_route_preview", "mesh_list_nodes", "mesh_enqueue_batch", "mesh_enqueue_task", "mesh_view_queue", "mesh_queue_cancel", "mesh_task_stage_decide", "mesh_direct_cancel", "mesh_queue_requeue", "mesh_queue_revise", "mesh_light_land", "mesh_light_discard", "mesh_send_task", "mesh_read_chat", "mesh_read_debug", "mesh_read_terminal", "mesh_send_keys", "mesh_launch_session", "mesh_git_status", "mesh_read_node_logs", "mesh_fast_forward_node", "mesh_restart_daemon", "mesh_checkpoint", "mesh_approve", "mesh_answer_question", "mesh_list_pending_approvals", "mesh_create", "mesh_add_node", "mesh_reattach_source_parent", "mesh_attach_remote", "mesh_clone_node", "mesh_remove_node", "mesh_retry_node_bootstrap", "mesh_cleanup_worktree_nodes", "mesh_refine_node", "mesh_refine_batch", "mesh_config", "mesh_init", "mesh_cleanup_sessions", "mesh_task_history", "mesh_ledger_query", "mesh_note", "mesh_reconcile_ledger", "mesh_mission_upsert", "mesh_mission_list", "mesh_mission_git_eval", "mesh_release_upsert", "mesh_release_scope", "mesh_release_list", "mesh_release_record_deploy", "mesh_release_changelog_draft", "mesh_file_transfer", "mesh_review_inbox", "mesh_node_slots", "driver_list", "driver_describe", "artifact_list", "artifact_read", "artifact_register"];
|
|
22
22
|
export type CanonicalMeshToolName = typeof CANONICAL_MESH_TOOL_NAMES[number];
|
|
23
23
|
/** The count the `NN tools` barrel doc comments and consistency test assert against. */
|
|
24
|
-
export declare const CANONICAL_MESH_TOOL_COUNT:
|
|
24
|
+
export declare const CANONICAL_MESH_TOOL_COUNT: 60;
|
|
25
25
|
/**
|
|
26
26
|
* Tool names retired by the 2026-09-26 tool-surface consolidation (60 → 48).
|
|
27
27
|
* Every capability behind them is still reachable: each retired name maps to the
|
package/dist/turn-ipc-queue.d.ts
CHANGED
|
@@ -125,6 +125,12 @@ export interface QueueRequeueRequest {
|
|
|
125
125
|
}
|
|
126
126
|
export interface QueueRequeueResponse {
|
|
127
127
|
task: QueueEntryWire | null;
|
|
128
|
+
/** queue_revise {requestQuotaOverride}: the owner decision that was raised (or already open). Never a grant. */
|
|
129
|
+
quotaOverrideRequested?: {
|
|
130
|
+
decisionId: string;
|
|
131
|
+
alreadyAsked: boolean;
|
|
132
|
+
options: string[];
|
|
133
|
+
};
|
|
128
134
|
}
|
|
129
135
|
export declare function decodeQueueRequeueRequest(value: unknown): QueueRequeueRequest | null;
|
|
130
136
|
export declare function decodeQueueRequeueResponse(value: unknown): QueueRequeueResponse | null;
|
|
@@ -208,6 +214,7 @@ export interface QueueReviseRequest {
|
|
|
208
214
|
dependsOn?: string[];
|
|
209
215
|
routingPreferences?: import('./task-source-phase').MeshRoutingPreferences;
|
|
210
216
|
review?: import('./task-source-phase').MeshReviewConstraint;
|
|
217
|
+
requestQuotaOverride?: true;
|
|
211
218
|
};
|
|
212
219
|
}
|
|
213
220
|
export type QueueReviseResponse = QueueRequeueResponse;
|
|
@@ -63,6 +63,11 @@ export interface WorkerProtocolFooterInput {
|
|
|
63
63
|
ossBaseSha?: string;
|
|
64
64
|
ownedPaths: string[];
|
|
65
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Code-changing task on a shared (non-worktree) node checkout, not a light task: the worker commits on the
|
|
68
|
+
* branch that is currently checked out. Renders the "do not create or switch branches" rule.
|
|
69
|
+
*/
|
|
70
|
+
commitOnCurrentBranch?: boolean;
|
|
66
71
|
/**
|
|
67
72
|
* Review-in-task (docs/design/2026-11-01-review-in-task.md §9.3): present when this
|
|
68
73
|
* dispatch is one stage of a stage pipeline. `workspace` is the reviewer's pinned
|
|
@@ -77,6 +82,8 @@ export interface WorkerProtocolFooterInput {
|
|
|
77
82
|
}
|
|
78
83
|
/** Light-workspace worker rules (design §9). */
|
|
79
84
|
export declare function renderLightWorkspaceRules(light: NonNullable<WorkerProtocolFooterInput['light']>): string[];
|
|
85
|
+
/** Base-node code changes land on the branch the coordinator and review expect: the one already checked out. */
|
|
86
|
+
export declare const WORKER_CURRENT_BRANCH_RULE: string;
|
|
80
87
|
export declare function hasWorkerProtocolFooter(body: string): boolean;
|
|
81
88
|
/**
|
|
82
89
|
* The protocol block appended to a dispatched task. Written for the model that
|
package/package.json
CHANGED
|
@@ -40,6 +40,7 @@ export const ASSISTANT_TOOLS = [
|
|
|
40
40
|
'decision_answer',
|
|
41
41
|
'decision_request',
|
|
42
42
|
'session_control',
|
|
43
|
+
'file_transfer',
|
|
43
44
|
] as const
|
|
44
45
|
|
|
45
46
|
export type AssistantTool = typeof ASSISTANT_TOOLS[number]
|
|
@@ -83,6 +84,8 @@ export const ASSISTANT_VERB = {
|
|
|
83
84
|
decisionRequest: 'assistant_decision_request',
|
|
84
85
|
/** Stop / restart / switch the provider of a coordinator, worker or the assistant session (handoff design 2026-11-01 §4). */
|
|
85
86
|
sessionControl: 'assistant_session_control',
|
|
87
|
+
/** Request / status / cancel the assistant's own project file transfers (owner approves in the dashboard; file-transfer design section 6). */
|
|
88
|
+
fileTransfer: 'assistant_file_transfer',
|
|
86
89
|
// assistant-side daemon verbs without a tool of the same name
|
|
87
90
|
launch: 'launch_assistant',
|
|
88
91
|
pendingRelays: 'assistant_pending_relays',
|
|
@@ -129,6 +132,7 @@ export const ASSISTANT_TOOL_VERBS: Readonly<Record<AssistantTool, AssistantVerb>
|
|
|
129
132
|
decision_answer: ASSISTANT_VERB.decisionAnswer,
|
|
130
133
|
decision_request: ASSISTANT_VERB.decisionRequest,
|
|
131
134
|
session_control: ASSISTANT_VERB.sessionControl,
|
|
135
|
+
file_transfer: ASSISTANT_VERB.fileTransfer,
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
/**
|
|
@@ -137,7 +141,7 @@ export const ASSISTANT_TOOL_VERBS: Readonly<Record<AssistantTool, AssistantVerb>
|
|
|
137
141
|
* because they cause effects (a coordinator message or launch, a new
|
|
138
142
|
* project), and MCP clients use readOnlyHint to skip confirmation.
|
|
139
143
|
*/
|
|
140
|
-
export const ASSISTANT_WRITE_TOOLS: readonly AssistantTool[] = ['project_watch', 'assistant_action', 'memory', 'skill_manage', 'project_note', 'project_send', 'project_add', 'project_attach_remote', 'launch_defaults_set', 'decision_answer', 'decision_request', 'session_control']
|
|
144
|
+
export const ASSISTANT_WRITE_TOOLS: readonly AssistantTool[] = ['project_watch', 'assistant_action', 'memory', 'skill_manage', 'project_note', 'project_send', 'project_add', 'project_attach_remote', 'launch_defaults_set', 'decision_answer', 'decision_request', 'session_control', 'file_transfer']
|
|
141
145
|
|
|
142
146
|
/** Owner-only verbs: never reachable from the assistant's MCP server (no `ipc`). */
|
|
143
147
|
export const ASSISTANT_OWNER_VERBS: readonly AssistantVerb[] = [
|
package/src/light-task.ts
CHANGED
|
@@ -101,3 +101,16 @@ export interface LightLandRequest {
|
|
|
101
101
|
partial?: boolean
|
|
102
102
|
approvedPublishShas?: string[]
|
|
103
103
|
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* True when a session record/state (or a bare settings object) belongs to a light-task worker, i.e.
|
|
107
|
+
* it was launched with `settings.lightWorkspaceId`. A light session is bound to ONE task's scratch
|
|
108
|
+
* workspace and, by the central claim rule, can never claim any other row — so it is never "the
|
|
109
|
+
* node's worker" for duplicate-launch guards, auto-launch gating or concurrency counts.
|
|
110
|
+
*/
|
|
111
|
+
export function isLightWorkerSession(session: unknown): boolean {
|
|
112
|
+
const s = session as any
|
|
113
|
+
if (!s || typeof s !== 'object') return false
|
|
114
|
+
const has = (o: any): boolean => !!o && typeof o === 'object' && typeof o.lightWorkspaceId === 'string' && o.lightWorkspaceId.trim() !== ''
|
|
115
|
+
return has(s.settings) || has(s.launchRecord?.settings) || has(s)
|
|
116
|
+
}
|
package/src/mesh-tool-names.ts
CHANGED
package/src/turn-ipc-queue.ts
CHANGED
|
@@ -308,6 +308,8 @@ export interface QueueRequeueRequest {
|
|
|
308
308
|
|
|
309
309
|
export interface QueueRequeueResponse {
|
|
310
310
|
task: QueueEntryWire | null
|
|
311
|
+
/** queue_revise {requestQuotaOverride}: the owner decision that was raised (or already open). Never a grant. */
|
|
312
|
+
quotaOverrideRequested?: { decisionId: string; alreadyAsked: boolean; options: string[] }
|
|
311
313
|
}
|
|
312
314
|
|
|
313
315
|
function isQueueRequeueRequest(value: unknown): value is QueueRequeueRequest {
|
|
@@ -321,7 +323,8 @@ export function decodeQueueRequeueRequest(value: unknown): QueueRequeueRequest |
|
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
function isQueueRequeueResponse(value: unknown): value is QueueRequeueResponse {
|
|
324
|
-
return isRecord(value) && hasOnlyKeys(value, ['task']) && (value.task === null || isQueueEntryWire(value.task))
|
|
326
|
+
return isRecord(value) && hasOnlyKeys(value, ['task', 'quotaOverrideRequested']) && (value.task === null || isQueueEntryWire(value.task))
|
|
327
|
+
&& (value.quotaOverrideRequested === undefined || (isRecord(value.quotaOverrideRequested) && typeof value.quotaOverrideRequested.decisionId === 'string'))
|
|
325
328
|
}
|
|
326
329
|
|
|
327
330
|
export function decodeQueueRequeueResponse(value: unknown): QueueRequeueResponse | null {
|
|
@@ -501,7 +504,7 @@ export interface QueueReviseRequest {
|
|
|
501
504
|
meshId: string
|
|
502
505
|
taskId: string
|
|
503
506
|
expectedRevision: number
|
|
504
|
-
patch: { message?: string; ownedPaths?: string[]; phase?: 'source' | 'integration'; dependsOn?: string[]; routingPreferences?: import('./task-source-phase').MeshRoutingPreferences; review?: import('./task-source-phase').MeshReviewConstraint }
|
|
507
|
+
patch: { message?: string; ownedPaths?: string[]; phase?: 'source' | 'integration'; dependsOn?: string[]; routingPreferences?: import('./task-source-phase').MeshRoutingPreferences; review?: import('./task-source-phase').MeshReviewConstraint; requestQuotaOverride?: true }
|
|
505
508
|
}
|
|
506
509
|
export type QueueReviseResponse = QueueRequeueResponse
|
|
507
510
|
export function decodeQueueReviseRequest(value: unknown): QueueReviseRequest | null {
|
|
@@ -509,8 +512,9 @@ export function decodeQueueReviseRequest(value: unknown): QueueReviseRequest | n
|
|
|
509
512
|
|| value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId) || !isEvidenceIdentifier(value.taskId)
|
|
510
513
|
|| !Number.isSafeInteger(value.expectedRevision) || (value.expectedRevision as number) < 0
|
|
511
514
|
|| !isRecord(value.patch) || !Object.keys(value.patch).length
|
|
512
|
-
|| !hasOnlyKeys(value.patch, ['message', 'ownedPaths', 'phase', 'dependsOn', 'routingPreferences', 'review'])) return null
|
|
515
|
+
|| !hasOnlyKeys(value.patch, ['message', 'ownedPaths', 'phase', 'dependsOn', 'routingPreferences', 'review', 'requestQuotaOverride'])) return null
|
|
513
516
|
const p = value.patch
|
|
517
|
+
if (p.requestQuotaOverride !== undefined && (p.requestQuotaOverride !== true || Object.keys(p).length !== 1)) return null
|
|
514
518
|
if (p.message !== undefined && (typeof p.message !== 'string' || !p.message.trim())) return null
|
|
515
519
|
if (p.phase !== undefined && p.phase !== 'source' && p.phase !== 'integration') return null
|
|
516
520
|
for (const key of ['ownedPaths', 'dependsOn']) {
|
package/src/worker-protocol.ts
CHANGED
|
@@ -91,6 +91,11 @@ export interface WorkerProtocolFooterInput {
|
|
|
91
91
|
* Renders the light-workspace rules (stay inside, commit there, no installs).
|
|
92
92
|
*/
|
|
93
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
|
|
94
99
|
/**
|
|
95
100
|
* Review-in-task (docs/design/2026-11-01-review-in-task.md §9.3): present when this
|
|
96
101
|
* dispatch is one stage of a stage pipeline. `workspace` is the reviewer's pinned
|
|
@@ -115,6 +120,11 @@ export function renderLightWorkspaceRules(light: NonNullable<WorkerProtocolFoote
|
|
|
115
120
|
]
|
|
116
121
|
}
|
|
117
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
|
+
|
|
118
128
|
export function hasWorkerProtocolFooter(body: string): boolean {
|
|
119
129
|
return typeof body === 'string' && body.includes(WORKER_PROTOCOL_FOOTER_MARKER)
|
|
120
130
|
}
|
|
@@ -151,6 +161,7 @@ export function renderWorkerProtocolFooter(input: WorkerProtocolFooterInput = {}
|
|
|
151
161
|
if (scope.length) lines.push(`You are a delegated worker (${scope.join(', ')}).`)
|
|
152
162
|
else lines.push('You are a delegated worker.')
|
|
153
163
|
if (input.light) lines.push(...renderLightWorkspaceRules(input.light))
|
|
164
|
+
else if (input.commitOnCurrentBranch && input.stage?.role !== 'review') lines.push(WORKER_CURRENT_BRANCH_RULE)
|
|
154
165
|
if (input.workerMcp === false) {
|
|
155
166
|
lines.push(
|
|
156
167
|
'This session has NO adhdev worker tools (`report_completion`, `progress_update`, `peer_context_pull`, '
|
|
@@ -190,6 +201,8 @@ export function renderWorkerProtocolFooter(input: WorkerProtocolFooterInput = {}
|
|
|
190
201
|
'Put substantial findings (a diagnosis, evidence, repro steps, review findings) in a workspace file and register it with '
|
|
191
202
|
+ '`artifact_register`, then cite the returned ids in `report_completion` `artifact_ids`. The next task in this mission '
|
|
192
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.',
|
|
193
206
|
)
|
|
194
207
|
if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
|
|
195
208
|
lines.push(
|