@songsid/agend 2.1.4-beta.1 → 2.1.4-beta.11

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 (107) hide show
  1. package/dist/backend/antigravity.d.ts +1 -0
  2. package/dist/backend/antigravity.js +1 -0
  3. package/dist/backend/antigravity.js.map +1 -1
  4. package/dist/backend/claude-code.d.ts +1 -0
  5. package/dist/backend/claude-code.js +24 -2
  6. package/dist/backend/claude-code.js.map +1 -1
  7. package/dist/backend/codex.d.ts +1 -0
  8. package/dist/backend/codex.js +43 -4
  9. package/dist/backend/codex.js.map +1 -1
  10. package/dist/backend/gemini-cli.d.ts +1 -0
  11. package/dist/backend/gemini-cli.js +1 -0
  12. package/dist/backend/gemini-cli.js.map +1 -1
  13. package/dist/backend/grok.d.ts +1 -0
  14. package/dist/backend/grok.js +1 -0
  15. package/dist/backend/grok.js.map +1 -1
  16. package/dist/backend/kiro.d.ts +1 -0
  17. package/dist/backend/kiro.js +1 -0
  18. package/dist/backend/kiro.js.map +1 -1
  19. package/dist/backend/mock.d.ts +1 -0
  20. package/dist/backend/mock.js +1 -0
  21. package/dist/backend/mock.js.map +1 -1
  22. package/dist/backend/opencode.d.ts +40 -0
  23. package/dist/backend/opencode.js +81 -1
  24. package/dist/backend/opencode.js.map +1 -1
  25. package/dist/backend/types.d.ts +10 -0
  26. package/dist/backend/types.js +7 -0
  27. package/dist/backend/types.js.map +1 -1
  28. package/dist/channel/adapters/discord.js +24 -7
  29. package/dist/channel/adapters/discord.js.map +1 -1
  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 +1 -1
  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 +34 -3
  36. package/dist/classic-channel-manager.js +190 -31
  37. package/dist/classic-channel-manager.js.map +1 -1
  38. package/dist/cli.js +65 -13
  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 +35 -7
  47. package/dist/config-validator.js.map +1 -1
  48. package/dist/config.js +1 -0
  49. package/dist/config.js.map +1 -1
  50. package/dist/daemon.d.ts +53 -0
  51. package/dist/daemon.js +229 -40
  52. package/dist/daemon.js.map +1 -1
  53. package/dist/fleet-context.d.ts +8 -0
  54. package/dist/fleet-manager.d.ts +143 -3
  55. package/dist/fleet-manager.js +1109 -290
  56. package/dist/fleet-manager.js.map +1 -1
  57. package/dist/general-knowledge/skills/backend-providers/SKILL.md +114 -0
  58. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +3 -1
  59. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +52 -0
  60. package/dist/general-knowledge/skills/development-workflow/SKILL.md +28 -0
  61. package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -0
  62. package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -0
  63. package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -0
  64. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -0
  65. package/dist/general-knowledge/skills/model-discovery/SKILL.md +1 -0
  66. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -0
  67. package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -0
  68. package/dist/general-knowledge/skills/session-management/SKILL.md +1 -0
  69. package/dist/general-knowledge/skills/tui-effort/SKILL.md +1 -0
  70. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +30 -0
  71. package/dist/instance-lifecycle.d.ts +10 -0
  72. package/dist/instance-lifecycle.js +50 -33
  73. package/dist/instance-lifecycle.js.map +1 -1
  74. package/dist/instructions.d.ts +12 -0
  75. package/dist/instructions.js +33 -0
  76. package/dist/instructions.js.map +1 -1
  77. package/dist/locale.js +130 -0
  78. package/dist/locale.js.map +1 -1
  79. package/dist/outbound-schemas.d.ts +2 -1
  80. package/dist/outbound-schemas.js +1 -0
  81. package/dist/outbound-schemas.js.map +1 -1
  82. package/dist/quickstart.js +25 -0
  83. package/dist/quickstart.js.map +1 -1
  84. package/dist/restart-progress.d.ts +7 -1
  85. package/dist/restart-progress.js +27 -6
  86. package/dist/restart-progress.js.map +1 -1
  87. package/dist/tool-progress.d.ts +40 -0
  88. package/dist/tool-progress.js +289 -0
  89. package/dist/tool-progress.js.map +1 -0
  90. package/dist/topic-commands.d.ts +26 -0
  91. package/dist/topic-commands.js +117 -1
  92. package/dist/topic-commands.js.map +1 -1
  93. package/dist/transcript-monitor.d.ts +15 -2
  94. package/dist/transcript-monitor.js +63 -17
  95. package/dist/transcript-monitor.js.map +1 -1
  96. package/dist/transcript-sources.d.ts +106 -0
  97. package/dist/transcript-sources.js +428 -0
  98. package/dist/transcript-sources.js.map +1 -0
  99. package/dist/types.d.ts +8 -0
  100. package/dist/update-marker.d.ts +30 -0
  101. package/dist/update-marker.js +71 -20
  102. package/dist/update-marker.js.map +1 -1
  103. package/dist/update-progress.d.ts +6 -0
  104. package/dist/update-progress.js +29 -0
  105. package/dist/update-progress.js.map +1 -0
  106. package/dist/workflow-templates/default.md +2 -1
  107. package/package.json +2 -2
