mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Allow Bedrock Runtime selection during setup and login (#62222)
## Why The app server's Bedrock setup and login flows always selected Mantle. Clients using Bedrock Runtime had to configure that provider separately. ## What changed Accept an optional `providerId` in `account/bedrock/setup` for AWS profiles and environment credentials, and in `account/login/start` for Bedrock API keys and AWS access keys. Pass `"amazon-bedrock-runtime"` to select Runtime. Omit the field or pass `null` to keep the Mantle default. Save configuration for the selected provider and check that provider for an existing `aws.credential_export` before changing credential sources. ## Testing Extend app-server tests to cover Runtime setup with profiles and environment credentials, Runtime login with both key types, and Mantle fallback. Verify that environment setup selects the Runtime default model for a new thread and that a configured Runtime credential exporter blocks profile setup. GitOrigin-RevId: 6396b638208ab9b12f50f13f13bd517a919d0848
This commit is contained in:
@@ -2120,6 +2120,17 @@
|
||||
"apiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerId": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BedrockProviderId"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Defaults to Amazon Bedrock Mantle when omitted."
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -2145,6 +2156,17 @@
|
||||
"accessKeyId": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerId": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BedrockProviderId"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Defaults to Amazon Bedrock Mantle when omitted."
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
+22
@@ -15293,6 +15293,17 @@
|
||||
"apiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerId": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/BedrockProviderId"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Defaults to Amazon Bedrock Mantle when omitted."
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -15318,6 +15329,17 @@
|
||||
"accessKeyId": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerId": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/BedrockProviderId"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Defaults to Amazon Bedrock Mantle when omitted."
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
+22
@@ -11227,6 +11227,17 @@
|
||||
"apiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerId": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BedrockProviderId"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Defaults to Amazon Bedrock Mantle when omitted."
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -11252,6 +11263,17 @@
|
||||
"accessKeyId": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerId": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BedrockProviderId"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Defaults to Amazon Bedrock Mantle when omitted."
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"definitions": {
|
||||
"BedrockProviderId": {
|
||||
"enum": [
|
||||
"amazon-bedrock",
|
||||
"amazon-bedrock-runtime"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"LoginAppBrand": {
|
||||
"enum": [
|
||||
"codex",
|
||||
@@ -119,6 +126,17 @@
|
||||
"apiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerId": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BedrockProviderId"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Defaults to Amazon Bedrock Mantle when omitted."
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -144,6 +162,17 @@
|
||||
"accessKeyId": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerId": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BedrockProviderId"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Defaults to Amazon Bedrock Mantle when omitted."
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { BedrockProviderId } from "./BedrockProviderId";
|
||||
import type { LoginAppBrand } from "./LoginAppBrand";
|
||||
|
||||
export type LoginAccountParams = { "type": "apiKey", apiKey: string, } | { "type": "chatgpt", codexStreamlinedLogin?: boolean, useHostedLoginSuccessPage?: boolean, appBrand?: LoginAppBrand | null, } | { "type": "chatgptDeviceCode" } | { "type": "chatgptAuthTokens",
|
||||
@@ -19,4 +20,12 @@ chatgptAccountId: string,
|
||||
* When `null`, Codex attempts to derive the plan type from access-token
|
||||
* claims. If unavailable, the plan defaults to `unknown`.
|
||||
*/
|
||||
chatgptPlanType?: string | null, } | { "type": "amazonBedrock", apiKey: string, region: string, } | { "type": "amazonBedrockAccessKeys", accessKeyId: string, secretAccessKey: string, sessionToken?: string | null, region: string, };
|
||||
chatgptPlanType?: string | null, } | { "type": "amazonBedrock", apiKey: string, region: string,
|
||||
/**
|
||||
* Defaults to Amazon Bedrock Mantle when omitted.
|
||||
*/
|
||||
providerId?: BedrockProviderId | null, } | { "type": "amazonBedrockAccessKeys", accessKeyId: string, secretAccessKey: string, sessionToken?: string | null, region: string,
|
||||
/**
|
||||
* Defaults to Amazon Bedrock Mantle when omitted.
|
||||
*/
|
||||
providerId?: BedrockProviderId | null, };
|
||||
|
||||
@@ -3521,11 +3521,13 @@ mod tests {
|
||||
v2::LoginAccountParams::AmazonBedrock {
|
||||
api_key: "secret".to_string(),
|
||||
region: "us-west-2".to_string(),
|
||||
provider_id: None,
|
||||
},
|
||||
json!({
|
||||
"type": "amazonBedrock",
|
||||
"apiKey": "secret",
|
||||
"region": "us-west-2"
|
||||
"region": "us-west-2",
|
||||
"providerId": null
|
||||
}),
|
||||
),
|
||||
(
|
||||
@@ -3534,13 +3536,15 @@ mod tests {
|
||||
secret_access_key: "secret-access-key".to_string(),
|
||||
session_token: Some("session-token".to_string()),
|
||||
region: "us-west-2".to_string(),
|
||||
provider_id: Some(v2::BedrockProviderId::AmazonBedrockRuntime),
|
||||
},
|
||||
json!({
|
||||
"type": "amazonBedrockAccessKeys",
|
||||
"accessKeyId": "access-key-id",
|
||||
"secretAccessKey": "secret-access-key",
|
||||
"sessionToken": "session-token",
|
||||
"region": "us-west-2"
|
||||
"region": "us-west-2",
|
||||
"providerId": "amazon-bedrock-runtime"
|
||||
}),
|
||||
),
|
||||
] {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use super::BedrockProviderId;
|
||||
use super::ThreadUsage;
|
||||
use crate::JsonSchema;
|
||||
use crate::TS;
|
||||
@@ -117,7 +118,13 @@ pub enum LoginAccountParams {
|
||||
#[experimental("account/login/start.amazonBedrock")]
|
||||
#[serde(rename = "amazonBedrock", rename_all = "camelCase")]
|
||||
#[ts(rename = "amazonBedrock", rename_all = "camelCase")]
|
||||
AmazonBedrock { api_key: String, region: String },
|
||||
AmazonBedrock {
|
||||
api_key: String,
|
||||
region: String,
|
||||
/// Defaults to Amazon Bedrock Mantle when omitted.
|
||||
#[ts(optional = nullable)]
|
||||
provider_id: Option<BedrockProviderId>,
|
||||
},
|
||||
/// [UNSTABLE] Managed Amazon Bedrock AWS access key login is experimental.
|
||||
#[experimental("account/login/start.amazonBedrockAccessKeys")]
|
||||
#[serde(rename = "amazonBedrockAccessKeys", rename_all = "camelCase")]
|
||||
@@ -128,6 +135,9 @@ pub enum LoginAccountParams {
|
||||
#[ts(optional = nullable)]
|
||||
session_token: Option<String>,
|
||||
region: String,
|
||||
/// Defaults to Amazon Bedrock Mantle when omitted.
|
||||
#[ts(optional = nullable)]
|
||||
provider_id: Option<BedrockProviderId>,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use super::BedrockProviderId;
|
||||
use crate::JsonSchema;
|
||||
use crate::TS;
|
||||
use serde::Deserialize;
|
||||
@@ -50,10 +51,21 @@ pub enum AwsCredentialType {
|
||||
pub enum BedrockSetupParams {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
Profile { profile: String, region: String },
|
||||
Profile {
|
||||
profile: String,
|
||||
region: String,
|
||||
/// Defaults to Amazon Bedrock Mantle when omitted.
|
||||
#[ts(optional = nullable)]
|
||||
provider_id: Option<BedrockProviderId>,
|
||||
},
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
Environment { region: String },
|
||||
Environment {
|
||||
region: String,
|
||||
/// Defaults to Amazon Bedrock Mantle when omitted.
|
||||
#[ts(optional = nullable)]
|
||||
provider_id: Option<BedrockProviderId>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
|
||||
Reference in New Issue
Block a user