/** 缓存边界标记 —— 此标记之前的 section 可缓存,之后每轮重算。 */ export declare const SYSTEM_PROMPT_DYNAMIC_BOUNDARY = "---DYNAMIC_BOUNDARY---"; export interface SystemPromptSection { /** section 名称(用于调试/memoize key) */ name: string; /** section 内容 */ content: string; /** 是否动态(每轮重算,放在边界后) */ dynamic?: boolean; } export declare function clearSectionCache(): void; /** * Memoize 一个 section 的计算(对齐 Claude Code systemPromptSection)。 * 首次调 fn() 计算并缓存;后续直接返回缓存。 * clearSectionCache() 清空后下次重新计算。 */ export declare function memoizedSection(name: string, fn: () => string): string; /** * 构建分段 system prompt。 * 返回 string[](分段数组),调用方可拼成字符串或打包成 cache block。 * * @param sections 自定义 section * @param dynamicSections 动态 section(放在边界后) * @param basePrompt 自定义 base prompt(默认 BASE_SYSTEM_PROMPT) * @returns 分段数组(含边界标记) */ export declare function buildSystemPromptSections(sections?: SystemPromptSection[], dynamicSections?: SystemPromptSection[], basePrompt?: string): string[]; /** * 把分段数组拼成单一字符串(用于非 cache 场景)。 * 边界标记会被移除(不影响 LLM)。 */ export declare function sectionsToString(sections: string[]): string; /** * 打包分段数组为 API cache block(对齐 Claude Code buildSystemPromptBlocks)。 * 边界前的内容打上 cache_control: { type: "ephemeral" }, * 边界后的内容不打 cache_control(每轮变化)。 * * @returns Anthropic API messages.create 格式的 system blocks */ export declare function buildCacheBlocks(sections: string[]): Array<{ type: "text"; text: string; cache_control?: { type: "ephemeral"; }; }>; /** * 构建环境信息 section(动态)。 * 对齐 Claude Code 的 EnvInfo section:注入 model name/platform/shell/workdir。 */ export declare function buildEnvInfoSection(opts: { model?: string; workdir?: string; platform?: string; }): SystemPromptSection; /** * 构建 skill 列表 section(动态)。 */ export declare function buildSkillSection(skills: Array<{ name: string; description: string; }>): SystemPromptSection | undefined; /** * 构建 memory 召回 section(动态)。 */ export declare function buildMemorySection(memoryBlock: string): SystemPromptSection; /** * 构建 MCP instructions section(动态)。 * 对齐 Claude Code getMcpInstructionsSection:把已连接 MCP server 的 instructions 注入 systemPrompt。 */ export declare function buildMcpInstructionsSection(instructions: Array<{ serverName: string; instructions: string; }>): SystemPromptSection | undefined; /** * 构建 output style section(动态,对齐 Claude Code OutputStyle)。 */ export declare function buildOutputStyleSection(styleName: string, stylePrompt: string): SystemPromptSection; /** * 构建 scratchpad section(动态,对齐 Claude Code Scratchpad)。 * 告诉模型可以用 scratchpad 目录做临时文件。 */ export declare function buildScratchpadSection(scratchpadDir: string): SystemPromptSection; /** * 构建 function result clearing 提示 section(静态,对齐 Claude Code)。 */ export declare const FUNCTION_RESULT_CLEARING_SECTION = "When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later."; /** * 构建 language section(动态,对齐 Claude Code Language)。 */ export declare function buildLanguageSection(language: string): SystemPromptSection; /** * 构建 session guidance section(动态,对齐 Claude Code SessionGuidance)。 * 包含 worktree 状态、git 状态、skill 使用指引。 */ export declare function buildSessionGuidanceSection(opts: { isWorktree?: boolean; isGitRepo?: boolean; hasSkills?: boolean; }): SystemPromptSection;