@cocorograph/hub-agent 0.7.95 → 0.7.96

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": "@cocorograph/hub-agent",
3
- "version": "0.7.95",
3
+ "version": "0.7.96",
4
4
  "description": "Hub Hosted Cockpit のローカル常駐 agent。Hub と outbound WSS で接続し、ローカルの tmux/pty を中継する。",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
package/src/main.mjs CHANGED
@@ -2636,7 +2636,9 @@ export function startStateLoop({ client, plugins, logger, intervalMs, claudeBrid
2636
2636
  const chatCliKind = sessionCliKind
2637
2637
  const contextSessionId =
2638
2638
  chat?.sessionId ??
2639
- (sessionCliKind === "claude" ? boundSessions?.get(s.session_name) ?? null : codexThreadId)
2639
+ (sessionCliKind === "claude"
2640
+ ? boundSessions?.get(s.session_name) ?? `unbound:${s.session_name}`
2641
+ : codexThreadId)
2640
2642
 
2641
2643
  const prev = lastByName.get(s.session_name)
2642
2644
  if (
package/src/state.mjs CHANGED
@@ -313,6 +313,16 @@ export function detectContextPctFromText(text) {
313
313
  if (Number.isFinite(n) && n >= 0 && n <= 100) return n
314
314
  }
315
315
  }
316
+ // Claude の初回 Chrome 連携確認は、TUI セッションがまだ会話を開始していないことを
317
+ // 明示する画面。context 行は未描画だが使用量は実際に 0% なので、同一 cwd に残った
318
+ // 過去 jsonl の高使用率を採用せず 0% を返す。文言の一部だけで誤認しないよう、製品名と
319
+ // 選択肢を対にして判定する。
320
+ if (
321
+ /Claude in Chrome extension detected/i.test(text) &&
322
+ /Yes,? use my browser/i.test(text)
323
+ ) {
324
+ return 0
325
+ }
316
326
  return null
317
327
  }
318
328
 
package/src/tmux.mjs CHANGED
@@ -687,13 +687,19 @@ export async function listSessions(opts = {}) {
687
687
  boundSessionId(opts.boundSessions, s.name) ||
688
688
  (cwd && opts.claudeBridge?.liveSessionIdForCwd?.(cwd)) ||
689
689
  null
690
- const jsonlInfo = cwd ? await jsonlContextForCwd(cwd, boundId) : null
690
+ // cwd だけでは同じリポジトリで並走する別 Claude / subagent / 過去会話を区別できない。
691
+ // bound ID が無い状態で statusLine/jsonl の「cwd 最新値」を使うと、再起動後や未オープンの
692
+ // tmux セッションへ別会話の 98〜100% が混入する。実際に値の帰属先を示せる bound session
693
+ // がある場合だけ per-session cache を採用し、無ければ capture-pane の当該行由来値 (または
694
+ // null) に留める。null は「不明」であり、他会話の数値を表示するより正しい。
695
+ const hasBoundSession = typeof boundId === "string" && boundId.length > 0
696
+ const jsonlInfo = hasBoundSession && cwd ? await jsonlContextForCwd(cwd, boundId) : null
691
697
  const context_pct =
692
698
  freshUnbound
693
699
  ? 0
694
700
  : jsonlInfo?.isReset && typeof jsonlInfo.percent === "number"
695
701
  ? jsonlInfo.percent
696
- : typeof fromStatusLine === "number"
702
+ : hasBoundSession && typeof fromStatusLine === "number"
697
703
  ? fromStatusLine
698
704
  : typeof jsonlInfo?.percent === "number"
699
705
  ? jsonlInfo.percent