@songsid/agend 2.1.4-beta.3 → 2.1.4-beta.30

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 (139) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/dist/agent-endpoint.js +1 -1
  4. package/dist/agent-endpoint.js.map +1 -1
  5. package/dist/backend/antigravity.d.ts +9 -5
  6. package/dist/backend/antigravity.js +155 -30
  7. package/dist/backend/antigravity.js.map +1 -1
  8. package/dist/backend/claude-code.d.ts +23 -21
  9. package/dist/backend/claude-code.js +47 -24
  10. package/dist/backend/claude-code.js.map +1 -1
  11. package/dist/backend/codex.d.ts +17 -0
  12. package/dist/backend/codex.js +122 -7
  13. package/dist/backend/codex.js.map +1 -1
  14. package/dist/backend/kiro.d.ts +1 -0
  15. package/dist/backend/kiro.js +14 -0
  16. package/dist/backend/kiro.js.map +1 -1
  17. package/dist/backend/opencode.d.ts +27 -11
  18. package/dist/backend/opencode.js +48 -37
  19. package/dist/backend/opencode.js.map +1 -1
  20. package/dist/backend/types.d.ts +14 -0
  21. package/dist/backend/types.js +7 -0
  22. package/dist/backend/types.js.map +1 -1
  23. package/dist/channel/adapters/discord.js +106 -19
  24. package/dist/channel/adapters/discord.js.map +1 -1
  25. package/dist/channel/adapters/telegram.js +5 -3
  26. package/dist/channel/adapters/telegram.js.map +1 -1
  27. package/dist/channel/agy-mcp-launcher.d.ts +2 -0
  28. package/dist/channel/agy-mcp-launcher.js +28 -0
  29. package/dist/channel/agy-mcp-launcher.js.map +1 -0
  30. package/dist/channel/mcp-server.js +6 -20
  31. package/dist/channel/mcp-server.js.map +1 -1
  32. package/dist/channel/mcp-tools.js +4 -2
  33. package/dist/channel/mcp-tools.js.map +1 -1
  34. package/dist/channel/types.d.ts +1 -1
  35. package/dist/classic-channel-manager.d.ts +40 -3
  36. package/dist/classic-channel-manager.js +218 -31
  37. package/dist/classic-channel-manager.js.map +1 -1
  38. package/dist/cli.js +148 -33
  39. package/dist/cli.js.map +1 -1
  40. package/dist/completion-install.d.ts +70 -0
  41. package/dist/completion-install.js +152 -0
  42. package/dist/completion-install.js.map +1 -0
  43. package/dist/completion.d.ts +7 -1
  44. package/dist/completion.js +14 -4
  45. package/dist/completion.js.map +1 -1
  46. package/dist/config-validator.js +38 -7
  47. package/dist/config-validator.js.map +1 -1
  48. package/dist/config.d.ts +2 -0
  49. package/dist/config.js +10 -1
  50. package/dist/config.js.map +1 -1
  51. package/dist/daemon.d.ts +173 -5
  52. package/dist/daemon.js +721 -83
  53. package/dist/daemon.js.map +1 -1
  54. package/dist/doctor.d.ts +26 -0
  55. package/dist/doctor.js +216 -0
  56. package/dist/doctor.js.map +1 -0
  57. package/dist/fleet-context.d.ts +47 -0
  58. package/dist/fleet-manager.d.ts +247 -10
  59. package/dist/fleet-manager.js +1978 -384
  60. package/dist/fleet-manager.js.map +1 -1
  61. package/dist/fleet-yaml-slim.d.ts +10 -0
  62. package/dist/fleet-yaml-slim.js +59 -0
  63. package/dist/fleet-yaml-slim.js.map +1 -0
  64. package/dist/general-knowledge/skills/backend-providers/SKILL.md +114 -0
  65. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +3 -1
  66. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +52 -0
  67. package/dist/general-knowledge/skills/development-workflow/SKILL.md +28 -0
  68. package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -0
  69. package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -0
  70. package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -0
  71. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -0
  72. package/dist/general-knowledge/skills/model-discovery/SKILL.md +64 -16
  73. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -0
  74. package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -0
  75. package/dist/general-knowledge/skills/session-management/SKILL.md +1 -0
  76. package/dist/general-knowledge/skills/tui-effort/SKILL.md +1 -0
  77. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +30 -0
  78. package/dist/instance-lifecycle.d.ts +28 -0
  79. package/dist/instance-lifecycle.js +79 -5
  80. package/dist/instance-lifecycle.js.map +1 -1
  81. package/dist/instructions.d.ts +12 -0
  82. package/dist/instructions.js +35 -1
  83. package/dist/instructions.js.map +1 -1
  84. package/dist/locale.js +746 -288
  85. package/dist/locale.js.map +1 -1
  86. package/dist/login-flows.d.ts +85 -0
  87. package/dist/login-flows.js +159 -0
  88. package/dist/login-flows.js.map +1 -0
  89. package/dist/login-manager.d.ts +63 -0
  90. package/dist/login-manager.js +134 -0
  91. package/dist/login-manager.js.map +1 -0
  92. package/dist/outbound-handlers.d.ts +8 -0
  93. package/dist/outbound-handlers.js +44 -5
  94. package/dist/outbound-handlers.js.map +1 -1
  95. package/dist/outbound-schemas.d.ts +5 -0
  96. package/dist/outbound-schemas.js +7 -0
  97. package/dist/outbound-schemas.js.map +1 -1
  98. package/dist/quickstart.js +25 -0
  99. package/dist/quickstart.js.map +1 -1
  100. package/dist/restart-progress.d.ts +2 -0
  101. package/dist/restart-progress.js +3 -0
  102. package/dist/restart-progress.js.map +1 -1
  103. package/dist/scheduler/db.d.ts +12 -0
  104. package/dist/scheduler/db.js +59 -0
  105. package/dist/scheduler/db.js.map +1 -1
  106. package/dist/service-installer.d.ts +11 -0
  107. package/dist/service-installer.js +84 -18
  108. package/dist/service-installer.js.map +1 -1
  109. package/dist/settings-api.js +1 -1
  110. package/dist/settings-api.js.map +1 -1
  111. package/dist/setup-wizard.js +2 -2
  112. package/dist/setup-wizard.js.map +1 -1
  113. package/dist/tips.d.ts +44 -0
  114. package/dist/tips.js +355 -0
  115. package/dist/tips.js.map +1 -0
  116. package/dist/tmux-manager.d.ts +6 -0
  117. package/dist/tmux-manager.js +12 -0
  118. package/dist/tmux-manager.js.map +1 -1
  119. package/dist/tool-progress.d.ts +40 -0
  120. package/dist/tool-progress.js +289 -0
  121. package/dist/tool-progress.js.map +1 -0
  122. package/dist/topic-commands.d.ts +36 -4
  123. package/dist/topic-commands.js +322 -64
  124. package/dist/topic-commands.js.map +1 -1
  125. package/dist/transcript-monitor.d.ts +15 -2
  126. package/dist/transcript-monitor.js +63 -17
  127. package/dist/transcript-monitor.js.map +1 -1
  128. package/dist/transcript-sources.d.ts +131 -0
  129. package/dist/transcript-sources.js +580 -0
  130. package/dist/transcript-sources.js.map +1 -0
  131. package/dist/types.d.ts +11 -0
  132. package/dist/ui/dashboard.html +55 -32
  133. package/dist/ui/settings.html +120 -51
  134. package/dist/ui/view.html +23 -15
  135. package/dist/usage/usage-api.d.ts +8 -2
  136. package/dist/usage/usage-api.js +24 -3
  137. package/dist/usage/usage-api.js.map +1 -1
  138. package/dist/workflow-templates/default.md +2 -1
  139. package/package.json +1 -1
