@songsid/agend 2.2.0-beta.4 → 2.2.0-beta.6

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 (116) hide show
  1. package/dist/backend/claude-carry.d.ts +22 -0
  2. package/dist/backend/claude-carry.js +170 -0
  3. package/dist/backend/claude-carry.js.map +1 -0
  4. package/dist/backend/claude-code.d.ts +23 -0
  5. package/dist/backend/claude-code.js +102 -2
  6. package/dist/backend/claude-code.js.map +1 -1
  7. package/dist/backend/credential-profile.d.ts +7 -0
  8. package/dist/backend/credential-profile.js +7 -1
  9. package/dist/backend/credential-profile.js.map +1 -1
  10. package/dist/backend/kiro.js +5 -2
  11. package/dist/backend/kiro.js.map +1 -1
  12. package/dist/backend/muse.d.ts +41 -0
  13. package/dist/backend/muse.js +239 -44
  14. package/dist/backend/muse.js.map +1 -1
  15. package/dist/backend/types.d.ts +7 -0
  16. package/dist/backend/types.js.map +1 -1
  17. package/dist/background-work-ended.d.ts +18 -0
  18. package/dist/background-work-ended.js +30 -0
  19. package/dist/background-work-ended.js.map +1 -0
  20. package/dist/channel/adapters/telegram.d.ts +4 -5
  21. package/dist/channel/adapters/telegram.js +33 -17
  22. package/dist/channel/adapters/telegram.js.map +1 -1
  23. package/dist/channel/message-edit-errors.d.ts +5 -0
  24. package/dist/channel/message-edit-errors.js +24 -0
  25. package/dist/channel/message-edit-errors.js.map +1 -0
  26. package/dist/cli.js +60 -10
  27. package/dist/cli.js.map +1 -1
  28. package/dist/config-validator.js +3 -0
  29. package/dist/config-validator.js.map +1 -1
  30. package/dist/daemon.js +41 -0
  31. package/dist/daemon.js.map +1 -1
  32. package/dist/fleet-context.d.ts +4 -1
  33. package/dist/fleet-manager.d.ts +112 -5
  34. package/dist/fleet-manager.js +516 -52
  35. package/dist/fleet-manager.js.map +1 -1
  36. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +44 -9
  37. package/dist/locale.js +18 -2
  38. package/dist/locale.js.map +1 -1
  39. package/dist/needs-you-hub.js +2 -0
  40. package/dist/needs-you-hub.js.map +1 -1
  41. package/dist/needs-you-live.d.ts +6 -0
  42. package/dist/needs-you-live.js +23 -3
  43. package/dist/needs-you-live.js.map +1 -1
  44. package/dist/outbound-handlers.d.ts +7 -0
  45. package/dist/outbound-handlers.js +19 -10
  46. package/dist/outbound-handlers.js.map +1 -1
  47. package/dist/public-preview.d.ts +100 -0
  48. package/dist/public-preview.js +233 -0
  49. package/dist/public-preview.js.map +1 -0
  50. package/dist/public-web-gateway.js +4 -3
  51. package/dist/public-web-gateway.js.map +1 -1
  52. package/dist/public-web-link.d.ts +20 -0
  53. package/dist/public-web-link.js +26 -1
  54. package/dist/public-web-link.js.map +1 -1
  55. package/dist/restart-progress.d.ts +33 -0
  56. package/dist/restart-progress.js +30 -0
  57. package/dist/restart-progress.js.map +1 -1
  58. package/dist/service-installer.d.ts +31 -0
  59. package/dist/service-installer.js +41 -2
  60. package/dist/service-installer.js.map +1 -1
  61. package/dist/topic-commands.js +3 -1
  62. package/dist/topic-commands.js.map +1 -1
  63. package/dist/tunnel/purpose-lane.d.ts +5 -1
  64. package/dist/tunnel/purpose-lane.js +14 -7
  65. package/dist/tunnel/purpose-lane.js.map +1 -1
  66. package/dist/types.d.ts +6 -0
  67. package/dist/ui/chat-strings.js +14 -2
  68. package/dist/ui/chat-thread.js +2 -2
  69. package/dist/ui/panel-chat.js +9 -2
  70. package/dist/ui/panel-fleet.js +148 -35
  71. package/dist/ui/panel-needs.js +4 -3
  72. package/dist/ui/panel-settings.js +1 -1
  73. package/dist/ui/preview-status.js +28 -0
  74. package/dist/ui/preview.js +35 -2
  75. package/dist/ui/shared/app-i18n.js +4 -0
  76. package/dist/ui/shared/app-prefs.js +1 -0
  77. package/dist/ui/shared/app-shell.js +146 -2
  78. package/dist/ui/shared/app-stream.js +21 -4
  79. package/dist/ui/shared/app.css +41 -15
  80. package/dist/ui/shared/instance-nav.js +47 -16
  81. package/dist/ui/shared/usage-dialog.js +10 -1
  82. package/dist/ui/shared/view-strings.js +4 -0
  83. package/dist/update-install.d.ts +13 -1
  84. package/dist/update-install.js +16 -4
  85. package/dist/update-install.js.map +1 -1
  86. package/dist/update-marker.d.ts +51 -0
  87. package/dist/update-marker.js +61 -0
  88. package/dist/update-marker.js.map +1 -1
  89. package/dist/usage/i18n-keys.d.ts +1 -1
  90. package/dist/usage/i18n-keys.js +1 -1
  91. package/dist/usage/i18n-keys.js.map +1 -1
  92. package/dist/usage/providers.d.ts +34 -5
  93. package/dist/usage/providers.js +160 -27
  94. package/dist/usage/providers.js.map +1 -1
  95. package/dist/usage/statusline-usage.d.ts +6 -2
  96. package/dist/usage/statusline-usage.js +10 -4
  97. package/dist/usage/statusline-usage.js.map +1 -1
  98. package/dist/web-api.d.ts +20 -1
  99. package/dist/web-api.js +101 -13
  100. package/dist/web-api.js.map +1 -1
  101. package/dist/web-auth.js +2 -1
  102. package/dist/web-auth.js.map +1 -1
  103. package/dist/web-prefs.js +2 -0
  104. package/dist/web-prefs.js.map +1 -1
  105. package/dist/web-preview.d.ts +14 -1
  106. package/dist/web-preview.js +35 -13
  107. package/dist/web-preview.js.map +1 -1
  108. package/dist/web-schedules.d.ts +12 -0
  109. package/dist/web-schedules.js +34 -0
  110. package/dist/web-schedules.js.map +1 -0
  111. package/dist/web-server-drain.d.ts +10 -0
  112. package/dist/web-server-drain.js +50 -0
  113. package/dist/web-server-drain.js.map +1 -0
  114. package/package.json +1 -1
  115. package/templates/launchd.plist.ejs +3 -1
  116. package/templates/systemd.service.ejs +2 -1
