openclaw-multi-auto 1.4.4 → 1.4.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 (175) 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/{accounts-C3m65--E.js → accounts-BJAXxY46.js} +2 -2
  4. package/dist/plugin-sdk/{accounts-CNCCkdEF.js → accounts-C1j7HSL0.js} +3 -3
  5. package/dist/plugin-sdk/{accounts-BslAlVYS.js → accounts-DyFCXtHv.js} +2 -2
  6. package/dist/plugin-sdk/{active-listener-B_sLJTXM.js → active-listener-CftX5jLD.js} +2 -2
  7. package/dist/plugin-sdk/{api-key-rotation-BRE4X2tf.js → api-key-rotation-8nyyt1kx.js} +2 -2
  8. package/dist/plugin-sdk/{audio-preflight-CtO4fFvp.js → audio-preflight-C_aSAPR1.js} +26 -26
  9. package/dist/plugin-sdk/{audio-transcription-runner-DnxvOS1-.js → audio-transcription-runner-CB53F7_7.js} +11 -11
  10. package/dist/plugin-sdk/{audit-membership-runtime-BpfoSk8M.js → audit-membership-runtime-BXndI4LG.js} +2 -2
  11. package/dist/plugin-sdk/{channel-activity-WJYxcJ3S.js → channel-activity-C5y8AgAV.js} +3 -3
  12. package/dist/plugin-sdk/{channel-web-dO5k3ubM.js → channel-web-DBTRO03V.js} +18 -18
  13. package/dist/plugin-sdk/{chrome-CjNTuJML.js → chrome-f00sZkDX.js} +6 -6
  14. package/dist/plugin-sdk/{commands-registry-CdYjoI0i.js → commands-registry-BJ_NxG2F.js} +4 -4
  15. package/dist/plugin-sdk/{common-oYc5vPFl.js → common-Cf27Jwxu.js} +2 -2
  16. package/dist/plugin-sdk/{config-B1z-UxQ3.js → config-CHQrpx-Q.js} +7 -7
  17. package/dist/plugin-sdk/{deliver-D5_6T567.js → deliver-DNEuetST.js} +10 -10
  18. package/dist/plugin-sdk/deliver-runtime-BFdqklJM.js +32 -0
  19. package/dist/plugin-sdk/deps-send-discord.runtime-DuqpYwU0.js +23 -0
  20. package/dist/plugin-sdk/deps-send-imessage.runtime-CZ2rS8Lb.js +22 -0
  21. package/dist/plugin-sdk/deps-send-signal.runtime-BdqiWhIh.js +21 -0
  22. package/dist/plugin-sdk/deps-send-slack.runtime-04s36qiC.js +19 -0
  23. package/dist/plugin-sdk/deps-send-telegram.runtime-LE5tkPvr.js +24 -0
  24. package/dist/plugin-sdk/deps-send-whatsapp.runtime-Bz57lobC.js +57 -0
  25. package/dist/plugin-sdk/{diagnostic-Bxxu0ig-.js → diagnostic-LYUUmjJ5.js} +2 -2
  26. package/dist/plugin-sdk/{errors-B3cHyZZA.js → errors-CtMWwS2Z.js} +1 -1
  27. package/dist/plugin-sdk/{fetch-guard-Dcgod0tg.js → fetch-guard-CxYB5Kg6.js} +2 -2
  28. package/dist/plugin-sdk/{fs-safe-BaKqI3G4.js → fs-safe-DtfhxbrI.js} +3 -3
  29. package/dist/plugin-sdk/{image-B2mQW9Rb.js → image-BwjYjRHx.js} +6 -6
  30. package/dist/plugin-sdk/{image-ops-Cbzr4U9l.js → image-ops-BnZKcbd6.js} +2 -2
  31. package/dist/plugin-sdk/image-runtime-B8twoubs.js +25 -0
  32. package/dist/plugin-sdk/index.js +50 -50
  33. package/dist/plugin-sdk/{ir-ZEmrTr4J.js → ir-Z4hX67TJ.js} +7 -7
  34. package/dist/plugin-sdk/{local-roots-CIPRxA-4.js → local-roots-KhjQw04O.js} +4 -4
  35. package/dist/plugin-sdk/{logger-CvPFVOgT.js → logger-DHIIvMxj.js} +2 -2
  36. package/dist/plugin-sdk/{login-CCTew9bt.js → login-C31642Ld.js} +4 -4
  37. package/dist/plugin-sdk/{login-qr-BI3Vi_wJ.js → login-qr--y2SG_Ue.js} +5 -5
  38. package/dist/plugin-sdk/{manager-BEoYPn7R.js → manager-2UZBMCc7.js} +8 -8
  39. package/dist/plugin-sdk/manager-runtime-CMeLwose.js +15 -0
  40. package/dist/plugin-sdk/mattermost.js +3 -3
  41. package/dist/plugin-sdk/{outbound-ByOw1K6W.js → outbound-Ba0QUI5h.js} +5 -5
  42. package/dist/plugin-sdk/{outbound-attachment-BzVhxRRw.js → outbound-attachment-B1Laso-8.js} +2 -2
  43. package/dist/plugin-sdk/{path-alias-guards-DBjLbIX_.js → path-alias-guards-C7Vm5DZ1.js} +1 -1
  44. package/dist/plugin-sdk/{paths-Dpg3qxcl.js → paths-DopV9PQG.js} +1 -1
  45. package/dist/plugin-sdk/{pi-embedded-helpers-DIxXkGJf.js → pi-embedded-helpers-DnA_OCzP.js} +16 -16
  46. package/dist/plugin-sdk/{pi-model-discovery-DM_2uFtj.js → pi-model-discovery-DdPqXk8f.js} +1 -1
  47. package/dist/plugin-sdk/pi-model-discovery-runtime-D8CJhtJY.js +8 -0
  48. package/dist/plugin-sdk/{pi-tools.before-tool-call.runtime-w1dqL_ty.js → pi-tools.before-tool-call.runtime-DxFHiLUE.js} +4 -4
  49. package/dist/plugin-sdk/{plugins-C4USiH29.js → plugins-CbCt4osF.js} +4 -4
  50. package/dist/plugin-sdk/{proxy-env-ET-rp8eg.js → proxy-env-C63mMdas.js} +1 -1
  51. package/dist/plugin-sdk/{proxy-fetch-ChxOhWF4.js → proxy-fetch-Ch95c_Y2.js} +1 -1
  52. package/dist/plugin-sdk/{pw-ai-CyOt3RDA.js → pw-ai-DpJk62D4.js} +9 -9
  53. package/dist/plugin-sdk/{qmd-manager-BySdoVR7.js → qmd-manager-Ca-iSfEE.js} +7 -7
  54. package/dist/plugin-sdk/{query-expansion-C6uS-7lj.js → query-expansion-B_Xe41Ab.js} +4 -4
  55. package/dist/plugin-sdk/{redact-DjVX-1N3.js → redact-hp9TOulW.js} +1 -1
  56. package/dist/plugin-sdk/{reply-CTCSeQqW.js → reply-CovBlFea.js} +73 -73
  57. package/dist/plugin-sdk/{resolve-outbound-target-Bw8YNANu.js → resolve-outbound-target-BbrHgyUk.js} +2 -2
  58. package/dist/plugin-sdk/{run-with-concurrency-C_KCHwvf.js → run-with-concurrency-BR1DXa8T.js} +1 -1
  59. package/dist/plugin-sdk/runtime-whatsapp-login.runtime-SkO91TZH.js +10 -0
  60. package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-B0VWK5hm.js +19 -0
  61. package/dist/plugin-sdk/{send-C0w6xP2x.js → send-BTztm3D2.js} +6 -6
  62. package/dist/plugin-sdk/{send-qPyNGSe4.js → send-BXpXBwM_.js} +13 -13
  63. package/dist/plugin-sdk/{send-BZ6nYFZr.js → send-BvAtLLPl.js} +5 -5
  64. package/dist/plugin-sdk/{send-CFf-1V89.js → send-CWJUuG0i.js} +8 -8
  65. package/dist/plugin-sdk/{send-CY-Qfwia.js → send-EcglC4cG.js} +7 -7
  66. package/dist/plugin-sdk/{session-COrvpvUQ.js → session-k256LJZT.js} +3 -3
  67. package/dist/plugin-sdk/{skill-commands-DZqhtmiv.js → skill-commands-DoRqLzxm.js} +4 -4
  68. package/dist/plugin-sdk/{skills-Cw_vXEJb.js → skills-QudILG6e.js} +6 -6
  69. package/dist/plugin-sdk/slash-commands.runtime-DS6vCNSL.js +13 -0
  70. package/dist/plugin-sdk/slash-dispatch.runtime-BXrxb2wd.js +52 -0
  71. package/dist/plugin-sdk/slash-skill-commands.runtime-Bd6qQ2oT.js +16 -0
  72. package/dist/plugin-sdk/{store-CMHj6IIw.js → store-BbDQw3g6.js} +2 -2
  73. package/dist/plugin-sdk/subagent-registry-runtime-1uwQbuXj.js +52 -0
  74. package/dist/plugin-sdk/{tables-CSqrHsKL.js → tables-BhvloMKN.js} +1 -1
  75. package/dist/plugin-sdk/{thinking-DOnsR_A8.js → thinking-URzkT-3p.js} +7 -7
  76. package/dist/plugin-sdk/{tokens-DgNRBwIg.js → tokens-B1PW5Ayy.js} +1 -1
  77. package/dist/plugin-sdk/{tool-images-Gk_-0y2N.js → tool-images-xpqbP6RR.js} +2 -2
  78. package/dist/plugin-sdk/web-B74yhL2N.js +56 -0
  79. package/dist/plugin-sdk/{whatsapp-actions-xcleMoMv.js → whatsapp-actions-RcZ6vp61.js} +17 -17
  80. package/dist/plugin-sdk/whatsapp.js +50 -50
  81. package/package.json +1 -1
  82. package/scripts/create-instance.sh +6 -0
  83. package/scripts/install-maca.sh +78 -87
  84. package/dist/plugin-sdk/accounts-CJWOBzwB.js +0 -35
  85. package/dist/plugin-sdk/accounts-DP1-L-QS.js +0 -288
  86. package/dist/plugin-sdk/accounts-DZhWlEg3.js +0 -46
  87. package/dist/plugin-sdk/active-listener-CkPnMUkB.js +0 -50
  88. package/dist/plugin-sdk/api-key-rotation-BXnNsojA.js +0 -181
  89. package/dist/plugin-sdk/audio-preflight-DGEUDxxR.js +0 -69
  90. package/dist/plugin-sdk/audio-transcription-runner-DkoPNPYt.js +0 -2176
  91. package/dist/plugin-sdk/audit-membership-runtime-DSBHHw7o.js +0 -58
  92. package/dist/plugin-sdk/channel-activity-F3d0yUwy.js +0 -94
  93. package/dist/plugin-sdk/channel-web-QF7EpjeP.js +0 -2256
  94. package/dist/plugin-sdk/chrome-BXoCyCkY.js +0 -2415
  95. package/dist/plugin-sdk/commands-registry-t7cXBTfN.js +0 -1125
  96. package/dist/plugin-sdk/config-BkEnz2Po.js +0 -17913
  97. package/dist/plugin-sdk/deliver-B6AG_l67.js +0 -1694
  98. package/dist/plugin-sdk/deliver-runtime-C5dgvvga.js +0 -32
  99. package/dist/plugin-sdk/deliver-runtime-D585kJZc.js +0 -32
  100. package/dist/plugin-sdk/deps-send-discord.runtime-Dg4N7PHJ.js +0 -23
  101. package/dist/plugin-sdk/deps-send-discord.runtime-a_OKY2js.js +0 -23
  102. package/dist/plugin-sdk/deps-send-imessage.runtime-0OEwzMQm.js +0 -22
  103. package/dist/plugin-sdk/deps-send-imessage.runtime-Baxy9TD4.js +0 -22
  104. package/dist/plugin-sdk/deps-send-signal.runtime-BM1jRt3G.js +0 -21
  105. package/dist/plugin-sdk/deps-send-signal.runtime-BwXoCrFl.js +0 -21
  106. package/dist/plugin-sdk/deps-send-slack.runtime-1E3BYRdF.js +0 -19
  107. package/dist/plugin-sdk/deps-send-slack.runtime-CLmKjgso.js +0 -19
  108. package/dist/plugin-sdk/deps-send-telegram.runtime-BKfdBKnZ.js +0 -24
  109. package/dist/plugin-sdk/deps-send-telegram.runtime-DNCxIflA.js +0 -24
  110. package/dist/plugin-sdk/deps-send-whatsapp.runtime-BOTwkbx_.js +0 -57
  111. package/dist/plugin-sdk/deps-send-whatsapp.runtime-OLwr-9c8.js +0 -57
  112. package/dist/plugin-sdk/diagnostic-CsP-lEkI.js +0 -319
  113. package/dist/plugin-sdk/errors-DaiAM-yU.js +0 -54
  114. package/dist/plugin-sdk/fetch-guard-DETCcJzQ.js +0 -156
  115. package/dist/plugin-sdk/fs-safe-B8y811FR.js +0 -352
  116. package/dist/plugin-sdk/image-DjTEkYZE.js +0 -2310
  117. package/dist/plugin-sdk/image-ops-BSiMpAw4.js +0 -584
  118. package/dist/plugin-sdk/image-runtime-6xPp8m5a.js +0 -25
  119. package/dist/plugin-sdk/image-runtime-BFm45j49.js +0 -25
  120. package/dist/plugin-sdk/ir-DQ7_HbvK.js +0 -1296
  121. package/dist/plugin-sdk/local-roots-BUP4YBmR.js +0 -186
  122. package/dist/plugin-sdk/logger-CZY9KIoY.js +0 -1163
  123. package/dist/plugin-sdk/login-BxEKLlCo.js +0 -57
  124. package/dist/plugin-sdk/login-qr-BQIpMPr9.js +0 -320
  125. package/dist/plugin-sdk/manager-I6KbPihW.js +0 -3917
  126. package/dist/plugin-sdk/manager-runtime-CFfYYWIQ.js +0 -15
  127. package/dist/plugin-sdk/manager-runtime-DxclHQ4U.js +0 -15
  128. package/dist/plugin-sdk/outbound-NS6UHnB6.js +0 -212
  129. package/dist/plugin-sdk/outbound-attachment-Dy6fyf6H.js +0 -19
  130. package/dist/plugin-sdk/path-alias-guards-sWayacde.js +0 -43
  131. package/dist/plugin-sdk/paths-vTM3Lh3X.js +0 -166
  132. package/dist/plugin-sdk/pi-embedded-helpers-1R1gu7eX.js +0 -9627
  133. package/dist/plugin-sdk/pi-model-discovery-runtime-BuzvkvNR.js +0 -8
  134. package/dist/plugin-sdk/pi-model-discovery-runtime-Do9o-dUd.js +0 -8
  135. package/dist/plugin-sdk/pi-model-discovery-v-XPUOOf.js +0 -134
  136. package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-D4sFsIks.js +0 -354
  137. package/dist/plugin-sdk/plugins-DeBZB9l_.js +0 -864
  138. package/dist/plugin-sdk/proxy-fetch-uDXGKG3Z.js +0 -38
  139. package/dist/plugin-sdk/pw-ai-DEOmCSSC.js +0 -1938
  140. package/dist/plugin-sdk/qmd-manager-HyYKoEch.js +0 -1448
  141. package/dist/plugin-sdk/query-expansion-CeyKUeDW.js +0 -1011
  142. package/dist/plugin-sdk/redact-Bvxt1T_Q.js +0 -319
  143. package/dist/plugin-sdk/reply-DAo_Jt8K.js +0 -97916
  144. package/dist/plugin-sdk/resolve-outbound-target-B42qgQS9.js +0 -40
  145. package/dist/plugin-sdk/run-with-concurrency-Bt_ks0Qa.js +0 -1994
  146. package/dist/plugin-sdk/runtime-whatsapp-login.runtime-B6W989eF.js +0 -10
  147. package/dist/plugin-sdk/runtime-whatsapp-login.runtime-BxgRDkhc.js +0 -10
  148. package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-c_GDFy37.js +0 -19
  149. package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-elOqrkfg.js +0 -19
  150. package/dist/plugin-sdk/send-CQpMudwO.js +0 -2587
  151. package/dist/plugin-sdk/send-DQHLzVyO.js +0 -414
  152. package/dist/plugin-sdk/send-DTB24bEF.js +0 -3135
  153. package/dist/plugin-sdk/send-DfHadjZ_.js +0 -503
  154. package/dist/plugin-sdk/send-XXlW2iny.js +0 -540
  155. package/dist/plugin-sdk/session-6TF6MyaC.js +0 -169
  156. package/dist/plugin-sdk/skill-commands-CkGeFUMl.js +0 -342
  157. package/dist/plugin-sdk/skills-CBkHBYPq.js +0 -1428
  158. package/dist/plugin-sdk/slash-commands.runtime-CxliuGaP.js +0 -13
  159. package/dist/plugin-sdk/slash-commands.runtime-D67JLweo.js +0 -13
  160. package/dist/plugin-sdk/slash-dispatch.runtime-DFaeYlJQ.js +0 -52
  161. package/dist/plugin-sdk/slash-dispatch.runtime-DvcpvCJ0.js +0 -52
  162. package/dist/plugin-sdk/slash-skill-commands.runtime-0M0OLCxq.js +0 -16
  163. package/dist/plugin-sdk/slash-skill-commands.runtime-BM1x3azR.js +0 -16
  164. package/dist/plugin-sdk/ssrf-cFtplYtS.js +0 -202
  165. package/dist/plugin-sdk/store-5nyxY3WU.js +0 -81
  166. package/dist/plugin-sdk/subagent-registry-runtime-1lbDyRzz.js +0 -52
  167. package/dist/plugin-sdk/subagent-registry-runtime-DCtmDwna.js +0 -52
  168. package/dist/plugin-sdk/tables-C47P4GTN.js +0 -55
  169. package/dist/plugin-sdk/target-errors-Blia4S69.js +0 -195
  170. package/dist/plugin-sdk/thinking-Bo2eosVa.js +0 -1206
  171. package/dist/plugin-sdk/tokens-BDr0Z9o3.js +0 -52
  172. package/dist/plugin-sdk/tool-images-eEfOVkzf.js +0 -274
  173. package/dist/plugin-sdk/web-BLyT64pW.js +0 -56
  174. package/dist/plugin-sdk/web-CVxZbXyH.js +0 -56
  175. package/dist/plugin-sdk/whatsapp-actions-Bw0H9g-n.js +0 -80
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bash
2
2
  # =================================================================
