Server: serve a Claude chat's history page from a per-file line index
Reading a history page parsed the whole session file (tens of MB) on every chat_messages. A per-file index now records which lines build each shown message; a page re-reads and replays only its own messages' lines, and the index follows appends by reading only the new bytes. Results match the whole-file read (compared page by page on synthetic transcripts); shapes the index cannot replay exactly fall back to the whole-file read. chat_subscribe may ask (history: true) for the newest page in its reply, read once the subscription is attached, saving the client a round trip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -184,7 +184,7 @@ func handleChat(ctx context.Context, request protocol.Message, broker chatBroker
|
||||
handleChatPrompt(ctx, request, broker, hub, registry, clientID, write)
|
||||
return true
|
||||
case protocol.ChatSubscribe:
|
||||
handleChatSubscribe(request, broker, hub, clientID, write)
|
||||
handleChatSubscribe(ctx, request, broker, hub, clientID, write)
|
||||
return true
|
||||
case protocol.ChatUnqueue:
|
||||
handleChatUnqueue(ctx, request, hub, write)
|
||||
|
||||
Reference in New Issue
Block a user