UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

35 lines (34 loc) • 2.33 kB
/** The kinds of entry that did not apply — `detail.kind` of `config.entries_not_applied`. */ export declare const ENTRIES_NOT_APPLIED_KINDS: readonly ["stored_rule_row", "rule_text_unreadable", "mcp_injection_dropped", "model_word_unknown", "allow_entry_inert", "session_rule_unread", "session_rule_named_no_tool", "setting_not_applied"]; export type EntriesNotAppliedKind = (typeof ENTRIES_NOT_APPLIED_KINDS)[number]; /** How many entries a frame lists; `count` counts every one. */ export declare const ENTRIES_NOT_APPLIED_SHOWN = 8; /** A member of a listed entry: words, counts and flags, or lists and plain records of them — never a collection object. */ export type EntryMember = string | number | boolean | null | undefined | readonly EntryMember[] | { readonly [key: string]: EntryMember; }; /** One entry as a frame lists it: what the person wrote, and the kind's own members. */ export type EntryNotApplied = { readonly entry: string; } & { readonly [key: string]: EntryMember; }; /** Detail shape minted by {@link entriesNotAppliedDetail}. `entries` lists at most {@link ENTRIES_NOT_APPLIED_SHOWN} entries * ordered severest-first ({@link orderEntriesBySeverity}); `count` counts all entries; `identity` digests the full set. */ export interface EntriesNotAppliedDetail { readonly kind: EntriesNotAppliedKind; readonly entries: EntryNotApplied[]; readonly count: number; readonly identity: string; /** Per-reason totals across the full entry set. Present iff the list was cut (`count > ENTRIES_NOT_APPLIED_SHOWN`) and at least one entry carries a string `reason`. */ readonly reasonCounts?: Readonly<Record<string, number>>; } /** Stable severest-first ordering shared by {@link entriesNotAppliedDetail} and message renderers so the sentence and * `detail.entries` surface the same high-severity entries when a list is cut. */ export declare function orderEntriesBySeverity<T extends { readonly entry?: unknown; readonly reason?: unknown; readonly behavior?: unknown; }>(all: readonly T[]): T[]; /** The `kind`, `entries`, `count`, `identity` (and cut-only `reasonCounts`) members of one frame over every entry of the kind. */ export declare function entriesNotAppliedDetail(kind: EntriesNotAppliedKind, all: readonly EntryNotApplied[]): EntriesNotAppliedDetail;