@openclaw/discord 2026.5.28-beta.3 → 2026.5.28

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 (66) hide show
  1. package/dist/action-runtime-api.js +1 -1
  2. package/dist/{api-ChQJ1kfZ.js → api-BmXlcjYW.js} +5 -5
  3. package/dist/api.js +14 -14
  4. package/dist/{approval-handler.runtime-CIZiiFBd.js → approval-handler.runtime-CN_E7nkQ.js} +3 -3
  5. package/dist/{audit-D6BXQsYY.js → audit-BFCBp74H.js} +3 -3
  6. package/dist/{channel--B_psO5e.js → channel-COXb22wL.js} +15 -15
  7. package/dist/{channel-actions-BOH34yJ5.js → channel-actions-C2g9OmnG.js} +15 -3
  8. package/dist/{channel-actions.runtime-B1RCm1JP.js → channel-actions.runtime-drnbrgpt.js} +5 -5
  9. package/dist/channel-plugin-api.js +1 -1
  10. package/dist/{channel.setup-COYdCbY_.js → channel.setup-BsrP5-hv.js} +2 -2
  11. package/dist/{components-DX5Baphr.js → components-CjQujWa1.js} +27 -26
  12. package/dist/contract-api.js +2 -2
  13. package/dist/{conversation-identity-Dugx5WfH.js → conversation-identity-CsPV1Gjx.js} +2 -2
  14. package/dist/{directory-config-CcjUkNgK.js → directory-config-BqPvRoDv.js} +1 -1
  15. package/dist/directory-contract-api.js +1 -1
  16. package/dist/{directory-live-NOtxlJZ3.js → directory-live-CCI0IMZq.js} +2 -2
  17. package/dist/{handle-action.guild-admin-wC9VaAdl.js → handle-action.guild-admin-BmjclQbR.js} +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/legacy-state-migrations-api.js +99 -0
  20. package/dist/{manager.runtime-Bwgq6hJW.js → manager.runtime-ClhnLsZf.js} +3 -3
  21. package/dist/{message-handler-DhqxKFLP.js → message-handler-BnhAHqem.js} +6 -6
  22. package/dist/{message-handler.preflight-BC8QmsWW.js → message-handler.preflight-B1RTQ6ZO.js} +10 -10
  23. package/dist/{message-handler.process-DE1an2G4.js → message-handler.process-B1ODKav3.js} +9 -9
  24. package/dist/{message-utils-BlvuUPP4.js → message-utils-CmB03FoF.js} +1 -1
  25. package/dist/{outbound-adapter-BGrOFkR8.js → outbound-adapter-DfY2Dtf3.js} +11 -11
  26. package/dist/{pluralkit-Cq_PUr06.js → pluralkit-DAZN3ZMK.js} +1 -1
  27. package/dist/{probe-CSBPZIYV.js → probe-BiEg-_i1.js} +1 -1
  28. package/dist/{probe.runtime-BhWW0223.js → probe.runtime-Dja7CbJT.js} +1 -1
  29. package/dist/{provider-DIVQuJTw.js → provider-DCcqVFp-.js} +198 -138
  30. package/dist/{provider-session.runtime-C7jT_K-7.js → provider-session.runtime-mKSG07RE.js} +3 -3
  31. package/dist/provider.runtime-BmpunJHX.js +2 -0
  32. package/dist/{resolve-allowlist-common-CzfIcLSO.js → resolve-allowlist-common-DAIbZobr.js} +1 -1
  33. package/dist/{resolve-channels-CQ13aBCV.js → resolve-channels-D1zgoxnw.js} +3 -3
  34. package/dist/{resolve-users-Bj4Y4uWR.js → resolve-users-wPAvLk_8.js} +3 -3
  35. package/dist/{retry-after-CSukypPP.js → retry-after-D5_VmM-_.js} +10 -6
  36. package/dist/runtime-api.actions.js +2 -2
  37. package/dist/runtime-api.js +19 -19
  38. package/dist/runtime-api.lookup.js +5 -5
  39. package/dist/runtime-api.monitor-B38upMUK.js +5 -0
  40. package/dist/runtime-api.monitor.js +4 -4
  41. package/dist/runtime-api.send.js +5 -5
  42. package/dist/runtime-api.threads.js +3 -3
  43. package/dist/{runtime-DA70ebm-.js → runtime-gaB5-Wsj.js} +7 -7
  44. package/dist/{send-3r8QQkTY.js → send-CBxhnbKU.js} +3 -3
  45. package/dist/{send.components-2qRLUwBn.js → send.components-uuQuHL3t.js} +4 -4
  46. package/dist/{send.outbound-LjX_KYiO.js → send.outbound-DZHJYmNF.js} +3 -3
  47. package/dist/{send.receipt-Bo_43DQZ.js → send.receipt-3y2lVFRf.js} +4 -6
  48. package/dist/{send.shared-CXctTF1I.js → send.shared-Ddl21-Gt.js} +4 -5
  49. package/dist/setup-entry.js +5 -0
  50. package/dist/setup-plugin-api.js +1 -1
  51. package/dist/{subagent-hooks-DoWTMQyQ.js → subagent-hooks-BacIbIBD.js} +2 -2
  52. package/dist/subagent-hooks-api.js +1 -1
  53. package/dist/{system-events-DV85gUxb.js → system-events-Cw6Hp8RF.js} +1 -1
  54. package/dist/{target-resolver-DVpZI7ZL.js → target-resolver-jjQzAS6T.js} +2 -2
  55. package/dist/targets-BVKF5wbg.js +3 -0
  56. package/dist/{thread-bindings-Cm3GqlNC.js → thread-bindings-BBq-yzq2.js} +4 -4
  57. package/dist/{thread-bindings.discord-api-JrJXT7L0.js → thread-bindings.discord-api-5QgEd_dW.js} +6 -6
  58. package/dist/{thread-bindings.manager-DqJuGG-r.js → thread-bindings.manager-COkxjwR9.js} +3 -3
  59. package/dist/{transcripts-source-lEfSvSRD.js → transcripts-source-DDrS8HrV.js} +1 -1
  60. package/dist/transcripts-source-api.js +1 -1
  61. package/dist/{typing-DlT_14RX.js → typing-B7bCMPJJ.js} +1 -1
  62. package/npm-shrinkwrap.json +3 -3
  63. package/package.json +7 -4
  64. package/dist/provider.runtime-BtnupyG-.js +0 -2
  65. package/dist/runtime-api.monitor-P-emTjcx.js +0 -5
  66. package/dist/targets-0WHF7kV0.js +0 -3
