Public mirror for @nebutra/workflow-runtime from Nebutra/Nebutra-Sailor.
This repository is generated from the Nebutra Sailor monorepo. Package releases are cut from the monorepo and mirrored here for discovery, standalone cloning, and contribution intake.
- Canonical source:
packages/ai/workflow-runtimeinNebutra/Nebutra-Sailor - Package registry: npm and GitHub Packages
- Contributions: open issues or PRs here; maintainers port accepted changes back into the monorepo source package
Tenant-authored workflow orchestration. A workflow is tenant-written JavaScript
(agent(), parallel(), phase(), args) — the same orchestration grammar as
Claude Code's Workflow tool — executed only inside a fail-closed sandbox.
This package owns three things:
- The sandbox seam (
WorkflowSandbox) + the fail-closed default (REFUSING_WORKFLOW_SANDBOX). UntrustedscriptSourceis never run viaeval/new Function/node:vm. - The QuickJS adapter (
createQuickJSSandbox) — a self-hosted WASM VM (quickjs-emscripten).agent()returns a guest Promise the host resolves asynchronously, soparallel()gets real host-side concurrency despite the single-threaded VM. - The guest primitives + the JSON-Schema → forced-tool + AJV structured output bridge.
The actual model call behind agent() is injected by the host (the gateway)
via HostBindings, so this package layers on @nebutra/agents +
@nebutra/agent-runtime without re-implementing the provider stack or wave
scheduling.
import{createQuickJSSandbox,DEFAULT_SANDBOX_LIMITS}from"@nebutra/workflow-runtime";constsandbox=createQuickJSSandbox();constresult=awaitsandbox.run({scriptSource: `const a = await agent("research X"); return a;`,args: {},limits: DEFAULT_SANDBOX_LIMITS,host: {agent: (prompt,opts)=>runBriefAsTurn(prompt,opts),// gateway-injectedlog: (m)=>emit({type: "log",message: m}),phase: (t)=>emit({type: "phase",title: t}),},});Status: WIP. The QuickJS adapter and guest primitives are landing incrementally; the default seam refuses to run until a concrete sandbox is wired.