@computesdk/cli

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

ComputeSDK CLI - Cloud-native workspace management

原始使用文档
文档目录5 节
  1. Install
  2. Login
  3. Commands
  4. Managed-agent persistence
  5. Migrating from @computesdk/cli 1.x

@computesdk/cli

The compute CLI for the ComputeSDK platform — Actions CI, the compute market, sandboxes, and the benchmarks toolchain.

Install

npm i -g @computesdk/cli        # or: pnpm dlx @computesdk/cli <cmd>

Login

compute login                   # OAuth device flow → ~/.benchsdk/credentials.json
compute logout                  # clear stored credentials
compute --login / --logout      # same, as flags

Login uses the same OAuth device flow as bench auth login — every first-party CLI shares one credential store (~/.benchsdk/credentials.json) and refresh tokens renew automatically.

Commands

compute actions …               # Actions API — repos, dispatch, runs, logs, vault
compute market …                # buy and sell on the compute market (cap, bids, credits, listings)
compute sandboxes …             # platform sandbox control plane
compute bench …                 # benchmarks CLI (run, auth, org, results, …)
compute providers               # sandbox provider credential status
compute org list                # your organizations (* = active)
compute org use <slug>          # switch the stored login's active org
compute org current / whoami    # current user + active org

All platform commands accept --api-key / COMPUTE_API_KEY and fall back to the stored OAuth credentials.

The active org comes from the stored login (compute org use changes it — it's per user, so every CLI on every machine sees the switch). For a one-off override, pass --org <slug> (on the root command or any sandboxes / actions / market subcommand) or set COMPUTE_ORG; it sends X-Org-Slug on the request. Precedence: --org > COMPUTE_ORG > the stored login's org. The platform ignores the header for org API keys.

For compute sandboxes exec and compute sandboxes spawn, everything after the command's first word goes to the sandbox untouched — flags like uname -a or node -e are not CLI options. Pass CLI options (--json, --timeout-ms, --cwd, -e/--env, --stdin, --org) before the command; a bare -- before the command is optional but supported.

compute sandboxes exec sb1 uname -a
compute sandboxes spawn sb1 --cwd /app -e NODE_ENV=production -- npm run dev

Managed-agent persistence

compute agents run <agent> starts a conversation. On platforms with managed Archil storage, the first run provisions the agent's disk automatically. After its turn finishes, compute agents stop <sessionId> flushes storage and releases compute. Resume that conversation, including Pi history and workspace:

compute agents run my-agent --resume <sessionId>
compute agents run my-agent "Continue the task" --resume <sessionId>

Resume preserves the session ID and event journal but acquires a new sandbox. Only one session per agent can be active at a time. Legacy sessions without persistent state cannot be recovered retroactively. Requires the platform's managed-volume/resume API; no account storage credentials are needed in the CLI.

Migrating from @computesdk/cli 1.x

v2 removes the legacy console authentication and its commands:

  • Removed commands: compute create, compute sandbox, compute connect, compute workspace, compute run, and the interactive REPL. Sandbox management moved to compute sandboxes, which drives the platform's /api/v1/sandboxes API.
  • Auth: compute login no longer opens a browser flow against console.computesdk.com or writes ~/.computesdk/credentials.json — that credential store is gone. compute login now runs the platform's OAuth device flow and writes ~/.benchsdk/credentials.json (the same store bench auth login uses). Run compute login once after upgrading.
  • compute providers is unchanged.

版本与发布记录

@computesdk/cli 共发布 40 个版本,首次发布于 2026/04/01;过去 12 个月发布了 40 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.6.3latest2026/11/073 天前
2.6.22026/11/064 天前
2.6.12026/11/046 天前
2.6.02026/10/2813 天前
2.5.82026/10/2813 天前
2.5.72026/10/2813 天前

关于 @computesdk/cli 的常见问题

@computesdk/cli 是什么?

ComputeSDK CLI - Cloud-native workspace management

如何安装 @computesdk/cli?

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

@computesdk/cli 支持 TypeScript 吗?

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

@computesdk/cli 支持 ESM 还是 CommonJS?

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

@computesdk/cli 可以商用吗?

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

@computesdk/cli 的下载量有多少?

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

@computesdk/cli 还在维护吗?

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