Patch Changes
-
886c423: Context compaction for the agents runtime. Modelled on OpenAI Codex's
summarization but adapted to the event-sourced timeline (acontext_inserted
checkpoint placed at a stored watermark, so reconstruction folds older messages
into a summary):- A context-window usage gauge (cache-inclusive
context_input_tokens+
context_windowpersisted per step) and<token_budget>notices injected at
25 / 50 / 75% usage. - Oversized tool-output truncation, and a synchronous mid-turn compaction floor
at the 90% hard ceiling (runs before every model step via the adapter's
transformContexthook). - Non-blocking background (turn-end) compaction that starts at 85%: a detached
summarize whose checkpoint is applied at the next turn's start, or immediately
if it finishes while idle. Each generation uses a watermark-unique checkpoint
id so a new run can't supersede a prior completed one. Summarize calls are
bounded by a hard timeout. - UI: a "Compacting…" indicator (blocking vs. background) and a collapsible
"Context compacted" entry in the conversation timeline.
Thresholds are env-tunable (
ELECTRIC_AGENTS_COMPACT_CEILING,
ELECTRIC_AGENTS_COMPACT_BG_CEILING). - A context-window usage gauge (cache-inclusive
-
7139c53: Context-usage indicator: a circular ring gauge plus a hover breakdown popover
showing how the prompt decomposes across system prompt, tools, messages, and
free space (à la Claude Code's/context). The runtime now persists an
approximatecontext_breakdownof the stable request parts (system + tools) on
each step alongside the cache-inclusive total, and exports new
computeContextBreakdown/parseContextBreakdownhelpers from the client
entry; the UI derives the "messages" bucket as the real remainder so the
segments always sum to the gauge.