@songsid/agend 2.1.6-beta.9 → 2.1.7-beta.1
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/backend/codex.d.ts +35 -0
- package/dist/backend/codex.js +588 -36
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/kiro.d.ts +9 -0
- package/dist/backend/kiro.js +129 -0
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/muse.d.ts +37 -4
- package/dist/backend/muse.js +150 -61
- package/dist/backend/muse.js.map +1 -1
- package/dist/backend/types.d.ts +15 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +1 -0
- package/dist/channel/adapters/discord.js +25 -0
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +13 -0
- package/dist/channel/adapters/telegram.js +44 -3
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/types.d.ts +4 -0
- package/dist/daemon.d.ts +98 -10
- package/dist/daemon.js +868 -119
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-manager.d.ts +53 -9
- package/dist/fleet-manager.js +253 -75
- package/dist/fleet-manager.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +19 -1
- package/dist/instance-lifecycle.js +128 -9
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +16 -0
- package/dist/locale.js.map +1 -1
- package/dist/muse-usage-relay.d.ts +72 -0
- package/dist/muse-usage-relay.js +431 -0
- package/dist/muse-usage-relay.js.map +1 -0
- package/dist/tmux-manager.d.ts +2 -0
- package/dist/tmux-manager.js +20 -0
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tool-permissions.d.ts +27 -0
- package/dist/tool-permissions.js +64 -3
- package/dist/tool-permissions.js.map +1 -1
- package/dist/topic-commands.d.ts +9 -0
- package/dist/topic-commands.js +36 -2
- package/dist/topic-commands.js.map +1 -1
- package/dist/turn-reply-guard.d.ts +5 -1
- package/dist/turn-reply-guard.js +6 -1
- package/dist/turn-reply-guard.js.map +1 -1
- package/dist/ui/view.html +2 -2
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +1 -1
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/providers.d.ts +4 -0
- package/dist/usage/providers.js +86 -9
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.d.ts +0 -11
- package/dist/usage/usage-api.js +50 -8
- package/dist/usage/usage-api.js.map +1 -1
- package/package.json +2 -1
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
|
-
* *
|
|
221
|
-
*
|
|
222
|
-
*
|
|
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
|
|
260
|
-
*
|
|
261
|
-
*
|
|
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
|
*
|
|
@@ -268,7 +278,7 @@ export interface PasteSettleResult {
|
|
|
268
278
|
*/
|
|
269
279
|
export declare function waitForPasteSettle(client: PasteSettleObservation, windowId: string, pasteStartedAt: number, fallbackMs: number): Promise<PasteSettleResult>;
|
|
270
280
|
/** Redact likely credentials and control sequences before pane text reaches logs. */
|
|
271
|
-
export declare function sanitizePaneTail(pane: string, lineCount?: number): string[];
|
|
281
|
+
export declare function sanitizePaneTail(pane: string, lineCount?: number, excludeLine?: (line: string) => boolean): string[];
|
|
272
282
|
/**
|
|
273
283
|
* Distill a pane capture into text worth relaying as a proxy reply.
|
|
274
284
|
*
|
|
@@ -276,13 +286,16 @@ export declare function sanitizePaneTail(pane: string, lineCount?: number): stri
|
|
|
276
286
|
* final answer exists only on screen. Everything up to and including the last
|
|
277
287
|
* line of the inbound message we pasted is cut (the reply starts after it),
|
|
278
288
|
* lines with no letters or digits are dropped (borders, separators, spinners,
|
|
279
|
-
* bare prompts), and
|
|
280
|
-
* when
|
|
281
|
-
*
|
|
289
|
+
* bare prompts), and UI chrome is dropped by a backend-specific per-line
|
|
290
|
+
* filter when available (or a legacy single-line ready pattern). Whole-pane
|
|
291
|
+
* readiness regexes cannot identify individual prompt/footer lines. Returns
|
|
292
|
+
* null when what remains is trivial — a proxy message must carry an answer,
|
|
293
|
+
* not chrome. Secrets are redacted by sanitizePaneTail, same as stuck diagnostics.
|
|
282
294
|
*/
|
|
283
295
|
export declare function extractProxyReplyText(pane: string, opts?: {
|
|
284
296
|
inboundMarker?: string;
|
|
285
297
|
readyPattern?: RegExp | null;
|
|
298
|
+
isChromeLine?: (line: string) => boolean;
|
|
286
299
|
maxLines?: number;
|
|
287
300
|
maxChars?: number;
|
|
288
301
|
}): string | null;
|
|
@@ -494,6 +507,11 @@ export declare class Daemon extends EventEmitter {
|
|
|
494
507
|
private fatalStartupBlocked;
|
|
495
508
|
/** model_error seen mid-turn: notify only if it survives to the idle screen. */
|
|
496
509
|
private pendingModelErrorKey;
|
|
510
|
+
/** Optional per-instance localhost relay used to observe Muse usage events. */
|
|
511
|
+
private museUsageRelay;
|
|
512
|
+
/** Set after an in-run relay failure so subsequent Muse respawns go direct. */
|
|
513
|
+
private museRelayFallback;
|
|
514
|
+
private museRelayFallbackInFlight;
|
|
497
515
|
/**
|
|
498
516
|
* Let the next pause() proceed from a stuck pane. Set only for the auth-deferred
|
|
499
517
|
* pause — see the pausePending consumption site for why waiting for idle there
|
|
@@ -602,6 +620,14 @@ export declare class Daemon extends EventEmitter {
|
|
|
602
620
|
getProcessStatus(): "running" | "crashed" | "stopped";
|
|
603
621
|
get lastPausedAt(): number | null;
|
|
604
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>;
|
|
605
631
|
/** Whether this instance is in a crash loop (3+ consecutive crashes). */
|
|
606
632
|
get isCrashLoop(): boolean;
|
|
607
633
|
/** The most recent error type detected by the error monitor (e.g. "rate_limit", "auth_error"). */
|
|
@@ -803,8 +829,33 @@ export declare class Daemon extends EventEmitter {
|
|
|
803
829
|
* `y` as a brand-new user message.
|
|
804
830
|
*/
|
|
805
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;
|
|
806
850
|
/** Send the backend-specific graceful quit command/key sequence. */
|
|
807
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;
|
|
808
859
|
stop(): Promise<void>;
|
|
809
860
|
getHangDetector(): HangDetector | null;
|
|
810
861
|
getInstanceState(): InstanceState | "paused";
|
|
@@ -1081,6 +1132,9 @@ export declare class Daemon extends EventEmitter {
|
|
|
1081
1132
|
* Other backends keep the silence-based gate byte-for-byte.
|
|
1082
1133
|
*/
|
|
1083
1134
|
private isPaneReadyForDelivery;
|
|
1135
|
+
private needsStartupInputProof;
|
|
1136
|
+
/** Codex can paint a prompt before the TTY enters raw mode. Both are required. */
|
|
1137
|
+
private hasPositiveDeliveryInput;
|
|
1084
1138
|
/**
|
|
1085
1139
|
* Why a pane is not deliverable matters. "busy" may be handed to a native
|
|
1086
1140
|
* input queue or steered (after its own dialog probe); "dialog", "transient"
|
|
@@ -1132,6 +1186,10 @@ export declare class Daemon extends EventEmitter {
|
|
|
1132
1186
|
* (dropped) Enter — and an unreadable pane is not a verified absence either.
|
|
1133
1187
|
*/
|
|
1134
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;
|
|
1135
1193
|
/**
|
|
1136
1194
|
* While the CLI is parked on a fatal startup screen (see fatalStartupBlocked),
|
|
1137
1195
|
* no pane write may happen: paste+Enter into the corrupt-config modal would
|
|
@@ -1208,6 +1266,8 @@ export declare class Daemon extends EventEmitter {
|
|
|
1208
1266
|
*/
|
|
1209
1267
|
private confirmAfterEnter;
|
|
1210
1268
|
private confirmSubmitted;
|
|
1269
|
+
/** Only positive echo/queue evidence may turn an ambiguous Codex write into ✅. */
|
|
1270
|
+
private lateCodexSubmissionProof;
|
|
1211
1271
|
/**
|
|
1212
1272
|
* What the pane currently shows of a given message. Taken once before the
|
|
1213
1273
|
* paste and once after, so confirmSubmitted can require a NEW marker or a NEW
|
|
@@ -1293,6 +1353,12 @@ export declare class Daemon extends EventEmitter {
|
|
|
1293
1353
|
* Bounded, and called BEFORE the pane lock is taken — waiting on the spawn while
|
|
1294
1354
|
* holding the lock the spawn itself needs would deadlock.
|
|
1295
1355
|
*/
|
|
1356
|
+
/**
|
|
1357
|
+
* Wait for an in-flight spawn to finish, up to the cap. Returns true when no
|
|
1358
|
+
* spawn is in flight afterwards; false when the cap expired with one still
|
|
1359
|
+
* running. A false return is NOT settled evidence — the caller must not
|
|
1360
|
+
* treat the current generation as a completed spawn.
|
|
1361
|
+
*/
|
|
1296
1362
|
private waitForSpawnToSettle;
|
|
1297
1363
|
/** Spawn a CLI window. Returns true if --resume was used successfully. */
|
|
1298
1364
|
/**
|
|
@@ -1374,6 +1440,28 @@ export declare class Daemon extends EventEmitter {
|
|
|
1374
1440
|
* Returns true if CLI is ready, false if it failed or got stuck.
|
|
1375
1441
|
*/
|
|
1376
1442
|
private trySpawn;
|
|
1443
|
+
/**
|
|
1444
|
+
* One fresh pane capture judged as ready && !busy && !dialog. Transcript
|
|
1445
|
+
* silence is deliberately NOT the gate: its monitor is inert for muse, so a
|
|
1446
|
+
* quiet-but-working pane would read as idle and the respawn below would kill
|
|
1447
|
+
* a live turn. Fail closed: an unreadable pane is never idle.
|
|
1448
|
+
*/
|
|
1449
|
+
private isPaneAuthoritativelyIdle;
|
|
1450
|
+
/**
|
|
1451
|
+
* Poll the authoritative pane check until it reports idle or the budget runs
|
|
1452
|
+
* out. Each poll is a fresh capture, so a turn that ends mid-wait is seen.
|
|
1453
|
+
*/
|
|
1454
|
+
private waitForAuthoritativePaneIdle;
|
|
1455
|
+
/**
|
|
1456
|
+
* A relay crash must not make the daemon kill a live Muse process. The
|
|
1457
|
+
* supervisor normally reclaims the same port; when that bounded recovery
|
|
1458
|
+
* fails, move Muse back to a direct connection once it is authoritatively
|
|
1459
|
+
* idle (session preserved via the existing resume path) and mark usage
|
|
1460
|
+
* unavailable. The fallback flag also covers every later natural spawn.
|
|
1461
|
+
* Never throws: the floor is the old behavior (flag set, relay stopped,
|
|
1462
|
+
* next restart direct).
|
|
1463
|
+
*/
|
|
1464
|
+
private switchMuseToDirect;
|
|
1377
1465
|
/**
|
|
1378
1466
|
* Tell the agent its instructions moved, once the CLI is idle.
|
|
1379
1467
|
*
|