import { GatewayConfig } from './openai'; import type { Conversation } from './conversationState'; import type { AiAssistantLimits, AiAssistantTool, AiChatItem, AiProposalConfig, ProposalStatus } from './types'; /** What the model is told a proposal card's fate was, once the user decides. */ export declare const PROPOSAL_OUTCOME: Record; export interface AiEngineConfig { gateway: GatewayConfig; /** * The stable part of the prompt: role, rules, schema. Called on every request * so it can follow a subject change (a different entity), but it should come * back identical from one turn to the next — together with the kept history * it is the cacheable prefix. Live state belongs in `buildContext`. */ buildSystemPrompt: () => string; /** * The live part: selection, view state, today's date. Called on every request * and sent inside the incoming user message, after the history, so a change * here never invalidates the cached prefix. */ buildContext?: () => string; /** * Extra OpenAI request-body params merged into every completion call * (temperature, max_completion_tokens, reasoning_effort, ...) — pure pass-through. */ requestParams?: Record; tools?: AiAssistantTool[]; /** * Proposal flows keyed by their tool name. Several may be live at once (a * page assistant plus a docked copilot); an incoming propose call is routed * to the config registered under the called tool's name. */ proposals?: Record; limits?: AiAssistantLimits; } export type AiConversation = Conversation; /** A string field of parsed tool arguments, or undefined when absent or not a string. */ export declare const argString: (args: unknown, key: string) => string; /** * Records a mid-conversation context switch (e.g. the user picked a different * entity): a divider in the chat for the user, and a note in the history so * the model knows earlier turns referred to a different context. The note is * a user-role message — Anthropic has no system role inside messages, and * consecutive user turns are merged, so this is provider-neutral. No-op on an * empty conversation. */ export declare const notifyContextSwitch: (conversation: AiConversation, noticeText: string, historyMarker: string) => void; export declare const setProposalStatus: (conversation: AiConversation, itemId: number, status: ProposalStatus) => void; /** * One user turn of the OpenAI tool loop: completion → execute tools / validate * a proposal (one repair round) → repeat, until the model answers in text, a * terminal tool ends the turn, or a limit is hit. All domain knowledge (prompt, * tools, proposal handling) comes from `config`; `getConfig` is re-read for * proposal routing so the flow never runs against a stale closure. * * History is the raw Chat Completions message log kept as whole turns (the * user message and everything the model did in reply, tool traffic included) * so the model remembers what it looked up and proposed. A turn is only kept * once every tool call in it has a tool message answering it. See * conversation.ts for the rules and their sources. */ export declare const runTurn: (conversation: AiConversation, getConfig: () => AiEngineConfig, userText: string, model: string, contextKey?: string) => Promise; //# sourceMappingURL=engine.d.ts.map