From 779e9b23682a780c1d34e745ebd7e6a1586646b6 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 14 Oct 2026 17:28:46 +0800 Subject: [PATCH] kiro 0.1.11: a thinking model offers xhigh as its own level, so Claude Code's xhigh isn't routed as max (#120) The variants came from BUDGETS (low, medium, high, max), while thinking() already read xhigh. magpie fits an effort the model doesn't offer to the nearest it does, so Claude Code's xhigh on a moved Kiro was recorded and sent as max: 166 of the reporter's requests on 10-14, after the built-in, which takes xhigh, had served it as xhigh the day before. BUDGETS now has xhigh at 50k, the budget thinking() and the built-in's kiroThinkingBudget give it, so what Kiro is asked is unchanged; only the level magpie records and passes is. Both configModel and runtimeModel read BUDGETS. Run: bun test across the repo (TMPDIR+HOME in the scratchpad), all pass; the new effort.test.mjs fails on the old BUDGETS. Not tried with a real Kiro account (none signed in on this machine). --- packages/kiro/README.md | 3 ++- packages/kiro/effort.test.mjs | 15 +++++++++++++++ packages/kiro/index.mjs | 6 ++++-- packages/kiro/package.json | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 packages/kiro/effort.test.mjs diff --git a/packages/kiro/README.md b/packages/kiro/README.md index 6b3f1a0..7ad79ce 100644 --- a/packages/kiro/README.md +++ b/packages/kiro/README.md @@ -85,7 +85,8 @@ request: tool calls and usage. When Kiro reports only how full the context is, input tokens are estimated from that. - Thinking (Claude models and Auto) is asked for the way kiro-cli asks, in - the prompt, with a budget: low 10k, medium 20k, high 30k, max 50k. The + the prompt, with a budget: low 10k, medium 20k, high 30k, xhigh and max + 50k (as magpie's built-in Kiro: #120). The `` block of the reply comes back as thinking. - Kiro's failures keep their meaning: - input too long → 400 diff --git a/packages/kiro/effort.test.mjs b/packages/kiro/effort.test.mjs new file mode 100644 index 0000000..3dc6924 --- /dev/null +++ b/packages/kiro/effort.test.mjs @@ -0,0 +1,15 @@ +import { test, expect } from "bun:test" +import { _internal } from "./index.mjs" + +// Claude Code's levels are low, medium, high, xhigh and max: a thinking +// model offers each, so xhigh isn't routed as max (#120) +test("a thinking model offers xhigh as its own level", () => { + const m = { id: "claude-opus-5.5", name: "Claude Opus 5.5", context: 200000 } + for (const got of [_internal.configModel(m), _internal.runtimeModel(m)]) { + expect(Object.keys(got.variants)).toEqual(["low", "medium", "high", "xhigh", "max"]) + expect(got.variants.xhigh).toEqual({ thinking: { type: "enabled", budgetTokens: 50000 } }) + } + expect(_internal.thinking({ output_config: { effort: "xhigh" } }, "claude-opus-5.5")).toBe(50000) + // a model that doesn't think offers none + expect(_internal.configModel({ id: "deepseek-3.2", name: "DeepSeek" }).variants).toBeUndefined() +}) diff --git a/packages/kiro/index.mjs b/packages/kiro/index.mjs index ce373b0..0df5d09 100644 --- a/packages/kiro/index.mjs +++ b/packages/kiro/index.mjs @@ -503,7 +503,9 @@ function account(client) { const windows = new Map() // a model's context, as Kiro last listed it const thinks = (id) => /claude/i.test(id) || id === "auto" -const BUDGETS = { low: 10000, medium: 20000, high: 30000, max: 50000 } +// the levels a thinking model offers, as the built-in thinks them (xhigh as +// long as max: #120) +const BUDGETS = { low: 10000, medium: 20000, high: 30000, xhigh: 50000, max: 50000 } function configModel(m) { return { @@ -1516,4 +1518,4 @@ export async function KiroAuthPlugin({ client } = {}) { } // for tests -export const _internal = { generate, refresh, usageOf, buildKiro, events, reply, failure, toolID, toolName, toolNames, thinking, readCLI, readIDE, regionOf, planName, frames } +export const _internal = { generate, refresh, usageOf, buildKiro, events, reply, failure, toolID, toolName, toolNames, thinking, configModel, runtimeModel, readCLI, readIDE, regionOf, planName, frames } diff --git a/packages/kiro/package.json b/packages/kiro/package.json index c111693..e257ff8 100644 --- a/packages/kiro/package.json +++ b/packages/kiro/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-kiro-auth", - "version": "0.1.10", + "version": "0.1.11", "description": "Kiro subscriptions (Free, Pro, Pro+, Power) in OpenCode and magpie", "type": "module", "main": "./index.mjs",