@computesdk/isorun

中文文档
0.1.21发布于 2026/11/06MITTypeScriptESM + CJS近 30 天下载 9615

计算SDK的 Isorun 提供商 – 孤立的 Linux VM 沙盒用于运行不可信和 AI 生成的代码

中文使用文档
文档目录5 节
  1. 安装
  2. 使用量
  3. 配置
  4. 沙盒 API
  5. 标准接口之外

@ computesdk/isorun

伊索伦语Name 提供方 计算SDK. 被隔离的 Linux VM 沙盒用于运行不可信和AI生成的代码,由第二台计费.

安装

npm install @computesdk/isorun

使用量

import { isorun } from '@computesdk/isorun'

const compute = isorun({
  apiKey: process.env.ISORUN_API_KEY,
})

const sandbox = await compute.instances.create({ runtime: 'node' })

const result = await sandbox.runCommand('node -v')
console.log(result.stdout) // v22.x.x

await sandbox.filesystem.writeFile('/tmp/hello.txt', 'world')
const content = await sandbox.filesystem.readFile('/tmp/hello.txt')

await sandbox.destroy()

配置

选项新闻 var默认说明
apiKeyISORUN_API_KEY所需经费API 密钥从 (原始内容存档于2018-10-21). app.isorun.ai

沙盒 API

// Execute commands
const cmd = await sandbox.runCommand('echo hello', { env: { FOO: 'bar' }, cwd: '/tmp' })

// Filesystem
await sandbox.filesystem.writeFile('/app/data.json', JSON.stringify({ key: 'value' }))
const data = await sandbox.filesystem.readFile('/app/data.json')
const entries = await sandbox.filesystem.readdir('/app')
const exists = await sandbox.filesystem.exists('/app/data.json')
await sandbox.filesystem.mkdir('/app/output')
await sandbox.filesystem.remove('/app/output')

// Lifecycle
const info = await sandbox.getInfo()
const all = await compute.instances.list()
await sandbox.destroy()

标准接口之外

这个 isorun SDK暴露出一些在标准计算SDK接口中没有插槽的能力——分叉(sandbox.fork(n)),休眠/休眠(sandbox.hibernate() 编号 : sandbox.resume()),并重新设置超时(sandbox.setTimeout(seconds)) (中文(简体) ). 通过以下方式达到基本实例:

const native = sandbox.getInstance() // returns the raw Sandbox
await native.fork(4)
await native.hibernate()

版本与发布记录

@computesdk/isorun 共发布 22 个版本,首次发布于 2026/06/17;过去 12 个月发布了 22 个版本。

版本发布日期距今
0.1.21latest2026/11/064 天前
0.1.202026/11/046 天前
0.1.192026/10/3110 天前
0.1.182026/10/2812 天前
0.1.172026/10/2317 天前
0.1.162026/10/2318 天前

关于 @computesdk/isorun 的常见问题

@computesdk/isorun 是什么?

计算SDK的 Isorun 提供商 – 孤立的 Linux VM 沙盒用于运行不可信和 AI 生成的代码

如何安装 @computesdk/isorun?

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

@computesdk/isorun 支持 TypeScript 吗?

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

@computesdk/isorun 支持 ESM 还是 CommonJS?

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

@computesdk/isorun 需要什么版本的 Node.js?

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

@computesdk/isorun 可以商用吗?

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

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

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

@computesdk/isorun 还在维护吗?

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