@adhdev/daemon-standalone 0.9.82-rc.384 → 0.9.82-rc.386
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 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30108,10 +30108,10 @@ var require_dist3 = __commonJS({
|
|
|
30108
30108
|
}
|
|
30109
30109
|
function getDaemonBuildInfo() {
|
|
30110
30110
|
if (cached2) return cached2;
|
|
30111
|
-
const commit = readInjected(true ? "
|
|
30112
|
-
const commitShort = readInjected(true ? "
|
|
30113
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30114
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30111
|
+
const commit = readInjected(true ? "fad1d175ca84a75f52bd0c1d88125fbb783ad241" : void 0) ?? "unknown";
|
|
30112
|
+
const commitShort = readInjected(true ? "fad1d175" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30113
|
+
const version2 = readInjected(true ? "0.9.82-rc.386" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30114
|
+
const builtAt = readInjected(true ? "2026-06-26T00:13:10.987Z" : void 0);
|
|
30115
30115
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30116
30116
|
return cached2;
|
|
30117
30117
|
}
|
|
@@ -44781,6 +44781,32 @@ ${cleanBody}`;
|
|
|
44781
44781
|
}
|
|
44782
44782
|
return out;
|
|
44783
44783
|
}
|
|
44784
|
+
function resolveCoordinatorDrainDeliverability(components, meshId) {
|
|
44785
|
+
const coordinators = findLiveCoordinators(components).filter((c) => c.meshId === meshId);
|
|
44786
|
+
if (coordinators.length === 0) {
|
|
44787
|
+
return { hasLiveCliCoordinator: false, deliverableNow: false, holdForReconcile: false };
|
|
44788
|
+
}
|
|
44789
|
+
const hasIdle = coordinators.some((c) => c.idle);
|
|
44790
|
+
return {
|
|
44791
|
+
hasLiveCliCoordinator: true,
|
|
44792
|
+
deliverableNow: hasIdle,
|
|
44793
|
+
// A live CLI coordinator exists but none is idle → the reconcile loop is
|
|
44794
|
+
// holding the events; the poll must not steal them.
|
|
44795
|
+
holdForReconcile: !hasIdle
|
|
44796
|
+
};
|
|
44797
|
+
}
|
|
44798
|
+
function shouldHoldPendingDrainForBusyLocalCoordinator(components, meshId, requestedCoordinatorDaemonId) {
|
|
44799
|
+
if (!meshId) return false;
|
|
44800
|
+
const deliverability = resolveCoordinatorDrainDeliverability(components, meshId);
|
|
44801
|
+
if (!deliverability.holdForReconcile) return false;
|
|
44802
|
+
const requested = readNonEmptyString2(requestedCoordinatorDaemonId);
|
|
44803
|
+
if (!requested) return true;
|
|
44804
|
+
const localIds = expandDaemonIdForms([
|
|
44805
|
+
readNonEmptyString2(components.statusInstanceId),
|
|
44806
|
+
readNonEmptyString2(loadConfig2().machineId)
|
|
44807
|
+
]);
|
|
44808
|
+
return localIds.some((id) => daemonIdsEquivalent(id, requested));
|
|
44809
|
+
}
|
|
44784
44810
|
function injectPendingIntoCoordinator(coordinator, pending) {
|
|
44785
44811
|
if (!coordinator || !pending.coordinatorMessage) return;
|
|
44786
44812
|
const force = shouldForceInjectMeshEvent(pending.event);
|
|
@@ -45502,9 +45528,11 @@ ${cleanBody}`;
|
|
|
45502
45528
|
isMeshCoordinatorEvent: () => isMeshCoordinatorEvent,
|
|
45503
45529
|
queuePendingMeshCoordinatorEvent: () => queuePendingMeshCoordinatorEvent,
|
|
45504
45530
|
reconcileDirectDispatchCompletionFromTranscript: () => reconcileDirectDispatchCompletionFromTranscript,
|
|
45531
|
+
resolveCoordinatorDrainDeliverability: () => resolveCoordinatorDrainDeliverability,
|
|
45505
45532
|
runMeshReconcileTick: () => runMeshReconcileTick,
|
|
45506
45533
|
setupMeshEventForwarding: () => setupMeshEventForwarding,
|
|
45507
45534
|
setupMeshReconcileLoop: () => setupMeshReconcileLoop,
|
|
45535
|
+
shouldHoldPendingDrainForBusyLocalCoordinator: () => shouldHoldPendingDrainForBusyLocalCoordinator,
|
|
45508
45536
|
triggerMeshQueue: () => triggerMeshQueue,
|
|
45509
45537
|
tryAssignQueueTask: () => tryAssignQueueTask
|
|
45510
45538
|
});
|
|
@@ -65821,6 +65849,17 @@ ${body}
|
|
|
65821
65849
|
hasIdleHoldPending() {
|
|
65822
65850
|
return (this.lastFsmEval?.transitions ?? []).some((t) => !t.holdSatisfied && t.condResult);
|
|
65823
65851
|
}
|
|
65852
|
+
/**
|
|
65853
|
+
* True once the machine has reached its first non-initial idle state (the
|
|
65854
|
+
* prompt is genuinely drawn — see maybeMarkReady). The cli-adapter surfaces
|
|
65855
|
+
* this on its idle status so CliProviderInstance can re-arm the queue-claim
|
|
65856
|
+
* agent:ready on the first genuine ready, independent of the boot-time
|
|
65857
|
+
* starting→idle one-shot (which is consumed too early for specs whose
|
|
65858
|
+
* initial state already reports idle).
|
|
65859
|
+
*/
|
|
65860
|
+
hasSeenReady() {
|
|
65861
|
+
return this.readySeenOnce;
|
|
65862
|
+
}
|
|
65824
65863
|
getCompletionIdleDebounceState() {
|
|
65825
65864
|
const out = outgoingTransitions(this.spec, this.currentStateId);
|
|
65826
65865
|
const toReady = this.lastFsmEval?.transitions.find((t, i) => {
|
|
@@ -67477,7 +67516,7 @@ ${body}
|
|
|
67477
67516
|
if (state.status === "generating") {
|
|
67478
67517
|
return { status: "generating", messages: [], activeModal: null, activeInteractivePrompt: this.activeInteractivePrompt, ...sessionFields };
|
|
67479
67518
|
}
|
|
67480
|
-
return { status: "idle", messages: [], activeModal: null, activeInteractivePrompt: this.activeInteractivePrompt, ...sessionFields };
|
|
67519
|
+
return { status: "idle", messages: [], activeModal: null, activeInteractivePrompt: this.activeInteractivePrompt, fsmReadySeen: this.driver.hasSeenReady?.() ?? false, ...sessionFields };
|
|
67481
67520
|
}
|
|
67482
67521
|
maybeRefreshNativeHistory() {
|
|
67483
67522
|
}
|
|
@@ -68510,6 +68549,14 @@ ${body}
|
|
|
68510
68549
|
context = null;
|
|
68511
68550
|
events = [];
|
|
68512
68551
|
lastStatus = "starting";
|
|
68552
|
+
// Idempotency guard for the queue-claim agent:ready event. agent:ready is the
|
|
68553
|
+
// sole signal the mesh coordinator's tryAssignQueueTask waits on to hand a
|
|
68554
|
+
// queued task to this worker. It is emitted in two places: the boot-time
|
|
68555
|
+
// starting→idle one-shot, and the readySeen re-arm below. This flag makes the
|
|
68556
|
+
// event fire AT MOST ONCE per session so a worker is never claimed twice and a
|
|
68557
|
+
// queued task is never double-dispatched/double-injected. Whichever path fires
|
|
68558
|
+
// first sets it; the other becomes a no-op.
|
|
68559
|
+
agentReadyEmitted = false;
|
|
68513
68560
|
generatingStartedAt = 0;
|
|
68514
68561
|
settings = {};
|
|
68515
68562
|
monitor;
|
|
@@ -69590,6 +69637,17 @@ ${body}
|
|
|
69590
69637
|
} catch {
|
|
69591
69638
|
}
|
|
69592
69639
|
}
|
|
69640
|
+
/**
|
|
69641
|
+
* Emit the queue-claim agent:ready event at most once per session. Both the
|
|
69642
|
+
* boot-time starting→idle one-shot and the fsmReadySeen re-arm call this; the
|
|
69643
|
+
* agentReadyEmitted guard ensures the second caller is a no-op so a worker is
|
|
69644
|
+
* never claimed twice and a queued task is never double-dispatched.
|
|
69645
|
+
*/
|
|
69646
|
+
emitAgentReadyOnce(chatTitle, now) {
|
|
69647
|
+
if (this.agentReadyEmitted) return;
|
|
69648
|
+
this.agentReadyEmitted = true;
|
|
69649
|
+
this.pushEvent({ event: "agent:ready", chatTitle, timestamp: now });
|
|
69650
|
+
}
|
|
69593
69651
|
detectStatusTransition() {
|
|
69594
69652
|
const now = Date.now();
|
|
69595
69653
|
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
@@ -69742,7 +69800,7 @@ ${body}
|
|
|
69742
69800
|
this.scheduleCompletedDebounceFlush(flushDelay);
|
|
69743
69801
|
}
|
|
69744
69802
|
} else if (newStatus === "idle" && this.lastStatus === "starting") {
|
|
69745
|
-
this.
|
|
69803
|
+
this.emitAgentReadyOnce(chatTitle, now);
|
|
69746
69804
|
} else if (newStatus === "error") {
|
|
69747
69805
|
if (this.generatingDebounceTimer) {
|
|
69748
69806
|
clearTimeout(this.generatingDebounceTimer);
|
|
@@ -69781,6 +69839,9 @@ ${body}
|
|
|
69781
69839
|
}
|
|
69782
69840
|
this.lastStatus = newStatus;
|
|
69783
69841
|
}
|
|
69842
|
+
if (newStatus === "idle" && adapterStatus.fsmReadySeen === true && !this.agentReadyEmitted) {
|
|
69843
|
+
this.emitAgentReadyOnce(chatTitle, now);
|
|
69844
|
+
}
|
|
69784
69845
|
this.applyProviderResponse(parsedStatus, {
|
|
69785
69846
|
phase: newStatus === "idle" && (previousStatus === "generating" || previousStatus === "waiting_approval") ? "turn_completed" : "immediate"
|
|
69786
69847
|
});
|
|
@@ -78071,9 +78132,12 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
78071
78132
|
mesh_forward_event: async (ctx, args) => {
|
|
78072
78133
|
return handleMeshForwardEvent({ instanceManager: ctx.deps.instanceManager }, args);
|
|
78073
78134
|
},
|
|
78074
|
-
get_pending_mesh_events: async (
|
|
78135
|
+
get_pending_mesh_events: async (ctx, args) => {
|
|
78075
78136
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
78076
78137
|
const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : void 0;
|
|
78138
|
+
if (meshId && shouldHoldPendingDrainForBusyLocalCoordinator(ctx.deps, meshId, coordinatorDaemonId)) {
|
|
78139
|
+
return { success: true, events: [], heldForBusyLocalCoordinator: true };
|
|
78140
|
+
}
|
|
78077
78141
|
const events = drainPendingMeshCoordinatorEvents(meshId || void 0, coordinatorDaemonId);
|
|
78078
78142
|
return { success: true, events };
|
|
78079
78143
|
},
|