/** * Runtime factory - creates and configures the agent runtime * * This is the main entry point for applications using the generic runtime. * Applications provide their own adapter implementations and configuration. * * @example * ```typescript * import { serve } from "@hono/node-server"; * import { createAgentRuntime } from './runtime'; * * * // Create and initialize runtime * const runtime = await createAgentRuntime({ * persistence: new MyPersistenceAdapter(), * profileLoader: new MyProfileLoader(), * sandboxConfig: new MySandboxConfig(), * modal: { * tokenId: process.env.MODAL_TOKEN_ID, * tokenSecret: process.env.MODAL_TOKEN_SECRET, * appName: 'my-app-agents', * }, * }); * * await runtime.start(); * * // Create Hono REST API * const honoApp = runtime.createRestServer({ * apiKey: process.env.API_KEY, * }); * * // Create HTTP server from Hono * const httpServer = serve({ * fetch: honoApp.fetch, * port: 3000, * }); * * // Create WebSocket server on same HTTP server * const wsServer = runtime.createWebSocketServer(httpServer); * * console.log('Server running on http://localhost:3000'); * ``` */ import { type Server } from 'http'; import type { Hono } from 'hono'; import { Server as SocketIOServer } from 'socket.io'; import { EventBus } from './core/event-bus.js'; import { SessionManager } from './core/session-manager.js'; import type { RuntimeConfig } from './types/runtime.js'; import type { ServerToClientEvents, ClientToServerEvents, InterServerEvents, SocketData } from './types/events.js'; /** * Agent runtime instance returned by createAgentRuntime */ export type AgentRuntime = { sessionManager: SessionManager; eventBus: EventBus; createRestServer: (config: { apiKey: string; }) => Hono; createWebSocketServer: (httpServer: Server) => SocketIOServer; start: () => Promise; shutdown: () => Promise; isHealthy: () => boolean; }; /** * Create and initialize the agent runtime * * @param config - Runtime configuration with all required adapters * @returns Initialized runtime instance * * @example * ```typescript * const runtime = await createAgentRuntime({ * persistence: new ConvexPersistenceAdapter(...), * profileLoader: new FileProfileLoader('./profiles'), * sandboxConfig: new MyAppSandboxConfig(...), * modal: { * tokenId: process.env.MODAL_TOKEN_ID, * tokenSecret: process.env.MODAL_TOKEN_SECRET, * appName: 'my-app-agents', * }, * }); * * await runtime.start(); * ``` */ export declare function createAgentRuntime(config: RuntimeConfig): Promise; //# sourceMappingURL=runtime.d.ts.map