Skip to content

div-anthropic D2: package.json 移除/降级 SDK 依赖 (受 #63 阻塞) #64

Closed

Description

@dahai80

背景

feat/div-anthropic Phase 5 已解耦错误层 (见 #63 D1),但 package.json 仍保留三个 SDK 运行时依赖:

"@anthropic-ai/claude-agent-sdk": "^0.2.87",
"@anthropic-ai/foundry-sdk": "^0.2.3",
"@anthropic-ai/sdk": "^0.80.0",

现状审计

  • @anthropic-ai/sdk — 运行时必需。src/services/api/client.ts line 1 import Anthropic,4 处 new Anthropic(...) (firstParty/fusionMlx/bedrock/vertex/foundry 入口)。受 div-anthropic D1: client.ts 云 provider 解耦 — 决定 seam 是否覆盖 bedrock/vertex/foundry 签名 #63 D1 阻塞: D1 决定云 provider 签名归属前不能移除。
  • @anthropic-ai/foundry-sdk — 运行时必需 (foundry provider)。client.ts:226 动态 import() 构造 AnthropicFoundry。同受 D1 阻塞。
  • @anthropic-ai/claude-agent-sdk — 仅类型,编译期擦除。src/cli/print.ts:132 import type { PermissionMode },build 后无运行时引用。可安全降为 devDependencies 或保留 (不影响 bundle)。

bedrock/vertex SDK (@anthropic-ai/bedrock-sdk、@anthropic-ai/vertex-sdk) 未在 package.json,靠 client.ts 动态 import() + 运行时报错提示用户 bun add。

待办 (受 D1 阻塞)

  1. 等 div-anthropic D1: client.ts 云 provider 解耦 — 决定 seam 是否覆盖 bedrock/vertex/foundry 签名 #63 D1 决策落地。
  2. 若 D1 选方案 2 (SDK 仅云 provider): 把 @anthropic-ai/sdk + @anthropic-ai/foundry-sdk 从 dependencies 移到 optionalDependencies,云 provider 用户按需安装。
  3. @anthropic-ai/claude-agent-sdk 移到 devDependencies (纯类型)。
  4. 验证: bun run build 默认构建不打包 SDK; 云 provider 路径在装了 optional dep 后仍可用; grep -rn "@anthropic-ai/sdk" dist/ 为空 (或仅云 provider 分支)。
  5. README/CLAUDE.md 更新安装说明 (云 provider 需额外装 dep)。

验收标准

Activity

  1. dahai80 commented on Aug 16, 2026

    @dahai80
    OwnerAuthor

    PR #66 已合并到 main (ed892e1)。本 issue (#64) 仍受 #63 阻塞: package.json 的 @anthropic-ai/sdk / claude-agent-sdk 依赖尚未移除/降级 (云 provider 签名仍需 SDK)。作为后续任务保留。

  2. dahai80 commented on Aug 19, 2026

    @dahai80
    OwnerAuthor

    核心目标已达成,经 PR #67 (commit b3e14a6) 落地:

    • @anthropic-ai/sdk 已从 dependencies 移除(运行时零 import)
    • @anthropic-ai/foundry-sdk 已从 dependencies 移除
    • 默认构建产物不含 SDK 运行时代码(build 3715 modules,0 处功能性 SDK 引用)

    残余项 @anthropic-ai/claude-agent-sdk 降级 devDependencies 属 #65 D3 范畴(该包 print.ts:132 纯 import type,编译期擦除),本 issue 不再追踪,归 D3。

    受 #63 D1 阻塞已解除(#63 已关闭,决策落地)。本 issue 关闭。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions