UNPKG

@code-yeongyu/senpi

Version:

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

68 lines • 3.75 kB
/** * Collapsed widget for a pending async (waitForAnswer=false) question: it * sits above the editor and shows the unanswered count with the idle * countdown, the first unanswered question with its options, and every way * into the full AskUserQuestionComponent. The response-building helpers here * are pure so interactive-mode can turn ordinary composer text into the * comment answer. */ import { type Component, type TUI, type TuiMouseEvent, type TuiMouseEventResult } from "@earendil-works/pi-tui"; import type { QuestionRequest, QuestionResponse } from "../../../core/extensions/types.ts"; import { type QuestionDraft } from "./ask-user-question-state.ts"; /** Host-owned widget slot displaying one request from the pending queue. */ export declare const ASK_USER_WIDGET_KEY = "ask-user"; type Question = QuestionRequest["questions"][number]; /** Question ids the draft has not answered yet. */ export declare function unansweredIds(request: QuestionRequest, draft: QuestionDraft): string[]; /** Response for a draft that already answers every question, submitted from the collapsed widget. */ export declare function buildAnsweredResponse(request: QuestionRequest, draft: QuestionDraft): QuestionResponse; /** Response for composer text typed while the question is pending: the text is the comment. */ export declare function buildCommentResponse(request: QuestionRequest, draft: QuestionDraft, comment: string): QuestionResponse; /** Response for an idle countdown that expired while the widget was collapsed. */ export declare function buildTimedOutResponse(request: QuestionRequest, draft: QuestionDraft, autoResolvedAfterMs: number): QuestionResponse; export declare function renderStatusLine(unanswered: number, countdownLabel: string, pendingCount?: number): string; export declare function renderQuestionLine(question: Question): string; export declare function renderOptionsLine(question: Question, remaining: number): string; /** Hint naming every way into the pending question; the shortcut segment follows the effective binding. */ export declare function renderAnswerHint(): string; /** * How to select text while the app owns the mouse: Option on iTerm2, Option on macOS VS Code only with * `terminal.integrated.macOptionClickForcesSelection`, Shift elsewhere (Windows Terminal, Ghostty, * WezTerm, kitty, VS Code on Windows/Linux). Terminal.app documents no drag bypass (Option-drag is its * rectangular selection); its documented way out is Command-R, which toggles Allow Mouse Reporting. * Inside tmux the outer terminal decides and cannot be detected. */ export declare function selectionBypassHint(termProgram?: string, platform?: NodeJS.Platform): string; export interface AskUserAsyncWidgetOptions { request: QuestionRequest; draft: QuestionDraft; /** Idle countdown shown in the line; 0 disables it. */ timeoutMs: number; getDeadlineAtMs?: () => number; pendingCount?: number; tui?: TUI; onExpire: () => void; mouseCaptureActive?: boolean; onOptionClick?: (optionIndex: number) => void; onOwnAnswerClick?: () => void; onExpandClick?: () => void; onNextQuestion?: () => void; } export declare class AskUserAsyncWidget implements Component { private readonly request; private readonly draft; private readonly countdown; private readonly pendingCount; private countdownLabel; private hits; private renderedWidth; private readonly options; constructor(options: AskUserAsyncWidgetOptions); dispose(): void; invalidate(): void; private update; render(width: number): string[]; handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined; } export {}; //# sourceMappingURL=ask-user-async-widget.d.ts.map