@songsid/agend 2.1.6-beta.6 → 2.1.6-beta.8

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 (51) hide show
  1. package/dist/backend/claude-code.d.ts +25 -0
  2. package/dist/backend/claude-code.js +103 -0
  3. package/dist/backend/claude-code.js.map +1 -1
  4. package/dist/backend/types.d.ts +27 -0
  5. package/dist/backend/types.js.map +1 -1
  6. package/dist/channel/adapters/discord.d.ts +14 -0
  7. package/dist/channel/adapters/discord.js +59 -1
  8. package/dist/channel/adapters/discord.js.map +1 -1
  9. package/dist/channel/adapters/telegram.d.ts +6 -0
  10. package/dist/channel/adapters/telegram.js +36 -0
  11. package/dist/channel/adapters/telegram.js.map +1 -1
  12. package/dist/channel/tool-router.js +20 -1
  13. package/dist/channel/tool-router.js.map +1 -1
  14. package/dist/channel/types.d.ts +18 -0
  15. package/dist/config-validator.js +3 -0
  16. package/dist/config-validator.js.map +1 -1
  17. package/dist/connection-secrets.d.ts +96 -0
  18. package/dist/connection-secrets.js +25 -0
  19. package/dist/connection-secrets.js.map +1 -0
  20. package/dist/daemon.d.ts +38 -0
  21. package/dist/daemon.js +246 -80
  22. package/dist/daemon.js.map +1 -1
  23. package/dist/fleet-manager.d.ts +171 -0
  24. package/dist/fleet-manager.js +954 -5
  25. package/dist/fleet-manager.js.map +1 -1
  26. package/dist/outbound-schemas.js +1 -1
  27. package/dist/outbound-schemas.js.map +1 -1
  28. package/dist/provider-probe.d.ts +3 -0
  29. package/dist/provider-probe.js +12 -2
  30. package/dist/provider-probe.js.map +1 -1
  31. package/dist/provider-secret-registry.d.ts +98 -0
  32. package/dist/provider-secret-registry.js +334 -0
  33. package/dist/provider-secret-registry.js.map +1 -0
  34. package/dist/quickstart-api.d.ts +1 -1
  35. package/dist/quickstart-api.js +14 -4
  36. package/dist/quickstart-api.js.map +1 -1
  37. package/dist/secret-store.d.ts +25 -0
  38. package/dist/secret-store.js +165 -0
  39. package/dist/secret-store.js.map +1 -0
  40. package/dist/settings-api.d.ts +101 -0
  41. package/dist/settings-api.js +404 -4
  42. package/dist/settings-api.js.map +1 -1
  43. package/dist/types.d.ts +2 -0
  44. package/dist/ui/settings.html +171 -6
  45. package/dist/usage/providers.d.ts +8 -6
  46. package/dist/usage/providers.js +83 -9
  47. package/dist/usage/providers.js.map +1 -1
  48. package/dist/usage/usage-api.d.ts +12 -0
  49. package/dist/usage/usage-api.js +55 -0
  50. package/dist/usage/usage-api.js.map +1 -1
  51. package/package.json +1 -1
@@ -21,6 +21,8 @@ import { type AgentEndpointContext } from "./agent-endpoint.js";
21
21
  import { ClassicChannelManager } from "./classic-channel-manager.js";
22
22
  import { type ExplicitInstanceRemoval } from "./instance-removal.js";
23
23
  import type { InstanceState } from "./backend/types.js";
24
+ import { type ConnectionMetadata, type ConnectionBinding, type BindingProbe, type SecretApplyJob, type ProviderSecretApplyJob } from "./connection-secrets.js";
25
+ import { type ProviderSecretStatus } from "./provider-secret-registry.js";
24
26
  import { ApplyJobStore, type ApplyJob, type ApplyTargetKind, type SelfRestartResult } from "./apply-job.js";
25
27
  import { StormWindow } from "./storm-window.js";
26
28
  import { SpawnGate } from "./spawn-gate.js";
@@ -243,6 +245,40 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
243
245
  private ipcReconnectInFlight;
244
246
  private adapterRestarting;
245
247
  private adapterState;