3
3
  # OpenClaw 离线增强版部署脚本 (适配 bundledDependencies + 中国区镜像)
4
- # 核心逻辑:修复权限 -> 固化环境 -> 本地 pnpm 安装 -> 实例初始化
5
- # 新增:可选安装 Ollama 本地模型(用于截屏识图)
4
+ # 核心逻辑:修复权限 -> 固化环境 -> 安装外部依赖 -> 本地 pnpm 安装 -> 实例初始化
5
+ # 包含:Ollama 可选安装 + Playwright 浏览器自动化
6
6
  # =================================================================
7
7
 
8
8
  set -e
@@ -80,21 +80,44 @@ if ! check_node; then
80
80
  fi
81
81
  echo -e "${GREEN}✅ Node.js 环境已就绪: $(node -v)${NC}"
82
82
 
83
+ # ==================== 5. 配置用户级全局路径 ====================
84
+ echo -e "${YELLOW}🔧 配置用户全局安装路径 ($HOME/.npm-global)...${NC}"
85
+ NPM_GLOBAL_BIN="$HOME/.npm-global"
86
+ mkdir -p "$NPM_GLOBAL_BIN/bin"
87
+ npm config set prefix "$NPM_GLOBAL_BIN"
88
+
89
+ export PATH="$NPM_GLOBAL_BIN/bin:$PATH"
90
+ if ! grep -q ".npm-global/bin" "$CONF_FILE" 2>/dev/null; then
91
+ echo -e "\n# OpenClaw PATH\nexport PATH=\"\$HOME/.npm-global/bin:\$PATH\"" >> "$CONF_FILE"
92
+ fi
93
+
94
+ # ==================== 6. 建立 GitHub 隧道(备用,对 pnpm 安装无影响)====================
95
+ echo -e "${YELLOW}🚀 切换 GitHub 稳定隧道镜像 (moeyy 代理)...${NC}"
96
+ git config --global url."https://github.moeyy.xyz/https://github.com/".insteadOf "https://github.com/"
97
+ git config --global http.sslVerify false
98
+
99
+ # ==================== 7. 安装 pnpm 及设置编译标志 ====================
100
+ echo -e "${YELLOW}🛠️ 正在安装 pnpm 并配置编译环境...${NC}"
101
+ npm install -g pnpm --registry=https://registry.npmmirror.com
102
+
103
+ if [[ "$OS" == "Darwin" ]]; then
104
+ export CFLAGS="-Wno-error=implicit-function-declaration"
105
+ fi
106
+
107
+ # ==================== 8. 询问并安装 Ollama(可选)====================
83
108
  echo -e "${BLUE}================================================${NC}"
