import { R as RegistryConfig, A as ActorDriver, a as AnyConn, b as AnyActorInstance, E as Encoding, c as EventSchemaConfig, Q as QueueSchemaConfig, d as Actions, e as ActorConfigInput, f as ActorDefinition, g as event$1, q as queue$1 } from './config-BFqid9Gr.js';
export { h as ActionContext, i as ActionContextOf, j as ActorConfig, k as ActorConfigSchema, l as ActorContext, m as ActorContextOf, n as ActorKey, o as ActorKv, p as ActorQuery, r as ActorTypes, s as ActorsSchema, t as AnyActorDefinition, u as AnyClient, v as AuthIntent, B as BeforeActionResponseContext, w as BeforeActionResponseContextOf, x as BeforeConnectContext, y as BeforeConnectContextOf, C as Client, z as Conn, D as ConnContext, F as ConnContextOf, G as ConnInitContext, H as ConnInitContextOf, I as ConnectContext, J as ConnectContextOf, K as CreateConnStateContext, L as CreateConnStateContextOf, M as CreateContext, N as CreateContextOf, O as CreateVarsContext, P as CreateVarsContextOf, S as DestroyContext, T as DestroyContextOf, U as DisconnectContext, V as DisconnectContextOf, W as DocActorConfigSchema, X as DocActorOptionsSchema, Y as DocConfigureRunnerPoolSchema, Z as DocInspectorConfigSchema, _ as DocRegistryConfigSchema, $ as DocRunnerConfigSchema, a0 as DocServerlessConfigSchema, a1 as FetchHandler, a2 as InspectorUnsubscribe, a3 as LegacyStartServerOutput, a4 as RUN_FUNCTION_CONFIG_SYMBOL, a5 as Registry, a6 as RegistryActors, a7 as RegistryConfigInput, a8 as RegistryConfigSchema, a9 as RequestContext, aa as RequestContextOf, ab as RunConfig, ac as RunConfigSchema, ad as RunContext, ae as RunContextOf, af as RunInspectorConfig, ag as ServerlessHandler, ah as SleepContext, ai as SleepContextOf, aj as StateChangeContext, ak as StateChangeContextOf, al as TestConfig, am as TestConfigSchema, an as Type, ao as WakeContext, ap as WakeContextOf, aq as WebSocketContext, ar as WebSocketContextOf, as as WorkflowInspectorConfig, at as buildActorNames, au as createClientWithDriver, av as getRunFunction, aw as getRunInspectorConfig, ax as getRunMetadata, ay as lookupInRegistry, az as setup, aA as test } from './config-BFqid9Gr.js';
import { A as AnyDatabaseProvider } from './config-BiNoIHRs.js';
export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-x9zKhx5T.js';
import { WSContext } from 'hono/ws';
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
export { n as noopNext } from './utils-fwx3o3K9.js';
import { D as DriverConfig } from './driver-Bxv62E2p.js';
export { a as DriverConfigSchema } from './driver-Bxv62E2p.js';
import { z } from 'zod';
import { GetUpgradeWebSocket } from './utils.js';
export { toUint8Array } from './utils.js';
export { A as ALLOWED_PUBLIC_HEADERS, P as PATH_CONNECT, a as PATH_WEBSOCKET_PREFIX } from './actor-router-consts-D29T1Z-K.js';
import { Hono } from 'hono';
export { K as KV_KEYS } from './keys-CydblqMh.js';
export { UserError, UserErrorOptions } from './actor/errors.js';
import 'zod/v4';
import '@rivetkit/traces';
import 'vbare';
import 'pino';
import '@rivetkit/sqlite-vfs';
import 'drizzle-orm/sqlite-core';
import '@standard-schema/spec';
import 'nanoevents';
import './v3-DnYObHH3.js';
import '@rivetkit/bare-ts';
import '@rivetkit/workflow-engine';
import 'hono/utils/http-status';

interface UniversalEvent {
    type: string;
    target?: any;
    currentTarget?: any;
}
interface UniversalMessageEvent extends UniversalEvent {
    data: string;
    lastEventId: string;
    origin: string;
}
interface UniversalErrorEvent extends UniversalEvent {
    message: string;
    filename?: string;
    lineno?: number;
    colno?: number;
    error?: any;
}
/**
 * Common EventSource interface that can be implemented by different EventSource-like classes
 * This is compatible with the standard EventSource API but allows for custom implementations
 */
