@openclaw/discord 2026.10.5 → 2026.10.10-beta.2

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 (64) hide show
  1. package/dist/.setup/{approval-handler.runtime-D88-QVlO.mjs → approval-handler.runtime-BvF8oUpa.mjs} +9 -9
  2. package/dist/.setup/{approval-message-updates-CIGByUcE.mjs → approval-message-updates-wbUqLtLI.mjs} +2 -2
  3. package/dist/.setup/{audit-TGIPL0f_.mjs → audit-UwzCdDJk.mjs} +3 -3
  4. package/dist/.setup/{channel-C24afwHP.mjs → channel-BlvyeRAu.mjs} +72 -49
  5. package/dist/.setup/{channel.setup-B3KEh05g.mjs → channel.setup-By7wNopw.mjs} +1 -1
  6. package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-D78sAoOz.mjs} +1 -1
  7. package/dist/.setup/{components-HN9052L1.mjs → components-C_cuoW1q.mjs} +1 -1
  8. package/dist/.setup/conversation-binding-route-fdYsXexV.mjs +68 -0
  9. package/dist/.setup/{discord-BGqgx-yd.mjs → discord-Cl2OPTZ6.mjs} +18 -14
  10. package/dist/.setup/{doctor-9Ka20lDD.mjs → doctor-94GSI6lY.mjs} +2 -2
  11. package/dist/.setup/{handle-action-CsQmpfGZ.mjs → handle-action-0-FZD3Am.mjs} +7 -7
  12. package/dist/.setup/{handle-action.guild-admin-Aw-vutu3.mjs → handle-action.guild-admin-DfAWANBE.mjs} +2 -2
  13. package/dist/.setup/{message-handler-C_BQFYCW.mjs → message-handler-CtR2w7W_.mjs} +4 -4
  14. package/dist/.setup/{message-handler.preflight-C_xFOxPN.mjs → message-handler.preflight-BqUw7LWb.mjs} +11 -10
  15. package/dist/.setup/{message-handler.preflight-pluralkit-CfRsEwg4.mjs → message-handler.preflight-pluralkit-BU9I_X-b.mjs} +4 -6
  16. package/dist/.setup/{message-handler.process-_np9if7z.mjs → message-handler.process-BZeWmSNC.mjs} +40 -50
  17. package/dist/.setup/{outbound-adapter-L3UDoMOG.mjs → outbound-adapter-DBwgKemw.mjs} +5 -5
  18. package/dist/.setup/{outbound-session-route-iwnu6IK8.mjs → outbound-session-route-CsHHPxsQ.mjs} +24 -7
  19. package/dist/.setup/{provider-CbmXLYrW.mjs → provider-DUTsZJHz.mjs} +230 -205
  20. package/dist/.setup/{provider-session.runtime-BMOuDbod.mjs → provider-session.runtime-Ucr3XodI.mjs} +3 -3
  21. package/dist/.setup/provider.runtime-J8NuMCNs.mjs +1 -0
  22. package/dist/.setup/{realtime-session.runtime-YCumnRSE.mjs → realtime-session.runtime-bNnPOKP_.mjs} +161 -150
  23. package/dist/.setup/{receive-recovery-eVmK2_hl.mjs → receive-recovery-CKvaG2Hf.mjs} +4 -25
  24. package/dist/.setup/{runtime-DPm3gZXk.mjs → runtime-Cg5pIBm_.mjs} +1 -1
  25. package/dist/.setup/{runtime-CRTkKU1G.mjs → runtime-DE6W14G3.mjs} +7 -7
  26. package/dist/.setup/{send-DbILKgcm.mjs → send-yR1hfybW.mjs} +26 -12
  27. package/dist/.setup/{send.components-FxOS3CeP.mjs → send.components--dxMjc2O.mjs} +5 -5
  28. package/dist/.setup/{send.outbound-_jx4Xpd3.mjs → send.outbound-B5vQwgUK.mjs} +10 -4
  29. package/dist/.setup/{send.receipt-BAlzXd8e.mjs → send.receipt-eE3zLTDH.mjs} +3 -9
  30. package/dist/.setup/{send.shared-CjQ4jbMA.mjs → send.shared-iGf1rqAm.mjs} +4 -3
  31. package/dist/.setup/setup-plugin-api-DVpA_yqS.mjs +2 -0
  32. package/dist/.setup/{shared-C027f-lL.mjs → shared-DgzLizSt.mjs} +1 -1
  33. package/dist/.setup/{subagent-hooks-CME7dSGf.mjs → subagent-hooks-tBtaqWkD.mjs} +21 -12
  34. package/dist/.setup/{system-events-BwwSDCw4.mjs → system-events-DGsxf-l9.mjs} +1 -1
  35. package/dist/.setup/{target-resolver-Bse8fuTi.mjs → target-resolver-BFOKmBni.mjs} +1 -1
  36. package/dist/.setup/{targets-DZJjkzwv.mjs → targets-UbCpek5o.mjs} +1 -1
  37. package/dist/.setup/{thread-bindings-0hPTSK14.mjs → thread-bindings-Dsc3zsrI.mjs} +29 -7
  38. package/dist/.setup/{thread-bindings.manager-CdNa6UIs.mjs → thread-bindings.manager-BMpmKLQh.mjs} +63 -19
  39. package/dist/.setup/{thread-bindings.session-updates-DGSljVf6.mjs → thread-bindings.session-updates-BMdJeJMc.mjs} +39 -122
  40. package/dist/.setup/{threading-BWz5lW0p.mjs → threading-Cg_QRc8s.mjs} +2 -2
  41. package/dist/.setup/{transcripts-source-EMrQb132.mjs → transcripts-source-fRvFsZng.mjs} +12 -17
  42. package/dist/.setup/{voice-runtime-BFEBhf2B.mjs → voice-runtime-DHDNu0fz.mjs} +73 -120
  43. package/dist/action-runtime-api.js +1 -1
  44. package/dist/activities-api.js +3 -3
  45. package/dist/api.js +11 -11
  46. package/dist/channel-plugin-api.js +1 -1
  47. package/dist/runtime-api.js +15 -15
  48. package/dist/setup-entry.js +1 -1
  49. package/dist/setup-plugin-api.js +1 -1
  50. package/dist/src/voice/audio-worker.runtime.js +8 -11
  51. package/dist/subagent-hooks-api.js +1 -1
  52. package/dist/transcripts-source-api.js +1 -1
  53. package/node_modules/mdast-util-from-markdown/dev/lib/index.js +152 -45
  54. package/node_modules/mdast-util-from-markdown/dev/lib/types.d.ts +26 -0
  55. package/node_modules/mdast-util-from-markdown/lib/index.js +133 -40
  56. package/node_modules/mdast-util-from-markdown/lib/types.d.ts +26 -0
  57. package/node_modules/mdast-util-from-markdown/package.json +6 -7
  58. package/node_modules/mdast-util-from-markdown/readme.md +15 -1
  59. package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
  60. package/node_modules/typebox/package.json +1 -1
  61. package/package.json +6 -6
  62. package/dist/.setup/conversation-binding-route-r4XyytCE.mjs +0 -51
  63. package/dist/.setup/provider.runtime-1yN_05AK.mjs +0 -1
  64. package/dist/.setup/setup-plugin-api-BFl2FljJ.mjs +0 -2
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
2
  import { D as getDiscordEndpointRuntime, O as resolveDiscordEndpointAttachmentGuard, T as parseDiscordRetryAfterBodySeconds } from "./allow-list-B_ToXtew.mjs";
