Repository navigation
Description
Question
Do we intend to support Pi on Node at all, or is Bun a stated requirement we own? Both answers are defensible. Shipping a front-page adapter that only loads on a runtime the host does not use, with no launcher to bridge it, is the one answer that is not.
This ticket is a decision with a measured cost attached, not an open-ended port.
Measured surface
Counted across src/ on main:
| Dependency | Uses | Note |
|---|---|---|
bun:sqlite |
1 file | src/store/lock.ts — this is the store's locking correctness mechanism: BEGIN IMMEDIATE, PRAGMA busy_timeout, journal-mode handling. Not an optimization to drop. |
Bun.file |
8 | reads in load, gate, init, startup, viewer, commands |
Bun.write |
7 | publication paths |
Bun.Glob |
6 | day-file discovery and gate matching; comments in src/gate/resolver.ts already say a replacement must match Bun.Glob |
Bun.spawnSync |
4 | git probes and host capability probes |
Bun.version |
1 | startup telemetry |
Bun.serve |
1 | the browser viewer, optional surface |
The TypeScript entry point is not the obstacle: Pi loaded .ts under Node without complaint, which is why the failure in #610 is our own message rather than a syntax error. The file and process primitives are mechanical. The decision is sqlite.
Options for the locking layer
node:sqlite— no dependency, but Node 22.5 or newer. The seat used to test this runs Node 20.20.2, so a large share of users would still be locked out, and we would be trading one runtime requirement for a version floor.better-sqlite3or similar — broad Node coverage, but a native dependency with prebuilds for every platform we claim, and its own install failure modes. We would be removing one install cliff by adding another.- Bun required, owned — keep
bun:sqlite, and ship the launcher in No launcher artifact: Pi with memory needs a hand-assembled Bun command every session #611 so the requirement is satisfied for the user rather than explained to them. Cheapest path to a non-broken experience; costs us the "works anywhere Node runs" reading of the portability claim, so the docs must say it out loud at the point of use, not only inREADME.pi.md.
Acceptance
- An ADR recording the choice with these numbers and the reasoning, plus the front-page wording it implies.
- If the choice is 1 or 2: a branch where the store runs under Node with the existing store-concurrency, lock and publication tests unchanged and green, and a glob-behaviour comparison against
Bun.Globon the day-file patterns before any recall claim is made. No merge if a concurrency test is edited to accommodate the new driver — that result means the driver is wrong, not the test. - If the choice is 3: Pi adapter throws at extension load, so a Node-launched Pi refuses to start #610 and No launcher artifact: Pi with memory needs a hand-assembled Bun command every session #611 are what ship, and the README's harness paragraph names the runtime requirement in the same sentence as the adapter, so the claim and the constraint arrive together.
Non-goals
Not a port of the viewer, and not an argument about which runtime is better. The only question is what a person who installs this package into Pi can be promised.
Activity
ocsi-architect commentedon Nov 29, 2026
Measured option 1, so the decision can be made on numbers rather than on the Node 22.5 date.
On this machine's two Node installs, same
BEGIN IMMEDIATE/PRAGMA busy_timeout = 0sequencesrc/store/lock.tsuses, and two processes racing one database file:ERR_UNKNOWN_BUILTIN_MODULEnode:sqlite, emits an experimental warning)bun:sqlite)database is lockedSo the mutual exclusion is real under
node:sqlite, and option 1 is viable at the level that matters: the lock still locks, it does not silently degrade into a per-process advisory.journal_modereads backdelete, matching what the module sets explicitly.The work is not swapping the import. Node reports refusal as
ERR_SQLITE_ERRORwhere Bun reportsdatabase is locked, andsrc/store/lock.tsclassifies waits by driver codes (the comment near its error helper notesSQLITE_BUSYversus the extended name, because comparing against the plain code mis-sortsBUSY_RECOVERYand friends). A port has to map error identity per driver, and the tests that assert the reported reason must stay byte-identical — a changed assertion there means the driver is wrong, not the test.Cost is therefore: one driver seam plus error-identity mapping, against a hard Node 22.5 floor that excludes the Node most people still have — the machine used to test Pi support is on 20.20.2. That makes option 3 (own "Bun required", bridge it with #613) the cheaper promise to keep honest, and option 1 the better one if we are willing to publish a floor. What we cannot keep doing is the current state: a front-page adapter claim whose runtime constraint is stated only in
README.pi.md.ocsi-architect commentedon Nov 29, 2026
Correction to my earlier comment. I wrote that option 1 "excludes the Node most people still have", using this test machine's Node 20.20.2 as the reference. That was the wrong reference, and the ticket owner should not weigh it.
Pi's own manifest says otherwise:
@earendil-works/pi-coding-agent1.7.0 (installed here)node: >=22.19.0@earendil-works/pi-coding-agentlatest on npmnode: >=22.19.0@oh-my-pi/pi-coding-agent19.2.1bun: >=1.4.4bun: >=1.3.0node:sqlitestopped needing--experimental-sqlitein Node 22.13.0 and 23.4.0 (Node's own compatibility table). So every Node version Pi itself supports already hasnode:sqliteunflagged: option 1 adds no floor at all for the host this whole thread is about. It removes the requirement, which is better than bridging it.This machine's Node 20.20.2 is not a counterexample — it is running Pi outside Pi's declared range, which is why the
pishim works at all.Re-scoped the port cost to the graph a Pi session actually loads, rather than all of
src/: walking imports fromsrc/adapters/pi/extension.tsreaches 131 files, with no.tsxanywhere in it, onebun:module (bun:sqlite), and 22Bun.*sites —Bun.file6,Bun.write5,Bun.Glob6,Bun.spawnSync4,Bun.version1. TypeScript is not an obstacle either way: Pi's extension loader parsed our.tsentry point under Node 20, so the message in #610 was ours and not a syntax error.Two API details the port has to carry, from the same compatibility table:
DatabaseSyncis the only export from 22.13 through 26.10, withDatabaseadded in 26.11, so the import needsDatabase ?? DatabaseSyncrather than either name alone; and Node reports a refused lock asERR_SQLITE_ERRORwhere Bun saysdatabase is locked, whilesrc/store/lock.tsclassifies waits by driver code, so that mapping is part of the work, not a follow-up.Revised recommendation, which reverses mine: make the store runtime-neutral (option 1) as the durable fix, and keep #613 as the install-and-diagnose surface rather than as the thing that papers over the runtime. #610 still ships first either way, because it is five lines and it stops the host refusing to start today.
ocsi-architect commentedon Nov 29, 2026
Scoping for the implementation, from the branch that fixes #610 (
f6a3337), plus the one unknown that turned out fine.Error identity is not a blocker. Node exposes the extended SQLite result code on the exception, so
src/store/lock.tscan keep classifying by code rather than by message. Forcing a second writer against a heldBEGIN IMMEDIATEon Node 22.23.4:errcode: 5isSQLITE_BUSY, and because it is the extended code the existing distinction between plain busy andBUSY_RECOVERY-style variants survives; Bun's driver already exposeserrno. So the seam needs{ run, get, close }plus a busy classifier overerrcode/errno, and nothing has to parse text.The port is 22 sites in 13 files, not 1. Walking the imports a Pi session loads,
bun:sqliteappears once (src/store/lock.ts), and these are the rest:src/gate/resolver.tssrc/store/files/load.tssrc/core/logfmt/publish.ts,src/store/undo.ts,src/init/detect.ts,src/capture/available.tssrc/identity/repokey.ts,src/core/permissions.ts,src/runtime/setup.ts,src/runtime/startup.ts,src/store/files/snapshots.ts,src/status/payload.ts,src/capture/triggers.tsBy API:
Bun.file6,Bun.Glob6,Bun.write5,Bun.spawnSync4,Bun.version1. So a sqlite-only change would not make Pi load: the engine would still throw on the firstBun.file. The work is one small host-io seam (read, write, glob, spawn, version) threaded through those 13 files, plus the driver seam.The risk that decides the order of work is glob semantics, not sqlite.
src/gate/resolver.tscomments already say a replacement must matchBun.Glob, and gate matching decides which memories a project sees. So the first artifact should be a differential test that runs both glob implementations over the day-file and gate patterns — real store trees, not hand-written fixtures — and fails on any divergence. Same forspawnSync:src/identity/repokey.tsderives the repo key fromgit remote get-url origin, so a mismatch there silently re-keys every project's memories. Both of those are correctness, not plumbing, and they need to be pinned before the seam is threaded, not after.Nothing here changes the merge condition in the ticket body: store-concurrency, lock and publication tests stay untouched and green, and a test edited to accommodate the new driver means the driver is wrong.
chore(release): 0.41.0 [skip ci]
abogartz-opencode-self-improvement commentedon Nov 30, 2026
🎉 This issue has been resolved in version 0.41.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
spike(store): run the lock layer on node:sqlite
feat(runtime): native installs on plain Node for the Pi-family adapters