/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { CachePolicy, IExecuteContext, StreamEvent } from "@workglow/task-graph"; import type { DataPortSchema } from "@workglow/util/schema"; import type { AiJobInput } from "../job/AiJob"; import type { ModelConfig } from "../model/ModelSchema"; import { StreamingAiTask } from "./base/StreamingAiTask"; import type { ChatMessage } from "./ChatMessage"; export declare const AiChatInputSchema: { readonly type: "object"; readonly properties: { readonly model: { readonly oneOf: readonly [{ readonly title: "Model"; readonly description: `The model ${string}`; } & Record & { readonly format: import(".").TypeModelSemantic; readonly type: "string"; }, { readonly type: "object"; readonly properties: { readonly model_id: { readonly type: "string"; }; readonly capabilities: { readonly type: "array"; readonly items: { readonly type: "string"; }; readonly "x-ui-editor": "multiselect"; }; readonly title: { readonly type: "string"; }; readonly description: { readonly type: "string"; readonly "x-ui-editor": "textarea"; }; readonly provider: { readonly type: "string"; }; readonly provider_config: { readonly type: "object"; readonly properties: { readonly credential_key: { readonly type: "string"; readonly format: "credential"; readonly "x-ui-hidden": true; }; readonly native_dimensions: { readonly type: "integer"; readonly description: "Native output vector dimensions for embedding models"; }; readonly mrl: { readonly type: "boolean"; readonly description: "Whether the model supports Matryoshka Representation Learning"; }; }; readonly additionalProperties: true; readonly default: {}; }; readonly metadata: { readonly type: "object"; readonly default: {}; readonly "x-ui-hidden": true; }; }; readonly required: readonly ["provider", "provider_config"]; readonly format: "model"; readonly additionalProperties: true; } & Record & { readonly format: import(".").TypeModelSemantic; }]; } & Record & { readonly format: import(".").TypeModelSemantic; }; readonly prompt: { readonly oneOf: readonly [{ readonly type: "string"; readonly title: "Prompt"; readonly description: "The initial user message"; }, { readonly type: "array"; readonly title: "Prompt"; readonly description: "The initial user message as structured content blocks"; readonly items: { readonly oneOf: readonly [{ readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["text"]; }; readonly text: { readonly type: "string"; }; }; readonly required: readonly ["type", "text"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["image"]; }; readonly mimeType: { readonly type: "string"; }; readonly data: { readonly type: "string"; }; }; readonly required: readonly ["type", "mimeType", "data"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["tool_use"]; }; readonly id: { readonly type: "string"; }; readonly name: { readonly type: "string"; }; readonly input: { readonly type: "object"; readonly additionalProperties: true; }; }; readonly required: readonly ["type", "id", "name", "input"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["tool_result"]; }; readonly tool_use_id: { readonly type: "string"; }; readonly content: { readonly type: "array"; readonly items: { readonly oneOf: readonly [{ readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["text"]; }; readonly text: { readonly type: "string"; }; }; readonly required: readonly ["type", "text"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["image"]; }; readonly mimeType: { readonly type: "string"; }; readonly data: { readonly type: "string"; }; }; readonly required: readonly ["type", "mimeType", "data"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["tool_use"]; }; readonly id: { readonly type: "string"; }; readonly name: { readonly type: "string"; }; readonly input: { readonly type: "object"; readonly additionalProperties: true; }; }; readonly required: readonly ["type", "id", "name", "input"]; readonly additionalProperties: false; }]; }; }; readonly is_error: { readonly type: "boolean"; }; }; readonly required: readonly ["type", "tool_use_id", "content"]; readonly additionalProperties: false; }]; readonly title: "ContentBlock"; readonly description: "A single content block within a chat message"; }; }]; readonly title: "Prompt"; readonly description: "The first user message to start the conversation"; }; readonly messages: { readonly type: "array"; readonly title: "Messages"; readonly description: "Conversation history (managed internally by the chat loop; not a user-facing input)"; readonly items: { readonly type: "object"; readonly properties: { readonly role: { readonly type: "string"; readonly enum: readonly ["user", "assistant", "tool", "system"]; }; readonly content: { readonly type: "array"; readonly items: { readonly oneOf: readonly [{ readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["text"]; }; readonly text: { readonly type: "string"; }; }; readonly required: readonly ["type", "text"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["image"]; }; readonly mimeType: { readonly type: "string"; }; readonly data: { readonly type: "string"; }; }; readonly required: readonly ["type", "mimeType", "data"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["tool_use"]; }; readonly id: { readonly type: "string"; }; readonly name: { readonly type: "string"; }; readonly input: { readonly type: "object"; readonly additionalProperties: true; }; }; readonly required: readonly ["type", "id", "name", "input"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["tool_result"]; }; readonly tool_use_id: { readonly type: "string"; }; readonly content: { readonly type: "array"; readonly items: { readonly oneOf: readonly [{ readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["text"]; }; readonly text: { readonly type: "string"; }; }; readonly required: readonly ["type", "text"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["image"]; }; readonly mimeType: { readonly type: "string"; }; readonly data: { readonly type: "string"; }; }; readonly required: readonly ["type", "mimeType", "data"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["tool_use"]; }; readonly id: { readonly type: "string"; }; readonly name: { readonly type: "string"; }; readonly input: { readonly type: "object"; readonly additionalProperties: true; }; }; readonly required: readonly ["type", "id", "name", "input"]; readonly additionalProperties: false; }]; }; }; readonly is_error: { readonly type: "boolean"; }; }; readonly required: readonly ["type", "tool_use_id", "content"]; readonly additionalProperties: false; }]; readonly title: "ContentBlock"; readonly description: "A single content block within a chat message"; }; }; }; readonly required: readonly ["role", "content"]; readonly additionalProperties: false; readonly title: "ChatMessage"; readonly description: "A single chat message with role and structured content blocks"; }; readonly "x-ui-hidden": true; }; readonly systemPrompt: { readonly type: "string"; readonly title: "System Prompt"; readonly description: "Optional system instructions for the model"; }; readonly maxTokens: { readonly type: "number"; readonly title: "Max Tokens"; readonly description: "Per-turn token limit"; readonly minimum: 1; readonly "x-ui-group": "Configuration"; }; readonly temperature: { readonly type: "number"; readonly title: "Temperature"; readonly description: "Sampling temperature"; readonly minimum: 0; readonly maximum: 2; readonly "x-ui-group": "Configuration"; }; readonly maxIterations: { readonly type: "number"; readonly title: "Max Iterations"; readonly description: "Safety cap on conversation turns"; readonly minimum: 1; readonly default: 100; readonly "x-ui-group": "Configuration"; }; readonly responseFormat: { readonly type: "string"; readonly enum: readonly ["text", "markdown"]; readonly default: "text"; readonly title: "Response format"; readonly description: string; readonly "x-ui-group": "Configuration"; }; }; readonly required: readonly ["model", "prompt"]; readonly additionalProperties: false; }; export declare const AiChatOutputSchema: { readonly type: "object"; readonly properties: { readonly text: { readonly type: "string"; readonly title: "Text"; readonly description: "Full streamed transcript across all assistant turns"; readonly "x-stream": "append"; }; readonly messages: { readonly type: "array"; readonly title: "Messages"; readonly description: "Full conversation history"; readonly items: { readonly type: "object"; readonly properties: { readonly role: { readonly type: "string"; readonly enum: readonly ["user", "assistant", "tool", "system"]; }; readonly content: { readonly type: "array"; readonly items: { readonly oneOf: readonly [{ readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["text"]; }; readonly text: { readonly type: "string"; }; }; readonly required: readonly ["type", "text"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["image"]; }; readonly mimeType: { readonly type: "string"; }; readonly data: { readonly type: "string"; }; }; readonly required: readonly ["type", "mimeType", "data"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["tool_use"]; }; readonly id: { readonly type: "string"; }; readonly name: { readonly type: "string"; }; readonly input: { readonly type: "object"; readonly additionalProperties: true; }; }; readonly required: readonly ["type", "id", "name", "input"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["tool_result"]; }; readonly tool_use_id: { readonly type: "string"; }; readonly content: { readonly type: "array"; readonly items: { readonly oneOf: readonly [{ readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["text"]; }; readonly text: { readonly type: "string"; }; }; readonly required: readonly ["type", "text"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["image"]; }; readonly mimeType: { readonly type: "string"; }; readonly data: { readonly type: "string"; }; }; readonly required: readonly ["type", "mimeType", "data"]; readonly additionalProperties: false; }, { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly enum: readonly ["tool_use"]; }; readonly id: { readonly type: "string"; }; readonly name: { readonly type: "string"; }; readonly input: { readonly type: "object"; readonly additionalProperties: true; }; }; readonly required: readonly ["type", "id", "name", "input"]; readonly additionalProperties: false; }]; }; }; readonly is_error: { readonly type: "boolean"; }; }; readonly required: readonly ["type", "tool_use_id", "content"]; readonly additionalProperties: false; }]; readonly title: "ContentBlock"; readonly description: "A single content block within a chat message"; }; }; }; readonly required: readonly ["role", "content"]; readonly additionalProperties: false; readonly title: "ChatMessage"; readonly description: "A single chat message with role and structured content blocks"; }; readonly "x-stream": "object"; }; readonly iterations: { readonly type: "number"; readonly title: "Iterations"; readonly description: "Number of completed turns"; }; }; readonly required: readonly ["text", "messages", "iterations"]; readonly additionalProperties: false; }; export type AiChatTaskInput = Omit<{ systemPrompt?: string | undefined; messages?: ChatMessage[] | undefined; maxTokens?: number | undefined; temperature?: number | undefined; maxIterations?: number | undefined; responseFormat?: "text" | "markdown" | undefined; model: string | ModelConfig; prompt: string | ({ type: "text"; text: string; } | { type: "image"; mimeType: string; data: string; } | { type: "tool_use"; id: string; name: string; input: { [x: string]: unknown; }; } | { is_error?: boolean | undefined; type: "tool_result"; content: ({ type: "text"; text: string; } | { type: "image"; mimeType: string; data: string; } | { type: "tool_use"; id: string; name: string; input: { [x: string]: unknown; }; })[]; tool_use_id: string; })[]; }, "messages"> & { readonly messages?: ReadonlyArray; }; export type AiChatTaskOutput = { text: string; messages: ChatMessage[]; iterations: number; }; /** Provider-facing input: same structural type as AiChatTaskInput, named separately for intent. */ export type AiChatProviderInput = AiChatTaskInput; export interface AiChatProviderOutput { readonly text: string; [key: string]: unknown; } export declare class AiChatTask extends StreamingAiTask { static type: string; /** Capabilities required of the model; gated in {@link StreamingAiTask.executeStream}. */ static readonly requires: ["text.generation"]; protected static readonly streamingPhaseLabel = "Replying"; static category: string; static title: string; static description: string; static cachePolicy: CachePolicy; static configSchema(): DataPortSchema; static inputSchema(): DataPortSchema; static outputSchema(): DataPortSchema; private _sessionId; protected getJobInput(input: AiChatTaskInput): Promise>; executeStream(input: AiChatTaskInput, context: IExecuteContext): AsyncIterable>; } //# sourceMappingURL=AiChatTask.d.ts.map