UNPKG

framework

Version:

The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.

32 lines 2.53 kB
import type { IncomingMessage, ServerResponse } from 'node:http'; import type { FrameworkEvent } from '../events.js'; import type { StartAgentKind, StartAgentOptions, StartAgentResult } from './types.js'; /** * The device-side of the remote-agent relay (#1067): the two endpoints a daemon exposes so another * daemon (holding this device's token) can run a session here and watch it. They live under * `/_relay`, behind the shared-token guard (#1051) in {@link startDashboard}. The guard admits a matching * `fw_daemon` cookie without the browser-only `?token=` 302, so a daemon-to-daemon call passes with * a cookie and a token-less caller is already 401'd before it reaches here. * * - `POST /_relay/start` starts an ordinary local agent and returns its {@link StartAgentResult}. It * runs in this device's own home checkout (slice 1); which project it targets is a later slice. * - `GET /_relay/events?run=<id>` streams that agent's events as newline-delimited JSON until it * ends or the caller disconnects. * - `GET /_relay/ping` (#1072) a cookie-guarded reachability probe: 200 and an empty body, starts * nothing. The online/offline status the dashboard shows is the local daemon calling this on each * saved device with its token; a token-less caller is already 401'd by the shared-token guard (#1051) above. * - `POST /_relay/rpc` (#1067 slice 2) runs one whitelisted run-scoped RPC (a read/diff/steer/handoff/ * push/PR) against this device's own checkout for the daemon relaying an agent here, answering {result}. */ export declare const RELAY_PREFIX = "/_relay"; /** What the daemon wires behind the relay endpoints: its own start closure and an events tail. */ export interface RelayHandlers { start: (prompt: string, kind: StartAgentKind, options: StartAgentOptions, projectId?: string) => StartAgentResult | Promise<StartAgentResult>; tailEvents: (agentId: string, onEvent: (event: FrameworkEvent) => void) => () => void; /** Run one whitelisted read/steer/handoff RPC against THIS device's own checkout, for the daemon * relaying an agent here (#1067 slice 2); the caller wraps the result as {result}. */ rpc?: (fn: string, args: unknown[]) => Promise<unknown>; } /** Route a `/_relay/*` request. A host that wired no relay handlers 404s every relay route. */ export declare function handleRelayRequest(req: IncomingMessage, res: ServerResponse, pathname: string, handlers: RelayHandlers | undefined): Promise<void>; //# sourceMappingURL=relay-endpoints.d.ts.map