Flips the connection model so sidecars register themselves with the API server via WebSocket at /api/sidecar/register, enabling dynamic discovery, location independence, and automatic reconnection from either side. - Add registration protocol types and PTY command/event types - Create sidecar-registry.ts (replaces sidecar-client.ts) as passive registry - Create sidecar connector (connect.ts) with exponential backoff reconnect - Convert process sidecar from WS server to WS client - Convert PTY sidecar from WS server to multiplexed WS client - Simplify terminal bridge to thin adapter using registry - Add PTY sidecar as PM2-managed process - Update all consumer imports Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
17 lines
473 B
TypeScript
17 lines
473 B
TypeScript
// ── Sidecar self-registration protocol ──
|
|
|
|
// Sidecar → API server on connect
|
|
export type SidecarRegistration = {
|
|
type: 'register';
|
|
name: string; // 'process' | 'pty' | custom
|
|
capabilities: string[]; // ['claude', 'pi', 'queue', 'proxy'] or ['terminal']
|
|
};
|
|
|
|
// API server → sidecar ack
|
|
export type RegistrationAck = {
|
|
type: 'registered';
|
|
id: string; // server-assigned ID
|
|
};
|
|
|
|
export type RegistrationMessage = SidecarRegistration | RegistrationAck;
|