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
Chat-agent image→see→video: reliable tool calls + vision feedback + I2V chaining
purple0e63ffe2faee
diff --git a/src/api/backend.ts b/src/api/backend.tsindex 21c5d98e..2605e87a 100644--- a/src/api/backend.ts+++ b/src/api/backend.ts@@ -480,6 +480,23 @@ export async function fetchExternalBytes(url: string): Promise<ArrayBuffer> {return res.arrayBuffer();}+/**+ * Fetch a localhost URL as raw bytes (Tauri-aware). Used to pull a generated+ * ComfyUI image back so a vision-capable chat model can actually SEE it. In+ * Tauri the browser can't fetch localhost directly (CORS) so we route through+ * the Rust byte proxy; in dev a plain fetch works.+ */+export async function fetchLocalhostBytes(url: string): Promise<Uint8Array> {+ if (isTauri()) {+ const invoke = await getInvoke()+ const bytes = (await invoke('proxy_localhost_stream', { url, method: 'GET', body: null })) as number[]+ return new Uint8Array(bytes)+ }+ const res = await fetch(url)+ if (!res.ok) throw new Error(`HTTP ${res.status}`)+ return new Uint8Array(await res.arrayBuffer())+}+/** Open a URL in the system's default browser (works in both dev and Tauri) */export async function openExternal(url: string): Promise<void> {if (isTauri()) {diff --git a/src/api/comfyui.ts b/src/api/comfyui.tsindex cce11ab0..f2df44d1 100644--- a/src/api/comfyui.ts+++ b/src/api/comfyui.ts@@ -1,4 +1,4 @@-import { comfyuiUrl, localFetch } from "./backend"+import { comfyuiUrl, localFetch, fetchLocalhostBytes } from "./backend"import { log } from "../lib/logger"// ─── Control-plane fetch timeouts ───@@ -902,6 +902,22 @@ export function getImageUrl(filename: string, subfolder: string = '', type: strireturn comfyuiUrl(cacheBust != null ? `${path}&t=${cacheBust}` : path)}+/**+ * Fetch a ComfyUI /view image URL and return it base64-encoded (no data: prefix)+ * so it can be handed to a vision-capable chat model as an `images` attachment.+ * Used by the chat-agent vision feedback loop: after image_generate, the model+ * SEES the picture it made and can comment on it.+ */+export async function fetchComfyImageBase64(url: string): Promise<string> {+ const bytes = await fetchLocalhostBytes(url)+ let binary = ''+ const CHUNK = 0x8000 // avoid arg-count limits on String.fromCharCode+ for (let i = 0; i < bytes.length; i += CHUNK) {+ binary += String.fromCharCode.apply(null, bytes.subarray(i, i + CHUNK) as unknown as number[])+ }+ return btoa(binary)+}+// ─── Validate params ───function validateParams(params: GenerateParams) {diff --git a/src/api/ollama.ts b/src/api/ollama.tsindex 34dad0bc..ccd3dec7 100644--- a/src/api/ollama.ts+++ b/src/api/ollama.ts@@ -202,6 +202,41 @@ export async function listRunningModels(): Promise<string[]> {}}+// ── Model capabilities (/api/show) ────────────────────────────────+//+// Ollama reports a model's modalities/skills as a `capabilities` array+// (e.g. ['completion','vision','tools','thinking']). The chat-agent vision+// feedback loop needs to know whether the active model can actually SEE an+// image before it bothers attaching the generated picture. Cached per model+// (capabilities don't change at runtime) and soft-fails to [] so a probe+// failure never blocks a generation.+const _capCache = new Map<string, string[]>()++export async function getModelCapabilities(model: string): Promise<string[]> {+ if (!model) return []+ if (_capCache.has(model)) return _capCache.get(model)!+ try {+ const res = await localFetch(ollamaUrl("/show"), {+ method: "POST",+ body: JSON.stringify({ model }),+ timeoutMs: 8000,+ })+ if (!res.ok) { _capCache.set(model, []); return [] }+ const data = await res.json()+ const caps: string[] = Array.isArray(data?.capabilities) ? data.capabilities : []+ _capCache.set(model, caps)+ return caps+ } catch {+ _capCache.set(model, [])+ return []+ }+}++/** True when the model can take image input (multimodal/vision). */+export async function modelSupportsVision(model: string): Promise<boolean> {+ return (await getModelCapabilities(model)).includes("vision")+}+export interface ModelCapabilityCheck {name: stringok: booleandiff --git a/src/api/vision-feedback.ts b/src/api/vision-feedback.tsnew file mode 100644index 00000000..411d7ef3--- /dev/null+++ b/src/api/vision-feedback.ts@@ -0,0 +1,90 @@+/**+ * Vision feedback for the chat-agent image/video flow.+ *+ * David's requirement: after the agent generates an image, the chat LLM must+ * actually SEE it and be able to comment — and then optionally turn it into a+ * video. The generation tools (image_generate / video_generate) return a text+ * result with a ComfyUI `/view` URL; that text alone tells a model a file+ * exists but lets it see nothing. This helper turns that result into a real+ * image attachment so a vision-capable model (e.g. gemma4:e4b, which reports+ * the `vision` capability) receives the pixels on its next turn.+ *+ * Gated on the model genuinely supporting vision (Ollama /api/show), so we+ * never ship a useless base64 blob to a text-only model (qwen2.5-coder) or pay+ * the fetch when it can't help.+ */++import { modelSupportsVision } from './ollama'+import { fetchComfyImageBase64 } from './comfyui'+import { log } from '../lib/logger'++// Same contract as ToolCallBlock's inline preview: only a localhost ComfyUI+// /view URL is trusted (never auto-load arbitrary tool output).+const COMFY_VIEW_RE = /(https?:\/\/(?:localhost|127\.0\.0\.1):\d+\/view\?[^\s)\]]+)/i++function urlIsVideo(url: string): boolean {+ try {+ const m = /[?&]filename=([^&]+)/i.exec(url)+ const name = m ? decodeURIComponent(m[1]) : url+ return /\.(mp4|webm)$/i.test(name)+ } catch {+ return /\.(mp4|webm)(?=[?&]|$)/i.test(url)+ }+}++function filenameFromResult(result: string): string | null {+ // image_generate result shape: `Image generated: <file> (prompt: "...")\n<url>`+ const m = result.match(/generated:\s*([^\s(]+\.(?:png|jpg|jpeg|webp))/i)+ return m ? m[1] : null+}++export interface VisionFeedbackMessage {+ role: 'user'+ content: string+ images: { data: string; mimeType: string }[]+}++/**+ * Build a follow-up user message carrying the just-generated image so the model+ * can look at it. Returns null when this isn't an image result, the model can't+ * see images, or the fetch fails (all non-fatal — the flow still works, the+ * model just won't visually comment).+ */+export async function buildVisionFeedback(+ model: string,+ toolName: string,+ result: string,+): Promise<VisionFeedbackMessage | null> {+ if (!result) return null+ if (toolName !== 'image_generate' && toolName !== 'video_generate') return null+ const m = result.match(COMFY_VIEW_RE)+ if (!m) return null+ const url = m[1]+ if (urlIsVideo(url)) return null // can't feed a video to the model as an image+ try {+ if (!(await modelSupportsVision(model))) return null+ } catch {+ return null+ }+ let b64: string+ try {+ b64 = await fetchComfyImageBase64(url)+ } catch (e) {+ log.warn('vision_feedback.fetch_failed', { err: String(e) })+ return null+ }+ if (!b64) return null++ const file = filenameFromResult(result)+ const chain = file+ ? ` If the user asked to turn it into a video, call video_generate now with inputImage set to "${file}".`+ : ' If the user asked to turn it into a video, call video_generate now with inputImage set to that image\'s filename.'++ return {+ role: 'user',+ content:+ 'Here is the image you just generated, shown to the user. Look at it and describe in one or two sentences what you actually see in the picture (composition, subject, colors).' ++ chain,+ images: [{ data: b64, mimeType: 'image/png' }],+ }+}diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.tsindex ea83a8b8..afce259c 100644--- a/src/hooks/useAgentChat.ts+++ b/src/hooks/useAgentChat.ts@@ -22,6 +22,8 @@ import { getToolPermission, executeAgentTool, AGENT_TOOL_DEFS } from '../api/tooimport { getToolCallingStrategy, type ToolCallingStrategy } from '../lib/model-compatibility'import { log } from '../lib/logger'import { buildHermesToolPrompt, buildHermesToolResult, parseHermesToolCalls, stripToolCallTags, hasToolCallTags } from '../api/hermes-tool-calling'+import { parseLooseToolCalls, stripMatchedCalls } from '../lib/loose-tool-parse'+import { buildVisionFeedback } from '../api/vision-feedback'import { compactMessages, getModelMaxTokens } from '../lib/context-compaction'import { useMemoryStore } from '../stores/memoryStore'import { getProviderForModel, getProviderIdFromModel } from '../api/providers'@@ -668,6 +670,23 @@ export function useAgentChat() {// preserved as a `reflection` block so it renders above the tool// calls in chronological order. Only the final-turn content (no// tool_calls) becomes the message body.+ // Loose tool-call fallback (David 2026-06-03): weak local models often+ // WRITE the call into their answer text instead of using the structured+ // tool_calls channel — gemma4:e4b answers in prose; qwen2.5-coder:14b+ // wrote `image_generate(prompt="…")` as plain text and never emitted a+ // real call, so the image/video flow never fired. If the native/Hermes+ // channel produced nothing, lift any recognizable call out of the+ // content (known tool names only) and strip it from the visible prose.+ if (toolCalls.length === 0 && turnContent.trim()) {+ const knownNames = toolRegistry.getAll().map((t) => t.name)+ const loose = parseLooseToolCalls(turnContent, knownNames)+ if (loose.calls.length > 0) {+ toolCalls = loose.calls.map((c) => ({ function: { name: c.name, arguments: c.arguments } }))+ turnContent = stripMatchedCalls(turnContent, loose.matched)+ log.info('agent.loose_tool_call_recovered', { count: toolCalls.length, names: toolCalls.map((t) => t.function.name) })+ }+ }+const isFinalTurn = toolCalls.length === 0if (isFinalTurn) {contentRef.current = turnContent@@ -882,6 +901,27 @@ export function useAgentChat() {}}+ // Vision feedback (David 2026-06-03): after image_generate, hand the+ // generated picture to a vision-capable local model so it SEES the+ // result and can comment — and learns the filename to chain into+ // video_generate. Local Ollama only; buildVisionFeedback no-ops for+ // text-only models, video results, or fetch failures.+ if (providerId === 'ollama') {+ for (const { tc, ac } of batch) {+ const result = results.find((r) => r.id === ac.id)+ if (result?.status === 'completed' && result.result) {+ try {+ const vf = await buildVisionFeedback(modelToUse, tc.function.name, result.result)+ if (vf) {+ agentMessages.push(vf as unknown as ChatMessage)+ log.info('agent.vision_feedback_attached', { tool: tc.function.name })+ break // one image per batch is enough context+ }+ } catch { /* non-fatal — flow still works without the visual */ }+ }+ }+ }+// Reset content for next iterationcontentRef.current = ''thinkingRef.current = ''@@ -1024,6 +1064,12 @@ Workflow for build / create tasks:2. file_write the artefact(s) directly. For a website: write index.html, style.css, script.js as separate file_write calls.3. After the LAST file_write, write a 1–3 sentence final answer ("Done — wrote 3 files to <path>"). Nothing in between.+Creative tools — image_generate, video_generate:+- When the user asks for an image / picture / drawing, CALL image_generate. You HAVE this tool — do NOT reply with prose about DALL-E, Midjourney, or "as a text model I can't". Just call it.+- After image_generate runs you will be shown the generated image; LOOK at it and briefly describe what you actually see.+- To make a video, CALL video_generate. To animate an image you just generated, call video_generate with inputImage set to that image's filename (it is in the image_generate result).+- Emit these as REAL tool calls through the tool channel — never write the call as plain text like image_generate(prompt="…") in your answer.+Other rules:- You MUST use tools — NEVER answer from memory or guess file contents.- For filesystem READ tasks: file_list first if needed, then file_read.diff --git a/src/lib/__tests__/loose-tool-parse.test.ts b/src/lib/__tests__/loose-tool-parse.test.tsnew file mode 100644index 00000000..a60a8710--- /dev/null+++ b/src/lib/__tests__/loose-tool-parse.test.ts@@ -0,0 +1,100 @@+import { describe, it, expect } from 'vitest'+import { parseLooseToolCalls, stripMatchedCalls } from '../loose-tool-parse'++const KNOWN = ['image_generate', 'video_generate', 'web_search', 'file_write']++describe('parseLooseToolCalls — function-call syntax', () => {+ it('extracts the exact prose call qwen2.5-coder wrote live', () => {+ const r = parseLooseToolCalls('image_generate(prompt="a small red cube on a wooden table")', KNOWN)+ expect(r.calls).toEqual([{ name: 'image_generate', arguments: { prompt: 'a small red cube on a wooden table' } }])+ expect(r.matched.length).toBe(1)+ })++ it('parses multiple kwargs incl. numbers + single quotes', () => {+ const r = parseLooseToolCalls("image_generate(prompt='a red cube', denoise=0.6, steps=20)", KNOWN)+ expect(r.calls[0]).toEqual({ name: 'image_generate', arguments: { prompt: 'a red cube', denoise: 0.6, steps: 20 } })+ })++ it('parses colon-style args', () => {+ const r = parseLooseToolCalls('image_generate(prompt: "sunset over hills")', KNOWN)+ expect(r.calls[0].arguments).toEqual({ prompt: 'sunset over hills' })+ })++ it('maps a single positional string to prompt', () => {+ const r = parseLooseToolCalls('image_generate("a lighthouse at dusk")', KNOWN)+ expect(r.calls[0].arguments).toEqual({ prompt: 'a lighthouse at dusk' })+ })++ it('parses video_generate with inputImage for image→video chaining', () => {+ const r = parseLooseToolCalls('video_generate(inputImage="locally_uncensored_00084_.png", prompt="gentle zoom")', KNOWN)+ expect(r.calls[0]).toEqual({+ name: 'video_generate',+ arguments: { inputImage: 'locally_uncensored_00084_.png', prompt: 'gentle zoom' },+ })+ })++ it('finds the call even inside a fenced code block', () => {+ const r = parseLooseToolCalls('Sure!\n```\nimage_generate(prompt="a fox")\n```', KNOWN)+ expect(r.calls[0].arguments).toEqual({ prompt: 'a fox' })+ })+})++describe('parseLooseToolCalls — JSON object syntax', () => {+ it('extracts {"name","arguments"}', () => {+ const r = parseLooseToolCalls('{"name": "image_generate", "arguments": {"prompt": "x"}}', KNOWN)+ expect(r.calls).toEqual([{ name: 'image_generate', arguments: { prompt: 'x' } }])+ })++ it('extracts a fenced ```json blob with {"tool","parameters"}', () => {+ const txt = 'Here:\n```json\n{"tool": "image_generate", "parameters": {"prompt": "a cat"}}\n```'+ const r = parseLooseToolCalls(txt, KNOWN)+ expect(r.calls[0]).toEqual({ name: 'image_generate', arguments: { prompt: 'a cat' } })+ })++ it('tolerates trailing commas (repairJson)', () => {+ const r = parseLooseToolCalls('{"name":"image_generate","arguments":{"prompt":"x",}}', KNOWN)+ expect(r.calls[0].name).toBe('image_generate')+ })+})++describe('parseLooseToolCalls — Hermes tags in content', () => {+ it('extracts a <tool_call> tag the model put in its answer', () => {+ const r = parseLooseToolCalls('<tool_call>\n{"name": "image_generate", "arguments": {"prompt": "y"}}\n</tool_call>', KNOWN)+ expect(r.calls[0]).toEqual({ name: 'image_generate', arguments: { prompt: 'y' } })+ expect(r.matched.some((s) => s.includes('<tool_call>'))).toBe(true)+ })+})++describe('parseLooseToolCalls — safety (no false positives)', () => {+ it('ignores unknown tool names', () => {+ expect(parseLooseToolCalls('do_something(x=1)', KNOWN).calls).toEqual([])+ })++ it('ignores a tool NAME mentioned in prose with no call', () => {+ expect(parseLooseToolCalls('You can use the image_generate tool to make pictures.', KNOWN).calls).toEqual([])+ })++ it('ignores empty parens (image_generate())', () => {+ expect(parseLooseToolCalls('Call image_generate() to start.', KNOWN).calls).toEqual([])+ })++ it('returns nothing for ordinary prose', () => {+ expect(parseLooseToolCalls('The cube is small and red, sitting on oak.', KNOWN).calls).toEqual([])+ })++ it('dedupes the same call found by two patterns', () => {+ const txt = 'image_generate(prompt="z") and also {"name":"image_generate","arguments":{"prompt":"z"}}'+ const r = parseLooseToolCalls(txt, KNOWN)+ expect(r.calls.length).toBe(1)+ })+})++describe('stripMatchedCalls', () => {+ it('removes the recognized call snippet from the prose', () => {+ const txt = 'Okay, generating now: image_generate(prompt="a red cube")'+ const r = parseLooseToolCalls(txt, KNOWN)+ const stripped = stripMatchedCalls(txt, r.matched)+ expect(stripped).not.toContain('image_generate(prompt=')+ expect(stripped.toLowerCase()).toContain('okay')+ })+})diff --git a/src/lib/loose-tool-parse.ts b/src/lib/loose-tool-parse.tsnew file mode 100644index 00000000..7775f5a7--- /dev/null+++ b/src/lib/loose-tool-parse.ts@@ -0,0 +1,170 @@+/**+ * Loose tool-call extraction — the safety net for weak local models that+ * "describe" a tool call in their TEXT answer instead of emitting it through+ * the native `tool_calls` channel.+ *+ * Native tool_calls (Ollama `tools`) and Hermes `<tool_call>` XML are handled+ * directly in useAgentChat. This module is the fallback for everything in+ * between — observed LIVE on the only locally-installed agent models:+ * - gemma4:e4b → often answers in prose, occasionally writes the call+ * - qwen2.5-coder:14b → wrote `image_generate(prompt="a small red cube …")`+ * as plain answer text and never used the structured channel.+ * Without this, the chat-agent image/video flow simply never fires for these+ * models. With it, ANY recognizable call (function-syntax, JSON object, Hermes+ * tag) the model wrote into its answer is lifted into a real tool call.+ *+ * SAFETY: only calls whose name is in `known` are returned, so ordinary prose+ * that happens to contain parentheses or a stray `{}` can't be misread as a+ * tool invocation. The matched snippet is also reported so the caller can strip+ * it from the visible answer (we don't want the raw `foo(...)` echoed as prose).+ */++import { repairJson } from './tool-call-repair'+import { parseHermesToolCalls } from '../api/hermes-tool-calling'++export interface LooseToolCall {+ name: string+ arguments: Record<string, unknown>+}++export interface LooseParseResult {+ calls: LooseToolCall[]+ /** The exact substrings that were recognized as calls (for stripping from prose). */+ matched: string[]+}++function escapeRe(s: string): string {+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')+}++/** Coerce a scalar token ("..."/'...'/number/true/false) into a JS value. */+function coerceScalar(raw: string): unknown {+ const v = raw.trim()+ if (v === 'true') return true+ if (v === 'false') return false+ if (v === 'null') return null+ if (/^-?\d+(?:\.\d+)?$/.test(v)) return Number(v)+ // quoted string → unquote + unescape+ if ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))) {+ return v.slice(1, -1).replace(/\\(["'\\])/g, '$1')+ }+ return v+}++/**+ * Parse the inside of a `name( ... )` call into an arguments object.+ * Handles `key="val"`, `key='val'`, `key: "val"`, `key=123`, `key=true`, and a+ * single positional string (mapped to `prompt`, the natural arg for the+ * creative tools this fallback exists for).+ */+function parseCallArgs(inner: string): Record<string, unknown> {+ const args: Record<string, unknown> = {}+ const kw = /([A-Za-z_]\w*)\s*[:=]\s*("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|true|false|null|-?\d+(?:\.\d+)?)/g+ let m: RegExpExecArray | null+ let found = false+ while ((m = kw.exec(inner)) !== null) {+ found = true+ args[m[1]] = coerceScalar(m[2])+ }+ if (!found) {+ // Positional single string → prompt (e.g. image_generate("a red cube")).+ const s = inner.trim().replace(/^["']|["']$/g, '').trim()+ if (s) args.prompt = s+ }+ return args+}++/** Find bare/fenced JSON objects that name a known tool: {"name":"X","arguments":{…}}. */+function parseJsonObjectCalls(text: string, known: Set<string>): LooseToolCall[] {+ const calls: LooseToolCall[] = []+ // Scan every top-level-ish {...} candidate. Cheap brace-scan; repairJson+ // tolerates trailing commas / single quotes / unquoted keys.+ const candidates: string[] = []+ let depth = 0+ let start = -1+ for (let i = 0; i < text.length; i++) {+ const c = text[i]+ if (c === '{') {+ if (depth === 0) start = i+ depth+++ } else if (c === '}') {+ depth--+ if (depth === 0 && start >= 0) {+ candidates.push(text.slice(start, i + 1))+ start = -1+ }+ if (depth < 0) depth = 0+ }+ }+ for (const cand of candidates) {+ if (!/["']?(?:name|tool|tool_name|function)["']?\s*[:=]/.test(cand)) continue+ const parsed = repairJson(cand) as Record<string, any> | null+ if (!parsed) continue+ const name = parsed.name || parsed.tool || parsed.tool_name || parsed.function+ if (typeof name === 'string' && known.has(name)) {+ const a = parsed.arguments || parsed.parameters || parsed.args || parsed.params || {}+ calls.push({ name, arguments: (a && typeof a === 'object') ? a : {} })+ }+ }+ return calls+}++/**+ * Extract tool calls a model wrote into its text answer. Returns the calls plus+ * the matched source snippets (so the caller can strip them from the prose).+ * Only `known` tool names are recognized.+ */+export function parseLooseToolCalls(text: string, known: string[]): LooseParseResult {+ if (!text || !text.trim()) return { calls: [], matched: [] }+ const knownSet = new Set(known)+ const calls: LooseToolCall[] = []+ const matched: string[] = []+ const seen = new Set<string>()++ const push = (c: LooseToolCall, snippet: string) => {+ // Dedupe by name + JSON of args so the same call found by two patterns+ // isn't executed twice.+ const key = c.name + '|' + JSON.stringify(c.arguments)+ if (seen.has(key)) return+ seen.add(key)+ calls.push(c)+ if (snippet) matched.push(snippet)+ }++ // 1) Hermes <tool_call>{…}</tool_call> tags (some models emit these in content).+ if (/<tool_call>/i.test(text)) {+ for (const hc of parseHermesToolCalls(text)) {+ if (knownSet.has(hc.name)) push({ name: hc.name, arguments: hc.arguments || {} }, '')+ }+ const tagRe = /<tool_call>[\s\S]*?<\/tool_call>/gi+ let tm: RegExpExecArray | null+ while ((tm = tagRe.exec(text)) !== null) matched.push(tm[0])+ }++ // 2) JSON objects naming a known tool.+ for (const c of parseJsonObjectCalls(text, knownSet)) push(c, '')++ // 3) Function-call syntax name( ... ) — only for known tool names.+ for (const name of knownSet) {+ const re = new RegExp(`\\b${escapeRe(name)}\\s*\\(([\\s\\S]*?)\\)`, 'g')+ let m: RegExpExecArray | null+ while ((m = re.exec(text)) !== null) {+ const args = parseCallArgs(m[1])+ // Require at least one arg — `image_generate()` with nothing is not a+ // usable call (and is more likely the model naming the tool in prose).+ if (Object.keys(args).length > 0) push({ name, arguments: args }, m[0])+ }+ }++ return { calls, matched }+}++/** Remove the matched call snippets from a prose answer (best-effort). */+export function stripMatchedCalls(text: string, matched: string[]): string {+ let out = text+ for (const snip of matched) {+ if (snip) out = out.split(snip).join('')+ }+ // Tidy leftover empty code fences / blank lines.+ return out.replace(/```(?:json|python|tool_code)?\s*```/gi, '').replace(/\n{3,}/g, '\n\n').trim()+}diff --git a/src/lib/tool-selection.ts b/src/lib/tool-selection.tsindex eecccd2c..b10ac0bf 100644--- a/src/lib/tool-selection.ts+++ b/src/lib/tool-selection.ts@@ -47,8 +47,14 @@ const TOOL_GROUPS: ToolGroup[] = [tools: ['screenshot'],},{- keywords: ['image', 'picture', 'generate image', 'draw', 'create image'],- tools: ['image_generate'],+ // Creative image/video. Surface BOTH generators for any creative request so+ // the model can chain image → video in one conversation (David: "ein Video+ // aus dem Bild soll die LLM auch machen können"). Without video_generate+ // here the keyword path dropped it (it was in no group + not ALWAYS_INCLUDE),+ // so a "now animate it" follow-up had no tool to call.+ keywords: ['image', 'picture', 'generate image', 'draw', 'create image', 'bild', 'foto', 'zeichne',+ 'video', 'animate', 'animation', 'clip', 'mp4', 'make a video', 'turn into a video', 'movie', 'gif', 'animiere'],+ tools: ['image_generate', 'video_generate'],},{keywords: ['workflow', 'run workflow', 'automate'],