import { LLMProvider } from '../../providers/types.js'; import type { SkillRegistry } from '../../skills/types.js'; import type { Message, StepResult, Usage, ApproveToolFn, PermissionLevel, ProviderType, PersistenceBackend } from '../../core/types.js'; import type { Middleware } from '../../core/middleware.js'; /** * Outcome of a single `Agent.chat()` turn. Returned so non-readline callers * (the TUI) can render terminal states (aborted / max-steps / error) instead * of relying on chalk stdout. The readline path ignores it and prints the * same chalk messages as before. */ export interface ChatResult { finishReason: string; error?: string; usage?: Usage; } export declare class Agent { private provider; private messages; private model; private config; private autoConfirm; private skillRegistry; private skillCatalog; private abortController; private _middleware; private readonly systemPrompt; private readonly providerType; private readonly persistence; private sessionId; constructor(provider: LLMProvider, model?: string, config?: any, systemPrompt?: string, persistence?: PersistenceBackend | null, providerType?: ProviderType); initializeSkills(): Promise; getSkillRegistry(): SkillRegistry | null; /** Set middleware pipeline (e.g., gateway semantic injection). */ setMiddleware(middleware: Middleware[]): void; chat(userInput: string, signal?: AbortSignal, approveTool?: ApproveToolFn, permissionLevel?: PermissionLevel, onStep?: (step: StepResult) => void): Promise; /** * Load a previously persisted session by id, replacing the in-memory history. * Re-seeds the system message if the loaded set has none. No-op when no * backend is configured. */ loadSession(sessionId: string): Promise; /** Active session id (rotated by `clearConversation` when persistence is on). */ getSessionId(): string; /** Configured persistence backend, or null when persistence is disabled. */ getPersistence(): PersistenceBackend | null; clearConversation(): void; /** Public accessor for the current message history. */ getMessages(): Message[]; /** Replace the message history (e.g., after compaction). */ setMessages(messages: Message[]): void; /** Public accessor for the active LLM provider. */ getProvider(): LLMProvider; /** Public accessor for the active model name. */ getModel(): string; switchProvider(provider: LLMProvider, model: string): void; abort(): void; createAbortSignal(): AbortSignal; clearAbortController(): void; }