@songsid/agend 2.1.6-beta.11 → 2.1.6-beta.13

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 (39) hide show
  1. package/README.md +22 -0
  2. package/dist/backend/codex-session.d.ts +45 -0
  3. package/dist/backend/codex-session.js +202 -0
  4. package/dist/backend/codex-session.js.map +1 -0
  5. package/dist/backend/codex.d.ts +48 -12
  6. package/dist/backend/codex.js +700 -65
  7. package/dist/backend/codex.js.map +1 -1
  8. package/dist/backend/kiro.d.ts +9 -0
  9. package/dist/backend/kiro.js +129 -0
  10. package/dist/backend/kiro.js.map +1 -1
  11. package/dist/backend/muse.d.ts +9 -4
  12. package/dist/backend/muse.js +89 -34
  13. package/dist/backend/muse.js.map +1 -1
  14. package/dist/backend/types.d.ts +25 -1
  15. package/dist/backend/types.js.map +1 -1
  16. package/dist/cli.js +23 -1
  17. package/dist/cli.js.map +1 -1
  18. package/dist/daemon.d.ts +41 -7
  19. package/dist/daemon.js +546 -91
  20. package/dist/daemon.js.map +1 -1
  21. package/dist/fleet-manager.d.ts +11 -1
  22. package/dist/fleet-manager.js +57 -3
  23. package/dist/fleet-manager.js.map +1 -1
  24. package/dist/instance-lifecycle.d.ts +7 -0
  25. package/dist/instance-lifecycle.js +126 -2
  26. package/dist/instance-lifecycle.js.map +1 -1
  27. package/dist/locale.js +6 -0
  28. package/dist/locale.js.map +1 -1
  29. package/dist/muse-usage-relay.js +14 -2
  30. package/dist/muse-usage-relay.js.map +1 -1
  31. package/dist/tmux-manager.d.ts +2 -0
  32. package/dist/tmux-manager.js +20 -0
  33. package/dist/tmux-manager.js.map +1 -1
  34. package/dist/usage/providers.js +10 -2
  35. package/dist/usage/providers.js.map +1 -1
  36. package/dist/usage/usage-api.d.ts +0 -12
  37. package/dist/usage/usage-api.js +24 -3
  38. package/dist/usage/usage-api.js.map +1 -1
  39. package/package.json +2 -1
@@ -1128,6 +1128,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1128
1128
  * would have to make this async and change every caller.
1129
1129
  */
1130
1130
  notifyInstanceTopic(instanceName: string, text: string, extraOpts?: import("./channel/types.js").SendOpts): boolean;
1131
+ /** A migration debt is retired only after the platform accepted the send. */
1132
+ notifyInstanceTopicConfirmed(instanceName: string, text: string): Promise<boolean>;
1131
1133
  /**
1132
1134
  * Post decision buttons whose callback ids are `<prefix><nonce>:<action>`.
1133
1135
  * The entry is registered before the send and rolled back if the send
@@ -1676,7 +1678,15 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1676
1678
  private customProviderFor;
1677
1679
  /** Ask a backend for its catalog using ONE instance's real config. Never throws. */
1678
1680
  private instanceScopedModels;
1679
- /** Account-wide catalog: probe cache first, live probe on miss. */
1681
+ /**
1682
+ * Account-wide catalog: probe cache first, live probe when the cache is
1683
+ * missing or older than the same ~1h window `/model` uses (#888).
1684
+ *
1685
+ * Previously this served anything inside the 24h hard TTL, so `list_models`
1686
+ * could answer with a day-old list `/model` had already re-probed past.
1687
+ * The probe runs under the same deadline `/model` uses: a vendor that stops
1688
+ * answering degrades to the previous list, never stalls the tool call.
1689
+ */
1680
1690
  private globalModelCatalog;
1681
1691
  /** `/model` slash handler (admin only). No arg → DC menu; `/model <name>` → apply directly. */
1682
1692
  /** Label an effort choice, marking the one currently configured. */
@@ -6857,6 +6857,43 @@ export class FleetManager {
6857
6857
  this.logger.warn({ instanceName }, "No postable target — instance topic notification not sent");
6858
6858
  return false;
6859
6859
  }
