@openclaw/sms 2026.8.1-beta.2 → 2026.8.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.
@@ -1,5 +1,5 @@
1
1
  import { t as getSmsRuntime } from "./runtime-BBlPgBIF.js";
2
- import { _ as normalizeSmsAllowFrom, a as listTwilioMessages, c as resolveTwilioMessageSid, d as retrieveTwilioMessagingService, f as sendSmsViaTwilio, g as looksLikeSmsPhoneNumber, h as resolveTwilioStatusCallbackUrl, i as listTwilioIncomingPhoneNumbers, l as resolveTwilioWebhookSignatureUrl, m as parseSmsPublicWebhookUrl, o as readTwilioWebhookForm, p as verifyTwilioSignature, r as buildTwilioInboundMessage, s as resolveTwilioInboundSender, t as TWILIO_MESSAGE_BODY_MAX_LENGTH, u as respondTwiml, v as normalizeSmsPhoneNumber } from "./twilio-QS1jkUGH.js";
2
+ import { _ as normalizeSmsAllowFrom, a as listTwilioMessages, c as resolveTwilioMessageSid, d as retrieveTwilioMessagingService, f as sendSmsViaTwilio, g as looksLikeSmsPhoneNumber, h as resolveTwilioStatusCallbackUrl, i as listTwilioIncomingPhoneNumbers, l as resolveTwilioWebhookSignatureUrl, m as parseSmsPublicWebhookUrl, o as readTwilioWebhookForm, p as verifyTwilioSignature, r as buildTwilioInboundMessage, s as resolveTwilioInboundSender, t as TWILIO_MESSAGE_BODY_MAX_LENGTH, u as respondTwiml, v as normalizeSmsPhoneNumber } from "./twilio-BkGAecwf.js";
3
3
  import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-Cp0f-YPc.js";
