/** * System prompt construction and project context loading */ import { type AgentPersona } from "./agents.ts"; import { type Skill } from "./skills.ts"; export interface BuildSystemPromptOptions { /** Custom system prompt (replaces the default prefix). */ customPrompt?: string; /** Exact full prompt replacement set by a before_agent_start handler. */ forceSystemPrompt?: string; /** Tools to include in prompt. Default: [read, bash, edit, write] */ selectedTools?: string[]; /** Optional one-line tool snippets keyed by tool name. */ toolSnippets?: Record; /** Guideline bullets contributed by each tool, keyed by tool name. */ toolGuidelines?: Record; /** Additional guideline bullets appended to the default system prompt guidelines. */ promptGuidelines?: string[]; /** Text to append to system prompt. */ appendSystemPrompt?: string; /** Additional XML-wrapped prompt sections keyed by tag name. */ sections?: Record; /** Working directory. */ cwd: string; /** Pre-loaded context files. */ contextFiles?: Array<{ path: string; content: string; }>; /** Pre-loaded skills. */ skills?: Skill[]; /** Pre-loaded subagent personas. */ agents?: AgentPersona[]; } export type NormalizedBuildSystemPromptOptions = BuildSystemPromptOptions & { selectedTools: string[]; toolSnippets: Record; toolGuidelines: Record; promptGuidelines: string[]; appendSystemPrompt: string; sections: Record; contextFiles: Array<{ path: string; content: string; }>; skills: Skill[]; agents: AgentPersona[]; }; /** * Ordered system prompt sections, keyed by name. `preamble` is untagged text; every other * section is wrapped in a tag of the same name so the model can match later updates to it. * These become `SystemMessage.sections` in the transcript. */ export type SystemPromptSections = Record; /** Normalize prompt input into the mutable, collection-complete shape exposed to extensions. */ export declare function normalizeBuildSystemPromptOptions(input: BuildSystemPromptOptions): NormalizedBuildSystemPromptOptions; export declare function buildRules(selectedTools: string[], toolGuidelines: Record, promptGuidelines: string[]): string; /** Build the ordered, independently replaceable sections of the structured system prompt. */ export declare function buildSystemPromptSections(input: BuildSystemPromptOptions): SystemPromptSections; /** * The complete prompt state for `input`. A forced prompt is opaque and lives in `content` * with no sections; otherwise `content` is empty and the structured sections carry the prompt. */ export declare function buildSystemPromptState(input: BuildSystemPromptOptions): { content: string; sections?: SystemPromptSections; }; /** Build the system prompt text, rendered exactly as the transcript's system message replays it. */ export declare function buildSystemPrompt(input: BuildSystemPromptOptions): string; /** * Diff the sections the model currently has (replayed from the transcript, so never null) * against the desired ones. Returns a `SystemMessage.sections` patch, or undefined when * nothing changed. */ export declare function diffSystemPromptSections(previous: Record, current: SystemPromptSections): Record | undefined;