/** * `/api/v1/relay/{status,reconnect}` — authenticated runtime control * over the daemon's RelayClient instance. * * `loopsy mobile pair` writes a fresh `relay:` block into * `~/.loopsy/config.yaml` and then POSTs `/relay/reconnect` so the * daemon swaps its in-memory RelayClient without restarting the process. * Active PTY sessions and the local Unix socket survive the swap. * * Both endpoints sit behind the standard bearer-auth hook * (`auth.ts:30` whitelists `/api/v1/health` only) so neither leaks * relay topology to anyone on the LAN. */ import type { FastifyInstance } from 'fastify'; import type { LoopsyConfig } from '@loopsy/protocol'; import { RelayClient, type RelayClientLogger } from '../services/relay-client.js'; import type { PtySessionManager } from '../services/pty-session-manager.js'; /** * Mutable holder so the route can swap the RelayClient instance the * daemon is using. server.ts constructs the holder once at boot and * mutates `current` in place when /reconnect lands. */ export interface RelayClientHandle { current: RelayClient | null; } interface RelayRouteDeps { handle: RelayClientHandle; pty: PtySessionManager; logger: RelayClientLogger; /** Same in-memory config object the rest of the daemon reads. We mutate * `config.relay` here so saveCustomCommands and other code see the new * link without a daemon restart. */ config: LoopsyConfig; /** Same dataDir as the rest of the daemon. Optional so this matches * config.server.dataDir, which is also optional. */ dataDir?: string; } export declare function registerRelayRoutes(app: FastifyInstance, deps: RelayRouteDeps): void; export {}; //# sourceMappingURL=relay.d.ts.map