@adhdev/daemon-core 0.9.82-rc.444 → 0.9.82-rc.445
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhdev/daemon-core",
|
|
3
|
-
"version": "0.9.82-rc.
|
|
3
|
+
"version": "0.9.82-rc.445",
|
|
4
4
|
"description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"author": "vilmire",
|
|
47
47
|
"license": "AGPL-3.0-or-later",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@adhdev/mesh-shared": "0.9.82-rc.
|
|
49
|
+
"@adhdev/mesh-shared": "0.9.82-rc.445",
|
|
50
50
|
"@adhdev/session-host-core": "*",
|
|
51
51
|
"@agentclientprotocol/sdk": "^0.16.1",
|
|
52
52
|
"ajv": "^8.20.0",
|
|
@@ -57,6 +57,7 @@ import * as fs from 'fs';
|
|
|
57
57
|
import * as path from 'path';
|
|
58
58
|
import * as os from 'os';
|
|
59
59
|
import { loadBetterSqlite3 } from '../../system/load-better-sqlite3.js';
|
|
60
|
+
import { LOG } from '../../logging/logger.js';
|
|
60
61
|
|
|
61
62
|
// ─── Types ─────────────────────────────────────────────────────────────────
|
|
62
63
|
|
|
@@ -564,7 +565,18 @@ function parseConversationDb(
|
|
|
564
565
|
try {
|
|
565
566
|
const Database = loadBetterSqlite3();
|
|
566
567
|
db = new Database(filePath, { readonly: true, fileMustExist: true });
|
|
567
|
-
} catch {
|
|
568
|
+
} catch (err) {
|
|
569
|
+
// better-sqlite3 unavailable (ABI mismatch / not installed in this bundle)
|
|
570
|
+
// or the db handle failed to open. This is the silent-degrade that made a
|
|
571
|
+
// live read_chat return 0 assistant messages with no trace — the answers
|
|
572
|
+
// are on disk but unreadable. Log it (once-ish, at WARN) so the failure is
|
|
573
|
+
// greppable in daemon logs and distinguishable from "no db file". The
|
|
574
|
+
// reader still degrades gracefully (returns null → dispatcher falls back to
|
|
575
|
+
// brain/.pb), but the operator now knows WHY the .db path produced nothing.
|
|
576
|
+
LOG.warn(
|
|
577
|
+
'NativeHistory',
|
|
578
|
+
`antigravity .db reader could not open ${path.basename(filePath)}: ${err instanceof Error ? err.message : String(err)} (better-sqlite3 load/open failed — assistant answers in this .db will not surface)`,
|
|
579
|
+
);
|
|
568
580
|
return null;
|
|
569
581
|
}
|
|
570
582
|
|
|
@@ -578,8 +590,15 @@ function parseConversationDb(
|
|
|
578
590
|
ORDER BY idx ASC`,
|
|
579
591
|
)
|
|
580
592
|
.all() as AgyDbStepRow[];
|
|
581
|
-
} catch {
|
|
582
|
-
// `steps` table absent / unexpected schema
|
|
593
|
+
} catch (err) {
|
|
594
|
+
// `steps` table absent / unexpected schema — a real (but recoverable)
|
|
595
|
+
// shape mismatch, not the binding-missing case above. Log at debug so a
|
|
596
|
+
// schema drift in a future antigravity release is diagnosable without
|
|
597
|
+
// spamming logs for every legacy db.
|
|
598
|
+
LOG.debug(
|
|
599
|
+
'NativeHistory',
|
|
600
|
+
`antigravity .db ${path.basename(filePath)} has no readable steps table: ${err instanceof Error ? err.message : String(err)}`,
|
|
601
|
+
);
|
|
583
602
|
return null;
|
|
584
603
|
} finally {
|
|
585
604
|
try { db.close(); } catch { /* ignore */ }
|
|
@@ -239,6 +239,11 @@ function resolveAntigravityPath(workspace: string, sessionId: string): string |
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// (2) brain/<uuid>/.system_generated/logs/transcript.jsonl (legacy full source).
|
|
242
|
+
// Only bind to a brain transcript that is NON-EMPTY: current antigravity
|
|
243
|
+
// writes this file but leaves it 0 bytes (all real conversation data now
|
|
244
|
+
// lives in the per-session .db), so an empty transcript here would
|
|
245
|
+
// otherwise shadow the .db fallback below and return no messages. Skip
|
|
246
|
+
// empty transcripts so an unbound read still reaches the .db.
|
|
242
247
|
const brainRoot = path.join(agyRoot, 'brain');
|
|
243
248
|
if (fs.existsSync(brainRoot)) {
|
|
244
249
|
const cutoff = Date.now() - RECENT_WINDOW_MS;
|
|
@@ -249,7 +254,7 @@ function resolveAntigravityPath(workspace: string, sessionId: string): string |
|
|
|
249
254
|
.sort((a, b) => b.mtime - a.mtime);
|
|
250
255
|
for (const e of entries) {
|
|
251
256
|
const t = path.join(e.p, '.system_generated', 'logs', 'transcript.jsonl');
|
|
252
|
-
if (fs.existsSync(t)) return t;
|
|
257
|
+
if (fs.existsSync(t) && safeSize(t) > 0) return t;
|
|
253
258
|
}
|
|
254
259
|
}
|
|
255
260
|
|
|
@@ -354,6 +359,10 @@ function safeMtime(p: string): number {
|
|
|
354
359
|
try { return Math.floor(fs.statSync(p).mtimeMs); } catch { return 0; }
|
|
355
360
|
}
|
|
356
361
|
|
|
362
|
+
function safeSize(p: string): number {
|
|
363
|
+
try { return fs.statSync(p).size; } catch { return 0; }
|
|
364
|
+
}
|
|
365
|
+
|
|
357
366
|
function normalizeRole(r: any): 'user' | 'assistant' | 'system' {
|
|
358
367
|
const s = String(r ?? '').toLowerCase();
|
|
359
368
|
if (s === 'user' || s === 'human') return 'user';
|