import type { AgAiInstructionContext } from '../../api/ai/agAiInstructionContext'; import type { AgAiConversationItem, AgAiOutputItem } from '../../api/ai/agAiMessage'; import type { AgToolRef } from '../../api/ai/agAiTool'; import type { AgAiProfileState } from '../../api/state/agAiAssistantState'; import type { BeanCollection } from '../interfaces/beanCollection'; import type { Shape } from '../shape/core/shapeTypes'; import type { AiError } from './aiError'; import type { AiExecutionContext } from './aiExecutionContext'; import type { AiArtifactStore } from './artifacts/types'; import type { AiMessageModel } from './messages/aiMessageModel'; import type { AnyTool } from './tools/types'; export interface AiProfileDefinition { type: string; schema: Shape; config: (params: T, beans: BeanCollection) => AiProfileConfig; } export type AnyProfileDefinition = AiProfileDefinition; export interface AiProfileConfig { name: string; instructions: (ctx: AgAiInstructionContext, artifacts: AiArtifactStore) => string; delegateProfiles?: string[]; tools: AgToolRef[]; defaultToolCalls?: { tool: string; args?: Record; }[]; } export interface AiProfile { type: string; name: string; instructions: (ctx: AgAiInstructionContext, artifacts: AiArtifactStore) => string; tools: AnyTool[]; defaultToolCalls?: { tool: string; args?: Record; }[]; } export interface AiExchangeRunConfig { tools: AnyTool[]; instructions: () => string; modelId?: string; terminatingTool?: string; context: AiExecutionContext; initialInput: AgAiConversationItem[]; } export type AiStreamResult = { status: 'complete'; terminatingResult?: unknown; } | { status: 'cancelled'; } | { status: 'error'; error: AiError; }; export type AiExchangeEvents = 'turnStarted' | 'turnCompleted' | 'completed' | 'updated' | 'messageAdded' | 'messageUpdated'; export interface ExchangeOptions { modelId?: string; profile?: AgAiProfileState; } export type MessageModelFactory = (data: AgAiOutputItem) => AiMessageModel | null; export type AiTurnEvents = 'messageAdded' | 'messageUpdated';