@sema-agent/core
Version:
Stateless, task-oriented AI agent core
385 lines (384 loc) • 30.1 kB
TypeScript
import type { SessionHead, SessionPlacement, SessionStore } from "../session.js";
import type { RunnerDeps } from "../types.js";
import type { RunInternals } from "./contracts.js";
/**
* The delegation tree's owner as one run binds it: `bound` with the owner (`null` = the tree root's row is anonymous), or `unbound`
* when the row this run acquired no longer stands under its id (deleted, or deleted and created again for another occupant) the first
* time the owner is asked for — a child placed on that answer would record whoever holds the id now, not this tree's owner. `reason` is
* the engine's sentence; a read that threw carries what it threw in `fault` (the host's to read, never the model's text).
*/
export type DelegationOwnerReading = {
readonly bound: true;
readonly owner: string | null;
/** The tree's root anchor as this reading saw it — the root session's id and the occupant its row held — the one source of the anchor
* a durable record of the tree writes (a revival is judged in the tree that root anchors). The engine's seats carry it; a seat a host
* builds ({@link delegationOwnerSeat}) anchors no root. */
readonly root?: {
readonly sessionId: string;
readonly incarnation: string | undefined;
};
} | {
readonly bound: false;
readonly reason: string;
readonly fault?: unknown;
};
/**
* The delegation tree's owner: the owner cell of the tree root's row, as the root run read it — once. A run spawned by another run
* holds its spawner's seat (by reference, so the whole tree shares one reading), and so does a revived child (its reviver's; a revival no
* the tree it was BORN in — its record's root anchor ({@link revivalTreeSeat}), never the reviving caller's seat nor one read off the row
* it re-opens); a run nobody spawned (a top-level run, a parked child resumed on its own) holds a seat over the row it acquired itself
* ({@link ownRowDelegationOwner}). The first answer that binds or refuses is the answer for every later call; a read fault rejects and
* binds nothing.
*/
export interface DelegationOwnerSeat {
read(): Promise<DelegationOwnerReading>;
}
/** A seat a host builds for a leg it starts itself (a composed leg, a direct workflow): the tree's owner it states — a principal name, or
* `null` for an anonymous tree — bound as given. Its reading anchors no root: a record the leg's background children write carries no
* root occupant (what a revival of such a record runs as: {@link revivalTreeSeat}). A value that is neither a name nor `null` is refused. */
export declare function delegationOwnerSeat(owner: string | null): DelegationOwnerSeat;
/** A seat a host hands the engine for a run (`RunInternals.delegationOwner`, a workflow's `delegationOwner`), taken at the door so it
* answers once ({@link onceSeat}): a host's own seat that answered alice and would answer bob next answers alice to the leg and
* to every row its tree creates. A seat that already answers once is handed back as it is (one tree, one object). */
export declare function answeringOnce(seat: DelegationOwnerSeat): DelegationOwnerSeat;
/**
* The seat of a run nobody spawned: the owner of the row it acquired, read by id through its own store's {@link SessionStore.headOf}
* and taken only while the row's occupant is the one acquired ({@link sameOccupant} of the head's `incarnation` and the acquired
* session's metadata's). A store without a by-id read has no owner to read: the reading is `null`, anchoring no root. The reading's
* root anchor ({@link DelegationOwnerReading}) is the run's declared tree root when it has one (`declaredRoot`: the root session a host
* handed the run, with that row's occupant as handed — a revival checks it against the root row, never takes it on trust), else the row
* itself with the occupant this read compared.
*/
export declare function ownRowDelegationOwner(sessions: Pick<SessionStore, "headOf">, sessionId: string, acquiredIncarnation: () => Promise<string | undefined>, declaredRoot?: {
readonly sessionId: string;
readonly incarnation: string | undefined;
}): DelegationOwnerSeat;
/** The refusal of a delegation whose tree owner does not bind ({@link DelegationOwnerReading}): the child is not started and no row is
* created for it. */
export declare const DELEGATION_OWNER_UNBOUND = "delegation.owner_unbound";
export declare function delegationOwnerUnbound(reason: string): Error & {
code: typeof DELEGATION_OWNER_UNBOUND;
};
/** The refusal of a delegated leg whose session row does not record its tree's owner ({@link readBackDelegatedRow}): the leg does not
* run on the row, and nothing is deleted. */
export declare const DELEGATION_OWNER_MISMATCH = "delegation.owner_mismatch";
/**
* The tree owner a delegated leg's row is judged under: its spawner's seat as it binds — a name, or `null` for an anonymous tree. Read
* BEFORE the acquire (a create-capable acquire names the name, and a row it creates records it; an anonymous tree's names none), so a seat
* that does not bind refuses the leg (`delegation.owner_unbound`, what the read threw as the cause) with no row created for it. Read by
* every leg that holds a spawner's seat, whatever its acquire's form ({@link judgedOwnerSeat}); a run nobody spawned reads none (its own row
* is the tree's). The read is bounded ({@link boundedOwnerRead}): one that does not answer in time binds nothing and refuses the leg the same
* way; one still pending when the leg's run is stopped (`signal`) ends the leg as the stopped run it is ({@link ownerReadEnd}).
*/
export declare function delegatedTreeOwner(seat: DelegationOwnerSeat, signal?: AbortSignal): Promise<{
readonly owner: string | null;
}>;
/** The one answer to "is there an owner to judge" for a leg: the name its tree's reading binds, or `undefined` — an anonymous tree
* (`owner: null`) judges nothing, as a leg with no seat does. Prepare reads a leg's row back only against it ({@link delegatedRowOwner});
* a spawning lane says "verified" at a leg's birth exactly when it is `undefined` — of the seat reading it already took (the background
* lane's), or through {@link verifiedAtBirth} (the synchronous lane, which takes none before). */
export declare function ownerToJudge(tree: {
readonly owner: string | null;
}): string | undefined;
/** A spawning lane's word at a leg's birth: `true` when the leg has no owner to judge ({@link ownerToJudge}) — no seat
* ({@link judgedOwnerSeat} answers none), or a seat whose tree is anonymous — so the leg is verified from its birth, as prepare will
* find it. The seat's reading is the one prepare reads (a seat answers once). A reading that does not answer — a fault, a tree that
* does not bind, the call's stop — says nothing: the leg waits for prepare's word ({@link RunInternals.onSessionVerified}). */
export declare function verifiedAtBirth(seat: DelegationOwnerSeat | undefined, signal?: AbortSignal): Promise<boolean>;
/** The seat a leg's row is judged under: its spawner's tree-owner seat — every leg that holds one is judged ({@link judgeRowForTree}),
* whatever its acquire's form (a re-open of a row it did not create included). The run's carrier is born "unverified" off it and prepare
* reads the seat off it; an anonymous tree's leg on a row the engine minted for it is told "verified" with no read ({@link ownerToJudge}). */
export declare function judgedOwnerSeat(internals: {
readonly delegationOwner?: DelegationOwnerSeat;
} | undefined): DelegationOwnerSeat | undefined;
/** The create-capable acquire's options of a leg: the placement and the owner it names, each only when there is one — a leg with neither
* passes none at all, the same call as a host's own acquire. */
export declare function createForm(input: {
readonly placement?: SessionPlacement;
readonly owner?: string;
}): {
placement?: SessionPlacement;
owner?: string;
} | undefined;
/** What the one row judge ({@link judgeRowForTree}) answers: the row may be opened (`claimed`: this judgement recorded the tree's owner on
* it; `head`: the head it judged — `null` for a row it read as not there, absent when it read none — which an entry that opens the row
* only after judging it holds its read to, {@link readJudgedRow}), or it may not, with the engine's sentence (`why`) and one of two
* kinds:
* · `not_ours` — the row is not this tree's to open: it records another owner, another tree claimed it first, it holds another occupant
* than the one acquired (or, for a caller holding a handle of it, it is not there). Each entry answers these as it answers "the record
* does not name this row" (the model `not_retained` / `not_found`, a leg `delegation.owner_mismatch`): never an owner, never which;
* · `store` — the deployment's session store could not judge it: it has no by-id read or no conditional owner write
* (`config.invalid_session_store`, the sentence naming the member), a read or the claim faulted or did not answer in time (`storage`,
* what it threw in `fault`), or the tree's own owner does not bind (`delegation.owner_unbound`). The deployment's to fix: never
* answered as "not retained". */
export type RowAdmission = {
readonly open: true;
readonly claimed: boolean;
readonly head?: SessionHead | null;
} | {
readonly open: false;
readonly kind: "not_ours";
readonly why: string;
} | {
readonly open: false;
readonly kind: "store";
readonly code: RowStoreFaultCode;
readonly why: string;
readonly fault?: unknown;
};
/** The codes a {@link RowAdmission} of kind `store` carries. */
export type RowStoreFaultCode = "config.invalid_session_store" | "storage" | "delegation.owner_unbound";
/** The row a judgement is of: its id, the occupant of the handle the caller holds and will use (`occupant`; absent = the caller holds no
* handle, and the occupant the head names is the one judged), whether the engine minted the id for this call and the call's create-capable
* acquire laid the row down (`minted`), and whether the caller is the leg that will run on it (`runsOn`: the one judgement that claims). */
export interface JudgedRow {
readonly sessionId: string;
readonly occupant?: () => Promise<string | undefined>;
readonly minted?: boolean;
readonly runsOn?: true;
/** `false`: the claimant's judgement taken without its write — a preview of the leg that would run on the row. Everything the claim
* needs is judged (a store with no conditional owner write refuses as it refuses the leg); a row that records no owner answers open
* and unclaimed, and nothing is recorded on it. */
readonly writes?: false;
}
/** The one refusal of a claim on a store that has no conditional owner write ({@link SessionStore.recordOwner}) — the whole of what a tree
* with an owner meets on a row that records none there; one sentence, one place. */
export declare function claimUnavailable(): RowAdmission;
/** The error an entry that throws a refusal of kind `store` throws: coded, the cause what faulted. */
export declare function rowStoreFaultError(sessionId: string, verdict: Extract<RowAdmission, {
kind: "store";
}>): Error & {
code: RowStoreFaultCode;
};
/**
* THE judge of a session row an entry is about to run on or read, for a tree (`tree`, its seat's reading) — one rule at every entry that
* opens a row's content (prepare's acquire of every leg that holds a seat, SendMessage before it touches the record, AgentTranscript's two
* lanes, an extension's read of a subagent's transcript). Read by id through the store's {@link SessionStore.headOf}, within the bound and
* ended by the caller's stop (`signal`; the one throw is the run's cancellation):
* · a tree that does not bind opens nothing;
* · an anonymous tree opens, unread, a row the engine minted for this call (`row.minted`); on a store with no by-id read it opens any row
* (no row there records an owner the engine wrote); otherwise it opens only a row that records no owner, and claims nothing;
* · a tree with an owner opens a row that records exactly that owner. A row that records none an entry that only opens or reads it opens
* as it is (unclaimed: its content is every tree's to read); the leg that will RUN on it (`row.runsOn`, prepare's acquire —
* {@link judgeLegRow}, the one claimant) claims it first — the store's conditional owner write ({@link SessionStore.recordOwner}) naming
* the occupant this judgement read, answered within the bound — and opens it only when the head that write answers records this owner on
* that occupant;
* · a row that is not there is not judged for a caller that holds no handle of it (`row.occupant` absent: it is answered by the
* caller's own path for a gone row); a caller that holds a handle — it opened the row, the leg that would run on it included — is
* refused (its handle no longer names the row);
* · every other answer opens nothing: another owner (or a cell that names nobody), a claim another tree won first, a head whose
* occupant is not the one the caller holds (`row.occupant`), a store with no by-id read, or none to claim with ({@link claimUnavailable}),
* a read or a claim that faulted or did not answer in time (a late claim still records this tree's owner — the claim is monotonic — but
* this leg has refused).
* A claim records the owner for every later entry; what a run that opened the row while it recorded none already holds is not taken back.
*/
export declare function judgeRowForTree(sessions: Pick<SessionStore, "headOf" | "recordOwner">, row: JudgedRow, tree: DelegationOwnerReading, signal?: AbortSignal): Promise<RowAdmission>;
/**
* THE read of a row a reading entry judged ({@link judgeRowForSeat}, no handle held — nothing of a row it may be refused is opened, a File
* log's tail repair included): judge → open → read → judge the head again. The row is opened (`acquire`, the existing row only) and read
* (`read`); then its head is read again by id, and the read stands only when that head is the one judged — the same owner and the same
* occupant. A row whose owner or occupant moved between the judgement and the end of the read (claimed by another tree, deleted, laid
* down again) voids the read, and so does a row judged not there that opens anyway (a head judged absent is the head of no row): it is
* answered as not this tree's and its view is dropped. A head read that faults or does not answer voids it too, as the store's fault. A verdict that read no head
* (a store with no by-id read, a row the engine minted) has nothing to hold the read to: it stands. What the open or the read throw is
* the caller's (its own answers for a row that is gone or unreadable); the one other throw is the run's stop.
*/
export declare function readJudgedRow<T>(sessions: Pick<SessionStore, "headOf" | "acquire" | "forget">, sessionId: string, verdict: Extract<RowAdmission, {
open: true;
}>, read: (held: Awaited<ReturnType<SessionStore["acquire"]>>) => Promise<T>, signal?: AbortSignal): Promise<{
readonly read: T;
} | {
readonly refused: Exclude<RowAdmission, {
open: true;
}>;
}>;
/** The refusal of a read whose row is not the one judged ({@link readStandsAsJudged}). */
export declare function rowNotTheOneJudged(): Extract<RowAdmission, {
kind: "not_ours";
}>;
/** {@link judgeRowForTree} for an entry that reads its CALLER's seat off the tool call (SendMessage, AgentTranscript, an extension's
* transcript read): the seat's reading, bounded and ended by the call's stop. A caller that holds no seat — a tool driven with no run around
* it, an operator's continuation — is an anonymous tree's ({@link delegationOwnerOf}): it opens only rows that record no owner. What a
* revival then runs as is not this caller's tree but the one it was born in ({@link revivalTreeSeat}). It opens or refuses; it never claims. */
export declare function judgeRowForSeat(sessions: Pick<SessionStore, "headOf">, row: Omit<JudgedRow, "runsOn">, seat: DelegationOwnerSeat | undefined, signal?: AbortSignal): Promise<RowAdmission>;
/**
* The tree a revival cycle runs in — the one the record was BORN in — read ONCE per cycle, off the record as the store holds it: its root
* anchor (`rootSessionId` + `rootSessionIncarnation`, written from the spawning tree's seat) names the root row, whose owner is read by id
* while it still holds that occupant. ONE rule for a tree that is not there to read: a record that anchors no root occupant (written before
* 7.65.0, or spawned by a call with no seat or under a seat that anchors no root or another root), a root row that is gone, and a root row
* laid down again for another occupant name no tree — the cycle is an anonymous tree's: it opens only a row that records no owner and
* claims nothing. A read that faults or does not answer is refused (`fault`), and so is a root cell that names nobody and a record whose
* root is its own session (the child would read its own row's owner). Answers the seat of the reading taken (it answers that reading,
* always — what the cycle carries to its revive arm), or the refusal's sentence.
*/
export declare function birthTree(sessions: Pick<SessionStore, "headOf">, record: RevivalRecord, signal?: AbortSignal): Promise<{
readonly seat: DelegationOwnerSeat;
readonly reading: Extract<DelegationOwnerReading, {
bound: true;
}>;
} | {
readonly refused: string;
readonly fault?: unknown;
}>;
/** Puts the tree a message entry admitted its caller on onto the claim object it hands its spawner ({@link revivalTreeSeat} takes it). */
export declare function holdCycleTree(claim: object, seat: DelegationOwnerSeat): void;
/** The tree a message entry put on this claim object: `undefined` for an object no entry handed out (a copy of one included). */
export declare function heldCycleTree(claim: object): DelegationOwnerSeat | undefined;
/**
* The tree a revival's leg runs in, at the revive arm: the claim (`claim.row` as the claimant read it, `claim.rev`) must be the record the
* store holds — the same rev and the same identity cells (session, root anchor, owner, scope); a claim whose copy differs is refused,
* nothing re-opened. Then the cycle's tree, by ONE rule on whether a message entry stands behind the claim: a parked drive's claim
* (`parked`: a person deciding a parked agent through its host — no message entry) reads the birth tree here, once ({@link birthTree});
* every other claim runs in the tree its message entry admitted the caller on and put on this very claim object ({@link holdCycleTree};
* never read again), and one that carries none — a copy of the entry's object, a claim a host made by hand — is refused, no row read.
* Answers the seat, or the refusal's sentence.
*/
export declare function revivalTreeSeat(sessions: Pick<SessionStore, "headOf">, records: {
get(handle: string, scope: string): Promise<RevivalRecord | null>;
}, claim: {
readonly row: RevivalRecord;
readonly rev: number;
readonly parked: boolean;
}, signal?: AbortSignal): Promise<{
readonly seat: DelegationOwnerSeat;
} | {
readonly refused: string;
readonly identity?: true;
readonly fault?: unknown;
}>;
/** THE rule of who may reach an agent from outside its run — continue it, or message it while it runs or is retained: its tree (`tree`,
* the one it was born in) records no owner, or records the owner the caller's tree binds. A reading that does not bind reaches nothing. */
export declare function treeReaches(tree: DelegationOwnerReading, caller: DelegationOwnerReading): boolean;
/**
* Whether a caller's tree may continue a record (SendMessage's revival and its backlog drain): the cycle runs in the tree the record was
* born in, read here ONCE ({@link birthTree}) and carried to the revive arm as the seat this answer admits on (`tree`), so a caller may
* start it only FROM that tree, and the row the record names is judged for THAT tree — the one that will run on it. A caller whose tree
* does not bind starts nothing (`delegation.owner_unbound`). Then the birth tree admits a caller when it records no owner (the anonymous
* cycle, {@link birthTree}) or records the owner the caller's tree binds (`caller`: the caller's reading, taken once for the call); another
* principal's tree, and an anonymous caller, are refused as "not this tree's" (nothing is claimed, written or lent); a birth tree that
* cannot be read is the store fault it is (`storage` where a read faulted, `delegation.owner_unbound` otherwise) — never let through. Last,
* the row (`row`, no handle held) is judged for the cycle's tree ({@link judgeRowForTree}): an anonymous cycle opens only a row that
* records no owner. Answers the cycle's seat and the row's verdict, or the refusal.
*/
export declare function birthTreeAdmission(sessions: Pick<SessionStore, "headOf">, record: RevivalRecord, row: Omit<JudgedRow, "runsOn" | "occupant">, caller: DelegationOwnerReading, signal?: AbortSignal): Promise<{
readonly open: true;
readonly tree: DelegationOwnerSeat;
readonly row: Extract<RowAdmission, {
open: true;
}>;
} | Exclude<RowAdmission, {
open: true;
}>>;
/** The root anchor a fresh background agent's durable record carries — the one source its revival's tree is read from
* ({@link revivalTreeSeat}): the call's root linkage (`rootSessionId ?? sessionId`), and beside it the root occupant only as the spawning
* tree's reading saw it (`tree.root`, the reading that bound the tree's owner), and only when that anchor is the linkage's root. A call's
* own root fields never put an occupant there: a call with no seat, or one whose seat anchors no root or another root, records the
* linkage alone. */
export declare function recordedRootAnchor(ctx: {
readonly rootSessionId?: string;
readonly sessionId?: string;
}, tree: DelegationOwnerReading | undefined): {
rootSessionId?: string;
rootSessionIncarnation?: string;
};
/** The cells of a durable agent record a revival's tree is read from ({@link revivalTreeSeat}). */
export interface RevivalRecord {
readonly handle: string;
readonly scope: string;
readonly owner: string;
readonly rev: number;
readonly sessionId?: string;
readonly rootSessionId?: string;
readonly rootSessionIncarnation?: string;
}
/** A delegated leg's row as prepare's acquire resolved it, judged before anything is written to it ({@link judgeRowForTree}, on the occupant
* the acquired session carries): one that may not be opened is never run on — its cached view is dropped (`forget`, history-safe; a fault
* of the drop goes to `report`) and the leg refused: `delegation.owner_mismatch` for a row that is not the tree's (the row named, no
* owner), the store fault's own code ({@link RowStoreFaultCode}) for a store that could not judge it; nothing is deleted. */
export declare function judgeLegRow(sessions: Pick<SessionStore, "headOf" | "recordOwner" | "forget">, held: {
readonly sessionId: string;
readonly session: {
getMetadata(): Promise<{
readonly incarnation?: string;
}>;
};
}, leg: JudgedLeg, report?: (err: Error, sessionId: string) => void): Promise<void>;
/** A leg's refusal of a row its judgement did not open: the store fault's own code ({@link RowStoreFaultCode}) for a store that could not
* judge it, `delegation.owner_mismatch` for a row that is not the tree's (the row named, no owner). Thrown by the leg's prepare
* ({@link judgeLegRow}) and answered by a preview of that leg alike. */
export declare function legRowRefusal(sessionId: string, verdict: Exclude<RowAdmission, {
open: true;
}>): Error & {
code: string;
};
/** What a leg's row is judged by ({@link JudgedLeg}), read off its spec, its internals and its tree's owner (`undefined` = the leg holds
* no seat: nothing is judged). The one reading of a leg's prepare and of a preview of that leg. */
export declare function judgedLegOf(spec: {
readonly sessionId?: string;
readonly requireExistingSession?: boolean;
readonly signal?: AbortSignal;
}, internals: {
readonly sessionIdMintedBySpawner?: boolean;
} | undefined, treeOwner: {
readonly owner: string | null;
} | undefined): JudgedLeg | undefined;
/** Whether a read of a row stands for the head a judgement read (`judged`; `null` = judged not there): the head after the read records
* the same owner on the same occupant. A row judged not there stands for no read. */
export declare function readStandsAsJudged(judged: SessionHead | null, now: SessionHead | undefined): boolean;
/** What a delegated leg's row is judged by in prepare: the tree owner its seat bound (`owner`; `null` = anonymous), whether the engine
* minted the id for this leg's create-capable acquire (`minted` — no author named it: the store's mint, or the spawning lane's,
* `RunInternals.sessionIdMintedBySpawner`), and the leg's own stop (`signal`, its spec's). */
export interface JudgedLeg {
readonly owner: string | null;
readonly minted: boolean;
readonly signal?: AbortSignal;
}
/**
* A fork lane's judgement of the row a store's fork answered, before the child runs on it or a cleanup releases it: the row must be a copy
* of the session this run holds — its lineage cells name the source id and the occupant this run acquired — or it is not this tree's to run
* on or to release (a store that answered a row that stands under another id's history, or a source the id no longer holds). Answers the
* sentence of a row that is not, `undefined` for one that is. A source occupant of `null` is one the caller does not hold (a delegation tool
* driven outside a run): only the lineage id is judged.
*/
export declare function forkedRowNotOurs(sessions: Pick<SessionStore, "acquire" | "forget">, forkedId: string, source: {
readonly sessionId: string;
readonly occupant: string | undefined | null;
}): Promise<string | undefined>;
/**
* Whether a leg's result names the session it ran on. A result names only a session whose row's owner was verified (or a leg with no
* owner to judge): a leg refused over its row, or one that ended — stopped, timed out — before the row was read, names none (`""`).
* How the leg ended is another fact; this one alone decides whether a lane may name, keep, release or offer to resume the child's
* session — an unverified row is not the tree's to name, keep or delete.
*/
export declare function namesVerifiedSession(result: {
readonly sessionId: string;
}): boolean;
/**
* THE read of the tree root's address a run's internals carry, taken once where the run's internals are first composed so that prepare,
* the notification lane and every child the run spawns read the same answer: the root's id (`rootSessionId`, and the explicit placement
* declaration `placementRoot` that outranks it) and the occupant that root held when the tree was born (`rootSessionIncarnation`).
*
* A root id is a session id: a non-empty string. Absent, `undefined` and `null` name no root (the member is left out of the copy, the
* run is its own root). Anything else — `""`, a number, an object, an array — is a bad root and the run is REFUSED
* (`config.placement_root_invalid`, the member named and its shape said, never its value): the root decides where the leg is placed and
* whose session a notice is filed under, so a malformed one is never read as "no root" and defaulted around — one reading, everywhere.
* The occupant goes through the engine's one occupant decoding ({@link readIncarnationCell}): a non-empty string is the token;
* anything else names no occupant — the member is dropped from the copy handed back, so the root reads as an unknown occupant
* everywhere — and `onError` is told once (`phase: "config"`, `config.invalid_argument`) with the value's shape, never the value.
* Absent, `undefined` and `null` are an unknown occupant already, said nothing. The root's box scope (`rootSessionScope`) is read the
* same way: a non-empty string is the scope; anything else is no recorded scope, dropped and told once. The root's principal
* (`rootPrincipal`) is read as a principal is ({@link readPrincipal}): a name is kept; absent, `null` and `""` state none, said
* nothing; anything else is no stated principal, dropped and told once (its shape, never its value). The tree's owner seat
* (`delegationOwner`) is taken at this door as well: it answers once ({@link answeringOnce}). Every member is read once
* into the copy, so a getter cannot answer one value here and another to the spread that follows; the caller's own bag is never written.
*/
export declare function readRootOccupant(internals: RunInternals | undefined, onError: RunnerDeps["onError"], sessionId: string | undefined): RunInternals | undefined;
/** The owner a seat binds, or `null` where no seat rides (a tool driven with no run around it has no tree root to read). Bounded, and
* ended by the delegating call's stop (`signal`): the one throw is the run's cancellation, when the stop ended the read
* ({@link ownerReadEnd}) — the call was given up on, which is no reading of the seat. */
export declare function delegationOwnerOf(seat: DelegationOwnerSeat | undefined, signal?: AbortSignal): Promise<DelegationOwnerReading>;
/** The owner a row records, read by id through the store it lives in (`null` where the store has no by-id read, or holds no row for
* the id): what a revived child's park writes into the durable row it promotes — the row keeps its owner. It is not the revived
* child's tree owner, which is its reviver's seat. A row whose owner cell is not a name or `null` does not bind, as in the seat of a
* run nobody spawned. */
export declare function rowOwnerReading(sessions: Pick<SessionStore, "headOf">, sessionId: string | undefined): Promise<DelegationOwnerReading>;