缺少依赖时会直接安装 npm 包
原文依据:2 处指令要求在 `node_modules/ai/` 不存在时执行项目包管理器的安装命令,而不是先取得用户确认。安装会获取并执行所选版本的包管理流程,并通常改动依赖清单、锁文件和 `node_modules`。
在仅询问文档或评估方案时,用户的项目也可能被持久修改;安装过程还会引入 npm 供应链及安装脚本的执行风险。
该行是生效中的安装指令:目录缺失时要求安装,而没有要求先征得用户确认。此操作具有合理目的,但会从包仓库取得代码,且包管理器通常会修改 `node_modules`、依赖清单和锁文件,并可能运行安装生命周期脚本。用户可限制代理仅检查现有依赖,或要求安装前确认包、版本及预期文件变更。
1. Ensure `ai` is installed. If `node_modules/ai/` does not exist, install **only** the `ai` package using the project's package manager (e.g. `pnpm add ai`). Install provider packages (e.g. `@ai-sdk/openai`) and framework packages (e.g. `@ai-sdk/react`) later, when the task requires them.2. Read and grep the bundled docs at `node_modules/ai/docs/` and the source at `node_modules/ai/src/`.查看另外 1 个位置
The `ai` package ships its full documentation and source code inside `node_modules`. These always match the installed version, so trust them over anything you remember.