@@ -80,6 +80,9 @@ export interface FleetContext {
80
80
  ready: boolean;
81
81
  token: string | null;
82
82
  };
83
+ /** Persist and edit one `/update` message across the fleet process restart. */
84
+ beginUpdateProgress?(adapter: import("./channel/types.js").ChannelAdapter, chatId: string, threadId: string | undefined, messageId: string): void;
85
+ failUpdateProgress?(message: string): void;
83
86
  /** Human-readable effective model for an instance (resolves inherited defaults). */
84
87
  modelDisplayForInstance?(name: string): string;
85
88
  /**
@@ -97,4 +100,9 @@ export interface FleetContext {
97
100
  applyEffort?(instanceName: string, level: string): Promise<string>;
98
101
  /** TG inline-keyboard effort menu; same contract as promptModelMenu. */
99
102
  promptEffortMenu?(instanceName: string, userId: string, channelId: string, adapter: import("./channel/types.js").ChannelAdapter, chatId: string, threadId?: string): Promise<string | null>;
103
+ /**
104
+ * Post a nonce-armed confirmation before the destructive `/clear` command.
105
+ * Returns null when the buttons were posted, otherwise a user-facing error.
106
+ */
107
+ promptClearConfirmation?(instanceName: string, channelId: string, adapter: import("./channel/types.js").ChannelAdapter, chatId: string, threadId?: string): Promise<string | null>;
100
108
  }
@@ -106,6 +106,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
106
106
  readonly replyDeduper: ReplyDeduper;
107
107
  /** instanceName → what it is doing right now, when the backend can tell us. */
108
108
  private instanceActivity;
109
+ /** instanceName → this turn's tool list (multi-line), for the bubble. */
110
+ private instanceProgress;
109
111
  /** instanceName → tail of deliveries waiting for its IPC to come back. */
110
112
  private ipcWaitTails;
111
113
  /** instanceName → restart currently executing; concurrent callers join it. */
@@ -119,6 +121,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
119
121
  /** In-flight /effort selections, same coordinator shape as pendingModelSelects. */
120
122
  private pendingEffortSelects;
121
123
  private pendingModelSelects;
124
+ /** nonce → pending button prompt (hang restart, interactive assist, clean-exit restart). */
125
+ private pendingNonceButtons;
122
126
  private failoverActive;
123
127
  /** instance → when a click with no live button entry last fired a cancel. */
124
128
  private staleCancelClickAt;
