show compaction as it happens and open tool calls while they run
Compaction was the one thing the harness does that emitted nothing at all while it ran, and it can run for minutes — silence that reads as a hung turn, which costs a server restart to discover it wasn't. The sidecar now reports both ends: the start from the PreCompact hook, the finish from the compact_boundary message with the token count, both durable so a reload or a reconnect still sees them. Tool rows open themselves while they run and hold for five seconds after their result, so the inputs are on screen at the moment the call is made rather than after the fact. The clock lives outside React, keyed by tool call id: rows are virtualised, so unmounting is not the call ending, and a fast call can render its start and its result together — a row that only opens when it catches the pending state never opens for exactly the quickest calls. A click outranks the clock for as long as the row lives. A failure behaves identically and differs only in colour, so it stays findable by scanning and nameable in conversation. Shell logs move off the green-on-black pre onto the shared code surface, which is the one block that had no copy button and the one you most often want to hand to someone else. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -150,6 +150,25 @@ describe('processLine', () => {
|
||||
expect(sessionIds).toEqual(['sess_abc123']);
|
||||
});
|
||||
|
||||
test('handles compact_boundary — emits compact:done with what it dropped', () => {
|
||||
const state = createParseState();
|
||||
const { events, callbacks } = makeCallbacks();
|
||||
const line = JSON.stringify({
|
||||
type: 'system',
|
||||
subtype: 'compact_boundary',
|
||||
compact_metadata: { trigger: 'auto', pre_tokens: 168215 },
|
||||
});
|
||||
processLine(line, state, callbacks);
|
||||
expect(events).toEqual([{ type: 'compact:done', trigger: 'auto', preTokens: 168215 }]);
|
||||
});
|
||||
|
||||
test('handles compact_boundary with no metadata — still announces the boundary', () => {
|
||||
const state = createParseState();
|
||||
const { events, callbacks } = makeCallbacks();
|
||||
processLine(JSON.stringify({ type: 'system', subtype: 'compact_boundary' }), state, callbacks);
|
||||
expect(events).toEqual([{ type: 'compact:done', trigger: 'auto', preTokens: 0 }]);
|
||||
});
|
||||
|
||||
test('handles result — sets gotResult, emits cost', () => {
|
||||
const state = createParseState();
|
||||
state.textBuffers.set('', 'trailing');
|
||||
|
||||
Reference in New Issue
Block a user