@adhdev/daemon-standalone 0.9.82-rc.371 → 0.9.82-rc.373

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
@@ -30036,10 +30036,10 @@ var require_dist3 = __commonJS({
30036
30036
  }
30037
30037
  function getDaemonBuildInfo() {
30038
30038
  if (cached2) return cached2;
30039
- const commit = readInjected(true ? "0e66043bc2858f114fbdd7b1edeb7774f33bfd2d" : void 0) ?? "unknown";
30040
- const commitShort = readInjected(true ? "0e66043b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
- const version2 = readInjected(true ? "0.9.82-rc.371" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
- const builtAt = readInjected(true ? "2026-06-24T12:30:40.845Z" : void 0);
30039
+ const commit = readInjected(true ? "f16b5e6cdf653b4258f8f44cb11fb6ad8c13329f" : void 0) ?? "unknown";
30040
+ const commitShort = readInjected(true ? "f16b5e6c" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
+ const version2 = readInjected(true ? "0.9.82-rc.373" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
+ const builtAt = readInjected(true ? "2026-06-24T16:29:42.060Z" : void 0);
30043
30043
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30044
30044
  return cached2;
30045
30045
  }
@@ -35318,7 +35318,14 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
35318
35318
  if (candidate.taskMode === "live_debug_readonly") return true;
35319
35319
  return !nodeBusy;
35320
35320
  };
35321
- const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && nodeConflictAllows(candidate));
35321
+ const nodeIsWorktree = opts?.nodeIsWorktree === true;
35322
+ const convergenceAllows = (candidate) => candidate.taskMode !== "convergence" || !nodeIsWorktree;
35323
+ const targetMatches = (candidate) => {
35324
+ if (candidate.targetSessionId && candidate.targetSessionId !== sessionId) return false;
35325
+ if (candidate.targetNodeId && candidate.targetNodeId !== nodeId) return false;
35326
+ return true;
35327
+ };
35328
+ const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && convergenceAllows(candidate) && targetMatches(candidate) && nodeConflictAllows(candidate));
35322
35329
  if (!entry) return null;
35323
35330
  const now = (/* @__PURE__ */ new Date()).toISOString();
35324
35331
  entry.status = "assigned";
@@ -42530,6 +42537,31 @@ ${cleanBody}`;
42530
42537
  }
42531
42538
  return "";
42532
42539
  }
42540
+ function resolveForwardEventMeshId(components, payload) {
42541
+ const direct = readNonEmptyString2(payload.meshId);
42542
+ if (direct) return direct;
42543
+ const workspace = readNonEmptyString2(payload.workspace);
42544
+ const byWorkspace = workspace ? readNonEmptyString2(getCachedMeshByWorkspace(workspace)?.id) : "";
42545
+ if (byWorkspace) return byWorkspace;
42546
+ const byNode = recoverMeshIdByNodeId(readNonEmptyString2(payload.nodeId));
42547
+ if (byNode) return byNode;
42548
+ const sessionId = readNonEmptyString2(payload.targetSessionId) || readNonEmptyString2(payload.sessionId) || readNonEmptyString2(payload.instanceId);
42549
+ if (sessionId) {
42550
+ try {
42551
+ const state = components.instanceManager?.getInstance?.(sessionId)?.getState?.();
42552
+ const settings = state?.settings || {};
42553
+ const meshNodeFor = readNonEmptyString2(settings.meshNodeFor);
42554
+ if (meshNodeFor) return meshNodeFor;
42555
+ const byStamp = recoverMeshIdByNodeId(readNonEmptyString2(settings.meshNodeId));
42556
+ if (byStamp) return byStamp;
42557
+ const sessionWorkspace = readNonEmptyString2(state?.workspace);
42558
+ const bySessionWorkspace = sessionWorkspace ? readNonEmptyString2(getCachedMeshByWorkspace(sessionWorkspace)?.id) : "";
42559
+ if (bySessionWorkspace) return bySessionWorkspace;
42560
+ } catch {
42561
+ }
42562
+ }
42563
+ return "";
42564
+ }
42533
42565
  function __resetIdleAutoFastForwardForTests() {
42534
42566
  idleAutoFastForwardLastAttempt.clear();
42535
42567
  }
@@ -42776,9 +42808,11 @@ ${cleanBody}`;
42776
42808
  }
42777
42809
  const capabilityTags = buildMeshNodeCapabilityTags(node, providerType);
42778
42810
  const providerMaxParallel = resolveProviderMaxParallel(node?.policy, providerType);
42811
+ const nodeIsWorktree = node?.isLocalWorktree === true;
42779
42812
  const task = claimNextTask(meshId, nodeId, sessionId, capabilityTags, {
42780
42813
  providerType,
42781
- ...providerMaxParallel !== void 0 ? { providerMaxParallel } : {}
42814
+ ...providerMaxParallel !== void 0 ? { providerMaxParallel } : {},
42815
+ nodeIsWorktree
42782
42816
  });
42783
42817
  if (!task) {
42784
42818
  return false;
@@ -43122,6 +43156,7 @@ ${cleanBody}`;
43122
43156
  }
43123
43157
  const candidateNodes = Array.isArray(mesh?.nodes) ? mesh.nodes.filter((node) => {
43124
43158
  if (task.targetNodeId && !meshNodeIdMatches(node, task.targetNodeId)) return false;
43159
+ if (task.taskMode === "convergence" && node?.isLocalWorktree === true) return false;
43125
43160
  if (task.requiredTags?.length) {
43126
43161
  const priorities = normalizeProviderPriority(node?.policy);
43127
43162
  const providerCandidates = priorities.length ? priorities : [void 0];
@@ -44105,6 +44140,8 @@ ${cleanBody}`;
44105
44140
  nodeId: readNonEmptyString2(routing.nodeId) || readNonEmptyString2(event.meshNodeId) || void 0,
44106
44141
  workspace: readNonEmptyString2(routing.workspace) || readNonEmptyString2(event.workspace) || void 0
44107
44142
  };
44143
+ const resolvedMeshId = resolveForwardEventMeshId(components, payload);
44144
+ if (resolvedMeshId) payload.meshId = resolvedMeshId;
44108
44145
  const selfDaemonIds = resolveCoordinatorDrainDaemonIds(components);
44109
44146
  if (selfDaemonIds.some((self) => daemonIdsEquivalent(self, coordinatorDaemonId))) {
44110
44147
  try {
@@ -44645,7 +44682,10 @@ ${cleanBody}`;
44645
44682
  if (!dispatchMeshCommand) return;
44646
44683
  expireStaleUnresolvedDelegateForwards();
44647
44684
  const entries = peekUnresolvedDelegateForwards();
44648
- if (entries.length === 0) return;
44685
+ if (entries.length === 0) {
44686
+ if (unresolvedForwardRejectionCounts.size > 0) unresolvedForwardRejectionCounts.clear();
44687
+ return;
44688
+ }
44649
44689
  const selfIds = resolveCoordinatorDaemonIds(components);
44650
44690
  const isSelfCoordinatorId = (id) => selfIds.some((self) => daemonIdsEquivalent(self, id));
44651
44691
  for (const entry of entries) {
@@ -44664,6 +44704,7 @@ ${cleanBody}`;
44664
44704
  LOG2.warn("MeshReconcile", `Local route of self-addressed forward to ${entry.coordinatorDaemonId} threw: ${e?.message || e} \u2014 draining anyway to break the retry loop`);
44665
44705
  }
44666
44706
  ackUnresolvedDelegateForward(entry.id);
44707
+ unresolvedForwardRejectionCounts.delete(entry.id);
44667
44708
  if (localResult && localResult.success === false) {
44668
44709
  LOG2.warn("MeshReconcile", `Self-addressed unresolved-delegate ${readNonEmptyString2(entry.payload.event)} rejected by local router (${readNonEmptyString2(localResult.error) || "no reason"}) \u2014 drained to break the self-forward retry loop`);
44669
44710
  traceMeshEventDrop("self_forward_local_rejected", entryTraceCtx, readNonEmptyString2(localResult.error) || "no reason");
@@ -44672,21 +44713,40 @@ ${cleanBody}`;
44672
44713
  }
44673
44714
  continue;
44674
44715
  }
44716
+ let pushPayload = entry.payload;
44717
+ if (!readNonEmptyString2(pushPayload.meshId)) {
44718
+ const recoveredMeshId = resolveForwardEventMeshId(components, pushPayload);
44719
+ if (recoveredMeshId) {
44720
+ pushPayload = { ...pushPayload, meshId: recoveredMeshId };
44721
+ traceMeshEventStage("forward_meshid_recovered", entryTraceCtx, `meshId=${recoveredMeshId}`);
44722
+ }
44723
+ }
44675
44724
  let result;
44676
44725
  try {
44677
44726
  traceMeshEventStage("forward_send", entryTraceCtx, `retry \u2192 ${entry.coordinatorDaemonId}`);
44678
- result = await dispatchMeshCommand(entry.coordinatorDaemonId, "mesh_forward_event", entry.payload);
44727
+ result = await dispatchMeshCommand(entry.coordinatorDaemonId, "mesh_forward_event", pushPayload);
44679
44728
  } catch (e) {
44680
44729
  LOG2.warn("MeshReconcile", `Retry forward to coordinator ${entry.coordinatorDaemonId} failed: ${e?.message || e} \u2014 left queued`);
44681
44730
  traceMeshEventDrop("retry_forward_failed", entryTraceCtx, e?.message || String(e));
44682
44731
  continue;
44683
44732
  }
44684
44733
  if (result && result.success === false) {
44685
- LOG2.warn("MeshReconcile", `Retry forward to coordinator ${entry.coordinatorDaemonId} rejected (${readNonEmptyString2(result.error) || "no reason"}) \u2014 left queued`);
44686
- traceMeshEventDrop("retry_forward_rejected", entryTraceCtx, readNonEmptyString2(result.error) || "no reason");
44734
+ const rejections = (unresolvedForwardRejectionCounts.get(entry.id) || 0) + 1;
44735
+ unresolvedForwardRejectionCounts.set(entry.id, rejections);
44736
+ const reason = readNonEmptyString2(result.error) || "no reason";
44737
+ if (rejections >= MAX_FORWARD_REJECTIONS) {
44738
+ ackUnresolvedDelegateForward(entry.id);
44739
+ unresolvedForwardRejectionCounts.delete(entry.id);
44740
+ LOG2.warn("MeshReconcile", `Retry forward to coordinator ${entry.coordinatorDaemonId} rejected ${rejections}x (${reason}) \u2014 dropping unresolved-delegate ${readNonEmptyString2(entry.payload.event)} (sess=${readNonEmptyString2(entry.payload.targetSessionId) || readNonEmptyString2(entry.payload.sessionId) || "-"}) to stop the retry loop`);
44741
+ traceMeshEventDrop("retry_forward_exhausted", entryTraceCtx, `${reason} (${rejections} rejections)`);
44742
+ } else {
44743
+ LOG2.warn("MeshReconcile", `Retry forward to coordinator ${entry.coordinatorDaemonId} rejected (${reason}) \u2014 left queued (attempt ${rejections}/${MAX_FORWARD_REJECTIONS})`);
44744
+ traceMeshEventDrop("retry_forward_rejected", entryTraceCtx, reason);
44745
+ }
44687
44746
  continue;
44688
44747
  }
44689
44748
  ackUnresolvedDelegateForward(entry.id);
44749
+ unresolvedForwardRejectionCounts.delete(entry.id);
44690
44750
  LOG2.info("MeshReconcile", `Retried+delivered unresolved-delegate ${readNonEmptyString2(entry.payload.event)} to coordinator ${entry.coordinatorDaemonId}`);
44691
44751
  }
44692
44752
  }
@@ -44917,6 +44977,8 @@ ${cleanBody}`;
44917
44977
  var heldEventLedgerRecorded;
44918
44978
  var ASSIGNED_STRANDED_DEADLINE_MS;
44919
44979
  var STRICT_SESSION_MATCH_TTL_MS;
44980
+ var unresolvedForwardRejectionCounts;
44981
+ var MAX_FORWARD_REJECTIONS;
44920
44982
  var init_mesh_reconcile_loop = __esm2({
44921
44983
  "src/mesh/mesh-reconcile-loop.ts"() {
44922
44984
  "use strict";
@@ -44941,6 +45003,8 @@ ${cleanBody}`;
44941
45003
  heldEventLedgerRecorded = /* @__PURE__ */ new Set();
44942
45004
  ASSIGNED_STRANDED_DEADLINE_MS = 5 * 6e4;
44943
45005
  STRICT_SESSION_MATCH_TTL_MS = 6e4;
45006
+ unresolvedForwardRejectionCounts = /* @__PURE__ */ new Map();
45007
+ MAX_FORWARD_REJECTIONS = 5;
44944
45008
  }
44945
45009
  });
44946
45010
  var mesh_events_exports = {};
@@ -50566,6 +50630,7 @@ ${lastSnapshot}`;
50566
50630
  buildMeshLedgerReplicaEvidence: () => buildMeshLedgerReplicaEvidence,
50567
50631
  buildMeshNodeCapabilityTags: () => buildMeshNodeCapabilityTags,
50568
50632
  buildMeshNodeDataFreshness: () => buildMeshNodeDataFreshness,
50633
+ buildMeshNodeProbeFreshness: () => buildMeshNodeProbeFreshness,
50569
50634
  buildMissionPromptSection: () => buildMissionPromptSection,
50570
50635
  buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
50571
50636
  buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
@@ -64418,6 +64483,27 @@ ${body}
64418
64483
  fs13.closeSync(fd);
64419
64484
  }
64420
64485
  }
64486
+ function splitLogLines(text) {
64487
+ const lines = text.split("\n");
64488
+ if (lines.length && lines[lines.length - 1] === "") lines.pop();
64489
+ return lines;
64490
+ }
64491
+ function takeLastLinesWithinBytes(lines, limitBytes) {
64492
+ if (lines.length === 0) return { kept: [], truncated: false, bytesReturned: 0 };
64493
+ let total = 0;
64494
+ let firstKept = lines.length;
64495
+ for (let i = lines.length - 1; i >= 0; i--) {
64496
+ const lineBytes = Buffer.byteLength(lines[i], "utf-8") + 1;
64497
+ if (firstKept !== lines.length && total + lineBytes > limitBytes) break;
64498
+ total += lineBytes;
64499
+ firstKept = i;
64500
+ }
64501
+ return {
64502
+ kept: lines.slice(firstKept),
64503
+ truncated: firstKept > 0,
64504
+ bytesReturned: total
64505
+ };
64506
+ }
64421
64507
  function parseLineEpochMs(line, fileDate) {
64422
64508
  const m = line.match(/^\[(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,3}))?\]/);
64423
64509
  if (!m) {
@@ -64432,47 +64518,97 @@ ${body}
64432
64518
  d.setHours(Number(m[1]), Number(m[2]), Number(m[3]), m[4] ? Number(m[4].padEnd(3, "0")) : 0);
64433
64519
  return d.getTime();
64434
64520
  }
64521
+ function buildGrepPredicate(grepSource) {
64522
+ let re = null;
64523
+ try {
64524
+ re = new RegExp(grepSource, "i");
64525
+ } catch {
64526
+ re = null;
64527
+ }
64528
+ if (re) {
64529
+ const compiled = re;
64530
+ return (line) => compiled.test(line);
64531
+ }
64532
+ const needle = grepSource.toLowerCase();
64533
+ return (line) => line.toLowerCase().includes(needle);
64534
+ }
64535
+ function fileDateFor(date5) {
64536
+ if (date5 instanceof Date) return date5;
64537
+ if (typeof date5 === "string" && date5.trim()) return /* @__PURE__ */ new Date(`${date5.trim()}T00:00:00.000Z`);
64538
+ return /* @__PURE__ */ new Date();
64539
+ }
64540
+ function errorResult(error48, logPath, platform10) {
64541
+ return {
64542
+ success: false,
64543
+ error: error48,
64544
+ lines: [],
64545
+ truncated: false,
64546
+ logPath,
64547
+ platform: platform10,
64548
+ bytesReturned: 0,
64549
+ filtered: false,
64550
+ fullScan: false,
64551
+ scannedBytes: 0,
64552
+ matchedLineCount: 0,
64553
+ excludedByFilter: 0
64554
+ };
64555
+ }
64435
64556
  function readDaemonLogTail(args = {}) {
64436
64557
  const platform10 = process.platform;
64437
64558
  const limitBytes = clampTailBytes(args.tailBytes);
64438
- let logPath = resolveLogPath(args.date);
64439
- if (!fs13.existsSync(logPath)) {
64440
- const backup = logPath.replace(/\.log$/, ".1.log");
64441
- if (fs13.existsSync(backup)) {
64442
- logPath = backup;
64443
- } else {
64444
- return {
64445
- success: false,
64446
- error: `No daemon log file at ${logPath} (dir: ${getDaemonLogDir()})`,
64447
- lines: [],
64448
- truncated: false,
64449
- logPath,
64450
- platform: platform10,
64451
- bytesReturned: 0,
64452
- filtered: false
64453
- };
64454
- }
64559
+ const primaryPath = resolveLogPath(args.date);
64560
+ const backupPath = primaryPath.replace(/\.log$/, ".1.log");
64561
+ const primaryExists = fs13.existsSync(primaryPath);
64562
+ const backupExists = fs13.existsSync(backupPath);
64563
+ if (!primaryExists && !backupExists) {
64564
+ return errorResult(
64565
+ `No daemon log file at ${primaryPath} (dir: ${getDaemonLogDir()})`,
64566
+ primaryPath,
64567
+ platform10
64568
+ );
64455
64569
  }
64456
- let raw;
64457
- try {
64458
- raw = readByteBoundedTail(logPath, limitBytes);
64459
- } catch (e) {
64570
+ const logPath = primaryExists ? primaryPath : backupPath;
64571
+ const hasGrep = typeof args.grep === "string" && args.grep.trim().length > 0;
64572
+ const hasSince = Number.isFinite(args.sinceMs);
64573
+ const filterMode = hasGrep || hasSince;
64574
+ if (!filterMode) {
64575
+ let raw;
64576
+ try {
64577
+ raw = readByteBoundedTail(logPath, limitBytes);
64578
+ } catch (e) {
64579
+ return errorResult(`Failed to read ${logPath}: ${e?.message ?? String(e)}`, logPath, platform10);
64580
+ }
64581
+ const lines2 = splitLogLines(raw.text);
64460
64582
  return {
64461
- success: false,
64462
- error: `Failed to read ${logPath}: ${e?.message ?? String(e)}`,
64463
- lines: [],
64464
- truncated: false,
64583
+ success: true,
64584
+ lines: lines2,
64585
+ truncated: raw.truncated,
64465
64586
  logPath,
64466
64587
  platform: platform10,
64467
- bytesReturned: 0,
64468
- filtered: false
64588
+ bytesReturned: raw.bytesReturned,
64589
+ filtered: false,
64590
+ fullScan: false,
64591
+ scannedBytes: raw.bytesReturned,
64592
+ matchedLineCount: lines2.length,
64593
+ excludedByFilter: 0
64469
64594
  };
64470
64595
  }
64471
- let lines = raw.text.split("\n");
64472
- if (lines.length && lines[lines.length - 1] === "") lines.pop();
64473
- const rawCount = lines.length;
64474
- if (Number.isFinite(args.sinceMs)) {
64475
- const fileDate = args.date instanceof Date ? args.date : typeof args.date === "string" && args.date.trim() ? /* @__PURE__ */ new Date(`${args.date.trim()}T00:00:00.000Z`) : /* @__PURE__ */ new Date();
64596
+ let scannedBytes = 0;
64597
+ let allLines = [];
64598
+ try {
64599
+ for (const p of [backupExists ? backupPath : null, primaryExists ? primaryPath : null]) {
64600
+ if (!p) continue;
64601
+ const buf = fs13.readFileSync(p);
64602
+ scannedBytes += buf.length;
64603
+ allLines = allLines.concat(splitLogLines(buf.toString("utf-8")));
64604
+ }
64605
+ } catch (e) {
64606
+ return errorResult(`Failed to read ${logPath}: ${e?.message ?? String(e)}`, logPath, platform10);
64607
+ }
64608
+ const scannedLineCount = allLines.length;
64609
+ let lines = allLines;
64610
+ if (hasSince) {
64611
+ const fileDate = fileDateFor(args.date);
64476
64612
  const floor = args.sinceMs;
64477
64613
  lines = lines.filter((line) => {
64478
64614
  const ts2 = parseLineEpochMs(line, fileDate);
@@ -64480,30 +64616,26 @@ ${body}
64480
64616
  });
64481
64617
  }
64482
64618
  let appliedGrep;
64483
- if (typeof args.grep === "string" && args.grep.trim()) {
64619
+ if (hasGrep) {
64484
64620
  appliedGrep = args.grep.trim();
64485
- let re = null;
64486
- try {
64487
- re = new RegExp(appliedGrep, "i");
64488
- } catch {
64489
- re = null;
64490
- }
64491
- if (re) {
64492
- const compiled = re;
64493
- lines = lines.filter((line) => compiled.test(line));
64494
- } else {
64495
- const needle = appliedGrep.toLowerCase();
64496
- lines = lines.filter((line) => line.toLowerCase().includes(needle));
64497
- }
64621
+ const matches = buildGrepPredicate(appliedGrep);
64622
+ lines = lines.filter(matches);
64498
64623
  }
64624
+ const matchedLineCount = lines.length;
64625
+ const excludedByFilter = scannedLineCount - matchedLineCount;
64626
+ const capped = takeLastLinesWithinBytes(lines, limitBytes);
64499
64627
  return {
64500
64628
  success: true,
64501
- lines,
64502
- truncated: raw.truncated,
64629
+ lines: capped.kept,
64630
+ truncated: capped.truncated,
64503
64631
  logPath,
64504
64632
  platform: platform10,
64505
- bytesReturned: raw.bytesReturned,
64506
- filtered: lines.length !== rawCount,
64633
+ bytesReturned: capped.bytesReturned,
64634
+ filtered: excludedByFilter > 0,
64635
+ fullScan: true,
64636
+ scannedBytes,
64637
+ matchedLineCount,
64638
+ excludedByFilter,
64507
64639
  ...appliedGrep ? { grep: appliedGrep } : {}
64508
64640
  };
64509
64641
  }
@@ -64616,6 +64748,12 @@ ${body}
64616
64748
  truncated: tail.truncated,
64617
64749
  filtered: tail.filtered,
64618
64750
  bytesReturned: tail.bytesReturned,
64751
+ // Transparency meta — lets the coordinator see that a full-file grep
64752
+ // ran past the recent tail window, and how much was scanned/excluded.
64753
+ fullScan: tail.fullScan,
64754
+ scannedBytes: tail.scannedBytes,
64755
+ matchedLineCount: tail.matchedLineCount,
64756
+ excludedByFilter: tail.excludedByFilter,
64619
64757
  ...tail.grep ? { grep: tail.grep } : {}
64620
64758
  };
64621
64759
  }
@@ -71697,7 +71835,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
71697
71835
  const adapter = this.adapters.get(ik);
71698
71836
  if (adapter) return { adapter, key: ik };
71699
71837
  }
71700
- if (opts?.dir) {
71838
+ if (opts?.dir && !opts?.instanceKey) {
71701
71839
  for (const [k, a] of this.adapters) {
71702
71840
  if (a.cliType === agentType && a.workingDir === opts.dir) {
71703
71841
  return { adapter: a, key: k };
@@ -77640,7 +77778,7 @@ ${ptyResult.output.slice(-2e3)}`);
77640
77778
  workspace
77641
77779
  };
77642
77780
  }
77643
- const { existsSync: existsSync49, readFileSync: readFileSync39, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
77781
+ const { existsSync: existsSync49, readFileSync: readFileSync40, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
77644
77782
  const { dirname: dirname17 } = await import("path");
77645
77783
  const mcpConfigPath = coordinatorSetup.configPath;
77646
77784
  const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
@@ -77690,7 +77828,7 @@ ${ptyResult.output.slice(-2e3)}`);
77690
77828
  }
77691
77829
  if (hadExistingMcpConfig) {
77692
77830
  try {
77693
- const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync39(mcpConfigPath, "utf-8"), configFormat);
77831
+ const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync40(mcpConfigPath, "utf-8"), configFormat);
77694
77832
  const existingCoordinatorConfig = hermesManualFallback ? stripHermesCoordinatorTempModelProviderOverrides(parsedExistingMcpConfig) : parsedExistingMcpConfig;
77695
77833
  existingMcpConfig = { ...existingMcpConfig, ...existingCoordinatorConfig };
77696
77834
  copyFileSync4(mcpConfigPath, mcpConfigPath + ".backup");
@@ -79392,6 +79530,23 @@ ${ptyResult.output.slice(-2e3)}`);
79392
79530
  staleness
79393
79531
  };
79394
79532
  }
79533
+ function buildMeshNodeProbeFreshness(args) {
79534
+ const { git, liveTruthProbed, isSelfNode, daemonId, node, now } = args;
79535
+ const status = {
79536
+ git,
79537
+ connection: { state: liveTruthProbed ? "connected" : "disconnected" }
79538
+ };
79539
+ if (liveTruthProbed) status[MESH_NODE_LIVE_TRUTH_MARKER] = true;
79540
+ return buildMeshNodeDataFreshness({
79541
+ status,
79542
+ node,
79543
+ isSelfNode,
79544
+ daemonId,
79545
+ liveTruthProbed,
79546
+ directTruthUnavailable: !liveTruthProbed && !!daemonId,
79547
+ now
79548
+ });
79549
+ }
79395
79550
  function finalizeMeshNodeStatus(args) {
79396
79551
  const { status, node, daemonId, isSelfNode, directTruthUnavailable } = args;
79397
79552
  if (!readStringValue(status.machineStatus)) {