@@ -135,6 +139,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
135
139
  private healthServer;
136
140
  private healthPortRetried;
137
141
  private updateCheckTimer;
142
+ private updateProgressTimer;
143
+ private updateProgressEditRunning;
144
+ private lastUpdateProgressText;
138
145
  private eventLogPruneTimer;
139
146
  private logRotateTimer;
140
147
  /** Days of event/activity history to keep. */
@@ -216,6 +223,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
216
223
  */
217
224
  private isModelAdmin;
218
225
  private handlePauseWakeSlash;
226
+ private handleUpdateSlash;
227
+ /** Admin-only full conversation reset for fleet-topic and Classic instances. */
228
+ private handleClearSlash;
219
229
  /** Get the adapter bound to an instance, falling back to primary adapter */
220
230
  getAdapterForInstance(name: string): ChannelAdapter | null;
221
231
  /** Get the world for an instance */
@@ -327,6 +337,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
327
337
  ready: boolean;
328
338
  token: string | null;
329
339
  };
340
+ beginUpdateProgress(adapter: ChannelAdapter, chatId: string, threadId: string | undefined, messageId: string): void;
341
+ failUpdateProgress(message: string): void;
342
+ /** The old fleet edits CLI install stages; the new fleet adopts the same message below. */
343
+ private startUpdateProgressMonitor;
330
344
  /** Start all instances from fleet config */
331
345
  startAll(configPath: string): Promise<void>;
332
346
  /**
@@ -528,6 +542,58 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
528
542
  private static readonly FLEET_ERROR_THROTTLE_MS;
529
543
  private fleetErrorNotices;
530
544
  notifyInstanceTopic(instanceName: string, text: string, extraOpts?: import("./channel/types.js").SendOpts): void;
545
+ /**
546
+ * Post decision buttons whose callback ids are `<prefix><nonce>:<action>`.
547
+ * The entry is registered before the send and rolled back if the send
548
+ * fails, so a nonce in the map always refers to a message that exists (or
549
+ * is about to). Returns the nonce, or null when the alert could not be sent.
550
+ */
551
+ private postNonceButtonPrompt;
552
+ /**
553
+ * Claim a nonce-armed callback exactly once.
554
+ *
555
+ * Returns:
556
+ * - null — the callback is not for this prefix; try the next handler
557
+ * - "consumed" — for this prefix but stale/denied/malformed; stop dispatch
558
+ * - the entry+action — the click is authorized and now claimed (removed
559
+ * from the map before any await, so double clicks cannot act twice)
560
+ *
561
+ * A stale click (expired nonce, or a pre-upgrade button whose payload no
562
+ * longer parses) collapses the clicked message so the dead button stops
563
+ * inviting clicks — the same courtesy the cancel button extends.
564
+ */
565
+ private consumeNonceCallback;
566
+ /** Collapse a consumed prompt's buttons into a final status line. */
567
+ private retireNonceButtons;
568
+ /** Post the destructive `/clear` confirmation in the invoking channel. */
569
+ promptClearConfirmation(instanceName: string, channelId: string, adapter: ChannelAdapter, chatId: string, threadId?: string): Promise<string | null>;
570
+ /** Consume `/clear` Confirm/Cancel exactly once; only Confirm reaches IPC. */
571
+ private handleClearConfirmation;
572
+ /**
573
+ * Drop every pending prompt that refers to an instance being stopped or
574
+ * restarted — a restart offer for an instance the operator just restarted
575
+ * (or an assist for one they stopped) must not stay clickable for the rest
576
+ * of its 15 minutes.
577
+ */
578
+ clearNoncePromptsForInstance(instanceName: string): void;
579
+ /** A clean exit is intentional from the CLI's perspective, but often not from
580
+ * the operator's. Keep the instance notice passive and put the action in the
581
+ * same-world General topic where an administrator can make the choice. */
582
+ notifyNormalExit(instanceName: string): Promise<void>;
583
+ /** Consume a clean-exit Restart/Ignore button exactly once. */
584
+ private handleExitRestartPrompt;
585
+ private interactivePromptLabel;
586
+ /**
587
+ * Surface a stable terminal prompt in both places that matter:
588
+ * - the blocked instance gets a plain pointer to General;
589
+ * - General gets one-shot Confirm/Cancel controls on its own bound adapter.
590
+ *
591
+ * Only the prompt category crosses channels. The captured terminal line can
592
+ * contain usernames or secret-adjacent text and stays in daemon.log.
593
+ */
594
+ notifyInteractivePrompt(instanceName: string, kind: string): Promise<void>;
595
+ /** Consume a General assist button exactly once. */
596
+ private handleInteractivePromptAssist;
531
597
  /** Send a "🛑 Cancel" button to the instance's topic/channel after delivery. */
