# 执行场 Compute

> 智能体的物理手脚——本机、远端 SSH 与 Cloudflare Sandbox 隔离容器电脑，按转子粒度挂载。

Compute 是 Kernuq 的「器」，把物理执行环境抽象为独立资源 `compute://`，再编排进 Harness。

## 三种底座

### 本机 `local_host`

```yaml
uri: "compute://builtin/local-host"
substrate_kind: "local_host"
declared_capabilities: ["exec", "fs_rw", "pty"]
local_host_config:
  workspace_root: "~/.kernuq/workspaces"
  isolate_subprocess: true
```

### 远端 SSH `remote_ssh`

私钥存放在金库，执行时由内核盲注入：

```yaml
uri: "compute://ssh/prod-order-01"
substrate_kind: "remote_ssh"
remote_ssh_config:
  ssh_vault_uri: "vault://infra/ssh/prod-order-01"
  remote_workdir: "/var/kernuq-ops"
  read_only_guard: true
```

### Cloudflare Sandbox `cloudflare_sandbox`

基于 Cloudflare Containers 毫秒级拉起隔离 Linux 电脑，支持进程流、`/workspace` 快照水合、PTY、端口预览与 GUI / CDP 浏览器操控：

```yaml
uri: "compute://cloudflare/desktop-computer-01"
substrate_kind: "cloudflare_sandbox"
declared_capabilities: ["exec", "fs_rw", "pty", "code_interpreter", "computer_gui", "port_preview"]
cloudflare_sandbox_config:
  gateway_url: "https://kernuq-sandbox-gw.example.workers.dev"
  auth_vault_uri: "vault://secret/cf-sandbox-gateway"
  gateway_contract_version: "kcg_v1"
  image_profile: "desktop-computer"
  idle_sleep_sec: 300
```

## 挂载到转子

在 Harness 中通过 `compute_binding.compute_uri` 选择执行场。同一个 Agent 的不同转子可以运行在不同的机器上。

```bash
kernuq schema compute
```
