@openclaw/discord 2026.5.28 → 2026.5.31-beta.1

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 (82) hide show
  1. package/dist/{account-inspect-C4sJZNbI.js → account-inspect-DDZtT5C8.js} +9 -7
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{accounts-dXTfmnSZ.js → accounts-P19jm1lf.js} +1 -1
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/api.js +16 -16
  6. package/dist/{approval-handler.runtime-CN_E7nkQ.js → approval-handler.runtime-DSFfzXpo.js} +4 -4
  7. package/dist/{audit-BFCBp74H.js → audit-kgIklCyI.js} +4 -4
  8. package/dist/{channel-COXb22wL.js → channel-D0gX0yj6.js} +44 -31
  9. package/dist/{channel-actions-C2g9OmnG.js → channel-actions-DDoc4V7x.js} +4 -4
  10. package/dist/{channel-actions.runtime-drnbrgpt.js → channel-actions.runtime-CqZfnMaA.js} +5 -5
  11. package/dist/channel-config-api.js +1 -1
  12. package/dist/channel-plugin-api.js +1 -1
  13. package/dist/{channel.setup-BsrP5-hv.js → channel.setup-BNZm3eed.js} +8 -23
  14. package/dist/{components-CjQujWa1.js → components-DcLQ2JkV.js} +1 -1
  15. package/dist/{config-schema-3tZYNVTM.js → config-schema-spuxW477.js} +17 -1
  16. package/dist/contract-api.js +3 -3
  17. package/dist/{conversation-identity-CsPV1Gjx.js → conversation-identity-BURFgcfI.js} +7 -5
  18. package/dist/{directory-config-BqPvRoDv.js → directory-config-B9Jw1Q2R.js} +2 -2
  19. package/dist/directory-contract-api.js +1 -1
  20. package/dist/{directory-live-CCI0IMZq.js → directory-live-CDWUg-nA.js} +2 -2
  21. package/dist/{doctor-Dy7sI1sL.js → doctor-BUhqxLb9.js} +4 -5
  22. package/dist/{doctor-contract-8-Ia3d_X.js → doctor-contract-BAu3WLvd.js} +5 -5
  23. package/dist/doctor-contract-api.js +1 -1
  24. package/dist/{handle-action.guild-admin-BmjclQbR.js → handle-action.guild-admin-Dpa-kUzu.js} +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/legacy-state-migrations-api.js +3 -1
  27. package/dist/{manager.runtime-ClhnLsZf.js → manager.runtime-BWBENHRA.js} +22 -19
  28. package/dist/{message-handler-BnhAHqem.js → message-handler-HO8BbZmQ.js} +182 -29
  29. package/dist/{message-handler.preflight-B1RTQ6ZO.js → message-handler.preflight-DxHBPQvD.js} +24 -17
  30. package/dist/{message-handler.process-B1ODKav3.js → message-handler.process-Cq3j7A9k.js} +41 -29
  31. package/dist/{message-utils-CmB03FoF.js → message-utils-D_3KTxh_.js} +19 -15
  32. package/dist/{outbound-adapter-DfY2Dtf3.js → outbound-adapter-BkPkILpq.js} +52 -87
  33. package/dist/{pluralkit-DAZN3ZMK.js → pluralkit-Ds9aZAM4.js} +1 -1
  34. package/dist/{probe-BiEg-_i1.js → probe-2MdGjUAf.js} +1 -1
  35. package/dist/{probe.runtime-Dja7CbJT.js → probe.runtime-J927koKG.js} +1 -1
  36. package/dist/{provider-DCcqVFp-.js → provider-BK8hjk_y.js} +224 -150
  37. package/dist/{provider-session.runtime-mKSG07RE.js → provider-session.runtime-CYMFlLg9.js} +3 -3
  38. package/dist/provider.runtime-RfQSSM_v.js +2 -0
  39. package/dist/{resolve-allowlist-common-DAIbZobr.js → resolve-allowlist-common-BIf3417N.js} +1 -1
  40. package/dist/{resolve-channels-D1zgoxnw.js → resolve-channels-DK-3f_aA.js} +2 -2
  41. package/dist/{resolve-users-wPAvLk_8.js → resolve-users-DUDPsfWt.js} +2 -2
  42. package/dist/{runtime-gaB5-Wsj.js → runtime-Blf_d9E7.js} +8 -8
  43. package/dist/runtime-api.actions.js +2 -2
  44. package/dist/runtime-api.js +22 -22
  45. package/dist/runtime-api.lookup.js +5 -5
  46. package/dist/runtime-api.monitor-LVbgPRHA.js +6 -0
  47. package/dist/runtime-api.monitor.js +5 -5
  48. package/dist/runtime-api.send.js +5 -5
  49. package/dist/runtime-api.threads.js +5 -5
  50. package/dist/{send-CBxhnbKU.js → send-BHkA8a-k.js} +7 -7
  51. package/dist/{send.components-uuQuHL3t.js → send.components-CUHzDapa.js} +26 -12
  52. package/dist/{send.outbound-DZHJYmNF.js → send.outbound-DSKZbjML.js} +15 -5
  53. package/dist/{send.receipt-3y2lVFRf.js → send.receipt-CjsWpitW.js} +25 -13
  54. package/dist/{send.shared-Ddl21-Gt.js → send.shared-Cluujl6W.js} +3 -3
  55. package/dist/setup-plugin-api.js +1 -1
  56. package/dist/{shared-D3NkInmq.js → shared-BMGLQw74.js} +5 -5
  57. package/dist/{subagent-hooks-BacIbIBD.js → subagent-hooks-7jAn9HT5.js} +3 -3
  58. package/dist/subagent-hooks-api.js +1 -5
  59. package/dist/{system-events-Cw6Hp8RF.js → system-events-BjuNA9Zs.js} +1 -1
  60. package/dist/{target-resolver-jjQzAS6T.js → target-resolver-BYuWNVQp.js} +3 -3
  61. package/dist/targets-BNDUOdvI.js +3 -0
  62. package/dist/{thread-bindings-BBq-yzq2.js → thread-bindings-CKruJE91.js} +6 -6
  63. package/dist/{thread-bindings.discord-api-5QgEd_dW.js → thread-bindings.discord-api-BjLUwwSP.js} +5 -5
  64. package/dist/{thread-bindings.manager-COkxjwR9.js → thread-bindings.manager-Dji7SZHG.js} +4 -4
  65. package/dist/{thread-bindings.session-updates-D5gY2ZTE.js → thread-bindings.session-updates-DoDFvU_h.js} +1 -1
  66. package/dist/{thread-bindings.state-BsOnj5NX.js → thread-bindings.state-DYp4FVEB.js} +8 -2
  67. package/dist/{timeouts-l_PsHQvX.js → timeouts-CEJ3--Uw.js} +5 -2
  68. package/dist/timeouts.js +1 -1
  69. package/dist/{transcripts-source-DDrS8HrV.js → transcripts-source-O73_YIDs.js} +1 -1
  70. package/dist/transcripts-source-api.js +1 -1
  71. package/dist/{typing-B7bCMPJJ.js → typing-CKW0i8du.js} +2 -2
  72. package/node_modules/typebox/build/type/script/mapping.d.mts +5 -2
  73. package/node_modules/typebox/build/type/script/mapping.mjs +15 -8
  74. package/node_modules/typebox/build/type/script/parser.d.mts +3 -1
  75. package/node_modules/typebox/build/type/script/parser.mjs +2 -1
  76. package/node_modules/typebox/package.json +29 -29
  77. package/npm-shrinkwrap.json +7 -38
  78. package/openclaw.plugin.json +77 -1
  79. package/package.json +5 -5
  80. package/dist/provider.runtime-BmpunJHX.js +0 -2
  81. package/dist/runtime-api.monitor-B38upMUK.js +0 -5
  82. package/dist/targets-BVKF5wbg.js +0 -3
