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

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 (96) 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 +39 -2
  4. package/dist/backend/claude-code.js +115 -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/config-validator.js +4 -0
  21. package/dist/config-validator.js.map +1 -1
  22. package/dist/daemon.d.ts +96 -0
  23. package/dist/daemon.js +339 -16
  24. package/dist/daemon.js.map +1 -1
  25. package/dist/delivery-outbox.d.ts +18 -5
  26. package/dist/delivery-outbox.js +121 -14
  27. package/dist/delivery-outbox.js.map +1 -1
  28. package/dist/fleet-context.d.ts +1 -0
  29. package/dist/fleet-manager.d.ts +59 -3
  30. package/dist/fleet-manager.js +357 -71
  31. package/dist/fleet-manager.js.map +1 -1
  32. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +43 -10
  33. package/dist/host-memory.d.ts +10 -0
  34. package/dist/host-memory.js +33 -1
  35. package/dist/host-memory.js.map +1 -1
  36. package/dist/instance-lifecycle.d.ts +25 -6
  37. package/dist/instance-lifecycle.js +73 -26
  38. package/dist/instance-lifecycle.js.map +1 -1
  39. package/dist/locale.js +44 -18
  40. package/dist/locale.js.map +1 -1
  41. package/dist/login-controller.d.ts +20 -3
  42. package/dist/login-controller.js +71 -19
  43. package/dist/login-controller.js.map +1 -1
  44. package/dist/login-flows.d.ts +5 -2
  45. package/dist/login-flows.js +5 -4
  46. package/dist/login-flows.js.map +1 -1
  47. package/dist/memory-pressure.d.ts +13 -1
  48. package/dist/memory-pressure.js +50 -10
  49. package/dist/memory-pressure.js.map +1 -1
  50. package/dist/outbound-handlers.d.ts +61 -0
  51. package/dist/outbound-handlers.js +100 -35
  52. package/dist/outbound-handlers.js.map +1 -1
  53. package/dist/outbound-schemas.d.ts +1 -0
  54. package/dist/outbound-schemas.js +2 -0
  55. package/dist/outbound-schemas.js.map +1 -1
  56. package/dist/public-web-gateway.js +4 -3
  57. package/dist/public-web-gateway.js.map +1 -1
  58. package/dist/settings-api.js +10 -4
  59. package/dist/settings-api.js.map +1 -1
  60. package/dist/spawn-gate.js +5 -1
  61. package/dist/spawn-gate.js.map +1 -1
  62. package/dist/spawn-hold-reply.d.ts +12 -0
  63. package/dist/spawn-hold-reply.js +39 -0
  64. package/dist/spawn-hold-reply.js.map +1 -0
  65. package/dist/topic-commands.js +9 -2
  66. package/dist/topic-commands.js.map +1 -1
  67. package/dist/turn-resume.d.ts +2 -0
  68. package/dist/turn-resume.js +1 -1
  69. package/dist/turn-resume.js.map +1 -1
  70. package/dist/types.d.ts +2 -0
  71. package/dist/ui/chat-mentions.js +63 -0
  72. package/dist/ui/chat-render.js +25 -0
  73. package/dist/ui/chat-thread.js +26 -8
  74. package/dist/ui/panel-chat.js +17 -9
  75. package/dist/ui/panel-details.js +2 -0
  76. package/dist/ui/panel-fleet.js +51 -22
  77. package/dist/ui/panel-settings.js +3 -1
  78. package/dist/ui/preview-panel.js +48 -14
  79. package/dist/ui/preview.js +5 -1
  80. package/dist/ui/settings-token.js +1 -1
  81. package/dist/ui/shared/app-store.js +3 -1
  82. package/dist/ui/shared/app.css +11 -7
  83. package/dist/ui/shared/instance-nav.js +32 -7
  84. package/dist/ui/shared/view-strings.js +6 -0
  85. package/dist/unrecognised-prompt.d.ts +23 -0
  86. package/dist/unrecognised-prompt.js +74 -0
  87. package/dist/unrecognised-prompt.js.map +1 -0
  88. package/dist/web-api.d.ts +3 -0
  89. package/dist/web-api.js +115 -17
  90. package/dist/web-api.js.map +1 -1
  91. package/dist/web-auth.js +1 -1
  92. package/dist/web-auth.js.map +1 -1
  93. package/dist/web-mentions.d.ts +44 -0
  94. package/dist/web-mentions.js +75 -0
  95. package/dist/web-mentions.js.map +1 -0
  96. package/package.json +1 -1