532
598
  /**
533
599
  * Handle the DC `/save` slash command for both classic AND fleet-topic targets.
@@ -553,7 +619,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
553
619
  */
554
620
  private handleCancelClick;
555
621
  private hasCancelButton;
556
- sendCancelButton(instanceName: string, correlationId?: string): Promise<void>;
622
+ sendCancelButton(instanceName: string, correlationId?: string, preserveProgress?: boolean): Promise<void>;
557
623
  /**
558
624
  * The cancel button's text for a given elapsed time.
559
625
  *
@@ -563,6 +629,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
563
629
  * and once the agent had replied once there was no sign it was still going.
564
630
  */
565
631
  static progressText(elapsedMs: number, activity?: string | null, minElapsedMs?: number): string;
632
+ /** Render elapsed time consistently in live and retained progress bubbles. */
633
+ private static formatProgressElapsed;
634
+ /** Final read-only form of a bubble that contains semantic tool history.
635
+ * Neutral wording is intentional: the same retirement primitive is used for
636
+ * normal completion, a mid-turn bubble replacement, and user cancellation,
637
+ * so claiming every retained checkpoint is "completed" would be false. */
638
+ private composeRetiredBubbleText;
566
639
  /**
567
640
  * Make a tool summary safe to paste into a channel message.
568
641
  *
@@ -580,6 +653,26 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
580
653
  * never used to decide anything — purely what the user is shown.
581
654
  */
582
655
  private cacheInstanceActivity;
656
+ /**
657
+ * Cache the turn's tool-progress list and push it into the instance's live
658
+ * bubble, coalesced so a burst of tool events cannot flood the Bot API
659
+ * (Telegram's flood limit is per-chat across ALL forum topics, so edits are
660
+ * rate-limited per bubble AND ride behind the daemon-side 3s coalescer).
661
+ */
662
+ private cacheInstanceProgress;
663
+ /** At most one progress-driven edit per bubble per TOOL_PROGRESS_EDIT_MIN_MS. */
664
+ private scheduleProgressEdit;
665
+ /**
666
+ * The ONE composer for the bubble text. Both writers — the elapsed-time
667
+ * ticker and the tool-progress push — go through here; two independent
668
+ * renderers editing the same message is how the progress list used to get
669
+ * wiped by the next elapsed tick (#528 trap 2).
670
+ */
671
+ private composeBubbleText;
672
+ /** Pure composition of header + tool list, exposed for tests. */
673
+ static bubbleText(elapsedMs: number, activity: string | undefined, minElapsedMs: number, progress: string | undefined): string;
674
+ /** Recompose and edit the bubble in place; skips when nothing changed. */
675
+ private refreshBubble;
583
676
  /**
584
677
  * Refresh the button's text in place while the instance keeps working.
585
678
  *
@@ -620,7 +713,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
620
713
  private sweepOrphanedCancelButtons;
621
714
  /** Re-attempt a failed button delete up to CANCEL_BTN_MAX_RETRIES times. */
622
715
  private scheduleButtonRetry;
