@openclaw/discord 2026.9.6 → 2026.9.7

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 (150) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/.setup/{account-inspect-BwQj24ht.mjs → account-inspect-De8hOUxG.mjs} +1 -1
  3. package/dist/.setup/{accounts-CwJQoLjM.mjs → accounts-ChaMcixG.mjs} +1 -4
  4. package/dist/.setup/{activities-api-COU4-0nR.mjs → activities-api-tvbsU2e3.mjs} +38 -66
  5. package/dist/.setup/{api-CBK9zcq5.mjs → api-DVbJwZVt.mjs} +10 -2
  6. package/dist/.setup/{approval-handler.runtime-CbBktBb4.mjs → approval-handler.runtime-DxCK2Rux.mjs} +49 -125
  7. package/dist/.setup/{approval-message-updates-jf9zMaIC.mjs → approval-message-updates-BKFqavHZ.mjs} +2 -2
  8. package/dist/.setup/{audit-vKbh-LFR.mjs → audit-CLg9I71N.mjs} +5 -5
  9. package/dist/.setup/{channel-Dv4e3Jpc.mjs → channel-DxlUVU9t.mjs} +121 -227
  10. package/dist/.setup/{channel-type-DKnjV1XW.mjs → channel-type-DRCrEMss.mjs} +22 -22
  11. package/dist/.setup/{channel.setup-0NX6FFwi.mjs → channel.setup-CRo1GjV7.mjs} +6 -9
  12. package/dist/.setup/{components-yBEb75bB.mjs → components-Cq1PvIpN.mjs} +41 -69
  13. package/dist/.setup/{config-schema-CiZz-mtA.mjs → config-schema-oxELUSDx.mjs} +19 -44
  14. package/dist/.setup/{conversation-binding-route-B7qImK_b.mjs → conversation-binding-route-Caz_XuFH.mjs} +10 -5
  15. package/dist/.setup/{directory-config-BytTftz-.mjs → directory-config-esqNn0Eo.mjs} +6 -9
  16. package/dist/.setup/{directory-live--EGTH0DC.mjs → directory-live-DtKRHuGV.mjs} +6 -12
  17. package/dist/.setup/{discord-BXpHW-cu.mjs → discord-0xJYfdDD.mjs} +82 -386
  18. package/dist/.setup/{doctor-D1R-uFIu.mjs → doctor-BCl1H5tl.mjs} +21 -36
  19. package/dist/.setup/{doctor-contract-Co5vRCZ6.mjs → doctor-contract-CvvgwrrG.mjs} +41 -50
  20. package/dist/.setup/{channel-actions.runtime-leZuw01r.mjs → handle-action-CUvQWnE7.mjs} +67 -104
  21. package/dist/.setup/{handle-action.guild-admin-DcFa8NwA.mjs → handle-action.guild-admin-Df-8gVle.mjs} +62 -120
  22. package/dist/.setup/{live-policy-config-eKQ-PLdy.mjs → live-policy-config-8Pv20CHc.mjs} +2 -3
  23. package/dist/.setup/{message-handler-X6ejmbtY.mjs → message-handler-B-Jk4oDk.mjs} +18 -94
  24. package/dist/.setup/{message-handler.preflight-pluralkit-8Xji34AF.mjs → message-handler.preflight-pluralkit-CWLUBVcx.mjs} +8 -10
  25. package/dist/.setup/{message-handler.preflight-DE_POxFc.mjs → message-handler.preflight-v-__NSDq.mjs} +69 -180
  26. package/dist/.setup/{message-handler.process-CCmIVnxy.mjs → message-handler.process-BNFFuChn.mjs} +65 -86
  27. package/dist/.setup/{outbound-adapter-ClIgmu4F.mjs → outbound-adapter-BobT-kse.mjs} +105 -19
  28. package/dist/.setup/{outbound-session-route-VulUE0yV.mjs → outbound-session-route-zVGxxceg.mjs} +140 -108
  29. package/dist/.setup/{pluralkit-CdAt1G0P.mjs → pluralkit-a6_NLfH9.mjs} +1 -1
  30. package/dist/.setup/{presence-cache-dYSHPWMx.mjs → presence-cache-Di3H3DIU.mjs} +0 -4
  31. package/dist/.setup/{probe-CupW4we4.mjs → probe-LYrIHlBF.mjs} +13 -4
  32. package/dist/.setup/{provider-iOf73HW-.mjs → provider-B_G5hASF.mjs} +721 -1416
  33. package/dist/.setup/provider-session.runtime-BYlTBFD2.mjs +6 -0
  34. package/dist/.setup/provider.runtime-CUE3UxER.mjs +2 -0
  35. package/dist/.setup/{realtime-session.runtime-Dz8uVutq.mjs → realtime-session.runtime-oUd9DOcz.mjs} +41 -55
  36. package/dist/.setup/{receive-recovery-DHst8WRx.mjs → receive-recovery-CHPOsnLc.mjs} +1 -4
  37. package/dist/.setup/{resolve-allowlist-common-CwMBzbx9.mjs → resolve-allowlist-common-DPdRggu5.mjs} +4 -7
  38. package/dist/.setup/{resolve-channels-BbvsLQOZ.mjs → resolve-channels-BFPNRmVv.mjs} +21 -40
  39. package/dist/.setup/{resolve-users-ByFlR7LQ.mjs → resolve-users-0-aBuCy3.mjs} +4 -4
  40. package/dist/.setup/{retry-BEYkDy0P.mjs → retry-pz_cSha2.mjs} +3 -3
  41. package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
  42. package/dist/.setup/{runtime-B8lJfyrA.mjs → runtime-FN000lxA.mjs} +60 -162
  43. package/dist/.setup/runtime-doctor-migrations-CshUGl36.mjs +159 -0
  44. package/dist/.setup/{runtime-DisDbixd.mjs → runtime-sUksZ--Q.mjs} +2 -5
  45. package/dist/.setup/{secret-config-contract-DFu9hfU8.mjs → secret-config-contract-uOE2J7yM.mjs} +15 -85
  46. package/dist/.setup/{security-audit-s5w50-Ly.mjs → security-audit-Cdaegq7C.mjs} +3 -1
  47. package/dist/.setup/{send-CIBzvXjS.mjs → send-CrfEI6Bs.mjs} +53 -108
  48. package/dist/.setup/{send.components-ChY21qr-.mjs → send.components-DxQAMfES.mjs} +62 -107
  49. package/dist/.setup/{send.outbound-QTyuFupn.mjs → send.outbound-BISKnb-a.mjs} +66 -140
  50. package/dist/.setup/{send.shared-VNvWfX2T.mjs → send.shared-DGFkbkQR.mjs} +10 -25
  51. package/dist/.setup/{sender-identity-0Ymgvmaj.mjs → sender-identity-B9X5Vb9R.mjs} +2 -3
  52. package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +3 -0
  53. package/dist/.setup/{shared-DHPDaMSx.mjs → shared-B3wZ4hN-.mjs} +25 -32
  54. package/dist/.setup/{subagent-hooks-CjW7r8Pe.mjs → subagent-hooks-nlUE9ow7.mjs} +5 -6
  55. package/dist/.setup/system-events-CdeZnvPV.mjs +33 -0
  56. package/dist/.setup/{target-resolver-BXpy6VT8.mjs → target-resolver-BuLapkhy.mjs} +9 -12
  57. package/dist/.setup/targets-0KUcEIYx.mjs +3 -0
  58. package/dist/.setup/{thread-bindings-CEh2dhqP.mjs → thread-bindings-D7TfgjR_.mjs} +33 -35
  59. package/dist/.setup/{thread-bindings.manager-ve-i6oqt.mjs → thread-bindings.manager-DN-NissX.mjs} +325 -233
  60. package/dist/.setup/thread-bindings.session-updates-CshfKghV.mjs +359 -0
  61. package/dist/.setup/{thread-bindings.state-BThFQEga.mjs → thread-bindings.state-g6v9zAym.mjs} +21 -62
  62. package/dist/.setup/{transcripts-source-DVegW0WI.mjs → transcripts-source-p8EV179h.mjs} +76 -235
  63. package/dist/.setup/{typing-BKZL5fGj.mjs → typing-BiHCzBRu.mjs} +2 -1
  64. package/dist/.setup/{voice-runtime-elTtjEIG.mjs → voice-runtime-B46rcwrG.mjs} +140 -244
  65. package/dist/account-inspect-api.js +1 -1
  66. package/dist/action-runtime-api.js +1 -1
  67. package/dist/activities-api.js +1 -1
  68. package/dist/api.js +18 -18
  69. package/dist/channel-config-api.js +1 -1
  70. package/dist/channel-plugin-api.js +1 -1
  71. package/dist/directory-contract-api.js +1 -1
  72. package/dist/doctor-contract-api.js +4 -4
  73. package/dist/index.js +1 -1
  74. package/dist/runtime-api.js +20 -20
  75. package/dist/secret-contract-api.js +1 -1
  76. package/dist/security-audit-contract-api.js +1 -1
  77. package/dist/setup-entry.js +1 -1
  78. package/dist/setup-plugin-api.js +1 -1
  79. package/dist/src/voice/audio-worker.runtime.js +15 -24
  80. package/dist/subagent-hooks-api.js +3 -4
  81. package/dist/transcripts-source-api.js +1 -1
  82. package/node_modules/@types/node/README.md +2 -2
  83. package/node_modules/@types/node/child_process.d.ts +1 -1
  84. package/node_modules/@types/node/crypto.d.ts +20 -8
  85. package/node_modules/@types/node/ffi.d.ts +14 -0
  86. package/node_modules/@types/node/http2.d.ts +3 -2
  87. package/node_modules/@types/node/net.d.ts +16 -4
  88. package/node_modules/@types/node/package.json +2 -17
  89. package/node_modules/@types/node/process.d.ts +1 -0
  90. package/node_modules/@types/node/quic.d.ts +39 -1
  91. package/node_modules/@types/node/stream/iter.d.ts +9 -12
  92. package/node_modules/@types/node/test/reporters.d.ts +1 -0
  93. package/node_modules/@types/node/test.d.ts +72 -0
  94. package/node_modules/@types/node/tls.d.ts +14 -10
  95. package/node_modules/@types/node/vm.d.ts +2 -1
  96. package/node_modules/@types/node/worker_threads.d.ts +4 -1
  97. package/node_modules/typebox/build/compile/code.mjs +1 -2
  98. package/node_modules/typebox/build/compile/validator.mjs +5 -1
  99. package/node_modules/typebox/build/format/iri.mjs +16 -9
  100. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  101. package/node_modules/typebox/build/guard/guard.d.mts +7 -5
  102. package/node_modules/typebox/build/guard/guard.mjs +14 -9
  103. package/node_modules/typebox/build/guard/index.mjs +6 -0
  104. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
  105. package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
  106. package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
  107. package/node_modules/typebox/build/schema/build.mjs +2 -3
  108. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
  109. package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
  110. package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
  111. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
  112. package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
  113. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
  114. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
  115. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
  116. package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
  117. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
  118. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
  119. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
  120. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
  121. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
  122. package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
  123. package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
  124. package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
  125. package/node_modules/typebox/build/schema/parse.mjs +3 -0
  126. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
  127. package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
  128. package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
  129. package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
  130. package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
  131. package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
  132. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  133. package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
  134. package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
  135. package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
  136. package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
  137. package/node_modules/typebox/package.json +1 -1
  138. package/node_modules/typebox/readme.md +3 -1
  139. package/openclaw.plugin.json +21 -1
  140. package/package.json +5 -5
  141. package/dist/.setup/agent-components.runtime-CEPrf2SY.mjs +0 -4
  142. package/dist/.setup/probe.runtime-DBQ_AGPe.mjs +0 -2
  143. package/dist/.setup/provider-session.runtime-DrGAYnZv.mjs +0 -6
  144. package/dist/.setup/provider.runtime-BmjW_pIw.mjs +0 -2
  145. package/dist/.setup/security-audit.runtime-DHtYenx9.mjs +0 -2
  146. package/dist/.setup/setup-plugin-api-Dvr41dyx.mjs +0 -3
  147. package/dist/.setup/system-events-B2YEEMbS.mjs +0 -34
  148. package/dist/.setup/targets-CvemhN3i.mjs +0 -3
  149. package/dist/.setup/thread-bindings.session-updates-DCQq1WZ5.mjs +0 -55
  150. /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
