fix(ai-vault): require node:sqlite backup support in remote SQLite probes (#24086)

* fix(ai-vault): require the full SyncDatabase node:sqlite surface in host SQLite probes

The SSH and WSL OpenCode probes admitted any Node with DatabaseSync, so
Node 22.13-22.15 hosts (no backup export) skipped the pinned-runtime
fallback. Share one admission predicate with isSqliteAvailable() and
embed its source in both probe scripts.

* build(cli): list the node:sqlite admission predicate in the CLI project

---------

Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
This commit is contained in:
OrcaWin
2026-09-30 22:57:01 -07:00
committed by GitHub
co-authored by m4air
parent 07e9fdfd13
commit 3fe4b18dae
9 changed files with 131 additions and 4 deletions
+20
View File
@@ -0,0 +1,20 @@
/**
* Source of the node:sqlite admission check, embedded in remote/WSL probe scripts so a
* host's Node passes exactly when `isSqliteAvailable()` would admit it there.
* Why `backup`: it landed with the DatabaseSync options SyncDatabase relies on (Node 22.16),
* so Node 22.13–22.15 must take the pinned-runtime fallback.
*/
export const NODE_SQLITE_READER_API_SOURCE =
"(m)=>typeof m==='object'&&m!==null&&typeof m.DatabaseSync==='function'&&typeof m.backup==='function'"
/** In-process twin of {@link NODE_SQLITE_READER_API_SOURCE}; a parity test keeps them equal. */
export function hasNodeSqliteReaderApi(sqlite: unknown): boolean {
return (
typeof sqlite === 'object' &&
sqlite !== null &&
'DatabaseSync' in sqlite &&
typeof sqlite.DatabaseSync === 'function' &&
'backup' in sqlite &&
typeof sqlite.backup === 'function'
)
}