/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { IHumanConnector, IHumanRequest, IHumanResponse } from "@workglow/util"; import { type PromptFieldDescriptor } from "../input/prompt"; import type { RefusableFormOutcome } from "./render"; /** * The prompts this connector draws, injectable so the mapping can be exercised * without a terminal — and so a host with its own prompt stack can supply it. */ export interface PromptHumanRenderers { readonly select: (options: ReadonlyArray<{ label: string; value: string; }>, message: string | undefined, signal: AbortSignal) => Promise; /** * A form that can also be refused. The three outcomes are distinct answers — * see {@link RefusableFormOutcome} — so a host supplying its own prompt stack * has to say which one happened rather than collapsing a refusal into a * missing value. */ readonly form: (fields: readonly PromptFieldDescriptor[], signal: AbortSignal) => Promise; readonly notice: (lines: readonly string[]) => void; } /** * The terminal connector for anything that is NOT inside the Ink run UI. * * {@link InkHumanConnector} hands a request to a mounted * {@link HumanInteractionHost} and throws when there is none — right for a * command whose whole life is one graph run, and useless to anything that * prompts between runs rather than during one. This draws its own prompt for * the length of the question and takes the screen back afterwards, so a * transcript printed around it survives. * * What each request is asking is decided by {@link humanPromptModel}, the same * function the Ink panel and the web console read, so the three cannot disagree * about whether something is a form or an approval — the case that matters, * since a confirm drawn as a form leaves a person no way to say no. * * There is deliberately no `followUp`: a modal prompt settles the question it * asked, so no response is ever `done: false` and there is no partial answer for * a follow-up to continue. Declaring one that just asked again would report a * multi-turn conversation this surface cannot hold. */ export declare class PromptHumanConnector implements IHumanConnector { private readonly renderers; constructor(renderers?: PromptHumanRenderers); send(request: IHumanRequest, signal: AbortSignal): Promise; }