84
109
  echo -e "${BLUE} Ollama 独立安装脚本(带系统检测) ${NC}"
85
110
  echo -e "${BLUE}================================================${NC}"
86
111
  echo -e "系统: ${YELLOW}$OS${NC}"
87
112
  echo -e "架构: ${YELLOW}$ARCH${NC}"
88
113
 
89
- # ==================== 询问是否安装 ====================
90
114
  echo
91
115
  echo -e "${YELLOW}📷 是否安装本地模型用于截屏识图?(需要约6GB内存,模型:qwen3-vl:8b)${NC}"
92
116
  read -p "请输入 y/N: " install_model_choice
93
117
 
94
118
  if [[ "$install_model_choice" == "y" || "$install_model_choice" == "Y" ]]; then
95
- # ==================== 系统兼容性检查 ====================
119
+ # 系统兼容性检查
96
120
  echo -e "${YELLOW}🔍 检查系统兼容性...${NC}"
97
-
98
121
  SUPPORTED=0
99
122
  case "$OS" in
100
123
  Linux)
@@ -126,70 +149,54 @@ if [[ "$install_model_choice" == "y" || "$install_model_choice" == "Y" ]]; then
126
149
 
127
150
  if [ $SUPPORTED -ne 1 ]; then
128
151
  echo -e "${YELLOW}⚠️ 当前系统不被官方安装脚本支持,请手动安装 ${NC}"
