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.
Files changed (41) hide show
  1. package/dist/public/data/scripts/manifest.json +5 -5
  2. package/dist/public/data/scripts/upgrade.211d7e4c.sh +266 -0
  3. package/dist/public/data/scripts/upgrade.sh +266 -0
  4. package/dist/src/config.d.ts +3 -3
  5. package/dist/src/config.d.ts.map +1 -1
  6. package/dist/src/config.js +4 -4
  7. package/dist/src/config.js.map +1 -1
  8. package/dist/src/dedup.d.ts +6 -1
  9. package/dist/src/dedup.d.ts.map +1 -1
  10. package/dist/src/dedup.js +27 -14
  11. package/dist/src/dedup.js.map +1 -1
  12. package/dist/src/gateway.d.ts.map +1 -1
  13. package/dist/src/gateway.js +9 -6
  14. package/dist/src/gateway.js.map +1 -1
  15. package/dist/src/history/text-processing.d.ts.map +1 -1
  16. package/dist/src/history/text-processing.js +2 -0
  17. package/dist/src/history/text-processing.js.map +1 -1
  18. package/dist/src/inbound.js +2 -2
  19. package/dist/src/inbound.js.map +1 -1
  20. package/dist/src/socket-handlers.d.ts.map +1 -1
  21. package/dist/src/socket-handlers.js +45 -45
  22. package/dist/src/socket-handlers.js.map +1 -1
  23. package/dist/src/streaming/delta-tracker.d.ts +34 -0
  24. package/dist/src/streaming/delta-tracker.d.ts.map +1 -0
  25. package/dist/src/streaming/delta-tracker.js +145 -0
  26. package/dist/src/streaming/delta-tracker.js.map +1 -0
  27. package/dist/src/streaming/index.d.ts +12 -0
  28. package/dist/src/streaming/index.d.ts.map +1 -0
  29. package/dist/src/streaming/index.js +13 -0
  30. package/dist/src/streaming/index.js.map +1 -0
  31. package/dist/src/streaming/stream-reply-sink.d.ts +59 -0
  32. package/dist/src/streaming/stream-reply-sink.d.ts.map +1 -0
  33. package/dist/src/streaming/stream-reply-sink.js +293 -0
  34. package/dist/src/streaming/stream-reply-sink.js.map +1 -0
  35. package/dist/src/streaming/types.d.ts +45 -0
  36. package/dist/src/streaming/types.d.ts.map +1 -0
  37. package/dist/src/streaming/types.js +7 -0
  38. package/dist/src/streaming/types.js.map +1 -0
  39. package/package.json +1 -1
  40. package/dist/public/data/scripts/preflight.78097a58.sh +0 -94
  41. package/dist/public/data/scripts/preflight.sh +0 -94
