Description
Port upstream PR anomalyco#12342 to enable 1M context window and adaptive thinking for Claude Opus 4.6.
Scope
This is a major AI SDK upgrade (v5→v6) with breaking changes. Not a simple cherry-pick.
Changes Required
Phase 1 - Minimal (just headers + adaptive thinking):
Phase 2 - SDK Upgrade (breaking changes):
Key Files
packages/opencode/src/provider/provider.ts - Beta headers
packages/opencode/src/provider/transform.ts - Adaptive thinking logic
packages/opencode/src/session/compaction.ts - Token counting
packages/opencode/src/session/llm.ts - Async migration
packages/opencode/src/session/prompt.ts - Type migration
packages/opencode/src/provider/sdk/copilot/responses/tool/* - Factory renames
Upstream Reference
Quality Gates
Description
Port upstream PR anomalyco#12342 to enable 1M context window and adaptive thinking for Claude Opus 4.6.
Scope
This is a major AI SDK upgrade (v5→v6) with breaking changes. Not a simple cherry-pick.
Changes Required
Phase 1 - Minimal (just headers + adaptive thinking):
context-1m-2025-08-07beta header to Anthropic provideradaptive-thinking-2026-01-28beta headerPhase 2 - SDK Upgrade (breaking changes):
ai5.0.124 → 6.0.72Key Files
packages/opencode/src/provider/provider.ts- Beta headerspackages/opencode/src/provider/transform.ts- Adaptive thinking logicpackages/opencode/src/session/compaction.ts- Token countingpackages/opencode/src/session/llm.ts- Async migrationpackages/opencode/src/session/prompt.ts- Type migrationpackages/opencode/src/provider/sdk/copilot/responses/tool/*- Factory renamesUpstream Reference
Quality Gates