@nwire/kernel
v0.7.1
Published
Nwire kernel — the shared core that CLI, Studio, and MCP all dispatch through. Process supervisor, event bus, command router. One execution model, three surfaces.
Downloads
47
Readme
@nwire/kernel
The shared core under every Nwire surface — CLI, Studio, MCP all client through it.
What it does
Ships ProcessSupervisor (spawn / stream stdout / health-check / stop / restart), an EventBus for control events, and the CommandRouter that backs kernel.run(name, args). The CLI, Studio's run page, and @nwire/mcp all dispatch through this one router — same commands, three surfaces.
Install
pnpm add @nwire/kernelQuick start
import { createKernel, httpHealthCheck } from "@nwire/kernel";
const kernel = createKernel();
kernel.router.register("dev", async (args, ctx) => {
const proc = kernel.spawn({
name: "dev",
cmd: "vite-node",
args: ["apps/run.ts"],
healthCheck: httpHealthCheck("http://localhost:3000/healthz"),
});
ctx.onCancel(() => proc.stop());
await proc.ready;
});
const handle = kernel.run("dev", {});
handle.on((event) => console.log(event));
await handle.promise;API surface
createKernel()— produces{ router, supervisor, eventBus, run, spawn }.RunnerSupervisor— manages long-lived processes;start/stop/restart/list.EventBus— typed pub/sub forKernelEvent.httpHealthCheck(url)/inspectHealthCheck(...)— health-check factories.
When to use
When building anything that needs to launch and observe multiple processes — CLI commands, Studio's run page, MCP servers. (tooling).