@@ -105,7 +105,10 @@ export interface FleetContext {
105
105
  getInstanceAdapterId?(instanceName: string): string | undefined;
106
106
  changeInstancePauseState(name: string, action: "pause" | "wake"): Promise<"paused" | "awake" | "not_idle">;
107
107
  startInstance(name: string, config: InstanceConfig, topicMode: boolean): Promise<void>;
108
- stopInstance(name: string): Promise<void>;
108
+ /** #1716: resolves whether the stop ended background work that was running. */
109
+ stopInstance(name: string): Promise<{
110
+ backgroundWorkEnded: boolean;
111
+ }>;
109
112
  connectIpcToInstance(name: string): Promise<void>;
110
113
  saveFleetConfig(): void;
111
114
  getInstanceDir(name: string): string;
@@ -51,6 +51,7 @@ export declare function applyTaskListCap<T extends {
51
51
  omitted: number;
52
52
  hint: string;
53
53
  } | T[];
54
+ import { type PublicPreviewForUi } from "./web-api.js";
54
55
  import { WebChatHistory } from "./web-chat-history.js";
55
56
  import { SeenUsers, type MentionNames, type MentionQuery } from "./web-mentions.js";
56
57
  import { WebPrefsStore } from "./web-prefs.js";
@@ -74,6 +75,7 @@ import { type PreviewAvailability } from "./web-preview.js";
74
75
  import { type ConnectionMetadata, type ConnectionBinding, type BindingProbe, type SecretApplyJob, type ProviderSecretApplyJob } from "./connection-secrets.js";
75
76
  import { type ProviderSecretStatus } from "./provider-secret-registry.js";
76
77
  import { ApplyJobStore, type ApplyJob, type ApplyTargetKind, type SelfRestartResult } from "./apply-job.js";
78
+ import { type CarryResult } from "./backend/claude-carry.js";
77
79
  import { StormWindow } from "./storm-window.js";
78
80
  import { SpawnGate } from "./spawn-gate.js";
79
81
  import { BackendOutageTracker } from "./backend-outage.js";
@@ -101,6 +103,17 @@ export declare function selectLruEvictions(warm: string[], cap: number, opts: {
101
103
  * must match here, or a deleted instance's CLI is left running (#1305 P2-3).
102
104
  */
103
105
  export declare function isOrphanInstanceWindowName(name: string): boolean;
106
+ /** restartSingleInstance's options. `carry` (#1753): a credential-profile switch; its outcome is written into `result`. */
107
+ export interface RestartOpts {
108
+ freshStart?: boolean;
109
+ explicit?: boolean;
110
+ carry?: {
111
+ backend: string;
112
+ from: string | null;
113
+ to: string | null;
114
+ result?: CarryResult | null;
115
+ };
116
+ }
104
117
  /**
105
118
  * Answer shape for `list_models`. `scope` reports where the LIST came from —
106
119
  * "instance" only when it was read through that instance's own backend config,
@@ -304,6 +317,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
304
317
  private webChannelEchoGuards;
305
318
  /** instanceName → restart currently executing; concurrent callers join it. */
306
319
  private restartsInFlight;
320
+ /**
321
+ * #1753: each in-flight restart's stop → start gap — the conversation carry it will run there (its own, or one a later
322
+ * caller joined with before the gap), and whether the gap has been reached.
323
+ */
324
+ private readonly restartGaps;
307
325
  /**
308
326
  * Delayed automatic retries for instances whose startup failed. Before this a
309
327
  * failed start was logged once and the instance stayed `stopped` until an
@@ -402,6 +420,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
402
420
  private connectionBindingInFlight;
403
421
  private collabInstances;
404
422
  private healthServer;
423
+ private healthServerDrain;
405
424
  /** #1306: the preview listener (health_port + 1 by default), and whether it is listening. */
406
425
  private previewListener;
407
426
  private previewListening;
@@ -414,6 +433,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
414
433
  private updateProgressEditRunning;
415
434
  private lastUpdateProgressText;
416
435
  private updateCompletionTipText;
436
+ /**
437
+ * #1660: an adopted update whose retire outcome is still owed. The
438
+ * completion summary was (or will be) posted; this watch appends the
439
+ * cleanup outcome to the same receipt instead of letting stage edits
440
+ * clobber it — and refuses a receipt that no longer matches (checklist 3/5).
441
+ */
442
+ private updateCleanupWatch;
417
443
  /** Injectable only to keep the chat→CLI reload hand-off deterministic in tests. */
418
444
  private fullRestartLauncher;
419
445
  private eventLogPruneTimer;
@@ -602,6 +628,18 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
602
628
  */
603
629
  isPlannedRestart(): boolean;
604
630
  private finishStartup;
631
+ /**
632
+ * We are the post-update fleet: the update is over by definition. Clearing it here (rather than in the update
633
+ * command, which exits before the new fleet is up) is what keeps the quiet window from outliving the restart.
634
+ * #1660 exception: an update still owing its retire outcome keeps its receipt until the cleanup watch resolves it —
635
+ * deleting it here is what lost the warning. Terminal stages are still cleared unconditionally.
636
+ * #1735: and while the watch is armed it owns the marker — even if the outcome landed after the completion posted
637
+ * (a launchd kickstart or a detached restart returns at once, so it can land at any point of the boot): the watch
638
+ * appends it, then clears.
639
+ * #1737 review: and only the marker this boot adopted. One written since — a `/restart full` or a new `/update`
640
+ * landing while this boot's completion was still being edited — belongs to its writer and is left alone.
641
+ */
642
+ private clearSettledUpdateMarker;
605
643
  lastActivityMs(name: string): number;
606
644
  /** Capture the current daemon and delivery owner for a background context read. */
607
645
  getPaneContextSource(name: string): import("./pane-context-cache.js").PaneContextSource | null;
@@ -1097,12 +1135,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1097
1135
  /** Last-resort completion after RestartProgress could not deliver to its
1098
1136
  * adopted target. It stays bounded and never wakes a not-ready gateway. */
1099
1137
  private sendFleetStartCompletionFallback;
1100
- stopInstance(name: string, transition?: TransitionHandle): Promise<void>;
1138
+ stopInstance(name: string, transition?: TransitionHandle): Promise<{
1139
+ backgroundWorkEnded: boolean;
1140
+ }>;
1101
1141
  /** Restart a single instance, reloading fleet.yaml first to pick up config changes. */
1102
- restartSingleInstance(name: string, opts?: {
1103
- freshStart?: boolean;
1104
- explicit?: boolean;
1105
- }): Promise<void>;
1142
+ restartSingleInstance(name: string, opts?: RestartOpts): Promise<void>;
1106
1143
  isInstanceRestarting(name: string): boolean;
1107
1144
  /** InstanceLifecycleContext: an explicit wake joins the restart in flight. */
1108
1145
  restartInFlight(name: string): Promise<void> | undefined;
@@ -1123,6 +1160,12 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1123
1160
  * One-shot: the daemon deletes it on startup.
1124
1161
  */
1125
1162
  private writeFreshStartMarker;
1163
+ /**
1164
+ * #1753: a credential-profile switch, between the old CLI's stop and the new one's start. Where the backend can take
1165
+ * the conversation along (claude-code), copy it into the new profile and make it the one `--continue` picks; when that
1166
+ * cannot be done, or the backend cannot, start fresh as before. Null when nothing was tried.
1167
+ */
1168
+ private switchConversation;
1126
1169
  /** Load .env file from data dir into process.env */
1127
1170
  private loadEnvFile;
1128
1171
  /** Initialize auth before any adapter can answer /dashboard. */
@@ -1138,11 +1181,31 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1138
1181
  ttlMinutes: number;
1139
1182
  } | null;
1140
1183
  private tunnelPurposeLane;
1184
+ private previewTunnel;
1141
1185
  private publicWebLink;
1186
+ /** #1723: the public link's preview tunnel — a manager and lease of its own, never the fleet's one tunnel lane. */
1187
+ private getPreviewTunnel;
1142
1188
  private getTunnelLane;
1143
1189
  private publicOwnerCurrent;
1144
1190
  /** Exact owning General. No primary-adapter or name fallback participates in authorization. */
1145
1191
  private dashboardOwner;
1192
+ /**
1193
+ * #1742: the General a fleet admin's DM speaks for (`/start web`): the same owner `/web` in that General would make
1194
+ * — this bot's configured group and its one General topic. No address to match in a DM, so it must be unambiguous:
1195
+ * no General, or more than one on this bot and group, and there is no owner (nothing is guessed).
1196
+ */
1197
+ private dmDashboardOwner;
1198
+ /**
1199
+ * #1742: a fleet admin whose Telegram `/web` could not reach them privately may next open the bot's DM and press
1200
+ * Telegram's START, which sends a bare `/start` — read as `/start web` (the DM menu) for 10 minutes, once, for that
1201
+ * admin on that bot. Monotonic: a wall-clock jump neither opens nor shuts it.
1202
+ */
1203
+ private readonly tgWebStartWindows;
1204
+ private openTgWebStartWindow;
1205
+ /** Uses the window up: true when it was open. */
1206
+ private takeTgWebStartWindow;
1207
+ /** #1742: `/start web` from a fleet admin: the /web menu right here in the DM, for the General this bot serves. */
1208
+ private startWebInDm;
1146
1209
  private getPublicWebLink;
1147
1210
  getPublicWebStatus(): {
1148
1211
  state: string;
@@ -1180,6 +1243,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1180
1243
  /** Why the DM did not go, for the log only (Discord 50007 = the user does not accept DMs from this server's members). */
1181
1244
  private logDashboardDmFailure;
1182
1245
  /** False when the menu was not shown (the caller still owes the user an answer). */
1246
+ /**
1247
+ * `dmChatId` (#1742): show it in the owner's own private chat with the bot instead of the General — the owner, its
1248
+ * gates and the code's route are the same; only where the menu sits (and its clicks are good) changes.
1249
+ */
1183
1250
  private showDashboardMenu;
1184
1251
  private handleDashboardCallback;
1185
1252
  /** `/dashboard revoke`: sign out every browser and withdraw any unused code. */
@@ -1232,6 +1299,36 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1232
1299
  private reportFullRestartFailure;
1233
1300
  failUpdateProgress(message: string): void;
1234
1301
  /** The old fleet edits CLI install stages; the new fleet adopts the same message below. */
1302
+ /**
1303
+ * #1660: arm the post-completion cleanup watch and make sure its monitor
1304
+ * actually runs. The new fleet adopts the receipt at boot but nothing else
1305
+ * starts this timer on that path (Prism a) — without this, the owed
1306
+ * outcome would sit in the marker unwatched. READY never waits for it.
1307
+ */
1308
+ /**
1309
+ * #1735: what the completion of an adopted update does about its retire outcome, read from the marker as it is now.
1310
+ * Already landed with a warning (a detached restart returns before this fleet boots, so the updater retires first)
1311
+ * → render it in the completion. Still owed (`cleanup: "pending"` — a service restart waits for READY, which comes
1312
+ * after the completion) → watch for it. Anything else (no retire on this update, done silently, another receipt)
1313
+ * → nothing.
1314
+ */
1315
+ /**
1316
+ * #1716: background work this restart/update ended, scoped to the operation
1317
+ * so an older stop never reports (`sinceAt` null = plain boot, report
1318
+ * nothing). A method — not a module function — because the #1737
1319
+ * extracted-completion harness runs this region verbatim with only
1320
+ * `this`-methods plus a fixed context.
1321
+ */
1322
+ private collectBackgroundWorkEndedNames;
1323
+ private updateCleanupAtCompletion;
1324
+ private armCleanupWatch;
1325
+ /**
1326
+ * #1660: append a recorded cleanup outcome to the adopted update message,
1327
+ * then release the receipt — but only if this receipt still owns the
1328
+ * marker. The await yields, so a newer receipt (e.g. a full-restart that
1329
+ * landed mid-edit) must not be cleared or disturbed (Prism b).
1330
+ */
1331
+ private appendCleanupWarning;
1235
1332
  private startUpdateProgressMonitor;
1236
1333
  /** Start all instances from fleet config */
1237
1334
  startAll(configPath: string): Promise<void>;
@@ -1436,6 +1533,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1436
1533
  */
1437
1534
  private resolveInboundTarget;
1438
1535
  private handleInboundMessage;
1536
+ /**
1537
+ * #1752: the bot that speaks back about an inbound message — in a fleet topic the owning instance's adapter, never
1538
+ * the sibling that happened to win the dedup race; elsewhere (ClassicBot rooms, no routed instance) the receiver.
1539
+ */
1540
+ private inboundNoticeAdapter;
1439
1541
  private handleInboundMessageCore;
1440
1542
  /** Handle outbound tool calls from a daemon instance */
1441
1543
  /** Warn (but don't block) when rate limits are high. 30-min debounce per instance. */
@@ -3121,6 +3223,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
3121
3223
  previewForUi(hostHeader: string | undefined, secure: boolean): PreviewAvailability & {
3122
3224
  boot: string | null;
3123
3225
  };
3226
+ /**
3227
+ * #1723: for one page of the public link (exposure `exposureId`, at `dashboardOrigin`): its own preview tunnel's
3228
+ * origin once up, "starting" until then, why it failed if it did — or a configured web.preview_origin, used instead.
3229
+ */
3230
+ publicPreviewForUi(exposureId: string, dashboardOrigin: string): PublicPreviewForUi;
3124
3231
  getUiStatus(): unknown;
3125
3232
  private getUiStatusSync;
3126
3233
  }