@computesdk/quilt

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

Quilt provider for ComputeSDK - tenant-scoped Linux sandboxes with exec, published services, and snapshots

原始使用文档
文档目录6 节
  1. Features
  2. Installation
  3. Configuration
  4. Usage
  5. Snapshot Support
  6. Limitations

@computesdk/quilt

Quilt provider for ComputeSDK.

This package maps ComputeSDK's sandbox interface onto Quilt's tenant-scoped container API. It supports container lifecycle, synchronous command execution, published HTTP/WebSocket services, shell-backed filesystem operations, and Quilt snapshots.

Features

  • Create, inspect, list, and destroy Quilt containers
  • Run shell commands through Quilt's synchronous /exec API
  • Expose HTTP or WebSocket URLs through Quilt published services
  • Read and write files inside the container filesystem through exec
  • Create, list, and delete Quilt snapshots

Installation

npm install computesdk @computesdk/quilt

Configuration

The provider accepts config directly and falls back to environment variables.

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

const provider = quilt({
  baseUrl: process.env.QUILT_BASE_URL,
  apiKey: process.env.QUILT_API_KEY,
  tenantId: process.env.QUILT_TENANT_ID,
});

Supported config fields:

  • baseUrl or QUILT_BASE_URL: Quilt backend base URL
  • apiKey or QUILT_API_KEY: Quilt API key
  • accessToken or QUILT_ACCESS_TOKEN: Bearer token for JWT-backed deployments
  • tenantId or QUILT_TENANT_ID: required for snapshot operations
  • image or QUILT_IMAGE: default container image, defaults to prod
  • timeout or QUILT_TIMEOUT_MS: default provider timeout in milliseconds
  • publishedServiceAuthMode or QUILT_PUBLISHED_SERVICE_AUTH_MODE: service_token or public
  • publishedServiceTtlSecs or QUILT_PUBLISHED_SERVICE_TTL_SECS: optional published-service TTL
  • pollIntervalMs or QUILT_POLL_INTERVAL_MS: async operation polling interval

At least one of apiKey or accessToken must be configured.

Usage

import { compute } from 'computesdk';
import { quilt } from '@computesdk/quilt';

compute.setConfig({
  provider: quilt({
    baseUrl: process.env.QUILT_BASE_URL,
    apiKey: process.env.QUILT_API_KEY,
    tenantId: process.env.QUILT_TENANT_ID,
  }),
});

const sandbox = await compute.instances.create({
  name: 'computesdk-demo',
  envs: {
    APP_ENV: 'dev',
  },
});

const result = await sandbox.runCommand('echo "hello from Quilt"');
console.log(result.stdout);

const url = await sandbox.getUrl({ port: 3000 });
console.log(url);

await sandbox.destroy();

Snapshot Support

Snapshot operations require tenantId because Quilt validates X-Tenant-Id on snapshot routes.

const snapshot = await provider.snapshot?.create(sandbox.instanceId, {
  name: 'baseline',
  metadata: { branch: 'main' },
});

Limitations

  • getUrl() maps to Quilt published services, so it is HTTP/WebSocket only
  • Filesystem operations are implemented over shell exec for portability across Quilt containers
  • template operations are not exposed because Quilt's closest equivalents are image references and snapshots, which map differently

版本与发布记录

@computesdk/quilt 共发布 20 个版本,首次发布于 2026/07/01;过去 12 个月发布了 20 个版本。

版本发布日期距今
1.0.20latest2026/11/064 天前
1.0.192026/11/046 天前
1.0.182026/10/2813 天前
1.0.172026/10/2318 天前
1.0.162026/10/2318 天前
1.0.152026/10/2219 天前

关于 @computesdk/quilt 的常见问题

@computesdk/quilt 是什么?

Quilt provider for ComputeSDK - tenant-scoped Linux sandboxes with exec, published services, and snapshots

如何安装 @computesdk/quilt?

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

@computesdk/quilt 支持 TypeScript 吗?

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

@computesdk/quilt 支持 ESM 还是 CommonJS?

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

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

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

@computesdk/quilt 可以商用吗?

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

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

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

@computesdk/quilt 还在维护吗?

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