interface UniversalEventSource {
    readonly CONNECTING: 0;
    readonly OPEN: 1;
    readonly CLOSED: 2;
    readonly readyState: 0 | 1 | 2;
    readonly url: string;
    readonly withCredentials: boolean;
    close(): void;
    addEventListener(type: string, listener: (event: any) => void): void;
    removeEventListener(type: string, listener: (event: any) => void): void;
    dispatchEvent(event: UniversalEvent): boolean;
    onopen?: ((event: UniversalEvent) => void) | null;
    onmessage?: ((event: UniversalMessageEvent) => void) | null;
    onerror?: ((event: UniversalErrorEvent) => void) | null;
}

interface ActorRouterBindings {
    actorId: string;
}
type ActorRouter = Hono<{
    Bindings: ActorRouterBindings;
}>;
/**
 * Creates a router that runs on the partitioned instance.
 *
 * You only need to pass `getUpgradeWebSocket` if this router is exposed
 * directly publicly. Usually WebSockets are routed manually in the
 * ManagerDriver instead of via Hono. The only platform that uses this
 * currently is Cloudflare Workers.
 */
declare function createActorRouter(config: RegistryConfig, actorDriver: ActorDriver, getUpgradeWebSocket: GetUpgradeWebSocket | undefined, isTest: boolean): ActorRouter;

interface UpgradeWebSocketArgs {
    conn?: AnyConn;
    actor?: AnyActorInstance;
    onRestore?: (ws: WSContext) => void;
    onOpen: (event: any, ws: WSContext) => void;
    onMessage: (event: any, ws: WSContext) => void;
    onClose: (event: any, ws: WSContext) => void;
    onError: (error: any, ws: WSContext) => void;
}
declare function routeWebSocket(request: Request | undefined, requestPath: string, requestHeaders: Record<string, string>, config: RegistryConfig, actorDriver: ActorDriver, actorId: string, encoding: Encoding, parameters: unknown, gatewayId: ArrayBuffer | undefined, requestId: ArrayBuffer | undefined, isHibernatable: boolean, isRestoringHibernatable: boolean): Promise<UpgradeWebSocketArgs>;

declare function actor<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> = Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>(input: ActorConfigInput<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions>): ActorDefinition<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions>;

declare const event: typeof event$1;
declare const queue: typeof queue$1;

/**
 * InlineWebSocketAdapter creates two linked WebSocket objects:
 * - clientWs: for the client/proxy side (returned from openWebSocket)
 * - actorWs: for the actor side (passed via wsContext.raw)
 *
 * Each side's send() triggers the OTHER side's message event.
 */
declare class InlineWebSocketAdapter {
    #private;
    constructor(handler: UpgradeWebSocketArgs);
    /** Get the client-side WebSocket (for proxy/client code) */
    get clientWebSocket(): UniversalWebSocket;
    /** Get the actor-side WebSocket (passed to actor via wsContext.raw) */
    get actorWebSocket(): UniversalWebSocket;
}

declare function createEngineDriver(): DriverConfig;

declare const CreateFileSystemDriverOptionsSchema: z.ZodObject<{
    path: z.ZodOptional<z.ZodString>;
    useNativeSqlite: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
type CreateFileSystemDriverOptionsInput = z.input<typeof CreateFileSystemDriverOptionsSchema>;
declare function createFileSystemDriver(opts?: CreateFileSystemDriverOptionsInput): DriverConfig;
declare function createMemoryDriver(): DriverConfig;

export { Actions, ActorConfigInput, ActorDefinition, type ActorRouter, AnyActorInstance, AnyConn, DriverConfig, Encoding, InlineWebSocketAdapter, RegistryConfig, type UniversalErrorEvent, type UniversalEvent, type UniversalEventSource, type UniversalMessageEvent, actor, createActorRouter, createEngineDriver, createFileSystemDriver, createMemoryDriver, event, queue, routeWebSocket };
