@songsid/agend 2.2.0-beta.3 → 2.2.0-beta.5

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/dist/agent-cli.js +6 -2
  2. package/dist/agent-cli.js.map +1 -1
  3. package/dist/backend/claude-code.d.ts +46 -2
  4. package/dist/backend/claude-code.js +125 -31
  5. package/dist/backend/claude-code.js.map +1 -1
  6. package/dist/backend/credential-profile.d.ts +33 -3
  7. package/dist/backend/credential-profile.js +107 -5
  8. package/dist/backend/credential-profile.js.map +1 -1
  9. package/dist/backend/types.d.ts +1 -1
  10. package/dist/cache-service.d.ts +2 -0
  11. package/dist/cache-service.js +2 -1
  12. package/dist/cache-service.js.map +1 -1
  13. package/dist/channel/adapters/discord.d.ts +13 -0
  14. package/dist/channel/adapters/discord.js +42 -0
  15. package/dist/channel/adapters/discord.js.map +1 -1
  16. package/dist/channel/adapters/telegram.d.ts +6 -1
  17. package/dist/channel/adapters/telegram.js +27 -2
  18. package/dist/channel/adapters/telegram.js.map +1 -1
  19. package/dist/channel/types.d.ts +22 -1
  20. package/dist/cli.js +35 -0
  21. package/dist/cli.js.map +1 -1
  22. package/dist/config-validator.js +7 -0
  23. package/dist/config-validator.js.map +1 -1
  24. package/dist/daemon.d.ts +96 -0
  25. package/dist/daemon.js +339 -16
  26. package/dist/daemon.js.map +1 -1
  27. package/dist/delivery-outbox.d.ts +18 -5
  28. package/dist/delivery-outbox.js +121 -14
  29. package/dist/delivery-outbox.js.map +1 -1
  30. package/dist/fleet-context.d.ts +1 -0
  31. package/dist/fleet-manager.d.ts +89 -3
  32. package/dist/fleet-manager.js +541 -86
  33. package/dist/fleet-manager.js.map +1 -1
  34. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +43 -10
  35. package/dist/host-memory.d.ts +10 -0
  36. package/dist/host-memory.js +33 -1
  37. package/dist/host-memory.js.map +1 -1
  38. package/dist/instance-lifecycle.d.ts +25 -6
  39. package/dist/instance-lifecycle.js +73 -26
  40. package/dist/instance-lifecycle.js.map +1 -1
  41. package/dist/locale.js +48 -18
  42. package/dist/locale.js.map +1 -1
  43. package/dist/login-controller.d.ts +20 -3
  44. package/dist/login-controller.js +71 -19
  45. package/dist/login-controller.js.map +1 -1
  46. package/dist/login-flows.d.ts +5 -2
  47. package/dist/login-flows.js +5 -4
  48. package/dist/login-flows.js.map +1 -1
  49. package/dist/memory-pressure.d.ts +13 -1
  50. package/dist/memory-pressure.js +50 -10
  51. package/dist/memory-pressure.js.map +1 -1
  52. package/dist/outbound-handlers.d.ts +61 -0
  53. package/dist/outbound-handlers.js +100 -35
  54. package/dist/outbound-handlers.js.map +1 -1
  55. package/dist/outbound-schemas.d.ts +1 -0
  56. package/dist/outbound-schemas.js +2 -0
  57. package/dist/outbound-schemas.js.map +1 -1
  58. package/dist/public-preview.d.ts +100 -0
  59. package/dist/public-preview.js +233 -0
  60. package/dist/public-preview.js.map +1 -0
  61. package/dist/public-web-gateway.js +6 -4
  62. package/dist/public-web-gateway.js.map +1 -1
  63. package/dist/public-web-link.d.ts +20 -0
  64. package/dist/public-web-link.js +26 -1
  65. package/dist/public-web-link.js.map +1 -1
  66. package/dist/restart-progress.d.ts +29 -0
  67. package/dist/restart-progress.js +23 -0
  68. package/dist/restart-progress.js.map +1 -1
  69. package/dist/settings-api.js +10 -4
  70. package/dist/settings-api.js.map +1 -1
  71. package/dist/spawn-gate.js +5 -1
  72. package/dist/spawn-gate.js.map +1 -1
  73. package/dist/spawn-hold-reply.d.ts +12 -0
  74. package/dist/spawn-hold-reply.js +39 -0
  75. package/dist/spawn-hold-reply.js.map +1 -0
  76. package/dist/topic-commands.js +9 -2
  77. package/dist/topic-commands.js.map +1 -1
  78. package/dist/tunnel/purpose-lane.d.ts +5 -1
  79. package/dist/tunnel/purpose-lane.js +14 -7
  80. package/dist/tunnel/purpose-lane.js.map +1 -1
  81. package/dist/turn-resume.d.ts +2 -0
  82. package/dist/turn-resume.js +1 -1
  83. package/dist/turn-resume.js.map +1 -1
  84. package/dist/types.d.ts +8 -0
  85. package/dist/ui/chat-mentions.js +63 -0
  86. package/dist/ui/chat-render.js +25 -0
  87. package/dist/ui/chat-strings.js +14 -2
  88. package/dist/ui/chat-thread.js +28 -10
  89. package/dist/ui/panel-chat.js +26 -11
  90. package/dist/ui/panel-details.js +2 -0
  91. package/dist/ui/panel-fleet.js +199 -57
  92. package/dist/ui/panel-needs.js +4 -3
  93. package/dist/ui/panel-settings.js +4 -2
  94. package/dist/ui/preview-panel.js +48 -14
  95. package/dist/ui/preview-status.js +28 -0
  96. package/dist/ui/preview.js +40 -3
  97. package/dist/ui/settings-token.js +1 -1
  98. package/dist/ui/shared/app-i18n.js +4 -0
  99. package/dist/ui/shared/app-prefs.js +1 -0
  100. package/dist/ui/shared/app-shell.js +146 -2
  101. package/dist/ui/shared/app-store.js +3 -1
  102. package/dist/ui/shared/app.css +47 -20
  103. package/dist/ui/shared/instance-nav.js +79 -23
  104. package/dist/ui/shared/view-strings.js +10 -0
  105. package/dist/unrecognised-prompt.d.ts +23 -0
  106. package/dist/unrecognised-prompt.js +74 -0
  107. package/dist/unrecognised-prompt.js.map +1 -0
  108. package/dist/update-install.d.ts +8 -0
  109. package/dist/update-install.js +9 -3
  110. package/dist/update-install.js.map +1 -1
  111. package/dist/update-marker.d.ts +40 -0
  112. package/dist/update-marker.js +49 -0
  113. package/dist/update-marker.js.map +1 -1
  114. package/dist/usage/i18n-keys.d.ts +1 -1
  115. package/dist/usage/i18n-keys.js +1 -1
  116. package/dist/usage/i18n-keys.js.map +1 -1
  117. package/dist/usage/providers.d.ts +34 -5
  118. package/dist/usage/providers.js +160 -27
  119. package/dist/usage/providers.js.map +1 -1
  120. package/dist/usage/statusline-usage.d.ts +6 -2
  121. package/dist/usage/statusline-usage.js +10 -4
  122. package/dist/usage/statusline-usage.js.map +1 -1
  123. package/dist/web-api.d.ts +20 -0
  124. package/dist/web-api.js +216 -30
  125. package/dist/web-api.js.map +1 -1
  126. package/dist/web-auth.js +3 -2
  127. package/dist/web-auth.js.map +1 -1
  128. package/dist/web-mentions.d.ts +44 -0
  129. package/dist/web-mentions.js +75 -0
  130. package/dist/web-mentions.js.map +1 -0
  131. package/dist/web-prefs.js +2 -0
  132. package/dist/web-prefs.js.map +1 -1
  133. package/dist/web-preview.d.ts +14 -1
  134. package/dist/web-preview.js +35 -13
  135. package/dist/web-preview.js.map +1 -1
  136. package/dist/web-schedules.d.ts +12 -0
  137. package/dist/web-schedules.js +34 -0
  138. package/dist/web-schedules.js.map +1 -0
  139. package/package.json +1 -1
