@adhdev/daemon-core 0.9.82-rc.394 → 0.9.82-rc.396
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 +45 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -23
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-events-stale.d.ts +9 -0
- package/package.json +2 -2
- package/src/mesh/mesh-events-stale.ts +43 -17
- package/src/mesh/mesh-queue-assignment.ts +31 -0
- package/src/mesh/mesh-reconcile-loop.ts +26 -3
package/dist/index.mjs
CHANGED
|
@@ -378,10 +378,10 @@ function readInjected(value) {
|
|
|
378
378
|
}
|
|
379
379
|
function getDaemonBuildInfo() {
|
|
380
380
|
if (cached) return cached;
|
|
381
|
-
const commit = readInjected(true ? "
|
|
382
|
-
const commitShort = readInjected(true ? "
|
|
383
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
384
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
381
|
+
const commit = readInjected(true ? "109c5230408ea2b33e9083395b42b1c3e894aed2" : void 0) ?? "unknown";
|
|
382
|
+
const commitShort = readInjected(true ? "109c5230" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
383
|
+
const version = readInjected(true ? "0.9.82-rc.396" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
384
|
+
const builtAt = readInjected(true ? "2026-06-27T07:15:39.648Z" : void 0);
|
|
385
385
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
386
386
|
return cached;
|
|
387
387
|
}
|
|
@@ -9859,27 +9859,32 @@ function reconcileDirectDispatchCompletionFromTranscript(args) {
|
|
|
9859
9859
|
updateDirectDispatchStatus(args.meshId, args.sessionId, kind === "task_completed" ? "completed" : "failed", args.taskId);
|
|
9860
9860
|
markSessionDeliveriesTerminal(args.meshId, args.sessionId, kind === "task_completed" ? "completed" : "failed");
|
|
9861
9861
|
setImmediate(() => cleanupTerminalDirectDispatches());
|
|
9862
|
+
const eventName = kind === "task_completed" ? "agent:generating_completed" : "agent:stopped";
|
|
9863
|
+
const nodeLabel = nodeId ? `Node '${nodeId}'` : "Remote agent";
|
|
9864
|
+
const metadataEvent = {
|
|
9865
|
+
targetSessionId: args.sessionId,
|
|
9866
|
+
providerType: providerType || void 0,
|
|
9867
|
+
providerSessionId: readNonEmptyString2(args.providerSessionId),
|
|
9868
|
+
finalSummary,
|
|
9869
|
+
taskId: args.taskId,
|
|
9870
|
+
workerResult,
|
|
9871
|
+
completionDiagnostic: {
|
|
9872
|
+
reason: "direct_task_transcript_reconciliation",
|
|
9873
|
+
terminalLedgerKind: kind,
|
|
9874
|
+
terminalLedgerId: entry.id
|
|
9875
|
+
}
|
|
9876
|
+
};
|
|
9877
|
+
const targetCoordinatorSessionId = readNonEmptyString2(args.targetCoordinatorSessionId) || readNonEmptyString2(dispatch?.payload?.coordinatorSessionId);
|
|
9862
9878
|
queuePendingMeshCoordinatorEvent({
|
|
9863
|
-
event:
|
|
9879
|
+
event: eventName,
|
|
9864
9880
|
meshId: args.meshId,
|
|
9865
|
-
nodeLabel
|
|
9881
|
+
nodeLabel,
|
|
9866
9882
|
nodeId: nodeId || void 0,
|
|
9867
|
-
metadataEvent
|
|
9868
|
-
|
|
9869
|
-
providerType: providerType || void 0,
|
|
9870
|
-
providerSessionId: readNonEmptyString2(args.providerSessionId),
|
|
9871
|
-
finalSummary,
|
|
9872
|
-
taskId: args.taskId,
|
|
9873
|
-
workerResult,
|
|
9874
|
-
completionDiagnostic: {
|
|
9875
|
-
reason: "direct_task_transcript_reconciliation",
|
|
9876
|
-
terminalLedgerKind: kind,
|
|
9877
|
-
terminalLedgerId: entry.id
|
|
9878
|
-
}
|
|
9879
|
-
},
|
|
9880
|
-
coordinatorMessage: void 0,
|
|
9883
|
+
metadataEvent,
|
|
9884
|
+
coordinatorMessage: buildMeshSystemMessage({ event: eventName, nodeLabel, metadataEvent }),
|
|
9881
9885
|
queuedAt: Date.now(),
|
|
9882
|
-
...readNonEmptyString2(args.targetCoordinatorDaemonId) ? { targetCoordinatorDaemonId: readNonEmptyString2(args.targetCoordinatorDaemonId) } : {}
|
|
9886
|
+
...readNonEmptyString2(args.targetCoordinatorDaemonId) ? { targetCoordinatorDaemonId: readNonEmptyString2(args.targetCoordinatorDaemonId) } : {},
|
|
9887
|
+
...targetCoordinatorSessionId ? { targetCoordinatorSessionId } : {}
|
|
9883
9888
|
});
|
|
9884
9889
|
return { reconciled: true, kind, workerResult, ledgerEntryId: entry.id };
|
|
9885
9890
|
}
|
|
@@ -10775,6 +10780,11 @@ function deliverTaskToSession(dispatchThunk, ctx, warmup) {
|
|
|
10775
10780
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
10776
10781
|
const mesh = getMeshWithCache(components, meshId);
|
|
10777
10782
|
const node = mesh?.nodes.find((n) => readMeshNodeId(n) === nodeId);
|
|
10783
|
+
const gateNode = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
10784
|
+
if (gateNode?.worktreeBootstrap?.status === "running") {
|
|
10785
|
+
LOG.info("MeshQueue", `Gating queue claim for worktree node ${nodeId} (${sessionId}): worktree bootstrap still running \u2014 task left pending; claim re-fires once bootstrap reaches a terminal state (guards against dispatching into a half-built worktree \u2192 empty session)`);
|
|
10786
|
+
return false;
|
|
10787
|
+
}
|
|
10778
10788
|
const localClaimAdapter = components.cliManager?.adapters?.get(sessionId);
|
|
10779
10789
|
let claimInstanceWorkspace = "";
|
|
10780
10790
|
let claimStampedNodeId = "";
|
|
@@ -15212,7 +15222,19 @@ function shouldHoldPendingDrainForBusyLocalCoordinator(components, meshId, reque
|
|
|
15212
15222
|
return localIds.some((id) => daemonIdsEquivalent(id, requested));
|
|
15213
15223
|
}
|
|
15214
15224
|
function injectPendingIntoCoordinator(coordinator, pending) {
|
|
15215
|
-
if (!coordinator
|
|
15225
|
+
if (!coordinator) return;
|
|
15226
|
+
let coordinatorMessage = pending.coordinatorMessage;
|
|
15227
|
+
if (!coordinatorMessage) {
|
|
15228
|
+
if (!shouldForceInjectMeshEvent(pending.event)) return;
|
|
15229
|
+
const metadataEvent = pending.metadataEvent && typeof pending.metadataEvent === "object" ? pending.metadataEvent : {};
|
|
15230
|
+
coordinatorMessage = buildMeshSystemMessage({
|
|
15231
|
+
event: pending.event,
|
|
15232
|
+
nodeLabel: pending.nodeLabel,
|
|
15233
|
+
metadataEvent
|
|
15234
|
+
});
|
|
15235
|
+
if (!coordinatorMessage) return;
|
|
15236
|
+
LOG.warn("MeshReconcile", `Lazily synthesized missing coordinatorMessage for ${pending.event} (mesh ${pending.meshId}) at inject time \u2014 a queued terminal event arrived message-less`);
|
|
15237
|
+
}
|
|
15216
15238
|
const force = shouldForceInjectMeshEvent(pending.event);
|
|
15217
15239
|
traceMeshEventStage("surfaced", {
|
|
15218
15240
|
taskId: pending.metadataEvent?.taskId,
|
|
@@ -15222,7 +15244,7 @@ function injectPendingIntoCoordinator(coordinator, pending) {
|
|
|
15222
15244
|
event: pending.event
|
|
15223
15245
|
}, force ? "force-inject" : "inject");
|
|
15224
15246
|
coordinator.onEvent("send_message", {
|
|
15225
|
-
input: { text:
|
|
15247
|
+
input: { text: coordinatorMessage, textFallback: coordinatorMessage },
|
|
15226
15248
|
...force ? { force: true } : {}
|
|
15227
15249
|
});
|
|
15228
15250
|
}
|