@@ -52,6 +52,7 @@ export declare function applyTaskListCap<T extends {
52
52
  hint: string;
53
53
  } | T[];
54
54
  import { WebChatHistory } from "./web-chat-history.js";
55
+ import { SeenUsers, type MentionNames, type MentionQuery } from "./web-mentions.js";
55
56
  import { WebPrefsStore } from "./web-prefs.js";
56
57
  import { ReplyButtonsController } from "./reply-buttons-controller.js";
57
58
  import { WebFileLedger } from "./web-upload.js";
@@ -160,6 +161,8 @@ export declare const LOGIN_CALLBACK_PREFIX = "login:";
160
161
  * and hides exactly the newly released model the user opened `/model` to find.
161
162
  * The wait is announced before it starts, so it reads as progress, not a stall.
162
163
  */
164
+ /** #1690: how long `/model` waits for the daemon's word on our own runtime switch (its dialog wait plus settling). */
165
+ export declare const RUNTIME_SWITCH_RESULT_MS = 12000;
163
166
  export declare const CLI_ENV_PROBE_DEADLINE_MS = 16000;
164
167
  /**
165
168
  * How many CLIs may cold-start at once, from BOTH memory and cores.
@@ -430,8 +433,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
430
433
  private memoryLogAt;
431
434
  private memoryDebugAt;
432
435
  private memoryLogLevel;
433
- private memoryNoticeAt;
434
- private memoryNoticeLevel;
436
+ /** #1685: the host_memory value the last status frame carried, so a change re-sends the frame. */
437
+ private memoryIndicatorShown;
435
438
  private mirrorBuffer;
436
439
  private mirrorTimer;
437
440
  private sseClients;
@@ -441,6 +444,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
441
444
  private webChatStore;
442
445
  /** Uploaded files and the files the dashboard may fetch back (uploads, reply attachments). */
443
446
  readonly webFiles: WebFileLedger;
447
+ /** #1682: the people seen on inbound messages (id → name), for the web chat's mention pills; bounded, in memory. */
448
+ readonly seenUsers: SeenUsers;
444
449
  private webPrefsStore?;
445
450
  /** #1665: the web preferences kept on the host (<home>/web-prefs.json), read on first use. */
446
451
  get webPrefs(): WebPrefsStore;
@@ -542,6 +547,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
542
547
  * notice when the owner is not working and nothing came back in time.
543
548
  */
544
549
  sweepReplyObligations(now?: Date): void;
550
+ private expireReplyObligations;
545
551
  private scheduleDeliveryOutboxPump;
546
552
  private runDeliveryOutboxPump;
547
553
  /**
@@ -558,6 +564,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
558
564
  private dispatchDurableDelivery;
559
565
  private waitForDurableLaneRelease;
560
566
  private spawnConcurrency;
567
+ /** #1685: "elevated" or "critical" while host memory pressure slows or holds new agents; otherwise null (an
568
+ * unknown macOS reading — the advisory case — is unknown, so null too). */
569
+ private hostMemoryIndicator;
561
570
  /** Separate cooldown: changing measurements must not create new text-throttle keys. */
562
571
  private reportMemoryPressure;
563
572
  /** Wire the one fleet-wide storm into notification and recovery surfaces. */
