# Changelog

## 0.1.5 — 2026-10-28

### Changed

- Use `@opencode/codemode` 2.2.0. The published interpreter sources are unchanged
  from 2.1.4; Acorn stays 8.15.0 and Effect stays 4.0.1. This dependency
  update alone does not change the tool bridge, limits, preflight, or result
  contract; `for...in` remains rejected.

### Improvements

- Admit direct `String.raw` tagged templates through preflight for backslash-heavy
  shell commands and heredocs. Other tags stay rejected; substitutions retain
  the existing compatibility checks, and source is never rewritten. Document
  interpolation/backtick caveats in model guidance and the shell examples.
- Include bounded upstream recovery suggestions in model-visible error/warning
  text, before logs and return data, without automatic retry or replay.
- Show an error-attempt count such as `1 failed` only when failures exist,
  including failures hidden by the last-eight-call preview. Do not add total or
  success counts, count cancellations as failures, or change script success.
- Nudge models to use JS template literals for multiline shell commands and
  heredocs, with explicit guidance on embedded backticks, interpolation, and
  backslash escaping. Source validation and execution behavior are unchanged.

## 0.1.4 — 2026-10-26

### Changed

- Admit `switch`/`case` and `new Date`, `new RegExp`, `new Map`,
  `new Set`, `new URL`, `new EvalError`, and `new URIError` through preflight.
  CodeMode 2.1.4 already runs them. Other constructors and unsupported syntax
  stay rejected before execution.
- Keep `for...in` rejected before any host effects: CodeMode 2.1.4 skips inherited
  properties and still visits keys deleted during iteration.
- Name `codemode_o` and native `codemode` explicitly as the model-only direct-call
  targets; `bash` and `edit` remain ordinary host calls inside a program.
- Keep short programs that call native `bash` and `edit` on `codemode_o`.
  Those host calls already ran through Pi's tool bridge; the tool guidance no
  longer treats a shell command or file edit as a reason to switch to native
  `codemode`.
- Use `@opencode/codemode` 2.1.4. Upstream promise scheduling now holds the
  main job until leftover promise work is interrupted; the extension's tool
  bridge, limits, and result contract are unchanged. Acorn stays 8.15.0 and
  Effect stays 4.0.1.

## 0.1.3 — 2026-10-25

### Improvements

- Simplify the source-preview notice to `Preview; expand for original`.

### Fixes

- Allow OpenCode-supported regular-expression literals through preflight instead
  of incorrectly reporting `NativeCodemodeRequired`; preserve syntax errors for
  invalid patterns/flags and existing BigInt/Pi-only restrictions.
- Preserve Pi's native pending/success/error panel backgrounds when call rows
  are shortened or wrapped, including duration text and trailing padding.

## 0.1.2 — 2026-10-25

### Improvements

- Show live, per-attempt host-call rows with bounded argument/error previews,
  status and duration. Preserve duplicate names, settle cancellation after host
  cleanup, and retain detached records for restored sessions.
- Format source previews at AST boundaries without changing execution input;
  preserve literals/comments/templates and fall back to raw source on parse or
  structure-check failure. Expansion also exposes the original execution source.

### Fixes

- Distinguish invalid script syntax (`SourceSyntaxError`) and unexpected
  preflight parser exceptions (`PreflightParserError`) from native-required
  compatibility limitations; do not recommend native replay for these failures.
- Preserve bounded Acorn messages and valid UTF-16 offsets/line-column locations,
  including the string start and newline detection position. Explain JS/JSON
  newline escaping without rewriting source or executing any host tool.
- Add raw LF/CR/CRLF, escaped heredoc/Korean multi-call, parser failure injection,
  diagnostic budget, and isolated real-session regression coverage.

## 0.1.1 — 2026-10-24

### Improvements

- Prefer `codemode_o` for short, compatible programs through concise model
  context guidance; choose native `codemode` upfront for Pi-specific features,
  images, MCP readiness, long-running work, or uncertain compatibility.
- Separate LLM tool selection from compatibility-only preflight validation.
  Preserve the historical routing helper and metadata for compatibility.
- Report compatibility outcomes in `details.preflight`; keep native-availability
  caveats explicit and never automatically delegate or replay execution failures.
- Add regression coverage for active/inactive/unloaded prompt guidance and
  duplicate-free reactivation; update tool-selection and testing documentation.

### Known limits

- Guidance influences model choice; it is not enforced routing or a performance
  guarantee. Custom prompts and higher-priority instructions may affect it.
- MCP startup/reconnect readiness coordination remains out of scope; prefer
  native `codemode` for MCP workflows.

## 0.1.0 — 2026-10-23

Initial public release.

### Features

- Add `codemode_o`, backed by OpenCode CodeMode 2.1.0, alongside Pi's native
  `codemode`; neither tool replaces or recursively invokes the other.
- Discover already-callable Pi tools with OpenCode's synchronous `search` API.
- Preserve Pi tool validation, permission/result hooks, and nested-call audits.
- Reject native-only programs before execution, without automatic fallback or
  replay after side effects.
- Bound final text output to 65,536 UTF-8 bytes with visible diagnostics and
  truncation indicators; await cooperative host cancellation and cleanup.
- Show highlighted source, collapsible output, and execution duration in the TUI.

### Compatibility and verification

- Require Node.js >= 22.19.0 and Pi >= 0.99.0, < 2.0.0.
- Add CI for Node 22.19.0 / 24.x and Pi 0.99.0 / 1.3.0 / 1.4.0, including isolated
  scripted real-SDK sessions. See [TESTING.md](TESTING.md).
- Include a sourced historical `pi-codemode-bench` comparison in the README,
  with measured versions, timing boundaries, and contrary CPU-heavy results.

### Known limits

- The interpreter is not an OS or memory-isolation sandbox, and supports only a
  JavaScript subset. Use trusted host tools.
- The 30-second deadline requests interruption; a host tool that never settles
  can delay delivery indefinitely. Cancellation does not roll back side effects.
- Historical benchmark results are not a current-release performance guarantee;
  no live-provider E2E guarantee is included.
