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",