/** * Pure helpers for the daemon's `POST /api/asks` IPC route. * * Kept separate from daemon.ts so the body-validator is unit-testable without * spinning up an HTTP server, registering bots, or mounting a full session map. */ import type { AskQuestion } from './ask-types.js'; export interface AskApiBody { sessionId: string; chatId: string; larkAppId: string; rootMessageId: string | null; /** v0.1.8:替换旧的 options/prompt,支持多问多选。 */ questions: AskQuestion[]; /** Already in milliseconds. CLI side converts from `--timeout` seconds. */ timeoutMs: number; /** Per-invocation identity (hook generates once, reuses across reconnect * retries) so a re-POST after a daemon restart re-attaches to the same ask. * Optional — legacy callers omit it and the broker synthesizes one. */ requestId?: string; /** Caller kind ('hook' | 'explicit' | …) namespacing the identity so an * explicit `botmux ask` can't re-claim a hook ask's card. Optional. */ originKind?: string; } export type AskApiBodyError = 'bad_body' | 'bad_sessionId' | 'bad_chatId' | 'bad_larkAppId' | 'bad_rootMessageId' | 'bad_prompt' | 'bad_timeoutMs' | 'bad_options' | 'bad_option_shape' | 'bad_option_key' | 'bad_option_label' | 'duplicate_option_key' | 'bad_questions' | 'bad_question_shape' | 'bad_multiSelect' | 'bad_requestId' | 'bad_originKind'; /** Validate the request body. Returns either the parsed body or an error code * ready to be sent back as `{ ok: false, error }` with HTTP 400. * * v0.1.8: * - 优先识别 `questions[]` 新格式(多问多选)。 * - 兼容旧的 `options[]` + `prompt` 格式,归一化为单问单选的 questions[]。 * - 两者都没有则返回 `bad_options`。 */ export declare function parseAskBody(raw: unknown): AskApiBody | { error: AskApiBodyError; }; //# sourceMappingURL=ask-api.d.ts.map