@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.
- package/dist/commands/router.d.ts +28 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +211 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -69
- package/dist/index.mjs.map +1 -1
- package/dist/logging/log-tail-reader.d.ts +40 -5
- package/dist/mesh/mesh-events-stale.d.ts +12 -0
- package/dist/providers/chat-message-normalization.d.ts +1 -1
- package/package.json +2 -2
- package/src/commands/low-family/mesh-node-logs.ts +6 -0
- package/src/commands/med-family/mesh-crud.ts +12 -2
- package/src/commands/router.ts +45 -0
- package/src/index.ts +1 -1
- package/src/logging/log-tail-reader.ts +187 -66
- package/src/mesh/mesh-events-coordinator.ts +19 -0
- package/src/mesh/mesh-events-stale.ts +23 -0
- package/src/mesh/mesh-events-utils.ts +1 -1
- package/src/mesh/mesh-reconcile-loop.ts +31 -9
- package/src/providers/chat-message-normalization.ts +1 -1
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 ? "
|
|
315
|
-
const commitShort = readInjected(true ? "
|
|
316
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
317
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
314
|
+
const commit = readInjected(true ? "47e042dcb10c9ca07c30ac4bf8e0d5a4153a63c6" : void 0) ?? "unknown";
|
|
315
|
+
const commitShort = readInjected(true ? "47e042dc" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
316
|
+
const version = readInjected(true ? "0.9.82-rc.374" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
317
|
+
const builtAt = readInjected(true ? "2026-06-25T00:33:05.038Z" : void 0);
|
|
318
318
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
319
319
|
return cached;
|
|
320
320
|
}
|
|
@@ -8742,7 +8742,7 @@ var init_mesh_events_utils = __esm({
|
|
|
8742
8742
|
"src/mesh/mesh-events-utils.ts"() {
|
|
8743
8743
|
"use strict";
|
|
8744
8744
|
MESH_SURFACED_PREVIEW_MAX_CHARS = 512;
|
|
8745
|
-
MESH_COMPLETION_SURFACE_MAX_CHARS =
|
|
8745
|
+
MESH_COMPLETION_SURFACE_MAX_CHARS = 16e3;
|
|
8746
8746
|
}
|
|
8747
8747
|
});
|
|
8748
8748
|
|
|
@@ -9382,6 +9382,22 @@ function isWeakCompletionLedgerPayload(payload) {
|
|
|
9382
9382
|
const diag = readRecord4(payload.completionDiagnostic);
|
|
9383
9383
|
return diag?.finalAssistantPresent === false || diag?.blockReason === "missing_final_assistant";
|
|
9384
9384
|
}
|
|
9385
|
+
function findTerminalLedgerEvidenceForTask(args) {
|
|
9386
|
+
const taskId = readNonEmptyString2(args.taskId);
|
|
9387
|
+
if (!taskId) return null;
|
|
9388
|
+
const entries = readLedgerEntries(args.meshId, { tail: args.tail ?? 500 });
|
|
9389
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
9390
|
+
const entry = entries[i];
|
|
9391
|
+
if (entry.kind !== "task_completed" && entry.kind !== "task_failed" && entry.kind !== "task_stalled") continue;
|
|
9392
|
+
const terminalTaskId = readNonEmptyString2(entry.payload?.taskId);
|
|
9393
|
+
if (terminalTaskId !== taskId) continue;
|
|
9394
|
+
if (entry.kind === "task_completed" && isWeakCompletionLedgerPayload(entry.payload)) continue;
|
|
9395
|
+
if (args.sessionId && entry.sessionId && entry.sessionId !== args.sessionId) continue;
|
|
9396
|
+
if (!args.sessionId && args.nodeId && entry.nodeId && !meshNodeIdMatches(entry, args.nodeId)) continue;
|
|
9397
|
+
return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
9398
|
+
}
|
|
9399
|
+
return null;
|
|
9400
|
+
}
|
|
9385
9401
|
function findDirectDispatchLedgerEntry(args) {
|
|
9386
9402
|
const entries = readLedgerEntries(args.meshId, { tail: 500 });
|
|
9387
9403
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
@@ -11512,7 +11528,7 @@ var init_chat_message_normalization = __esm({
|
|
|
11512
11528
|
"src/providers/chat-message-normalization.ts"() {
|
|
11513
11529
|
"use strict";
|
|
11514
11530
|
init_contracts();
|
|
11515
|
-
DEFAULT_FINAL_SUMMARY_MAX_CHARS =
|
|
11531
|
+
DEFAULT_FINAL_SUMMARY_MAX_CHARS = 16e3;
|
|
11516
11532
|
BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
|
|
11517
11533
|
CHAT_MESSAGE_VISIBILITIES = ["user", "debug", "internal", "hidden"];
|
|
11518
11534
|
CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES = ["visible", "chat", "user", "debug", "internal", "hidden"];
|
|
@@ -13029,6 +13045,23 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
|
|
|
13029
13045
|
if (!task) {
|
|
13030
13046
|
return false;
|
|
13031
13047
|
}
|
|
13048
|
+
const terminal = findTerminalLedgerEvidenceForTask({
|
|
13049
|
+
meshId,
|
|
13050
|
+
taskId: task.id
|
|
13051
|
+
});
|
|
13052
|
+
if (terminal) {
|
|
13053
|
+
const status = terminal.kind === "task_completed" ? "completed" : "failed";
|
|
13054
|
+
updateTaskStatus(meshId, task.id, status);
|
|
13055
|
+
LOG.info("MeshQueue", `Skipped dispatch for terminal task ${task.id} on mesh ${meshId}; ${terminal.kind} ledger evidence already exists`);
|
|
13056
|
+
traceMeshEventDrop("dispatch_terminal_ledger", {
|
|
13057
|
+
taskId: task.id,
|
|
13058
|
+
sessionId,
|
|
13059
|
+
nodeId,
|
|
13060
|
+
meshId,
|
|
13061
|
+
event: "agent_command"
|
|
13062
|
+
}, terminal.kind);
|
|
13063
|
+
return false;
|
|
13064
|
+
}
|
|
13032
13065
|
LOG.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
|
|
13033
13066
|
if (node?.daemonId && components.dispatchMeshCommand) {
|
|
13034
13067
|
const isLocalNode = components.cliManager.adapters.has(sessionId);
|
|
@@ -14565,20 +14598,24 @@ function daemonHostsMesh(mesh, daemonIds) {
|
|
|
14565
14598
|
if (host.role && host.role !== "host") return false;
|
|
14566
14599
|
const hostDaemonId = readNonEmptyString2(host.hostDaemonId);
|
|
14567
14600
|
if (!hostDaemonId) return true;
|
|
14568
|
-
return daemonIds
|
|
14601
|
+
return daemonIdListIncludes(daemonIds, hostDaemonId);
|
|
14602
|
+
}
|
|
14603
|
+
function daemonIdListIncludes(ids, id) {
|
|
14604
|
+
if (!id) return false;
|
|
14605
|
+
return ids.some((candidate) => candidate === id || daemonIdsEquivalent(candidate, id));
|
|
14569
14606
|
}
|
|
14570
14607
|
function resolveCoordinatorSelfIds(mesh, drainDaemonIds) {
|
|
14571
14608
|
const ids = new Set(drainDaemonIds);
|
|
14572
14609
|
for (const node of mesh.nodes) {
|
|
14573
14610
|
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
14574
14611
|
const nodeMachineId = readNonEmptyString2(node.machineId);
|
|
14575
|
-
const isSelf = nodeDaemonId && drainDaemonIds
|
|
14612
|
+
const isSelf = nodeDaemonId && daemonIdListIncludes(drainDaemonIds, nodeDaemonId) || nodeMachineId && daemonIdListIncludes(drainDaemonIds, nodeMachineId);
|
|
14576
14613
|
if (!isSelf) continue;
|
|
14577
14614
|
if (nodeDaemonId) ids.add(nodeDaemonId);
|
|
14578
14615
|
if (nodeMachineId) ids.add(nodeMachineId);
|
|
14579
14616
|
}
|
|
14580
14617
|
const hostDaemonId = readNonEmptyString2(mesh.meshHost?.hostDaemonId);
|
|
14581
|
-
if (hostDaemonId && ids
|
|
14618
|
+
if (hostDaemonId && daemonIdListIncludes([...ids], hostDaemonId)) ids.add(hostDaemonId);
|
|
14582
14619
|
return [...ids];
|
|
14583
14620
|
}
|
|
14584
14621
|
function findLiveCoordinators(components) {
|
|
@@ -14656,6 +14693,23 @@ function recoverStrandedAssignedDispatches(meshId, store) {
|
|
|
14656
14693
|
const dispatchedAtMs = Date.parse(row.dispatchTimestamp ?? "");
|
|
14657
14694
|
if (!Number.isFinite(dispatchedAtMs)) continue;
|
|
14658
14695
|
if (nowMs - dispatchedAtMs < ASSIGNED_STRANDED_DEADLINE_MS) continue;
|
|
14696
|
+
const terminal = findTerminalLedgerEvidenceForTask({
|
|
14697
|
+
meshId,
|
|
14698
|
+
taskId: row.id
|
|
14699
|
+
});
|
|
14700
|
+
if (terminal) {
|
|
14701
|
+
const status = terminal.kind === "task_completed" ? "completed" : "failed";
|
|
14702
|
+
updateTaskStatus(meshId, row.id, status);
|
|
14703
|
+
LOG.warn("MeshReconcile", `Skipped stranded reclaim redispatch for terminal task ${row.id} on mesh ${meshId}; ${terminal.kind} ledger evidence already exists`);
|
|
14704
|
+
traceMeshEventDrop("assigned_stranded_terminal_ledger", {
|
|
14705
|
+
taskId: row.id,
|
|
14706
|
+
sessionId: row.assignedSessionId,
|
|
14707
|
+
nodeId: row.assignedNodeId,
|
|
14708
|
+
meshId,
|
|
14709
|
+
event: "agent:generating_completed"
|
|
14710
|
+
}, terminal.kind);
|
|
14711
|
+
continue;
|
|
14712
|
+
}
|
|
14659
14713
|
if (store.taskHasConfirmedDelivery(meshId, row.id)) continue;
|
|
14660
14714
|
const reclaimed = reclaimStrandedAssignedTask(meshId, row.id, {
|
|
14661
14715
|
reason: "assigned_stranded_dispatch_unconfirmed",
|
|
@@ -14952,7 +15006,7 @@ async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDa
|
|
|
14952
15006
|
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
14953
15007
|
if (!nodeDaemonId) continue;
|
|
14954
15008
|
if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) continue;
|
|
14955
|
-
if (candidateDaemonIds
|
|
15009
|
+
if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) continue;
|
|
14956
15010
|
for (const pendingEventArgs of pulls) {
|
|
14957
15011
|
let events;
|
|
14958
15012
|
try {
|
|
@@ -15008,7 +15062,7 @@ async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds,
|
|
|
15008
15062
|
if (!sessionId || !nodeId || !taskId) continue;
|
|
15009
15063
|
const node = nodeById.get(nodeId);
|
|
15010
15064
|
const nodeDaemonId = readNonEmptyString2(node?.daemonId);
|
|
15011
|
-
const isLocalNode = !nodeDaemonId || selfIds
|
|
15065
|
+
const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId) || !!components.instanceManager.getInstance(sessionId);
|
|
15012
15066
|
const providerType = readNonEmptyString2(dispatch.providerType);
|
|
15013
15067
|
const readArgs = {
|
|
15014
15068
|
sessionId,
|
|
@@ -15083,7 +15137,7 @@ async function collectLiveNodesWithSessions(components, mesh, selfIds, localDaem
|
|
|
15083
15137
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
15084
15138
|
return Promise.all(mesh.nodes.map(async (node) => {
|
|
15085
15139
|
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
15086
|
-
const isLocalNode = !nodeDaemonId || selfIds
|
|
15140
|
+
const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId);
|
|
15087
15141
|
let statusResult;
|
|
15088
15142
|
try {
|
|
15089
15143
|
if (isLocalNode) {
|
|
@@ -34451,6 +34505,27 @@ function readByteBoundedTail(filePath, limitBytes) {
|
|
|
34451
34505
|
fs13.closeSync(fd);
|
|
34452
34506
|
}
|
|
34453
34507
|
}
|
|
34508
|
+
function splitLogLines(text) {
|
|
34509
|
+
const lines = text.split("\n");
|
|
34510
|
+
if (lines.length && lines[lines.length - 1] === "") lines.pop();
|
|
34511
|
+
return lines;
|
|
34512
|
+
}
|
|
34513
|
+
function takeLastLinesWithinBytes(lines, limitBytes) {
|
|
34514
|
+
if (lines.length === 0) return { kept: [], truncated: false, bytesReturned: 0 };
|
|
34515
|
+
let total = 0;
|
|
34516
|
+
let firstKept = lines.length;
|
|
34517
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
34518
|
+
const lineBytes = Buffer.byteLength(lines[i], "utf-8") + 1;
|
|
34519
|
+
if (firstKept !== lines.length && total + lineBytes > limitBytes) break;
|
|
34520
|
+
total += lineBytes;
|
|
34521
|
+
firstKept = i;
|
|
34522
|
+
}
|
|
34523
|
+
return {
|
|
34524
|
+
kept: lines.slice(firstKept),
|
|
34525
|
+
truncated: firstKept > 0,
|
|
34526
|
+
bytesReturned: total
|
|
34527
|
+
};
|
|
34528
|
+
}
|
|
34454
34529
|
function parseLineEpochMs(line, fileDate) {
|
|
34455
34530
|
const m = line.match(/^\[(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,3}))?\]/);
|
|
34456
34531
|
if (!m) {
|
|
@@ -34465,47 +34540,97 @@ function parseLineEpochMs(line, fileDate) {
|
|
|
34465
34540
|
d.setHours(Number(m[1]), Number(m[2]), Number(m[3]), m[4] ? Number(m[4].padEnd(3, "0")) : 0);
|
|
34466
34541
|
return d.getTime();
|
|
34467
34542
|
}
|
|
34543
|
+
function buildGrepPredicate(grepSource) {
|
|
34544
|
+
let re = null;
|
|
34545
|
+
try {
|
|
34546
|
+
re = new RegExp(grepSource, "i");
|
|
34547
|
+
} catch {
|
|
34548
|
+
re = null;
|
|
34549
|
+
}
|
|
34550
|
+
if (re) {
|
|
34551
|
+
const compiled = re;
|
|
34552
|
+
return (line) => compiled.test(line);
|
|
34553
|
+
}
|
|
34554
|
+
const needle = grepSource.toLowerCase();
|
|
34555
|
+
return (line) => line.toLowerCase().includes(needle);
|
|
34556
|
+
}
|
|
34557
|
+
function fileDateFor(date) {
|
|
34558
|
+
if (date instanceof Date) return date;
|
|
34559
|
+
if (typeof date === "string" && date.trim()) return /* @__PURE__ */ new Date(`${date.trim()}T00:00:00.000Z`);
|
|
34560
|
+
return /* @__PURE__ */ new Date();
|
|
34561
|
+
}
|
|
34562
|
+
function errorResult(error, logPath, platform10) {
|
|
34563
|
+
return {
|
|
34564
|
+
success: false,
|
|
34565
|
+
error,
|
|
34566
|
+
lines: [],
|
|
34567
|
+
truncated: false,
|
|
34568
|
+
logPath,
|
|
34569
|
+
platform: platform10,
|
|
34570
|
+
bytesReturned: 0,
|
|
34571
|
+
filtered: false,
|
|
34572
|
+
fullScan: false,
|
|
34573
|
+
scannedBytes: 0,
|
|
34574
|
+
matchedLineCount: 0,
|
|
34575
|
+
excludedByFilter: 0
|
|
34576
|
+
};
|
|
34577
|
+
}
|
|
34468
34578
|
function readDaemonLogTail(args = {}) {
|
|
34469
34579
|
const platform10 = process.platform;
|
|
34470
34580
|
const limitBytes = clampTailBytes(args.tailBytes);
|
|
34471
|
-
|
|
34472
|
-
|
|
34473
|
-
|
|
34474
|
-
|
|
34475
|
-
|
|
34476
|
-
|
|
34477
|
-
|
|
34478
|
-
|
|
34479
|
-
|
|
34480
|
-
|
|
34481
|
-
truncated: false,
|
|
34482
|
-
logPath,
|
|
34483
|
-
platform: platform10,
|
|
34484
|
-
bytesReturned: 0,
|
|
34485
|
-
filtered: false
|
|
34486
|
-
};
|
|
34487
|
-
}
|
|
34581
|
+
const primaryPath = resolveLogPath(args.date);
|
|
34582
|
+
const backupPath = primaryPath.replace(/\.log$/, ".1.log");
|
|
34583
|
+
const primaryExists = fs13.existsSync(primaryPath);
|
|
34584
|
+
const backupExists = fs13.existsSync(backupPath);
|
|
34585
|
+
if (!primaryExists && !backupExists) {
|
|
34586
|
+
return errorResult(
|
|
34587
|
+
`No daemon log file at ${primaryPath} (dir: ${getDaemonLogDir()})`,
|
|
34588
|
+
primaryPath,
|
|
34589
|
+
platform10
|
|
34590
|
+
);
|
|
34488
34591
|
}
|
|
34489
|
-
|
|
34490
|
-
|
|
34491
|
-
|
|
34492
|
-
|
|
34592
|
+
const logPath = primaryExists ? primaryPath : backupPath;
|
|
34593
|
+
const hasGrep = typeof args.grep === "string" && args.grep.trim().length > 0;
|
|
34594
|
+
const hasSince = Number.isFinite(args.sinceMs);
|
|
34595
|
+
const filterMode = hasGrep || hasSince;
|
|
34596
|
+
if (!filterMode) {
|
|
34597
|
+
let raw;
|
|
34598
|
+
try {
|
|
34599
|
+
raw = readByteBoundedTail(logPath, limitBytes);
|
|
34600
|
+
} catch (e) {
|
|
34601
|
+
return errorResult(`Failed to read ${logPath}: ${e?.message ?? String(e)}`, logPath, platform10);
|
|
34602
|
+
}
|
|
34603
|
+
const lines2 = splitLogLines(raw.text);
|
|
34493
34604
|
return {
|
|
34494
|
-
success:
|
|
34495
|
-
|
|
34496
|
-
|
|
34497
|
-
truncated: false,
|
|
34605
|
+
success: true,
|
|
34606
|
+
lines: lines2,
|
|
34607
|
+
truncated: raw.truncated,
|
|
34498
34608
|
logPath,
|
|
34499
34609
|
platform: platform10,
|
|
34500
|
-
bytesReturned:
|
|
34501
|
-
filtered: false
|
|
34610
|
+
bytesReturned: raw.bytesReturned,
|
|
34611
|
+
filtered: false,
|
|
34612
|
+
fullScan: false,
|
|
34613
|
+
scannedBytes: raw.bytesReturned,
|
|
34614
|
+
matchedLineCount: lines2.length,
|
|
34615
|
+
excludedByFilter: 0
|
|
34502
34616
|
};
|
|
34503
34617
|
}
|
|
34504
|
-
let
|
|
34505
|
-
|
|
34506
|
-
|
|
34507
|
-
|
|
34508
|
-
|
|
34618
|
+
let scannedBytes = 0;
|
|
34619
|
+
let allLines = [];
|
|
34620
|
+
try {
|
|
34621
|
+
for (const p of [backupExists ? backupPath : null, primaryExists ? primaryPath : null]) {
|
|
34622
|
+
if (!p) continue;
|
|
34623
|
+
const buf = fs13.readFileSync(p);
|
|
34624
|
+
scannedBytes += buf.length;
|
|
34625
|
+
allLines = allLines.concat(splitLogLines(buf.toString("utf-8")));
|
|
34626
|
+
}
|
|
34627
|
+
} catch (e) {
|
|
34628
|
+
return errorResult(`Failed to read ${logPath}: ${e?.message ?? String(e)}`, logPath, platform10);
|
|
34629
|
+
}
|
|
34630
|
+
const scannedLineCount = allLines.length;
|
|
34631
|
+
let lines = allLines;
|
|
34632
|
+
if (hasSince) {
|
|
34633
|
+
const fileDate = fileDateFor(args.date);
|
|
34509
34634
|
const floor = args.sinceMs;
|
|
34510
34635
|
lines = lines.filter((line) => {
|
|
34511
34636
|
const ts2 = parseLineEpochMs(line, fileDate);
|
|
@@ -34513,30 +34638,26 @@ function readDaemonLogTail(args = {}) {
|
|
|
34513
34638
|
});
|
|
34514
34639
|
}
|
|
34515
34640
|
let appliedGrep;
|
|
34516
|
-
if (
|
|
34641
|
+
if (hasGrep) {
|
|
34517
34642
|
appliedGrep = args.grep.trim();
|
|
34518
|
-
|
|
34519
|
-
|
|
34520
|
-
re = new RegExp(appliedGrep, "i");
|
|
34521
|
-
} catch {
|
|
34522
|
-
re = null;
|
|
34523
|
-
}
|
|
34524
|
-
if (re) {
|
|
34525
|
-
const compiled = re;
|
|
34526
|
-
lines = lines.filter((line) => compiled.test(line));
|
|
34527
|
-
} else {
|
|
34528
|
-
const needle = appliedGrep.toLowerCase();
|
|
34529
|
-
lines = lines.filter((line) => line.toLowerCase().includes(needle));
|
|
34530
|
-
}
|
|
34643
|
+
const matches = buildGrepPredicate(appliedGrep);
|
|
34644
|
+
lines = lines.filter(matches);
|
|
34531
34645
|
}
|
|
34646
|
+
const matchedLineCount = lines.length;
|
|
34647
|
+
const excludedByFilter = scannedLineCount - matchedLineCount;
|
|
34648
|
+
const capped = takeLastLinesWithinBytes(lines, limitBytes);
|
|
34532
34649
|
return {
|
|
34533
34650
|
success: true,
|
|
34534
|
-
lines,
|
|
34535
|
-
truncated:
|
|
34651
|
+
lines: capped.kept,
|
|
34652
|
+
truncated: capped.truncated,
|
|
34536
34653
|
logPath,
|
|
34537
34654
|
platform: platform10,
|
|
34538
|
-
bytesReturned:
|
|
34539
|
-
filtered:
|
|
34655
|
+
bytesReturned: capped.bytesReturned,
|
|
34656
|
+
filtered: excludedByFilter > 0,
|
|
34657
|
+
fullScan: true,
|
|
34658
|
+
scannedBytes,
|
|
34659
|
+
matchedLineCount,
|
|
34660
|
+
excludedByFilter,
|
|
34540
34661
|
...appliedGrep ? { grep: appliedGrep } : {}
|
|
34541
34662
|
};
|
|
34542
34663
|
}
|
|
@@ -34653,6 +34774,12 @@ var meshNodeLogsHandlers = {
|
|
|
34653
34774
|
truncated: tail.truncated,
|
|
34654
34775
|
filtered: tail.filtered,
|
|
34655
34776
|
bytesReturned: tail.bytesReturned,
|
|
34777
|
+
// Transparency meta — lets the coordinator see that a full-file grep
|
|
34778
|
+
// ran past the recent tail window, and how much was scanned/excluded.
|
|
34779
|
+
fullScan: tail.fullScan,
|
|
34780
|
+
scannedBytes: tail.scannedBytes,
|
|
34781
|
+
matchedLineCount: tail.matchedLineCount,
|
|
34782
|
+
excludedByFilter: tail.excludedByFilter,
|
|
34656
34783
|
...tail.grep ? { grep: tail.grep } : {}
|
|
34657
34784
|
};
|
|
34658
34785
|
}
|
|
@@ -46429,7 +46556,7 @@ var meshCrudHandlers = {
|
|
|
46429
46556
|
return "";
|
|
46430
46557
|
}
|
|
46431
46558
|
})();
|
|
46432
|
-
const isCoordinatorBaseNode = !!selfDaemonId && (nodeDaemonId
|
|
46559
|
+
const isCoordinatorBaseNode = !!selfDaemonId && (daemonIdsEquivalent(nodeDaemonId, selfDaemonId) || daemonIdsEquivalent(nodeMachineId, selfDaemonId)) || !!selfMachineId && (daemonIdsEquivalent(nodeDaemonId, selfMachineId) || daemonIdsEquivalent(nodeMachineId, selfMachineId));
|
|
46433
46560
|
if (isCoordinatorBaseNode) {
|
|
46434
46561
|
return {
|
|
46435
46562
|
success: false,
|
|
@@ -47778,7 +47905,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
47778
47905
|
workspace
|
|
47779
47906
|
};
|
|
47780
47907
|
}
|
|
47781
|
-
const { existsSync: existsSync49, readFileSync:
|
|
47908
|
+
const { existsSync: existsSync49, readFileSync: readFileSync40, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
|
|
47782
47909
|
const { dirname: dirname17 } = await import("path");
|
|
47783
47910
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
47784
47911
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -47828,7 +47955,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
47828
47955
|
}
|
|
47829
47956
|
if (hadExistingMcpConfig) {
|
|
47830
47957
|
try {
|
|
47831
|
-
const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(
|
|
47958
|
+
const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync40(mcpConfigPath, "utf-8"), configFormat);
|
|
47832
47959
|
const existingCoordinatorConfig = hermesManualFallback ? stripHermesCoordinatorTempModelProviderOverrides(parsedExistingMcpConfig) : parsedExistingMcpConfig;
|
|
47833
47960
|
existingMcpConfig = { ...existingMcpConfig, ...existingCoordinatorConfig };
|
|
47834
47961
|
copyFileSync4(mcpConfigPath, mcpConfigPath + ".backup");
|
|
@@ -47956,7 +48083,7 @@ import { hostname as osHostname } from "os";
|
|
|
47956
48083
|
|
|
47957
48084
|
// src/mesh/preview-freshness.ts
|
|
47958
48085
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
47959
|
-
import { existsSync as existsSync39, readFileSync as
|
|
48086
|
+
import { existsSync as existsSync39, readFileSync as readFileSync30 } from "fs";
|
|
47960
48087
|
import { resolve as resolve19 } from "path";
|
|
47961
48088
|
var PREVIEW_DEPLOY_RECORD = ".adhdev/preview-deploy.json";
|
|
47962
48089
|
function runGit2(repoRoot, args) {
|
|
@@ -47975,7 +48102,7 @@ function readRecord5(repoRoot) {
|
|
|
47975
48102
|
const path42 = resolve19(repoRoot, PREVIEW_DEPLOY_RECORD);
|
|
47976
48103
|
if (!existsSync39(path42)) return null;
|
|
47977
48104
|
try {
|
|
47978
|
-
const parsed = JSON.parse(
|
|
48105
|
+
const parsed = JSON.parse(readFileSync30(path42, "utf8"));
|
|
47979
48106
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
47980
48107
|
} catch {
|
|
47981
48108
|
return null;
|
|
@@ -49548,6 +49675,23 @@ function buildMeshNodeDataFreshness(args) {
|
|
|
49548
49675
|
staleness
|
|
49549
49676
|
};
|
|
49550
49677
|
}
|
|
49678
|
+
function buildMeshNodeProbeFreshness(args) {
|
|
49679
|
+
const { git, liveTruthProbed, isSelfNode, daemonId, node, now } = args;
|
|
49680
|
+
const status = {
|
|
49681
|
+
git,
|
|
49682
|
+
connection: { state: liveTruthProbed ? "connected" : "disconnected" }
|
|
49683
|
+
};
|
|
49684
|
+
if (liveTruthProbed) status[MESH_NODE_LIVE_TRUTH_MARKER] = true;
|
|
49685
|
+
return buildMeshNodeDataFreshness({
|
|
49686
|
+
status,
|
|
49687
|
+
node,
|
|
49688
|
+
isSelfNode,
|
|
49689
|
+
daemonId,
|
|
49690
|
+
liveTruthProbed,
|
|
49691
|
+
directTruthUnavailable: !liveTruthProbed && !!daemonId,
|
|
49692
|
+
now
|
|
49693
|
+
});
|
|
49694
|
+
}
|
|
49551
49695
|
function finalizeMeshNodeStatus(args) {
|
|
49552
49696
|
const { status, node, daemonId, isSelfNode, directTruthUnavailable } = args;
|
|
49553
49697
|
if (!readStringValue(status.machineStatus)) {
|
|
@@ -61525,11 +61669,11 @@ init_parse_session();
|
|
|
61525
61669
|
|
|
61526
61670
|
// src/providers/sdk/v1/fixture-tooling/replay.ts
|
|
61527
61671
|
init_provider_cli_shared();
|
|
61528
|
-
import { readFileSync as
|
|
61672
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
61529
61673
|
import { dirname as dirname15, resolve as resolve22 } from "path";
|
|
61530
61674
|
|
|
61531
61675
|
// src/providers/sdk/v1/validators/taint.ts
|
|
61532
|
-
import { readFileSync as
|
|
61676
|
+
import { readFileSync as readFileSync39, existsSync as existsSync48 } from "fs";
|
|
61533
61677
|
import { resolve as resolve23, dirname as dirname16, join as join47 } from "path";
|
|
61534
61678
|
|
|
61535
61679
|
// src/providers/sdk/v1/validators/index.ts
|
|
@@ -61707,6 +61851,7 @@ export {
|
|
|
61707
61851
|
buildMeshLedgerReplicaEvidence,
|
|
61708
61852
|
buildMeshNodeCapabilityTags,
|
|
61709
61853
|
buildMeshNodeDataFreshness,
|
|
61854
|
+
buildMeshNodeProbeFreshness,
|
|
61710
61855
|
buildMissionPromptSection,
|
|
61711
61856
|
buildP2pRelayFailurePayload,
|
|
61712
61857
|
buildPinnedGlobalInstallCommand,
|