package/dist/daemon.d.ts CHANGED
@@ -11,6 +11,10 @@ export declare function buildInstructionReloadNotice(binaryName: string, instanc
11
11
  export declare const DEFAULT_STUCK_TIMEOUT_MS: number;
12
12
  export declare const DEFAULT_STATE_IDLE_DEBOUNCE_MS = 2000;
13
13
  export declare const DEFAULT_STATE_SAFETY_SWEEP_MS = 60000;
14
+ /** Coalesce one cosmetic-redraw burst before comparing the visible pane. */
15
+ export declare const PERIODIC_REDRAW_PROBE_MS = 25;
16
+ /** A foreground server/port-forward should hand control back or be acknowledged. */
17
+ export declare const DEFAULT_BLOCKING_PROCESS_GRACE_MS: number;
14
18
  /**
15
19
  * Whether two working directories belong to the same project, so a fleet-scoped
16
20
  * decision recorded in one reaches the other. Covers the worktree/checkout
@@ -62,11 +66,13 @@ export declare function writeLastInboundAt(instanceDir: string, timestamp: numbe
62
66
  export declare function renderHandoffMetadata(meta: Record<string, string>): string;
63
67
  /** Headless inactivity timer used by the daemon and unit tests. */
64
68
  export declare class AutoPauseController {
65
- private readonly thresholdMs;
69
+ private thresholdMs;
66
70
  private lastActivityAt;
67
71
  private pausedAt;
68
72
  constructor(thresholdMs: number, lastActivityAt?: number);
69
73
  recordActivity(now?: number): void;
74
+ /** Apply a new idle threshold and start a fresh countdown from this update. */
75
+ reconfigure(thresholdMs: number, now?: number): void;
70
76
  observe(state: InstanceState, now?: number): boolean;
71
77
  markPaused(now?: number): void;
72
78
  markAwake(now?: number): void;
@@ -142,10 +148,13 @@ export declare class PaneStateMachine {
142
148
  * working" and a finished turn would not be seen as idle until the next 60s
143
149
  * safety sweep. Output timestamps are the honest liveness signal here, and
144
150
  * the caller has them.
151
+ * @param opts.forceBusy the backend has positively identified a still-running
152
+ * foreground tool even though its TUI keeps an old ready footer visible.
145
153
  */
146
154
  observe(pane: string, now?: number, opts?: {
147
155
  settled?: boolean;
148
156
  changeAt?: number;
157
+ forceBusy?: boolean;
149
158
  }): InstanceStateSnapshot;
150
159
  /** Record pane motion from tmux control mode without capturing pane content. */
151
160
  recordOutput(now?: number): InstanceStateSnapshot;
@@ -258,6 +267,30 @@ export declare class InteractivePromptDetector {
258
267
  observe(pane: string, now?: number, outputAt?: number): InteractivePromptDetection | null;
259
268
  reset(): void;
260
269
  }
270
+ export interface BlockingProcessDetection {
271
+ activity: string;
272
+ evidence: string;
273
+ blockedForMs: number;
274
+ }
275
+ /**
276
+ * Detect a foreground shell tool which has become a long-lived server.
277
+ *
278
+ * Unlike the generic pane-stuck clock, this clock deliberately survives new
279
+ * output: access logs and `Handling connection` lines are exactly why a
280
+ * foreground server can remain blocked forever without ever looking silent.
281
+ * Once a server marker is seen, the still-running tool identity is the stable
282
+ * signal; the marker may scroll out of the 32-row pane.
283
+ */
284
+ export declare class BlockingProcessDetector {
285
+ private readonly graceMs;
286
+ private activity;
287
+ private evidence;
288
+ private detectedAt;
289
+ private notified;
290
+ constructor(graceMs?: number);
291
+ observe(pane: string, activity: string | null, now?: number): BlockingProcessDetection | null;
292
+ reset(): void;
293
+ }
261
294
  export declare class Daemon extends EventEmitter {
262
295
  private name;
263
296
  private config;
@@ -317,6 +350,7 @@ export declare class Daemon extends EventEmitter {
317
350
  /** Fallback safety sweep used only when no shared tmux control client exists. */
318
351
  private instanceStateMonitorTimer;
319
352
  private instanceStateIdleTimer;
353
+ private instanceStateOutputProbeTimer;
320
354
  private instanceStateStuckTimer;
321
355
  private instanceStateOutputListener;
322
356
  private instanceStateOutputEventName;
@@ -327,6 +361,7 @@ export declare class Daemon extends EventEmitter {
327
361
  private instanceStateReadyPattern;
328
362
  private instanceStateBusyPattern;
329
363
  private instanceStateMonitorActive;
364
+ private sessionCheckpointWarningEmitted;
330
365
  private statePollInFlight;
331
366
  private turnHadInbound;
332
367
  private turnOutboundDelivered;
@@ -342,6 +377,22 @@ export declare class Daemon extends EventEmitter {
342
377
  * would silently no-op exactly when we most need to stop feeding the CLI.
343
378
  */
344
379
  private pausePending;
380
+ /**
381
+ * An auth failure was detected and nothing has resolved it yet.
382
+ *
383
+ * Separate from `pausePending` because it must outlive it: the deferred pause
384
+ * clears `pausePending` as soon as it fires, but if that pause is refused the
385
+ * instance is still auth-broken and must not resume raising alarms.
386
+ */
387
+ private authFailureUnresolved;
388
+ /** One login-screen auth report per spawn — the screen persists across polls. */
389
+ private loginScreenReported;
390
+ /**
391
+ * Let the next pause() proceed from a stuck pane. Set only for the auth-deferred
392
+ * pause — see the pausePending consumption site for why waiting for idle there
393
+ * is waiting forever.
394
+ */
395
+ private pauseAllowStuck;
345
396
  private pauseWakeState;
346
397
  private pauseWakeTransition;
347
398
  private modelOverride;
@@ -353,6 +404,12 @@ export declare class Daemon extends EventEmitter {
353
404
  * and ⏳/👀/✅ reactions live here). It does NOT cover the other writers that
354
405
  * reach the pane — {@link paneWriteLock} does. */
355
406
  private pasteLock;
407
+ /**
408
+ * Fleet cancellation epoch. Queue entries retain the epoch they arrived with;
409
+ * advancing it invalidates only work received before the cancel, never a new
410
+ * user message which arrives immediately afterwards.
411
+ */
412
+ private deliveryEpoch;
356
413
  /** Mutual exclusion for *every* write into the pane, whichever subsystem it
357
414
  * comes from. See PaneWriteLock for why interleaving is destructive. */
358
415
  private readonly paneWriteLock;
@@ -362,8 +419,20 @@ export declare class Daemon extends EventEmitter {
362
419
  private lastBuiltInstructions;
363
420
  private pasteQueueDepth;
364
421
  private firstDeliveryDelay;
422
+ /** Orders /steer pastes against each other. Deliberately NOT pasteLock:
423
+ * a steer must not queue behind the normal deliveries it exists to
424
+ * overtake. Pane-level exclusion still comes from paneWriteLock inside
425
+ * deliverMessage, so a steer and a normal delivery can never interleave
426
+ * their PTY writes — the steer just doesn't wait for idle. */
427
+ private steerLock;
428
+ /** Tool lines shown in the channel processing bubble for the current turn. */
429
+ private readonly turnProgress;
430
+ private lastProgressBroadcast;
431
+ private progressBroadcastTimer;
432
+ private lastProgressBroadcastAt;
365
433
  private errorMonitorTimer;
366
434
  private readonly interactivePromptDetector;
435
+ private readonly blockingProcessDetector;
367
436
  /** Same 5-min gate the error monitor uses, so a dead MCP server alerts once. */
368
437
  private static readonly MCP_DEATH_COOLDOWN_MS;
369
438
  private lastMcpDeathNotifiedAt;
@@ -489,12 +558,30 @@ export declare class Daemon extends EventEmitter {
489
558
  * that message, which is what the user asked for anyway.
490
559
  */
491
560
  sendEscape(): Promise<void>;
561
+ /**
562
+ * Drop every not-yet-started pane delivery which predates a user cancel.
563
+ * Promise chains cannot be removed, so entries become generation-checked
564
+ * no-ops. An entry already past its check is allowed to finish its current PTY
565
+ * transaction; the interrupt key still cancels the CLI generation.
566
+ */
567
+ clearPendingDeliveries(fleetEpoch?: number): void;
568
+ private captureDeliveryEpoch;
569
+ private isDeliveryEpochCurrent;
570
+ private queueRawPaste;
492
571
  /** Send the backend-specific graceful quit command/key sequence. */
493
572
  private sendQuitSequence;
494
573
  stop(): Promise<void>;
495
574
  getHangDetector(): HangDetector | null;
496
575
  getInstanceState(): InstanceState | "paused";
497
576
  getInstanceStateSnapshot(): InstanceStateSnapshot;
577
+ /**
578
+ * Answer a FleetManager state query. Most callers only need the cached state,
579
+ * but lifecycle decisions such as post-reply Cancel retirement need an
580
+ * authoritative pane observation: after startup the last transition can stay
581
+ * "working" even though the CLI has since settled without emitting another
582
+ * control-mode output record.
583
+ */
584
+ private respondToInstanceStateQuery;
498
585
  /** Gracefully stop the CLI while keeping its remain-on-exit tmux window. */
499
586
  /**
500
587
  * Mark the instance to pause as soon as its pane is idle. Used for auth
@@ -524,6 +611,13 @@ export declare class Daemon extends EventEmitter {
524
611
  /** Relay the pane's final text to the channel, marked as a daemon proxy reply. */
525
612
  private sendProxyReply;
526
613
  private clearInstanceStateIdleTimer;
614
+ private clearInstanceStateOutputProbeTimer;
615
+ /**
616
+ * Periodic status-line hooks can generate `%output` without changing a single
617
+ * visible cell. Probe the pane once per burst: a changed capture is real work;
618
+ * an identical ready capture remains idle and emits no state edge.
619
+ */
620
+ private scheduleInstanceStateOutputProbe;
527
621
  private clearInstanceStateStuckTimer;
528
622
  private scheduleInstanceStateStuckDeadline;
529
623
  private scheduleInstanceStateIdleCapture;
@@ -542,14 +636,48 @@ export declare class Daemon extends EventEmitter {
542
636
  * Tell the fleet manager what this instance is doing right now, for the live
543
637
  * progress line on the cancel button.
544
638
  *
545
- * Purely cosmetic — nothing decides anything from it, so it is fine that only
546
- * backends with a transcript feed report at all (claude-code today). For the
547
- * rest the progress line keeps showing just elapsed time.
639
+ * Primarily cosmetic. The foreground-process detector also uses a current
640
+ * shell activity as one of several positive signals, but never makes a state
641
+ * decision from an arbitrary activity label alone.
548
642
  *
549
643
  * Repeats are dropped: the ticker only edits the channel message when the text
550
644
  * changes, and a stream of identical broadcasts would defeat that.
551
645
  */
552
646
  private publishActivity;
647
+ /** Effective tool_progress level, hardened against junk config values.
648
+ * Off unless explicitly enabled: an update must never make bubbles start
649
+ * listing tool activity the operator did not ask to broadcast. */
650
+ private toolProgressLevel;
651
+ /**
652
+ * Apply a tool-progress setting without restarting the CLI session.
653
+ *
654
+ * Drop the current accumulator at the boundary: verbose entries may contain
655
+ * command previews which must not survive a downgrade to standard/off, and a
656
+ * newly enabled level should start with a clean, internally consistent list.
657
+ */
658
+ updateToolProgress(level: InstanceConfig["tool_progress"]): void;
659
+ /** Snapshot the configuration actually owned by this live daemon. */
660
+ getConfigSnapshot(): InstanceConfig;
661
+ /**
662
+ * Apply the whitelisted hot configuration carried by FleetManager IPC.
663
+ * null removes an optional value; invalid/unlisted fields are ignored rather
664
+ * than allowing another client on the per-instance socket to mutate cold
665
+ * process/session settings.
666
+ */
667
+ applyConfigUpdate(value: unknown): void;
668
+ /**
669
+ * Accumulate one semantic progress line for the channel bubble and schedule
670
+ * a coalesced broadcast. Separate from publishActivity on purpose: that one
671
+ * is the single-line statusline detail (terse, operator-facing), this is the
672
+ * multi-line channel list (semantic, argument-free at `standard`) — see
673
+ * tool-progress.ts for why the two labellers must not merge.
674
+ */
675
+ private recordToolProgress;
676
+ /** Coalesce progress broadcasts: at most one per 3s, trailing edge kept. */
677
+ private scheduleProgressBroadcast;
678
+ private broadcastToolProgress;
679
+ /** New turn (or turn over): drop the list and tell the fleet to clear it. */
680
+ private resetToolProgress;
553
681
  /**
554
682
  * Options for every system-initiated paste (startup notice, session snapshot,
555
683
  * runtime-dialog keys).
@@ -561,12 +689,43 @@ export declare class Daemon extends EventEmitter {
561
689
  */
562
690
  private systemPasteOptions;
563
691
  private summarizeTool;
692
+ /**
693
+ * The one place an inbound message grows its metadata wrapper ([user:]/
694
+ * [from:] prefix, pending reactions, handoff metadata, reply instructions).
695
+ * Both the normal queued path (pushChannelMessage) and /steer go through
696
+ * here — a steered message must read EXACTLY like a queued one to the
697
+ * agent, or the two drift apart in what the agent is told about replying.
698
+ */
699
+ private formatInboundMessage;
700
+ /**
701
+ * /steer: interject into the CURRENT turn instead of queueing for idle.
702
+ *
703
+ * Differences from pushChannelMessage, and nothing else:
704
+ * - serialized on steerLock, not pasteLock — it must overtake, not queue
705
+ * - deliverMessage runs with { steer: true }, which takes the busy branch
706
+ * that pastes immediately (the codex native-queue transaction) instead of
707
+ * waiting for idle. Verification and silent-loss fallback are the ones
708
+ * that path already has: pane-capture visibility check, then one
709
+ * idle-gated redelivery — so on a TUI that swallows busy input the steer
710
+ * degrades to "next message after this turn", never silently vanishes.
711
+ *
712
+ * The steered text goes through formatInboundMessage so the agent sees a
713
+ * normal inbound message, with a steering notice prepended for context.
714
+ */
715
+ steerMessage(content: string, meta: Record<string, string>, deliveryEpoch?: number): void;
716
+ /**
717
+ * /btw: submit a separately-labelled side question immediately while asking
718
+ * the agent not to change the active task. Claude's native `/btw` opens a
719
+ * branchAndResume panel whose answer never reaches the channel or transcript,
720
+ * so channel delivery intentionally uses a normal wrapped inbound instead.
721
+ */
722
+ btwMessage(content: string, meta: Record<string, string>, deliveryEpoch?: number): void;
564
723
  /**
565
724
  * Push an inbound channel message to a specific MCP session.
566
725
  * If targetSession is provided, only send to the matching socket.
567
726
  * Otherwise send to the instance's own session (this.name).
568
727
  */
569
- pushChannelMessage(content: string, meta: Record<string, string>, _targetSession?: string): void;
728
+ pushChannelMessage(content: string, meta: Record<string, string>, _targetSession?: string, deliveryEpoch?: number): void;
570
729
  /**
571
730
  * Deliver a single message and drive its status reactions:
572
731
  * ⏳ message_queued — CLI busy; queued locally or by the backend
@@ -584,6 +743,15 @@ export declare class Daemon extends EventEmitter {
584
743
  * serial in both cases so separate PTY writes can never overlap.
585
744
  */
586
745
  private deliverMessage;
746
+ /**
747
+ * A raw `%output` silence check is authoritative for ordinary TUIs. It is not
748
+ * for a backend such as agy whose status-line hook periodically redraws an
749
+ * identical screen. In that case trust an idle pane-state snapshot only when
750
+ * it was captured after both the latest output and the latest control-client
751
+ * observation reset.
752
+ */
753
+ private isPaneIdleForDelivery;
754
+ private waitForPaneIdleForDelivery;
587
755
  /**
588
756
  * The write half of a delivery: paste → Enter → confirm, with retries.
589
757
  *