UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

31 lines (30 loc) • 2.07 kB
/** * The one reading and the one snapshot of a host-written tool-name list (an agent definition's allowed-tools or denied-tools list, * a tool's alias list, a model-id list). The judge before the run, the spawn-time filter, the memory content-origin face and the * roster snapshot all meet a list through here, so a hostile container is answered once and the same way everywhere. */ /** A fixed label of a host value's TYPE for a sentence that must not print or convert the value (`typeof` and the array test only). */ export declare function valueTypeLabel(value: unknown): string; /** * How a tool-name list's VALUE (an agent definition's allowed-tools or denied-tools list) reads as a list. A host that reads its * definitions from a file can hand over anything, and a list can be hostile as a container (an accessor or a proxy trap that * throws, an overridden iterator, holes): it is read BY INDEX over its length, once, into a dense copy — no iterator of the host * runs, a hole reads as `undefined` (an entry that is not a string) — and a value that is not an array, or an array whose read * throws, is reported as such and never printed or converted. */ export type ToolNameListReading = { readonly kind: "entries"; readonly entries: readonly unknown[]; } | { readonly kind: "not_a_list"; readonly type: string; } | { readonly kind: "unreadable"; }; /** What the mount keeps of a list it could not read: one frozen marker, so the judgment and every later reader meet the same * failure and never read the host's container again (a list that throws once and answers afterwards must not pass the second look). */ export declare const UNREADABLE_LIST: object; export declare function readToolNameList(value: unknown): ToolNameListReading; /** A tool-name list as the mount keeps it: the dense copy when it reads as a list, the failure marker when it cannot be read, else * the value itself (not a list: the judge refuses it, and its type never changes). */ export declare function snapshotToolNameList(value: unknown): unknown;