@adhdev/daemon-standalone 0.9.82-rc.406 → 0.9.82-rc.407
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 +71 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30127,10 +30127,10 @@ var require_dist3 = __commonJS({
|
|
|
30127
30127
|
}
|
|
30128
30128
|
function getDaemonBuildInfo() {
|
|
30129
30129
|
if (cached2) return cached2;
|
|
30130
|
-
const commit = readInjected(true ? "
|
|
30131
|
-
const commitShort = readInjected(true ? "
|
|
30132
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30133
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30130
|
+
const commit = readInjected(true ? "bfd7d9b1d38a7d1f4709fbad2627c56b5a1ae342" : void 0) ?? "unknown";
|
|
30131
|
+
const commitShort = readInjected(true ? "bfd7d9b1" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30132
|
+
const version2 = readInjected(true ? "0.9.82-rc.407" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30133
|
+
const builtAt = readInjected(true ? "2026-06-28T06:12:42.391Z" : void 0);
|
|
30134
30134
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30135
30135
|
return cached2;
|
|
30136
30136
|
}
|
|
@@ -46204,6 +46204,20 @@ ${cleanBody}`;
|
|
|
46204
46204
|
}
|
|
46205
46205
|
return DEFAULT_RECONCILE_INTERVAL_MS;
|
|
46206
46206
|
}
|
|
46207
|
+
function resolveTunedReconcileMs(envName, def, min, max) {
|
|
46208
|
+
const raw = readNonEmptyString2(process.env[envName]);
|
|
46209
|
+
if (raw) {
|
|
46210
|
+
const parsed = Number.parseInt(raw, 10);
|
|
46211
|
+
if (Number.isFinite(parsed) && parsed >= min && parsed <= max) return parsed;
|
|
46212
|
+
}
|
|
46213
|
+
return def;
|
|
46214
|
+
}
|
|
46215
|
+
function resolveMinIdleSettleMs() {
|
|
46216
|
+
return resolveTunedReconcileMs("MESH_INFLIGHT_MIN_IDLE_SETTLE_MS", 16e3, 0, 12e4);
|
|
46217
|
+
}
|
|
46218
|
+
function resolveAckedTurnSettleMs() {
|
|
46219
|
+
return resolveTunedReconcileMs("MESH_INFLIGHT_ACKED_TURN_SETTLE_MS", 2e4, 0, 18e4);
|
|
46220
|
+
}
|
|
46207
46221
|
function inFlightSynthKey(meshId, taskId) {
|
|
46208
46222
|
return `${meshId}::${taskId}`;
|
|
46209
46223
|
}
|
|
@@ -46780,6 +46794,33 @@ ${cleanBody}`;
|
|
|
46780
46794
|
function readChatPayloadStatus(payload) {
|
|
46781
46795
|
return readNonEmptyString2(payload?.status).toLowerCase();
|
|
46782
46796
|
}
|
|
46797
|
+
function realTerminalEmitPendingForTask(meshId, taskId) {
|
|
46798
|
+
let pending;
|
|
46799
|
+
try {
|
|
46800
|
+
pending = getPendingMeshCoordinatorEvents(meshId);
|
|
46801
|
+
} catch {
|
|
46802
|
+
return false;
|
|
46803
|
+
}
|
|
46804
|
+
return pending.some((e) => readNonEmptyString2(e.metadataEvent?.taskId) === taskId && (e.event === "agent:generating_completed" || e.event === "agent:stopped"));
|
|
46805
|
+
}
|
|
46806
|
+
async function reprobeWorkerStatus(components, args) {
|
|
46807
|
+
try {
|
|
46808
|
+
if (args.isLocalNode) {
|
|
46809
|
+
const r = await components.commandHandler.handle("read_chat", args.readArgs);
|
|
46810
|
+
if (r && r.success === false) return null;
|
|
46811
|
+
return readChatPayloadStatus(unwrapReadChatPayload(r));
|
|
46812
|
+
}
|
|
46813
|
+
if (components.dispatchMeshCommand) {
|
|
46814
|
+
const r = await components.dispatchMeshCommand(args.nodeDaemonId, "read_chat", args.readArgs);
|
|
46815
|
+
const p = unwrapReadChatPayload(r);
|
|
46816
|
+
if (p && p.success === false) return null;
|
|
46817
|
+
return readChatPayloadStatus(p);
|
|
46818
|
+
}
|
|
46819
|
+
} catch {
|
|
46820
|
+
return null;
|
|
46821
|
+
}
|
|
46822
|
+
return null;
|
|
46823
|
+
}
|
|
46783
46824
|
async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds, localDaemonId) {
|
|
46784
46825
|
const dispatches = getActiveDirectDispatches(mesh.id);
|
|
46785
46826
|
if (dispatches.length === 0) return;
|
|
@@ -46827,18 +46868,34 @@ ${cleanBody}`;
|
|
|
46827
46868
|
}
|
|
46828
46869
|
if (!payload) continue;
|
|
46829
46870
|
const synthKey = inFlightSynthKey(mesh.id, taskId);
|
|
46871
|
+
const nowMs = Date.now();
|
|
46830
46872
|
if (readChatPayloadStatus(payload) !== "idle") {
|
|
46831
46873
|
inFlightIdleObservationCounts.delete(synthKey);
|
|
46832
46874
|
continue;
|
|
46833
46875
|
}
|
|
46834
46876
|
if (dispatch.status === "acked") {
|
|
46835
|
-
const
|
|
46836
|
-
|
|
46837
|
-
|
|
46838
|
-
|
|
46877
|
+
const prior = inFlightIdleObservationCounts.get(synthKey);
|
|
46878
|
+
const firstIdleAtMs = prior?.firstIdleAtMs ?? nowMs;
|
|
46879
|
+
const idleStreak = (prior?.count ?? 0) + 1;
|
|
46880
|
+
inFlightIdleObservationCounts.set(synthKey, { count: idleStreak, firstIdleAtMs });
|
|
46881
|
+
const idleSettleMs = nowMs - firstIdleAtMs;
|
|
46882
|
+
const minIdleSettleMs = resolveMinIdleSettleMs();
|
|
46883
|
+
const ackedTurnSettleMs = resolveAckedTurnSettleMs();
|
|
46884
|
+
const ackedAtMs = Date.parse(readNonEmptyString2(dispatch.updatedAt));
|
|
46885
|
+
const sinceAckMs = Number.isFinite(ackedAtMs) ? nowMs - ackedAtMs : Number.POSITIVE_INFINITY;
|
|
46886
|
+
const tickGuardMet = idleStreak >= REQUIRED_CONSECUTIVE_IDLE_TICKS_FOR_INFLIGHT_SYNTH;
|
|
46887
|
+
const settleGuardMet = idleSettleMs >= minIdleSettleMs;
|
|
46888
|
+
const ackGuardMet = sinceAckMs >= ackedTurnSettleMs;
|
|
46889
|
+
if (!tickGuardMet || !settleGuardMet || !ackGuardMet) {
|
|
46890
|
+
LOG2.info("MeshReconcile", `In-flight synth hold: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) idle ${idleStreak}/${REQUIRED_CONSECUTIVE_IDLE_TICKS_FOR_INFLIGHT_SYNTH} tick(s), settle ${Math.round(idleSettleMs / 1e3)}s/${Math.round(minIdleSettleMs / 1e3)}s, since-ack ${Number.isFinite(sinceAckMs) ? Math.round(sinceAckMs / 1e3) + "s" : "\u221E"}/${Math.round(ackedTurnSettleMs / 1e3)}s \u2014 deferring completion synth until the worker's turn genuinely settles (guards against a mid-turn idle window pre-empting the real completion)`);
|
|
46839
46891
|
continue;
|
|
46840
46892
|
}
|
|
46841
46893
|
}
|
|
46894
|
+
if (realTerminalEmitPendingForTask(mesh.id, taskId)) {
|
|
46895
|
+
inFlightIdleObservationCounts.delete(synthKey);
|
|
46896
|
+
LOG2.info("MeshReconcile", `Worker-emit priority: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) has a real terminal completion already queued \u2014 yielding synth to the worker's own emit`);
|
|
46897
|
+
continue;
|
|
46898
|
+
}
|
|
46842
46899
|
const messages = Array.isArray(payload.messages) ? payload.messages : [];
|
|
46843
46900
|
const evidence = extractFinalAssistantSummaryEvidence(messages);
|
|
46844
46901
|
if (!evidence.finalSummary) continue;
|
|
@@ -46855,6 +46912,12 @@ ${cleanBody}`;
|
|
|
46855
46912
|
}, `transcriptAt=${evidence.transcriptMessageAt} < dispatchedAt=${dispatch.dispatchedAt}`);
|
|
46856
46913
|
continue;
|
|
46857
46914
|
}
|
|
46915
|
+
const reprobeStatus = await reprobeWorkerStatus(components, { isLocalNode, nodeDaemonId, readArgs });
|
|
46916
|
+
if (reprobeStatus && reprobeStatus !== "idle") {
|
|
46917
|
+
inFlightIdleObservationCounts.delete(synthKey);
|
|
46918
|
+
LOG2.info("MeshReconcile", `Live re-probe defer: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) read '${reprobeStatus}' at synth-commit time \u2014 worker resumed generating; deferring synth to a later tick`);
|
|
46919
|
+
continue;
|
|
46920
|
+
}
|
|
46858
46921
|
const providerSessionId = readNonEmptyString2(payload.providerSessionId);
|
|
46859
46922
|
const coordinatorDaemonId = selfIds.find((id) => !!id);
|
|
46860
46923
|
try {
|