UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

57 lines • 2.15 kB
import { CompactLaneCurrent } from "./compact-lane-current.js"; /** * The read side of an acceptance lane: every reader of a root goes through here and is refused once the root is not * live. Publishing and releasing roots stays with the lane (`SessionAcceptanceLane`), which owns these three fields. */ export class AcceptedRootReads { constructor() { this.live = new Set(); this.rootOwners = new WeakMap(); this.current = new CompactLaneCurrent(); } get liveRoots() { return this.live.size; } /** True while `root` is readable: published by this lane and not released, by its holder or a retirement. */ holds(root) { return this.live.has(root); } readCurrent(root) { if (!this.live.has(root)) throw new Error("accepted root released"); return this.current.read(root.current); } readCurrentComponents(root) { if (!this.live.has(root)) throw new Error("accepted root released"); return this.current.readComponents(root.current); } readCurrentActive(root) { if (!this.live.has(root)) throw new Error("accepted root released"); return this.current.readActive(root.current); } readCurrentCalls(root) { if (!this.live.has(root)) throw new Error("accepted root released"); return this.current.readCalls(root.current); } /** The cut's content store under its lease (S09 catalog build and reads). */ cutStorage(root, use) { return this.current.cutStorage(root.current, use); } readSettled(root) { return this.settledOwner(root).read(root.settled); } /** The bounded settled reader of a live root (S10b catalog families); refused once the root is released. */ settledOf(root) { return this.settledOwner(root).reader(root.settled); } settledOwner(root) { const owner = this.rootOwners.get(root); if (!owner || !this.live.has(root)) throw new Error("accepted root released"); return owner; } } //# sourceMappingURL=session-acceptance-reads.js.map