import type { RetainedArtifactReference, VideoArtifactPlaybackSource } from "@opengeni/sdk"; import type { ComponentType } from "react"; import type { ToolCallItem } from "./types.js"; export type ToolRendererProps = { item: ToolCallItem; loadRetainedScreenshot?: RetainedScreenshotLoader | undefined; loadRetainedArtifact?: RetainedArtifactLoader | undefined; }; export type RetainedScreenshotLoader = (artifact: RetainedArtifactReference, signal: AbortSignal) => Promise; export type RetainedArtifactLoader = (artifact: RetainedArtifactReference, signal: AbortSignal, options?: RetainedArtifactLoadOptions) => Promise; export type RetainedArtifactLoadOptions = { /** * Ask for a short-lived download URL instead of bytes, for example to build a * copyable `curl … | git apply` command. A loader that cannot mint one may * still return bytes; callers must handle that. */ prefer?: "url" | undefined; }; /** Mint an expiring source for native browser playback without loading video bytes in JS. */ export type VideoArtifactPlaybackLoader = (artifactId: string, signal: AbortSignal) => Promise; export type ToolRenderer = ComponentType; /** A registry entry: which key it matches and the component that renders it. */ export type ToolRegistryEntry = { match: "rawType"; type: string; render: ToolRenderer; } | { match: "name"; name: string; render: ToolRenderer; /** Disable untrusted `__${name}` leaf matching for identity-sensitive renderers. */ matchPrefixedLeaf?: boolean | undefined; }; export type ToolRegistry = { /** Resolve the renderer for a call (never null — falls back to generic). */ resolve: (item: ToolCallItem) => ToolRenderer; /** The generic fallback renderer. */ fallback: ToolRenderer; }; export type CreateToolRegistryOptions = { /** * Entries that take precedence over the built-ins. Earlier entries win, so a * consumer can shadow a default renderer for the same key. */ entries?: ToolRegistryEntry[] | undefined; /** Replace the generic fallback used for unmatched tools. */ fallback?: ToolRenderer | undefined; }; /** The `raw.type` of a projected tool call, when the provider item carries one. */ export declare function rawTypeOf(item: ToolCallItem): string | null; /** * Build a tool registry from a set of entries and a fallback. The returned * registry resolves in priority order: `raw.type` entries first, then `name` * entries, then the fallback. Consumer `entries` are consulted before the * built-in `baseEntries`, so they shadow defaults cleanly. */ export declare function createToolRegistry(baseEntries: ToolRegistryEntry[], baseFallback: ToolRenderer, options?: CreateToolRegistryOptions): ToolRegistry;