UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

20 lines (19 loc) • 1.26 kB
import type { SessionHead, SessionStore } from "./session.js"; /** A delegation tree's root anchor as a reading saw it: the root session's id and the occupant its row held. */ interface RootAnchor { readonly sessionId: string; readonly incarnation: string | undefined; } /** Enters `root` as read through `sessions` ({@link ROOT_READ_THROUGH}); answers it. */ export declare function rootReadThrough<R extends RootAnchor>(root: R, sessions: Pick<SessionStore, "headOf">): R; /** * The head read of a tree's root, through the session store this process read the root's occupant through — for the anchor that * reading saw and no other (`root`: the same session id and the same occupant as `anchor`). `undefined` when there is no such read: the * reading anchors no root or another one, its root was declared rather than read, the anchor names no occupant, or the store the root * was read through has no by-id head read. A background agent's durable writer asks it after each write of its row lands. */ export declare function rootHeadReadOf(root: RootAnchor | undefined, anchor: { readonly rootSessionId?: string; readonly rootSessionIncarnation?: string; }): ((sessionId: string) => Promise<SessionHead | undefined>) | undefined; export {};