import { Actor, ActorRef } from "./actor.js"; import { ActorSystem, SpawnOptions } from "./actor_system.js"; import { Transport } from "./transport.js"; import { Cluster } from "./cluster.js"; import { Registry } from "./registry.js"; import { ActorRefFrom, ActorRegistry, ActorDefinition, DistributedConfig, LocalConfig, TypedActorRef, WaitForClusterOptions } from "./types/functional.js"; import type { Keyring } from "./types/functional.js"; export declare function isClusterReady(members: string[], options: { minMembers?: number; nodes?: string[]; }): boolean; export declare function waitForCluster(cluster: Cluster, options?: WaitForClusterOptions): Promise; /** * System wrapper that provides a unified API for interacting with the actor system. * Exposes escape hatches for advanced use cases. */ export interface System { /** Spawn an actor (class-based or functional) */ spawn any>, TCasts extends Record void>>(actorClass: ActorDefinition, options?: SpawnOptions): TypedActorRef; spawn(actorClass: new () => T, options?: SpawnOptions): ActorRef; /** Register an actor class for remote spawning */ register(actorClass: new () => Actor): void; /** Look up a named actor (local or remote) */ getActorByName(name: K): Promise | null>; getActorByName(name: string): Promise; /** Wait for the cluster to reach a ready state based on membership conditions */ waitForCluster(options?: WaitForClusterOptions): Promise; /** Gracefully shut down the system */ shutdown(): Promise; /** Stop a specific actor (cascading termination of children) */ stop(ref: ActorRef): Promise; /** Add an actor to a named process group */ joinGroup(group: string, ref: ActorRef): void; /** Remove an actor from a named process group */ leaveGroup(group: string, ref: ActorRef): void; /** Get all actors in a named process group */ getGroup(group: string): ActorRef[]; /** Broadcast a cast message to all actors in a process group */ broadcast(group: string, message: any): void; /** The underlying transport layer */ readonly transport: Transport; /** The underlying cluster membership */ readonly cluster: Cluster; /** The underlying actor registry */ readonly registry: Registry; /** The underlying actor system */ readonly system: ActorSystem; /** The node ID */ readonly nodeId: string; /** Keyring for cookie rotation. Only available on distributed systems. */ readonly keyring?: Keyring; } /** * Creates an actor system with minimal configuration. * * @example Local mode (synchronous) * ```typescript * // Default local system * const system = createSystem(); * * // Local system with custom nodeId * const system = createSystem({ nodeId: "my-node" }); * ``` * * @example Distributed mode (asynchronous) * ```typescript * // Distributed system with port convention (rpc=5000, pub=5001, gossip=5002) * const system = await createSystem({ * type: "distributed", * port: 5000, * seedNodes: ["127.0.0.1:6002"], // Connect to another node's gossip port * }); * * // Distributed system with explicit ports * const system = await createSystem({ * type: "distributed", * ports: { rpc: 5000, pub: 5001, gossip: 5002 }, * seedNodes: [], * }); * ``` */ export declare function createSystem(): System; export declare function createSystem(config: LocalConfig): System; export declare function createSystem(config: DistributedConfig): Promise; //# sourceMappingURL=create_system.d.ts.map