152
+ else
153
+ echo -e "${GREEN}✅ 系统兼容性通过 (${OS}-${ARCH})${NC}"
129
154
 
130
- fi
131
-
132
- echo -e "${GREEN} 系统兼容性通过 (${OS}-${ARCH})${NC}"
133
-
134
- # ==================== 安装 Ollama ====================
135
- if ! command -v ollama &> /dev/null; then
136
- echo -e "${YELLOW}未检测到 Ollama,正在安装 Ollama...${NC}"
137
- echo -e "${BLUE}将使用官方安装脚本:https://ollama.com/install.sh${NC}"
138
- echo -e "${YELLOW}注:如果网络访问 GitHub 不稳定,安装可能失败。若失败请手动下载安装包。${NC}"
139
-
140
- if curl -fsSL https://ollama.com/install.sh | sh; then
141
- # 强制让当前脚本重新识别一遍环境变量
142
- [ -f /etc/profile ] && . /etc/profile
143
- [ -f ~/.zshrc ] && . ~/.zshrc 2>/dev/null
155
+ # 安装 Ollama
156
+ if ! command -v ollama &> /dev/null; then
157
+ echo -e "${YELLOW}未检测到 Ollama,正在安装 Ollama...${NC}"
158
+ echo -e "${BLUE}将使用官方安装脚本:https://ollama.com/install.sh${NC}"
159
+ echo -e "${YELLOW}注:如果网络访问 GitHub 不稳定,安装可能失败。若失败请手动下载安装包。${NC}"
144
160
 