@@ -51,7 +51,9 @@ 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";
56
+ import { SeenUsers, type MentionNames, type MentionQuery } from "./web-mentions.js";
55
57
  import { WebPrefsStore } from "./web-prefs.js";
56
58
  import { ReplyButtonsController } from "./reply-buttons-controller.js";
57
59
  import { WebFileLedger } from "./web-upload.js";
@@ -160,6 +162,8 @@ export declare const LOGIN_CALLBACK_PREFIX = "login:";
160
162
  * and hides exactly the newly released model the user opened `/model` to find.
161
163
  * The wait is announced before it starts, so it reads as progress, not a stall.
162
164
  */
165
+ /** #1690: how long `/model` waits for the daemon's word on our own runtime switch (its dialog wait plus settling). */
166
+ export declare const RUNTIME_SWITCH_RESULT_MS = 12000;
163
167
  export declare const CLI_ENV_PROBE_DEADLINE_MS = 16000;
164
168
  /**
165
169
  * How many CLIs may cold-start at once, from BOTH memory and cores.
@@ -411,6 +415,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
411
415
  private updateProgressEditRunning;
412
416
  private lastUpdateProgressText;
413
417
  private updateCompletionTipText;
418
+ /**
419
+ * #1660: an adopted update whose retire outcome is still owed. The
420
+ * completion summary was (or will be) posted; this watch appends the
421
+ * cleanup outcome to the same receipt instead of letting stage edits
422
+ * clobber it — and refuses a receipt that no longer matches (checklist 3/5).
423
+ */
424
+ private updateCleanupWatch;
414
425
  /** Injectable only to keep the chat→CLI reload hand-off deterministic in tests. */
