/** Optional inclusive `[min, max]` clamp applied after a write. Omit an edge for unbounded. */ export interface NumericBounds { readonly min?: number; readonly max?: number; } /** Clamp a scalar to `bounds` (identity when `bounds` is omitted). Pure — touches no record. */ export declare function clampValue(value: number, bounds?: NumericBounds): number; /** Current value for `key`, or `fallback` (default `0`) when the record has no entry. */ export declare function getValue(record: Record, key: string, fallback?: number): number; /** * Set `key` to `value` (clamped to `bounds`), writing the record in place. Returns the stored value. * * @capability set a bounded keyed value in a caller-owned serializable record */ export declare function setValue(record: Record, key: string, value: number, bounds?: NumericBounds): number; /** Add `delta` to `key` (clamped to `bounds`), writing the record in place. Returns the stored value. */ export declare function addValue(record: Record, key: string, delta: number, bounds?: NumericBounds): number; /** * Step `key` toward `target` by at most `maxDelta` without overshooting, then clamp * to `bounds`. Writes in place and returns the stored value. * * @capability move a keyed value toward a target by a bounded step */ export declare function towardValue(record: Record, key: string, target: number, maxDelta: number, bounds?: NumericBounds): number; /** * Decay `key` toward a `rest` value (default `0`) by `rate` per call — the common * "relationships cool off" / "heat fades" drift. Thin wrapper over {@link towardValue}. */ export declare function driftValue(record: Record, key: string, rate: number, rest?: number, bounds?: NumericBounds): number; /** Canonicalizes a two-part relation identity into a single delimiter-safe record key. */ export interface PairKeyCodec { /** `true` when order matters (a→b differs from b→a); `false` sorts the pair first. */ readonly directed: boolean; /** Encode a pair into one record key. Undirected codecs canonicalize by sorting the two ids. */ key(a: string, b: string): string; /** Recover the pair from a key. Undirected keys come back in canonical (sorted) order. */ parse(key: string): [string, string]; } /** Direction and delimiter policy for {@link createPairKeyCodec}. */ export interface PairKeyOptions { /** `true` for ordered relations (rivalry-from, owes-to); default `false` (mutual). */ readonly directed?: boolean; /** Single-character delimiter between encoded ids (default `"|"`). Collisions are escaped, not forbidden. */ readonly separator?: string; } /** * Build a pair-key codec for keyed relation values. Ids are escaped before joining, * so any id (including ones containing the separator or a backslash) round-trips * through {@link PairKeyCodec.key} → {@link PairKeyCodec.parse} without collision. * Undirected codecs (the default) canonicalize so `key(a, b) === key(b, a)`. * * @capability build a serializable directed/undirected pair key that resists delimiter collisions */ export declare function createPairKeyCodec(options?: PairKeyOptions): PairKeyCodec;