@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.
@@ -14,7 +14,7 @@
14
14
  * Assistant-specific tools remain separate from mesh tools. Driver discovery
15
15
  * (list/describe) is shared across all three modes; invoke remains Worker-only.
16
16
  */
17
- export declare const ASSISTANT_TOOLS: readonly ["projects", "environment", "assistant_action", "project_watch", "project_status", "project_send", "project_read", "project_add", "project_attach_remote", "discover_repos", "memory", "memory_search", "skill_view", "skill_manage", "project_note", "launch_defaults", "launch_defaults_set", "driver_list", "driver_describe", "artifact_list", "artifact_read", "decision_answer", "decision_request", "session_control"];
17
+ export declare const ASSISTANT_TOOLS: readonly ["projects", "environment", "assistant_action", "project_watch", "project_status", "project_send", "project_read", "project_add", "project_attach_remote", "discover_repos", "memory", "memory_search", "skill_view", "skill_manage", "project_note", "launch_defaults", "launch_defaults_set", "driver_list", "driver_describe", "artifact_list", "artifact_read", "decision_answer", "decision_request", "session_control", "file_transfer"];
18
18
  export type AssistantTool = typeof ASSISTANT_TOOLS[number];
19
19
  export declare function isAssistantTool(value: unknown): value is AssistantTool;
20
20
  /** Daemon verb names (§4.4 table + the five verbs below it). */
