@cocorograph/hub-agent 0.8.119 → 0.8.120
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 +1 -1
- package/src/main.mjs +27 -7
package/package.json
CHANGED
package/src/main.mjs
CHANGED
|
@@ -2862,6 +2862,7 @@ function logHistoryDelivery(ctx, via, stream_id, timing, payload, sendOk) {
|
|
|
2862
2862
|
ws_buffered_before: timing.ws_buffered_before ?? null,
|
|
2863
2863
|
payload_bytes: timing.payload_bytes ?? null,
|
|
2864
2864
|
stringify_ms: timing.stringify_ms ?? null,
|
|
2865
|
+
widened: timing.widened === true,
|
|
2865
2866
|
events: payload?.events?.length || 0, total_lines: payload?.total_lines || 0,
|
|
2866
2867
|
truncated: payload?.truncated === true, send_ok: Boolean(sendOk),
|
|
2867
2868
|
ws_buffered: ctx.client.bufferedAmount ?? null,
|
|
@@ -2897,10 +2898,18 @@ export function sendClaudeAttachHistory(ctx, stream_id, payload, timing) {
|
|
|
2897
2898
|
}
|
|
2898
2899
|
}
|
|
2899
2900
|
|
|
2900
|
-
// attach 時の先回り push
|
|
2901
|
-
//
|
|
2902
|
-
//
|
|
2903
|
-
|
|
2901
|
+
// attach 時の先回り push は末尾 100 元行に絞る (2026-10-27)。500 行だと初回 frame が
|
|
2902
|
+
// 中央値 375KB・最大 1.8MB になり、送信待ちと Hub/ブラウザの JSON 処理が ready→表示の
|
|
2903
|
+
// 遅れの大半を占めていた (100 行で中央値 72KB・最大 304KB、親の表示イベント 34〜54 件)。
|
|
2904
|
+
// ⚠️ ブラウザ側の窓 (INITIAL_CLAUDE_HISTORY_LINES=500) は変えない。追加取得は
|
|
2905
|
+
// 「現在の窓 × 2」を要求し、受け取った窓から今の先頭イベントより前だけを取り出すため、
|
|
2906
|
+
// push が 100 行でも次の要求は 1000 行になり境界を必ず含む。逆にブラウザ側を 100 にすると、
|
|
2907
|
+
// 旧 agent の 500 行 push の後に 200 行を要求して境界が見つからず追加取得が止まる。
|
|
2908
|
+
// ⚠️ 100 行の窓に境界候補 (照合キーを持つイベント) が無いと、旧ブラウザは追加取得が止まる。
|
|
2909
|
+
// Hub 側は候補ゼロの窓を権威的に取り込む対応を 2026-10-28 に本番反映済み (Hub PR #5700)。
|
|
2910
|
+
// 対応前の画面を開いたままのタブだけは再読み込みが要る。
|
|
2911
|
+
export const ATTACH_HISTORY_PUSH_LINES = 100
|
|
2912
|
+
export const ATTACH_HISTORY_PUSH_FALLBACK_LINES = 500
|
|
2904
2913
|
|
|
2905
2914
|
/**
|
|
2906
2915
|
* claude.attach の ready 直後にpushする履歴を組み立てる。
|
|
@@ -2943,14 +2952,25 @@ export async function loadClaudeAttachHistory({
|
|
|
2943
2952
|
const projectsRoot = resolved
|
|
2944
2953
|
? resolved.projectsRoot
|
|
2945
2954
|
: await getActiveProjectsRoot()
|
|
2946
|
-
const
|
|
2955
|
+
const fetchWindow = (maxLines) => fetchHistoryFn({
|
|
2947
2956
|
cwd,
|
|
2948
2957
|
session_id: sessionId,
|
|
2949
|
-
maxLines
|
|
2958
|
+
maxLines,
|
|
2950
2959
|
projectsRoot,
|
|
2951
2960
|
logger,
|
|
2952
2961
|
timing,
|
|
2953
|
-
})
|
|
2962
|
+
})
|
|
2963
|
+
const result = await timeHistoryPhase(timing, "fetch_ms", async () => {
|
|
2964
|
+
const narrow = await fetchWindow(ATTACH_HISTORY_PUSH_LINES)
|
|
2965
|
+
// ⚠️ 末尾 100 行が表示対象外の行 (progress 等) だけだと events が空になり、ブラウザの
|
|
2966
|
+
// 追加取得は「今の先頭イベント」を境界にするため境界が無く止まる (cross-review major)。
|
|
2967
|
+
// 表示イベントが 1 件も無く続きがあるときだけ、従来の 500 行で読み直す (従来と同等以上)。
|
|
2968
|
+
if (narrow?.truncated === true && !narrow.error && (narrow.events?.length || 0) === 0) {
|
|
2969
|
+
timing.widened = true
|
|
2970
|
+
return fetchWindow(ATTACH_HISTORY_PUSH_FALLBACK_LINES)
|
|
2971
|
+
}
|
|
2972
|
+
return narrow
|
|
2973
|
+
})
|
|
2954
2974
|
return withProfile({
|
|
2955
2975
|
type: "claude.history.response",
|
|
2956
2976
|
session_id: sessionId,
|