export type GuidedQuestionType = "text-options" | "color-options" | "slider" | "file" | "freeform"; export interface GuidedQuestionOption { label: string; value: string; color?: string; icon?: string; description?: string; recommended?: boolean; /** Optional preview content (mockup, code snippet, or short comparison) * shown beneath the option to help the user compare choices. Mirrors the * `preview` field of Claude Code's AskUserQuestion options. */ preview?: string; } export interface GuidedQuestion { id: string; type: GuidedQuestionType; header?: string; question: string; description?: string; options?: GuidedQuestionOption[]; choices?: GuidedQuestionOption[]; multiSelect?: boolean; min?: number; max?: number; step?: number; required?: boolean; placeholder?: string; allowOther?: boolean; includeExplore?: boolean; includeDecide?: boolean; /** Submit immediately when a single-select option is clicked. */ submitOnSelect?: boolean; } export type GuidedQuestionAnswers = Record; export interface GuidedQuestionPayload { questions: GuidedQuestion[]; title?: string; description?: string; skipLabel?: string; submitLabel?: string; submitMessage?: string; skipMessage?: string; /** * @internal Set by {@link askUserQuestion} for client-initiated questions. * When present, `useGuidedQuestionFlow` resolves the matching in-memory * promise with the answer instead of forwarding it to the agent chat. */ clientResolveId?: string; } export declare function isOtherGuidedAnswer(value: unknown): value is string; export declare function getOtherGuidedAnswerText(value: unknown): string; export declare function makeOtherGuidedAnswer(text?: string): string; export declare function hasGuidedAnswer(value: unknown): boolean; export declare function formatGuidedAnswerValue(value: unknown): unknown; export declare function normalizeGuidedAnswers(answers: GuidedQuestionAnswers): GuidedQuestionAnswers; export declare function formatGuidedAnswersForAgent(answers: GuidedQuestionAnswers): string; /** A single option for {@link askUserQuestion}. Mirrors the agent `ask-question` * tool and Claude Code's AskUserQuestion option shape. */ export interface AskUserQuestionOption { /** Display text the user picks (1-5 words). */ label: string; /** Value reported back. Defaults to `label` when omitted. */ value?: string; /** Short explanation of the trade-off. */ description?: string; /** Optional preview (mockup, code snippet, short comparison) shown under the option. */ preview?: string; /** Mark the most likely option so the UI highlights it. */ recommended?: boolean; } /** Input for {@link askUserQuestion}. */ export interface AskUserQuestionInput { /** The complete question. Clear, specific, ends with a question mark. */ question: string; /** Optional very short chip/heading (≈12 chars), e.g. "Date range". */ header?: string; /** 2-4 distinct options (mutually exclusive unless `allowMultiple`). */ options: AskUserQuestionOption[]; /** Allow a free-text "Other" answer. Default `true`. */ allowFreeText?: boolean; /** Allow selecting more than one option (multi-select). Default `false`. */ allowMultiple?: boolean; /** Application-state key the agent panel polls. Default `"guided-questions"`. */ stateKey?: string; } /** The user's answer to an {@link askUserQuestion}: the selected option * value(s), the free-text "Other" string, or `null` if the user skipped. */ export type AskUserQuestionResult = string | string[] | null; /** * Ask the user a multiple-choice question from app code and render it inline in * the agent panel — the client-side twin of the agent's `ask-question` tool. * * The question is written to application state (`"guided-questions"` by * default), where the mounted `GuidedQuestionFlow` (driven by * {@link useGuidedQuestionFlow}) renders it, and the agent panel is revealed so * it's visible. **Resolves with the user's answer** — the selected option * value (or `value[]` when `allowMultiple`), the free-text "Other" string, or * `null` if they skip — so the caller can branch on it (e.g. build the right * generate prompt before kicking off agent work): * * ```ts * const length = await askUserQuestion({ * question: "How long should this deck be?", * header: "Deck length", * options: [{ label: "Short", recommended: true }, { label: "Long" }], * }); * if (length) sendToAgentChat({ message: `Make a ${length} deck`, submit: true }); * ``` * * Requires the agent panel (the mounted `GuidedQuestionFlow`) to exist, which * it does in every template. The returned promise stays pending until the user * answers or skips. */ export declare function askUserQuestion(input: AskUserQuestionInput): Promise; /** Stable content hash so poll refreshes do not reset in-progress answers. */ export declare function guidedQuestionsFingerprint(questions: GuidedQuestion[]): string; export interface GuidedQuestionFlowProps { questions: GuidedQuestion[]; onSubmit: (answers: GuidedQuestionAnswers) => void; onSkip: () => void; title?: string; description?: string; skipLabel?: string; submitLabel?: string; className?: string; } export declare function GuidedQuestionFlow({ questions, onSubmit, onSkip, title, description, skipLabel, submitLabel, className, }: GuidedQuestionFlowProps): import("react").JSX.Element; export interface UseGuidedQuestionFlowOptions { /** Disable application-state reads for signed-out or otherwise inactive surfaces. */ enabled?: boolean; stateKey?: string; /** * The current browser tab id. Agent actions that write the guided-questions * payload scope the application-state key per tab (`:`), so the * client must read the scoped key first and fall back to the bare key. Without * this, the question card never renders when the agent run carries a tab id * (which it almost always does — see `sessionBrowserTabId`). */ browserTabId?: string; queryKey?: readonly unknown[]; refetchInterval?: number | false; submitMessage?: string; skipMessage?: string; buildSubmitContext?: (args: { answers: GuidedQuestionAnswers; formattedAnswers: string; }) => string; buildSkipContext?: () => string; } export declare function useGuidedQuestionFlow({ enabled, stateKey, browserTabId, queryKey, refetchInterval, submitMessage, skipMessage, buildSubmitContext, buildSkipContext, }?: UseGuidedQuestionFlowOptions): { payload: GuidedQuestionPayload | null; questions: GuidedQuestion[] | null; title: string | undefined; description: string | undefined; skipLabel: string | undefined; submitLabel: string | undefined; clear: () => void; handleSubmit: (answers: GuidedQuestionAnswers) => void; handleSkip: () => void; }; //# sourceMappingURL=guided-questions.d.ts.map