CJackHwang/Succinix--packages-engine ↗★ 6

@succinix/engine

在WebContainer中嵌入类Unix沙箱引擎 适合需要在浏览器中管理文件系统、执行Node/Python命令的开发。

包名
@succinix/engine
兼容性
待验证
Cordis 依赖范围
^4.0.1
版本
0.7.0
许可证
MIT
最近更新
2026年8月19日

安装

此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗

@succinix/engine

简体中文

@succinix/engine is the Cordis plugin for embedding Succinix in an application. It provides a browser project workspace that manages files, command execution, terminal sessions, and session persistence.

What It Is For

You do not need to build a filesystem, command router, terminal, and persistence layer yourself. Once connected to WebContainer, Node, Python, and Unix commands use the same workspace.

How To Use It

Install the package and publish its assets as static files:

npm install @succinix/engine@0.7.0 @deepseek-ai/cordis @webcontainer/api
mkdir -p public/engine
cp -R node_modules/@succinix/engine/assets/. public/engine/
import { Context } from '@deepseek-ai/cordis'
import engine from '@succinix/engine'
import { WebContainer } from '@webcontainer/api'

const ctx = new Context()
const fiber = ctx.plugin(engine, {
  hostJsUrl: '/engine/host.js',
  lifoCoreUrl: '/engine/lifo-core.js',
  pythonAssetsUrl: '/engine/pyodide/',
  container: { mode: 'external' },
})
await fiber

const host = ctx.get('succinix', false)!
await host.attach(await WebContainer.boot())
await host.ensureInstance('default', { executor: {} })
await host.executor.exec('npm run dev')

await host.shutdown()
await fiber.dispose()

Application plugins needing files, confinement, terminals, or session persistence declare:

export const inject = ['fs', 'sandbox', 'terminals', 'sessionPersistence']

Use ctx.get('succinix', false) for host lifecycle, instances, ports, and executor management; use the four services for daily plugin work.

Check Before Integrating

  • Peer dependencies are @deepseek-ai/cordis ^4.0.1 and @webcontainer/api ^1.6.4.
  • Chromium only; the page needs COOP/COEP.
  • Ports are browser previews, not public services.

See Integration for fields and lifecycle and Migration for older versions.