@openclaw/whatsapp 2026.5.1-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/action-runtime-api.ts +1 -0
- package/action-runtime.runtime.ts +1 -0
- package/api.ts +213 -0
- package/auth-presence.ts +80 -0
- package/channel-config-api.ts +1 -0
- package/channel-plugin-api.ts +3 -0
- package/config-api.ts +4 -0
- package/constants.ts +1 -0
- package/contract-api.ts +29 -0
- package/directory-contract-api.ts +4 -0
- package/dist/.boundary-tsc.stamp +1 -0
- package/dist/.boundary-tsc.tsbuildinfo +1 -0
- package/doctor-contract-api.ts +8 -0
- package/index.test.ts +13 -0
- package/index.ts +16 -0
- package/legacy-session-surface-api.ts +6 -0
- package/legacy-state-migrations-api.ts +1 -0
- package/light-runtime-api.ts +12 -0
- package/login-qr-api.ts +1 -0
- package/login-qr-runtime.ts +23 -0
- package/openclaw.plugin.json +742 -0
- package/outbound-payload-test-api.ts +1 -0
- package/package.json +74 -0
- package/runtime-api.ts +86 -0
- package/secret-contract-api.ts +4 -0
- package/security-contract-api.ts +4 -0
- package/setup-entry.test.ts +21 -0
- package/setup-entry.ts +21 -0
- package/setup-plugin-api.ts +3 -0
- package/src/account-config.ts +77 -0
- package/src/account-ids.ts +13 -0
- package/src/account-types.ts +5 -0
- package/src/accounts.test.ts +182 -0
- package/src/accounts.ts +176 -0
- package/src/accounts.whatsapp-auth.test.ts +59 -0
- package/src/action-runtime-target-auth.ts +27 -0
- package/src/action-runtime.test.ts +330 -0
- package/src/action-runtime.ts +76 -0
- package/src/active-listener.test.ts +65 -0
- package/src/active-listener.ts +17 -0
- package/src/agent-tools-login.test.ts +81 -0
- package/src/agent-tools-login.ts +113 -0
- package/src/approval-auth.test.ts +24 -0
- package/src/approval-auth.ts +27 -0
- package/src/auth-store.runtime.ts +1 -0
- package/src/auth-store.test.ts +311 -0
- package/src/auth-store.ts +502 -0
- package/src/auto-reply/config.runtime.ts +16 -0
- package/src/auto-reply/constants.ts +1 -0
- package/src/auto-reply/deliver-reply.test.ts +843 -0
- package/src/auto-reply/deliver-reply.ts +279 -0
- package/src/auto-reply/heartbeat-runner.runtime.ts +33 -0
- package/src/auto-reply/heartbeat-runner.test.ts +214 -0
- package/src/auto-reply/heartbeat-runner.ts +330 -0
- package/src/auto-reply/loggers.ts +6 -0
- package/src/auto-reply/mentions.ts +131 -0
- package/src/auto-reply/monitor/ack-reaction.test.ts +170 -0
- package/src/auto-reply/monitor/ack-reaction.ts +99 -0
- package/src/auto-reply/monitor/audio-preflight.runtime.ts +9 -0
- package/src/auto-reply/monitor/broadcast.ts +153 -0
- package/src/auto-reply/monitor/commands.ts +19 -0
- package/src/auto-reply/monitor/echo.ts +64 -0
- package/src/auto-reply/monitor/group-activation.runtime.ts +1 -0
- package/src/auto-reply/monitor/group-activation.test.ts +189 -0
- package/src/auto-reply/monitor/group-activation.ts +73 -0
- package/src/auto-reply/monitor/group-gating.audio-preflight.test.ts +103 -0
- package/src/auto-reply/monitor/group-gating.runtime.ts +8 -0
- package/src/auto-reply/monitor/group-gating.ts +217 -0
- package/src/auto-reply/monitor/group-members.test.ts +56 -0
- package/src/auto-reply/monitor/group-members.ts +65 -0
- package/src/auto-reply/monitor/inbound-context.test.ts +97 -0
- package/src/auto-reply/monitor/inbound-context.ts +92 -0
- package/src/auto-reply/monitor/inbound-dispatch.runtime.ts +21 -0
- package/src/auto-reply/monitor/inbound-dispatch.test.ts +895 -0
- package/src/auto-reply/monitor/inbound-dispatch.ts +422 -0
- package/src/auto-reply/monitor/last-route.test.ts +37 -0
- package/src/auto-reply/monitor/last-route.ts +61 -0
- package/src/auto-reply/monitor/message-line.runtime.ts +38 -0
- package/src/auto-reply/monitor/message-line.ts +54 -0
- package/src/auto-reply/monitor/on-message.audio-preflight.test.ts +354 -0
- package/src/auto-reply/monitor/on-message.ts +291 -0
- package/src/auto-reply/monitor/peer.ts +17 -0
- package/src/auto-reply/monitor/process-message.audio-preflight.test.ts +420 -0
- package/src/auto-reply/monitor/process-message.test.ts +355 -0
- package/src/auto-reply/monitor/process-message.ts +531 -0
- package/src/auto-reply/monitor/runtime-api.ts +30 -0
- package/src/auto-reply/monitor-state.test.ts +64 -0
- package/src/auto-reply/monitor-state.ts +106 -0
- package/src/auto-reply/monitor.ts +600 -0
- package/src/auto-reply/reply-resolver.runtime.ts +1 -0
- package/src/auto-reply/session-snapshot.ts +69 -0
- package/src/auto-reply/types.ts +48 -0
- package/src/auto-reply/util.ts +63 -0
- package/src/auto-reply/web-auto-reply-monitor.test.ts +687 -0
- package/src/auto-reply/web-auto-reply-utils.test.ts +327 -0
- package/src/auto-reply.broadcast-groups.combined.test.ts +246 -0
- package/src/auto-reply.broadcast-groups.test-harness.ts +47 -0
- package/src/auto-reply.impl.ts +7 -0
- package/src/auto-reply.test-harness.ts +421 -0
- package/src/auto-reply.ts +1 -0
- package/src/auto-reply.web-auto-reply.compresses-common-formats-jpeg-cap.test.ts +427 -0
- package/src/auto-reply.web-auto-reply.connection-and-logging.e2e.test.ts +908 -0
- package/src/auto-reply.web-auto-reply.last-route.test.ts +184 -0
- package/src/channel-actions.runtime.ts +7 -0
- package/src/channel-actions.test.ts +216 -0
- package/src/channel-actions.ts +84 -0
- package/src/channel-outbound.test.ts +131 -0
- package/src/channel-outbound.ts +36 -0
- package/src/channel-react-action.runtime.ts +7 -0
- package/src/channel-react-action.test.ts +294 -0
- package/src/channel-react-action.ts +84 -0
- package/src/channel.runtime.ts +117 -0
- package/src/channel.setup.test.ts +461 -0
- package/src/channel.setup.ts +28 -0
- package/src/channel.ts +336 -0
- package/src/command-policy.ts +7 -0
- package/src/config-accessors.test.ts +34 -0
- package/src/config-accessors.ts +22 -0
- package/src/config-schema.test.ts +121 -0
- package/src/config-schema.ts +6 -0
- package/src/config-ui-hints.ts +24 -0
- package/src/connection-controller-registry.test.ts +27 -0
- package/src/connection-controller-registry.ts +49 -0
- package/src/connection-controller.test.ts +282 -0
- package/src/connection-controller.ts +679 -0
- package/src/creds-files.ts +19 -0
- package/src/creds-persistence.ts +102 -0
- package/src/directory-config.test.ts +60 -0
- package/src/directory-config.ts +40 -0
- package/src/directory-contract.test.ts +56 -0
- package/src/doctor-contract.ts +11 -0
- package/src/doctor.test.ts +74 -0
- package/src/doctor.ts +56 -0
- package/src/group-intro.ts +15 -0
- package/src/group-policy.test.ts +36 -0
- package/src/group-policy.ts +40 -0
- package/src/group-session-contract.ts +20 -0
- package/src/group-session-key.test.ts +53 -0
- package/src/group-session-key.ts +41 -0
- package/src/heartbeat-recipients.runtime.ts +6 -0
- package/src/heartbeat-recipients.test.ts +203 -0
- package/src/heartbeat-recipients.ts +104 -0
- package/src/heartbeat.ts +34 -0
- package/src/identity.ts +164 -0
- package/src/inbound/access-control.test-harness.ts +37 -0
- package/src/inbound/access-control.test.ts +375 -0
- package/src/inbound/access-control.ts +237 -0
- package/src/inbound/dedupe.ts +132 -0
- package/src/inbound/extract.test.ts +282 -0
- package/src/inbound/extract.ts +488 -0
- package/src/inbound/lifecycle.ts +39 -0
- package/src/inbound/media.node.test.ts +83 -0
- package/src/inbound/media.ts +102 -0
- package/src/inbound/monitor.ts +890 -0
- package/src/inbound/runtime-api.ts +7 -0
- package/src/inbound/save-media.runtime.ts +1 -0
- package/src/inbound/send-api.test.ts +307 -0
- package/src/inbound/send-api.ts +141 -0
- package/src/inbound/send-result.ts +61 -0
- package/src/inbound/types.ts +106 -0
- package/src/inbound-context.contract.test.ts +32 -0
- package/src/inbound-policy.ts +231 -0
- package/src/inbound.media.test.ts +320 -0
- package/src/inbound.test.ts +290 -0
- package/src/inbound.ts +9 -0
- package/src/login-qr.test.ts +483 -0
- package/src/login-qr.ts +542 -0
- package/src/login.coverage.test.ts +133 -0
- package/src/login.test.ts +89 -0
- package/src/login.ts +70 -0
- package/src/logout.test.ts +162 -0
- package/src/media.test.ts +480 -0
- package/src/media.ts +10 -0
- package/src/monitor-inbox.allows-messages-from-senders-allowfrom-list.test-support.ts +400 -0
- package/src/monitor-inbox.append-upsert.test-support.ts +133 -0
- package/src/monitor-inbox.behavior.test.ts +5 -0
- package/src/monitor-inbox.blocks-messages-from-unauthorized-senders-not-allowfrom.test-support.ts +362 -0
- package/src/monitor-inbox.captures-media-path-image-messages.test-support.ts +306 -0
- package/src/monitor-inbox.streams-inbound-messages.test-support.ts +729 -0
- package/src/monitor-inbox.test-harness.ts +304 -0
- package/src/normalize-target.ts +112 -0
- package/src/normalize.ts +6 -0
- package/src/outbound-adapter.poll.test.ts +62 -0
- package/src/outbound-adapter.sendpayload.test.ts +195 -0
- package/src/outbound-adapter.ts +36 -0
- package/src/outbound-base.test.ts +560 -0
- package/src/outbound-base.ts +244 -0
- package/src/outbound-media-contract.ts +278 -0
- package/src/outbound-media.runtime.ts +36 -0
- package/src/outbound-payload.contract.test.ts +61 -0
- package/src/outbound-send-deps.ts +1 -0
- package/src/outbound-test-support.ts +16 -0
- package/src/pairing-security.test-harness.ts +59 -0
- package/src/qr-image.ts +1 -0
- package/src/qr-terminal.ts +1 -0
- package/src/quoted-message.test.ts +83 -0
- package/src/quoted-message.ts +184 -0
- package/src/reaction-level.test.ts +94 -0
- package/src/reaction-level.ts +21 -0
- package/src/reconnect.test.ts +51 -0
- package/src/reconnect.ts +55 -0
- package/src/resolve-outbound-target.test.ts +265 -0
- package/src/resolve-outbound-target.ts +54 -0
- package/src/resolve-target.test.ts +97 -0
- package/src/runtime-api.ts +60 -0
- package/src/runtime-group-policy.ts +16 -0
- package/src/runtime.ts +9 -0
- package/src/security-contract.ts +47 -0
- package/src/security-fix.ts +71 -0
- package/src/send.test.ts +515 -0
- package/src/send.ts +287 -0
- package/src/session-contract.test.ts +31 -0
- package/src/session-contract.ts +43 -0
- package/src/session-errors.ts +125 -0
- package/src/session-route.ts +26 -0
- package/src/session.runtime.ts +8 -0
- package/src/session.test.ts +559 -0
- package/src/session.ts +330 -0
- package/src/setup-core.ts +52 -0
- package/src/setup-finalize.ts +446 -0
- package/src/setup-surface.test.ts +367 -0
- package/src/setup-surface.ts +69 -0
- package/src/setup-test-helpers.ts +216 -0
- package/src/shared.ts +291 -0
- package/src/socket-timing.test.ts +49 -0
- package/src/socket-timing.ts +38 -0
- package/src/state-migrations.ts +54 -0
- package/src/status-issues.test.ts +137 -0
- package/src/status-issues.ts +185 -0
- package/src/system-prompt.test.ts +199 -0
- package/src/system-prompt.ts +31 -0
- package/src/targets-runtime.ts +180 -0
- package/src/test-helpers.ts +690 -0
- package/src/text-runtime.test.ts +162 -0
- package/src/text-runtime.ts +11 -0
- package/src/vcard.ts +84 -0
- package/targets.ts +5 -0
- package/test-api.ts +2 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { handleWhatsAppAction } from "./src/action-runtime.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { handleWhatsAppAction } from "./src/action-runtime.js";
|
package/api.ts
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
export { whatsappPlugin } from "./src/channel.js";
|
|
2
|
+
export { whatsappSetupPlugin } from "./src/channel.setup.js";
|
|
3
|
+
export {
|
|
4
|
+
DEFAULT_WHATSAPP_MEDIA_MAX_MB,
|
|
5
|
+
hasAnyWhatsAppAuth,
|
|
6
|
+
listEnabledWhatsAppAccounts,
|
|
7
|
+
listWhatsAppAccountIds,
|
|
8
|
+
listWhatsAppAuthDirs,
|
|
9
|
+
resolveDefaultWhatsAppAccountId,
|
|
10
|
+
type ResolvedWhatsAppAccount,
|
|
11
|
+
resolveWhatsAppAccount,
|
|
12
|
+
resolveWhatsAppAuthDir,
|
|
13
|
+
resolveWhatsAppMediaMaxBytes,
|
|
14
|
+
} from "./src/accounts.js";
|
|
15
|
+
export { DEFAULT_WEB_MEDIA_BYTES } from "./src/auto-reply/constants.js";
|
|
16
|
+
export { whatsappCommandPolicy } from "./src/command-policy.js";
|
|
17
|
+
export {
|
|
18
|
+
resolveWhatsAppGroupRequireMention,
|
|
19
|
+
resolveWhatsAppGroupToolPolicy,
|
|
20
|
+
} from "./src/group-policy.js";
|
|
21
|
+
export { WHATSAPP_LEGACY_OUTBOUND_SEND_DEP_KEYS } from "./src/outbound-send-deps.js";
|
|
22
|
+
export {
|
|
23
|
+
__test__,
|
|
24
|
+
asNullableObjectRecord,
|
|
25
|
+
asNullableRecord,
|
|
26
|
+
asOptionalObjectRecord,
|
|
27
|
+
asOptionalRecord,
|
|
28
|
+
asRecord,
|
|
29
|
+
assertWebChannel,
|
|
30
|
+
type AssistantVisibleTextSanitizerProfile,
|
|
31
|
+
bindAbortRelay,
|
|
32
|
+
buildTimeoutAbortSignal,
|
|
33
|
+
chunkItems,
|
|
34
|
+
chunkMarkdownIR,
|
|
35
|
+
clamp,
|
|
36
|
+
clampInt,
|
|
37
|
+
clampNumber,
|
|
38
|
+
type CodeRegion,
|
|
39
|
+
CONFIG_DIR,
|
|
40
|
+
convertMarkdownTables,
|
|
41
|
+
createScopedExpiringIdCache,
|
|
42
|
+
DEFAULT_LOG_DIR,
|
|
43
|
+
DEFAULT_LOG_FILE,
|
|
44
|
+
diagnosticLogger,
|
|
45
|
+
type DisplayMessageWithContent,
|
|
46
|
+
displayPath,
|
|
47
|
+
displayString,
|
|
48
|
+
ensureDir,
|
|
49
|
+
escapeRegExp,
|
|
50
|
+
fetchWithTimeout,
|
|
51
|
+
FILE_REF_EXTENSIONS_WITH_TLD,
|
|
52
|
+
findCodeRegions,
|
|
53
|
+
getChildLogger,
|
|
54
|
+
getDefaultRedactPatterns,
|
|
55
|
+
getDiagnosticSessionStateCountForTest,
|
|
56
|
+
getLogger,
|
|
57
|
+
getResolvedLoggerSettings,
|
|
58
|
+
hasNonEmptyString,
|
|
59
|
+
hasOrphanReasoningCloseBoundary,
|
|
60
|
+
hasSystemMark,
|
|
61
|
+
type InlineDirectiveParseResult,
|
|
62
|
+
isAutoLinkedFileRef,
|
|
63
|
+
isFileLogLevelEnabled,
|
|
64
|
+
isInsideCode,
|
|
65
|
+
isRecord,
|
|
66
|
+
isSelfChatMode,
|
|
67
|
+
jidToE164,
|
|
68
|
+
type JidToE164Options,
|
|
69
|
+
localeLowercasePreservingWhitespace,
|
|
70
|
+
logActiveRuns,
|
|
71
|
+
logDebug,
|
|
72
|
+
logError,
|
|
73
|
+
type LoggerResolvedSettings,
|
|
74
|
+
type LoggerSettings,
|
|
75
|
+
logInfo,
|
|
76
|
+
logLaneDequeue,
|
|
77
|
+
logLaneEnqueue,
|
|
78
|
+
logMessageProcessed,
|
|
79
|
+
logMessageQueued,
|
|
80
|
+
logRunAttempt,
|
|
81
|
+
logSessionStateChange,
|
|
82
|
+
logSuccess,
|
|
83
|
+
logToolLoopAction,
|
|
84
|
+
logWarn,
|
|
85
|
+
logWebhookError,
|
|
86
|
+
logWebhookProcessed,
|
|
87
|
+
logWebhookReceived,
|
|
88
|
+
lowercasePreservingWhitespace,
|
|
89
|
+
type MarkdownIR,
|
|
90
|
+
type MarkdownLinkSpan,
|
|
91
|
+
type MarkdownParseOptions,
|
|
92
|
+
type MarkdownStyle,
|
|
93
|
+
type MarkdownStyleSpan,
|
|
94
|
+
type MarkdownTableData,
|
|
95
|
+
type MarkdownTableMeta,
|
|
96
|
+
markdownToIR,
|
|
97
|
+
markdownToIRWithMeta,
|
|
98
|
+
markdownToWhatsApp,
|
|
99
|
+
normalizeArrayBackedTrimmedStringList,
|
|
100
|
+
normalizeAtHashSlug,
|
|
101
|
+
normalizeCsvOrLooseStringList,
|
|
102
|
+
normalizeE164,
|
|
103
|
+
normalizeFastMode,
|
|
104
|
+
normalizeHyphenSlug,
|
|
105
|
+
normalizeLowercaseStringOrEmpty,
|
|
106
|
+
normalizeNullableString,
|
|
107
|
+
normalizeOptionalLowercaseString,
|
|
108
|
+
normalizeOptionalString,
|
|
109
|
+
normalizeOptionalStringifiedId,
|
|
110
|
+
normalizeOptionalThreadValue,
|
|
111
|
+
normalizeOptionalTrimmedStringList,
|
|
112
|
+
normalizeSingleOrTrimmedStringList,
|
|
113
|
+
normalizeStringEntries,
|
|
114
|
+
normalizeStringEntriesLower,
|
|
115
|
+
normalizeStringifiedOptionalString,
|
|
116
|
+
normalizeTrimmedStringList,
|
|
117
|
+
parseInlineDirectives,
|
|
118
|
+
pathExists,
|
|
119
|
+
type PinoLikeLogger,
|
|
120
|
+
prefixSystemMessage,
|
|
121
|
+
type ReactionLevel,
|
|
122
|
+
readStringField,
|
|
123
|
+
readStringValue,
|
|
124
|
+
type ReasoningTagMode,
|
|
125
|
+
type ReasoningTagTrim,
|
|
126
|
+
redactIdentifier,
|
|
127
|
+
redactSensitiveLines,
|
|
128
|
+
type RedactSensitiveMode,
|
|
129
|
+
redactSensitiveText,
|
|
130
|
+
redactToolDetail,
|
|
131
|
+
type RenderedMarkdownChunk,
|
|
132
|
+
type RenderLink,
|
|
133
|
+
renderMarkdownIRChunksWithinLimit,
|
|
134
|
+
type RenderMarkdownIRChunksWithinLimitOptions,
|
|
135
|
+
renderMarkdownWithMarkers,
|
|
136
|
+
type RenderOptions,
|
|
137
|
+
type RenderStyleMap,
|
|
138
|
+
type RenderStyleMarker,
|
|
139
|
+
resetDiagnosticStateForTest,
|
|
140
|
+
resetLogger,
|
|
141
|
+
resolveConfigDir,
|
|
142
|
+
type ResolvedReactionLevel,
|
|
143
|
+
type ResolvedRedactOptions,
|
|
144
|
+
resolveGlobalMap,
|
|
145
|
+
resolveGlobalSingleton,
|
|
146
|
+
resolveHomeDir,
|
|
147
|
+
resolveJidToE164,
|
|
148
|
+
resolvePrimaryStringValue,
|
|
149
|
+
resolveReactionLevel,
|
|
150
|
+
resolveRedactOptions,
|
|
151
|
+
resolveStuckSessionWarnMs,
|
|
152
|
+
resolveUserPath,
|
|
153
|
+
safeParseJson,
|
|
154
|
+
sanitizeAssistantVisibleText,
|
|
155
|
+
sanitizeAssistantVisibleTextWithOptions,
|
|
156
|
+
sanitizeAssistantVisibleTextWithProfile,
|
|
157
|
+
sanitizeReplyDirectiveId,
|
|
158
|
+
sanitizeTerminalText,
|
|
159
|
+
type ScopedExpiringIdCache,
|
|
160
|
+
setLoggerOverride,
|
|
161
|
+
sha256HexPrefix,
|
|
162
|
+
shortenHomeInString,
|
|
163
|
+
shortenHomePath,
|
|
164
|
+
sleep,
|
|
165
|
+
sliceMarkdownIR,
|
|
166
|
+
sliceUtf16Safe,
|
|
167
|
+
startDiagnosticHeartbeat,
|
|
168
|
+
stopDiagnosticHeartbeat,
|
|
169
|
+
stripAssistantInternalScaffolding,
|
|
170
|
+
stripDowngradedToolCallText,
|
|
171
|
+
stripInlineDirectiveTagsForDelivery,
|
|
172
|
+
stripInlineDirectiveTagsForDisplay,
|
|
173
|
+
stripInlineDirectiveTagsFromMessageForDisplay,
|
|
174
|
+
stripMarkdown,
|
|
175
|
+
stripMinimaxToolCallXml,
|
|
176
|
+
stripReasoningTagsFromText,
|
|
177
|
+
stripToolCallXmlTags,
|
|
178
|
+
summarizeStringEntries,
|
|
179
|
+
SYSTEM_MARK,
|
|
180
|
+
toPinoLikeLogger,
|
|
181
|
+
toWhatsappJid,
|
|
182
|
+
truncateUtf16Safe,
|
|
183
|
+
type WebChannel,
|
|
184
|
+
withTimeout,
|
|
185
|
+
} from "./src/text-runtime.js";
|
|
186
|
+
export {
|
|
187
|
+
type WebChannelHealthState,
|
|
188
|
+
type WebChannelStatus,
|
|
189
|
+
type WebInboundMsg,
|
|
190
|
+
type WebMonitorTuning,
|
|
191
|
+
} from "./src/auto-reply/types.js";
|
|
192
|
+
export {
|
|
193
|
+
type ActiveWebListener,
|
|
194
|
+
type ActiveWebSendOptions,
|
|
195
|
+
type WebInboundMessage,
|
|
196
|
+
type WebListenerCloseReason,
|
|
197
|
+
type WhatsAppStructuredContactContext,
|
|
198
|
+
} from "./src/inbound/types.js";
|
|
199
|
+
export {
|
|
200
|
+
listWhatsAppDirectoryGroupsFromConfig,
|
|
201
|
+
listWhatsAppDirectoryPeersFromConfig,
|
|
202
|
+
} from "./src/directory-config.js";
|
|
203
|
+
export { resolveWhatsAppOutboundTarget } from "./src/resolve-outbound-target.js";
|
|
204
|
+
export {
|
|
205
|
+
isWhatsAppGroupJid,
|
|
206
|
+
normalizeWhatsAppAllowFromEntries,
|
|
207
|
+
isWhatsAppUserTarget,
|
|
208
|
+
looksLikeWhatsAppTargetId,
|
|
209
|
+
normalizeWhatsAppMessagingTarget,
|
|
210
|
+
normalizeWhatsAppTarget,
|
|
211
|
+
} from "./src/normalize-target.js";
|
|
212
|
+
export { resolveWhatsAppGroupIntroHint } from "./src/runtime-api.js";
|
|
213
|
+
export { __testing as whatsappAccessControlTesting } from "./src/inbound/access-control.js";
|
package/auth-presence.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
4
|
+
import { resolveUserPath } from "openclaw/plugin-sdk/account-resolution";
|
|
5
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
|
|
6
|
+
import { resolveOAuthDir } from "openclaw/plugin-sdk/state-paths";
|
|
7
|
+
import { hasWebCredsSync } from "./src/creds-files.js";
|
|
8
|
+
|
|
9
|
+
type WhatsAppAuthPresenceParams =
|
|
10
|
+
| {
|
|
11
|
+
cfg: OpenClawConfig;
|
|
12
|
+
env?: NodeJS.ProcessEnv;
|
|
13
|
+
}
|
|
14
|
+
| OpenClawConfig;
|
|
15
|
+
|
|
16
|
+
function addAccountAuthDirs(
|
|
17
|
+
authDirs: Set<string>,
|
|
18
|
+
accountId: string,
|
|
19
|
+
authDir: string | undefined,
|
|
20
|
+
accountsRoot: string,
|
|
21
|
+
env: NodeJS.ProcessEnv,
|
|
22
|
+
): void {
|
|
23
|
+
authDirs.add(path.join(accountsRoot, normalizeAccountId(accountId)));
|
|
24
|
+
const configuredAuthDir = authDir?.trim();
|
|
25
|
+
if (configuredAuthDir) {
|
|
26
|
+
authDirs.add(resolveUserPath(configuredAuthDir, env));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function listWhatsAppAuthDirs(
|
|
31
|
+
cfg: OpenClawConfig,
|
|
32
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
33
|
+
): readonly string[] {
|
|
34
|
+
const oauthDir = resolveOAuthDir(env);
|
|
35
|
+
const accountsRoot = path.join(oauthDir, "whatsapp");
|
|
36
|
+
const channel = cfg.channels?.whatsapp;
|
|
37
|
+
const authDirs = new Set<string>([oauthDir, path.join(accountsRoot, DEFAULT_ACCOUNT_ID)]);
|
|
38
|
+
|
|
39
|
+
addAccountAuthDirs(authDirs, DEFAULT_ACCOUNT_ID, undefined, accountsRoot, env);
|
|
40
|
+
|
|
41
|
+
if (channel?.defaultAccount?.trim()) {
|
|
42
|
+
addAccountAuthDirs(
|
|
43
|
+
authDirs,
|
|
44
|
+
channel.defaultAccount,
|
|
45
|
+
channel.accounts?.[channel.defaultAccount]?.authDir,
|
|
46
|
+
accountsRoot,
|
|
47
|
+
env,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const accounts = channel?.accounts;
|
|
52
|
+
if (accounts) {
|
|
53
|
+
for (const [accountId, account] of Object.entries(accounts)) {
|
|
54
|
+
addAccountAuthDirs(authDirs, accountId, account?.authDir, accountsRoot, env);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const entries = fs.readdirSync(accountsRoot, { withFileTypes: true });
|
|
60
|
+
for (const entry of entries) {
|
|
61
|
+
if (entry.isDirectory()) {
|
|
62
|
+
authDirs.add(path.join(accountsRoot, entry.name));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} catch {
|
|
66
|
+
// Missing directories mean no auth state.
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return [...authDirs];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function hasAnyWhatsAppAuth(
|
|
73
|
+
params: WhatsAppAuthPresenceParams,
|
|
74
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
75
|
+
): boolean {
|
|
76
|
+
const cfg = params && typeof params === "object" && "cfg" in params ? params.cfg : params;
|
|
77
|
+
const resolvedEnv =
|
|
78
|
+
params && typeof params === "object" && "cfg" in params ? (params.env ?? env) : env;
|
|
79
|
+
return listWhatsAppAuthDirs(cfg, resolvedEnv).some((authDir) => hasWebCredsSync(authDir));
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WhatsAppChannelConfigSchema } from "./src/config-schema.js";
|
package/config-api.ts
ADDED
package/constants.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DEFAULT_WEB_MEDIA_BYTES } from "./src/auto-reply/constants.js";
|
package/contract-api.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { whatsappCommandPolicy as whatsappCommandPolicyImpl } from "./src/command-policy.js";
|
|
2
|
+
import { resolveLegacyGroupSessionKey as resolveLegacyGroupSessionKeyImpl } from "./src/group-session-contract.js";
|
|
3
|
+
import { __testing as whatsappAccessControlTestingImpl } from "./src/inbound/access-control.js";
|
|
4
|
+
import {
|
|
5
|
+
isWhatsAppGroupJid as isWhatsAppGroupJidImpl,
|
|
6
|
+
normalizeWhatsAppTarget as normalizeWhatsAppTargetImpl,
|
|
7
|
+
} from "./src/normalize-target.js";
|
|
8
|
+
export {
|
|
9
|
+
listWhatsAppDirectoryGroupsFromConfig,
|
|
10
|
+
listWhatsAppDirectoryPeersFromConfig,
|
|
11
|
+
} from "./src/directory-config.js";
|
|
12
|
+
import { resolveWhatsAppRuntimeGroupPolicy as resolveWhatsAppRuntimeGroupPolicyImpl } from "./src/runtime-group-policy.js";
|
|
13
|
+
import {
|
|
14
|
+
canonicalizeLegacySessionKey as canonicalizeLegacySessionKeyImpl,
|
|
15
|
+
isLegacyGroupSessionKey as isLegacyGroupSessionKeyImpl,
|
|
16
|
+
} from "./src/session-contract.js";
|
|
17
|
+
export {
|
|
18
|
+
collectUnsupportedSecretRefConfigCandidates,
|
|
19
|
+
unsupportedSecretRefSurfacePatterns,
|
|
20
|
+
} from "./src/security-contract.js";
|
|
21
|
+
|
|
22
|
+
export const canonicalizeLegacySessionKey = canonicalizeLegacySessionKeyImpl;
|
|
23
|
+
export const isLegacyGroupSessionKey = isLegacyGroupSessionKeyImpl;
|
|
24
|
+
export const isWhatsAppGroupJid = isWhatsAppGroupJidImpl;
|
|
25
|
+
export const normalizeWhatsAppTarget = normalizeWhatsAppTargetImpl;
|
|
26
|
+
export const resolveLegacyGroupSessionKey = resolveLegacyGroupSessionKeyImpl;
|
|
27
|
+
export const resolveWhatsAppRuntimeGroupPolicy = resolveWhatsAppRuntimeGroupPolicyImpl;
|
|
28
|
+
export const whatsappAccessControlTesting = whatsappAccessControlTestingImpl;
|
|
29
|
+
export const whatsappCommandPolicy = whatsappCommandPolicyImpl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2026-04-29T11:29:30.144Z
|