/** * Teardown for one attached session, so a window can attach another. * * The runner used to own everything through `ctx.effect`, which was right while * a window drove exactly one session for the life of the process: the plugin * fiber outlived the session, so the two were the same lifetime. Reopening a * session from inside the window breaks that identity — the slot registrations, * the log listener, the spinner timer, and the capability projections belong to * the session, not to the window — and a second attach without a matching * detach would leave the previous session's listener still projecting into the * terminal. * * Deliberately not a Cordis fiber. A fiber would give scoping for free, but the * agent handle's disposer is asynchronous and must run AFTER the presentation is * gone, and expressing "these synchronous disposers, then that awaited one" is * clearer as an explicit ordered stack than as a nested composite effect. * @module dshline/session-scope */ /** * An ordered, error-contained teardown stack. * * Reverse order on purpose: registrations are made outermost-first, so a view * registered after the projection that feeds it must come down before it. */ export declare class SessionScope { private readonly disposers; private done; /** * Take ownership of one disposer. * @param disposer - the teardown to run when this scope closes. */ own(disposer: () => void): void; /** * Run every owned disposer, newest first. * * A throwing disposer must not strand the ones behind it: the whole point of * this call is that nothing from the previous session is left listening, and * one failed unregistration is a smaller problem than a leaked transcript * projection. Failures are collected and the first is rethrown afterwards, so * a bug here is still visible. * @throws the first failure, after every disposer has run. */ dispose(): void; /** Whether teardown has already run. */ get closed(): boolean; } //# sourceMappingURL=session-scope.d.ts.map