@sema-agent/core
Version:
Stateless, task-oriented AI agent core
59 lines (58 loc) • 5.64 kB
TypeScript
/**
* ONE presence rule for a RETIRED key on a caller-supplied bag (a deps object, an options object): the key is
* PRESENT iff ordinary property lookup answers a defined value — prototype and non-enumerable members included,
* exactly what the former direct read of the seat honored; an explicit `undefined` reads as absence, as every
* optional seat reads. Every retired-key door reads through here so no door grows its own idea of "present";
* each composes its own refusal from the answer. A table row is `{ key: replacement }` — the sentence that says
* what replaced the seat, quoted in the refusal. A dotted key names a member of a member bag (`attachments.x`),
* read the same way one step at a time; a step that is not an object or a function holds nothing. A step spelled
* `name[]` names an array member and reads every element it holds (`skills[].manifest`: any element carrying it).
*/
/** The first retired key present on `bag`, in table order, or undefined when none is. */
export declare function retiredKeyOf(bag: object, table: Readonly<Record<string, string>>): {
key: string;
replacement: string;
} | undefined;
/**
* The retired-key door: a retired seat still wired by a deployment is refused BY NAME (`config.deps_retired_key`
* on a deps bag, `config.spec_retired_key` on a `TaskSpec`) instead of vanishing silently — a seat that is silently
* dropped reads to the caller as wired. `owner` is the bag's type name for the sentence (`RunnerDeps`,
* `RunWorkflowToolDeps`, `TaskSpec`).
*/
export declare function assertNoRetiredKeys(bag: object, table: Readonly<Record<string, string>>, owner: string): void;
/** What replaced the `hooks` record, on a deps bag and on a `TaskSpec` alike: one seat name, one sentence, quoted by both
* tables (this one and `runner/retired-runner-deps.ts`). The record's callbacks never run, so a deny one carried would pass
* unseen — the key is refused by name instead. */
export declare const RETIRED_HOOKS_REPLACEMENT = "the callback seats are `mods` registrations now \u2014 register the extension on `RunnerDeps.mods` (a deployment's) or `TaskSpec.mods` (a task's), hung on the `classic.*` events (`classic.PreToolUse`, `classic.PostToolUse`, `classic.PostToolBatch`, `classic.UserPromptSubmit`, `classic.Stop`, `classic.SubagentStop`, \u2026); a callback that denied is a handler answering `{ action: \"deny\", message }`";
/** The RETIRED `TaskSpec` keys, each with the sentence that names its replacement — the table the spec door reads
* ({@link assertNoRetiredKeys} with owner `TaskSpec`). A caller still writing one of these is refused by name
* (`config.spec_retired_key`), never read as absence: a mode a caller believes it declared must not silently run
* as another. */
export declare const RETIRED_TASK_SPEC_KEYS: Readonly<Record<string, string>>;
/** The RETIRED `ToolPolicy` members — a policy still carrying one is refused by name (`config.deps_retired_key`) wherever
* the engine reads a policy's members: the intake of the caller's policy (prepare, and a resume before its claim), the
* by-name member reader the wrap and the path-rule installation share, and `combinePolicies`. A member the policy no
* longer declares is dropped by every one of them, so a guard stated in it would read as stated while guarding nothing. */
export declare const RETIRED_TOOL_POLICY_KEYS: Readonly<Record<string, string>>;
/** The RETIRED `ShellReadBoundary` members — a boundary a consumer hands to `judgeShellRead` that still carries one is
* refused by name (`config.deps_retired_key`); the station reads one write seat, so a retired one would leave every write
* target unjudged by its rows. (The engine's own station builds its boundaries itself.) */
export declare const RETIRED_SHELL_READ_BOUNDARY_KEYS: Readonly<Record<string, string>>;
/** The RETIRED members of a permission DECISION (`PermissionResult`, a PreToolUse hook's result), each with the sentence that
* names its replacement — the table the decision receipt reads ({@link import("./tool-policy.js").refuseOutOfContractDecision}).
* That door does not use {@link retiredKeyOf}: a decision is caller-supplied data the receipt reads by descriptor without
* running a getter, so a name is retired when the decision carries it by the receipt's presence law (its own descriptor, or a
* non-absent one on its prototype chain; a data value of `undefined` is absence). A
* decision that carries one is denied in the engine's own words, never read without it: the type retires a member only where
* a decision is a literal in an annotated position, and a `check` whose return type is inferred still compiles with it. */
export declare const RETIRED_DECISION_MEMBERS: Readonly<Record<string, string>>;
/**
* The `ToolPolicy` door — every policy the engine installs passes it (a task's or deployment's seat, a combined member, an inherited
* constraint): `undefined` (or `null`, the seat's other absence spelling) is no policy; a value that is not an object whose `check`
* is a function is no policy either, and refuses by name (`config.invalid_argument`, `detail.field: "ToolPolicy"`) — a policy the
* engine cannot call is never installed as if it were absent, which would run the leg with nothing the deployment meant to apply;
* a retired member refuses by name ({@link RETIRED_TOOL_POLICY_KEYS}).
*/
export declare function assertNoRetiredToolPolicyKeys(policy: unknown): void;
/** The `ShellReadBoundary` door ({@link RETIRED_SHELL_READ_BOUNDARY_KEYS}). */
export declare function assertNoRetiredShellReadBoundaryKeys(boundary: object): void;