@adhdev/daemon-core 0.9.82-rc.372 → 0.9.82-rc.374

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.
@@ -112,6 +112,34 @@ export declare function buildMeshNodeDataFreshness(args: {
112
112
  directTruthUnavailable?: boolean;
113
113
  now?: () => number;
114
114
  }): Record<string, unknown>;
115
+ /**
116
+ * Canonical live-probe → freshness adapter. The coordinator-facing mesh_status
117
+ * (mcp-server `meshStatus`) builds each node entry from a SINGLE fresh git_status
118
+ * probe that either returns (live truth) or throws (peer unreachable). It used to
119
+ * hand-reconstruct the freshness INPUT inline — a synthetic `{ git, connection }`
120
+ * status plus the directTruthUnavailable/liveTruthProbed wiring — which is exactly
121
+ * how a field added to `buildMeshNodeDataFreshness`'s input contract ends up "wired
122
+ * on the daemon surface, null on the coordinator surface" (the rc.371
123
+ * null-everywhere regression). Routing every live-probe surface through this one
124
+ * adapter keeps the marker derivation canonical: there is a SINGLE place that turns
125
+ * a probe outcome into freshness args, so the two mesh_status surfaces cannot drift.
126
+ *
127
+ * `liveTruthProbed` true → the probe returned (live/self truth); false → it threw,
128
+ * so a configured peer is unreachable while an unconfigured node (no daemonId) falls
129
+ * through to the classifier's `unconfigured` branch.
130
+ */
131
+ export declare function buildMeshNodeProbeFreshness(args: {
132
+ /** The git snapshot this probe stamped on the node entry (entry.git). */
133
+ git: unknown;
134
+ /** True when the fresh git_status probe RETURNED (live truth); false when it threw. */
135
+ liveTruthProbed: boolean;
136
+ isSelfNode: boolean;
137
+ /** The node's resolved daemonId; absent → unconfigured node. */
138
+ daemonId?: string;
139
+ /** The mesh node record, for held-git fallback when the probe did not return live. */
140
+ node?: any;
141
+ now?: () => number;
142
+ }): Record<string, unknown>;
115
143
  export declare function finalizeMeshNodeStatus(args: {
116
144
  status: Record<string, unknown>;
117
145
  node: any;
package/dist/index.d.ts CHANGED
@@ -84,7 +84,7 @@ export { DaemonCdpInitializer } from './cdp/initializer.js';
84
84
  export type { CdpInitializerConfig } from './cdp/initializer.js';
85
85
  export { DaemonCommandHandler } from './commands/handler.js';
86
86
  export type { CommandResult, CommandContext } from './commands/handler.js';
87
- export { DaemonCommandRouter, readCachedInlineMeshActiveSessionDetails, resolveMeshNodeAttribution, buildMeshNodeDataFreshness, MESH_NODE_LIVE_TRUTH_MARKER } from './commands/router.js';
87
+ export { DaemonCommandRouter, readCachedInlineMeshActiveSessionDetails, resolveMeshNodeAttribution, buildMeshNodeDataFreshness, buildMeshNodeProbeFreshness, MESH_NODE_LIVE_TRUTH_MARKER } from './commands/router.js';
88
88
  export type { CommandRouterDeps, CommandRouterResult } from './commands/router.js';
89
89
  export { maybeRunDaemonUpgradeHelperFromEnv, spawnDetachedDaemonUpgradeHelper, resolveCurrentGlobalInstallSurface, buildPinnedGlobalInstallCommand, execNpmCommandSync, getNpmExecOptions, } from './commands/upgrade-helper.js';
90
90
  export type { DaemonUpgradeHelperPayload, CurrentGlobalInstallSurface, PinnedGlobalInstallCommand, NpmExecOptions, } from './commands/upgrade-helper.js';
package/dist/index.js CHANGED
@@ -316,10 +316,10 @@ function readInjected(value) {
316
316
  }
317
317
  function getDaemonBuildInfo() {
318
318
  if (cached) return cached;
319
- const commit = readInjected(true ? "376a56400a2a60c210b7d8a2476b5d2a15604c7e" : void 0) ?? "unknown";
320
- const commitShort = readInjected(true ? "376a5640" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
- const version = readInjected(true ? "0.9.82-rc.372" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
- const builtAt = readInjected(true ? "2026-06-24T13:46:48.450Z" : void 0);
319
+ const commit = readInjected(true ? "47e042dcb10c9ca07c30ac4bf8e0d5a4153a63c6" : void 0) ?? "unknown";
320
+ const commitShort = readInjected(true ? "47e042dc" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
+ const version = readInjected(true ? "0.9.82-rc.374" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
+ const builtAt = readInjected(true ? "2026-06-25T00:33:05.038Z" : void 0);
323
323
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
324
324
  return cached;
325
325
  }
@@ -8749,7 +8749,7 @@ var init_mesh_events_utils = __esm({
8749
8749
  "src/mesh/mesh-events-utils.ts"() {
8750
8750
  "use strict";
8751
8751
  MESH_SURFACED_PREVIEW_MAX_CHARS = 512;
8752
- MESH_COMPLETION_SURFACE_MAX_CHARS = 4e3;
8752
+ MESH_COMPLETION_SURFACE_MAX_CHARS = 16e3;
8753
8753
  }
8754
8754
  });
8755
8755
 
@@ -9389,6 +9389,22 @@ function isWeakCompletionLedgerPayload(payload) {
9389
9389
  const diag = readRecord4(payload.completionDiagnostic);
9390
9390
  return diag?.finalAssistantPresent === false || diag?.blockReason === "missing_final_assistant";
9391
9391
  }
9392
+ function findTerminalLedgerEvidenceForTask(args) {
9393
+ const taskId = readNonEmptyString2(args.taskId);
9394
+ if (!taskId) return null;
9395
+ const entries = readLedgerEntries(args.meshId, { tail: args.tail ?? 500 });
9396
+ for (let i = entries.length - 1; i >= 0; i--) {
9397
+ const entry = entries[i];
9398
+ if (entry.kind !== "task_completed" && entry.kind !== "task_failed" && entry.kind !== "task_stalled") continue;
9399
+ const terminalTaskId = readNonEmptyString2(entry.payload?.taskId);
9400
+ if (terminalTaskId !== taskId) continue;
9401
+ if (entry.kind === "task_completed" && isWeakCompletionLedgerPayload(entry.payload)) continue;
9402
+ if (args.sessionId && entry.sessionId && entry.sessionId !== args.sessionId) continue;
9403
+ if (!args.sessionId && args.nodeId && entry.nodeId && !meshNodeIdMatches(entry, args.nodeId)) continue;
9404
+ return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
9405
+ }
9406
+ return null;
9407
+ }
9392
9408
  function findDirectDispatchLedgerEntry(args) {
9393
9409
  const entries = readLedgerEntries(args.meshId, { tail: 500 });
9394
9410
  for (let i = entries.length - 1; i >= 0; i--) {
@@ -11517,7 +11533,7 @@ var init_chat_message_normalization = __esm({
11517
11533
  "src/providers/chat-message-normalization.ts"() {
11518
11534
  "use strict";
11519
11535
  init_contracts();
11520
- DEFAULT_FINAL_SUMMARY_MAX_CHARS = 4e3;
11536
+ DEFAULT_FINAL_SUMMARY_MAX_CHARS = 16e3;
11521
11537
  BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
11522
11538
  CHAT_MESSAGE_VISIBILITIES = ["user", "debug", "internal", "hidden"];
11523
11539
  CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES = ["visible", "chat", "user", "debug", "internal", "hidden"];
@@ -13033,6 +13049,23 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
13033
13049
  if (!task) {
13034
13050
  return false;
13035
13051
  }
13052
+ const terminal = findTerminalLedgerEvidenceForTask({
13053
+ meshId,
13054
+ taskId: task.id
13055
+ });
13056
+ if (terminal) {
13057
+ const status = terminal.kind === "task_completed" ? "completed" : "failed";
13058
+ updateTaskStatus(meshId, task.id, status);
13059
+ LOG.info("MeshQueue", `Skipped dispatch for terminal task ${task.id} on mesh ${meshId}; ${terminal.kind} ledger evidence already exists`);
13060
+ traceMeshEventDrop("dispatch_terminal_ledger", {
13061
+ taskId: task.id,
13062
+ sessionId,
13063
+ nodeId,
13064
+ meshId,
13065
+ event: "agent_command"
13066
+ }, terminal.kind);
13067
+ return false;
13068
+ }
13036
13069
  LOG.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
13037
13070
  if (node?.daemonId && components.dispatchMeshCommand) {
13038
13071
  const isLocalNode = components.cliManager.adapters.has(sessionId);
@@ -14570,20 +14603,24 @@ function daemonHostsMesh(mesh, daemonIds) {
14570
14603
  if (host.role && host.role !== "host") return false;
14571
14604
  const hostDaemonId = readNonEmptyString2(host.hostDaemonId);
14572
14605
  if (!hostDaemonId) return true;
14573
- return daemonIds.includes(hostDaemonId);
14606
+ return daemonIdListIncludes(daemonIds, hostDaemonId);
14607
+ }
14608
+ function daemonIdListIncludes(ids, id) {
14609
+ if (!id) return false;
14610
+ return ids.some((candidate) => candidate === id || daemonIdsEquivalent(candidate, id));
14574
14611
  }
14575
14612
  function resolveCoordinatorSelfIds(mesh, drainDaemonIds) {
14576
14613
  const ids = new Set(drainDaemonIds);
14577
14614
  for (const node of mesh.nodes) {
14578
14615
  const nodeDaemonId = readNonEmptyString2(node.daemonId);
14579
14616
  const nodeMachineId = readNonEmptyString2(node.machineId);
14580
- const isSelf = nodeDaemonId && drainDaemonIds.includes(nodeDaemonId) || nodeMachineId && drainDaemonIds.includes(nodeMachineId);
14617
+ const isSelf = nodeDaemonId && daemonIdListIncludes(drainDaemonIds, nodeDaemonId) || nodeMachineId && daemonIdListIncludes(drainDaemonIds, nodeMachineId);
14581
14618
  if (!isSelf) continue;
14582
14619
  if (nodeDaemonId) ids.add(nodeDaemonId);
14583
14620
  if (nodeMachineId) ids.add(nodeMachineId);
14584
14621
  }
14585
14622
  const hostDaemonId = readNonEmptyString2(mesh.meshHost?.hostDaemonId);
14586
- if (hostDaemonId && ids.has(hostDaemonId)) ids.add(hostDaemonId);
14623
+ if (hostDaemonId && daemonIdListIncludes([...ids], hostDaemonId)) ids.add(hostDaemonId);
14587
14624
  return [...ids];
14588
14625
  }
14589
14626
  function findLiveCoordinators(components) {
@@ -14661,6 +14698,23 @@ function recoverStrandedAssignedDispatches(meshId, store) {
14661
14698
  const dispatchedAtMs = Date.parse(row.dispatchTimestamp ?? "");
14662
14699
  if (!Number.isFinite(dispatchedAtMs)) continue;
14663
14700
  if (nowMs - dispatchedAtMs < ASSIGNED_STRANDED_DEADLINE_MS) continue;
14701
+ const terminal = findTerminalLedgerEvidenceForTask({
14702
+ meshId,
14703
+ taskId: row.id
14704
+ });
14705
+ if (terminal) {
14706
+ const status = terminal.kind === "task_completed" ? "completed" : "failed";
14707
+ updateTaskStatus(meshId, row.id, status);
14708
+ LOG.warn("MeshReconcile", `Skipped stranded reclaim redispatch for terminal task ${row.id} on mesh ${meshId}; ${terminal.kind} ledger evidence already exists`);
14709
+ traceMeshEventDrop("assigned_stranded_terminal_ledger", {
14710
+ taskId: row.id,
14711
+ sessionId: row.assignedSessionId,
14712
+ nodeId: row.assignedNodeId,
14713
+ meshId,
14714
+ event: "agent:generating_completed"
14715
+ }, terminal.kind);
14716
+ continue;
14717
+ }
14664
14718
  if (store.taskHasConfirmedDelivery(meshId, row.id)) continue;
14665
14719
  const reclaimed = reclaimStrandedAssignedTask(meshId, row.id, {
14666
14720
  reason: "assigned_stranded_dispatch_unconfirmed",
@@ -14957,7 +15011,7 @@ async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDa
14957
15011
  const nodeDaemonId = readNonEmptyString2(node.daemonId);
14958
15012
  if (!nodeDaemonId) continue;
14959
15013
  if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) continue;
14960
- if (candidateDaemonIds.includes(nodeDaemonId)) continue;
15014
+ if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) continue;
14961
15015
  for (const pendingEventArgs of pulls) {
14962
15016
  let events;
14963
15017
  try {
@@ -15013,7 +15067,7 @@ async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds,
15013
15067
  if (!sessionId || !nodeId || !taskId) continue;
15014
15068
  const node = nodeById.get(nodeId);
15015
15069
  const nodeDaemonId = readNonEmptyString2(node?.daemonId);
15016
- const isLocalNode = !nodeDaemonId || selfIds.includes(nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId) || !!components.instanceManager.getInstance(sessionId);
15070
+ const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId) || !!components.instanceManager.getInstance(sessionId);
15017
15071
  const providerType = readNonEmptyString2(dispatch.providerType);
15018
15072
  const readArgs = {
15019
15073
  sessionId,
@@ -15088,7 +15142,7 @@ async function collectLiveNodesWithSessions(components, mesh, selfIds, localDaem
15088
15142
  const dispatchMeshCommand = components.dispatchMeshCommand;
15089
15143
  return Promise.all(mesh.nodes.map(async (node) => {
15090
15144
  const nodeDaemonId = readNonEmptyString2(node.daemonId);
15091
- const isLocalNode = !nodeDaemonId || selfIds.includes(nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId);
15145
+ const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId);
15092
15146
  let statusResult;
15093
15147
  try {
15094
15148
  if (isLocalNode) {
@@ -20822,6 +20876,7 @@ __export(index_exports, {
20822
20876
  buildMeshLedgerReplicaEvidence: () => buildMeshLedgerReplicaEvidence,
20823
20877
  buildMeshNodeCapabilityTags: () => buildMeshNodeCapabilityTags,
20824
20878
  buildMeshNodeDataFreshness: () => buildMeshNodeDataFreshness,
20879
+ buildMeshNodeProbeFreshness: () => buildMeshNodeProbeFreshness,
20825
20880
  buildMissionPromptSection: () => buildMissionPromptSection,
20826
20881
  buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
20827
20882
  buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
@@ -34824,6 +34879,27 @@ function readByteBoundedTail(filePath, limitBytes) {
34824
34879
  fs13.closeSync(fd);
34825
34880
  }
34826
34881
  }
34882
+ function splitLogLines(text) {
34883
+ const lines = text.split("\n");
34884
+ if (lines.length && lines[lines.length - 1] === "") lines.pop();
34885
+ return lines;
34886
+ }
34887
+ function takeLastLinesWithinBytes(lines, limitBytes) {
34888
+ if (lines.length === 0) return { kept: [], truncated: false, bytesReturned: 0 };
34889
+ let total = 0;
34890
+ let firstKept = lines.length;
34891
+ for (let i = lines.length - 1; i >= 0; i--) {
34892
+ const lineBytes = Buffer.byteLength(lines[i], "utf-8") + 1;
34893
+ if (firstKept !== lines.length && total + lineBytes > limitBytes) break;
34894
+ total += lineBytes;
34895
+ firstKept = i;
34896
+ }
34897
+ return {
34898
+ kept: lines.slice(firstKept),
34899
+ truncated: firstKept > 0,
34900
+ bytesReturned: total
34901
+ };
34902
+ }
34827
34903
  function parseLineEpochMs(line, fileDate) {
34828
34904
  const m = line.match(/^\[(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,3}))?\]/);
34829
34905
  if (!m) {
@@ -34838,47 +34914,97 @@ function parseLineEpochMs(line, fileDate) {
34838
34914
  d.setHours(Number(m[1]), Number(m[2]), Number(m[3]), m[4] ? Number(m[4].padEnd(3, "0")) : 0);
34839
34915
  return d.getTime();
34840
34916
  }
34917
+ function buildGrepPredicate(grepSource) {
34918
+ let re = null;
34919
+ try {
34920
+ re = new RegExp(grepSource, "i");
34921
+ } catch {
34922
+ re = null;
34923
+ }
34924
+ if (re) {
34925
+ const compiled = re;
34926
+ return (line) => compiled.test(line);
34927
+ }
34928
+ const needle = grepSource.toLowerCase();
34929
+ return (line) => line.toLowerCase().includes(needle);
34930
+ }
34931
+ function fileDateFor(date) {
34932
+ if (date instanceof Date) return date;
34933
+ if (typeof date === "string" && date.trim()) return /* @__PURE__ */ new Date(`${date.trim()}T00:00:00.000Z`);
34934
+ return /* @__PURE__ */ new Date();
34935
+ }
34936
+ function errorResult(error, logPath, platform10) {
34937
+ return {
34938
+ success: false,
34939
+ error,
34940
+ lines: [],
34941
+ truncated: false,
34942
+ logPath,
34943
+ platform: platform10,
34944
+ bytesReturned: 0,
34945
+ filtered: false,
34946
+ fullScan: false,
34947
+ scannedBytes: 0,
34948
+ matchedLineCount: 0,
34949
+ excludedByFilter: 0
34950
+ };
34951
+ }
34841
34952
  function readDaemonLogTail(args = {}) {
34842
34953
  const platform10 = process.platform;
34843
34954
  const limitBytes = clampTailBytes(args.tailBytes);
34844
- let logPath = resolveLogPath(args.date);
34845
- if (!fs13.existsSync(logPath)) {
34846
- const backup = logPath.replace(/\.log$/, ".1.log");
34847
- if (fs13.existsSync(backup)) {
34848
- logPath = backup;
34849
- } else {
34850
- return {
34851
- success: false,
34852
- error: `No daemon log file at ${logPath} (dir: ${getDaemonLogDir()})`,
34853
- lines: [],
34854
- truncated: false,
34855
- logPath,
34856
- platform: platform10,
34857
- bytesReturned: 0,
34858
- filtered: false
34859
- };
34860
- }
34955
+ const primaryPath = resolveLogPath(args.date);
34956
+ const backupPath = primaryPath.replace(/\.log$/, ".1.log");
34957
+ const primaryExists = fs13.existsSync(primaryPath);
34958
+ const backupExists = fs13.existsSync(backupPath);
34959
+ if (!primaryExists && !backupExists) {
34960
+ return errorResult(
34961
+ `No daemon log file at ${primaryPath} (dir: ${getDaemonLogDir()})`,
34962
+ primaryPath,
34963
+ platform10
34964
+ );
34861
34965
  }
34862
- let raw;
34863
- try {
34864
- raw = readByteBoundedTail(logPath, limitBytes);
34865
- } catch (e) {
34966
+ const logPath = primaryExists ? primaryPath : backupPath;
34967
+ const hasGrep = typeof args.grep === "string" && args.grep.trim().length > 0;
34968
+ const hasSince = Number.isFinite(args.sinceMs);
34969
+ const filterMode = hasGrep || hasSince;
34970
+ if (!filterMode) {
34971
+ let raw;
34972
+ try {
34973
+ raw = readByteBoundedTail(logPath, limitBytes);
34974
+ } catch (e) {
34975
+ return errorResult(`Failed to read ${logPath}: ${e?.message ?? String(e)}`, logPath, platform10);
34976
+ }
34977
+ const lines2 = splitLogLines(raw.text);
34866
34978
  return {
34867
- success: false,
34868
- error: `Failed to read ${logPath}: ${e?.message ?? String(e)}`,
34869
- lines: [],
34870
- truncated: false,
34979
+ success: true,
34980
+ lines: lines2,
34981
+ truncated: raw.truncated,
34871
34982
  logPath,
34872
34983
  platform: platform10,
34873
- bytesReturned: 0,
34874
- filtered: false
34984
+ bytesReturned: raw.bytesReturned,
34985
+ filtered: false,
34986
+ fullScan: false,
34987
+ scannedBytes: raw.bytesReturned,
34988
+ matchedLineCount: lines2.length,
34989
+ excludedByFilter: 0
34875
34990
  };
34876
34991
  }
34877
- let lines = raw.text.split("\n");
34878
- if (lines.length && lines[lines.length - 1] === "") lines.pop();
34879
- const rawCount = lines.length;
34880
- if (Number.isFinite(args.sinceMs)) {
34881
- 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();
34992
+ let scannedBytes = 0;
34993
+ let allLines = [];
34994
+ try {
34995
+ for (const p of [backupExists ? backupPath : null, primaryExists ? primaryPath : null]) {
34996
+ if (!p) continue;
34997
+ const buf = fs13.readFileSync(p);
34998
+ scannedBytes += buf.length;
34999
+ allLines = allLines.concat(splitLogLines(buf.toString("utf-8")));
35000
+ }
35001
+ } catch (e) {
35002
+ return errorResult(`Failed to read ${logPath}: ${e?.message ?? String(e)}`, logPath, platform10);
35003
+ }
35004
+ const scannedLineCount = allLines.length;
35005
+ let lines = allLines;
35006
+ if (hasSince) {
35007
+ const fileDate = fileDateFor(args.date);
34882
35008
  const floor = args.sinceMs;
34883
35009
  lines = lines.filter((line) => {
34884
35010
  const ts2 = parseLineEpochMs(line, fileDate);
@@ -34886,30 +35012,26 @@ function readDaemonLogTail(args = {}) {
34886
35012
  });
34887
35013
  }
34888
35014
  let appliedGrep;
34889
- if (typeof args.grep === "string" && args.grep.trim()) {
35015
+ if (hasGrep) {
34890
35016
  appliedGrep = args.grep.trim();
34891
- let re = null;
34892
- try {
34893
- re = new RegExp(appliedGrep, "i");
34894
- } catch {
34895
- re = null;
34896
- }
34897
- if (re) {
34898
- const compiled = re;
34899
- lines = lines.filter((line) => compiled.test(line));
34900
- } else {
34901
- const needle = appliedGrep.toLowerCase();
34902
- lines = lines.filter((line) => line.toLowerCase().includes(needle));
34903
- }
35017
+ const matches = buildGrepPredicate(appliedGrep);
35018
+ lines = lines.filter(matches);
34904
35019
  }
35020
+ const matchedLineCount = lines.length;
35021
+ const excludedByFilter = scannedLineCount - matchedLineCount;
35022
+ const capped = takeLastLinesWithinBytes(lines, limitBytes);
34905
35023
  return {
34906
35024
  success: true,
34907
- lines,
34908
- truncated: raw.truncated,
35025
+ lines: capped.kept,
35026
+ truncated: capped.truncated,
34909
35027
  logPath,
34910
35028
  platform: platform10,
34911
- bytesReturned: raw.bytesReturned,
34912
- filtered: lines.length !== rawCount,
35029
+ bytesReturned: capped.bytesReturned,
35030
+ filtered: excludedByFilter > 0,
35031
+ fullScan: true,
35032
+ scannedBytes,
35033
+ matchedLineCount,
35034
+ excludedByFilter,
34913
35035
  ...appliedGrep ? { grep: appliedGrep } : {}
34914
35036
  };
34915
35037
  }
@@ -35026,6 +35148,12 @@ var meshNodeLogsHandlers = {
35026
35148
  truncated: tail.truncated,
35027
35149
  filtered: tail.filtered,
35028
35150
  bytesReturned: tail.bytesReturned,
35151
+ // Transparency meta — lets the coordinator see that a full-file grep
35152
+ // ran past the recent tail window, and how much was scanned/excluded.
35153
+ fullScan: tail.fullScan,
35154
+ scannedBytes: tail.scannedBytes,
35155
+ matchedLineCount: tail.matchedLineCount,
35156
+ excludedByFilter: tail.excludedByFilter,
35029
35157
  ...tail.grep ? { grep: tail.grep } : {}
35030
35158
  };
35031
35159
  }
@@ -46797,7 +46925,7 @@ var meshCrudHandlers = {
46797
46925
  return "";
46798
46926
  }
46799
46927
  })();
46800
- const isCoordinatorBaseNode = !!selfDaemonId && (nodeDaemonId === selfDaemonId || nodeMachineId === selfDaemonId) || !!selfMachineId && (nodeDaemonId === selfMachineId || nodeMachineId === selfMachineId);
46928
+ const isCoordinatorBaseNode = !!selfDaemonId && (daemonIdsEquivalent(nodeDaemonId, selfDaemonId) || daemonIdsEquivalent(nodeMachineId, selfDaemonId)) || !!selfMachineId && (daemonIdsEquivalent(nodeDaemonId, selfMachineId) || daemonIdsEquivalent(nodeMachineId, selfMachineId));
46801
46929
  if (isCoordinatorBaseNode) {
46802
46930
  return {
46803
46931
  success: false,
@@ -48146,7 +48274,7 @@ ${ptyResult.output.slice(-2e3)}`);
48146
48274
  workspace
48147
48275
  };
48148
48276
  }
48149
- const { existsSync: existsSync49, readFileSync: readFileSync39, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
48277
+ const { existsSync: existsSync49, readFileSync: readFileSync40, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
48150
48278
  const { dirname: dirname17 } = await import("path");
48151
48279
  const mcpConfigPath = coordinatorSetup.configPath;
48152
48280
  const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
@@ -48196,7 +48324,7 @@ ${ptyResult.output.slice(-2e3)}`);
48196
48324
  }
48197
48325
  if (hadExistingMcpConfig) {
48198
48326
  try {
48199
- const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync39(mcpConfigPath, "utf-8"), configFormat);
48327
+ const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync40(mcpConfigPath, "utf-8"), configFormat);
48200
48328
  const existingCoordinatorConfig = hermesManualFallback ? stripHermesCoordinatorTempModelProviderOverrides(parsedExistingMcpConfig) : parsedExistingMcpConfig;
48201
48329
  existingMcpConfig = { ...existingMcpConfig, ...existingCoordinatorConfig };
48202
48330
  copyFileSync4(mcpConfigPath, mcpConfigPath + ".backup");
@@ -49916,6 +50044,23 @@ function buildMeshNodeDataFreshness(args) {
49916
50044
  staleness
49917
50045
  };
49918
50046
  }
50047
+ function buildMeshNodeProbeFreshness(args) {
50048
+ const { git, liveTruthProbed, isSelfNode, daemonId, node, now } = args;
50049
+ const status = {
50050
+ git,
50051
+ connection: { state: liveTruthProbed ? "connected" : "disconnected" }
50052
+ };
50053
+ if (liveTruthProbed) status[MESH_NODE_LIVE_TRUTH_MARKER] = true;
50054
+ return buildMeshNodeDataFreshness({
50055
+ status,
50056
+ node,
50057
+ isSelfNode,
50058
+ daemonId,
50059
+ liveTruthProbed,
50060
+ directTruthUnavailable: !liveTruthProbed && !!daemonId,
50061
+ now
50062
+ });
50063
+ }
49919
50064
  function finalizeMeshNodeStatus(args) {
49920
50065
  const { status, node, daemonId, isSelfNode, directTruthUnavailable } = args;
49921
50066
  if (!readStringValue(status.machineStatus)) {
@@ -62069,6 +62214,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
62069
62214
  buildMeshLedgerReplicaEvidence,
62070
62215
  buildMeshNodeCapabilityTags,
62071
62216
  buildMeshNodeDataFreshness,
62217
+ buildMeshNodeProbeFreshness,
62072
62218
  buildMissionPromptSection,
62073
62219
  buildP2pRelayFailurePayload,
62074
62220
  buildPinnedGlobalInstallCommand,