@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.mjs
CHANGED
|
@@ -290,10 +290,10 @@ function readInjected(value) {
|
|
|
290
290
|
}
|
|
291
291
|
function getDaemonBuildInfo() {
|
|
292
292
|
if (cached) return cached;
|
|
293
|
-
const commit = readInjected(true ? "
|
|
294
|
-
const commitShort = readInjected(true ? "
|
|
295
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
296
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
293
|
+
const commit = readInjected(true ? "6103da081f92baaf891d3410e3d7ebc36d9e300d" : void 0) ?? "unknown";
|
|
294
|
+
const commitShort = readInjected(true ? "6103da08" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
295
|
+
const version = readInjected(true ? "0.9.82-rc.305" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
296
|
+
const builtAt = readInjected(true ? "2026-06-17T06:08:13.151Z" : void 0);
|
|
297
297
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
298
298
|
return cached;
|
|
299
299
|
}
|
|
@@ -41986,6 +41986,15 @@ function finalizeMeshNodeStatus(args) {
|
|
|
41986
41986
|
const connectionState = readStringValue(readObjectRecord(status.connection).state);
|
|
41987
41987
|
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || connectionState === "connected" || isSelfNode);
|
|
41988
41988
|
}
|
|
41989
|
+
function readMeshTimeoutEnvMs(name, defaultMs) {
|
|
41990
|
+
const raw = process.env[name]?.trim();
|
|
41991
|
+
if (!raw) return defaultMs;
|
|
41992
|
+
const parsed = Number.parseInt(raw, 10);
|
|
41993
|
+
if (Number.isFinite(parsed) && parsed >= 1e3 && parsed <= 12e4) return parsed;
|
|
41994
|
+
return defaultMs;
|
|
41995
|
+
}
|
|
41996
|
+
var MESH_DIRECT_PROBE_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_TIMEOUT_MS", 25e3);
|
|
41997
|
+
var MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS", 25e3);
|
|
41989
41998
|
async function probeRemoteMeshGitStatus(args) {
|
|
41990
41999
|
if (!args.dispatchMeshCommand) return null;
|
|
41991
42000
|
const remoteResult = await Promise.race([
|
|
@@ -42003,6 +42012,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42003
42012
|
localConfirmedCount: 0,
|
|
42004
42013
|
peerAttemptedCount: 0,
|
|
42005
42014
|
peerConfirmedCount: 0,
|
|
42015
|
+
standingEvidenceCount: 0,
|
|
42006
42016
|
unavailableNodeIds: []
|
|
42007
42017
|
};
|
|
42008
42018
|
}
|
|
@@ -42014,6 +42024,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42014
42024
|
let localConfirmedCount = 0;
|
|
42015
42025
|
let peerAttemptedCount = 0;
|
|
42016
42026
|
let peerConfirmedCount = 0;
|
|
42027
|
+
let standingEvidenceCount = 0;
|
|
42017
42028
|
const unavailableNodeIds = [];
|
|
42018
42029
|
for (const [nodeIndex, node] of nodes.entries()) {
|
|
42019
42030
|
const nodeId = normalizeMeshNodeId(node) || `node_${nodeIndex}`;
|
|
@@ -42039,6 +42050,14 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42039
42050
|
} catch {
|
|
42040
42051
|
}
|
|
42041
42052
|
}
|
|
42053
|
+
const standingGit = buildInlineMeshTransitGitStatus(node);
|
|
42054
|
+
if (standingGit) {
|
|
42055
|
+
standingEvidenceCount += 1;
|
|
42056
|
+
continue;
|
|
42057
|
+
}
|
|
42058
|
+
if (!args.probeRemotePeers) {
|
|
42059
|
+
continue;
|
|
42060
|
+
}
|
|
42042
42061
|
if (!daemonId || !args.dispatchMeshCommand) {
|
|
42043
42062
|
if (!isSelfNode) unavailableNodeIds.push(nodeId);
|
|
42044
42063
|
continue;
|
|
@@ -42049,7 +42068,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42049
42068
|
dispatchMeshCommand: args.dispatchMeshCommand,
|
|
42050
42069
|
daemonId,
|
|
42051
42070
|
workspace,
|
|
42052
|
-
timeoutMs:
|
|
42071
|
+
timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS
|
|
42053
42072
|
});
|
|
42054
42073
|
if (remoteGit) {
|
|
42055
42074
|
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
@@ -42061,10 +42080,11 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42061
42080
|
unavailableNodeIds.push(nodeId);
|
|
42062
42081
|
}
|
|
42063
42082
|
return {
|
|
42064
|
-
directEvidenceCount: localConfirmedCount + peerConfirmedCount,
|
|
42083
|
+
directEvidenceCount: localConfirmedCount + peerConfirmedCount + standingEvidenceCount,
|
|
42065
42084
|
localConfirmedCount,
|
|
42066
42085
|
peerAttemptedCount,
|
|
42067
42086
|
peerConfirmedCount,
|
|
42087
|
+
standingEvidenceCount,
|
|
42068
42088
|
unavailableNodeIds
|
|
42069
42089
|
};
|
|
42070
42090
|
}
|
|
@@ -46268,12 +46288,14 @@ ${hintLines.join("\n")}` : "",
|
|
|
46268
46288
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
46269
46289
|
if (!meshRecord?.mesh) return { success: false, error: "Mesh not found" };
|
|
46270
46290
|
const requireDirectPeerTruth = args?.requireDirectPeerTruth === true;
|
|
46291
|
+
const probeRemotePeers = args?.refresh === true || args?.forceRefresh === true;
|
|
46271
46292
|
const directTruth = await hydrateInlineMeshDirectTruth({
|
|
46272
46293
|
mesh: meshRecord.mesh,
|
|
46273
46294
|
meshSource: meshRecord.source,
|
|
46274
46295
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
46275
46296
|
statusInstanceId: this.deps.statusInstanceId,
|
|
46276
|
-
localMachineId: loadConfig().machineId || ""
|
|
46297
|
+
localMachineId: loadConfig().machineId || "",
|
|
46298
|
+
probeRemotePeers
|
|
46277
46299
|
});
|
|
46278
46300
|
const directTruthSatisfied = meshRecord.source !== "inline_bootstrap" || directTruth.directEvidenceCount > 0;
|
|
46279
46301
|
const sourceOfTruth = {
|
|
@@ -47854,20 +47876,25 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
47854
47876
|
meshSource: meshRecord.source,
|
|
47855
47877
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
47856
47878
|
statusInstanceId: this.deps.statusInstanceId,
|
|
47857
|
-
localMachineId
|
|
47879
|
+
localMachineId,
|
|
47880
|
+
// Standing-state model: only an explicit refresh fans
|
|
47881
|
+
// out a blocking peer git probe. Default loads return
|
|
47882
|
+
// held truth so one slow peer can't block the graph.
|
|
47883
|
+
probeRemotePeers: refreshRequested
|
|
47858
47884
|
}) : {
|
|
47859
47885
|
directEvidenceCount: 0,
|
|
47860
47886
|
localConfirmedCount: 0,
|
|
47861
47887
|
peerAttemptedCount: 0,
|
|
47862
47888
|
peerConfirmedCount: 0,
|
|
47889
|
+
standingEvidenceCount: 0,
|
|
47863
47890
|
unavailableNodeIds: []
|
|
47864
47891
|
};
|
|
47865
47892
|
const passivePeerTruthNotAttempted = requireDirectPeerTruth && !refreshRequested && directTruth.directEvidenceCount > 0 && directTruth.peerAttemptedCount === 0;
|
|
47866
47893
|
const effectiveDirectTruth = passivePeerTruthNotAttempted ? { ...directTruth, unavailableNodeIds: [] } : directTruth;
|
|
47867
47894
|
const unavailableDirectTruthNodeIds = new Set(effectiveDirectTruth.unavailableNodeIds);
|
|
47868
47895
|
const unavailableNodesAreOnlyRemovedWorktrees = unavailableDirectTruthNodeIds.size > 0 && Array.isArray(mesh.nodes) && mesh.nodes.filter((node) => unavailableDirectTruthNodeIds.has(normalizeMeshNodeId(node) ?? "")).every((node) => node?.isLocalWorktree === true);
|
|
47869
|
-
const directTruthSatisfied = !requireDirectPeerTruth || effectiveDirectTruth.directEvidenceCount > 0 && (effectiveDirectTruth.unavailableNodeIds.length === 0 || unavailableNodesAreOnlyRemovedWorktrees);
|
|
47870
|
-
if (requireDirectPeerTruth && !directTruthSatisfied) {
|
|
47896
|
+
const directTruthSatisfied = !requireDirectPeerTruth || !refreshRequested || effectiveDirectTruth.directEvidenceCount > 0 && (effectiveDirectTruth.unavailableNodeIds.length === 0 || unavailableNodesAreOnlyRemovedWorktrees);
|
|
47897
|
+
if (requireDirectPeerTruth && refreshRequested && !directTruthSatisfied) {
|
|
47871
47898
|
const failureResult = {
|
|
47872
47899
|
success: false,
|
|
47873
47900
|
code: "mesh_direct_peer_truth_unavailable",
|
|
@@ -48013,13 +48040,13 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48013
48040
|
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
48014
48041
|
}
|
|
48015
48042
|
remoteProbeApplied = true;
|
|
48016
|
-
} else if (!isSelfNode && daemonId && this.deps.dispatchMeshCommand && !directTruthUnavailableNodeIds.has(nodeId)) {
|
|
48043
|
+
} else if (refreshRequested && !isSelfNode && daemonId && this.deps.dispatchMeshCommand && !directTruthUnavailableNodeIds.has(nodeId)) {
|
|
48017
48044
|
try {
|
|
48018
48045
|
const remoteGit = await probeRemoteMeshGitStatus({
|
|
48019
48046
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
48020
48047
|
daemonId,
|
|
48021
48048
|
workspace,
|
|
48022
|
-
timeoutMs:
|
|
48049
|
+
timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS
|
|
48023
48050
|
});
|
|
48024
48051
|
if (remoteGit) {
|
|
48025
48052
|
status.git = remoteGit;
|
|
@@ -48043,7 +48070,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48043
48070
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
48044
48071
|
daemonId,
|
|
48045
48072
|
workspace,
|
|
48046
|
-
timeoutMs:
|
|
48073
|
+
timeoutMs: MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS
|
|
48047
48074
|
});
|
|
48048
48075
|
if (remoteGit) {
|
|
48049
48076
|
status.git = remoteGit;
|