@daohoangson/computesdk-boat

中文文档
1.0.1发布于 2026/10/16MITTypeScriptESM + CJS近 30 天下载 3032

Boat provider for ComputeSDK - Ubuntu cloud sandboxes with streaming, named snapshots, signed file transfers, and preview URLs

原始使用文档
文档目录8 节
  1. Installation
  2. Setup
  3. Usage
  4. Configuration
  5. Features
  6. Limitations
  7. Development
  8. License

@daohoangson/computesdk-boat

Interim build of the ComputeSDK Boat provider, published ahead of the upstream @computesdk/boat package. The API is the same; switch the import to @computesdk/boat once it is released.

Boat provider for ComputeSDK: Ubuntu cloud sandboxes with streaming commands, signed file transfers, named snapshots and templates, and HTTPS preview URLs.

Installation

npm install computesdk @computesdk/provider @daohoangson/computesdk-boat

Setup

Create an API key in the Boat dashboard and export it:

export BOAT_API_KEY=boat_...
# Optional: custom API endpoint (defaults to https://boat.dev/api/v1)
export BOAT_API_BASE=https://boat.dev/api/v1

Usage

import { createCompute } from '@computesdk/provider';
import { boat } from '@daohoangson/computesdk-boat';

const compute = createCompute({ provider: boat({}) });
const sandbox = await compute.instances.create({ type: 'small' });

try {
  const result = await sandbox.runCommand('echo "Hello from Boat"');
  console.log(result.stdout);
  await sandbox.filesystem.writeFile('/tmp/hello.txt', 'Hello from Boat');
  console.log(await sandbox.filesystem.readFile('/tmp/hello.txt'));
} finally {
  await sandbox.destroy();
}

Configuration

OptionMeaning
apiKeyAPI key; falls back to BOAT_API_KEY
baseURLAPI URL; falls back to BOAT_API_BASE, then https://boat.dev/api/v1
timeoutDefault sandbox lifetime in milliseconds; omitted uses Boat's one-hour default
readyTimeoutProvisioning wait deadline in milliseconds; defaults to 300000
snapshotTimeoutNamed snapshot save deadline in milliseconds; defaults to 600000
previewDefault preview settings: public, localhost, and title
createOptionsNative Boat creation defaults, such as type, environment, noEnv, from, org, and ttlSeconds

Features

  • Sandbox create, get, list, and permanent destroy
  • Foreground commands with reconnecting output streams, optional timeouts, and remote cleanup; background commands
  • Interactive processes through the shared daemon API
  • Filesystem access, with signed binary transfers under /home/user and /tmp (readBoatFile, writeBoatFile)
  • Named snapshots and templates through provider.snapshot and provider.template
  • Token-protected HTTPS preview URLs, with typed controls through getBoatUrl

Limitations

  • Fixed machine types: CPU, memory, disk, GPU, image, region, and arbitrary metadata options are rejected
  • Preview URLs are HTTPS only
  • Snapshots keep disk changes, not process memory; /tmp is excluded
  • Setup scripts run in the background, so readiness does not mean setup has finished

See the Boat provider guide for details and examples.

Development

For local live tests, put BOAT_API_KEY=boat_... in the repository root .env file, which Git ignores. Tests use the live Boat API whenever BOAT_API_KEY is present.

# Unit tests and real-SDK/local-HTTP transport tests; no cloud resources.
pnpm --filter @daohoangson/computesdk-boat test:unit

# Shared conformance, shared CRUD, and Boat-specific integration tests.
# BOAT_API_KEY in the environment or root .env enables live calls.
pnpm --filter @daohoangson/computesdk-boat test:integration

# All tests (also live when credentials are available).
pnpm --filter @daohoangson/computesdk-boat test
pnpm --filter @daohoangson/computesdk-boat typecheck
pnpm --filter @daohoangson/computesdk-boat lint

index.test.ts uses runProviderTestSuite and crud.test.ts uses runProviderCrudTest. The shared contract checks commands, filesystem, streaming, and interactive processes; its baseline tests use shared mocks without credentials. CRUD and Boat-specific integration tests skip without credentials. No separate live opt-in flag is required.

unit.test.ts uses SDK mocks; transport.test.ts uses the real Boat SDK against a local HTTP server. The separate integration.test.ts covers signed large-text/binary transfers, protected/public localhost preview routing, and named snapshot restore. Test files run sequentially to avoid concurrent account-quota pressure. The shared conformance entry point also spaces sandbox starts to stay below Boat's standard 12-starts-per-minute limit; accounts with lower limits may need slower pacing.

Credentialed runs create multiple small billable sandboxes. Shared suite hooks clean up their instances; the Boat-specific test attempts cleanup of both sandboxes and its named snapshot in a finally block. To run every suite without cloud access even when root .env contains a key, use BOAT_API_KEY= pnpm --filter @daohoangson/computesdk-boat test.

License

MIT

版本与发布记录

@daohoangson/computesdk-boat 共发布 3 个版本,首次发布于 2026/10/16;过去 12 个月发布了 3 个版本。

版本发布日期距今
1.0.1latest2026/10/1626 天前
1.0.02026/10/1626 天前
0.0.0-stage2026/10/1626 天前

关于 @daohoangson/computesdk-boat 的常见问题

@daohoangson/computesdk-boat 是什么?

Boat provider for ComputeSDK - Ubuntu cloud sandboxes with streaming, named snapshots, signed file transfers, and preview URLs

如何安装 @daohoangson/computesdk-boat?

在项目目录运行 npm install @daohoangson/computesdk-boat,或使用 pnpm add / yarn add / bun add。

@daohoangson/computesdk-boat 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@daohoangson/computesdk-boat 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@daohoangson/computesdk-boat 需要什么版本的 Node.js?

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

@daohoangson/computesdk-boat 可以商用吗?

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

@daohoangson/computesdk-boat 的下载量有多少?

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

@daohoangson/computesdk-boat 还在维护吗?

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