@adhdev/daemon-core 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.mjs CHANGED
@@ -311,10 +311,10 @@ function readInjected(value) {
311
311
  }
312
312
  function getDaemonBuildInfo() {
313
313
  if (cached) return cached;
314
- const commit = readInjected(true ? "0e66043bc2858f114fbdd7b1edeb7774f33bfd2d" : void 0) ?? "unknown";
315
- const commitShort = readInjected(true ? "0e66043b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
316
- const version = readInjected(true ? "0.9.82-rc.371" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
317
- const builtAt = readInjected(true ? "2026-06-24T12:30:13.850Z" : void 0);
314
+ const commit = readInjected(true ? "f16b5e6cdf653b4258f8f44cb11fb6ad8c13329f" : void 0) ?? "unknown";
315
+ const commitShort = readInjected(true ? "f16b5e6c" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
316
+ const version = readInjected(true ? "0.9.82-rc.373" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
317
+ const builtAt = readInjected(true ? "2026-06-24T16:28:52.547Z" : void 0);
318
318
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
319
319
  return cached;
320
320
  }
@@ -5535,7 +5535,14 @@ var init_mesh_runtime_store = __esm({
5535
5535
  if (candidate.taskMode === "live_debug_readonly") return true;
5536
5536
  return !nodeBusy;
5537
5537
  };
5538
- const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && nodeConflictAllows(candidate));
5538
+ const nodeIsWorktree = opts?.nodeIsWorktree === true;
5539
+ const convergenceAllows = (candidate) => candidate.taskMode !== "convergence" || !nodeIsWorktree;
5540
+ const targetMatches = (candidate) => {
5541
+ if (candidate.targetSessionId && candidate.targetSessionId !== sessionId) return false;
5542
+ if (candidate.targetNodeId && candidate.targetNodeId !== nodeId) return false;
5543
+ return true;
5544
+ };
5545
+ const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && convergenceAllows(candidate) && targetMatches(candidate) && nodeConflictAllows(candidate));
5539
5546
  if (!entry) return null;
5540
5547
  const now = (/* @__PURE__ */ new Date()).toISOString();
5541
5548
  entry.status = "assigned";
@@ -12742,6 +12749,31 @@ function recoverMeshIdByNodeId(nodeId) {
12742
12749
  }
12743
12750
  return "";
12744
12751
  }
12752
+ function resolveForwardEventMeshId(components, payload) {
12753
+ const direct = readNonEmptyString2(payload.meshId);
12754
+ if (direct) return direct;
12755
+ const workspace = readNonEmptyString2(payload.workspace);
12756
+ const byWorkspace = workspace ? readNonEmptyString2(getCachedMeshByWorkspace(workspace)?.id) : "";
12757
+ if (byWorkspace) return byWorkspace;
12758
+ const byNode = recoverMeshIdByNodeId(readNonEmptyString2(payload.nodeId));
12759
+ if (byNode) return byNode;
12760
+ const sessionId = readNonEmptyString2(payload.targetSessionId) || readNonEmptyString2(payload.sessionId) || readNonEmptyString2(payload.instanceId);
12761
+ if (sessionId) {
12762
+ try {
12763
+ const state = components.instanceManager?.getInstance?.(sessionId)?.getState?.();
12764
+ const settings = state?.settings || {};
12765
+ const meshNodeFor = readNonEmptyString2(settings.meshNodeFor);
12766
+ if (meshNodeFor) return meshNodeFor;
12767
+ const byStamp = recoverMeshIdByNodeId(readNonEmptyString2(settings.meshNodeId));
12768
+ if (byStamp) return byStamp;
12769
+ const sessionWorkspace = readNonEmptyString2(state?.workspace);
12770
+ const bySessionWorkspace = sessionWorkspace ? readNonEmptyString2(getCachedMeshByWorkspace(sessionWorkspace)?.id) : "";
12771
+ if (bySessionWorkspace) return bySessionWorkspace;
12772
+ } catch {
12773
+ }
12774
+ }
12775
+ return "";
12776
+ }
12745
12777
  function __resetIdleAutoFastForwardForTests() {
12746
12778
  idleAutoFastForwardLastAttempt.clear();
12747
12779
  }
@@ -12988,9 +13020,11 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
12988
13020
  }
12989
13021
  const capabilityTags = buildMeshNodeCapabilityTags(node, providerType);
12990
13022
  const providerMaxParallel = resolveProviderMaxParallel(node?.policy, providerType);
13023
+ const nodeIsWorktree = node?.isLocalWorktree === true;
12991
13024
  const task = claimNextTask(meshId, nodeId, sessionId, capabilityTags, {
12992
13025
  providerType,
12993
- ...providerMaxParallel !== void 0 ? { providerMaxParallel } : {}
13026
+ ...providerMaxParallel !== void 0 ? { providerMaxParallel } : {},
13027
+ nodeIsWorktree
12994
13028
  });
12995
13029
  if (!task) {
12996
13030
  return false;
@@ -13334,6 +13368,7 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
13334
13368
  }
13335
13369
  const candidateNodes = Array.isArray(mesh?.nodes) ? mesh.nodes.filter((node) => {
13336
13370
  if (task.targetNodeId && !meshNodeIdMatches(node, task.targetNodeId)) return false;
13371
+ if (task.taskMode === "convergence" && node?.isLocalWorktree === true) return false;
13337
13372
  if (task.requiredTags?.length) {
13338
13373
  const priorities = normalizeProviderPriority(node?.policy);
13339
13374
  const providerCandidates = priorities.length ? priorities : [void 0];
@@ -14317,6 +14352,8 @@ function forwardUnresolvedDelegateEvent(components, routing, event) {
14317
14352
  nodeId: readNonEmptyString2(routing.nodeId) || readNonEmptyString2(event.meshNodeId) || void 0,
14318
14353
  workspace: readNonEmptyString2(routing.workspace) || readNonEmptyString2(event.workspace) || void 0
14319
14354
  };
14355
+ const resolvedMeshId = resolveForwardEventMeshId(components, payload);
14356
+ if (resolvedMeshId) payload.meshId = resolvedMeshId;
14320
14357
  const selfDaemonIds = resolveCoordinatorDrainDaemonIds(components);
14321
14358
  if (selfDaemonIds.some((self) => daemonIdsEquivalent(self, coordinatorDaemonId))) {
14322
14359
  try {
@@ -14838,7 +14875,10 @@ async function retryUnresolvedDelegateForwards(components) {
14838
14875
  if (!dispatchMeshCommand) return;
14839
14876
  expireStaleUnresolvedDelegateForwards();
14840
14877
  const entries = peekUnresolvedDelegateForwards();
14841
- if (entries.length === 0) return;
14878
+ if (entries.length === 0) {
14879
+ if (unresolvedForwardRejectionCounts.size > 0) unresolvedForwardRejectionCounts.clear();
14880
+ return;
14881
+ }
14842
14882
  const selfIds = resolveCoordinatorDaemonIds(components);
14843
14883
  const isSelfCoordinatorId = (id) => selfIds.some((self) => daemonIdsEquivalent(self, id));
14844
14884
  for (const entry of entries) {
@@ -14857,6 +14897,7 @@ async function retryUnresolvedDelegateForwards(components) {
14857
14897
  LOG.warn("MeshReconcile", `Local route of self-addressed forward to ${entry.coordinatorDaemonId} threw: ${e?.message || e} \u2014 draining anyway to break the retry loop`);
14858
14898
  }
14859
14899
  ackUnresolvedDelegateForward(entry.id);
14900
+ unresolvedForwardRejectionCounts.delete(entry.id);
14860
14901
  if (localResult && localResult.success === false) {
14861
14902
  LOG.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`);
14862
14903
  traceMeshEventDrop("self_forward_local_rejected", entryTraceCtx, readNonEmptyString2(localResult.error) || "no reason");
@@ -14865,21 +14906,40 @@ async function retryUnresolvedDelegateForwards(components) {
14865
14906
  }
14866
14907
  continue;
14867
14908
  }
14909
+ let pushPayload = entry.payload;
14910
+ if (!readNonEmptyString2(pushPayload.meshId)) {
14911
+ const recoveredMeshId = resolveForwardEventMeshId(components, pushPayload);
14912
+ if (recoveredMeshId) {
14913
+ pushPayload = { ...pushPayload, meshId: recoveredMeshId };
14914
+ traceMeshEventStage("forward_meshid_recovered", entryTraceCtx, `meshId=${recoveredMeshId}`);
14915
+ }
14916
+ }
14868
14917
  let result;
14869
14918
  try {
14870
14919
  traceMeshEventStage("forward_send", entryTraceCtx, `retry \u2192 ${entry.coordinatorDaemonId}`);
14871
- result = await dispatchMeshCommand(entry.coordinatorDaemonId, "mesh_forward_event", entry.payload);
14920
+ result = await dispatchMeshCommand(entry.coordinatorDaemonId, "mesh_forward_event", pushPayload);
14872
14921
  } catch (e) {
14873
14922
  LOG.warn("MeshReconcile", `Retry forward to coordinator ${entry.coordinatorDaemonId} failed: ${e?.message || e} \u2014 left queued`);
14874
14923
  traceMeshEventDrop("retry_forward_failed", entryTraceCtx, e?.message || String(e));
14875
14924
  continue;
14876
14925
  }
14877
14926
  if (result && result.success === false) {
14878
- LOG.warn("MeshReconcile", `Retry forward to coordinator ${entry.coordinatorDaemonId} rejected (${readNonEmptyString2(result.error) || "no reason"}) \u2014 left queued`);
14879
- traceMeshEventDrop("retry_forward_rejected", entryTraceCtx, readNonEmptyString2(result.error) || "no reason");
14927
+ const rejections = (unresolvedForwardRejectionCounts.get(entry.id) || 0) + 1;
14928
+ unresolvedForwardRejectionCounts.set(entry.id, rejections);
14929
+ const reason = readNonEmptyString2(result.error) || "no reason";
14930
+ if (rejections >= MAX_FORWARD_REJECTIONS) {
14931
+ ackUnresolvedDelegateForward(entry.id);
14932
+ unresolvedForwardRejectionCounts.delete(entry.id);
14933
+ LOG.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`);
14934
+ traceMeshEventDrop("retry_forward_exhausted", entryTraceCtx, `${reason} (${rejections} rejections)`);
14935
+ } else {
14936
+ LOG.warn("MeshReconcile", `Retry forward to coordinator ${entry.coordinatorDaemonId} rejected (${reason}) \u2014 left queued (attempt ${rejections}/${MAX_FORWARD_REJECTIONS})`);
14937
+ traceMeshEventDrop("retry_forward_rejected", entryTraceCtx, reason);
14938
+ }
14880
14939
  continue;
14881
14940
  }
14882
14941
  ackUnresolvedDelegateForward(entry.id);
14942
+ unresolvedForwardRejectionCounts.delete(entry.id);
14883
14943
  LOG.info("MeshReconcile", `Retried+delivered unresolved-delegate ${readNonEmptyString2(entry.payload.event)} to coordinator ${entry.coordinatorDaemonId}`);
14884
14944
  }
14885
14945
  }
@@ -15105,7 +15165,7 @@ function setupMeshReconcileLoop(components) {
15105
15165
  }
15106
15166
  };
15107
15167
  }
15108
- var DEFAULT_RECONCILE_INTERVAL_MS, DEFAULT_AUTO_PRUNE_MIN_AGE_MS, heldEventLedgerRecorded, ASSIGNED_STRANDED_DEADLINE_MS, STRICT_SESSION_MATCH_TTL_MS;
15168
+ var DEFAULT_RECONCILE_INTERVAL_MS, DEFAULT_AUTO_PRUNE_MIN_AGE_MS, heldEventLedgerRecorded, ASSIGNED_STRANDED_DEADLINE_MS, STRICT_SESSION_MATCH_TTL_MS, unresolvedForwardRejectionCounts, MAX_FORWARD_REJECTIONS;
15109
15169
  var init_mesh_reconcile_loop = __esm({
15110
15170
  "src/mesh/mesh-reconcile-loop.ts"() {
15111
15171
  "use strict";
@@ -15130,6 +15190,8 @@ var init_mesh_reconcile_loop = __esm({
15130
15190
  heldEventLedgerRecorded = /* @__PURE__ */ new Set();
15131
15191
  ASSIGNED_STRANDED_DEADLINE_MS = 5 * 6e4;
15132
15192
  STRICT_SESSION_MATCH_TTL_MS = 6e4;
15193
+ unresolvedForwardRejectionCounts = /* @__PURE__ */ new Map();
15194
+ MAX_FORWARD_REJECTIONS = 5;
15133
15195
  }
15134
15196
  });
15135
15197
 
@@ -34389,6 +34451,27 @@ function readByteBoundedTail(filePath, limitBytes) {
34389
34451
  fs13.closeSync(fd);
34390
34452
  }
34391
34453
  }
34454
+ function splitLogLines(text) {
34455
+ const lines = text.split("\n");
34456
+ if (lines.length && lines[lines.length - 1] === "") lines.pop();
34457
+ return lines;
34458
+ }
34459
+ function takeLastLinesWithinBytes(lines, limitBytes) {
34460
+ if (lines.length === 0) return { kept: [], truncated: false, bytesReturned: 0 };
34461
+ let total = 0;
34462
+ let firstKept = lines.length;
34463
+ for (let i = lines.length - 1; i >= 0; i--) {
34464
+ const lineBytes = Buffer.byteLength(lines[i], "utf-8") + 1;
34465
+ if (firstKept !== lines.length && total + lineBytes > limitBytes) break;
34466
+ total += lineBytes;
34467
+ firstKept = i;
34468
+ }
34469
+ return {
34470
+ kept: lines.slice(firstKept),
34471
+ truncated: firstKept > 0,
34472
+ bytesReturned: total
34473
+ };
34474
+ }
34392
34475
  function parseLineEpochMs(line, fileDate) {
34393
34476
  const m = line.match(/^\[(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,3}))?\]/);
34394
34477
  if (!m) {
@@ -34403,47 +34486,97 @@ function parseLineEpochMs(line, fileDate) {
34403
34486
  d.setHours(Number(m[1]), Number(m[2]), Number(m[3]), m[4] ? Number(m[4].padEnd(3, "0")) : 0);
34404
34487
  return d.getTime();
34405
34488
  }
34489
+ function buildGrepPredicate(grepSource) {
34490
+ let re = null;
34491
+ try {
34492
+ re = new RegExp(grepSource, "i");
34493
+ } catch {
34494
+ re = null;
34495
+ }
34496
+ if (re) {
34497
+ const compiled = re;
34498
+ return (line) => compiled.test(line);
34499
+ }
34500
+ const needle = grepSource.toLowerCase();
34501
+ return (line) => line.toLowerCase().includes(needle);
34502
+ }
34503
+ function fileDateFor(date) {
34504
+ if (date instanceof Date) return date;
34505
+ if (typeof date === "string" && date.trim()) return /* @__PURE__ */ new Date(`${date.trim()}T00:00:00.000Z`);
34506
+ return /* @__PURE__ */ new Date();
34507
+ }
34508
+ function errorResult(error, logPath, platform10) {
34509
+ return {
34510
+ success: false,
34511
+ error,
34512
+ lines: [],
34513
+ truncated: false,
34514
+ logPath,
34515
+ platform: platform10,
34516
+ bytesReturned: 0,
34517
+ filtered: false,
34518
+ fullScan: false,
34519
+ scannedBytes: 0,
34520
+ matchedLineCount: 0,
34521
+ excludedByFilter: 0
34522
+ };
34523
+ }
34406
34524
  function readDaemonLogTail(args = {}) {
34407
34525
  const platform10 = process.platform;
34408
34526
  const limitBytes = clampTailBytes(args.tailBytes);
34409
- let logPath = resolveLogPath(args.date);
34410
- if (!fs13.existsSync(logPath)) {
34411
- const backup = logPath.replace(/\.log$/, ".1.log");
34412
- if (fs13.existsSync(backup)) {
34413
- logPath = backup;
34414
- } else {
34415
- return {
34416
- success: false,
34417
- error: `No daemon log file at ${logPath} (dir: ${getDaemonLogDir()})`,
34418
- lines: [],
34419
- truncated: false,
34420
- logPath,
34421
- platform: platform10,
34422
- bytesReturned: 0,
34423
- filtered: false
34424
- };
34425
- }
34527
+ const primaryPath = resolveLogPath(args.date);
34528
+ const backupPath = primaryPath.replace(/\.log$/, ".1.log");
34529
+ const primaryExists = fs13.existsSync(primaryPath);
34530
+ const backupExists = fs13.existsSync(backupPath);
34531
+ if (!primaryExists && !backupExists) {
34532
+ return errorResult(
34533
+ `No daemon log file at ${primaryPath} (dir: ${getDaemonLogDir()})`,
34534
+ primaryPath,
34535
+ platform10
34536
+ );
34426
34537
  }
34427
- let raw;
34428
- try {
34429
- raw = readByteBoundedTail(logPath, limitBytes);
34430
- } catch (e) {
34538
+ const logPath = primaryExists ? primaryPath : backupPath;
34539
+ const hasGrep = typeof args.grep === "string" && args.grep.trim().length > 0;
34540
+ const hasSince = Number.isFinite(args.sinceMs);
34541
+ const filterMode = hasGrep || hasSince;
34542
+ if (!filterMode) {
34543
+ let raw;
34544
+ try {
34545
+ raw = readByteBoundedTail(logPath, limitBytes);
34546
+ } catch (e) {
34547
+ return errorResult(`Failed to read ${logPath}: ${e?.message ?? String(e)}`, logPath, platform10);
34548
+ }
34549
+ const lines2 = splitLogLines(raw.text);
34431
34550
  return {
34432
- success: false,
34433
- error: `Failed to read ${logPath}: ${e?.message ?? String(e)}`,
34434
- lines: [],
34435
- truncated: false,
34551
+ success: true,
34552
+ lines: lines2,
34553
+ truncated: raw.truncated,
34436
34554
  logPath,
34437
34555
  platform: platform10,
34438
- bytesReturned: 0,
34439
- filtered: false
34556
+ bytesReturned: raw.bytesReturned,
34557
+ filtered: false,
34558
+ fullScan: false,
34559
+ scannedBytes: raw.bytesReturned,
34560
+ matchedLineCount: lines2.length,
34561
+ excludedByFilter: 0
34440
34562
  };
34441
34563
  }
34442
- let lines = raw.text.split("\n");
34443
- if (lines.length && lines[lines.length - 1] === "") lines.pop();
34444
- const rawCount = lines.length;
34445
- if (Number.isFinite(args.sinceMs)) {
34446
- 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();
34564
+ let scannedBytes = 0;
34565
+ let allLines = [];
34566
+ try {
34567
+ for (const p of [backupExists ? backupPath : null, primaryExists ? primaryPath : null]) {
34568
+ if (!p) continue;
34569
+ const buf = fs13.readFileSync(p);
34570
+ scannedBytes += buf.length;
34571
+ allLines = allLines.concat(splitLogLines(buf.toString("utf-8")));
34572
+ }
34573
+ } catch (e) {
34574
+ return errorResult(`Failed to read ${logPath}: ${e?.message ?? String(e)}`, logPath, platform10);
34575
+ }
34576
+ const scannedLineCount = allLines.length;
34577
+ let lines = allLines;
34578
+ if (hasSince) {
34579
+ const fileDate = fileDateFor(args.date);
34447
34580
  const floor = args.sinceMs;
34448
34581
  lines = lines.filter((line) => {
34449
34582
  const ts2 = parseLineEpochMs(line, fileDate);
@@ -34451,30 +34584,26 @@ function readDaemonLogTail(args = {}) {
34451
34584
  });
34452
34585
  }
34453
34586
  let appliedGrep;
34454
- if (typeof args.grep === "string" && args.grep.trim()) {
34587
+ if (hasGrep) {
34455
34588
  appliedGrep = args.grep.trim();
34456
- let re = null;
34457
- try {
34458
- re = new RegExp(appliedGrep, "i");
34459
- } catch {
34460
- re = null;
34461
- }
34462
- if (re) {
34463
- const compiled = re;
34464
- lines = lines.filter((line) => compiled.test(line));
34465
- } else {
34466
- const needle = appliedGrep.toLowerCase();
34467
- lines = lines.filter((line) => line.toLowerCase().includes(needle));
34468
- }
34589
+ const matches = buildGrepPredicate(appliedGrep);
34590
+ lines = lines.filter(matches);
34469
34591
  }
34592
+ const matchedLineCount = lines.length;
34593
+ const excludedByFilter = scannedLineCount - matchedLineCount;
34594
+ const capped = takeLastLinesWithinBytes(lines, limitBytes);
34470
34595
  return {
34471
34596
  success: true,
34472
- lines,
34473
- truncated: raw.truncated,
34597
+ lines: capped.kept,
34598
+ truncated: capped.truncated,
34474
34599
  logPath,
34475
34600
  platform: platform10,
34476
- bytesReturned: raw.bytesReturned,
34477
- filtered: lines.length !== rawCount,
34601
+ bytesReturned: capped.bytesReturned,
34602
+ filtered: excludedByFilter > 0,
34603
+ fullScan: true,
34604
+ scannedBytes,
34605
+ matchedLineCount,
34606
+ excludedByFilter,
34478
34607
  ...appliedGrep ? { grep: appliedGrep } : {}
34479
34608
  };
34480
34609
  }
@@ -34591,6 +34720,12 @@ var meshNodeLogsHandlers = {
34591
34720
  truncated: tail.truncated,
34592
34721
  filtered: tail.filtered,
34593
34722
  bytesReturned: tail.bytesReturned,
34723
+ // Transparency meta — lets the coordinator see that a full-file grep
34724
+ // ran past the recent tail window, and how much was scanned/excluded.
34725
+ fullScan: tail.fullScan,
34726
+ scannedBytes: tail.scannedBytes,
34727
+ matchedLineCount: tail.matchedLineCount,
34728
+ excludedByFilter: tail.excludedByFilter,
34594
34729
  ...tail.grep ? { grep: tail.grep } : {}
34595
34730
  };
34596
34731
  }
@@ -41723,7 +41858,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
41723
41858
  const adapter = this.adapters.get(ik);
41724
41859
  if (adapter) return { adapter, key: ik };
41725
41860
  }
41726
- if (opts?.dir) {
41861
+ if (opts?.dir && !opts?.instanceKey) {
41727
41862
  for (const [k, a] of this.adapters) {
41728
41863
  if (a.cliType === agentType && a.workingDir === opts.dir) {
41729
41864
  return { adapter: a, key: k };
@@ -47716,7 +47851,7 @@ ${ptyResult.output.slice(-2e3)}`);
47716
47851
  workspace
47717
47852
  };
47718
47853
  }
47719
- const { existsSync: existsSync49, readFileSync: readFileSync39, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
47854
+ const { existsSync: existsSync49, readFileSync: readFileSync40, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
47720
47855
  const { dirname: dirname17 } = await import("path");
47721
47856
  const mcpConfigPath = coordinatorSetup.configPath;
47722
47857
  const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
@@ -47766,7 +47901,7 @@ ${ptyResult.output.slice(-2e3)}`);
47766
47901
  }
47767
47902
  if (hadExistingMcpConfig) {
47768
47903
  try {
47769
- const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync39(mcpConfigPath, "utf-8"), configFormat);
47904
+ const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync40(mcpConfigPath, "utf-8"), configFormat);
47770
47905
  const existingCoordinatorConfig = hermesManualFallback ? stripHermesCoordinatorTempModelProviderOverrides(parsedExistingMcpConfig) : parsedExistingMcpConfig;
47771
47906
  existingMcpConfig = { ...existingMcpConfig, ...existingCoordinatorConfig };
47772
47907
  copyFileSync4(mcpConfigPath, mcpConfigPath + ".backup");
@@ -47894,7 +48029,7 @@ import { hostname as osHostname } from "os";
47894
48029
 
47895
48030
  // src/mesh/preview-freshness.ts
47896
48031
  import { execFileSync as execFileSync5 } from "child_process";
47897
- import { existsSync as existsSync39, readFileSync as readFileSync29 } from "fs";
48032
+ import { existsSync as existsSync39, readFileSync as readFileSync30 } from "fs";
47898
48033
  import { resolve as resolve19 } from "path";
47899
48034
  var PREVIEW_DEPLOY_RECORD = ".adhdev/preview-deploy.json";
47900
48035
  function runGit2(repoRoot, args) {
@@ -47913,7 +48048,7 @@ function readRecord5(repoRoot) {
47913
48048
  const path42 = resolve19(repoRoot, PREVIEW_DEPLOY_RECORD);
47914
48049
  if (!existsSync39(path42)) return null;
47915
48050
  try {
47916
- const parsed = JSON.parse(readFileSync29(path42, "utf8"));
48051
+ const parsed = JSON.parse(readFileSync30(path42, "utf8"));
47917
48052
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
47918
48053
  } catch {
47919
48054
  return null;
@@ -49486,6 +49621,23 @@ function buildMeshNodeDataFreshness(args) {
49486
49621
  staleness
49487
49622
  };
49488
49623
  }
49624
+ function buildMeshNodeProbeFreshness(args) {
49625
+ const { git, liveTruthProbed, isSelfNode, daemonId, node, now } = args;
49626
+ const status = {
49627
+ git,
49628
+ connection: { state: liveTruthProbed ? "connected" : "disconnected" }
49629
+ };
49630
+ if (liveTruthProbed) status[MESH_NODE_LIVE_TRUTH_MARKER] = true;
49631
+ return buildMeshNodeDataFreshness({
49632
+ status,
49633
+ node,
49634
+ isSelfNode,
49635
+ daemonId,
49636
+ liveTruthProbed,
49637
+ directTruthUnavailable: !liveTruthProbed && !!daemonId,
49638
+ now
49639
+ });
49640
+ }
49489
49641
  function finalizeMeshNodeStatus(args) {
49490
49642
  const { status, node, daemonId, isSelfNode, directTruthUnavailable } = args;
49491
49643
  if (!readStringValue(status.machineStatus)) {
@@ -61463,11 +61615,11 @@ init_parse_session();
61463
61615
 
61464
61616
  // src/providers/sdk/v1/fixture-tooling/replay.ts
61465
61617
  init_provider_cli_shared();
61466
- import { readFileSync as readFileSync37 } from "fs";
61618
+ import { readFileSync as readFileSync38 } from "fs";
61467
61619
  import { dirname as dirname15, resolve as resolve22 } from "path";
61468
61620
 
61469
61621
  // src/providers/sdk/v1/validators/taint.ts
61470
- import { readFileSync as readFileSync38, existsSync as existsSync48 } from "fs";
61622
+ import { readFileSync as readFileSync39, existsSync as existsSync48 } from "fs";
61471
61623
  import { resolve as resolve23, dirname as dirname16, join as join47 } from "path";
61472
61624
 
61473
61625
  // src/providers/sdk/v1/validators/index.ts
@@ -61645,6 +61797,7 @@ export {
61645
61797
  buildMeshLedgerReplicaEvidence,
61646
61798
  buildMeshNodeCapabilityTags,
61647
61799
  buildMeshNodeDataFreshness,
61800
+ buildMeshNodeProbeFreshness,
61648
61801
  buildMissionPromptSection,
61649
61802
  buildP2pRelayFailurePayload,
61650
61803
  buildPinnedGlobalInstallCommand,