@ai-development-environment/control-agent

中文文档
0.0.145发布于 2026/11/07MITES Module构建来源已验证近 30 天下载 4154

Control agent for the AI Development Environment

原始使用文档
文档目录6 节
  1. Install
  2. Usage
  3. Local and remote endpoints
  4. Enrollment
  5. OpenCode 2
  6. See also

@ai-development-environment/control-agent

Control agent for the AI Development Environment. It makes authenticated outbound HTTP and GraphQL WebSocket connections to the control plane; managed machines do not expose a listening port.

Install

npm install -g @ai-development-environment/control-agent

Requires Node.js 24 (>=24.16.0 <25). Saved commands use the agent user's login shell and require no additional runtime.

Usage

Open the server's Agents page and create a one-time enrollment command, then run it on the target machine (the server defaults to the same computer when omitted):

control-agent enroll \
  --server http://127.0.0.1:3090 \
  --enrollment-token <one-time-token>
control-agent run

Local and remote endpoints

One control plane is often reachable at two addresses — a LAN address at the desk and a public or VPN address elsewhere. Configure both and the agent prefers the local one, moving to the remote one when the local address stops answering and the remote one is confirmed to be answering. A control plane that is down at every configured address is not a failover: the agent keeps its session and the jobs running under it, and reconnects when the server comes back.

control-agent enroll \
  --server http://192.168.1.10:3090 \
  --remote-server https://control.example.com \
  --enrollment-token <one-time-token>

Change the addresses on an enrolled agent, or print the current ones by passing no flags:

control-agent endpoints
control-agent endpoints --remote-server https://control.example.com
control-agent endpoints --clear-remote

The websocket address of each endpoint is derived from its server URL unless --websocket-server or --remote-websocket-server sets it explicitly.

Changing a server address re-derives its websocket address, because one stored against the old server no longer points anywhere useful. If the websocket is served from somewhere other than /graphql on the same host and port — behind a reverse proxy, say — pass it alongside the new server address:

control-agent endpoints --server http://192.168.1.20:3090 --websocket-server ws://192.168.1.20:3092/graphql

Enrollment

control-agent enrollment
control-agent unenroll

enrollment reports whether this machine is enrolled and whether each configured endpoint answers for it. unenroll removes the local credential; the control plane still lists the agent until it is deleted there.

Diagnostics:

control-agent status
control-agent doctor

OpenCode 2

The OpenCode integration requires OpenCode >=2.1.1 <3. The agent uses @opencode/client 2.1.1; the Docker image includes @opencode/cli 2.1.1. Install the CLI on each machine running a control agent:

npm install -g @opencode/[email protected]
# Or, on macOS:
brew install anomalyco/tap/opencode-v2
opencode --version

OpenCode 1's opencode-ai package and the former @opencode-ai/sdk/v2 entrypoint do not provide this integration. Remove a package-managed OpenCode 1 installation before installing OpenCode 2, since both expose the opencode command. Set CONTROL_AGENT_OPENCODE_EXECUTABLE to the full executable path when the agent should use a specific installation. An invalid override fails explicitly.

Connect providers using OpenCode's /connect interface or opencode auth login. Models, credentials, and variants are resolved for each registered worktree. The agent starts authenticated services on loopback with private state under its configuration directory. Runs with control-plane MCP tools receive their own service and connection headers. The agent does not start or stop the user's shared OpenCode service.

Supported existing configuration and .opencode/skills files can remain in place. Native v2 MCP configuration groups connections under mcp.servers. OpenCode 1 plugin implementations require porting to the new plugin API; terminal preferences migrate to global cli.json. Review the official migration guide and MCP configuration.

History sync retries while OpenCode's native history migration is pending and reports migration errors without replacing saved transcripts. Full native forms support typed fields, defaults, conditional visibility, validation, external-step acknowledgements, and cancellation. A rejected native answer remains editable.

Deploy the server and its additive database migration before upgrading agents. Existing questions and answers retain their original representation; new native fields are stored alongside it.

From the repository root, verify the integration with:

npm run agent:test:run
npm run test:opencode-v2

The native smoke test requires the CLI. It uses temporary XDG directories and a deterministic local model endpoint, then closes its owned service and removes the temporary data.

The credential and stable agent ID are stored at ~/.config/control-agent/config.json.

See also

版本与发布记录

@ai-development-environment/control-agent 共发布 117 个版本,首次发布于 2026/07/19;过去 12 个月发布了 117 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.145latest2026/11/071 天前
0.0.1442026/11/061 天前
0.0.1432026/11/052 天前
0.0.1422026/11/052 天前
0.0.1412026/11/043 天前
0.0.1402026/11/043 天前

关于 @ai-development-environment/control-agent 的常见问题

@ai-development-environment/control-agent 是什么?

Control agent for the AI Development Environment

如何安装 @ai-development-environment/control-agent?

在项目目录运行 npm install @ai-development-environment/control-agent,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 control-agent,可以用 npx control-agent 直接运行。

@ai-development-environment/control-agent 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ai-development-environment__control-agent 是否存在。

@ai-development-environment/control-agent 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@ai-development-environment/control-agent 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.16.0 <25。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ai-development-environment/control-agent 可以商用吗?

@ai-development-environment/control-agent 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ai-development-environment/control-agent 的下载量有多少?

根据 npm 官方下载统计,@ai-development-environment/control-agent 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,154 次,日均约 138 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ai-development-environment/control-agent 还在维护吗?

最新版本 0.0.145 发布于 2026/11/07(1 天前);至今共发布 117 个版本,其中过去 12 个月发布了 117 个;首次发布于 2026/07/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。