@songsid/agend 2.1.8-beta.2 → 2.1.8-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 (44) hide show
  1. package/dist/agent-cli.js +14 -0
  2. package/dist/agent-cli.js.map +1 -1
  3. package/dist/agent-endpoint.d.ts +4 -1
  4. package/dist/agent-endpoint.js +10 -1
  5. package/dist/agent-endpoint.js.map +1 -1
  6. package/dist/backend/cli-env-probe-worker.d.ts +1 -0
  7. package/dist/backend/cli-env-probe-worker.js +25 -0
  8. package/dist/backend/cli-env-probe-worker.js.map +1 -0
  9. package/dist/backend/muse.js +30 -2
  10. package/dist/backend/muse.js.map +1 -1
  11. package/dist/backend/types.d.ts +12 -1
  12. package/dist/backend/types.js +14 -3
  13. package/dist/backend/types.js.map +1 -1
  14. package/dist/channel/adapters/discord.d.ts +16 -4
  15. package/dist/channel/adapters/discord.js +20 -5
  16. package/dist/channel/adapters/discord.js.map +1 -1
  17. package/dist/channel/mcp-tools.js +6 -0
  18. package/dist/channel/mcp-tools.js.map +1 -1
  19. package/dist/daemon.d.ts +2 -0
  20. package/dist/daemon.js +24 -18
  21. package/dist/daemon.js.map +1 -1
  22. package/dist/fleet-context.d.ts +5 -0
  23. package/dist/fleet-context.js.map +1 -1
  24. package/dist/fleet-manager.d.ts +66 -11
  25. package/dist/fleet-manager.js +430 -61
  26. package/dist/fleet-manager.js.map +1 -1
  27. package/dist/general-knowledge/skills/persona-emoji/SKILL.md +52 -0
  28. package/dist/locale.js +18 -0
  29. package/dist/locale.js.map +1 -1
  30. package/dist/outbound-schemas.d.ts +21 -4
  31. package/dist/outbound-schemas.js +12 -0
  32. package/dist/outbound-schemas.js.map +1 -1
  33. package/dist/settings-api.d.ts +6 -8
  34. package/dist/settings-api.js +9 -4
  35. package/dist/settings-api.js.map +1 -1
  36. package/dist/status-emojis.d.ts +19 -0
  37. package/dist/status-emojis.js.map +1 -1
  38. package/dist/tool-permissions.js +8 -2
  39. package/dist/tool-permissions.js.map +1 -1
  40. package/dist/topic-commands.d.ts +9 -0
  41. package/dist/topic-commands.js +41 -2
  42. package/dist/topic-commands.js.map +1 -1
  43. package/dist/ui/settings.html +23 -11
  44. package/package.json +1 -1
@@ -6,6 +6,7 @@ import type { Logger } from "./logger.js";
6
6
  import type { CostGuard } from "./cost-guard.js";
7
7
  import type { ClassicChannelManager } from "./classic-channel-manager.js";
8
8
  import type { ExplicitInstanceRemoval } from "./instance-removal.js";
