/** The two driver methods the reply router touches. */ export interface ReplyTargetDriver { hasPendingQuestion(): boolean; answerQuestion(answer: string, question?: string, requestId?: string): boolean; } export interface ReplyRoutingDeps { /** Re-read late: `swapDriver()` rebinds the outer `driver` var in place. */ getDriver: () => ReplyTargetDriver; /** `DriverSwapGate.awaitSwap` — bind to the fresh driver before a new turn. */ awaitSwap: () => Promise; answer: string; question?: string; requestId?: string; } /** * Decide whether an inbound `reply` completes the turn already in flight or * starts a new one, and gate it accordingly. * * The paused-question fast path runs BEFORE the swap gate, and the ordering is * load-bearing, not stylistic (skaile-ai/workspaces#704). A driver recreate * arms `beginSwap` synchronously and then `awaitActiveTurn()`s; a turn paused * on `AskUserQuestion` only settles once `answerQuestion` resolves it. Awaiting * the swap first therefore closes a cycle — swap waits on turn, turn waits on * answer, answer waits on swap — and wedges the session permanently (only * `handleCancel`, which does not gate on the swap, escapes it). * * Answering is safe to do un-gated precisely because it is the completion of * the existing turn: it targets the current driver, which the swap is waiting * on and has therefore not disposed. Only the fall-through genuinely starts a * new turn, so only the fall-through needs the fresh driver. * * A pending question short-circuits the gate whether or not the driver accepts * the answer: `CodexQuestions.answer` rejects a stale `requestId`, or an * approval answered with anything but `Approve once`/`Deny`, and leaves the * turn parked — awaiting the swap there would simply re-open the cycle. * Returning un-gated is safe because every driver that can reject sets * `acceptsReplyAsPrompt: false`, so the caller stops at the fall-through rather * than prompting a parked driver. * * @returns `"answered"` when the paused turn was resumed and the caller is * done, `"fresh-turn"` when the caller should treat the reply as a prompt. */ export declare function routeReply(deps: ReplyRoutingDeps): Promise<"answered" | "fresh-turn">; //# sourceMappingURL=reply-routing.d.ts.map