6860
+ /** A migration debt is retired only after the platform accepted the send. */
6861
+ async notifyInstanceTopicConfirmed(instanceName, text) {
6862
+ const adapter = this.getAdapterForInstance(instanceName) ?? this.adapter;
6863
+ if (!adapter)
6864
+ return false;
6865
+ const channelCfg = this.getChannelConfig(this.getInstanceAdapterId(instanceName));
6866
+ const groupId = channelCfg?.group_id;
6867
+ const threadId = this.fleetConfig?.instances[instanceName]?.topic_id;
6868
+ let chatId;
6869
+ let opts;
6870
+ if (threadId != null && groupId) {
6871
+ chatId = String(groupId);
6872
+ opts = { threadId: String(threadId) };
6873
+ }
6874
+ else {
6875
+ const classicChatId = this.classicChannels?.getChannelIdByInstance(instanceName);
6876
+ if (classicChatId)
6877
+ chatId = classicChatId;
6878
+ else {
6879
+ const target = this.fleetNoticeTarget(this.getInstanceAdapterId(instanceName));
6880
+ if (!target)
6881
+ return false;
6882
+ chatId = target.chatId;
6883
+ opts = target.opts;
6884
+ }
6885
+ }
6886
+ try {
6887
+ await adapter.sendText(chatId, text, opts);
6888
+ return true;
6889
+ }
6890
+ catch {
6891
+ // Provider transport errors can include credential-bearing URLs. This
6892
+ // notice is diagnostic only; never put the raw error into a fleet log.
6893
+ this.logger.warn({ instanceName }, "Codex upgrade notice was not delivered — pending for retry");
6894
+ return false;
6895
+ }
6896
+ }
6860
6897
  // ── Nonce-armed button prompts (hang / assist / exit / clear) ──
6861
6898
  //
6862
6899
  // One shared lifecycle for every "notification with decision buttons":
@@ -10056,17 +10093,25 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
10056
10093
  return [];
10057
10094
  }
10058
10095
  }
10059
- /** Account-wide catalog: probe cache first, live probe on miss. */
10096
+ /**
10097
+ * Account-wide catalog: probe cache first, live probe when the cache is
10098
+ * missing or older than the same ~1h window `/model` uses (#888).
10099
+ *
10100
+ * Previously this served anything inside the 24h hard TTL, so `list_models`
10101
+ * could answer with a day-old list `/model` had already re-probed past.
10102
+ * The probe runs under the same deadline `/model` uses: a vendor that stops
10103
+ * answering degrades to the previous list, never stalls the tool call.
10104
+ */
10060
10105
  async globalModelCatalog(backend) {
10061
10106
  const cached = this.readCliEnv(backend);
10062
- if (cached?.models?.length) {
10107
+ if (cached?.models?.length && !this.cliEnvNeedsRefresh(cached)) {
10063
10108
  return {
10064
10109
  backend, scope: "global", current_model: cached.currentModel ?? null,
10065
10110
  models: cached.models, source: "cache",
10066
10111
  probed_at: new Date(cached.probedAt).toISOString(),
10067
10112
  };
10068
10113
  }
10069
- const env = await this.probeBackend(backend);
10114
+ const env = await this.probeBackendBounded(backend);
10070
10115
  if (env?.models?.length) {
10071
10116
  return {
10072
10117
  backend, scope: "global", current_model: env.currentModel ?? null,
@@ -10074,6 +10119,15 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
10074
10119
  probed_at: new Date(env.probedAt).toISOString(),
10075
10120
  };
10076
10121
  }
10122
+ // Probe failed or timed out: like `/model`, the previous list is still the
10123
+ // best answer — a stale list beats an empty one.
10124
+ if (cached?.models?.length) {
10125
+ return {
10126
+ backend, scope: "global", current_model: cached.currentModel ?? null,
10127
+ models: cached.models, source: "cache",
10128
+ probed_at: new Date(cached.probedAt).toISOString(),
10129
+ };
10130
+ }
10077
10131
  // Reported rather than thrown: "we could not enumerate" is a useful answer,
10078
10132
  // and the caller can still set a model by name (AgEnD passes it through).
10079
10133
  return {