Expand description
ocserve-plugin: opencode plugin compatibility via a Node sidecar (M4b).
Gate rationale (PLAN §10, evidence not assumption): the frozen plugins
import bun:sqlite, child_process, node:fs/crypto/url and TTY UI
modules (import audit of the actual artifacts). A quickjs embed would need
a dozen shims with a synchronous SQLite bridge — rejected as high-risk;
one Node sidecar (v25 present, node:sqlite built in) is the low-
maintenance host. Isolation: sidecar crash/restart cannot take down the
server; protocol = NDJSON on stdio; plugin chatter is forced to stderr by
the host so framing cannot corrupt.
Re-exports§
pub use normalize::Outcome as NormalizeOutcome;pub use normalize::normalize_or_raw_sync;
Modules§
- normalize
- Plugin entry normalization (D1 — bench/normalizer-spike/STRESS-RESULTS.md §Phase 3 dispositions; executable spec: bench/normalizer-spike/D1-PLAN.md).
Structs§
- Sidecar
- Sidecar handle: one Node process, NDJSON request/response, reader task.
Enums§
- Plugin
Runtime - Plugin-host runtime: Bun preferred (upstream runs plugins under Bun; real
bun:sqlite, TS plugins load, lower RSS floor), Node fallback.OCSERVE_PLUGIN_RUNTIME=node|bunforces one (lab A/B control).
Constants§
- HOST_
FILES - Host files (written next to the data dir once; content-addressed by embed).
- OOM_
CHILD_ WRAPPER sh -c WRAPPER sh <prog> <args…>→ raise oom_score_adj, move into the L2 kids cgroup (if the partition dance published one), then exec. Kept identical in ocserve-mcp + ocserve-plugin (no shared dep) — A3/L2.- RPC_
TIMEOUT - Per-RPC timeout (hooks are local JS; anything longer is a runaway plugin).
Functions§
- materialize_
host - Write host files into
dir(idempotent overwrite — embed is authoritative). - plugin_
runtime - resolve_
entry - Resolve a plugin spec to an entry file (loader.ts semantics, npm-install stage assumed already done by opencode’s cache — we re-use it read-only):
- set_
kids_ cgroup