Files
orca/src/main/sqlite/node-sqlite-reader-api.ts
T
OrcaWinandm4air 3fe4b18dae 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>
2026-09-30 22:57:01 -07:00

21 lines
869 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 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'
)
}