248
+ /** Web Settings secret rotation is deliberately separate from reconnect
249
+ * recovery: a rotation must build a fresh provider client with the new token,
250
+ * and stale callbacks from the old client must not win. */
251
+ private connectionSecretChallenges;
252
+ private connectionSecretChallengesByKey;
253
+ private connectionSecretJobs;
254
+ private connectionSecretJobSession;
255
+ private connectionSecretInFlight;
256
+ private connectionSecretGenerations;
257
+ /** Local epoch that fences a challenge across adapter replacement and
258
+ * provider reconnect generations. The adapter's own generation can reset
259
+ * when a new adapter object is constructed, so keep an independent epoch. */
260
+ private connectionSecretAdapterRefs;
261
+ private connectionSecretHealthGenerations;
262
+ /** Generic API-key verifier/apply state. The challenge scope contains the
263
+ * resolved spec/env key, so a request can never retarget another provider. */
264
+ private providerSecretChallenges;
265
+ private providerSecretChallengesByKey;
266
+ private providerSecretJobs;
267
+ private providerSecretJobSession;
268
+ private providerSecretInFlight;
269
+ private providerSecretGenerations;
270
+ /** Test seam only; production always uses the fixed HTTPS client. */
271
+ private providerSecretHttpClient?;
272
+ /** Code-owned activation hooks; never populated from a request. */
273
+ private providerSecretReloadHooks;
274
+ /** In-memory snapshots for narrow hot consumers (currently Groq voice). */
275
+ private providerSecretHotSnapshots;
276
+ /** Web Settings connection-binding step-up challenges and apply jobs. */
277
+ private connectionBindingChallenges;
278
+ private connectionBindingChallengesByKey;
279
+ private connectionBindingJobs;
280
+ private connectionBindingJobSession;
281
+ private connectionBindingInFlight;
246
282
  private collabInstances;
247
283
  private healthServer;
248
284
  private healthPortRetried;
@@ -255,6 +291,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
255
291
  private fullRestartLauncher;
256
292
  private eventLogPruneTimer;
257
293
  private logRotateTimer;
294
+ private discordPresenceTimer;
295
+ private discordPresenceInFlight;
296
+ private static readonly DISCORD_PRESENCE_REFRESH_MS;
258
297
  /** Days of event/activity history to keep. */
259
298
  private static readonly EVENT_LOG_RETENTION_DAYS;
260
299
  private watchdogTimer;
@@ -344,6 +383,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
344
383
  getSysInfo(): import("./fleet-context.js").SysInfo;
345
384
  /** Load fleet.yaml and build routing table */
346
385
  loadConfig(configPath: string): FleetConfig;
386
+ /**
387
+ * A channel's configurable bot_token_env is an env-key writer too. Refuse
388
+ * an overlap with a registry API key (or a process-reserved key) before the
389
+ * config becomes live; otherwise a Discord token could be written into
390
+ * GROQ_API_KEY by a perfectly valid-looking rotation request.
391
+ */
392
+ private assertProviderSecretEnvKeys;
347
393
  /** User-authored fleet.yaml, before defaults are merged into instances. */
348
394
  getRawFleetConfig(): RawFleetConfig;
349
395
  /** Build topic routing table: { topicId -> RouteTarget } */
@@ -631,6 +677,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
631
677
  private startUpdateProgressMonitor;
632
678
  /** Start all instances from fleet config */
633
679
  startAll(configPath: string): Promise<void>;
680
+ /** Keep Discord profile activity aligned with the same cached usage source as /usage. */
681
+ private startDiscordUsagePresence;
682
+ private refreshDiscordUsagePresence;
634
683
  /**
635
684
  * Delete inbox files older than retentionDays (by mtime). Cleans the shared
636
685
  * inbox (`<dataDir>/inbox`) and every workspace inbox
@@ -1752,6 +1801,128 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1752
1801
  private postSelfRestartNotice;
1753
1802
  /** Jobs outlive this process on purpose; see apply-job.ts. */
1754
1803
  get applyJobs(): ApplyJobStore;
