A local-first multi-agent app development platform, built on PenguinHarness
Command confinement, with backends as plugins
- Date: 2026-08-22
- Type: feature
- Scope:
core,server,plugins,docs - PR: #354
- Breaking: yes —
extensions.jsonis read no longer and both SDK subpaths moved to/plugin; the plugin contract is closed, socontext.terminalsneeds a cast
Shell commands an agent runs can now be confined. The harness gained its own sandbox interface — argv rewriting, honest enforcement reporting, fail-closed — naming three dimensions: fs-write, network and mask-paths. No backend is part of the harness: each is a plugin package a deployment installs and names in plugins.json, which is why this builds on the plugin mechanism — shipped in 0.2.8 as the extension mechanism and renamed here. A default deployment names none and confines nothing.
Details
- The seam is in core.
confineSpawnis threaded along the existingproxyEnvline and applied inManagedSessionimmediately before spawn: it receives the exact argv,cwdandworkspaceDir, and returns the argv to spawn instead. Mechanism only — it never interprets the argv. - Routing cannot silently drop a dimension. A backend declares which dimensions it implements (declaring none means filesystem-only) and the service routes each policy to one that covers what it requires. A requirement nothing covers fails closed, naming what each mounted backend does cover.
confinemust return enforcing argv or throw; a throw aborts the spawn and surfaces as the command's spawn error, so a command never runs unconfined because a backend failed. - Four backends ship as packages:
plugin-sandbox-dsh(the portable DSH adaptor, file effects on all three platforms), plusplugin-sandbox-bwrap(Linux),-seatbelt(macOS) and-mxc(Windows, through Microsoft MXC'sprocesscontainer) — the three native ones implementing all three dimensions. Each declaresApache-2.0and ships aREADME.mddocumenting what it actually enforces, down to bwrap's mount ordering and Seatbelt's rule precedence: a deployment chooses a backend by exactly that. With no backend inside the platform bundle, the bundle no longer inlines any native-adjacent module, anddeploy.mjs's runtime-resolved-natives shim is gone. Confinement settings ride the parked platform context, so a hot push cannot silently un-confine a deployment. - The plugin contract is closed, and owns the sandbox vocabulary.
PenguinContextandPenguinInterfacename every member instead of being reopened bydeclare module: a plugin checking against the contract used to compile against members only one embedder supplies.SandboxPolicy,SandboxProvider,ConfinedArgvand the mode/dimension unions live in@prismshadow/penguin-core/pluginnow, since a backend is written against those names and nothing else — while the helpers that read them stay in the server package, which keeps both plugin subpaths emitting types and nothing else. A backend therefore names core alone: all four dropped@prismshadow/penguin-serverfrom their dependencies and can no longer resolve it, and the server's plugin subpath narrowed to the one member it owns,HarnessContext. - One word for the mechanism: plugin. What 0.2.8 shipped as the extension mechanism is the plugin mechanism from here on, so a reader meets the same term wherever the concept appears. The config file is
<root>/plugins.jsonwith apluginskey; the SDK subpaths are@prismshadow/penguin-core/pluginand@prismshadow/penguin-server/plugin; the contract namesPlugin/PluginContext/PluginEvents, and the harnessPluginHost; the four backends are@prismshadow/penguin-plugin-sandbox-*underplugins/.PenguinContext,PenguinInterface,HarnessContextand the whole sandbox vocabulary keep their names. The word stays taken elsewhere and none of it moved: file extensions, remark/micromark syntax extensions, the composer's "+" extension menu, and the SDK's own "Extension seams". Nor is it cordis'splugin— the DSH adaptor mounts DSH's chain through cordis'sContext.plugin, and the two vocabularies share nothing but the word.
Compatibility
An extensions.json already on disk is not read and not migrated. A deployment that configured plugins under the old name keeps running with none of them loaded and their capability silently unavailable — for these sandbox backends, that means commands spawn unconfined. Rename the file to plugins.json and its "extensions" key to "plugins"; the specifiers inside change only where they name this repository's sandbox backends, whose packages are now @prismshadow/penguin-plugin-sandbox-*. A package compiled against @prismshadow/penguin-core/extension or @prismshadow/penguin-server/extension no longer resolves: point the import at /plugin and rename the three types it uses.
terminals is a harness class and cannot be in the contract. It is named on HarnessContext, which extends it, so the emitted value still satisfies the contract and the seam is unchanged — but a plugin reading context.terminals now writes ctx as HarnessContext, stating where it is used that it depends on this embedder.
Nothing about the wire format, the database or any other on-disk document changes.