@openclaw/slack 2026.10.10-beta.5 → 2026.10.33

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 (99) hide show
  1. package/dist/.setup/action-runtime.runtime-vLxx_7s2.mjs +2 -0
  2. package/dist/.setup/{channel-6YzXl_63.mjs → channel-DQKq-0IZ.mjs} +5 -5
  3. package/dist/.setup/{channel.setup-u6QQdbTa.mjs → channel.setup-CzFw73mU.mjs} +1 -1
  4. package/dist/.setup/{monitor-BFilOuM_.mjs → monitor-Dcd6ymHV.mjs} +3 -3
  5. package/dist/.setup/{pipeline.runtime-BG5swHnj.mjs → pipeline.runtime-CdF95Pej.mjs} +3 -2
  6. package/dist/.setup/{relay-source-oY9SbDiX.mjs → relay-source-BPXstGYg.mjs} +7 -2
  7. package/dist/.setup/{replies-CJwjTqDr.mjs → replies-C60dQn3J.mjs} +1 -1
  8. package/dist/.setup/runtime-setter-api-CMFvhrAr.mjs +3 -0
  9. package/dist/.setup/secret-contract-api-DK9gZldc.mjs +3 -0
  10. package/dist/.setup/{secret-contract-B-Qm6aQQ.mjs → secret-contract-vVRMoE1D.mjs} +2 -0
  11. package/dist/.setup/setup-plugin-api-BGD1TYnK.mjs +3 -0
  12. package/dist/.setup/{setup-surface-9WVQgYCT.mjs → setup-surface--n8VsDvV.mjs} +2 -2
  13. package/dist/.setup/{shared-DpHCoKy2.mjs → shared-BhJHIZs1.mjs} +2 -2
  14. package/dist/.setup/{slash-dispatch.runtime-v5kQqJPh.mjs → slash-dispatch.runtime-DNddQpYP.mjs} +1 -1
  15. package/dist/api.js +2 -2
  16. package/dist/channel-config-api.js +2 -1
  17. package/dist/channel-plugin-api.js +2 -1
  18. package/dist/directory-contract-api.js +2 -1
  19. package/dist/doctor-contract-api.js +2 -1
  20. package/dist/http-routes-api.js +2 -1
  21. package/dist/message-tool-api.js +2 -1
  22. package/dist/runtime-api.js +1 -1
  23. package/dist/runtime-setter-api.js +2 -1
  24. package/dist/secret-contract-api.js +2 -1
  25. package/dist/security-contract-api.js +2 -1
  26. package/dist/setup-entry.js +3 -3
  27. package/dist/setup-plugin-api.js +2 -1
  28. package/node_modules/@slack/bolt/node_modules/body-parser/README.md +17 -13
  29. package/node_modules/@slack/bolt/node_modules/body-parser/lib/read.js +74 -57
  30. package/node_modules/@slack/bolt/node_modules/body-parser/lib/types/json.js +11 -11
  31. package/node_modules/@slack/bolt/node_modules/body-parser/lib/types/urlencoded.js +5 -5
  32. package/node_modules/@slack/bolt/node_modules/body-parser/lib/utils.js +0 -15
  33. package/node_modules/@slack/bolt/node_modules/body-parser/package.json +7 -12
  34. package/node_modules/undici/README.md +25 -3
  35. package/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
  36. package/node_modules/undici/docs/docs/api/Client.md +11 -6
  37. package/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
  38. package/node_modules/undici/docs/docs/api/Errors.md +76 -1
  39. package/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
  40. package/node_modules/undici/docs/docs/api/Interceptors.md +13 -6
  41. package/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
  42. package/node_modules/undici/docs/docs/index.md +12 -12
  43. package/node_modules/undici/docs/docs/type-map.json +66 -66
  44. package/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
  45. package/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
  46. package/node_modules/undici/lib/core/connect.js +10 -4
  47. package/node_modules/undici/lib/core/constants.js +12 -1
  48. package/node_modules/undici/lib/core/errors.js +38 -1
  49. package/node_modules/undici/lib/core/request.js +16 -1
  50. package/node_modules/undici/lib/core/symbols.js +2 -0
  51. package/node_modules/undici/lib/core/util.js +26 -1
  52. package/node_modules/undici/lib/dispatcher/agent.js +6 -2
  53. package/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
  54. package/node_modules/undici/lib/dispatcher/client-h2.js +46 -14
  55. package/node_modules/undici/lib/dispatcher/client.js +4 -1
  56. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
  57. package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
  58. package/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
  59. package/node_modules/undici/lib/dispatcher/pool-base.js +65 -28
  60. package/node_modules/undici/lib/dispatcher/pool.js +11 -8
  61. package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
  62. package/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
  63. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
  64. package/node_modules/undici/lib/handler/cache-handler.js +153 -15
  65. package/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
  66. package/node_modules/undici/lib/handler/redirect-handler.js +28 -8
  67. package/node_modules/undici/lib/handler/retry-handler.js +44 -11
  68. package/node_modules/undici/lib/interceptor/cache.js +11 -3
  69. package/node_modules/undici/lib/interceptor/decompress.js +22 -9
  70. package/node_modules/undici/lib/interceptor/dns.js +11 -0
  71. package/node_modules/undici/lib/interceptor/response-error.js +72 -28
  72. package/node_modules/undici/lib/milo/LICENSE.md +7 -0
  73. package/node_modules/undici/lib/milo/no-simd.js +1002 -0
  74. package/node_modules/undici/lib/milo/simd.js +1002 -0
  75. package/node_modules/undici/lib/mock/mock-agent.js +11 -0
  76. package/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
  77. package/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
  78. package/node_modules/undici/lib/util/cache.js +11 -5
  79. package/node_modules/undici/lib/web/cookies/util.js +19 -2
  80. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
  81. package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
  82. package/node_modules/undici/lib/web/fetch/body.js +47 -38
  83. package/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
  84. package/node_modules/undici/lib/web/fetch/headers.js +2 -2
  85. package/node_modules/undici/lib/web/fetch/index.js +8 -4
  86. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  87. package/node_modules/undici/lib/web/websocket/receiver.js +25 -4
  88. package/node_modules/undici/package.json +7 -5
  89. package/node_modules/undici/types/cache-interceptor.d.ts +10 -0
  90. package/node_modules/undici/types/client.d.ts +10 -4
  91. package/node_modules/undici/types/errors.d.ts +16 -1
  92. package/node_modules/undici/types/h2c-client.d.ts +1 -1
  93. package/node_modules/undici/types/interceptors.d.ts +6 -1
  94. package/package.json +5 -5
  95. package/dist/.setup/action-runtime.runtime-Ck_j1YTn.mjs +0 -1
  96. package/dist/.setup/runtime-setter-api-Cx_PV-xu.mjs +0 -2
  97. package/dist/.setup/secret-contract-api-DB6CMdgc.mjs +0 -2
  98. package/dist/.setup/setup-plugin-api-B18kDKtr.mjs +0 -2
  99. package/dist/.source-module-urls/562d694877afe9d9dcbb3b32a8883c16974738f2aa892c48d45572cdc9a62529.json +0 -1
