@sema-agent/core
Version:
Stateless, task-oriented AI agent core
84 lines (83 loc) • 8.02 kB
TypeScript
/** 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;
/** The refusal {@link assertNoRetiredKeys} throws for a hit — the one sentence and code, for a caller that has to read the bag
* itself (to tell a refusal from a member that cannot be read) and must not read it a second time. */
export declare function retiredKeyRefusal(hit: {
key: string;
replacement: string;
}, owner: string): Error & {
code: string;
};
/** 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's one read judges
* (`readCallerSpec`, over the values it took: {@link retiredKeyOf}, 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. Each retired row has ONE reader: a row inside a seat that is read once by its own reader lives in that
* seat's table ({@link RETIRED_SKILLS_SEAT_KEYS}), so the spec's read never reads into the seat a second time. */
export declare const RETIRED_TASK_SPEC_KEYS: Readonly<Record<string, string>>;
/** The RETIRED `TaskSpec.skills` rows — the table the skills seat's one reader (`readSkillsSeat`) judges over its one read of
* the seat, owner `TaskSpec` (same code, same `TaskSpec.skills[].…` sentence). Kept out of {@link RETIRED_TASK_SPEC_KEYS}:
* the spec's read judging these rows would read into the caller's `skills` entries before the seat's reader does. */
export declare const RETIRED_SKILLS_SEAT_KEYS: Readonly<Record<string, string>>;
/** The RETIRED member of every bag that carries the compaction seats — a task's `compaction`, a `Runner.compactSession`
* request's `compaction`, a deployment's `contextSettings` overlay — keyed relative to the bag. The table the seats' one
* judgment reads (`compactionSeatsDefect`, `context-settings.ts`), each door with its own owner and code. Kept out of
* {@link RETIRED_TASK_SPEC_KEYS} for the reason the skills rows are: the seats have their own reader. */
export declare const RETIRED_COMPACTION_SEAT_KEYS: Readonly<Record<string, string>>;
/** The RETIRED members of a `Runner.compactSession` request — refused by name at its request door (`compact.invalid_request`,
* the door's own code) with the sentence that names the replacement. */
export declare const RETIRED_COMPACT_SESSION_KEYS: Readonly<Record<string, string>>;
/** The RETIRED members of `maybeCompact`'s options — refused by name (`config.deps_retired_key`) before the pass reads anything. */
export declare const RETIRED_MAYBE_COMPACT_KEYS: Readonly<Record<string, string>>;
/** The RETIRED members of `TaskSpec.instructionFamily`, keyed relative to the family — the table the family's one reader
* (`screenNestedMemory`) judges over its one read of the declaration, refusing as `TaskSpec.instructionFamily.<key>`
* (`config.spec_retired_key`). Kept out of {@link RETIRED_TASK_SPEC_KEYS} for the reason the skills rows are. */
export declare const RETIRED_INSTRUCTION_FAMILY_KEYS: Readonly<Record<string, string>>;
/** The RETIRED `ToolSpec` members — a spec still carrying one is refused by name (`config.deps_retired_key`) where the
* factory reads the spec, never dropped unseen: a description the author wrote for one prompt shape would silently
* never be shown. */
export declare const RETIRED_TOOL_SPEC_KEYS: Readonly<Record<string, string>>;
/** The RETIRED {@link import("../engine/llm/types.js").Model} members — a model still carrying one is refused by name
* (`config.deps_retired_key`) at the model door, never read as absence: text a deployment believes it appended would
* silently not reach the model. */
export declare const RETIRED_MODEL_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;