/** Workspace 可选 Shell 能力协议。 */ import type { RuntimeTool } from "@downcity/type"; import type { ShellProcessResult } from "./Sandbox.js"; /** Workspace Shell 执行一次受控命令的输入。 */ export interface WorkspaceShellSandboxCommandInput { /** 当前命令执行记录的稳定标识。 */ execution_id: string; /** 要交给解释器执行的完整命令。 */ cmd: string; /** 当前命令使用的 Workspace 工作目录。 */ cwd: string; /** 当前命令使用的解释器绝对路径。 */ shell_path: string; /** 是否使用 login shell 语义。 */ login: boolean; /** 当前命令显式获得的环境变量。 */ env: Readonly>; /** 是否通过 PTY 启动命令。 */ terminal?: boolean; /** PTY 列数。 */ cols?: number; /** PTY 行数。 */ rows?: number; } /** Workspace Shell 执行一次受控命令的结果。 */ export interface WorkspaceShellSandboxCommandResult { /** 命令的标准输出。 */ stdout: string; /** 命令的标准错误输出。 */ stderr: string; /** 命令最终退出码。 */ exit_code: number; /** Workspace Sandbox 返回的完整启动信息。 */ spawn: ShellProcessResult; } /** 由 Workspace 持有并绑定到项目边界的命令执行能力。 */ export interface WorkspaceShell { /** 当前 Shell 向 Agent 暴露的命令与进程工具。 */ readonly tools: Record; /** 将 Shell 绑定到一个 Workspace 项目和私有数据作用域。 */ bind(input: { /** Workspace 的稳定业务标识。 */ workspace_id: string; /** 项目文件和命令 cwd 的根路径。 */ root_path: string; /** Agent private runtime directory 私有数据根路径。 */ data_path: string; }): void; /** 更新后续进程使用的 Workspace 环境变量。 */ set_env(env: Readonly>): void; /** 在当前 Workspace 的持久 Sandbox 中执行一次命令。 */ run_sandbox_command(input: WorkspaceShellSandboxCommandInput): Promise; /** 关闭全部 Shell Sessions,并删除、重建当前 Shell 的持久 Sandbox。 */ reset_sandbox(): Promise; /** 释放当前 Shell 的进程、PTY 与 Sandbox 资源。 */ dispose(): Promise; } //# sourceMappingURL=WorkspaceShell.d.ts.map