UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

43 lines (42 loc) • 2.81 kB
/** * The engine's side of the mods bus's two outward faces: which registrations the two seats hold, the * notice an admission refusal becomes, and the sink that carries handler failures to `onError`. */ import type { EngineNotice } from "../engine-notice.js"; import type { RunnerDeps } from "../runner-deps.js"; import type { TaskSpec } from "../task-spec.js"; import { type ModAdmissionRecord, type ModBusInput, type ModSeats } from "./kernel/index.js"; import type { SkillSpec } from "../agent-definition.js"; import type { EngineDollar } from "./dollar.js"; import { type SkillSeats } from "./spec-seats.js"; /** * The two seats, both kept: the deployment's (`RunnerDeps.mods`) and the task's (`TaskSpec.mods`). Neither overrides the other. * (A retired `hooks` key on either is not read here: it is refused by name at the retired-key doors, where every other * retired seat is — `retired-keys.ts`.) */ export declare function modSeatsOf(spec: Pick<TaskSpec, "mods">, deps: Pick<RunnerDeps, "mods">): ModSeats<EngineDollar>; /** Handler failures land on the deployment's `onError` with `phase: "hook"`; a throwing sink is swallowed. */ export declare function modsReportToOnError(onError: RunnerDeps["onError"], sessionId: string): ModBusInput["report"]; type RefusedRecord = Extract<ModAdmissionRecord, { readonly refusedBy: string; }>; /** The notice for a registration admission refused: the run goes on without it. A task-seat registration (a skill's included) * is the person's fact; a deployment-seat one is the operator's, under its own code — one fact, one code, one audience. */ export declare function registrationRefusedNotice(record: RefusedRecord, sessionId: string): EngineNotice; /** A leg's registrations as its admission takes them: both seats, and the skills' registrations riding the task seat after the * task's own (same screen, unique names in the run). Listed ONCE per leg — read before the leg's environment exists (whether * a registration declares a method that runs on it) and handed to the admission as it was read. */ export interface LegModSeats { /** The two seats as the leg declares them (`RunnerDeps.mods`, `TaskSpec.mods`) — the chain identity's input. */ readonly seats: ModSeats<EngineDollar>; readonly skillSeats: SkillSeats; /** What the admission screens: `seats` with the skills' registrations on the task seat. */ readonly admitted: ModSeats<EngineDollar>; } export declare function listLegModSeats(input: { readonly spec: Pick<TaskSpec, "mods">; readonly deps: Pick<RunnerDeps, "mods">; /** The leg's skills as the skills seat read them: each one's registrations join the task seat, scoped to its activation. */ readonly skills?: readonly Pick<SkillSpec, "name" | "mods">[]; }): LegModSeats; export {};