/** * Workspace 执行上下文的内部组合对象。 * * 关键点(中文) * - Agent 仍是身份、模型、指令与 Plugin 的唯一拥有者。 * - 当前对象只组合 Workspace Tool、Plugin Context、日志与后台资源。 * - Session 的所有权属于 Agent.sessions;本对象只提供内部执行上下文。 * - 它不是公开领域对象,也不是 AgentWorkspace。 */ import type { RuntimeTool as Tool } from "@downcity/type"; import type { SessionSystemMessage } from "../executor/types/SessionPrompts.js"; import type { Hono } from "hono"; import type { WorkspaceShell } from "@downcity/workspace"; import type { AgentSessionCollection } from "../types/agent/AgentSessionCollection.js"; import type { AgentPlugins } from "../types/plugin/PluginRuntime.js"; import type { AgentPluginExecutionRuntime } from "../types/plugin/PluginRuntime.js"; import type { PluginContext } from "../types/plugin/PluginContext.js"; import type { PluginSnapshot } from "../types/plugin/PluginState.js"; import type { WorkspaceEntryOptions } from "../types/agent/WorkspaceEntryOptions.js"; import { Logger } from "../utils/logger/Logger.js"; import type { AgentStorage } from "../types/agent/AgentStorage.js"; import { type SystemProfile } from "../executor/composer/system/default/SystemDomain.js"; /** Agent 在一个 Workspace 中的内部执行上下文。 */ export declare class WorkspaceEntry { /** 拥有当前作用域的 Agent。 */ readonly agent: WorkspaceEntryOptions["agent"]; /** 当前 Workspace。 */ readonly workspace: WorkspaceEntryOptions["workspace"]; /** 当前 Workspace ID。 */ readonly workspace_id: string; /** 当前 Workspace 下的 Tool 集合。 */ readonly tools: Record; /** 当前 Workspace Context 绑定的 Agent Plugin 调用面。 */ readonly plugins: AgentPlugins; /** * 当前 Workspace 的内部 Session 查询视图;实际所有权仍属于 Agent.sessions。 * 该视图只供 City transport 和内部测试装配使用,不是新的 Session 所有者。 */ readonly sessions: AgentSessionCollection; /** 当前 Workspace 的 Session、日志和调度数据根路径。 */ readonly data_path: string; private readonly context; private readonly logger; private readonly unsubscribe_env; private readonly unsubscribe_plugins; private readonly storage; private readonly plugin_contexts; private leave_promise?; constructor(options: WorkspaceEntryOptions); /** 当前 Agent ID。 */ get id(): string; /** 返回当前 Workspace 的 Shell。 */ get_shell(): WorkspaceShell | undefined; /** 返回当前 Workspace 的日志器。 */ get_logger(): Logger; /** 列出当前 Agent 注册的 Plugin 状态。 */ list_plugin_states(): PluginSnapshot[]; /** 将 Plugin HTTP 路由绑定到当前 Workspace Context。 */ register_plugin_http_routes(app: Hono): void; /** 解析指定 Session 当前可见的完整 system messages。 */ resolve_system_messages(input: { session_id: string; profile?: SystemProfile; }): Promise; /** 离开当前 Workspace 并释放 Agent 独享的执行资源。 */ leave(): Promise; /** 返回当前 Workspace 的 PluginContext,供 Agent 级调度器解析执行上下文。 */ get_context(): PluginContext; /** 返回单个 Session 创建所需的 Workspace 执行上下文。 */ get_session_context(): { workspace_path: string; workspace_id: string; logger: Logger; tools: Record; get_workspace_env: () => Record; get_agent_plugins: () => AgentPluginExecutionRuntime; store: AgentStorage["sessions"]; }; /** 返回指定 Plugin 的 Agent 级运行时 Context。 */ private get_plugin_context; } //# sourceMappingURL=WorkspaceEntry.d.ts.map