9
+ import type { BackendCliVersionSnapshot } from "./backend/types.js";
9
10
  export type RouteTarget = {
10
11
  kind: "instance";
11
12
  name: string;
@@ -68,6 +69,10 @@ export interface FleetContext {
68
69
  /** Classic-bot channels (defined in classicBot.yaml, not fleet.yaml instances). */
69
70
  readonly classicChannels: ClassicChannelManager | null;
70
71
  getSysInfo(): SysInfo;
72
+ /** Read cached CLI versions without triggering a probe. */
73
+ getBackendCliVersionSnapshot?(): BackendCliVersionSnapshot;
74
+ /** Refresh stale/missing CLI versions after the sysinfo reply has been sent. */
75
+ refreshBackendCliVersions?(): void;
71
76
  getInstanceStatus(name: string): "running" | "paused" | "stopped" | "crashed";
72
77
  /** Current cancellation epoch stamped onto direct daemon IPC deliveries. */
73
78
  getDeliveryEpoch?(name: string): number;
@@ -1 +1 @@
1
- {"version":3,"file":"fleet-context.js","sourceRoot":"","sources":["../src/fleet-context.ts"],"names":[],"mappings":"AAiCA,MAAM,UAAU,sBAAsB,CAAC,MAAmB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC;AACpC,CAAC"}
1
+ {"version":3,"file":"fleet-context.js","sourceRoot":"","sources":["../src/fleet-context.ts"],"names":[],"mappings":"AAkCA,MAAM,UAAU,sBAAsB,CAAC,MAAmB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC;AACpC,CAAC"}
@@ -1,13 +1,14 @@
1
1
  import { type FleetMemory } from "./process-memory.js";
2
2
  import { ReplyDeduper } from "./reply-dedup.js";
3
3
  import type { FleetConfig, RawFleetConfig, InstanceConfig } from "./types.js";
4
- import { type DeliveryStatus, type ResolvedStatusEmojis } from "./status-emojis.js";
4
+ import { type DeliveryStatus, type GuildEmoji, type GuildEmojiGroup, type ResolvedStatusEmojis } from "./status-emojis.js";
5
5
  import { type RouteTarget } from "./fleet-context.js";
6
6
  import { EventLog } from "./event-log.js";
7
7
  import { AdapterWorld } from "./adapter-world.js";
8
8
  import { CostGuard } from "./cost-guard.js";
9
9
  import { IpcClient } from "./channel/ipc-bridge.js";
10
10
  import type { AdapterHealthSnapshot, ChannelAdapter, InboundReaction } from "./channel/types.js";
11
+ import { type BackendCliVersionSnapshot } from "./backend/types.js";
11
12
  import { type Logger } from "./logger.js";
12
13
  import { Scheduler } from "./scheduler/index.js";
13
14
  import type { FleetContext } from "./fleet-context.js";
@@ -960,6 +961,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
960
961
  */
961
962
  private refuseTypedIpc;
962
963
  private dispatchTypedIpc;
964
+ /** `list_emojis` / `set_persona_emoji` / `preview_emojis` over IPC; the agent endpoint calls the same methods. */
965
+ private handlePersonaEmoji;
963
966
  private handleScheduleCrud;
964
967
  private handleDecisionCrud;
965
968
  /** Resolve display name for an instance, fallback to instance name. */
@@ -987,6 +990,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
987
990
  handleDecisionCrudHttp(instance: string, op: string, args: Record<string, unknown>): Promise<unknown>;
988
991
  handleTaskCrudHttp(instance: string, args: Record<string, unknown>): Promise<unknown>;
989
992
  handleSetDisplayNameHttp(instance: string, name: string): Promise<unknown>;
993
+ handleListEmojisHttp(instance: string, refresh: boolean): Promise<unknown>;
994
+ handleSetPersonaEmojiHttp(instance: string, args: Record<string, unknown>): Promise<unknown>;
995
+ handlePreviewEmojisHttp(instance: string, args: Record<string, unknown>): Promise<unknown>;
990
996
  handleSetDescriptionHttp(instance: string, description: string): Promise<unknown>;
991
997
  private summarizeToolCall;
992
998
  private handleTaskCrud;
@@ -1077,6 +1083,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1077
1083
  private deliveryStatusChains;
1078
1084
  /** #725: in-flight CLI env probes, keyed by backend name. Coalesces concurrent /model requests. */
1079
1085
  private pendingCliEnvProbes;
1086
+ /** Forced vendor catalog refreshes are separate flights, but sysinfo joins either flight. */
1087
+ private pendingVendorCliEnvProbes;
1080
1088
  /**
1081
1089
  * The status emojis for an instance (#1005): its own `status_emojis`, then
1082
1090
  * its channel's `options.status_emojis`, then the platform built-in. An
@@ -1088,27 +1096,67 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1088
1096
  };
1089
1097
  private warnedStatusEmojis;
1090
1098
  /**
1091
- * A Discord connection's server emojis for the Settings picker (#1005).
1092
- * Cached per connection — a server's emoji set changes rarely — and one
1093
- * fetch at a time; `refresh` forces a new one. Uses the running adapter, so
1094
- * the bot token never leaves the server.
1099
+ * A Discord connection's server emojis for the Settings picker (#1005), from
1100
+ * every server its bot can draw on (#1021): the primary `group_id` server,
1101
+ * then each other server the bot is a member of that ClassicBot's
1102
+ * `allowed_guilds` admits (unset = all, as for classic routing). A bot can
1103
+ * react with a custom emoji from any server it is in. Cached per server — a
1104
+ * server's emoji set changes rarely — and one fetch per server at a time;
1105
+ * `refresh` forces new ones. One server refusing (e.g. Missing Access) is
1106
+ * reported on that server and does not hide the others. Uses the running
1107
+ * adapter, so the bot token never leaves the server.
1095
1108
  */
1096
1109
  listGuildEmojis(channelId: string, refresh?: boolean): Promise<{
1097
1110
  ok: true;
1098
1111
  fetched_at: number;
1099
- emojis: Array<{
1100
- id: string;
1101
- name: string;
1102
- animated: boolean;
1103
- available: boolean;
1104
- }>;
1112
+ emojis: GuildEmoji[];
1113
+ guilds: GuildEmojiGroup[];
1105
1114
  } | {
1106
1115
  ok: false;
1107
1116
  error: string;
1108
1117
  }>;
1109
1118
  private static GUILD_EMOJI_TTL_MS;
1119
+ /** Keyed `<connection>\0<server id>`. */
1110
1120
  private guildEmojiCache;
1111
1121
  private guildEmojiFetches;
1122
+ /**
1123
+ * What `instanceName` may pick as its persona emoji (the `list_emojis`
1124
+ * tool): its current status set with where each value comes from, the
1125
+ * standard emojis its platform takes, and on Discord the server emojis its
1126
+ * bot can draw on — the same lists, and the same resolution, as the
1127
+ * Settings picker (#1005/#1021), so an agent and an operator see one truth.
1128
+ */
1129
+ listEmojisFor(instanceName: string, refresh?: boolean): Promise<Record<string, unknown>>;
1130
+ /**
1131
+ * `preview_emojis` (#1040): download a few Discord server emojis so an agent
1132
+ * can look at them before it picks one — a name and an id say nothing about
1133
+ * what an emoji looks like. The fleet fetches, not the agent (not every
1134
+ * backend can), and returns a local path per emoji to Read, as
1135
+ * download_attachment does for an attachment.
1136
+ *
1137
+ * SSRF-safe by construction: nothing from the caller reaches a URL. The
1138
+ * caller names emojis; each must be an available one in a server this bot
1139
+ * can draw on (the list set_persona_emoji checks), and the CDN URL is built
1140
+ * from that listed emoji's numeric id. Static PNG, size-capped, cached by id.
1141
+ */
1142
+ previewEmojis(instanceName: string, args: Record<string, unknown>): Promise<Record<string, unknown>>;
1143
+ private static EMOJI_PREVIEW_MAX;
1144
+ private static EMOJI_PREVIEW_MAX_BYTES;
1145
+ private static EMOJI_PREVIEW_TTL_MS;
1146
+ /** One emoji's static PNG under the inbox, reused while fresh; stale ones are pruned. */
1147
+ private fetchEmojiPreview;
1148
+ /**
1149
+ * `set_persona_emoji`: `instanceName` sets one of its own status emojis —
1150
+ * `delivered` unless it names another — in its per-instance `status_emojis`
1151
+ * override (#1005 addendum 2), so its stamp is told apart from other bots'
1152
+ * on a shared message. The value is judged exactly as Settings and the
1153
+ * react path judge it (statusEmojiProblem on the instance's platform), and
1154
+ * a Discord server emoji must be one its bot can use: an emoji from a
1155
+ * server it is not in would be stored, preview fine, and fail every react.
1156
+ * An empty emoji removes that status's override.
1157
+ */
1158
+ setPersonaEmoji(instanceName: string, args: Record<string, unknown>): Promise<Record<string, unknown>>;
1159
+ private personaEmojiMissing;
1112
1160
  /** What the instructions tell `instanceName` not to react with (its own status set). */
1113
1161
  statusEmojiAvoidList(instanceName: string): string[];
1114
1162
  /** The progress bubble's leading emoji, in the form the channel renders. */
@@ -1711,6 +1759,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1711
1759
  private cliEnvPath;
1712
1760
  /** Read the cached CLI env for a backend, or null if missing/stale/unparseable. */
1713
1761
  private readCliEnv;
1762
+ /** Return cached CLI versions immediately. Refresh is started after /sysinfo is sent. */
1763
+ getBackendCliVersionSnapshot(): BackendCliVersionSnapshot;
1764
+ /** Called only after the user-visible sysinfo send/respond has settled. */
1765
+ refreshBackendCliVersions(): void;
1714
1766
  /** True when a cached CLI env is old enough that `/model` should re-probe. */
1715
1767
  private cliEnvNeedsRefresh;
1716
1768
  /**
@@ -1719,6 +1771,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1719
1771
  * previous list, never stall the command that asked for it.
1720
1772
  */
1721
1773
  private probeBackendBounded;
1774
+ private startCliEnvProbeWorker;
1722
1775
  /**
1723
1776
  * Resolve the effective model for a fleet or ClassicBot instance, plus where it
1724
1777
  * came from. Single source of truth for `/model` and `/ctx` — precedence:
@@ -1745,6 +1798,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1745
1798
  * the old list off as fresh.
1746
1799
  */
1747
1800
  private probeBackend;
1801
+ /** Preserve the existing cache merge rules for both in-process and worker probes. */
1802
+ private persistCliEnvProbeResult;
1748
1803
  /** Background-probe every distinct backend in use at startup (non-blocking). */
1749
1804
  private probeCliEnvs;
1750
1805
  /** Best-effort model list for `/model`: cached CLI env first, else live probe. Never throws. */