/** * The 402 body both spending lanes get from api-server, and the sentence it * turns into. * * `api-server/src/cli/spark-refusal.ts` builds exactly this shape for the asset * lane and the forge lane alike, so the two CLI stream readers share one reader * rather than each inventing a dialect. * * There are two refusals behind one status code and they ask the creator to do * OPPOSITE things — buy sparks, or allow the ones they already have to be spent * — so telling them apart is the whole job here. */ /** Every field is optional on the wire: an older api-server sends only `error`. */ export interface SparkRefusalBody { error?: unknown; code?: unknown; balance?: unknown; required?: unknown; } /** * PURE. Whether this 402 means "the money exists but you have not agreed to * spend it", as opposed to "there is not enough money". */ export declare function isSpillConsentRefusal(body: SparkRefusalBody): boolean; /** * The `CliError.code` a 402 is filed under in the usage report. * * Classified HERE rather than at the four throw sites, for the reason * `errors.ts` states: one line classifies a whole family, and a per-site * decision is a per-site chance to forget. Without it both spending lanes * reported the generic `cli_error` — hiding the ONE refusal family with a * specific remedy (`bitmagic allowance --allow-sparks`) behind the same bucket * as everything else, while the 403 Pro refusal beside it was fully labelled. */ export declare function sparkRefusalCode(body: SparkRefusalBody): 'pro_spill_consent_required' | 'insufficient_sparks'; /** * PURE. What to tell the creator — or, far more often, the agent working for * them — when the allowance is spent and the spark balance is not authorised. * * Names `bitmagic allowance` rather than quoting a reset time: the command * prints both windows and their resets, and one place to look beats a countdown * baked into an error. The accept is deliberately described as something a * person does, because `--allow-sparks` refuses to run without a terminal. */ export declare function spillConsentMessage(action: string): string;