/** * HTTP Handler — Serves the React dashboard SPA and API proxy endpoints. * * Registered at the `/orgx` prefix. Handles: * /orgx/live → dashboard SPA (index.html) * /orgx/live/assets/* → static assets (JS, CSS, images) * /orgx/api/status → org status summary * /orgx/api/agents → agent states * /orgx/api/activity → activity feed * /orgx/api/initiatives → initiative data * /orgx/api/health → plugin diagnostics + outbox/sync status * /orgx/api/onboarding → onboarding / config state * /orgx/api/agent-suite/status → suite provisioning plan (OpenClaw-local) * /orgx/api/agent-suite/install → install/update suite (OpenClaw-local) * /orgx/api/delegation/preflight → delegation preflight * /orgx/api/runs/:id/checkpoints → list/create checkpoints * /orgx/api/runs/:id/checkpoints/:checkpointId/restore → restore checkpoint * /orgx/api/runs/:id/actions/:action → run control action */ import type { OrgXClient } from "../api.js"; import type { OnboardingState, OrgXConfig, OrgSnapshot } from "../types.js"; import { type OutboxAdapter } from "../adapters/outbox.js"; type OpenClawAdapter = { listAgents?: () => Promise>>; spawnAgentTurn?: (input: { agentId: string; sessionId: string; message: string; thinking?: string | null; }) => { pid: number | null; }; stopDetachedProcess?: (pid: number) => Promise<{ stopped: boolean; wasRunning: boolean; }>; isPidAlive?: (pid: number) => boolean; }; interface PluginRequest { method?: string; url?: string; headers: Record; body?: unknown; on?: (event: string, listener: (...args: unknown[]) => void) => void; once?: (event: string, listener: (...args: unknown[]) => void) => void; } interface PluginResponse { writeHead(status: number, headers?: Record): void; end(body?: string | Buffer): void; write?(chunk: string | Buffer): boolean | void; on?: (event: string, listener: (...args: unknown[]) => void) => void; once?: (event: string, listener: (...args: unknown[]) => void) => void; writableEnded?: boolean; } interface OnboardingController { getState: () => OnboardingState; startPairing: (input: { openclawVersion?: string; platform?: string; deviceName?: string; }) => Promise<{ pairingId: string; connectUrl: string; expiresAt: string; pollIntervalMs: number; state: OnboardingState; }>; getStatus: () => Promise; submitManualKey: (input: { apiKey: string; userId?: string; }) => Promise; cancelPairing?: () => Promise; disconnect: () => Promise; } interface DiagnosticsProvider { getHealth?: (input?: { probeRemote?: boolean; }) => Promise; } export declare function createHttpHandler(config: OrgXConfig & { dashboardEnabled?: boolean; pluginVersion?: string; installationId?: string | null; }, client: OrgXClient, getSnapshot: () => OrgSnapshot | null, onboarding: OnboardingController, diagnostics?: DiagnosticsProvider, adapters?: { outbox?: OutboxAdapter; openclaw?: OpenClawAdapter; }): (req: PluginRequest, res: PluginResponse) => Promise; export {};