@@ -1,35 +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-3y2lVFRf.js";
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-CjQujWa1.js";
4
- import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-uuQuHL3t.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-CjsWpitW.js";
2
+ import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
3
+ import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-DcLQ2JkV.js";
4
+ import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-CUHzDapa.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-Ddl21-Gt.js";
6
+ import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, H as withValidatedDiscordProxy, I as createDiscordRestClient, V as validateDiscordProxyUrl } from "./send.shared-Cluujl6W.js";
7
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-CBxhnbKU.js";
10
- import { i as formatMention, t as sendMessageDiscord } from "./send.outbound-DZHJYmNF.js";
9
+ import { s as sendVoiceMessageDiscord } from "./send-BHkA8a-k.js";
10
+ import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-DSKZbjML.js";
11
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";
17
- import { o as raceWithTimeout, s as withAbortTimeout } from "./timeouts-l_PsHQvX.js";
18
- import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-CmB03FoF.js";
12
+ import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-BURFgcfI.js";
13
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-DK-3f_aA.js";
14
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-DUDPsfWt.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-BjLUwwSP.js";
16
+ import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-2MdGjUAf.js";
17
+ import { o as raceWithTimeout, s as withAbortTimeout } from "./timeouts-CEJ3--Uw.js";
18
+ import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-D_3KTxh_.js";
19
19
  import { t as resolveDiscordSenderIdentity } from "./sender-identity-BFp5w0F8.js";