415
426
  private fullRestartLauncher;
416
427
  private eventLogPruneTimer;
@@ -430,8 +441,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
430
441
  private memoryLogAt;
431
442
  private memoryDebugAt;
432
443
  private memoryLogLevel;
433
- private memoryNoticeAt;
434
- private memoryNoticeLevel;
444
+ /** #1685: the host_memory value the last status frame carried, so a change re-sends the frame. */
445
+ private memoryIndicatorShown;
435
446
  private mirrorBuffer;
436
447
  private mirrorTimer;
437
448
  private sseClients;
@@ -441,6 +452,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
441
452
  private webChatStore;
442
453
  /** Uploaded files and the files the dashboard may fetch back (uploads, reply attachments). */
443
454
  readonly webFiles: WebFileLedger;
455
+ /** #1682: the people seen on inbound messages (id → name), for the web chat's mention pills; bounded, in memory. */
456
+ readonly seenUsers: SeenUsers;
444
457
  private webPrefsStore?;
445
458
  /** #1665: the web preferences kept on the host (<home>/web-prefs.json), read on first use. */
446
459
  get webPrefs(): WebPrefsStore;
@@ -542,6 +555,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
542
555
  * notice when the owner is not working and nothing came back in time.
543
556
  */
544
557
  sweepReplyObligations(now?: Date): void;
558
+ private expireReplyObligations;
545
559
  private scheduleDeliveryOutboxPump;
546
560
  private runDeliveryOutboxPump;
547
561
  /**
@@ -558,6 +572,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
558
572
  private dispatchDurableDelivery;
559
573
  private waitForDurableLaneRelease;
560
574
  private spawnConcurrency;
575
+ /** #1685: "elevated" or "critical" while host memory pressure slows or holds new agents; otherwise null (an
576
+ * unknown macOS reading — the advisory case — is unknown, so null too). */
577
+ private hostMemoryIndicator;
561
578
  /** Separate cooldown: changing measurements must not create new text-throttle keys. */
562
579
  private reportMemoryPressure;
563
580
  /** Wire the one fleet-wide storm into notification and recovery surfaces. */
@@ -901,6 +918,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
901
918
  * the check and the act, so the channel's instance cannot be rebound to another bot in between.
902
919
  */
903
920
  private dispatchSlash;
921
+ private dispatchSlashCore;
904
922
  /**
905
923
  * The door every Discord slash command goes through (src/slash-authz.ts has the rule and the reasoning): the scope
906
924
  * it lets the command into, or the reply that refuses it. Synchronous, so the dispatch acts on what it judged.
@@ -1128,7 +1146,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1128
1146
  ttlMinutes: number;
1129
1147
  } | null;
1130
1148
  private tunnelPurposeLane;
1149
+ private previewTunnel;
1131
1150
  private publicWebLink;
1151
+ /** #1723: the public link's preview tunnel — a manager and lease of its own, never the fleet's one tunnel lane. */
1152
+ private getPreviewTunnel;
1132
1153
  private getTunnelLane;
1133
1154
  private publicOwnerCurrent;
1134
1155
  /** Exact owning General. No primary-adapter or name fallback participates in authorization. */
@@ -1146,6 +1167,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1146
1167
  }, current: () => boolean): Promise<void>;
1147
1168
  /** Telegram's typed command enters through the same strict owner and nonce path as Discord. */
1148
1169
  dashboardMenu(msg: InboundMessage): Promise<void>;
