/** * AgentRPC:把本地 Agent 暴露为本机 RPC 服务的对外类。 * * 关键点(中文) * - 持有一个 `Agent` 引用,按需启动 / 关闭底层 net server。 * - RPC 协议本身仍是 NDJSON over TCP,不做协议变更。 * - 仅提供 `listen()` / `close()` / `binding()` 三个方法,端口、host 由调用方决定。 */ import type { Agent } from "../../../agent/Agent.js"; import type { WorkspaceBase } from "@downcity/workspace"; import type { AgentPlugins } from "../../../types/plugin/PluginRuntime.js"; import type { AgentRpcBinding, AgentRpcListenOptions } from "../types/AgentRpcBinding.js"; import type { AgentRpcRuntimeOptions } from "../types/AgentRpcRuntime.js"; /** * 把一个 `Agent` 暴露为本机 RPC 服务。 */ export declare class AgentRPC { private readonly agent; private readonly workspace?; private readonly plugins?; private readonly session_collection; private readonly runtime_options; /** 当前 Agent RPC Server 的唯一串行生命周期。 */ private readonly lifecycle; constructor(agent_or_workspace: Agent | { agent: Agent; workspace: WorkspaceBase; plugins: AgentPlugins; }, workspace_or_options?: WorkspaceBase | AgentRpcRuntimeOptions, runtime_options?: AgentRpcRuntimeOptions); /** * 监听 RPC 端口。 * * 说明(中文) * - 重复调用返回同一个 binding。 * - 默认 `127.0.0.1:15314`,本机调试足够。 */ listen(options?: AgentRpcListenOptions): Promise; /** * 关闭 RPC 服务。 */ close(): Promise; /** * 当前监听绑定信息,未 listen 时返回 `null`。 */ binding(): AgentRpcBinding | null; } //# sourceMappingURL=AgentRPC.d.ts.map