@songsid/agend 2.1.6-beta.14 → 2.1.6-beta.16

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/daemon.d.ts CHANGED
@@ -217,9 +217,13 @@ export declare class BackendUnreachableStartupError extends Error {
217
217
  * prompt. A TUI that is still completing its first redraw can swallow Enter.
218
218
  *
219
219
  * Since the adaptive settle (see {@link waitForPasteSettle}) this value is the
220
- * *fallback* wait — it governs only deliveries where the pane's output cannot
221
- * be observed (no control mode, native-queue handoff, mid-wait reconnect, or a
222
- * paste that never visibly renders).
220
+ * *minimum* settle window for the first delivery — it prevents Enter from firing
221
+ * before the minimum elapses even when the paste's own render goes quiet early.
222
+ * For observed deliveries the quiet-exit path in waitForPasteSettle now checks
223
+ * `now >= fallbackDeadline`, so 1750ms governs every first delivery regardless
224
+ * of whether output is observed. For unobserved deliveries (no control mode,
225
+ * native-queue handoff, mid-wait reconnect, or a paste that never visibly
226
+ * renders) it is the flat fallback delay, same as before.
223
227
  */
224
228
  export declare class FirstDeliveryDelay {
225
229
  private readyAt;
@@ -256,9 +260,15 @@ export interface PasteSettleResult {
256
260
  * So: watch `lastOutputAt` and send Enter only once the paste's own render has
257
261
  * been quiet for {@link PASTE_QUIET_MS}. Bounded both ways —
258
262
  *
259
- * - never earlier than the legacy fixed delay when the paste produces no
260
- * observable output at all (`usedFallback`), so panes that don't echo keep
261
- * their long-standing behaviour;
263
+ * - never earlier than `fallbackMs` from settle start: `fallbackMs` is a
264
+ * **minimum** settle window, not merely a fallback. For first deliveries
265
+ * (fallbackMs = 1750ms) the compositor may render quickly then go quiet at
266
+ * ~550ms while still initialising — the minimum ensures Enter is held until
267
+ * 1750ms regardless of observed output. This applies to every backend's first
268
+ * delivery after ready, not only codex/Luna Reserve. For normal deliveries
269
+ * (fallbackMs = 500ms ≈ PASTE_QUIET_MS) the minimum adds at most a few ms
270
+ * and is effectively unchanged. When the paste produces no observable output
271
+ * at all (`usedFallback`), the same `fallbackMs` deadline governs;
262
272
  * - never later than {@link PASTE_SETTLE_CAP_MS} after the paste (`capHit`),
263
273
  * so a chatty pane cannot stall delivery.
264
274
  *
@@ -610,6 +620,14 @@ export declare class Daemon extends EventEmitter {
610
620
  getProcessStatus(): "running" | "crashed" | "stopped";
611
621
  get lastPausedAt(): number | null;
612
622
  private getPauseWakeState;
623
+ /**
624
+ * Codex can show an exhausted-account notice while the user is switching to
625
+ * a reserve account. Once the live composer and Context footer are back, the
626
+ * notice is scrollback, not a reason to pause and send /quit.
627
+ */
628
+ private isCodexLivePaneSnapshot;
629
+ /** Re-check the current pane after an async quota probe before pausing it. */
630
+ isCodexLivePane(): Promise<boolean>;
613
631
  /** Whether this instance is in a crash loop (3+ consecutive crashes). */
614
632
  get isCrashLoop(): boolean;
615
633
  /** The most recent error type detected by the error monitor (e.g. "rate_limit", "auth_error"). */
@@ -811,8 +829,33 @@ export declare class Daemon extends EventEmitter {
811
829
  * `y` as a brand-new user message.
812
830
  */
813
831
  private confirmBackendClearDialog;
832
+ /**
833
+ * The last time AgEnD itself asked the CLI to go away, and why (#927). Read
834
+ * when a pane dies, to tell "AgEnD stopped it" from "the CLI exited on its
835
+ * own" — a codex that exits 0 on its own and one AgEnD sent /quit look the
836
+ * same from the pane.
837
+ */
838
+ private lastStopRequest;
839
+ /** Record, and log, that AgEnD is about to stop the CLI. */
840
+ private noteStopRequest;
841
+ /** Capture the pane's recent output with escape codes stripped. Never throws. */
842
+ private capturePaneOutput;
843
+ /**
844
+ * One record per pane death: exit status, when, who, and what the CLI printed
845
+ * last — the line that was missing when a codex on Luna Reserve died with
846
+ * status 0 and daemon.log said only "exited normally" (#927). Logging only;
847
+ * the caller decides what happens next.
848
+ */
849
+ private logPaneDeath;
814
850
  /** Send the backend-specific graceful quit command/key sequence. */
815
851
  private sendQuitSequence;
852
+ /**
853
+ * Kiro drops `/quit` while a turn is running. Stop that turn first, then use
854
+ * the same delivery readiness gate that protects Enter from the busy pane.
855
+ * Returning false is fail-closed: the caller skips `/quit` and enters the
856
+ * bounded SIGTERM -> SIGKILL fallback instead of typing into an unknown pane.
857
+ */
858
+ private drainBusyKiroForStop;
816
859
  stop(): Promise<void>;
817
860
  getHangDetector(): HangDetector | null;
818
861
  getInstanceState(): InstanceState | "paused";
@@ -1143,6 +1186,10 @@ export declare class Daemon extends EventEmitter {
1143
1186
  * (dropped) Enter — and an unreadable pane is not a verified absence either.
1144
1187
  */
1145
1188
  private confirmSubmittedAfterEnter;
1189
+ /** Once Kiro returns to its prompt, its unique envelope id in history proves submission. */
1190
+ private kiroSubmissionEvidence;
1191
+ /** Observe the Kiro paste outside paneWriteLock; a long agent turn must not block dialog handling. */
1192
+ private observeKiroSubmission;
1146
1193
  /**
1147
1194
  * While the CLI is parked on a fatal startup screen (see fatalStartupBlocked),
1148
1195
  * no pane write may happen: paste+Enter into the corrupt-config modal would