@adhdev/daemon-standalone 1.0.28-rc.34 → 1.0.28-rc.35
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 +50 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -33311,10 +33311,10 @@ var require_dist3 = __commonJS({
|
|
|
33311
33311
|
}
|
|
33312
33312
|
function getDaemonBuildInfo() {
|
|
33313
33313
|
if (cached2) return cached2;
|
|
33314
|
-
const commit = readInjected(true ? "
|
|
33315
|
-
const commitShort = readInjected(true ? "
|
|
33316
|
-
const version2 = readInjected(true ? "1.0.28-rc.
|
|
33317
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
33314
|
+
const commit = readInjected(true ? "cea3ab2da10d31dbd18ef98dd0e5db0a65bb2617" : void 0) ?? "unknown";
|
|
33315
|
+
const commitShort = readInjected(true ? "cea3ab2d" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
33316
|
+
const version2 = readInjected(true ? "1.0.28-rc.35" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
33317
|
+
const builtAt = readInjected(true ? "2026-07-31T04:26:19.809Z" : void 0);
|
|
33318
33318
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
33319
33319
|
return cached2;
|
|
33320
33320
|
}
|
|
@@ -38338,6 +38338,25 @@ Next step: ${nextStep}`;
|
|
|
38338
38338
|
LOG2.info("TurnLedger", `Rebound attempt ${attempt.attemptId} (task ${args.taskId}) from session ${attempt.sessionId ?? "none"} to live holder ${holder} after a duplicate-dispatch refusal`);
|
|
38339
38339
|
return { rebound: true, attemptId: attempt.attemptId, fromSessionId: attempt.sessionId ?? void 0, toSessionId: holder };
|
|
38340
38340
|
}
|
|
38341
|
+
function resolveTaskEvidenceSessionId(meshId, taskId, rowAssignedSessionId) {
|
|
38342
|
+
const nonEmpty = (v) => {
|
|
38343
|
+
const s2 = typeof v === "string" ? v.trim() : "";
|
|
38344
|
+
return s2 ? s2 : void 0;
|
|
38345
|
+
};
|
|
38346
|
+
const rowSessionId = nonEmpty(rowAssignedSessionId);
|
|
38347
|
+
try {
|
|
38348
|
+
const attempt = MeshRuntimeStore.getInstance().getCurrentTurnAttempt(meshId, taskId);
|
|
38349
|
+
if (!attempt || attempt.terminalOutcome) return rowSessionId;
|
|
38350
|
+
const attemptSessionId = nonEmpty(attempt.sessionId);
|
|
38351
|
+
if (!attemptSessionId) return rowSessionId;
|
|
38352
|
+
if (rowSessionId && !sessionIdsEquivalent(attemptSessionId, rowSessionId)) {
|
|
38353
|
+
LOG2.info("TurnLedger", `Evidence read for task ${taskId} follows the ATTEMPT session ${attemptSessionId} (attempt ${attempt.attemptId}), not the claim-time row stamp ${rowSessionId} \u2014 the attempt was rebound to the live holder`);
|
|
38354
|
+
}
|
|
38355
|
+
return attemptSessionId;
|
|
38356
|
+
} catch {
|
|
38357
|
+
return rowSessionId;
|
|
38358
|
+
}
|
|
38359
|
+
}
|
|
38341
38360
|
function evaluateRedrive(meshId, taskId, nowMs = Date.now()) {
|
|
38342
38361
|
const store = MeshRuntimeStore.getInstance();
|
|
38343
38362
|
const attempt = store.getCurrentTurnAttempt(meshId, taskId);
|
|
@@ -61023,12 +61042,13 @@ ${cleanBody}`;
|
|
|
61023
61042
|
}
|
|
61024
61043
|
async function pollAssignedTaskActivity(components, mesh, row) {
|
|
61025
61044
|
const NONE = { inTurnProgress: false, lastAgentActivityMs: null };
|
|
61026
|
-
const sessionId =
|
|
61045
|
+
const sessionId = resolveTaskEvidenceSessionId(mesh.id, row.id, row.assignedSessionId);
|
|
61027
61046
|
const nodeId = readNonEmptyString(row.assignedNodeId);
|
|
61028
61047
|
if (!sessionId || !nodeId) return NONE;
|
|
61048
|
+
const evidenceRow = sessionId !== row.assignedSessionId ? { ...row, assignedSessionId: sessionId } : row;
|
|
61029
61049
|
const dispatchedAtMs = Date.parse(readNonEmptyString(row.dispatchTimestamp));
|
|
61030
61050
|
if (!Number.isFinite(dispatchedAtMs)) return NONE;
|
|
61031
|
-
const payload = await runSessionEvidenceCollection(sessionId, () => fetchAssignedTaskChatTail(components, mesh,
|
|
61051
|
+
const payload = await runSessionEvidenceCollection(sessionId, () => fetchAssignedTaskChatTail(components, mesh, evidenceRow));
|
|
61032
61052
|
if (!payload) return NONE;
|
|
61033
61053
|
const messages = Array.isArray(payload.messages) ? payload.messages : [];
|
|
61034
61054
|
let lastAgentActivityMs = null;
|
|
@@ -61043,8 +61063,9 @@ ${cleanBody}`;
|
|
|
61043
61063
|
return { inTurnProgress: lastAgentActivityMs !== null, lastAgentActivityMs };
|
|
61044
61064
|
}
|
|
61045
61065
|
async function pollAssignedTaskTerminalEvidence(components, mesh, row, opts) {
|
|
61046
|
-
const sessionId =
|
|
61066
|
+
const sessionId = resolveTaskEvidenceSessionId(mesh.id, row.id, row.assignedSessionId);
|
|
61047
61067
|
const nodeId = readNonEmptyString(row.assignedNodeId);
|
|
61068
|
+
const evidenceRow = sessionId && sessionId !== row.assignedSessionId ? { ...row, assignedSessionId: sessionId } : row;
|
|
61048
61069
|
const traceCtx = {
|
|
61049
61070
|
taskId: row.id,
|
|
61050
61071
|
...sessionId ? { sessionId } : {},
|
|
@@ -61060,7 +61081,7 @@ ${cleanBody}`;
|
|
|
61060
61081
|
return declined("no_assigned_worker", `sessionId=${sessionId ?? "none"} nodeId=${nodeId ?? "none"}`);
|
|
61061
61082
|
}
|
|
61062
61083
|
const providerType = readNonEmptyString(row.assignedProviderType);
|
|
61063
|
-
const payload = await runSessionEvidenceCollection(sessionId, () => fetchAssignedTaskChatTail(components, mesh,
|
|
61084
|
+
const payload = await runSessionEvidenceCollection(sessionId, () => fetchAssignedTaskChatTail(components, mesh, evidenceRow));
|
|
61064
61085
|
if (!payload) return declined("chat_tail_unreadable", "worker transcript read returned no payload (offline/unreachable?)");
|
|
61065
61086
|
const payloadStatus = readChatPayloadStatus(payload);
|
|
61066
61087
|
if (payloadStatus !== "idle") return declined("session_not_idle", `status=${payloadStatus ?? "unknown"} \u2014 mid-turn, not a turn-end`);
|
|
@@ -61671,7 +61692,9 @@ ${cleanBody}`;
|
|
|
61671
61692
|
}
|
|
61672
61693
|
}
|
|
61673
61694
|
const shortStreakKey = `${meshId}::${row.id}`;
|
|
61674
|
-
const
|
|
61695
|
+
const evidenceSessionId = resolveTaskEvidenceSessionId(meshId, row.id, row.assignedSessionId);
|
|
61696
|
+
const evidenceRow = evidenceSessionId && evidenceSessionId !== row.assignedSessionId ? { ...row, assignedSessionId: evidenceSessionId } : row;
|
|
61697
|
+
const verdict = evidenceSessionId ? resolveSessionBusyVerdict(components, evidenceSessionId) : "IDLE_CONFIRMED";
|
|
61675
61698
|
if (verdict === "GENERATING") {
|
|
61676
61699
|
deliveredUnconsumedUnknownStreak.delete(shortStreakKey);
|
|
61677
61700
|
const gate = gateRedriveForHeldSuspension({ meshId, taskId: row.id, sessionLiveness: "alive", nowMs });
|
|
@@ -61685,15 +61708,16 @@ ${cleanBody}`;
|
|
|
61685
61708
|
}, `held suspension recovered \u2192 ${gate.stage} (verdict GENERATING)`);
|
|
61686
61709
|
}
|
|
61687
61710
|
} else {
|
|
61688
|
-
const redriveProfile =
|
|
61689
|
-
if (redriveProfile?.emitsPtyTurnEvents === false && await pollAssignedTaskInTurnProgress(components, { id: meshId, nodes: mesh.nodes },
|
|
61711
|
+
const redriveProfile = evidenceSessionId ? resolveAssignedTranscriptProfile(components, evidenceRow) : void 0;
|
|
61712
|
+
if (redriveProfile?.emitsPtyTurnEvents === false && await pollAssignedTaskInTurnProgress(components, { id: meshId, nodes: mesh.nodes }, evidenceRow)) {
|
|
61690
61713
|
deliveredUnconsumedUnknownStreak.delete(shortStreakKey);
|
|
61691
61714
|
try {
|
|
61692
61715
|
recordTurnAck({
|
|
61693
61716
|
meshId,
|
|
61694
61717
|
taskId: row.id,
|
|
61695
61718
|
kind: "consumed",
|
|
61696
|
-
|
|
61719
|
+
// Attempt-bound session (rc.35): see the long path below.
|
|
61720
|
+
sessionId: evidenceSessionId,
|
|
61697
61721
|
legacy: {
|
|
61698
61722
|
...typeof row.dispatchNonce === "number" ? { dispatchNonce: row.dispatchNonce } : {},
|
|
61699
61723
|
...row.assignedNodeId ? { nodeId: row.assignedNodeId } : {},
|
|
@@ -61719,7 +61743,7 @@ ${cleanBody}`;
|
|
|
61719
61743
|
}
|
|
61720
61744
|
if (verdict === "IDLE_CONFIRMED") {
|
|
61721
61745
|
deliveredUnconsumedUnknownStreak.delete(shortStreakKey);
|
|
61722
|
-
} else if (assignedRowLiveStatusIsAwaitingApproval(mesh, row.assignedNodeId,
|
|
61746
|
+
} else if (assignedRowLiveStatusIsAwaitingApproval(mesh, row.assignedNodeId, evidenceSessionId)) {
|
|
61723
61747
|
traceMeshEventDrop("short_redrive_deferred_awaiting_approval", {
|
|
61724
61748
|
taskId: row.id,
|
|
61725
61749
|
sessionId: row.assignedSessionId,
|
|
@@ -61782,10 +61806,10 @@ ${cleanBody}`;
|
|
|
61782
61806
|
event: "agent:generating_started"
|
|
61783
61807
|
}, !redriveEval || redriveEval.allowed ? "n/a" : redriveEval.reason);
|
|
61784
61808
|
} else {
|
|
61785
|
-
if (redriveProfile?.emitsPtyTurnEvents === false &&
|
|
61809
|
+
if (redriveProfile?.emitsPtyTurnEvents === false && evidenceSessionId) {
|
|
61786
61810
|
stopStaleMeshWorker(components, {
|
|
61787
61811
|
meshId,
|
|
61788
|
-
sessionId:
|
|
61812
|
+
sessionId: evidenceSessionId,
|
|
61789
61813
|
nodeId: row.assignedNodeId,
|
|
61790
61814
|
providerType: row.assignedProviderType
|
|
61791
61815
|
});
|
|
@@ -61836,7 +61860,9 @@ ${cleanBody}`;
|
|
|
61836
61860
|
if (store.taskHasConfirmedDelivery(meshId, row.id)) {
|
|
61837
61861
|
if (nowMs - dispatchedAtMs < DELIVERED_NO_TURN_DEADLINE_MS) continue;
|
|
61838
61862
|
const streakKey = `${meshId}::${row.id}`;
|
|
61839
|
-
const
|
|
61863
|
+
const evidenceSessionId = resolveTaskEvidenceSessionId(meshId, row.id, row.assignedSessionId);
|
|
61864
|
+
const evidenceRow = evidenceSessionId && evidenceSessionId !== row.assignedSessionId ? { ...row, assignedSessionId: evidenceSessionId } : row;
|
|
61865
|
+
const verdict = evidenceSessionId ? resolveSessionBusyVerdict(components, evidenceSessionId) : "IDLE_CONFIRMED";
|
|
61840
61866
|
if (verdict === "GENERATING") {
|
|
61841
61867
|
deliveredNoTurnUnknownStreak.delete(streakKey);
|
|
61842
61868
|
const gate = gateRedriveForHeldSuspension({ meshId, taskId: row.id, sessionLiveness: "alive", nowMs });
|
|
@@ -61855,7 +61881,7 @@ ${cleanBody}`;
|
|
|
61855
61881
|
if (verdict === "IDLE_CONFIRMED") {
|
|
61856
61882
|
deliveredNoTurnUnknownStreak.delete(streakKey);
|
|
61857
61883
|
reclaimReason = "delivered_no_turn_deadline";
|
|
61858
|
-
} else if (assignedRowLiveStatusIsAwaitingApproval(mesh, row.assignedNodeId,
|
|
61884
|
+
} else if (assignedRowLiveStatusIsAwaitingApproval(mesh, row.assignedNodeId, evidenceSessionId)) {
|
|
61859
61885
|
traceMeshEventDrop("reclaim_deferred_awaiting_approval", {
|
|
61860
61886
|
taskId: row.id,
|
|
61861
61887
|
sessionId: row.assignedSessionId,
|
|
@@ -61902,7 +61928,7 @@ ${cleanBody}`;
|
|
|
61902
61928
|
if (suspensionGate.kind === "released" && suspensionGate.dropped > 0) {
|
|
61903
61929
|
LOG2.info("MeshReconcile", `Dropped ${suspensionGate.dropped} held suspension(s) for task ${row.id} on mesh ${meshId}: worker session ${row.assignedSessionId ?? "?"} demonstrably dead \u2014 ${reclaimReason} proceeds to a new attempt`);
|
|
61904
61930
|
}
|
|
61905
|
-
const terminalEvidence = await pollAssignedTaskTerminalEvidence(components, mesh,
|
|
61931
|
+
const terminalEvidence = await pollAssignedTaskTerminalEvidence(components, mesh, evidenceRow);
|
|
61906
61932
|
if (terminalEvidence) {
|
|
61907
61933
|
deliveredNoTurnUnknownStreak.delete(streakKey);
|
|
61908
61934
|
if (!reconcileTerminalViaReducer({
|
|
@@ -61919,7 +61945,7 @@ ${cleanBody}`;
|
|
|
61919
61945
|
const propagation = propagateWatchdogTranscriptCompletion(
|
|
61920
61946
|
components,
|
|
61921
61947
|
meshId,
|
|
61922
|
-
|
|
61948
|
+
evidenceRow,
|
|
61923
61949
|
terminalEvidence,
|
|
61924
61950
|
"redrive_deadline_transcript_evidence",
|
|
61925
61951
|
{ boundedBackstop: true }
|
|
@@ -61971,9 +61997,9 @@ ${cleanBody}`;
|
|
|
61971
61997
|
}, `attempt stage ${attemptStage} \u2014 live turn, ${reclaimReason} suppressed`);
|
|
61972
61998
|
continue;
|
|
61973
61999
|
}
|
|
61974
|
-
const noTurnProfile =
|
|
62000
|
+
const noTurnProfile = evidenceSessionId ? resolveAssignedTranscriptProfile(components, evidenceRow) : void 0;
|
|
61975
62001
|
if (noTurnProfile?.emitsPtyTurnEvents === false) {
|
|
61976
|
-
const activity = await pollAssignedTaskActivity(components, { id: meshId, nodes: mesh.nodes },
|
|
62002
|
+
const activity = await pollAssignedTaskActivity(components, { id: meshId, nodes: mesh.nodes }, evidenceRow);
|
|
61977
62003
|
if (activity.inTurnProgress && activity.lastAgentActivityMs !== null && nowMs - activity.lastAgentActivityMs <= NATIVE_SOURCE_ACTIVITY_STALE_MS) {
|
|
61978
62004
|
deliveredNoTurnUnknownStreak.delete(streakKey);
|
|
61979
62005
|
try {
|
|
@@ -61981,7 +62007,9 @@ ${cleanBody}`;
|
|
|
61981
62007
|
meshId,
|
|
61982
62008
|
taskId: row.id,
|
|
61983
62009
|
kind: "consumed",
|
|
61984
|
-
|
|
62010
|
+
// Attempt-bound session (rc.35): a consumed ACK naming the
|
|
62011
|
+
// rebound-away row session would fail the reducer's causality check.
|
|
62012
|
+
sessionId: evidenceSessionId,
|
|
61985
62013
|
legacy: {
|
|
61986
62014
|
...typeof row.dispatchNonce === "number" ? { dispatchNonce: row.dispatchNonce } : {},
|
|
61987
62015
|
...row.assignedNodeId ? { nodeId: row.assignedNodeId } : {},
|