@computesdk/freestyle

中文文档
0.2.19发布于 2026/11/06MITTypeScriptESM + CJS构建来源已验证近 30 天下载 8580

ComputeSDK的自由式提供者 - 用于长期代理任务的全 Linux VMS, 即时启动和廉价快照

中文使用文档
文档目录5 节
  1. 安装
  2. 使用量
  3. 配置
  4. 能力
  5. 许可证

@ computesdk/ 免费样式

自由风格 computeSDK的提供商——为长期运行,复杂的代理任务而设计的全Linux虚拟机,具有即时启动,持续,廉价快照等功能.

安装

npm install @computesdk/freestyle

# .env
FREESTYLE_API_KEY=your_freestyle_api_key

自由式基础图像没有语言运行时间,所以 第一个 账户上的沙盒会烤出一个节点+Python快照一次(~20 s),并用~200–300ms从中取出后的每一个沙盒. 设定 FREESTYLE_SNAPSHOT_ID (或 snapshotId 选项),以跳过烘焙.

使用量

import { freestyle } from '@computesdk/freestyle';

const compute = freestyle({ apiKey: process.env.FREESTYLE_API_KEY });

const sandbox = await compute.instances.create();

const result = await sandbox.runCommand('node -v');
console.log(result.stdout); // "v22.19.0\n"

// Full native filesystem — Freestyle VMs are real Linux guests
await sandbox.filesystem.writeFile('/tmp/app.js', 'console.log("hi")');
console.log(await sandbox.filesystem.readFile('/tmp/app.js'));

await sandbox.destroy();

配置

interface FreestyleConfig {
  /** Freestyle API key. Falls back to FREESTYLE_API_KEY. */
  apiKey?: string;
  /** Snapshot every sandbox boots from. Falls back to FREESTYLE_SNAPSHOT_ID; auto-baked when unset. */
  snapshotId?: string;
  /** API base URL. Falls back to FREESTYLE_API_URL, then the SDK default. */
  baseUrl?: string;
  /** Idle seconds before Freestyle stops the VM (default 300). */
  idleTimeoutSeconds?: number;
  /** Default wall-clock limit for a single command, ms (default 300000; up to 24h per call). */
  timeout?: number;
  /** Keep the VM after it stops instead of deleting it (default: kept 5 min after stop/pause, so it can be resumed). */
  persistent?: boolean;
  /** Outbound firewall. Defaults to allow-all outbound; pass { rules: [] } to seal. */
  firewall?: { rules: unknown[] };
}

能力

特性支助
runCommand✅
文件系统: 读取、 写入、 读取、 mkdir、 存在、 删除 (本国)
抓图: 创建、 列表、 删除✅
由 id 重新连接( N)compute.instances.getById(中文(简体) )✅
列出沙盒QQ( 此提供者创建的 VMs)
长期运行的命令( R)timeout 最高24小时)✅
标准尺寸(sizeClass: 'lg' | 'xl'和 cpu 编号 : memory (微调)QQ( 仅来自 4 vCPU / 8 GiB 运行时快照)
暂停/ 恢复( N)getInstance().pause() 编号 : .start()(中文(简体) )✅(默认沙盒; ephemeral: true VM 无法暂停)
getUrl (每个端口 URL)qq — 绘制一个域名 freestyle.domains

许可证

麻省理工学院

版本与发布记录

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

版本发布日期距今
0.2.19latest2026/11/064 天前
0.2.182026/11/046 天前
0.2.172026/10/2813 天前
0.2.162026/10/2318 天前
0.2.152026/10/2318 天前
0.2.142026/10/2219 天前

关于 @computesdk/freestyle 的常见问题

@computesdk/freestyle 是什么?

ComputeSDK的自由式提供者 - 用于长期代理任务的全 Linux VMS, 即时启动和廉价快照

如何安装 @computesdk/freestyle?

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

@computesdk/freestyle 支持 TypeScript 吗?

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

@computesdk/freestyle 支持 ESM 还是 CommonJS?

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

@computesdk/freestyle 可以商用吗?

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

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

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

@computesdk/freestyle 还在维护吗?

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