/** * adapters/iterm/core.ts — Low-level iTerm2 AppleScript primitives. * * Foundation of all iTerm2 communication. Wraps `osascript` and `spawnSync` * with zero transport-specific imports. */ export declare function runAppleScript(script: string, timeoutMs?: number): string | null; export declare function stripItermPrefix(id: string | undefined): string | undefined; export declare function withSessionAppleScript(sessionId: string, body: string, fallback?: string): string; export declare function sendKeystrokeToSession(sessionId: string, asciiCode: number): boolean; export declare function sendEscapeSequenceToSession(sessionId: string, dirChar: string): boolean; export declare function typeIntoSession(sessionId: string, text: string): boolean; export declare function pasteTextIntoSession(sessionId: string, text: string): boolean; export declare function findClaudeSession(): string | null; export declare function isClaudeRunningInSession(sessionId: string): boolean; export declare function isItermRunning(): boolean; export declare function isItermSessionAlive(sessionId: string): boolean; export declare function isScreenLocked(): boolean; /** * Write a line to a tty device. * * This used to build `sh -c "printf '%s\n' '' > "`. Two things * were wrong with that. The path was interpolated unquoted, so everything after * the `/dev/ttys` prefix the check required was shell syntax rather than a * filename. And the text — arbitrary inbound WhatsApp/Telegram/Todoist content — * was held inside single quotes by one hand-rolled escape that had to stay * exactly right forever. Neither risk is worth running a shell to copy bytes * into a file descriptor, so it no longer runs one. */ export declare function writeToTty(ttyPath: string, text: string): boolean; export interface SessionSnapshot { id: string; name: string; profileName: string; tabTitle: string | null; tty: string; atPrompt: boolean; paiName: string | null; /** * Durable, transport-stable id. For tmux this is the pane's @aibroker_id * (survives server restarts, unlike the volatile %N pane id). For iTerm it is * undefined — the GUID in `id` is already stable. Persistent-name lookups key * on this when present so a tmux session keeps its name across %N churn. */ aibrokerId?: string | null; /** * Whether a Claude is actually running on this terminal, read from the * process table. Undefined when that could not be read — a caller must then * fall back to guessing from the title rather than treat "unknown" as "no". */ isClaude?: boolean; } export declare function snapshotAllSessions(): SessionSnapshot[]; /** * Clear the user.paiName variable from all live iTerm2 sessions. * Used for recovery when session names are corrupt. * Does a single AppleScript pass over all sessions. */ export declare function clearAllPaiNames(): number; //# sourceMappingURL=core.d.ts.map