Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 13, 2026

Summary

Adds Amazon Bedrock as a new LLM provider option and refactors the AI provider credentials storage from flat fields to a discriminated union JSON structure.

Bedrock Provider:

  • Added Bedrock provider entry supporting two authentication methods:
    • API Key (recommended): Uses AWS Bearer Token for simpler setup
    • AWS Credentials (SigV4): Uses access_key_id, secret_access_key, and region
  • Added UI toggle for users to choose between authentication methods
  • Added Bedrock icon from @lobehub/icons
  • Added setup instructions pointing to AWS IAM Console
  • Added createAmazonBedrock integration in useLLMConnection.ts with conditional auth handling

Credentials Schema Refactor:

  • Replaced flat base_url/api_key fields with discriminated union credentials JSON field
  • Two credential types: api_key (base_url?, api_key) and aws (access_key_id, secret_access_key, region)
  • Simplified TinyBase store schema from multiple columns to single credentials column
  • Added migration logic in transform.ts to convert legacy flat fields to new JSON format
  • Updated ProviderEligibilityContext to accept parsed Credentials type instead of flat config
  • Updated all connection hooks (useLLMConnection.ts, useSTTConnection.ts) to parse credentials JSON

Updates since last revision:

  • Added requires_config_one_of requirement kind for providers that accept multiple credential types (either/or field requirements)
  • Added UI toggle in provider configuration for Bedrock to switch between "API Key" and "AWS Credentials" authentication
  • Updated useLLMConnection.ts to check for apiKey first and use API Key auth, otherwise fall back to SigV4 auth
  • Fixed credential type detection for new provider configurations
  • Fixed migration bug for legacy data with empty api_key
  • Fixed missing baseUrl field in STT provider eligibility check
  • Extracted normalizeBaseUrl to shared utility in @hypr/store
  • Added test coverage for AWS credentials roundtrip and legacy migration

Fixes from code review (latest):

  • Fixed silent data loss during migration: provider configs with base_url but empty credentials are now preserved instead of being silently dropped
  • Added form validation: isFormValid helper prevents saving invalid intermediate states during auto-submit
  • Improved error messages: new missing_config_one_of blocker type properly explains either/or credential requirements instead of listing all fields as required
  • Added runtime type validation: parseCredentials now accepts unknown type and validates input is a string before parsing, removing unsafe type casts throughout the codebase

Review & Testing Checklist for Human

  • Test migration with custom providers: If you have custom OpenAI-compatible providers configured with only base_url (no API key), verify they are preserved after the migration
  • Test Bedrock auth method toggle: Open Settings > AI > LLM > Amazon Bedrock, verify the "Authentication Method" toggle appears with "API Key" and "AWS Credentials" buttons, and that switching between them shows/hides the appropriate fields
  • Test form validation: While configuring a provider, type partial credentials and verify incomplete states are not saved (check settings.json)
  • Test Bedrock with API Key: Configure Bedrock with an API Key (AWS Bearer Token), save, close settings, reopen and verify persistence
  • Test Bedrock with AWS Credentials: Configure Bedrock with Access Key ID, Secret Access Key, and Region, save, close settings, reopen and verify persistence
  • Verify existing providers still work: Test that OpenAI, Anthropic, OpenRouter, Ollama, etc. still validate, save, and connect correctly after the schema change

Recommended test plan:

  1. If you have existing settings, back them up first
  2. Open the app and navigate to Settings > AI > LLM
  3. Verify all existing providers show their expected fields and saved values
  4. Expand Amazon Bedrock - confirm it shows the "Authentication Method" toggle with "API Key" selected by default
  5. Click "AWS Credentials" button - verify Access Key ID, Secret Access Key, and Region fields appear (API Key field should hide)
  6. Click "API Key" button - verify API Key field appears (AWS fields should hide)
  7. Navigate to Settings > AI > STT and verify providers can be selected
  8. Configure a provider (e.g., OpenAI with API key), save, close settings, reopen and verify persistence
  9. Check settings.json file to confirm flat field format is preserved
  10. (Optional) If you have AWS Bedrock access, configure real credentials and test a chat completion with both auth methods

Notes

The credentials are stored internally as JSON strings in TinyBase but transformed back to flat fields when writing to settings.json for human readability. The migration from legacy format happens transparently on load via settingsToProviderRows().

The Bedrock integration uses @ai-sdk/amazon-bedrock which was already a dependency. The provider defaults to us-east-1 region if none is specified. Per the Vercel AI SDK docs, API Key authentication is the recommended method, with SigV4 as a fallback.

Requested by @yujonglee

Link to Devin run: https://app.devin.ai/sessions/9e517eda38854c9fabea1213efa088da

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Jan 13, 2026

Deploy Preview for howto-fix-macos-audio-selection ready!

Name Link
🔨 Latest commit 3960a18
🔍 Latest deploy log https://app.netlify.com/projects/howto-fix-macos-audio-selection/deploys/6968aa14051ff700082de4e8
😎 Deploy Preview https://deploy-preview-3005--howto-fix-macos-audio-selection.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 13, 2026

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit 3960a18
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/6968aa146976960008b262fc
😎 Deploy Preview https://deploy-preview-3005--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 13, 2026

Deploy Preview for hyprnote-storybook ready!

