@cocorograph/hub-agent 0.8.79 → 0.8.81
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,5 +1,6 @@
|
|
|
1
1
|
import path from "node:path"
|
|
2
2
|
import { listChatTargets } from "./chat-targets.mjs"
|
|
3
|
+
import { hubProjectsBase } from "./chat-workspace.mjs"
|
|
3
4
|
import { getChatSignal as defaultGetChatSignal } from "./chat-signals.mjs"
|
|
4
5
|
import { describeLiveSessionsUnion } from "./live-sessions.mjs"
|
|
5
6
|
import { sessionNameFor } from "./session-names.mjs"
|
|
@@ -142,5 +143,7 @@ export async function buildChatSessionsSnapshot({
|
|
|
142
143
|
)
|
|
143
144
|
if (replace) live[prior] = attachChatSignal(item, cwd, getChatSignal, logger)
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
+
// chat-targets.mjs の fs.readdir(hubProjectsBase()) と同じ絶対パスに揃える(~ は展開しない)。
|
|
147
|
+
const projects_base = path.resolve(hubProjectsBase())
|
|
148
|
+
return { targets, live, errors, projects_base }
|
|
146
149
|
}
|
|
@@ -2870,12 +2870,20 @@ export class ClaudeStreamBridge extends EventEmitter {
|
|
|
2870
2870
|
// 新規 query を起動せずそのセッションへ再アタッチする。これにより端末スリープ/再接続でも
|
|
2871
2871
|
// ターンは落ちず、以降のイベントは新しい stream_id 経由でライブに流れる
|
|
2872
2872
|
// (= 通常の生成中表示と同じ)。再接続前の確定分は browser の jsonl hydrate で復元する。
|
|
2873
|
+
// ⚠️ 新規生成へ落ちた理由を 1 語で残す。ここを通ると同じ cwd に会話オブジェクトが 1 つ増え、
|
|
2874
|
+
// 古い方は close されないので一覧に残り続ける (chat.sessions の名前衝突になる)。理由が
|
|
2875
|
+
// `index_miss` なら「browser が持っている resume id が索引に無い」= /clear・compaction での
|
|
2876
|
+
// session_id 回転後に古い id で再接続した疑い (下の onEvent で旧キーを delete しているため)、
|
|
2877
|
+
// `not_reattachable` なら「索引にはあるが常駐 query が終了済み」= 古い session の掃除漏れで、
|
|
2878
|
+
// 直し方が正反対になる。2026-09-17 にログからこの 2 つを区別できず判別に詰まった。
|
|
2879
|
+
let reattachSkip = "no_resume"
|
|
2873
2880
|
if (resumeSessionId) {
|
|
2874
2881
|
// ⚠️ cwd 境界 (T06271): _liveBySession は **複合キー (cwd+session_id)** なので、別 cwd の
|
|
2875
2882
|
// 同一 session_id は別エントリに分離される。よって cwd=A の resume を cwd=B から
|
|
2876
2883
|
// attach しても引き当たらず、越境 reattach が原理的に起きない (session_id は本来
|
|
2877
2884
|
// ユニークだが異常系でも cwd を跨がない)。
|
|
2878
2885
|
const live = this._liveBySession.get(this._liveKeyFor(scwd, resumeSessionId))
|
|
2886
|
+
reattachSkip = live ? "not_reattachable" : "index_miss"
|
|
2879
2887
|
// R1(b): !_closed だけでなく「常駐子プロセスが実生存しているか」も確認する。子が死んで
|
|
2880
2888
|
// いれば reattach せず下の新規 spawn 経路へフォールバックし、死んだ session を引き当てない。
|
|
2881
2889
|
if (live && live._isReattachable()) {
|
|
@@ -3026,7 +3034,16 @@ export class ClaudeStreamBridge extends EventEmitter {
|
|
|
3026
3034
|
this._liveBySession.set(key, session)
|
|
3027
3035
|
}
|
|
3028
3036
|
this.logger?.info(
|
|
3029
|
-
{
|
|
3037
|
+
{
|
|
3038
|
+
stream_id,
|
|
3039
|
+
cwd: session.cwd,
|
|
3040
|
+
model: session.model,
|
|
3041
|
+
// ⚠️ ブール値ではなく id そのものを出す。reattach 側 (上) は id を出しているので、
|
|
3042
|
+
// 同じ値で突き合わせて「その id が過去に live だったか」を追える。ブールだけだと
|
|
3043
|
+
// 「古い id で来た」と「知らない id で来た」を区別できない。
|
|
3044
|
+
resume: resumeSessionId || null,
|
|
3045
|
+
reattach_skip: reattachSkip,
|
|
3046
|
+
},
|
|
3030
3047
|
"claude stream attached",
|
|
3031
3048
|
)
|
|
3032
3049
|
// per-message モデルでは attach 時点では query() を起動しない (即 ready)。
|