Environment:1broseidon Ketch Node Toolchain
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Build |
| Last Updated | 2026-10-27 00:00 GMT |
Overview
Node.js runtime environment for the pi package extension and the npm-distributed ketch CLI launcher, requiring Node >= 16.
Description
This environment is the JavaScript runtime context for the two Node.js surfaces in ketch. The pi package extension (`plugins/pi/extensions/ketch.ts` and `render.ts`) is a TypeScript module loaded by the pi coding agent; it spawns the ketch binary as a subprocess over `ketch … --json` and renders bounded, terminal-safe output. The npm launcher (`npm/bin/ketch.js`) is a thin shim that resolves the platform-specific goreleaser artifact and execs it, so `npx ketch` works without a Go toolchain on the host.
The npm package declares `engines.node: ">=16"` in `npm/package.json`. The pi package's tests run on the built-in Node test runner (`node --test plugins/pi/extensions/*.test.ts`). TypeScript is not a runtime dependency: the extension is consumed as source by pi, which compiles it.
Usage
Use this environment for any work on the pi package extension (ketch_* tool adapters and render helpers) or the npm launcher shim. A developer running `npm test` against the pi extension needs only this environment plus the ketch binary on PATH; no Go toolchain is required to run the tests. The npm-distributed binary itself is a goreleaser artifact — the launcher downloads the platform package, so an end user needs Node but not Go.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / macOS / Windows | Same cross-compile targets as the Go build |
| Hardware | Any CPU | amd64 or arm64; no GPU |
| Node.js | >= 16 | Declared in `npm/package.json` `engines.node` |
| ketch binary | on PATH | The pi extension and the npm launcher both invoke `ketch … --json` as a subprocess |
Dependencies
Runtime
- `node` >= 16 (npm launcher `engines.node`)
- `ketch` binary (platform artifact or locally built; on PATH)
pi Package Peer/Dev Dependencies (from `package.json`)
- `@earendil-works/pi-coding-agent` (peer; provides `ToolRenderers` type)
- `@earendil-works/pi-tui` (peer + dev 1.3.0; provides `Text` for inert rendering)
- `typebox` (peer + dev ^1.4.2)
npm Launcher Optional Dependencies (platform binaries)
- `@ketch-cli/{darwin,linux,win32}-{arm64,x64}` — one resolved per host platform
Credentials
No credentials are required for this environment. The ketch subprocess it launches may read operator config (`~/.config/ketch/`) and API keys, but those belong to the ketch runtime, not the Node toolchain.
Quick Install
# Node.js (adjust for your OS package manager; requires >= 16)
node --version
# Run the pi extension tests (built-in Node test runner)
npm test
# Install the npm-distributed CLI (downloads the platform artifact)
npm install -g ketch-cli
ketch --version
Code Evidence
Node engine constraint from `npm/package.json:36-37`:
"engines": {
"node": ">=16"
}
pi package test script from `package.json:33`:
"test": "node --test plugins/pi/extensions/*.test.ts"
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ketch: command not found` | ketch binary not on PATH | Build ketch (`CGO_ENABLED=0 go build`) or install via `npm install -g ketch-cli`; ensure it is on PATH |
| `Cannot find module '@earendil-works/pi-coding-agent'` | pi peer dependency missing | Install the pi package and its peers in the host project |
| `node: command not found` | Node.js not installed | Install Node >= 16 from nodejs.org or your package manager |
Compatibility Notes
- The pi extension is TypeScript source, not a compiled artifact: pi compiles it at load time, so there is no build step in this environment for the extension itself.
- The npm launcher (`bin/ketch.js`) is platform-agnostic Node that delegates to a platform-specific goreleaser binary via optional dependencies; it does not need the Go toolchain.
- The `>=16` floor matches the npm launcher's use of modern JS; the pi extension targets the same floor for consistency.