@sema-agent/core
Version:
Stateless, task-oriented AI agent core
22 lines (21 loc) • 1.53 kB
TypeScript
/** The integers an option takes, both ends included. */
export interface IntegerRange {
readonly min: number;
readonly max: number;
}
/** Every whole number a double holds exactly, from 0: the range of a count or a size. */
export declare const NON_NEGATIVE_SAFE_INTEGER: IntegerRange;
/** The milliseconds an interval timer takes: `1..{@link MAX_TIMER_DELAY_MS}`. Node reads a zero, a negative, a non-number or a longer
* delay as 1 ms and truncates a fractional one — an interval set to a 1 ms delay runs back to back — so an interval option refuses every value outside it. */
export declare const TIMER_DELAY_MS: IntegerRange;
/**
* The ONE reading of a whole-number option of a constructor: absent is the option's own default (`undefined`), a number that is an
* integer inside `range` is itself, and anything else — a fractional, an infinite, a NaN, an out-of-range number, a value that is no
* number — refuses (`config.invalid_argument`) rather than being read as "off" or as a neighbouring value. A number is spelled in the
* sentence; any other value is named by its type only, so a refusal never repeats text the caller handed over.
*
* @param name the option as the refusal names it (`Owner.option`)
* @param unit what the number counts (`milliseconds`, `characters`)
* @param absent what omitting the option means, as the sentence's way out
*/
export declare function readIntegerOption(name: string, value: unknown, range: IntegerRange, unit: string, absent: string): number | undefined;