import type { ActorRef } from '../types/session/actor.js'; /** * Walking the actor chain that was already there. * * `ActorRef`'s agent variant has carried `parentActor` since the 0.2.0 * design, and its docblock says permission audit events walk this chain to * attribute a subagent's actions back to the originating user. Nothing * walked it — `rg 'isDescendantOf|ancestor'` over this package found no * reader at all. A declared hierarchy with no code that traverses it is a * `declared-but-undriven` primitive, and every cross-tree concern that came * along instead invented its own propagation: `resumeHandler` is threaded * by hand at the spawn site, and a tool scope was about to be. * * **Not a parallel parent registry.** The obvious fix is a `WeakMap` from * child to parent maintained by the manager, and it is the wrong one: the * chain is already persisted on the actor, so a second structure gives the * tree two answers to the same question that can disagree — and the one a * check reads would be the one that is NOT written to disk. */ /** * How far the walk goes before giving up. * * A chain is built by the manager one link per spawn, and the spawn depth * limit is far below this — so reaching it means the chain is malformed or * cyclic, not that somebody legitimately nested a hundred deep. Bounded * rather than cycle-detected with a `Set` because the bound is the thing * that must hold: a containment check that hangs is a denial of service on * whatever holds the lock, and a check that allocates per call to prove a * property nobody can trigger is worse than one that stops. */ export declare const MAX_ACTOR_CHAIN_DEPTH = 64; /** The chain from `actor` up to its root, newest first, `actor` included. */ export declare function actorChain(actor: ActorRef, opts?: { readonly maxDepth?: number; }): readonly ActorRef[]; /** * Whether `ancestor` appears strictly above `actor` in its chain. * * Strictly: an actor is not its own ancestor. The question this answers is * "may what happened up there constrain what happens here", and an actor * constraining itself is not a hierarchy fact — reading it as one makes * every self-comparison silently true and hides a caller that passed the * same actor twice by mistake. * * Returns `false` on a malformed or cyclic chain rather than throwing. The * callers are authorization checks, and the honest answer to "is this * contained by that" when the chain cannot be read is no. */ export declare function isDescendantOfActor(actor: ActorRef, ancestor: ActorRef, opts?: { readonly maxDepth?: number; }): boolean; //# sourceMappingURL=actor-scope.d.ts.map