@adhdev/daemon-core 0.9.82-rc.389 → 0.9.82-rc.390
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 +54 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -10
- package/dist/index.mjs.map +1 -1
- package/dist/providers/cli-provider-instance.d.ts +20 -0
- package/package.json +2 -2
- package/src/commands/high-family/mesh-events.ts +23 -2
- package/src/providers/cli-provider-instance.ts +71 -5
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 ? "25bb0512a5fd46999cb1fe21ef4ab7e2ed23a6c6" : void 0) ?? "unknown";
|
|
382
|
+
const commitShort = readInjected(true ? "25bb0512" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
383
|
+
const version = readInjected(true ? "0.9.82-rc.390" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
384
|
+
const builtAt = readInjected(true ? "2026-06-26T09:55:40.652Z" : void 0);
|
|
385
385
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
386
386
|
return cached;
|
|
387
387
|
}
|
|
@@ -38774,6 +38774,24 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
38774
38774
|
* from scratch rather than firing on a stale timestamp.
|
|
38775
38775
|
*/
|
|
38776
38776
|
static AUTO_APPROVE_GATE_HYSTERESIS_MS = 1500;
|
|
38777
|
+
/**
|
|
38778
|
+
* STATUS-MISMATCH: upper bound on how long the auto-approve→`generating` SURFACE
|
|
38779
|
+
* mask may hide a worker's `waiting_approval` (status + activeModal) before we give
|
|
38780
|
+
* up and surface the real prompt. The mask exists because auto-approve is expected
|
|
38781
|
+
* to resolve the modal momentarily; but if it STALLS without ever calling
|
|
38782
|
+
* resolveModal — the modal signature never settles for AUTO_APPROVE_SETTLE_MS (a
|
|
38783
|
+
* perpetually-flapping/streaming prompt), no concrete modal is ever captured, or the
|
|
38784
|
+
* modal is a picker/non-affirmative we never auto-pick — the mask would persist
|
|
38785
|
+
* forever and read_chat / mesh_status / the dashboard would NEVER see the pending
|
|
38786
|
+
* approval (the coordinator cannot mesh_approve what it cannot see). Once an episode
|
|
38787
|
+
* exceeds this bound we stop masking. Generously larger than
|
|
38788
|
+
* AUTO_APPROVE_SETTLE_MS (600) + AUTO_APPROVE_GATE_HYSTERESIS_MS (1500) so a
|
|
38789
|
+
* legitimately slow-settling / blip-flapping prompt is never unmasked early; a
|
|
38790
|
+
* genuine never-resolving stall surfaces within this window. The settle gate keeps
|
|
38791
|
+
* running underneath, so a prompt that finally stabilises still auto-approves, and
|
|
38792
|
+
* mesh_approve (raw FSM, unmasked) works throughout.
|
|
38793
|
+
*/
|
|
38794
|
+
static AUTO_APPROVE_MASK_STALL_MS = 4500;
|
|
38777
38795
|
adapter;
|
|
38778
38796
|
context = null;
|
|
38779
38797
|
events = [];
|
|
@@ -38807,6 +38825,14 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
38807
38825
|
// a settle gate was in progress. Drives AUTO_APPROVE_GATE_HYSTERESIS_MS so a
|
|
38808
38826
|
// brief generating flip does not immediately wipe the settle clock.
|
|
38809
38827
|
autoApproveInactiveSince = 0;
|
|
38828
|
+
// STATUS-MISMATCH: wall-clock when the CURRENT auto-approve episode (waiting_approval
|
|
38829
|
+
// + shouldAutoApprove) first began wanting to mask. Unlike pendingAutoApprovalSince it
|
|
38830
|
+
// is NOT reset when the modal signature changes (a still-streaming/flapping prompt) and
|
|
38831
|
+
// survives the same hysteresis blips the settle gate does, so it measures the TRUE age
|
|
38832
|
+
// of an unresolved auto-approve. Once it exceeds AUTO_APPROVE_MASK_STALL_MS the surface
|
|
38833
|
+
// mask is dropped so the real waiting_approval surfaces. Cleared when the episode ends
|
|
38834
|
+
// (modal genuinely gone, manual attendance takes over, or auto-approve fires).
|
|
38835
|
+
autoApproveMaskSince = 0;
|
|
38810
38836
|
// Provider-common manual-attendance signal: while a human is actively driving
|
|
38811
38837
|
// this session from the dashboard, auto-approve holds so they can take manual
|
|
38812
38838
|
// control. Background mesh workers are never attended → delegated auto-approve
|
|
@@ -38954,7 +38980,8 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
38954
38980
|
this.provider,
|
|
38955
38981
|
typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
|
|
38956
38982
|
);
|
|
38957
|
-
const
|
|
38983
|
+
const nowMs = Date.now();
|
|
38984
|
+
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, nowMs) && !this.autoApproveMaskStalled(nowMs);
|
|
38958
38985
|
const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
|
|
38959
38986
|
let visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
|
|
38960
38987
|
if (isCliGeneratingLikeStatus(visibleStatus) && this.lastStatus === "idle") {
|
|
@@ -39095,7 +39122,8 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
39095
39122
|
}
|
|
39096
39123
|
getHotChatSessionState() {
|
|
39097
39124
|
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
39098
|
-
const
|
|
39125
|
+
const nowMs = Date.now();
|
|
39126
|
+
const autoApproveActive = this.autoApproveEffectivelyActive(adapterStatus.status, nowMs) && !this.autoApproveMaskStalled(nowMs);
|
|
39099
39127
|
const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
|
|
39100
39128
|
const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
|
|
39101
39129
|
const runtime = this.adapter.getRuntimeMetadata();
|
|
@@ -39110,7 +39138,8 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
39110
39138
|
}
|
|
39111
39139
|
getSessionModalState(sessionId) {
|
|
39112
39140
|
const adapterStatus = this.adapter.getStatus({ allowParse: true });
|
|
39113
|
-
const
|
|
39141
|
+
const nowMs = Date.now();
|
|
39142
|
+
const autoApproveActive = this.autoApproveEffectivelyActive(adapterStatus.status, nowMs) && !this.autoApproveMaskStalled(nowMs);
|
|
39114
39143
|
const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
|
|
39115
39144
|
const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
|
|
39116
39145
|
const dirName = workingDirBasename(this.workingDir);
|
|
@@ -39223,7 +39252,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
39223
39252
|
} catch {
|
|
39224
39253
|
return null;
|
|
39225
39254
|
}
|
|
39226
|
-
if (adapterStatus.status === "waiting_approval" && !this.autoApproveEffectivelyActive(adapterStatus.status)) {
|
|
39255
|
+
if (adapterStatus.status === "waiting_approval" && (!this.autoApproveEffectivelyActive(adapterStatus.status) || this.autoApproveMaskStalled())) {
|
|
39227
39256
|
return "waiting_approval";
|
|
39228
39257
|
}
|
|
39229
39258
|
return null;
|
|
@@ -39762,6 +39791,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
39762
39791
|
this.pendingAutoApprovalSignature = "";
|
|
39763
39792
|
this.pendingAutoApprovalSince = 0;
|
|
39764
39793
|
this.autoApproveInactiveSince = 0;
|
|
39794
|
+
this.autoApproveMaskSince = 0;
|
|
39765
39795
|
if (this.autoApproveSettleTimer) clearTimeout(this.autoApproveSettleTimer);
|
|
39766
39796
|
this.autoApproveSettleTimer = setTimeout(() => {
|
|
39767
39797
|
this.autoApproveSettleTimer = null;
|
|
@@ -39787,6 +39817,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
39787
39817
|
this.pendingAutoApprovalSignature = "";
|
|
39788
39818
|
this.pendingAutoApprovalSince = 0;
|
|
39789
39819
|
this.autoApproveInactiveSince = 0;
|
|
39820
|
+
this.autoApproveMaskSince = 0;
|
|
39790
39821
|
if (this.autoApproveSettleTimer) {
|
|
39791
39822
|
clearTimeout(this.autoApproveSettleTimer);
|
|
39792
39823
|
this.autoApproveSettleTimer = null;
|
|
@@ -39794,6 +39825,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
39794
39825
|
return autoApproveActive;
|
|
39795
39826
|
}
|
|
39796
39827
|
this.autoApproveInactiveSince = 0;
|
|
39828
|
+
if (!this.autoApproveMaskSince) this.autoApproveMaskSince = now;
|
|
39797
39829
|
const modal = adapterStatus.activeModal;
|
|
39798
39830
|
const buttons = Array.isArray(modal?.buttons) ? modal.buttons.map((b) => String(b || "").trim()).filter(Boolean) : [];
|
|
39799
39831
|
if (!modal || buttons.length === 0) {
|
|
@@ -39839,6 +39871,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
39839
39871
|
this.pendingAutoApprovalSignature = "";
|
|
39840
39872
|
this.pendingAutoApprovalSince = 0;
|
|
39841
39873
|
this.autoApproveInactiveSince = 0;
|
|
39874
|
+
this.autoApproveMaskSince = 0;
|
|
39842
39875
|
if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
|
|
39843
39876
|
this.autoApproveBusyTimer = setTimeout(() => {
|
|
39844
39877
|
this.autoApproveBusy = false;
|
|
@@ -40280,6 +40313,16 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40280
40313
|
autoApproveEffectivelyActive(status, now = Date.now()) {
|
|
40281
40314
|
return status === "waiting_approval" && this.shouldAutoApprove() && !this.manualAttendance.isAttended(now);
|
|
40282
40315
|
}
|
|
40316
|
+
// STATUS-MISMATCH: true once the current auto-approve episode has been masking
|
|
40317
|
+
// waiting_approval behind `generating` for longer than AUTO_APPROVE_MASK_STALL_MS without
|
|
40318
|
+
// resolving (the settle gate never fired). When stalled, the surface mask must be dropped
|
|
40319
|
+
// so read_chat / mesh_status / the dashboard see the real waiting_approval + modal (and a
|
|
40320
|
+
// coordinator can mesh_approve it). autoApproveMaskSince is maintained by
|
|
40321
|
+
// maybeAutoApproveStatus (driven by getState + the recheck timer during a waiting episode);
|
|
40322
|
+
// this read is side-effect-free so getStatusMetadata can consult it too.
|
|
40323
|
+
autoApproveMaskStalled(now = Date.now()) {
|
|
40324
|
+
return this.autoApproveMaskSince > 0 && now - this.autoApproveMaskSince > _CliProviderInstance.AUTO_APPROVE_MASK_STALL_MS;
|
|
40325
|
+
}
|
|
40283
40326
|
recordAutoApproval(modalMessage, buttonLabel, now = Date.now()) {
|
|
40284
40327
|
this.appendRuntimeSystemMessage(
|
|
40285
40328
|
formatAutoApprovalMessage(modalMessage, buttonLabel),
|
|
@@ -48429,11 +48472,12 @@ var meshEventsHandlers = {
|
|
|
48429
48472
|
get_pending_mesh_events: async (ctx, args) => {
|
|
48430
48473
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
48431
48474
|
const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : void 0;
|
|
48475
|
+
const hasLiveCliCoordinator = meshId ? resolveCoordinatorDrainDeliverability(ctx.deps, meshId).hasLiveCliCoordinator : false;
|
|
48432
48476
|
if (meshId && shouldHoldPendingDrainForBusyLocalCoordinator(ctx.deps, meshId, coordinatorDaemonId)) {
|
|
48433
|
-
return { success: true, events: [], heldForBusyLocalCoordinator: true };
|
|
48477
|
+
return { success: true, events: [], heldForBusyLocalCoordinator: true, hasLiveCliCoordinator };
|
|
48434
48478
|
}
|
|
48435
48479
|
const events = drainPendingMeshCoordinatorEvents(meshId || void 0, coordinatorDaemonId);
|
|
48436
|
-
return { success: true, events };
|
|
48480
|
+
return { success: true, events, hasLiveCliCoordinator };
|
|
48437
48481
|
},
|
|
48438
48482
|
interactive_prompt_response: async (ctx, args) => {
|
|
48439
48483
|
const sessionId = typeof args?.targetSessionId === "string" && args.targetSessionId.trim() ? args.targetSessionId.trim() : typeof args?.sessionId === "string" && args.sessionId.trim() ? args.sessionId.trim() : "";
|