A unified, high-level abstraction layer for cloud sandbox providers. It offers a consistent, vendor-agnostic interface for creating, managing, and interacting with sandboxed environments like OpenSandbox.
This package is ESM-only (
"type": "module") and requires Node.js >= 20.
pnpm add @fastgpt/sandbox如果在 Next.js 项目中使用,需要配置以处理 ESM 依赖。在 next.config.js 中添加:
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ['@fastgpt-sdk/sandbox-adapter'],
experimental: {
esmExternals: 'loose',
},
};
module.exports = nextConfig;详细说明请参考 Next.js 集成指南。
- 执行命令:执行命令并返回结果
- Create 接口:成功返回,则认为沙盒已创建成功,可以执行命令。
- 执行
- 下载文件。
- 定期暂停:每 n 分钟不活跃则暂停
- 定期销毁:每 n 分钟不活跃则销毁