@@ -0,0 +1,2 @@
1
+ import { t as handleSlackAction } from "./action-runtime-ChRfnnBu.mjs";
2
+ export { handleSlackAction };
@@ -9,8 +9,8 @@ import { n as resolveSlackReplyThreadTs, r as resolveSlackThreadTsValue, t as no
9
9
  import { n as extractSlackToolSend, t as describeSlackMessageTool } from "./message-tool-api-BS5ekEA_.mjs";
10
10
  import { n as resolveSlackChannelType, r as resolveSlackConversationInfo } from "./channel-type-BEFP2ORi.mjs";
11
11
  import { t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.mjs";
12
- import { n as slackPluginBase, r as slackSecurityAdapter, t as slackConfigAdapter } from "./shared-DpHCoKy2.mjs";
13
- import { i as SLACK_CHANNEL } from "./channel.setup-u6QQdbTa.mjs";
12
+ import { n as slackPluginBase, r as slackSecurityAdapter, t as slackConfigAdapter } from "./shared-BhJHIZs1.mjs";
13
+ import { i as SLACK_CHANNEL } from "./channel.setup-CzFw73mU.mjs";
14
14
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
15
15
  import { normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/account-resolution";
16
16
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -378,7 +378,7 @@ const SLACK_TOOL_DELIVERY_ACTIONS = /* @__PURE__ */ new Set([
378
378
  "unpinMessage",
379
379
  "uploadFile"
380
380
  ]);
381
- const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-Ck_j1YTn.mjs"));
381
+ const loadSlackActionRuntime$1 = createLazyRuntimeModule(() => import("./action-runtime.runtime-vLxx_7s2.mjs"));
382
382
  function resolveSlackActionContext(ctx, toolContext) {
383
383
  if (!toolContext && !ctx.mediaAccess && !ctx.mediaLocalRoots && !ctx.mediaReadFile && !ctx.conversationReadOrigin && !ctx.requesterAccountId && !ctx.requesterSenderId && !ctx.assertDirectAdapterHandoff) return;
384
384
  return {
@@ -621,10 +621,10 @@ async function resolveSlackHandleAction() {
621
621
  const loadSlackDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-Cjj0N8R0.mjs").then((n) => n.t));
622
622
  const loadSlackResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-DRRhElwz.mjs").then((n) => n.n));
623
623
  const loadSlackResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-Cz8e17ky.mjs").then((n) => n.n));
624
- const loadSlackActionRuntime = createLazyRuntimeModule(() => import("./action-runtime.runtime-Ck_j1YTn.mjs"));
624
+ const loadSlackActionRuntime = createLazyRuntimeModule(() => import("./action-runtime.runtime-vLxx_7s2.mjs"));
625
625
  const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send-C-8wY0lK.mjs").then((n) => n.n));
626
626
  const loadSlackProbeModule = createLazyRuntimeModule(() => import("./probe-IiHogLQN.mjs").then((n) => n.n));
627
- const loadSlackMonitorModule = createLazyRuntimeModule(() => import("./monitor-BFilOuM_.mjs").then((n) => n.t));
627
+ const loadSlackMonitorModule = createLazyRuntimeModule(() => import("./monitor-Dcd6ymHV.mjs").then((n) => n.t));
628
628
  const loadSlackDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-BIKD-5B_.mjs").then((n) => n.t));
629
629
  async function setSlackHeartbeatThreadStatus(params) {
630
630
  const threadTs = resolveSlackThreadTsValue({ threadId: params.threadId });
@@ -550,7 +550,7 @@ const slackSetupPlugin = {
550
550
  markdownCapable: true,
551
551
  preferSessionLookupForAnnounceTarget: true
552
552
  },
553
- setupWizard: createSlackSetupWizardProxy(() => import("./setup-surface-9WVQgYCT.mjs")),
553
+ setupWizard: createSlackSetupWizardProxy(() => import("./setup-surface--n8VsDvV.mjs")),
554
554
  capabilities: {
555
555
  chatTypes: [
556
556
  "direct",
@@ -2921,7 +2921,7 @@ const SLACK_COMMAND_ARG_BUTTON_VALUE_MAX = 2e3;
2921
2921
  const SLACK_COMMAND_ARG_CONFIRM_TEXT_MAX = 300;
2922
2922
  const SLACK_HEADER_TEXT_MAX = 150;
2923
2923
  const SLACK_COMMAND_ARG_ACTION_BLOCKS_MAX = 47;
2924
- const loadSlashDispatchRuntime = createLazyRuntimeModule(() => import("./slash-dispatch.runtime-v5kQqJPh.mjs"));
2924
+ const loadSlashDispatchRuntime = createLazyRuntimeModule(() => import("./slash-dispatch.runtime-DNddQpYP.mjs"));
2925
2925
  const loadPluginCommandRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/plugin-command-runtime"));
2926
2926
  const slackExternalArgMenuStore = createSlackExternalArgMenuStore();
2927
2927
  function buildSlackArgMenuConfirm(params) {
@@ -5879,7 +5879,7 @@ function buildSlackDebounceKey(message, accountId, teamId) {
5879
5879
  }
5880
5880
  //#endregion
5881
5881
  //#region extensions/slack/src/monitor/message-handler.ts
5882
- const loadSlackMessagePipeline = createLazyRuntimeModule(() => import("./pipeline.runtime-BG5swHnj.mjs"));
5882
+ const loadSlackMessagePipeline = createLazyRuntimeModule(() => import("./pipeline.runtime-CdF95Pej.mjs"));
5883
5883
  const RETRYABLE_FLUSH_MAX_ATTEMPTS = 3;
5884
5884
  function shouldDebounceSlackMessage(message, cfg) {
5885
5885
  const textForCommandDetection = stripSlackMentionsForCommandDetection(message.text ?? "");
@@ -6414,7 +6414,7 @@ async function getSlackBoltInterop() {
6414
6414
  }
6415
6415
  return slackBoltInterop;
6416
6416
  }
6417
- const loadSlackRelaySource = createLazyRuntimeModule(() => import("./relay-source-oY9SbDiX.mjs"));
6417
+ const loadSlackRelaySource = createLazyRuntimeModule(() => import("./relay-source-BPXstGYg.mjs"));
6418
6418
  function resolveSlackRuntimeIdentity(params) {
6419
6419
  const botUserId = normalizeOptionalString(params.botUserId);
6420
6420
  const botId = normalizeOptionalString(params.botId);
@@ -8,8 +8,8 @@ import { n as resolveSlackReplyThreadTs } from "./thread-ts-Cvt7WD6B.mjs";
8
8
  import { C as hasSlackTableBlock, D as buildSlackEditTextPayload, E as resolveSlackMessageText$1, T as resolveSlackBlocksText, a as editSlackRenderedMessage, b as formatSlackFileReference, d as reactSlackMessage, i as editSlackMessage, m as removeSlackReaction, n as deleteSlackMessage, w as isSlackUnfurlAttachment, x as formatSlackFileReferenceList } from "./actions-By7tvpvv.mjs";
9
9
  import { c as hasSlackThreadParticipationWithPersistence, i as clearSlackThreadFailureNotice, l as recordSlackThreadFailureNotice, m as buildSlackNativeDataDeliveryPlan, o as hasSlackThreadFailureNotice, p as hasSlackMessageIdentity, s as hasSlackThreadParticipation, t as sendMessageSlack, u as recordSlackThreadParticipation } from "./send-C-8wY0lK.mjs";
10
10
  import { n as resolveSlackChannelConfig } from "./policy-yhn48xf5.mjs";
11
- import { C as resolveSlackChatType, E as stripSlackMentionsForCommandDetection, S as normalizeSlackChannelType, T as readSlackAssistantThreadContext, _ as appendSlackStream, b as stopSlackStream, c as resolveSlackRoutingContext, g as SlackStreamNotDeliveredError, h as resolveSlackEffectiveAllowFrom, i as resolveSlackRoomContextHints, l as registerSlackSessionRun, m as resolveSlackCommandIngress, p as authorizeSlackBotRoomMessage, r as trackSlackDraftMessage, s as authorizeSlackDirectMessage, u as resolveSlackThreadContext, v as markSlackStreamFallbackDelivered, w as buildSlackAssistantThreadMetadata, y as startSlackStream } from "./monitor-BFilOuM_.mjs";
12
- import { a as emitSlackMessageSentHooks, i as sanitizeSlackMonitorReplyPayload, n as deliverReplies, t as createSlackReplyDeliveryPlan } from "./replies-CJwjTqDr.mjs";
11
+ import { C as resolveSlackChatType, E as stripSlackMentionsForCommandDetection, S as normalizeSlackChannelType, T as readSlackAssistantThreadContext, _ as appendSlackStream, b as stopSlackStream, c as resolveSlackRoutingContext, g as SlackStreamNotDeliveredError, h as resolveSlackEffectiveAllowFrom, i as resolveSlackRoomContextHints, l as registerSlackSessionRun, m as resolveSlackCommandIngress, p as authorizeSlackBotRoomMessage, r as trackSlackDraftMessage, s as authorizeSlackDirectMessage, u as resolveSlackThreadContext, v as markSlackStreamFallbackDelivered, w as buildSlackAssistantThreadMetadata, y as startSlackStream } from "./monitor-Dcd6ymHV.mjs";
12
+ import { a as emitSlackMessageSentHooks, i as sanitizeSlackMonitorReplyPayload, n as deliverReplies, t as createSlackReplyDeliveryPlan } from "./replies-C60dQn3J.mjs";
13
13
  import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
14
14
  import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
15
15
  import { buildChannelProgressDraftLine, compactChannelProgressDraftLine, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor, createChannelProgressWorkCounter, createDraftStreamLoop, createFinalizableDraftLifecycle, createLivePreviewLifecycle, createMessageReceiptFromOutboundResults, resolveAgentOutboundIdentity, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelProgressDraftConfig, resolveChannelProgressDraftMaxLineChars, resolveChannelStreamingBlockEnabled, resolveChannelStreamingPreviewToolProgress, resolveChannelStreamingSuppressDefaultToolProgressMessages, selectPlanChecklistSteps } from "openclaw/plugin-sdk/channel-outbound";
@@ -1426,6 +1426,7 @@ function createSlackProgressRuntime(runtimeParams) {
1426
1426
  const pushReasoningProgress = async (payload) => {
1427
1427
  if (!payload?.text) return false;
1428
1428
  if (!isProgressMode) {
1429
+ if (!previewToolProgressEnabled) return false;
1429
1430
  const normalized = progressDraft.mergeReasoningProgress(payload.text, { snapshot: payload.isReasoningSnapshot === true }).replace(/^_(.*)_$/su, "$1").trim();
1430
1431
  if (!normalized) return false;
1431
1432
  const visible = await progressDraft.pushToolProgress({
@@ -1,11 +1,11 @@
1
1
  import { o as formatSlackError } from "./probe-IiHogLQN.mjs";
2
- import { d as parseSlackMessageEvent, f as requireSlackMessageEvent, x as SLACK_SOCKET_RECONNECT_POLICY } from "./monitor-BFilOuM_.mjs";
2
+ import { d as parseSlackMessageEvent, f as requireSlackMessageEvent, x as SLACK_SOCKET_RECONNECT_POLICY } from "./monitor-Dcd6ymHV.mjs";
3
3
  import { asOptionalRecord, normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { computeBackoff, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
5
5
  import { createNodeProxyAgent } from "openclaw/plugin-sdk/fetch-runtime";
6
6
  import { isIP } from "node:net";
7
7
  import { rawDataToString } from "openclaw/plugin-sdk/webhook-ingress";
8
- import { WebSocket } from "openclaw/plugin-sdk/websocket-runtime";
8
+ import { WebSocket, startWebSocketKeepalive } from "openclaw/plugin-sdk/websocket-runtime";
9
9
  //#region extensions/slack/src/monitor/relay-source.ts
10
10
  const SLACK_RELAY_ROUTE_KINDS = /* @__PURE__ */ new Set([
11
11
  "user_group",
@@ -93,7 +93,12 @@ function runRelayWebSocket(params) {
93
93
  const ws = params.connection;
94
94
  let pending = Promise.resolve();
95
95
  return new Promise((resolve, reject) => {
96
+ const stopKeepalive = startWebSocketKeepalive(ws, () => {
97
+ ws.terminate();
98
+ settleReject(/* @__PURE__ */ new Error("Slack relay websocket heartbeat timed out"));
99
+ });
96
100
  const cleanup = () => {
101
+ stopKeepalive();
97
102
  ws.off("message", onMessage);
98
103
  ws.off("error", onError);
99
104
  ws.off("close", onClose);
@@ -2,7 +2,7 @@ import { C as isSlackNativeResponseUrlRejection, M as SLACK_TEXT_LIMIT, S as isS
2
2
  import { n as iterateSlackReplyDeliveryMessages, o as resolveSlackReplyBlockResolution, t as hasSlackReplyStructuredContent } from "./reply-blocks-Ca-raz2z.mjs";
3
3
  import { n as resolveSlackReplyThreadTs } from "./thread-ts-Cvt7WD6B.mjs";
4
4
  import { h as chunkSlackTextAtHardLimit, m as buildSlackNativeDataDeliveryPlan, t as sendMessageSlack } from "./send-C-8wY0lK.mjs";
5
- import { a as SlackResponseAlreadyReportedError, o as createSlackResponseUrlBudget } from "./monitor-BFilOuM_.mjs";
5
+ import { a as SlackResponseAlreadyReportedError, o as createSlackResponseUrlBudget } from "./monitor-Dcd6ymHV.mjs";
6
6
  import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
7
7
  import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
8
8
  import { deliverTextOrMediaReply, getReplyPayloadTtsSupplement, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
@@ -0,0 +1,3 @@
1
+ import { r as setSlackRuntime } from "./runtime-JSVZSWAj.mjs";
2
+ import "../runtime-setter-api.js";
3
+ export { setSlackRuntime };
@@ -0,0 +1,3 @@
1
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-vVRMoE1D.mjs";
2
+ import "../secret-contract-api.js";
3
+ export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
@@ -1,3 +1,4 @@
1
+ import { n as hasSlackAccountCredentialsFromConfig } from "./account-configured-zcR9TJJN.mjs";
1
2
  import { collectConditionalChannelFieldAssignments, collectNestedChannelFieldAssignments, collectSimpleChannelFieldAssignments, createChannelSecretContract, hasOwnProperty } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
2
3
  //#region extensions/slack/src/secret-contract.ts
3
4
  const channelSecrets = createChannelSecretContract({
@@ -16,6 +17,7 @@ const channelSecrets = createChannelSecretContract({
16
17
  "signingSecret",
17
18
  "userToken"
18
19
  ],
20
+ hasImplicitDefaultAccount: ({ context }) => hasSlackAccountCredentialsFromConfig(context.sourceConfig.channels?.slack, context.env),
19
21
  collect(params) {
20
22
  const { channel: slack, surface } = params;
21
23
  const resolveMode = (value) => value === "http" || value === "socket" || value === "relay" ? value : void 0;
@@ -0,0 +1,3 @@
1
+ import { t as slackSetupPlugin } from "./channel.setup-CzFw73mU.mjs";
2
+ import "../setup-plugin-api.js";
3
+ export { slackSetupPlugin };
@@ -1,7 +1,7 @@
1
1
  import { c as resolveSlackAccountAllowFrom, o as resolveDefaultSlackAccountId } from "./accounts-msihSF3-.mjs";
2
2
  import { t as inspectSlackAccount } from "./account-inspect-CmkKiSb9.mjs";
3
- import "./shared-DpHCoKy2.mjs";
4
- import { a as buildSlackAllowFromPrompt, i as SLACK_CHANNEL, n as createSlackSetupWizardBase } from "./channel.setup-u6QQdbTa.mjs";
3
+ import "./shared-BhJHIZs1.mjs";
4
+ import { a as buildSlackAllowFromPrompt, i as SLACK_CHANNEL, n as createSlackSetupWizardBase } from "./channel.setup-CzFw73mU.mjs";
5
5
  import { t as resolveSlackChannelAllowlist } from "./resolve-channels-DRRhElwz.mjs";
6
6
  import { t as resolveSlackUserAllowlist } from "./resolve-users-Cz8e17ky.mjs";
7
7
  import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -4,9 +4,9 @@ import { t as inspectSlackAccount } from "./account-inspect-CmkKiSb9.mjs";
4
4
  import { a as parseSlackTarget } from "./target-parsing-FFE26kOV.mjs";
5
5
  import { a as slackIngressIdentity, t as probeSlack } from "./probe-IiHogLQN.mjs";
6
6
  import { n as SLACK_CHANNEL_META } from "./channel-meta-C443t-lI.mjs";
7
- import { r as slackBaseConfigAdapter, t as slackSetupPlugin } from "./channel.setup-u6QQdbTa.mjs";
7
+ import { r as slackBaseConfigAdapter, t as slackSetupPlugin } from "./channel.setup-CzFw73mU.mjs";
8
8
  import { n as normalizeCompatibilityConfig, r as runtime_doctor_migrations_exports, t as legacyConfigRules } from "./doctor-contract-Cd4-VzIM.mjs";
9
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-B-Qm6aQQ.mjs";
9
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-vVRMoE1D.mjs";
10
10
  import { adaptScopedAccountAccessor, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
11
11
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
12
12
  import { buildMutableAllowEntryDetector, collectStandardAllowlistLists, createConditionalWarningCollector, createDangerousNameMatchingMutableAllowlistWarningCollector, createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy";
@@ -1,4 +1,4 @@
1
- import { i as sanitizeSlackMonitorReplyPayload, r as deliverSlackSlashReplies } from "./replies-CJwjTqDr.mjs";
1
+ import { i as sanitizeSlackMonitorReplyPayload, r as deliverSlackSlashReplies } from "./replies-C60dQn3J.mjs";
2
2
  import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
3
3
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
4
4
  import { resolveConversationLabel } from "openclaw/plugin-sdk/conversation-runtime";
package/dist/api.js CHANGED
@@ -5,11 +5,11 @@ import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, o as resolve
5
5
  import "./.setup/targets-C6LZQL1Q.mjs";
6
6
  import { Ht as resolveSlackAutoThreadId, a as resolveSlackGroupRequireMention, gt as validateSlackBlocksArray, ht as parseSlackBlocksInput, mt as SLACK_MAX_BLOCKS, o as resolveSlackGroupToolPolicy } from "./.setup/session-status-Dv8wNBEt.mjs";
7
7
  import { A as resolveSlackAllowListMatch, D as allowListMatches, E as resolveSlackWriteClientOptions, M as resolveSlackUserAllowed, O as normalizeSlackAllowOwnerEntry, S as SLACK_WRITE_RETRY_OPTIONS, T as resolveSlackWebClientOptions, _ as getSlackWriteClient, h as createSlackWriteClient, k as normalizeSlackSlug, m as createSlackWebClient, p as createSlackTokenCacheKey, t as probeSlack, x as SLACK_DEFAULT_RETRY_OPTIONS } from "./.setup/probe-IiHogLQN.mjs";
8
- import { n as buildSlackThreadingToolContext, t as slackPlugin } from "./.setup/channel-6YzXl_63.mjs";
8
+ import { n as buildSlackThreadingToolContext, t as slackPlugin } from "./.setup/channel-DQKq-0IZ.mjs";
9
9
  import { d as buildSlackInteractiveBlocks, f as buildSlackPresentationBlocks } from "./.setup/reply-blocks-Ca-raz2z.mjs";
10
10
  import { n as extractSlackToolSend, r as listSlackMessageActions } from "./.setup/message-tool-api-BS5ekEA_.mjs";
11
11
  import { n as resolveSlackChannelType } from "./.setup/channel-type-BEFP2ORi.mjs";
12
- import { t as slackSetupPlugin } from "./.setup/channel.setup-u6QQdbTa.mjs";
12
+ import { t as slackSetupPlugin } from "./.setup/channel.setup-CzFw73mU.mjs";
13
13
  import { c as listSlackPins, d as reactSlackMessage, f as readSlackMessages, g as unpinSlackMessage, h as sendSlackMessage, i as editSlackMessage, l as listSlackReactions, m as removeSlackReaction, n as deleteSlackMessage, o as getSlackMemberInfo, p as removeOwnSlackReactions, r as downloadSlackFile, s as listSlackEmojis, u as pinSlackMessage } from "./.setup/actions-By7tvpvv.mjs";
14
14
  import { a as clearSlackThreadParticipationCache, s as hasSlackThreadParticipation, u as recordSlackThreadParticipation } from "./.setup/send-C-8wY0lK.mjs";
15
15
  import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./.setup/directory-config-Cjj0N8R0.mjs";
@@ -1 +1,2 @@
1
- export { t as SlackChannelConfigSchema } from "./.setup/config-schema-DNnh6bWU.mjs";
1
+ import { t as SlackChannelConfigSchema } from "./.setup/config-schema-DNnh6bWU.mjs";
2
+ export { SlackChannelConfigSchema };
@@ -1 +1,2 @@
1
- export { t as slackPlugin } from "./.setup/channel-6YzXl_63.mjs";
1
+ import { t as slackPlugin } from "./.setup/channel-DQKq-0IZ.mjs";
2
+ export { slackPlugin };
@@ -1 +1,2 @@
1
- export { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./.setup/directory-config-Cjj0N8R0.mjs";
1
+ import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./.setup/directory-config-Cjj0N8R0.mjs";
2
+ export { listSlackDirectoryGroupsFromConfig, listSlackDirectoryPeersFromConfig };
@@ -1 +1,2 @@
1
- export { t as legacyConfigRules, n as normalizeCompatibilityConfig } from "./.setup/doctor-contract-Cd4-VzIM.mjs";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-Cd4-VzIM.mjs";
2
+ export { legacyConfigRules, normalizeCompatibilityConfig };
@@ -1 +1,2 @@
1
- export { t as registerSlackPluginHttpRoutes } from "./.setup/plugin-routes-D4qozHVn.mjs";
1
+ import { t as registerSlackPluginHttpRoutes } from "./.setup/plugin-routes-D4qozHVn.mjs";
2
+ export { registerSlackPluginHttpRoutes };
@@ -1 +1,2 @@
1
- export { t as describeMessageTool } from "./.setup/message-tool-api-BS5ekEA_.mjs";
1
+ import { t as describeSlackMessageTool } from "./.setup/message-tool-api-BS5ekEA_.mjs";
2
+ export { describeSlackMessageTool as describeMessageTool };
@@ -7,7 +7,7 @@ import { c as listSlackPins, d as reactSlackMessage, f as readSlackMessages, g a
7
7
  import { t as sendMessageSlack } from "./.setup/send-C-8wY0lK.mjs";
8
8
  import { n as slackActionRuntime, t as handleSlackAction } from "./.setup/action-runtime-ChRfnnBu.mjs";
9
9
  import { n as listSlackDirectoryGroupsLive, r as listSlackDirectoryPeersLive } from "./.setup/directory-live-BIKD-5B_.mjs";
10
- import { n as monitorSlackProvider } from "./.setup/monitor-BFilOuM_.mjs";
10
+ import { n as monitorSlackProvider } from "./.setup/monitor-Dcd6ymHV.mjs";
11
11
  import { t as resolveSlackChannelAllowlist } from "./.setup/resolve-channels-DRRhElwz.mjs";
12
12
  import { t as resolveSlackUserAllowlist } from "./.setup/resolve-users-Cz8e17ky.mjs";
13
13
  export { deleteSlackMessage, editSlackMessage, getSlackMemberInfo, handleSlackAction, listEnabledSlackAccounts, listSlackAccountIds, listSlackDirectoryGroupsLive, listSlackDirectoryPeersLive, listSlackEmojis, listSlackPins, listSlackReactions, monitorSlackProvider, pinSlackMessage, probeSlack, reactSlackMessage, readSlackMessages, registerSlackPluginHttpRoutes, removeOwnSlackReactions, removeSlackReaction, resolveDefaultSlackAccountId, resolveSlackAccount, resolveSlackAppToken, resolveSlackBotToken, resolveSlackChannelAllowlist, resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy, resolveSlackUserAllowlist, sendMessageSlack, sendSlackMessage, setSlackRuntime, slackActionRuntime, unpinSlackMessage };
@@ -1 +1,2 @@
1
- export { r as setSlackRuntime } from "./.setup/runtime-JSVZSWAj.mjs";
1
+ import { r as setSlackRuntime } from "./.setup/runtime-JSVZSWAj.mjs";
2
+ export { setSlackRuntime };
@@ -1 +1,2 @@
1
- export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./.setup/secret-contract-B-Qm6aQQ.mjs";
1
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./.setup/secret-contract-vVRMoE1D.mjs";
2
+ export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
@@ -1 +1,2 @@
1
- export { t as collectSlackSecurityAuditFindings } from "./.setup/security-audit-DFGiFLqd.mjs";
1
+ import { t as collectSlackSecurityAuditFindings } from "./.setup/security-audit-DFGiFLqd.mjs";
2
+ export { collectSlackSecurityAuditFindings };
@@ -4,15 +4,15 @@ import { fileURLToPath } from "node:url";
4
4
  var setup_entry_default = defineBundledChannelSetupEntry({
5
5
  importMetaUrl: import.meta.url,
6
6
  plugin: {
7
- specifier: fileURLToPath(new URL(".setup/setup-plugin-api-B18kDKtr.mjs", import.meta.url).href),
7
+ specifier: fileURLToPath(new URL(".setup/setup-plugin-api-BGD1TYnK.mjs", import.meta.url).href),
8
8
  exportName: "slackSetupPlugin"
9
9
  },
10
10
  secrets: {
11
- specifier: fileURLToPath(new URL(".setup/secret-contract-api-DB6CMdgc.mjs", import.meta.url).href),
11
+ specifier: fileURLToPath(new URL(".setup/secret-contract-api-DK9gZldc.mjs", import.meta.url).href),
12
12
  exportName: "channelSecrets"
13
13
  },
14
14
  runtime: {
15
- specifier: fileURLToPath(new URL(".setup/runtime-setter-api-Cx_PV-xu.mjs", import.meta.url).href),
15
+ specifier: fileURLToPath(new URL(".setup/runtime-setter-api-CMFvhrAr.mjs", import.meta.url).href),
16
16
  exportName: "setSlackRuntime"
17
17
  }
18
18
  });
@@ -1 +1,2 @@
1
- export { t as slackSetupPlugin } from "./.setup/channel.setup-u6QQdbTa.mjs";
1
+ import { t as slackSetupPlugin } from "./.setup/channel.setup-CzFw73mU.mjs";
2
+ export { slackSetupPlugin };
@@ -37,6 +37,10 @@ This module provides the following parsers:
37
37
  * [Text body parser](#bodyparsertextoptions)
38
38
  * [URL-encoded form body parser](#bodyparserurlencodedoptions)
39
39
 
40
+ All parsers support automatic inflation of `gzip`, `br` (brotli), `deflate`
41
+ and `zstd` encodings. `zstd` is available in Node.js `^22.15.0` and
42
+ `>=23.8.0`.
43
+
40
44
  Other body parsers you might be interested in:
41
45
 
42
46
  - [body](https://www.npmjs.com/package/body#readme)
@@ -65,6 +69,12 @@ The `bodyParser` object exposes various factories to create middlewares. All
65
69
  middlewares will populate the `req.body` property with the parsed body when
66
70
  the `Content-Type` request header matches the `type` option.
67
71
 
72
+ **Note** As of v2, `req.body` is left `undefined` when no body is parsed (for
73
+ example when the request has neither `Content-Length` nor `Transfer-Encoding`,
74
+ or when `Content-Type` does not match). In v1, `req.body` was always initialized
75
+ to `{}`. Code that assumes `req.body` is always an object should use optional
76
+ chaining (for example `req.body?.username`) or set a default.
77
+
68
78
  The various errors returned by this module are described in the
69
79
  [errors section](#errors).
70
80
 
@@ -72,8 +82,7 @@ The various errors returned by this module are described in the
72
82
 
73
83
  Returns middleware that only parses `json` and only looks at requests where
74
84
  the `Content-Type` header matches the `type` option. This parser accepts any
75
- Unicode encoding of the body and supports automatic inflation of `gzip`,
76
- `br` (brotli) and `deflate` encodings.
85
+ Unicode encoding of the body.
77
86
 
78
87
  A new `body` object containing the parsed data is populated on the `request`
79
88
  object after the middleware (i.e. `req.body`).
@@ -110,7 +119,7 @@ argument. You can find more information on this argument
110
119
 
111
120
  ##### strict
112
121
 
113
- When set to `true`, will only accept arrays and objects; when `false` will
122
+ When set to `true`, it will only accept arrays and objects; when `false`, it will
114
123
  accept anything `JSON.parse` accepts. Defaults to `true`.
115
124
 
116
125
  ##### type
@@ -133,9 +142,7 @@ encoding of the request. The parsing can be aborted by throwing an error.
133
142
  ### bodyParser.raw([options])
134
143
 
135
144
  Returns middleware that parses all bodies as a `Buffer` and only looks at
136
- requests where the `Content-Type` header matches the `type` option. This
137
- parser supports automatic inflation of `gzip`, `br` (brotli) and `deflate`
138
- encodings.
145
+ requests where the `Content-Type` header matches the `type` option.
139
146
 
140
147
  A new `body` object containing the parsed data is populated on the `request`
141
148
  object after the middleware (i.e. `req.body`). This will be a `Buffer` object
@@ -181,9 +188,7 @@ encoding of the request. The parsing can be aborted by throwing an error.
181
188
  ### bodyParser.text([options])
182
189
 
183
190
  Returns middleware that parses all bodies as a string and only looks at
184
- requests where the `Content-Type` header matches the `type` option. This
185
- parser supports automatic inflation of `gzip`, `br` (brotli) and `deflate`
186
- encodings.
191
+ requests where the `Content-Type` header matches the `type` option.
187
192
 
188
193
  A new `body` string containing the parsed data is populated on the `request`
189
194
  object after the middleware (i.e. `req.body`). This will be a string of the
@@ -234,8 +239,7 @@ encoding of the request. The parsing can be aborted by throwing an error.
234
239
 
235
240
  Returns middleware that only parses `urlencoded` bodies and only looks at
236
241
  requests where the `Content-Type` header matches the `type` option. This
237
- parser accepts only UTF-8 and ISO-8859-1 encodings of the body and supports
238
- automatic inflation of `gzip`, `br` (brotli) and `deflate` encodings.
242
+ parser accepts only UTF-8 and ISO-8859-1 encodings of the body.
239
243
 
240
244
  A new `body` object containing the parsed data is populated on the `request`
241
245
  object after the middleware (i.e. `req.body`). This object will contain
@@ -346,7 +350,7 @@ the entity value that failed parsing.
346
350
  ### entity verify failed
347
351
 
348
352
  This error will occur when the request contained an entity that could not be
349
- failed verification by the defined `verify` option. The `status` property is
353
+ verified by the defined `verify` option. The `status` property is
350
354
  set to `403`, the `type` property is set to `'entity.verify.failed'`, and the
351
355
  `body` property is set to the entity value that failed verification.
352
356
 
@@ -413,7 +417,7 @@ property is set to the encoding that is unsupported.
413
417
 
414
418
  ### The input exceeded the depth
415
419
 
416
- This error occurs when using `bodyParser.urlencoded` with the `extended` property set to `true` and the input exceeds the configured `depth` option. The `status` property is set to `400`. It is recommended to review the `depth` option and evaluate if it requires a higher value. When the `depth` option is set to `32` (default value), the error will not be thrown.
420
+ This error occurs when using `bodyParser.urlencoded` with the `extended` property set to `true` and the input exceeds the configured `depth` option. The `status` property is set to `400`. It is recommended to review the `depth` option and evaluate if it requires a higher value. With the default `depth` of `32`, an input with 33 or more levels of nesting gets this error.
417
421
 
418
422
  ## Examples
419
423
 
@@ -17,7 +17,7 @@ const iconv = require('iconv-lite')
17
17
  const onFinished = require('on-finished')
18
18
  const zlib = require('node:zlib')
19
19
  const hasBody = require('type-is').hasBody
20
- const { getCharset } = require('./utils')
20
+ const contentType = require('content-type')
21
21
 
22
22
  /**
23
23
  * Module exports.
@@ -25,6 +25,12 @@ const { getCharset } = require('./utils')
25
25
 
26
26
  module.exports = read
27
27
 
28
+ /**
29
+ * @const
30
+ * whether current node version has zstandard support
31
+ */
32
+ const hasZstandardSupport = 'createZstdDecompress' in zlib
33
+
28
34
  /**
29
35
  * Read a request into a buffer and parse.
30
36
  *
@@ -79,38 +85,53 @@ function read (req, res, next, parse, debug, options) {
79
85
  }
80
86
 
81
87
  let length
82
- const opts = options
83
88
  let stream
84
89
 
85
- // read options
86
- const verify = opts.verify
90
+ const verify = options.verify
91
+
92
+ // assert charset is supported before creating the decompression stream, so an
93
+ // unsupported charset cannot leave a decoder piped with no error listener
94
+ if (verify && encoding !== null && !iconv.encodingExists(encoding)) {
95
+ return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
96
+ charset: encoding.toLowerCase(),
97
+ type: 'charset.unsupported'
98
+ }))
99
+ }
87
100
 
88
101
  try {
102
+ const contentEncoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
103
+
104
+ debug('content-encoding "%s"', contentEncoding)
105
+
106
+ if (options.inflate === false && contentEncoding !== 'identity') {
107
+ throw createError(415, 'content encoding unsupported', {
108
+ encoding: contentEncoding,
109
+ type: 'encoding.unsupported'
110
+ })
111
+ }
112
+
89
113
  // get the content stream
90
- stream = contentstream(req, debug, opts.inflate)
91
- length = stream.length
92
- stream.length = undefined
114
+ if (contentEncoding === 'identity') {
115
+ length = req.headers['content-length']
116
+ stream = req
117
+ } else {
118
+ stream = createDecompressionStream(contentEncoding, debug)
119
+ req.pipe(stream)
120
+ }
93
121
  } catch (err) {
94
122
  return next(err)
95
123
  }
96
124
 
97
125
  // set raw-body options
98
- opts.length = length
99
- opts.encoding = verify
100
- ? null
101
- : encoding
102
-
103
- // assert charset is supported
104
- if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
105
- return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
106
- charset: encoding.toLowerCase(),
107
- type: 'charset.unsupported'
108
- }))
126
+ const rawBodyOptions = {
127
+ length,
128
+ encoding: verify ? null : encoding,
129
+ limit: options.limit
109
130
  }
110
131
 
111
132
  // read body
112
133
  debug('read body')
113
- getBody(stream, opts, function (error, body) {
134
+ getBody(stream, rawBodyOptions, function (error, body) {
114
135
  if (error) {
115
136
  let _error
116
137
 
@@ -138,6 +159,17 @@ function read (req, res, next, parse, debug, options) {
138
159
  return
139
160
  }
140
161
 
162
+ // detach and destroy the decompression stream to
163
+ // avoid decompression errors on the finished stream
164
+ if (stream !== req) {
165
+ req.unpipe(stream)
166
+ stream.on('error', () => {})
167
+ stream.destroy()
168
+
169
+ // consume any remaining bytes so the HTTP request can finish
170
+ req.resume()
171
+ }
172
+
141
173
  // verify
142
174
  if (verify) {
143
175
  try {
@@ -145,7 +177,7 @@ function read (req, res, next, parse, debug, options) {
145
177
  verify(req, res, body, encoding)
146
178
  } catch (err) {
147
179
  next(createError(403, err, {
148
- body: body,
180
+ body,
149
181
  type: err.type || 'entity.verify.failed'
150
182
  }))
151
183
  return
@@ -172,38 +204,6 @@ function read (req, res, next, parse, debug, options) {
172
204
  })
173
205
  }
174
206
 
175
- /**
176
- * Get the content stream of the request.
177
- *
178
- * @param {Object} req
179
- * @param {Function} debug
180
- * @param {boolean} inflate
181
- * @returns {Object}
182
- * @private
183
- */
184
- function contentstream (req, debug, inflate) {
185
- const encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
186
- const length = req.headers['content-length']
187
-
188
- debug('content-encoding "%s"', encoding)
189
-
190
- if (inflate === false && encoding !== 'identity') {
191
- throw createError(415, 'content encoding unsupported', {
192
- encoding: encoding,
193
- type: 'encoding.unsupported'
194
- })
195
- }
196
-
197
- if (encoding === 'identity') {
198
- req.length = length
199
- return req
200
- }
201
-
202
- const stream = createDecompressionStream(encoding, debug)
203
- req.pipe(stream)
204
- return stream
205
- }
206
-
207
207
  /**
208
208
  * Create a decompression stream for the given encoding.
209
209
  * @param {string} encoding
@@ -222,12 +222,16 @@ function createDecompressionStream (encoding, debug) {
222
222
  case 'br':
223
223
  debug('brotli decompress body')
224
224
  return zlib.createBrotliDecompress()
225
- default:
226
- throw createError(415, 'unsupported content encoding "' + encoding + '"', {
227
- encoding: encoding,
228
- type: 'encoding.unsupported'
229
- })
225
+ case 'zstd':
226
+ if (hasZstandardSupport) {
227
+ debug('zstd decompress body')
228
+ return zlib.createZstdDecompress()
229
+ }
230
230
  }
231
+ throw createError(415, 'unsupported content encoding "' + encoding + '"', {
232
+ encoding,
233
+ type: 'encoding.unsupported'
234
+ })
231
235
  }
232
236
 
233
237
  /**
@@ -245,3 +249,16 @@ function dump (req, callback) {
245
249
  req.resume()
246
250
  }
247
251
  }
252
+
253
+ /**
254
+ * Get the charset of a request.
255
+ *
256
+ * @param {Object} req
257
+ * @returns {string | undefined}
258
+ * @private
259
+ */
260
+ function getCharset (req) {
261
+ const header = req.headers['content-type']
262
+ if (!header) return undefined
263
+ return contentType.parse(header).parameters.charset?.toLowerCase()
264
+ }