import { type SKYKOIConfig } from "../config/config.js"; import { DEFAULT_FAST_LANE_MODEL } from "../koi/fast-lane-model.js"; export { DEFAULT_FAST_LANE_MODEL }; /** Fast mode is DEFAULT ON — only an explicit { enabled: false } disables it. */ export declare function loadFastModeEnabled(): boolean; export declare function saveFastModeEnabled(enabled: boolean): void; export type FastAction = { type: "answer"; text: string; } | { type: "command"; commands: string[]; } | { type: "delegate"; ack: string; } /** INSTANT INTERFACE: a compact inline-content surface mounted locally by * the shell with zero gateway round-trip. Repaired+validated on mount. */ | { type: "surface"; surface: Record; }; /** Optional per-response visual intent for the Living Canvas (GPU CA). */ export type FastVisual = { mood?: string; family?: string; energy?: number; palette?: string; }; export type FastDecision = { actions: FastAction[]; visual?: FastVisual; }; /** Commands the fast model may drive (kept tight — this is prompt real estate). */ export declare const FAST_COMMANDS: string; /** * The ONLY command names the executor will run from a fast-lane decision. * The prompt already restricts what the model should emit, but a prompt is not * a security boundary — a routed `/uninstall confirm` or `/reset-koi confirm` * must never execute no matter what the model says. Names are the CANONICAL * names after alias resolution (parseCommand), so "/voice on" (alias of speak) * passes while "/uninstall" can never slip through via an alias. */ export declare const FAST_COMMAND_ALLOWLIST: Set; /** Split routed commands into executable vs dropped (not allowlisted). */ export declare function filterAllowedCommands(commands: string[]): { allowed: string[]; dropped: string[]; }; export declare function buildFastLaneSystemPrompt(): string; /** Tolerant parse of the model's JSON decision. Returns null on garbage. */ /** * Pull the answer text out of a PARTIAL streaming router JSON. Matches the * first `"answer" … "text":"…` and returns the value decoded so far (JSON * escapes handled), or null when this isn't shaping up as an answer action * yet (a command/surface/delegate, or text not reached). Deliberately * tolerant: it operates on incomplete JSON every chunk. */ export declare function extractPartialAnswer(raw: string): string | null; export declare function parseFastLaneResponse(raw: string): FastDecision | null; export type FastDigestInput = { transcriptTail: Array<{ role: "user" | "assistant"; text: string; }>; model?: string; koiLabel?: string; speakMode: boolean; fastMode: boolean; /** What the smart model is doing right now, if a delegated run is active. */ delegationActivity?: string | null; /** Saved canvas preset names, so natural asks map to /canvas . */ canvasPresets?: string[]; /** * The durable personal context (dossier + profile + memory) — the SAME * knowledge the smart lane carries. Without it the fast voice answers * personal questions blind. */ personal?: string; }; export declare function buildDigest(input: FastDigestInput): string; export type FastLaneFetch = typeof fetch; export type RouteResult = { decision: FastDecision; firstTokenMs: number; totalMs: number; model: string; }; /** * Route one user submit through the fast model. Returns null on ANY failure — * the caller then falls through to the normal smart-model path. */ export declare function routeFastLane(params: { input: string; digest: string; /** Surface currently on the person's screen — moves INTO it must delegate. */ activeSurface?: { title: string; paneTypes: string[]; }; fetchImpl?: FastLaneFetch; apiKey?: string; /** Config override for tests; defaults to the loaded user config. */ config?: SKYKOIConfig; /** Streams the ANSWER text as it generates (before the whole JSON finishes) * so a plain reply appears word-by-word within ~200ms instead of popping * in at ~600ms. Only fires for the answer action; commands/surfaces/ * delegates don't stream. */ onAnswerDelta?: (partialAnswer: string) => void; }): Promise; export type Narrator = { /** Feed a koi event for the delegated run; may emit a narration line. */ onKoiEvent: (payload: unknown) => void; /** True while a fast-lane delegation is being narrated. */ isActive: () => boolean; /** The current activity label ("reading a file"), for status questions. */ currentActivity: () => string | null; begin: (runId: string) => void; reset: () => void; }; export declare function createNarrator(deps: { emit: (line: string) => void; }): Narrator; /** * Turn a smart-model reply into what the front voice should SAY (max ~2 short * sentences, first person, no code/formatting). Returns null on any failure — * the caller falls back to the reply's own first sentences. */ export declare function summarizeForVoice(params: { text: string; apiKey?: string; fetchImpl?: FastLaneFetch; /** Config override for tests; defaults to the loaded user config. */ config?: SKYKOIConfig; }): Promise; /** Split text into speakable sentence chunks; the first is spoken ASAP. */ export declare function splitSentences(text: string): string[];