@adhdev/mesh-shared 1.0.60-rc.41 → 1.0.60-rc.43

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/types.d.ts CHANGED
@@ -136,4 +136,15 @@ export interface RepoMeshSessionStatus {
136
136
  startedAt?: string | null;
137
137
  lastActivityAt?: string | null;
138
138
  isCached?: boolean;
139
+ /**
140
+ * Worker MCP delivery outcome for this session's launch (present only for a
141
+ * mesh-delegated launch). `reason` is a short enum code, never free text —
142
+ * see `WORKER_MCP_DELIVERY_REASONS` (daemon-core's `mesh/worker-mcp-isolation.ts`,
143
+ * the source of the vocabulary this field's values are drawn from; not
144
+ * re-exported here so mesh-shared stays a dependency-free leaf).
145
+ */
146
+ workerMcp?: {
147
+ delivered: boolean;
148
+ reason?: string;
149
+ };
139
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/mesh-shared",
3
- "version": "1.0.60-rc.41",
3
+ "version": "1.0.60-rc.43",
4
4
  "description": "ADHDev mesh-shared — pure mesh/git status normalizers shared by daemon-core and web-core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/types.ts CHANGED
@@ -153,4 +153,12 @@ export interface RepoMeshSessionStatus {
153
153
  startedAt?: string | null
154
154
  lastActivityAt?: string | null
155
155
  isCached?: boolean
156
+ /**
157
+ * Worker MCP delivery outcome for this session's launch (present only for a
158
+ * mesh-delegated launch). `reason` is a short enum code, never free text —
159
+ * see `WORKER_MCP_DELIVERY_REASONS` (daemon-core's `mesh/worker-mcp-isolation.ts`,
160
+ * the source of the vocabulary this field's values are drawn from; not
161
+ * re-exported here so mesh-shared stays a dependency-free leaf).
162
+ */
163
+ workerMcp?: { delivered: boolean; reason?: string }
156
164
  }
@@ -31,6 +31,7 @@
31
31
  */
32
32
 
33
33
  import { renderMissionBriefBlock, type MissionBrief } from './mission-brief'
34
+ import { isMeshTaskDifficulty } from './brain-routing'
34
35
 
35
36
  export const WORKER_TOOLS = [
36
37
  'report_completion',
@@ -78,7 +79,23 @@ export function renderWorkerProtocolFooter(input: WorkerProtocolFooterInput = {}
78
79
  const scope: string[] = []
79
80
  if (input.taskId) scope.push(`task ${input.taskId}`)
80
81
  if (input.taskMode) scope.push(`mode ${input.taskMode}`)
81
- if (input.difficulty) scope.push(`difficulty ${input.difficulty}`)
82
+ // MCP-usage-audit item 2: validate against the canonical difficulty set
83
+ // (this package's own brain-routing vocabulary — never duplicated here)
84
+ // rather than rendering an internal caller's typo or stale value verbatim.
85
+ // The MCP tool-schema enum already blocks a bad value AT THE TOOLS; this
86
+ // covers internal callers that can still construct a task with one.
87
+ if (input.difficulty) {
88
+ if (isMeshTaskDifficulty(input.difficulty)) {
89
+ scope.push(`difficulty ${input.difficulty}`)
90
+ } else {
91
+ // eslint-disable-next-line no-console -- mesh-shared is a dependency-free
92
+ // leaf with no logger abstraction; this is the one place that matters.
93
+ console.warn(
94
+ `[worker-protocol] task ${input.taskId ?? '(unknown)'}: dropping invalid difficulty '${input.difficulty}' `
95
+ + `from the worker footer (expected one of easy, medium, difficult, freeform)`,
96
+ )
97
+ }
98
+ }
82
99
  if (input.readonly) scope.push('read-only')
83
100
  if (scope.length) lines.push(`You are a delegated worker (${scope.join(', ')}).`)
84
101
  else lines.push('You are a delegated worker.')
@@ -89,10 +106,15 @@ export function renderWorkerProtocolFooter(input: WorkerProtocolFooterInput = {}
89
106
  'For work that runs longer than a few minutes, call `progress_update` at natural checkpoints so the '
90
107
  + 'coordinator can see you are alive without polling.',
91
108
  '`peer_context_pull` shows what sibling tasks in this mission have reported; `git_status` / `git_diff` / '
92
- + '`git_log` inspect your own workspace (pass its absolute path as `workspace`).',
109
+ + '`git_log` inspect your own workspace — all three REQUIRE the absolute path to it as `workspace`.',
93
110
  'You have no coordinator tools (no `mesh_*`) by design: do not enqueue, dispatch, or restart anything. '
94
111
  + 'If you need a decision from the coordinator, finish with `report_completion` and outcome `blocked`, '
95
112
  + 'listing what you need in `blockers`.',
113
+ 'On a code-changing task, `report_completion` with outcome `completed` requires `touched_files` — send '
114
+ + '`[]` if you changed nothing, omitting the field is what gets refused. `blocked`/`failed` never need it, '
115
+ + 'and a read-only task should omit it or send `[]`.',
116
+ 'If `report_completion` is refused, the response carries `validationErrors` (or a `hint`) naming exactly '
117
+ + 'what to fix — correct that field and call it again; a refusal records nothing.',
96
118
  )
97
119
  if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
98
120
  lines.push(