UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

75 lines • 3.93 kB
/** * System prompt construction and project context loading */ import type { ContextFile } from "./context-files.ts"; import type { PromptSurface, SharedSections } from "./dynamic-prompt/types.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<string, string>; /** Guideline bullets contributed by each tool, keyed by tool name. */ toolGuidelines?: Record<string, string[]>; /** Additional guideline bullets appended to the default system prompt rules. */ promptGuidelines?: string[]; /** Text appended from user configuration before project context, skills, and cwd. */ appendSystemPrompt?: string; /** Additional XML-wrapped prompt sections keyed by tag name. */ sections?: Record<string, string>; /** Working directory. */ cwd: string; /** Pre-loaded context files. */ contextFiles?: ContextFile[]; /** Pre-loaded skills. */ skills?: Skill[]; /** Where replies render (`SENPI_PROMPT_SURFACE`); read by the dynamic prompt and presets. */ surface?: PromptSurface; } /** Contributions include eval-only tools even when the selected model-facing list does not. */ export declare function getEvalOnlyGrepGuideline(selectedTools: string[], toolSnippets?: Record<string, string>, sharedSections?: SharedSections): string | undefined; export type NormalizedBuildSystemPromptOptions = BuildSystemPromptOptions & { selectedTools: string[]; toolSnippets: Record<string, string>; toolGuidelines: Record<string, string[]>; promptGuidelines: string[]; appendSystemPrompt: string; sections: Record<string, string>; contextFiles: ContextFile[]; skills: Skill[]; }; /** * 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<string, string>; /** Normalize prompt input into the mutable, collection-complete shape exposed to extensions. */ export declare function normalizeBuildSystemPromptOptions(input: BuildSystemPromptOptions): NormalizedBuildSystemPromptOptions; /** 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 string (fork layout: "Available tools:" / "Guidelines:" blocks and a trailing * "Current working directory:" line). The structured section form for transcript system messages is * `buildSystemPromptSections`/`buildSystemPromptState`. */ export declare function buildSystemPrompt(options: 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<string, string | null>, current: SystemPromptSections): Record<string, string | null> | undefined; //# sourceMappingURL=system-prompt.d.ts.map