lightclawbot 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/public/data/scripts/manifest.json +5 -5
- package/dist/public/data/scripts/upgrade.211d7e4c.sh +266 -0
- package/dist/public/data/scripts/upgrade.sh +266 -0
- package/dist/src/config.d.ts +3 -3
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +4 -4
- package/dist/src/config.js.map +1 -1
- package/dist/src/dedup.d.ts +6 -1
- package/dist/src/dedup.d.ts.map +1 -1
- package/dist/src/dedup.js +27 -14
- package/dist/src/dedup.js.map +1 -1
- package/dist/src/gateway.d.ts.map +1 -1
- package/dist/src/gateway.js +9 -6
- package/dist/src/gateway.js.map +1 -1
- package/dist/src/history/text-processing.d.ts.map +1 -1
- package/dist/src/history/text-processing.js +2 -0
- package/dist/src/history/text-processing.js.map +1 -1
- package/dist/src/inbound.js +2 -2
- package/dist/src/inbound.js.map +1 -1
- package/dist/src/socket-handlers.d.ts.map +1 -1
- package/dist/src/socket-handlers.js +45 -45
- package/dist/src/socket-handlers.js.map +1 -1
- package/dist/src/streaming/delta-tracker.d.ts +34 -0
- package/dist/src/streaming/delta-tracker.d.ts.map +1 -0
- package/dist/src/streaming/delta-tracker.js +145 -0
- package/dist/src/streaming/delta-tracker.js.map +1 -0
- package/dist/src/streaming/index.d.ts +12 -0
- package/dist/src/streaming/index.d.ts.map +1 -0
- package/dist/src/streaming/index.js +13 -0
- package/dist/src/streaming/index.js.map +1 -0
- package/dist/src/streaming/stream-reply-sink.d.ts +59 -0
- package/dist/src/streaming/stream-reply-sink.d.ts.map +1 -0
- package/dist/src/streaming/stream-reply-sink.js +293 -0
- package/dist/src/streaming/stream-reply-sink.js.map +1 -0
- package/dist/src/streaming/types.d.ts +45 -0
- package/dist/src/streaming/types.d.ts.map +1 -0
- package/dist/src/streaming/types.js +7 -0
- package/dist/src/streaming/types.js.map +1 -0
- package/package.json +1 -1
- package/dist/public/data/scripts/preflight.78097a58.sh +0 -94
- package/dist/public/data/scripts/preflight.sh +0 -94
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-03-
|
|
2
|
+
"generatedAt": "2026-03-18T12:42:17.408Z",
|
|
3
3
|
"cdnBase": "https://cloudcache.tencent-cloud.com/qcloud/tea/app/data/scripts",
|
|
4
4
|
"files": {
|
|
5
|
-
"
|
|
6
|
-
"hashed": "
|
|
7
|
-
"hash": "
|
|
8
|
-
"size":
|
|
5
|
+
"upgrade.sh": {
|
|
6
|
+
"hashed": "upgrade.211d7e4c.sh",
|
|
7
|
+
"hash": "211d7e4c",
|
|
8
|
+
"size": 8792
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# ========== lightclawbot 插件快速安装/升级脚本 ==========
|
|
5
|
+
# 用途:跳过 openclaw plugins install 的慢路径,直接安装/升级 lightclawbot 插件
|
|
6
|
+
# 前提:openclaw 已安装且可用,pnpm 或 npm 已安装(不依赖 jq,JSON 操作统一用 node)
|
|
7
|
+
# 支持:首次安装 / 重装 / 升级,自动保留已有的 channels 配置
|
|
8
|
+
#
|
|
9
|
+
# 输出规范:stdout 只输出一行 RESULT:{...} JSON,供前端解析
|
|
10
|
+
# - 成功:RESULT:{"status":"ok","version":"x.y.z"}
|
|
11
|
+
# - 失败:RESULT:{"status":"error","reason":"..."}
|
|
12
|
+
#
|
|
13
|
+
# 使用方式:
|
|
14
|
+
# 本地执行: bash scripts/upgrade.sh
|
|
15
|
+
# CDN 执行: bash <(curl -fsSL https://your-cdn.com/upgrade.sh)
|
|
16
|
+
# 传入参数: APIKEY="sk-xxx" bash <(curl -fsSL https://your-cdn.com/upgrade.sh)
|
|
17
|
+
|
|
18
|
+
# ========== 工具函数 ==========
|
|
19
|
+
|
|
20
|
+
result_exit() {
|
|
21
|
+
local reason="$1"
|
|
22
|
+
echo "RESULT:{\"status\":\"error\",\"reason\":\"${reason}\"}"
|
|
23
|
+
exit 1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
result_ok() {
|
|
27
|
+
echo "RESULT:{\"status\":\"ok\",\"version\":\"${1}\"}"
|
|
28
|
+
exit 0
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# ========== 配置 ==========
|
|
32
|
+
|
|
33
|
+
id="lightclawbot"
|
|
34
|
+
spec="lightclawbot"
|
|
35
|
+
cfg="$HOME/.openclaw/openclaw.json"
|
|
36
|
+
plugin_dir="$HOME/.openclaw/extensions/${id}"
|
|
37
|
+
|
|
38
|
+
# npm 源:使用腾讯镜像源(可通过 NPM_REGISTRY 环境变量覆盖)
|
|
39
|
+
NPM_REGISTRY="${NPM_REGISTRY:-https://mirrors.tencent.com/npm/}"
|
|
40
|
+
# fallback 源:首选失败时兜底(可通过 NPM_FALLBACK 环境变量覆盖)
|
|
41
|
+
NPM_FALLBACK="${NPM_FALLBACK:-https://registry.npmjs.org}"
|
|
42
|
+
|
|
43
|
+
# API Key:优先读取环境变量,为空则保留配置文件中已有的值
|
|
44
|
+
# 用法:APIKEY="sk-xxx" bash <(curl -fsSL https://your-cdn.com/upgrade.sh)
|
|
45
|
+
APIKEY="${APIKEY:-}"
|
|
46
|
+
|
|
47
|
+
# ========== 环境加载 ==========
|
|
48
|
+
# bash xxx.sh 启动的是非交互式 shell,不会自动 source ~/.bashrc,
|
|
49
|
+
# 如果用户通过 nvm 安装 node,脚本中的 node/pnpm/openclaw 都找不到。
|
|
50
|
+
|
|
51
|
+
export NVM_DIR="$HOME/.nvm"
|
|
52
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
53
|
+
|
|
54
|
+
if [ -z "$PNPM_HOME" ] && [ -d "$HOME/.local/share/pnpm" ]; then
|
|
55
|
+
export PNPM_HOME="$HOME/.local/share/pnpm"
|
|
56
|
+
export PATH="$PNPM_HOME:$PATH"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
[ ! -t 1 ] && export CI=true
|
|
60
|
+
|
|
61
|
+
# ========== 前置检查 ==========
|
|
62
|
+
|
|
63
|
+
# 1) 探测包管理器:优先 pnpm,fallback npm,都没有则报错
|
|
64
|
+
if command -v pnpm &>/dev/null; then
|
|
65
|
+
PKG_MGR="pnpm"
|
|
66
|
+
elif command -v npm &>/dev/null; then
|
|
67
|
+
PKG_MGR="npm"
|
|
68
|
+
else
|
|
69
|
+
result_exit "npm_not_found"
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# 2) 检查 openclaw 是否可用
|
|
73
|
+
if ! openclaw -v &>/dev/null; then
|
|
74
|
+
result_exit "openclaw_not_available"
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# 3) 设置 npm/pnpm 源(确保后续 pack/install 都走镜像源)
|
|
78
|
+
npm config set registry "$NPM_REGISTRY" 2>/dev/null || true
|
|
79
|
+
[ "$PKG_MGR" = "pnpm" ] && pnpm config set registry "$NPM_REGISTRY" 2>/dev/null || true
|
|
80
|
+
|
|
81
|
+
# 4) 检查 APIKEY
|
|
82
|
+
if [ -z "$APIKEY" ]; then
|
|
83
|
+
result_exit "apikey_empty"
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
# ========== 安装 / 升级 lightclawbot ==========
|
|
87
|
+
|
|
88
|
+
# ---------- 检查是否已安装,获取本地版本 ----------
|
|
89
|
+
local_version=""
|
|
90
|
+
if [ -d "$plugin_dir" ] && [ -f "$plugin_dir/package.json" ]; then
|
|
91
|
+
local_version=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync(process.argv[1],'utf8')).version||'')}catch(e){console.log('')}" "$plugin_dir/package.json" 2>/dev/null || true)
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# ---------- 查询远程最新版本 ----------
|
|
95
|
+
remote_version=$(npm view "$spec" version 2>/dev/null || true)
|
|
96
|
+
|
|
97
|
+
if [ -z "$remote_version" ]; then
|
|
98
|
+
remote_version=$(npm view "$spec" version --registry "$NPM_FALLBACK" 2>/dev/null || true)
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# ---------- 判断安装模式 ----------
|
|
102
|
+
install_mode="install"
|
|
103
|
+
if [ -n "$local_version" ]; then
|
|
104
|
+
if [ -n "$remote_version" ] && [ "$local_version" = "$remote_version" ]; then
|
|
105
|
+
install_mode="up-to-date"
|
|
106
|
+
else
|
|
107
|
+
install_mode="upgrade"
|
|
108
|
+
fi
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
if [ "$install_mode" != "up-to-date" ]; then
|
|
112
|
+
# ---------- 清理旧版本 ----------
|
|
113
|
+
rm -rf "$plugin_dir"
|
|
114
|
+
|
|
115
|
+
# ---------- npm pack 下载 tgz ----------
|
|
116
|
+
tmp_dir=$(mktemp -d /tmp/openclaw-plugin-XXXXXX)
|
|
117
|
+
|
|
118
|
+
tgz_file=$(cd "$tmp_dir" && npm pack "$spec" 2>/dev/null | tail -n1)
|
|
119
|
+
if [ -z "$tgz_file" ] || [ ! -f "$tmp_dir/$tgz_file" ]; then
|
|
120
|
+
tgz_file=$(cd "$tmp_dir" && npm pack "$spec" --registry "$NPM_FALLBACK" 2>/dev/null | tail -n1)
|
|
121
|
+
fi
|
|
122
|
+
if [ -z "$tgz_file" ] || [ ! -f "$tmp_dir/$tgz_file" ]; then
|
|
123
|
+
rm -rf "$tmp_dir"
|
|
124
|
+
result_exit "download_failed"
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
# ---------- 解压到插件目录 ----------
|
|
128
|
+
mkdir -p "$plugin_dir"
|
|
129
|
+
tar -xzf "$tmp_dir/$tgz_file" -C "$plugin_dir" --strip-components=1
|
|
130
|
+
rm -rf "$tmp_dir"
|
|
131
|
+
|
|
132
|
+
# ---------- 安装生产依赖 ----------
|
|
133
|
+
# lightclawbot 声明了 bundledDependencies,npm pack 产出的 tgz 已包含所有依赖
|
|
134
|
+
has_unbundled_deps=$(node -e '
|
|
135
|
+
const pkg = JSON.parse(require("fs").readFileSync(process.argv[1], "utf8"));
|
|
136
|
+
const deps = Object.keys(pkg.dependencies || {});
|
|
137
|
+
const bundled = pkg.bundledDependencies || pkg.bundleDependencies || [];
|
|
138
|
+
console.log(deps.length > 0 && bundled.length < deps.length ? "true" : "false");
|
|
139
|
+
' "$plugin_dir/package.json")
|
|
140
|
+
|
|
141
|
+
if [ "$has_unbundled_deps" = true ]; then
|
|
142
|
+
(cd "$plugin_dir" && CI=true $PKG_MGR install --prod) >/dev/null 2>&1
|
|
143
|
+
fi
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
# ========== 更新配置文件 ==========
|
|
147
|
+
|
|
148
|
+
# 确保配置文件存在
|
|
149
|
+
if [ ! -f "$cfg" ]; then
|
|
150
|
+
mkdir -p "$(dirname "$cfg")"
|
|
151
|
+
echo '{}' > "$cfg"
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
# 校验配置文件是合法 JSON(用户可能手动编辑弄坏了格式)
|
|
155
|
+
if ! node -e "JSON.parse(require('fs').readFileSync(process.argv[1],'utf8'))" "$cfg" 2>/dev/null; then
|
|
156
|
+
result_exit "config_json_invalid"
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
# ---------- 单次 node 调用完成所有配置更新 ----------
|
|
160
|
+
# 一次启动 V8,通过环境变量安全传参,
|
|
161
|
+
# 顺序完成 plugins.entries / installs / deny / allow / channels 全部配置修改,
|
|
162
|
+
# 减少文件 I/O 次数(只读一次 + 写一次)。
|
|
163
|
+
|
|
164
|
+
version=$(UPGRADE_CFG="$cfg" UPGRADE_ID="$id" UPGRADE_SPEC="$spec" \
|
|
165
|
+
UPGRADE_PLUGIN_DIR="$plugin_dir" UPGRADE_APIKEY="$APIKEY" \
|
|
166
|
+
node -e '
|
|
167
|
+
const fs = require("fs");
|
|
168
|
+
const cfgPath = process.env.UPGRADE_CFG;
|
|
169
|
+
const pluginId = process.env.UPGRADE_ID;
|
|
170
|
+
const spec = process.env.UPGRADE_SPEC;
|
|
171
|
+
const pluginDir = process.env.UPGRADE_PLUGIN_DIR;
|
|
172
|
+
const envApiKey = process.env.UPGRADE_APIKEY || "";
|
|
173
|
+
|
|
174
|
+
function fail(reason) {
|
|
175
|
+
process.exit(1);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// 读取配置
|
|
179
|
+
let cfg;
|
|
180
|
+
try {
|
|
181
|
+
cfg = JSON.parse(fs.readFileSync(cfgPath, "utf8"));
|
|
182
|
+
} catch (e) {
|
|
183
|
+
fail("config_read_failed");
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// 读取插件版本
|
|
187
|
+
let version = "unknown";
|
|
188
|
+
try {
|
|
189
|
+
const pkg = JSON.parse(fs.readFileSync(pluginDir + "/package.json", "utf8"));
|
|
190
|
+
version = pkg.version || "unknown";
|
|
191
|
+
} catch (e) {}
|
|
192
|
+
|
|
193
|
+
// ---------- 1) 确保 plugins 基础结构存在 & 全局插件系统启用 ----------
|
|
194
|
+
if (!cfg.plugins) cfg.plugins = {};
|
|
195
|
+
// 确保全局插件系统生效(plugins.enabled 默认 true,仅显式 false 时需修复)
|
|
196
|
+
if (cfg.plugins.enabled === false) {
|
|
197
|
+
cfg.plugins.enabled = true;
|
|
198
|
+
}
|
|
199
|
+
if (!cfg.plugins.entries) cfg.plugins.entries = {};
|
|
200
|
+
if (!cfg.plugins.installs) cfg.plugins.installs = {};
|
|
201
|
+
|
|
202
|
+
// plugins.entries:启用插件
|
|
203
|
+
cfg.plugins.entries[pluginId] = { enabled: true };
|
|
204
|
+
|
|
205
|
+
// plugins.installs:安装记录
|
|
206
|
+
cfg.plugins.installs[pluginId] = {
|
|
207
|
+
source: "npm",
|
|
208
|
+
spec: spec,
|
|
209
|
+
installPath: pluginDir,
|
|
210
|
+
version: version,
|
|
211
|
+
installedAt: new Date().toISOString().replace(/\.\d{3}Z$/, ".000Z")
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// ---------- 2) 黑名单修复 ----------
|
|
215
|
+
if (Array.isArray(cfg.plugins.deny)) {
|
|
216
|
+
const idx = cfg.plugins.deny.indexOf(pluginId);
|
|
217
|
+
if (idx !== -1) {
|
|
218
|
+
cfg.plugins.deny.splice(idx, 1);
|
|
219
|
+
if (cfg.plugins.deny.length === 0) {
|
|
220
|
+
delete cfg.plugins.deny;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// ---------- 3) 白名单添加 ----------
|
|
226
|
+
if (Array.isArray(cfg.plugins.allow)) {
|
|
227
|
+
if (!cfg.plugins.allow.includes(pluginId)) {
|
|
228
|
+
cfg.plugins.allow.push(pluginId);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// ---------- 4) channel 配置:智能合并 ----------
|
|
233
|
+
if (!cfg.channels) cfg.channels = {};
|
|
234
|
+
const ch = cfg.channels[pluginId] || {};
|
|
235
|
+
|
|
236
|
+
// 迁移旧的 apiKey -> apiKeys
|
|
237
|
+
let apiKeys = Array.isArray(ch.apiKeys) ? [...ch.apiKeys] : [];
|
|
238
|
+
if (ch.apiKey && typeof ch.apiKey === "string") {
|
|
239
|
+
if (!apiKeys.includes(ch.apiKey)) {
|
|
240
|
+
apiKeys.push(ch.apiKey);
|
|
241
|
+
}
|
|
242
|
+
delete ch.apiKey;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// 如果通过环境变量传入了 APIKEY,确保它在 apiKeys 数组中(去重)
|
|
246
|
+
if (envApiKey && !apiKeys.includes(envApiKey)) {
|
|
247
|
+
apiKeys.push(envApiKey);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
ch.enabled = true;
|
|
251
|
+
ch.apiKeys = apiKeys;
|
|
252
|
+
cfg.channels[pluginId] = ch;
|
|
253
|
+
|
|
254
|
+
// ---------- 5) 写回配置文件 ----------
|
|
255
|
+
fs.writeFileSync(cfgPath, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
256
|
+
|
|
257
|
+
// 输出版本号到 stdout,供 shell 接收
|
|
258
|
+
process.stdout.write(version);
|
|
259
|
+
') || result_exit "config_update_failed"
|
|
260
|
+
|
|
261
|
+
# ========== 重启 Gateway ==========
|
|
262
|
+
|
|
263
|
+
openclaw gateway restart >/dev/null 2>&1 || true
|
|
264
|
+
|
|
265
|
+
# stdout 只输出这一行 RESULT,供前端解析
|
|
266
|
+
result_ok "$version"
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# ========== lightclawbot 插件快速安装/升级脚本 ==========
|
|
5
|
+
# 用途:跳过 openclaw plugins install 的慢路径,直接安装/升级 lightclawbot 插件
|
|
6
|
+
# 前提:openclaw 已安装且可用,pnpm 或 npm 已安装(不依赖 jq,JSON 操作统一用 node)
|
|
7
|
+
# 支持:首次安装 / 重装 / 升级,自动保留已有的 channels 配置
|
|
8
|
+
#
|
|
9
|
+
# 输出规范:stdout 只输出一行 RESULT:{...} JSON,供前端解析
|
|
10
|
+
# - 成功:RESULT:{"status":"ok","version":"x.y.z"}
|
|
11
|
+
# - 失败:RESULT:{"status":"error","reason":"..."}
|
|
12
|
+
#
|
|
13
|
+
# 使用方式:
|
|
14
|
+
# 本地执行: bash scripts/upgrade.sh
|
|
15
|
+
# CDN 执行: bash <(curl -fsSL https://your-cdn.com/upgrade.sh)
|
|
16
|
+
# 传入参数: APIKEY="sk-xxx" bash <(curl -fsSL https://your-cdn.com/upgrade.sh)
|
|
17
|
+
|
|
18
|
+
# ========== 工具函数 ==========
|
|
19
|
+
|
|
20
|
+
result_exit() {
|
|
21
|
+
local reason="$1"
|
|
22
|
+
echo "RESULT:{\"status\":\"error\",\"reason\":\"${reason}\"}"
|
|
23
|
+
exit 1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
result_ok() {
|
|
27
|
+
echo "RESULT:{\"status\":\"ok\",\"version\":\"${1}\"}"
|
|
28
|
+
exit 0
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# ========== 配置 ==========
|
|
32
|
+
|
|
33
|
+
id="lightclawbot"
|
|
34
|
+
spec="lightclawbot"
|
|
35
|
+
cfg="$HOME/.openclaw/openclaw.json"
|
|
36
|
+
plugin_dir="$HOME/.openclaw/extensions/${id}"
|
|
37
|
+
|
|
38
|
+
# npm 源:使用腾讯镜像源(可通过 NPM_REGISTRY 环境变量覆盖)
|
|
39
|
+
NPM_REGISTRY="${NPM_REGISTRY:-https://mirrors.tencent.com/npm/}"
|
|
40
|
+
# fallback 源:首选失败时兜底(可通过 NPM_FALLBACK 环境变量覆盖)
|
|
41
|
+
NPM_FALLBACK="${NPM_FALLBACK:-https://registry.npmjs.org}"
|
|
42
|
+
|
|
43
|
+
# API Key:优先读取环境变量,为空则保留配置文件中已有的值
|
|
44
|
+
# 用法:APIKEY="sk-xxx" bash <(curl -fsSL https://your-cdn.com/upgrade.sh)
|
|
45
|
+
APIKEY="${APIKEY:-}"
|
|
46
|
+
|
|
47
|
+
# ========== 环境加载 ==========
|
|
48
|
+
# bash xxx.sh 启动的是非交互式 shell,不会自动 source ~/.bashrc,
|
|
49
|
+
# 如果用户通过 nvm 安装 node,脚本中的 node/pnpm/openclaw 都找不到。
|
|
50
|
+
|
|
51
|
+
export NVM_DIR="$HOME/.nvm"
|
|
52
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
53
|
+
|
|
54
|
+
if [ -z "$PNPM_HOME" ] && [ -d "$HOME/.local/share/pnpm" ]; then
|
|
55
|
+
export PNPM_HOME="$HOME/.local/share/pnpm"
|
|
56
|
+
export PATH="$PNPM_HOME:$PATH"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
[ ! -t 1 ] && export CI=true
|
|
60
|
+
|
|
61
|
+
# ========== 前置检查 ==========
|
|
62
|
+
|
|
63
|
+
# 1) 探测包管理器:优先 pnpm,fallback npm,都没有则报错
|
|
64
|
+
if command -v pnpm &>/dev/null; then
|
|
65
|
+
PKG_MGR="pnpm"
|
|
66
|
+
elif command -v npm &>/dev/null; then
|
|
67
|
+
PKG_MGR="npm"
|
|
68
|
+
else
|
|
69
|
+
result_exit "npm_not_found"
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# 2) 检查 openclaw 是否可用
|
|
73
|
+
if ! openclaw -v &>/dev/null; then
|
|
74
|
+
result_exit "openclaw_not_available"
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# 3) 设置 npm/pnpm 源(确保后续 pack/install 都走镜像源)
|
|
78
|
+
npm config set registry "$NPM_REGISTRY" 2>/dev/null || true
|
|
79
|
+
[ "$PKG_MGR" = "pnpm" ] && pnpm config set registry "$NPM_REGISTRY" 2>/dev/null || true
|
|
80
|
+
|
|
81
|
+
# 4) 检查 APIKEY
|
|
82
|
+
if [ -z "$APIKEY" ]; then
|
|
83
|
+
result_exit "apikey_empty"
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
# ========== 安装 / 升级 lightclawbot ==========
|
|
87
|
+
|
|
88
|
+
# ---------- 检查是否已安装,获取本地版本 ----------
|
|
89
|
+
local_version=""
|
|
90
|
+
if [ -d "$plugin_dir" ] && [ -f "$plugin_dir/package.json" ]; then
|
|
91
|
+
local_version=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync(process.argv[1],'utf8')).version||'')}catch(e){console.log('')}" "$plugin_dir/package.json" 2>/dev/null || true)
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# ---------- 查询远程最新版本 ----------
|
|
95
|
+
remote_version=$(npm view "$spec" version 2>/dev/null || true)
|
|
96
|
+
|
|
97
|
+
if [ -z "$remote_version" ]; then
|
|
98
|
+
remote_version=$(npm view "$spec" version --registry "$NPM_FALLBACK" 2>/dev/null || true)
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# ---------- 判断安装模式 ----------
|
|
102
|
+
install_mode="install"
|
|
103
|
+
if [ -n "$local_version" ]; then
|
|
104
|
+
if [ -n "$remote_version" ] && [ "$local_version" = "$remote_version" ]; then
|
|
105
|
+
install_mode="up-to-date"
|
|
106
|
+
else
|
|
107
|
+
install_mode="upgrade"
|
|
108
|
+
fi
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
if [ "$install_mode" != "up-to-date" ]; then
|
|
112
|
+
# ---------- 清理旧版本 ----------
|
|
113
|
+
rm -rf "$plugin_dir"
|
|
114
|
+
|
|
115
|
+
# ---------- npm pack 下载 tgz ----------
|
|
116
|
+
tmp_dir=$(mktemp -d /tmp/openclaw-plugin-XXXXXX)
|
|
117
|
+
|
|
118
|
+
tgz_file=$(cd "$tmp_dir" && npm pack "$spec" 2>/dev/null | tail -n1)
|
|
119
|
+
if [ -z "$tgz_file" ] || [ ! -f "$tmp_dir/$tgz_file" ]; then
|
|
120
|
+
tgz_file=$(cd "$tmp_dir" && npm pack "$spec" --registry "$NPM_FALLBACK" 2>/dev/null | tail -n1)
|
|
121
|
+
fi
|
|
122
|
+
if [ -z "$tgz_file" ] || [ ! -f "$tmp_dir/$tgz_file" ]; then
|
|
123
|
+
rm -rf "$tmp_dir"
|
|
124
|
+
result_exit "download_failed"
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
# ---------- 解压到插件目录 ----------
|
|
128
|
+
mkdir -p "$plugin_dir"
|
|
129
|
+
tar -xzf "$tmp_dir/$tgz_file" -C "$plugin_dir" --strip-components=1
|
|
130
|
+
rm -rf "$tmp_dir"
|
|
131
|
+
|
|
132
|
+
# ---------- 安装生产依赖 ----------
|
|
133
|
+
# lightclawbot 声明了 bundledDependencies,npm pack 产出的 tgz 已包含所有依赖
|
|
134
|
+
has_unbundled_deps=$(node -e '
|
|
135
|
+
const pkg = JSON.parse(require("fs").readFileSync(process.argv[1], "utf8"));
|
|
136
|
+
const deps = Object.keys(pkg.dependencies || {});
|
|
137
|
+
const bundled = pkg.bundledDependencies || pkg.bundleDependencies || [];
|
|
138
|
+
console.log(deps.length > 0 && bundled.length < deps.length ? "true" : "false");
|
|
139
|
+
' "$plugin_dir/package.json")
|
|
140
|
+
|
|
141
|
+
if [ "$has_unbundled_deps" = true ]; then
|
|
142
|
+
(cd "$plugin_dir" && CI=true $PKG_MGR install --prod) >/dev/null 2>&1
|
|
143
|
+
fi
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
# ========== 更新配置文件 ==========
|
|
147
|
+
|
|
148
|
+
# 确保配置文件存在
|
|
149
|
+
if [ ! -f "$cfg" ]; then
|
|
150
|
+
mkdir -p "$(dirname "$cfg")"
|
|
151
|
+
echo '{}' > "$cfg"
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
# 校验配置文件是合法 JSON(用户可能手动编辑弄坏了格式)
|
|
155
|
+
if ! node -e "JSON.parse(require('fs').readFileSync(process.argv[1],'utf8'))" "$cfg" 2>/dev/null; then
|
|
156
|
+
result_exit "config_json_invalid"
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
# ---------- 单次 node 调用完成所有配置更新 ----------
|
|
160
|
+
# 一次启动 V8,通过环境变量安全传参,
|
|
161
|
+
# 顺序完成 plugins.entries / installs / deny / allow / channels 全部配置修改,
|
|
162
|
+
# 减少文件 I/O 次数(只读一次 + 写一次)。
|
|
163
|
+
|
|
164
|
+
version=$(UPGRADE_CFG="$cfg" UPGRADE_ID="$id" UPGRADE_SPEC="$spec" \
|
|
165
|
+
UPGRADE_PLUGIN_DIR="$plugin_dir" UPGRADE_APIKEY="$APIKEY" \
|
|
166
|
+
node -e '
|
|
167
|
+
const fs = require("fs");
|
|
168
|
+
const cfgPath = process.env.UPGRADE_CFG;
|
|
169
|
+
const pluginId = process.env.UPGRADE_ID;
|
|
170
|
+
const spec = process.env.UPGRADE_SPEC;
|
|
171
|
+
const pluginDir = process.env.UPGRADE_PLUGIN_DIR;
|
|
172
|
+
const envApiKey = process.env.UPGRADE_APIKEY || "";
|
|
173
|
+
|
|
174
|
+
function fail(reason) {
|
|
175
|
+
process.exit(1);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// 读取配置
|
|
179
|
+
let cfg;
|
|
180
|
+
try {
|
|
181
|
+
cfg = JSON.parse(fs.readFileSync(cfgPath, "utf8"));
|
|
182
|
+
} catch (e) {
|
|
183
|
+
fail("config_read_failed");
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// 读取插件版本
|
|
187
|
+
let version = "unknown";
|
|
188
|
+
try {
|
|
189
|
+
const pkg = JSON.parse(fs.readFileSync(pluginDir + "/package.json", "utf8"));
|
|
190
|
+
version = pkg.version || "unknown";
|
|
191
|
+
} catch (e) {}
|
|
192
|
+
|
|
193
|
+
// ---------- 1) 确保 plugins 基础结构存在 & 全局插件系统启用 ----------
|
|
194
|
+
if (!cfg.plugins) cfg.plugins = {};
|
|
195
|
+
// 确保全局插件系统生效(plugins.enabled 默认 true,仅显式 false 时需修复)
|
|
196
|
+
if (cfg.plugins.enabled === false) {
|
|
197
|
+
cfg.plugins.enabled = true;
|
|
198
|
+
}
|
|
199
|
+
if (!cfg.plugins.entries) cfg.plugins.entries = {};
|
|
200
|
+
if (!cfg.plugins.installs) cfg.plugins.installs = {};
|
|
201
|
+
|
|
202
|
+
// plugins.entries:启用插件
|
|
203
|
+
cfg.plugins.entries[pluginId] = { enabled: true };
|
|
204
|
+
|
|
205
|
+
// plugins.installs:安装记录
|
|
206
|
+
cfg.plugins.installs[pluginId] = {
|
|
207
|
+
source: "npm",
|
|
208
|
+
spec: spec,
|
|
209
|
+
installPath: pluginDir,
|
|
210
|
+
version: version,
|
|
211
|
+
installedAt: new Date().toISOString().replace(/\.\d{3}Z$/, ".000Z")
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// ---------- 2) 黑名单修复 ----------
|
|
215
|
+
if (Array.isArray(cfg.plugins.deny)) {
|
|
216
|
+
const idx = cfg.plugins.deny.indexOf(pluginId);
|
|
217
|
+
if (idx !== -1) {
|
|
218
|
+
cfg.plugins.deny.splice(idx, 1);
|
|
219
|
+
if (cfg.plugins.deny.length === 0) {
|
|
220
|
+
delete cfg.plugins.deny;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// ---------- 3) 白名单添加 ----------
|
|
226
|
+
if (Array.isArray(cfg.plugins.allow)) {
|
|
227
|
+
if (!cfg.plugins.allow.includes(pluginId)) {
|
|
228
|
+
cfg.plugins.allow.push(pluginId);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// ---------- 4) channel 配置:智能合并 ----------
|
|
233
|
+
if (!cfg.channels) cfg.channels = {};
|
|
234
|
+
const ch = cfg.channels[pluginId] || {};
|
|
235
|
+
|
|
236
|
+
// 迁移旧的 apiKey -> apiKeys
|
|
237
|
+
let apiKeys = Array.isArray(ch.apiKeys) ? [...ch.apiKeys] : [];
|
|
238
|
+
if (ch.apiKey && typeof ch.apiKey === "string") {
|
|
239
|
+
if (!apiKeys.includes(ch.apiKey)) {
|
|
240
|
+
apiKeys.push(ch.apiKey);
|
|
241
|
+
}
|
|
242
|
+
delete ch.apiKey;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// 如果通过环境变量传入了 APIKEY,确保它在 apiKeys 数组中(去重)
|
|
246
|
+
if (envApiKey && !apiKeys.includes(envApiKey)) {
|
|
247
|
+
apiKeys.push(envApiKey);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
ch.enabled = true;
|
|
251
|
+
ch.apiKeys = apiKeys;
|
|
252
|
+
cfg.channels[pluginId] = ch;
|
|
253
|
+
|
|
254
|
+
// ---------- 5) 写回配置文件 ----------
|
|
255
|
+
fs.writeFileSync(cfgPath, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
256
|
+
|
|
257
|
+
// 输出版本号到 stdout,供 shell 接收
|
|
258
|
+
process.stdout.write(version);
|
|
259
|
+
') || result_exit "config_update_failed"
|
|
260
|
+
|
|
261
|
+
# ========== 重启 Gateway ==========
|
|
262
|
+
|
|
263
|
+
openclaw gateway restart >/dev/null 2>&1 || true
|
|
264
|
+
|
|
265
|
+
# stdout 只输出这一行 RESULT,供前端解析
|
|
266
|
+
result_ok "$version"
|
package/dist/src/config.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ export declare const EVENT_SESSIONS_RESPONSE = "sessions:response";
|
|
|
84
84
|
export declare const REPLY_TIMEOUT = 120000;
|
|
85
85
|
/** 文件上传超时时间(ms) */
|
|
86
86
|
export declare const UPLOAD_TIMEOUT = 120000;
|
|
87
|
-
/** 媒体文件最大字节数(
|
|
87
|
+
/** 媒体文件最大字节数(100MB) */
|
|
88
88
|
export declare const MEDIA_MAX_BYTES: number;
|
|
89
89
|
/** 消息队列最大容量 */
|
|
90
90
|
export declare const MESSAGE_QUEUE_SIZE = 1000;
|
|
@@ -96,8 +96,8 @@ export declare const QUEUE_POLL_INTERVAL = 200;
|
|
|
96
96
|
export declare const DEDUP_TTL: number;
|
|
97
97
|
/** 去重 Map 最大容量 */
|
|
98
98
|
export declare const DEDUP_MAX_SIZE = 5000;
|
|
99
|
-
/** History
|
|
100
|
-
export declare const HISTORY_THROTTLE_MS =
|
|
99
|
+
/** History 请求防抖间隔(ms) */
|
|
100
|
+
export declare const HISTORY_THROTTLE_MS = 200;
|
|
101
101
|
/** 节流 Map 最大容量 */
|
|
102
102
|
export declare const HISTORY_THROTTLE_MAX_SIZE = 1000;
|
|
103
103
|
/** Health-monitor 心跳间隔(ms),需小于框架的 stale-socket 阈值(30 分钟) */
|
package/dist/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,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M,aAAa,SAAU,CAAC;AACrC,mBAAmB;AACnB,eAAO,MAAM,cAAc,SAAU,CAAC;AACtC,uBAAuB;AACvB,eAAO,MAAM,eAAe,QAAoB,CAAC;AAMjD,eAAe;AACf,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,aAAa;AACb,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAChD,iBAAiB;AACjB,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAMvC,mBAAmB;AACnB,eAAO,MAAM,SAAS,QAAiB,CAAC;AACxC,kBAAkB;AAClB,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,yBAAyB;AACzB,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,kBAAkB;AAClB,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAM9C,4DAA4D;AAC5D,eAAO,MAAM,yBAAyB,QAAc,CAAC;AACrD,yBAAyB;AACzB,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,iBAAiB;AACjB,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAe;AACf,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAOrC,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,EAAE,CAmB5D;AAED,aAAa;AACb,wBAAgB,cAAc,CAC5B,GAAG,EAAE,cAAc,EACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GACxB,wBAAwB,CA4C1B;AAED,gBAAgB;AAChB,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAE7D;AAED,yBAAyB;AACzB,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,CAAC,sBAAsB,CAAC,GACvC,cAAc,CAgBhB"}
|
package/dist/src/config.js
CHANGED
|
@@ -165,8 +165,8 @@ export const EVENT_SESSIONS_RESPONSE = "sessions:response";
|
|
|
165
165
|
export const REPLY_TIMEOUT = 120_000;
|
|
166
166
|
/** 文件上传超时时间(ms) */
|
|
167
167
|
export const UPLOAD_TIMEOUT = 120_000;
|
|
168
|
-
/** 媒体文件最大字节数(
|
|
169
|
-
export const MEDIA_MAX_BYTES =
|
|
168
|
+
/** 媒体文件最大字节数(100MB) */
|
|
169
|
+
export const MEDIA_MAX_BYTES = 100 * 1024 * 1024;
|
|
170
170
|
// ============================================================
|
|
171
171
|
// 消息队列配置
|
|
172
172
|
// ============================================================
|
|
@@ -183,8 +183,8 @@ export const QUEUE_POLL_INTERVAL = 200;
|
|
|
183
183
|
export const DEDUP_TTL = 10 * 60 * 1000;
|
|
184
184
|
/** 去重 Map 最大容量 */
|
|
185
185
|
export const DEDUP_MAX_SIZE = 5000;
|
|
186
|
-
/** History
|
|
187
|
-
export const HISTORY_THROTTLE_MS =
|
|
186
|
+
/** History 请求防抖间隔(ms) */
|
|
187
|
+
export const HISTORY_THROTTLE_MS = 200;
|
|
188
188
|
/** 节流 Map 最大容量 */
|
|
189
189
|
export const HISTORY_THROTTLE_MAX_SIZE = 1000;
|
|
190
190
|
// ============================================================
|
package/dist/src/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAE5C,WAAW;AACX,MAAM,WAAW,GAAG,mBAAmB,CAAC;AACxC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAElD,+DAA+D;AAC/D,cAAc;AACd,+DAA+D;AAE/D,aAAa;AACb,MAAM,CAAC,MAAM,MAAM,GAAG,2BAA2B,CAAC;AAElD,qBAAqB;AACrB,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;AACxC,oBAAoB;AACpB,MAAM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
|
5
|
+
/**
|
|
6
|
+
* 对同一用户的 history 请求做防抖:
|
|
7
|
+
* 在 HISTORY_THROTTLE_MS 窗口内如果有新请求到来,取消前一次,
|
|
8
|
+
* 只在最后一次请求后延迟 HISTORY_THROTTLE_MS 再执行 callback。
|
|
9
|
+
*/
|
|
10
|
+
export declare function debounceHistoryRequest(userId: string, callback: () => void): void;
|
|
6
11
|
export declare function generateMsgId(): string;
|
|
7
12
|
//# sourceMappingURL=dedup.d.ts.map
|
package/dist/src/dedup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedup.d.ts","sourceRoot":"","sources":["../../src/dedup.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAUtD;AASD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"dedup.d.ts","sourceRoot":"","sources":["../../src/dedup.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAUtD;AASD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAsBjF;AAQD,wBAAgB,aAAa,IAAI,MAAM,CAKtC"}
|