145
- # 给系统一点点响应时间
146
- sleep 2
147
-
148
- if command -v ollama &> /dev/null; then
149
- echo -e "${GREEN}✅ Ollama 安装并识别成功${NC}"
161
+ if curl -fsSL https://ollama.com/install.sh | sh; then
162
+ # 强制让当前脚本重新识别一遍环境变量
163
+ [ -f /etc/profile ] && . /etc/profile
164
+ [ -f ~/.zshrc ] && . ~/.zshrc 2>/dev/null
165
+ sleep 2
166
+
167
+ if command -v ollama &> /dev/null; then
168
+ echo -e "${GREEN}✅ Ollama 安装并识别成功${NC}"
169
+ else
170
+ echo -e "${YELLOW}⚠️ 脚本已运行但命令未直接生效,尝试使用全路径:${NC}"
171
+ /usr/local/bin/ollama --version && echo -e "${GREEN}全路径可用!${NC}"
172
+ fi
150
173
  else
151
- echo -e "${YELLOW}⚠️ 脚本已运行但命令未直接生效,尝试使用全路径:${NC}"
152
- /usr/local/bin/ollama --version && echo -e "${GREEN}全路径可用!${NC}"
174
+ echo -e "${RED} 脚本执行异常${NC}"
153
175
  fi