package/assets/icon.png CHANGED
Binary file
@@ -1,4 +1,4 @@
1
- import { _ as inspectDiscordAccountTokenState, o as mergeDiscordAccountConfig, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig, v as resolveDiscordAccountAvailability } from "./accounts-CwJQoLjM.mjs";
1
+ import { _ as inspectDiscordAccountTokenState, o as mergeDiscordAccountConfig, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig, v as resolveDiscordAccountAvailability } from "./accounts-ChaMcixG.mjs";
2
2
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
@@ -201,7 +201,7 @@ function resolveDiscordToken(cfg, opts = {}) {
201
201
  }
202
202
  //#endregion
203
203
  //#region extensions/discord/src/accounts.ts
204
- const { listAccountIds, resolveDefaultAccountId, resolveAccountConfig: resolveMergedDiscordAccountConfig } = createAccountListHelpers("discord", {
204
+ const { listAccountIds, resolveDefaultAccountId, resolveAccountConfig: mergeDiscordAccountConfig } = createAccountListHelpers("discord", {
205
205
  implicitDefaultAccount: {
206
206
  channelKeys: ["token"],
207
207
  envVars: ["DISCORD_BOT_TOKEN"]
@@ -217,9 +217,6 @@ const resolveDefaultDiscordAccountId = resolveDefaultAccountId;
217
217
  function resolveDiscordAccountConfig(cfg, accountId) {
218
218
  return resolveAccountEntry(cfg.channels?.discord?.accounts, accountId);
219
219
  }
220
- function mergeDiscordAccountConfig(cfg, accountId) {
221
- return resolveMergedDiscordAccountConfig(cfg, accountId);
222
- }
223
220
  function resolveDiscordAccountAllowFrom(params) {
224
221
  const accountId = normalizeAccountId(params.accountId ?? resolveDefaultDiscordAccountId(params.cfg));
225
222
  const accountConfig = resolveDiscordAccountConfig(params.cfg, accountId);
@@ -1,9 +1,9 @@
1
- import { S as parseDiscordActivityCustomId, i as buildDiscordPresentationComponents } from "./components-yBEb75bB.mjs";
2
- import { E as getDiscordEndpointRuntime } from "./channel-type-DKnjV1XW.mjs";
3
- import { c as resolveDiscordAccount } from "./accounts-CwJQoLjM.mjs";
4
- import { r as sendDiscordComponentMessage } from "./send.components-ChY21qr-.mjs";
5
- import { b as resolveDiscordChannelId$1 } from "./retry-BEYkDy0P.mjs";
6
- import { r as setDiscordActivitiesRuntime, t as DiscordActivitiesRuntime } from "./runtime-DisDbixd.mjs";
1
+ import { S as parseDiscordActivityCustomId, i as buildDiscordPresentationComponents } from "./components-Cq1PvIpN.mjs";
2
+ import { D as getDiscordEndpointRuntime } from "./channel-type-DRCrEMss.mjs";
3
+ import { c as resolveDiscordAccount } from "./accounts-ChaMcixG.mjs";
4
+ import { r as sendDiscordComponentMessage } from "./send.components-DxQAMfES.mjs";
5
+ import { x as resolveDiscordChannelId$1 } from "./retry-pz_cSha2.mjs";
6
+ import { r as setDiscordActivitiesRuntime, t as DiscordActivitiesRuntime } from "./runtime-sUksZ--Q.mjs";
7
7
  import fs from "node:fs/promises";
8
8
  import { logError } from "openclaw/plugin-sdk/logging-core";
9
9
  import { resolveRequestClientIp } from "openclaw/plugin-sdk/webhook-ingress";
@@ -332,12 +332,9 @@ function createDiscordActivityHttpHandler(deps) {
332
332
  emptyObjectOnEmpty: true,
333
333
  destroyOnLimit: false
334
334
  });
335
- if (!bodyResult.ok && bodyResult.code === "REQUEST_BODY_TIMEOUT") {
336
- await sendHttpRequestRejection(req, res, 408, jsonBody({ error: "request body timeout" }), JSON_CONTENT_TYPE);
337
- return true;
338
- }
339
- if (!bodyResult.ok && bodyResult.code === "PAYLOAD_TOO_LARGE") {
340
- await sendHttpRequestRejection(req, res, 413, jsonBody({ error: "request body too large" }), JSON_CONTENT_TYPE);
335
+ if (!bodyResult.ok && (bodyResult.code === "REQUEST_BODY_TIMEOUT" || bodyResult.code === "PAYLOAD_TOO_LARGE")) {
336
+ const timedOut = bodyResult.code === "REQUEST_BODY_TIMEOUT";
337
+ await sendHttpRequestRejection(req, res, timedOut ? 408 : 413, jsonBody({ error: timedOut ? "request body timeout" : "request body too large" }), JSON_CONTENT_TYPE);
341
338
  return true;
342
339
  }
343
340
  const body = bodyResult.ok && bodyResult.value && typeof bodyResult.value === "object" && !Array.isArray(bodyResult.value) ? bodyResult.value : null;
@@ -553,7 +550,7 @@ function createDiscordWidgetPresenter(runtime, deps = {}) {
553
550
  message: "Discord Activities are unavailable for the current channel and account."
554
551
  }
555
552
  };
556
- if (title.length > 80) return {
553
+ if (Array.from(title).length > 80) return {
557
554
  ok: false,
558
555
  error: {
559
556
  code: "presentation_error",
@@ -664,18 +661,13 @@ function openDiscordActivityStores(openKeyedStore) {
664
661
  function pendingLaunchKey(accountId, channelId, discordUserId) {
665
662
  return `${accountId}:${channelId}:${discordUserId}`;
666
663
  }
667
- function deliveredWidgetIntent(widget, messageId) {
668
- return widget ? {
669
- operation: "update",
670
- action: "set",
671
- value: {
672
- ...widget,
673
- deliveredMessageId: messageId
674
- }
675
- } : {
676
- operation: "update",
677
- action: "keep"
678
- };
664
+ async function applyActivityStoreIntent(store, key, intent) {
665
+ let observed = await store.observe(key);
666
+ while (true) {
667
+ const result = await store.compareAndApply(key, observed.comparison, intent(observed.value));
668
+ if (result.status !== "conflict") return result.status;
669
+ observed = result.current;
670
+ }
679
671
  }
680
672
  function pendingLaunchForWidget(existing, widgetId, createdAt) {
681
673
  return existing && (existing.state === "ambiguous" || existing.widgetId !== widgetId) ? {
@@ -687,12 +679,6 @@ function pendingLaunchForWidget(existing, widgetId, createdAt) {
687
679
  createdAt
688
680
  };
689
681
  }
690
- function retirePendingLaunchIntent(existing, widgetId) {
691
- return {
692
- operation: "delete",
693
- action: existing?.state === "single" && existing.widgetId === widgetId ? "delete" : "keep"
694
- };
695
- }
696
682
  var DiscordActivityStore = class {
697
683
  constructor(stores) {
698
684
  this.stores = stores;
@@ -711,17 +697,17 @@ var DiscordActivityStore = class {
711
697
  }
712
698
  async markWidgetDelivered(id, messageId) {
713
699
  if (!/^\d+$/u.test(messageId)) throw new Error("Discord Activity delivery returned an invalid message ID");
714
- const widgets = this.stores.widgets;
715
- let observed = await widgets.observe(id);
716
- while (true) {
717
- const result = await widgets.compareAndApply(id, observed.comparison, deliveredWidgetIntent(observed.value, messageId));
718
- if (result.status === "conflict") {
719
- observed = result.current;
720
- continue;
700
+ if (await applyActivityStoreIntent(this.stores.widgets, id, (widget) => widget ? {
701
+ operation: "update",
702
+ action: "set",
703
+ value: {
704
+ ...widget,
705
+ deliveredMessageId: messageId
721
706
  }
722
- if (result.status === "unchanged") throw new Error("Discord Activity widget disappeared before delivery was recorded");
723
- return;
724
- }
707
+ } : {
708
+ operation: "update",
709
+ action: "keep"
710
+ }) === "unchanged") throw new Error("Discord Activity widget disappeared before delivery was recorded");
725
711
  }
726
712
  async deleteWidget(id) {
727
713
  await this.stores.widgets.delete(id);
@@ -765,27 +751,18 @@ var DiscordActivityStore = class {
765
751
  async recordPendingLaunch(params) {
766
752
  const key = pendingLaunchKey(params.accountId, params.channelId, params.discordUserId);
767
753
  const { widgetId, createdAt } = params;
768
- const launches = this.stores.launches;
769
- let observed = await launches.observe(key);
770
- while (true) {
771
- const result = await launches.compareAndApply(key, observed.comparison, {
772
- operation: "update",
773
- action: "set",
774
- value: pendingLaunchForWidget(observed.value, widgetId, createdAt)
775
- });
776
- if (result.status !== "conflict") return;
777
- observed = result.current;
778
- }
754
+ await applyActivityStoreIntent(this.stores.launches, key, (existing) => ({
755
+ operation: "update",
756
+ action: "set",
757
+ value: pendingLaunchForWidget(existing, widgetId, createdAt)
758
+ }));
779
759
  }
780
760
  async retirePendingLaunch(accountId, channelId, discordUserId, widgetId) {
781
761
  const key = pendingLaunchKey(accountId, channelId, discordUserId);
782
- const launches = this.stores.launches;
783
- let observed = await launches.observe(key);
784
- while (true) {
785
- const result = await launches.compareAndApply(key, observed.comparison, retirePendingLaunchIntent(observed.value, widgetId));
786
- if (result.status !== "conflict") return;
787
- observed = result.current;
788
- }
762
+ await applyActivityStoreIntent(this.stores.launches, key, (existing) => ({
763
+ operation: "delete",
764
+ action: existing?.state === "single" && existing.widgetId === widgetId ? "delete" : "keep"
765
+ }));
789
766
  }
790
767
  async consumePendingLaunch(accountId, channelId, discordUserId) {
791
768
  const launch = await this.stores.launches.consume(pendingLaunchKey(accountId, channelId, discordUserId));
@@ -794,9 +771,9 @@ var DiscordActivityStore = class {
794
771
  };
795
772
  //#endregion
796
773
  //#region extensions/discord/src/activities/register.ts
797
- function registerDiscordActivities$1(api) {
774
+ function registerDiscordActivities(api) {
798
775
  setDiscordActivitiesRuntime(void 0);
799
- const store = new DiscordActivityStore(openDiscordActivityStores((options) => api.runtime.state.openKeyedStore(options)));
776
+ const store = new DiscordActivityStore(openDiscordActivityStores(api.runtime.state.openKeyedStore.bind(api.runtime.state)));
800
777
  const runtime = new DiscordActivitiesRuntime(store, api.config, api.runtime.config?.current ? () => api.runtime.config.current() : void 0);
801
778
  setDiscordActivitiesRuntime(runtime);
802
779
  const http = createDiscordActivityHttpHandler({
@@ -812,9 +789,4 @@ function registerDiscordActivities$1(api) {
812
789
  api.registerWidgetPresenter(createDiscordWidgetPresenter(runtime));
813
790
  }
814
791
  //#endregion
815
- //#region extensions/discord/activities-api.ts
816
- function registerDiscordActivities(api) {
817
- registerDiscordActivities$1(api);
818
- }
819
- //#endregion
820
792
  export { registerDiscordActivities as t };
@@ -1,4 +1,4 @@
1
- import { E as getDiscordEndpointRuntime, w as parseDiscordRetryAfterBodySeconds } from "./channel-type-DKnjV1XW.mjs";
1
+ import { D as getDiscordEndpointRuntime, T as parseDiscordRetryAfterBodySeconds } from "./channel-type-DRCrEMss.mjs";
2
2
  import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
3
3
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
4
4
  import { captureChannelReadAuthority, resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
@@ -9,6 +9,14 @@ import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
9
9
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
10
10
  //#region extensions/discord/src/error-body.ts
11
11
  const DISCORD_RESPONSE_BODY_SUMMARY_MAX_CHARS = 240;
12
+ function parseDiscordHttpErrorBody(raw) {
13
+ if (!raw) return;
14
+ try {
15
+ return JSON.parse(raw);
16
+ } catch {
17
+ return { message: truncateUtf16Safe(raw, 200) };
18
+ }
19
+ }
12
20
  function summarizeDiscordResponseBody(body, opts = {}) {
13
21
  const summary = body.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, " ").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/\s+/g, " ").trim();
14
22
  if (!summary) return opts.emptyText;
@@ -161,4 +169,4 @@ async function fetchDiscord(path, token, fetcher = fetch, options) {
161
169
  });
162
170
  }
163
171
  //#endregion
164
- export { isDiscordRateLimitResponseBody as a, requestDiscord as i, DiscordApiError as n, summarizeDiscordResponseBody as o, fetchDiscord as r, DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS as t };
172
+ export { isDiscordRateLimitResponseBody as a, requestDiscord as i, DiscordApiError as n, parseDiscordHttpErrorBody as o, fetchDiscord as r, summarizeDiscordResponseBody as s, DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS as t };
@@ -1,16 +1,16 @@
1
- import { A as serializePayload, G as Row, L as Button, Y as TextDisplay, et as stripUndefinedFields, ft as editChannelMessage, nt as createUserDmChannel, q as Separator, st as createChannelMessage, ut as deleteChannelMessage, z as Container } from "./discord-BXpHW-cu.mjs";
2
- import { s as buildExecApprovalCustomId } from "./components-yBEb75bB.mjs";
3
- import { N as createDiscordClient, O as createDiscordMessageNonce } from "./send.shared-VNvWfX2T.mjs";
4
- import { D as isDiscordExecApprovalClientEnabled, c as formatDiscordApprovalDisplayValue, s as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./outbound-session-route-VulUE0yV.mjs";
5
- import { a as shouldHandleDiscordApprovalRequest } from "./channel-Dv4e3Jpc.mjs";
6
- import { t as discordApprovalMessageUpdates } from "./approval-message-updates-jf9zMaIC.mjs";
1
+ import { s as buildExecApprovalCustomId } from "./components-Cq1PvIpN.mjs";
2
+ import { A as serializePayload, B as Container, J as Separator, K as Row, R as Button, X as TextDisplay, ct as createChannelMessage, dt as deleteChannelMessage, pt as editChannelMessage, rt as createUserDmChannel, tt as stripUndefinedFields } from "./discord-0xJYfdDD.mjs";
3
+ import { s as findGraphemeChunkEnd } from "./retry-pz_cSha2.mjs";
4
+ import { D as createDiscordMessageNonce, M as createDiscordClient } from "./send.shared-DGFkbkQR.mjs";
5
+ import { D as isDiscordExecApprovalClientEnabled, c as formatDiscordApprovalDisplayValue, s as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./outbound-session-route-zVGxxceg.mjs";
6
+ import { a as shouldHandleDiscordApprovalRequest } from "./channel-DxlUVU9t.mjs";
7
+ import { t as discordApprovalMessageUpdates } from "./approval-message-updates-BKFqavHZ.mjs";
7
8
  import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
8
9
  import { ButtonStyle } from "discord-api-types/v10";
9
10
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
10
11
  import { createChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-runtime";
11
12
  import { formatChannelApprovalResolvedLabel } from "openclaw/plugin-sdk/approval-runtime";
12
13
  //#region extensions/discord/src/ui-colors.ts
13
- const DEFAULT_DISCORD_ACCENT_COLOR = "#5865F2";
14
14
  function normalizeDiscordAccentColor(raw) {
15
15
  const trimmed = (raw ?? "").trim();
16
16
  if (!trimmed) return null;
@@ -18,17 +18,11 @@ function normalizeDiscordAccentColor(raw) {
18
18
  if (!/^#[0-9a-fA-F]{6}$/.test(normalized)) return null;
19
19
  return normalized.toUpperCase();
20
20
  }
21
- function resolveDiscordAccentColor(_params) {
22
- return DEFAULT_DISCORD_ACCENT_COLOR;
23
- }
24
21
  //#endregion
25
22
  //#region extensions/discord/src/ui.ts
26
23
  var DiscordUiContainer = class extends Container {
27
24
  constructor(params) {
28
- const accentColor = normalizeDiscordAccentColor(params.accentColor) ?? resolveDiscordAccentColor({
29
- cfg: params.cfg,
30
- accountId: params.accountId
31
- });
25
+ const accentColor = normalizeDiscordAccentColor(params.accentColor) ?? "#5865F2";
32
26
  super(params.components, {
33
27
  accentColor,
34
28
  spoiler: params.spoiler
@@ -46,33 +40,6 @@ function resolveHandlerContext(params) {
46
40
  context
47
41
  };
48
42
  }
49
- var ExecApprovalContainer = class extends DiscordUiContainer {
50
- constructor(params) {
51
- const components = [new TextDisplay(`## ${params.title}`)];
52
- if (params.description) components.push(new TextDisplay(params.description));
53
- components.push(new Separator({
54
- divider: true,
55
- spacing: "small"
56
- }));
57
- components.push(new TextDisplay(`### ${params.commandLabel ?? "Command"}\n\`\`\`\n${params.commandPreview}\n\`\`\``));
58
- if (params.commandSecondaryPreview) components.push(new TextDisplay(`### Shell Preview\n\`\`\`\n${params.commandSecondaryPreview}\n\`\`\``));
59
- if (params.metadataLines?.length) components.push(new TextDisplay(params.metadataLines.join("\n")));
60
- if (params.actionRow) components.push(params.actionRow);
61
- if (params.footer) {
62
- components.push(new Separator({
63
- divider: false,
64
- spacing: "small"
65
- }));
66
- components.push(new TextDisplay(`-# ${params.footer}`));
67
- }
68
- super({
69
- cfg: params.cfg,
70
- accountId: params.accountId,
71
- components,
72
- accentColor: params.accentColor
73
- });
74
- }
75
- };
76
43
  var ExecApprovalActionButton = class extends Button {
77
44
  constructor(params) {
78
45
  super();
@@ -81,24 +48,12 @@ var ExecApprovalActionButton = class extends Button {
81
48
  this.style = params.descriptor.style === "success" ? ButtonStyle.Success : params.descriptor.style === "primary" ? ButtonStyle.Primary : params.descriptor.style === "danger" ? ButtonStyle.Danger : ButtonStyle.Secondary;
82
49
  }
83
50
  };
84
- var ExecApprovalActionRow = class extends Row {
85
- constructor(params) {
86
- super(params.actions.map((descriptor) => new ExecApprovalActionButton({
87
- approvalId: params.approvalId,
88
- approvalKind: params.approvalKind,
89
- descriptor
90
- })));
91
- }
92
- };
93
51
  function createApprovalActionRow(view) {
94
- return new ExecApprovalActionRow({
52
+ return new Row(view.actions.map((descriptor) => new ExecApprovalActionButton({
95
53
  approvalId: view.approvalId,
96
54
  approvalKind: view.approvalKind,
97
- actions: view.actions
98
- });
99
- }
100
- function buildApprovalMetadataLines(metadata) {
101
- return metadata.map((item) => `- ${item.label}: ${item.value}`);
55
+ descriptor
56
+ })));
102
57
  }
103
58
  function buildExecApprovalPayload(container) {
104
59
  return {
@@ -106,39 +61,14 @@ function buildExecApprovalPayload(container) {
106
61
  allowed_mentions: DISCORD_APPROVAL_ALLOWED_MENTIONS
107
62
  };
108
63
  }
109
- const commandPreviewSegmenter = typeof Intl !== "undefined" && "Segmenter" in Intl ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
110
- function* iterateCommandPreviewSegments(commandText) {
111
- if (!commandPreviewSegmenter) {
112
- yield* Array.from(commandText);
113
- return;
114
- }
115
- try {
116
- for (const segment of commandPreviewSegmenter.segment(commandText)) yield segment.segment;
117
- } catch {
118
- yield* Array.from(commandText);
119
- }
120
- }
121
- function truncateCommandPreview(commandText, maxChars) {
122
- let commandRaw = "";
123
- for (const segment of iterateCommandPreviewSegments(commandText)) {
124
- if (commandRaw.length + segment.length > maxChars) return `${commandRaw}...`;
125
- commandRaw += segment;
126
- }
127
- return commandText;
128
- }
129
64
  function formatCommandPreview(commandText, maxChars) {
130
- return truncateCommandPreview(commandText, maxChars).replace(/`/g, "​`");
65
+ const end = findGraphemeChunkEnd(commandText, 0, maxChars, maxChars, false);
66
+ return (end < commandText.length ? `${commandText.slice(0, end)}...` : commandText).replace(/`/g, "​`");
131
67
  }
132
68
  function formatOptionalCommandPreview(commandText, maxChars) {
133
69
  if (!commandText) return null;
134
70
  return formatCommandPreview(commandText, maxChars);
135
71
  }
136
- function resolveCommandPreviews(commandText, commandPreview, maxChars, secondaryMaxChars) {
137
- return {
138
- commandPreview: formatCommandPreview(commandText, maxChars),
139
- commandSecondaryPreview: formatOptionalCommandPreview(commandPreview, secondaryMaxChars)
140
- };
141
- }
142
72
  function createApprovalContainer(params) {
143
73
  const { view } = params;
144
74
  const plugin = view.approvalKind === "plugin";
@@ -148,24 +78,36 @@ function createApprovalContainer(params) {
148
78
  const { commandPreview, commandSecondaryPreview } = plugin ? {
149
79
  commandPreview: formatCommandPreview(view.title, 700),
150
80
  commandSecondaryPreview: formatOptionalCommandPreview(view.description, 1e3)
151
- } : resolveCommandPreviews(view.commandText, view.commandPreview, pending ? 1e3 : 500, pending ? 500 : 300);
81
+ } : {
82
+ commandPreview: formatCommandPreview(view.commandText, pending ? 1e3 : 500),
83
+ commandSecondaryPreview: formatOptionalCommandPreview(view.commandPreview, pending ? 500 : 300)
84
+ };
152
85
  const decisionLabel = view.phase === "resolved" ? formatChannelApprovalResolvedLabel(view, (decision) => decision === "allow-once" ? "Allowed (once)" : decision === "allow-always" ? "Allowed (always)" : "Denied") : void 0;
153
86
  const title = pending ? `${approvalLabel} Approval Required` : `${approvalLabel} Approval: ${view.phase === "expired" ? "Expired" : decisionLabel}`;
154
87
  const description = pending ? plugin ? "A plugin action needs your approval." : systemAgent ? "An OpenClaw change needs your approval." : "A command needs your approval." : view.phase === "expired" ? "This approval request has expired." : view.resolvedBy ? `Resolved by ${formatDiscordApprovalDisplayValue(view.resolvedBy)}` : "Resolved";
155
88
  const accentColor = view.phase === "expired" ? "#99AAB5" : view.phase === "resolved" ? view.decision === "deny" ? "#ED4245" : view.decision === "allow-always" ? "#5865F2" : "#57F287" : plugin ? view.severity === "critical" ? "#ED4245" : view.severity === "info" ? "#5865F2" : "#FAA61A" : "#FFA500";
156
89
  const approvalId = formatDiscordApprovalDisplayValue(view.approvalId);
157
90
  const footer = pending ? `Expires <t:${Math.max(0, Math.floor(view.expiresAtMs / 1e3))}:R> · ID: ${approvalId}` : `ID: ${approvalId}`;
158
- return new ExecApprovalContainer({
91
+ const components = [
92
+ new TextDisplay(`## ${title}`),
93
+ new TextDisplay(description),
94
+ new Separator({
95
+ divider: true,
96
+ spacing: "small"
97
+ }),
98
+ new TextDisplay(`### ${systemAgent ? "Change" : "Command"}\n\`\`\`\n${commandPreview}\n\`\`\``)
99
+ ];
100
+ if (commandSecondaryPreview) components.push(new TextDisplay(`### Shell Preview\n\`\`\`\n${commandSecondaryPreview}\n\`\`\``));
101
+ if (view.metadata.length) components.push(new TextDisplay(view.metadata.map((item) => `- ${item.label}: ${item.value}`).join("\n")));
102
+ if (params.actionRow) components.push(params.actionRow);
103
+ components.push(new Separator({
104
+ divider: false,
105
+ spacing: "small"
106
+ }), new TextDisplay(`-# ${footer}`));
107
+ return new DiscordUiContainer({
159
108
  cfg: params.cfg,
160
109
  accountId: params.accountId,
161
- title,
162
- description,
163
- commandLabel: systemAgent ? "Change" : "Command",
164
- commandPreview,
165
- commandSecondaryPreview,
166
- metadataLines: buildApprovalMetadataLines(view.metadata),
167
- actionRow: params.actionRow,
168
- footer,
110
+ components,
169
111
  accentColor
170
112
  });
171
113
  }
@@ -199,6 +141,18 @@ async function finalizeMessage(params) {
199
141
  await updateMessage(params);
200
142
  }
201
143
  }
144
+ function buildTerminalApprovalResult(params) {
145
+ const resolved = resolveHandlerContext(params);
146
+ if (!resolved) return { kind: "delete" };
147
+ return {
148
+ kind: "update",
149
+ payload: createApprovalContainer({
150
+ view: params.view,
151
+ cfg: params.cfg,
152
+ accountId: resolved.accountId
153
+ })
154
+ };
155
+ }
202
156
  const discordApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
203
157
  eventKinds: [
204
158
  "exec",
@@ -240,38 +194,8 @@ const discordApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
240
194
  });
241
195
  return { body: stripUndefinedFields(serializePayload(buildExecApprovalPayload(container))) };
242
196
  },
243
- buildResolvedResult: ({ cfg, accountId, context, view }) => {
244
- const resolvedContext = resolveHandlerContext({
245
- cfg,
246
- accountId,
247
- context
248
- });
249
- if (!resolvedContext) return { kind: "delete" };
250
- return {
251
- kind: "update",
252
- payload: createApprovalContainer({
253
- view,
254
- cfg,
255
- accountId: resolvedContext.accountId
256
- })
257
- };
258
- },
259
- buildExpiredResult: ({ cfg, accountId, context, view }) => {
260
- const resolvedContext = resolveHandlerContext({
261
- cfg,
262
- accountId,
263
- context
264
- });
265
- if (!resolvedContext) return { kind: "delete" };
266
- return {
267
- kind: "update",
268
- payload: createApprovalContainer({
269
- view,
270
- cfg,
271
- accountId: resolvedContext.accountId
272
- })
273
- };
274
- }
197
+ buildResolvedResult: buildTerminalApprovalResult,
198
+ buildExpiredResult: buildTerminalApprovalResult
275
199
  },
276
200
  transport: {
277
201
  prepareTarget: async ({ cfg, accountId, context, plannedTarget }) => {
@@ -1,5 +1,5 @@
1
- import { $ as parseCustomId } from "./discord-BXpHW-cu.mjs";
2
- import { c as parseExecApprovalData } from "./components-yBEb75bB.mjs";
1
+ import { c as parseExecApprovalData } from "./components-Cq1PvIpN.mjs";
2
+ import { et as parseCustomId } from "./discord-0xJYfdDD.mjs";
3
3
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
4
4
  //#region extensions/discord/src/approval-message-updates.ts
5
5
  const discordApprovalMessageUpdates = new KeyedAsyncQueue();
@@ -1,8 +1,8 @@
1
- import { Ut as __exportAll } from "./discord-BXpHW-cu.mjs";
2
- import { x as fetchChannelPermissionsDiscord } from "./send.shared-VNvWfX2T.mjs";
3
- import { t as inspectDiscordAccount } from "./account-inspect-BwQj24ht.mjs";
4
- import "./send-CIBzvXjS.mjs";
5
- import { C as collectDiscordAuditChannelIdsForAccount, S as auditDiscordChannelPermissionsWithFetcher } from "./outbound-session-route-VulUE0yV.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
+ import { b as fetchChannelPermissionsDiscord } from "./send.shared-DGFkbkQR.mjs";
3
+ import { t as inspectDiscordAccount } from "./account-inspect-De8hOUxG.mjs";
4
+ import "./send-CrfEI6Bs.mjs";
5
+ import { C as collectDiscordAuditChannelIdsForAccount, S as auditDiscordChannelPermissionsWithFetcher } from "./outbound-session-route-zVGxxceg.mjs";
6
6
  //#region extensions/discord/src/audit.ts
7
7
  var audit_exports = /* @__PURE__ */ __exportAll({
8
8
  auditDiscordChannelPermissions: () => auditDiscordChannelPermissions,