The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(agent): LU Cloud is a native-tool provider — Chat-tab agent no longer 404s
purple1b142aa48eb7
diff --git a/src/api/agents.ts b/src/api/agents.tsindex 4658eca9..0650e4a5 100644--- a/src/api/agents.ts+++ b/src/api/agents.ts@@ -11,6 +11,13 @@ import { ollamaUrl, localFetch } from "./backend";* useCodex, useAgentChat and the workflow engine for one-shot "give me the* whole answer at once" calls (plan synthesis, JSON repair) where streaming* and the tool loop are not wanted.+ *+ * OLLAMA-ONLY by contract: it posts to the local Ollama endpoint, so `model`+ * must be a locally installed tag. Every caller reaches it from a+ * strategy === 'hermes_xml' branch, and hermes_xml is now unreachable for cloud+ * providers (see isNativeToolProvider). A cloud model slipping in here used to+ * surface as a bare "Chat API error: 404" from Ollama's model lookup — the 404+ * branch below says that out loud instead.*/export async function chatNonStreaming(model: string,@@ -28,6 +35,11 @@ export async function chatNonStreaming(});if (!res.ok) {+ if (res.status === 404) {+ throw new Error(+ `Model "${model}" is not installed locally (Ollama returned 404). This code path only serves local models.`+ );+ }throw new Error(`Chat API error: ${res.status} ${res.statusText}`);}diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.tsindex f9e5f6fc..a64a3fdd 100644--- a/src/hooks/useAgentChat.ts+++ b/src/hooks/useAgentChat.ts@@ -17,7 +17,7 @@ import { retrieveContext } from '../api/rag'import { toolRegistry } from '../api/mcp'import { usePermissionStore } from '../stores/permissionStore'import { isThinkingCompatible, isPlainTextPlanner } from '../lib/model-compatibility'-import { getToolCallingStrategy, type ToolCallingStrategy } from '../lib/model-compatibility'+import { getToolCallingStrategy, isNativeToolProvider, type ToolCallingStrategy } from '../lib/model-compatibility'import { isMultimodalUnsupportedError, MULTIMODAL_UNSUPPORTED_MESSAGE } from '../lib/ollama-errors'import { log } from '../lib/logger'import { buildHermesToolPrompt, buildHermesToolResult, parseHermesToolCalls, stripToolCallTags, hasToolCallTags } from '../api/hermes-tool-calling'@@ -270,7 +270,7 @@ export function useAgentChat() {let modelToUse = modelIdlet strategy: ToolCallingStrategy- if (providerId === 'openai' || providerId === 'anthropic') {+ if (isNativeToolProvider(providerId)) {// Cloud providers always support native tool callingstrategy = 'native'} else {diff --git a/src/lib/__tests__/native-tool-providers.test.ts b/src/lib/__tests__/native-tool-providers.test.tsnew file mode 100644index 00000000..93ae409b--- /dev/null+++ b/src/lib/__tests__/native-tool-providers.test.ts@@ -0,0 +1,67 @@+/**+ * Cloud providers must never be routed through the Ollama name heuristics.+ *+ * Live repro 2026-07-27 (Chat tab, Cloud on, Kimi K2.6): `lu-cloud` was missing+ * from the native-tool provider list, so getToolCallingStrategy fell through to+ * the Ollama family match. Families that happen to appear in AGENT_COMPATIBLE+ * (qwen3-coder, hermes, …) still resolved to 'native' — which is why the Code+ * tab worked — but everything else got 'hermes_xml', whose branch posts to the+ * LOCAL Ollama endpoint via chatNonStreaming(). The cloud model isn't installed+ * locally, so the whole agent run died with "Chat API error: 404".+ */+import { describe, it, expect } from 'vitest'+import {+ isNativeToolProvider,+ getToolCallingStrategy,+ isAgentCompatible,+ isThinkingCompatible,+ isVisionCompatible,+} from '../model-compatibility'++// Real catalogue ids from /api/inference/v1/models, prefixed the way the model+// store keeps them (see prefixModelName).+const CLOUD = {+ kimi: 'lu-cloud::moonshotai/Kimi-K2.6',+ coder: 'lu-cloud::Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo',+ euryale: 'lu-cloud::Sao10K/L3.3-70B-Euryale-v2.3',+ minimax: 'lu-cloud::MiniMaxAI/MiniMax-M2',+}++describe('isNativeToolProvider', () => {+ it('covers every provider that speaks OpenAI-style tool calling', () => {+ expect(isNativeToolProvider('lu-cloud')).toBe(true)+ expect(isNativeToolProvider('openai')).toBe(true)+ expect(isNativeToolProvider('anthropic')).toBe(true)+ })++ it('leaves Ollama on the local name heuristics', () => {+ expect(isNativeToolProvider('ollama')).toBe(false)+ })+})++describe('getToolCallingStrategy — LU Cloud', () => {+ it('is native for EVERY cloud model, including families the Ollama list never heard of', () => {+ for (const [name, id] of Object.entries(CLOUD)) {+ expect(getToolCallingStrategy(id), `${name} must not fall back to hermes_xml`).toBe('native')+ }+ })++ it('still routes Ollama models by family (regression guard for the local path)', () => {+ expect(getToolCallingStrategy('qwen2.5-coder:7b')).toBe('native')+ expect(getToolCallingStrategy('smollm2:360m')).toBe('hermes_xml')+ })+})++describe('capability checks stay lenient for LU Cloud', () => {+ it('treats cloud models as agent/think/vision capable — the server catalogue is the authority', () => {+ expect(isAgentCompatible(CLOUD.kimi)).toBe(true)+ expect(isThinkingCompatible(CLOUD.kimi)).toBe(true)+ expect(isVisionCompatible(CLOUD.kimi)).toBe(true)+ })++ it('does not leak that leniency to Ollama tags', () => {+ expect(isAgentCompatible('smollm2:360m')).toBe(false)+ expect(isThinkingCompatible('smollm2:360m')).toBe(false)+ expect(isVisionCompatible('smollm2:360m')).toBe(false)+ })+})diff --git a/src/lib/agent-strategy.ts b/src/lib/agent-strategy.tsindex afdf8ab5..9c3c8c74 100644--- a/src/lib/agent-strategy.ts+++ b/src/lib/agent-strategy.ts@@ -6,7 +6,7 @@*/import { getProviderIdFromModel, getProviderForModel } from '../api/providers'-import { getToolCallingStrategy, type ToolCallingStrategy } from './model-compatibility'+import { getToolCallingStrategy, isNativeToolProvider, type ToolCallingStrategy } from './model-compatibility'import { agentVariantExists, createAgentVariant, getAgentModelName, canFixModel } from '../api/model-template-fix'export interface ResolvedStrategy {@@ -28,7 +28,7 @@ export async function resolveToolCallingStrategy(modelName: string): Promise<Reslet modelToUse = modelIdlet strategy: ToolCallingStrategy- if (providerId === 'openai' || providerId === 'anthropic') {+ if (isNativeToolProvider(providerId)) {strategy = 'native'} else {strategy = getToolCallingStrategy(modelId)diff --git a/src/lib/model-compatibility.ts b/src/lib/model-compatibility.tsindex 1a0e1e4a..79ca866b 100644--- a/src/lib/model-compatibility.ts+++ b/src/lib/model-compatibility.ts@@ -1,13 +1,34 @@/*** Model Compatibility for Agent Mode — now provider-aware.*- * Cloud providers (OpenAI, Anthropic) always support native tool calling.- * Ollama models need explicit compatibility checks.+ * Cloud providers (OpenAI, Anthropic, LU Cloud) always support native tool+ * calling. Ollama models need explicit compatibility checks.*/import { getProviderIdFromModel } from '../api/providers'import type { ProviderId } from '../api/providers/types'+/**+ * Providers whose endpoints speak native OpenAI-style tool calling, so the+ * local name heuristics below must never gate them.+ *+ * `lu-cloud` used to be missing here, and the name heuristic then decided per+ * model: families that happen to be listed in AGENT_COMPATIBLE (qwen3-coder,+ * hermes, …) resolved to 'native', everything else — Kimi K2.6, MiniMax,+ * DeepSeek-V4 — fell through to 'hermes_xml'. The Hermes branch calls+ * chatNonStreaming(), which posts to the LOCAL Ollama endpoint, so a cloud+ * model that isn't installed locally answered "Chat API error: 404" and the+ * whole Chat-tab agent run died (live repro 2026-07-27, Kimi K2.6 + Cloud).+ * Cloud tool capability is server-driven: the picker hides tool-less models+ * (`supports_tools` from /api/inference/v1/models) and the proxy rejects them+ * with a clean 400, so 'native' is both correct and safe here.+ */+const NATIVE_TOOL_PROVIDERS: readonly string[] = ['openai', 'anthropic', 'lu-cloud']++export function isNativeToolProvider(providerId: string): boolean {+ return NATIVE_TOOL_PROVIDERS.includes(providerId)+}+const AGENT_COMPATIBLE = [// ── Hermes: THE uncensored agent model ──'hermes3', 'hermes-3', 'hermes',@@ -127,7 +148,7 @@ export function isAgentCompatible(modelName: string | null): boolean {const providerId = getProviderIdFromModel(modelName)// Cloud providers always support tool calling- if (providerId === 'openai' || providerId === 'anthropic') return true+ if (isNativeToolProvider(providerId)) return trueconst baseName = normalizeFamily(modelName)return AGENT_COMPATIBLE.some((f) => containsFamily(f, baseName))@@ -176,7 +197,7 @@ const THINKING_COMPATIBLE = [export function isThinkingCompatible(modelName: string | null): boolean {if (!modelName) return falseconst providerId = getProviderIdFromModel(modelName)- if (providerId === 'openai' || providerId === 'anthropic') return true+ if (isNativeToolProvider(providerId)) return trueconst baseName = normalizeFamily(modelName)return THINKING_COMPATIBLE.some(f => containsFamily(f, baseName))@@ -215,7 +236,7 @@ const VISION_COMPATIBLE = [export function isVisionCompatible(modelName: string | null): boolean {if (!modelName) return falseconst providerId = getProviderIdFromModel(modelName)- if (providerId === 'openai' || providerId === 'anthropic') return true+ if (isNativeToolProvider(providerId)) return trueconst baseName = normalizeFamily(modelName)return VISION_COMPATIBLE.some(f => containsFamily(f, baseName))@@ -272,7 +293,7 @@ export function getToolCallingStrategy(modelName: string): ToolCallingStrategy {const providerId = getProviderIdFromModel(modelName)// Cloud providers always use native tool calling- if (providerId === 'openai' || providerId === 'anthropic') return 'native'+ if (isNativeToolProvider(providerId)) return 'native'// Ollamareturn isAgentCompatible(modelName) ? 'native' : 'hermes_xml'