Skip to content

Commit a061271

Browse files
authored
feat: add IO Intelligence provider (#1758)
* feat: add IO Intelligence provider Restore the IO Intelligence (io.net) provider removed in #11297, updated to the current architecture: dynamic model catalog fetched from GET /models, streaming chat completions with reasoning and tool-call support, usage reporting, settings UI, and translations for all supported locales. * fix(api): derive IO Intelligence model metadata from the live catalog - parse context_window, max_tokens, tool/vision/cache capabilities, and per-token pricing (normalized per million) from the /models catalog - prefer context_window over the always-null max_model_len field - skip catalog entries that explicitly declare no tool support - add io-intelligence to KEY_SCOPED_PROVIDERS for per-key cache isolation - un-retire test fixtures, add provider parity tests across types, api, and webview-ui, and record a changeset * fix(api): forward IO Intelligence completion options only when set The OpenAI SDK validates a present-but-undefined timeout key, so completePrompt threw before issuing a request whenever it was called without options. Request options are now built conditionally, matching the SDK's key-presence semantics, and regression tests cover both the bare and optioned calls. Adds the missing settings-component spec. * fix(api): harden IO Intelligence schema and temperature guard Aligns the max_model_len zod field with its sibling numeric fields (integer, positive, nullish) and gates the streaming temperature parameter on a configured value and the model's capability flag, matching the NanoGPT handler. * fix(api): forward IO Intelligence temperature in completePrompt Mirror the streaming path's three-condition guard (configured temperature, catalog supportsTemperature not explicitly false, model supports it) in the non-streaming completePrompt body, matching the NanoGPT handler. Add a regression test asserting the temperature reaches the request body. * test(api): use a catalog-listed model id in the IO Intelligence fixture * fix(webview): link the IO Intelligence model hint to the product page - point the ModelPicker serviceUrl at https://io.net/intelligence instead of the raw models API endpoint, matching how the other providers link a human-readable page - use deepseek-ai/DeepSeek-V3.2 as the handler-spec fixture id; the previously used DeepSeek-V3.1 is no longer listed in the io.net catalog * fix: align IO Intelligence usage mapping and render order with the precedent - use ?? instead of || for cacheReadTokens so a legitimate cached_tokens of 0 is preserved, matching the NanoGPT usage mapping - move the ApiOptions render block after Kenari so io-intelligence sits in the same position as every other registration in this change * test(api): cover cached_tokens:0 preservation in the IO Intelligence usage mapping * chore: drop the IO Intelligence changeset Routine provider PRs do not add changesets in this repo; they are only added during release preparation. * fix(api): redact the IO Intelligence key before the provider error is logged handleProviderError logs the message and stack before it applies the messageTransformer, so an upstream error that echoed the API key reached the extension-host log even though the thrown error was redacted. Scrub the key from the error itself (and from non-Error values) before handing it over, and keep the transformer redaction for messages derived from other error fields. The spec now spies on console.error and also covers the non-Error and no-key paths. * test: reject a disallowed IO Intelligence model in ProfileValidator Add ioIntelligenceModelId to the positive-and-negative provider table and assert that a model absent from the allowlist is rejected. * fix(webview): debounce IO Intelligence catalog refreshes while the key is typed The API-key effect posted requestRouterModels on every keystroke, and because the IO Intelligence cache is keyed by the API key each partial value triggered a fresh catalog request. Use the same 250ms useDebounce as ApiOptions so only the settled key is sent, and drop a pending request on unmount. * fix(webview): keep an unlisted IO Intelligence model id as the picker selection A custom id stored through ModelPicker's "Use custom model" path was replaced by the default id in useSelectedModel when the fetched catalog did not list it, so the picker displayed a different model from the one the handler sends requests with (RouterProvider.getModel resolves modelId || defaultModelId). Preserve the configured id and only fall back the metadata, mirroring the litellm and kimi-code cases. Covered by a hook test and a real-ModelPicker selection test. * fix: redact raw error metadata and keep IO Intelligence ready after a catalog failure handleProviderError prefers error.error.metadata.raw as the logged message, so scrub the API key from that field alongside message and stack before the handler logs it. Treat IO Intelligence like LiteLLM in the readiness check so a settled catalog error still resolves the configured model id instead of falling back to the provider default. Regression tests for both. * fix: serialize object-valued raw error bodies before redacting them handleProviderError calls string methods on error.error.metadata.raw, so an object-valued upstream body reached it unredacted and threw a TypeError before the status was preserved. Serialize it first, then redact. Regression test with an object body and a 401 status. * fix(io-intelligence): stop rendering catalog names as model descriptions The IO Intelligence catalog has no free-text description field, so the fetcher was copying the remote model name into ModelInfo.description, which the settings view renders as Markdown. Leave description unset and keep the name as the plain-text displayName only. Add focused tests for the requestRouterModels path (stored key, unsaved key from message values, explicit empty key) and for the IO Intelligence provider validation. * fix(io-intelligence): do not forward OpenAI Compatible custom headers The IO Intelligence endpoint is fixed, so the custom headers configured for the OpenAI Compatible provider are dropped before the client is built. Add tests for the header isolation and for omitting temperature on a model that does not support it (streaming and completePrompt). * test(io-intelligence): assert the catalog published for each router-models key * fix(io-intelligence): build the model catalog on a null-prototype object * test(io-intelligence): pin the request messages and the completePrompt payload * test(io-intelligence): add a visual snapshot of the provider settings * test(io-intelligence): keep only the screenshot check in the visual test
1 parent ff0a2bd commit a061271

69 files changed

Lines changed: 2036 additions & 9 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/cli/src/lib/utils/__tests__/context-window.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ describe("getContextWindow", () => {
1414
[providerIdentifiers.vercelAiGateway, "vercelAiGatewayModelId"],
1515
[providerIdentifiers.opencodeGo, "opencodeGoModelId"],
1616
[providerIdentifiers.kenari, "kenariModelId"],
17+
[providerIdentifiers.ioIntelligence, "ioIntelligenceModelId"],
1718
[providerIdentifiers.nanogpt, "nanoGptModelId"],
1819
[providerIdentifiers.zooGateway, "zooGatewayModelId"],
1920
] as const)("uses the provider-specific model field for %s", (provider, modelField) => {

‎apps/cli/src/lib/utils/context-window.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ function getModelIdForProvider(config: ProviderSettings): string | undefined {
5050
return config.unboundModelId
5151
case providerIdentifiers.litellm:
5252
return config.litellmModelId
53+
case providerIdentifiers.ioIntelligence:
54+
return config.ioIntelligenceModelId
5355
case providerIdentifiers.vercelAiGateway:
5456
return config.vercelAiGatewayModelId
5557
case providerIdentifiers.opencodeGo:
@@ -90,7 +92,6 @@ function getModelIdForProvider(config: ProviderSettings): string | undefined {
9092
case retiredProviderIdentifiers.featherless:
9193
case retiredProviderIdentifiers.groq:
9294
case retiredProviderIdentifiers.huggingface:
93-
case retiredProviderIdentifiers.ioIntelligence:
9495
case retiredProviderIdentifiers.roo:
9596
case providerIdentifiers.vscodeLm:
9697
case providerIdentifiers.fakeAi:
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {
2+
dynamicProviders,
3+
getModelId,
4+
getProviderDefaultModelId,
5+
ioIntelligenceDefaultModelId,
6+
isSecretStateKey,
7+
providerIdentifiers,
8+
providerSettingsSchema,
9+
} from "../index.js"
10+
11+
describe("IO Intelligence shared contract", () => {
12+
it("registers the stable dynamic-provider identity and default model", () => {
13+
expect(providerIdentifiers.ioIntelligence).toBe("io-intelligence")
14+
expect(dynamicProviders).toContain(providerIdentifiers.ioIntelligence)
15+
expect(getProviderDefaultModelId(providerIdentifiers.ioIntelligence)).toBe(ioIntelligenceDefaultModelId)
16+
})
17+
18+
it("classifies the API key as secret and resolves the configured model", () => {
19+
expect(isSecretStateKey("ioIntelligenceApiKey")).toBe(true)
20+
const settings = providerSettingsSchema.parse({
21+
apiProvider: providerIdentifiers.ioIntelligence,
22+
ioIntelligenceModelId: "model",
23+
})
24+
expect(getModelId(settings)).toBe("model")
25+
})
26+
})

‎packages/types/src/__tests__/provider-identifiers.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const expectedProviderIdentifiers = [
3535
"opencode-go",
3636
"kenari",
3737
"nanogpt",
38+
"io-intelligence",
3839
"ollama",
3940
"lmstudio",
4041
"vscode-lm",
@@ -70,7 +71,6 @@ const expectedRetiredProviderIdentifiers = [
7071
"featherless",
7172
"groq",
7273
"huggingface",
73-
"io-intelligence",
7474
"roo",
7575
]
7676
/* eslint-enable zoo/no-raw-provider-identifiers */
@@ -112,6 +112,7 @@ describe("provider identifiers", () => {
112112
providerIdentifiers.opencodeGo,
113113
providerIdentifiers.kenari,
114114
providerIdentifiers.nanogpt,
115+
providerIdentifiers.ioIntelligence,
115116
providerIdentifiers.kimiCode,
116117
])
117118
expect(localProviders).toEqual([providerIdentifiers.ollama, providerIdentifiers.lmstudio])

‎packages/types/src/__tests__/provider-model-id.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const expectedModelIdKeys = [
2121
"opencodeGoModelId",
2222
"kenariModelId",
2323
"nanoGptModelId",
24+
"ioIntelligenceModelId",
2425
"zooGatewayModelId",
2526
] as const
2627

‎packages/types/src/global-settings.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ export const SECRET_STATE_KEYS = [
361361
"vercelAiGatewayApiKey",
362362
"opencodeGoApiKey",
363363
"kenariApiKey",
364+
"ioIntelligenceApiKey",
364365
"nanoGptApiKey",
365366
"basetenApiKey",
366367
] as const

‎packages/types/src/provider-identifiers.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const providerIdentifiers = {
1515
opencodeGo: "opencode-go",
1616
kenari: "kenari",
1717
nanogpt: "nanogpt",
18+
ioIntelligence: "io-intelligence",
1819
ollama: "ollama",
1920
lmstudio: "lmstudio",
2021
vscodeLm: "vscode-lm",
@@ -53,7 +54,6 @@ export const retiredProviderIdentifiers = {
5354
featherless: "featherless",
5455
groq: "groq",
5556
huggingface: "huggingface",
56-
ioIntelligence: "io-intelligence",
5757
roo: "roo",
5858
} as const
5959

‎packages/types/src/provider-settings.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export const dynamicProviders = [
9999
providerIdentifiers.opencodeGo,
100100
providerIdentifiers.kenari,
101101
providerIdentifiers.nanogpt,
102+
providerIdentifiers.ioIntelligence,
102103
providerIdentifiers.kimiCode,
103104
] as const
104105

@@ -313,6 +314,7 @@ export const modelIdKeys = [
313314
"opencodeGoModelId",
314315
"kenariModelId",
315316
"nanoGptModelId",
317+
"ioIntelligenceModelId",
316318
"zooGatewayModelId",
317319
] as const satisfies readonly ModelIdKey[]
318320

@@ -546,6 +548,11 @@ export const MODELS_BY_PROVIDER: Record<
546548
},
547549
[providerIdentifiers.opencodeGo]: { id: providerIdentifiers.opencodeGo, label: "Opencode Go", models: [] },
548550
[providerIdentifiers.kenari]: { id: providerIdentifiers.kenari, label: "Kenari", models: [] },
551+
[providerIdentifiers.ioIntelligence]: {
552+
id: providerIdentifiers.ioIntelligence,
553+
label: "IO Intelligence",
554+
models: [],
555+
},
549556
[providerIdentifiers.nanogpt]: { id: providerIdentifiers.nanogpt, label: "NanoGPT", models: [] },
550557
[providerIdentifiers.zooGateway]: { id: providerIdentifiers.zooGateway, label: "Zoo Gateway", models: [] },
551558

‎packages/types/src/provider-settings/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { qwenCodeProviderDefinition } from "./qwen-code.js"
3030
import { vercelAiGatewayProviderDefinition } from "./vercel-ai-gateway.js"
3131
import { opencodeGoProviderDefinition } from "./opencode-go.js"
3232
import { kenariProviderDefinition } from "./kenari.js"
33+
import { ioIntelligenceProviderDefinition } from "./io-intelligence.js"
3334
import { nanoGptProviderDefinition } from "./nanogpt.js"
3435
import { zooGatewayProviderDefinition } from "./zoo-gateway.js"
3536
import { basetenProviderDefinition } from "./baseten.js"
@@ -83,6 +84,7 @@ export const providerDefinitionList = [
8384
opencodeGoProviderDefinition,
8485
kenariProviderDefinition,
8586
nanoGptProviderDefinition,
87+
ioIntelligenceProviderDefinition,
8688
zooGatewayProviderDefinition,
8789
basetenProviderDefinition,
8890
] as const satisfies readonly ProviderDefinition[]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { z } from "zod"
2+
3+
import { providerIdentifiers } from "../provider-identifiers.js"
4+
import { baseProviderSettingsShape, createModelIdAccessor, createProviderDefinition } from "./common.js"
5+
6+
const IO_INTELLIGENCE_MODEL_ID_FIELD = "ioIntelligenceModelId"
7+
8+
export const ioIntelligenceProviderDefinition = createProviderDefinition({
9+
apiProvider: providerIdentifiers.ioIntelligence,
10+
modelIdKey: IO_INTELLIGENCE_MODEL_ID_FIELD,
11+
getModelId: createModelIdAccessor(IO_INTELLIGENCE_MODEL_ID_FIELD),
12+
schema: {
13+
...baseProviderSettingsShape,
14+
ioIntelligenceApiKey: z.string().optional(),
15+
[IO_INTELLIGENCE_MODEL_ID_FIELD]: z.string().optional(),
16+
},
17+
})

0 commit comments

Comments
 (0)