1170
+ /**
1171
+ * #1686: build the Telegram deep-link that opens a DM with this bot pre-seeded with `/start web`.
1172
+ * Returns null when no botUsername is known or the username fails Telegram's format validation.
1173
+ */
1174
+ private tgStartWebUrl;
1149
1175
  private sendLocalDashboard;
1150
1176
  /**
1151
1177
  * #1586: the sign-in code once more, as a message of its own, so a phone can copy it by itself: Telegram's monospace
@@ -1217,6 +1243,20 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1217
1243
  private reportFullRestartFailure;
1218
1244
  failUpdateProgress(message: string): void;
1219
1245
  /** The old fleet edits CLI install stages; the new fleet adopts the same message below. */
1246
+ /**
1247
+ * #1660: arm the post-completion cleanup watch and make sure its monitor
1248
+ * actually runs. The new fleet adopts the receipt at boot but nothing else
1249
+ * starts this timer on that path (Prism a) — without this, the owed
1250
+ * outcome would sit in the marker unwatched. READY never waits for it.
1251
+ */
1252
+ private armCleanupWatch;
1253
+ /**
1254
+ * #1660: append a recorded cleanup outcome to the adopted update message,
1255
+ * then release the receipt — but only if this receipt still owns the
1256
+ * marker. The await yields, so a newer receipt (e.g. a full-restart that
1257
+ * landed mid-edit) must not be cleared or disturbed (Prism b).
1258
+ */
1259
+ private appendCleanupWarning;
1220
1260
  private startUpdateProgressMonitor;
1221
1261
  /** Start all instances from fleet config */
1222
1262
  startAll(configPath: string): Promise<void>;
@@ -1421,6 +1461,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1421
1461
  */
1422
1462
  private resolveInboundTarget;
1423
1463
  private handleInboundMessage;
1464
+ private handleInboundMessageCore;
1424
1465
  /** Handle outbound tool calls from a daemon instance */
1425
1466
  /** Warn (but don't block) when rate limits are high. 30-min debounce per instance. */
1426
1467
  private rateLimitWarnedAt;
@@ -1729,6 +1770,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1729
1770
  private webIdentityImage;
1730
1771
  /** GET /ui/img/bot|avatar/<key>: what is cached, never a fetch. Only an own-bot connection, or a known instance's upload. */
1731
1772
  webImage(kind: "bot" | "avatar", key: string): CachedImage | null;
1773
+ /**
1774
+ * #1682 GET /ui/mentions: names for the mention ids a page found in what it rendered — never a Discord request; in order:
1775
+ * the fleet's bots (an instance's own bot is that instance's label: fleet.yaml, and the View profiles read from
1776
+ * profiles.db, as the status frame does), the people seen on inbound messages, and the Discord adapters' caches
1777
+ * (members, users, roles, channels).
1778
+ */
1779
+ webMentionNames(query: MentionQuery): MentionNames;
1732
1780
  /** GET /ui/emojis: the custom emoji of every server the fleet's Discord bots are in (the Settings picker's cache). */
1733
1781
  webEmojiList(): Promise<Array<{
1734
1782
  id: string;
@@ -2039,6 +2087,19 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2039
2087
  */
2040
2088
  orgChart(): OrgChart;
2041
2089
  private cacheService;
2090
+ /**
2091
+ * #1699: the credential profile an instance's CLI signs in with on `backend` — fleet.yaml's (with its defaults), or a
2092
+ * ClassicBot room's launched or would-be login when the room runs that backend. Null: the backend's default login
2093
+ * (also for a backend that has no profiles, where the option is ignored).
2094
+ */
2095
+ credentialProfileOf(name: string, backend: string): string | null;
2096
+ /**
2097
+ * #1699: the claude config dir an instance's CLI uses — its credential profile's, else exactly as before
2098
+ * (CLAUDE_CONFIG_DIR or ~/.claude).
2099
+ */
2100
+ claudeConfigDirOf(name: string): string;
2101
+ /** The instances the cache analysis reads: fleet.yaml's, then the ClassicBot rooms (their workspace under the AgEnD home, their own backend). */
2102
+ private cacheInstances;
2042
2103
  /**
2043
2104
  * #1468: the prompt-cache expiry analysis for the web, per instance, over `window`. Read from each instance's
2044
2105
  * ledger as it is now; the first request starts the bounded, persisted catch-up over the transcripts
@@ -2174,7 +2235,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2174
2235
  * Backends with no remote login flow (opencode logs in from a terminal) get
2175
2236
  * no button — the alert's own wording already tells them what to run.
2176
2237
  */
2177
- offerBackendLogin(targetInstance: string, backend: string): Promise<void>;
2238
+ offerBackendLogin(targetInstance: string, backend: string, profile?: string): Promise<void>;
2178
2239
  /** Consume a General assist button exactly once. */
2179
2240
  private handleInteractivePromptAssist;
2180
2241
  /** Send a "🛑 Cancel" button to the instance's topic/channel after delivery. */
@@ -2407,6 +2468,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2407
2468
  skipAuthCheck?: boolean;
2408
2469
  tokenPresent?: boolean;
2409
2470
  tunnel?: boolean;
2471
+ profile?: string;
2410
2472
  }): Promise<string | null>;