3
- import { C as hasAnyChannelPermissionDiscord, D as createDiscordMessageNonce, I as resolveDiscordClientAccountContext, L as resolveDiscordRest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, R as DISCORD_REST_TIMEOUT_MS, S as hasAllGuildPermissionsDiscord, _ as canManageGuildMemberRoleDiscord, a as normalizeEmojiName, b as fetchChannelPermissionsDiscord, c as resolveChannelId, d as sendDiscordChunks, g as DiscordSendError, h as DISCORD_MAX_STICKER_BYTES, j as resolveDiscordSuppressEmbeds, m as DISCORD_MAX_EVENT_COVER_BYTES, n as buildDiscordTextChunks, o as normalizeReactionEmoji, p as DISCORD_MAX_EMOJI_BYTES, r as buildReactionIdentifier, t as buildDiscordSendError, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, x as fetchMemberGuildPermissionsDiscord, y as canViewDiscordGuildChannel } from "./send.shared-CjQ4jbMA.mjs";
4
- import { B as readDiscordCode, H as readRetryAfter, L as DiscordError, R as RateLimitError, V as readDiscordMessage, W as withDiscordRequestAuthority, _t as getGuildMember, at as deleteOwnMessageReaction, bt as stripUndefinedFields, ct as createThread, dt as getChannel, ft as getChannelMessage, gt as getGuild, ht as unpinChannelMessage, it as createOwnMessageReaction, lt as deleteChannelMessage, mt as pinChannelMessage, ot as listMessageReactionUsers, ut as editChannelMessage, vt as getGuildVoiceState, yt as listGuildEmojis, z as isUnknownDiscordVoiceStateError } from "./discord-BGqgx-yd.mjs";
5
- import { _ as recordDiscordMessageCreateAmbiguity, a as createReusableDiscordReplyReference, h as createDiscordRetryRunner, m as classifyDiscordDeliveryFailure, n as createDiscordSendReceiptFromResults, o as resolveDiscordReplyMessageId, r as createDiscordSendResult, v as chunkDiscordTextWithMode } from "./send.receipt-BAlzXd8e.mjs";
3
+ import { C as hasAnyChannelPermissionDiscord, D as createDiscordMessageNonce, I as resolveDiscordClientAccountContext, L as resolveDiscordRest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, R as DISCORD_REST_TIMEOUT_MS, S as hasAllGuildPermissionsDiscord, _ as canManageGuildMemberRoleDiscord, a as normalizeEmojiName, b as fetchChannelPermissionsDiscord, c as resolveChannelId, d as sendDiscordChunks, g as DiscordSendError, h as DISCORD_MAX_STICKER_BYTES, j as resolveDiscordSuppressEmbeds, m as DISCORD_MAX_EVENT_COVER_BYTES, n as buildDiscordTextChunks, o as normalizeReactionEmoji, p as DISCORD_MAX_EMOJI_BYTES, r as buildReactionIdentifier, t as buildDiscordSendError, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, x as fetchMemberGuildPermissionsDiscord, y as canViewDiscordGuildChannel } from "./send.shared-iGf1rqAm.mjs";
4
+ import { B as isUnknownDiscordVoiceStateError, G as withDiscordRequestAuthority, H as readDiscordMessage, L as DiscordError, R as RateLimitError, U as readRetryAfter, V as readDiscordCode, _t as getGuild, at as createOwnMessageReaction, bt as listGuildEmojis, dt as editChannelMessage, ft as getChannel, gt as unpinChannelMessage, ht as pinChannelMessage, lt as createThread, ot as deleteOwnMessageReaction, pt as getChannelMessage, st as listMessageReactionUsers, ut as deleteChannelMessage, vt as getGuildMember, xt as stripUndefinedFields, yt as getGuildVoiceState, z as isUnknownDiscordMessageError } from "./discord-Cl2OPTZ6.mjs";
5
+ import { _ as recordDiscordMessageCreateAmbiguity, a as createReusableDiscordReplyReference, h as createDiscordRetryRunner, m as classifyDiscordDeliveryFailure, n as createDiscordSendReceiptFromResults, o as resolveDiscordReplyMessageId, r as createDiscordSendResult, v as chunkDiscordTextWithMode } from "./send.receipt-eE3zLTDH.mjs";
6
6
  import { o as parseDiscordHttpErrorBody } from "./api-CtmE1OUN.mjs";
