@adhdev/daemon-core 0.9.82-rc.303 → 0.9.82-rc.305
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 +40 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/commands/router.ts +77 -6
package/dist/index.js
CHANGED
|
@@ -295,10 +295,10 @@ function readInjected(value) {
|
|
|
295
295
|
}
|
|
296
296
|
function getDaemonBuildInfo() {
|
|
297
297
|
if (cached) return cached;
|
|
298
|
-
const commit = readInjected(true ? "
|
|
299
|
-
const commitShort = readInjected(true ? "
|
|
300
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
301
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
298
|
+
const commit = readInjected(true ? "6103da081f92baaf891d3410e3d7ebc36d9e300d" : void 0) ?? "unknown";
|
|
299
|
+
const commitShort = readInjected(true ? "6103da08" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
300
|
+
const version = readInjected(true ? "0.9.82-rc.305" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
301
|
+
const builtAt = readInjected(true ? "2026-06-17T06:08:13.151Z" : void 0);
|
|
302
302
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
303
303
|
return cached;
|
|
304
304
|
}
|
|
@@ -42325,6 +42325,15 @@ function finalizeMeshNodeStatus(args) {
|
|
|
42325
42325
|
const connectionState = readStringValue(readObjectRecord(status.connection).state);
|
|
42326
42326
|
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || connectionState === "connected" || isSelfNode);
|
|
42327
42327
|
}
|
|
42328
|
+
function readMeshTimeoutEnvMs(name, defaultMs) {
|
|
42329
|
+
const raw = process.env[name]?.trim();
|
|
42330
|
+
if (!raw) return defaultMs;
|
|
42331
|
+
const parsed = Number.parseInt(raw, 10);
|
|
42332
|
+
if (Number.isFinite(parsed) && parsed >= 1e3 && parsed <= 12e4) return parsed;
|
|
42333
|
+
return defaultMs;
|
|
42334
|
+
}
|
|
42335
|
+
var MESH_DIRECT_PROBE_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_TIMEOUT_MS", 25e3);
|
|
42336
|
+
var MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS", 25e3);
|
|
42328
42337
|
async function probeRemoteMeshGitStatus(args) {
|
|
42329
42338
|
if (!args.dispatchMeshCommand) return null;
|
|
42330
42339
|
const remoteResult = await Promise.race([
|
|
@@ -42342,6 +42351,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42342
42351
|
localConfirmedCount: 0,
|
|
42343
42352
|
peerAttemptedCount: 0,
|
|
42344
42353
|
peerConfirmedCount: 0,
|
|
42354
|
+
standingEvidenceCount: 0,
|
|
42345
42355
|
unavailableNodeIds: []
|
|
42346
42356
|
};
|
|
42347
42357
|
}
|
|
@@ -42353,6 +42363,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42353
42363
|
let localConfirmedCount = 0;
|
|
42354
42364
|
let peerAttemptedCount = 0;
|
|
42355
42365
|
let peerConfirmedCount = 0;
|
|
42366
|
+
let standingEvidenceCount = 0;
|
|
42356
42367
|
const unavailableNodeIds = [];
|
|
42357
42368
|
for (const [nodeIndex, node] of nodes.entries()) {
|
|
42358
42369
|
const nodeId = normalizeMeshNodeId(node) || `node_${nodeIndex}`;
|
|
@@ -42378,6 +42389,14 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42378
42389
|
} catch {
|
|
42379
42390
|
}
|
|
42380
42391
|
}
|
|
42392
|
+
const standingGit = buildInlineMeshTransitGitStatus(node);
|
|
42393
|
+
if (standingGit) {
|
|
42394
|
+
standingEvidenceCount += 1;
|
|
42395
|
+
continue;
|
|
42396
|
+
}
|
|
42397
|
+
if (!args.probeRemotePeers) {
|
|
42398
|
+
continue;
|
|
42399
|
+
}
|
|
42381
42400
|
if (!daemonId || !args.dispatchMeshCommand) {
|
|
42382
42401
|
if (!isSelfNode) unavailableNodeIds.push(nodeId);
|
|
42383
42402
|
continue;
|
|
@@ -42388,7 +42407,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42388
42407
|
dispatchMeshCommand: args.dispatchMeshCommand,
|
|
42389
42408
|
daemonId,
|
|
42390
42409
|
workspace,
|
|
42391
|
-
timeoutMs:
|
|
42410
|
+
timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS
|
|
42392
42411
|
});
|
|
42393
42412
|
if (remoteGit) {
|
|
42394
42413
|
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
@@ -42400,10 +42419,11 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42400
42419
|
unavailableNodeIds.push(nodeId);
|
|
42401
42420
|
}
|
|
42402
42421
|
return {
|
|
42403
|
-
directEvidenceCount: localConfirmedCount + peerConfirmedCount,
|
|
42422
|
+
directEvidenceCount: localConfirmedCount + peerConfirmedCount + standingEvidenceCount,
|
|
42404
42423
|
localConfirmedCount,
|
|
42405
42424
|
peerAttemptedCount,
|
|
42406
42425
|
peerConfirmedCount,
|
|
42426
|
+
standingEvidenceCount,
|
|
42407
42427
|
unavailableNodeIds
|
|
42408
42428
|
};
|
|
42409
42429
|
}
|
|
@@ -46607,12 +46627,14 @@ ${hintLines.join("\n")}` : "",
|
|
|
46607
46627
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
46608
46628
|
if (!meshRecord?.mesh) return { success: false, error: "Mesh not found" };
|
|
46609
46629
|
const requireDirectPeerTruth = args?.requireDirectPeerTruth === true;
|
|
46630
|
+
const probeRemotePeers = args?.refresh === true || args?.forceRefresh === true;
|
|
46610
46631
|
const directTruth = await hydrateInlineMeshDirectTruth({
|
|
46611
46632
|
mesh: meshRecord.mesh,
|
|
46612
46633
|
meshSource: meshRecord.source,
|
|
46613
46634
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
46614
46635
|
statusInstanceId: this.deps.statusInstanceId,
|
|
46615
|
-
localMachineId: loadConfig().machineId || ""
|
|
46636
|
+
localMachineId: loadConfig().machineId || "",
|
|
46637
|
+
probeRemotePeers
|
|
46616
46638
|
});
|
|
46617
46639
|
const directTruthSatisfied = meshRecord.source !== "inline_bootstrap" || directTruth.directEvidenceCount > 0;
|
|
46618
46640
|
const sourceOfTruth = {
|
|
@@ -48193,20 +48215,25 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48193
48215
|
meshSource: meshRecord.source,
|
|
48194
48216
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
48195
48217
|
statusInstanceId: this.deps.statusInstanceId,
|
|
48196
|
-
localMachineId
|
|
48218
|
+
localMachineId,
|
|
48219
|
+
// Standing-state model: only an explicit refresh fans
|
|
48220
|
+
// out a blocking peer git probe. Default loads return
|
|
48221
|
+
// held truth so one slow peer can't block the graph.
|
|
48222
|
+
probeRemotePeers: refreshRequested
|
|
48197
48223
|
}) : {
|
|
48198
48224
|
directEvidenceCount: 0,
|
|
48199
48225
|
localConfirmedCount: 0,
|
|
48200
48226
|
peerAttemptedCount: 0,
|
|
48201
48227
|
peerConfirmedCount: 0,
|
|
48228
|
+
standingEvidenceCount: 0,
|
|
48202
48229
|
unavailableNodeIds: []
|
|
48203
48230
|
};
|
|
48204
48231
|
const passivePeerTruthNotAttempted = requireDirectPeerTruth && !refreshRequested && directTruth.directEvidenceCount > 0 && directTruth.peerAttemptedCount === 0;
|
|
48205
48232
|
const effectiveDirectTruth = passivePeerTruthNotAttempted ? { ...directTruth, unavailableNodeIds: [] } : directTruth;
|
|
48206
48233
|
const unavailableDirectTruthNodeIds = new Set(effectiveDirectTruth.unavailableNodeIds);
|
|
48207
48234
|
const unavailableNodesAreOnlyRemovedWorktrees = unavailableDirectTruthNodeIds.size > 0 && Array.isArray(mesh.nodes) && mesh.nodes.filter((node) => unavailableDirectTruthNodeIds.has(normalizeMeshNodeId(node) ?? "")).every((node) => node?.isLocalWorktree === true);
|
|
48208
|
-
const directTruthSatisfied = !requireDirectPeerTruth || effectiveDirectTruth.directEvidenceCount > 0 && (effectiveDirectTruth.unavailableNodeIds.length === 0 || unavailableNodesAreOnlyRemovedWorktrees);
|
|
48209
|
-
if (requireDirectPeerTruth && !directTruthSatisfied) {
|
|
48235
|
+
const directTruthSatisfied = !requireDirectPeerTruth || !refreshRequested || effectiveDirectTruth.directEvidenceCount > 0 && (effectiveDirectTruth.unavailableNodeIds.length === 0 || unavailableNodesAreOnlyRemovedWorktrees);
|
|
48236
|
+
if (requireDirectPeerTruth && refreshRequested && !directTruthSatisfied) {
|
|
48210
48237
|
const failureResult = {
|
|
48211
48238
|
success: false,
|
|
48212
48239
|
code: "mesh_direct_peer_truth_unavailable",
|
|
@@ -48352,13 +48379,13 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48352
48379
|
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
48353
48380
|
}
|
|
48354
48381
|
remoteProbeApplied = true;
|
|
48355
|
-
} else if (!isSelfNode && daemonId && this.deps.dispatchMeshCommand && !directTruthUnavailableNodeIds.has(nodeId)) {
|
|
48382
|
+
} else if (refreshRequested && !isSelfNode && daemonId && this.deps.dispatchMeshCommand && !directTruthUnavailableNodeIds.has(nodeId)) {
|
|
48356
48383
|
try {
|
|
48357
48384
|
const remoteGit = await probeRemoteMeshGitStatus({
|
|
48358
48385
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
48359
48386
|
daemonId,
|
|
48360
48387
|
workspace,
|
|
48361
|
-
timeoutMs:
|
|
48388
|
+
timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS
|
|
48362
48389
|
});
|
|
48363
48390
|
if (remoteGit) {
|
|
48364
48391
|
status.git = remoteGit;
|
|
@@ -48382,7 +48409,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48382
48409
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
48383
48410
|
daemonId,
|
|
48384
48411
|
workspace,
|
|
48385
|
-
timeoutMs:
|
|
48412
|
+
timeoutMs: MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS
|
|
48386
48413
|
});
|
|
48387
48414
|
if (remoteGit) {
|
|
48388
48415
|
status.git = remoteGit;
|