peertable 0.8.46 → 0.8.47

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peertable",
3
- "version": "0.8.46",
3
+ "version": "0.8.47",
4
4
  "description": "A round table of peer agents. No orchestrator at the head. Turn Claude Code, Codex, and Grok sessions into a team of equal, long-lived peers.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/room/client.mjs CHANGED
@@ -14,7 +14,7 @@ import { boundedRecent, boundedUnread } from './message-bounds.mjs'
14
14
 
15
15
  // client.mjs 側のハードコード版数。package.json の version と一致していることを
16
16
  // diagnostics の version_consistency が見る(2 つの版数源の drift 検出。決定45)
17
- const MCP_VERSION = '0.8.46'
17
+ const MCP_VERSION = '0.8.47'
18
18
  const PKG_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..')
19
19
 
20
20
  const USAGE = `usage:
@@ -10,6 +10,9 @@ if [ -z "${TMPDIR:-}" ] && command -v getconf >/dev/null; then
10
10
  TMPDIR="$(getconf DARWIN_USER_TEMP_DIR 2>/dev/null || true)"
11
11
  [ -n "$TMPDIR" ] && export TMPDIR
12
12
  fi
13
+ # launchd環境には書込tokenが無い。bridgeのreceipt書込とresumeの席起動に必要なので、
14
+ # 標準の置き場から読み込む(無ければ従来どおり進み、書込systemは自分で degrade を報告する)
15
+ [ -f "$HOME/.config/peertable.env" ] && . "$HOME/.config/peertable.env"
13
16
  scripts="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
14
17
  for state in /Users/kite/Developer/*/.team/setup-state.json; do
15
18
  [ -f "$state" ] || continue
@@ -36,3 +39,44 @@ print(' '.join(m['name'] for m in ms if m.get('observe') or m.get('harness')))"
36
39
  fi
37
40
  fi
38
41
  done
42
+
43
+ # ---- 席の自動蘇生(オーナー恒久裁定「死んだら自動で起こせ。毎回手で復活させるな」)----
44
+ # tmux server死で全席が消える事故が反復した(実被弾 2026-08-29〜30に3回・原因未特定)。
45
+ # 台帳に居るのにtmux sessionが無い席を検知し、**工程が残っている時だけ**resumeで再着席させる。
46
+ # 仕事ゼロの時は起こさない(quotaを浪費しない。SEAT_TUI_GONE通知が親へ届く経路は別に生きている)。
47
+ # 二重起動はresume側のlaunch-seatが同名席を処理するが、周期の重複実行はlockで抑止する。
48
+ for state in /Users/kite/Developer/*/.team/setup-state.json; do
49
+ [ -f "$state" ] || continue
50
+ proj="$(dirname "$(dirname "$state")")"
51
+ lock="$proj/.team/seat-revive.lock"
52
+ # 10分cooldown(前回の蘇生が走っていれば触らない)
53
+ if [ -f "$lock" ] && [ -n "$(find "$lock" -mmin -10 2>/dev/null)" ]; then continue; fi
54
+ server="$(python3 -c "import json;print(json.load(open('$state'))['server_url'])" 2>/dev/null)"
55
+ room="$(python3 -c "import json;print(json.load(open('$state'))['room'])" 2>/dev/null)"
56
+ [ -n "$server" ] && [ -n "$room" ] || continue
57
+ sockprefix=$(node "$scripts/tmux-socket.mjs" --prefix 2>/dev/null) || continue
58
+ # shellcheck disable=SC2206
59
+ conn=($sockprefix)
60
+ dead=""
61
+ for seat in $(curl -s --max-time 10 "$server/api/$room/members" | python3 -c "
62
+ import json,sys
63
+ try: ms=json.load(sys.stdin).get('members',[])
64
+ except Exception: ms=[]
65
+ print(' '.join(m['name'] for m in ms if m.get('harness')))" 2>/dev/null); do
66
+ tmux "${conn[@]}" has-session -t "peer-$seat" 2>/dev/null || dead="$dead $seat"
67
+ done
68
+ [ -n "$dead" ] || continue
69
+ work=$(cd "$proj" && lattice todo status --json 2>/dev/null | python3 -c "
70
+ import json,sys
71
+ try: d=json.load(sys.stdin)
72
+ except Exception: print(0); raise SystemExit
73
+ print(len(d.get('next_ready',[]))+len(d.get('active_set',[]))+len(d.get('audit_pending',[])))" 2>/dev/null)
74
+ if [ "${work:-0}" -gt 0 ]; then
75
+ date -u +%FT%TZ > "$lock"
76
+ echo "$(date -u +%FT%TZ) 席消失を検知($proj:$dead / 残工程 $work)。resumeで自動蘇生する"
77
+ (cd "$proj" && bash "$scripts/resume.sh" "$proj" >> "$proj/.team/seat-revive.log" 2>&1) \
78
+ || echo "$(date -u +%FT%TZ) 自動蘇生に失敗: $proj(seat-revive.log参照)"
79
+ else
80
+ echo "$(date -u +%FT%TZ) 席消失を検知したが残工程ゼロのため起こさない($proj:$dead)"
81
+ fi
82
+ done