@adhdev/mesh-shared 1.0.60-rc.40 → 1.0.60-rc.42

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/index.js CHANGED
@@ -1990,15 +1990,25 @@ function renderWorkerProtocolFooter(input = {}) {
1990
1990
  const scope = [];
1991
1991
  if (input.taskId) scope.push(`task ${input.taskId}`);
1992
1992
  if (input.taskMode) scope.push(`mode ${input.taskMode}`);
1993
- if (input.difficulty) scope.push(`difficulty ${input.difficulty}`);
1993
+ if (input.difficulty) {
1994
+ if (isMeshTaskDifficulty(input.difficulty)) {
1995
+ scope.push(`difficulty ${input.difficulty}`);
1996
+ } else {
1997
+ console.warn(
1998
+ `[worker-protocol] task ${input.taskId ?? "(unknown)"}: dropping invalid difficulty '${input.difficulty}' from the worker footer (expected one of easy, medium, difficult, freeform)`
1999
+ );
2000
+ }
2001
+ }
1994
2002
  if (input.readonly) scope.push("read-only");
1995
2003
  if (scope.length) lines.push(`You are a delegated worker (${scope.join(", ")}).`);
1996
2004
  else lines.push("You are a delegated worker.");
1997
2005
  lines.push(
1998
2006
  "When your work is finished, blocked, or has failed, call `report_completion` exactly once. Its `summary` is recorded verbatim as the authoritative record of this task \u2014 your terminal is not scraped for it \u2014 so state what you did, what you found, and where you left the branch.",
1999
2007
  "For work that runs longer than a few minutes, call `progress_update` at natural checkpoints so the coordinator can see you are alive without polling.",
2000
- "`peer_context_pull` shows what sibling tasks in this mission have reported; `git_status` / `git_diff` / `git_log` inspect your own workspace (pass its absolute path as `workspace`).",
2001
- "You have no coordinator tools (no `mesh_*`) by design: do not enqueue, dispatch, or restart anything. If you need a decision from the coordinator, finish with `report_completion` and outcome `blocked`, listing what you need in `blockers`."
2008
+ "`peer_context_pull` shows what sibling tasks in this mission have reported; `git_status` / `git_diff` / `git_log` inspect your own workspace \u2014 all three REQUIRE the absolute path to it as `workspace`.",
2009
+ "You have no coordinator tools (no `mesh_*`) by design: do not enqueue, dispatch, or restart anything. If you need a decision from the coordinator, finish with `report_completion` and outcome `blocked`, listing what you need in `blockers`.",
2010
+ "On a code-changing task, `report_completion` with outcome `completed` requires `touched_files` \u2014 send `[]` if you changed nothing, omitting the field is what gets refused. `blocked`/`failed` never need it, and a read-only task should omit it or send `[]`.",
2011
+ "If `report_completion` is refused, the response carries `validationErrors` (or a `hint`) naming exactly what to fix \u2014 correct that field and call it again; a refusal records nothing."
2002
2012
  );
2003
2013
  if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
2004
2014
  lines.push(
@@ -2098,7 +2108,12 @@ var HOLD_REASONS = [
2098
2108
  "live_pending",
2099
2109
  "transcript_quiet",
2100
2110
  "weak_candidate",
2101
- "suspension_before_consumed"
2111
+ "suspension_before_consumed",
2112
+ // A genuine FSM end of a mesh turn whose worker holds a live worker-MCP bind:
2113
+ // the structured report is the primary evidence (design §F2), so the idle edge
2114
+ // only opens this hold (R9r) — a report commits (R17), a new busy edge cancels
2115
+ // it as a false idle (R12r), expiry commits weak (R13r).
2116
+ "await_report"
2102
2117
  ];
2103
2118
  var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
2104
2119
  var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
@@ -2198,7 +2213,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2198
2213
  blockReason: enOpt(TURN_END_BLOCK_REASONS),
2199
2214
  releasedByHardCap: boolOpt,
2200
2215
  nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
2201
- live: { t: "live", optional: true }
2216
+ live: { t: "live", optional: true },
2217
+ reportExpected: boolOpt
2202
2218
  },
2203
2219
  transcript_final: {
2204
2220
  selfAttributing: bool,