4
4
  import { DEFAULT_ACCOUNT_ID, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
5
5
  import { createHybridChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
@@ -11,7 +11,7 @@ import { createEmptyChannelDirectoryAdapter } from "openclaw/plugin-sdk/director
11
11
  import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
12
12
  import { isRecord, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
13
13
  import { chunkTextForOutbound, renderMarkdownIRChunksWithinLimit, sanitizeAssistantVisibleText, stripMarkdown } from "openclaw/plugin-sdk/text-chunking";
14
- import { createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers";
14
+ import { createAccountListHelpers, resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
15
15
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, hasConfiguredAccountValue, resolveAccountEntry } from "openclaw/plugin-sdk/account-resolution";
16
16
  import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
17
17
  import { buildSecretInputSchema, hasConfiguredSecretInput, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
@@ -97,7 +97,12 @@ function resolveSmsAccount(cfg, accountId) {
97
97
  dangerouslyDisableSignatureValidation: merged.dangerouslyDisableSignatureValidation === true || envDisableSignatureValidation === "true",
98
98
  dmPolicy: merged.dmPolicy ?? "pairing",
99
99
  allowFrom: parseList(merged.allowFrom ?? envAllowFrom),
100
- textChunkLimit: parseTextChunkLimit(merged.textChunkLimit ?? envTextChunkLimit)
100
+ textChunkLimit: parseTextChunkLimit(merged.textChunkLimit ?? envTextChunkLimit),
101
+ mediaMaxBytes: resolveChannelMediaMaxBytes({
102
+ cfg,
103
+ accountId: id,
104
+ resolveChannelLimitMb: () => merged.mediaMaxMb
105
+ })
101
106
  };
102
107
  }
103
108
  function inspectSmsAccount(cfg, accountId) {
@@ -121,6 +126,7 @@ const SmsChannelConfigSchema = buildChannelConfigSchema(buildMultiAccountChannel
121
126
  name: z.string().optional(),
122
127
  enabled: z.boolean().optional(),
123
128
  configWrites: z.boolean().optional(),
129
+ mediaMaxMb: z.number().positive().optional(),
124
130
  accountSid: z.string().optional(),
125
131
  authToken: SecretInputSchema.optional(),
126
132
  fromNumber: z.string().optional(),
@@ -561,7 +567,7 @@ async function prepareSmsMediaAttempt(params) {
561
567
  });
562
568
  let hostedMedia;
563
569
  try {
564
- const { prepareHostedSmsMedia } = await import("./media-C_8jX0L8.js");
570
+ const { prepareHostedSmsMedia } = await import("./media-CakyGP6W.js");
565
571
  const prepared = await prepareHostedSmsMedia({
566
572
  account: params.account,
567
573
  mediaUrl: params.mediaUrl,
@@ -692,7 +698,7 @@ async function dispatchSmsInboundEvent(params) {
692
698
  params.log?.warn?.(`SMS sender ${from} is not authorized`);
693
699
  return;
694
700
  }
695
- const materialized = params.msg.media.length > 0 || (params.msg.unavailableMediaCount ?? 0) > 0 ? await (await import("./media-C_8jX0L8.js")).materializeSmsInboundMedia({
701
+ const materialized = params.msg.media.length > 0 || (params.msg.unavailableMediaCount ?? 0) > 0 ? await (await import("./media-CakyGP6W.js")).materializeSmsInboundMedia({
696
702
  account: params.account,
697
703
  msg: params.msg,
698
704
  mediaRuntime: params.channelRuntime,
@@ -1176,7 +1182,7 @@ async function registerSmsWebhookRoute(params) {
1176
1182
  throwOnFailure: true,
1177
1183
  log: (msg) => params.log?.info?.(msg),
1178
1184
  handler: async (req, res) => {
1179
- const { tryHandleHostedSmsMediaRequest } = await import("./media-C_8jX0L8.js");
1185
+ const { tryHandleHostedSmsMediaRequest } = await import("./media-CakyGP6W.js");
1180
1186
  if (await tryHandleHostedSmsMediaRequest(req, res, params.account.accountId)) return true;
1181
1187
  return await webhookHandler(req, res);
1182
1188
  }
@@ -1512,7 +1518,8 @@ const smsConfigAdapter = createHybridChannelConfigAdapter({
1512
1518
  "dangerouslyDisableSignatureValidation",
1513
1519
  "dmPolicy",
1514
1520
  "allowFrom",
1515
- "textChunkLimit"
1521
+ "textChunkLimit",
1522
+ "mediaMaxMb"
1516
1523
  ],
1517
1524
  resolveAllowFrom: (account) => account.allowFrom,
1518
1525
  formatAllowFrom: (allowFrom) => normalizeStringEntries(allowFrom.map((entry) => normalizeSmsAllowFrom(String(entry)))),
@@ -1527,7 +1534,13 @@ const resolveSmsDmPolicy = createScopedDmSecurityResolver({
1527
1534
  approveHint: "openclaw pairing approve sms <code>",
1528
1535
  normalizeEntry: normalizeSmsAllowFrom
1529
1536
  });
1530
- const collectSmsSecurityWarnings = createConditionalWarningCollector((account) => account.dangerouslyDisableSignatureValidation && "- SMS: Twilio signature validation is disabled. Only use this for local testing.", (account) => account.dmPolicy === "open" && account.allowFrom.includes("*") && "- SMS: dmPolicy=\"open\" allows any phone number to message the bot.");
1537
+ const collectSmsSecurityWarnings = createConditionalWarningCollector((account) => account.dangerouslyDisableSignatureValidation && "- SMS: Twilio signature validation is disabled. Only use this for local testing.");
1538
+ const collectSmsOpenDmFindings = createConditionalWarningCollector.findings({
1539
+ collectWarnings: createConditionalWarningCollector((account) => account.dmPolicy === "open" && account.allowFrom.includes("*") && "- SMS: dmPolicy=\"open\" allows any phone number to message the bot."),
1540
+ checkId: "channels.sms.dm.open",
1541
+ severity: "critical",
1542
+ title: "SMS security warning"
1543
+ });
1531
1544
  function smsSetupPatch(input) {
1532
1545
  const patch = {};
1533
1546
  for (const key of [
@@ -1886,7 +1899,7 @@ const smsPlugin = createChatChannelPlugin({
1886
1899
  } },
1887
1900
  security: {
1888
1901
  resolveDmPolicy: resolveSmsDmPolicy,
1889
- collectWarnings: ({ account }) => collectSmsSecurityWarnings(account)
1902
+ collectWarnings: ({ account }) => [...collectSmsSecurityWarnings(account), ...collectSmsOpenDmFindings(account)]
1890
1903
  },
1891
1904
  outbound: {
1892
1905
  deliveryMode: "gateway",
@@ -0,0 +1,26 @@
1
+ import { DEFAULT_ACCOUNT_ID, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-core";
2
+ //#region extensions/sms/configured-state.ts
3
+ function hasConfiguredSmsAccount(account, env) {
4
+ const hasAccount = hasConfiguredAccountValue(account?.accountSid ?? env.TWILIO_ACCOUNT_SID);
5
+ const hasToken = hasConfiguredAccountValue(account?.authToken ?? env.TWILIO_AUTH_TOKEN);
6
+ const fromNumber = [env.TWILIO_PHONE_NUMBER, env.TWILIO_SMS_FROM].find((value) => hasConfiguredAccountValue(value));
7
+ const hasSender = hasConfiguredAccountValue(account?.fromNumber ?? fromNumber) || hasConfiguredAccountValue(account?.messagingServiceSid ?? env.TWILIO_MESSAGING_SERVICE_SID);
8
+ return hasAccount && hasToken && hasSender;
9
+ }
10
+ /** Require a complete Twilio identity and sender, scoped to each enabled account. */
11
+ function hasConfiguredSmsChannelState(params) {
12
+ const channel = params.cfg.channels?.sms;
13
+ if (channel?.enabled === false) return false;
14
+ const defaultAccount = channel?.accounts?.[DEFAULT_ACCOUNT_ID];
15
+ const { accounts: _accounts, defaultAccount: _defaultAccount, ...defaults } = channel ?? {};
16
+ if (defaultAccount?.enabled !== false && hasConfiguredSmsAccount(defaultAccount ? {
17
+ ...defaults,
18
+ ...defaultAccount
19
+ } : channel, params.env ?? process.env)) return true;
20
+ return Object.entries(channel?.accounts ?? {}).some(([accountId, account]) => accountId !== DEFAULT_ACCOUNT_ID && account.enabled !== false && hasConfiguredSmsAccount({
21
+ ...defaults,
22
+ ...account
23
+ }, {}));
24
+ }
25
+ //#endregion
26
+ export { hasConfiguredSmsChannelState };
@@ -1,5 +1,5 @@
1
1
  import { t as getSmsRuntime } from "./runtime-BBlPgBIF.js";
2
- import { n as TWILIO_MMS_MAX_BYTES } from "./twilio-QS1jkUGH.js";
2
+ import { n as TWILIO_MMS_MAX_BYTES } from "./twilio-BkGAecwf.js";
3
3
  import { resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
4
4
  import { createHash } from "node:crypto";
5
5
  import { formatInboundMediaUnavailableText, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
@@ -180,7 +180,7 @@ async function prepareHostedSmsMedia(params) {
180
180
  mediaUrl: params.mediaUrl,
181
181
  routePath: route.localRoutePath,
182
182
  publicBaseUrl: route.publicBaseUrl,
183
- maxBytes: aggregateMediaBudget,
183
+ maxBytes: Math.min(params.account.mediaMaxBytes ?? aggregateMediaBudget, aggregateMediaBudget),
184
184
  mediaAccess
185
185
  }));
186
186
  const id = stagedUrl.pathname.split("/").at(-1) ?? "";
@@ -297,7 +297,7 @@ async function materializeSmsInboundMedia(params) {
297
297
  },
298
298
  filePathHint: inboundMediaFileName(media.contentType, index),
299
299
  fallbackContentType: media.contentType,
300
- maxBytes: remainingBytes,
300
+ maxBytes: Math.min(params.account.mediaMaxBytes ?? remainingBytes, remainingBytes),
301
301
  ssrfPolicy: { hostnameAllowlist: [TWILIO_API_HOSTNAME] },
302
302
  timeoutMs: TWILIO_MEDIA_TOTAL_TIMEOUT_MS,
303
303
  responseHeaderTimeoutMs: TWILIO_MEDIA_RESPONSE_HEADER_TIMEOUT_MS,
@@ -3,6 +3,7 @@ import { fetchWithSsrFGuard, isBlockedHostnameOrIp } from "openclaw/plugin-sdk/s
3
3
  import { createHmac } from "node:crypto";
4
4
  import { readRequestBodyWithLimit } from "openclaw/plugin-sdk/webhook-ingress";
5
5
  import * as querystring from "node:querystring";
6
+ import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
6
7
  import { readResponseTextPrefix, readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
7
8
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
8
9
  //#region extensions/sms/src/phone.ts
@@ -170,12 +171,13 @@ function resolveTwilioWebhookSignatureUrl(params) {
170
171
  }
171
172
  var TwilioSmsApiError = class extends Error {
172
173
  constructor(httpStatus, responseText, operation = "send") {
173
- const parsed = parseTwilioApiError(responseText);
174
- const detail = parsed.message ?? (responseText || "unknown");
174
+ const redactedResponseText = redactToolPayloadText(responseText);
175
+ const parsed = parseTwilioApiError(redactedResponseText);
176
+ const detail = parsed.message ?? (redactedResponseText || "unknown");
175
177
  super(`Twilio SMS ${operation} failed (${httpStatus}): ${detail}`);
176
178
  this.name = "TwilioSmsApiError";
177
179
  this.httpStatus = httpStatus;
178
- this.responseText = responseText;
180
+ this.responseText = redactedResponseText;
179
181
  this.twilioCode = parsed.code;
180
182
  }
181
183
  };
@@ -28,6 +28,10 @@
28
28
  "configWrites": {
29
29
  "type": "boolean"
30
30
  },
31
+ "mediaMaxMb": {
32
+ "type": "number",
33
+ "exclusiveMinimum": 0
34
+ },
31
35
  "accountSid": {
32
36
  "type": "string"
33
37
  },
@@ -195,6 +199,10 @@
195
199
  "configWrites": {
196
200
  "type": "boolean"
197
201
  },
202
+ "mediaMaxMb": {
203
+ "type": "number",
204
+ "exclusiveMinimum": 0
205
+ },
198
206
  "accountSid": {
199
207
  "type": "string"
200
208
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/sms",
3
- "version": "2026.8.1-beta.2",
3
+ "version": "2026.8.1",
4
4
  "description": "OpenClaw SMS/MMS channel plugin for Twilio messages.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,12 +23,11 @@
23
23
  "TWILIO_AUTH_TOKEN",
24
24
  "TWILIO_PHONE_NUMBER",
25
25
  "TWILIO_SMS_FROM",
26
- "TWILIO_MESSAGING_SERVICE_SID",
27
- "SMS_PUBLIC_WEBHOOK_URL",
28
- "SMS_WEBHOOK_PATH",
29
- "SMS_ALLOWED_USERS"
26
+ "TWILIO_MESSAGING_SERVICE_SID"
30
27
  ]
31
- }
28
+ },
29
+ "specifier": "./dist/configured-state.js",
30
+ "exportName": "hasConfiguredSmsChannelState"
32
31
  },
33
32
  "label": "SMS",
34
33
  "selectionLabel": "SMS (Twilio)",
@@ -124,10 +123,10 @@
124
123
  }
125
124
  },
126
125
  "compat": {
127
- "pluginApi": ">=2026.8.1-beta.2"
126
+ "pluginApi": ">=2026.8.1"
128
127
  },
129
128
  "build": {
130
- "openclawVersion": "2026.8.1-beta.2",
129
+ "openclawVersion": "2026.8.1",
131
130
  "bundledDist": false
132
131
  },
133
132
  "install": {
@@ -151,7 +150,7 @@
151
150
  "README.md"
152
151
  ],
153
152
  "peerDependencies": {
154
- "openclaw": ">=2026.8.1-beta.2"
153
+ "openclaw": ">=2026.8.1"
155
154
  },
156
155
  "peerDependenciesMeta": {
157
156
  "openclaw": {