1804
+ /** The only channel metadata exposed to the Settings secret UI. */
1805
+ listSecureConnections(): ConnectionMetadata[];
1806
+ private secureConnectionChannel;
1807
+ private secureConnectionGeneration;
1808
+ /** Provider API-key rows exposed to Settings (never the env key or secret). */
1809
+ providerSecretsEnabled(): boolean;
1810
+ listProviderSecrets(): ProviderSecretStatus[];
1811
+ private providerSecretStaleConsumers;
1812
+ private providerSecretGeneration;
1813
+ private providerSecretEnvAllowed;
1814
+ verifyProviderSecret(input: {
1815
+ specId: string;
1816
+ secret: string;
1817
+ sessionBinding: string;
1818
+ idempotencyKey: string;
1819
+ }): Promise<{
1820
+ ok: true;
1821
+ verification_id: string;
1822
+ expires_at: number;
1823
+ spec_id: string;
1824
+ activation: "next_use" | "reload_hook";
1825
+ } | {
1826
+ ok: false;
1827
+ status: "unsupported_verifier" | "provider_rejected" | "provider_unavailable" | "invalid";
1828
+ error: string;
1829
+ }>;
1830
+ /** Naming aliases used by integrations that call this an API-key operation. */
1831
+ verifyProviderApiKey(input: Parameters<FleetManager["verifyProviderSecret"]>[0]): ReturnType<FleetManager["verifyProviderSecret"]>;
1832
+ startProviderSecretApply(input: {
1833
+ specId: string;
1834
+ verificationId: string;
1835
+ sessionBinding: string;
1836
+ idempotencyKey: string;
1837
+ }): {
1838
+ job: ProviderSecretApplyJob;
1839
+ reused: boolean;
1840
+ } | {
1841
+ busy: ProviderSecretApplyJob | null;
1842
+ } | {
1843
+ error: string;
1844
+ };
1845
+ startProviderApiKeyApply(input: Parameters<FleetManager["startProviderSecretApply"]>[0]): ReturnType<FleetManager["startProviderSecretApply"]>;
1846
+ getProviderSecretApply(jobId: string, sessionBinding: string): ProviderSecretApplyJob | null;
1847
+ getProviderApiKeyApply(jobId: string, sessionBinding: string): ProviderSecretApplyJob | null;
1848
+ private runProviderSecretApply;
1849
+ /** Groq is currently read from process.env per voice request, so the hook is
1850
+ * intentionally a no-op. Keeping it as a named code-owned hook makes the
1851
+ * hot activation contract explicit and gives tests a failure seam; no generic
1852
+ * SIGHUP or caller-provided hook is ever executed. */
1853
+ private runProviderSecretReloadHook;
1854
+ private normalizeConnectionBinding;
1855
+ private connectionBindingChannelConfig;
1856
+ /** Verify a prospective group/guild binding without mutating fleet state. */
1857
+ verifyConnectionBinding(input: {
1858
+ connectionId: string;
1859
+ binding: {
1860
+ group_id?: unknown;
1861
+ general_channel_id?: unknown;
1862
+ };
1863
+ sessionBinding: string;
1864
+ idempotencyKey: string;
1865
+ }): Promise<{
1866
+ ok: true;
1867
+ verification_id: string;
1868
+ expires_at: number;
1869
+ binding: ConnectionBinding;
1870
+ probe: BindingProbe;
1871
+ } | {
1872
+ ok: false;
1873
+ error: string;
1874
+ }>;
1875
+ startConnectionBindingApply(input: {
1876
+ connectionId: string;
1877
+ verificationId: string;
1878
+ sessionBinding: string;
1879
+ idempotencyKey: string;
1880
+ }): {
1881
+ job: SecretApplyJob;
1882
+ reused: boolean;
1883
+ } | {
1884
+ busy: SecretApplyJob | null;
1885
+ } | {
1886
+ error: string;
1887
+ };
1888
+ getConnectionBindingApply(jobId: string, sessionBinding: string): SecretApplyJob | null;
1889
+ private runConnectionBindingApply;
1890
+ /** Stop, rebuild and wait for a new adapter before committing YAML binding. */
1891
+ private rebuildAdapterForBinding;
1892
+ verifyConnectionSecret(input: {
1893
+ connectionId: string;
1894
+ secret: string;
1895
+ sessionBinding: string;
1896
+ idempotencyKey: string;
1897
+ }): Promise<{
1898
+ ok: true;
1899
+ verification_id: string;
1900
+ expires_at: number;
1901
+ identity?: {
1902
+ id: string | null;
1903
+ username: string | null;
1904
+ };
1905
+ } | {
1906
+ ok: false;
1907
+ error: string;
1908
+ }>;
1909
+ startConnectionSecretApply(input: {
1910
+ connectionId: string;
1911
+ verificationId: string;
1912
+ sessionBinding: string;
1913
+ idempotencyKey: string;
1914
+ }): {
1915
+ job: SecretApplyJob;
1916
+ reused: boolean;
1917
+ } | {
1918
+ busy: SecretApplyJob | null;
1919
+ } | {
1920
+ error: string;
1921
+ };
1922
+ getConnectionSecretApply(jobId: string, sessionBinding: string): SecretApplyJob | null;
1923
+ private runConnectionSecretApply;
1924
+ /** Stop the old provider client and construct a new one from process.env. */
1925
+ private rebuildAdapterForSecret;
1755
1926
  /**
1756
1927
  * What a reconcile is about to do, per target.
1757
1928
  *