@adhdev/daemon-standalone 0.9.82-rc.292 → 0.9.82-rc.293

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
@@ -29983,10 +29983,10 @@ var require_dist3 = __commonJS({
29983
29983
  }
29984
29984
  function getDaemonBuildInfo() {
29985
29985
  if (cached2) return cached2;
29986
- const commit = readInjected(true ? "7b5b620e2df42c7c3beb8a2983e3cc076c25f832" : void 0) ?? "unknown";
29987
- const commitShort = readInjected(true ? "7b5b620e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
29988
- const version2 = readInjected(true ? "0.9.82-rc.292" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
29989
- const builtAt = readInjected(true ? "2026-06-16T09:16:52.266Z" : void 0);
29986
+ const commit = readInjected(true ? "88f97abcc85d83fe5d5313b229d32a7d76b1208a" : void 0) ?? "unknown";
29987
+ const commitShort = readInjected(true ? "88f97abc" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
29988
+ const version2 = readInjected(true ? "0.9.82-rc.293" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
29989
+ const builtAt = readInjected(true ? "2026-06-16T11:14:20.929Z" : void 0);
29990
29990
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
29991
29991
  return cached2;
29992
29992
  }
@@ -30055,6 +30055,15 @@ var require_dist3 = __commonJS({
30055
30055
  );
30056
30056
  }
30057
30057
  }
30058
+ function isNonRuntimeRootFile(file2) {
30059
+ const base = file2.slice(file2.lastIndexOf("/") + 1);
30060
+ if (/^\.(?:verify|marker|converge|ff-verify|patch-equiv|live-verify)\b/i.test(base)) return true;
30061
+ if (/(?:^|\/)docs\//i.test(file2)) return true;
30062
+ if (/^(?:README|CHANGELOG|LICENSE|NOTICE|AUTHORS|CONTRIBUTING|CODEOWNERS)(?:\.[A-Za-z0-9]+)?$/i.test(base)) {
30063
+ return true;
30064
+ }
30065
+ return false;
30066
+ }
30058
30067
  async function classifyDaemonBuildChange(repoPath, buildCommit, options) {
30059
30068
  try {
30060
30069
  const diff = await runGit(repoPath, ["diff", "--name-only", `${buildCommit}..HEAD`], options);
@@ -30063,18 +30072,18 @@ var require_dist3 = __commonJS({
30063
30072
  return { isDaemonAffecting: true, affectedPackages: [] };
30064
30073
  }
30065
30074
  const pkgs = /* @__PURE__ */ new Set();
30066
- let sawNonPackageOrUnknown = false;
30075
+ let sawRuntimeAmbiguousNonPackage = false;
30067
30076
  for (const file2 of files) {
30068
30077
  const match = file2.match(/(?:^|\/)packages\/([^/]+)\//);
30069
30078
  if (!match) {
30070
- sawNonPackageOrUnknown = true;
30079
+ if (!isNonRuntimeRootFile(file2)) sawRuntimeAmbiguousNonPackage = true;
30071
30080
  continue;
30072
30081
  }
30073
30082
  pkgs.add(match[1]);
30074
30083
  }
30075
30084
  const affectedPackages = [...pkgs].sort();
30076
- const allWebOnly = !sawNonPackageOrUnknown && affectedPackages.length > 0 && affectedPackages.every((p) => WEB_ONLY_PACKAGES.has(p) && !DAEMON_RUNTIME_PACKAGES.has(p));
30077
- return { isDaemonAffecting: !allWebOnly, affectedPackages };
30085
+ const allBenign = !sawRuntimeAmbiguousNonPackage && affectedPackages.every((p) => WEB_ONLY_PACKAGES.has(p) && !DAEMON_RUNTIME_PACKAGES.has(p));
30086
+ return { isDaemonAffecting: !allBenign, affectedPackages };
30078
30087
  } catch {
30079
30088
  return { isDaemonAffecting: true, affectedPackages: [] };
30080
30089
  }
@@ -30101,7 +30110,8 @@ var require_dist3 = __commonJS({
30101
30110
  options
30102
30111
  );
30103
30112
  const scopeLabel = scope === "root" ? "workspace" : scope;
30104
- const warning = isDaemonAffecting ? `Live daemon was built from ${build.commitShort} which is behind ${scopeLabel} HEAD ${head.slice(0, 7)}. Merged code is NOT live until the daemon is rebuilt/redeployed and restarted \u2014 a local dist rebuild alone does not update a cloud daemon.` : `Live daemon was built from ${build.commitShort} which is behind ${scopeLabel} HEAD ${head.slice(0, 7)}, but only web packages changed (${(affectedPackages || []).join(", ") || "web"}). Daemon restart NOT required \u2014 redeploy the web app to reflect the change.`;
30113
+ const benignDetail = affectedPackages.length > 0 ? `only web packages changed (${affectedPackages.join(", ")})` : "only non-runtime files changed (markers/docs)";
30114
+ const warning = isDaemonAffecting ? `Live daemon was built from ${build.commitShort} which is behind ${scopeLabel} HEAD ${head.slice(0, 7)}. Merged code is NOT live until the daemon is rebuilt/redeployed and restarted \u2014 a local dist rebuild alone does not update a cloud daemon.` : `Live daemon was built from ${build.commitShort} which is behind ${scopeLabel} HEAD ${head.slice(0, 7)}, but ${benignDetail}. Daemon restart NOT required \u2014 redeploy the web app to reflect the change.`;
30105
30115
  return {
30106
30116
  buildCommit: build.commit,
30107
30117
  buildCommitShort: build.commitShort,
@@ -31713,7 +31723,7 @@ ${rules.join("\n")}`;
31713
31723
  - **Reuse idle sessions.** For follow-up, retry, commit/push, or cleanup on the same issue, send only the delta to the existing idle session. Start fresh only for independent work, provider mismatch, transcript contamination, or required worktree isolation.
31714
31724
  - **Respect explicit provider requests.** Map: Hermes \u2192 \`hermes-cli\`, Claude/Claude Code \u2192 \`claude-cli\`, Codex \u2192 \`codex-cli\`, Gemini \u2192 \`gemini-cli\`, Antigravity \u2192 \`antigravity-cli\`. Never substitute the coordinator's own runtime.
31715
31725
  - **Verify via git, not source.** Use \`mesh_git_status\` to confirm side effects. Treat agent summaries as self-reports, not verification.
31716
- - **Limit parallelism.** Start with 1\u20132 tasks; scale only on success. Never duplicate a session because \`mesh_read_chat\` shows no final message while tool/terminal activity is ongoing.
31726
+ - **Limit parallelism.** Start with 1\u20132 tasks; scale only on success. Never duplicate a session because \`mesh_read_chat\` shows no final message while tool/terminal activity is ongoing. This caps *concurrent* load \u2014 it does not mean serialize independent work: when a new, independent request arrives and there is headroom under \`maxParallelTasks\`, dispatch it right away rather than waiting for an in-flight task or a user nudge (read-only diagnosis especially, since it has no merge cost).
31717
31727
  - **Check history first.** Call \`mesh_task_history\` at session start to avoid duplicate work and inform recovery. On failure, read task history before retrying.
31718
31728
  - **Converge branches.** After worktree tasks: refine/fast-forward, or classify as \`pushed_feature_branch_needs_merge\` / \`blocked_review\` / \`cleanup_candidate\` / \`not_mergeable\`. Clean up with \`mesh_remove_node\`.
31719
31729
  - **Refinery is config-driven.** \`mesh_refine_node\` must run validation from \`.adhdev/refine.{json,yaml,yml}\` or \`repo-mesh.refine.*\`. Heuristics are scaffolding only.
@@ -31772,7 +31782,7 @@ Before doing any coordinator work, confirm that the actual callable tool list in
31772
31782
  c. **Targeted Tasks**: Use \`mesh_send_task\` only when you need to bypass the queue and force a specific node to execute a task immediately.
31773
31783
  d. For the first dispatch of a new task, provide a **complete, self-contained** instruction that includes all context the agent needs (file paths, line numbers, what to change, why). Do not send partial instructions expecting future follow-up.
31774
31784
  e. For a continuation of the same issue in an existing session, send a concise **delta instruction**: current verified state, the exact failed/blocked step, the newly approved action, and final reporting requirements. Do not resend the full original task or open a new chat solely to continue the same work; that wastes coordinator and worker context.
31775
- 4. **Monitor** \u2014 Prefer event-driven completion/status notifications. Do **not** poll \`mesh_read_chat\` repeatedly. Do **not** repeatedly call \`mesh_status\` or \`mesh_view_queue\` just to wait for assigned/generating work. After dispatching a direct or queued task, send one progress update with the task/session handle, then stop. Wait for \`pendingCoordinatorEvents\` or another completion/approval/status signal, an explicit user status request, or a real timeout/stall signal before reading status/chat/queue again. Use at most one compact \`mesh_read_chat\` check after a terminal signal. Handle approvals via \`mesh_approve\`.
31785
+ 4. **Monitor** \u2014 Prefer event-driven completion/status notifications. Do **not** poll \`mesh_read_chat\` repeatedly. Do **not** repeatedly call \`mesh_status\` or \`mesh_view_queue\` just to wait for assigned/generating work. After dispatching a direct or queued task, send one progress update with the task/session handle, then stop. Wait for \`pendingCoordinatorEvents\` or another completion/approval/status signal, an explicit user status request, or a real timeout/stall signal before reading status/chat/queue again. Use at most one compact \`mesh_read_chat\` check after a terminal signal. Handle approvals via \`mesh_approve\`. **Proactively parallelize new work.** When the user reports a new bug or asks for new work, start it immediately if it is independent of in-flight tasks and there is headroom under \`maxParallelTasks\` \u2014 do not wait for a current task to finish or for the user to prompt you to parallelize. Read-only diagnosis (\`live_debug_readonly\`) has no isolation or merge cost, so dispatch it in parallel right away. The no-polling / concurrency-limit rules constrain *re-checking or duplicating already-dispatched work*; they are **not** a reason to defer starting a new, independent task.
31776
31786
  5. **Verify** \u2014 When a task reports completion or git work is visible, call \`mesh_git_status\` to verify changes were made.
31777
31787
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
31778
31788
  7. **Converge branches** \u2014 Before marking any task complete, classify every touched node/branch into exactly one final state: \`merged_to_main\`, \`pushed_feature_branch_needs_merge\`, \`blocked_review\`, \`cleanup_candidate\`, or \`not_mergeable\`. Use \`mesh_status\` branchConvergenceSummary. For obvious clean branch catch-up (ahead 0, behind > 0, upstream fresh, no dirty/stash/submodule issues), use \`mesh_fast_forward_node\` dry-run first and execute only when explicitly safe/approved; this avoids consuming an agent session. Use \`mesh_refine_node\` for clean worktree branches when safe. Before/refine merging root commits that contain submodule gitlink changes, require each submodule commit to be reachable from the configured submodule remote main branch, not merely present on a feature ref or local checkout. If \`mesh_refine_node\` returns \`submodule_reachability_failed\` or publish-required evidence, keep the public convergence bucket as \`blocked_review\`; unless \`allowAutoPublishSubmoduleMainCommits\` is explicitly enabled and Refinery reports successful non-force publish plus post-publish verification, ask the user for explicit approval to push/publish the unreachable submodule commit(s) to submodule main, then rerun \`mesh_refine_node\`. Do not merge the root branch until the submodule commit(s) are reachable from submodule origin/main. A task that remains on a non-main branch is not fully complete unless the final report names the follow-up state and next step.
@@ -34138,11 +34148,40 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
34138
34148
  ).get(meshId);
34139
34149
  return row?.cnt ?? 0;
34140
34150
  }
34151
+ /**
34152
+ * Mark specific pending-event rows drained by id (ack). Used by the
34153
+ * unresolved-delegate durable-forward outbox: an event is peeked (not drained)
34154
+ * while its push to the coordinator is unconfirmed, then marked drained ONLY
34155
+ * after the push is acked. A failed push leaves the row undrained so the next
34156
+ * reconcile tick retries it. Returns the number of rows newly marked drained.
34157
+ */
34158
+ markPendingEventsDrainedById(ids) {
34159
+ const idList = ids.filter((id) => typeof id === "string" && id.length > 0);
34160
+ if (idList.length === 0) return 0;
34161
+ const now = Date.now();
34162
+ return this.db.prepare(
34163
+ `UPDATE mesh_pending_events SET drained = 1, drained_at = ? WHERE drained = 0 AND id IN (${idList.map(() => "?").join(",")})`
34164
+ ).run(now, ...idList).changes;
34165
+ }
34166
+ /**
34167
+ * Hard-delete pending-event rows by id (including the dedup fingerprint history).
34168
+ * Used to expire an unresolved-delegate outbox entry that has exhausted its retry
34169
+ * budget — fully removing it frees the fingerprint so a genuinely new completion
34170
+ * for the same task could be re-queued later. Returns the number of rows deleted.
34171
+ */
34172
+ deletePendingEventsById(ids) {
34173
+ const idList = ids.filter((id) => typeof id === "string" && id.length > 0);
34174
+ if (idList.length === 0) return 0;
34175
+ return this.db.prepare(
34176
+ `DELETE FROM mesh_pending_events WHERE id IN (${idList.map(() => "?").join(",")})`
34177
+ ).run(...idList).changes;
34178
+ }
34141
34179
  };
34142
34180
  }
34143
34181
  });
34144
34182
  var mesh_missions_exports = {};
34145
34183
  __export2(mesh_missions_exports, {
34184
+ GOAL_PREVIEW_MAX: () => GOAL_PREVIEW_MAX,
34146
34185
  MESH_MISSION_STATUSES: () => MESH_MISSION_STATUSES,
34147
34186
  buildMissionPromptSection: () => buildMissionPromptSection,
34148
34187
  getActiveMeshMissionSummaries: () => getActiveMeshMissionSummaries,
@@ -34214,12 +34253,23 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
34214
34253
  function getActiveMeshMissionSummaries(meshId) {
34215
34254
  return getMeshMissions(meshId, ["active"]).map((mission) => summarizeMeshMission(meshId, mission));
34216
34255
  }
34256
+ function slimMissionSummary(summary) {
34257
+ const goal = typeof summary.goal === "string" ? summary.goal : "";
34258
+ const goalTruncated = goal.length > GOAL_PREVIEW_MAX;
34259
+ const { goal: _omitGoal, ...rest } = summary;
34260
+ return {
34261
+ ...rest,
34262
+ goalPreview: goalTruncated ? goal.slice(0, GOAL_PREVIEW_MAX) : goal,
34263
+ goalTruncated
34264
+ };
34265
+ }
34217
34266
  function getMeshStatusMissionSummaries(meshId, options) {
34218
34267
  const historyLimit = Math.max(0, options?.historyLimit ?? 10);
34219
34268
  const all = getMeshMissions(meshId);
34220
34269
  const live = all.filter((m) => m.status === "active" || m.status === "paused");
34221
34270
  const history = all.filter((m) => m.status === "completed" || m.status === "abandoned").sort((a, b) => (b.updatedAt || "").localeCompare(a.updatedAt || "")).slice(0, historyLimit);
34222
- return [...live, ...history].map((mission) => summarizeMeshMission(meshId, mission));
34271
+ const full = [...live, ...history].map((mission) => summarizeMeshMission(meshId, mission));
34272
+ return options?.verbose ? full : full.map(slimMissionSummary);
34223
34273
  }
34224
34274
  function buildMissionPromptSection(meshId) {
34225
34275
  const summaries = getActiveMeshMissionSummaries(meshId);
@@ -34241,6 +34291,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
34241
34291
  }
34242
34292
  var import_crypto6;
34243
34293
  var MESH_MISSION_STATUSES;
34294
+ var GOAL_PREVIEW_MAX;
34244
34295
  var init_mesh_missions = __esm2({
34245
34296
  "src/mesh/mesh-missions.ts"() {
34246
34297
  "use strict";
@@ -34248,6 +34299,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
34248
34299
  init_mesh_runtime_store();
34249
34300
  init_mesh_work_queue();
34250
34301
  MESH_MISSION_STATUSES = ["active", "paused", "completed", "abandoned"];
34302
+ GOAL_PREVIEW_MAX = 120;
34251
34303
  }
34252
34304
  });
34253
34305
  function readString3(value) {
@@ -37363,6 +37415,111 @@ Next step: ${nextStep}`;
37363
37415
  recentUnroutableDiagnostics = /* @__PURE__ */ new Map();
37364
37416
  }
37365
37417
  });
37418
+ function getStore() {
37419
+ try {
37420
+ return MeshRuntimeStore.getInstance();
37421
+ } catch {
37422
+ return void 0;
37423
+ }
37424
+ }
37425
+ function enqueueUnresolvedDelegateForward(coordinatorDaemonId, eventName, forwardPayload) {
37426
+ const target = readNonEmptyString2(coordinatorDaemonId);
37427
+ const event = readNonEmptyString2(eventName);
37428
+ if (!target || !event) return false;
37429
+ const store = getStore();
37430
+ if (!store) return false;
37431
+ const queuedAt = Date.now();
37432
+ const fingerprintSource = {
37433
+ event,
37434
+ meshId: UNRESOLVED_FORWARD_OUTBOX_MESH_ID,
37435
+ nodeLabel: readNonEmptyString2(forwardPayload.nodeId) || readNonEmptyString2(forwardPayload.workspace) || "unresolved-delegate",
37436
+ nodeId: readNonEmptyString2(forwardPayload.nodeId) || void 0,
37437
+ workspace: readNonEmptyString2(forwardPayload.workspace) || void 0,
37438
+ metadataEvent: forwardPayload,
37439
+ queuedAt,
37440
+ targetCoordinatorDaemonId: target
37441
+ };
37442
+ const fingerprint = `${target}::${buildPendingEventFingerprint(fingerprintSource)}`;
37443
+ try {
37444
+ const inserted = store.insertPendingEvent({
37445
+ id: (0, import_crypto9.randomUUID)(),
37446
+ meshId: UNRESOLVED_FORWARD_OUTBOX_MESH_ID,
37447
+ coordinatorDaemonId: target,
37448
+ event,
37449
+ // Store the flat forward payload + the queue timestamp so the retry tick can
37450
+ // rebuild the push args and apply age-based expiry without a schema change.
37451
+ payload: { forwardPayload, coordinatorDaemonId: target, queuedAt },
37452
+ fingerprint,
37453
+ queuedAt
37454
+ });
37455
+ if (inserted) {
37456
+ LOG2.info("MeshEvents", `Durably queued unresolved-delegate ${event} for coordinator ${target} (outbox)`);
37457
+ }
37458
+ return true;
37459
+ } catch (e) {
37460
+ LOG2.warn("MeshEvents", `Failed to persist unresolved-delegate forward to outbox: ${e?.message || e}`);
37461
+ return false;
37462
+ }
37463
+ }
37464
+ function peekUnresolvedDelegateForwards() {
37465
+ const store = getStore();
37466
+ if (!store) return [];
37467
+ let rows;
37468
+ try {
37469
+ rows = store.peekPendingEvents(UNRESOLVED_FORWARD_OUTBOX_MESH_ID);
37470
+ } catch {
37471
+ return [];
37472
+ }
37473
+ const out = [];
37474
+ for (const row of rows) {
37475
+ const stored = row.payload && typeof row.payload === "object" ? row.payload : {};
37476
+ const coordinatorDaemonId = readNonEmptyString2(stored.coordinatorDaemonId);
37477
+ const forwardPayload = stored.forwardPayload && typeof stored.forwardPayload === "object" ? stored.forwardPayload : void 0;
37478
+ if (!coordinatorDaemonId || !forwardPayload) continue;
37479
+ const queuedAt = typeof stored.queuedAt === "number" ? stored.queuedAt : 0;
37480
+ out.push({ id: row.id, coordinatorDaemonId, payload: forwardPayload, queuedAt });
37481
+ }
37482
+ return out;
37483
+ }
37484
+ function ackUnresolvedDelegateForward(id) {
37485
+ const store = getStore();
37486
+ if (!store) return;
37487
+ try {
37488
+ store.markPendingEventsDrainedById([id]);
37489
+ } catch {
37490
+ }
37491
+ }
37492
+ function expireStaleUnresolvedDelegateForwards(nowMs = Date.now()) {
37493
+ const entries = peekUnresolvedDelegateForwards();
37494
+ const staleIds = entries.filter((e) => e.queuedAt > 0 && nowMs - e.queuedAt >= UNRESOLVED_FORWARD_MAX_AGE_MS).map((e) => e.id);
37495
+ if (staleIds.length === 0) return 0;
37496
+ const store = getStore();
37497
+ if (!store) return 0;
37498
+ try {
37499
+ const removed = store.deletePendingEventsById(staleIds);
37500
+ if (removed > 0) {
37501
+ LOG2.warn("MeshEvents", `Expired ${removed} unresolved-delegate forward(s) after ${Math.round(UNRESOLVED_FORWARD_MAX_AGE_MS / 6e4)}m of failed retries \u2014 coordinator unreachable, completion dropped`);
37502
+ }
37503
+ return removed;
37504
+ } catch {
37505
+ return 0;
37506
+ }
37507
+ }
37508
+ var import_crypto9;
37509
+ var UNRESOLVED_FORWARD_OUTBOX_MESH_ID;
37510
+ var UNRESOLVED_FORWARD_MAX_AGE_MS;
37511
+ var init_mesh_unresolved_forward_outbox = __esm2({
37512
+ "src/mesh/mesh-unresolved-forward-outbox.ts"() {
37513
+ "use strict";
37514
+ import_crypto9 = require("crypto");
37515
+ init_logger();
37516
+ init_mesh_runtime_store();
37517
+ init_mesh_events_pending();
37518
+ init_mesh_events_utils();
37519
+ UNRESOLVED_FORWARD_OUTBOX_MESH_ID = "__unresolved_forward_outbox__";
37520
+ UNRESOLVED_FORWARD_MAX_AGE_MS = 30 * 60 * 1e3;
37521
+ }
37522
+ });
37366
37523
  function resolveCoordinatorDrainDaemonIds(components) {
37367
37524
  const ids = /* @__PURE__ */ new Set();
37368
37525
  const statusInstanceId = readNonEmptyString2(components.statusInstanceId);
@@ -38496,12 +38653,25 @@ Next step: ${nextStep}`;
38496
38653
  nodeId: readNonEmptyString2(routing.nodeId) || readNonEmptyString2(event.meshNodeId) || void 0,
38497
38654
  workspace: readNonEmptyString2(routing.workspace) || readNonEmptyString2(event.workspace) || void 0
38498
38655
  };
38499
- Promise.resolve(components.dispatchMeshCommand(coordinatorDaemonId, "mesh_forward_event", payload)).catch((e) => {
38500
- LOG2.warn("MeshEvents", `Fallback forward of ${eventName} to coordinator ${coordinatorDaemonId} failed: ${e?.message || e}`);
38656
+ const persisted = enqueueUnresolvedDelegateForward(coordinatorDaemonId, eventName, payload);
38657
+ Promise.resolve(components.dispatchMeshCommand(coordinatorDaemonId, "mesh_forward_event", payload)).then((result) => {
38658
+ if (result && result.success === false) {
38659
+ LOG2.warn("MeshEvents", `Immediate forward of ${eventName} to coordinator ${coordinatorDaemonId} rejected (${readNonEmptyString2(result.error) || "no reason"}) \u2014 left queued for retry`);
38660
+ return;
38661
+ }
38662
+ if (persisted) ackUnresolvedDelegateForwardByFingerprint(coordinatorDaemonId, eventName, payload);
38663
+ }).catch((e) => {
38664
+ LOG2.warn("MeshEvents", `Immediate forward of ${eventName} to coordinator ${coordinatorDaemonId} failed: ${e?.message || e} \u2014 left queued for retry`);
38501
38665
  });
38502
- LOG2.info("MeshEvents", `Fallback-forwarded ${eventName} for unresolved-mesh worker at ${routing.workspace || "(no workspace)"} to coordinator daemon ${coordinatorDaemonId}`);
38666
+ LOG2.info("MeshEvents", `Durably forwarded ${eventName} for unresolved-mesh worker at ${routing.workspace || "(no workspace)"} to coordinator daemon ${coordinatorDaemonId}`);
38503
38667
  return true;
38504
38668
  }
38669
+ function ackUnresolvedDelegateForwardByFingerprint(coordinatorDaemonId, eventName, payload) {
38670
+ const match = peekUnresolvedDelegateForwards().find(
38671
+ (entry) => entry.coordinatorDaemonId === coordinatorDaemonId && readNonEmptyString2(entry.payload.event) === eventName && readNonEmptyString2(entry.payload.targetSessionId || entry.payload.sessionId || entry.payload.instanceId) === readNonEmptyString2(payload.targetSessionId || payload.sessionId || payload.instanceId) && readNonEmptyString2(entry.payload.workspace) === readNonEmptyString2(payload.workspace)
38672
+ );
38673
+ if (match) ackUnresolvedDelegateForward(match.id);
38674
+ }
38505
38675
  function setupMeshEventForwarding(components) {
38506
38676
  components.instanceManager.onEvent((event) => {
38507
38677
  if (event.event === "agent:ready" || event.event === "agent:generating_completed") {
@@ -38596,6 +38766,7 @@ Next step: ${nextStep}`;
38596
38766
  init_mesh_runtime_store();
38597
38767
  init_mesh_events_pending();
38598
38768
  init_mesh_routing();
38769
+ init_mesh_unresolved_forward_outbox();
38599
38770
  init_repo_mesh_types();
38600
38771
  init_dist();
38601
38772
  init_mesh_events_stale();
@@ -38709,6 +38880,13 @@ Next step: ${nextStep}`;
38709
38880
  return void 0;
38710
38881
  }
38711
38882
  })();
38883
+ if (dispatchMeshCommand) {
38884
+ try {
38885
+ await retryUnresolvedDelegateForwards(components);
38886
+ } catch (e) {
38887
+ LOG2.warn("MeshReconcile", `Unresolved-delegate forward retry failed: ${e?.message || e}`);
38888
+ }
38889
+ }
38712
38890
  if (dispatchMeshCommand) {
38713
38891
  for (const mesh of listMeshes()) {
38714
38892
  const selfIds = resolveCoordinatorSelfIds(mesh, drainDaemonIds);
@@ -38762,6 +38940,28 @@ Next step: ${nextStep}`;
38762
38940
  }
38763
38941
  }
38764
38942
  }
38943
+ async function retryUnresolvedDelegateForwards(components) {
38944
+ const dispatchMeshCommand = components.dispatchMeshCommand;
38945
+ if (!dispatchMeshCommand) return;
38946
+ expireStaleUnresolvedDelegateForwards();
38947
+ const entries = peekUnresolvedDelegateForwards();
38948
+ if (entries.length === 0) return;
38949
+ for (const entry of entries) {
38950
+ let result;
38951
+ try {
38952
+ result = await dispatchMeshCommand(entry.coordinatorDaemonId, "mesh_forward_event", entry.payload);
38953
+ } catch (e) {
38954
+ LOG2.warn("MeshReconcile", `Retry forward to coordinator ${entry.coordinatorDaemonId} failed: ${e?.message || e} \u2014 left queued`);
38955
+ continue;
38956
+ }
38957
+ if (result && result.success === false) {
38958
+ LOG2.warn("MeshReconcile", `Retry forward to coordinator ${entry.coordinatorDaemonId} rejected (${readNonEmptyString2(result.error) || "no reason"}) \u2014 left queued`);
38959
+ continue;
38960
+ }
38961
+ ackUnresolvedDelegateForward(entry.id);
38962
+ LOG2.info("MeshReconcile", `Retried+delivered unresolved-delegate ${readNonEmptyString2(entry.payload.event)} to coordinator ${entry.coordinatorDaemonId}`);
38963
+ }
38964
+ }
38765
38965
  async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDaemonIds) {
38766
38966
  const dispatchMeshCommand = components.dispatchMeshCommand;
38767
38967
  if (!dispatchMeshCommand) return;
@@ -38838,6 +39038,7 @@ Next step: ${nextStep}`;
38838
39038
  init_mesh_events_pending();
38839
39039
  init_mesh_runtime_store();
38840
39040
  init_mesh_events_coordinator();
39041
+ init_mesh_unresolved_forward_outbox();
38841
39042
  init_mesh_events_utils();
38842
39043
  DEFAULT_RECONCILE_INTERVAL_MS = 4e3;
38843
39044
  }
@@ -52018,7 +52219,7 @@ ${cleanBody}`;
52018
52219
  this.runtimeMessages = [];
52019
52220
  }
52020
52221
  updateSettings(newSettings) {
52021
- this.settings = { ...newSettings };
52222
+ this.settings = { ...this.settings, ...newSettings };
52022
52223
  this.monitor.updateConfig({
52023
52224
  approvalAlert: this.settings.approvalAlert !== false,
52024
52225
  longGeneratingAlert: this.settings.longGeneratingAlert !== false,
@@ -52675,7 +52876,7 @@ ${effect.notification.body || ""}`.trim();
52675
52876
  this.extensions.clear();
52676
52877
  }
52677
52878
  updateSettings(newSettings) {
52678
- this.settings = { ...newSettings };
52879
+ this.settings = { ...this.settings, ...newSettings };
52679
52880
  this.monitor.updateConfig({
52680
52881
  approvalAlert: this.settings.approvalAlert !== false,
52681
52882
  longGeneratingAlert: this.settings.longGeneratingAlert !== false,
@@ -62145,22 +62346,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
62145
62346
  };
62146
62347
  }
62147
62348
  updateSettings(newSettings) {
62148
- const runtimeMeshSettings = {};
62149
- for (const key of [
62150
- "meshNodeFor",
62151
- "meshNodeId",
62152
- "meshActiveTaskId",
62153
- "meshCoordinatorFor",
62154
- "meshCoordinatorDaemonId",
62155
- "meshCoordinatorNodeId",
62156
- "spawnedSessionVisibility",
62157
- "launchedByCoordinator"
62158
- ]) {
62159
- if (this.settings[key] !== void 0 && newSettings[key] === void 0) {
62160
- runtimeMeshSettings[key] = this.settings[key];
62161
- }
62162
- }
62163
- this.settings = { ...newSettings, ...runtimeMeshSettings };
62349
+ this.settings = { ...this.settings, ...newSettings };
62164
62350
  this.adapter.updateRuntimeSettings?.(this.settings);
62165
62351
  this.monitor.updateConfig({
62166
62352
  approvalAlert: this.settings.approvalAlert !== false,
@@ -76164,9 +76350,9 @@ ${hintLines.join("\n")}` : "",
76164
76350
  });
76165
76351
  let node;
76166
76352
  if (meshRecord.inline) {
76167
- const { randomUUID: randomUUID14 } = await import("crypto");
76353
+ const { randomUUID: randomUUID15 } = await import("crypto");
76168
76354
  node = {
76169
- id: `node_${randomUUID14().replace(/-/g, "")}`,
76355
+ id: `node_${randomUUID15().replace(/-/g, "")}`,
76170
76356
  workspace: result.worktreePath,
76171
76357
  repoRoot: result.worktreePath,
76172
76358
  daemonId: sourceNode.daemonId,
@@ -76940,10 +77126,11 @@ ${ptyResult.output.slice(-2e3)}`);
76940
77126
  if (!mesh) return { success: false, error: "Mesh not found" };
76941
77127
  const meshHost = resolveMeshHostStatus(mesh);
76942
77128
  const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
77129
+ const verboseMissions = args?.verbose === true || args?.compact === false;
76943
77130
  const peekScope = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : this.deps.statusInstanceId || void 0;
76944
77131
  const pendingCoordinatorEventCount = getPendingMeshCoordinatorEvents(meshId, peekScope).length;
76945
77132
  const hadAggregateCache = this.aggregateMeshStatusCache.has(meshId);
76946
- if (!refreshRequested && pendingCoordinatorEventCount === 0) {
77133
+ if (!refreshRequested && !verboseMissions && pendingCoordinatorEventCount === 0) {
76947
77134
  const cachedStatus = this.getCachedAggregateMeshStatus(meshId, mesh, { requireDirectPeerTruth: args?.requireDirectPeerTruth === true });
76948
77135
  if (cachedStatus) {
76949
77136
  logRepoMeshStatusDebug("return_cached", {
@@ -77246,7 +77433,7 @@ ${ptyResult.output.slice(-2e3)}`);
77246
77433
  liveSessionRecords: liveMeshSessions
77247
77434
  });
77248
77435
  const { getMeshStatusMissionSummaries: getMeshStatusMissionSummaries2 } = await Promise.resolve().then(() => (init_mesh_missions(), mesh_missions_exports));
77249
- const missions = getMeshStatusMissionSummaries2(meshId);
77436
+ const missions = getMeshStatusMissionSummaries2(meshId, { verbose: verboseMissions });
77250
77437
  const statusResult = {
77251
77438
  success: true,
77252
77439
  meshId: mesh.id,
@@ -77300,7 +77487,7 @@ ${ptyResult.output.slice(-2e3)}`);
77300
77487
  }))
77301
77488
  };
77302
77489
  const { pendingCoordinatorEvents: _pendingCoordinatorEvents, unroutableDeliveries: _unroutableDeliveries, ...cacheableStatusResult } = statusResult;
77303
- const rememberedStatus = this.rememberAggregateMeshStatus(meshId, cacheableStatusResult, refreshReason);
77490
+ const rememberedStatus = verboseMissions ? cacheableStatusResult : this.rememberAggregateMeshStatus(meshId, cacheableStatusResult, refreshReason);
77304
77491
  const returnedStatus = {
77305
77492
  ...rememberedStatus,
77306
77493
  ...pendingCoordinatorEvents.length > 0 ? { pendingCoordinatorEvents } : {},
@@ -84812,7 +84999,7 @@ data: ${JSON.stringify(msg.data)}
84812
84999
  });
84813
85000
  }
84814
85001
  };
84815
- var import_crypto9 = require("crypto");
85002
+ var import_crypto10 = require("crypto");
84816
85003
  var import_session_host_core10 = require_dist();
84817
85004
  var BASE_KEY_SEQUENCES = {
84818
85005
  enter: "\r",
@@ -84910,7 +85097,7 @@ data: ${JSON.stringify(msg.data)}
84910
85097
  const sessionId = String(options.sessionId || "").trim();
84911
85098
  if (!sessionId) throw new Error("sessionId is required");
84912
85099
  const mode = options.mode || "read";
84913
- const clientId = options.clientId || `raw-terminal-${process.pid}-${(0, import_crypto9.randomUUID)().slice(0, 8)}`;
85100
+ const clientId = options.clientId || `raw-terminal-${process.pid}-${(0, import_crypto10.randomUUID)().slice(0, 8)}`;
84914
85101
  const client = options.client || new import_session_host_core10.SessionHostClient({ endpoint: options.endpoint });
84915
85102
  await client.connect();
84916
85103
  const attachResponse = await client.request({