@@ -901,6 +910,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
901
910
  * the check and the act, so the channel's instance cannot be rebound to another bot in between.
902
911
  */
903
912
  private dispatchSlash;
913
+ private dispatchSlashCore;
904
914
  /**
905
915
  * The door every Discord slash command goes through (src/slash-authz.ts has the rule and the reasoning): the scope
906
916
  * it lets the command into, or the reply that refuses it. Synchronous, so the dispatch acts on what it judged.
@@ -1146,6 +1156,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1146
1156
  }, current: () => boolean): Promise<void>;
1147
1157
  /** Telegram's typed command enters through the same strict owner and nonce path as Discord. */
1148
1158
  dashboardMenu(msg: InboundMessage): Promise<void>;
1159
+ /**
1160
+ * #1686: build the Telegram deep-link that opens a DM with this bot pre-seeded with `/start web`.
1161
+ * Returns null when no botUsername is known or the username fails Telegram's format validation.
1162
+ */
1163
+ private tgStartWebUrl;
1149
1164
  private sendLocalDashboard;
1150
1165
  /**
1151
1166
  * #1586: the sign-in code once more, as a message of its own, so a phone can copy it by itself: Telegram's monospace
@@ -1421,6 +1436,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1421
1436
  */
1422
1437
  private resolveInboundTarget;
1423
1438
  private handleInboundMessage;
1439
+ private handleInboundMessageCore;
1424
1440
  /** Handle outbound tool calls from a daemon instance */
1425
1441
  /** Warn (but don't block) when rate limits are high. 30-min debounce per instance. */
1426
1442
  private rateLimitWarnedAt;
@@ -1729,6 +1745,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1729
1745
  private webIdentityImage;
1730
1746
  /** GET /ui/img/bot|avatar/<key>: what is cached, never a fetch. Only an own-bot connection, or a known instance's upload. */
1731
1747
  webImage(kind: "bot" | "avatar", key: string): CachedImage | null;
1748
+ /**
1749
+ * #1682 GET /ui/mentions: names for the mention ids a page found in what it rendered — never a Discord request; in order:
1750
+ * the fleet's bots (an instance's own bot is that instance's label: fleet.yaml, and the View profiles read from
1751
+ * profiles.db, as the status frame does), the people seen on inbound messages, and the Discord adapters' caches
1752
+ * (members, users, roles, channels).
1753
+ */
1754
+ webMentionNames(query: MentionQuery): MentionNames;
1732
1755
  /** GET /ui/emojis: the custom emoji of every server the fleet's Discord bots are in (the Settings picker's cache). */
1733
1756
  webEmojiList(): Promise<Array<{
1734
1757
  id: string;
@@ -2039,6 +2062,19 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2039
2062
  */
2040
2063
  orgChart(): OrgChart;
2041
2064
  private cacheService;
2065
+ /**
2066
+ * #1699: the credential profile an instance's CLI signs in with on `backend` — fleet.yaml's (with its defaults), or a
2067
+ * ClassicBot room's launched or would-be login when the room runs that backend. Null: the backend's default login
2068
+ * (also for a backend that has no profiles, where the option is ignored).
2069
+ */
2070
+ credentialProfileOf(name: string, backend: string): string | null;
2071
+ /**
2072
+ * #1699: the claude config dir an instance's CLI uses — its credential profile's, else exactly as before
2073
+ * (CLAUDE_CONFIG_DIR or ~/.claude).
2074
+ */
2075
+ claudeConfigDirOf(name: string): string;
2076
+ /** The instances the cache analysis reads: fleet.yaml's, then the ClassicBot rooms (their workspace under the AgEnD home, their own backend). */
2077
+ private cacheInstances;
2042
2078
  /**
2043
2079
  * #1468: the prompt-cache expiry analysis for the web, per instance, over `window`. Read from each instance's
2044
2080
  * ledger as it is now; the first request starts the bounded, persisted catch-up over the transcripts
@@ -2174,7 +2210,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2174
2210
  * Backends with no remote login flow (opencode logs in from a terminal) get
2175
2211
  * no button — the alert's own wording already tells them what to run.
2176
2212
  */
2177
- offerBackendLogin(targetInstance: string, backend: string): Promise<void>;
2213
+ offerBackendLogin(targetInstance: string, backend: string, profile?: string): Promise<void>;
2178
2214
  /** Consume a General assist button exactly once. */
2179
2215
  private handleInteractivePromptAssist;
2180
2216
  /** Send a "🛑 Cancel" button to the instance's topic/channel after delivery. */
@@ -2407,6 +2443,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2407
2443
  skipAuthCheck?: boolean;
2408
2444
  tokenPresent?: boolean;
2409
2445
  tunnel?: boolean;
2446
+ profile?: string;
2410
2447
  }): Promise<string | null>;
