import type { System } from "../create_system.js"; import type { ActorDefinition } from "../types/functional.js"; /** * Options passed to `spawn` via NodeAgent. * A subset of SpawnOptions — only the fields that make sense for remote orchestration. */ export interface NodeAgentSpawnOptions { name?: string; args?: any[]; } /** * Node information returned by `getNodeInfo`. */ export interface NodeInfo { nodeId: string; uptime: number; memoryUsage: NodeJS.MemoryUsage; actorCount: number; } /** Explicit call handlers for JSR fast-check (no slow types). */ export type NodeAgentCalls = { ping: () => "pong"; getNodeInfo: () => NodeInfo; registerActor: (name: string, definition: ActorDefinition) => void; spawn: (className: string, options?: NodeAgentSpawnOptions) => string; stopActor: (actorName: string) => Promise; callActor: (actorName: string, method: string, ...args: any[]) => Promise; castActor: (actorName: string, method: string, ...args: any[]) => Promise; getActorIds: () => string[]; shutdown: () => Promise; }; /** * NodeAgent — a regular actor that runs on every node, enabling remote * actor management via standard actor calls. * * Named `node-agent@{nodeId}` so any node can find it via `getActorByName`. * * Usage: * ```typescript * const system = await createSystem({ ... }); * * // Register actor classes that can be spawned remotely * const agent = system.spawn(NodeAgent, { * name: `node-agent@${system.nodeId}`, * args: [system], * }); * * // From any node in the cluster: * const remoteAgent = await system.getActorByName("node-agent@node-B"); * await remoteAgent.call("spawn", "Counter", { name: "order-counter" }); * await remoteAgent.call("getNodeInfo"); * ``` */ export declare const NodeAgent: ActorDefinition<[System], NodeAgentCalls, {}>; //# sourceMappingURL=node_agent.d.ts.map