Skip to content

Commit fbc20a4

Browse files
authored
Merge branch 'main' into glittery-panama
2 parents 644b6f8 + 174833b commit fbc20a4

20 files changed

Lines changed: 343 additions & 26 deletions

File tree

.changeset/add-alibaba-provider.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@kilocode/kilo-gateway": minor
3+
---
4+
5+
Add Alibaba as a supported AI SDK provider for routing Qwen model requests via the native `@ai-sdk/alibaba` adapter.

bun.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kilo-docs/pages/code-with-ai/agents/model-selection.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ While the specifics change constantly, some principles stay consistent:
2626

2727
- Use the **model selector** in the chat prompt area to pick a model for the current session. You can also type `/models` to open the model picker.
2828
- Set per-agent defaults and a global default in the **Settings** panel (Models tab), or directly in the `kilo.jsonc` config file.
29-
- **Model precedence:** Session override → Per-agent config → Global config → Recent models → Kilo Auto (free).
29+
- **Model precedence:** Session override → Last picked per agent → Per-agent config → Global config → Kilo Auto (free).
30+
- The model selector remembers the last model you picked for each agent — switching agents restores your previous choice. A manual pick always beats config settings; use the **reset button** (visible when your active model differs from config) to go back to the config default.
3031

3132
{% /tab %}
3233
{% tab label="CLI" %}

packages/kilo-docs/pages/customize/custom-modes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ Pin a specific model using the `provider/model` format:
161161
model: anthropic/claude-sonnet-4-20250514
162162
```
163163

164+
The model selector also **remembers the last model you picked for each agent** across sessions. A config-pinned `model` acts as the default when no manual pick exists. To reset a pick and let the config take over, use the **reset button** in the model selector (visible when your active model differs from what the config specifies).
165+
164166
### `steps`
165167

166168
Limits the number of agentic iterations (tool call rounds) before the agent is forced to respond with text only. Useful for preventing runaway agents:
@@ -379,6 +381,8 @@ Pin a specific model using the `provider/model` format:
379381
model: anthropic/claude-sonnet-4-20250514
380382
```
381383

384+
The TUI also **remembers the last model you picked for each agent** across sessions. A config-pinned `model` acts as the default when no manual pick exists. To reset a pick and let the config take over, use the model picker (`Ctrl+X m`) and select a different model, or remove the saved pick from `~/.local/state/kilo/model.json`.
385+
382386
### `steps`
383387

384388
Limits the number of agentic iterations (tool call rounds) before the agent is forced to respond with text only. Useful for preventing runaway agents:

packages/kilo-gateway/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"dependencies": {
3030
"@kilocode/plugin": "workspace:*",
3131
"@kilocode/sdk": "workspace:*",
32+
"@ai-sdk/alibaba": "1.0.17",
3233
"@ai-sdk/anthropic": "3.0.71",
3334
"@ai-sdk/openai": "3.0.48",
3435
"@ai-sdk/openai-compatible": "2.0.37",

packages/kilo-gateway/src/api/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ export const ENV_FEATURE = "KILOCODE_FEATURE"
7272

7373
export const PROMPTS = ["codex", "gemini", "beast", "anthropic", "trinity", "anthropic_without_todo"] as const
7474

75-
export const AI_SDK_PROVIDERS = ["anthropic", "openai", "openai-compatible", "openrouter"] as const
75+
export const AI_SDK_PROVIDERS = ["alibaba", "anthropic", "openai", "openai-compatible", "openrouter"] as const

packages/kilo-gateway/src/provider.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createOpenRouter } from "@openrouter/ai-sdk-provider"
2+
import { createAlibaba } from "@ai-sdk/alibaba"
23
import { createAnthropic } from "@ai-sdk/anthropic"
34
import { createOpenAI } from "@ai-sdk/openai"
45
import { createOpenAICompatible } from "@ai-sdk/openai-compatible"
@@ -76,6 +77,7 @@ export function createKilo(options: KiloProviderOptions = {}): KiloProvider {
7677
}
7778

7879
const openrouter = createOpenRouter(sdkOptions)
80+
const alibaba = createAlibaba(sdkOptions)
7981
const anthropic = createAnthropic(sdkOptions)
8082
const openai = createOpenAI(sdkOptions)
8183
const openaiCompatible = createOpenAICompatible({ ...sdkOptions, name: "openaiCompatible" })
@@ -93,6 +95,9 @@ export function createKilo(options: KiloProviderOptions = {}): KiloProvider {
9395
imageModel(modelId) {
9496
return openrouter.imageModel(modelId)
9597
},
98+
alibaba(modelId) {
99+
return alibaba(modelId)
100+
},
96101
anthropic(modelId) {
97102
return anthropic(modelId)
98103
},

packages/kilo-gateway/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export interface ProviderInfo {
160160
}
161161

162162
export type KiloProvider = Provider & {
163+
alibaba(modelId: string): LanguageModel
163164
anthropic(modelId: string): LanguageModel
164165
openai(modelId: string): LanguageModel
165166
openaiCompatible(modelId: string): LanguageModel

packages/kilo-vscode/eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default [
3838
// New code must stay ≤ 20. Do not raise these caps; refactor instead.
3939
{
4040
files: ["src/KiloProvider.ts"],
41-
rules: { complexity: ["error", 140], "max-lines": ["error", 3350] },
41+
rules: { complexity: ["error", 140], "max-lines": ["error", 3353] },
4242
},
4343
{
4444
files: ["webview-ui/agent-manager/AgentManagerApp.tsx"],

packages/kilo-vscode/src/KiloProvider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import { fetchMessagePage, MESSAGE_PAGE_LIMIT } from "./kilo-provider/message-pa
5555
import { childID } from "./kilo-provider/task-session"
5656
import { handleNetworkEvent, clearNetworkWaits } from "./kilo-provider/network"
5757
import { abortSession, parseQueued } from "./kilo-provider/abort"
58+
import * as ModelState from "./kilo-provider/model-state"
5859
import { handleForkSession } from "./kilo-provider/fork-session"
5960
import { retryable, backoff, MAX_RETRIES } from "./util/retry"
6061
import { hasGit } from "./kilo-provider/git-status"
@@ -569,6 +570,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
569570
}
570571

571572
await routeSuggestionWebviewMessage(this.questionCtx, message)
573+
if (await ModelState.handleMessage(message.type, message, this.client, (msg) => this.postMessage(msg))) return
572574
switch (message.type) {
573575
case "webviewReady":
574576
console.log("[Kilo New] KiloProvider: ✅ webviewReady received")
@@ -2836,6 +2838,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
28362838
this.sendBrowserSettings()
28372839
this.sendNotificationSettings()
28382840
this.sendTimelineSetting()
2841+
await ModelState.reset(this.client, (msg) => this.postMessage(msg))
28392842

28402843
// Re-send globalState items to the webview
28412844
this.postMessage({ type: "variantsLoaded", variants: {} })

0 commit comments

Comments
 (0)