Merge pull request #6195 from Kilo-Org/kevinvandijk/kilo-opencode-v1.2.3

OpenCode v1.2.3
This commit is contained in:
Kevin van Dijk
2026-02-23 16:58:20 +01:00
committed by GitHub
8 changed files with 185 additions and 13 deletions
+1
View File
@@ -468,6 +468,7 @@
"tree-sitter-bash",
],
"patchedDependencies": {
"@openrouter/ai-sdk-provider@1.5.4": "patches/@openrouter%2Fai-sdk-provider@1.5.4.patch",
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
},
"overrides": {
Generated
+3 -3
View File
@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1771207753,
"narHash": "sha256-b9uG8yN50DRQ6A7JdZBfzq718ryYrlmGgqkRm9OOwCE=",
"lastModified": 1770812194,
"narHash": "sha256-OH+lkaIKAvPXR3nITO7iYZwew2nW9Y7Xxq0yfM/UcUU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d1c15b7d5806069da59e819999d70e1cec0760bf",
"rev": "8482c7ded03bae7550f3d69884f1e611e3bd19e8",
"type": "github"
},
"original": {
+1
View File
@@ -102,6 +102,7 @@
},
"patchedDependencies": {
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
"@openrouter/ai-sdk-provider@1.5.4": "patches/@openrouter%2Fai-sdk-provider@1.5.4.patch",
"ghostty-web@0.3.0": "patches/ghostty-web@0.3.0.patch"
},
"version": "7.0.26",
+6 -6
View File
@@ -78,15 +78,13 @@
"@gitlab/opencode-gitlab-auth": "1.3.2",
"@hono/standard-validator": "0.1.5",
"@hono/zod-validator": "catalog:",
"@kilocode/kilo-gateway": "workspace:*",
"@kilocode/kilo-telemetry": "workspace:*",
"@kilocode/plugin": "workspace:*",
"@kilocode/sdk": "workspace:*",
"@modelcontextprotocol/sdk": "1.25.2",
"@octokit/graphql": "9.0.2",
"@octokit/rest": "catalog:",
"@openauthjs/openauth": "catalog:",
"@kilocode/plugin": "workspace:*",
"@opencode-ai/script": "workspace:*",
"@kilocode/sdk": "workspace:*",
"@opencode-ai/util": "workspace:*",
"@openrouter/ai-sdk-provider": "1.5.4",
"@opentui/core": "0.1.79",
@@ -117,7 +115,6 @@
"opentui-spinner": "0.0.6",
"partial-json": "0.1.7",
"remeda": "catalog:",
"simple-git": "3.31.1",
"solid-js": "catalog:",
"strip-ansi": "7.1.2",
"tree-sitter-bash": "0.25.0",
@@ -128,7 +125,10 @@
"xdg-basedir": "5.1.0",
"yargs": "18.0.0",
"zod": "catalog:",
"zod-to-json-schema": "3.24.5"
"zod-to-json-schema": "3.24.5",
"@kilocode/kilo-gateway": "workspace:*",
"@kilocode/kilo-telemetry": "workspace:*",
"simple-git": "3.31.1"
},
"overrides": {
"drizzle-orm": "1.0.0-beta.12-a5629fb"
+15 -4
View File
@@ -378,7 +378,7 @@ export namespace ProviderTransform {
switch (model.api.npm) {
case "@openrouter/ai-sdk-provider":
if (!model.id.includes("gpt") && !model.id.includes("gemini-3")) return {}
if (!model.id.includes("gpt") && !model.id.includes("gemini-3") && !model.id.includes("claude")) return {}
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
// kilocode_change start
@@ -799,6 +799,9 @@ export namespace ProviderTransform {
result["promptCacheKey"] = input.sessionID
}
if (input.model.providerID === "openrouter") {
result["prompt_cache_key"] = input.sessionID
}
if (input.model.api.npm === "@ai-sdk/gateway") {
result["gateway"] = {
caching: "auto",
@@ -840,15 +843,22 @@ export namespace ProviderTransform {
return {}
}
// Maps model ID prefix to provider slug used in providerOptions.
// Example: "amazon/nova-2-lite" → "bedrock"
const SLUG_OVERRIDES: Record<string, string> = {
amazon: "bedrock",
}
export function providerOptions(model: Provider.Model, options: { [x: string]: any }) {
if (model.api.npm === "@ai-sdk/gateway") {
// Gateway providerOptions are split across two namespaces:
// - `gateway`: gateway-native routing/caching controls
// - `gateway`: gateway-native routing/caching controls (order, only, byok, etc.)
// - `<upstream slug>`: provider-specific model options (anthropic/openai/...)
// We keep `gateway` as-is and route every other top-level option under the
// model-derived upstream slug so variants/options can stay flat internally.
// model-derived upstream slug.
const i = model.api.id.indexOf("/")
const slug = i > 0 ? model.api.id.slice(0, i) : undefined
const rawSlug = i > 0 ? model.api.id.slice(0, i) : undefined
const slug = rawSlug ? (SLUG_OVERRIDES[rawSlug] ?? rawSlug) : undefined
const gateway = options.gateway
const rest = Object.fromEntries(Object.entries(options).filter(([k]) => k !== "gateway"))
const has = Object.keys(rest).length > 0
@@ -858,6 +868,7 @@ export namespace ProviderTransform {
if (has) {
if (slug) {
// Route model-specific options under the provider slug
result[slug] = rest
} else if (gateway && typeof gateway === "object" && !Array.isArray(gateway)) {
result.gateway = { ...gateway, ...rest }
+1
View File
@@ -74,6 +74,7 @@ export namespace Database {
sqlite.run("PRAGMA busy_timeout = 5000")
sqlite.run("PRAGMA cache_size = -64000")
sqlite.run("PRAGMA foreign_keys = ON")
sqlite.run("PRAGMA wal_checkpoint(PASSIVE)")
const db = drizzle({ client: sqlite, schema })
@@ -341,6 +341,36 @@ describe("ProviderTransform.providerOptions", () => {
gateway: { reasoningEffort: "high" },
})
})
test("maps amazon slug to bedrock for provider options", () => {
const model = createModel({
providerID: "vercel",
api: {
id: "amazon/nova-2-lite",
url: "https://ai-gateway.vercel.sh/v3/ai",
npm: "@ai-sdk/gateway",
},
})
expect(ProviderTransform.providerOptions(model, { reasoningConfig: { type: "enabled" } })).toEqual({
bedrock: { reasoningConfig: { type: "enabled" } },
})
})
test("uses groq slug for groq models", () => {
const model = createModel({
providerID: "vercel",
api: {
id: "groq/llama-3.3-70b-versatile",
url: "https://ai-gateway.vercel.sh/v3/ai",
npm: "@ai-sdk/gateway",
},
})
expect(ProviderTransform.providerOptions(model, { reasoningFormat: "parsed" })).toEqual({
groq: { reasoningFormat: "parsed" },
})
})
})
describe("ProviderTransform.schema - gemini array items", () => {
@@ -0,0 +1,128 @@
diff --git a/dist/index.js b/dist/index.js
index f33510a50d11a2cb92a90ea70cc0ac84c89f29b9..e887a60352c0c08ab794b1e6821854dfeefd20cc 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -2110,7 +2110,12 @@ var OpenRouterChatLanguageModel = class {
if (reasoningStarted && !textStarted) {
controller.enqueue({
type: "reasoning-end",
- id: reasoningId || generateId()
+ id: reasoningId || generateId(),
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
+ openrouter: {
+ reasoning_details: accumulatedReasoningDetails
+ }
+ } : undefined
});
reasoningStarted = false;
}
@@ -2307,7 +2312,12 @@ var OpenRouterChatLanguageModel = class {
if (reasoningStarted) {
controller.enqueue({
type: "reasoning-end",
- id: reasoningId || generateId()
+ id: reasoningId || generateId(),
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
+ openrouter: {
+ reasoning_details: accumulatedReasoningDetails
+ }
+ } : undefined
});
}
if (textStarted) {
diff --git a/dist/index.mjs b/dist/index.mjs
index 8a688331b88b4af738ee4ca8062b5f24124d3d81..6310cb8b7c8d0a728d86e1eed09906c6b4c91ae2 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -2075,7 +2075,12 @@ var OpenRouterChatLanguageModel = class {
if (reasoningStarted && !textStarted) {
controller.enqueue({
type: "reasoning-end",
- id: reasoningId || generateId()
+ id: reasoningId || generateId(),
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
+ openrouter: {
+ reasoning_details: accumulatedReasoningDetails
+ }
+ } : undefined
});
reasoningStarted = false;
}
@@ -2272,7 +2277,12 @@ var OpenRouterChatLanguageModel = class {
if (reasoningStarted) {
controller.enqueue({
type: "reasoning-end",
- id: reasoningId || generateId()
+ id: reasoningId || generateId(),
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
+ openrouter: {
+ reasoning_details: accumulatedReasoningDetails
+ }
+ } : undefined
});
}
if (textStarted) {
diff --git a/dist/internal/index.js b/dist/internal/index.js
index d40fa66125941155ac13a4619503caba24d89f8a..8dd86d1b473f2fa31c1acd9881d72945b294a197 100644
--- a/dist/internal/index.js
+++ b/dist/internal/index.js
@@ -2064,7 +2064,12 @@ var OpenRouterChatLanguageModel = class {
if (reasoningStarted && !textStarted) {
controller.enqueue({
type: "reasoning-end",
- id: reasoningId || generateId()
+ id: reasoningId || generateId(),
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
+ openrouter: {
+ reasoning_details: accumulatedReasoningDetails
+ }
+ } : undefined
});
reasoningStarted = false;
}
@@ -2261,7 +2266,12 @@ var OpenRouterChatLanguageModel = class {
if (reasoningStarted) {
controller.enqueue({
type: "reasoning-end",
- id: reasoningId || generateId()
+ id: reasoningId || generateId(),
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
+ openrouter: {
+ reasoning_details: accumulatedReasoningDetails
+ }
+ } : undefined
});
}
if (textStarted) {
diff --git a/dist/internal/index.mjs b/dist/internal/index.mjs
index b0ed9d113549c5c55ea3b1e08abb3db6f92ae5a7..5695930a8e038facc071d58a4179a369a29be9c7 100644
--- a/dist/internal/index.mjs
+++ b/dist/internal/index.mjs
@@ -2030,7 +2030,12 @@ var OpenRouterChatLanguageModel = class {
if (reasoningStarted && !textStarted) {
controller.enqueue({
type: "reasoning-end",
- id: reasoningId || generateId()
+ id: reasoningId || generateId(),
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
+ openrouter: {
+ reasoning_details: accumulatedReasoningDetails
+ }
+ } : undefined
});
reasoningStarted = false;
}
@@ -2227,7 +2232,12 @@ var OpenRouterChatLanguageModel = class {
if (reasoningStarted) {
controller.enqueue({
type: "reasoning-end",
- id: reasoningId || generateId()
+ id: reasoningId || generateId(),
+ providerMetadata: accumulatedReasoningDetails.length > 0 ? {
+ openrouter: {
+ reasoning_details: accumulatedReasoningDetails
+ }
+ } : undefined
});
}
if (textStarted) {