### 新增功能
- 通过 `terminal_input` 实现扩展终端输入拦截,允许扩展在常规 TUI 处理之前消费或转换原始输入。详见 [docs/extensions.md](docs/extensions.md)。
- 扩展 CLI 模型选择:`--model` 现在支持 `provider/id` 格式、模糊匹配以及 `:<thinking>` 后缀。详见 [README.md](README.md) 和 [docs/models.md](docs/models.md)。
- 更安全的包源处理,采用更严格的 git 源解析规则并改进本地路径规范化。详见 [docs/packages.md](docs/packages.md)。
- 新增适用于 OpenAI 和 OpenAI Codex 提供商的内置模型定义 `gpt-5.3-codex-spark`。
- 提升 OpenAI 流式处理的健壮性,能够容忍部分数据块中结尾工具调用 JSON 格式错误的情况。
- 通过 z.ai 和 OpenRouter 提供商目录新增内置 GLM-5 模型支持。
### 不兼容变更
- `ContextUsage.tokens` 和 `ContextUsage.percent` 现在类型为 `number | null`。上下文压缩后,直到下一次 LLM 响应前都无法获知上下文 token 数量,因此这些字段将返回 `null`。读取 `ContextUsage` 的扩展必须处理 `null` 情况。已从 `ContextUsage` 中移除 `usageTokens`、`trailingTokens` 和 `lastUsageIndex` 字段(这些本不应公开的底层实现细节)([#1382](https://github.com/badlogic/pi-mono/pull/1382) by [@ferologics](https://github.com/ferologics))
- 不再带 `git:` 前缀的 Git 源解析现在更为严格:仅协议 URL 会被视为 git 源(`https://`、`http://`、`ssh://`、`git://`)。类似 `github.com/org/repo` 和 `
[email protected]:org/repo` 的简写源现在必须添加 `git:` 前缀。([#1426](https://github.com/badlogic/pi-mono/issues/1426))
### 新增
- 新增消息和工具执行生命周期的扩展事件转发(`message_start`、`message_update`、`message_end`、`tool_execution_start`、`tool_execution_update`、`tool_execution_end`)([#1375](https://github.com/badlogic/pi-mono/pull/1375) by [@sumeet](https://github.com/sumeet))
- 新增 `terminal_input` 扩展事件,用于在常规 TUI 处理之前拦截、消费或转换原始终端输入。
- 新增适用于 OpenAI 和 OpenAI Codex 提供商的 `gpt-5.3-codex-spark` 模型定义(研究预览版)。
### 更改
- 将 GitHub Copilot 的 Claude 4.x 模型路由至 Anthropic Messages API,并更新了针对 Claude 模型请求的 Copilot 头部处理逻辑。
### 修复
- 修复了页脚中上下文使用百分比显示压缩前旧值的问题。压缩后,页脚将显示 `?/200k`,直到下一次 LLM 响应提供准确的使用数据 ([#1382](https://github.com/badlogic/pi-mono/pull/1382) by [@ferologics](https://github.com/ferologics))
- 修复了 `_checkCompaction()` 使用首次压缩记录而非最新记录的问题,该问题在多次压缩时可能导致溢出检测错误 ([#1382](https://github.com/badlogic/pi-mono/pull/1382) by [@ferologics](https://github.com/ferologics))
- `--model` 现在无需 `--provider` 即可工作,支持 `provider/id` 语法、模糊匹配以及 `:<thinking>` 后缀(例如 `--model sonnet:high`、`--model openai/gpt-4o`)([#1350](https://github.com/badlogic/pi-mono/pull/1350) by [@mitsuhiko](https://github.com/mitsuhiko))
- 修复了扩展源本地包路径的规范化问题,同时收紧了 git 源解析规则 ([#1426](https://github.com/badlogic/pi-mono/issues/1426))
- 修复了会话重置时未清除扩展终端输入监听器的问题,该问题可能导致过时的处理程序处于活跃状态。
- 修复了 Termux 中 `fd` 安装引导包的包名 ([#1433](https://github.com/badlogic/pi-mono/pull/1433))
- 修复了 `@` 文件自动补全的模糊匹配逻辑,使其优先匹配嵌套路径的路径前缀和段 ([#1423](https://github.com/badlogic/pi-mono/issues/1423))
- 修复了 OpenAI 流式工具调用解析逻辑,使其能够容忍部分数据块中结尾 JSON 格式错误的情况 ([#1424](https://github.com/badlogic/pi-mono/issues/1424))
### New Features
- Extension terminal input interception via `terminal_input`, allowing extensions to consume or transform raw input before normal TUI handling. See [docs/extensions.md](docs/extensions.md).
- Expanded CLI model selection: `--model` now supports `provider/id`, fuzzy matching, and `:<thinking>` suffixes. See [README.md](README.md) and [docs/models.md](docs/models.md).
- Safer package source handling with stricter git source parsing and improved local path normalization. See [docs/packages.md](docs/packages.md).
- New built-in model definition `gpt-5.3-codex-spark` for OpenAI and OpenAI Codex providers.
- Improved OpenAI stream robustness for malformed trailing tool-call JSON in partial chunks.
- Added built-in GLM-5 model support via z.ai and OpenRouter provider catalogs.
### Breaking Changes
- `ContextUsage.tokens` and `ContextUsage.percent` are now `number | null`. After compaction, context token count is unknown until the next LLM response, so these fields return `null`. Extensions that read `ContextUsage` must handle the `null` case. Removed `usageTokens`, `trailingTokens`, and `lastUsageIndex` fields from `ContextUsage` (implementation details that should not have been public) ([#1382](https://github.com/badlogic/pi-mono/pull/1382) by [@ferologics](https://github.com/ferologics))
- Git source parsing is now strict without `git:` prefix: only protocol URLs are treated as git (`https://`, `http://`, `ssh://`, `git://`). Shorthand sources like `github.com/org/repo` and `
[email protected]:org/repo` now require the `git:` prefix. ([#1426](https://github.com/badlogic/pi-mono/issues/1426))
### Added
- Added extension event forwarding for message and tool execution lifecycles (`message_start`, `message_update`, `message_end`, `tool_execution_start`, `tool_execution_update`, `tool_execution_end`) ([#1375](https://github.com/badlogic/pi-mono/pull/1375) by [@sumeet](https://github.com/sumeet))
- Added `terminal_input` extension event to intercept, consume, or transform raw terminal input before normal TUI handling.
- Added `gpt-5.3-codex-spark` model definition for OpenAI and OpenAI Codex providers (research preview).
### Changed
- Routed GitHub Copilot Claude 4.x models through Anthropic Messages API, with updated Copilot header handling for Claude model requests.
### Fixed
- Fixed context usage percentage in footer showing stale pre-compaction values. After compaction the footer now shows `?/200k` until the next LLM response provides accurate usage ([#1382](https://github.com/badlogic/pi-mono/pull/1382) by [@ferologics](https://github.com/ferologics))
- Fixed `_checkCompaction()` using the first compaction entry instead of the latest, which could cause incorrect overflow detection with multiple compactions ([#1382](https://github.com/badlogic/pi-mono/pull/1382) by [@ferologics](https://github.com/ferologics))
- `--model` now works without `--provider`, supports `provider/id` syntax, fuzzy matching, and `:<thinking>` suffix (e.g., `--model sonnet:high`, `--model openai/gpt-4o`) ([#1350](https://github.com/badlogic/pi-mono/pull/1350) by [@mitsuhiko](https://github.com/mitsuhiko))
- Fixed local package path normalization for extension sources while tightening git source parsing rules ([#1426](https://github.com/badlogic/pi-mono/issues/1426))
- Fixed extension terminal input listeners not being cleared during session resets, which could leave stale handlers active.
- Fixed Termux bootstrap package name for `fd` installation ([#1433](https://github.com/badlogic/pi-mono/pull/1433))
- Fixed `@` file autocomplete fuzzy matching to prioritize path-prefix and segment matches for nested paths ([#1423](https://github.com/badlogic/pi-mono/issues/1423))
- Fixed OpenAI streaming tool-call parsing to tolerate malformed trailing JSON in partial chunks ([#1424](https://github.com/badlogic/pi-mono/issues/1424))