@@ -49,6 +49,8 @@ export declare const ASSISTANT_VERB: {
49
49
  readonly decisionRequest: "assistant_decision_request";
50
50
  /** Stop / restart / switch the provider of a coordinator, worker or the assistant session (handoff design 2026-11-01 §4). */
51
51
  readonly sessionControl: "assistant_session_control";
52
+ /** Request / status / cancel the assistant's own project file transfers (owner approves in the dashboard; file-transfer design section 6). */
53
+ readonly fileTransfer: "assistant_file_transfer";
52
54
  readonly launch: "launch_assistant";
53
55
  readonly pendingRelays: "assistant_pending_relays";
54
56
  readonly stagedResolve: "assistant_staged_resolve";
package/dist/index.js CHANGED
@@ -221,6 +221,7 @@ __export(index_exports, {
221
221
  VIEWER_TO_SHARED_SESSION_TYPES: () => VIEWER_TO_SHARED_SESSION_TYPES,
222
222
  WORKER_BRANCH_STATES: () => WORKER_BRANCH_STATES,
223
223
  WORKER_COMMITS_MAX: () => WORKER_COMMITS_MAX,
224
+ WORKER_CURRENT_BRANCH_RULE: () => WORKER_CURRENT_BRANCH_RULE,
224
225
  WORKER_DECISIONS_NEEDED_MAX: () => WORKER_DECISIONS_NEEDED_MAX,
225
226
  WORKER_PROTOCOL_FOOTER_MARKER: () => WORKER_PROTOCOL_FOOTER_MARKER,
226
227
  WORKER_REPORT_OUTCOMES: () => WORKER_REPORT_OUTCOMES,
@@ -352,6 +353,7 @@ __export(index_exports, {
352
353
  isInputEnvelopeWire: () => isInputEnvelopeWire,
353
354
  isLaunchDefaultRole: () => isLaunchDefaultRole,
354
355
  isLaunchDefaultSource: () => isLaunchDefaultSource,
356
+ isLightWorkerSession: () => isLightWorkerSession,
355
357
  isMeshDeliveryMode: () => isMeshDeliveryMode,
356
358
  isMeshIndexQueryResponse: () => isMeshIndexQueryResponse,
357
359
  isMeshMissionStatusValue: () => isMeshMissionStatusValue,
@@ -1300,6 +1302,7 @@ var CANONICAL_MESH_TOOL_NAMES = [
1300
1302
  "mesh_release_list",
1301
1303
  "mesh_release_record_deploy",
1302
1304
  "mesh_release_changelog_draft",
1305
+ "mesh_file_transfer",
1303
1306
  "mesh_review_inbox",
1304
1307
  "mesh_node_slots",
1305
1308
  "driver_list",
@@ -2225,6 +2228,7 @@ function renderLightWorkspaceRules(light) {
2225
2228
  light.ownedPaths.length ? `Stay inside \`owned_paths\` (${light.ownedPaths.join(", ")}); if you must touch more, say why in the summary.` : "Stay inside the paths the task names; if you must touch more, say why in the summary."
2226
2229
  ];
2227
2230
  }
2231
+ var WORKER_CURRENT_BRANCH_RULE = "Commit your change on the branch that is currently checked out in this workspace. Do not create or switch branches (no `git checkout -b` / `git switch`) unless the task explicitly says to; report the branch you committed on.";
2228
2232
  function hasWorkerProtocolFooter(body) {
2229
2233
  return typeof body === "string" && body.includes(WORKER_PROTOCOL_FOOTER_MARKER);
2230
2234
  }
@@ -2247,6 +2251,7 @@ function renderWorkerProtocolFooter(input = {}) {
2247
2251
  if (scope.length) lines.push(`You are a delegated worker (${scope.join(", ")}).`);
2248
2252
  else lines.push("You are a delegated worker.");
2249
2253
  if (input.light) lines.push(...renderLightWorkspaceRules(input.light));
2254
+ else if (input.commitOnCurrentBranch && input.stage?.role !== "review") lines.push(WORKER_CURRENT_BRANCH_RULE);
2250
2255
  if (input.workerMcp === false) {
2251
2256
  lines.push(
2252
2257
  "This session has NO adhdev worker tools (`report_completion`, `progress_update`, `peer_context_pull`, `git_*`) \u2014 do not look for them. When your work is finished, blocked, or has failed, end your turn with a plain final summary: what you did, what you found, which files you changed, and where you left the branch. That final message is what the coordinator receives.",
@@ -2267,7 +2272,8 @@ function renderWorkerProtocolFooter(input = {}) {
2267
2272
  "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`.",
2268
2273
  "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 `[]`.",
2269
2274
  "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.",
2270
- "Put substantial findings (a diagnosis, evidence, repro steps, review findings) in a workspace file and register it with `artifact_register`, then cite the returned ids in `report_completion` `artifact_ids`. The next task in this mission inherits them as input artifacts instead of re-investigating \u2014 keep each artifact self-contained and factual."
2275
+ "Put substantial findings (a diagnosis, evidence, repro steps, review findings) in a workspace file and register it with `artifact_register`, then cite the returned ids in `report_completion` `artifact_ids`. The next task in this mission inherits them as input artifacts instead of re-investigating \u2014 keep each artifact self-contained and factual.",
2276
+ "`driver_invoke` results that carry an image or a large body arrive already registered: take `artifacts[].artifactId` from the result and cite it in `artifact_ids` \u2014 do not paste the body."
2271
2277
  );
2272
2278
  if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
2273
2279
  lines.push(
@@ -2340,7 +2346,8 @@ var ASSISTANT_TOOLS = [
2340
2346
  "artifact_read",
2341
2347
  "decision_answer",
2342
2348
  "decision_request",
2343
- "session_control"
2349
+ "session_control",
2350
+ "file_transfer"
2344
2351
  ];
2345
2352
  var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
2346
2353
  function isAssistantTool(value) {
@@ -2378,6 +2385,8 @@ var ASSISTANT_VERB = {
2378
2385
  decisionRequest: "assistant_decision_request",
2379
2386
  /** Stop / restart / switch the provider of a coordinator, worker or the assistant session (handoff design 2026-11-01 §4). */
2380
2387
  sessionControl: "assistant_session_control",
2388
+ /** Request / status / cancel the assistant's own project file transfers (owner approves in the dashboard; file-transfer design section 6). */
2389
+ fileTransfer: "assistant_file_transfer",
2381
2390
  // assistant-side daemon verbs without a tool of the same name
2382
2391
  launch: "launch_assistant",
2383
2392
  pendingRelays: "assistant_pending_relays",
@@ -2419,9 +2428,10 @@ var ASSISTANT_TOOL_VERBS = {
2419
2428
  artifact_read: ASSISTANT_VERB.artifactRead,
2420
2429
  decision_answer: ASSISTANT_VERB.decisionAnswer,
2421
2430
  decision_request: ASSISTANT_VERB.decisionRequest,
2422
- session_control: ASSISTANT_VERB.sessionControl
2431
+ session_control: ASSISTANT_VERB.sessionControl,
2432
+ file_transfer: ASSISTANT_VERB.fileTransfer
2423
2433
  };
2424
- var ASSISTANT_WRITE_TOOLS = ["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"];
2434
+ var ASSISTANT_WRITE_TOOLS = ["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"];
2425
2435
  var ASSISTANT_OWNER_VERBS = [
2426
2436
  ASSISTANT_VERB.executionSettings,
2427
2437
  ASSISTANT_VERB.stagedResolve,
@@ -3723,7 +3733,7 @@ function decodeQueueRequeueRequest(value) {
3723
3733
  return isQueueRequeueRequest(value) ? value : null;
3724
3734
  }
3725
3735
  function isQueueRequeueResponse(value) {
3726
- return isRecord(value) && hasOnlyKeys2(value, ["task"]) && (value.task === null || isQueueEntryWire(value.task));
3736
+ return isRecord(value) && hasOnlyKeys2(value, ["task", "quotaOverrideRequested"]) && (value.task === null || isQueueEntryWire(value.task)) && (value.quotaOverrideRequested === void 0 || isRecord(value.quotaOverrideRequested) && typeof value.quotaOverrideRequested.decisionId === "string");
3727
3737
  }
3728
3738
  function decodeQueueRequeueResponse(value) {
3729
3739
  return isQueueRequeueResponse(value) ? value : null;
@@ -3788,8 +3798,9 @@ function decodeRecoveryContextQueryResponse(value) {
3788
3798
  return isRecoveryContextQueryResponse(value) ? value : null;
3789
3799
  }
3790
3800
  function decodeQueueReviseRequest(value) {
3791
- if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "taskId", "expectedRevision", "patch"]) || value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId) || !isEvidenceIdentifier(value.taskId) || !Number.isSafeInteger(value.expectedRevision) || value.expectedRevision < 0 || !isRecord(value.patch) || !Object.keys(value.patch).length || !hasOnlyKeys2(value.patch, ["message", "ownedPaths", "phase", "dependsOn", "routingPreferences", "review"])) return null;
3801
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "taskId", "expectedRevision", "patch"]) || value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId) || !isEvidenceIdentifier(value.taskId) || !Number.isSafeInteger(value.expectedRevision) || value.expectedRevision < 0 || !isRecord(value.patch) || !Object.keys(value.patch).length || !hasOnlyKeys2(value.patch, ["message", "ownedPaths", "phase", "dependsOn", "routingPreferences", "review", "requestQuotaOverride"])) return null;
3792
3802
  const p = value.patch;
3803
+ if (p.requestQuotaOverride !== void 0 && (p.requestQuotaOverride !== true || Object.keys(p).length !== 1)) return null;
3793
3804
  if (p.message !== void 0 && (typeof p.message !== "string" || !p.message.trim())) return null;
3794
3805
  if (p.phase !== void 0 && p.phase !== "source" && p.phase !== "integration") return null;
3795
3806
  for (const key of ["ownedPaths", "dependsOn"]) {
@@ -4777,6 +4788,12 @@ var LIGHT_BLOCK_REASONS = [
4777
4788
  var LIGHT_WARNINGS = ["shared_checkout_changed_during_task", "light_base_dirty_overlap"];
4778
4789
  var LIGHT_LAND_MODES = ["refine", "apply_to_checkout"];
4779
4790
  var LIGHT_TESTS_RUN_MAX = 20;
4791
+ function isLightWorkerSession(session) {
4792
+ const s = session;
4793
+ if (!s || typeof s !== "object") return false;
4794
+ const has = (o) => !!o && typeof o === "object" && typeof o.lightWorkspaceId === "string" && o.lightWorkspaceId.trim() !== "";
4795
+ return has(s.settings) || has(s.launchRecord?.settings) || has(s);
4796
+ }
4780
4797
 
4781
4798
  // src/relay-reprobe.ts
4782
4799
  var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
@@ -5343,6 +5360,7 @@ function formatStageVerdictLine(input) {
5343
5360
  VIEWER_TO_SHARED_SESSION_TYPES,
5344
5361
  WORKER_BRANCH_STATES,
5345
5362
  WORKER_COMMITS_MAX,
5363
+ WORKER_CURRENT_BRANCH_RULE,
5346
5364
  WORKER_DECISIONS_NEEDED_MAX,
5347
5365
  WORKER_PROTOCOL_FOOTER_MARKER,
5348
5366
  WORKER_REPORT_OUTCOMES,
@@ -5474,6 +5492,7 @@ function formatStageVerdictLine(input) {
5474
5492
  isInputEnvelopeWire,
5475
5493
  isLaunchDefaultRole,
5476
5494
  isLaunchDefaultSource,
5495
+ isLightWorkerSession,
5477
5496
  isMeshDeliveryMode,
5478
5497
  isMeshIndexQueryResponse,
5479
5498
  isMeshMissionStatusValue,