diff --git a/src/shared/constants/cliTools.js b/src/shared/constants/cliTools.js index 97de7434..9f8b23bf 100644 --- a/src/shared/constants/cliTools.js +++ b/src/shared/constants/cliTools.js @@ -45,6 +45,11 @@ export const MITM_TOOLS = { configType: "mitm", mitmDomain: "q.us-east-1.amazonaws.com", defaultModels: [ + // Kiro's agent/"vibe" mode sends modelId "auto" for the main turn and "simple-task" + // for background sub-tasks (verified via MITM request dump of generateAssistantResponse). + // Both need a mappable slot — otherwise getMappedModel returns null and the chat call + // is passed through to AWS instead of being routed to the chosen provider. + { id: "auto", name: "Auto (Kiro Agent)", alias: "auto" }, { id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5", alias: "claude-sonnet-4.5" }, { id: "claude-sonnet-4", name: "Claude Sonnet 4", alias: "claude-sonnet-4" }, { id: "claude-haiku-4.5", name: "Claude Haiku 4.5", alias: "claude-haiku-4.5" }, diff --git a/tests/unit/kiro-model-slots.test.js b/tests/unit/kiro-model-slots.test.js new file mode 100644 index 00000000..3eb9c7b8 --- /dev/null +++ b/tests/unit/kiro-model-slots.test.js @@ -0,0 +1,30 @@ +import { describe, expect, it } from "vitest"; +import { MITM_TOOLS } from "../../src/shared/constants/cliTools.js"; + +// Guards the fix in commit 356607c: Kiro's agent/"vibe" mode sends modelId +// "auto" for the main turn and "simple-task" for background sub-tasks. Both +// need a mappable defaultModels slot — otherwise getMappedModel (src/mitm/server.js) +// returns null and the /generateAssistantResponse call is passed through to AWS +// instead of being routed to the user's chosen provider (surfacing as Kiro's +// "monthly usage limit" once the AWS quota is gone). +describe("Kiro MITM model slots", () => { + const kiro = MITM_TOOLS.kiro; + + it("exposes the kiro mitm tool", () => { + expect(kiro).toBeTruthy(); + expect(kiro.configType).toBe("mitm"); + expect(Array.isArray(kiro.defaultModels)).toBe(true); + }); + + it("offers a mappable slot for the agent default model id 'auto'", () => { + const auto = kiro.defaultModels.find((m) => m.id === "auto"); + expect(auto).toBeTruthy(); + expect(auto.alias).toBe("auto"); + }); + + it("offers a mappable slot for the background sub-task model id 'simple-task'", () => { + const simpleTask = kiro.defaultModels.find((m) => m.id === "simple-task"); + expect(simpleTask).toBeTruthy(); + expect(simpleTask.alias).toBe("simple-task"); + }); +});