@@ -1,17 +1,17 @@
1
- import { Ut as resolveDiscordChannelId, c as discord_exports, ft as editChannelMessage, s as chunkDiscordTextWithMode, st as createChannelMessage, ut as deleteChannelMessage } from "./send.receipt-Bo_43DQZ.js";
1
+ import { Ut as resolveDiscordChannelId, c as discord_exports, ft as editChannelMessage, s as chunkDiscordTextWithMode, st as createChannelMessage, ut as deleteChannelMessage } from "./send.receipt-3y2lVFRf.js";
2
2
  import { f as resolveDiscordMaxLinesPerMessage } from "./accounts-dXTfmnSZ.js";
3
- import { I as createDiscordRestClient, L as createDiscordRuntimeAccountContext, _ as resolveDiscordMessageFlags, d as resolveDiscordTargetChannelId } from "./send.shared-CXctTF1I.js";
3
+ import { I as createDiscordRestClient, L as createDiscordRuntimeAccountContext, _ as resolveDiscordMessageFlags, d as resolveDiscordTargetChannelId } from "./send.shared-Ddl21-Gt.js";
4
4
  import { S as resolveTimestampMs, a as normalizeDiscordSlug, r as normalizeDiscordAllowList } from "./allow-list-BnkWtVpA.js";
5
- import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-3r8QQkTY.js";
6
- import "./targets-0WHF7kV0.js";
7
- import { t as resolveDiscordConversationIdentity } from "./conversation-identity-Dugx5WfH.js";
5
+ import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-CBxhnbKU.js";
6
+ import "./targets-BVKF5wbg.js";
7
+ import { t as resolveDiscordConversationIdentity } from "./conversation-identity-CsPV1Gjx.js";
8
8
  import { t as beginDiscordInboundEventDeliveryCorrelation } from "./inbound-event-delivery-CEPlt2uz.js";
9
- import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-BGrOFkR8.js";
9
+ import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-DfY2Dtf3.js";
10
10
  import { t as resolveDiscordPreviewStreamMode } from "./preview-streaming-DXT8oJdo.js";
11
11
  import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-l_PsHQvX.js";
