@cloop/runner

中文文档
0.3.59发布于 2026/11/10MITES Module近 30 天下载 8539

Make your computer and your agents Cloop machines: device login, the machine daemon, the Cloop MCP server, and Claude Code hooks.

原始使用文档
文档目录8 节
  1. Install
  2. Windows
  3. Commands
  4. Presence model (Phase 1)
  5. MCP tools
  6. Live presence mesh ( cloop serve )
  7. Develop
  8. OAuth fallback

@cloop/runner

The cloop CLI: device login, a stdio MCP server (Cloop Skills), and a Claude Code hook that heartbeat your agents into the Cloop mesh. Harness- and domain-agnostic — Claude Code, Cowork, and Codex all get presence via the MCP server; Claude Code hooks add session-lifecycle detail.

Install

npm install -g @cloop/runner
cloop login          # approve the device in your browser
cloop install        # register the MCP server with Claude Code / others

Credentials live in ~/.cloop/credentials.json. The API origin comes from CLOOP_ORIGIN, the stored value, or the staging default.

npx -y @cloop/runner@latest connect makes this computer a Cloop machine. As its last step, it adds the remote Cloop MCP server to each Claude Code and Codex on the machine, and signs it in with OAuth on a terminal. It runs the usual lines: claude mcp add -s user --transport http cloop https://app.mycloop.com/api/mcp/mcp and codex mcp add cloop --url https://app.mycloop.com/api/mcp/mcp, then claude mcp login cloop and codex mcp login cloop. Staging uses the name cloop-staging and https://mcp-staging.mycloop.com/mcp. When an entry under any name already has the URL, connect adds nothing. This step never makes connect fail. Details: docs/runbooks/cloop-local.md, "Connect", step 5.

To disconnect a machine, use Disconnect in its ⋯ menu on the Threads page.

Windows

cloop connect on Windows writes %LOCALAPPDATA%\Cloop\cloop-runner.cmd and registers a per-user Task Scheduler task, Cloop Runner, that runs it at logon. No admin rights are needed. The log is %LOCALAPPDATA%\Cloop\cloop-runner.log. cloop disconnect deletes the task and the launcher. Use the native Claude Code install, which puts claude.exe on PATH. The Windows path is covered by unit tests and has not yet run on a Windows machine; details and the open points are in docs/runbooks/cloop-local.md, section "Windows".

Commands

CommandWhat it does
cloop login [--name <device>]Device-code flow → long-lived token
cloop installclaude mcp add cloop -- cloop serve + Cowork/Codex instructions
cloop serve [--platform <p>]Run the stdio MCP server (heartbeats presence)
cloop hook session-startClaude Code SessionStart hook — not registered in Phase 1

Presence model (Phase 1)

The MCP server (cloop serve) is the sole presence source: one agent_sessions row per live server process. Its session_key is CLAUDE_SESSION_ID when the harness provides it, otherwise a per-process UUID. name is the harness label ("Claude Code" / "Codex" / "Cowork"); machine is the hostname; login deviceName is separate (cli_devices.name).

cloop hook session-start exists in the tree but cloop install does not wire it up — Claude Code hooks are the Phase 2 coding adapter (richer session lifecycle detail). Leaving it unregistered keeps Phase 1 at one row per MCP process.

MCP tools

The server exposes one built-in tool plus every tool advertised by the shared app-side registry — it fetches GET {origin}/api/agent/mesh/tools at startup and registers each dynamically, proxying calls through POST {origin}/api/agent/mesh/tools {tool, input}. New skills land with no CLI release.

  • cloop_status {} — built-in: who's live on your mesh, on what surface (served locally from /api/agent/mesh/status, not the registry)
  • cloop_inbox {action?} — built-in: drain (default) returns and clears the delegated tasks / DMs pushed to this agent over the mesh; list peeks
  • registry tools — e.g. search, list_tasks, get_task, get_task_context, get_contact, list_cloops, get_cloop

If the registry is unreachable at startup, the server runs status-only (warns once on stderr). A 401 from any proxied call returns an isError result asking the user to run cloop login.

Live presence mesh (cloop serve)

On start, serve opens a WebSocket to the cloop-mesh Worker's per-user Durable Object at {CLOOP_MESH_URL}/mesh/agent?session_key=… (default https://mcp.mycloop.com; --staging or CLOOP_MESH_URL selects another mesh, and the choice is stored as meshUrl). The device token rides the first Sec-WebSocket-Protocol entry, never the URL (query strings leak into edge logs). While it's up, presence beats ride the socket (the DO mirrors them into the heartbeat route) and the HTTP HeartbeatClient is the fallback; it reconnects with 1s→60s backoff + jitter. Incoming delegate / dm frames are appended to ~/.cloop/inbox.jsonl and the statusline shows a ✉ N pending badge; cloop_inbox drains them.

Develop

npm install
npm run build
npm test

OAuth fallback

Claude Code and Codex can carry each other's runs after a provider login failure. This works for direct CLI runners and T3 runners. See the runbook for restrictions and release steps. After the release merges, run bash tools/ops/runner-oauth-fallback-wizard.sh from the repository root to approve and install it.

版本与发布记录

@cloop/runner 共发布 57 个版本,首次发布于 2026/10/08;过去 12 个月发布了 57 个版本。

版本发布日期距今
0.3.59latest2026/11/10今天
0.3.582026/11/10今天
0.3.572026/11/09今天
0.3.562026/11/09今天
0.3.552026/11/073 天前
0.3.542026/11/063 天前

关于 @cloop/runner 的常见问题

@cloop/runner 是什么?

Make your computer and your agents Cloop machines: device login, the machine daemon, the Cloop MCP server, and Claude Code hooks.

如何安装 @cloop/runner?

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

@cloop/runner 支持 TypeScript 吗?

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

@cloop/runner 支持 ESM 还是 CommonJS?

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

@cloop/runner 需要什么版本的 Node.js?

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

@cloop/runner 可以商用吗?

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

@cloop/runner 的下载量有多少?

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

@cloop/runner 还在维护吗?

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