帮助开发者升级 Anthropic SDK、迁移版本并解决相关依赖与类型问题。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "anthropic-sdk-upgrader" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/vscode/main/extensions/copilot/.agents/skills/anthropic-sdk-upgrader/SKILL.md 2. 保存为 ~/.claude/skills/anthropic-sdk-upgrader/SKILL.md 3. 装好后重载技能,告诉我可以用了
请帮我把项目中的 @anthropic-ai/sdk 升级到最新稳定版,检查破坏性变更,更新代码示例,并列出需要修改的依赖与类型定义。
一份升级方案,包含版本变更说明、代码修改建议、依赖更新列表与注意事项。
我正在使用旧版 @anthropic-ai/claude-agent-sdk,请帮我迁移到最新版,说明 API 差异,重写初始化与调用示例,并指出可能的兼容性问题。
一份迁移指南,包含新旧 API 对照、示例重写和兼容性风险说明。
升级 Anthropic 相关包后出现依赖冲突和 TypeScript 类型报错,请分析可能原因,给出逐步排查方案,并提供可行的修复建议。
一份问题诊断与修复建议,涵盖冲突来源、排查步骤和推荐解决方案。
You are an expert at upgrading Anthropic SDK packages in the vscode-copilot-chat project.
| Package | Description |
|---|---|
@anthropic-ai/claude-agent-sdk | Official Claude Agent SDK - provides the core agent runtime, tools, hooks, sessions, and message streaming |
@anthropic-ai/sdk | Anthropic API SDK - provides base types, API client, and message structures used by the agent SDK |
Follow these steps exactly:
Before upgrading, review the current versions in package.json and check the release notes:
Create a consolidated summary of changes between the current version and the target version. Group changes by category, not by individual version:
Summary Format:
### `@anthropic-ai/package-name` (oldVersion → newVersion)
#### Features
- **Category:** Description of new feature or capability
#### Bug Fixes
- Description of what was fixed
#### Breaking Changes
- **Old API → New API**: Description of what changed and how to migrate
How to Create the Summary:
Categorize changes by impact level:
Critical (Must Address Before Merge):
Important (Should Address):
Nice to Have (Can Address Later):
# Update to latest
npm install @anthropic-ai/claude-agent-sdk @anthropic-ai/sdk
After updating, diff the old and new type definitions to detect API changes that may not cause compilation errors but are important to know about (new parameters, new functions, deprecated APIs, etc.).
Steps:
Snapshot before upgrading: Before running npm install in step 4, copy the current type definitions to a temp directory:
mkdir -p /tmp/anthropic-sdk-old
cp -r node_modules/@anthropic-ai/sdk/*.d.ts node_modules/@anthropic-ai/sdk/resources/*.d.ts /tmp/anthropic-sdk-old/ 2>/dev/null
cp -r node_modules/@anthropic-ai/claude-agent-sdk/*.d.ts /tmp/anthropic-sdk-old/ 2>/dev/null
Important: This snapshot must be taken before step 4's
npm install.
Diff the type definitions: After npm install, compare the old and new .d.ts files:
# Diff the Anthropic SDK types
for f in node_modules/@anthropic-ai/sdk/*.d.ts node_modules/@anthropic-ai/sdk/resources/*.d.ts; do
base=$(basename "$f")
if [ -f "/tmp/anthropic-sdk-old/$base" ]; then
diff -u "/tmp/anthropic-sdk-old/$base" "$f"
else
echo "+++ NEW FILE: $f"
fi
done
# Diff the Agent SDK types
for f in node_modules/@anthropic-ai/claude-agent-sdk/*.d.ts; do
base=$(basename "$f")
if [ -f "/tmp/anthropic-sdk-old/$base" ]; then
diff -u "/tmp/anthropic-sdk-old/$base" "$f"
else
…
帮助开发者验证 Azure DevOps 流水线改动,快速排查构建与 YAML 配置问题。
提供完整的 Claude Code 代理与配置集合,帮助快速构建和优化 AI 开发工作流。