@ boatdev/ sdk
使用应用程序代码中的船 .
安装
npm install @boatdev/sdk
链接
- SDK文档 : https://docs.boat.dev/sdks/overview 页面存档备份,存于互联网档案馆
- API 参考 : https://docs.boat.dev/api/v1 请检查isbn=值 (帮助)
- 盘子 : https://boat.dev/dashboard (英语)
- API 密钥 : https://boat.dev/dashboard?tab=api-keys (英语)
流动
- 在船仪表板上创建 API 密钥 .
- 创建或恢复沙盒 .
- 启动沙盒.
- 阅读事件直到工作完成.
- 需要浏览器或图形界面能见度时打开桌面访问.
- 停止,恢复,叉子,或者根据您的保留政策删除沙盒.
页:1
- 把清理进去
finally:停止/存档或删除用于测试的沙盒. - 将 API 密钥、 船密钥、 SSH 密钥和桌面流 URL 视为敏感 .
updateSecrets编号 :update_secrets替换整个秘密设置。 先读一下目前的设置,然后发送所有应该留下的env var和秘密文件.rotateApiKey编号 :rotate_api_key旋转原生秘诀就位. 立即存储返回的秘密; 显示一次 .- 仓库选取为一能. 选择一个已经选中的寄存器更新其基础分支 .
示例
类型脚本
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;
});
Java 脚本
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;
});
许可证
这个SDK是麻省理工学院的执照 赛艇,赛艇API,赛艇CLI,沙盒产品均为专有.