UNPKG

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.

36 lines 2.13 kB
/** * # series/types — the value model of the series layer (RUNTIME §2–§3) * * Two small, load-bearing types and the units bridge shared by every file in this module. * * - {@link UNKNOWN} — the single sentinel for "insufficient data / unresolvable". It is a * value, distinct from `false`: a series with too little history reads UNKNOWN, never a * guess (RUNTIME §2), and a trigger over an UNKNOWN operand evaluates UNKNOWN, never * silently false (RUNTIME §3). Only a definite `true` fires. * - {@link Resolved} — what a series resolves to: a `number` (a market/org scalar), a * `string` (a symbolic state value like a plan-state or regime tag), or {@link UNKNOWN}. * - {@link TriState} — the result of evaluating a trigger: `true | false | UNKNOWN`. * * All time is injected (RUNTIME §0): {@link durationMs} is the one place a `Window` or * `Duration` value+unit is turned into milliseconds, so every window/held/within/esc span * measures identically. */ import type { TimeUnit } from "../lang/index.ts"; /** The sole "insufficient data / unresolvable" sentinel. A unique symbol so it can never * be confused with a real string value, a `0`, or a `false`. */ export declare const UNKNOWN: unique symbol; export type Unknown = typeof UNKNOWN; /** A concrete series value: a numeric market/org scalar, or a symbolic state string * (a plan-state literal like `armed`, a regime tag value). */ export type SeriesValue = number | string; /** What {@link import("./provider.ts").SeriesProvider.resolve} returns. */ export type Resolved = SeriesValue | Unknown; /** The tri-state result of a trigger evaluation (RUNTIME §3). Only `true` fires. */ export type TriState = boolean | Unknown; /** Is `x` the UNKNOWN sentinel? */ export declare function isUnknown(x: unknown): x is Unknown; /** Is `x` a resolved *number* (not a string, not UNKNOWN)? */ export declare function isNumber(x: Resolved): x is number; /** Convert a `{ value, unit }` window/duration to milliseconds. */ export declare function durationMs(value: number, unit: TimeUnit): number; //# sourceMappingURL=types.d.ts.map