2411
2448
  /** Which way a `/login` went (#1131) — so the event log shows what users actually need. */
2412
2449
  private recordLoginFlow;
@@ -2450,6 +2487,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2450
2487
  chatId: string;
2451
2488
  threadId?: string;
2452
2489
  userId?: string;
2490
+ }, signIn?: {
2491
+ profile?: string;
2453
2492
  }): Promise<string>;
2454
2493
  /** Whether this backend's CLI is on the fleet's PATH (what `/login` installs when it is not). */
2455
2494
  isCliInstalled(backend: string): boolean;
@@ -2566,6 +2605,20 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2566
2605
  /** Forward a message to a classic channel instance with chat log context */
2567
2606
  private forwardToClassicInstance;
2568
2607
  /** Paste raw text directly to a classic instance's CLI (no [user:] wrapping) */
2608
+ /** #1690: our own runtime switches awaiting the daemon's outcome, by id. */
2609
+ private readonly runtimeSwitchWaiters;
2610
+ /**
2611
+ * #1690: type `/model <model>` and wait for what it came to: the daemon answers claude's "Switch model?" for us (Yes
2612
+ * when it names this model, No otherwise) or sees claude's own result. Null when it could not be sent; a timeout is
2613
+ * "not confirmed".
2614
+ */
2615
+ private runRuntimeModelSwitch;
2616
+ /**
2617
+ * #1690: the names claude-code is known to accept, for checking `/model <name>` BEFORE it is typed — claude itself
2618
+ * accepts any string ("Set model to opsu"), and its "Switch model?" then names the typo. Static aliases (with [1m]),
2619
+ * the cached account catalog, the configured model; without a cached catalog, any `claude-…` id too (cannot check).
2620
+ */
2621
+ private claudeModelKnown;
2569
2622
  private pasteRawToClassicInstance;
2570
2623
  /** Resolve the backend name configured for an instance (fleet or classic). */
2571
2624
  private backendNameForInstance;
@@ -2731,6 +2784,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2731
2784
  */
2732
2785
  applyEffort(instanceName: string, requested: string): Promise<string>;
2733
2786
  applyModel(instanceName: string, model: string): Promise<string>;
2787
+ /** Save an instance's model (fleet.yaml, or its ClassicBot channel). False when neither holds it. */
2788
+ private persistInstanceModel;
2734
2789
  /**
2735
2790
  * The trailing "Current effort: …" line for a /model reply.
2736
2791
  *
@@ -2754,6 +2809,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
2754
2809
  private getMissingBackendWarning;
2755
2810
  /** Handle Discord's required static slash choice, warning before a likely startup failure. */
2756
2811
  private handleClassicStartSlash;
2812
+ private handleClassicStartSlashCore;
2757
2813
  /** Present platform-native backend choices, then start on selection or timeout. */
2758
2814
  private beginClassicBackendSelection;
2759
2815
  /** Consume a selection callback. Returns true for all ClassicBot callback IDs, including stale ones. */