/** * Start Server - Unified Server API * * Simple alternative to createServer + createServerPlugin pattern. * Auto-discovers slices from state and routes from plugins. */ import type { Runtime, Action } from "@gizmo-ai/runtime"; import type { ServerRoute, AuthConfig } from "./types.ts"; import type { ManifestConfig, Server } from "./types.ts"; import type { ActionContract } from "@gizmo-ai/runtime"; import type { PluginManifestSchema } from "./manifest-schema.ts"; /** * Configuration for startServer() */ export interface StartServerConfig { /** Port to listen on (default: 3001) */ port?: number; /** Heartbeat interval in ms (default: 30000) */ heartbeatInterval?: number; /** Base path for all routes (default: "") */ basePath?: string; /** Custom serializer for state (default: safe JSON serializer) */ serializer?: (value: unknown) => string; /** Optional manifest configuration for agent identity */ manifest?: ManifestConfig; /** State slices to broadcast (default: auto-discovered from state) */ slices?: string[]; /** Number of recent runs to store for history (default: 10) */ historySize?: number; /** Persistence configuration for JSONL storage */ persistence?: { enabled: boolean; baseDir?: string; }; /** Action contracts from installed plugins */ contracts?: ActionContract[]; /** Routes to mount (replaces plugin route auto-discovery) */ routes?: ServerRoute[]; /** Authentication configuration (optional, no auth by default) */ auth?: AuthConfig; /** * Plugin manifest schemas for static manifest generation. * When provided, the manifest uses these schemas instead of inferring from runtime state. */ schemas?: PluginManifestSchema[]; /** * Whether to infer state schema from runtime (default: false when schemas provided). * Set to true to always use runtime inference even when schemas are available. */ inferState?: boolean; } /** * Start a server for an Gizmo runtime with automatic route discovery * * This is the simplified API that: * - Auto-discovers state slices * - Auto-mounts plugin routes * - Creates server plugin automatically * * @example * ```typescript * import { createRuntime } from "@gizmo-ai/runtime"; * import { hitl, branching } from "@gizmo-ai/hitl-plugin"; * import { agent } from "@gizmo-ai/agent-plugin"; * import { startServer } from "@gizmo-ai/server"; * * const runtime = createRuntime({ * plugins: [ * hitl({ autoApprove: ['read', 'glob', 'grep'] }), * agent({ model, tools, systemMessage }), * branching(), * ], * }); * * // Routes auto-mounted from plugins: * // - /approvals (from hitl) * // - /branching (from branching) * const server = startServer(runtime, { port: 3001 }); * ``` */ export declare function startServer, A extends Action>(runtime: Runtime, config?: StartServerConfig): Server; //# sourceMappingURL=start-server.d.ts.map