@songsid/agend 2.1.11-beta.3 → 2.1.11-beta.5

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.
Files changed (47) hide show
  1. package/dist/backend/codex.d.ts +2 -0
  2. package/dist/backend/codex.js +55 -14
  3. package/dist/backend/codex.js.map +1 -1
  4. package/dist/backend/muse.d.ts +50 -5
  5. package/dist/backend/muse.js +166 -32
  6. package/dist/backend/muse.js.map +1 -1
  7. package/dist/backend/types.d.ts +39 -1
  8. package/dist/backend/types.js.map +1 -1
  9. package/dist/command-table.d.ts +33 -0
  10. package/dist/command-table.js +45 -0
  11. package/dist/command-table.js.map +1 -1
  12. package/dist/daemon.d.ts +93 -1
  13. package/dist/daemon.js +456 -31
  14. package/dist/daemon.js.map +1 -1
  15. package/dist/darwin-memory.d.ts +34 -0
  16. package/dist/darwin-memory.js +160 -0
  17. package/dist/darwin-memory.js.map +1 -0
  18. package/dist/fleet-manager.d.ts +10 -0
  19. package/dist/fleet-manager.js +30 -7
  20. package/dist/fleet-manager.js.map +1 -1
  21. package/dist/host-memory.d.ts +3 -2
  22. package/dist/host-memory.js +14 -0
  23. package/dist/host-memory.js.map +1 -1
  24. package/dist/instance-lifecycle.d.ts +11 -0
  25. package/dist/instance-lifecycle.js +45 -8
  26. package/dist/instance-lifecycle.js.map +1 -1
  27. package/dist/locale.js +11 -0
  28. package/dist/locale.js.map +1 -1
  29. package/dist/memory-pressure.d.ts +20 -1
  30. package/dist/memory-pressure.js +87 -6
  31. package/dist/memory-pressure.js.map +1 -1
  32. package/dist/resource-report.d.ts +1 -1
  33. package/dist/resource-report.js +5 -4
  34. package/dist/resource-report.js.map +1 -1
  35. package/dist/spawn-gate.d.ts +4 -0
  36. package/dist/spawn-gate.js +36 -8
  37. package/dist/spawn-gate.js.map +1 -1
  38. package/dist/tmux-manager.d.ts +7 -0
  39. package/dist/tmux-manager.js +19 -0
  40. package/dist/tmux-manager.js.map +1 -1
  41. package/dist/topic-commands.d.ts +16 -2
  42. package/dist/topic-commands.js +85 -94
  43. package/dist/topic-commands.js.map +1 -1
  44. package/dist/turn-reply-guard.d.ts +3 -0
  45. package/dist/turn-reply-guard.js +12 -2
  46. package/dist/turn-reply-guard.js.map +1 -1
  47. package/package.json +1 -1
