opencode
opencode copied to clipboard
feat(bedrock): config options and authentication precedence
Summary
Adds configuration file support for Amazon Bedrock provider with profile, region, and endpoint options. Documents authentication precedence to clarify that bearer tokens take priority over AWS credential chain methods.
Changes
Provider Configuration (provider.ts)
- Added support for
profile,region, andendpointoptions inopencode.json - Implemented precedence logic: config file options override environment variables
- Profile option now passed to
fromNodeProviderChain()for proper credential resolution
Tests (amazon-bedrock.test.ts)
- Added 4 tests covering config precedence scenarios
- Tests verify profile precedence, endpoint configuration, and combined options
Documentation (config.mdx, providers.mdx)
- Added "Provider-Specific Options" section to config docs
- Added "Authentication Precedence" section to providers docs
- Documents that bearer tokens (
AWS_BEARER_TOKEN_BEDROCKor/connect) take precedence over credential chain
CLI (auth.ts)
- Updated
/connect amazon-bedrockhelp message to show clear credential priority order
Configuration Example
{
"provider": {
"amazon-bedrock": {
"options": {
"region": "us-east-1",
"profile": "my-aws-profile",
"endpoint": "https://bedrock-runtime.us-east-1.vpce-xxxxx.amazonaws.com"
}
}
}
}
Authentication Precedence
- Bearer token (
AWS_BEARER_TOKEN_BEDROCKor/connect) - AWS credential chain (profile, access keys, IAM roles)
Notes:
- Follows existing patterns for provider configuration
- Maintains backward compatibility with environment variable configuration
- Configuration file options take precedence over environment variables (except bearer tokens)