/** * System prompt builder — assembles the full system prompt injected into every koi turn. * * Combines runtime metadata (OS, shell, model, channel, capabilities), user-provided * workspace files (SOUL.md, KOI.md, HEARTBEAT.md, etc.), tool descriptions, skill * references, memory instructions, credential/OAuth guidance, and formatting rules * into a single coherent system prompt string. * * The prompt adapts dynamically based on: active channel, available tools, enabled * skills, reasoning level, heartbeat state, and session type (main vs isolated). * * @module */ import type { ReasoningLevel, ThinkLevel } from "../auto-reply/thinking.js"; import type { MemoryCitationsMode } from "../config/types.memory.js"; import type { ResolvedTimeFormat } from "./date-time.js"; import type { EmbeddedContextFile } from "./pi-embedded-helpers.js"; import type { WorldModel } from "../world-model/types.js"; /** * Controls which hardcoded sections are included in the system prompt. * - "full": All sections (default, for main koi) * - "minimal": Reduced sections (Tooling, Workspace, Runtime) - used for subkois * - "none": Just basic identity line, no sections */ export type PromptMode = "full" | "minimal" | "none"; export declare function buildKoiSystemPrompt(params: { workspaceDir: string; defaultThinkLevel?: ThinkLevel; reasoningLevel?: ReasoningLevel; extraSystemPrompt?: string; ownerNumbers?: string[]; reasoningTagHint?: boolean; toolNames?: string[]; toolSummaries?: Record; modelAliasLines?: string[]; userTimezone?: string; userTime?: string; userTimeFormat?: ResolvedTimeFormat; contextFiles?: EmbeddedContextFile[]; skillsPrompt?: string; heartbeatPrompt?: string; docsPath?: string; workspaceNotes?: string[]; ttsHint?: string; /** Controls which hardcoded sections to include. Defaults to "full". */ promptMode?: PromptMode; runtimeInfo?: { koiId?: string; host?: string; os?: string; arch?: string; node?: string; model?: string; defaultModel?: string; shell?: string; channel?: string; capabilities?: string[]; repoRoot?: string; }; messageToolHints?: string[]; sandboxInfo?: { enabled: boolean; workspaceDir?: string; workspaceAccess?: "none" | "ro" | "rw"; koiWorkspaceMount?: string; browserBridgeUrl?: string; browserNoVncUrl?: string; hostBrowserAllowed?: boolean; elevated?: { allowed: boolean; defaultLevel: "on" | "off" | "ask" | "full"; }; }; /** Reaction guidance for the koi (for Telegram minimal/extensive modes). */ reactionGuidance?: { level: "minimal" | "extensive"; channel: string; }; memoryCitationsMode?: MemoryCitationsMode; /** * Per-session ground-truth context (resource ownership, credentials, time, * presence). Rendered between user identity and time as `` JSON * for the koi to consult before infrastructure-touching tool calls. Optional * for backwards-compatibility; sections degrade gracefully when omitted. */ worldModel?: WorldModel; }): string; export declare function buildRuntimeLine(runtimeInfo?: { koiId?: string; host?: string; os?: string; arch?: string; node?: string; model?: string; defaultModel?: string; shell?: string; repoRoot?: string; }, runtimeChannel?: string, runtimeCapabilities?: string[], defaultThinkLevel?: ThinkLevel): string;