UNPKG

@code-yeongyu/senpi

Version:

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

62 lines • 3.48 kB
import type { ImageContent, TextContent } from "@earendil-works/pi-ai"; import { type ToolResultUserWord } from "../../../tool-result-user-words.ts"; import { type AskUserVariant, type QuestionRequest, type QuestionResponse } from "./schema.ts"; export type CodexResultDetails = { resolvedBy?: QuestionResponse["resolvedBy"]; answers: Record<string, { answers: string[]; }>; comment?: string; unanswered: string[]; status: QuestionResponse["status"]; userWords?: ToolResultUserWord[]; }; export type ClaudeResultDetails = { resolvedBy?: QuestionResponse["resolvedBy"]; questions: QuestionRequest["questions"]; answers: Record<string, string>; freeText?: string; unanswered: string[]; status: QuestionResponse["status"]; userWords?: ToolResultUserWord[]; }; type Questions = QuestionRequest["questions"]; /** Whether a line opens the partial answers of a cancelled question. */ export declare function isCancelledWithAnswersLine(line: string): boolean; /** * The one rule for a cancelled question's partial answers (sisyphuslabs/omo-desktop-app#4042): a cancel * the user chose, or a failing question UI, shows the model what was already answered. Every lifecycle * cancel (a turn abort, the session closing, ask-user disabled, a closed RPC connection) stays silent. */ export declare function showsPartialAnswers(response: QuestionResponse): boolean; /** * A required question cancelled with a reason (a UI failure): the reason stands in for the status line, * a draft the user typed is named and marked not an answer, and the action is refused (senpi#2949). */ export declare function formatGatedCancellation(reason: string, response: QuestionResponse, requestId: string, questions: Questions): string; /** The answer as a person reads it, with the user's words inline (hooks, the transcript card). */ export declare function formatResultText(_variant: AskUserVariant, response: QuestionResponse, questions?: Questions, required?: boolean): string; /** * The answer as the model receives it: `text` holds only the structure and the options the model * offered; each of the user's own words is a `words` entry that `text` names by its label. */ export declare function formatModelAnswer(response: QuestionResponse, requestId: string, questions?: Questions, required?: boolean): { text: string; words: ToolResultUserWord[]; }; /** * The framed user message for a later answer: the `[Answer to question <id>]` frame with the * structure, then each of the user's words after its own label block. An answer with no typed * words stays the single framed string it always was. */ export declare function formatUserMessage(response: QuestionResponse, requestId: string, questions?: Questions, required?: boolean): string | TextContent[]; /** Display text of a framed answer whose words travel as labelled blocks; undefined otherwise. */ export declare function askUserAnswerDisplayText(content: string | (TextContent | ImageContent)[]): string | undefined; export interface AskUserAnswerFrame { readonly requestId: string; readonly body: string; } export declare function parseAskUserAnswerFrame(text: string): AskUserAnswerFrame | undefined; export declare function formatResultDetails(variant: AskUserVariant, response: QuestionResponse, requestId: string, questions?: Questions, required?: boolean): CodexResultDetails | ClaudeResultDetails; export {}; //# sourceMappingURL=format.d.ts.map