forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
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):
- Add
context-1m-2025-08-07beta header to Anthropic provider - Add
adaptive-thinking-2026-01-28beta header - Add adaptive thinking detection for Opus 4.6 in transform.ts
- Convert budgetTokens → effort for Opus 4.6 models
Phase 2 - SDK Upgrade (breaking changes):
- Upgrade
ai5.0.124 → 6.0.72 - Upgrade all @ai-sdk/* packages (18+ packages)
- Migrate LanguageModelV2 → LanguageModelV3
- Make toModelMessages async
- Rename tool factory functions
- Update test suites for new usage types
- Fix compaction token counting bug
Key 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 renames
Upstream Reference
- Issue: 1M tokens for Opus 4.6 anomalyco/opencode#12338
- PR: feat(provider): add adaptive thinking and 1M context support for Claude Opus 4.6 anomalyco/opencode#12342
Quality Gates
- Tests pass
- Type checking passes
- Manual test: Opus 4.6 with >200k tokens
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels