@boatdev/sdk

中文文档
1.13.0发布于 2026/10/28MITTypeScriptESM + CJS零依赖近 30 天下载 15.9万

OpenAPI client for @boatdev/sdk

原始使用文档
文档目录8 节
  1. Install
  2. Links
  3. Flow
  4. Notes
  5. Example
  6. TypeScript
  7. JavaScript
  8. License

@boatdev/sdk

Use Boat from your application code.

Install

npm install @boatdev/sdk

Flow

  1. Create an API key in the Boat dashboard.
  2. Create or resume a sandbox.
  3. Prompt the sandbox.
  4. Read events until the work is done.
  5. Open desktop access when you need browser or GUI visibility.
  6. Stop, resume, fork, or delete the sandbox according to your retention policy.

Notes

  • Put cleanup in finally: stop/archive or delete sandboxes you create for tests.
  • Treat API key secrets, Boat secrets, SSH keys, and desktop stream URLs as sensitive.
  • updateSecrets / update_secrets replaces the entire secret setup. Read the current setup first and send every env var and secret file that should remain.
  • rotateApiKey / rotate_api_key rotates the raw secret in place. Store the returned secret immediately; it is shown once.
  • Repository selection is idempotent. Selecting an already-selected repository updates its base branch.

Example

TypeScript

import { BoatApi, Configuration } from "@boatdev/sdk";

const sandbox = new BoatApi(new Configuration({
  basePath: process.env.BOAT_BASE_URL ?? "https://boat.dev/api/v1",
  accessToken: process.env.BOAT_API_KEY ?? (() => {
    throw new Error("Set BOAT_API_KEY from the Boat dashboard API keys tab.");
  })(),
}));

async function main() {
  let sandboxId: string | undefined;

  try {
    const created = await sandbox.create({ ttlSeconds: 1800 });

    sandboxId = created.sandbox.id;

    await sandbox.update({ sandboxId, name: "sdk-demo" });

    while (!["ready", "idle"].includes((await sandbox.get({ sandboxId })).sandbox.state)) {
      await new Promise((resolve) => setTimeout(resolve, 2000));
    }

    await sandbox.prompt({
      sandboxId,
      prompt: "Inspect the repository and summarize the test command.",
      provider: "codex",
    });

    const events = await sandbox.events({ sandboxId });
    console.log(events.events);
  } finally {
    if (sandboxId) {
      await sandbox.stop({ sandboxId });
    }
  }
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

JavaScript

const { BoatApi, Configuration } = require("@boatdev/sdk");

const sandbox = new BoatApi(new Configuration({
  basePath: process.env.BOAT_BASE_URL || "https://boat.dev/api/v1",
  accessToken: process.env.BOAT_API_KEY || (() => {
    throw new Error("Set BOAT_API_KEY from the Boat dashboard API keys tab.");
  })(),
}));

async function main() {
  let sandboxId;

  try {
    const created = await sandbox.create({ ttlSeconds: 1800 });

    sandboxId = created.sandbox.id;

    await sandbox.update({ sandboxId, name: "sdk-demo" });

    while (!["ready", "idle"].includes((await sandbox.get({ sandboxId })).sandbox.state)) {
      await new Promise((resolve) => setTimeout(resolve, 2000));
    }

    await sandbox.prompt({
      sandboxId,
      prompt: "Inspect the repository and summarize the test command.",
      provider: "codex",
    });

    const events = await sandbox.events({ sandboxId });
    console.log(events.events);
  } finally {
    if (sandboxId) {
      await sandbox.stop({ sandboxId });
    }
  }
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

License

This SDK is MIT licensed. Boat, the Boat API, the Boat CLI, and the sandbox product are proprietary.

版本与发布记录

@boatdev/sdk 共发布 25 个版本,首次发布于 2026/09/17;过去 12 个月发布了 25 个版本。

版本发布日期距今
1.13.0latest2026/10/2811 天前
1.12.12026/10/2712 天前
1.12.02026/10/2712 天前
1.11.02026/10/2315 天前
1.10.02026/10/1920 天前
1.9.92026/10/1524 天前

关于 @boatdev/sdk 的常见问题

@boatdev/sdk 是什么?

OpenAPI client for @boatdev/sdk

如何安装 @boatdev/sdk?

在项目目录运行 npm install @boatdev/sdk,或使用 pnpm add / yarn add / bun add。

@boatdev/sdk 支持 TypeScript 吗?

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

@boatdev/sdk 支持 ESM 还是 CommonJS?

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

@boatdev/sdk 可以商用吗?

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

@boatdev/sdk 的下载量有多少?

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

@boatdev/sdk 还在维护吗?

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