@openclaw/discord 2026.9.1-beta.1 → 2026.9.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 (93) hide show
  1. package/dist/account-inspect-BY-ve3yH.js +45 -0
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{accounts-CfQ-vSyf.js → accounts-CwJQoLjM.js} +89 -45
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{activities-api-q-9PaaHH.js → activities-api-E-segZn6.js} +30 -17
  6. package/dist/activities-api.js +1 -1
  7. package/dist/{allow-list-BDMimASD.js → allow-list-C2JuH-R0.js} +10 -6
  8. package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
  9. package/dist/api.js +18 -18
  10. package/dist/{approval-handler.runtime-B7qhK3fR.js → approval-handler.runtime-CW5k3mSa.js} +19 -12
  11. package/dist/{audit-CBEv_ERu.js → audit-B9rydv5a.js} +8 -7
  12. package/dist/{channel-Dx1tMTfx.js → channel-D93LnbTE.js} +29 -23
  13. package/dist/{channel-actions.runtime-CLWWu9nC.js → channel-actions.runtime-DMFv4doE.js} +16 -13
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel.setup-DOzXS2Pk.js → channel.setup-DTL7kPOM.js} +18 -18
  17. package/dist/{components-B9V5o361.js → components-DmXYIQ26.js} +111 -149
  18. package/dist/{config-schema-BR13IAx6.js → config-schema-B797-Spt.js} +19 -12
  19. package/dist/{conversation-binding-route-DJYrY2TQ.js → conversation-binding-route-24afmvEC.js} +1 -1
  20. package/dist/{directory-config-BK6eqekJ.js → directory-config-BD4YL7wT.js} +2 -2
  21. package/dist/directory-contract-api.js +1 -1
  22. package/dist/{directory-live-DSAJSrJk.js → directory-live-BrFVc1Ds.js} +4 -4
  23. package/dist/{doctor-Cm7Y1pJ2.js → doctor-BUB41_lr.js} +5 -5
  24. package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
  25. package/dist/doctor-contract-api.js +3 -2
  26. package/dist/{handle-action.guild-admin-BdwCRHmm.js → handle-action.guild-admin-B0egstYq.js} +2 -2
  27. package/dist/index.js +1 -1
  28. package/dist/ingress-identity-BCzfPPYM.js +60 -0
  29. package/dist/{message-handler-BXpWZyni.js → message-handler-Qdw9c0j4.js} +14 -10
  30. package/dist/{message-handler.preflight-Ba5LAY_X.js → message-handler.preflight-Dxi2yBfR.js} +41 -101
  31. package/dist/{message-handler.process-3HEzmemS.js → message-handler.process-BYDjtxZJ.js} +83 -109
  32. package/dist/{message-text-aiwO5R2F.js → message-text-BRVqYm-t.js} +11 -6
  33. package/dist/{outbound-adapter-BE4jSq2d.js → outbound-adapter-DEhthWTk.js} +52 -67
  34. package/dist/{outbound-components-oLpg8Qzb.js → outbound-components-DehyxvA4.js} +5 -4
  35. package/dist/{outbound-session-route-Cg15ZFJd.js → outbound-session-route-BFGRF9fE.js} +55 -12
  36. package/dist/{owner-access-UlYi9t0M.js → owner-access-yc1sX7Gx.js} +7 -6
  37. package/dist/{pluralkit-Tiyl70dx.js → pluralkit-XmmAHoV6.js} +2 -2
  38. package/dist/{probe-n6ZXxK8V.js → probe-3ovFAp3b.js} +3 -3
  39. package/dist/{probe.runtime-CN4bdPfZ.js → probe.runtime-BckHn3cJ.js} +1 -1
  40. package/dist/{provider-B11xwilq.js → provider-DuDtKbF8.js} +294 -131
  41. package/dist/{provider-session.runtime-B9xe-Qaf.js → provider-session.runtime-BA2BPyZ4.js} +3 -3
  42. package/dist/provider.runtime-Db8YwZBv.js +2 -0
  43. package/dist/{realtime-session.runtime-CU8IQUS-.js → realtime-session.runtime-DgSbX6ay.js} +103 -163
  44. package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
  45. package/dist/{resolve-channels-C2sT_n67.js → resolve-channels-CYseD5Uw.js} +4 -4
  46. package/dist/{resolve-users-CzpjLwjy.js → resolve-users-DrmhDrqm.js} +5 -4
  47. package/dist/{retry-Cv4jCU5Z.js → retry-BNCxiyyR.js} +120 -32
  48. package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
  49. package/dist/{runtime-BHrTlFkf.js → runtime-BbWNtfyq.js} +127 -93
  50. package/dist/{runtime-CY4PRMF-.js → runtime-DB7Fb6AU.js} +2 -2
  51. package/dist/runtime-api.js +19 -19
  52. package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
  53. package/dist/secret-contract-api.js +1 -1
  54. package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
  55. package/dist/security-audit-contract-api.js +1 -1
  56. package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
  57. package/dist/{send-C49MFF9j.js → send-BnTEIeLE.js} +132 -100
  58. package/dist/{send.components-DKKAw5VX.js → send.components-BWVEcjRP.js} +21 -15
  59. package/dist/{send.outbound-zam0TrZx.js → send.outbound-b5xwHTlL.js} +35 -22
  60. package/dist/{send.shared-JjljcV4O.js → send.shared-5vxBTagO.js} +25 -18
  61. package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
  62. package/dist/setup-plugin-api.js +1 -1
  63. package/dist/{shared-_5EcP4jW.js → shared-BSJWHEMA.js} +20 -14
  64. package/dist/{subagent-hooks-DQzvOptn.js → subagent-hooks-IzQKX4RQ.js} +2 -2
  65. package/dist/subagent-hooks-api.js +1 -1
  66. package/dist/{system-events-C7yxaHWP.js → system-events-BOiDS8b3.js} +2 -2
  67. package/dist/{target-resolver-vxIh6O3-.js → target-resolver-BVI8xSSC.js} +6 -5
  68. package/dist/targets-DbxVbq8k.js +3 -0
  69. package/dist/{thread-bindings-DW5F9vat.js → thread-bindings-D7mcaXQC.js} +6 -5
  70. package/dist/{thread-bindings.manager-ByOtwjo_.js → thread-bindings.manager-B1oySiVc.js} +37 -28
  71. package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
  72. package/dist/{threading-agH1T_6s.js → threading-OQnL-0Zx.js} +8 -6
  73. package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
  74. package/dist/{transcripts-source-BR11iHA4.js → transcripts-source-D8lH7AkN.js} +9 -4
  75. package/dist/transcripts-source-api.js +1 -1
  76. package/dist/{typing-Dc_YMY2e.js → typing-C9q0AQMb.js} +2 -2
  77. package/dist/{voice-runtime-DIeaa8fJ.js → voice-runtime-Dfhjh1tV.js} +433 -93
  78. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
  79. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
  80. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
  81. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
  82. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
  83. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
  84. package/node_modules/typebox/build/format/email.mjs +1 -1
  85. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  86. package/node_modules/typebox/package.json +1 -1
  87. package/openclaw.plugin.json +14 -6
  88. package/package.json +6 -5
  89. package/skills/discord/SKILL.md +1 -1
  90. package/dist/account-inspect-BDfKyuvL.js +0 -89
  91. package/dist/provider.runtime-DiYaHvOz.js +0 -2
  92. package/dist/sdk-runtime-4geQHtXc.js +0 -338
  93. package/dist/targets-CtTKvntJ.js +0 -3
