import { createSidecarProxy } from '../../sidecar/create-proxy';

// `/api/terminal/*` is a plain auth-and-forward proxy onto the pty sidecar's own listener, like every
// other HTTP sidecar. The sidecar owns `/_officer/sessions` (list) and `DELETE /_officer/sessions/:id`
// (kill); the platform knows neither contract, only where to send them.
//
// `/api/terminal/ws` does NOT come through here — Bun's route table takes it first and hands it to the
// byte relay in `websocket.ts`.
const proxy = createSidecarProxy({ name: 'pty', prefix: '/api/terminal' });

export const terminalRouter = proxy.router;
export const getTerminalHttpUrl = proxy.getHttpUrl;
export const getTerminalWsUrl = proxy.getWsUrl;
