Repository navigation
v0.3.2
Accumulated changes since v0.3.1 — headlined by a token-accounting correctness fix, plus a batch of security, provider-correctness, and runtime hardening.
Headline
Run-total token usage on terminal EventDone
Runtime.Run previously emitted only the last turn's token usage on its terminal EventDone, so multi-turn runs under-reported tokens to any consumer metering AgentEvent.Usage. It now accumulates usage across all turns (summing input, output, and both cache fields via a pure, non-mutating addUsage helper) and emits the run total. RunTurn is unchanged (one turn per call). The calibrator still uses per-turn figures. Behavior preserved for usage-less providers (stays nil) and single-turn runs.
Security / SSRF hardening
SafeHTTPClientwith an IP-pinning transport;web_fetchand allweb_searchbackends now pin a validated IP.isPrivateIPblocks0.0.0.0/8, CGNAT, and reserved ranges; dual-stack fallback dials all validated IPs.- Browser tool blocks private-IP resolution via host-resolver-rules.
- Bash allowlist mode: reject real newline/CR and redirection; treat background
&as a command separator (S1 bypass closed).
Provider correctness
- Anthropic: surface in-band stream errors; Builder accumulation.
- Gemini: emit a single
EventDonewith final usage; recognize 429/5xx as retryable via typedAPIError. - OpenAI / Qwen: index-order tool emission for prompt-cache determinism;
strings.Builderfor tool-arg accumulation; Qwen requests usage stats. - Retry classifier scoped to bounded 429/529 forms.
Runtime & tools
- Single-turn
RunTurnAPI; bounded-synchronous KG recall and KG ingest on exchange completion. - Recover from pre-first-token stream errors; surface and recover from model refusals.
- Atomic file writes (
write_file/edit_file0600, preserve mode);read_file/edit_filesize caps to prevent OOM; honor ctx cancellation. - Calibrator recomputes estimate at
EventDone(stale-estimate fix); session persistence ordering and degraded-persistence warnings. - Token estimation: count attached images; 1M context window for Fable 5 / Mythos 5 / Opus 4.6+ / Sonnet 4.6.
- Configurable per-tool-result truncation cap; MCP
Pingon Client.
See docs/ and package-level docs for details.