20
- import "./approval-handler.runtime-CN_E7nkQ.js";
20
+ import "./approval-handler.runtime-DSFfzXpo.js";
21
21
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
22
22
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
23
23
  import { buildAgentSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
24
24
  import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
25
25
  import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
26
+ import { MAX_DATE_TIMESTAMP_MS, asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
26
27
  import { createHash, randomUUID } from "node:crypto";
27
28
  import path from "node:path";
28
29
  import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
29
30
  import { Type } from "typebox";
30
31
  import { Check, Errors } from "typebox/value";
31
32
  import { inspect } from "node:util";
32
- import { parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
33
33
  import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
34
34
  import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
35
35
  import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
@@ -76,6 +76,7 @@ import { captureHttpExchange, captureWsEvent, resolveDebugProxySettings, resolve
76
76
  import * as dns from "node:dns";
77
77
  import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
78
78
  import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
79
+ import { stripPlainTextToolCallBlocks } from "openclaw/plugin-sdk/tool-payload";
79
80
  import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
80
81
  import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
81
82
  import { Agent as Agent$1, fetch as fetch$1 } from "undici";
@@ -2231,6 +2232,7 @@ const PREFERENCE_MAX_ENTRIES = 2e3;
2231
2232
  const MAX_PLUGIN_STATE_KEY_BYTES = 512;
2232
2233
  const textEncoder = new TextEncoder();
2233
2234
  let lastPreferenceTimestampMs = 0;
2235
+ let lastPreferenceOrder = 0;
2234
2236
  const legacyPreferenceImports = /* @__PURE__ */ new Map();
2235
2237
  function openPreferenceStore(env) {
2236
2238
  return getDiscordRuntime().state.openKeyedStore({
@@ -2289,7 +2291,8 @@ function sanitizeStoredPreferenceEntry(value) {
2289
2291
  return {
2290
2292
  scopeKey: typedValue.scopeKey,
2291
2293
  modelRef,
2292
- updatedAt: typeof typedValue.updatedAt === "string" ? typedValue.updatedAt : ""
2294
+ updatedAt: typeof typedValue.updatedAt === "string" ? typedValue.updatedAt : "",
2295
+ updatedOrder: typeof typedValue.updatedOrder === "number" && Number.isSafeInteger(typedValue.updatedOrder) ? typedValue.updatedOrder : void 0
2293
2296
  };
2294
2297
  }
2295
2298
  function hashSegment(value, length) {
@@ -2302,12 +2305,25 @@ function timestampMs(value) {
2302
2305
  const parsed = Date.parse(value);
2303
2306
  return Number.isFinite(parsed) ? parsed : 0;
2304
2307
  }
2305
- function legacyUpdatedAtForIndex(updatedAt, index, total) {
2306
- return new Date(timestampMs(updatedAt) + Math.max(0, total - index)).toISOString();
2308
+ function timestampOrder(value) {
2309
+ return value !== void 0 && value >= 0 ? value : 0;
2307
2310
  }
2308
- function nextPreferenceTimestampIso() {
2309
- lastPreferenceTimestampMs = Math.max(Date.now(), lastPreferenceTimestampMs + 1);
2310
- return new Date(lastPreferenceTimestampMs).toISOString();
2311
+ function comparePreferenceEntries(left, right) {
2312
+ return timestampMs(right.value.updatedAt) - timestampMs(left.value.updatedAt) || timestampOrder(right.value.updatedOrder) - timestampOrder(left.value.updatedOrder) || left.key.localeCompare(right.key);
2313
+ }
2314
+ function legacyUpdatedAtForIndex(updatedAt, index, total) {
2315
+ const baseMs = timestampMs(updatedAt);
2316
+ return timestampMsToIsoString(Math.min(baseMs + Math.max(0, total), MAX_DATE_TIMESTAMP_MS) - Math.max(0, index)) ?? timestampMsToIsoString(baseMs) ?? timestampMsToIsoString(Math.max(0, total - index)) ?? "1970-01-01T00:00:00.000Z";
2317
+ }
2318
+ function nextPreferenceTimestamp(existingEntries) {
2319
+ const existingMaxTimestampMs = existingEntries.reduce((max, entry) => Math.max(max, timestampMs(entry.updatedAt)), 0);
2320
+ lastPreferenceTimestampMs = Math.min(Math.max(resolveDateTimestampMs(Date.now(), 0), lastPreferenceTimestampMs + 1, existingMaxTimestampMs + 1), MAX_DATE_TIMESTAMP_MS);
2321
+ const existingMaxOrder = existingEntries.reduce((max, entry) => Math.max(max, timestampOrder(entry.updatedOrder)), 0);
2322
+ lastPreferenceOrder = Math.max(lastPreferenceOrder + 1, existingMaxOrder + 1);
2323
+ return {
2324
+ updatedAt: resolveTimestampMsToIsoString(lastPreferenceTimestampMs),
2325
+ updatedOrder: lastPreferenceOrder
2326
+ };
2311
2327
  }
2312
2328
  function normalizeLegacyPreferenceKey(key) {
2313
2329
  const trimmed = key.trim();
@@ -2356,7 +2372,10 @@ async function readDiscordModelPickerRecentModels(params) {
2356
2372
  const limit = Math.max(1, Math.min(params.limit ?? DEFAULT_RECENT_LIMIT, 10));
2357
2373
  try {
2358
2374
  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);
2375
+ const recent = (await openPreferenceStore(params.env).entries()).map((entry) => ({
2376
+ key: entry.key,
2377
+ value: sanitizeStoredPreferenceEntry(entry.value)
2378
+ })).filter((entry) => entry.value?.scopeKey === key).toSorted(comparePreferenceEntries).map((entry) => entry.value.modelRef);
2360
2379
  if (!params.allowedModelRefs || params.allowedModelRefs.size === 0) return sanitizeRecentModels(recent, limit);
2361
2380
  return sanitizeRecentModels(recent.filter((modelRef) => params.allowedModelRefs?.has(modelRef)), limit);
2362
2381
  } catch {
@@ -2370,20 +2389,19 @@ async function recordDiscordModelPickerRecentModel(params) {
2370
2389
  try {
2371
2390
  await importLegacyPreferences(params.env);
2372
2391
  const store = openPreferenceStore(params.env);
2392
+ const timestamp = nextPreferenceTimestamp((await store.entries()).map((entry) => sanitizeStoredPreferenceEntry(entry.value)).filter((entry) => entry?.scopeKey === key));
2373
2393
  await store.register(buildPreferenceModelKey(key, normalizedModelRef), {
2374
2394
  scopeKey: key,
2375
2395
  modelRef: normalizedModelRef,
2376
- updatedAt: nextPreferenceTimestampIso()
2396
+ ...timestamp
2377
2397
  });
2378
2398
  const limit = Math.max(1, Math.min(params.limit ?? DEFAULT_RECENT_LIMIT, 10));
2379
2399
  const scopedEntries = (await store.entries()).map((entry) => ({
2380
2400
  key: entry.key,
2381
2401
  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));
2402
+ })).filter((entry) => entry.value?.scopeKey === key).toSorted(comparePreferenceEntries);
2383
2403
  await Promise.all(scopedEntries.slice(limit).map((entry) => store.delete(entry.key)));
2384
- } catch {
2385
- return;
2386
- }
2404
+ } catch {}
2387
2405
  }
2388
2406
  //#endregion
2389
2407
  //#region extensions/discord/src/monitor/model-picker.state.ts
@@ -4839,21 +4857,26 @@ function normalizeMaxConcurrency(value) {
4839
4857
  }
4840
4858
  var GatewayIdentifyLimiter = class {
4841
4859
  constructor() {
4842
- this.nextAllowedAtByKey = /* @__PURE__ */ new Map();
4860
+ this.stateByKey = /* @__PURE__ */ new Map();
4843
4861
  }
4844
4862
  async wait(params) {
4845
4863
  const maxConcurrency = normalizeMaxConcurrency(params.maxConcurrency);
4846
4864
  const rateKey = (params.shardId ?? 0) % maxConcurrency;
4847
4865
  const now = Date.now();
4848
- const nextAllowedAt = this.nextAllowedAtByKey.get(rateKey) ?? now;
4866
+ const state = this.stateByKey.get(rateKey);
4867
+ const clockMovedBackward = state !== void 0 && now < state.lastObservedAt;
4868
+ const nextAllowedAt = state === void 0 ? now : clockMovedBackward ? now + IDENTIFY_WINDOW_MS : state.nextAllowedAt;
4849
4869
  const waitMs = Math.max(0, nextAllowedAt - now);
4850
- this.nextAllowedAtByKey.set(rateKey, Math.max(now, nextAllowedAt) + IDENTIFY_WINDOW_MS);
4870
+ this.stateByKey.set(rateKey, {
4871
+ lastObservedAt: now,
4872
+ nextAllowedAt: Math.max(now, nextAllowedAt) + IDENTIFY_WINDOW_MS
4873
+ });
4851
4874
  if (waitMs > 0) await new Promise((resolve) => {
4852
4875
  setTimeout(resolve, waitMs).unref?.();
4853
4876
  });
4854
4877
  }
4855
4878
  reset() {
4856
- this.nextAllowedAtByKey.clear();
4879
+ this.stateByKey.clear();
4857
4880
  }
4858
4881
  };
4859
4882
  const sharedGatewayIdentifyLimiter = new GatewayIdentifyLimiter();
@@ -5798,6 +5821,9 @@ async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
5798
5821
  //#endregion
5799
5822
  //#region extensions/discord/src/monitor/gateway-plugin.ts
5800
5823
  const DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS = 3e4;
5824
+ const DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE = 1008;
5825
+ const DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE = "WS_ERR_TOO_MANY_BUFFERED_PARTS";
5826
+ const DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS = 240;
5801
5827
  const discordDnsLookup$1 = createDiscordDnsLookup();
5802
5828
  const registrationPromises = /* @__PURE__ */ new WeakMap();
5803
5829
  function assignGatewayClient(plugin, client) {
@@ -5807,6 +5833,58 @@ function hasGatewaySocketStarted(plugin) {
5807
5833
  const state = plugin;
5808
5834
  return state.ws != null || state.isConnecting === true;
5809
5835
  }
5836
+ function readStringProperty(value, key) {
5837
+ const property = value[key];
5838
+ return typeof property === "string" && property ? property : void 0;
5839
+ }
5840
+ function readNumberProperty(value, key) {
5841
+ const property = value[key];
5842
+ return typeof property === "number" && Number.isFinite(property) ? property : void 0;
5843
+ }
5844
+ function describeDiscordGatewayTransportError(error) {
5845
+ const code = readStringProperty(error, "code");
5846
+ const closeCode = readNumberProperty(error, "closeCode");
5847
+ const statusCode = readNumberProperty(error, "statusCode");
5848
+ return {
5849
+ ...error.name ? { name: error.name } : {},
5850
+ message: error.message,
5851
+ ...code ? { code } : {},
5852
+ ...closeCode !== void 0 ? { closeCode } : {},
5853
+ ...statusCode !== void 0 ? { statusCode } : {}
5854
+ };
5855
+ }
5856
+ function formatDiscordGatewayCloseReason(reason) {
5857
+ if (!reason.length) return "<empty>";
5858
+ const text = reason.toString("utf8").replaceAll(/\s+/g, " ").trim();
5859
+ if (!text) return `<${reason.length} bytes>`;
5860
+ if (text.length <= DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS) return text;
5861
+ return `${text.slice(0, DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS)}...`;
5862
+ }
5863
+ function formatDiscordGatewayTransportErrorLog(params) {
5864
+ return `discord: gateway websocket error ${[
5865
+ `flow=${params.flowId}`,
5866
+ params.error.name ? `name=${params.error.name}` : void 0,
5867
+ params.error.code ? `code=${params.error.code}` : void 0,
5868
+ typeof params.error.closeCode === "number" ? `closeCode=${params.error.closeCode}` : void 0,
5869
+ typeof params.error.statusCode === "number" ? `statusCode=${params.error.statusCode}` : void 0,
5870
+ `message=${params.error.message}`
5871
+ ].filter(Boolean).join(" ")}`;
5872
+ }
5873
+ function formatDiscordGatewayTransportCloseLog(params) {
5874
+ const receiverLimit = params.code === DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE || params.lastError?.code === DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE;
5875
+ return `discord: gateway websocket closed ${[
5876
+ `flow=${params.flowId}`,
5877
+ `code=${params.code}`,
5878
+ `reasonBytes=${params.reason.length}`,
5879
+ `reason=${formatDiscordGatewayCloseReason(params.reason)}`,
5880
+ params.lastError?.code ? `lastErrorCode=${params.lastError.code}` : void 0,
5881
+ params.lastError?.message ? `lastError=${params.lastError.message}` : void 0,
5882
+ receiverLimit ? "hint=possible ws receiver buffered-parts limit" : void 0
5883
+ ].filter(Boolean).join(" ")}`;
5884
+ }
5885
+ function shouldLogDiscordGatewayTransportClose(params) {
5886
+ return params.code === DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE || params.code !== 1e3 && params.code !== 1001 || params.reason.length > 0 || params.lastError !== void 0;
5887
+ }
5810
5888
  function resolveDiscordGatewayIntents(params) {
5811
5889
  const intentsConfig = params?.intentsConfig;
5812
5890
  const voiceEnabled = params?.voiceEnabled;
@@ -5861,6 +5939,7 @@ function createGatewayPlugin(params) {
5861
5939
  handshakeTimeout: DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS,
5862
5940
  ...params.wsAgent ? { agent: params.wsAgent } : {}
5863
5941
  });
5942
+ let lastTransportError;
5864
5943
  const emitTransportActivity = () => {
5865
5944
  if (this.ws !== socket) return;
5866
5945
  this.emitter.emit(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, { at: Date.now() });
@@ -5884,17 +5963,29 @@ function createGatewayPlugin(params) {
5884
5963
  });
5885
5964
  });
5886
5965
  socket.on?.("close", (code, reason) => {
5966
+ const closeReason = Buffer.isBuffer(reason) ? reason : Buffer.from(String(reason ?? ""));
5887
5967
  captureWsEvent({
5888
5968
  url,
5889
5969
  direction: "local",
5890
5970
  kind: "ws-close",
5891
5971
  flowId: wsFlowId,
5892
5972
  closeCode: code,
5893
- payload: reason,
5973
+ payload: closeReason,
5894
5974
  meta: { subsystem: "discord-gateway" }
5895
5975
  });
5976
+ if (shouldLogDiscordGatewayTransportClose({
5977
+ code,
5978
+ reason: closeReason,
5979
+ lastError: lastTransportError
5980
+ })) params.runtime?.log?.(warn(formatDiscordGatewayTransportCloseLog({
5981
+ flowId: wsFlowId,
5982
+ code,
5983
+ reason: closeReason,
5984
+ lastError: lastTransportError
5985
+ })));
5896
5986
  });
5897
5987
  socket.on?.("error", (error) => {
5988
+ lastTransportError = describeDiscordGatewayTransportError(error);
5898
5989
  captureWsEvent({
5899
5990
  url,
5900
5991
  direction: "local",
@@ -5903,6 +5994,10 @@ function createGatewayPlugin(params) {
5903
5994
  errorText: error.message,
5904
5995
  meta: { subsystem: "discord-gateway" }
5905
5996
  });
5997
+ params.runtime?.log?.(warn(formatDiscordGatewayTransportErrorLog({
5998
+ flowId: wsFlowId,
5999
+ error: lastTransportError
6000
+ })));
5906
6001
  });
5907
6002
  if ("binaryType" in socket) try {
5908
6003
  socket.binaryType = "arraybuffer";
@@ -6054,9 +6149,7 @@ function createDiscordGatewaySupervisor(params) {
6054
6149
  case "teardown":
6055
6150
  logLateEvent("teardown")(event);
6056
6151
  return;
6057
- case "buffering":
6058
- pending.push(event);
6059
- return;
6152
+ case "buffering": pending.push(event);
6060
6153
  }
6061
6154
  };
6062
6155
  emitter.on("error", onGatewayError);
@@ -6109,6 +6202,13 @@ function classifyAcpStatusProbeError(params) {
6109
6202
  reason: "status-error"
6110
6203
  };
6111
6204
  }
6205
+ function resolveRunningActivityAgeMs(params) {
6206
+ if (params.storedState !== "running") return 0;
6207
+ const nowMs = asDateTimestampMs(Date.now());
6208
+ if (nowMs === void 0) return 0;
6209
+ const activityAtMs = asDateTimestampMs(params.lastActivityAt);
6210
+ return Math.max(0, nowMs - (activityAtMs === void 0 ? 0 : Math.max(0, Math.floor(activityAtMs))));
6211
+ }
6112
6212
  async function probeDiscordAcpBindingHealth(params) {
6113
6213
  const { getAcpSessionManager, isAcpRuntimeError } = params.providerSessionRuntime;
6114
6214
  const manager = getAcpSessionManager();
@@ -6129,7 +6229,7 @@ async function probeDiscordAcpBindingHealth(params) {
6129
6229
  onTimeout: () => ({ kind: "timeout" })
6130
6230
  });
6131
6231
  if (result.kind === "timeout") statusProbeAbortController.abort();
6132
- const runningForMs = params.storedState === "running" && Number.isFinite(params.lastActivityAt) ? Date.now() - Math.max(0, Math.floor(params.lastActivityAt ?? 0)) : 0;
6232
+ const runningForMs = resolveRunningActivityAgeMs(params);
6133
6233
  const isStaleRunning = params.storedState === "running" && runningForMs >= DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS;
6134
6234
  if (result.kind === "timeout") return isStaleRunning ? {
6135
6235
  status: "stale",
@@ -6769,7 +6869,6 @@ async function deployDiscordCommands(params) {
6769
6869
  try {
6770
6870
  try {
6771
6871
  await params.client.deployCommands({ mode: "reconcile" });
6772
- return;
6773
6872
  } catch (err) {
6774
6873
  if (isDiscordDeployDailyCreateLimit(err)) {
6775
6874
  params.runtime.log?.(warn(`discord: native slash command deploy skipped for ${accountId}; daily application command create limit reached. Existing slash commands stay active until Discord resets the quota. Message send/receive is unaffected.`));
@@ -7760,7 +7859,7 @@ function collapseExcessBlankLines(text) {
7760
7859
  return text.replace(/[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n");
7761
7860
  }
7762
7861
  function sanitizeDiscordFrontChannelText(text) {
7763
- return collapseExcessBlankLines(stripDiscordInternalTraceLines(sanitizeAssistantVisibleText(text))).trim();
7862
+ return collapseExcessBlankLines(stripDiscordInternalTraceLines(stripPlainTextToolCallBlocks(sanitizeAssistantVisibleText(stripPlainTextToolCallBlocks(text))))).trim();
7764
7863
  }
7765
7864
  function sanitizeDiscordFrontChannelReplyPayloads(payloads, options = {}) {
7766
7865
  const preserveVerboseToolProgress = options.kind === "tool";
@@ -7876,7 +7975,7 @@ async function loadConversationRuntime$1() {
7876
7975
  return await conversationRuntimePromise$1;
7877
7976
  }
7878
7977
  async function loadTypingRuntime() {
7879
- typingRuntimePromise ??= import("./typing-B7bCMPJJ.js").then((n) => n.n);
7978
+ typingRuntimePromise ??= import("./typing-CKW0i8du.js").then((n) => n.n);
7880
7979
  return await typingRuntimePromise;
7881
7980
  }
7882
7981
  function buildDiscordComponentConversationLabel(params) {
@@ -8297,7 +8396,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
8297
8396
  //#region extensions/discord/src/monitor/agent-components.handlers.ts
8298
8397
  let componentsRuntimePromise;
8299
8398
  async function loadComponentsRuntime() {
8300
- componentsRuntimePromise ??= import("./components-CjQujWa1.js").then((n) => n.t);
8399
+ componentsRuntimePromise ??= import("./components-DcLQ2JkV.js").then((n) => n.t);
8301
8400
  return await componentsRuntimePromise;
8302
8401
  }
8303
8402
  async function handleDiscordComponentEvent(params) {
@@ -8616,6 +8715,66 @@ var DiscordComponentModal = class extends Modal {
8616
8715
  };
8617
8716
  //#endregion
8618
8717
  //#region extensions/discord/src/monitor/agent-components.system-controls.ts
8718
+ async function runAgentSystemControlInteraction(params) {
8719
+ const parsed = parseAgentComponentData(params.data);
8720
+ if (!parsed) {
8721
+ logError(`${params.label}: failed to parse component data`);
8722
+ try {
8723
+ await params.interaction.reply({
8724
+ content: params.invalidReply,
8725
+ ephemeral: true
8726
+ });
8727
+ } catch {}
8728
+ return;
8729
+ }
8730
+ const { componentId } = parsed;
8731
+ const interactionCtx = await resolveInteractionContextWithDmAuth({
8732
+ ctx: params.ctx,
8733
+ interaction: params.interaction,
8734
+ label: params.label,
8735
+ componentLabel: params.interactionComponentLabel,
8736
+ defer: false
8737
+ });
8738
+ if (!interactionCtx) return;
8739
+ const { channelId, user, username, userId, replyOpts, rawGuildId, isDirectMessage, isGroupDm, memberRoleIds } = interactionCtx;
8740
+ const allowed = await ensureAgentComponentInteractionAllowed({
8741
+ ctx: params.ctx,
8742
+ interaction: params.interaction,
8743
+ channelId,
8744
+ rawGuildId,
8745
+ memberRoleIds,
8746
+ user,
8747
+ replyOpts,
8748
+ componentLabel: params.authorizationComponentLabel,
8749
+ unauthorizedReply: params.unauthorizedReply
8750
+ });
8751
+ if (!allowed) return;
8752
+ const route = resolveAgentComponentRoute({
8753
+ ctx: params.ctx,
8754
+ rawGuildId,
8755
+ memberRoleIds,
8756
+ isDirectMessage,
8757
+ isGroupDm,
8758
+ userId,
8759
+ channelId,
8760
+ parentId: allowed.parentId
8761
+ });
8762
+ const eventText = params.formatEventText({
8763
+ componentId,
8764
+ username,
8765
+ userId
8766
+ });
8767
+ logDebug(`${params.label}: enqueuing event for channel ${channelId}: ${eventText}`);
8768
+ enqueueSystemEvent$1(eventText, {
8769
+ sessionKey: route.sessionKey,
8770
+ contextKey: `${params.contextKeyPrefix}:${channelId}:${componentId}:${userId}`
8771
+ });
8772
+ await ackComponentInteraction({
8773
+ interaction: params.interaction,
8774
+ replyOpts,
8775
+ label: params.label
8776
+ });
8777
+ }
8619
8778
  var AgentComponentButton = class extends Button {
8620
8779
  constructor(ctx) {
8621
8780
  super();
@@ -8625,60 +8784,17 @@ var AgentComponentButton = class extends Button {
8625
8784
  this.ctx = ctx;
8626
8785
  }
8627
8786
  async run(interaction, data) {
8628
- const parsed = parseAgentComponentData(data);
8629
- if (!parsed) {
8630
- logError("agent button: failed to parse component data");
8631
- try {
8632
- await interaction.reply({
8633
- content: "This button is no longer valid.",
8634
- ephemeral: true
8635
- });
8636
- } catch {}
8637
- return;
8638
- }
8639
- const { componentId } = parsed;
8640
- const interactionCtx = await resolveInteractionContextWithDmAuth({
8787
+ await runAgentSystemControlInteraction({
8641
8788
  ctx: this.ctx,
8642
8789
  interaction,
8790
+ data,
8643
8791
  label: "agent button",
8644
- componentLabel: "button",
8645
- defer: false
8646
- });
8647
- if (!interactionCtx) return;
8648
- const { channelId, user, username, userId, replyOpts, rawGuildId, isDirectMessage, isGroupDm, memberRoleIds } = interactionCtx;
8649
- const allowed = await ensureAgentComponentInteractionAllowed({
8650
- ctx: this.ctx,
8651
- interaction,
8652
- channelId,
8653
- rawGuildId,
8654
- memberRoleIds,
8655
- user,
8656
- replyOpts,
8657
- componentLabel: "button",
8658
- unauthorizedReply: "You are not authorized to use this button."
8659
- });
8660
- if (!allowed) return;
8661
- const { parentId } = allowed;
8662
- const route = resolveAgentComponentRoute({
8663
- ctx: this.ctx,
8664
- rawGuildId,
8665
- memberRoleIds,
8666
- isDirectMessage,
8667
- isGroupDm,
8668
- userId,
8669
- channelId,
8670
- parentId
8671
- });
8672
- const eventText = `[Discord component: ${componentId} clicked by ${username} (${userId})]`;
8673
- logDebug(`agent button: enqueuing event for channel ${channelId}: ${eventText}`);
8674
- enqueueSystemEvent$1(eventText, {
8675
- sessionKey: route.sessionKey,
8676
- contextKey: `discord:agent-button:${channelId}:${componentId}:${userId}`
8677
- });
8678
- await ackComponentInteraction({
8679
- interaction,
8680
- replyOpts,
8681
- label: "agent button"
8792
+ interactionComponentLabel: "button",
8793
+ authorizationComponentLabel: "button",
8794
+ invalidReply: "This button is no longer valid.",
8795
+ unauthorizedReply: "You are not authorized to use this button.",
8796
+ contextKeyPrefix: "discord:agent-button",
8797
+ formatEventText: ({ componentId, username, userId }) => `[Discord component: ${componentId} clicked by ${username} (${userId})]`
8682
8798
  });
8683
8799
  }
8684
8800
  };
@@ -8690,62 +8806,19 @@ var AgentSelectMenu = class extends StringSelectMenu {
8690
8806
  this.ctx = ctx;
8691
8807
  }
8692
8808
  async run(interaction, data) {
8693
- const parsed = parseAgentComponentData(data);
8694
- if (!parsed) {
8695
- logError("agent select: failed to parse component data");
8696
- try {
8697
- await interaction.reply({
8698
- content: "This select menu is no longer valid.",
8699
- ephemeral: true
8700
- });
8701
- } catch {}
8702
- return;
8703
- }
8704
- const { componentId } = parsed;
8705
- const interactionCtx = await resolveInteractionContextWithDmAuth({
8706
- ctx: this.ctx,
8707
- interaction,
8708
- label: "agent select",
8709
- componentLabel: "select menu",
8710
- defer: false
8711
- });
8712
- if (!interactionCtx) return;
8713
- const { channelId, user, username, userId, replyOpts, rawGuildId, isDirectMessage, isGroupDm, memberRoleIds } = interactionCtx;
8714
- const allowed = await ensureAgentComponentInteractionAllowed({
8715
- ctx: this.ctx,
8716
- interaction,
8717
- channelId,
8718
- rawGuildId,
8719
- memberRoleIds,
8720
- user,
8721
- replyOpts,
8722
- componentLabel: "select",
8723
- unauthorizedReply: "You are not authorized to use this select menu."
8724
- });
8725
- if (!allowed) return;
8726
- const { parentId } = allowed;
8727
8809
  const values = interaction.values ?? [];
8728
8810
  const valuesText = values.length > 0 ? ` (selected: ${values.join(", ")})` : "";
8729
- const route = resolveAgentComponentRoute({
8811
+ await runAgentSystemControlInteraction({
8730
8812
  ctx: this.ctx,
8731
- rawGuildId,
8732
- memberRoleIds,
8733
- isDirectMessage,
8734
- isGroupDm,
8735
- userId,
8736
- channelId,
8737
- parentId
8738
- });
8739
- const eventText = `[Discord select menu: ${componentId} interacted by ${username} (${userId})${valuesText}]`;
8740
- logDebug(`agent select: enqueuing event for channel ${channelId}: ${eventText}`);
8741
- enqueueSystemEvent$1(eventText, {
8742
- sessionKey: route.sessionKey,
8743
- contextKey: `discord:agent-select:${channelId}:${componentId}:${userId}`
8744
- });
8745
- await ackComponentInteraction({
8746
8813
  interaction,
8747
- replyOpts,
8748
- label: "agent select"
8814
+ data,
8815
+ label: "agent select",
8816
+ interactionComponentLabel: "select menu",
8817
+ authorizationComponentLabel: "select",
8818
+ invalidReply: "This select menu is no longer valid.",
8819
+ unauthorizedReply: "You are not authorized to use this select menu.",
8820
+ contextKeyPrefix: "discord:agent-select",
8821
+ formatEventText: ({ componentId, username, userId }) => `[Discord select menu: ${componentId} interacted by ${username} (${userId})${valuesText}]`
8749
8822
  });
8750
8823
  }
8751
8824
  };
@@ -9267,7 +9340,8 @@ function parseGatewayCloseCode(message) {
9267
9340
  }
9268
9341
  function resolveTransportActivityAt(event) {
9269
9342
  const at = event?.at;
9270
- return typeof at === "number" && Number.isFinite(at) && at >= 0 ? at : Date.now();
9343
+ const timestampMs = asDateTimestampMs(at);
9344
+ return timestampMs !== void 0 && timestampMs >= 0 ? timestampMs : Date.now();
9271
9345
  }
9272
9346
  function createGatewayStatusObserver(params) {
9273
9347
  let forceStopHandler;
@@ -9529,7 +9603,7 @@ async function runDiscordGatewayLifecycle(params) {
9529
9603
  gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
9530
9604
  if (params.voiceManager) {
9531
9605
  await params.voiceManager.destroy();
9532
- const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DDrS8HrV.js").then((n) => n.n);
9606
+ const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-O73_YIDs.js").then((n) => n.n);
9533
9607
  setDiscordTranscriptsVoiceManager({
9534
9608
  accountId: params.accountId,
9535
9609
  manager: null
@@ -9807,7 +9881,7 @@ function logDiscordStartupPhase(params) {
9807
9881
  });
9808
9882
  }
9809
9883
  async function loadDiscordVoiceRuntime() {
9810
- const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-ClhnLsZf.js");
9884
+ const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-BWBENHRA.js");
9811
9885
  discordVoiceRuntimePromise = promise;
9812
9886
  try {
9813
9887
  return await promise;
@@ -9817,7 +9891,7 @@ async function loadDiscordVoiceRuntime() {
9817
9891
  }
9818
9892
  }
9819
9893
  async function loadDiscordProviderSessionRuntime() {
9820
- const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-mKSG07RE.js");
9894
+ const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-CYMFlLg9.js");
9821
9895
  discordProviderSessionRuntimePromise = promise;
9822
9896
  try {
9823
9897
  return await promise;
@@ -10063,7 +10137,7 @@ async function monitorDiscordProvider(opts = {}) {
10063
10137
  });
10064
10138
  const logger = createSubsystemLogger("discord/monitor");
10065
10139
  const guildHistories = /* @__PURE__ */ new Map();
10066
- let { botUserId, botUserName } = await fetchDiscordBotIdentity({
10140
+ const { botUserId, botUserName } = await fetchDiscordBotIdentity({
10067
10141
  client,
10068
10142
  token,
10069
10143
  runtime,
@@ -10087,7 +10161,7 @@ async function monitorDiscordProvider(opts = {}) {
10087
10161
  runtime,
10088
10162
  botUserId
10089
10163
  });
10090
- const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DDrS8HrV.js").then((n) => n.n);
10164
+ const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-O73_YIDs.js").then((n) => n.n);
10091
10165
  setDiscordTranscriptsVoiceManager({
10092
10166
  accountId: account.accountId,
10093
10167
  manager: voiceManager
@@ -1,6 +1,6 @@
1
- import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-BBq-yzq2.js";
2
- import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-COkxjwR9.js";
3
- import { t as createDiscordMessageHandler } from "./message-handler-BnhAHqem.js";
1
+ import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-CKruJE91.js";
2
+ import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-Dji7SZHG.js";
3
+ import { t as createDiscordMessageHandler } from "./message-handler-HO8BbZmQ.js";
4
4
  import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
5
5
  import { getAcpSessionManager, isAcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
6
6
  export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled };
@@ -0,0 +1,2 @@
1
+ import { t as monitorDiscordProvider } from "./provider-BK8hjk_y.js";
2
+ export { monitorDiscordProvider };
@@ -1,4 +1,4 @@
1
- import { p as normalizeDiscordToken } from "./accounts-dXTfmnSZ.js";
1
+ import { p as normalizeDiscordToken } from "./accounts-P19jm1lf.js";
2
2
  import { n as fetchDiscord } from "./api-BmXlcjYW.js";
3
3
  import { a as normalizeDiscordSlug } from "./allow-list-BnkWtVpA.js";
4
4
  //#region extensions/discord/src/guilds.ts
@@ -1,7 +1,7 @@
1
- import { Wt as __exportAll } from "./send.receipt-3y2lVFRf.js";
1
+ import { Wt as __exportAll } from "./send.receipt-CjsWpitW.js";
2
2
  import { n as fetchDiscord, t as DiscordApiError } from "./api-BmXlcjYW.js";
3
3
  import { a as normalizeDiscordSlug } from "./allow-list-BnkWtVpA.js";
4
- import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-DAIbZobr.js";
4
+ import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-BIf3417N.js";
5
5
  //#region extensions/discord/src/resolve-channels.ts
6
6
  var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
7
7
  function parseDiscordChannelInput(raw) {