/** * transport/sync-facade.ts — Drop-in replacements for the iTerm primitives, * with MULTI-TRANSPORT enumeration. * * The daemon historically imported `snapshotAllSessions`, `typeIntoSession`, * `pasteTextIntoSession`, and `isClaudeRunningInSession` directly from * adapters/iterm/core.ts. Those imports are repointed here. Every function keeps * the EXACT same signature. * * Transport selection (decided once at module load): * AIBROKER_TRANSPORT=iterm → iTerm only * AIBROKER_TRANSPORT=tmux → tmux only * AIBROKER_TRANSPORT=multi → both (subject to availability) * unset / anything else → AUTO: enumerate whatever is available right now * (non-macOS: tmux only — see policy.ts) * * AUTO is the default and is safe: on a Mac with no tmux server it resolves to * iTerm-only (byte-identical to the pre-transport behaviour — verified). The * instant a tmux server exists, its panes merge into the same session list, so * iTerm and tmux sessions show up together. This is what makes the iTerm→tmux * migration seamless and unblocks PAILot seeing both worlds at once. * * The iTerm path calls core.ts VERBATIM (raw SessionSnapshot: name=process name, * tabTitle separate, paiName=null) so every downstream consumer — gateway * displayName resolution, atPrompt heuristics, name matching — is unchanged. * * Per-id ops (send / busy) route by id shape: tmux pane ids start with "%", * iTerm uses GUIDs. With one transport active, everything routes to it. */ import type { SessionSnapshot } from "../adapters/iterm/core.js"; import type { ManagedSession } from "./session-transport.js"; /** * tmux only sees the foreground command, so idle comes from the pane CONTENT * (`aibroker launch` pins the title, so Claude's ✳ marker never shows). Only * claude/node panes are captured, cached briefly; the ✳ title is the fallback * when capture fails. */ export declare function tmuxAtPrompt(s: ManagedSession, capture?: (id: string, lines: number) => string | null): boolean; export declare function tmuxToSnapshot(s: ManagedSession): SessionSnapshot; /** * Enumerate sessions across all permitted transports, availability checked live. * `fresh` bypasses iTerm's short-lived cache — forwarded verbatim, see * adapters/iterm/core.ts. tmux's `listSessions()` has no such cache to bypass. */ export declare function snapshotAllSessions(opts?: { fresh?: boolean; }): SessionSnapshot[]; /** * Whether the LAST snapshotAllSessions() call actually enumerated iTerm, * rather than getting an osascript failure back as an indistinguishable `[]`. * tmux has no such failure mode here — `listSessions()` returning `[]` means * "no server", which is a real answer, not a dropped one. */ export declare function wasLastEnumerationReliable(): boolean; /** * Decide whether an id belongs to tmux. tmux session ids are now durable * @aibroker_ids (a raw "%N" pane id may also appear during inbound translation). * A "%N" is unambiguously tmux; otherwise check whether a live tmux pane carries * that @aibroker_id (iTerm GUIDs won't match → routed to iTerm). */ export declare function routeToTmux(id: string): boolean; /** Translate a caller's $TMUX_PANE into the durable @aibroker_id identity. */ export declare function aibrokerIdForPane(paneId: string): string | null; /** Inject text + Enter into a session. Refuses a shell unless `allowShell`. */ export declare function typeIntoSession(id: string, text: string, opts?: { allowShell?: boolean; }): boolean; /** Inject text WITHOUT Enter (chunked / partial sends). Same guard. */ export declare function pasteTextIntoSession(id: string, text: string, opts?: { allowShell?: boolean; }): boolean; /** * Clear whatever is on the input line with Ctrl-U, WITHOUT typing or * submitting anything. Used only by the read-back-first typing sequence, and * only after text has been confirmed to have sat unchanged for minutes — see * inputLineDecision. Never sent blind ahead of a type. */ export declare function sendControlU(id: string): boolean; /** Send a bare Enter/CR — the last step of the read-back-first sequence, * only once the line has been read back and verified. */ export declare function sendEnterKey(id: string): boolean; /** * Escape a possible vi-normal-mode stall in the input box before typing. * iTerm-specific (AppleScript's `write text` into Claude Code's input can * land in vi normal mode); tmux's raw key injection never gets stuck this * way, so this is a no-op there. Safe to call on an already-empty line: 'i' * enters insert mode (or types nothing new if already in it beyond one * transient char), the backspace removes exactly what that keystroke added. */ export declare function escapeInputMode(id: string): void; /** Drop a cached readiness verdict (call right after launching into a tab). */ export declare function invalidateReadyCache(id?: string): void; /** True when the session is currently showing a live Claude prompt. */ export declare function isClaudeSession(id: string): boolean; /** * Read what a session is currently showing. Used by checkpoint's ack detection, * which watches for the screen to change (message landed) and then settle * (Claude finished). Returns null when the session can't be read. */ export declare function captureSession(id: string, lines?: number): string | null; /** True when a foreground program (Claude) is running, not at a shell prompt. */ export declare function isClaudeRunningInSession(id: string): boolean; /** * Set a tmux pane's title. Returns false for non-tmux ids — iTerm visuals are * set separately by the caller via the iTerm sessions adapter. */ export declare function setSessionTitle(id: string, title: string): boolean; /** * For a tmux pane id, return the iTerm2 session id of the tab currently viewing * it (via the tmux client tty → iTerm tty match), or null if detached / not on * iTerm. Uses the RAW iTerm enumeration (not the de-duped facade list, which * suppresses viewer tabs) so the host tab can still receive iTerm visuals. */ export declare function itermViewerSessionId(tmuxPaneId: string): string | null; /** Daemon-only diagnostic: module-load logging would leak into every CLI verb's stderr. */ export declare function logTransportPolicy(): void; //# sourceMappingURL=sync-facade.d.ts.map