quilltap 4.10.0-dev.61 → 4.10.0-dev.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/bin/quilltap.js +13 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -193,6 +193,8 @@ quilltap db --mount-points --tables # Target the mount index DB
|
|
|
193
193
|
|
|
194
194
|
The database is opened **read-only by default**. Add `--write` to make changes: it opens the database read-write, **claims the instance lock** (`<dataDir>/quilltap.lock`) for the duration, and releases it on exit. It **refuses — with no override — if a running server or another instance holds the lock**, so stop the server first. `--repl` is read-only unless combined with `--write`. Attempting a write without `--write` fails with a hint to re-run with the flag. What "held" means, and how to tell a live lock from a stale one, is [below](#locking).
|
|
195
195
|
|
|
196
|
+
Compressed text columns (`chat_messages.content`, `llm_logs.request` / `response` and friends) are stored as BLOBs. Wrap them in `qt_text()` to read the text: `SELECT qt_text(content) …`.
|
|
197
|
+
|
|
196
198
|
In the REPL, `.cols <table>` and `.find <text>` mirror the subcommand helpers.
|
|
197
199
|
|
|
198
200
|
## Locking
|
package/bin/quilltap.js
CHANGED
|
@@ -11,6 +11,7 @@ const {
|
|
|
11
11
|
printDefaultInstanceHint,
|
|
12
12
|
promptPassphrase,
|
|
13
13
|
loadDbKey,
|
|
14
|
+
openEncryptedDb,
|
|
14
15
|
} = require('../lib/db-helpers');
|
|
15
16
|
const { resolveInstance } = require('../lib/instances');
|
|
16
17
|
const { resolveModuleDir, ensureNativeModules, ensureDatabaseNativeModule } = require('../lib/native-modules');
|
|
@@ -982,9 +983,10 @@ async function dbCommand(args) {
|
|
|
982
983
|
}
|
|
983
984
|
|
|
984
985
|
let dbFilename;
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
else dbFilename = 'quilltap.db';
|
|
986
|
+
let dbFriendlyName;
|
|
987
|
+
if (useLlmLogs) { dbFilename = 'quilltap-llm-logs.db'; dbFriendlyName = 'LLM logs database'; }
|
|
988
|
+
else if (useMountPoints) { dbFilename = 'quilltap-mount-index.db'; dbFriendlyName = 'mount index database'; }
|
|
989
|
+
else { dbFilename = 'quilltap.db'; dbFriendlyName = 'main database'; }
|
|
988
990
|
const dbPath = path.join(dataDir, dbFilename);
|
|
989
991
|
|
|
990
992
|
if (!fs.existsSync(dbPath)) {
|
|
@@ -1014,27 +1016,16 @@ async function dbCommand(args) {
|
|
|
1014
1016
|
}
|
|
1015
1017
|
}
|
|
1016
1018
|
|
|
1017
|
-
// Open
|
|
1018
|
-
|
|
1019
|
+
// Open through the one shared opener. It picks the SQLCipher-capable build,
|
|
1020
|
+
// keys the connection, verifies it, and — the reason the low-level path may
|
|
1021
|
+
// not roll its own — registers qt_text(). Without it raw SQL cannot read
|
|
1022
|
+
// inside a compressed text column, and a --write to chat_messages fails
|
|
1023
|
+
// outright because the search-index triggers call it (bug 162).
|
|
1024
|
+
let db;
|
|
1019
1025
|
try {
|
|
1020
|
-
|
|
1021
|
-
} catch {
|
|
1022
|
-
Database = require('better-sqlite3');
|
|
1023
|
-
}
|
|
1024
|
-
const db = new Database(dbPath, { readonly: !writable });
|
|
1025
|
-
|
|
1026
|
-
if (pepper) {
|
|
1027
|
-
const keyHex = Buffer.from(pepper, 'base64').toString('hex');
|
|
1028
|
-
db.pragma(`key = "x'${keyHex}'"`);
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
try {
|
|
1032
|
-
// Verify database is readable
|
|
1033
|
-
db.prepare('SELECT 1').get();
|
|
1026
|
+
db = openEncryptedDb(dbPath, pepper, { readonly: !writable, friendlyName: dbFriendlyName });
|
|
1034
1027
|
} catch (err) {
|
|
1035
|
-
console.error(
|
|
1036
|
-
console.error('The database may be encrypted with a different key, or the .dbkey file may be missing.');
|
|
1037
|
-
db.close();
|
|
1028
|
+
console.error(err.message);
|
|
1038
1029
|
process.exit(1);
|
|
1039
1030
|
}
|
|
1040
1031
|
|