Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Merge branch 'r3b/assist-skills' into claude/fuobe-parity-3

Claude9af296e16e23
diff --cc src/lib/assist.ts
index 2fc7dfec,b6c28623..31ffbfc1
--- a/src/lib/assist.ts
+++ b/src/lib/assist.ts
@@@ -6,7 -10,8 +10,8 @@@ import type { Engine, Generation, Media
/** One job the agent wants to run, priced before the user approves it. */
export interface PlannedJob {
- tool: "generate" | "create_storyboard" | "katana";
- /** The tool that would run it (generate, create_storyboard, remember, a studio tool…). */
++ /** The tool that would run it (generate, create_storyboard, katana, remember, a studio tool…). */
+ tool: string;
modelId: string;
modelName: string;
kind: MediaKind;
diff --cc src/server/assist/tools.ts
index 2ae0bfe8,7a3064bc..a757c1f4
--- a/src/server/assist/tools.ts
+++ b/src/server/assist/tools.ts
@@@ -13,35 -13,12 +13,13 @@@ import { provider } from "../providers"
import { llmBackends } from "../providers/llm";
import { engineMode } from "../settings";
import { readRef } from "../storage";
+import { katanaTool } from "../katana";
import { createStoryboard } from "../storyboard";
+ import { CONTEXT_TOOLS } from "./context-tools";
+ import { defineTool, type ResultContent, type ToolContext, type ToolDef, type ToolOutcome } from "./define";
+ import { STUDIO_TOOLS } from "./studio-tools";
- type ResultContent = Anthropic.Beta.BetaToolResultBlockParam["content"];
-
- export interface ToolContext {
- engine: "cloud" | "open";
- }
-
- export interface ToolOutcome {
- content: ResultContent;
- isError?: boolean;
- /** Cards to show in the chat (generations started, a short "looked up models" line…). */
- items?: AssistItem[];
- }
-
- interface ToolDef<S extends z.ZodType> {
- name: string;
- description: string;
- schema: S;
- /** Spends money or GPU time: waits for the user's approval unless auto-approve is on. */
- gated?: boolean;
- strict?: boolean;
- run: (input: z.infer<S>, ctx: ToolContext) => Promise<ToolOutcome>;
- /** For gated tools: what the run would do, priced. */
- plan?: (input: z.infer<S>, ctx: ToolContext) => PlannedJob[];
- }
-
- const defineTool = <S extends z.ZodType>(def: ToolDef<S>) => def;
+ export type { ToolContext, ToolOutcome };
const ref = z.string().describe("A file URL from the chat: an attachment or an earlier output (/api/files/…).");
@@@ -500,9 -482,22 +483,22 @@@ const storyboard = defineTool(
// ---------------------------------------------------------------------------
// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export const TOOLS: ToolDef<any>[] = [searchModels, listElementsTool, listRecent, checkGenerations, generate, storyboard];
+export const TOOLS: ToolDef<any>[] = [searchModels, listElementsTool, listRecent, checkGenerations, generate, storyboard, defineTool(katanaTool)];
export const getTool = (name: string) => TOOLS.find((t) => t.name === name);
+ // Skills, memory and project sources; then whole studios (layers, restyle, dub, faceless, ads, captions).
+ TOOLS.push(...CONTEXT_TOOLS, ...STUDIO_TOOLS);
+
+ /** The approval card's heading for one gated call. */
+ export function cardTitle(name: string, input: unknown): string {
+ const t = getTool(name);
+ const parsed = t?.schema.safeParse(input);
+ if (t?.title && parsed?.success) return t.title(parsed.data);
+ const summary = (input as { summary?: unknown } | null)?.summary;
+ if (typeof summary === "string" && summary.trim()) return summary.trim();
+ return name === "create_storyboard" ? "Storyboard" : "Generate";
+ }
+
/** JSON Schema for the API: every object closed, constraints the API doesn't take removed (zod still checks them). */
export function apiSchema(schema: z.ZodType): Anthropic.Beta.BetaTool.InputSchema {
const json = z.toJSONSchema(schema) as Record<string, unknown>;