UNPKG

@code-yeongyu/senpi

Version:

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

36 lines • 2.87 kB
import type { AssistantMessage, Context } from "@earendil-works/pi-ai"; import type { PromptCacheTtl } from "./prompt-cache-ttl.ts"; import type { ContentBlockParam, SDKUserMessage } from "./sdk-boundary.ts"; export { mapPiToolNameToSdk } from "./tools.ts"; export declare function contentToText(content: AssistantMessage["content"], customToolNameToSdk?: ReadonlyMap<string, string>): string; /** * Text that closes the replayed history. Everything after it (recovered tool results, the * response instruction, the final user message) changes every turn, so it stays after the * cache breakpoint. */ export declare const CONVERSATION_HISTORY_CLOSER = "\n</conversation_history>"; export declare const RESPOND_TO_USER_INSTRUCTION = "The above is the conversation history so far, provided as context. Respond as the assistant to the user message below only. Never emit \"USER:\" or \"ASSISTANT:\" labels or continue the transcript."; /** * A replay that ends with tool results (a model switch or fallback mid-turn) has no new user message. Saying "the * user message below" there made the model read the last tool output, often images it generated itself, as something * the user had just sent (senpi#2768). */ export declare const CONTINUE_TURN_INSTRUCTION = "The above is the conversation history so far, provided as context. There is no new user message: the last entries are results of tool calls you made in your current turn, not anything the user sent. Continue that turn as the assistant. Never emit \"USER:\" or \"ASSISTANT:\" labels or continue the transcript."; export type PromptBlockOptions = { /** * Mark the last history text block as a prompt-cache breakpoint with this lifetime. History only grows by * appending, so the next rebuilt prompt starts with the same bytes up to here and reads them from cache * (senpi#2982). The lifetime must equal the one Claude Code is pinned to (see prompt-cache-ttl.ts). Only for * one-shot queries: a resident session keeps this user message in its transcript, where Claude Code adds its own. */ cacheBreakpoint?: PromptCacheTtl; }; export declare function buildPromptBlocks(context: Context, customToolNameToSdk?: ReadonlyMap<string, string>, toolWatchNote?: string, options?: PromptBlockOptions): ContentBlockParam[]; /** * A prompt that builds its blocks each time it is iterated. A failover retry hands the same prompt to a fresh query, * and an async generator would be exhausted by then; building late also lets the blocks follow the auth lane the * attempt resolved (its pinned cache lifetime). */ export declare function buildDeferredPromptStream(build: () => ContentBlockParam[]): AsyncIterable<SDKUserMessage>; export declare function buildPromptStream(promptBlocks: ContentBlockParam[]): AsyncIterable<SDKUserMessage>; //# sourceMappingURL=prompt-bridge.d.ts.map