feat: add Kiro provider with @ai-sdk/kiro SDK#18408
Open
GyuminJack wants to merge 8 commits intoanomalyco:devfrom
Open
feat: add Kiro provider with @ai-sdk/kiro SDK#18408GyuminJack wants to merge 8 commits intoanomalyco:devfrom
GyuminJack wants to merge 8 commits intoanomalyco:devfrom
Conversation
Add Kiro language model SDK with converters, streaming, tokenizer, provider factory, and model resolver for AWS CodeWhisperer integration.
Add Kiro plugin with Builder ID SSO authentication flow, token refresh, and register it in the plugin index. Add @anthropic-ai/sdk dependency.
Register Kiro in provider database with models: claude-sonnet-4-5, claude-opus-4-5, claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5, claude-sonnet-4, claude-3-7-sonnet. Add @ai-sdk/kiro reasoning variants to transform.
Add Kiro model ID fallback in agent resolution and extend message-v2 for Kiro provider compatibility.
Add tests for Kiro provider registration, model definitions, tool pairing, compaction, overflow recovery, and plugin auth flow.
Remove tests that depend on compaction functions (shouldCompact, fitMessages, truncateModelMessages, aggressive mode) not present in dev baseline. Fix kiro-provider context limit assertion (210K -> 200K).
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential duplicate found:
This PR appears to be an earlier attempt at adding Kiro provider support. The current PR #18408 is likely an updated/improved implementation with the @ai-sdk/kiro SDK, suggesting the previous PR may have been closed or superseded. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
- Use ModelID.make() for all kiro model id fields in provider.ts - Use ProviderID.kiro for kiro provider id and model providerID fields - Add kiro to ProviderID well-known list in schema.ts - Fix agent.ts variant fallback to use ModelID.make() - Fix kiro-provider.test.ts to use branded types in assertions - Fix mockPlugin to return async for proper .catch() support
|
Will it have support for other Kiro logins such as Sign in with Google? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
N/A — new feature, no existing issue.
Type of change
What does this PR do?
Adds Kiro as a provider in OpenCode. Kiro uses AWS CodeWhisperer-backed Claude models via Builder ID SSO auth.
Changes:
@ai-sdk/kiroSDK undersrc/provider/kiro/(converters, streaming, tokenizer, language model, provider factory)src/plugin/kiro.ts) handling Builder ID SSO auth + token refreshtransform.tsBuilt on top of work from:
Two main gotchas with Kiro's API: context window is ~200K tokens (exceeding it causes rejection), and there's no official docs on the exact request payload format — the opencode-kiro-auth repo was essential for figuring that out.
Thanks to both authors for their work 🙏 This is a baseline implementation — some edge cases may not be fully covered, so feedback is welcome.
How did you verify your code works?
bun typecheckpasses (only pre-existing branded type warnings)bun test— 1450 pass, 8 skip, 1 fail (pre-existingcowsaypackage issue, unrelated)Screenshots / recordings
N/A — no UI changes, provider shows up in existing model selection UI.
Checklist