mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
Bundle Bun for headless Orca and profile persistence (#22635)
Bundle a pinned, verified Bun runtime for headless Orca so existing Node launch commands can hand off before opening a profile. Keep desktop execution on Electron. Add the Bun SQLite adapter and terminal backend, bounded shutdown, process inspection and cross-platform artifact qualification. Keep future managed SSH deployment separate from current production launch paths.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import type { StatementResultingChanges } from 'node:sqlite'
|
||||
import type { SqliteRow } from './sqlite-statement'
|
||||
|
||||
export class SqliteIntegerReader {
|
||||
readBigInts = false
|
||||
|
||||
row(row: SqliteRow): SqliteRow {
|
||||
if (!this.readBigInts) {
|
||||
for (const key of Object.keys(row)) {
|
||||
const value = row[key]
|
||||
if (typeof value === 'bigint') {
|
||||
row[key] = this.integer(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
return row
|
||||
}
|
||||
|
||||
result(result: StatementResultingChanges): StatementResultingChanges {
|
||||
return {
|
||||
changes: this.integer(result.changes, false),
|
||||
lastInsertRowid: this.integer(result.lastInsertRowid, false)
|
||||
}
|
||||
}
|
||||
|
||||
private integer(value: number | bigint, requireSafeNumber = true): number | bigint {
|
||||
if (this.readBigInts) {
|
||||
return BigInt(value)
|
||||
}
|
||||
const number = Number(value)
|
||||
if (!Number.isSafeInteger(number)) {
|
||||
// Metadata conversion must not report failure after a write has committed.
|
||||
if (!requireSafeNumber) {
|
||||
return BigInt(value)
|
||||
}
|
||||
throw new RangeError('SQLite integer cannot be represented safely as a JavaScript number')
|
||||
}
|
||||
return number
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user