@sema-agent/core
Version:
Stateless, task-oriented AI agent core
21 lines (20 loc) • 2.05 kB
TypeScript
/** The configuration directory's name below a home: the one segment the deny tables spell the agent's own settings under. */
export declare const AGENT_CONFIG_DIR_SEGMENT = ".sema";
/** The code a declared root that names no directory is refused with, wherever it is declared. */
export declare const AGENT_CONFIG_DIR_INVALID_CODE = "config.agent_config_dir_invalid";
/** A run (the `/`-separated segments of a deny row, home word already removed) read below the configuration directory:
* `.sema/settings.json` ⇒ `settings.json`, `.sema` ⇒ `""`, and `undefined` for a run that does not open with the
* directory's name. The first segment is compared as the row compares it (ASCII-case-insensitive unless the row opts out).
*
* @contract agent_config_dir.one_reading — which rows a declared configuration root relocates is decided HERE and nowhere
* else: a row that opens with the `.sema` segment names its tail below the root, in the read placement, in the always-on
* write-protection table and in the opt-in deny set alike; the root adds a place and never moves the default one, a row that
* does not open with that segment keeps its place, and a face with a list of its own of "the rows that relocate" is a fork
* of this sentence, not a variant of it. */
export declare function agentConfigDirTail(run: string, caseSensitive?: boolean): string | undefined;
/** The segments of a declared root in lexical normal form — what a path's leading segments are compared with. */
export declare function agentConfigDirSegments(dir: string): string[];
/** The declared configuration root as given (`undefined` = none declared, the default location), or a refusal naming the
* seat and the shape of the value: not a string, empty, not absolute, no such directory, not a directory, not readable.
* The directory is looked at on the host's own file system — the host that declares the root is the host that keeps it. */
export declare function checkedAgentConfigDir(value: string | undefined, seat: string): string | undefined;