@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
22 lines • 1.22 kB
TypeScript
import { type Message, type TextContent, type ToolResultMessage } from "@earendil-works/pi-ai";
/**
* Words the user typed that a tool result carries in `details.userWords` instead of its content.
* A model trained to distrust tool results may ignore user text inside one (senpi#2920), so each
* request delivers them as a user turn after the tool results, every word after its own label.
*/
export interface ToolResultUserWord {
readonly label: string;
readonly text: string;
}
export declare function toolResultUserWords(message: Pick<ToolResultMessage, "details"> | {
details: unknown;
}): ToolResultUserWord[];
/** The label block a reference names, then the words, for each word in order. */
export declare function userWordBlocks(words: readonly ToolResultUserWord[]): TextContent[];
/**
* Inserts one user message after each contiguous run of tool results whose details carry user
* words. It is derived only from persisted tool results, so live requests, resumed sessions and
* compaction all see the same messages, and no queue operation can drop them.
*/
export declare function appendToolResultUserWords(messages: Message[]): Message[];
//# sourceMappingURL=tool-result-user-words.d.ts.map