import * as i0 from '@angular/core'; import { Type } from '@angular/core'; import { Observable } from 'rxjs'; interface AIMessageStreamSteps extends AIMessage { componentSteps$?: Observable<{ content: Type | string; origin: AgentStep; }[]>; } interface AIMessage { role: 'user' | 'assistant'; content: string; options?: AIMessageOptions; steps?: Array; finishReason?: 'stop' | 'error' | 'tool_use'; timestamp?: string; } interface AIMessageOptions { skipToLLM?: boolean; hiddenContent?: string; variables?: { [key: string]: any; }; } declare enum DataStreamType { TEXT_DELTA = "text-delta", TOOL_CALL = "tool-call", TOOL_INPUT_START = "tool-input-start", TOOL_INPUT_DELTA = "tool-input-delta", TOOL_CALL_STREAMING = "tool-call-streaming", TOOL_CALL_DELTA = "tool-call-delta", TOOL_RESULT = "tool-result", REASONING = "reasoning", REASONING_DELTA = "reasoning-delta", REDACTED_REASONING = "redacted-reasoning", REASONING_SIGNATURE = "reasoning-signature", FINISH_REASONING = "finish-reasoning", FINISH = "finish", FINISH_STEP = "finish-step", ERROR = "error", DATA = "data", MESSAGE_ANNOTATIONS = "message-annotations", SOURCE = "source", FILE = "file", STEP_START = "start-step", STEP_FINISH = "finish-step", STEP_START_V4 = "step-start", STEP_FINISH_V4 = "step-finish" } type AgentStep = { type: 'text' | 'reasoning' | string; text: string; reasoning?: string; textDelta?: string; toolCalls?: Array; toolResults?: Array; aborted?: boolean; }; interface Tool { toolName: string; toolCallId: string; type: 'tool-call' | 'tool-result'; } interface ToolCall extends Tool { arguments: { [key: string]: any; }; } interface ToolResult extends Tool { input: any; output: { content: { text: string; type: string; }[]; }; } interface ClientAgentDefinition { /** * If set to true, the agent will use the test endpoint to generate responses. * This is useful for development and testing purposes, but requires agent admin * privileges. */ snapshot: boolean; /** * The label of the agent that is shown to the user. */ label: string; /** * The definition of the agent to use */ definition: AgentDefinition; } interface AgentDefinition { name: string; type: 'object' | 'text'; agent: { system: string; [key: string]: any; }; mcp: Array<{ serverName: string; tools: string[]; }>; } interface ChatConfig { title: string; headline: string; welcomeText: string; placeholder: string; placeholderAfterFirstMessage: string; sendButtonText: string; cancelButtonText: string; disclaimerText: string; userInterfaceIcons: { send: string; cancel: string; }; } interface AgentHealthCheckResponse { /** * Indicates if the agent exists and can be used. * If false, the agent was not found. */ exists: boolean; /** * Indicates if the user can create the agent, and if a global provider is configured. */ canCreate: boolean; /** * Indicates if the provider is configured. * If false, the agent cannot be created as the provider is not configured. */ isProviderConfigured: boolean; /** * If canCreate or exist is false, this array contains messages * that explain why the agent cannot be used or created. */ messages?: string[]; } declare class AIService { private baseUrl; private client; /** * Creates or updates an agent. * @param def The agent definition */ createOrUpdateAgent(def: AgentDefinition): Promise; /** * Check if an agent exists. * @param name Agent name (optional) * @param fromApp The app context path to check for an agent. This can be used, if the agent should get distributed by the plugin (optional). * @returns Agent health check response. */ getAgentHealth(name?: string, fromApp?: string): Promise; /** * Send a text message to the agent. * @param name Agent name * @param messages Messages to send * @param variables Variables to include * @param fromApp The app context path to check for an agent. This can be used, if the agent should get distributed by the plugin (optional). * @returns Text response from the agent. */ text(name: string, messages: AIMessage[], variables: { [key: string]: any; }, fromApp?: string): Promise; /** * Stream a text message to the agent. * @param agent Agent name or an agent definition. * @param messages Messages to send * @param variables Variables to include * @param abortController An AbortController to cancel the request. * @param fromApp The app context path to check for an agent. This can be used, if the agent should get distributed by the plugin (optional). * @returns An observable that emits partial AIMessage objects as they are received. The observable can be cancelled using the provided AbortController. * The observable will emit an error if the request fails or is aborted. * The observable will complete when the stream is finished. * * The messages sent to the agent can include special options: * - `hiddenContent`: If set, this content will be sent to the agent instead of the `content` field. * - `skipToLLM`: If set to true, this message will be skipped when sending to the agent. * * Example usage: * ```typescript * const abortController = new AbortController(); * const messages: AIMessage[] = [ * { role: 'user', content: 'Hello' }, * { role: 'assistant', content: 'Hi there!' }, * { role: 'user', content: 'Tell me a joke.', options: { hiddenContent: 'Tell me a joke about cats.' } } * ]; * const observable = aiService.stream$('my-agent', messages, {}, abortController); * const subscription = observable.subscribe({ * next: (message) => console.log('Received message part:', message), * error: (err) => console.error('Error:', err), * complete: () => console.log('Stream complete') * }); * * // To cancel the request: * abortController.abort(); * subscription.unsubscribe(); * ``` */ stream$(agent: string | ClientAgentDefinition, messages: AIMessage[], variables: { [key: string]: any; }, abortController: AbortController, fromApp?: string): Promise>; private parseMessages; private processLine; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { AIService, DataStreamType }; export type { AIMessage, AIMessageOptions, AIMessageStreamSteps, AgentDefinition, AgentHealthCheckResponse, AgentStep, ChatConfig, ClientAgentDefinition, Tool, ToolCall, ToolResult }; //# sourceMappingURL=index.d.ts.map