@adhdev/daemon-core 1.0.28-rc.6 → 1.0.28-rc.7

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.
@@ -64,6 +64,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
64
64
  private pendingOutboundQueue;
65
65
  private pendingOutboundFlushTimer;
66
66
  private pendingOutboundFlushInFlight;
67
+ private pendingOutboundStaleTimer;
67
68
  private submitRetryTimer;
68
69
  private ptyWriteChain;
69
70
  private resizeSuppressUntil;
@@ -264,6 +265,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
264
265
  }): Promise<void>;
265
266
  forceSendMessage(text: string, meshTaskId?: string): Promise<void>;
266
267
  private waitForForceSubmitSettle;
268
+ private static readonly STALE_QUEUE_WARN_MS;
267
269
  private enqueuePendingOutboundMessage;
268
270
  private shouldQueuePendingOutboundMessage;
269
271
  private schedulePendingOutboundFlush;
package/dist/index.js CHANGED
@@ -791,10 +791,10 @@ function readInjected(value) {
791
791
  }
792
792
  function getDaemonBuildInfo() {
793
793
  if (cached) return cached;
794
- const commit = readInjected(true ? "dd0a9d78c0de3a18edc594b4ae7b39afac2d6b83" : void 0) ?? "unknown";
795
- const commitShort = readInjected(true ? "dd0a9d78" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
796
- const version = readInjected(true ? "1.0.28-rc.6" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
797
- const builtAt = readInjected(true ? "2026-07-25T07:34:35.835Z" : void 0);
794
+ const commit = readInjected(true ? "4d3d797d7472b72daaa82b9460f599e819ffee72" : void 0) ?? "unknown";
795
+ const commitShort = readInjected(true ? "4d3d797d" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
796
+ const version = readInjected(true ? "1.0.28-rc.7" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
797
+ const builtAt = readInjected(true ? "2026-07-25T10:44:41.655Z" : void 0);
798
798
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
799
799
  return cached;
800
800
  }
@@ -29757,7 +29757,7 @@ var init_cli_state_engine = __esm({
29757
29757
  return true;
29758
29758
  }
29759
29759
  shouldDeferFinishForTranscript(parsed) {
29760
- const requiresFinalAssistant = !!this.provider.requiresFinalAssistantBeforeIdle;
29760
+ const requiresFinalAssistant = resolveTranscriptAuthorityProfile(this.provider).timing === "floor";
29761
29761
  if (!requiresFinalAssistant) return false;
29762
29762
  if (!this.isWaitingForResponse || !this.currentTurnScope || this.hasActionableApproval()) return false;
29763
29763
  const parsedStatus = typeof parsed?.status === "string" ? parsed.status.trim() : "";
@@ -30169,6 +30169,9 @@ var init_provider_cli_adapter = __esm({
30169
30169
  pendingOutboundQueue = [];
30170
30170
  pendingOutboundFlushTimer = null;
30171
30171
  pendingOutboundFlushInFlight = false;
30172
+ // Stale-queue watchdog: fires STALE_QUEUE_WARN_MS after the oldest queued
30173
+ // message was enqueued if nothing has been flushed yet.
30174
+ pendingOutboundStaleTimer = null;
30172
30175
  // Submit retry timer — PTY-level, not state machine
30173
30176
  submitRetryTimer = null;
30174
30177
  // PTY-WRITE-SERIALIZE: a single per-session tail promise that serializes every
@@ -31202,6 +31205,9 @@ ${lastSnapshot}`;
31202
31205
  async waitForForceSubmitSettle() {
31203
31206
  await new Promise((resolve28) => setTimeout(resolve28, FORCE_SUBMIT_SETTLE_MS));
31204
31207
  }
31208
+ // Stale-queue threshold: warn if a queued message has not been flushed
31209
+ // within this many milliseconds (instrumentation only, no behavior change).
31210
+ static STALE_QUEUE_WARN_MS = 15e3;
31205
31211
  enqueuePendingOutboundMessage(text, reason, meshTaskId) {
31206
31212
  const content = String(text || "");
31207
31213
  const duplicate = this.pendingOutboundQueue.some((message2) => message2.content === content);
@@ -31209,6 +31215,16 @@ ${lastSnapshot}`;
31209
31215
  return;
31210
31216
  }
31211
31217
  const queuedAt = Date.now();
31218
+ const stableMs = this.lastScreenChangeAt ? queuedAt - this.lastScreenChangeAt : -1;
31219
+ const gateContext = {
31220
+ reason,
31221
+ startupParseGate: this.startupParseGate,
31222
+ ready: this.ready,
31223
+ engineStatus: this.engine.currentStatus,
31224
+ isWaitingForResponse: this.engine.isWaitingForResponse,
31225
+ stableMs,
31226
+ sessionId: this.engine.getTraceSessionId()
31227
+ };
31212
31228
  const message = {
31213
31229
  id: `${queuedAt}:${this.pendingOutboundQueue.length}:${Math.random().toString(36).slice(2, 10)}`,
31214
31230
  role: "user",
@@ -31218,8 +31234,18 @@ ${lastSnapshot}`;
31218
31234
  ...typeof meshTaskId === "string" && meshTaskId.trim() ? { meshTaskId } : {}
31219
31235
  };
31220
31236
  this.pendingOutboundQueue.push(message);
31221
- LOG.info("CLI", `[${this.cliType}] queued outbound message while busy (${reason}); queue=${this.pendingOutboundQueue.length}`);
31237
+ LOG.info("CLI", `[${this.cliType}] queued outbound message; gate=${JSON.stringify(gateContext)}; queue=${this.pendingOutboundQueue.length}`);
31222
31238
  this.onStatusChange?.();
31239
+ if (!this.pendingOutboundStaleTimer) {
31240
+ this.pendingOutboundStaleTimer = setTimeout(() => {
31241
+ this.pendingOutboundStaleTimer = null;
31242
+ if (this.pendingOutboundQueue.length === 0) return;
31243
+ const oldest = this.pendingOutboundQueue[0];
31244
+ const staleSec = ((Date.now() - oldest.queuedAt) / 1e3).toFixed(1);
31245
+ const nowStableMs = this.lastScreenChangeAt ? Date.now() - this.lastScreenChangeAt : -1;
31246
+ LOG.warn("CLI", `[${this.cliType}] STALE QUEUE: ${this.pendingOutboundQueue.length} message(s) undelivered for ${staleSec}s; gate=startupParseGate:${this.startupParseGate} ready:${this.ready} engineStatus:${this.engine.currentStatus} isWaitingForResponse:${this.engine.isWaitingForResponse} stableMs:${nowStableMs} sessionId:${this.engine.getTraceSessionId()} enqueueReason:${oldest.id}`);
31247
+ }, _ProviderCliAdapter.STALE_QUEUE_WARN_MS);
31248
+ }
31223
31249
  }
31224
31250
  shouldQueuePendingOutboundMessage(parsedStatusBeforeSend = null) {
31225
31251
  if (this.provider.allowInputDuringGeneration === true) return null;
@@ -31260,6 +31286,10 @@ ${lastSnapshot}`;
31260
31286
  try {
31261
31287
  await this.sendMessageNow(next.content, false, next.meshTaskId);
31262
31288
  this.pendingOutboundQueue.shift();
31289
+ if (this.pendingOutboundQueue.length === 0 && this.pendingOutboundStaleTimer) {
31290
+ clearTimeout(this.pendingOutboundStaleTimer);
31291
+ this.pendingOutboundStaleTimer = null;
31292
+ }
31263
31293
  this.onStatusChange?.();
31264
31294
  } catch (error) {
31265
31295
  LOG.warn("CLI", `[${this.cliType}] queued outbound flush failed: ${error?.message || error}`);
@@ -31591,6 +31621,10 @@ ${lastSnapshot}`;
31591
31621
  clearTimeout(this.pendingOutboundFlushTimer);
31592
31622
  this.pendingOutboundFlushTimer = null;
31593
31623
  }
31624
+ if (this.pendingOutboundStaleTimer) {
31625
+ clearTimeout(this.pendingOutboundStaleTimer);
31626
+ this.pendingOutboundStaleTimer = null;
31627
+ }
31594
31628
  this.pendingOutboundQueue = [];
31595
31629
  this.pendingOutboundFlushInFlight = false;
31596
31630
  if (this.ptyProcess) {
@@ -31619,6 +31653,10 @@ ${lastSnapshot}`;
31619
31653
  clearTimeout(this.pendingOutboundFlushTimer);
31620
31654
  this.pendingOutboundFlushTimer = null;
31621
31655
  }
31656
+ if (this.pendingOutboundStaleTimer) {
31657
+ clearTimeout(this.pendingOutboundStaleTimer);
31658
+ this.pendingOutboundStaleTimer = null;
31659
+ }
31622
31660
  this.pendingOutboundQueue = [];
31623
31661
  this.pendingOutboundFlushInFlight = false;
31624
31662
  if (this.ptyProcess) {
@@ -52762,7 +52800,12 @@ ${buttons.join("\n")}`;
52762
52800
  fcFinalSummary = extractFinalSummaryFromMessages(evidence.messages);
52763
52801
  } catch {
52764
52802
  }
52765
- const missingEvidence = (resolveTranscriptAuthorityProfile(this.provider).timing === "floor" || fcEvidenceSource === "external-native") && !fcFinalSummary;
52803
+ const synthTiming = resolveTranscriptAuthorityProfile(this.provider).timing;
52804
+ const missingEvidence = (synthTiming === "floor" || synthTiming === "hold" || fcEvidenceSource === "external-native") && !fcFinalSummary;
52805
+ if (missingEvidence && synthTiming === "hold") {
52806
+ LOG.info("CLI", `[${this.type}] ${reason} held: hold-class transcript not yet landed (source=${fcEvidenceSource})`);
52807
+ return false;
52808
+ }
52766
52809
  const hasMeshContext = !!(this.settings.meshNodeFor || this.settings.meshActiveTaskId || this.settings.launchedByCoordinator);
52767
52810
  if (missingEvidence && !hasMeshContext) {
52768
52811
  LOG.info("CLI", `[${this.type}] ${reason} suppressed: missing final assistant evidence, no mesh context (source=${fcEvidenceSource})`);