Name Link
🔨 Latest commit 3960a18
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6968aa14cda1810008a39b9f
😎 Deploy Preview https://deploy-preview-3005--hyprnote-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ComputelessComputer ComputelessComputer linked an issue Jan 13, 2026 that may be closed by this pull request
@devin-ai-integration devin-ai-integration bot changed the title feat: add Amazon Bedrock support for LLM provider feat: add Amazon Bedrock support with credentials schema refactor Jan 13, 2026
@yujonglee
Copy link
Contributor

/update

@yujonglee yujonglee force-pushed the devin/1768268311-add-bedrock-support branch from fc72b7c to 15741bd Compare January 14, 2026 01:39
@devin-ai-integration
Copy link
Contributor Author

Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it.

Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues

Review with Devin

@yujonglee
Copy link
Contributor

/update

devin-ai-integration bot and others added 12 commits January 15, 2026 17:49
- Add Bedrock provider with access_key_id, secret_access_key, and region fields
- Extend ConfigField type to support new credential fields
- Update aiProviderSchema to include optional Bedrock credentials
- Update SETTINGS_MAPPING and queries to handle new fields
- Add form fields for Bedrock credentials in NonHyprProviderCard
- Add Bedrock icon from @lobehub/icons

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
- Import createAmazonBedrock from @ai-sdk/amazon-bedrock
- Extend LLMConnectionInfo type with Bedrock credentials
- Update resolveLLMConnection to extract and pass Bedrock credentials
- Add amazon_bedrock case in createLanguageModel function

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
… structure

- Update schema.ts with apiKeyCredentialsSchema and awsCredentialsSchema
- Simplify TinyBase store schema to single credentials column
- Update transform.ts for legacy migration and clean output
- Update eligibility.ts to accept parsed Credentials type
- Update UI forms to handle credentials JSON parsing and serialization
- Update useLLMConnection.ts and useSTTConnection.ts to parse credentials JSON
- Update llm/select.tsx and stt/select.tsx to use new credentials structure

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
…figurations

When configuring a provider for the first time (no existing credentials),
the credential type is now determined from the provider's requirements.
If the provider requires AWS fields (access_key_id, secret_access_key, region),
the form defaults to 'aws' credential type instead of 'api_key'.

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
When legacy data has no api_key, toCredentialsJson now returns null
instead of creating invalid credentials with an empty api_key string
that would fail the min(1) schema validation. The caller skips creating
rows for unconfigured providers.

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
…ibility check

- Fix missing baseUrl field in STT provider eligibility check (addresses Graphite comment)
- Extract normalizeBaseUrl to @hypr/store package to avoid code duplication
- Add test coverage for AWS credentials (Bedrock provider)

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
- Add requires_config_one_of requirement kind for either/or field requirements
- Update Bedrock provider to accept either API Key OR AWS credentials (SigV4)
- Add UI toggle for users to choose between authentication methods
- Update useLLMConnection to handle both auth types for Bedrock

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
devin-ai-integration bot and others added 3 commits January 15, 2026 17:49
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
- Fix silent data loss during migration by preserving provider configs with base_url but empty credentials
- Add form validation to prevent saving invalid intermediate states
- Improve error messages for requires_config_one_of by using a new blocker type
- Add runtime type validation for credentials by accepting unknown type in parseCredentials

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
@yujonglee yujonglee force-pushed the devin/1768268311-add-bedrock-support branch from 2d5771d to 3960a18 Compare January 15, 2026 08:49
Comment on lines +124 to +131
if (data.access_key_id && data.secret_access_key && data.region) {
return JSON.stringify({
type: "aws",
access_key_id: data.access_key_id.trim(),
secret_access_key: data.secret_access_key.trim(),
region: data.region.trim(),
});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical Bug: Whitespace-only strings bypass validation

The truthy check allows whitespace-only strings (e.g., " ") to pass, but they become empty after .trim(). This creates invalid AWS credentials with empty strings.

// Current code allows whitespace to pass:
if (data.access_key_id && data.secret_access_key && data.region) {
  return JSON.stringify({
    type: "aws",
    access_key_id: data.access_key_id.trim(), // Could be empty!
    secret_access_key: data.secret_access_key.trim(),
    region: data.region.trim(),
  });
}

// Fix: Check after trimming
const trimmedKeyId = typeof data.access_key_id === "string" ? data.access_key_id.trim() : "";
const trimmedSecret = typeof data.secret_access_key === "string" ? data.secret_access_key.trim() : "";
const trimmedRegion = typeof data.region === "string" ? data.region.trim() : "";

if (trimmedKeyId && trimmedSecret && trimmedRegion) {
  return JSON.stringify({
    type: "aws",
    access_key_id: trimmedKeyId,
    secret_access_key: trimmedSecret,
    region: trimmedRegion,
  });
}

This would cause authentication failures when migrating legacy AWS credentials that contain whitespace.

Suggested change
if (data.access_key_id && data.secret_access_key && data.region) {
return JSON.stringify({
type: "aws",
access_key_id: data.access_key_id.trim(),
secret_access_key: data.secret_access_key.trim(),
region: data.region.trim(),
});
}
const trimmedKeyId = typeof data.access_key_id === "string" ? data.access_key_id.trim() : "";
const trimmedSecret = typeof data.secret_access_key === "string" ? data.secret_access_key.trim() : "";
const trimmedRegion = typeof data.region === "string" ? data.region.trim() : "";
if (trimmedKeyId && trimmedSecret && trimmedRegion) {
return JSON.stringify({
type: "aws",
access_key_id: trimmedKeyId,
secret_access_key: trimmedSecret,
region: trimmedRegion,
});
}

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Amazon Bedrock support

2 participants