Skip to content

v0.4.0

Latest

Choose a tag to compare

@tone4hook tone4hook released this 03 May 11:32

Highlights (breaking pre-1.0)

  • error.code taxonomy: error events now stamp a typed CoderErrorCode (rate_limit, auth_expired, context_too_large, network_error, timeout, binary_not_found, tool_crash, protocol_error, stalled, interrupted, unknown) plus a best-effort retryable hint. cancelled events optionally carry 'interrupted'/'stalled'. Per-adapter classifiers in src/adapters/{claude,codex,gemini}/classify.ts.
  • stallTimeoutMs: new RunOpts.stallTimeoutMs aborts a run if no normalized event is emitted for N ms; synthesizes an error with code: 'stalled'.
  • env hygiene: host env is now sanitized by default before spawn (strips NODE_OPTIONS, npm_*, CLAUDECODE, etc.); auth/proxy/CA-bundle vars preserved. Opt out with cleanEnv: false; extend deny list via additionalDenyEnv.
  • detached spawn + tree-kill fallback: child CLIs now run in their own POSIX process group; killProcessTree falls back to process.kill(-pid) when tree-kill errors, so grandchildren are reliably reaped.
  • Claude isolation preset: isolation: 'strict' | 'project' | 'user'. Strict mode mints a per-spawn CLAUDE_CONFIG_DIR (via extraEnv, never mutates process.env) plus an empty MCP config so user plugins don't load.
  • opt-in exit cleanup: installExitCleanup() + trackForExitCleanup() reap spawned CLIs on host SIGINT/SIGTERM/SIGHUP/uncaughtException.
  • @tone4hook/headless-coding-agent-sdk/worktree: new subpath export with createWorktree / pruneStaleWorktrees.
  • UsageStats normalization: added reasoningTokens; Codex now extracts cache + reasoning token breakdown; Gemini extracts cached + thoughts tokens. New src/pricing.ts with estimateCostUsd (returns undefined for unknown models — no NaN).

Notable behavior changes

  • Env sanitation is on by default. Pass cleanEnv: false to restore prior pass-through behavior.
  • error events now require code (was optional string).
  • RunResult.error.code is typed as CoderErrorCode.

206 tests, build + typecheck clean.