@songsid/agend 2.1.6-beta.12 → 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.
@@ -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
@@ -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":