UNPKG

@code-yeongyu/senpi

Version:

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

97 lines • 4.94 kB
import type { Skill } from "../skills.ts"; import type { AvailableTool, PromptSurface, SharedSections } from "./types.ts"; import { type WorkstationDialect } from "./workstation.ts"; export { type PromptSurface, type SharedSections, type TerminalOrApp, terminalOrApp } from "./types.ts"; export declare const PROMPT_SURFACE_ENV_VAR = "SENPI_PROMPT_SURFACE"; /** `SENPI_PROMPT_SURFACE=app` or `=chat` selects that surface; unset or any other value is the terminal. */ export declare function resolvePromptSurface(env: Readonly<Record<string, string | undefined>>): PromptSurface; /** Context handed to a `corePrompt` override so it can reuse the dynamic pieces. */ export interface DynamicPromptCoreContext { tools: AvailableTool[]; surface: PromptSurface; appName?: string; /** Rendered "## Available Tools" (+ "## Tool Guidelines") section; empty when it has nothing to list. */ toolSection: string; /** The wording the shared section builders render for this prompt (senpi#5665). */ sharedSections: SharedSections; /** * True when the session can search through a provider-native search tool * added to the request (e.g. Anthropic-native web search), even when the * builtin `web_search` tool is not among the active tools (senpi#2935). */ nativeSearchAvailable?: boolean; } /** Tool snippets and guidelines as the pre-diet prompt listed them, rendered for `sharedSections: "full"`. */ export interface FullToolPrompt { /** Every contributing tool's snippet, including tools whose schema description the model already reads. */ toolSnippets: Record<string, string>; /** Each tool's `fullPromptGuidelines`, else its `promptGuidelines`. */ promptGuidelines: string[]; } export interface BuildDynamicSystemPromptOptions { /** Observe the parts from this exact render without composing the prompt again. */ onParts?: (parts: readonly DynamicSystemPromptPart[]) => void; /** Loader replacement and additions, assembled here with the same separators as the session. */ customPrompt?: string; appendSystemPrompt?: string; /** Host identity; omitted preserves the Native runtime's configured brand. */ appName?: string; /** * Session working directory. Not rendered: cwd and date reach the model as an * append-only environment-context message so this prompt stays byte-stable * across days and directories (senpi#2093). */ cwd: string; selectedTools: string[]; /** * Whether a provider-native search tool is available for this session * (e.g. Anthropic-native web search added to the request), even when the * builtin `web_search` tool is not selected (senpi#2935). Presets that * gate search wording on the builtin tool read this as a second signal. */ nativeSearchAvailable?: boolean; /** One-line snippets, listed under "## Available Tools" for selected tools; pass none for a tool whose schema description the model already sees. */ toolSnippets: Record<string, string>; promptGuidelines: string[]; /** Tool contributions for `sharedSections: "full"`; without it the full render uses `toolSnippets`/`promptGuidelines`. */ fullToolPrompt?: FullToolPrompt; /** * Wording of the shared section builders: `full` renders their text from before the senpi#5335 diet, * `diet` (the default) the slimmed text. A prompt preset declares it (senpi#5665). */ sharedSections?: SharedSections; contextFiles: Array<{ path: string; content: string; scope?: "user"; }>; skills: Skill[]; tuningSection?: string; /** * Replaces the default core sections (identity through style) with a * model-specific full rewrite. Tool section, tuning, context files, skills, * and workstation assembly stay in this builder. */ corePrompt?: (context: DynamicPromptCoreContext) => string; /** * Wording dialect for the workstation execution-context instruction. * Presets pass their model family; the fallback prompt uses `default` * (maximum emphasis). */ workstationDialect?: WorkstationDialect; /** * Where replies render. `app` (a chat UI host) drops the visible routing line and keeps * tool and hook feedback with the agent; `chat` (a chat bridge) also drops the handoff block and * ledger lines; omitted means `terminal`. */ surface?: PromptSurface; } export interface DynamicSystemPromptPart { readonly name: string; readonly source?: string; /** Includes its separators: joining every text with "" is the exact provider prompt. */ readonly text: string; } export declare function buildDynamicSystemPromptParts(options: BuildDynamicSystemPromptOptions): DynamicSystemPromptPart[]; export declare function buildDynamicSystemPrompt(options: BuildDynamicSystemPromptOptions): string; //# sourceMappingURL=build.d.ts.map