Skip to content

v0.3.2

Choose a tag to compare

@sausheong sausheong released this 27 Jun 06:35
· 41 commits to main since this release

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

  • SafeHTTPClient with an IP-pinning transport; web_fetch and all web_search backends now pin a validated IP.
  • isPrivateIP blocks 0.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 EventDone with final usage; recognize 429/5xx as retryable via typed APIError.
  • OpenAI / Qwen: index-order tool emission for prompt-cache determinism; strings.Builder for tool-arg accumulation; Qwen requests usage stats.
  • Retry classifier scoped to bounded 429/529 forms.

Runtime & tools

  • Single-turn RunTurn API; 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_file 0600, preserve mode); read_file/edit_file size 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 Ping on Client.

See docs/ and package-level docs for details.