dsh-soul-forging 0.1.5 → 0.1.6

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/bin/sync CHANGED
@@ -10,10 +10,15 @@ if ! flock -n 9; then echo "同步已在运行,跳过"; exit 0; fi
10
10
 
11
11
  R() { bash "$BIN_DIR/runlog" "$@"; }; rc=0
12
12
  bash "$BIN_DIR/runlog" "live-summary" -- "$PY" "$MEMKIT_ROOT/brain/fix-live-summary.py" || rc=$((rc+1))
13
- bash "$BIN_DIR/runlog" "archive-log" -- bash "$BIN_DIR/archive-log" || rc=$((rc+2))
13
+ bash "$BIN_DIR/runlog" "archive-log" -- "$PY" "$BIN_DIR/archive-log" || rc=$((rc+2))
14
14
  bash "$BIN_DIR/runlog" "index" -- "$PY" "$MEMKIT_ROOT/brain/index.py" || rc=$((rc+4))
15
- bash "$BIN_DIR/runlog" "reload" -- bash -c "curl -s -m 5 -X POST $BRAIN_URL/reload >/dev/null" || rc=$((rc+8))
16
- bash "$BIN_DIR/runlog" "check" -- bash "$BIN_DIR/soul" check || rc=$((rc+16))
15
+ # 服务没起就不算失败 —— 用户不一定要常驻它,检索会自己现算
16
+ if curl -s -m 2 "$BRAIN_URL/health" 2>/dev/null | grep -q '"ok"'; then
17
+ bash "$BIN_DIR/runlog" "reload" -- bash -c "curl -s -m 5 -X POST $BRAIN_URL/reload >/dev/null" || rc=$((rc+8))
18
+ else
19
+ echo "(检索服务没起,跳过重载——不影响使用)"
20
+ fi
21
+ bash "$BIN_DIR/runlog" "check" -- "$PY" "$BIN_DIR/soul" check || rc=$((rc+16))
17
22
  [ -n "${SOUL_BACKUP_CMD:-}" ] && { bash "$BIN_DIR/runlog" "backup" -- bash -c "$SOUL_BACKUP_CMD" || rc=$((rc+32)); }
18
23
 
19
24
  if [ $rc -eq 0 ]; then echo "sync ok"; else echo "sync 有失败项 rc=$rc(看 $BRAIN_DIR/alarm.log)"; fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-soul-forging",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Separate Vessels, One Heart · 异体同心 —— 给 AI 的可迁移长期记忆与铸魂流程:markdown 记忆库 + 小脑检索 + 能长出来的性格。纯本地,不要服务器。",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/scripts/smoke.sh CHANGED
@@ -58,9 +58,16 @@ run() { # 名字 命令...
58
58
 
59
59
  run "soul-init" "$BIN/soul-init"
60
60
  run "soul-boot" "$BIN/soul-boot" --list
61
- run "soul-sync" "$BIN/soul-sync"
61
+ # sync 永远 exit 0(失败也返回 0,只是打印"有失败项"),所以必须看输出
62
+ sync_ok() {
63
+ local out; out=$("$BIN/soul-sync" 2>&1)
64
+ echo "$out" | grep -q "^sync ok$" && ok "soul-sync(干净)" && return 0
65
+ bad "soul-sync 有失败项" "$(echo "$out" | grep -E '失败' | head -1)"
66
+ return 1
67
+ }
68
+ sync_ok
62
69
  run "soul (write)" "$BIN/soul" write "烟测写的一条"
63
- run "soul-sync 2" "$BIN/soul-sync"
70
+ sync_ok
64
71
  run "soul-recall" "$BIN/soul-recall" "烟测" 1
65
72
  echo "$LAST_OUT" | grep -q "烟测写的一条" && ok "检索命中刚写的内容" || bad "检索没命中"
66
73
 
@@ -69,7 +76,7 @@ PORT=$(( (RANDOM % 2000) + 39000 ))
69
76
  BRAIN_PORT=$PORT "$BIN/soul-serve" >/dev/null 2>&1
70
77
  sleep 1
71
78
  curl -s -m 3 "http://127.0.0.1:$PORT/health" | grep -q '"ok": true' && ok "soul-serve 起得来" || bad "soul-serve"
72
- BRAIN_PORT=$PORT "$BIN/soul-sync" >/dev/null 2>&1 && ok "sync(服务在跑时)" || bad "sync(服务在跑时)"
79
+ BRAIN_PORT=$PORT "$BIN/soul-sync" 2>&1 | grep -q "^sync ok$" && ok "sync(服务在跑时)" || bad "sync(服务在跑时)"
73
80
 
74
81
  run "soul-check" "$BIN/soul" check
75
82
  run "soul-forget" "$BIN/soul-forget"