package/dist/daemon.d.ts CHANGED
@@ -169,10 +169,12 @@ export declare class PaneStateMachine {
169
169
  private readonly busyPattern;
170
170
  private lastPaneHash;
171
171
  private lastPaneChangeAt;
172
+ private lastProgressTick;
173
+ private readonly progressTick;
172
174
  private lastObservedAt;
173
175
  private stateChangedAt;
174
176
  private currentState;
175
- constructor(readyPattern: RegExp, stuckTimeoutMs?: number, now?: number, busyPattern?: RegExp | null);
177
+ constructor(readyPattern: RegExp, stuckTimeoutMs?: number, now?: number, busyPattern?: RegExp | null, progressTick?: ((pane: string) => number | null) | null);
176
178
  /** Ready, unless the backend can positively see that it is still generating. */
177
179
  private isReady;
178
180
  /**
@@ -480,6 +482,22 @@ export declare class Daemon extends EventEmitter {
480
482
  * dialog on screen at every poll and ignores nothing.
481
483
  */
482
484
  private dialogAnswers;
485
+ /**
486
+ * The last error occurrence handed to the lifecycle: what an action that needs the screen it was seen on (a
487
+ * `nudge_continue` arming) reads back, with the spawn / monitors it was seen under.
488
+ */
489
+ private lastErrorEpisode;
490
+ /**
491
+ * An armed "tell the agent to keep going" (Codex model at capacity). One per episode; the monitor owns it: every poll
492
+ * cancels it when anything changed, and it fires at most once. The due time is on the monotonic clock.
493
+ */
494
+ /**
495
+ * How many occurrences of each `nudge_continue` pattern were already on screen when this spawn first showed a live
496
+ * composer (null until then): resumed scrollback, i.e. HISTORY. An occurrence is a new episode only beyond that — a
497
+ * resumed session whose scrollback holds an old capacity line must not be told to "keep going" for it (#949).
498
+ */
499
+ private nudgeBaselines;
500
+ private capacityNudge;
483
501
  /** Current stdin-owning runtime dialog, independent from execution state. */
484
502
  private inputBlockedDialogKey;
485
503
  /** Generation/signature fence for safety dialogs while their screen is still visible. */
@@ -618,6 +636,8 @@ export declare class Daemon extends EventEmitter {
618
636
  * comes from. See PaneWriteLock for why interleaving is destructive. */
619
637
  private readonly paneWriteLock;
620
638
  private deliveryWritesStopping;
639
+ /** #829: the latest pastes, by spawn generation (see ownedInputDraft). */
640
+ private recentPastes;
621
641
  private pendingInstructionsUpdate;
622
642
  private pendingInstructionsNotice;
623
643
  private warmupNeeded;
@@ -1122,6 +1142,8 @@ export declare class Daemon extends EventEmitter {
1122
1142
  private startReplyRecovery;
1123
1143
  private reportReplyDropWithoutRetry;
1124
1144
  private queueReplyRecoveryPrompt;
1145
+ /** Recheck after queue waits and IO; cancellation must not become a failure notice. */
1146
+ private currentReplyRecovery;
1125
1147
  private queueMalformedReplyRecovery;
1126
1148
  private reportUnrecoveredReplyDrop;
1127
1149
  /** Relay the pane's final text to the channel, marked as a daemon proxy reply. */
@@ -1207,6 +1229,12 @@ export declare class Daemon extends EventEmitter {
1207
1229
  */
1208
1230
  private systemPasteOptions;
1209
1231
  private summarizeTool;
1232
+ /**
1233
+ * A steered message reads like a queued one plus a banner. The delivery marker (`[agend-delivery-id:…]`, when the message
1234
+ * is a durable delivery) must LEAD the persisted user message — restart reconciliation recognises a delivery only by a
1235
+ * marker at the start of the body (#1197) — so the banner goes right after it, not in front of it.
1236
+ */
1237
+ private static steerEnvelope;
1210
1238
  /**
1211
1239
  * The one place an inbound message grows its metadata wrapper ([user:]/
1212
1240
  * [from:] prefix, pending reactions, handoff metadata, reply instructions).
@@ -1338,6 +1366,26 @@ export declare class Daemon extends EventEmitter {
1338
1366
  * within a bound and then fail loudly.
1339
1367
  */
1340
1368
  private probeBlockingDialog;
1369
+ /**
1370
+ * Arm the "keep going" nudge for the error occurrence just reported (`pattern` must be the one the lifecycle was
1371
+ * handed). The nudge is sent once, `delayMs` from now on the MONOTONIC clock (a wall-clock step changes nothing),
1372
+ * and only if nothing has changed by then — see {@link tickCapacityNudge}. Returns false when there is nothing to arm.
1373
+ */
1374
+ armCapacityNudge(pattern: RegExp, delayMs: number): boolean;
1375
+ /** Drop an armed nudge (the user stopped / paused the instance, or the lifecycle gave up on it). */
1376
+ cancelCapacityNudge(reason: string): void;
1377
+ /** The first live composer of a spawn fixes what is history (see {@link nudgeBaselines}). */
1378
+ private takeNudgeBaselines;
1379
+ private static countOccurrences;
1380
+ /**
1381
+ * One monitor poll's look at an armed nudge. It is CANCELLED — never postponed — when anything about the instance
1382
+ * moved: a stop / pause / respawn (spawn generation or monitor epoch), a user cancel (delivery epoch), the pane no
1383
+ * longer being exactly the one the error was seen on (it moved on by itself, a person typed, another dialog), the
1384
+ * agent working, or a message waiting for delivery. Only when it is due and still untouched is it fired — once — and
1385
+ * the injection re-verifies everything under the pane-write lock.
1386
+ */
1387
+ private tickCapacityNudge;
1388
+ private sendCapacityNudge;
1341
1389
  /** What identifies the request on screen: the backend's own identity when it has one, else the whole screen verbatim. */
1342
1390
  private static screenOf;
1343
1391
  private static answerKey;
@@ -1447,6 +1495,35 @@ export declare class Daemon extends EventEmitter {
1447
1495
  * else submitted it); "failed" = the Enter could not be sent (the delivery
1448
1496
  * must fail rather than paste on top of the stranded text).
1449
1497
  */
1498
+ /** #829: remember what this pane generation was given, so a draft can be proven to be ours. */
1499
+ /**
1500
+ * #829: remember what was pasted, under the spawn generation it was written
1501
+ * to — fixed by the caller BEFORE its paste await, so a write that lands
1502
+ * while the CLI is replaced is never credited to the replacement.
1503
+ */
1504
+ private rememberPaste;
1505
+ /**
1506
+ * #829: whether the input box shows one of this generation's own pastes —
1507
+ * exactly as the backend draws it, wrapping included (inputDraftShows). A
1508
+ * marker that looks like AgEnD's, a collapsed paste whose content cannot be
1509
+ * seen, or text that differs only in spacing proves nothing.
1510
+ */
1511
+ private ownsInputDraft;
1512
+ /**
1513
+ * #829: empty the CLI's input box of a draft the CLI put back there itself
1514
+ * (muse restores a cancelled prompt) before a delivery is pasted. Only for a
1515
+ * backend that can read its box and names the keys that clear it; every other
1516
+ * backend is untouched.
1517
+ *
1518
+ * Only a draft that is provably one of this pane's own pastes is cleared, one
1519
+ * line per round, and every round must leave the first or last rows of what
1520
+ * was there — anything else in the box is somebody's typing and stops the
1521
+ * clearing. `current` is the caller's fixed fence (cancel, stop, freeze,
1522
+ * pause, spawn): it is asked after every await, and a stale answer means
1523
+ * nothing more is sent. A capture that fails, a box that does not empty or a
1524
+ * draft that is not ours stops the delivery; it is never pasted onto.
1525
+ */
1526
+ private clearRestoredInputDraft;
1450
1527
  private submitStrandedInputIfAny;
1451
1528
  /**
1452
1529
  * "stranded": an AgEnD message sits in the input row; "clear": no strand is
@@ -1531,6 +1608,13 @@ export declare class Daemon extends EventEmitter {
1531
1608
  * — fall back to "the pane printed something" whenever a paste left no trace,
1532
1609
  * which is the same false confirmation one layer down.
1533
1610
  */
1611
+ /**
1612
+ * The acceptance evidence for a steer whose input row cannot be read: a FRESH capture shows this delivery's trusted unique
1613
+ * marker more often than the pre-paste baseline did, no blocking dialog owns the pane, and it is still the spawn and the
1614
+ * window the paste went into. (The marker is the `message_id:` value AgEnD put in the handoff metadata — never text
1615
+ * scanned out of a body — so an older or quoted line cannot match it.)
1616
+ */
1617
+ private steerMarkerAccepted;
1534
1618
  private canProveSubmission;
1535
1619
  /** Positive submission retires the startup transient guard for this spawn. */
1536
1620
  private submittedProof;
@@ -1578,6 +1662,12 @@ export declare class Daemon extends EventEmitter {
1578
1662
  * Best effort by design: these notices must never fail a delivery or throw.
1579
1663
  * The caller already holds paneWriteLock.
1580
1664
  */
1665
+ /**
1666
+ * `guard` is for a paste that must not outlive the reason it was made (the continue nudge): `accept` judges the ONE
1667
+ * capture taken here — the same picture is the baseline, the expected-screen check and the idle check — and `current`
1668
+ * is asked again after every await that precedes a write, so a cancelled paste adds no further paste and no key
1669
+ * (the retries included). Without a guard it is exactly the old unconditional path.
1670
+ */
1581
1671
  private submitSystemPaste;
1582
1672
  /** Re-resolve this instance's tmux window by name (stale id after crash/respawn). */
1583
1673
  private recoverWindow;
@@ -1733,6 +1823,8 @@ export declare class Daemon extends EventEmitter {
1733
1823
  * a live turn. Fail closed: an unreadable pane is never idle.
1734
1824
  */
1735
1825
  private isPaneAuthoritativelyIdle;
1826
+ /** The verdict of {@link isPaneAuthoritativelyIdle} on a capture the caller already holds. */
1827
+ private paneAuthoritativelyIdle;
1736
1828
  /**
1737
1829
  * Poll the authoritative pane check until it reports idle or the budget runs
1738
1830
  * out. Each poll is a fresh capture, so a turn that ends mid-wait is seen.