154
176
  else
155
- echo -e "${RED} 脚本执行异常${NC}"
156
- fi
157
- else
158
- echo -e "${GREEN}✅ Ollama 已安装${NC}"
159
- fi
160
-
161
- # ==================== 拉取模型 ====================
162
- # 1. 尝试将 /usr/local/bin 加入临时路径(防止安装后未刷新环境)
163
- export PATH=$PATH:/usr/local/bin
164
- if command -v ollama &> /dev/null; then
165
- # 2. 检查 Ollama 服务是否启动,没启动则尝试后台启动
166
- if ! pgrep -x "ollama" > /dev/null; then
167
- echo -e "${YELLOW}正在启动 Ollama 后台服务...${NC}"
168
- # macOS 下启动命令,Linux 下通常是 systemctl start ollama
169
- open -a Ollama.app --args serve > /dev/null 2>&1 &
170
- sleep 5 # 等待服务初始化
177
+ echo -e "${GREEN} Ollama 已安装${NC}"
171
178
  fi
172
179
 
173
- echo -e "${YELLOW}正在拉取模型 qwen3vl:8b,这可能需要一些时间...${NC}"
174
-
175
- # ==================== 模型拉取配置 ====================
176
- TARGET_MODEL="qwen3-vl:8b"
180
+ # 拉取模型
181
+ export PATH=$PATH:/usr/local/bin
177
182
  if command -v ollama &> /dev/null; then
178
- echo -e "${YELLOW}🔍 正在检查本地模型库...${NC}"
179
-
180
- # 使用 grep -w 进行全字匹配,确保精准识别 qwen3-vl:8b
183
+ if ! pgrep -x "ollama" > /dev/null; then
184
+ echo -e "${YELLOW}正在启动 Ollama 后台服务...${NC}"
185
+ open -a Ollama.app --args serve > /dev/null 2>&1 &
186
+ sleep 5
187
+ fi
188
+
189
+ echo -e "${YELLOW}正在拉取模型 qwen3-vl:8b,这可能需要一些时间...${NC}"
190
+ TARGET_MODEL="qwen3-vl:8b"
181
191
  if ollama list | grep -w "$TARGET_MODEL" > /dev/null; then
182
192
  echo -e "${GREEN}✅ 检测到本地已存在 $TARGET_MODEL,跳过下载。${NC}"
183
193
  else
184
194
  echo -e "${YELLOW}📥 本地未发现 $TARGET_MODEL,准备拉取...${NC}"
