### 新功能
- **约束工具采样** — 工具可以偏好或要求严格的 JSON Schema 采样,或使用 OpenAI Lark/正则表达式语法,并通过模型能力元数据阻止不支持的请求。参见 [约束工具采样](https://github.com/earendil-works/pi/blob/v0.82.0/packages/ai/README.md#constrained-sampling-for-tools)。
- **OpenRouter 和 Kimi Code 登录** — 使用 `/login` 授权 OpenRouter 或 Kimi Code 订阅,无需手动配置 API 密钥。参见 [OpenRouter](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/providers.md#openrouter)。
- **会话感知、流式 bash 集成** — Bash 工具接收当前会话/模型元数据,而直接 RPC bash 命令会流式传输关联的输出。参见 [Bash 工具会话环境](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/environment-variables.md#bash-tool-session-environment) 和 [RPC bash 事件](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/rpc.md#bash_execution_update)。
### 新增
- 新增继承的 `Tool.constrainedSampling`,支持严格 JSON Schema(`prefer`/`require`)及 OpenAI Lark/正则语法变体,覆盖 OpenAI、Anthropic、Amazon Bedrock、Google Gemini 和 Mistral。参见 [约束工具采样](https://github.com/earendil-works/pi/blob/v0.82.0/packages/ai/README.md#constrained-sampling-for-tools)。
- 新增继承的 `supportsGrammarTools` 和 `supportsStrictTools` 兼容性标志,扩展 `supportsStrictMode` 覆盖范围,并生成模型能力元数据以限制约束采样。
- 为 Kimi For Coding 提供商新增继承的 Kimi Code 订阅 OAuth 登录,包括设备授权和自动令牌刷新([#6935](https://github.com/earendil-works/pi/pull/6935) by [@zaycruz](https://github.com/zaycruz))。
- 通过 `/login` 新增继承的 OpenRouter OAuth PKCE 登录,生成由用户控制的 API 密钥。参见 [OpenRouter](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/providers.md#openrouter)([#6927](https://github.com/earendil-works/pi/pull/6927) by [@rsaryev](https://github.com/rsaryev))。
- 向内置和工厂创建的 bash 工具运行的命令暴露 `PI_SESSION_ID`、`PI_SESSION_FILE`、`PI_PROVIDER`、`PI_MODEL` 和 `PI_REASONING_LEVEL`。参见 [Bash 工具会话环境](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/environment-variables.md#bash-tool-session-environment)。
- 为直接 RPC bash 命令新增流式 `bash_execution_update` 事件,并与请求 ID 关联。参见 [RPC bash 事件](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/rpc.md#bash_execution_update)([#6971](https://github.com/earendil-works/pi/pull/6971) by [@ananthakumaran](https://github.com/ananthakumaran))。
### 变更
- 修改继承的生成模型目录,仅暴露 models.dev 中经提供商验证的推理强度级别([#6928](https://github.com/earendil-works/pi/pull/6928) by [@davidbrai](https://github.com/davidbrai))。
### 修复
- 修复了继承的 DNS 查找失败(如 `getaddrinfo`、`ENOTFOUND` 和 `EAI_AGAIN`)无法触发助手自动重试的问题 ([#6946](https://github.com/earendil-works/pi/pull/6946) by [@christianklotz](https://github.com/christianklotz))。
- 修复了继承的 OpenRouter Anthropic 缓存断点以推进工具结果,并为 `~anthropic/*-latest` 别名启用了缓存控制 ([#6941](https://github.com/earendil-works/pi/pull/6941) by [@mteam88](https://github.com/mteam88))。
- 修复了继承的 OpenAI Codex WebSocket 会话在出现 `previous_response_not_found` 错误后,能够重试一次而不会丢失对上一次响应的继续处理 ([#6955](https://github.com/earendil-works/pi/pull/6955) by [@davidbrai](https://github.com/davidbrai))。
- 修复了 TUI 调试和崩溃日志,使其尊重自定义代理目录,而不是始终写入 `~/.pi/agent` ([#6958](https://github.com/earendil-works/pi/pull/6958) by [@davidbrai](https://github.com/davidbrai))。
- 修复了当系统临时目录包含大量条目时,Ctrl+G 外部编辑器启动缓慢的问题 ([#6903](https://github.com/earendil-works/pi/pull/6903) by [@christianklotz](https://github.com/christianklotz))。
- 修复了启动资源显示,以保留由包加载的同级 npm 扩展的相对路径 ([#6964](https://github.com/earendil-works/pi/pull/6964) by [@davidbrai](https://github.com/davidbrai))。
- 修复了压缩和分支摘要请求,使其在支持的情况下使用新的路由会话 ID 并禁用提示缓存 ([#6618](https://github.com/earendil-works/pi/pull/6618) by [@tmustier](https://github.com/tmustier))。
- 修复了设置 `PI_SKIP_VERSION_CHECK` 时显式自更新的问题 ([#6977](https://github.com/earendil-works/pi/issues/6977))。
- 修复了包含方括号的作用域模型 ID 的解析,使其在通配符匹配前作为字面精确匹配进行解析 ([#6210](https://github.com/earendil-works/pi/issues/6210))。
- 修复了继承的 OpenAI 和 Anthropic 提供商重试等待,使其尊重中止信号和配置的延迟限制 ([#6980](https://github.com/earendil-works/pi/pull/6980) by [@petrroll](https://github.com/petrroll))。
- 修复了全新安装时因包文件修改时间较新而优先选择内置模型目录而非更新远程目录的问题 ([#7016](https://github.com/earendil-works/pi/pull/7016) by [@davidbrai](https://github.com/davidbrai))。
- 修复了继承的编辑器滚动指示器在窄终端中溢出的问题 ([#7015](https://github.com/earendil-works/pi/pull/7015) by [@christianklotz](https://github.com/christianklotz))。
- 修复了 llama.cpp 模型,使其使用加载的上下文窗口作为输出令牌限制,而不是将其限制在 16K ([#7034](https://github.com/earendil-works/pi/pull/7034) by [@christianklotz](https://github.com/christianklotz))。
- 修复了发布源归档,使其包含用于构建独立二进制文件的生成提供商模型数据。
- 将打包的 `protobufjs` 依赖项更新为 7.6.5 以解决 GHSA-j3f2-48v5-ccww 安全问题 ([#7005](https://github.com/earendil-works/pi/issues/7005))。
- 修复了 Wayland 上的 `/copy` 命令,当 `wl-copy` 失败时回退到 X11 或 OSC 52 ([#7009](https://github.com/earendil-works/pi/pull/7009) by [@rkfshakti](https://github.com/rkfshakti))。
- 修复了 `/model` 命令,使其在打开模型选择器时重新加载更新的 `models.json` 配置 ([#6999](https://github.com/earendil-works/pi/issues/6999))。
### New Features
- **Constrained tool sampling** — Tools can prefer or require strict JSON Schema sampling or use OpenAI Lark/regex grammars, with model capability metadata preventing unsupported requests. See [Constrained Sampling for Tools](https://github.com/earendil-works/pi/blob/v0.82.0/packages/ai/README.md#constrained-sampling-for-tools).
- **OpenRouter and Kimi Code sign-in** — Use `/login` to authorize OpenRouter or a Kimi Code subscription without manually configuring API keys. See [OpenRouter](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/providers.md#openrouter).
- **Session-aware, streaming bash integrations** — Bash tools receive current session/model metadata, while direct RPC bash commands stream correlated output. See [Bash Tool Session Environment](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/environment-variables.md#bash-tool-session-environment) and [RPC bash events](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/rpc.md#bash_execution_update).
### Added
- Added inherited `Tool.constrainedSampling` with strict JSON Schema (`prefer`/`require`) and OpenAI Lark/regex grammar variants across OpenAI, Anthropic, Amazon Bedrock, Google Gemini, and Mistral. See [Constrained Sampling for Tools](https://github.com/earendil-works/pi/blob/v0.82.0/packages/ai/README.md#constrained-sampling-for-tools).
- Added inherited `supportsGrammarTools` and `supportsStrictTools` compatibility flags, expanded `supportsStrictMode` coverage, and generated model capability metadata to gate constrained sampling.
- Added inherited Kimi Code subscription OAuth login for the Kimi For Coding provider, including device authorization and automatic token refresh ([#6935](https://github.com/earendil-works/pi/pull/6935) by [@zaycruz](https://github.com/zaycruz)).
- Added inherited OpenRouter OAuth PKCE login through `/login`, minting a user-controlled API key. See [OpenRouter](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/providers.md#openrouter) ([#6927](https://github.com/earendil-works/pi/pull/6927) by [@rsaryev](https://github.com/rsaryev)).
- Exposed `PI_SESSION_ID`, `PI_SESSION_FILE`, `PI_PROVIDER`, `PI_MODEL`, and `PI_REASONING_LEVEL` to commands run by built-in and factory-created bash tools. See [Bash Tool Session Environment](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/environment-variables.md#bash-tool-session-environment).
- Added streaming `bash_execution_update` events for direct RPC bash commands, correlated with request IDs. See [RPC bash events](https://github.com/earendil-works/pi/blob/v0.82.0/packages/coding-agent/docs/rpc.md#bash_execution_update) ([#6971](https://github.com/earendil-works/pi/pull/6971) by [@ananthakumaran](https://github.com/ananthakumaran)).
### Changed
- Changed inherited generated model catalogs to expose only provider-verified reasoning effort levels from models.dev ([#6928](https://github.com/earendil-works/pi/pull/6928) by [@davidbrai](https://github.com/davidbrai)).
### Fixed
- Fixed inherited DNS lookup failures such as `getaddrinfo`, `ENOTFOUND`, and `EAI_AGAIN` to trigger automatic assistant retries ([#6946](https://github.com/earendil-works/pi/pull/6946) by [@christianklotz](https://github.com/christianklotz)).
- Fixed inherited OpenRouter Anthropic cache breakpoints to advance through tool results and enabled cache control for `~anthropic/*-latest` aliases ([#6941](https://github.com/earendil-works/pi/pull/6941) by [@mteam88](https://github.com/mteam88)).
- Fixed inherited OpenAI Codex WebSocket sessions to retry once without a missing previous-response continuation after `previous_response_not_found` errors ([#6955](https://github.com/earendil-works/pi/pull/6955) by [@davidbrai](https://github.com/davidbrai)).
- Fixed TUI debug and crash logs to respect custom agent directories instead of always writing under `~/.pi/agent` ([#6958](https://github.com/earendil-works/pi/pull/6958) by [@davidbrai](https://github.com/davidbrai)).
- Fixed slow Ctrl+G external-editor startup when the system temporary directory contains many entries ([#6903](https://github.com/earendil-works/pi/pull/6903) by [@christianklotz](https://github.com/christianklotz)).
- Fixed startup resource display to preserve relative paths for sibling npm extensions loaded by a package ([#6964](https://github.com/earendil-works/pi/pull/6964) by [@davidbrai](https://github.com/davidbrai)).
- Fixed compaction and branch-summary requests to use fresh routing session IDs with prompt caching disabled where supported ([#6618](https://github.com/earendil-works/pi/pull/6618) by [@tmustier](https://github.com/tmustier)).
- Fixed explicit self-updates when `PI_SKIP_VERSION_CHECK` is set ([#6977](https://github.com/earendil-works/pi/issues/6977)).
- Fixed scoped model IDs containing brackets to resolve as literal exact matches before glob matching ([#6210](https://github.com/earendil-works/pi/issues/6210)).
- Fixed inherited OpenAI and Anthropic provider retry waits to honor abort signals and configured delay limits ([#6980](https://github.com/earendil-works/pi/pull/6980) by [@petrroll](https://github.com/petrroll)).
- Fixed fresh installs from preferring bundled model catalogs over newer remote catalogs because package file mtimes were newer ([#7016](https://github.com/earendil-works/pi/pull/7016) by [@davidbrai](https://github.com/davidbrai)).
- Fixed inherited editor scroll indicators overflowing narrow terminals ([#7015](https://github.com/earendil-works/pi/pull/7015) by [@christianklotz](https://github.com/christianklotz)).
- Fixed llama.cpp models to use the loaded context window as their output token limit instead of capping it at 16K ([#7034](https://github.com/earendil-works/pi/pull/7034) by [@christianklotz](https://github.com/christianklotz)).
- Fixed release source archives to include the generated provider model data used to build standalone binaries.
- Updated the packaged `protobufjs` dependency to 7.6.5 to address GHSA-j3f2-48v5-ccww ([#7005](https://github.com/earendil-works/pi/issues/7005)).
- Fixed `/copy` on Wayland to fall back to X11 or OSC 52 when `wl-copy` fails ([#7009](https://github.com/earendil-works/pi/pull/7009) by [@rkfshakti](https://github.com/rkfshakti)).
- Fixed `/model` to reload updated `models.json` configuration when opening the model picker ([#6999](https://github.com/earendil-works/pi/issues/6999)).