UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

381 lines (380 loc) • 31.6 kB
import type { ExecutionEnv, Session, SessionCheckoutDeclared, SessionCheckoutRecord } from "../internal/harness-types.js"; import { type SessionCheckoutRead } from "../engine/session/session.js"; import { type ReleasedTree } from "./git-worktree-env.js"; import type { SessionStore } from "./session.js"; import type { TaskSpec } from "./task-spec.js"; import type { WorkspaceSnapshot } from "./workspace-snapshot.js"; /** One declared code source: the root it is for, the repository URL (`https` only), the full commit id the session's code * starts from, and a display label. */ export interface WorkspaceSourceDeclaration { /** `"taskRoot"`, or `{ directory }` naming an entry of `TaskSpec.additionalDirectories` (the same spelling). */ readonly root: "taskRoot" | { readonly directory: string; }; /** The repository URL. `https` only; normalized (host lowercased, a trailing `/` or `.git` dropped). A user name or password in * it, or a query / fragment parameter whose name reads as a credential, is refused, and the refusal echoes only the origin. */ readonly remote: string; /** The full commit id (40 or 64 lowercase hex). The engine checks it on the session's first leg. */ readonly sha: string; /** A display / continuation label (a branch name); never resolved. */ readonly ref?: string; } /** `TaskSpec.workspace`: the session's workspace declaration. */ export interface WorkspaceDeclaration { /** `"worktree"`: the session works in its own managed trees — one per repository a listed root (`roots`) is in — minted * together on its first leg. */ readonly isolation?: "worktree"; /** Where a tree starts: `"fresh"` (default — the default branch tip) or `"head"` (the current local HEAD). Only with * `isolation`. A tree whose repository has a declared source starts at the source's commit instead; a `baseRef` that starts * no tree (every isolated repository has a source) is refused. */ readonly baseRef?: "fresh" | "head"; /** The trees' managed name (the EnterWorktree name grammar), one name for every tree of the session (each repository has its * own namespace); absent ⇒ derived from the session id. Only with `isolation`. */ readonly name?: string; /** The roots whose REPOSITORIES get a tree: `"taskRoot"` and / or `{ directory }` naming an `additionalDirectories` entry * (the same spelling). Absent ⇒ `["taskRoot"]` (that list is stored as absent). A repository gets one tree however many of * its roots are listed, and every declared root in it — listed or not, the task root included — works in that tree. Only * with `isolation`; a non-empty list of distinct roots. */ readonly roots?: ReadonlyArray<"taskRoot" | { readonly directory: string; }>; /** The code sources, one per repository. */ readonly sources?: readonly WorkspaceSourceDeclaration[]; } /** Why a checkout cannot get a managed tree here — the probe's closed set. */ export declare const WORKTREE_INCAPABLE_REASONS: readonly ["name_invalid", "git_unavailable", "not_a_repository", "bare_repository", "no_commit", "managed_parent_symlinked", "parent_not_writable", "name_in_use"]; export type WorktreeIncapableReason = (typeof WORKTREE_INCAPABLE_REASONS)[number]; /** What {@link probeWorktreeCapability} answered. `gitRoot` = the repository root the managed parent hangs at (present once * the location is known to be a repository). */ export interface WorktreeCapability { readonly worktreeCapable: boolean; readonly gitRoot?: string; readonly reason?: WorktreeIncapableReason; /** One human sentence for the refusal; absent when capable. */ readonly detail?: string; } export type { ReleasedTree } from "./git-worktree-env.js"; /** The one reader of a session's checkout record, the one this module's doors read (#4898: a host reads it too). */ export { readSessionCheckout, type SessionCheckoutRead } from "../engine/session/session.js"; export type { SessionCheckoutRecord } from "../internal/harness-types.js"; /** * THE shape judge of `TaskSpec.workspace` — `undefined` for an absent declaration, else the normalized declaration the record * stores and every later leg is compared on. Read once as data ({@link DECLARATION_DATA}), then judged on that copy. Refused * (`config.session_workspace_invalid`): a non-object, a value that is not plain data (a Proxy, an accessor, a class instance, a * member that is not an enumerable data property), an unknown key, a word outside a closed set, `baseRef` / `name` / `roots` * without `isolation`, a name outside the managed grammar, an empty or oversized `sources` or `roots`, a root listed twice, two * sources for one root, a declaration that declares nothing. What needs the repositories to judge (a listed directory that is no * `additionalDirectories` entry, two sources for one repository, a `baseRef` that starts no tree) is the first leg's. */ export declare function screenWorkspaceDeclaration(value: unknown): SessionCheckoutDeclared | undefined; /** Does the leg declare a workspace (its tree is minted, or reopened, in the leg's execution environment)? */ export declare function workspaceDeclared(raw: unknown): boolean; /** Does the session's checkout record, read before the leg's environment starts, make a leg that declares no workspace work * in the session's tree (reopened in the environment)? A released record and a `null` leg work in none; an unreadable * record is open (the judge refuses the leg where it reads it). A session that STANDS in another's checkout works in that tree * (whether it still stands, or was released, is the open's to refuse, as for a record). */ export declare function checkoutRecordNeedsEnv(read: SessionCheckoutRead, raw: unknown): boolean | undefined; /** A leg that declares no workspace reads its session's checkout record ONCE, before its environment starts: the record (handed to * {@link openSessionCheckout}, which reads no second copy) and whether it makes the leg work in the session's tree. A declaring leg * reads nothing here — its read follows its leaf, the allocation's condition — and its need stays open. */ export declare function readLegCheckout(session: Session, sessionId: string, declaration: unknown): Promise<{ readonly read?: SessionCheckoutRead; readonly needsEnv: boolean | undefined; }>; /** What a leg that STANDS WHERE ANOTHER SESSION'S LEGS STAND reads of that session ({@link readStandingCheckout}): the session that HOLDS * the tree, its checkout record as every leg of it reads the record, and whether the record makes the leg work in a tree (as * {@link readLegCheckout}'s `needsEnv`). `session` is absent when the session could not be opened (`read` is then `unreadable`). */ export interface StandingCheckout { readonly session: Session | undefined; readonly sessionId: string; readonly read: SessionCheckoutRead; readonly needsEnv: boolean | undefined; } /** * THE one hop of a stand (#4899): the checkout a session's recorded stand points at — the record of the session that holds the tree, as * every leg of that session reads it. The hop is bounded and fail-closed: the holder must be in the store, its read must be a record (a * stand never names another stand: the writer resolves to the session that holds the tree), and that record must be the allocation the * stand was written against. Anything else is the unreadable read it is — the session's legs are refused, never run in the base * checkout instead. A released record is returned as it is (the open refuses it, as it refuses a leg of the holder). * This is the ONE reader of a session's recorded stand: the session's own next leg, a parked leg resumed by its token, a verifier handed * the session, and a rewind of its files all read it here; the composition that wrote the stand is not asked again, and the leg's own * `workspace` is judged against the holder's record as for a leg of the holder (a different declaration is refused by the open). */ export declare function readRecordedStand(sessions: Pick<SessionStore, "acquire">, stand: Extract<SessionCheckoutRead, { kind: "stands"; }>, declaration: unknown): Promise<StandingCheckout>; /** * The session whose work a leg judges or continues from a session of its own (a verification gate's verifier, a cascade's or a repair * loop's restart over the host's session): the leg STANDS in that session's checkout — where a leg of that session stands — instead of in * the base checkout the tree isolates. Read once, before the leg's environment starts, off the same record every leg of the session reads * ({@link readSessionCheckout}); nothing is written to the session. A work session that itself records a stand (a cascade's rung, the * session a verifier of the rung's result is handed) is followed one hop, to the session that holds the tree ({@link readRecordedStand}). `undefined` ⇒ the leg stands where it would have stood: no work * session named (or it is the leg's own), the leg's own `workspace` is `null` (it wants no tree) or a declaration that is not the * session's (it follows its own declaration, which the host wrote), the session is not in the store, or its record holds no checkout. * A record that cannot be read is answered as the unreadable read it is (the leg is refused where it opens the checkout, never run * in the base checkout instead); a released record or a tree that is gone is refused there too, as for a leg of that session. Read only for * a leg whose own session records no stand; the first leg that stands writes its own ({@link ensureStand}) and is read from it after. */ export declare function readStandingCheckout(sessions: Pick<SessionStore, "acquire">, workSession: string | undefined, ownSessionId: string, declaration: unknown): Promise<StandingCheckout | undefined>; /** * The first leg of a session that STANDS in another session's checkout ({@link readStandingCheckout}) records it, once, in the session's * OWN log ({@link SessionCheckoutStand}: `standsIn` the session that holds the tree, `allocationId` the allocation of its record read here); * the holder's session is not written. It is written after the leg's checkout opened (so a stand always names a tree that stood) and before * the leg runs, on the leaf read just before the session's own checkout is read here (a leg that wrote meanwhile makes the append refuse). A stand already * recorded for the same holder and allocation is left as it is; one for another holder, or a checkout of the session's own, refuses the leg — * a session's legs stand in one place. A record that cannot be written refuses the leg (`workspace.checkout_unavailable`): a stand that is not * recorded is a place the next reader would read as the base checkout. A stand is a TREE's ({@link recordHoldsTree}): a holder whose record * isolates no tree (declared code sources only: every root of its session stands where it was declared) is not recorded — there the base * checkout IS where its legs stand, and a session that records a stand is one a cascade keeps; a session that already records a stand is * still refused a leg that places it there (its legs stand in one place: its tree, not the base checkout). */ export declare function ensureStand(session: Session, sessionId: string, standing: StandingCheckout): Promise<void>; /** May the session be one whose legs stand in another session's checkout ({@link ensureStand})? Read only. `false` only when it is known * not to be: a session the store does not hold (nothing to keep), or one that reads as having no stand (none, or a checkout of its own). * A session that records a stand, one whose log or row cannot be read, and one read from a bounded window that cannot vouch for a `none` * (the stand may lie below the floor) answer `true` — a read that cannot vouch is not "records none" (the answer decides whether a * cascade releases the session it hands back, and a release that wrongly drops a stand loses the place). */ export declare function recordsStand(sessions: Pick<SessionStore, "acquire">, sessionId: string): Promise<boolean>; /** * The checkout of a leg that stands where another session's legs stand ({@link readStandingCheckout}): {@link openSessionCheckout} * over that session's record, with the leg's own roots — each at its place in the session's tree, as for a leg of that session — and, * for a leg that JUDGES the session's work (`judges`: a verifier, read-only or not; its spec carries none of the session's directories), * every directory the record's declaration isolates as a read root — a read root only: a verifier that writes (`verifierHandsReadOnly: false`) * writes where its own spec lists, never in the session's second tree. A leg that does not judge (a cascade's rung, a repair loop's restart) * gets the directories its own spec lists, and no more: its authority is its caller's, not the record's. A directory the record isolates must * still stand in a tree of the session's; one that no longer does refuses the leg. Reads only: the allocation is never written, and the * answer carries no record of its own (the frame of a leg reports the checkout of its OWN session, and this leg's session has none). The * refusals are a leg of that session's. */ export declare function openStandingCheckout(standing: StandingCheckout, input: Pick<OpenSessionCheckoutInput, "env" | "baseRoot" | "restoredCwd"> & { readonly ownSession: Session; readonly judges?: boolean; readonly spec: Pick<TaskSpec, "workspace" | "additionalDirectories" | "additionalReadDirectories">; }): Promise<OpenedSessionCheckout>; /** * THE capability judge of a managed tree for the checkout at `cwd`: — with `name` — that name is a managed name (the declaration's * own grammar, {@link worktreeNameProblem}; a pure judgment of the argument, asked before anything is read, its `detail` the * grammar's own sentence), git runs, `cwd` is inside a non-bare work tree with a commit, no level of the managed parent is a * symlink, the managed parent can be written, and the name's directory and branch are free. The first failing check answers, * in that order. Reads only (no git write); a host calls it before offering isolation, and a session's first leg calls it * before minting. */ export declare function probeWorktreeCapability(env: ExecutionEnv, cwd: string, opts?: { readonly name?: string; }): Promise<WorktreeCapability>; /** One additional root as the leg's frame reports it. */ export interface DirectoryInSession { /** The entry as the leg declared it. */ readonly declared: string; /** Where it stands (canonical): its place in its repository's tree, or where it was declared. */ readonly at: string; /** `write`: an `additionalDirectories` entry; `read`: an `additionalReadDirectories` entry. */ readonly access: "write" | "read"; /** The session tree it stands in (that tree's `dir`, as the frame's `session` spells it); absent when it stands as declared. */ readonly tree?: string; } export interface OpenSessionCheckoutInput { /** The leg's hands environment (the one git runs in). */ readonly env: ExecutionEnv; readonly session: Session; readonly sessionId: string; /** The leg's raw `TaskSpec.workspace`. */ readonly declaration: unknown; /** The leg's task root as the deployment and the workspace restore settled it (the base checkout's location). */ readonly baseRoot: string; /** The leg's `TaskSpec.additionalDirectories` (declared spellings). */ readonly additionalDirectories: readonly string[] | undefined; /** The leg's `TaskSpec.additionalReadDirectories` (declared spellings). */ readonly additionalReadDirectories?: readonly string[] | undefined; /** The working directory a durable resume restores (the checkpoint's `handsCwd`); absent on a leg that resumes nothing. */ readonly restoredCwd?: string; /** The session's checkout record as a leg that declares no workspace read it before its environment started — the one * read of it on that leg; absent ⇒ read here (a declaring leg reads it after its leaf, the allocation's condition). */ readonly read?: SessionCheckoutRead; /** The session store, to read the holder of a stand (a session whose own record says its legs stand in another session's checkout, * {@link readRecordedStand}); read only when the session's own record is a stand. Absent on such a session ⇒ the leg is refused * (`workspace.checkout_unavailable`): the base checkout is never read in the tree's place. */ readonly sessions?: Pick<SessionStore, "acquire">; /** The leg judges the work of the session it stands with ({@link openStandingCheckout}); read only on a stand. */ readonly judges?: boolean; /** Whether the leg mounts a tool that can change a file (`legMayWriteFiles`); read only by a `null` leg's {@link nullLegRootOf}. `false`: * a leg whose session's checkout cannot be resolved runs outside it (it has nothing to record). Absent ⇒ it may write. */ readonly writes?: boolean; } export interface OpenedSessionCheckout { /** The leg's task root: its place in its repository's tree when that repository is isolated, else `baseRoot`. */ readonly taskRoot: string; /** The session's checkout record, when this leg reports one. */ readonly record?: SessionCheckoutRecord; /** The leg's `additionalDirectories` / `additionalReadDirectories` in their effective spellings, entry for entry (an entry of * an isolated repository at its place in that repository's tree, any other as declared) — what every reader of the leg reads; * absent when the leg's list is absent (or not a list of strings). */ readonly additionalDirectories?: readonly string[]; readonly additionalReadDirectories?: readonly string[]; /** The frame's report of the leg's additional roots ({@link DirectoryInSession}); absent when the leg has none. */ readonly directories?: readonly DirectoryInSession[]; /** Where the session's file history is keyed ({@link sessionRootOf}), read when the history first asks: `taskRoot` on a leg that * works in the session's checkout or of a session with none; on a `null` leg of a session with a checkout record, the session's * own root as a leg handed this leg's root reads it — read then: a checkout that cannot be resolved refuses as {@link sessionRootOf} * does, and a root the checkout cannot place answers `outside` (a leg that neither records nor restores never reads it). */ readonly sessionRoot: () => Promise<SessionRootRead>; } /** What a leg's {@link OpenedSessionCheckout.sessionRoot} answers: the session's root, or — on a `null` leg whose root the session's * checkout's trees do not hold (whatever the session listed) — `outside`: the leg works * outside the session's checkout and records no file history; `notice` says so to the operator, `refusal` (the checkout's code) is * the answer to a rewind sent on such a leg. */ export type SessionRootRead = { readonly root: string; } | { readonly outside: { readonly notice: string; readonly refusal: Error; }; }; /** What {@link sessionRootOf} reads: the leg's env (git runs in it), the session, and the root a leg of it is handed (the base * checkout's location, as {@link OpenSessionCheckoutInput.baseRoot}). */ export interface SessionRootInput { readonly env: ExecutionEnv; readonly session: Session; readonly sessionId: string; readonly baseRoot: string; /** The session store: a session whose own record is a stand in another session's checkout is read through it ({@link readRecordedStand}); * absent ⇒ such a session's root cannot be resolved and is refused (`workspace.checkout_unavailable`), never keyed at the base checkout. */ readonly sessions?: Pick<SessionStore, "acquire">; } /** * THE session's root — where its file history is keyed (a record's key is relative to it, the restore joins it back on it): the * task root a leg that omits `TaskSpec.workspace` works at, by that leg's own reading ({@link openSessionCheckout} with no * declaration and no directory lists — only the task root is placed). A session with its own tree: its place in that tree; a session * whose record says its legs stand in another session's tree (#4899, a cascade's rung, a verifier): its place in that tree, read through * the stand (the rewind of such a session joins its history back where it was made); a session with no checkout record: `baseRoot`. It * never mints a tree and never writes the record. It refuses where such a leg is * refused (the record cannot be read, the checkout was released, the tree is gone or no longer this session's, `baseRoot` is not in * the repository the tree was minted from): the refusal keeps the checkout's code (a throw with none is a checkout that cannot be * read, `workspace.checkout_unavailable`) and its sentence is `refusedAs` — the caller's, what was not done — then the checkout's. * Read by every leg's file history (a `null` leg works in the base checkout, but its edits are keyed against the session's root, * so every rewind joins them back where they were made) and by the out-of-run rewind. */ export declare function sessionRootOf(input: SessionRootInput, refusedAs: string): Promise<string>; /** * Where session `source`'s file history is keyed, read from the copy of `source`'s checkout record `input.session`'s log holds (a fork's * log holds the entries it copied from its source): `input.baseRoot` when the copy vouches that the source held no tree of its own — a * whole log with no record of it, or a record that isolates no tree ({@link recordHoldsTree}: code sources only, whose session keys at the * root its legs are handed) — read as the root this session's legs are handed (no record names the root the source's legs were handed); * `undefined` otherwise — the copy shows a record of the source that holds a tree (it worked in a tree of its * own, or came to: nothing on a history row says which of its rows were keyed there), the copy is not a readable record, or a record below * a bounded window's floor is not ruled out. Read by the fork carry: the source's records are joined back on the fork's root, so they are * carried only between two sessions that both key at the root their legs are handed. */ export declare function recordedRootOf(input: SessionRootInput, source: string): Promise<string | undefined>; /** * THE judgment "a fork that works in a tree of its own": `forkedFrom` is the row's lineage cell (`SessionMetadata.forkedFrom`), and the * session's own checkout record ({@link readSessionCheckout}, the reading every leg's open makes) holds a tree ({@link recordHoldsTree} — * released or not; `none` is none with or without a window, as the leg's open reads it). A session's key root changes only where its * allocation mints a tree, and only a fork's log can hold a turn written before its allocation (a session that is no fork is refused a * declaration once it holds a message or a compaction, `checkoutDeclarationClosed`), so only such a session's history scope can hold rows * keyed against two roots, and nothing on a row says which: in this version such a session records no file history and restores none. A * fork whose record declares code sources only keeps the root its legs are handed — one root, as a fork with no record — and is not * judged here. Read by the run's driver (once per leg, `prepare-task.ts`) and by the out-of-run rewind. A fork whose record cannot be read * is not judged to have none: refused `workspace.checkout_unavailable`, as every reader of the record refuses it. */ export declare function forkHasOwnTree(session: Session, sessionId: string, forkedFrom: string | undefined): Promise<boolean>; /** `spec` with its two directory lists in their effective spellings ({@link OpenedSessionCheckout}) — the leg's one rebinding of * them; a list the judge did not read (absent, or not a list of strings) stays as given. */ export declare function withEffectiveDirectories<S extends { additionalDirectories?: string[]; additionalReadDirectories?: string[]; }>(spec: S, opened: OpenedSessionCheckout): S; /** * THE per-leg judge of a session's checkout (see the module header): reads the record, reads the leg's declaration against it * ({@link legWorkspaceOf}), mints the allocation on the session's first leg, and answers the leg's roots through the one mapping * ({@link rootsInSession}). Throws a coded refusal; the first leg's allocation records nothing unless everything succeeded (every * path check runs before the first mint; the trees are minted, then marked; a refusal on the way removes, while still clean, * each tree it minted whose allocation mark is proved absent, and keeps and names the rest; the record is written only once * everything succeeded — immediately, not at settle). */ export declare function openSessionCheckout(input: OpenSessionCheckoutInput): Promise<OpenedSessionCheckout>; /** * Release a session's checkout — the host's door when it archives or deletes a session. Each of the session's trees is removed * only when it is clean (no uncommitted file, no file git ignores, no commit past its base on its HEAD or its branch, its state readable) AND its birth record names this * allocation; the removal itself runs without `--force`, so a write landing after the check keeps the tree. Everything else * is kept and reported with its path and why. The tree's branch is deleted with it only while the branch still sits at the * base commit. Then the release is recorded once (`released: true`), after which the session runs no further leg. Calling it * again re-reports and never removes a tree another allocation took over. * * `onExit`: `"keep-if-dirty"` (default) | `"keep"` (keep every tree; only record the release). A discarding removal is not * offered. A session with no checkout answers an empty list; a tree its first leg kept because the record could not be written * is no record's to release — {@link listOrphanSessionTrees} lists it. */ export declare function releaseSessionCheckout(env: ExecutionEnv, session: Session, opts?: { readonly onExit?: "keep-if-dirty" | "keep"; }): Promise<{ readonly trees: readonly ReleasedTree[]; }>; /** Why a session tree whose allocation mark reads is no record's ({@link OrphanSessionTree.why}). */ export type OrphanSessionTreeWhy = "unrecorded" | "record_unreadable" | "record_elsewhere"; /** A session tree no record holds — what {@link listOrphanSessionTrees} lists. */ export interface OrphanSessionTree { /** `<repository root>/.sema/worktrees/<name>`, the list's spelling — the path {@link releaseOrphanSessionTree} takes. */ readonly path: string; /** The tree's branch (`sema/<name>`), present while it exists. */ readonly branch?: string; /** The session its allocation mark names. */ readonly sessionId: string; /** The allocation its mark names. */ readonly allocationId: string; /** The commit it was minted at (its mark). */ readonly baseSha: string; /** `unrecorded`: the host's lookup says that session does not exist, or the id now names another occupant than the one the tree * was minted for (the session deleted and registered again, a log imported into a new row), or its log holds no checkout record · * `record_unreadable`: * the lookup threw, the session's record cannot be read, or its log is loaded from a bounded window that may hold the record * below its floor · `record_elsewhere`: the session's record holds another allocation (a first leg refused while another leg * recorded kept the tree it minted), or holds the tree's allocation without naming the tree (a first leg retried after a crash * that no longer lists the tree's repository). */ readonly why: OrphanSessionTreeWhy; /** `record_unreadable`: why; `record_elsewhere`: the allocation the record holds (and, when it is the tree's own, that it does * not name the tree). */ readonly detail?: string; /** The tree directory's modification time (ms since the epoch): a hint for a host's retention policy, not liveness. */ readonly modifiedAt: number; } /** * The host's lookup of a session by id, handed to the orphan doors. * * @contract session_checkout.session_of.absence_is_authority — `undefined` asserts that the host's DURABLE session store holds no * session with that id (a cache miss is not absence), and the lookup throws whenever it cannot tell. A session it answers is the * id's CURRENT occupant: its row as the durable store holds it now, never a cached view of a row deleted since. The doors read * `undefined` as "no leg of that session will take the tree back", a session of another occupant than the tree's mark names the * same way (an earlier occupant's tree is an orphan, whatever the id names now), and a throw as `record_unreadable`, which neither * door removes. */ export type OrphanSessionLookup = (sessionId: string) => Promise<Session | undefined>; /** * List the session trees under the repository at `root` that no record holds: each managed tree whose allocation mark reads and * whose session ({@link OrphanSessionLookup}) holds no record of that allocation — the tree a first leg kept when its record could * not be written, or one whose session the host deleted without releasing it. Reads only. A tree its session's record holds is * not listed ({@link releaseSessionCheckout} is its door), nor a directory with no readable mark (no session tree, or one neither * door touches). Answers `{ repository, trees }`; a repository with no managed parent answers no trees. */ export declare function listOrphanSessionTrees(env: ExecutionEnv, root: string, opts: { readonly sessionOf: OrphanSessionLookup; }): Promise<{ readonly repository: string; readonly trees: readonly OrphanSessionTree[]; }>; /** * Release one orphan session tree — the host's door for a tree no record holds (as {@link listOrphanSessionTrees} lists it). * The tree is judged again: a tree a session's record holds now answers `kept: "not_owned"` (release that session's checkout * instead), one whose record cannot be read `kept: "unverifiable"`, one with no allocation mark `not_owned`; an orphan is then * removed by the same judgment as {@link releaseSessionCheckout} (clean, no commit past its base, the mark read again right * before the removal, no `--force`; the branch only while it sits at the base commit). Removes nothing on its own initiative, * appends to no session. The host runs the removals of one repository one at a time — this door's, the release's, a deleted * session's cascade (a removal and a mint of the same name between two of them is the known window, KNOWN-LIMITS KL-3462-a). */ export declare function releaseOrphanSessionTree(env: ExecutionEnv, path: string, opts: { readonly sessionOf: OrphanSessionLookup; }): Promise<ReleasedTree>; /** The frame's checkout members, present together (none when the session has no checkout): `session`, the record's cells as the * leg reports them, and `declaration`, the record's normalized declaration — what every later leg sends. */ export declare function sessionFrameOf(record: SessionCheckoutRecord | undefined): Pick<WorkspaceSnapshot, "session" | "declaration">;