From aeb57f114750999201646a3c4a899e0bb4c2852a Mon Sep 17 00:00:00 2001 From: justintyku Date: Sat, 29 Aug 2026 16:06:47 -0400 Subject: [PATCH 1/3] add dev containers --- .devcontainer/devcontainer.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..88a91a1f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node +{ + "name": "Node.js & TypeScript", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/typescript-node:5-22-bookworm", + "features": { + "ghcr.io/devcontainers-extra/features/bun:1": {"version": "1.3.0"} + } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "yarn install", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} From 46e9c07b4d106ee6a09774a2a61a5d3ae2caa433 Mon Sep 17 00:00:00 2001 From: jku0227 Date: Mon, 7 Sep 2026 00:40:58 +0000 Subject: [PATCH 2/3] refactor resolveModelID into per-region prefix resolvers to reduce returns --- .../src/plugin/provider/amazon-bedrock.ts | 66 +++++++++---------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/packages/core/src/plugin/provider/amazon-bedrock.ts b/packages/core/src/plugin/provider/amazon-bedrock.ts index 0995cf1c..a0ed43bb 100644 --- a/packages/core/src/plugin/provider/amazon-bedrock.ts +++ b/packages/core/src/plugin/provider/amazon-bedrock.ts @@ -12,45 +12,39 @@ type MantleSDK = { // Bedrock cross-region inference profiles require regional prefixes only for // specific model/region combinations. Keep the mapping narrow and avoid // double-prefixing model IDs that models.dev already marks as global/us/eu/etc. -function resolveModelID(modelID: string, region: string | undefined) { - const crossRegionPrefixes = ["global.", "us.", "eu.", "jp.", "apac.", "au."] - if (crossRegionPrefixes.some((prefix) => modelID.startsWith(prefix))) return modelID +const CROSS_REGION_PREFIXES = ["global.", "us.", "eu.", "jp.", "apac.", "au."] +const US_MODELS = ["nova-micro", "nova-lite", "nova-pro", "nova-premier", "nova-2", "claude", "deepseek"] +const EU_REGIONS = ["eu-west-1", "eu-west-2", "eu-west-3", "eu-north-1", "eu-central-1", "eu-south-1", "eu-south-2"] +const EU_MODELS = ["claude", "nova-lite", "nova-micro", "llama3", "pixtral"] +const AU_REGIONS = ["ap-southeast-2", "ap-southeast-4"] +const AU_MODELS = ["anthropic.claude-sonnet-4-5", "anthropic.claude-haiku"] +const APAC_MODELS = ["claude", "nova-lite", "nova-micro", "nova-pro"] - const resolvedRegion = region ?? "us-east-1" - const regionPrefix = resolvedRegion.split("-")[0] - if (regionPrefix === "us") { - const requiresPrefix = ["nova-micro", "nova-lite", "nova-pro", "nova-premier", "nova-2", "claude", "deepseek"].some( - (item) => modelID.includes(item), - ) - if (requiresPrefix && !resolvedRegion.startsWith("us-gov")) return `${regionPrefix}.${modelID}` - return modelID - } - if (regionPrefix === "eu") { - const regionRequiresPrefix = [ - "eu-west-1", - "eu-west-2", - "eu-west-3", - "eu-north-1", - "eu-central-1", - "eu-south-1", - "eu-south-2", - ].some((item) => resolvedRegion.includes(item)) - const modelRequiresPrefix = ["claude", "nova-lite", "nova-micro", "llama3", "pixtral"].some((item) => - modelID.includes(item), - ) - return regionRequiresPrefix && modelRequiresPrefix ? `${regionPrefix}.${modelID}` : modelID - } - if (regionPrefix !== "ap") return modelID +const matchesAny = (value: string, patterns: string[]) => patterns.some((pattern) => value.includes(pattern)) + +type PrefixResolver = (modelID: string, region: string) => string | undefined + +const usPrefix: PrefixResolver = (modelID, region) => + !region.startsWith("us-gov") && matchesAny(modelID, US_MODELS) ? "us" : undefined - const australia = ["ap-southeast-2", "ap-southeast-4"].includes(resolvedRegion) - if (australia && ["anthropic.claude-sonnet-4-5", "anthropic.claude-haiku"].some((item) => modelID.includes(item))) { - return `au.${modelID}` - } +const euPrefix: PrefixResolver = (modelID, region) => + matchesAny(region, EU_REGIONS) && matchesAny(modelID, EU_MODELS) ? "eu" : undefined - const prefix = resolvedRegion === "ap-northeast-1" ? "jp" : "apac" - return ["claude", "nova-lite", "nova-micro", "nova-pro"].some((item) => modelID.includes(item)) - ? `${prefix}.${modelID}` - : modelID +const apPrefix: PrefixResolver = (modelID, region) => { + if (AU_REGIONS.includes(region) && matchesAny(modelID, AU_MODELS)) return "au" + const prefix = region === "ap-northeast-1" ? "jp" : "apac" + return matchesAny(modelID, APAC_MODELS) ? prefix : undefined +} + +const PREFIX_RESOLVERS: Record = { us: usPrefix, eu: euPrefix, ap: apPrefix } + +function resolveModelID(modelID: string, region: string | undefined) { + if (CROSS_REGION_PREFIXES.some((prefix) => modelID.startsWith(prefix))) return modelID + + const resolvedRegion = region ?? "us-east-1" + const resolver = PREFIX_RESOLVERS[resolvedRegion.split("-")[0]] + const prefix = resolver?.(modelID, resolvedRegion) + return prefix ? `${prefix}.${modelID}` : modelID } function selectMantleModel(sdk: MantleSDK, modelID: string) { From 6c4d73feb95e12dc80e5c370150970758e33c9ce Mon Sep 17 00:00:00 2001 From: jku0227 Date: Mon, 7 Sep 2026 00:44:14 +0000 Subject: [PATCH 3/3] add postcreatecommand --- .devcontainer/devcontainer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 88a91a1f..fb7ea8eb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,8 +5,8 @@ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": "mcr.microsoft.com/devcontainers/typescript-node:5-22-bookworm", "features": { - "ghcr.io/devcontainers-extra/features/bun:1": {"version": "1.3.0"} - } + "ghcr.io/devcontainers-extra/features/bun:1": {"version": "1.3.4"} + }, // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, @@ -15,7 +15,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "yarn install", + "postCreateCommand": "curl https://qlty.sh | bash && bun install" // Configure tool-specific properties. // "customizations": {},