AI SDK 7.0.157 稳定工具筛选 API,但工具可见性仍不等于执行权限
AI SDK 7.0.157 于 10 月 29 日发布:`filterActiveTools` 从实验名称转为稳定导出,`LanguageModelStreamPart` 也成为稳定类型,旧别名保留并标记弃用;同时修复遥测运行时检测在 Next.js Edge 中触发 Node API 警告的问题。
为什么值得关注
生成式 UI 和代理常连接大量搜索、数据、动作与渲染工具。按步骤缩小模型可见工具集可以减少无关 schema、降低选择歧义并保持类型推断;但若宿主把“未发给模型”误当成“禁止执行”,就会把提示优化误用为授权边界。
技术细节
稳定的 `filterActiveTools` 接受完整工具注册表和 activeTools 名单,返回类型化子集;原 `experimental_filterActiveTools` 继续作为弃用别名,便于渐进迁移。稳定的 `LanguageModelStreamPart` 统一模型流事件类型,`Experimental_LanguageModelStreamPart` 计划到 v8 才移除;用于自定义循环的 `experimental_streamLanguageModelCall` 本身仍是实验 API。Edge 修复把 `process.release` 检测改为可选的 `globalThis.process` 访问,维护者在 Next.js 端到端示例中验证警告消失。相关 gateway 依赖还修复了调用方取消被错误包装为可重试 HTTP 500 的问题,但这属于依赖更新而非 ai 核心 API。
适合哪些读者
使用 AI SDK 构建多工具代理、生成式 UI、MCP 目录、逐步工具选择、Edge 部署和权限控制的 TypeScript 团队
原始来源
- Vercel AI SDK official release, implementation commits and open design issue ↗github.com
- Stable LanguageModelStreamPart implementation and migration ↗github.com
- Next.js Edge runtime detection fix ↗github.com
- Open tool registry, availability, cache and execution-semantics design issue ↗github.com
修订与更正记录 (2)
— Publish the verified 7.0.157 release. The open design issue is a documented limitation and counterexample, not a date or identity conflict.
— Publish a verified framework boundary change and preserve the official open issue showing that model-visible tool filtering is not an authorization control.