openclaw-multi-auto 1.6.1 → 1.6.5

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 (83) hide show
  1. package/dist/build-info.json +3 -3
  2. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  3. package/dist/plugin-sdk/googlechat.js +2 -2
  4. package/dist/plugin-sdk/imessage.js +2 -2
  5. package/dist/plugin-sdk/index.js +50 -50
  6. package/dist/plugin-sdk/mattermost.js +3 -3
  7. package/package.json +1 -1
  8. package/scripts/create-instance.sh +15 -6
  9. package/dist/plugin-sdk/accounts-CJWOBzwB.js +0 -35
  10. package/dist/plugin-sdk/accounts-DP1-L-QS.js +0 -288
  11. package/dist/plugin-sdk/accounts-DZhWlEg3.js +0 -46
  12. package/dist/plugin-sdk/active-listener-B_sLJTXM.js +0 -50
  13. package/dist/plugin-sdk/api-key-rotation-BRE4X2tf.js +0 -181
  14. package/dist/plugin-sdk/audio-preflight-DGEUDxxR.js +0 -69
  15. package/dist/plugin-sdk/audio-transcription-runner-DkoPNPYt.js +0 -2176
  16. package/dist/plugin-sdk/audit-membership-runtime-DSBHHw7o.js +0 -58
  17. package/dist/plugin-sdk/channel-activity-F3d0yUwy.js +0 -94
  18. package/dist/plugin-sdk/channel-web-QF7EpjeP.js +0 -2256
  19. package/dist/plugin-sdk/chrome-BXoCyCkY.js +0 -2415
  20. package/dist/plugin-sdk/commands-registry-t7cXBTfN.js +0 -1125
  21. package/dist/plugin-sdk/config-BkEnz2Po.js +0 -17913
  22. package/dist/plugin-sdk/deliver-B6AG_l67.js +0 -1694
  23. package/dist/plugin-sdk/deliver-runtime-D585kJZc.js +0 -32
  24. package/dist/plugin-sdk/deps-send-discord.runtime-a_OKY2js.js +0 -23
  25. package/dist/plugin-sdk/deps-send-imessage.runtime-Baxy9TD4.js +0 -22
  26. package/dist/plugin-sdk/deps-send-signal.runtime-BwXoCrFl.js +0 -21
  27. package/dist/plugin-sdk/deps-send-slack.runtime-CLmKjgso.js +0 -19
  28. package/dist/plugin-sdk/deps-send-telegram.runtime-BKfdBKnZ.js +0 -24
  29. package/dist/plugin-sdk/deps-send-whatsapp.runtime-BOTwkbx_.js +0 -57
  30. package/dist/plugin-sdk/diagnostic-CsP-lEkI.js +0 -319
  31. package/dist/plugin-sdk/errors-DaiAM-yU.js +0 -54
  32. package/dist/plugin-sdk/fetch-guard-DETCcJzQ.js +0 -156
  33. package/dist/plugin-sdk/fs-safe-B8y811FR.js +0 -352
  34. package/dist/plugin-sdk/image-DjTEkYZE.js +0 -2310
  35. package/dist/plugin-sdk/image-ops-BSiMpAw4.js +0 -584
  36. package/dist/plugin-sdk/image-runtime-6xPp8m5a.js +0 -25
  37. package/dist/plugin-sdk/ir-DQ7_HbvK.js +0 -1296
  38. package/dist/plugin-sdk/local-roots-BUP4YBmR.js +0 -186
  39. package/dist/plugin-sdk/logger-CZY9KIoY.js +0 -1163
  40. package/dist/plugin-sdk/login-BxEKLlCo.js +0 -57
  41. package/dist/plugin-sdk/login-qr-BQIpMPr9.js +0 -320
  42. package/dist/plugin-sdk/manager-I6KbPihW.js +0 -3917
  43. package/dist/plugin-sdk/manager-runtime-CFfYYWIQ.js +0 -15
  44. package/dist/plugin-sdk/outbound-NS6UHnB6.js +0 -212
  45. package/dist/plugin-sdk/outbound-attachment-Dy6fyf6H.js +0 -19
  46. package/dist/plugin-sdk/path-alias-guards-DBjLbIX_.js +0 -43
  47. package/dist/plugin-sdk/paths-vTM3Lh3X.js +0 -166
  48. package/dist/plugin-sdk/pi-embedded-helpers-1R1gu7eX.js +0 -9627
  49. package/dist/plugin-sdk/pi-model-discovery-runtime-Do9o-dUd.js +0 -8
  50. package/dist/plugin-sdk/pi-model-discovery-v-XPUOOf.js +0 -134
  51. package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-D4sFsIks.js +0 -354
  52. package/dist/plugin-sdk/plugins-DeBZB9l_.js +0 -864
  53. package/dist/plugin-sdk/proxy-fetch-ChxOhWF4.js +0 -38
  54. package/dist/plugin-sdk/pw-ai-DEOmCSSC.js +0 -1938
  55. package/dist/plugin-sdk/qmd-manager-HyYKoEch.js +0 -1448
  56. package/dist/plugin-sdk/query-expansion-CeyKUeDW.js +0 -1011
  57. package/dist/plugin-sdk/redact-DjVX-1N3.js +0 -319
  58. package/dist/plugin-sdk/reply-DAo_Jt8K.js +0 -97916
  59. package/dist/plugin-sdk/resolve-outbound-target-B42qgQS9.js +0 -40
  60. package/dist/plugin-sdk/run-with-concurrency-Bt_ks0Qa.js +0 -1994
  61. package/dist/plugin-sdk/runtime-whatsapp-login.runtime-B6W989eF.js +0 -10
  62. package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-c_GDFy37.js +0 -19
  63. package/dist/plugin-sdk/send-CQpMudwO.js +0 -2587
  64. package/dist/plugin-sdk/send-DQHLzVyO.js +0 -414
  65. package/dist/plugin-sdk/send-DTB24bEF.js +0 -3135
  66. package/dist/plugin-sdk/send-DfHadjZ_.js +0 -503
  67. package/dist/plugin-sdk/send-XXlW2iny.js +0 -540
  68. package/dist/plugin-sdk/session-6TF6MyaC.js +0 -169
  69. package/dist/plugin-sdk/skill-commands-CkGeFUMl.js +0 -342
  70. package/dist/plugin-sdk/skills-CBkHBYPq.js +0 -1428
  71. package/dist/plugin-sdk/slash-commands.runtime-CxliuGaP.js +0 -13
  72. package/dist/plugin-sdk/slash-dispatch.runtime-DFaeYlJQ.js +0 -52
  73. package/dist/plugin-sdk/slash-skill-commands.runtime-0M0OLCxq.js +0 -16
  74. package/dist/plugin-sdk/ssrf-cFtplYtS.js +0 -202
  75. package/dist/plugin-sdk/store-5nyxY3WU.js +0 -81
  76. package/dist/plugin-sdk/subagent-registry-runtime-DCtmDwna.js +0 -52
  77. package/dist/plugin-sdk/tables-C47P4GTN.js +0 -55
  78. package/dist/plugin-sdk/target-errors-Blia4S69.js +0 -195
  79. package/dist/plugin-sdk/thinking-Bo2eosVa.js +0 -1206
  80. package/dist/plugin-sdk/tokens-DgNRBwIg.js +0 -52
  81. package/dist/plugin-sdk/tool-images-Gk_-0y2N.js +0 -274
  82. package/dist/plugin-sdk/web-CVxZbXyH.js +0 -56
  83. package/dist/plugin-sdk/whatsapp-actions-Bw0H9g-n.js +0 -80
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.6.1",
3
- "commit": "1e1cbc3be6a15fb1e49a0247c355c452dfeac2f7",
4
- "builtAt": "2026-03-15T03:36:10.264Z"
2
+ "version": "1.6.5",
3
+ "commit": "3b0e5775452d604305d34ee83f459afe00340f34",
4
+ "builtAt": "2026-03-15T05:36:28.951Z"
5
5
  }