2411
2473
  /** Which way a `/login` went (#1131) — so the event log shows what users actually need. */
2412
2474
  private recordLoginFlow;
@@ -2450,6 +2512,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2450
2512
  chatId: string;
2451
2513
  threadId?: string;
2452
2514
  userId?: string;
2515
+ }, signIn?: {
2516
+ profile?: string;
2453
2517
  }): Promise<string>;
2454
2518
  /** Whether this backend's CLI is on the fleet's PATH (what `/login` installs when it is not). */
2455
2519
  isCliInstalled(backend: string): boolean;
@@ -2566,6 +2630,20 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2566
2630
  /** Forward a message to a classic channel instance with chat log context */
2567
2631
  private forwardToClassicInstance;
2568
2632
  /** Paste raw text directly to a classic instance's CLI (no [user:] wrapping) */
2633
+ /** #1690: our own runtime switches awaiting the daemon's outcome, by id. */
2634
+ private readonly runtimeSwitchWaiters;
2635
+ /**
2636
+ * #1690: type `/model <model>` and wait for what it came to: the daemon answers claude's "Switch model?" for us (Yes
2637
+ * when it names this model, No otherwise) or sees claude's own result. Null when it could not be sent; a timeout is
2638
+ * "not confirmed".
2639
+ */
2640
+ private runRuntimeModelSwitch;
2641
+ /**
2642
+ * #1690: the names claude-code is known to accept, for checking `/model <name>` BEFORE it is typed — claude itself
2643
+ * accepts any string ("Set model to opsu"), and its "Switch model?" then names the typo. Static aliases (with [1m]),
2644
+ * the cached account catalog, the configured model; without a cached catalog, any `claude-…` id too (cannot check).
2645
+ */
2646
+ private claudeModelKnown;
2569
2647
  private pasteRawToClassicInstance;
2570
2648
  /** Resolve the backend name configured for an instance (fleet or classic). */
2571
2649
  private backendNameForInstance;
@@ -2731,6 +2809,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2731
2809
  */
2732
2810
  applyEffort(instanceName: string, requested: string): Promise<string>;
2733
2811
  applyModel(instanceName: string, model: string): Promise<string>;
2812
+ /** Save an instance's model (fleet.yaml, or its ClassicBot channel). False when neither holds it. */
2813
+ private persistInstanceModel;
2734
2814
  /**
2735
2815
  * The trailing "Current effort: …" line for a /model reply.
2736
2816
  *
@@ -2754,6 +2834,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2754
2834
  private getMissingBackendWarning;
2755
2835
  /** Handle Discord's required static slash choice, warning before a likely startup failure. */
2756
2836
  private handleClassicStartSlash;
2837
+ private handleClassicStartSlashCore;
2757
2838
  /** Present platform-native backend choices, then start on selection or timeout. */
2758
2839
  private beginClassicBackendSelection;
2759
2840
  /** Consume a selection callback. Returns true for all ClassicBot callback IDs, including stale ones. */
@@ -3065,6 +3146,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
3065
3146
  previewForUi(hostHeader: string | undefined, secure: boolean): PreviewAvailability & {
3066
3147
  boot: string | null;
3067
3148
  };
3149
+ /**
3150
+ * #1723: for one page of the public link (exposure `exposureId`, at `dashboardOrigin`): its own preview tunnel's
3151
+ * origin once up, "starting" until then, why it failed if it did — or a configured web.preview_origin, used instead.
3152
+ */
3153
+ publicPreviewForUi(exposureId: string, dashboardOrigin: string): PublicPreviewForUi;
3068
3154
  getUiStatus(): unknown;
3069
3155
  private getUiStatusSync;
3070
3156
  }