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:
@@ -163,6 +163,15 @@ function handleSystem(msg: Record<string, unknown>, callbacks: StreamParserCallb
|
||||
status: (msg.status as 'completed' | 'failed' | 'stopped') ?? 'completed',
|
||||
summary: (msg.summary as string) ?? '',
|
||||
});
|
||||
} else if (subtype === 'compact_boundary') {
|
||||
// The harness rewrote its own context. This lands *after* the work — the matching start comes from
|
||||
// the `PreCompact` hook — and is the only place the size of what was dropped is reported.
|
||||
const meta = (msg.compact_metadata ?? {}) as Record<string, unknown>;
|
||||
callbacks.onEvent({
|
||||
type: 'compact:done',
|
||||
trigger: meta.trigger === 'manual' ? 'manual' : 'auto',
|
||||
preTokens: typeof meta.pre_tokens === 'number' ? meta.pre_tokens : 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user