@magpie-community/opencode-kiro-auth 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/index.mjs +19 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,7 +85,8 @@ request:
|
|
|
85
85
|
tool calls and usage. When Kiro reports only how full the context is,
|
|
86
86
|
input tokens are estimated from that.
|
|
87
87
|
- Thinking (Claude models and Auto) is asked for the way kiro-cli asks, in
|
|
88
|
-
the prompt, with a budget: low 10k, medium 20k, high 30k,
|
|
88
|
+
the prompt, with a budget: low 10k, medium 20k, high 30k, xhigh and max
|
|
89
|
+
50k (as magpie's built-in Kiro: #120). The
|
|
89
90
|
`<thinking>` block of the reply comes back as thinking.
|
|
90
91
|
- Kiro's failures keep their meaning:
|
|
91
92
|
- input too long → 400
|
package/index.mjs
CHANGED
|
@@ -503,7 +503,9 @@ function account(client) {
|
|
|
503
503
|
const windows = new Map() // a model's context, as Kiro last listed it
|
|
504
504
|
|
|
505
505
|
const thinks = (id) => /claude/i.test(id) || id === "auto"
|
|
506
|
-
|
|
506
|
+
// the levels a thinking model offers, as the built-in thinks them (xhigh as
|
|
507
|
+
// long as max: #120)
|
|
508
|
+
const BUDGETS = { low: 10000, medium: 20000, high: 30000, xhigh: 50000, max: 50000 }
|
|
507
509
|
|
|
508
510
|
function configModel(m) {
|
|
509
511
|
return {
|
|
@@ -643,6 +645,17 @@ function thinking(req, model) {
|
|
|
643
645
|
return 20000
|
|
644
646
|
}
|
|
645
647
|
|
|
648
|
+
// formatText is the structured output a request asks for, said in words:
|
|
649
|
+
// Anthropic's output_config.format (or the AI SDK's output_format) with a
|
|
650
|
+
// JSON schema, "" when it asks for none. A JSON object with no schema
|
|
651
|
+
// reaches the plugin already told in the system prompt, as Messages has no
|
|
652
|
+
// field for it.
|
|
653
|
+
function formatText(req) {
|
|
654
|
+
const f = req.output_config?.format ?? req.output_format
|
|
655
|
+
if (f?.type !== "json_schema" || !f.schema || typeof f.schema !== "object") return ""
|
|
656
|
+
return "Respond with a single JSON value and nothing else, matching this JSON schema:\n" + JSON.stringify(f.schema) + "."
|
|
657
|
+
}
|
|
658
|
+
|
|
646
659
|
// buildKiro is the body of a generateAssistantResponse call.
|
|
647
660
|
function buildKiro(req, model, profile, budget) {
|
|
648
661
|
const entries = []
|
|
@@ -754,6 +767,10 @@ function buildKiro(req, model, profile, budget) {
|
|
|
754
767
|
for (const e of entries) if (e.assistantResponseMessage && !e.assistantResponseMessage.toolUses.length) delete e.assistantResponseMessage.toolUses
|
|
755
768
|
// the instructions go at the head of the first message
|
|
756
769
|
let system = typeof req.system === "string" ? req.system : textOf(req.system)
|
|
770
|
+
// Kiro has no field for the answer's format: it is told in words, at the
|
|
771
|
+
// end of the instructions, as magpie's built-in tells it (inSystem)
|
|
772
|
+
const format = formatText(req)
|
|
773
|
+
if (format) system = system ? system + "\n\n" + format : format
|
|
757
774
|
if (budget) system = `<thinking_mode>enabled</thinking_mode><max_thinking_length>${budget}</max_thinking_length>` + (system ? "\n" + system : "")
|
|
758
775
|
if (system) entries[0].userInputMessage.content = system + "\n\n" + entries[0].userInputMessage.content
|
|
759
776
|
if (Array.isArray(req.system)) mark(entries[0].userInputMessage, req.system)
|
|
@@ -1516,4 +1533,4 @@ export async function KiroAuthPlugin({ client } = {}) {
|
|
|
1516
1533
|
}
|
|
1517
1534
|
|
|
1518
1535
|
// for tests
|
|
1519
|
-
export const _internal = { generate, refresh, usageOf, buildKiro, events, reply, failure, toolID, toolName, toolNames, thinking, readCLI, readIDE, regionOf, planName, frames }
|
|
1536
|
+
export const _internal = { generate, refresh, usageOf, buildKiro, events, reply, failure, toolID, toolName, toolNames, thinking, configModel, runtimeModel, readCLI, readIDE, regionOf, planName, frames }
|