import type { BridgeTarget, IBridge } from "../bridge.js"; import type { EditorSession } from "../session.js"; import { GuardRegistry, type ResolveExistingFile } from "./guard.js"; export type { ResolveExistingFile } from "./guard.js"; /** * The dialog gate, at the boundary every route to the editor shares. * * A tool action, a flow step, a nested flow, a guard task making its own * calls: they all arrive here, so refusing here is what makes the guarantee * hold without a second copy of the rule anywhere else. The plugin refuses too, * and agrees, but it cannot see a call that never reaches it and it does not * know this machine's dialog mode. * * Returns the refusal to send back, or null to let the call through. */ export declare function refuseIfBlocked(session: EditorSession | undefined, method: string): Promise | null>; /** * Arm or clear the dialog latch from what the editor just said. * * Every bridge call funnels through here, so the latch is set by the first * refusal the plugin's gate emits rather than by a poll. Anything that comes * back normally proves the game thread is running again, which is what clears * it: an agent that answers the dialog does not then have to tell the server * it did. */ export declare function observeReply(session: EditorSession | undefined, method: string, result: T): T; /** * The dialog gate alone, with no flow pipeline around it. * * A guard task runs on the RAW bridge on purpose, so that a guard which itself * calls the editor cannot re-enter the pipeline that is running it. That is a * statement about the flow registry, not about dialogs: raw also meant those * calls were the one route that reached a parked game thread unrefused, where * they hung until they timed out. This restores the gate and nothing else. */ export declare class DialogGatedBridge implements IBridge { private readonly inner; private readonly session; constructor(inner: IBridge, session: EditorSession); get isConnected(): boolean; connect(timeoutMs?: number): Promise; retargetProject(uprojectPath: string, configPort?: number): BridgeTarget; getTarget(): BridgeTarget; call(method: string, params?: Record, timeoutMs?: number): Promise; } export declare class GuardedBridge implements IBridge { private readonly inner; private readonly registry; private readonly resolveExistingFile; /** The session this pipeline belongs to, so guards can see which editor * they are guarding rather than assuming the process has only one. */ private readonly session?; constructor(inner: IBridge, registry: GuardRegistry, resolveExistingFile: ResolveExistingFile, /** The session this pipeline belongs to, so guards can see which editor * they are guarding rather than assuming the process has only one. */ session?: EditorSession | undefined); private guardCall; /** Feed the reply back to the guard, which decides what it proves. */ private observe; get isConnected(): boolean; connect(timeoutMs?: number): Promise; retargetProject(uprojectPath: string, configPort?: number): BridgeTarget; getTarget(): BridgeTarget; call(method: string, params?: Record, timeoutMs?: number): Promise; }