import type { SessionEntry, SessionManager } from "@caupulican/pi-agent-core/node"; import type { ImageContent } from "@caupulican/pi-ai"; import type { ArtifactStore } from "./context/context-artifacts.ts"; import type { ContextArtifactRef } from "./context/context-item.ts"; import type { SessionImageStore } from "./session-image-store.ts"; import { type SessionBranchEntrySource } from "./session-snapshot.ts"; export declare const HUMAN_INPUT_CUSTOM_TYPE = "human_input_request"; export declare const HUMAN_INPUT_WORKER_RESPONSE_CUSTOM_TYPE = "worker-owner-response"; export declare const HUMAN_INPUT_INLINE_BYTES: number; export interface HumanInputOption { label: string; description: string; } export interface HumanInputQuestion { id: string; header: string; question: string; options: readonly HumanInputOption[]; multiSelect?: boolean; } export interface HumanInputAnswerImage { label: string; mimeType: string; } export interface HumanInputAnswer { id: string; header: string; question: string; selected: readonly string[]; /** Inline answer, or a bounded preview when customArtifact is present. */ custom?: string; /** Exact full answer retained out of prompt context when it exceeds the inline bound. */ customArtifact?: ContextArtifactRef; images?: readonly HumanInputAnswerImage[]; skipped: boolean; } export type HumanInputStopReason = "user_cancelled" | "ui_unavailable" | "interrupted" | "invalid_questions"; export interface HumanInputPresentationRequest { requestId: string; questions: readonly HumanInputQuestion[]; acceptsImages: boolean; } export interface HumanInputPresentationResult { answers: readonly HumanInputAnswer[]; cancelled: boolean; reason?: HumanInputStopReason; imageContents: readonly ImageContent[]; } export type HumanInputSource = "tool" | "worker"; export interface HumanInputRequest { requestId: string; source: HumanInputSource; toolCallId?: string; toolName?: string; workerRequestId?: string; questions: readonly HumanInputQuestion[]; acceptsImages: boolean; createdAt: string; } export type HumanInputStatus = "pending" | "answered" | "cancelled"; export interface HumanInputSnapshot { request: HumanInputRequest; status: HumanInputStatus; answers: readonly HumanInputAnswer[]; reason?: HumanInputStopReason; updatedAt: string; } export interface HumanInputRequestOptions { source: HumanInputSource; toolCallId?: string; toolName?: string; workerRequestId?: string; questions: readonly HumanInputQuestion[]; acceptsImages: boolean; now?: () => string; } export interface ResolveHumanInputOptions { sessionManager: Pick; request: HumanInputRequest; present: (request: HumanInputPresentationRequest, options?: { signal?: AbortSignal; }) => Promise; artifactStore?: ArtifactStore; getImageStore?: () => Pick | undefined; signal?: AbortSignal; now?: () => string; } export declare function createHumanInputRequest(options: HumanInputRequestOptions): HumanInputRequest; export declare function appendHumanInputSnapshot(sessionManager: Pick, snapshot: HumanInputSnapshot): string; export declare function beginHumanInputRequest(sessionManager: Pick, request: HumanInputRequest): HumanInputSnapshot; export declare function getHumanInputSnapshots(entries: readonly SessionEntry[]): HumanInputSnapshot[]; export declare function getLatestHumanInputSnapshots(source: SessionBranchEntrySource): HumanInputSnapshot[]; /** Incremental active-branch projection for worker questions that still need context-visible delivery. */ export declare class WorkerHumanInputProjection { private readonly knownWorkerRequestIds; private readonly deliveredInputRequestIds; private readonly workerRequestIdByInputRequestId; private readonly requiringDelivery; reset(entries: readonly SessionEntry[]): void; apply(entry: SessionEntry): void; hasKnownWorkerRequest(workerRequestId: string): boolean; requiresDelivery(workerRequestId: string): boolean; getRequiringDelivery(): HumanInputSnapshot[]; } export declare function getWorkerHumanInputsRequiringDelivery(source: SessionBranchEntrySource): HumanInputSnapshot[]; export declare function getResumableHumanInputSnapshot(source: SessionBranchEntrySource): HumanInputSnapshot | undefined; export declare function resolveHumanInput(options: ResolveHumanInputOptions): Promise<{ snapshot: HumanInputSnapshot; imageContents: readonly ImageContent[]; }>; export declare function formatHumanInputAnswerText(snapshot: HumanInputSnapshot): string; //# sourceMappingURL=human-input.d.ts.map