fix(kiro): add mappable "auto" model slot for Kiro agent mode
Kiro sends modelId "auto" for the main agent turn; without a defaultModels slot getMappedModel returned null and the call leaked to AWS instead of the configured provider. Adds the slot + guard test. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -45,6 +45,11 @@ export const MITM_TOOLS = {
|
|||||||
configType: "mitm",
|
configType: "mitm",
|
||||||
mitmDomain: "q.us-east-1.amazonaws.com",
|
mitmDomain: "q.us-east-1.amazonaws.com",
|
||||||
defaultModels: [
|
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.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-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" },
|
{ id: "claude-haiku-4.5", name: "Claude Haiku 4.5", alias: "claude-haiku-4.5" },
|
||||||
|
|||||||
30
tests/unit/kiro-model-slots.test.js
Normal file
30
tests/unit/kiro-model-slots.test.js
Normal file
@@ -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");
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user