Commit Graph

3 Commits

Author SHA1 Message Date
opencode-agent d1aabef771 sqlite: document what survives a process kill
User asked what happens if the window is closed mid-task. Added a
'What happens if the process dies mid-task' section that tabulates
the four exit paths (TUI close, SIGTERM, SIGKILL, power loss) and
empirically confirms that anything past the last fsync'd commit is
on disk. The only ways to lose data are :memory:, an explicit
synchronous=OFF, or a network filesystem. Also corrects the earlier
'leak fd' framing — a dead process leaks no fds, the OS reclaims
them.
2026-10-08 17:22:13 +08:00
opencode-agent f873990e72 sqlite: document lifecycle and concurrency behaviour
User asked what happens if the connection is never closed and whether
concurrent calls are safe. Adds a Lifecycle and concurrency section
to README.md covering:

- not closing only leaks fds; data is durable on commit
- 3-tier concurrency model: same service / multi-CLI same service /
  multi-process, with the actual busy_timeout default (5s) and what
  to do if a longer wait is needed (run PRAGMA busy_timeout via
  sqlite_exec)
- :memory: semantics (gone on close, even within one process)
- NFS/SMB caveat

No code changes; current defaults (busy_timeout 5s, synchronous
FULL, locking normal) are sensible and the existing test sweep
already verified end-to-end.
2026-10-08 17:20:21 +08:00
opencode-agent 9aef200ac9 Add sqlite plugin: open/query/exec/script against .db files
Adds a single-file V2 plugin that exposes eight tools under the
`sqlite` namespace (open, close, list, query, exec, script, tables,
schema) so a model can read and write SQLite databases from a session.

- OpenCode discovers it automatically from ~/.config/opencode/plugins/.
- New runtime dependency: better-sqlite3 (installed in this repo's
  node_modules so the host's module resolution picks it up).
- README documents install, copy-to-another-machine, options, and
  troubleshooting; SETUP.md is a copy-paste checklist.
- Schema/options were trimmed down while authoring: the initial draft
  registered a no-op SQLite function on every open as a 'future hook';
  removed, it was dead code.
2026-10-08 17:03:48 +08:00