@@ -1,94 +0,0 @@
1
- #!/bin/bash
2
-
3
- # ========== lightclawbot 插件前置检查脚本 ==========
4
- # 用途:快速判断 lightclawbot 插件是否可用
5
- # 输出:最后一行固定为 RESULT:{...} JSON,供前端解析
6
- # - 可用: RESULT:{"status":"ok","version":"x.y.z"}
7
- # - 缺 openclaw: RESULT:{"status":"need_openclaw","reason":"..."}
8
- # - 缺 lightclawbot:RESULT:{"status":"need_install","reason":"..."}
9
- # - 缺 apiKey: RESULT:{"status":"need_apikey","reason":"apikeys_empty"}
10
- #
11
- # 使用方式:
12
- # 本地执行: bash scripts/preflight.sh
13
- # CDN 执行: bash <(curl -fsSL https://your-cdn.com/preflight.sh)
14
-
15
- id="lightclawbot"
16
- cfg="$HOME/.openclaw/openclaw.json"
17
- plugin_dir="$HOME/.openclaw/extensions/${id}"
18
-
19
- # ---------- 1. 检查 openclaw 是否可用 ----------
20
-
21
- # 加载 nvm 环境(openclaw 可能依赖 nvm 管理的 node)
22
- export NVM_DIR="$HOME/.nvm"
23
- [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
24
-
25
- if ! command -v openclaw &>/dev/null; then
26
- echo "RESULT:{\"status\":\"need_openclaw\",\"reason\":\"openclaw_not_found\"}"
27
- exit 1
28
- fi
29
-
30
- # 验证 openclaw 可执行
31
- # 已知输出格式:
32
- # - OpenClaw 2026.3.8 (3caab92) (新版本,带前缀 + commit hash)
33
- # - OpenClaw 2026.3.2 (带前缀,无 commit hash)
34
- # - 2026.3.2 (旧版本,直接输出版本号,无前缀)
35
- openclaw_output=$(openclaw -v 2>/dev/null || true)
36
- if ! echo "$openclaw_output" | grep -qiE '(^OpenClaw[/ ])?[0-9]+\.[0-9]+'; then
37
- echo "RESULT:{\"status\":\"need_openclaw\",\"reason\":\"openclaw_not_working\"}"
38
- exit 1
39
- fi
40
-
41
- # ---------- 2. 检查配置文件是否存在 ----------
42
-
43
- if [ ! -f "$cfg" ]; then
44
- echo "RESULT:{\"status\":\"need_install\",\"reason\":\"config_not_found\"}"
45
- exit 1
46
- fi
47
-
48
- # ---------- 3. 检查插件是否已安装(目录 + package.json) ----------
49
-
50
- if [ ! -d "$plugin_dir" ] || [ ! -f "$plugin_dir/package.json" ]; then
51
- echo "RESULT:{\"status\":\"need_install\",\"reason\":\"plugin_not_installed\"}"
52
- exit 1
53
- fi
54
-
55
- # ---------- 4. 检查配置文件中插件注册是否完整 ----------
56
-
57
- # 需要 jq 来解析 JSON
58
- if ! command -v jq &>/dev/null; then
59
- echo "RESULT:{\"status\":\"need_install\",\"reason\":\"jq_not_found\"}"
60
- exit 1
61
- fi
62
-
63
- # 4a. plugins.entries 中是否存在且 enabled
64
- plugin_enabled=$(jq -r ".plugins.entries.\"${id}\".enabled // false" "$cfg" 2>/dev/null)
65
- if [ "$plugin_enabled" != "true" ]; then
66
- echo "RESULT:{\"status\":\"need_install\",\"reason\":\"plugin_not_enabled\"}"
67
- exit 1
68
- fi
69
-
70
- # 4b. plugins.installs 中是否有安装记录
71
- if ! jq -e ".plugins.installs.\"${id}\"" "$cfg" > /dev/null 2>&1; then
72
- echo "RESULT:{\"status\":\"need_install\",\"reason\":\"plugin_install_record_missing\"}"
73
- exit 1
74
- fi
75
-
76
- # 4c. channels 中是否配置且 enabled
77
- channel_enabled=$(jq -r ".channels.\"${id}\".enabled // false" "$cfg" 2>/dev/null)
78
- if [ "$channel_enabled" != "true" ]; then
79
- echo "RESULT:{\"status\":\"need_install\",\"reason\":\"channel_not_enabled\"}"
80
- exit 1
81
- fi
82
-
83
- # 4d. channels 中 apiKeys 是否配置且非空
84
- apikeys_count=$(jq -r ".channels.\"${id}\".apiKeys // [] | length" "$cfg" 2>/dev/null)
85
- if [ "$apikeys_count" = "0" ] || [ -z "$apikeys_count" ]; then
86
- echo "RESULT:{\"status\":\"need_install\",\"reason\":\"apikeys_empty\"}"
87
- exit 1
88
- fi
89
-
90
- # ---------- 5. 全部通过,插件可用 ----------
91
-
92
- version=$(jq -r '.version // "unknown"' "$plugin_dir/package.json")
93
- echo "RESULT:{\"status\":\"ok\",\"version\":\"${version}\"}"
94
- exit 0