7
- import { i as prepareDiscordOutboundText, n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-_jx4Xpd3.mjs";
7
+ import { a as prepareDiscordOutboundText, n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-B5vQwgUK.mjs";
8
8
  import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-CuNARfyw.mjs";
9
9
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
10
10
  import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
@@ -285,22 +285,36 @@ async function fetchMessageDiscord(channelId, messageId, opts) {
285
285
  return await getChannelMessage(rest, channelId, messageId);
286
286
  }
287
287
  async function editMessageDiscord(channelId, messageId, payload, opts) {
288
- const rest = resolveDiscordRest(opts);
289
- return await editChannelMessage(rest, channelId, messageId, { body: {
288
+ const { rest, request } = createDiscordClient(opts);
289
+ return await request(() => editChannelMessage(rest, channelId, messageId, { body: {
290
290
  content: payload.content,
291
291
  ...payload.flags !== void 0 ? { flags: payload.flags } : {},
292
292
  ...payload.allowedMentions ? { allowed_mentions: payload.allowedMentions } : {}
293
- } });
293
+ } }), "message-edit");
294
294
  }
295
- function messageMutation(operation) {
295
+ function messageMutation(operation, label) {
296
296
  return async (channelId, messageId, opts) => {
297
- await operation(resolveDiscordRest(opts), channelId, messageId);
297
+ const { rest, request } = createDiscordClient(opts);
298
+ await request(() => operation(rest, channelId, messageId), label);
298
299
  return { ok: true };
299
300
  };
300
301
  }
301
- const deleteMessageDiscord = messageMutation(deleteChannelMessage);
302
- const pinMessageDiscord = messageMutation(pinChannelMessage);
303
- const unpinMessageDiscord = messageMutation(unpinChannelMessage);
302
+ const pinMessageDiscord = messageMutation(pinChannelMessage, "message-pin");
303
+ const unpinMessageDiscord = messageMutation(unpinChannelMessage, "message-unpin");
304
+ async function deleteMessageDiscord(channelId, messageId, opts) {
305
+ const { rest, request } = createDiscordClient(opts);
306
+ let mayHaveApplied = false;
307
+ await request(async () => {
308
+ try {
309
+ await deleteChannelMessage(rest, channelId, messageId);
310
+ } catch (err) {
311
+ if (mayHaveApplied && isUnknownDiscordMessageError(err)) return;
312
+ mayHaveApplied ||= classifyDiscordDeliveryFailure(err) === "ambiguous";
313
+ throw err;
314
+ }
315
+ }, "message-delete");
316
+ return { ok: true };
317
+ }
304
318
  async function listPinsDiscord(channelId, opts) {
305
319
  return await resolveDiscordRest(opts).get(Routes.channelPins(channelId));
306
320
  }
@@ -1,9 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { D as createDiscordMessageNonce, M as parseAndResolveChannelRecipient, N as createDiscordClient, T as SUPPRESS_NOTIFICATIONS_FLAG, c as resolveChannelId, l as resolveDiscordChannel, t as buildDiscordSendError } from "./send.shared-CjQ4jbMA.mjs";
3
- import { K as serializePayload, W as withDiscordRequestAuthority, st as createChannelMessage, ut as editChannelMessage } from "./discord-BGqgx-yd.mjs";
4
- import { r as createDiscordSendResult } from "./send.receipt-BAlzXd8e.mjs";
5
- import { t as sendMessageDiscord } from "./send.outbound-_jx4Xpd3.mjs";
6
- import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-HN9052L1.mjs";
2
+ import { D as createDiscordMessageNonce, M as parseAndResolveChannelRecipient, N as createDiscordClient, T as SUPPRESS_NOTIFICATIONS_FLAG, c as resolveChannelId, l as resolveDiscordChannel, t as buildDiscordSendError } from "./send.shared-iGf1rqAm.mjs";
3
+ import { G as withDiscordRequestAuthority, ct as createChannelMessage, dt as editChannelMessage, q as serializePayload } from "./discord-Cl2OPTZ6.mjs";
4
+ import { r as createDiscordSendResult } from "./send.receipt-eE3zLTDH.mjs";
5
+ import { t as sendMessageDiscord } from "./send.outbound-B5vQwgUK.mjs";
6
+ import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-C_cuoW1q.mjs";
7
7
  import { n as getOptionalDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
8
8
  import { hasNonEmptyString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
9
9
  import { ChannelType } from "discord-api-types/v10";
@@ -1,6 +1,7 @@
1
- import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as sendDiscordChunks, f as sendDiscordMedia, i as normalizeDiscordPollInput, j as resolveDiscordSuppressEmbeds, k as resolveDiscordSendComponents, l as resolveDiscordChannel, n as buildDiscordTextChunks, s as normalizeStickerIds, t as buildDiscordSendError } from "./send.shared-CjQ4jbMA.mjs";
2
- import { W as withDiscordRequestAuthority, ct as createThread, st as createChannelMessage } from "./discord-BGqgx-yd.mjs";
3
- import { a as createReusableDiscordReplyReference, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-BAlzXd8e.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
+ import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as sendDiscordChunks, f as sendDiscordMedia, i as normalizeDiscordPollInput, j as resolveDiscordSuppressEmbeds, k as resolveDiscordSendComponents, l as resolveDiscordChannel, n as buildDiscordTextChunks, s as normalizeStickerIds, t as buildDiscordSendError } from "./send.shared-iGf1rqAm.mjs";
3
+ import { G as withDiscordRequestAuthority, ct as createChannelMessage, lt as createThread } from "./discord-Cl2OPTZ6.mjs";
4
+ import { a as createReusableDiscordReplyReference, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-eE3zLTDH.mjs";
4
5
  import { a as normalizeDiscordSnowflake, i as normalizeDiscordHandleKey, s as resolveDiscordDirectoryUserId } from "./directory-live-DLygQVtW.mjs";
5
6
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
7
  import { ChannelType } from "discord-api-types/v10";
@@ -365,6 +366,11 @@ function prepareDiscordOutboundText(text, params) {
365
366
  }
366
367
  //#endregion
367
368
  //#region extensions/discord/src/send.outbound.ts
369
+ var send_outbound_exports = /* @__PURE__ */ __exportAll({
370
+ sendMessageDiscord: () => sendMessageDiscord,
371
+ sendPollDiscord: () => sendPollDiscord,
372
+ sendStickerDiscord: () => sendStickerDiscord
373
+ });
368
374
  const DEFAULT_DISCORD_MEDIA_MAX_MB = 100;
369
375
  /** Discord's ChannelFlags.RequireTag is bit 4 on forum/media parent channels. */
370
376
  const DISCORD_FORUM_REQUIRE_TAG_FLAG = 16;
@@ -622,4 +628,4 @@ async function sendDiscordStructuredMessage(to, opts, kind, buildPayload) {
622
628
  });
623
629
  }
624
630
  //#endregion
625
- export { discordTextHasBroadcastMention as a, prepareDiscordOutboundText as i, sendPollDiscord as n, formatMention as o, sendStickerDiscord as r, sendMessageDiscord as t };
631
+ export { prepareDiscordOutboundText as a, send_outbound_exports as i, sendPollDiscord as n, discordTextHasBroadcastMention as o, sendStickerDiscord as r, formatMention as s, sendMessageDiscord as t };
@@ -1,4 +1,4 @@
1
- import { R as RateLimitError } from "./discord-BGqgx-yd.mjs";
1
+ import { R as RateLimitError } from "./discord-Cl2OPTZ6.mjs";
2
2
  import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
3
3
  import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, readErrorName } from "openclaw/plugin-sdk/error-runtime";
4
4
  import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
@@ -30,12 +30,6 @@ function getGraphemeSegmenter() {
30
30
  graphemeSegmenter ??= new Intl.Segmenter(void 0, { granularity: "grapheme" });
31
31
  return graphemeSegmenter;
32
32
  }
33
- /** Uses the same source text that created segments. */
34
- function containingSegment(segments, text, index) {
35
- const position = Number.isNaN(index) ? 0 : Math.trunc(index);
36
- const codePoint = text.codePointAt(position);
37
- return segments.containing(codePoint !== void 0 && codePoint > 65535 ? position + 1 : position);
38
- }
39
33
  /**
40
34
  * Chooses a whole-grapheme cut within the hard budget, honoring a usable preference.
41
35
  * If no whole grapheme fits, allowPartial permits a surrogate-safe progress cut;
@@ -50,8 +44,8 @@ function findGraphemeChunkEnd(text, start, maxEnd, preferredEnd = maxEnd, allowP
50
44
  const after = text.charCodeAt(preferred);
51
45
  if (Number.isInteger(preferred) && before <= 127 && after <= 127 && !(before === 13 && after === 10)) return preferred;
52
46
  const segments = getGraphemeSegmenter().segment(text);
53
- let end = containingSegment(segments, text, preferred)?.index ?? preferred;
54
- if (end <= start && preferred < hardEnd) end = hardEnd === text.length ? hardEnd : containingSegment(segments, text, hardEnd)?.index ?? hardEnd;
47
+ let end = segments.containing(preferred)?.index ?? preferred;
48
+ if (end <= start && preferred < hardEnd) end = hardEnd === text.length ? hardEnd : segments.containing(hardEnd)?.index ?? hardEnd;
55
49
  return end > start ? end : allowPartial ? avoidTrailingHighSurrogateBreak(text, start, hardEnd) : start;
56
50
  }
57
51
  //#endregion
@@ -1,8 +1,8 @@
1
1
  import { h as normalizeDiscordToken, l as resolveDiscordAccount, s as mergeDiscordAccountConfig } from "./accounts-ljrzXBJi.mjs";
2
2
  import { A as isDiscordThreadChannelType } from "./allow-list-B_ToXtew.mjs";
3
- import { G as hasDiscordV2Components, I as RequestClient, K as serializePayload, _t as getGuildMember, dt as getChannel, gt as getGuild, nt as createUserDmChannel, pt as getThreadMember, q as Embed, rt as getCurrentUser, st as createChannelMessage } from "./discord-BGqgx-yd.mjs";
4
- import { h as createDiscordRetryRunner, o as resolveDiscordReplyMessageId, v as chunkDiscordTextWithMode } from "./send.receipt-BAlzXd8e.mjs";
5
- import { t as parseAndResolveDiscordTarget } from "./target-resolver-Bse8fuTi.mjs";
3
+ import { I as RequestClient, J as Embed, K as hasDiscordV2Components, _t as getGuild, ct as createChannelMessage, ft as getChannel, it as getCurrentUser, mt as getThreadMember, q as serializePayload, rt as createUserDmChannel, vt as getGuildMember } from "./discord-Cl2OPTZ6.mjs";
4
+ import { h as createDiscordRetryRunner, o as resolveDiscordReplyMessageId, v as chunkDiscordTextWithMode } from "./send.receipt-eE3zLTDH.mjs";
5
+ import { t as parseAndResolveDiscordTarget } from "./target-resolver-BFOKmBni.mjs";
6
6
  import { danger } from "openclaw/plugin-sdk/runtime-env";
7
7
  import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
8
8
  import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -141,6 +141,7 @@ function createDiscordClient(opts) {
141
141
  request: createDiscordRetryRunner({
142
142
  retry: opts.retry,
143
143
  verbose: opts.verbose,
144
+ signal: opts.signal,
144
145
  isGatewayDisconnected: () => {
145
146
  const gateway = getGateway(restAccount.accountId);
146
147
  return gateway !== void 0 && !gateway.isConnected;
@@ -0,0 +1,2 @@
1
+ export { t as discordSetupPlugin } from "./channel.setup-By7wNopw.mjs";
2
+ import "../setup-plugin-api.js";
@@ -100,7 +100,7 @@ const DISCORD_LEGACY_CONFIG_RULES = [];
100
100
  //#region extensions/discord/src/shared.ts
101
101
  const DISCORD_CHANNEL = "discord";
102
102
  const livePolicyConfigPrefixes = Object.keys(selectDiscordLivePolicyConfig({})).flatMap((key) => [`channels.discord.${key}`, `channels.discord.accounts.*.${key}`]);
103
- const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-9Ka20lDD.mjs"));
103
+ const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-94GSI6lY.mjs"));
104
104
  const discordDoctor = {
105
105
  dmAllowFromMode: "topOnly",
106
106
  groupModel: "route",
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { x as ensureBindingsLoadedAsync } from "./thread-bindings.session-updates-DGSljVf6.mjs";
3
- import { o as listThreadBindingsBySessionKey, u as unbindThreadBindingsBySessionKeyAsync } from "./thread-bindings-0hPTSK14.mjs";
2
+ import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-Dsc3zsrI.mjs";
4
3
  import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ import { warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
5
5
  //#region extensions/discord/src/subagent-hooks.ts
6
6
  var subagent_hooks_exports = /* @__PURE__ */ __exportAll({
7
7
  handleDiscordSubagentDeliveryTarget: () => handleDiscordSubagentDeliveryTarget,
@@ -21,22 +21,31 @@ async function handleDiscordSubagentEnded(event) {
21
21
  function shouldResolveDiscordDeliveryTarget(event) {
22
22
  return Boolean(event.expectsCompletionMessage && normalizeOptionalLowercaseString(event.requesterOrigin?.channel) === "discord");
23
23
  }
24
+ /** @deprecated Use handleDiscordSubagentDeliveryTargetAsync; compatible through 2026-12-31, removed in the first January 2027 stable. */
24
25
  function handleDiscordSubagentDeliveryTarget(event) {
25
- return shouldResolveDiscordDeliveryTarget(event) ? resolveDiscordDeliveryTarget(event) : void 0;
26
+ warnPluginSdkDeprecation({
27
+ family: "conversation-bindings",
28
+ method: "handleDiscordSubagentDeliveryTarget",
29
+ replacement: "handleDiscordSubagentDeliveryTargetAsync"
30
+ });
31
+ if (!shouldResolveDiscordDeliveryTarget(event)) return;
32
+ return resolveDiscordDeliveryTarget(event, listThreadBindingsBySessionKey({
33
+ targetSessionKey: event.childSessionKey,
34
+ accountId: event.requesterOrigin?.accountId?.trim() || void 0,
35
+ targetKind: "subagent"
36
+ }));
26
37
  }
27
38
  async function handleDiscordSubagentDeliveryTargetAsync(event) {
28
39
  if (!shouldResolveDiscordDeliveryTarget(event)) return;
29
- await ensureBindingsLoadedAsync();
30
- return resolveDiscordDeliveryTarget(event);
40
+ return resolveDiscordDeliveryTarget(event, await listThreadBindingsBySessionKeyAsync({
41
+ targetSessionKey: event.childSessionKey,
42
+ accountId: event.requesterOrigin?.accountId?.trim() || void 0,
43
+ targetKind: "subagent"
44
+ }));
31
45
  }
32
- function resolveDiscordDeliveryTarget(event) {
46
+ function resolveDiscordDeliveryTarget(event, bindings) {
33
47
  const requesterAccountId = event.requesterOrigin?.accountId?.trim();
34
48
  const requesterThreadId = normalizeOptionalStringifiedId(event.requesterOrigin?.threadId);
35
- const bindings = listThreadBindingsBySessionKey({
36
- targetSessionKey: event.childSessionKey,
37
- ...requesterAccountId ? { accountId: requesterAccountId } : {},
38
- targetKind: "subagent"
39
- });
40
49
  const binding = (requesterThreadId ? bindings.find((entry) => entry.threadId === requesterThreadId && (!requesterAccountId || entry.accountId === requesterAccountId)) : void 0) ?? (bindings.length === 1 ? bindings[0] : void 0);
41
50
  if (!binding) return;
42
51
  return { origin: {
@@ -47,4 +56,4 @@ function resolveDiscordDeliveryTarget(event) {
47
56
  } };
48
57
  }
49
58
  //#endregion
50
- export { handleDiscordSubagentEnded as n, subagent_hooks_exports as r, handleDiscordSubagentDeliveryTarget as t };
59
+ export { subagent_hooks_exports as i, handleDiscordSubagentDeliveryTargetAsync as n, handleDiscordSubagentEnded as r, handleDiscordSubagentDeliveryTarget as t };
@@ -1,5 +1,5 @@
1
1
  import { S as formatDiscordUserTag } from "./allow-list-B_ToXtew.mjs";
2
- import { t as discord_exports } from "./discord-BGqgx-yd.mjs";
2
+ import { t as discord_exports } from "./discord-Cl2OPTZ6.mjs";
3
3
  //#region extensions/discord/src/monitor/system-events.ts
4
4
  const SYSTEM_EVENT_ACTIONS = /* @__PURE__ */ new Map([
5
5
  [discord_exports.MessageType.ChannelPinnedMessage, "pinned a message"],
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
2
  import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-ljrzXBJi.mjs";
3
- import { c as allowFromContainsDiscordUserId } from "./send.receipt-BAlzXd8e.mjs";
3
+ import { c as allowFromContainsDiscordUserId } from "./send.receipt-eE3zLTDH.mjs";
4
4
  import { o as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-DLygQVtW.mjs";
5
5
  import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
6
6
  import { buildMessagingTarget } from "openclaw/plugin-sdk/channel-targets";
@@ -1,3 +1,3 @@
1
1
  import "./target-parsing-C-HyNxcE.mjs";
2
- import "./target-resolver-Bse8fuTi.mjs";
2
+ import "./target-resolver-BFOKmBni.mjs";
3
3
  export {};
@@ -1,12 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
2
  import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
3
- import "./targets-DZJjkzwv.mjs";
4
- import { C as getThreadBindingToken, E as refreshUnboundThreadWebhookIdentity, F as resolveThreadBindingMaxAgeMs$1, M as resolveThreadBindingIdleTimeoutMs$1, N as resolveThreadBindingInactivityExpiresAt, P as resolveThreadBindingMaxAgeExpiresAt, _ as MANAGERS_BY_ACCOUNT_ID, a as mutateBindingsForTargetSession, g as BINDINGS_BY_THREAD_ID, i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, o as resolveBindingIdsForTargetSession, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey, u as removeBindingRecordSync } from "./thread-bindings.session-updates-DGSljVf6.mjs";
5
- import { c as resolveThreadBindingPersonaFromRecord, i as createNoopThreadBindingManager, n as getThreadBindingManager, o as resolveChannelIdForBinding, s as resolveThreadBindingPersona, t as createThreadBindingManager } from "./thread-bindings.manager-CdNa6UIs.mjs";
3
+ import "./targets-UbCpek5o.mjs";
4
+ import { D as refreshUnboundThreadWebhookIdentity, F as resolveThreadBindingMaxAgeExpiresAt, I as resolveThreadBindingMaxAgeMs$1, N as resolveThreadBindingIdleTimeoutMs$1, P as resolveThreadBindingInactivityExpiresAt, S as ensureBindingsLoadedAsync, _ as MANAGERS_BY_ACCOUNT_ID, a as mutateBindingsForTargetSession, g as BINDINGS_BY_THREAD_ID, i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, o as resolveBindingIdsForTargetSession, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey, u as removeBindingRecordSync, w as getThreadBindingToken, x as ensureBindingsLoaded } from "./thread-bindings.session-updates-BMdJeJMc.mjs";
5
+ import { c as resolveThreadBindingPersonaFromRecord, i as createNoopThreadBindingManager, n as getThreadBindingManager, o as resolveChannelIdForBinding, s as resolveThreadBindingPersona, t as createThreadBindingManager } from "./thread-bindings.manager-BMpmKLQh.mjs";
6
6
  import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
7
7
  import { normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { formatThreadBindingDurationLabel as formatThreadBindingDurationLabel$1, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingIntroText, resolveThreadBindingIntroText as resolveThreadBindingIntroText$1, resolveThreadBindingMaxAgeMs, resolveThreadBindingThreadName, resolveThreadBindingThreadName as resolveThreadBindingThreadName$1, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
9
- import { prepareAcpSessionEntryRead, readAcpSessionEntry, rethrowIncognitoSessionError } from "openclaw/plugin-sdk/acp-runtime";
9
+ import { warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
10
+ import { prepareAcpSessionEntryRead, readAcpSessionEntryAsync, rethrowIncognitoSessionError } from "openclaw/plugin-sdk/acp-runtime";
10
11
  import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
11
12
  //#region extensions/discord/src/monitor/thread-bindings.config.ts
12
13
  function resolveDiscordThreadBindingIdleTimeoutMs(params) {
@@ -33,7 +34,21 @@ const ACP_STARTUP_HEALTH_PROBE_CONCURRENCY_LIMIT = 8;
33
34
  function listThreadBindingsForAccount(accountId) {
34
35
  return getThreadBindingManager(accountId)?.listBindings() ?? [];
35
36
  }
37
+ /** @deprecated Use listThreadBindingsBySessionKeyAsync; compatible through 2026-12-31, removed in the first January 2027 stable. */
36
38
  function listThreadBindingsBySessionKey(params) {
39
+ warnPluginSdkDeprecation({
40
+ family: "conversation-bindings",
41
+ method: "listThreadBindingsBySessionKey",
42
+ replacement: "listThreadBindingsBySessionKeyAsync"
43
+ });
44
+ ensureBindingsLoaded();
45
+ return listLoadedThreadBindingsBySessionKey(params);
46
+ }
47
+ async function listThreadBindingsBySessionKeyAsync(params) {
48
+ await ensureBindingsLoadedAsync();
49
+ return listLoadedThreadBindingsBySessionKey(params);
50
+ }
51
+ function listLoadedThreadBindingsBySessionKey(params) {
37
52
  return resolveBindingIdsForTargetSession(params).map((bindingKey) => BINDINGS_BY_THREAD_ID.get(bindingKey)).filter((entry) => Boolean(entry));
38
53
  }
39
54
  async function autoBindSpawnedDiscordSubagent(params) {
@@ -86,8 +101,14 @@ async function autoBindSpawnedDiscordSubagent(params) {
86
101
  })
87
102
  });
88
103
  }
89
- /** @deprecated Public SDK compatibility; bundled callers use the awaited variant. */
104
+ /** @deprecated Use unbindThreadBindingsBySessionKeyAsync; compatible through 2026-12-31, removed in the first January 2027 stable. */
90
105
  function unbindThreadBindingsBySessionKey(params) {
106
+ warnPluginSdkDeprecation({
107
+ family: "conversation-bindings",
108
+ method: "unbindThreadBindingsBySessionKey",
109
+ replacement: "unbindThreadBindingsBySessionKeyAsync"
110
+ });
111
+ ensureBindingsLoaded();
91
112
  const ids = resolveBindingIdsForTargetSession(params);
92
113
  const removed = [];
93
114
  for (const bindingKey of ids) {
@@ -146,7 +167,7 @@ async function reconcileAcpThreadBindings(params, preparations) {
146
167
  preparations.set(binding, prepared);
147
168
  prepared.assertCurrent();
148
169
  }
149
- const session = prepared ? prepared.session : readAcpSessionEntry(input);
170
+ const session = prepared ? prepared.session : await readAcpSessionEntryAsync(input);
150
171
  if (session?.storeReadFailed) continue;
151
172
  if (!session?.acp) {
152
173
  staleBindings.push(binding);
@@ -221,6 +242,7 @@ var thread_bindings_exports = /* @__PURE__ */ __exportAll({
221
242
  formatThreadBindingDurationLabel: () => formatThreadBindingDurationLabel$1,
222
243
  getThreadBindingManager: () => getThreadBindingManager,
223
244
  listThreadBindingsBySessionKey: () => listThreadBindingsBySessionKey,
245
+ listThreadBindingsBySessionKeyAsync: () => listThreadBindingsBySessionKeyAsync,
224
246
  listThreadBindingsForAccount: () => listThreadBindingsForAccount,
225
247
  reconcileAcpThreadBindingsOnStartup: () => reconcileAcpThreadBindingsOnStartup,
226
248
  resolveDiscordThreadBindingIdleTimeoutMs: () => resolveDiscordThreadBindingIdleTimeoutMs,
@@ -242,4 +264,4 @@ var thread_bindings_exports = /* @__PURE__ */ __exportAll({
242
264
  unbindThreadBindingsBySessionKeyAsync: () => unbindThreadBindingsBySessionKeyAsync
243
265
  });
244
266
  //#endregion
245
- export { autoBindSpawnedDiscordSubagent as a, reconcileAcpThreadBindingsOnStartup as c, resolveDiscordThreadBindingIdleTimeoutMs as d, resolveDiscordThreadBindingMaxAgeMs as f, thread_bindings_exports as i, unbindThreadBindingsBySessionKey as l, resolveThreadBindingIntroText$1 as n, listThreadBindingsBySessionKey as o, resolveThreadBindingsEnabled as p, resolveThreadBindingThreadName$1 as r, listThreadBindingsForAccount as s, formatThreadBindingDurationLabel$1 as t, unbindThreadBindingsBySessionKeyAsync as u };
267
+ export { autoBindSpawnedDiscordSubagent as a, listThreadBindingsForAccount as c, unbindThreadBindingsBySessionKeyAsync as d, resolveDiscordThreadBindingIdleTimeoutMs as f, thread_bindings_exports as i, reconcileAcpThreadBindingsOnStartup as l, resolveThreadBindingsEnabled as m, resolveThreadBindingIntroText$1 as n, listThreadBindingsBySessionKey as o, resolveDiscordThreadBindingMaxAgeMs as p, resolveThreadBindingThreadName$1 as r, listThreadBindingsBySessionKeyAsync as s, formatThreadBindingDurationLabel$1 as t, unbindThreadBindingsBySessionKey as u };
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
2
  import { A as isDiscordThreadChannelType } from "./allow-list-B_ToXtew.mjs";
3
- import { P as createDiscordRestClient } from "./send.shared-CjQ4jbMA.mjs";
4
- import { W as withDiscordRequestAuthority, dt as getChannel, tt as createChannelWebhook } from "./discord-BGqgx-yd.mjs";
5
- import { p as canFallbackDiscordWebhookSend } from "./send.receipt-BAlzXd8e.mjs";
3
+ import { P as createDiscordRestClient } from "./send.shared-iGf1rqAm.mjs";
4
+ import { G as withDiscordRequestAuthority, ft as getChannel, nt as createChannelWebhook } from "./discord-Cl2OPTZ6.mjs";
5
+ import { p as canFallbackDiscordWebhookSend } from "./send.receipt-eE3zLTDH.mjs";
6
6
  import { n as resolveDiscordChannelId } from "./target-parsing-C-HyNxcE.mjs";
7
- import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-DbILKgcm.mjs";
8
- import { t as sendMessageDiscord } from "./send.outbound-_jx4Xpd3.mjs";
9
- import { A as resolveBindingRecordKey, C as getThreadBindingToken, D as rememberReusableWebhook, E as refreshUnboundThreadWebhookIdentity, F as resolveThreadBindingMaxAgeMs$1, I as shouldDefaultPersist, L as toBindingRecordKey, M as resolveThreadBindingIdleTimeoutMs$1, O as rememberThreadBindingToken, R as toReusableWebhookKey, S as forgetThreadBindingToken, T as normalizeThreadBindingDurationMs, _ as MANAGERS_BY_ACCOUNT_ID, b as THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS, c as drainThreadBindingAccountOperations, d as runThreadBindingAccountOperation, f as runThreadBindingMutation, g as BINDINGS_BY_THREAD_ID, h as updateBindingRecordSync, j as resolvePreparedThreadBindingLifecycle, k as resolveBindingIdsForSession, l as drainThreadBindingMutations, m as snapshotThreadBindingMetadata, p as shouldPersistAnyBindingState, s as commitBindingRecord, v as PERSIST_BY_ACCOUNT_ID, w as normalizeTargetKind, x as ensureBindingsLoadedAsync, y as REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL } from "./thread-bindings.session-updates-DGSljVf6.mjs";
7
+ import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-yR1hfybW.mjs";
8
+ import { t as sendMessageDiscord } from "./send.outbound-B5vQwgUK.mjs";
9
+ import { A as resolveBindingIdsForSession, C as forgetThreadBindingToken, D as refreshUnboundThreadWebhookIdentity, E as normalizeThreadBindingDurationMs, I as resolveThreadBindingMaxAgeMs$1, L as shouldDefaultPersist, M as resolvePreparedThreadBindingLifecycle, N as resolveThreadBindingIdleTimeoutMs$1, O as rememberReusableWebhook, R as toBindingRecordKey, S as ensureBindingsLoadedAsync, T as normalizeTargetKind, _ as MANAGERS_BY_ACCOUNT_ID, b as THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS, c as drainThreadBindingAccountOperations, d as runThreadBindingAccountOperation, f as runThreadBindingMutation, g as BINDINGS_BY_THREAD_ID, h as updateBindingRecordSync, j as resolveBindingRecordKey, k as rememberThreadBindingToken, l as drainThreadBindingMutations, m as snapshotThreadBindingMetadata, p as shouldPersistAnyBindingState, s as commitBindingRecord, v as PERSIST_BY_ACCOUNT_ID, w as getThreadBindingToken, y as REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL, z as toReusableWebhookKey } from "./thread-bindings.session-updates-BMdJeJMc.mjs";
10
10
  import { n as resolveDiscordChannelInfoSafe, t as resolveDiscordChannelIdSafe } from "./channel-access-DasWY_OV.mjs";
11
11
  import { createSubsystemLogger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
12
12
  import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
@@ -15,9 +15,10 @@ import { getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-sna
15
15
  import { parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1 } from "openclaw/plugin-sdk/number-runtime";
16
16
  import { SYSTEM_MARK } from "openclaw/plugin-sdk/text-chunking";
17
17
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
18
- import { registerSessionBindingAdapter, resolveThreadBindingFarewellText, resolveThreadBindingThreadName, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/conversation-runtime";
19
- import { createAccountScopedBindingAdapter, projectThreadBindingRecord } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
18
+ import { resolveThreadBindingFarewellText, resolveThreadBindingThreadName, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/conversation-runtime";
19
+ import { createAccountScopedBindingAdapterV2, projectThreadBindingRecord, registerSessionBindingAdapterV2, unregisterSessionBindingAdapter as unregisterSessionBindingAdapter$1, warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
20
20
  import { resolveSessionAgentIdStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
21
+ import { registerSessionBindingAdapterV2 as registerSessionBindingAdapterV2$1 } from "openclaw/plugin-sdk/thread-bindings-runtime";
21
22
  //#region extensions/discord/src/monitor/thread-bindings.persona.ts
22
23
  const THREAD_BINDING_PERSONA_MAX_CHARS = 80;
23
24
  function normalizePersonaLabel(value) {
@@ -208,7 +209,8 @@ function createThreadBindingSessionAdapter(params) {
208
209
  })
209
210
  });
210
211
  };
211
- return createAccountScopedBindingAdapter({
212
+ return createAccountScopedBindingAdapterV2({
213
+ assertCurrent: params.assertCurrent,
212
214
  channel: "discord",
213
215
  accountId: params.accountId,
214
216
  capabilities: { placements: ["current", "child"] },
@@ -249,6 +251,19 @@ function createThreadBindingSessionAdapter(params) {
249
251
  return bound ? serializeBinding(bound) : null;
250
252
  },
251
253
  project: serializeBinding,
254
+ listBySessionKeyAsync: async (key) => params.manager.listBySessionKey(key),
255
+ getByConversationAsync: async (ref) => params.manager.getByThreadId(ref.conversationId),
256
+ inspectByConversationAsync: async (ref) => params.manager.getByThreadId(ref.conversationId),
257
+ inspectByConversations: (refs) => {
258
+ const records = refs.map((ref) => params.manager.getByThreadId(ref.conversationId));
259
+ return {
260
+ records,
261
+ assertCurrent: () => {
262
+ params.assertCurrent();
263
+ if (refs.some((ref, index) => params.manager.getByThreadId(ref.conversationId) !== records[index])) throw new Error("Discord thread binding selection changed");
264
+ }
265
+ };
266
+ },
252
267
  listBySessionKey: params.manager.listBySessionKey,
253
268
  getByConversation: (ref) => params.manager.getByThreadId(ref.conversationId),
254
269
  touchConversation: (threadId, at) => params.manager.touchThreadSync({
@@ -274,7 +289,12 @@ function createThreadBindingSessionAdapter(params) {
274
289
  /** Disabled bindings have a live empty owner; retirement still makes that owner unavailable. */
275
290
  function createNoopThreadBindingManager(accountIdRaw) {
276
291
  const accountId = normalizeAccountId(accountIdRaw);
292
+ let stopped = false;
277
293
  const adapter = {
294
+ version: 2,
295
+ assertCurrent: () => {
296
+ if (stopped) throw new Error("Discord thread binding manager was retired");
297
+ },
278
298
  channel: "discord",
279
299
  accountId,
280
300
  capabilities: {
@@ -282,13 +302,21 @@ function createNoopThreadBindingManager(accountIdRaw) {
282
302
  unbindSupported: false,
283
303
  placements: []
284
304
  },
305
+ touchAsync: async () => {},
306
+ listBySessionAsync: async () => [],
307
+ resolveByConversationAsync: async () => null,
308
+ inspectByConversationAsync: async () => null,
309
+ inspectByConversationsAsync: async (refs) => ({
310
+ bindings: refs.map(() => null),
311
+ assertCurrent: () => adapter.assertCurrent()
312
+ }),
285
313
  listBySession: () => [],
286
314
  resolveByConversation: () => null
287
315
  };
288
- registerSessionBindingAdapter(adapter);
316
+ registerSessionBindingAdapterV2(adapter);
289
317
  return {
290
318
  accountId,
291
- isStopping: () => false,
319
+ isStopping: () => stopped,
292
320
  getIdleTimeoutMs: () => DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS,
293
321
  getMaxAgeMs: () => 0,
294
322
  getByThreadId: () => void 0,
@@ -296,16 +324,26 @@ function createNoopThreadBindingManager(accountIdRaw) {
296
324
  listBySessionKey: () => [],
297
325
  listBindings: () => [],
298
326
  touchThread: async () => null,
299
- touchThreadSync: () => null,
327
+ touchThreadSync: () => {
328
+ warnPluginSdkDeprecation({
329
+ family: "conversation-bindings",
330
+ method: "ThreadBindingManager.touchThreadSync",
331
+ replacement: "ThreadBindingManager.touchThread"
332
+ });
333
+ return null;
334
+ },
300
335
  bindTarget: async () => null,
301
336
  unbindThread: async () => null,
302
337
  unbindBySessionKey: async () => [],
303
338
  notifyUnbound: () => {},
304
- stop: async () => unregisterSessionBindingAdapter({
305
- channel: "discord",
306
- accountId,
307
- adapter
308
- })
339
+ stop: async () => {
340
+ stopped = true;
341
+ unregisterSessionBindingAdapter$1({
342
+ channel: "discord",
343
+ accountId,
344
+ adapter
345
+ });
346
+ }
309
347
  };
310
348
  }
311
349
  //#endregion
@@ -497,6 +535,11 @@ function createLoadedThreadBindingManager(params) {
497
535
  }).map((bindingKey) => BINDINGS_BY_THREAD_ID.get(bindingKey)).filter((entry) => Boolean(entry)),
498
536
  listBindings: () => [...BINDINGS_BY_THREAD_ID.values()].filter((entry) => entry.accountId === accountId),
499
537
  touchThreadSync: (input) => {
538
+ warnPluginSdkDeprecation({
539
+ family: "conversation-bindings",
540
+ method: "ThreadBindingManager.touchThreadSync",
541
+ replacement: "ThreadBindingManager.touchThread"
542
+ });
500
543
  assertManagerCurrent();
501
544
  if (stopping) throw new Error("Discord thread binding manager is stopping");
502
545
  const key = resolveBindingRecordKey({
@@ -727,9 +770,10 @@ function createLoadedThreadBindingManager(params) {
727
770
  maxAgeMs
728
771
  },
729
772
  resolveCurrentCfg,
730
- resolveCurrentToken
773
+ resolveCurrentToken,
774
+ assertCurrent: assertManagerCurrent
731
775
  });
732
- registerSessionBindingAdapter(sessionBindingAdapter);
776
+ registerSessionBindingAdapterV2$1(sessionBindingAdapter);
733
777
  MANAGERS_BY_ACCOUNT_ID.set(accountId, manager);
734
778
  return manager;
735
779
  }