/** * Trellis Server — HTTP + WebSocket Server * * Node-compatible server (no Express) exposing REST + realtime endpoints. * * REST: * POST /entities Create entity * GET /entities/:id Read entity * PUT /entities/:id Update entity attributes * DELETE /entities/:id Delete entity * GET /entities?type=&limit=&offset= List entities * GET /ops?kind=&limit=&offset= List causal ops (newest last in page) * POST /query EQL-S query * POST /upload File upload → blob hash * GET /files/:hash Download blob * GET /health Health check * GET /cron/status Cron scheduler probe (ADR 0019) * GET /admin/usage?tenant= Day-bucket usage (TURTLEDB_ADMIN_KEY) * * Auth: * POST /auth/login Email+password → JWT * POST /auth/register Create user → JWT * GET /auth/oauth/:provider OAuth redirect * GET /auth/oauth/:provider/callback OAuth callback → JWT * * WebSocket: * GET /realtime Upgrade to WebSocket for subscriptions * * MCP (Streamable HTTP): * GET/POST/DELETE /mcp Remote graph query/CRUD for AI agents * * @module trellis/server */ import type { TrellisDbConfig } from '../client/config.js'; import type { TenantPool } from './tenancy.js'; import type { PermissionRegistry } from './permissions.js'; import type { TrellisHttpServer } from './server-shared.js'; export type { TrellisHttpServer } from './server-shared.js'; import type { RealtimeRelayOptions } from '../realtime/relay-server.js'; /** * Presence / blob relay mount options for {@link startServer}. * `true` → `{ path: '/rt' }` (WS only). Pass a full * {@link RealtimeRelayOptions} object to enable `/blob` via `blobStore`. */ export type PresenceRelayOptions = boolean | RealtimeRelayOptions; export interface ServerConfig { port?: number; config: TrellisDbConfig; pool: TenantPool; permissions?: PermissionRegistry; oauthProviders?: Record; /** Mount a cross-browser presence relay at `/rt` on the same HTTP server. */ presenceRelay?: PresenceRelayOptions; /** * Graph-native cron (ADR 0019). Default: attach when `TRELLIS_CRON !== '0'`. * Pass `false` to disable even when the env gate would allow it. */ cron?: boolean | { tickMs?: number; }; } /** * Start the Trellis DB HTTP + WebSocket server. * * Uses Node's `node:http` + the `ws` library. Works in Node and WebContainer. */ export declare function startServer(opts: ServerConfig): Promise; /** * Alias for `startServer` — kept for API compatibility with callers that * previously used the cross-runtime dispatch path. */ export declare const startServerCrossRuntime: typeof startServer; //# sourceMappingURL=server.d.ts.map