feat: rename to wynba, pi-style auto-compaction, usage tracking, event logBrowse files at 7a93f83
flaxodotdev committed a month ago · 14 changed files
Rename coding-agent to wynba and land the pi-inspired reliability
overhaul: proactive/overflow context compaction, real token-usage
tracking, and a crash-survivable event log.
- Rename — binary, crate, paths (~/.wynba, WYNBA_DB), README and
system prompts now say wynba; the classic default palette is kept
as-is.
- Pi-style auto-compaction — the agent loop is now unbounded (no round
cap): it auto-compacts proactively when the estimated context gets
within the reserve of the provider's context window (should_compact +
estimate_context_tokens), and recovers from an overflow by folding
older turns into a summary and retrying once (overflow_recovered
bounds it at one attempt). CompactionReason (Manual/Threshold/Overflow)
drives a pi-style status line.
- Token usage & overflow detection — LlmUsage + finish_reason parsed
across OpenAI-compatible, Anthropic, Gemini and Bedrock (chat and
streaming); persisted per assistant message in a new messages.usage_json
column. is_context_overflow / is_recoverable_length classify provider
errors so a full window (or a length stop with zero output) triggers
compact-and-retry instead of a dead end. MAX_TOKENS default raised to
16384; new CONTEXT_WINDOW env overrides the window used by the
threshold.
- Event log — new src/events.rs appends JSONL events to events.jsonl
next to the DB (panics via a panic hook included), recording CLI
errors, LLM failures/retries, model-cache refreshes, and tool
spawn/timeout failures.
- Command usage — new command_usage table with record/query helpers; /
completions now rank commands by how often you've run them (aliases
collapse onto their canonical name).
- TUI — pi-style collapsible [compaction] blocks with the exact
"Compacted from N tokens" figure (ctrl+o to expand/collapse);
"Compacting… (Esc to cancel)" status with a single-Esc abort for
in-flight compactions; todowrite/todoread render as a checklist
instead of raw JSON; a todo list auto-clears once every item is
completed or cancelled.
- DB — migration for messages.usage_json; command_usage table; tests
renamed to the wynba temp prefix.