UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

40 lines (39 loc) • 2.08 kB
import type { RunnerDeps } from "../runner-deps.js"; import type { TaskSpec } from "../task-spec.js"; /** Which layer declared a place — the wiring manifest's word per place. */ export type DeclaredPlaceSource = "deployment" | "task" | "checkpoint"; /** One list of a leg's declared places: every place once, and the layers that declared it (index-aligned). `carried` is the part * a child and a parked row take — every place a task layer declared (the task's own, a resumed row's); a place only the * deployment declared is not carried, because every leg of the deployment declares it again (so a deployment that hands no * task place mints its children's specs and its rows as before). */ export interface LegDeclaredPlaces { readonly dirs: readonly string[]; readonly sources: ReadonlyArray<readonly DeclaredPlaceSource[]>; readonly carried: readonly string[]; } /** A leg's two lists, and what a parked row records of them (each list's carried part as a fresh copy, an empty one absent). */ export interface LegCallerPlaces { readonly configRoots: LegDeclaredPlaces; readonly homes: LegDeclaredPlaces; recorded(): { agentConfigDirs: string[] | undefined; agentHomeDirs: string[] | undefined; }; } /** The members of a parked row a resume reads back (judged by shape here; a damaged one refuses the resume). */ export interface RecordedCallerPlaces { readonly agentConfigDirs?: unknown; readonly agentHomeDirs?: unknown; } /** * Mint a leg's declared places. * * @contract agent_config_dir.leg_places_one_mint — the places a leg puts the configuration directory's rows and the * home-anchored rows at are these two lists: every face reads them, none unions the layers again, and the deployment's root * is among the roots whenever it is declared. */ export declare function legCallerPlaces(input: { readonly deps: Pick<RunnerDeps, "agentConfigDir">; readonly spec: Pick<TaskSpec, "agentConfigDirs" | "agentHomeDirs">; readonly recorded: RecordedCallerPlaces | undefined; }): LegCallerPlaces;