import type { ChildLike } from "@yanlinglabs/winter-agent-sdk/messaging"; import type { RuntimeDirectoryEntry } from "../seams/directory-store.js"; import type { DeliveryOutcome, GlobalAgentMessage, ListedRuntimeObject, RuntimeAddress, SerializedRuntimeAddress } from "../seams/messaging-contract.js"; /** * The session that OWNS an address (WS-10 §10.3, §11 rule 2). * * For a session that is the session itself; for an agent it is the parent, never the child — "a child * is only addressable within its owning parent", and every fence in this package is that one * sentence applied to a concrete pair of ids. */ export declare function owningSessionIdOf(address: RuntimeAddress): string; /** WS-10 §11's listing row for one entry. The row IS the directory record — nothing is inferred. */ export declare function entryToListedRuntimeObject(entry: RuntimeDirectoryEntry): ListedRuntimeObject; /** `starting`/`running` are live for resolution's purposes; everything else is terminal or worse. */ export declare function isLiveStatus(status: RuntimeDirectoryEntry["status"]): boolean; /** * WS-10 §10.2's LISTING eligibility — deliberately narrower than resolution's. * * "It lists what `SendMessage` can currently reach — children of this parent, teammates, eligible * LIVE peer sessions — and does NOT enumerate exited transcripts on disk." A terminal CHILD is still * listed (it is resumable through its owner, and the subpath's own child row says so with * `capabilities.resume`); an exited SESSION is not, because listing one is the enumeration that * sentence forbids. Resolution still reaches an exited session by canonical address — WS-15 §6.2's * routing table has a row for delivering to one — which is exactly why these are two functions and * not one. */ export declare function isListableFrom(entry: RuntimeDirectoryEntry, callerOwningSessionId: string): boolean; /** * What RESOLUTION may see: every non-archived object this caller could legitimately address. * * An archived session "refuses until a deliberate user/product resume unarchives it" (WS-15 §6.2), so * it is not resolvable at all — the refusal belongs at the delivery door only for objects a caller can * name, and an archived row is not one of them. */ export declare function isResolvableFrom(entry: RuntimeDirectoryEntry, callerOwningSessionId: string): boolean; /** * A `ChildLike` view of a child entry, so WS-10 §11's SHARED resolution runs over directory rows. * * `steer`/`resume` are the two doors `ChildLike` requires. The router never calls them — the core's * own `deliverEnvelope` calls `adapter.steerChild`/`adapter.resumeChild` and uses `ChildLike` only * for `status()` and the three `record` fields — so they are wired to the caller's own delivery * function rather than left as throws: a `ChildLike` that threw would be a trap for any future caller * that reasonably used the interface it was handed. * * `permission.effectiveMode` is the one member with no source on a directory row, and it is * UNOBSERVABLE by construction: the only place the subpath reads it is * `childToListedRuntimeObject`'s `mode`, and this package never renders a child through that function * — `resolve()` maps every candidate back to `entryToListedRuntimeObject`, which reads the entry's own * `mode`. It is stated here rather than left to be discovered, because a future caller that DID * render a `ChildLike` directly would otherwise show every child the same made-up mode. */ export declare function entryToChildLike(entry: RuntimeDirectoryEntry, deliver: (entry: RuntimeDirectoryEntry, msg: GlobalAgentMessage) => Promise): ChildLike; /** * THE ONE FIELD-LEVEL MERGE RULE IN THIS PACKAGE, and it exists because two lanes write one row. * * Lane A's supervised spawn proxy records WS-14 §6 rule 2's observed `CLAUDE_CONFIG_DIR` and §9's * pid-plus-start-identity onto the LAUNCHED SESSION's own directory entry, through the store's * `upsert` — which is a full REPLACE. A host that later records a status change through * `RuntimeDirectory.record()` builds its entry from what IT knows, which is never those two fields: * a plain `upsert` would drop them, and WS-15 §6.4 step 2 (revalidate process identity) plus §6 rule * 5 (clear the recorded root only after verified cleanup) would then be reading a row that lost its * evidence — silently, with nothing failing at the time. * * SO THE RULE IS NARROW AND STATED: exactly the two ADAPTER-OWNED fields are carried forward when the * incoming entry omits them. Everything else is the caller's, including a caller's `undefined` for a * field it owns, because a merge that preserved every absent field would make a display name or a * parent impossible to clear. Lane A's own `clear()` writes through the STORE (not through this * door), so rule 5's clearing still works exactly as it did. */ export declare function mergeAdapterOwnedFields(incoming: RuntimeDirectoryEntry, existing: RuntimeDirectoryEntry | undefined): RuntimeDirectoryEntry; /** Many rows, one mapping — so no caller ever writes the `.map(entryToListedRuntimeObject)` itself. */ export declare function entryToListedRuntimeObjectList(entries: readonly RuntimeDirectoryEntry[]): ListedRuntimeObject[]; /** * The parent's canonical address for a child entry. * * `parentAddress` is optional on the record, so the fallback derives it from the child's own parsed * address — through the SUBPATH's serializer, never a template literal, so this package has exactly * one spelling of WS-10 §11's serialization. */ export declare function parentAddressOf(entry: RuntimeDirectoryEntry): SerializedRuntimeAddress | undefined; /** The canonical address of a session id — the same one spelling. */ export declare function sessionAddressOf(winterSessionId: string): SerializedRuntimeAddress;