{"_id":"@buckeyestudio/toh-e2b","name":"@buckeyestudio/toh-e2b","dist-tags":{"next":"0.1.1-rc.2","latest":"0.1.1-rc.2"},"versions":{"0.1.1-rc.2":{"name":"@buckeyestudio/toh-e2b","description":"Shared E2B sandbox lifecycle for TheOpen Harness provider adapters","version":"0.1.1-rc.2","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/dustinwloring1988/theopen-harness.git","directory":"packages/e2b/e2b"},"type":"module","main":"lib/index.js","types":"lib/types/index.d.ts","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","author":{"name":"buckeyestudio"},"peerDependencies":{"@buckeyestudio/toh-invariants":"^0.1.1-rc.2","@buckeyestudio/cordis":"^4.0.1"},"dependencies":{"e2b":"2.35.3","@buckeyestudio/schemastery":"^3.18.1"},"devDependencies":{"@buckeyestudio/toh-invariants":"^0.1.1-rc.2","@buckeyestudio/toh-loader-smoke":"^0.1.1-rc.2","@buckeyestudio/toh-sandbox-policy":"^0.1.1-rc.2","@buckeyestudio/cordis":"^4.0.1"},"_id":"@buckeyestudio/toh-e2b@0.1.1-rc.2","bugs":{"url":"https://github.com/dustinwloring1988/theopen-harness/issues"},"homepage":"https://github.com/dustinwloring1988/theopen-harness#readme","_integrity":"sha512-Jl3zlXz1jOtsJeyDljZQneMNmbZ5IpVAXP9fr5nSW0wDPHLSuO4Nj+ZVFWABIZc1fWk8tPGY1JbeEIuglNEM3w==","_resolved":"/home/runner/work/theopen-harness/theopen-harness/dist/npm/buckeyestudio-toh-e2b-0.1.1-rc.2.tgz","_from":"file:/home/runner/work/theopen-harness/theopen-harness/dist/npm/buckeyestudio-toh-e2b-0.1.1-rc.2.tgz","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-Jl3zlXz1jOtsJeyDljZQneMNmbZ5IpVAXP9fr5nSW0wDPHLSuO4Nj+ZVFWABIZc1fWk8tPGY1JbeEIuglNEM3w==","shasum":"4cfa67ec24380aac4fd495f2eb7dac6e39ba80c5","tarball":"https://registry.npmjs.org/@buckeyestudio/toh-e2b/-/toh-e2b-0.1.1-rc.2.tgz","fileCount":9,"unpackedSize":16693,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCtJ93bNEcorLZArsEPVjKIYxChKmMfyR0nfc8h2bIktAIgMSYROPkKABNU2rb1hvMwMzbFj3ojWwVbUXoqUdxEjiM="}]},"_npmUser":{"name":"buckeyestudio","email":"dustinwloring1988@gmail.com"},"directories":{},"maintainers":[{"name":"buckeyestudio","email":"dustinwloring1988@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/toh-e2b_0.1.1-rc.2_1787489782055_0.1390863717645774"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-23T12:56:21.914Z","0.1.1-rc.2":"2026-08-23T12:56:22.178Z","modified":"2026-08-23T12:56:22.509Z"},"maintainers":[{"name":"buckeyestudio","email":"dustinwloring1988@gmail.com"}],"description":"Shared E2B sandbox lifecycle for TheOpen Harness provider adapters","homepage":"https://github.com/dustinwloring1988/theopen-harness#readme","repository":{"type":"git","url":"git+https://github.com/dustinwloring1988/theopen-harness.git","directory":"packages/e2b/e2b"},"author":{"name":"buckeyestudio"},"bugs":{"url":"https://github.com/dustinwloring1988/theopen-harness/issues"},"license":"MIT","readme":"# @buckeyestudio/toh-e2b\n\n[English](README.md) | 中文\n\n一个 E2B 沙箱的共享生命周期所有者。文件系统与进程管理适配器注入 `ctx.e2b`，等待其唯一的 SDK 句柄，因此处于同一个远程 Linux 工作树与进程环境中。本包固定使用 `e2b@2.29.1`；可选组合见[包族索引](../README.zh.md)。\n\n## 配置\n\n```yaml\n- id: e2b\n  name: '@buckeyestudio/toh-e2b'\n  config:\n    cwd: /home/user/workspace\n    timeoutMs: 300000\n\n- id: subprocess-e2b\n  name: '@buckeyestudio/toh-subprocess-e2b'\n\n- id: fs-e2b\n  name: '@buckeyestudio/toh-fs-e2b'\n```\n\n`apiKey` 可省略；省略时读取 `E2B_API_KEY`。该密钥只配置宿主 SDK 连接，绝不会安装进沙箱。`cwd` 默认为 `/home/user/workspace`，并且必须是绝对 POSIX 路径。`timeoutMs` 默认为 5 分钟并控制沙箱生命周期；超时会删除沙箱。\n\n## 生命周期与所有权\n\n构造阶段会启动一次沙箱创建。服务在 `getSandbox()` 成功返回前，会创建 `cwd` 和私有的 `cwd/.toh-e2b` 适配器状态目录，验证该预留路径是真实目录而非符号链接或其他文件类型，再把该目录的 mode 设为 `0700`。每个适配器内部的 E2B 命令 shell 都会获得一个位于根目录下、全新随机生成的 `HOME`，因此 SDK 固定使用的登录 shell 不会在控制命令之前解析可变用户主目录中的配置文件。\n\n资源释放会先阻止继续获取新句柄，再等待初始化完成，然后删除沙箱。`SandboxNotFoundError` 表示沙箱已因超时或被另一个所有者删除，因此可视为完全停稳。初始目录设置失败时会尝试删除一次；若该尝试也失败，则由已配置的 E2B 超时约束沙箱的存活时间。提供方插件必须在该所有者之后加载，并在其之前 dispose（资源释放）。\n\n## 模型体验\n\n无。本共享运行时所有者不注册模型可见上下文；提供方适配器及其消费方拥有所有渲染效果。\n\n#### KV Cache 影响\n\n不会直接失效；本包不会贡献请求 token。\n\n## 已知限制与延后工作\n\n- **这不是完整的 harness 运行时**：Cordis 服务、agent（智能体）／会话状态、会话日志、LLM（大语言模型）请求、skill（技能）和 SDK 侧缓冲仍留在宿主进程中。\n- **沙箱状态是短暂的**：资源释放和超时都会删除沙箱；重新连接、pause/leave 保留、模板、卷和快照均不在本 POC 范围内。\n- **没有配置部署平台**：网络策略、宿主工作区同步和沙箱发现均不在本 POC 范围内。\n- **`cwd` 是解析约定，而不是包含边界**：适配器和命令可以访问沙箱中的其他路径；E2B 网络访问也继续采用基础镜像的策略。\n","readmeFilename":"README.zh.md","_rev":"1-7993f0f10a61d118e3906b5e2c81a620"}