@@ -0,0 +1,45 @@
1
+ import { _ as inspectDiscordAccountTokenState, o as mergeDiscordAccountConfig, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig, v as resolveDiscordAccountAvailability } from "./accounts-CwJQoLjM.js";
2
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
3
+ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ import { normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
5
+ //#region extensions/discord/src/account-inspect.ts
6
+ function inspectDiscordAccountPrimary(params) {
7
+ const accountId = normalizeAccountId(params.accountId ?? resolveDefaultDiscordAccountId(params.cfg));
8
+ const merged = mergeDiscordAccountConfig(params.cfg, accountId);
9
+ const enabled = params.cfg.channels?.discord?.enabled !== false && merged.enabled !== false;
10
+ const accountConfig = resolveDiscordAccountConfig(params.cfg, accountId);
11
+ const hasAccountToken = Boolean(accountConfig && Object.hasOwn(accountConfig, "token"));
12
+ return inspectDiscordAccountTokenState({
13
+ base: {
14
+ accountId,
15
+ enabled,
16
+ name: normalizeOptionalString(merged.name)
17
+ },
18
+ config: merged,
19
+ accountToken: accountConfig?.token,
20
+ hasAccountToken,
21
+ channelToken: params.cfg.channels?.discord?.token,
22
+ resolveFallbackToken: () => {
23
+ const envToken = accountId === DEFAULT_ACCOUNT_ID ? normalizeSecretInputString(params.envToken ?? process.env.DISCORD_BOT_TOKEN) : void 0;
24
+ return {
25
+ token: envToken?.replace(/^Bot\s+/i, "") ?? "",
26
+ source: envToken ? "env" : "none"
27
+ };
28
+ }
29
+ });
30
+ }
31
+ function inspectDiscordAccount(params) {
32
+ const account = inspectDiscordAccountPrimary(params);
33
+ return {
34
+ ...account,
35
+ ...resolveDiscordAccountAvailability({
36
+ account,
37
+ resolveAccounts: () => listDiscordAccountIds(params.cfg).map((accountId) => inspectDiscordAccountPrimary({
38
+ ...params,
39
+ accountId
40
+ }))
41
+ })
42
+ };
43
+ }
44
+ //#endregion
45
+ export { inspectDiscordAccount as t };
@@ -1,4 +1,4 @@
1
- import { t as inspectDiscordAccount } from "./account-inspect-BDfKyuvL.js";
1
+ import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
2
2
  //#region extensions/discord/account-inspect-api.ts
3
3
  function inspectDiscordReadOnlyAccount(cfg, accountId) {
4
4
  return inspectDiscordAccount({
@@ -4,8 +4,87 @@ import { mapAllowFromEntries, normalizeChannelDmPolicy } from "openclaw/plugin-s
4
4
  import { resolveConfiguredFromCredentialStatuses } from "openclaw/plugin-sdk/channel-status";
5
5
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1, resolveAccountEntry } from "openclaw/plugin-sdk/routing";
6
6
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
+ import { hasConfiguredSecretInput, normalizeResolvedSecretInputString, normalizeSecretInputString, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
7
8
  import { getRuntimeConfigSnapshot, getRuntimeConfigSourceSnapshot, selectApplicableRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
8
- import { normalizeResolvedSecretInputString, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
9
+ //#region extensions/discord/src/account-token-inspect.ts
10
+ function inspectDiscordConfiguredToken(value) {
11
+ const normalized = normalizeSecretInputString(value);
12
+ if (normalized) return {
13
+ token: normalized.replace(/^Bot\s+/i, ""),
14
+ tokenSource: "config",
15
+ tokenStatus: "available"
16
+ };
17
+ if (hasConfiguredSecretInput(value)) return {
18
+ token: "",
19
+ tokenSource: "config",
20
+ tokenStatus: "configured_unavailable"
21
+ };
22
+ return null;
23
+ }
24
+ function inspectDiscordAccountTokenState(params) {
25
+ const accountToken = inspectDiscordConfiguredToken(params.accountToken);
26
+ if (accountToken) return {
27
+ ...params.base,
28
+ ...accountToken,
29
+ configured: true,
30
+ config: params.config
31
+ };
32
+ if (params.hasAccountToken) return {
33
+ ...params.base,
34
+ token: "",
35
+ tokenSource: "none",
36
+ tokenStatus: "missing",
37
+ configured: false,
38
+ config: params.config
39
+ };
40
+ const channelToken = inspectDiscordConfiguredToken(params.channelToken);
41
+ if (channelToken) return {
42
+ ...params.base,
43
+ ...channelToken,
44
+ configured: true,
45
+ config: params.config
46
+ };
47
+ const fallback = params.resolveFallbackToken();
48
+ if (fallback.token) return {
49
+ ...params.base,
50
+ token: fallback.token,
51
+ tokenSource: fallback.source,
52
+ tokenStatus: "available",
53
+ configured: true,
54
+ config: params.config
55
+ };
56
+ return {
57
+ ...params.base,
58
+ token: "",
59
+ tokenSource: "none",
60
+ tokenStatus: "missing",
61
+ configured: false,
62
+ config: params.config
63
+ };
64
+ }
65
+ /** Runtime and inspection keep the first enabled owner, preferring config over env tokens. */
66
+ function resolveDiscordAccountAvailability(params) {
67
+ if (!params.account.enabled) return {
68
+ enabled: false,
69
+ stateReason: "disabled"
70
+ };
71
+ const token = params.account.token.trim();
72
+ let owner;
73
+ if (token) for (const account of params.resolveAccounts()) {
74
+ if (!account.enabled || account.token.trim() !== token) continue;
75
+ const priority = account.tokenSource === "config" ? 2 : account.tokenSource === "env" ? 1 : 0;
76
+ if (!owner || priority > owner.priority) owner = {
77
+ accountId: account.accountId,
78
+ priority
79
+ };
80
+ }
81
+ const duplicateOwner = owner && owner.accountId !== params.account.accountId ? owner.accountId : void 0;
82
+ return {
83
+ enabled: !duplicateOwner,
84
+ stateReason: duplicateOwner ? `duplicate bot token; using account "${duplicateOwner}"` : void 0
85
+ };
86
+ }
87
+ //#endregion
9
88
  //#region extensions/discord/src/runtime-config.ts
10
89
  function selectDiscordRuntimeConfig(inputConfig) {
11
90
  return selectApplicableRuntimeConfig({
@@ -186,55 +265,20 @@ function resolveDiscordMaxLinesPerMessage(params) {
186
265
  accountId: params.accountId
187
266
  }).config.maxLinesPerMessage;
188
267
  }
189
- function resolveDiscordAccountTokenOwner(params) {
190
- const token = params.token.trim();
191
- if (!token) return;
192
- let owner;
193
- const accountIds = listDiscordAccountIds(params.cfg);
194
- for (const [index, accountId] of accountIds.entries()) {
195
- const account = resolveDiscordAccount({
196
- cfg: params.cfg,
268
+ function inspectDiscordRuntimeAvailability(account, cfg) {
269
+ return resolveDiscordAccountAvailability({
270
+ account,
271
+ resolveAccounts: () => listDiscordAccountIds(cfg).map((accountId) => resolveDiscordAccount({
272
+ cfg,
197
273
  accountId
198
- });
199
- const accountToken = account.token.trim();
200
- if (!account.enabled || accountToken !== token) continue;
201
- const priority = account.tokenSource === "config" ? 2 : account.tokenSource === "env" ? 1 : 0;
202
- if (!owner || priority > owner.priority) {
203
- owner = {
204
- accountId: account.accountId,
205
- priority,
206
- index
207
- };
208
- continue;
209
- }
210
- if (priority === owner.priority && index < owner.index) owner = {
211
- accountId: account.accountId,
212
- priority,
213
- index
214
- };
215
- }
216
- return owner?.accountId;
217
- }
218
- function resolveDiscordDuplicateTokenOwner(params) {
219
- const owner = resolveDiscordAccountTokenOwner({
220
- cfg: params.cfg,
221
- token: params.account.token
274
+ }))
222
275
  });
223
- return owner && owner !== params.account.accountId ? owner : void 0;
224
276
  }
225
277
  function isDiscordAccountEnabledForRuntime(account, cfg) {
226
- return account.enabled && !resolveDiscordDuplicateTokenOwner({
227
- cfg,
228
- account
229
- });
278
+ return inspectDiscordRuntimeAvailability(account, cfg).enabled;
230
279
  }
231
280
  function resolveDiscordAccountDisabledReason(account, cfg) {
232
- if (!account.enabled) return "disabled";
233
- const owner = resolveDiscordDuplicateTokenOwner({
234
- cfg,
235
- account
236
- });
237
- return owner ? `duplicate bot token; using account "${owner}"` : "disabled";
281
+ return inspectDiscordRuntimeAvailability(account, cfg).stateReason ?? "disabled";
238
282
  }
239
283
  function listEnabledDiscordAccounts(cfg) {
240
284
  return listDiscordAccountIds(cfg).map((accountId) => resolveDiscordAccount({
@@ -249,4 +293,4 @@ function listDiscordStartupAccountIds(cfg) {
249
293
  return [defaultAccountId, ...startupAccountIds.filter((candidateId) => candidateId !== defaultAccountId)];
250
294
  }
251
295
  //#endregion
252
- export { listEnabledDiscordAccounts as a, resolveDiscordAccount as c, resolveDiscordAccountDisabledReason as d, resolveDiscordAccountDmPolicy as f, selectDiscordActivitiesRuntimeConfig as g, resolveDiscordToken as h, listDiscordStartupAccountIds as i, resolveDiscordAccountAllowFrom as l, normalizeDiscordToken as m, isDiscordAccountEnabledForRuntime as n, mergeDiscordAccountConfig as o, resolveDiscordMaxLinesPerMessage as p, listDiscordAccountIds as r, resolveDefaultDiscordAccountId as s, createDiscordActionGate as t, resolveDiscordAccountConfig as u };
296
+ export { inspectDiscordAccountTokenState as _, listEnabledDiscordAccounts as a, resolveDiscordAccount as c, resolveDiscordAccountDisabledReason as d, resolveDiscordAccountDmPolicy as f, selectDiscordActivitiesRuntimeConfig as g, resolveDiscordToken as h, listDiscordStartupAccountIds as i, resolveDiscordAccountAllowFrom as l, normalizeDiscordToken as m, isDiscordAccountEnabledForRuntime as n, mergeDiscordAccountConfig as o, resolveDiscordMaxLinesPerMessage as p, listDiscordAccountIds as r, resolveDefaultDiscordAccountId as s, createDiscordActionGate as t, resolveDiscordAccountConfig as u, resolveDiscordAccountAvailability as v };
@@ -1,2 +1,2 @@
1
- import { t as handleDiscordAction } from "./runtime-BHrTlFkf.js";
1
+ import { t as handleDiscordAction } from "./runtime-BbWNtfyq.js";
2
2
  export { handleDiscordAction };
@@ -1,12 +1,12 @@
1
- import { v as resolveDiscordChannelId$1 } from "./retry-Cv4jCU5Z.js";
2
- import { i as buildDiscordPresentationComponents, x as parseDiscordActivityCustomId } from "./components-B9V5o361.js";
3
- import { c as resolveDiscordAccount } from "./accounts-CfQ-vSyf.js";
4
- import { r as sendDiscordComponentMessage } from "./send.components-DKKAw5VX.js";
5
- import { r as setDiscordActivitiesRuntime, t as DiscordActivitiesRuntime } from "./runtime-CY4PRMF-.js";
1
+ import { y as resolveDiscordChannelId$1 } from "./retry-BNCxiyyR.js";
2
+ import { S as parseDiscordActivityCustomId, i as buildDiscordPresentationComponents } from "./components-DmXYIQ26.js";
3
+ import { c as resolveDiscordAccount } from "./accounts-CwJQoLjM.js";
4
+ import { r as sendDiscordComponentMessage } from "./send.components-BWVEcjRP.js";
5
+ import { r as setDiscordActivitiesRuntime, t as DiscordActivitiesRuntime } from "./runtime-DB7Fb6AU.js";
6
6
  import fs from "node:fs/promises";
7
7
  import { logError } from "openclaw/plugin-sdk/logging-core";
8
8
  import { resolveRequestClientIp } from "openclaw/plugin-sdk/webhook-ingress";
9
- import { WEBHOOK_BODY_READ_DEFAULTS, readJsonBodyWithLimit } from "openclaw/plugin-sdk/webhook-request-guards";
9
+ import { WEBHOOK_BODY_READ_DEFAULTS, readJsonBodyWithLimit, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
10
10
  import { randomBytes } from "node:crypto";
11
11
  import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
12
12
  import { fetchWithSsrFGuard as fetchWithSsrFGuard$1 } from "openclaw/plugin-sdk/ssrf-runtime";
@@ -14,7 +14,7 @@ import { fetchWithSsrFGuard as fetchWithSsrFGuard$1 } from "openclaw/plugin-sdk/
14
14
  const DISCORD_TOKEN_URL = "https://discord.com/api/oauth2/token";
15
15
  const DISCORD_USER_URL = "https://discord.com/api/v10/users/@me";
16
16
  const DISCORD_HOST = "discord.com";
17
- const JSON_MAX_BYTES = 64 * 1024;
17
+ const JSON_MAX_BYTES = 65536;
18
18
  const INSTANCE_ID_MAX_LENGTH = 256;
19
19
  function normalizeInstanceId(value) {
20
20
  const instanceId = value?.trim();
@@ -243,7 +243,8 @@ run().catch((error) => {
243
243
  `;
244
244
  //#endregion
245
245
  //#region extensions/discord/src/activities/http.ts
246
- const BODY_MAX_BYTES = 8 * 1024;
246
+ const BODY_MAX_BYTES = 8192;
247
+ const JSON_CONTENT_TYPE = "application/json; charset=utf-8";
247
248
  const WIDGET_ID_PATTERN = /^[A-Za-z0-9_-]{22}$/;
248
249
  const DOC_TOKEN_PATTERN = /^[A-Za-z0-9_-]{43}$/;
249
250
  const DISCORD_ACTIVITY_WIDGET_CSP = "sandbox allow-scripts; default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; font-src data:; connect-src 'none'; frame-ancestors *";
@@ -260,8 +261,11 @@ function respond(res, statusCode, body, contentType, headers) {
260
261
  res.end(body);
261
262
  return true;
262
263
  }
264
+ function jsonBody(body) {
265
+ return `${JSON.stringify(body)}\n`;
266
+ }
263
267
  function respondJson(res, statusCode, body) {
264
- return respond(res, statusCode, `${JSON.stringify(body)}\n`, "application/json; charset=utf-8");
268
+ return respond(res, statusCode, jsonBody(body), JSON_CONTENT_TYPE);
265
269
  }
266
270
  function notFound(res, widgetDocument = false) {
267
271
  return respond(res, 404, "not found", "text/plain; charset=utf-8", widgetDocument ? { "Content-Security-Policy": DISCORD_ACTIVITY_WIDGET_CSP } : void 0);
@@ -309,9 +313,17 @@ function createDiscordActivityHttpHandler(deps) {
309
313
  const bodyResult = await readJsonBodyWithLimit(req, {
310
314
  maxBytes: BODY_MAX_BYTES,
311
315
  timeoutMs: bodyTimeoutMs,
312
- emptyObjectOnEmpty: true
316
+ emptyObjectOnEmpty: true,
317
+ destroyOnLimit: false
313
318
  });
314
- if (!bodyResult.ok && bodyResult.code === "REQUEST_BODY_TIMEOUT") return respondJson(res, 408, { error: "request body timeout" });
319
+ if (!bodyResult.ok && bodyResult.code === "REQUEST_BODY_TIMEOUT") {
320
+ await sendHttpRequestRejection(req, res, 408, jsonBody({ error: "request body timeout" }), JSON_CONTENT_TYPE);
321
+ return true;
322
+ }
323
+ if (!bodyResult.ok && bodyResult.code === "PAYLOAD_TOO_LARGE") {
324
+ await sendHttpRequestRejection(req, res, 413, jsonBody({ error: "request body too large" }), JSON_CONTENT_TYPE);
325
+ return true;
326
+ }
315
327
  const body = bodyResult.ok && bodyResult.value && typeof bodyResult.value === "object" && !Array.isArray(bodyResult.value) ? bodyResult.value : null;
316
328
  const code = typeof body?.code === "string" ? body.code.trim() : "";
317
329
  if (!code) return respondJson(res, 401, { error: "invalid authorization code" });
@@ -466,7 +478,7 @@ function createDiscordActivityHttpHandler(deps) {
466
478
  }
467
479
  //#endregion
468
480
  //#region extensions/discord/src/activities/presenter.ts
469
- const DISCORD_WIDGET_HTML_MAX_BYTES = 48 * 1024;
481
+ const DISCORD_WIDGET_HTML_MAX_BYTES = 49152;
470
482
  function resolveDiscordChannelId(context) {
471
483
  const raw = context.nativeChannelId?.trim() || context.currentMessagingTarget?.trim() || context.currentChannelId?.trim() || context.deliveryContext?.to?.trim();
472
484
  if (!raw) return;
@@ -593,12 +605,12 @@ function createDiscordWidgetPresenter(runtime, deps = {}) {
593
605
  }
594
606
  //#endregion
595
607
  //#region extensions/discord/src/activities/store.ts
596
- const DAY_MS = 1440 * 60 * 1e3;
608
+ const DAY_MS = 864e5;
597
609
  const DISCORD_EPOCH_MS = 14200704e5;
598
610
  const WIDGET_TTL_MS = 7 * DAY_MS;
599
- const SESSION_TTL_MS = 900 * 1e3;
600
- const DOC_TOKEN_TTL_MS = 60 * 1e3;
601
- const PENDING_LAUNCH_TTL_MS = 120 * 1e3;
611
+ const SESSION_TTL_MS = 9e5;
612
+ const DOC_TOKEN_TTL_MS = 6e4;
613
+ const PENDING_LAUNCH_TTL_MS = 12e4;
602
614
  function requireAtomicUpdate(store) {
603
615
  if (!store.update) throw new Error("Discord Activities require atomic plugin state updates");
604
616
  return store;
@@ -722,7 +734,8 @@ var DiscordActivityStore = class {
722
734
  //#region extensions/discord/src/activities/register.ts
723
735
  function registerDiscordActivities$1(api) {
724
736
  setDiscordActivitiesRuntime(void 0);
725
- const runtime = new DiscordActivitiesRuntime(new DiscordActivityStore(openDiscordActivityStores((options) => api.runtime.state.openKeyedStore(options))), api.config, api.runtime.config?.current ? () => api.runtime.config.current() : void 0);
737
+ const store = new DiscordActivityStore(openDiscordActivityStores((options) => api.runtime.state.openKeyedStore(options)));
738
+ const runtime = new DiscordActivitiesRuntime(store, api.config, api.runtime.config?.current ? () => api.runtime.config.current() : void 0);
726
739
  setDiscordActivitiesRuntime(runtime);
727
740
  const http = createDiscordActivityHttpHandler({
728
741
  runtime,
@@ -1,2 +1,2 @@
1
- import { t as registerDiscordActivities } from "./activities-api-q-9PaaHH.js";
1
+ import { t as registerDiscordActivities } from "./activities-api-E-segZn6.js";
2
2
  export { registerDiscordActivities };
@@ -258,10 +258,12 @@ function buildDiscordChannelKeys(params) {
258
258
  return buildChannelKeyCandidates(params.id, allowNameMatch ? params.slug : void 0, allowNameMatch ? params.name : void 0);
259
259
  }
260
260
  function resolveDiscordChannelEntryMatch(channels, params, parentParams) {
261
+ const keys = buildDiscordChannelKeys(params);
262
+ const parentKeys = parentParams ? buildDiscordChannelKeys(parentParams) : void 0;
261
263
  return resolveChannelEntryMatchWithFallback({
262
264
  entries: channels,
263
- keys: buildDiscordChannelKeys(params),
264
- parentKeys: parentParams ? buildDiscordChannelKeys(parentParams) : void 0,
265
+ keys,
266
+ parentKeys,
265
267
  wildcardKey: "*"
266
268
  });
267
269
  }
@@ -288,18 +290,19 @@ function resolveDiscordChannelConfig(params) {
288
290
  const { guildInfo, channelId, channelName, channelSlug } = params;
289
291
  const channels = guildInfo?.channels;
290
292
  if (!hasConfiguredDiscordChannels(channels)) return null;
291
- return resolveChannelMatchConfig(resolveDiscordChannelEntryMatch(channels, {
293
+ const match = resolveDiscordChannelEntryMatch(channels, {
292
294
  id: channelId,
293
295
  name: channelName,
294
296
  slug: channelSlug
295
- }), resolveDiscordChannelConfigEntry) ?? { allowed: false };
297
+ });
298
+ return resolveChannelMatchConfig(match, resolveDiscordChannelConfigEntry) ?? { allowed: false };
296
299
  }
297
300
  function resolveDiscordChannelConfigWithFallback(params) {
298
301
  const { guildInfo, channelId, channelName, channelSlug, parentId, parentName, parentSlug, scope } = params;
299
302
  const channels = guildInfo?.channels;
300
303
  if (!hasConfiguredDiscordChannels(channels)) return null;
301
304
  const resolvedParentSlug = parentSlug ?? (parentName ? normalizeDiscordSlug(parentName) : "");
302
- return resolveChannelMatchConfig(resolveDiscordChannelEntryMatch(channels, {
305
+ const match = resolveDiscordChannelEntryMatch(channels, {
303
306
  id: channelId,
304
307
  name: channelName,
305
308
  slug: channelSlug,
@@ -308,7 +311,8 @@ function resolveDiscordChannelConfigWithFallback(params) {
308
311
  id: parentId ?? "",
309
312
  name: parentName,
310
313
  slug: resolvedParentSlug
311
- } : void 0), resolveDiscordChannelConfigEntry) ?? { allowed: false };
314
+ } : void 0);
315
+ return resolveChannelMatchConfig(match, resolveDiscordChannelConfigEntry) ?? { allowed: false };
312
316
  }
313
317
  function resolveDiscordShouldRequireMention(params) {
314
318
  if (!params.isGuildMessage) return false;
@@ -1,4 +1,4 @@
1
- import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-DdLPmPoa.js";
1
+ import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-BrLjLUJi.js";
2
2
  import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
3
3
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
4
4
  import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
@@ -27,12 +27,12 @@ const DISCORD_API_BASE = "https://discord.com/api/v10";
27
27
  const DISCORD_API_RETRY_DEFAULTS = {
28
28
  attempts: 3,
29
29
  minDelayMs: 500,
30
- maxDelayMs: 5 * 6e4,
30
+ maxDelayMs: 3e5,
31
31
  jitter: .1
32
32
  };
33
33
  const DISCORD_API_429_FALLBACK_RETRY_AFTER_SECONDS = 60;
34
- const DISCORD_API_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
35
- const DISCORD_API_RESPONSE_BODY_LIMIT_BYTES = 4 * 1024 * 1024;
34
+ const DISCORD_API_ERROR_BODY_LIMIT_BYTES = 8192;
35
+ const DISCORD_API_RESPONSE_BODY_LIMIT_BYTES = 4194304;
36
36
  const DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS = 1e4;
37
37
  function parseDiscordApiErrorPayload(text) {
38
38
  const trimmed = text.trim();
@@ -46,7 +46,8 @@ function parseDiscordApiErrorPayload(text) {
46
46
  return null;
47
47
  }
48
48
  function parseRetryAfterSeconds(text, response) {
49
- const retryAfter = parseDiscordRetryAfterBodySeconds(parseDiscordApiErrorPayload(text)?.retry_after);
49
+ const payload = parseDiscordApiErrorPayload(text);
50
+ const retryAfter = parseDiscordRetryAfterBodySeconds(payload?.retry_after);
50
51
  if (retryAfter !== void 0) return retryAfter;
51
52
  const header = response.headers.get("Retry-After");
52
53
  if (!header) return;
package/dist/api.js CHANGED
@@ -1,24 +1,24 @@
1
- import { _ as parseDiscordTarget, g as normalizeDiscordOutboundTarget, h as normalizeDiscordMessagingTarget, m as looksLikeDiscordTargetId, v as resolveDiscordChannelId } from "./retry-Cv4jCU5Z.js";
2
- import { C as parseDiscordComponentCustomId, E as parseDiscordModalCustomIdForInteraction, T as parseDiscordModalCustomId, _ as DISCORD_MODAL_CUSTOM_ID_KEY, b as buildDiscordModalCustomId, d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as DISCORD_COMPONENT_CUSTOM_ID_KEY, h as resolveDiscordComponentAttachmentName, l as DiscordFormModal, m as readDiscordComponentSpec, n as formatDiscordComponentEventText, p as DISCORD_COMPONENT_ATTACHMENT_PREFIX, r as buildDiscordInteractiveComponents, u as createDiscordFormModal, w as parseDiscordComponentCustomIdForInteraction, y as buildDiscordComponentCustomId } from "./components-B9V5o361.js";
3
- import { a as listEnabledDiscordAccounts, c as resolveDiscordAccount, o as mergeDiscordAccountConfig, p as resolveDiscordMaxLinesPerMessage, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, t as createDiscordActionGate, u as resolveDiscordAccountConfig } from "./accounts-CfQ-vSyf.js";
4
- import { i as requestDiscord, n as DiscordApiError, r as fetchDiscord } from "./api-DNVbJyEy.js";
5
- import { i as parseDiscordSendTarget, n as resolveDiscordTarget } from "./target-resolver-vxIh6O3-.js";
6
- import { t as inspectDiscordAccount } from "./account-inspect-BDfKyuvL.js";
7
- import { i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
8
- import "./targets-CtTKvntJ.js";
9
- import { C as shouldSuppressLocalDiscordExecApprovalPrompt, S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, x as isDiscordExecApprovalApprover } from "./outbound-session-route-Cg15ZFJd.js";
10
- import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-Dx1tMTfx.js";
1
+ import { _ as normalizeDiscordOutboundTarget, g as normalizeDiscordMessagingTarget, h as looksLikeDiscordTargetId, v as parseDiscordTarget, y as resolveDiscordChannelId } from "./retry-BNCxiyyR.js";
2
+ import { D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, T as parseDiscordComponentCustomIdForInteraction, _ as DISCORD_COMPONENT_CUSTOM_ID_KEY, b as buildDiscordComponentCustomId, d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName, h as readDiscordComponentSpec, l as DiscordFormModal, n as formatDiscordComponentEventText, p as DISCORD_COMPONENT_ATTACHMENT_PREFIX, r as buildDiscordInteractiveComponents, u as createDiscordFormModal, v as DISCORD_MODAL_CUSTOM_ID_KEY, w as parseDiscordComponentCustomId, x as buildDiscordModalCustomId } from "./components-DmXYIQ26.js";
3
+ import { a as listEnabledDiscordAccounts, c as resolveDiscordAccount, o as mergeDiscordAccountConfig, p as resolveDiscordMaxLinesPerMessage, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, t as createDiscordActionGate, u as resolveDiscordAccountConfig } from "./accounts-CwJQoLjM.js";
4
+ import { i as requestDiscord, n as DiscordApiError, r as fetchDiscord } from "./api-BfmEP6wp.js";
5
+ import { i as parseDiscordSendTarget, n as resolveDiscordTarget } from "./target-resolver-BVI8xSSC.js";
6
+ import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
7
+ import { i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.js";
8
+ import "./targets-DbxVbq8k.js";
9
+ import { C as shouldSuppressLocalDiscordExecApprovalPrompt, S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, x as isDiscordExecApprovalApprover } from "./outbound-session-route-BFGRF9fE.js";
10
+ import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-D93LnbTE.js";
11
11
  import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-wJgsKPNF.js";
12
- import { t as discordSetupPlugin } from "./channel.setup-DOzXS2Pk.js";
13
- import { n as handleDiscordSubagentEnded, t as handleDiscordSubagentDeliveryTarget } from "./subagent-hooks-DQzvOptn.js";
14
- import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-BdwCRHmm.js";
15
- import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-BK6eqekJ.js";
16
- import { t as fetchPluralKitMessageInfo } from "./pluralkit-Tiyl70dx.js";
17
- import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-n6ZXxK8V.js";
18
- import { t as collectDiscordSecurityAuditFindings } from "./security-audit-BfJhAXZp.js";
12
+ import { t as discordSetupPlugin } from "./channel.setup-DTL7kPOM.js";
13
+ import { n as handleDiscordSubagentEnded, t as handleDiscordSubagentDeliveryTarget } from "./subagent-hooks-IzQKX4RQ.js";
14
+ import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-B0egstYq.js";
15
+ import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-BD4YL7wT.js";
16
+ import { t as fetchPluralKitMessageInfo } from "./pluralkit-XmmAHoV6.js";
17
+ import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-3ovFAp3b.js";
18
+ import { t as collectDiscordSecurityAuditFindings } from "./security-audit-DKfK-iPY.js";
19
19
  import { resolveOpenProviderRuntimeGroupPolicy as resolveDiscordRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
20
20
  //#region extensions/discord/api.ts
21
- const handleDiscordMessageAction = async (...args) => (await import("./channel-actions.runtime-CLWWu9nC.js")).handleDiscordMessageAction(...args);
21
+ const handleDiscordMessageAction = async (...args) => (await import("./channel-actions.runtime-DMFv4doE.js")).handleDiscordMessageAction(...args);
22
22
  /**
23
23
  * @deprecated Shipped `@openclaw/discord/api` compatibility only. Use native
24
24
  * `AbortSignal.any` after filtering optional signals. Removal with the next
@@ -1,8 +1,8 @@
1
- import { Dt as deleteChannelMessage, _t as stripUndefinedFields, ct as Row, et as Button, ft as TextDisplay, kt as editChannelMessage, nt as Container, q as serializePayload, ut as Separator, wt as createChannelMessage, yt as createUserDmChannel } from "./retry-Cv4jCU5Z.js";
2
- import { s as buildExecApprovalCustomId } from "./components-B9V5o361.js";
3
- import { N as createDiscordClient, O as createDiscordMessageNonce } from "./send.shared-JjljcV4O.js";
4
- import { S as isDiscordExecApprovalClientEnabled, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, r as formatDiscordApprovalDisplayValue } from "./outbound-session-route-Cg15ZFJd.js";
5
- import { a as shouldHandleDiscordApprovalRequest } from "./channel-Dx1tMTfx.js";
1
+ import { At as editChannelMessage, J as serializePayload, Ot as deleteChannelMessage, Tt as createChannelMessage, bt as createUserDmChannel, dt as Separator, lt as Row, pt as TextDisplay, rt as Container, tt as Button, vt as stripUndefinedFields } from "./retry-BNCxiyyR.js";
2
+ import { s as buildExecApprovalCustomId } from "./components-DmXYIQ26.js";
3
+ import { N as createDiscordClient, O as createDiscordMessageNonce } from "./send.shared-5vxBTagO.js";
4
+ import { S as isDiscordExecApprovalClientEnabled, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, r as formatDiscordApprovalDisplayValue } from "./outbound-session-route-BFGRF9fE.js";
5
+ import { a as shouldHandleDiscordApprovalRequest } from "./channel-D93LnbTE.js";
6
6
  import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
7
7
  import { ButtonStyle } from "discord-api-types/v10";
8
8
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -52,7 +52,7 @@ var ExecApprovalContainer = class extends DiscordUiContainer {
52
52
  divider: true,
53
53
  spacing: "small"
54
54
  }));
55
- components.push(new TextDisplay(`### Command\n\`\`\`\n${params.commandPreview}\n\`\`\``));
55
+ components.push(new TextDisplay(`### ${params.commandLabel ?? "Command"}\n\`\`\`\n${params.commandPreview}\n\`\`\``));
56
56
  if (params.commandSecondaryPreview) components.push(new TextDisplay(`### Shell Preview\n\`\`\`\n${params.commandSecondaryPreview}\n\`\`\``));
57
57
  if (params.metadataLines?.length) components.push(new TextDisplay(params.metadataLines.join("\n")));
58
58
  if (params.actionRow) components.push(params.actionRow);
@@ -140,15 +140,16 @@ function resolveCommandPreviews(commandText, commandPreview, maxChars, secondary
140
140
  function createApprovalContainer(params) {
141
141
  const { view } = params;
142
142
  const plugin = view.approvalKind === "plugin";
143
+ const systemAgent = view.approvalKind === "system-agent";
143
144
  const pending = view.phase === "pending";
144
- const approvalLabel = plugin ? "Plugin" : "Exec";
145
+ const approvalLabel = plugin ? "Plugin" : systemAgent ? "OpenClaw Change" : "Exec";
145
146
  const { commandPreview, commandSecondaryPreview } = plugin ? {
146
147
  commandPreview: formatCommandPreview(view.title, 700),
147
148
  commandSecondaryPreview: formatOptionalCommandPreview(view.description, 1e3)
148
149
  } : resolveCommandPreviews(view.commandText, view.commandPreview, pending ? 1e3 : 500, pending ? 500 : 300);
149
- const decisionLabel = view.phase !== "resolved" ? void 0 : view.decision === "allow-once" ? "Allowed (once)" : view.decision === "allow-always" ? "Allowed (always)" : "Denied";
150
+ const decisionLabel = view.phase !== "resolved" ? void 0 : systemAgent && view.terminalStatus === "cancelled" ? "Cancelled" : systemAgent && view.applicationStatus === "applied" ? "Applied" : systemAgent && view.applicationStatus === "not-applied" ? "Not applied" : view.decision === "allow-once" ? "Allowed (once)" : view.decision === "allow-always" ? "Allowed (always)" : "Denied";
150
151
  const title = pending ? `${approvalLabel} Approval Required` : `${approvalLabel} Approval: ${view.phase === "expired" ? "Expired" : decisionLabel}`;
151
- const description = pending ? plugin ? "A plugin action needs your approval." : "A command needs your approval." : view.phase === "expired" ? "This approval request has expired." : view.resolvedBy ? `Resolved by ${formatDiscordApprovalDisplayValue(view.resolvedBy)}` : "Resolved";
152
+ 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";
152
153
  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";
153
154
  const approvalId = formatDiscordApprovalDisplayValue(view.approvalId);
154
155
  const footer = pending ? `Expires <t:${Math.max(0, Math.floor(view.expiresAtMs / 1e3))}:R> · ID: ${approvalId}` : `ID: ${approvalId}`;
@@ -157,6 +158,7 @@ function createApprovalContainer(params) {
157
158
  accountId: params.accountId,
158
159
  title,
159
160
  description,
161
+ commandLabel: systemAgent ? "Change" : "Command",
160
162
  commandPreview,
161
163
  commandSecondaryPreview,
162
164
  metadataLines: buildApprovalMetadataLines(view.metadata),
@@ -196,7 +198,11 @@ async function finalizeMessage(params) {
196
198
  }
197
199
  }
198
200
  const discordApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
199
- eventKinds: ["exec", "plugin"],
201
+ eventKinds: [
202
+ "exec",
203
+ "plugin",
204
+ "system-agent"
205
+ ],
200
206
  availability: {
201
207
  isConfigured: (params) => {
202
208
  const resolved = resolveHandlerContext(params);
@@ -224,12 +230,13 @@ const discordApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
224
230
  context
225
231
  });
226
232
  if (!resolved) return { body: {} };
227
- return { body: stripUndefinedFields(serializePayload(buildExecApprovalPayload(createApprovalContainer({
233
+ const container = createApprovalContainer({
228
234
  view,
229
235
  cfg,
230
236
  accountId: resolved.accountId,
231
237
  actionRow: createApprovalActionRow(view)
232
- })))) };
238
+ });
239
+ return { body: stripUndefinedFields(serializePayload(buildExecApprovalPayload(container))) };
233
240
  },
234
241
  buildResolvedResult: ({ cfg, accountId, context, view }) => {
235
242
  const resolvedContext = resolveHandlerContext({
@@ -1,18 +1,19 @@
1
- import { on as __exportAll } from "./retry-Cv4jCU5Z.js";
2
- import { x as fetchChannelPermissionsDiscord } from "./send.shared-JjljcV4O.js";
3
- import { t as inspectDiscordAccount } from "./account-inspect-BDfKyuvL.js";
4
- import "./send-C49MFF9j.js";
5
- import { _ as auditDiscordChannelPermissionsWithFetcher, v as collectDiscordAuditChannelIdsForAccount } from "./outbound-session-route-Cg15ZFJd.js";
1
+ import { sn as __exportAll } from "./retry-BNCxiyyR.js";
2
+ import { x as fetchChannelPermissionsDiscord } from "./send.shared-5vxBTagO.js";
3
+ import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
4
+ import "./send-BnTEIeLE.js";
5
+ import { _ as auditDiscordChannelPermissionsWithFetcher, v as collectDiscordAuditChannelIdsForAccount } from "./outbound-session-route-BFGRF9fE.js";
6
6
  //#region extensions/discord/src/audit.ts
7
7
  var audit_exports = /* @__PURE__ */ __exportAll({
8
8
  auditDiscordChannelPermissions: () => auditDiscordChannelPermissions,
9
9
  collectDiscordAuditChannelIds: () => collectDiscordAuditChannelIds
10
10
  });
11
11
  function collectDiscordAuditChannelIds(params) {
12
- return collectDiscordAuditChannelIdsForAccount(inspectDiscordAccount({
12
+ const account = inspectDiscordAccount({
13
13
  cfg: params.cfg,
14
14
  accountId: params.accountId
15
- }).config);
15
+ });
16
+ return collectDiscordAuditChannelIdsForAccount(account.config);
16
17
  }
17
18
  async function auditDiscordChannelPermissions(params) {
18
19
  return await auditDiscordChannelPermissionsWithFetcher({