623
- /** Delete one button's message via its own adapter. Resolves on success,
716
+ /** Retire one cancel bubble via its own adapter. A bubble that accumulated
717
+ * tool progress is kept as a read-only history message; a plain bubble keeps
718
+ * the legacy delete/edit-to-checkmark behavior. Resolves on success and
624
719
  * rejects on failure so the caller can retry. */
625
720
  private deleteButtonMessage;
626
721
  /** Retire all cancel buttons for an instance — on reply or cancel. */
@@ -652,12 +747,57 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
652
747
  title: string;
653
748
  }>;
654
749
  sendHangNotification(instanceName: string, unchangedForMs?: number): Promise<void>;
750
+ /**
751
+ * Consume a hang Force-restart / Keep-waiting button exactly once. Restart
752
+ * goes through restartSingleInstance — serialized against concurrent restart
753
+ * sources, and with a Classic-instance fallback (the previous hand-rolled
754
+ * stop+start silently left Classic instances stopped while reporting
755
+ * "restarted").
756
+ */
757
+ private handleHangPrompt;
655
758
  private static INSTRUCTIONS_FILENAME;
656
759
  private static GENERAL_INSTRUCTIONS;
657
760
  /** Ensure the general instance has its project instructions file + knowledge */
658
761
  private ensureGeneralInstructions;
659
- /** Copy general-knowledge steering + skills to the general instance's workspace */
762
+ /** Resolve the workspace path a backend actually uses before publishing knowledge. */
763
+ private resolveKnowledgeWorkDir;
764
+ /**
765
+ * Where each backend natively loads on-demand skills from, relative to the
766
+ * workspace. Backends without a native skill mechanism (opencode, grok,
767
+ * antigravity, gemini-cli) are deliberately absent: dropping files a CLI
768
+ * never reads is clutter, not capability. Unknown directories are ignored
769
+ * by older CLI versions, so publishing is fail-open across upgrades.
770
+ */
771
+ private static SKILLS_DIR_SEGMENTS;
772
+ /** Copy general-knowledge steering + all role-eligible skills to General. */
660
773
  private syncGeneralKnowledge;
774
+ /** Publish only the bundled skills eligible for an instance role. */
775
+ private syncRoleSkills;
776
+ /**
777
+ * Steering (always-on rules like core-rules.md). Kiro loads a native
778
+ * steering directory; every other backend gets the content embedded into
779
+ * its instructions file (CLAUDE.md / AGENTS.md / …) inside a managed marker
780
+ * block — the previous behavior dropped bare .md files in the workspace
781
+ * root, which no CLI ever read. The block is replaced in place on every
782
+ * sync, so rule updates reach EXISTING workspaces; everything the user
783
+ * wrote outside the markers is preserved byte-for-byte.
784
+ */
785
+ private syncGeneralSteering;
786
+ private static STEERING_BLOCK_BEGIN;
787
+ private static STEERING_BLOCK_END;
788
+ /**
789
+ * Publish AgEnD's bundled skills into a CLI's native skills directory,
790
+ * owning ONLY what we published. A manifest records which skill names AgEnD
791
+ * wrote; a bundled rename/removal deletes the stale managed copy, while a
792
+ * skill the user created by hand is never listed and therefore never
793
+ * touched — even if a future bundle happens to reuse its name (the sync
794
+ * then skips it and logs, rather than overwrite the user's work). The sole
795
+ * migration exception is the pre-manifest Kiro General layout explicitly
796
+ * selected by adoptLegacyUnmanaged.
797
+ */
798
+ private syncManagedSkills;
799
+ /** Read AgEnD's roles extension from SKILL.md YAML frontmatter. */
800
+ private readManagedSkillRoles;
661
801
  /** Fetch forum topic icon stickers and pick emoji IDs for each state */
662
802
  private resolveTopicIcons;
663
803
  /** Set topic icon based on instance state */