@@ -1 +1 @@
1
- 25e7fb87f171f734edf63ccccc47f5089b0acda38fd2fecb72a9b8a91ac7bbaf
1
+ 2a94a03a6836181c132f1b10179b2cdaa42d15108752bf282c4bccbd58d40198
@@ -5,7 +5,7 @@ import chalk, { Chalk } from "chalk";
5
5
  import fs from "node:fs";
6
6
  import { Logger } from "tslog";
7
7
  import os from "node:os";
8
- import JSON5 from "json5";
8
+ import json5 from "json5";
9
9
  import { promisify } from "node:util";
10
10
  import { execFile } from "node:child_process";
11
11
  import { getOAuthProviders } from "@mariozechner/pi-ai";
@@ -415,7 +415,7 @@ function readLoggingConfig() {
415
415
  try {
416
416
  if (!fs.existsSync(configPath)) return;
417
417
  const raw = fs.readFileSync(configPath, "utf-8");
418
- const logging = JSON5.parse(raw)?.logging;
418
+ const logging = json5.parse(raw)?.logging;
419
419
  if (!logging || typeof logging !== "object" || Array.isArray(logging)) return;
420
420
  return logging;
421
421
  } catch {
@@ -4,7 +4,7 @@ import chalk, { Chalk } from "chalk";
4
4
  import fs from "node:fs";
5
5
  import { Logger } from "tslog";
6
6
  import os from "node:os";
7
- import json5 from "json5";
7
+ import JSON5 from "json5";
8
8
  import { promisify } from "node:util";
9
9
  import fs$1 from "node:fs/promises";
10
10
  import "@clack/prompts";
@@ -761,7 +761,7 @@ function readLoggingConfig() {
761
761
  try {
762
762
  if (!fs.existsSync(configPath)) return;
763
763
  const raw = fs.readFileSync(configPath, "utf-8");
764
- const logging = json5.parse(raw)?.logging;
764
+ const logging = JSON5.parse(raw)?.logging;
765
765
  if (!logging || typeof logging !== "object" || Array.isArray(logging)) return;
766
766
  return logging;
767
767
  } catch {
@@ -1,60 +1,60 @@
1
- import { $ as normalizeAgentId, D as runCommandWithTimeout, R as isNotFoundPathError, at as DEFAULT_ACCOUNT_ID, nt as resolveThreadSessionKeys, ot as normalizeAccountId, z as isPathInside } from "./run-with-concurrency-Bt_ks0Qa.js";
2
- import { a as resolveWhatsAppAuthDir, i as resolveWhatsAppAccount, n as listWhatsAppAccountIds, r as resolveDefaultWhatsAppAccountId, y as createAccountListHelpers } from "./accounts-DP1-L-QS.js";
3
- import { $ as shouldAckReaction, $t as isRequestBodyLimitError, A as attachFooterText, At as issuePairingChallenge, B as resolveDiscordChannelAllowlist, Bt as resolveControlCommandGate, Ct as resolveTimezone, D as processLineMessage, Dt as readBooleanParam, E as hasMarkdownToConvert, F as parseTelegramThreadId, Ft as resolveDmGroupAccessDecision, G as recordInboundSession, Gt as resolveOpenProviderRuntimeGroupPolicy, H as formatDocsLink, Ht as resetMissingProviderGroupPolicyFallbackWarningsForTesting, I as resolveSlackUserAllowlist, It as resolveDmGroupAccessWithCommandGate, J as logTypingFailure, Jt as pruneMapToMaxSize, K as logAckFailure, Kt as resolveRuntimeGroupPolicy, L as resolveSlackChannelAllowlist, Lt as resolveDmGroupAccessWithLists, Mt as DM_GROUP_ACCESS_REASON, Nt as readStoreAllowFromForDmPolicy, O as stripMarkdown, Ot as buildMediaPayload, P as parseTelegramReplyToMessageId, Pt as resolveDmAllowState, Q as removeAckReactionAfterReply, Qt as installRequestBodyLimitGuard, R as detectBinary, Rt as resolveEffectiveAllowFromLists, Sn as CHANNEL_MESSAGE_ACTION_NAMES, St as formatZonedTimestamp, U as optionalStringEnum, Ut as resolveAllowlistProviderRuntimeGroupPolicy, V as collectDiscordAuditChannelIds, Vt as GROUP_POLICY_BLOCKED_LABEL, W as stringEnum, Wt as resolveDefaultGroupPolicy, X as createReplyPrefixOptions, Xt as DEFAULT_WEBHOOK_MAX_BODY_BYTES, Y as createReplyPrefixContext, Yt as DEFAULT_WEBHOOK_BODY_TIMEOUT_MS, Z as createTypingCallbacks, Zt as RequestBodyLimitError, _n as resolveAllowlistMatchByCandidates, _t as listDevicePairing, an as isDangerousNameMatchingEnabled, at as DEFAULT_GROUP_HISTORY_LIMIT, bn as BLUEBUBBLES_ACTION_NAMES, bt as formatInboundFromLabel, c as normalizeAccountId$1, cn as registerAcpRuntimeBackend, ct as clearHistoryEntries, dn as ACP_ERROR_CODES, dt as recordPendingHistoryEntry, en as readJsonBodyWithLimit, et as shouldAckReactionForWhatsApp, fn as AcpRuntimeError, ft as recordPendingHistoryEntryIfEnabled, gn as formatAllowlistMatchMeta, gt as approveDevicePairing, hn as unbindThreadBindingsBySessionKey, ht as createDedupeCache, in as enqueueKeyedTask, it as summarizeMapping, k as createReceiptCard, kt as extractToolSend, l as resolveDefaultLineAccountId, ln as requireAcpRuntimeBackend, lt as clearHistoryEntriesIfEnabled, mn as listThreadBindingsBySessionKey, nn as requestBodyErrorToText, nt as resolveMentionGatingWithBypass, on as registerPluginHttpRoute, pn as autoBindSpawnedDiscordSubagent, q as logInboundDrop, qt as warnMissingProviderGroupPolicyFallbackOnce, rn as KeyedAsyncQueue, rt as mergeAllowlist, s as listLineAccountIds, sn as getAcpRuntimeBackend, st as buildPendingHistoryContextFromMap, tn as readRequestBodyWithLimit, tt as resolveMentionGating, u as resolveLineAccount, un as unregisterAcpRuntimeBackend, ut as evictOldHistoryKeys, vn as resolveAllowlistMatchSimple, vt as rejectDevicePairing, wt as resolveAckReaction, xn as BLUEBUBBLES_GROUP_ACTIONS, xt as formatUtcTimestamp, yn as BLUEBUBBLES_ACTIONS, z as resolveDiscordUserAllowlist } from "./reply-DAo_Jt8K.js";
1
+ import { $ as normalizeAgentId, D as runCommandWithTimeout, R as isNotFoundPathError, at as DEFAULT_ACCOUNT_ID, nt as resolveThreadSessionKeys, ot as normalizeAccountId, z as isPathInside } from "./run-with-concurrency-DGAUB0Z6.js";
2
+ import { a as resolveWhatsAppAuthDir, i as resolveWhatsAppAccount, n as listWhatsAppAccountIds, r as resolveDefaultWhatsAppAccountId, y as createAccountListHelpers } from "./accounts-D_zHze6C.js";
3
+ import { $ as shouldAckReaction, $t as isRequestBodyLimitError, A as attachFooterText, At as issuePairingChallenge, B as resolveDiscordChannelAllowlist, Bt as resolveControlCommandGate, Ct as resolveTimezone, D as processLineMessage, Dt as readBooleanParam, E as hasMarkdownToConvert, F as parseTelegramThreadId, Ft as resolveDmGroupAccessDecision, G as recordInboundSession, Gt as resolveOpenProviderRuntimeGroupPolicy, H as formatDocsLink, Ht as resetMissingProviderGroupPolicyFallbackWarningsForTesting, I as resolveSlackUserAllowlist, It as resolveDmGroupAccessWithCommandGate, J as logTypingFailure, Jt as pruneMapToMaxSize, K as logAckFailure, Kt as resolveRuntimeGroupPolicy, L as resolveSlackChannelAllowlist, Lt as resolveDmGroupAccessWithLists, Mt as DM_GROUP_ACCESS_REASON, Nt as readStoreAllowFromForDmPolicy, O as stripMarkdown, Ot as buildMediaPayload, P as parseTelegramReplyToMessageId, Pt as resolveDmAllowState, Q as removeAckReactionAfterReply, Qt as installRequestBodyLimitGuard, R as detectBinary, Rt as resolveEffectiveAllowFromLists, Sn as CHANNEL_MESSAGE_ACTION_NAMES, St as formatZonedTimestamp, U as optionalStringEnum, Ut as resolveAllowlistProviderRuntimeGroupPolicy, V as collectDiscordAuditChannelIds, Vt as GROUP_POLICY_BLOCKED_LABEL, W as stringEnum, Wt as resolveDefaultGroupPolicy, X as createReplyPrefixOptions, Xt as DEFAULT_WEBHOOK_MAX_BODY_BYTES, Y as createReplyPrefixContext, Yt as DEFAULT_WEBHOOK_BODY_TIMEOUT_MS, Z as createTypingCallbacks, Zt as RequestBodyLimitError, _n as resolveAllowlistMatchByCandidates, _t as listDevicePairing, an as isDangerousNameMatchingEnabled, at as DEFAULT_GROUP_HISTORY_LIMIT, bn as BLUEBUBBLES_ACTION_NAMES, bt as formatInboundFromLabel, c as normalizeAccountId$1, cn as registerAcpRuntimeBackend, ct as clearHistoryEntries, dn as ACP_ERROR_CODES, dt as recordPendingHistoryEntry, en as readJsonBodyWithLimit, et as shouldAckReactionForWhatsApp, fn as AcpRuntimeError, ft as recordPendingHistoryEntryIfEnabled, gn as formatAllowlistMatchMeta, gt as approveDevicePairing, hn as unbindThreadBindingsBySessionKey, ht as createDedupeCache, in as enqueueKeyedTask, it as summarizeMapping, k as createReceiptCard, kt as extractToolSend, l as resolveDefaultLineAccountId, ln as requireAcpRuntimeBackend, lt as clearHistoryEntriesIfEnabled, mn as listThreadBindingsBySessionKey, nn as requestBodyErrorToText, nt as resolveMentionGatingWithBypass, on as registerPluginHttpRoute, pn as autoBindSpawnedDiscordSubagent, q as logInboundDrop, qt as warnMissingProviderGroupPolicyFallbackOnce, rn as KeyedAsyncQueue, rt as mergeAllowlist, s as listLineAccountIds, sn as getAcpRuntimeBackend, st as buildPendingHistoryContextFromMap, tn as readRequestBodyWithLimit, tt as resolveMentionGating, u as resolveLineAccount, un as unregisterAcpRuntimeBackend, ut as evictOldHistoryKeys, vn as resolveAllowlistMatchSimple, vt as rejectDevicePairing, wt as resolveAckReaction, xn as BLUEBUBBLES_GROUP_ACTIONS, xt as formatUtcTimestamp, yn as BLUEBUBBLES_ACTIONS, z as resolveDiscordUserAllowlist } from "./reply-DFx1Qvnx.js";
4
4
  import "./paths-MKyEVmEb.js";
5
5
  import "./github-copilot-token-D5fdS6xD.js";
6
- import { A as GroupPolicySchema, Ar as withFileLock, At as normalizePluginHttpPath, B as requireOpenAllowFrom, D as BlockStreamingCoalesceSchema, E as ToolPolicySchema, F as TtsAutoSchema, Hr as isSecretRef, I as TtsConfigSchema, L as TtsModeSchema, M as MarkdownTableModeSchema, N as ReplyRuntimeConfigSchemaShape, O as DmConfigSchema, P as SecretInputSchema, Pr as formatCliCommand, R as TtsProviderSchema, Ur as normalizeResolvedSecretInputString, Vr as hasConfiguredSecretInput, Wr as normalizeSecretInputString, c as WhatsAppConfigSchema, d as IMessageConfigSchema, ei as isTruthyEnvValue, f as MSTeamsConfigSchema, fr as resolveSecretRefString, h as TelegramConfigSchema, j as MarkdownConfigSchema, k as DmPolicySchema, kr as acquireFileLock, l as DiscordConfigSchema, m as SlackConfigSchema, p as SignalConfigSchema, u as GoogleChatConfigSchema, vr as isValidFileSecretRefId, xr as encodeJsonPointerToken, yr as resolveDefaultSecretProviderAlias, yt as getChatChannelMeta, z as normalizeAllowFrom, zr as assertSecretInputResolved } from "./config-BkEnz2Po.js";
7
- import { A as sleep, C as pathExists, D as safeParseJson, K as registerLogTransport, S as normalizeE164, X as resolvePreferredOpenClawTmpDir, _ as escapeRegExp, f as CONFIG_DIR, o as stripAnsi, p as clamp, y as isRecord } from "./logger-CZY9KIoY.js";
8
- import { A as resolveWhatsAppGroupToolPolicy, B as normalizeWhatsAppMessagingTarget, C as resolveIMessageGroupRequireMention, D as resolveTelegramGroupRequireMention, E as resolveSlackGroupToolPolicy, F as resolveIMessageConfigDefaultTo, H as trimMessagingTarget, I as resolveWhatsAppConfigAllowFrom, K as resolveToolsBySender, L as resolveWhatsAppConfigDefaultTo, M as formatTrimmedAllowFromEntries, N as formatWhatsAppConfigAllowFromEntries, O as resolveTelegramGroupToolPolicy, P as resolveIMessageConfigAllowFrom, R as looksLikeWhatsAppTargetId, S as resolveGoogleChatGroupToolPolicy, T as resolveSlackGroupRequireMention, V as looksLikeHandleOrPhoneTarget, _ as resolveBlueBubblesGroupRequireMention, b as resolveDiscordGroupToolPolicy, g as normalizeSignalMessagingTarget, h as looksLikeSignalTargetId, j as buildSlackThreadingToolContext, k as resolveWhatsAppGroupRequireMention, m as resolveWhatsAppMentionStripPatterns, p as resolveWhatsAppGroupIntroHint, v as resolveBlueBubblesGroupToolPolicy, w as resolveIMessageGroupToolPolicy, x as resolveGoogleChatGroupRequireMention, y as resolveDiscordGroupRequireMention, z as normalizeWhatsAppAllowFromEntries } from "./thinking-Bo2eosVa.js";
9
- import { c as detectMime, l as extensionForMime, u as getFileExtension } from "./image-ops-BSiMpAw4.js";
10
- import "./pi-embedded-helpers-1R1gu7eX.js";
11
- import { A as listSlackAccountIds, C as resolveTelegramAccount, D as listConfiguredAccountIds, H as resolveDiscordAccount, I as isWhatsAppGroupJid, L as normalizeWhatsAppTarget, M as resolveSlackAccount, N as resolveSlackReplyToMode, O as resolveAccountWithDefaultFallback, S as resolveDefaultTelegramAccountId, V as resolveDefaultDiscordAccountId, a as listDiscordDirectoryPeersFromConfig, c as listTelegramDirectoryGroupsFromConfig, d as listWhatsAppDirectoryPeersFromConfig, f as looksLikeSlackTargetId, i as listDiscordDirectoryGroupsFromConfig, j as resolveDefaultSlackAccountId, k as listEnabledSlackAccounts, l as listTelegramDirectoryPeersFromConfig, o as listSlackDirectoryGroupsFromConfig, p as normalizeSlackMessagingTarget, s as listSlackDirectoryPeersFromConfig, u as listWhatsAppDirectoryGroupsFromConfig, x as listTelegramAccountIds, z as listDiscordAccountIds } from "./plugins-DeBZB9l_.js";
12
- import { n as resolveDefaultIMessageAccountId, r as resolveIMessageAccount, t as listIMessageAccountIds } from "./accounts-CJWOBzwB.js";
13
- import { i as resolveSignalAccount, n as listSignalAccountIds, r as resolveDefaultSignalAccountId } from "./accounts-DZhWlEg3.js";
14
- import { At as resolveChannelEntryMatch, Mt as resolveNestedAllowlistDecision, Ot as buildChannelKeyCandidates, at as parseDiscordTarget, dt as normalizeDiscordSlug, jt as resolveChannelEntryMatchWithFallback, kt as normalizeChannelSlug } from "./send-DTB24bEF.js";
15
- import "./paths-vTM3Lh3X.js";
6
+ import { A as GroupPolicySchema, Ar as withFileLock, At as normalizePluginHttpPath, B as requireOpenAllowFrom, D as BlockStreamingCoalesceSchema, E as ToolPolicySchema, F as TtsAutoSchema, Hr as isSecretRef, I as TtsConfigSchema, L as TtsModeSchema, M as MarkdownTableModeSchema, N as ReplyRuntimeConfigSchemaShape, O as DmConfigSchema, P as SecretInputSchema, Pr as formatCliCommand, R as TtsProviderSchema, Ur as normalizeResolvedSecretInputString, Vr as hasConfiguredSecretInput, Wr as normalizeSecretInputString, c as WhatsAppConfigSchema, d as IMessageConfigSchema, ei as isTruthyEnvValue, f as MSTeamsConfigSchema, fr as resolveSecretRefString, h as TelegramConfigSchema, j as MarkdownConfigSchema, k as DmPolicySchema, kr as acquireFileLock, l as DiscordConfigSchema, m as SlackConfigSchema, p as SignalConfigSchema, u as GoogleChatConfigSchema, vr as isValidFileSecretRefId, xr as encodeJsonPointerToken, yr as resolveDefaultSecretProviderAlias, yt as getChatChannelMeta, z as normalizeAllowFrom, zr as assertSecretInputResolved } from "./config-C0yrNwfy.js";
7
+ import { A as sleep, C as pathExists, D as safeParseJson, K as registerLogTransport, S as normalizeE164, X as resolvePreferredOpenClawTmpDir, _ as escapeRegExp, f as CONFIG_DIR, o as stripAnsi, p as clamp, y as isRecord } from "./logger-BCdjejtB.js";
8
+ import { A as resolveWhatsAppGroupToolPolicy, B as normalizeWhatsAppMessagingTarget, C as resolveIMessageGroupRequireMention, D as resolveTelegramGroupRequireMention, E as resolveSlackGroupToolPolicy, F as resolveIMessageConfigDefaultTo, H as trimMessagingTarget, I as resolveWhatsAppConfigAllowFrom, K as resolveToolsBySender, L as resolveWhatsAppConfigDefaultTo, M as formatTrimmedAllowFromEntries, N as formatWhatsAppConfigAllowFromEntries, O as resolveTelegramGroupToolPolicy, P as resolveIMessageConfigAllowFrom, R as looksLikeWhatsAppTargetId, S as resolveGoogleChatGroupToolPolicy, T as resolveSlackGroupRequireMention, V as looksLikeHandleOrPhoneTarget, _ as resolveBlueBubblesGroupRequireMention, b as resolveDiscordGroupToolPolicy, g as normalizeSignalMessagingTarget, h as looksLikeSignalTargetId, j as buildSlackThreadingToolContext, k as resolveWhatsAppGroupRequireMention, m as resolveWhatsAppMentionStripPatterns, p as resolveWhatsAppGroupIntroHint, v as resolveBlueBubblesGroupToolPolicy, w as resolveIMessageGroupToolPolicy, x as resolveGoogleChatGroupRequireMention, y as resolveDiscordGroupRequireMention, z as normalizeWhatsAppAllowFromEntries } from "./thinking-C72i4GK3.js";
9
+ import { c as detectMime, l as extensionForMime, u as getFileExtension } from "./image-ops-BR4AoqcN.js";
10
+ import "./pi-embedded-helpers-yP_sNpsD.js";
11
+ import { A as listSlackAccountIds, C as resolveTelegramAccount, D as listConfiguredAccountIds, H as resolveDiscordAccount, I as isWhatsAppGroupJid, L as normalizeWhatsAppTarget, M as resolveSlackAccount, N as resolveSlackReplyToMode, O as resolveAccountWithDefaultFallback, S as resolveDefaultTelegramAccountId, V as resolveDefaultDiscordAccountId, a as listDiscordDirectoryPeersFromConfig, c as listTelegramDirectoryGroupsFromConfig, d as listWhatsAppDirectoryPeersFromConfig, f as looksLikeSlackTargetId, i as listDiscordDirectoryGroupsFromConfig, j as resolveDefaultSlackAccountId, k as listEnabledSlackAccounts, l as listTelegramDirectoryPeersFromConfig, o as listSlackDirectoryGroupsFromConfig, p as normalizeSlackMessagingTarget, s as listSlackDirectoryPeersFromConfig, u as listWhatsAppDirectoryGroupsFromConfig, x as listTelegramAccountIds, z as listDiscordAccountIds } from "./plugins-D8WXr9FM.js";
12
+ import { n as resolveDefaultIMessageAccountId, r as resolveIMessageAccount, t as listIMessageAccountIds } from "./accounts-DTu9vqDO.js";
13
+ import { i as resolveSignalAccount, n as listSignalAccountIds, r as resolveDefaultSignalAccountId } from "./accounts-DjdShDhq.js";
14
+ import { At as resolveChannelEntryMatch, Mt as resolveNestedAllowlistDecision, Ot as buildChannelKeyCandidates, at as parseDiscordTarget, dt as normalizeDiscordSlug, jt as resolveChannelEntryMatchWithFallback, kt as normalizeChannelSlug } from "./send-84VBmNFp.js";
15
+ import "./paths-B0X69k-w.js";
16
16
  import "./fetch-Bv4TQOMH.js";
17
- import { t as redactSensitiveText } from "./redact-DjVX-1N3.js";
18
- import { r as formatErrorMessage } from "./errors-DaiAM-yU.js";
19
- import "./channel-activity-F3d0yUwy.js";
20
- import "./path-alias-guards-DBjLbIX_.js";
21
- import { a as openWritableFileWithinRoot, t as SafeOpenError } from "./fs-safe-B8y811FR.js";
22
- import { a as isBlockedHostnameOrIp, i as isBlockedHostname, o as isPrivateIpAddress, t as SsrFBlockedError } from "./ssrf-cFtplYtS.js";
23
- import { t as fetchWithSsrFGuard } from "./fetch-guard-DETCcJzQ.js";
24
- import "./local-roots-BUP4YBmR.js";
25
- import { p as chunkTextByBreakResolver, v as loadWebMedia } from "./ir-DQ7_HbvK.js";
17
+ import { t as redactSensitiveText } from "./redact-DvmglYXB.js";
18
+ import { r as formatErrorMessage } from "./errors-CSTn-hBe.js";
19
+ import "./channel-activity-C6oLeD1j.js";
20
+ import "./path-alias-guards--iqVU8bT.js";
21
+ import { a as openWritableFileWithinRoot, t as SafeOpenError } from "./fs-safe-CAyFBxNw.js";
22
+ import { a as isBlockedHostnameOrIp, i as isBlockedHostname, o as isPrivateIpAddress, t as SsrFBlockedError } from "./ssrf-cxGNhMo3.js";
23
+ import { t as fetchWithSsrFGuard } from "./fetch-guard-CHz3X-3e.js";
24
+ import "./local-roots-CdjCtqsK.js";
25
+ import { p as chunkTextByBreakResolver, v as loadWebMedia } from "./ir-CiHyL7CG.js";
26
26
  import "./render-HmipMDlP.js";
27
- import "./tables-C47P4GTN.js";
28
- import { c as parseChatAllowTargetPrefixes, d as resolveServicePrefixedTarget, f as formatAllowFromLowercase, l as parseChatTargetPrefixesOrThrow, m as isNormalizedSenderAllowed, o as normalizeIMessageHandle, p as isAllowedParsedChatSender, u as resolveServicePrefixedAllowTarget } from "./send-DfHadjZ_.js";
29
- import { J as isWSL2Sync, K as formatLocationText, X as isWSLSync, Y as isWSLEnv, nt as readJsonFileWithFallback, q as toLocationContext, rt as writeJsonFileAtomically } from "./send-CQpMudwO.js";
30
- import "./tool-images-Gk_-0y2N.js";
31
- import { d as readNumberParam, f as readReactionParams, h as readStringParam, l as jsonResult, n as missingTargetError, o as createActionGate } from "./target-errors-Blia4S69.js";
32
- import { s as parseSlackBlocksInput } from "./send-DQHLzVyO.js";
33
- import { b as buildRandomTempFilePath, x as withTempDownloadPath } from "./audio-transcription-runner-DkoPNPYt.js";
27
+ import "./tables-Db3TVK0K.js";
28
+ import { c as parseChatAllowTargetPrefixes, d as resolveServicePrefixedTarget, f as formatAllowFromLowercase, l as parseChatTargetPrefixesOrThrow, m as isNormalizedSenderAllowed, o as normalizeIMessageHandle, p as isAllowedParsedChatSender, u as resolveServicePrefixedAllowTarget } from "./send-DbhIVcUv.js";
29
+ import { J as isWSL2Sync, K as formatLocationText, X as isWSLSync, Y as isWSLEnv, nt as readJsonFileWithFallback, q as toLocationContext, rt as writeJsonFileAtomically } from "./send-CE7khF2S.js";
30
+ import "./tool-images-9Itpokny.js";
31
+ import { d as readNumberParam, f as readReactionParams, h as readStringParam, l as jsonResult, n as missingTargetError, o as createActionGate } from "./target-errors-COPp3hey.js";
32
+ import { s as parseSlackBlocksInput } from "./send-DVN4HyFu.js";
33
+ import { b as buildRandomTempFilePath, x as withTempDownloadPath } from "./audio-transcription-runner-BVLz4alM.js";
34
34
  import { a as resolveWindowsSpawnProgramCandidate, i as resolveWindowsSpawnProgram, n as materializeWindowsSpawnProgram, r as resolveWindowsExecutablePath, t as applyWindowsSpawnProgramPolicy } from "./windows-spawn-E2JqbJ-S.js";
35
- import { i as isSilentReplyText, n as SILENT_REPLY_TOKEN } from "./tokens-DgNRBwIg.js";
36
- import { n as listSkillCommandsForAgents } from "./skill-commands-CkGeFUMl.js";
37
- import "./skills-CBkHBYPq.js";
38
- import { J as rawDataToString } from "./chrome-BXoCyCkY.js";
39
- import { A as resolveChannelMediaMaxBytes } from "./deliver-B6AG_l67.js";
40
- import { g as onDiagnosticEvent, h as isDiagnosticsEnabled, m as emitDiagnosticEvent } from "./diagnostic-CsP-lEkI.js";
41
- import { r as extractOriginalFilename } from "./store-5nyxY3WU.js";
42
- import "./commands-registry-t7cXBTfN.js";
35
+ import { i as isSilentReplyText, n as SILENT_REPLY_TOKEN } from "./tokens-V02dmC1o.js";
36
+ import { n as listSkillCommandsForAgents } from "./skill-commands-4LbA80z8.js";
37
+ import "./skills-CwiK4DZ0.js";
38
+ import { J as rawDataToString } from "./chrome-Bv_J75Fj.js";
39
+ import { A as resolveChannelMediaMaxBytes } from "./deliver-Cy1mvDfK.js";
40
+ import { g as onDiagnosticEvent, h as isDiagnosticsEnabled, m as emitDiagnosticEvent } from "./diagnostic-Cy9gwgmM.js";
41
+ import { r as extractOriginalFilename } from "./store-BeHOf5uA.js";
42
+ import "./commands-registry-RhaS8hVZ.js";
43
43
  import { n as normalizeTelegramLookupTarget, r as parseTelegramTarget } from "./targets-D46Aqz9j.js";
44
- import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-B42qgQS9.js";
45
- import { r as resolveWhatsAppHeartbeatRecipients } from "./channel-web-QF7EpjeP.js";
46
- import "./image-DjTEkYZE.js";
47
- import "./api-key-rotation-BRE4X2tf.js";
48
- import "./proxy-fetch-ChxOhWF4.js";
49
- import "./pi-model-discovery-v-XPUOOf.js";
50
- import "./send-XXlW2iny.js";
51
- import "./outbound-attachment-Dy6fyf6H.js";
44
+ import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-D_dbLb1d.js";
45
+ import { r as resolveWhatsAppHeartbeatRecipients } from "./channel-web-DHx7fmo1.js";
46
+ import "./image-B1pTRNow.js";
47
+ import "./api-key-rotation-CGB3Vlsa.js";
48
+ import "./proxy-fetch-CkRgWOG1.js";
49
+ import "./pi-model-discovery-DX1ynqDO.js";
50
+ import "./send-DNkrevDM.js";
51
+ import "./outbound-attachment-n8QtvUtQ.js";
52
52
  import "./proxy-BKdNrmWL.js";
53
- import "./manager-I6KbPihW.js";
54
- import "./query-expansion-CeyKUeDW.js";
55
- import "./outbound-NS6UHnB6.js";
56
- import "./session-6TF6MyaC.js";
57
- import { t as loginWeb } from "./login-BxEKLlCo.js";
53
+ import "./manager-OqavXC3-.js";
54
+ import "./query-expansion-BEInImYs.js";
55
+ import "./outbound-DJzUZ5KM.js";
56
+ import "./session-C1RTgYcm.js";
57
+ import { t as loginWeb } from "./login-DIjFmnER.js";
58
58
  import fs, { createWriteStream } from "node:fs";
59
59
  import path from "node:path";
60
60
  import os from "node:os";
@@ -5,7 +5,7 @@ import fs, { constants } from "node:fs";
5
5
  import os from "node:os";
6
6
  import chalk, { Chalk } from "chalk";
7
7
  import { Logger } from "tslog";
8
- import JSON5 from "json5";
8
+ import json5 from "json5";
9
9
  import util, { promisify } from "node:util";
10
10
  import fs$1 from "node:fs/promises";
11
11
  import process$1 from "node:process";
@@ -400,7 +400,7 @@ function readLoggingConfig() {
400
400
  try {
401
401
  if (!fs.existsSync(configPath)) return;
402
402
  const raw = fs.readFileSync(configPath, "utf-8");
403
- const logging = JSON5.parse(raw)?.logging;
403
+ const logging = json5.parse(raw)?.logging;
404
404
  if (!logging || typeof logging !== "object" || Array.isArray(logging)) return;
405
405
  return logging;
406
406
  } catch {
@@ -4481,7 +4481,7 @@ function resolveOpenClawManifestBlock(params) {
4481
4481
  const raw = getFrontmatterString(params.frontmatter, params.key ?? "metadata");
4482
4482
  if (!raw) return;
4483
4483
  try {
4484
- const parsed = JSON5.parse(raw);
4484
+ const parsed = json5.parse(raw);
4485
4485
  if (!parsed || typeof parsed !== "object") return;
4486
4486
  const manifestKeys = [MANIFEST_KEY, ...LEGACY_MANIFEST_KEYS];
4487
4487
  for (const key of manifestKeys) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-multi-auto",
3
- "version": "1.6.1",
3
+ "version": "1.6.5",
4
4
  "description": "Multi-channel AI gateway with extensible messaging integrations",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/openclaw/openclaw#readme",
@@ -97,13 +97,13 @@ fi
97
97
  # --- 7. 核心代码同步 (物理对齐) ---
98
98
  echo -e "${BLUE}🔄 分发代码产物...${NC}"
99
99
  rm -rf "$DIST_DIR" && mkdir -p "$DIST_DIR"
100
- if [ -d "${SOURCE_CODE}/dist" ]; then
101
- cp -r "${SOURCE_CODE}/dist/." "${DIST_DIR}/"
100
+ if [ -d "${SOURCE_CODE}" ]; then
101
+ cp -r "${SOURCE_CODE}/." "${DIST_DIR}/"
102
102
  echo "cp exit code: $?"
103
103
 
104
- if [ -f "${DIST_DIR}/index.js" ]; then
105
- for chunk in $(grep -oE "utils-[A-Za-z0-9]+\.js" "${DIST_DIR}/index.js" 2>/dev/null | sort -u); do
106
- if [ ! -f "${DIST_DIR}/${chunk}" ]; then
104
+ if [ -f "${DIST_DIR}/dist/index.js" ]; then
105
+ for chunk in $(grep -oE "utils-[A-Za-z0-9]+\.js" "${DIST_DIR}/dist/index.js" 2>/dev/null | sort -u); do
106
+ if [ ! -f "${DIST_DIR}/dist/${chunk}" ]; then
107
107
  echo -e "${RED}❌ 致命错误: dist 缺失关键模块 ${chunk}${NC}"
108
108
  echo -e "${YELLOW}请在源码端执行: rm -rf dist && pnpm build && npm publish${NC}"
109
109
  exit 1
@@ -111,13 +111,22 @@ if [ -d "${SOURCE_CODE}/dist" ]; then
111
111
  done
112
112
  fi
113
113
  else
114
- echo -e "${RED}❌ 错误: 母本 dist 不存在${NC}"
114
+ echo -e "${RED}❌ 错误: 母本源码目录 ${SOURCE_CODE} 不存在${NC}"
115
115
  exit 1
116
116
  fi
117
117
 
118
118
  cp "${SOURCE_CODE}/package.json" "${INSTANCE_DIR}/package.json"
119
119
  [ -f "${SOURCE_CODE}/pnpm-lock.yaml" ] && cp "${SOURCE_CODE}/pnpm-lock.yaml" "${INSTANCE_DIR}/pnpm-lock.yaml"
120
120
 
121
+ # 复制 extensions 目录到实例目录(包含 page-action-cache, feishu 等)
122
+ # 多实例架构:每个实例完全隔离,运行自己的扩展
123
+ if [ -d "${SOURCE_CODE}/extensions" ]; then
124
+ echo -e "${YELLOW}📁 复制 extensions 目录到实例目录...${NC}"
125
+ cp -r "${SOURCE_CODE}/extensions/" "${INSTANCE_DIR}/extensions"
126
+ echo -e "${GREEN}✅ extensions 目录复制完成${NC}"
127
+ echo -e "${BLUE}📂 实例扩展目录: ${INSTANCE_DIR}/extensions${NC}"
128
+ fi
129
+
121
130
  # 复制 control-ui(如果存在)
122
131
  if [ -d "${SOURCE_CODE}/dist/control-ui" ]; then
123
132
  cp -r "${SOURCE_CODE}/dist/control-ui" "${INSTANCE_DIR}/dist/"
@@ -1,35 +0,0 @@
1
- import { ot as normalizeAccountId } from "./run-with-concurrency-Bt_ks0Qa.js";
2
- import { v as resolveAccountEntry, y as createAccountListHelpers } from "./accounts-DP1-L-QS.js";
3
-
4
- //#region src/imessage/accounts.ts
5
- const { listAccountIds, resolveDefaultAccountId } = createAccountListHelpers("imessage");
6
- const listIMessageAccountIds = listAccountIds;
7
- const resolveDefaultIMessageAccountId = resolveDefaultAccountId;
8
- function resolveAccountConfig(cfg, accountId) {
9
- return resolveAccountEntry(cfg.channels?.imessage?.accounts, accountId);
10
- }
11
- function mergeIMessageAccountConfig(cfg, accountId) {
12
- const { accounts: _ignored, ...base } = cfg.channels?.imessage ?? {};
13
- const account = resolveAccountConfig(cfg, accountId) ?? {};
14
- return {
15
- ...base,
16
- ...account
17
- };
18
- }
19
- function resolveIMessageAccount(params) {
20
- const accountId = normalizeAccountId(params.accountId);
21
- const baseEnabled = params.cfg.channels?.imessage?.enabled !== false;
22
- const merged = mergeIMessageAccountConfig(params.cfg, accountId);
23
- const accountEnabled = merged.enabled !== false;
24
- const configured = Boolean(merged.cliPath?.trim() || merged.dbPath?.trim() || merged.service || merged.region?.trim() || merged.allowFrom && merged.allowFrom.length > 0 || merged.groupAllowFrom && merged.groupAllowFrom.length > 0 || merged.dmPolicy || merged.groupPolicy || typeof merged.includeAttachments === "boolean" || merged.attachmentRoots && merged.attachmentRoots.length > 0 || merged.remoteAttachmentRoots && merged.remoteAttachmentRoots.length > 0 || typeof merged.mediaMaxMb === "number" || typeof merged.textChunkLimit === "number" || merged.groups && Object.keys(merged.groups).length > 0);
25
- return {
26
- accountId,
27
- enabled: baseEnabled && accountEnabled,
28
- name: merged.name?.trim() || void 0,
29
- config: merged,
30
- configured
31
- };
32
- }
33
-
34
- //#endregion
35
- export { resolveDefaultIMessageAccountId as n, resolveIMessageAccount as r, listIMessageAccountIds as t };
@@ -1,288 +0,0 @@
1
- import { at as DEFAULT_ACCOUNT_ID, ot as normalizeAccountId, st as normalizeOptionalAccountId } from "./run-with-concurrency-Bt_ks0Qa.js";
2
- import { o as resolveOAuthDir } from "./paths-MKyEVmEb.js";
3
- import { Pr as formatCliCommand } from "./config-BkEnz2Po.js";
4
- import { B as success, E as resolveUserPath, G as getChildLogger, I as info, c as defaultRuntime, x as jidToE164 } from "./logger-CZY9KIoY.js";
5
- import fs from "node:fs";
6
- import path from "node:path";
7
- import fs$1 from "node:fs/promises";
8
-
9
- //#region src/channels/plugins/account-helpers.ts
10
- function createAccountListHelpers(channelKey) {
11
- function resolveConfiguredDefaultAccountId(cfg) {
12
- const channel = cfg.channels?.[channelKey];
13
- const preferred = normalizeOptionalAccountId(typeof channel?.defaultAccount === "string" ? channel.defaultAccount : void 0);
14
- if (!preferred) return;
15
- if (listAccountIds(cfg).some((id) => normalizeAccountId(id) === preferred)) return preferred;
16
- }
17
- function listConfiguredAccountIds(cfg) {
18
- const accounts = (cfg.channels?.[channelKey])?.accounts;
19
- if (!accounts || typeof accounts !== "object") return [];
20
- return Object.keys(accounts).filter(Boolean);
21
- }
22
- function listAccountIds(cfg) {
23
- const ids = listConfiguredAccountIds(cfg);
24
- if (ids.length === 0) return [DEFAULT_ACCOUNT_ID];
25
- return ids.toSorted((a, b) => a.localeCompare(b));
26
- }
27
- function resolveDefaultAccountId(cfg) {
28
- const preferred = resolveConfiguredDefaultAccountId(cfg);
29
- if (preferred) return preferred;
30
- const ids = listAccountIds(cfg);
31
- if (ids.includes(DEFAULT_ACCOUNT_ID)) return DEFAULT_ACCOUNT_ID;
32
- return ids[0] ?? DEFAULT_ACCOUNT_ID;
33
- }
34
- return {
35
- listConfiguredAccountIds,
36
- listAccountIds,
37
- resolveDefaultAccountId
38
- };
39
- }
40
-
41
- //#endregion
42
- //#region src/routing/account-lookup.ts
43
- function resolveAccountEntry(accounts, accountId) {
44
- if (!accounts || typeof accounts !== "object") return;
45
- if (Object.hasOwn(accounts, accountId)) return accounts[accountId];
46
- const normalized = accountId.toLowerCase();
47
- const matchKey = Object.keys(accounts).find((key) => key.toLowerCase() === normalized);
48
- return matchKey ? accounts[matchKey] : void 0;
49
- }
50
-
51
- //#endregion
52
- //#region src/web/auth-store.ts
53
- function resolveDefaultWebAuthDir() {
54
- return path.join(resolveOAuthDir(), "whatsapp", DEFAULT_ACCOUNT_ID);
55
- }
56
- const WA_WEB_AUTH_DIR = resolveDefaultWebAuthDir();
57
- function resolveWebCredsPath(authDir) {
58
- return path.join(authDir, "creds.json");
59
- }
60
- function resolveWebCredsBackupPath(authDir) {
61
- return path.join(authDir, "creds.json.bak");
62
- }
63
- function hasWebCredsSync(authDir) {
64
- try {
65
- const stats = fs.statSync(resolveWebCredsPath(authDir));
66
- return stats.isFile() && stats.size > 1;
67
- } catch {
68
- return false;
69
- }
70
- }
71
- function readCredsJsonRaw(filePath) {
72
- try {
73
- if (!fs.existsSync(filePath)) return null;
74
- const stats = fs.statSync(filePath);
75
- if (!stats.isFile() || stats.size <= 1) return null;
76
- return fs.readFileSync(filePath, "utf-8");
77
- } catch {
78
- return null;
79
- }
80
- }
81
- function maybeRestoreCredsFromBackup(authDir) {
82
- const logger = getChildLogger({ module: "web-session" });
83
- try {
84
- const credsPath = resolveWebCredsPath(authDir);
85
- const backupPath = resolveWebCredsBackupPath(authDir);
86
- const raw = readCredsJsonRaw(credsPath);
87
- if (raw) {
88
- JSON.parse(raw);
89
- return;
90
- }
91
- const backupRaw = readCredsJsonRaw(backupPath);
92
- if (!backupRaw) return;
93
- JSON.parse(backupRaw);
94
- fs.copyFileSync(backupPath, credsPath);
95
- try {
96
- fs.chmodSync(credsPath, 384);
97
- } catch {}
98
- logger.warn({ credsPath }, "restored corrupted WhatsApp creds.json from backup");
99
- } catch {}
100
- }
101
- async function webAuthExists(authDir = resolveDefaultWebAuthDir()) {
102
- const resolvedAuthDir = resolveUserPath(authDir);
103
- maybeRestoreCredsFromBackup(resolvedAuthDir);
104
- const credsPath = resolveWebCredsPath(resolvedAuthDir);
105
- try {
106
- await fs$1.access(resolvedAuthDir);
107
- } catch {
108
- return false;
109
- }
110
- try {
111
- const stats = await fs$1.stat(credsPath);
112
- if (!stats.isFile() || stats.size <= 1) return false;
113
- const raw = await fs$1.readFile(credsPath, "utf-8");
114
- JSON.parse(raw);
115
- return true;
116
- } catch {
117
- return false;
118
- }
119
- }
120
- async function clearLegacyBaileysAuthState(authDir) {
121
- const entries = await fs$1.readdir(authDir, { withFileTypes: true });
122
- const shouldDelete = (name) => {
123
- if (name === "oauth.json") return false;
124
- if (name === "creds.json" || name === "creds.json.bak") return true;
125
- if (!name.endsWith(".json")) return false;
126
- return /^(app-state-sync|session|sender-key|pre-key)-/.test(name);
127
- };
128
- await Promise.all(entries.map(async (entry) => {
129
- if (!entry.isFile()) return;
130
- if (!shouldDelete(entry.name)) return;
131
- await fs$1.rm(path.join(authDir, entry.name), { force: true });
132
- }));
133
- }
134
- async function logoutWeb(params) {
135
- const runtime = params.runtime ?? defaultRuntime;
136
- const resolvedAuthDir = resolveUserPath(params.authDir ?? resolveDefaultWebAuthDir());
137
- if (!await webAuthExists(resolvedAuthDir)) {
138
- runtime.log(info("No WhatsApp Web session found; nothing to delete."));
139
- return false;
140
- }
141
- if (params.isLegacyAuthDir) await clearLegacyBaileysAuthState(resolvedAuthDir);
142
- else await fs$1.rm(resolvedAuthDir, {
143
- recursive: true,
144
- force: true
145
- });
146
- runtime.log(success("Cleared WhatsApp Web credentials."));
147
- return true;
148
- }
149
- function readWebSelfId(authDir = resolveDefaultWebAuthDir()) {
150
- try {
151
- const credsPath = resolveWebCredsPath(resolveUserPath(authDir));
152
- if (!fs.existsSync(credsPath)) return {
153
- e164: null,
154
- jid: null
155
- };
156
- const raw = fs.readFileSync(credsPath, "utf-8");
157
- const jid = JSON.parse(raw)?.me?.id ?? null;
158
- return {
159
- e164: jid ? jidToE164(jid, { authDir }) : null,
160
- jid
161
- };
162
- } catch {
163
- return {
164
- e164: null,
165
- jid: null
166
- };
167
- }
168
- }
169
- /**
170
- * Return the age (in milliseconds) of the cached WhatsApp web auth state, or null when missing.
171
- * Helpful for heartbeats/observability to spot stale credentials.
172
- */
173
- function getWebAuthAgeMs(authDir = resolveDefaultWebAuthDir()) {
174
- try {
175
- const stats = fs.statSync(resolveWebCredsPath(resolveUserPath(authDir)));
176
- return Date.now() - stats.mtimeMs;
177
- } catch {
178
- return null;
179
- }
180
- }
181
- function logWebSelfId(authDir = resolveDefaultWebAuthDir(), runtime = defaultRuntime, includeChannelPrefix = false) {
182
- const { e164, jid } = readWebSelfId(authDir);
183
- const details = e164 || jid ? `${e164 ?? "unknown"}${jid ? ` (jid ${jid})` : ""}` : "unknown";
184
- const prefix = includeChannelPrefix ? "Web Channel: " : "";
185
- runtime.log(info(`${prefix}${details}`));
186
- }
187
- async function pickWebChannel(pref, authDir = resolveDefaultWebAuthDir()) {
188
- const choice = pref === "auto" ? "web" : pref;
189
- if (!await webAuthExists(authDir)) throw new Error(`No WhatsApp Web session found. Run \`${formatCliCommand("openclaw channels login --channel whatsapp --verbose")}\` to link.`);
190
- return choice;
191
- }
192
-
193
- //#endregion
194
- //#region src/web/accounts.ts
195
- const { listConfiguredAccountIds, listAccountIds, resolveDefaultAccountId } = createAccountListHelpers("whatsapp");
196
- const listWhatsAppAccountIds = listAccountIds;
197
- const resolveDefaultWhatsAppAccountId = resolveDefaultAccountId;
198
- function listWhatsAppAuthDirs(cfg) {
199
- const oauthDir = resolveOAuthDir();
200
- const whatsappDir = path.join(oauthDir, "whatsapp");
201
- const authDirs = new Set([oauthDir, path.join(whatsappDir, DEFAULT_ACCOUNT_ID)]);
202
- const accountIds = listConfiguredAccountIds(cfg);
203
- for (const accountId of accountIds) authDirs.add(resolveWhatsAppAuthDir({
204
- cfg,
205
- accountId
206
- }).authDir);
207
- try {
208
- const entries = fs.readdirSync(whatsappDir, { withFileTypes: true });
209
- for (const entry of entries) {
210
- if (!entry.isDirectory()) continue;
211
- authDirs.add(path.join(whatsappDir, entry.name));
212
- }
213
- } catch {}
214
- return Array.from(authDirs);
215
- }
216
- function hasAnyWhatsAppAuth(cfg) {
217
- return listWhatsAppAuthDirs(cfg).some((authDir) => hasWebCredsSync(authDir));
218
- }
219
- function resolveAccountConfig(cfg, accountId) {
220
- return resolveAccountEntry(cfg.channels?.whatsapp?.accounts, accountId);
221
- }
222
- function resolveDefaultAuthDir(accountId) {
223
- return path.join(resolveOAuthDir(), "whatsapp", normalizeAccountId(accountId));
224
- }
225
- function resolveLegacyAuthDir() {
226
- return resolveOAuthDir();
227
- }
228
- function legacyAuthExists(authDir) {
229
- try {
230
- return fs.existsSync(path.join(authDir, "creds.json"));
231
- } catch {
232
- return false;
233
- }
234
- }
235
- function resolveWhatsAppAuthDir(params) {
236
- const accountId = params.accountId.trim() || DEFAULT_ACCOUNT_ID;
237
- const configured = resolveAccountConfig(params.cfg, accountId)?.authDir?.trim();
238
- if (configured) return {
239
- authDir: resolveUserPath(configured),
240
- isLegacy: false
241
- };
242
- const defaultDir = resolveDefaultAuthDir(accountId);
243
- if (accountId === DEFAULT_ACCOUNT_ID) {
244
- const legacyDir = resolveLegacyAuthDir();
245
- if (legacyAuthExists(legacyDir) && !legacyAuthExists(defaultDir)) return {
246
- authDir: legacyDir,
247
- isLegacy: true
248
- };
249
- }
250
- return {
251
- authDir: defaultDir,
252
- isLegacy: false
253
- };
254
- }
255
- function resolveWhatsAppAccount(params) {
256
- const rootCfg = params.cfg.channels?.whatsapp;
257
- const accountId = params.accountId?.trim() || resolveDefaultWhatsAppAccountId(params.cfg);
258
- const accountCfg = resolveAccountConfig(params.cfg, accountId);
259
- const enabled = accountCfg?.enabled !== false;
260
- const { authDir, isLegacy } = resolveWhatsAppAuthDir({
261
- cfg: params.cfg,
262
- accountId
263
- });
264
- return {
265
- accountId,
266
- name: accountCfg?.name?.trim() || void 0,
267
- enabled,
268
- sendReadReceipts: accountCfg?.sendReadReceipts ?? rootCfg?.sendReadReceipts ?? true,
269
- messagePrefix: accountCfg?.messagePrefix ?? rootCfg?.messagePrefix ?? params.cfg.messages?.messagePrefix,
270
- authDir,
271
- isLegacyAuthDir: isLegacy,
272
- selfChatMode: accountCfg?.selfChatMode ?? rootCfg?.selfChatMode,
273
- dmPolicy: accountCfg?.dmPolicy ?? rootCfg?.dmPolicy,
274
- allowFrom: accountCfg?.allowFrom ?? rootCfg?.allowFrom,
275
- groupAllowFrom: accountCfg?.groupAllowFrom ?? rootCfg?.groupAllowFrom,
276
- groupPolicy: accountCfg?.groupPolicy ?? rootCfg?.groupPolicy,
277
- textChunkLimit: accountCfg?.textChunkLimit ?? rootCfg?.textChunkLimit,
278
- chunkMode: accountCfg?.chunkMode ?? rootCfg?.chunkMode,
279
- mediaMaxMb: accountCfg?.mediaMaxMb ?? rootCfg?.mediaMaxMb,
280
- blockStreaming: accountCfg?.blockStreaming ?? rootCfg?.blockStreaming,
281
- ackReaction: accountCfg?.ackReaction ?? rootCfg?.ackReaction,
282
- groups: accountCfg?.groups ?? rootCfg?.groups,
283
- debounceMs: accountCfg?.debounceMs ?? rootCfg?.debounceMs
284
- };
285
- }
286
-
287
- //#endregion
288
- export { webAuthExists as _, resolveWhatsAppAuthDir as a, logWebSelfId as c, pickWebChannel as d, readCredsJsonRaw as f, resolveWebCredsPath as g, resolveWebCredsBackupPath as h, resolveWhatsAppAccount as i, logoutWeb as l, resolveDefaultWebAuthDir as m, listWhatsAppAccountIds as n, WA_WEB_AUTH_DIR as o, readWebSelfId as p, resolveDefaultWhatsAppAccountId as r, getWebAuthAgeMs as s, hasAnyWhatsAppAuth as t, maybeRestoreCredsFromBackup as u, resolveAccountEntry as v, createAccountListHelpers as y };
@@ -1,46 +0,0 @@
1
- import { ot as normalizeAccountId } from "./run-with-concurrency-Bt_ks0Qa.js";
2
- import { v as resolveAccountEntry, y as createAccountListHelpers } from "./accounts-DP1-L-QS.js";
3
-
4
- //#region src/signal/accounts.ts
5
- const { listAccountIds, resolveDefaultAccountId } = createAccountListHelpers("signal");
6
- const listSignalAccountIds = listAccountIds;
7
- const resolveDefaultSignalAccountId = resolveDefaultAccountId;
8
- function resolveAccountConfig(cfg, accountId) {
9
- return resolveAccountEntry(cfg.channels?.signal?.accounts, accountId);
10
- }
11
- function mergeSignalAccountConfig(cfg, accountId) {
12
- const { accounts: _ignored, ...base } = cfg.channels?.signal ?? {};
13
- const account = resolveAccountConfig(cfg, accountId) ?? {};
14
- return {
15
- ...base,
16
- ...account
17
- };
18
- }
19
- function resolveSignalAccount(params) {
20
- const accountId = normalizeAccountId(params.accountId);
21
- const baseEnabled = params.cfg.channels?.signal?.enabled !== false;
22
- const merged = mergeSignalAccountConfig(params.cfg, accountId);
23
- const accountEnabled = merged.enabled !== false;
24
- const enabled = baseEnabled && accountEnabled;
25
- const host = merged.httpHost?.trim() || "127.0.0.1";
26
- const port = merged.httpPort ?? 8080;
27
- const baseUrl = merged.httpUrl?.trim() || `http://${host}:${port}`;
28
- const configured = Boolean(merged.account?.trim() || merged.httpUrl?.trim() || merged.cliPath?.trim() || merged.httpHost?.trim() || typeof merged.httpPort === "number" || typeof merged.autoStart === "boolean");
29
- return {
30
- accountId,
31
- enabled,
32
- name: merged.name?.trim() || void 0,
33
- baseUrl,
34
- configured,
35
- config: merged
36
- };
37
- }
38
- function listEnabledSignalAccounts(cfg) {
39
- return listSignalAccountIds(cfg).map((accountId) => resolveSignalAccount({
40
- cfg,
41
- accountId
42
- })).filter((account) => account.enabled);
43
- }
44
-
45
- //#endregion
46
- export { resolveSignalAccount as i, listSignalAccountIds as n, resolveDefaultSignalAccountId as r, listEnabledSignalAccounts as t };