185
-
186
- # 确保 Ollama 服务处于运行状态
187
195
  if ! pgrep -x "ollama" > /dev/null; then
188
196
  echo -e "${YELLOW}🚀 正在后台启动 Ollama 服务...${NC}"
189
197
  open -a Ollama.app --args serve > /dev/null 2>&1 &
190
198
  sleep 5
191
199
  fi
192
-
193
200
  echo -e "${BLUE}开始拉取模型,这取决于你的网络环境...${NC}"
194
201
  if ollama pull "$TARGET_MODEL"; then
195
202
  echo -e "${GREEN}✅ 模型 $TARGET_MODEL 部署成功!${NC}"
@@ -199,48 +206,34 @@ if [[ "$install_model_choice" == "y" || "$install_model_choice" == "Y" ]]; then
199
206
  fi
200
207
  fi
201
208
  else
202
- echo -e "${RED}❌ 错误:系统中未找到 Ollama,请先完成安装。${NC}"
209
+ echo -e "${RED}❌ 未检测到 ollama 命令,请确保已安装并添加到 PATH。${NC}"
203
210
  fi
204
- 22
205
- else
206
- echo -e "${RED}❌ 未检测到 ollama 命令,请确保已安装并添加到 PATH。${NC}"
207
211
  fi
208
212
  fi
209
213
 
210
- # ==================== 5. 配置用户级全局路径 ====================
211
- echo -e "${YELLOW}🔧 配置用户全局安装路径 ($HOME/.npm-global)...${NC}"
212
- NPM_GLOBAL_BIN="$HOME/.npm-global"
213
- mkdir -p "$NPM_GLOBAL_BIN/bin"
214
- npm config set prefix "$NPM_GLOBAL_BIN"
214
+ # ==================== 9. 安装 Playwright 浏览器自动化 ====================
215
+ echo -e "${YELLOW}🌐 检查 Playwright 浏览器自动化工具...${NC}"
216
+ export PATH="$HOME/.npm-global/bin:$PATH"
215
217
 
216
- export PATH="$NPM_GLOBAL_BIN/bin:$PATH"
217
- if ! grep -q ".npm-global/bin" "$CONF_FILE" 2>/dev/null; then
218
- echo -e "\n# OpenClaw PATH\nexport PATH=\"\$HOME/.npm-global/bin:\$PATH\"" >> "$CONF_FILE"
218
+ if ! command -v playwright &> /dev/null; then
219
+ echo -e "${YELLOW}未检测到 playwright,正在安装...${NC}"
220
+ npm install -g playwright --registry=https://registry.npmmirror.com
221
+ echo -e "${GREEN}✅ Playwright 核心库安装完成${NC}"
222
+ else
223
+ echo -e "${GREEN}✅ Playwright 已安装${NC}"
219
224
  fi
220
225
 
221
- # ==================== 6. 建立 GitHub 隧道(备用,对 pnpm 安装无影响)====================
222
- echo -e "${YELLOW}🚀 切换 GitHub 稳定隧道镜像 (moeyy 代理)...${NC}"
223
- git config --global url."https://github.moeyy.xyz/https://github.com/".insteadOf "https://github.com/"
224
- git config --global http.sslVerify false
225
-
226
- # ==================== 6.5 补全编译依赖与镜像 ====================
227
- echo -e "${YELLOW}🛠️ 正在补全编译工具与二进制镜像...${NC}"
226
+ # 安装 Chromium 浏览器(若已安装则自动跳过)
227
+ echo -e "${YELLOW}📦 检查 Chromium 浏览器...${NC}"
228
+ npx playwright install chromium
229
+ echo -e "${GREEN}✅ Chromium 浏览器就绪${NC}"
228
230
 
229
- # 安装 pnpm (项目明确要求)
230
- npm install -g pnpm --registry=https://registry.npmmirror.com
231
-
232
- if [[ "$OS" == "Darwin" ]]; then
233
- export CFLAGS="-Wno-error=implicit-function-declaration"
234
- fi
235
-
236
- # ==================== 7. 改用 pnpm 本地安装(彻底避免 Git)====================
231
+ # ==================== 10. 使用 pnpm 本地安装 OpenClaw 核心 ====================
237
232
  echo -e "${YELLOW}📥 正在创建本地运行环境(路径:$HOME/openclaw-runtime)...${NC}"
238
-
239
- # 创建并进入运行目录
240
233
  mkdir -p "$HOME/openclaw-runtime"
241
234
  cd "$HOME/openclaw-runtime"
242
235
 
243
- # 写入 package.json,包含必要的 overrides(直接从项目配置复制)
236
+ # 写入 package.json,包含必要的 overrides
244
237
  cat > package.json <<'EOF'
