kestrel.markets
Version:
A typed, token-efficient language + runtime for agentic trading: agents author bounded plans, the runtime fires them at the tick. CLI + typed library + MCP server.
113 lines • 4.75 kB
TypeScript
/**
* # frame/refusals — the CLOSED refusal-constructor union for the inflection path (ADR-0041 §1/§3)
*
* Every {@link KernelHonestyError} the inflection path throws is now a TYPED constructor here, one
* per refusal kind. The message is GENERATED from the constructor — never hand-written at a throw
* site — so each refusal kind has ONE canonical printed form (golden-tested in
* `tests/frame.refusal-constructors.test.ts`), and "refused" is never one undifferentiated
* condition: every message names the rung it failed on (ADR-0041 §3's judgment ladder) plus the
* pane / slot / sort / value the fix must address.
*
* The canonical forms are BYTE-IDENTICAL to Train 1A's inline strings ({@link ./pane-catalog.ts},
* kestrel-wa0j.24) — this train relocates the message construction into the constructor without
* changing a byte, so no existing refusal fixture re-pins.
*
* Cell-state citations (ADR-0041 §3): a LATENT refusal names its train, PULLED FROM THE LEDGER
* ({@link ./paradigm-ledger.ts} — the single source, so the burn-down and the refusal quote the same
* string); a DEFECTIVE refusal names its written reason + its sanctioned periphrasis.
*
* Import discipline: this module imports the arg/slot TYPES from `./pane-catalog.ts` type-only (erased
* at runtime), and `./pane-catalog.ts` imports {@link paneRefusal} as a value — so the only runtime
* edge is pane-catalog → refusals (no cycle).
*/
import { KernelHonestyError } from "./types.ts";
import type { PaneSelectionArg, ParamSlot } from "./pane-catalog.ts";
/**
* The CLOSED union of refusal kinds on the inflection path (ADR-0041 §1/§3). One member per refusal
* kind; {@link paneRefusal} maps each to its ONE canonical {@link KernelHonestyError} message.
*/
export type PaneRefusal = {
readonly kind: "unknown-pane";
readonly view: string;
readonly pane: string;
readonly known: readonly string[];
} | {
readonly kind: "takes-no-args";
readonly view: string;
readonly pane: string;
readonly args: readonly PaneSelectionArg[];
} | {
readonly kind: "no-signature";
readonly pane: string;
readonly args: readonly PaneSelectionArg[];
} | {
readonly kind: "arity";
readonly pane: string;
readonly args: readonly PaneSelectionArg[];
readonly slots: readonly ParamSlot[];
} | {
readonly kind: "sort-mismatch";
readonly pane: string;
readonly slot: ParamSlot;
readonly arg: PaneSelectionArg;
} | {
readonly kind: "count-not-integer";
readonly pane: string;
readonly slot: ParamSlot;
readonly arg: PaneSelectionArg;
} | {
readonly kind: "ordinal-not-nonneg-integer";
readonly pane: string;
readonly slot: ParamSlot;
readonly arg: PaneSelectionArg;
} | {
readonly kind: "window-not-servable";
readonly pane: string;
readonly arg: PaneSelectionArg;
readonly servedBucketMin: number;
} | {
readonly kind: "unknown-value-naming-roster";
readonly pane: string;
readonly slot: string;
readonly value: string;
readonly roster: readonly string[];
} | {
readonly kind: "latent-cell";
readonly pane: string;
readonly form: string;
} | {
readonly kind: "defective-cell";
readonly pane: string;
readonly form: string;
readonly reason: string;
readonly periphrasis: string;
readonly conditioning?: string;
} | {
readonly kind: "over-budget";
readonly view: string;
readonly paneIds: readonly string[];
readonly spent: number;
readonly tokenizer: string;
readonly budget: number;
} | {
readonly kind: "unreachable-bound-arg";
readonly pane: string;
readonly expected: string;
readonly args: readonly PaneSelectionArg[];
} | {
readonly kind: "unreachable-not-catalogued";
readonly pane: string;
} | {
readonly kind: "unreachable-args-on-argless";
readonly pane: string;
readonly args: readonly PaneSelectionArg[];
};
/** The refusal kinds, as a closed roster (for exhaustiveness tests). */
export declare const PANE_REFUSAL_KINDS: readonly ["unknown-pane", "takes-no-args", "no-signature", "arity", "sort-mismatch", "count-not-integer", "ordinal-not-nonneg-integer", "window-not-servable", "unknown-value-naming-roster", "latent-cell", "defective-cell", "over-budget", "unreachable-bound-arg", "unreachable-not-catalogued", "unreachable-args-on-argless"];
/**
* Construct the ONE canonical {@link KernelHonestyError} for a refusal (ADR-0041 §1/§3). The message
* is generated HERE from `r`'s fields — never hand-written at the throw site. Exhaustive over the
* closed {@link PaneRefusal} union.
*/
export declare function paneRefusal(r: PaneRefusal): KernelHonestyError;
//# sourceMappingURL=refusals.d.ts.map