@adhdev/daemon-core 0.9.82-rc.444 → 0.9.82-rc.446
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/dist/index.js +104 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/providers/cli-provider-instance.ts +78 -16
- package/src/providers/native-history/antigravity-cli-transcript.ts +96 -19
- package/src/providers/native-history/dispatcher.ts +10 -1
package/dist/index.mjs
CHANGED
|
@@ -404,10 +404,10 @@ function readInjected(value) {
|
|
|
404
404
|
}
|
|
405
405
|
function getDaemonBuildInfo() {
|
|
406
406
|
if (cached) return cached;
|
|
407
|
-
const commit = readInjected(true ? "
|
|
408
|
-
const commitShort = readInjected(true ? "
|
|
409
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
410
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
407
|
+
const commit = readInjected(true ? "c70a1cf556d27bbee6f81e64ea13699887f50ecc" : void 0) ?? "unknown";
|
|
408
|
+
const commitShort = readInjected(true ? "c70a1cf5" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
409
|
+
const version = readInjected(true ? "0.9.82-rc.446" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
410
|
+
const builtAt = readInjected(true ? "2026-07-01T15:09:11.778Z" : void 0);
|
|
411
411
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
412
412
|
return cached;
|
|
413
413
|
}
|
|
@@ -42202,19 +42202,41 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
42202
42202
|
if (shortFinalSummary) {
|
|
42203
42203
|
this.pushEvent({ event: "agent:generating_started", chatTitle, timestamp: now - shortDurationMs });
|
|
42204
42204
|
}
|
|
42205
|
+
const shortEngineTurnStart = typeof this.adapter?.currentTurnStartedAt === "number" && Number.isFinite(this.adapter.currentTurnStartedAt) ? this.adapter.currentTurnStartedAt : 0;
|
|
42206
|
+
const shortTurnStartedAt = shortEngineTurnStart || this.generatingStartedAt || 0;
|
|
42207
|
+
const shortTaskId = this.completingTurnTaskId();
|
|
42205
42208
|
this.generatingDebouncePending = null;
|
|
42206
42209
|
this.generatingStartedAt = 0;
|
|
42207
|
-
const missingEvidence = (this.provider.requiresFinalAssistantBeforeIdle === true || shortEvidenceSource === "external-native") && !shortFinalSummary;
|
|
42210
|
+
const missingEvidence = (this.provider.requiresFinalAssistantBeforeIdle === true || shortEvidenceSource === "external-native" || shortEvidenceSource === "unavailable") && !shortFinalSummary;
|
|
42208
42211
|
if (missingEvidence) {
|
|
42209
42212
|
LOG.warn("CLI", `[${this.type}] short completion missing final assistant evidence (source=${shortEvidenceSource})`);
|
|
42210
42213
|
}
|
|
42211
|
-
|
|
42212
|
-
|
|
42213
|
-
|
|
42214
|
-
|
|
42214
|
+
if (this.isAutonomousMeshSession()) {
|
|
42215
|
+
this.completedDebouncePending = {
|
|
42216
|
+
chatTitle,
|
|
42217
|
+
duration: Math.round(shortDurationMs / 1e3),
|
|
42218
|
+
timestamp: now,
|
|
42219
|
+
firstObservedAt: now,
|
|
42220
|
+
// Short-gen enters from generating→idle (or waiting_approval→idle); the
|
|
42221
|
+
// completedDebounce finalization gate treats previousStatus for its
|
|
42222
|
+
// approval-resolution / inter-approval-valley handling. lastStatus is the
|
|
42223
|
+
// status we transitioned FROM here.
|
|
42224
|
+
previousStatus: this.lastStatus,
|
|
42225
|
+
...shortTaskId ? { taskId: shortTaskId } : {},
|
|
42226
|
+
...shortTurnStartedAt ? { turnStartedAt: shortTurnStartedAt } : {},
|
|
42227
|
+
// FALSE-IDLE continuity: same arm-time snapshots as the normal branch so the
|
|
42228
|
+
// flush guard can prove continuous idle across the settle window.
|
|
42229
|
+
busyEpochAtArm: this.busyEpoch,
|
|
42230
|
+
...typeof adapterStatus?.lastOutputAt === "number" && Number.isFinite(adapterStatus.lastOutputAt) ? { lastOutputAtArm: adapterStatus.lastOutputAt } : {}
|
|
42231
|
+
};
|
|
42232
|
+
LOG.info("CLI", `[${this.type}] short-generating routed through settle window (${shortDurationMs}ms, source=${shortEvidenceSource}, missingEvidence=${missingEvidence}) \u2014 arming completedDebouncePending instead of inline fire`);
|
|
42215
42233
|
if (this.isMeshWorkerSession()) {
|
|
42216
|
-
traceMeshEventStage("
|
|
42234
|
+
traceMeshEventStage("arm", this.meshTraceCtx(), `short-generating settle-arm (source=${shortEvidenceSource}, missingEvidence=${missingEvidence})`);
|
|
42217
42235
|
}
|
|
42236
|
+
this.scheduleCompletedDebounceFlush(NATIVE_HISTORY_MESH_IDLE_SETTLE_MS);
|
|
42237
|
+
} else if (missingEvidence) {
|
|
42238
|
+
LOG.info("CLI", `[${this.type}] short completion suppressed: missing final assistant evidence, non-mesh session (source=${shortEvidenceSource})`);
|
|
42239
|
+
} else {
|
|
42218
42240
|
this.pushEvent({
|
|
42219
42241
|
event: "agent:generating_completed",
|
|
42220
42242
|
chatTitle,
|
|
@@ -42224,8 +42246,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
42224
42246
|
completionDiagnostic: {
|
|
42225
42247
|
reason: "short_generating_suppressed",
|
|
42226
42248
|
shortDurationMs,
|
|
42227
|
-
finalAssistantEvidenceSource: shortEvidenceSource
|
|
42228
|
-
...missingEvidence ? { blockReason: "missing_final_assistant" } : {}
|
|
42249
|
+
finalAssistantEvidenceSource: shortEvidenceSource
|
|
42229
42250
|
}
|
|
42230
42251
|
});
|
|
42231
42252
|
}
|
|
@@ -46320,6 +46341,7 @@ function readSession2(sessionPath) {
|
|
|
46320
46341
|
|
|
46321
46342
|
// src/providers/native-history/antigravity-cli-transcript.ts
|
|
46322
46343
|
init_load_better_sqlite3();
|
|
46344
|
+
init_logger();
|
|
46323
46345
|
import * as fs22 from "fs";
|
|
46324
46346
|
import * as path31 from "path";
|
|
46325
46347
|
import * as os22 from "os";
|
|
@@ -46577,30 +46599,75 @@ function extractUserPrompt(payload) {
|
|
|
46577
46599
|
if (!text) return "";
|
|
46578
46600
|
return extractUserRequestContent(text);
|
|
46579
46601
|
}
|
|
46602
|
+
function isSqliteBusyError(err) {
|
|
46603
|
+
if (!err) return false;
|
|
46604
|
+
const code = err.code;
|
|
46605
|
+
if (typeof code === "string" && code.includes("SQLITE_BUSY")) return true;
|
|
46606
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
46607
|
+
return /SQLITE_BUSY|database is locked|database table is locked/i.test(msg);
|
|
46608
|
+
}
|
|
46609
|
+
var AGY_DB_BUSY_TIMEOUT_MS = 3e3;
|
|
46610
|
+
var AGY_DB_MAX_ATTEMPTS = 4;
|
|
46611
|
+
var AGY_DB_RETRY_BACKOFF_MS = [50, 100, 150];
|
|
46612
|
+
function sleepBusy(ms) {
|
|
46613
|
+
const end = Date.now() + ms;
|
|
46614
|
+
while (Date.now() < end) {
|
|
46615
|
+
}
|
|
46616
|
+
}
|
|
46580
46617
|
function parseConversationDb(filePath, sessionId, workspace) {
|
|
46581
|
-
let
|
|
46618
|
+
let Database;
|
|
46582
46619
|
try {
|
|
46583
|
-
|
|
46584
|
-
|
|
46585
|
-
|
|
46620
|
+
Database = loadBetterSqlite3();
|
|
46621
|
+
} catch (err) {
|
|
46622
|
+
LOG.warn(
|
|
46623
|
+
"NativeHistory",
|
|
46624
|
+
`antigravity .db reader could not load better-sqlite3 for ${path31.basename(filePath)}: ${err instanceof Error ? err.message : String(err)} (native binding unavailable \u2014 assistant answers in this .db will not surface)`
|
|
46625
|
+
);
|
|
46586
46626
|
return null;
|
|
46587
46627
|
}
|
|
46588
|
-
let rows;
|
|
46589
|
-
|
|
46590
|
-
|
|
46591
|
-
|
|
46592
|
-
FROM steps
|
|
46593
|
-
WHERE step_type IN (${AGY_STEP_TYPE_USER}, ${AGY_STEP_TYPE_MODEL})
|
|
46594
|
-
ORDER BY idx ASC`
|
|
46595
|
-
).all();
|
|
46596
|
-
} catch {
|
|
46597
|
-
return null;
|
|
46598
|
-
} finally {
|
|
46628
|
+
let rows = null;
|
|
46629
|
+
let lastBusyErr;
|
|
46630
|
+
for (let attempt = 1; attempt <= AGY_DB_MAX_ATTEMPTS; attempt++) {
|
|
46631
|
+
let db;
|
|
46599
46632
|
try {
|
|
46600
|
-
db
|
|
46601
|
-
|
|
46633
|
+
db = new Database(filePath, { readonly: true, fileMustExist: true });
|
|
46634
|
+
try {
|
|
46635
|
+
db.pragma(`busy_timeout = ${AGY_DB_BUSY_TIMEOUT_MS}`);
|
|
46636
|
+
} catch {
|
|
46637
|
+
}
|
|
46638
|
+
rows = db.prepare(
|
|
46639
|
+
`SELECT idx, step_type, step_payload
|
|
46640
|
+
FROM steps
|
|
46641
|
+
WHERE step_type IN (${AGY_STEP_TYPE_USER}, ${AGY_STEP_TYPE_MODEL})
|
|
46642
|
+
ORDER BY idx ASC`
|
|
46643
|
+
).all();
|
|
46644
|
+
break;
|
|
46645
|
+
} catch (err) {
|
|
46646
|
+
if (isSqliteBusyError(err)) {
|
|
46647
|
+
lastBusyErr = err;
|
|
46648
|
+
if (attempt < AGY_DB_MAX_ATTEMPTS) {
|
|
46649
|
+
sleepBusy(AGY_DB_RETRY_BACKOFF_MS[attempt - 1] ?? 150);
|
|
46650
|
+
continue;
|
|
46651
|
+
}
|
|
46652
|
+
LOG.warn(
|
|
46653
|
+
"NativeHistory",
|
|
46654
|
+
`antigravity .db ${path31.basename(filePath)} stayed locked (SQLITE_BUSY) after ${AGY_DB_MAX_ATTEMPTS} attempts: ${err instanceof Error ? err.message : String(err)} (WAL write/checkpoint lock contention \u2014 assistant answers may transiently not surface this read)`
|
|
46655
|
+
);
|
|
46656
|
+
return null;
|
|
46657
|
+
}
|
|
46658
|
+
LOG.debug(
|
|
46659
|
+
"NativeHistory",
|
|
46660
|
+
`antigravity .db ${path31.basename(filePath)} not readable: ${err instanceof Error ? err.message : String(err)}`
|
|
46661
|
+
);
|
|
46662
|
+
return null;
|
|
46663
|
+
} finally {
|
|
46664
|
+
try {
|
|
46665
|
+
db?.close();
|
|
46666
|
+
} catch {
|
|
46667
|
+
}
|
|
46602
46668
|
}
|
|
46603
46669
|
}
|
|
46670
|
+
void lastBusyErr;
|
|
46604
46671
|
if (!Array.isArray(rows) || rows.length === 0) return null;
|
|
46605
46672
|
const normalizedWorkspace = typeof workspace === "string" ? workspace.trim() : "";
|
|
46606
46673
|
const baseTs = statMtimeMs3(filePath) || Date.now();
|
|
@@ -47034,7 +47101,7 @@ function resolveAntigravityPath(workspace, sessionId) {
|
|
|
47034
47101
|
const entries = fs24.readdirSync(brainRoot2, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => ({ p: path33.join(brainRoot2, e.name), mtime: safeMtime(path33.join(brainRoot2, e.name)) })).filter((e) => e.mtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
47035
47102
|
for (const e of entries) {
|
|
47036
47103
|
const t = path33.join(e.p, ".system_generated", "logs", "transcript.jsonl");
|
|
47037
|
-
if (fs24.existsSync(t)) return t;
|
|
47104
|
+
if (fs24.existsSync(t) && safeSize(t) > 0) return t;
|
|
47038
47105
|
}
|
|
47039
47106
|
}
|
|
47040
47107
|
const convRoot = path33.join(agyRoot, "conversations");
|
|
@@ -47098,6 +47165,13 @@ function safeMtime(p) {
|
|
|
47098
47165
|
return 0;
|
|
47099
47166
|
}
|
|
47100
47167
|
}
|
|
47168
|
+
function safeSize(p) {
|
|
47169
|
+
try {
|
|
47170
|
+
return fs24.statSync(p).size;
|
|
47171
|
+
} catch {
|
|
47172
|
+
return 0;
|
|
47173
|
+
}
|
|
47174
|
+
}
|
|
47101
47175
|
function normalizeRole2(r) {
|
|
47102
47176
|
const s2 = String(r ?? "").toLowerCase();
|
|
47103
47177
|
if (s2 === "user" || s2 === "human") return "user";
|