@songsid/agend 2.1.4-beta.2 → 2.1.4-beta.21

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 (128) hide show
  1. package/dist/agent-endpoint.js +1 -1
  2. package/dist/agent-endpoint.js.map +1 -1
  3. package/dist/backend/antigravity.d.ts +1 -0
  4. package/dist/backend/antigravity.js +4 -0
  5. package/dist/backend/antigravity.js.map +1 -1
  6. package/dist/backend/claude-code.js +23 -2
  7. package/dist/backend/claude-code.js.map +1 -1
  8. package/dist/backend/codex.d.ts +17 -0
  9. package/dist/backend/codex.js +122 -7
  10. package/dist/backend/codex.js.map +1 -1
  11. package/dist/backend/kiro.d.ts +1 -0
  12. package/dist/backend/kiro.js +14 -0
  13. package/dist/backend/kiro.js.map +1 -1
  14. package/dist/backend/opencode.d.ts +27 -11
  15. package/dist/backend/opencode.js +48 -37
  16. package/dist/backend/opencode.js.map +1 -1
  17. package/dist/backend/types.d.ts +14 -0
  18. package/dist/backend/types.js +7 -0
  19. package/dist/backend/types.js.map +1 -1
  20. package/dist/channel/adapters/discord.js +76 -25
  21. package/dist/channel/adapters/discord.js.map +1 -1
  22. package/dist/channel/adapters/telegram.js +5 -3
  23. package/dist/channel/adapters/telegram.js.map +1 -1
  24. package/dist/channel/mcp-server.js +6 -20
  25. package/dist/channel/mcp-server.js.map +1 -1
  26. package/dist/channel/mcp-tools.js +4 -2
  27. package/dist/channel/mcp-tools.js.map +1 -1
  28. package/dist/channel/types.d.ts +1 -1
  29. package/dist/classic-channel-manager.d.ts +40 -3
  30. package/dist/classic-channel-manager.js +218 -31
  31. package/dist/classic-channel-manager.js.map +1 -1
  32. package/dist/cli.js +159 -36
  33. package/dist/cli.js.map +1 -1
  34. package/dist/completion-install.d.ts +70 -0
  35. package/dist/completion-install.js +152 -0
  36. package/dist/completion-install.js.map +1 -0
  37. package/dist/completion.d.ts +7 -1
  38. package/dist/completion.js +14 -4
  39. package/dist/completion.js.map +1 -1
  40. package/dist/config-validator.js +38 -7
  41. package/dist/config-validator.js.map +1 -1
  42. package/dist/config.d.ts +2 -0
  43. package/dist/config.js +10 -1
  44. package/dist/config.js.map +1 -1
  45. package/dist/daemon.d.ts +171 -5
  46. package/dist/daemon.js +696 -82
  47. package/dist/daemon.js.map +1 -1
  48. package/dist/doctor.d.ts +26 -0
  49. package/dist/doctor.js +216 -0
  50. package/dist/doctor.js.map +1 -0
  51. package/dist/fleet-context.d.ts +16 -0
  52. package/dist/fleet-manager.d.ts +233 -10
  53. package/dist/fleet-manager.js +1828 -493
  54. package/dist/fleet-manager.js.map +1 -1
  55. package/dist/fleet-yaml-slim.d.ts +10 -0
  56. package/dist/fleet-yaml-slim.js +59 -0
  57. package/dist/fleet-yaml-slim.js.map +1 -0
  58. package/dist/general-knowledge/skills/backend-providers/SKILL.md +114 -0
  59. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +3 -1
  60. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +52 -0
  61. package/dist/general-knowledge/skills/development-workflow/SKILL.md +28 -0
  62. package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -0
  63. package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -0
  64. package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -0
  65. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -0
  66. package/dist/general-knowledge/skills/model-discovery/SKILL.md +64 -16
  67. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -0
  68. package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -0
  69. package/dist/general-knowledge/skills/session-management/SKILL.md +1 -0
  70. package/dist/general-knowledge/skills/tui-effort/SKILL.md +1 -0
  71. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +30 -0
  72. package/dist/instance-lifecycle.d.ts +8 -0
  73. package/dist/instance-lifecycle.js +46 -25
  74. package/dist/instance-lifecycle.js.map +1 -1
  75. package/dist/instructions.d.ts +12 -0
  76. package/dist/instructions.js +33 -0
  77. package/dist/instructions.js.map +1 -1
  78. package/dist/locale.js +656 -220
  79. package/dist/locale.js.map +1 -1
  80. package/dist/outbound-handlers.d.ts +8 -0
  81. package/dist/outbound-handlers.js +44 -5
  82. package/dist/outbound-handlers.js.map +1 -1
  83. package/dist/outbound-schemas.d.ts +5 -0
  84. package/dist/outbound-schemas.js +7 -0
  85. package/dist/outbound-schemas.js.map +1 -1
  86. package/dist/quickstart.js +25 -0
  87. package/dist/quickstart.js.map +1 -1
  88. package/dist/restart-progress.d.ts +9 -1
  89. package/dist/restart-progress.js +30 -6
  90. package/dist/restart-progress.js.map +1 -1
  91. package/dist/scheduler/db.d.ts +5 -0
  92. package/dist/scheduler/db.js +35 -0
  93. package/dist/scheduler/db.js.map +1 -1
  94. package/dist/service-installer.d.ts +11 -0
  95. package/dist/service-installer.js +84 -18
  96. package/dist/service-installer.js.map +1 -1
  97. package/dist/settings-api.js +1 -1
  98. package/dist/settings-api.js.map +1 -1
  99. package/dist/tips.d.ts +39 -0
  100. package/dist/tips.js +351 -0
  101. package/dist/tips.js.map +1 -0
  102. package/dist/tool-progress.d.ts +40 -0
  103. package/dist/tool-progress.js +289 -0
  104. package/dist/tool-progress.js.map +1 -0
  105. package/dist/topic-commands.d.ts +28 -4
  106. package/dist/topic-commands.js +227 -65
  107. package/dist/topic-commands.js.map +1 -1
  108. package/dist/transcript-monitor.d.ts +15 -2
  109. package/dist/transcript-monitor.js +63 -17
  110. package/dist/transcript-monitor.js.map +1 -1
  111. package/dist/transcript-sources.d.ts +106 -0
  112. package/dist/transcript-sources.js +428 -0
  113. package/dist/transcript-sources.js.map +1 -0
  114. package/dist/types.d.ts +11 -0
  115. package/dist/ui/dashboard.html +55 -32
  116. package/dist/ui/settings.html +120 -51
  117. package/dist/ui/view.html +23 -15
  118. package/dist/update-marker.d.ts +30 -0
  119. package/dist/update-marker.js +71 -20
  120. package/dist/update-marker.js.map +1 -1
  121. package/dist/update-progress.d.ts +6 -0
  122. package/dist/update-progress.js +29 -0
  123. package/dist/update-progress.js.map +1 -0
  124. package/dist/usage/usage-api.d.ts +8 -2
  125. package/dist/usage/usage-api.js +24 -3
  126. package/dist/usage/usage-api.js.map +1 -1
  127. package/dist/workflow-templates/default.md +2 -1
  128. 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,20 @@ 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
