/** * Terminal Bindings * * A notebook has exactly one binding per plane (shell / agent) that decides * which named pty its panel attaches to — attach is always deterministic and * duplicates are impossible by construction (get-or-create on the name). * * Scopes: * server → the per-server shared terminal (well-known name `srv-main`) * project → shared by all notebooks in the same directory (`proj--`) * notebook → private to the notebook (`nb---` — the exact * scheme the panel has always used, so pre-binding ptys with live * jobs are grandfathered in, not orphaned) * named → a user-chosen name (normalized like every pty name) * * Persisted as JSON at ~/.nebula/terminal-bindings.json so a notebook's * binding follows it across browsers (same pattern as the agent registry). */ export type TerminalPlane = 'shell' | 'agent'; export type TerminalBindingScope = 'server' | 'project' | 'notebook' | 'named'; export interface TerminalBinding { filePath: string; plane: TerminalPlane; scope: TerminalBindingScope; /** Resolved pty name the panel attaches to (get-or-create). Null for * agent/project bindings — the client derives it from the chosen workdir. */ name: string | null; /** The raw user-supplied name for scope 'named'. */ customName?: string; updatedAt: number; } /** Well-known name of the per-server shared shell. */ export declare const SHARED_SHELL_NAME = "srv-main"; /** Well-known name of the per-server shared AGENT terminal. */ export declare const SHARED_AGENT_NAME = "agent-srv"; /** * Resolve a (plane, scope) to the pty name it binds to. Pure — no I/O. * * Agent-plane specifics: names double as agent-record keys. `project` returns * null — the workdir is a client-side choice (workdir chip), so the client * derives the legacy `agent--` name from it (which is also why * every pre-binding record keeps working). Named agents get an `agent-` * prefix so they can never collide with a shell terminal of the same name. */ export declare function resolveBindingName(plane: TerminalPlane, scope: TerminalBindingScope, filePath: string, customName?: string): string | null; export declare class TerminalBindingStore { private file; private bindings; constructor(file?: string); private key; private load; private persist; get(filePath: string, plane: TerminalPlane): TerminalBinding | null; set(filePath: string, plane: TerminalPlane, scope: TerminalBindingScope, customName?: string): TerminalBinding; delete(filePath: string, plane: TerminalPlane): void; } export declare const terminalBindings: TerminalBindingStore;