/** * Channel names for the control plane (request/response over ipcMain.handle). * * This module is deliberately dependency-free: the preload script imports it, * and a sandboxed preload should stay as small as possible. Zod schemas live in * `ipc-schemas.ts` and are imported only by the main process. */ export const CH = { APP_INFO: 'app:info', // Every tree mutation returns the full refreshed tree rather than the single // changed row. A move rewrites sort orders, and returning the tree makes it // impossible for the renderer's copy to drift out of sync with the database // — a class of bug that is tedious to reproduce and trivial to avoid at this // scale (a connection inventory is hundreds of rows, not millions). TREE_LIST: 'tree:list', FOLDER_CREATE: 'folder:create', FOLDER_RENAME: 'folder:rename', HOST_CREATE: 'host:create', HOST_UPDATE: 'host:update', // Folders and hosts share one id space and one ordering, so moving and // deleting are single operations rather than one channel per kind. NODE_MOVE: 'node:move', NODE_DELETE: 'node:delete', // Sessions. Terminal bytes do NOT travel on these — they go over a // per-session MessagePort. See `session-protocol.ts`. SESSION_OPEN: 'session:open', SESSION_OPEN_LOCAL: 'session:openLocal', SESSION_CLOSE: 'session:close', // Credentials are write-only from the renderer's side. There is deliberately // no channel that returns a stored secret; see `shared/api.ts`. CREDENTIAL_SET: 'credential:set', CREDENTIAL_DELETE: 'credential:delete', CREDENTIAL_HAS: 'credential:has', } as const export type Channel = (typeof CH)[keyof typeof CH]