@openclaw/sms 2026.11.5-beta.4 → 2026.11.10-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{media-_9qy6Xis.mjs → media-BF6-nsm2.mjs} +3 -4
- package/dist/.setup/{runtime-BBlPgBIF.mjs → runtime-A8rnEOmw.mjs} +1 -2
- package/dist/.setup/{secret-contract-B2P_lFGm.mjs → secret-contract-BTxRnkG1.mjs} +1 -2
- package/dist/.setup/{twilio-BzT4FTeC.mjs → twilio-07yIWayE.mjs} +5 -10
- package/dist/.source-module-urls/795a0e3f2ca7aa49f58abd6277a5075ff6437cd84711eea7629da8f4ff8f2b43.json +1 -1
- package/dist/api.js +1 -1
- package/dist/channel-plugin-api.js +32 -28
- package/dist/configured-state.js +1 -2
- package/dist/index.js +1 -2
- package/dist/secret-contract-api.js +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as getSmsRuntime } from "./runtime-
|
|
2
|
-
import { h as assertSmsCredentialOwnerAvailable, n as TWILIO_MMS_MAX_BYTES } from "./twilio-
|
|
1
|
+
import { t as getSmsRuntime } from "./runtime-A8rnEOmw.mjs";
|
|
2
|
+
import { h as assertSmsCredentialOwnerAvailable, n as TWILIO_MMS_MAX_BYTES } from "./twilio-07yIWayE.mjs";
|
|
3
3
|
import { collectErrorGraphCandidates } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
import { resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
@@ -9,7 +9,7 @@ import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
|
9
9
|
import { MediaFetchError, unlinkIfExists } from "openclaw/plugin-sdk/media-runtime";
|
|
10
10
|
import { createHostedOutboundMediaStore, resolveHostedOutboundMediaRequest, resolveOutboundMediaAccess } from "openclaw/plugin-sdk/outbound-media";
|
|
11
11
|
import { isTransientNetworkError } from "openclaw/plugin-sdk/retry-runtime";
|
|
12
|
-
|
|
12
|
+
// extensions/sms/src/media.ts
|
|
13
13
|
const TWILIO_API_HOSTNAME = "api.twilio.com";
|
|
14
14
|
const TWILIO_MEDIA_PATH_RE = /^\/2010-04-01\/Accounts\/([^/]+)\/Messages\/([^/]+)\/Media\/(ME[0-9a-fA-F]{32})$/u;
|
|
15
15
|
const TWILIO_MEDIA_TOTAL_TIMEOUT_MS = 6e4;
|
|
@@ -351,5 +351,4 @@ async function tryHandleHostedSmsMediaRequest(req, res, accountId = "default") {
|
|
|
351
351
|
res.end(body);
|
|
352
352
|
return true;
|
|
353
353
|
}
|
|
354
|
-
//#endregion
|
|
355
354
|
export { materializeSmsInboundMedia, prepareHostedSmsMedia, tryHandleHostedSmsMediaRequest };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
2
|
-
|
|
2
|
+
// extensions/sms/src/runtime.ts
|
|
3
3
|
const { setRuntime: setSmsRuntime, getRuntime: getSmsRuntime } = createPluginRuntimeStore({
|
|
4
4
|
pluginId: "sms",
|
|
5
5
|
errorMessage: "SMS runtime not initialized - plugin not registered"
|
|
6
6
|
});
|
|
7
|
-
//#endregion
|
|
8
7
|
export { setSmsRuntime as n, getSmsRuntime as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { collectConditionalChannelFieldAssignments, createChannelSecretContract, hasOwnProperty } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
2
|
-
|
|
2
|
+
// extensions/sms/src/secret-contract.ts
|
|
3
3
|
const DEFAULT_ACCOUNT_ID = "default";
|
|
4
4
|
function hasTopLevelSmsAccount(channel) {
|
|
5
5
|
return [
|
|
@@ -38,5 +38,4 @@ const channelSecrets = createChannelSecretContract({
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const { secretTargetRegistryEntries, collectRuntimeConfigAssignments } = channelSecrets;
|
|
41
|
-
//#endregion
|
|
42
41
|
export { collectRuntimeConfigAssignments as n, secretTargetRegistryEntries as r, channelSecrets as t };
|
|
@@ -16,7 +16,7 @@ import { safeParseJson } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
|
16
16
|
import { readRequestBodyWithLimit } from "openclaw/plugin-sdk/webhook-ingress";
|
|
17
17
|
import { assertSecretOwnerAvailable } from "openclaw/plugin-sdk/channel-secret-owner-runtime";
|
|
18
18
|
import { getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
19
|
-
|
|
19
|
+
// extensions/sms/src/phone.ts
|
|
20
20
|
function normalizeSmsPhoneNumber(raw) {
|
|
21
21
|
const trimmed = raw.trim().replace(/^(?:sms|twilio-sms):/i, "").trim();
|
|
22
22
|
if (!trimmed) return "";
|
|
@@ -30,8 +30,7 @@ function normalizeSmsAllowFrom(raw) {
|
|
|
30
30
|
if (raw.trim() === "*") return "*";
|
|
31
31
|
return normalizeSmsPhoneNumber(raw);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
//#region extensions/sms/src/public-webhook-url.ts
|
|
33
|
+
// extensions/sms/src/public-webhook-url.ts
|
|
35
34
|
const SMS_STATUS_CALLBACK_MAX_LENGTH = 4e3;
|
|
36
35
|
const SMS_STATUS_CALLBACK_READ_TIMEOUT_MS = 5e3;
|
|
37
36
|
const TWILIO_READ_TIMEOUT_MIN_MS = 100;
|
|
@@ -97,8 +96,7 @@ function resolveTwilioStatusCallbackUrl(publicWebhookUrl) {
|
|
|
97
96
|
if (callbackUrl.length > SMS_STATUS_CALLBACK_MAX_LENGTH) return "";
|
|
98
97
|
return callbackUrl;
|
|
99
98
|
}
|
|
100
|
-
|
|
101
|
-
//#region extensions/sms/src/accounts.ts
|
|
99
|
+
// extensions/sms/src/accounts.ts
|
|
102
100
|
const CHANNEL_ID = "sms";
|
|
103
101
|
const DEFAULT_WEBHOOK_PATH = "/webhooks/sms";
|
|
104
102
|
const DEFAULT_TEXT_CHUNK_LIMIT = 1500;
|
|
@@ -199,8 +197,7 @@ function inspectSmsAccount(cfg, accountId) {
|
|
|
199
197
|
function isSmsAccountConfigured(account) {
|
|
200
198
|
return Boolean(account.accountSid && account.authToken && (account.fromNumber || account.messagingServiceSid));
|
|
201
199
|
}
|
|
202
|
-
|
|
203
|
-
//#region extensions/sms/src/credential-availability.ts
|
|
200
|
+
// extensions/sms/src/credential-availability.ts
|
|
204
201
|
function assertSmsCredentialOwnerAvailable(account) {
|
|
205
202
|
assertSecretOwnerAvailable("account", `sms:${account.accountId}`);
|
|
206
203
|
const runtimeConfig = getRuntimeConfigSnapshot();
|
|
@@ -208,8 +205,7 @@ function assertSmsCredentialOwnerAvailable(account) {
|
|
|
208
205
|
const current = resolveSmsAccount(runtimeConfig, account.accountId);
|
|
209
206
|
if (current.accountSid !== account.accountSid || current.authToken !== account.authToken) throw new Error(`SMS credentials changed for ${account.accountId}; retry the operation.`);
|
|
210
207
|
}
|
|
211
|
-
|
|
212
|
-
//#region extensions/sms/src/twilio.ts
|
|
208
|
+
// extensions/sms/src/twilio.ts
|
|
213
209
|
const TWILIO_ACCOUNTS_URL = "https://api.twilio.com/2010-04-01/Accounts";
|
|
214
210
|
const TWILIO_MESSAGING_URL = "https://messaging.twilio.com/v1";
|
|
215
211
|
const TWILIO_API_HOSTNAME = "api.twilio.com";
|
|
@@ -506,5 +502,4 @@ async function sendSmsViaTwilio(params) {
|
|
|
506
502
|
...payload.status?.trim() ? { status: payload.status.trim() } : {}
|
|
507
503
|
};
|
|
508
504
|
}
|
|
509
|
-
//#endregion
|
|
510
505
|
export { normalizeSmsAllowFrom as C, looksLikeSmsPhoneNumber as S, isSmsAccountConfigured as _, listTwilioIncomingPhoneNumbers as a, resolveSmsAccount as b, resolveTwilioInboundSender as c, respondTwiml as d, retrieveTwilioMessagingService as f, inspectSmsAccount as g, assertSmsCredentialOwnerAvailable as h, buildTwilioInboundMessage as i, resolveTwilioMessageSid as l, verifyTwilioSignature as m, TWILIO_MMS_MAX_BYTES as n, listTwilioMessages as o, sendSmsViaTwilio as p, TWIML_CONTENT_TYPE as r, readTwilioWebhookForm as s, TWILIO_MESSAGE_BODY_MAX_LENGTH as t, resolveTwilioWebhookSignatureUrl as u, listSmsAccountIds as v, normalizeSmsPhoneNumber as w, resolveTwilioStatusCallbackUrl as x, resolveDefaultSmsAccountId as y };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"entries":[{"output":"api.js","source":"extensions/sms/api.ts"},{"output":"channel-plugin-api.js","source":"extensions/sms/channel-plugin-api.ts"},{"output":"configured-state.js","source":"extensions/sms/configured-state.ts"},{"output":"index.js","source":"extensions/sms/index.ts"},{"output":"secret-contract-api.js","source":"extensions/sms/secret-contract-api.ts"}],"chunks":[{"output":".setup/media-
|
|
1
|
+
{"version":3,"entries":[{"output":"api.js","source":"extensions/sms/api.ts"},{"output":"channel-plugin-api.js","source":"extensions/sms/channel-plugin-api.ts"},{"output":"configured-state.js","source":"extensions/sms/configured-state.ts"},{"output":"index.js","source":"extensions/sms/index.ts"},{"output":"secret-contract-api.js","source":"extensions/sms/secret-contract-api.ts"}],"chunks":[{"output":".setup/media-BF6-nsm2.mjs","sha256":"07c35be9a1b24339461d37b732b6f528382d20978d585347bb9c4ead05584f03","facadeSource":"extensions/sms/src/media.ts","sources":["extensions/sms/src/media.ts"]},{"output":".setup/runtime-A8rnEOmw.mjs","sha256":"c5421ac4c7b4a75bc7ecbc7c36ec291ca5fea32a88a3ee73d827805382709472","facadeSource":null,"sources":["extensions/sms/src/runtime.ts"]},{"output":".setup/secret-contract-BTxRnkG1.mjs","sha256":"41e6a81aa4b92fa9cc308365fd1b39f027966a6405817436e05ece5a86101289","facadeSource":null,"sources":["extensions/sms/src/secret-contract.ts"]},{"output":".setup/twilio-07yIWayE.mjs","sha256":"9273a6d10235c495f227ddc60d048943993b7caf377ce61f4544f9a29e826b3d","facadeSource":null,"sources":["extensions/sms/src/accounts.ts","extensions/sms/src/credential-availability.ts","extensions/sms/src/phone.ts","extensions/sms/src/public-webhook-url.ts","extensions/sms/src/twilio.ts"]},{"output":"api.js","sha256":"0af2cd7c6d77163e5a4b5db6d0a330cee812d376309fc5100549c96cfb418095","facadeSource":"extensions/sms/api.ts","sources":[]},{"output":"channel-plugin-api.js","sha256":"bb86994cba7946cad794b21ac0e89dadc0c8196ca54b009e0bc3e588f46fcb1d","facadeSource":"extensions/sms/channel-plugin-api.ts","sources":["extensions/sms/src/channel.ts","extensions/sms/src/config-schema.ts","extensions/sms/src/delivery-observations.ts","extensions/sms/src/gateway.ts","extensions/sms/src/inbound.ts","extensions/sms/src/ingress-spool.ts","extensions/sms/src/send.ts","extensions/sms/src/status.ts","extensions/sms/src/webhook.ts"]},{"output":"configured-state.js","sha256":"e994ab7f874fa87b8fe6ebf177c463524d6eb38b18ce39c81782317ba58d0e33","facadeSource":"extensions/sms/configured-state.ts","sources":["extensions/sms/configured-state.ts"]},{"output":"index.js","sha256":"409b8e41876eb5f13f405dae29989f6208bc6dd05a3a3edca4c045694ed03f08","facadeSource":"extensions/sms/index.ts","sources":["extensions/sms/index.ts"]},{"output":"secret-contract-api.js","sha256":"52f719be12576c4abb7161253c960de8b5001fc164f5e69f7228e57c29a5aed2","facadeSource":"extensions/sms/secret-contract-api.ts","sources":[]}],"unrenderedSources":["extensions/sms/api.ts","extensions/sms/channel-plugin-api.ts","extensions/sms/secret-contract-api.ts"]}
|
package/dist/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as getSmsRuntime, n as setSmsRuntime } from "./.setup/runtime-
|
|
1
|
+
export { t as getSmsRuntime, n as setSmsRuntime } from "./.setup/runtime-A8rnEOmw.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as getSmsRuntime } from "./.setup/runtime-
|
|
2
|
-
import { C as normalizeSmsAllowFrom, S as looksLikeSmsPhoneNumber, _ as isSmsAccountConfigured, a as listTwilioIncomingPhoneNumbers, b as resolveSmsAccount, c as resolveTwilioInboundSender, d as respondTwiml, f as retrieveTwilioMessagingService, g as inspectSmsAccount, h as assertSmsCredentialOwnerAvailable, i as buildTwilioInboundMessage, l as resolveTwilioMessageSid, m as verifyTwilioSignature, o as listTwilioMessages, p as sendSmsViaTwilio, r as TWIML_CONTENT_TYPE, s as readTwilioWebhookForm, t as TWILIO_MESSAGE_BODY_MAX_LENGTH, u as resolveTwilioWebhookSignatureUrl, v as listSmsAccountIds, w as normalizeSmsPhoneNumber, x as resolveTwilioStatusCallbackUrl, y as resolveDefaultSmsAccountId } from "./.setup/twilio-
|
|
3
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./.setup/secret-contract-
|
|
1
|
+
import { t as getSmsRuntime } from "./.setup/runtime-A8rnEOmw.mjs";
|
|
2
|
+
import { C as normalizeSmsAllowFrom, S as looksLikeSmsPhoneNumber, _ as isSmsAccountConfigured, a as listTwilioIncomingPhoneNumbers, b as resolveSmsAccount, c as resolveTwilioInboundSender, d as respondTwiml, f as retrieveTwilioMessagingService, g as inspectSmsAccount, h as assertSmsCredentialOwnerAvailable, i as buildTwilioInboundMessage, l as resolveTwilioMessageSid, m as verifyTwilioSignature, o as listTwilioMessages, p as sendSmsViaTwilio, r as TWIML_CONTENT_TYPE, s as readTwilioWebhookForm, t as TWILIO_MESSAGE_BODY_MAX_LENGTH, u as resolveTwilioWebhookSignatureUrl, v as listSmsAccountIds, w as normalizeSmsPhoneNumber, x as resolveTwilioStatusCallbackUrl, y as resolveDefaultSmsAccountId } from "./.setup/twilio-07yIWayE.mjs";
|
|
3
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./.setup/secret-contract-BTxRnkG1.mjs";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
5
5
|
import { createHybridChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
6
6
|
import { buildChannelOutboundSessionRoute, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
@@ -22,7 +22,7 @@ import { channelBlockedPatch, channelReadyPatch, channelStoppedPatch } from "ope
|
|
|
22
22
|
import { createWebhookInFlightLimiter, runDetachedWebhookWork, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
23
23
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
24
24
|
import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
25
|
-
|
|
25
|
+
// extensions/sms/src/config-schema.ts
|
|
26
26
|
const SecretInputSchema = buildSecretInputSchema();
|
|
27
27
|
const SmsAccountConfigSchema = z.object({
|
|
28
28
|
name: z.string().optional(),
|
|
@@ -105,8 +105,7 @@ const SmsChannelConfigSchema = buildChannelConfigSchema(SmsConfigSchema, { uiHin
|
|
|
105
105
|
help: "Maximum characters per outbound SMS chunk before OpenClaw splits long replies."
|
|
106
106
|
}
|
|
107
107
|
} });
|
|
108
|
-
|
|
109
|
-
//#region extensions/sms/src/delivery-observations.ts
|
|
108
|
+
// extensions/sms/src/delivery-observations.ts
|
|
110
109
|
const DELIVERY_NAMESPACE = "twilio-delivery-observations-v1";
|
|
111
110
|
const DELIVERY_RETENTION_MS = 2592e6;
|
|
112
111
|
const DELIVERY_MAX_MESSAGES = 5e3;
|
|
@@ -293,8 +292,7 @@ async function listRecentSmsDeliveryRecords(account) {
|
|
|
293
292
|
const accountSidHash = sha256Hex(account.accountSid);
|
|
294
293
|
return (await store.entries()).map((entry) => entry.value).filter((record) => record.accountId === account.accountId && record.accountSidHash === accountSidHash).toSorted((left, right) => right.lastObservedAt - left.lastObservedAt).slice(0, 1);
|
|
295
294
|
}
|
|
296
|
-
|
|
297
|
-
//#region extensions/sms/src/send.ts
|
|
295
|
+
// extensions/sms/src/send.ts
|
|
298
296
|
const SMS_ASSISTANT_TRANSCRIPT_ROLE_PREFIX = "[assistant-authored transcript] ";
|
|
299
297
|
function createSmsMessageReceipt(params) {
|
|
300
298
|
const receipt = createMessageReceiptFromOutboundResults({
|
|
@@ -426,7 +424,7 @@ async function prepareSmsMediaAttempt(params) {
|
|
|
426
424
|
});
|
|
427
425
|
let hostedMedia;
|
|
428
426
|
try {
|
|
429
|
-
const { prepareHostedSmsMedia } = await import("./.setup/media-
|
|
427
|
+
const { prepareHostedSmsMedia } = await import("./.setup/media-BF6-nsm2.mjs");
|
|
430
428
|
assertSmsCredentialOwnerAvailable(params.account);
|
|
431
429
|
const prepared = await prepareHostedSmsMedia({
|
|
432
430
|
account: params.account,
|
|
@@ -456,8 +454,7 @@ async function sendPreparedSmsMediaAttempt(params) {
|
|
|
456
454
|
mediaUrls: [params.attempt.hostedMediaUrl]
|
|
457
455
|
}, ...params.attempt.remainingChunks.map((text) => ({ text }))], "media");
|
|
458
456
|
}
|
|
459
|
-
|
|
460
|
-
//#region extensions/sms/src/inbound.ts
|
|
457
|
+
// extensions/sms/src/inbound.ts
|
|
461
458
|
const CHANNEL_ID$2 = "sms";
|
|
462
459
|
async function dispatchSmsInboundEvent(params) {
|
|
463
460
|
const from = normalizeSmsPhoneNumber(params.msg.from);
|
|
@@ -526,7 +523,7 @@ async function dispatchSmsInboundEvent(params) {
|
|
|
526
523
|
params.log?.warn?.(`SMS sender ${from} is not authorized`);
|
|
527
524
|
return;
|
|
528
525
|
}
|
|
529
|
-
const materialized = params.msg.media.length > 0 || (params.msg.unavailableMediaCount ?? 0) > 0 ? await (await import("./.setup/media-
|
|
526
|
+
const materialized = params.msg.media.length > 0 || (params.msg.unavailableMediaCount ?? 0) > 0 ? await (await import("./.setup/media-BF6-nsm2.mjs")).materializeSmsInboundMedia({
|
|
530
527
|
account: params.account,
|
|
531
528
|
msg: params.msg,
|
|
532
529
|
mediaRuntime: params.channelRuntime,
|
|
@@ -538,6 +535,11 @@ async function dispatchSmsInboundEvent(params) {
|
|
|
538
535
|
cleanup: async () => void 0
|
|
539
536
|
};
|
|
540
537
|
let adoptionState = "pending";
|
|
538
|
+
const releaseMedia = async (settle) => {
|
|
539
|
+
adoptionState = "abandoned";
|
|
540
|
+
await materialized.cleanup();
|
|
541
|
+
await settle();
|
|
542
|
+
};
|
|
541
543
|
try {
|
|
542
544
|
const turnAdoptionLifecycle = materialized.media.length > 0 && params.turnAdoptionLifecycle ? {
|
|
543
545
|
...params.turnAdoptionLifecycle,
|
|
@@ -556,11 +558,11 @@ async function dispatchSmsInboundEvent(params) {
|
|
|
556
558
|
return deferred;
|
|
557
559
|
},
|
|
558
560
|
onAbandoned: () => {
|
|
559
|
-
|
|
560
|
-
materialized.cleanup().then(() => params.turnAdoptionLifecycle?.onAbandoned?.()).catch((error) => {
|
|
561
|
+
releaseMedia(() => params.turnAdoptionLifecycle?.onAbandoned?.()).catch((error) => {
|
|
561
562
|
params.log?.warn?.(`Failed to abandon Twilio MMS ingress ${params.msg.messageSid}: ${String(error)}`);
|
|
562
563
|
});
|
|
563
|
-
}
|
|
564
|
+
},
|
|
565
|
+
onDropped: params.turnAdoptionLifecycle?.onDropped ? (reason) => releaseMedia(() => params.turnAdoptionLifecycle?.onDropped?.(reason)) : void 0
|
|
564
566
|
} : params.turnAdoptionLifecycle;
|
|
565
567
|
const route = params.channelRuntime.routing.resolveAgentRoute({
|
|
566
568
|
cfg: params.cfg,
|
|
@@ -674,8 +676,7 @@ async function dispatchSmsInboundEvent(params) {
|
|
|
674
676
|
if (adoptionState === "pending" || adoptionState === "abandoned") await materialized.cleanup();
|
|
675
677
|
}
|
|
676
678
|
}
|
|
677
|
-
|
|
678
|
-
//#region extensions/sms/src/ingress-spool.ts
|
|
679
|
+
// extensions/sms/src/ingress-spool.ts
|
|
679
680
|
const SMS_INGRESS_PAYLOAD_VERSION = 1;
|
|
680
681
|
const SMS_INGRESS_DRAIN_INTERVAL_MS = 500;
|
|
681
682
|
var SmsIngressPermanentError = class extends Error {};
|
|
@@ -777,10 +778,10 @@ function createSmsIngressSpool(params) {
|
|
|
777
778
|
stop: monitor.stop
|
|
778
779
|
};
|
|
779
780
|
}
|
|
780
|
-
|
|
781
|
-
//#region extensions/sms/src/webhook.ts
|
|
781
|
+
// extensions/sms/src/webhook.ts
|
|
782
782
|
const INVALID_REQUEST_MAX_REQUESTS = 300;
|
|
783
783
|
const PRE_AUTH_MAX_IN_FLIGHT = 64;
|
|
784
|
+
const PRE_AUTH_MAX_IN_FLIGHT_PER_CLIENT = 16;
|
|
784
785
|
const INBOUND_DISPATCH_MAX_REQUESTS = 30;
|
|
785
786
|
const DELIVERY_CALLBACK_MAX_REQUESTS = 3e3;
|
|
786
787
|
const DELIVERY_CALLBACK_WINDOW_MS = 6e4;
|
|
@@ -826,6 +827,10 @@ function createSmsWebhookHandler(params) {
|
|
|
826
827
|
maxTrackedKeys: 1
|
|
827
828
|
});
|
|
828
829
|
const preAuthInFlightKey = accountRouteRateLimitKey(params.account);
|
|
830
|
+
const clientInFlightLimiter = createWebhookInFlightLimiter({
|
|
831
|
+
maxInFlightPerKey: PRE_AUTH_MAX_IN_FLIGHT_PER_CLIENT,
|
|
832
|
+
maxTrackedKeys: PRE_AUTH_MAX_IN_FLIGHT
|
|
833
|
+
});
|
|
829
834
|
const deliveryCallbackRateLimiter = createFixedWindowRateLimiter({
|
|
830
835
|
maxRequests: DELIVERY_CALLBACK_MAX_REQUESTS,
|
|
831
836
|
windowMs: DELIVERY_CALLBACK_WINDOW_MS,
|
|
@@ -846,7 +851,9 @@ function createSmsWebhookHandler(params) {
|
|
|
846
851
|
subject: clientAddress
|
|
847
852
|
});
|
|
848
853
|
const invalidRequestRateLimited = invalidRequestRateLimiter.isRateLimited(clientAddressKey);
|
|
849
|
-
|
|
854
|
+
const routeAdmitted = preAuthInFlightLimiter.tryAcquire(preAuthInFlightKey);
|
|
855
|
+
if (!routeAdmitted || !clientInFlightLimiter.tryAcquire(clientAddressKey)) {
|
|
856
|
+
if (routeAdmitted) preAuthInFlightLimiter.release(preAuthInFlightKey);
|
|
850
857
|
params.log?.warn?.("SMS webhook pre-authentication concurrency limit exceeded");
|
|
851
858
|
await sendHttpRequestRejection(req, res, 429, "Rate limit exceeded", TWIML_CONTENT_TYPE);
|
|
852
859
|
return true;
|
|
@@ -894,6 +901,7 @@ function createSmsWebhookHandler(params) {
|
|
|
894
901
|
res
|
|
895
902
|
});
|
|
896
903
|
} finally {
|
|
904
|
+
clientInFlightLimiter.release(clientAddressKey);
|
|
897
905
|
preAuthInFlightLimiter.release(preAuthInFlightKey);
|
|
898
906
|
}
|
|
899
907
|
if (isTwilioDeliveryStatusForm(form)) {
|
|
@@ -957,8 +965,7 @@ function createSmsWebhookHandler(params) {
|
|
|
957
965
|
return true;
|
|
958
966
|
};
|
|
959
967
|
}
|
|
960
|
-
|
|
961
|
-
//#region extensions/sms/src/gateway.ts
|
|
968
|
+
// extensions/sms/src/gateway.ts
|
|
962
969
|
const CHANNEL_ID$1 = "sms";
|
|
963
970
|
const activeRoutePaths = /* @__PURE__ */ new Map();
|
|
964
971
|
const pendingRouteStops = /* @__PURE__ */ new Map();
|
|
@@ -1039,7 +1046,7 @@ async function startSmsGatewayAccount(params) {
|
|
|
1039
1046
|
throwOnFailure: true,
|
|
1040
1047
|
log: (msg) => params.log?.info?.(msg),
|
|
1041
1048
|
handler: async (req, res) => {
|
|
1042
|
-
const { tryHandleHostedSmsMediaRequest } = await import("./.setup/media-
|
|
1049
|
+
const { tryHandleHostedSmsMediaRequest } = await import("./.setup/media-BF6-nsm2.mjs");
|
|
1043
1050
|
if (await tryHandleHostedSmsMediaRequest(req, res, params.account.accountId)) return true;
|
|
1044
1051
|
return await webhookHandler(req, res);
|
|
1045
1052
|
}
|
|
@@ -1082,8 +1089,7 @@ async function startSmsGatewayAccount(params) {
|
|
|
1082
1089
|
params.statusSink?.(channelStoppedPatch());
|
|
1083
1090
|
});
|
|
1084
1091
|
}
|
|
1085
|
-
|
|
1086
|
-
//#region extensions/sms/src/status.ts
|
|
1092
|
+
// extensions/sms/src/status.ts
|
|
1087
1093
|
const TWILIO_ERROR_WEBHOOK_REACHABILITY = "11200";
|
|
1088
1094
|
function resolveRemoteProbeTimeoutMs(timeoutMs) {
|
|
1089
1095
|
const normalized = Math.max(1, Math.floor(timeoutMs));
|
|
@@ -1281,8 +1287,7 @@ function formatSmsProbeLines(probe) {
|
|
|
1281
1287
|
});
|
|
1282
1288
|
return lines;
|
|
1283
1289
|
}
|
|
1284
|
-
|
|
1285
|
-
//#region extensions/sms/src/channel.ts
|
|
1290
|
+
// extensions/sms/src/channel.ts
|
|
1286
1291
|
const CHANNEL_ID = "sms";
|
|
1287
1292
|
const smsConfigAdapter = createHybridChannelConfigAdapter({
|
|
1288
1293
|
sectionKey: CHANNEL_ID,
|
|
@@ -1691,5 +1696,4 @@ const smsPlugin = createChatChannelPlugin({
|
|
|
1691
1696
|
sendText: sendSmsText
|
|
1692
1697
|
}
|
|
1693
1698
|
});
|
|
1694
|
-
//#endregion
|
|
1695
1699
|
export { smsPlugin };
|
package/dist/configured-state.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_ACCOUNT_ID, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-core";
|
|
2
|
-
|
|
2
|
+
// extensions/sms/configured-state.ts
|
|
3
3
|
function hasConfiguredSmsAccount(account, env) {
|
|
4
4
|
const hasAccount = hasConfiguredAccountValue(account?.accountSid ?? env.TWILIO_ACCOUNT_SID);
|
|
5
5
|
const hasToken = hasConfiguredAccountValue(account?.authToken ?? env.TWILIO_AUTH_TOKEN);
|
|
@@ -22,5 +22,4 @@ function hasConfiguredSmsChannelState(params) {
|
|
|
22
22
|
...account
|
|
23
23
|
}, {}));
|
|
24
24
|
}
|
|
25
|
-
//#endregion
|
|
26
25
|
export { hasConfiguredSmsChannelState };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
2
|
-
|
|
2
|
+
// extensions/sms/index.ts
|
|
3
3
|
var sms_default = defineBundledChannelEntry({
|
|
4
4
|
id: "sms",
|
|
5
5
|
name: "SMS",
|
|
@@ -14,5 +14,4 @@ var sms_default = defineBundledChannelEntry({
|
|
|
14
14
|
exportName: "setSmsRuntime"
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
//#endregion
|
|
18
17
|
export { sms_default as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./.setup/secret-contract-
|
|
1
|
+
export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./.setup/secret-contract-BTxRnkG1.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/sms",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.10-beta.1",
|
|
4
4
|
"description": "OpenClaw SMS/MMS channel plugin for Twilio messages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -123,10 +123,10 @@
|
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
125
|
"compat": {
|
|
126
|
-
"pluginApi": ">=2026.11.
|
|
126
|
+
"pluginApi": ">=2026.11.10-beta.1"
|
|
127
127
|
},
|
|
128
128
|
"build": {
|
|
129
|
-
"openclawVersion": "2026.11.
|
|
129
|
+
"openclawVersion": "2026.11.10-beta.1",
|
|
130
130
|
"bundledDist": false
|
|
131
131
|
},
|
|
132
132
|
"install": {
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"assets/activity.svg"
|
|
153
153
|
],
|
|
154
154
|
"peerDependencies": {
|
|
155
|
-
"openclaw": ">=2026.11.
|
|
155
|
+
"openclaw": ">=2026.11.10-beta.1"
|
|
156
156
|
},
|
|
157
157
|
"peerDependenciesMeta": {
|
|
158
158
|
"openclaw": {
|