Skip to content

fix(provider): make Claude SDK opt-in - #2

Draft
onmax wants to merge 5 commits into
mainfrom
fix/lazy-claude-sdk-import
Draft

fix(provider): make Claude SDK opt-in#2
onmax wants to merge 5 commits into
mainfrom
fix/lazy-claude-sdk-import

Conversation

@onmax

@onmax onmax commented Aug 24, 2026

Copy link
Copy Markdown

@t3tools/provider-runtime currently installs and evaluates the Claude Agent SDK for every embedded consumer. That also lets the SDK install a platform binary of roughly 324 MB, even when the consumer uses Codex only.

This change loads the SDK only when Claude starts and keeps it as a development-only dependency of the embedded package. Consumers install it explicitly when they select Claude. Cancellation during the deferred import closes a late runtime without starting a query. An optional peer is deliberately avoided because pnpm auto-installs it.

Before / after

Before After
Importing the provider runtime evaluates the Claude SDK. Importing the provider runtime does not resolve the SDK.
Codex-only consumers install the Claude SDK and its optional native package. A packed consumer installs and imports without the Claude SDK present.
Interrupting startup can race a delayed import. An interrupted import cannot start a Claude query.

The corresponding source change is also proposed upstream in pingdotgg/t3code#8104. This fork PR adds the package contract needed by the separately published @t3tools/provider-runtime package.

Verification

  • focused Claude adapter and provider tests: 75 passed
  • provider-runtime tests: 1 passed
  • provider-runtime build passed
  • packed consumer installed and imported without @anthropic-ai/claude-agent-sdk
  • packed output retains a deferred SDK import

The provider-runtime typecheck still reports the existing contracts mismatch around mcp_elicitation_approval; this branch does not change that contract.

Created with the Codex harness using gpt-5.6-sol.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Aug 24, 2026
@onmax onmax closed this Aug 24, 2026
@onmax onmax reopened this Aug 26, 2026
@onmax onmax changed the title fix(provider): load Claude SDK only when needed fix(provider): make Claude SDK opt-in Aug 26, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/vite-hub/t3code/@t3tools/contracts@2
pnpm add https://pkg.pr.new/vite-hub/t3code/@t3tools/provider-runtime@2

commit: ace4e6c

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

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant