/** * Pure helpers for `botmux ask` argument parsing. * * Kept in its own file (no I/O, no env reads) so the CSV / timeout parsing can * be unit-tested without spinning up a daemon. The actual CLI dispatch * (`cmdAsk`) lives in cli.ts and calls these helpers. */ import type { AskOption } from './ask-types.js'; export declare class AskArgsError extends Error { readonly code: 'options_missing' | 'options_too_few' | 'options_empty_key' | 'options_duplicate_key' | 'timeout_out_of_range' | 'timeout_not_number'; constructor(code: 'options_missing' | 'options_too_few' | 'options_empty_key' | 'options_duplicate_key' | 'timeout_out_of_range' | 'timeout_not_number', message: string); } /** Parse `--options` CSV. Each item is either `key` (key==label) or `key=label`. * * Rules: * - Trims whitespace around each item and around `key=label` halves. * - Drops empty items (trailing commas / `"a,,b"`); does not count them. * - Requires ≥ 2 distinct keys after parsing. * - Empty `key` (e.g. `"=label"`) is rejected. * - Duplicate keys are rejected — let the caller surface a clear error rather * than silently de-duping (which would change observable button count). * - The first `=` splits key/label; subsequent `=` are part of the label, so * `"go=继续=右"` → key=`go`, label=`继续=右`. */ export declare function parseAskOptions(raw: string | undefined): AskOption[]; /** Parse `--timeout ` → milliseconds. Bounds match §7: * - lower bound: 10s (sub-10s asks are almost always a bug) * - upper bound: 3600s (1h — past that, recovery should kick in v0.1.8) * - default: 300s (caller passes `undefined` to use it) */ export declare function parseAskTimeoutSeconds(raw: string | undefined, defaults?: { default: number; min: number; max: number; }): number; /** Resolve the `(sub, rest)` pair for `botmux ask`'s top-level dispatch. * * Input: positional args *after* the `ask` token. So for the user typing * `botmux ask buttons --options yes,no "prompt"` we get * `['buttons', '--options', 'yes,no', 'prompt']`; for the bare alias * `botmux ask --options yes,no "prompt"` we get * `['--options', 'yes,no', 'prompt']`. * * The first positional starting with `--` means the user skipped the * subcommand and went straight to flags — that's the bare-alias path; we * return `sub=''` and let `cmdAsk` apply its v0.1.7 `buttons` default. * Otherwise the first positional is the subcommand. */ export declare function normalizeAskDispatch(tail: ReadonlyArray): { sub: string; rest: string[]; }; /** Required env vars on the CLI side (§5). Returns the first missing one so * the caller can produce a single, specific error message. */ export declare function findMissingAskEnv(env: NodeJS.ProcessEnv): string | null; //# sourceMappingURL=ask-args.d.ts.map