12
- import { S as resolveDiscordAutoThreadReplyPlan, a as resolveReplyContext, i as buildGuildLabel, m as createDiscordSupplementalContextAccessChecker, n as deliverDiscordReply, p as buildDiscordInboundAccessContext, r as buildDirectLabel, w as resolveDiscordThreadStarter } from "./provider-DIVQuJTw.js";
13
- import { a as resolveForwardedMediaList, o as resolveMediaList, r as resolveDiscordMessageText, s as resolveReferencedReplyMediaList } from "./message-utils-BlvuUPP4.js";
14
- import { t as sendTyping } from "./typing-DlT_14RX.js";
12
+ import { S as resolveDiscordAutoThreadReplyPlan, a as resolveReplyContext, i as buildGuildLabel, m as createDiscordSupplementalContextAccessChecker, n as deliverDiscordReply, p as buildDiscordInboundAccessContext, r as buildDirectLabel, w as resolveDiscordThreadStarter } from "./provider-DCcqVFp-.js";
13
+ import { a as resolveForwardedMediaList, o as resolveMediaList, r as resolveDiscordMessageText, s as resolveReferencedReplyMediaList } from "./message-utils-CmB03FoF.js";
14
+ import { t as sendTyping } from "./typing-B7bCMPJJ.js";
15
15
  import { buildAgentSessionKey, normalizeAccountId, resolveAccountEntry, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
16
16
  import { MessageFlags } from "discord-api-types/v10";
17
17
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- import { u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-JrJXT7L0.js";
1
+ import { u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-5QgEd_dW.js";
2
2
  import { a as mergeAbortSignals } from "./timeouts-l_PsHQvX.js";
3
3
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { ComponentType, StickerFormatType } from "discord-api-types/v10";
@@ -1,6 +1,7 @@
1
- import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt, x as DiscordError } from "./send.receipt-Bo_43DQZ.js";
1
+ import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt, x as DiscordError } from "./send.receipt-3y2lVFRf.js";
2
2
  import { s as resolveDiscordAccount } from "./accounts-dXTfmnSZ.js";
3
- import { d as readDiscordComponentSpec } from "./components-DX5Baphr.js";
3
+ import { d as readDiscordComponentSpec } from "./components-CjQujWa1.js";
4
+ import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-D5_VmM-_.js";
4
5
  import { n as notifyDiscordInboundEventOutboundPayloadSuccess } from "./inbound-event-delivery-CEPlt2uz.js";
5
6
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
6
7
  import { resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
@@ -21,13 +22,12 @@ function isRetryableDiscordDeliveryError(err) {
21
22
  }
22
23
  function getDiscordDeliveryRetryAfterMs(err) {
23
24
  if (!err || typeof err !== "object") return;
24
- if ("retryAfter" in err && typeof err.retryAfter === "number" && Number.isFinite(err.retryAfter)) return err.retryAfter * 1e3;
25
+ const retryAfterSeconds = "retryAfter" in err ? parseDiscordRetryAfterBodySeconds(err.retryAfter) : void 0;
26
+ if (retryAfterSeconds !== void 0) return retryAfterSeconds * 1e3;
25
27
  const retryAfterRaw = err.headers?.["retry-after"];
26
28
  if (!retryAfterRaw) return;
27
- const trimmedRetryAfter = retryAfterRaw.trim();
28
- if (!/^\d+(?:\.\d+)?$/.test(trimmedRetryAfter)) return;
29
- const retryAfterMs = Number(trimmedRetryAfter) * 1e3;
30
- return Number.isFinite(retryAfterMs) ? retryAfterMs : void 0;
29
+ const headerSeconds = parseDiscordRetryAfterBodySeconds(retryAfterRaw);
30
+ return headerSeconds === void 0 ? void 0 : headerSeconds * 1e3;
31
31
  }
32
32
  async function withDiscordDeliveryRetry(params) {
33
33
  const retryConfig = resolveRetryConfig(DISCORD_DELIVERY_RETRY_DEFAULTS, resolveDiscordAccount({
@@ -86,11 +86,11 @@ function normalizeDiscordApprovalPayload(payload) {
86
86
  let discordComponentSendPromise;
87
87
  let discordSharedInteractivePromise;
88
88
  async function sendDiscordComponentMessageLazy(...args) {
89
- discordComponentSendPromise ??= import("./send.components-2qRLUwBn.js").then((n) => n.i).then((module) => module.sendDiscordComponentMessage);
89
+ discordComponentSendPromise ??= import("./send.components-uuQuHL3t.js").then((n) => n.i).then((module) => module.sendDiscordComponentMessage);
90
90
  return await (await discordComponentSendPromise)(...args);
91
91
  }
92
92
  function loadDiscordSharedInteractive() {
93
- discordSharedInteractivePromise ??= import("./components-DX5Baphr.js").then((n) => n.a);
93
+ discordSharedInteractivePromise ??= import("./components-CjQujWa1.js").then((n) => n.a);
94
94
  return discordSharedInteractivePromise;
95
95
  }
96
96
  function addPayloadTextFallback(spec, payload) {
@@ -125,7 +125,7 @@ async function resolveDiscordComponentSpec(payload) {
125
125
  //#region extensions/discord/src/outbound-send-context.ts
126
126
  let discordSendRuntimePromise;
127
127
  async function loadDiscordSendRuntime() {
128
- discordSendRuntimePromise ??= import("./send-3r8QQkTY.js").then((n) => n.t);
128
+ discordSendRuntimePromise ??= import("./send-CBxhnbKU.js").then((n) => n.t);
129
129
  return await discordSendRuntimePromise;
130
130
  }
131
131
  function resolveDiscordOutboundTarget(params) {
@@ -315,7 +315,7 @@ function stripDiscordInternalRuntimeScaffolding(text) {
315
315
  }
316
316
  let discordThreadBindingsPromise;
317
317
  function loadDiscordThreadBindings() {
318
- discordThreadBindingsPromise ??= import("./thread-bindings-Cm3GqlNC.js").then((n) => n.t);
318
+ discordThreadBindingsPromise ??= import("./thread-bindings-BBq-yzq2.js").then((n) => n.t);
319
319
  return discordThreadBindingsPromise;
320
320
  }
321
321
  function resolveDiscordWebhookIdentity(params) {
@@ -1,4 +1,4 @@
1
- import { Wt as __exportAll } from "./send.receipt-Bo_43DQZ.js";
1
+ import { Wt as __exportAll } from "./send.receipt-3y2lVFRf.js";
2
2
  import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
3
3
  //#region extensions/discord/src/pluralkit.ts
4
4
  var pluralkit_exports = /* @__PURE__ */ __exportAll({ fetchPluralKitMessageInfo: () => fetchPluralKitMessageInfo });
@@ -1,5 +1,5 @@
1
1
  import { p as normalizeDiscordToken } from "./accounts-dXTfmnSZ.js";
2
- import { n as fetchDiscord, t as DiscordApiError } from "./api-ChQJ1kfZ.js";
2
+ import { n as fetchDiscord, t as DiscordApiError } from "./api-BmXlcjYW.js";
3
3
  import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
4
4
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
5
5
  import { fetchWithTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
@@ -1,2 +1,2 @@
1
- import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-CSBPZIYV.js";
1
+ import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-BiEg-_i1.js";
2
2
  export { fetchDiscordApplicationId, fetchDiscordApplicationSummary, parseApplicationIdFromToken, probeDiscord, resolveDiscordPrivilegedIntentsFromFlags };
@@ -1,34 +1,35 @@
1
- import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-Bo_43DQZ.js";
1
+ import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-3y2lVFRf.js";
2
2
  import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-dXTfmnSZ.js";
3
- import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-DX5Baphr.js";
4
- import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-2qRLUwBn.js";
3
+ import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-CjQujWa1.js";
4
+ import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-uuQuHL3t.js";
5
5
  import { c as setPresence, i as unregisterGateway, r as registerGateway } from "./gateway-registry-DPxmW0Db.js";
6
- import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, H as withValidatedDiscordProxy, I as createDiscordRestClient, V as validateDiscordProxyUrl } from "./send.shared-CXctTF1I.js";
7
- import { a as summarizeDiscordResponseBody, i as isDiscordRateLimitResponseBody } from "./api-ChQJ1kfZ.js";
6
+ import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, H as withValidatedDiscordProxy, I as createDiscordRestClient, V as validateDiscordProxyUrl } from "./send.shared-Ddl21-Gt.js";
7
+ import { a as summarizeDiscordResponseBody, i as isDiscordRateLimitResponseBody } from "./api-BmXlcjYW.js";
8
8
  import { S as resolveTimestampMs, _ as resolveGroupDmAllow, a as normalizeDiscordSlug, b as formatDiscordUserTag, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, h as resolveDiscordOwnerAllowFrom, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAllowed, r as normalizeDiscordAllowList, v as shouldEmitDiscordReactionNotification, y as formatDiscordReactionEmoji } from "./allow-list-BnkWtVpA.js";
9
- import { s as sendVoiceMessageDiscord } from "./send-3r8QQkTY.js";
10
- import { i as formatMention, t as sendMessageDiscord } from "./send.outbound-LjX_KYiO.js";
11
- import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-Dugx5WfH.js";
12
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-CQ13aBCV.js";
13
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-Bj4Y4uWR.js";
14
- import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-JrJXT7L0.js";
15
- import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-CSBPZIYV.js";
9
+ import { s as sendVoiceMessageDiscord } from "./send-CBxhnbKU.js";
10
+ import { i as formatMention, t as sendMessageDiscord } from "./send.outbound-DZHJYmNF.js";
11
+ import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
12
+ import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-CsPV1Gjx.js";
13
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-D1zgoxnw.js";
14
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-wPAvLk_8.js";
15
+ import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-5QgEd_dW.js";
16
+ import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-BiEg-_i1.js";
16
17
  import { o as raceWithTimeout, s as withAbortTimeout } from "./timeouts-l_PsHQvX.js";
17
- import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-BlvuUPP4.js";
18
+ import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-CmB03FoF.js";
18
19
  import { t as resolveDiscordSenderIdentity } from "./sender-identity-BFp5w0F8.js";
19
- import "./approval-handler.runtime-CIZiiFBd.js";
20
+ import "./approval-handler.runtime-CN_E7nkQ.js";
20
21
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
21
22
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
22
23
  import { buildAgentSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
23
24
  import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
24
25
  import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
25
- import { randomUUID } from "node:crypto";
26
+ import { createHash, randomUUID } from "node:crypto";
26
27
  import path from "node:path";
27
28
  import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
28
29
  import { Type } from "typebox";
29
30
  import { Check, Errors } from "typebox/value";
30
31
  import { inspect } from "node:util";
31
- import { parseFiniteNumber, parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
32
+ import { parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
32
33
  import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
33
34
  import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
34
35
  import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
@@ -43,7 +44,7 @@ import { fetchWithSsrFGuard, formatErrorMessage as formatErrorMessage$1 } from "
43
44
  import { GROUP_POLICY_BLOCKED_LABEL, resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
44
45
  import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
45
46
  import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
46
- import { readJsonFileWithFallback, writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
47
+ import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
47
48
  import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
48
49
  import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
49
50
  import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
@@ -51,6 +52,7 @@ import { clearExpiredCooldowns, ensureAuthProfileStore, isProfileInCooldown, res
51
52
  import { truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
52
53
  import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
53
54
  import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
55
+ import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
54
56
  import { enqueueSystemEvent, enqueueSystemEvent as enqueueSystemEvent$1 } from "openclaw/plugin-sdk/system-event-runtime";
55
57
  import { createChannelIngressResolver, defineStableChannelIngressIdentity, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
56
58
  import { applyModelOverrideToSessionEntry, resolveChannelModelOverride } from "openclaw/plugin-sdk/model-session-runtime";
@@ -66,8 +68,6 @@ import { createInteractiveConversationBindingHelpers, dispatchPluginInteractiveH
66
68
  import { dispatchReplyWithDispatcher, finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
67
69
  import * as conversationRuntime from "openclaw/plugin-sdk/conversation-binding-runtime";
68
70
  import os from "node:os";
69
- import { withFileLock } from "openclaw/plugin-sdk/file-lock";
70
- import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
71
71
  import { createConnectedChannelStatusPatch, createTransportActivityStatusPatch } from "openclaw/plugin-sdk/gateway-runtime";
72
72
  import { EventEmitter } from "node:events";
73
73
  import * as ws from "ws";
@@ -1687,6 +1687,36 @@ function resolveDiscordNativeCommandAllowlistAccess(params) {
1687
1687
  }).allowed
1688
1688
  };
1689
1689
  }
1690
+ function resolveDiscordNativeCommandChannelAccessContext(params) {
1691
+ const guild = params.guild ?? null;
1692
+ const commandsAllowFromAccess = resolveDiscordNativeCommandAllowlistAccess({
1693
+ cfg: params.cfg,
1694
+ accountId: params.accountId,
1695
+ sender: params.sender,
1696
+ chatType: params.isDirectMessage ? "direct" : params.isThreadChannel ? "thread" : guild ? "channel" : "group",
1697
+ conversationId: params.rawChannelId || void 0,
1698
+ guildId: guild?.id
1699
+ });
1700
+ const guildInfo = resolveDiscordGuildEntry({
1701
+ guild: guild ?? void 0,
1702
+ guildId: guild?.id ?? void 0,
1703
+ guildEntries: params.discordConfig?.guilds
1704
+ });
1705
+ return {
1706
+ commandsAllowFromAccess,
1707
+ guildInfo,
1708
+ channelConfig: guild ? resolveDiscordChannelConfigWithFallback({
1709
+ guildInfo,
1710
+ channelId: params.rawChannelId,
1711
+ channelName: params.channelName,
1712
+ channelSlug: params.channelSlug,
1713
+ parentId: params.threadParentId,
1714
+ parentName: params.threadParentName,
1715
+ parentSlug: params.threadParentSlug,
1716
+ scope: params.isThreadChannel ? "thread" : "channel"
1717
+ }) : null
1718
+ };
1719
+ }
1690
1720
  function resolveDiscordCommandOwnerAllowFrom(cfg) {
1691
1721
  const raw = cfg.commands?.ownerAllowFrom;
1692
1722
  if (!Array.isArray(raw) || raw.length === 0) return;
@@ -1802,33 +1832,21 @@ async function resolveDiscordNativeAutocompleteAuthorized(params) {
1802
1832
  },
1803
1833
  allowNameMatching
1804
1834
  });
1805
- const commandsAllowFromAccess = resolveDiscordNativeCommandAllowlistAccess({
1835
+ const { commandsAllowFromAccess, guildInfo, channelConfig } = resolveDiscordNativeCommandChannelAccessContext({
1806
1836
  cfg,
1837
+ discordConfig,
1807
1838
  accountId,
1808
- sender: {
1809
- id: sender.id,
1810
- name: sender.name,
1811
- tag: sender.tag
1812
- },
1813
- chatType: isDirectMessage ? "direct" : isThreadChannel ? "thread" : interaction.guild ? "channel" : "group",
1814
- conversationId: rawChannelId || void 0,
1815
- guildId: interaction.guild?.id
1816
- });
1817
- const guildInfo = resolveDiscordGuildEntry({
1818
- guild: interaction.guild ?? void 0,
1819
- guildId: interaction.guild?.id ?? void 0,
1820
- guildEntries: discordConfig?.guilds
1821
- });
1822
- const channelConfig = interaction.guild ? resolveDiscordChannelConfigWithFallback({
1823
- guildInfo,
1824
- channelId: rawChannelId,
1839
+ sender,
1840
+ isDirectMessage,
1841
+ isThreadChannel,
1842
+ guild: interaction.guild ?? null,
1843
+ rawChannelId,
1825
1844
  channelName,
1826
1845
  channelSlug,
1827
- parentId: threadParentId,
1828
- parentName: threadParentName,
1829
- parentSlug: threadParentSlug,
1830
- scope: isThreadChannel ? "thread" : "channel"
1831
- }) : null;
1846
+ threadParentId,
1847
+ threadParentName,
1848
+ threadParentSlug
1849
+ });
1832
1850
  if (channelConfig?.enabled === false) return false;
1833
1851
  if (interaction.guild && channelConfig?.allowed === false) return false;
1834
1852
  if (useAccessGroups && interaction.guild) {
@@ -2208,33 +2226,18 @@ function createDiscordCommandArgFallbackButton$1(params) {
2208
2226
  }
2209
2227
  //#endregion
2210
2228
  //#region extensions/discord/src/monitor/model-picker-preferences.ts
2211
- const MODEL_PICKER_PREFERENCES_LOCK_OPTIONS = {
2212
- retries: {
2213
- retries: 8,
2214
- factor: 2,
2215
- minTimeout: 50,
2216
- maxTimeout: 5e3,
2217
- randomize: true
2218
- },
2219
- stale: 15e3
2220
- };
2221
2229
  const DEFAULT_RECENT_LIMIT = 5;
2222
- function sanitizePreferenceEntries(entries) {
2223
- if (!entries || typeof entries !== "object") return {};
2224
- const normalizedEntries = {};
2225
- for (const [key, value] of Object.entries(entries)) {
2226
- if (!value || typeof value !== "object") continue;
2227
- const typedValue = value;
2228
- normalizedEntries[key] = {
2229
- recent: Array.isArray(typedValue.recent) ? typedValue.recent.filter((item) => typeof item === "string") : [],
2230
- updatedAt: typeof typedValue.updatedAt === "string" ? typedValue.updatedAt : ""
2231
- };
2232
- }
2233
- return normalizedEntries;
2234
- }
2235
- function resolvePreferencesStorePath(env = process.env) {
2236
- const stateDir = resolveStateDir(env, os.homedir);
2237
- return path.join(stateDir, "discord", "model-picker-preferences.json");
2230
+ const PREFERENCE_MAX_ENTRIES = 2e3;
2231
+ const MAX_PLUGIN_STATE_KEY_BYTES = 512;
2232
+ const textEncoder = new TextEncoder();
2233
+ let lastPreferenceTimestampMs = 0;
2234
+ const legacyPreferenceImports = /* @__PURE__ */ new Map();
2235
+ function openPreferenceStore(env) {
2236
+ return getDiscordRuntime().state.openKeyedStore({
2237
+ namespace: "model-picker-preferences",
2238
+ maxEntries: PREFERENCE_MAX_ENTRIES,
2239
+ ...env ? { env } : {}
2240
+ });
2238
2241
  }
2239
2242
  function normalizeId(value) {
2240
2243
  return normalizeOptionalString(value) ?? "";
@@ -2269,44 +2272,118 @@ function sanitizeRecentModels(models, limit) {
2269
2272
  }
2270
2273
  return deduped;
2271
2274
  }
2272
- async function readPreferencesStore(filePath) {
2273
- const { value } = await readJsonFileWithFallback(filePath, {
2274
- version: 1,
2275
- entries: {}
2276
- });
2277
- if (!value || typeof value !== "object" || value.version !== 1) return {
2278
- version: 1,
2279
- entries: {}
2275
+ function sanitizeLegacyPreferenceEntry(value) {
2276
+ if (!value || typeof value !== "object") return;
2277
+ const typedValue = value;
2278
+ return {
2279
+ recent: Array.isArray(typedValue.recent) ? typedValue.recent.filter((item) => typeof item === "string") : [],
2280
+ updatedAt: typeof typedValue.updatedAt === "string" ? typedValue.updatedAt : ""
2280
2281
  };
2282
+ }
2283
+ function sanitizeStoredPreferenceEntry(value) {
2284
+ if (!value || typeof value !== "object") return;
2285
+ const typedValue = value;
2286
+ if (typeof typedValue.scopeKey !== "string" || typeof typedValue.modelRef !== "string") return;
2287
+ const modelRef = normalizeModelRef(typedValue.modelRef);
2288
+ if (!modelRef) return;
2281
2289
  return {
2282
- version: 1,
2283
- entries: sanitizePreferenceEntries(value.entries)
2290
+ scopeKey: typedValue.scopeKey,
2291
+ modelRef,
2292
+ updatedAt: typeof typedValue.updatedAt === "string" ? typedValue.updatedAt : ""
2284
2293
  };
2285
2294
  }
2295
+ function hashSegment(value, length) {
2296
+ return createHash("sha256").update(value, "utf8").digest("hex").slice(0, length);
2297
+ }
2298
+ function buildPreferenceModelKey(scopeKey, modelRef) {
2299
+ return `v1:${hashSegment(scopeKey, 32)}:${hashSegment(modelRef, 24)}`;
2300
+ }
2301
+ function timestampMs(value) {
2302
+ const parsed = Date.parse(value);
2303
+ return Number.isFinite(parsed) ? parsed : 0;
2304
+ }
2305
+ function legacyUpdatedAtForIndex(updatedAt, index, total) {
2306
+ return new Date(timestampMs(updatedAt) + Math.max(0, total - index)).toISOString();
2307
+ }
2308
+ function nextPreferenceTimestampIso() {
2309
+ lastPreferenceTimestampMs = Math.max(Date.now(), lastPreferenceTimestampMs + 1);
2310
+ return new Date(lastPreferenceTimestampMs).toISOString();
2311
+ }
2312
+ function normalizeLegacyPreferenceKey(key) {
2313
+ const trimmed = key.trim();
2314
+ if (!trimmed || textEncoder.encode(trimmed).length > MAX_PLUGIN_STATE_KEY_BYTES) return;
2315
+ return trimmed;
2316
+ }
2317
+ function resolveLegacyPreferencesPath(env) {
2318
+ return path.join(resolveStateDir(env ?? process.env, os.homedir), "discord", "model-picker-preferences.json");
2319
+ }
2320
+ async function importLegacyPreferences(env) {
2321
+ const legacyPath = resolveLegacyPreferencesPath(env);
2322
+ const stateDir = path.dirname(path.dirname(legacyPath));
2323
+ const existingImport = legacyPreferenceImports.get(stateDir);
2324
+ if (existingImport) {
2325
+ await existingImport;
2326
+ return;
2327
+ }
2328
+ const importPromise = (async () => {
2329
+ const { value, exists } = await readJsonFileWithFallback(legacyPath, null);
2330
+ if (!exists || !value || typeof value.entries !== "object" || value.entries == null) return;
2331
+ const store = openPreferenceStore(env);
2332
+ for (const [rawKey, rawEntry] of Object.entries(value.entries)) {
2333
+ const key = normalizeLegacyPreferenceKey(rawKey);
2334
+ if (!key) continue;
2335
+ const entry = sanitizeLegacyPreferenceEntry(rawEntry);
2336
+ if (!entry || entry.recent.length === 0 && !entry.updatedAt) continue;
2337
+ const recent = sanitizeRecentModels(entry.recent, 10);
2338
+ for (const [index, modelRef] of recent.entries()) await store.registerIfAbsent(buildPreferenceModelKey(key, modelRef), {
2339
+ scopeKey: key,
2340
+ modelRef,
2341
+ updatedAt: legacyUpdatedAtForIndex(entry.updatedAt, index, recent.length)
2342
+ });
2343
+ }
2344
+ })();
2345
+ legacyPreferenceImports.set(stateDir, importPromise);
2346
+ try {
2347
+ await importPromise;
2348
+ } catch (error) {
2349
+ legacyPreferenceImports.delete(stateDir);
2350
+ throw error;
2351
+ }
2352
+ }
2286
2353
  async function readDiscordModelPickerRecentModels(params) {
2287
2354
  const key = buildDiscordModelPickerPreferenceKey(params.scope);
2288
2355
  if (!key) return [];
2289
2356
  const limit = Math.max(1, Math.min(params.limit ?? DEFAULT_RECENT_LIMIT, 10));
2290
- const entry = (await readPreferencesStore(resolvePreferencesStorePath(params.env))).entries[key];
2291
- const recent = sanitizeRecentModels(entry?.recent, limit);
2292
- if (!params.allowedModelRefs || params.allowedModelRefs.size === 0) return recent;
2293
- return recent.filter((modelRef) => params.allowedModelRefs?.has(modelRef));
2357
+ try {
2358
+ await importLegacyPreferences(params.env);
2359
+ const recent = (await openPreferenceStore(params.env).entries()).map((entry) => sanitizeStoredPreferenceEntry(entry.value)).filter((entry) => entry?.scopeKey === key).toSorted((left, right) => timestampMs(right.updatedAt) - timestampMs(left.updatedAt)).map((entry) => entry.modelRef);
2360
+ if (!params.allowedModelRefs || params.allowedModelRefs.size === 0) return sanitizeRecentModels(recent, limit);
2361
+ return sanitizeRecentModels(recent.filter((modelRef) => params.allowedModelRefs?.has(modelRef)), limit);
2362
+ } catch {
2363
+ return [];
2364
+ }
2294
2365
  }
2295
2366
  async function recordDiscordModelPickerRecentModel(params) {
2296
2367
  const key = buildDiscordModelPickerPreferenceKey(params.scope);
2297
2368
  const normalizedModelRef = normalizeModelRef(params.modelRef);
2298
2369
  if (!key || !normalizedModelRef) return;
2299
- const limit = Math.max(1, Math.min(params.limit ?? DEFAULT_RECENT_LIMIT, 10));
2300
- const filePath = resolvePreferencesStorePath(params.env);
2301
- await withFileLock(filePath, MODEL_PICKER_PREFERENCES_LOCK_OPTIONS, async () => {
2302
- const store = await readPreferencesStore(filePath);
2303
- const next = [normalizedModelRef, ...sanitizeRecentModels(store.entries[key]?.recent, limit).filter((entry) => entry !== normalizedModelRef)].slice(0, limit);
2304
- store.entries[key] = {
2305
- recent: next,
2306
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2307
- };
2308
- await writeJsonFileAtomically(filePath, store);
2309
- });
2370
+ try {
2371
+ await importLegacyPreferences(params.env);
2372
+ const store = openPreferenceStore(params.env);
2373
+ await store.register(buildPreferenceModelKey(key, normalizedModelRef), {
2374
+ scopeKey: key,
2375
+ modelRef: normalizedModelRef,
2376
+ updatedAt: nextPreferenceTimestampIso()
2377
+ });
2378
+ const limit = Math.max(1, Math.min(params.limit ?? DEFAULT_RECENT_LIMIT, 10));
2379
+ const scopedEntries = (await store.entries()).map((entry) => ({
2380
+ key: entry.key,
2381
+ value: sanitizeStoredPreferenceEntry(entry.value)
2382
+ })).filter((entry) => entry.value?.scopeKey === key).toSorted((left, right) => timestampMs(right.value.updatedAt) - timestampMs(left.value.updatedAt) || left.key.localeCompare(right.key));
2383
+ await Promise.all(scopedEntries.slice(limit).map((entry) => store.delete(entry.key)));
2384
+ } catch {
2385
+ return;
2386
+ }
2310
2387
  }
2311
2388
  //#endregion
2312
2389
  //#region extensions/discord/src/monitor/model-picker.state.ts
@@ -2366,19 +2443,14 @@ function normalizeModelPickerPage(value) {
2366
2443
  }
2367
2444
  function parseRawPage(value) {
2368
2445
  if (typeof value === "number") return normalizeModelPickerPage(value);
2369
- if (typeof value === "string" && /^[+-]?\d+$/.test(value.trim())) {
2370
- const parsed = Number(value.trim());
2371
- if (Number.isSafeInteger(parsed)) return normalizeModelPickerPage(parsed);
2446
+ if (typeof value === "string") {
2447
+ const parsed = parseStrictInteger(value);
2448
+ if (parsed !== void 0) return normalizeModelPickerPage(parsed);
2372
2449
  }
2373
2450
  return 1;
2374
2451
  }
2375
2452
  function parseRawPositiveInt(value) {
2376
- if (typeof value !== "string" && typeof value !== "number") return;
2377
- const raw = String(value).trim();
2378
- if (!/^[+]?\d+$/.test(raw)) return;
2379
- const parsed = Number(raw);
2380
- if (!Number.isSafeInteger(parsed) || parsed < 1) return;
2381
- return parsed;
2453
+ return parseStrictPositiveInteger(value);
2382
2454
  }
2383
2455
  function coerceString(value) {
2384
2456
  return typeof value === "string" || typeof value === "number" ? String(value) : "";
@@ -4306,33 +4378,21 @@ async function dispatchDiscordCommandInteraction(params) {
4306
4378
  const senderIsCommandOwner = commandOwnerOk || commandOwnerAllowAll;
4307
4379
  const ownerAllowListConfigured = discordOwnerAllowList != null;
4308
4380
  const ownerOk = discordOwnerOk;
4309
- const commandsAllowFromAccess = resolveDiscordNativeCommandAllowlistAccess({
4381
+ const { commandsAllowFromAccess, guildInfo, channelConfig } = resolveDiscordNativeCommandChannelAccessContext({
4310
4382
  cfg,
4383
+ discordConfig,
4311
4384
  accountId,
4312
- sender: {
4313
- id: sender.id,
4314
- name: sender.name,
4315
- tag: sender.tag
4316
- },
4317
- chatType: isDirectMessage ? "direct" : isThreadChannel ? "thread" : interaction.guild ? "channel" : "group",
4318
- conversationId: rawChannelId || void 0,
4319
- guildId: interaction.guild?.id
4320
- });
4321
- const guildInfo = resolveDiscordGuildEntry({
4322
- guild: interaction.guild ?? void 0,
4323
- guildId: interaction.guild?.id ?? void 0,
4324
- guildEntries: discordConfig?.guilds
4325
- });
4326
- const channelConfig = interaction.guild ? resolveDiscordChannelConfigWithFallback({
4327
- guildInfo,
4328
- channelId: rawChannelId,
4385
+ sender,
4386
+ isDirectMessage,
4387
+ isThreadChannel,
4388
+ guild: interaction.guild ?? null,
4389
+ rawChannelId,
4329
4390
  channelName,
4330
4391
  channelSlug,
4331
- parentId: threadParentId,
4332
- parentName: threadParentName,
4333
- parentSlug: threadParentSlug,
4334
- scope: isThreadChannel ? "thread" : "channel"
4335
- }) : null;
4392
+ threadParentId,
4393
+ threadParentName,
4394
+ threadParentSlug
4395
+ });
4336
4396
  let nativeRouteStatePromise;
4337
4397
  const getNativeRouteState = () => nativeRouteStatePromise ??= nativeCommandRuntime.resolveDiscordNativeInteractionRouteState({
4338
4398
  cfg,
@@ -6489,10 +6549,10 @@ function readDiscordDeployObjectField(value, field) {
6489
6549
  }
6490
6550
  function readFiniteNumber(value) {
6491
6551
  if (typeof value === "number" && Number.isFinite(value)) return value;
6492
- if (typeof value === "string" && value.trim().length > 0) {
6493
- const parsed = Number(value);
6494
- return Number.isFinite(parsed) ? parsed : void 0;
6495
- }
6552
+ if (typeof value === "string" && value.trim().length > 0) return parseStrictFiniteNumber(value);
6553
+ }
6554
+ function readNonNegativeInteger(value) {
6555
+ return parseStrictNonNegativeInteger(value);
6496
6556
  }
6497
6557
  function formatDurationMs(ms) {
6498
6558
  return formatDurationSeconds(ms, { decimals: ms >= 1e3 ? 1 : 0 });
@@ -6528,7 +6588,7 @@ function formatDiscordDeployErrorMessage(err) {
6528
6588
  function resolveDiscordDeployRateLimitDetails(err) {
6529
6589
  if (!err || typeof err !== "object") return;
6530
6590
  const deployErr = err;
6531
- const status = readFiniteNumber(deployErr.status) ?? readFiniteNumber(deployErr.statusCode);
6591
+ const status = readNonNegativeInteger(deployErr.status) ?? readNonNegativeInteger(deployErr.statusCode);
6532
6592
  const retryAfterSeconds = readFiniteNumber(deployErr.retryAfter) ?? readFiniteNumber(readDiscordDeployObjectField(deployErr.rawBody, "retry_after"));
6533
6593
  if (!(err instanceof RateLimitError || status === 429 || retryAfterSeconds !== void 0)) return;
6534
6594
  const rawGlobal = readDiscordDeployObjectField(deployErr.rawBody, "global");
@@ -6614,8 +6674,8 @@ function formatDiscordDeployErrorDetails(err) {
6614
6674
  function isDiscordDeployDailyCreateLimit(err) {
6615
6675
  if (!err || typeof err !== "object") return false;
6616
6676
  const deployErr = err;
6617
- const discordCode = readFiniteNumber(deployErr.discordCode);
6618
- const rawCode = readFiniteNumber(readDiscordDeployObjectField(deployErr.rawBody, "code"));
6677
+ const discordCode = readNonNegativeInteger(deployErr.discordCode);
6678
+ const rawCode = readNonNegativeInteger(readDiscordDeployObjectField(deployErr.rawBody, "code"));
6619
6679
  return (discordCode === 30034 || rawCode === 30034) && /daily application command creates/i.test(formatErrorMessage$1(err));
6620
6680
  }
6621
6681
  //#endregion
@@ -7816,7 +7876,7 @@ async function loadConversationRuntime$1() {
7816
7876
  return await conversationRuntimePromise$1;
7817
7877
  }
7818
7878
  async function loadTypingRuntime() {
7819
- typingRuntimePromise ??= import("./typing-DlT_14RX.js").then((n) => n.n);
7879
+ typingRuntimePromise ??= import("./typing-B7bCMPJJ.js").then((n) => n.n);
7820
7880
  return await typingRuntimePromise;
7821
7881
  }
7822
7882
  function buildDiscordComponentConversationLabel(params) {
@@ -8237,7 +8297,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
8237
8297
  //#region extensions/discord/src/monitor/agent-components.handlers.ts
8238
8298
  let componentsRuntimePromise;
8239
8299
  async function loadComponentsRuntime() {
8240
- componentsRuntimePromise ??= import("./components-DX5Baphr.js").then((n) => n.t);
8300
+ componentsRuntimePromise ??= import("./components-CjQujWa1.js").then((n) => n.t);
8241
8301
  return await componentsRuntimePromise;
8242
8302
  }
8243
8303
  async function handleDiscordComponentEvent(params) {
@@ -9469,7 +9529,7 @@ async function runDiscordGatewayLifecycle(params) {
9469
9529
  gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
9470
9530
  if (params.voiceManager) {
9471
9531
  await params.voiceManager.destroy();
9472
- const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-lEfSvSRD.js").then((n) => n.n);
9532
+ const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DDrS8HrV.js").then((n) => n.n);
9473
9533
  setDiscordTranscriptsVoiceManager({
9474
9534
  accountId: params.accountId,
9475
9535
  manager: null
@@ -9747,7 +9807,7 @@ function logDiscordStartupPhase(params) {
9747
9807
  });
9748
9808
  }
9749
9809
  async function loadDiscordVoiceRuntime() {
9750
- const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-Bwgq6hJW.js");
9810
+ const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-ClhnLsZf.js");
9751
9811
  discordVoiceRuntimePromise = promise;
9752
9812
  try {
9753
9813
  return await promise;
@@ -9757,7 +9817,7 @@ async function loadDiscordVoiceRuntime() {
9757
9817
  }
9758
9818
  }
9759
9819
  async function loadDiscordProviderSessionRuntime() {
9760
- const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-C7jT_K-7.js");
9820
+ const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-mKSG07RE.js");
9761
9821
  discordProviderSessionRuntimePromise = promise;
9762
9822
  try {
9763
9823
  return await promise;
@@ -10027,7 +10087,7 @@ async function monitorDiscordProvider(opts = {}) {
10027
10087
  runtime,
10028
10088
  botUserId
10029
10089
  });
10030
- const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-lEfSvSRD.js").then((n) => n.n);
10090
+ const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DDrS8HrV.js").then((n) => n.n);
10031
10091
  setDiscordTranscriptsVoiceManager({
10032
10092
  accountId: account.accountId,
10033
10093
  manager: voiceManager