245
238
  {
246
239
  "name": "openclaw-runtime",
@@ -255,7 +248,7 @@ cat > package.json <<'EOF'
255
248
  }
256
249
  EOF
257
250
 
258
- # 注入二进制镜像 (环境变量方式)
251
+ # 注入二进制镜像环境变量
259
252
  export SHARP_BINARY_HOST="https://npmmirror.com/mirrors/sharp"
260
253
  export SHARP_LIBVIPS_BINARY_HOST="https://npmmirror.com/mirrors/sharp-libvips"
261
254
  export NODEJS_ORG_MIRROR="https://npmmirror.com/mirrors/node"
@@ -268,12 +261,10 @@ ln -sf "$HOME/openclaw-runtime/node_modules/.bin/openclaw" "$NPM_GLOBAL_BIN/open
268
261
 
269
262
  echo -e "${GREEN}✅ 本地安装完成,openclaw 命令已链接到 $NPM_GLOBAL_BIN/openclaw${NC}"
270
263
 
271
-
272
- # ==================== 9. 自动化实例初始化 (直接调用 create-instance.sh) ====================
264
+ # ==================== 11. 自动化实例初始化 (调用 create-instance.sh) ====================
273
265
  CREATE_SCRIPT="$OPENCLAW_SOURCE_DIR/scripts/create-instance.sh"
274
266
 
275
267
  if [ ! -f "$CREATE_SCRIPT" ]; then
276
- # 尝试备用路径
277
268
  CREATE_SCRIPT="$(pwd)/node_modules/openclaw-multi-auto/scripts/create-instance.sh"
278
269
  fi
279
270
 
@@ -288,7 +279,7 @@ else
288
279
  exit 1
289
280
  fi
290
281
 
291
- # ==================== 10. 部署反馈 ====================
282
+ # ==================== 12. 部署反馈 ====================
292
283
  INSTANCE_DIR="$HOME/openclaws/yunwei"
293
284
  if [ -d "$INSTANCE_DIR" ]; then
294
285
  FINAL_PORT=$(grep '"port":' "$INSTANCE_DIR/config/openclaw.json" | awk -F': ' '{print $2}' | tr -d ', ' | xargs)
@@ -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 };
@@ -1,50 +0,0 @@
1
- import { at as DEFAULT_ACCOUNT_ID } from "./run-with-concurrency-C_KCHwvf.js";
2
- import { Tr as formatCliCommand } from "./config-B1z-UxQ3.js";
3
- import crypto from "node:crypto";
4
-
5
- //#region src/logging/redact-identifier.ts
6
- function sha256HexPrefix(value, len = 12) {
7
- const safeLen = Number.isFinite(len) ? Math.max(1, Math.floor(len)) : 12;
8
- return crypto.createHash("sha256").update(value).digest("hex").slice(0, safeLen);
9
- }
10
- function redactIdentifier(value, opts) {
11
- const trimmed = value?.trim();
12
- if (!trimmed) return "-";
13
- return `sha256:${sha256HexPrefix(trimmed, opts?.len ?? 12)}`;
14
- }
15
-
16
- //#endregion
17
- //#region src/web/active-listener.ts
18
- const listeners = /* @__PURE__ */ new Map();
19
- function resolveWebAccountId(accountId) {
20
- return (accountId ?? "").trim() || DEFAULT_ACCOUNT_ID;
21
- }
22
- function requireActiveWebListener(accountId) {
23
- const id = resolveWebAccountId(accountId);
24
- const listener = listeners.get(id) ?? null;
25
- if (!listener) throw new Error(`No active WhatsApp Web listener (account: ${id}). Start the gateway, then link WhatsApp with: ${formatCliCommand(`openclaw channels login --channel whatsapp --account ${id}`)}.`);
26
- return {
27
- accountId: id,
28
- listener
29
- };
30
- }
31
- function setActiveWebListener(accountIdOrListener, maybeListener) {
32
- const { accountId, listener } = typeof accountIdOrListener === "string" ? {
33
- accountId: accountIdOrListener,
34
- listener: maybeListener ?? null
35
- } : {
36
- accountId: DEFAULT_ACCOUNT_ID,
37
- listener: accountIdOrListener ?? null
38
- };
39
- const id = resolveWebAccountId(accountId);
40
- if (!listener) listeners.delete(id);
41
- else listeners.set(id, listener);
42
- if (id === DEFAULT_ACCOUNT_ID) {}
43
- }
44
- function getActiveWebListener(accountId) {
45
- const id = resolveWebAccountId(accountId);
46
- return listeners.get(id) ?? null;
47
- }
48
-
49
- //#endregion
50
- export { redactIdentifier as i, requireActiveWebListener as n, setActiveWebListener as r, getActiveWebListener as t };