+ /**
389
+ * Let the next pause() proceed from a stuck pane. Set only for the auth-deferred
390
+ * pause — see the pausePending consumption site for why waiting for idle there
391
+ * is waiting forever.
392
+ */
393
+ private pauseAllowStuck;
345
394
  private pauseWakeState;
346
395
  private pauseWakeTransition;
347
396
  private modelOverride;
@@ -353,6 +402,12 @@ export declare class Daemon extends EventEmitter {
353
402
  * and ⏳/👀/✅ reactions live here). It does NOT cover the other writers that
354
403
  * reach the pane — {@link paneWriteLock} does. */
355
404
  private pasteLock;
405
+ /**
406
+ * Fleet cancellation epoch. Queue entries retain the epoch they arrived with;
407
+ * advancing it invalidates only work received before the cancel, never a new
408
+ * user message which arrives immediately afterwards.
409
+ */
410
+ private deliveryEpoch;
356
411
  /** Mutual exclusion for *every* write into the pane, whichever subsystem it
357
412
  * comes from. See PaneWriteLock for why interleaving is destructive. */
358
413
  private readonly paneWriteLock;
@@ -362,8 +417,20 @@ export declare class Daemon extends EventEmitter {
362
417
  private lastBuiltInstructions;
363
418
  private pasteQueueDepth;
364
419
  private firstDeliveryDelay;
420
+ /** Orders /steer pastes against each other. Deliberately NOT pasteLock:
421
+ * a steer must not queue behind the normal deliveries it exists to
422
+ * overtake. Pane-level exclusion still comes from paneWriteLock inside
423
+ * deliverMessage, so a steer and a normal delivery can never interleave
424
+ * their PTY writes — the steer just doesn't wait for idle. */
425
+ private steerLock;
426
+ /** Tool lines shown in the channel processing bubble for the current turn. */
427
+ private readonly turnProgress;
428
+ private lastProgressBroadcast;
429
+ private progressBroadcastTimer;
430
+ private lastProgressBroadcastAt;
365
431
  private errorMonitorTimer;
366
432
  private readonly interactivePromptDetector;
433
+ private readonly blockingProcessDetector;
367
434
  /** Same 5-min gate the error monitor uses, so a dead MCP server alerts once. */
368
435
  private static readonly MCP_DEATH_COOLDOWN_MS;
369
436
  private lastMcpDeathNotifiedAt;
@@ -489,12 +556,30 @@ export declare class Daemon extends EventEmitter {
489
556
  * that message, which is what the user asked for anyway.
490
557
  */
491
558
  sendEscape(): Promise<void>;
559
+ /**
560
+ * Drop every not-yet-started pane delivery which predates a user cancel.
561
+ * Promise chains cannot be removed, so entries become generation-checked
562
+ * no-ops. An entry already past its check is allowed to finish its current PTY
563
+ * transaction; the interrupt key still cancels the CLI generation.
564
+ */
565
+ clearPendingDeliveries(fleetEpoch?: number): void;
566
+ private captureDeliveryEpoch;
567
+ private isDeliveryEpochCurrent;
568
+ private queueRawPaste;
492
569
  /** Send the backend-specific graceful quit command/key sequence. */
493
570
  private sendQuitSequence;
494
571
  stop(): Promise<void>;
495
572
  getHangDetector(): HangDetector | null;
496
573
  getInstanceState(): InstanceState | "paused";
497
574
  getInstanceStateSnapshot(): InstanceStateSnapshot;
575
+ /**
576
+ * Answer a FleetManager state query. Most callers only need the cached state,
577
+ * but lifecycle decisions such as post-reply Cancel retirement need an
578
+ * authoritative pane observation: after startup the last transition can stay
579
+ * "working" even though the CLI has since settled without emitting another
580
+ * control-mode output record.
581
+ */
582
+ private respondToInstanceStateQuery;
498
583
  /** Gracefully stop the CLI while keeping its remain-on-exit tmux window. */
499
584
  /**
500
585
  * Mark the instance to pause as soon as its pane is idle. Used for auth
@@ -524,6 +609,13 @@ export declare class Daemon extends EventEmitter {
524
609
  /** Relay the pane's final text to the channel, marked as a daemon proxy reply. */
525
610
  private sendProxyReply;
526
611
  private clearInstanceStateIdleTimer;
612
+ private clearInstanceStateOutputProbeTimer;
613
+ /**
614
+ * Periodic status-line hooks can generate `%output` without changing a single
615
+ * visible cell. Probe the pane once per burst: a changed capture is real work;
616
+ * an identical ready capture remains idle and emits no state edge.
617
+ */
618
+ private scheduleInstanceStateOutputProbe;
527
619
  private clearInstanceStateStuckTimer;
528
620
  private scheduleInstanceStateStuckDeadline;
529
621
  private scheduleInstanceStateIdleCapture;
@@ -542,14 +634,48 @@ export declare class Daemon extends EventEmitter {
542
634
  * Tell the fleet manager what this instance is doing right now, for the live
543
635
  * progress line on the cancel button.
544
636
  *
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.
637
+ * Primarily cosmetic. The foreground-process detector also uses a current
638
+ * shell activity as one of several positive signals, but never makes a state
639
+ * decision from an arbitrary activity label alone.
548
640
  *
549
641
  * Repeats are dropped: the ticker only edits the channel message when the text
550
642
  * changes, and a stream of identical broadcasts would defeat that.
551
643
  */
552
644
  private publishActivity;
645
+ /** Effective tool_progress level, hardened against junk config values.
646
+ * Off unless explicitly enabled: an update must never make bubbles start
647
+ * listing tool activity the operator did not ask to broadcast. */
648
+ private toolProgressLevel;
649
+ /**
650
+ * Apply a tool-progress setting without restarting the CLI session.
651
+ *
652
+ * Drop the current accumulator at the boundary: verbose entries may contain
653
+ * command previews which must not survive a downgrade to standard/off, and a
654
+ * newly enabled level should start with a clean, internally consistent list.
655
+ */
656
+ updateToolProgress(level: InstanceConfig["tool_progress"]): void;
657
+ /** Snapshot the configuration actually owned by this live daemon. */
658
+ getConfigSnapshot(): InstanceConfig;
659
+ /**
660
+ * Apply the whitelisted hot configuration carried by FleetManager IPC.
661
+ * null removes an optional value; invalid/unlisted fields are ignored rather
662
+ * than allowing another client on the per-instance socket to mutate cold
663
+ * process/session settings.
664
+ */
665
+ applyConfigUpdate(value: unknown): void;
666
+ /**
667
+ * Accumulate one semantic progress line for the channel bubble and schedule
668
+ * a coalesced broadcast. Separate from publishActivity on purpose: that one
669
+ * is the single-line statusline detail (terse, operator-facing), this is the
670
+ * multi-line channel list (semantic, argument-free at `standard`) — see
671
+ * tool-progress.ts for why the two labellers must not merge.
672
+ */
673
+ private recordToolProgress;
674
+ /** Coalesce progress broadcasts: at most one per 3s, trailing edge kept. */
675
+ private scheduleProgressBroadcast;
676
+ private broadcastToolProgress;
677
+ /** New turn (or turn over): drop the list and tell the fleet to clear it. */
678
+ private resetToolProgress;
553
679
  /**
554
680
  * Options for every system-initiated paste (startup notice, session snapshot,
555
681
  * runtime-dialog keys).
@@ -561,12 +687,43 @@ export declare class Daemon extends EventEmitter {
561
687
  */
562
688
  private systemPasteOptions;
563
689
  private summarizeTool;
690
+ /**
691
+ * The one place an inbound message grows its metadata wrapper ([user:]/
692
+ * [from:] prefix, pending reactions, handoff metadata, reply instructions).
693
+ * Both the normal queued path (pushChannelMessage) and /steer go through
694
+ * here — a steered message must read EXACTLY like a queued one to the
695
+ * agent, or the two drift apart in what the agent is told about replying.
696
+ */
697
+ private formatInboundMessage;
698
+ /**
699
+ * /steer: interject into the CURRENT turn instead of queueing for idle.
700
+ *
701
+ * Differences from pushChannelMessage, and nothing else:
702
+ * - serialized on steerLock, not pasteLock — it must overtake, not queue
703
+ * - deliverMessage runs with { steer: true }, which takes the busy branch
704
+ * that pastes immediately (the codex native-queue transaction) instead of
705
+ * waiting for idle. Verification and silent-loss fallback are the ones
706
+ * that path already has: pane-capture visibility check, then one
707
+ * idle-gated redelivery — so on a TUI that swallows busy input the steer
708
+ * degrades to "next message after this turn", never silently vanishes.
709
+ *
710
+ * The steered text goes through formatInboundMessage so the agent sees a
711
+ * normal inbound message, with a steering notice prepended for context.
712
+ */
713
+ steerMessage(content: string, meta: Record<string, string>, deliveryEpoch?: number): void;
714
+ /**
715
+ * /btw: submit a separately-labelled side question immediately while asking
716
+ * the agent not to change the active task. Claude's native `/btw` opens a
717
+ * branchAndResume panel whose answer never reaches the channel or transcript,
718
+ * so channel delivery intentionally uses a normal wrapped inbound instead.
719
+ */
720
+ btwMessage(content: string, meta: Record<string, string>, deliveryEpoch?: number): void;
564
721
  /**
565
722
  * Push an inbound channel message to a specific MCP session.
566
723
  * If targetSession is provided, only send to the matching socket.
567
724
  * Otherwise send to the instance's own session (this.name).
568
725
  */
569
- pushChannelMessage(content: string, meta: Record<string, string>, _targetSession?: string): void;
726
+ pushChannelMessage(content: string, meta: Record<string, string>, _targetSession?: string, deliveryEpoch?: number): void;
570
727
  /**
571
728
  * Deliver a single message and drive its status reactions:
572
729
  * ⏳ message_queued — CLI busy; queued locally or by the backend
@@ -584,6 +741,15 @@ export declare class Daemon extends EventEmitter {
584
741
  * serial in both cases so separate PTY writes can never overlap.
585
742
  */
586
743
  private deliverMessage;
744
+ /**
745
+ * A raw `%output` silence check is authoritative for ordinary TUIs. It is not
746
+ * for a backend such as agy whose status-line hook periodically redraws an
747
+ * identical screen. In that case trust an idle pane-state snapshot only when
748
+ * it was captured after both the latest output and the latest control-client
749
+ * observation reset.
750
+ */
751
+ private isPaneIdleForDelivery;
752
+ private waitForPaneIdleForDelivery;
587
753
  /**
588
754
  * The write half of a delivery: paste → Enter → confirm, with retries.
589
755
  *