@adhdev/daemon-core 0.9.5 → 0.9.6
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 +59 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -9
- package/dist/index.mjs.map +1 -1
- package/dist/providers/cli-provider-instance.d.ts +7 -0
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/providers/cli-provider-instance.ts +59 -15
- package/src/providers/provider-schema.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -12779,6 +12779,13 @@ var CliProviderInstance = class {
|
|
|
12779
12779
|
runtimeMessages = [];
|
|
12780
12780
|
lastPersistedHistoryMessages = [];
|
|
12781
12781
|
lastCanonicalHermesSyncMtimeMs = 0;
|
|
12782
|
+
lastCanonicalHermesExistCheckAt = 0;
|
|
12783
|
+
lastCanonicalHermesWatchPath = void 0;
|
|
12784
|
+
lastCanonicalClaudeRebuildMtimeMs = 0;
|
|
12785
|
+
lastCanonicalClaudeCheckAt = 0;
|
|
12786
|
+
cachedSqliteDb = null;
|
|
12787
|
+
cachedSqliteDbPath = null;
|
|
12788
|
+
cachedSqliteDbMissingUntil = 0;
|
|
12782
12789
|
instanceId;
|
|
12783
12790
|
suppressIdleHistoryReplay = false;
|
|
12784
12791
|
errorMessage = void 0;
|
|
@@ -12843,7 +12850,12 @@ var CliProviderInstance = class {
|
|
|
12843
12850
|
*/
|
|
12844
12851
|
probeSessionIdFromConfig(probe) {
|
|
12845
12852
|
const resolvedDbPath = probe.dbPath.replace(/^~/, os11.homedir());
|
|
12846
|
-
|
|
12853
|
+
const now = Date.now();
|
|
12854
|
+
if (this.cachedSqliteDbMissingUntil > now) return null;
|
|
12855
|
+
if (!fs5.existsSync(resolvedDbPath)) {
|
|
12856
|
+
this.cachedSqliteDbMissingUntil = now + 1e4;
|
|
12857
|
+
return null;
|
|
12858
|
+
}
|
|
12847
12859
|
const directories = this.getProbeDirectories();
|
|
12848
12860
|
const minCreatedAt = Math.max(0, this.startedAt - 6e4);
|
|
12849
12861
|
const tsFormat = probe.timestampFormat || "unix_ms";
|
|
@@ -13014,6 +13026,12 @@ var CliProviderInstance = class {
|
|
|
13014
13026
|
this.adapter.shutdown();
|
|
13015
13027
|
this.monitor.reset();
|
|
13016
13028
|
this.appliedEffectKeys.clear();
|
|
13029
|
+
try {
|
|
13030
|
+
this.cachedSqliteDb?.close();
|
|
13031
|
+
} catch {
|
|
13032
|
+
}
|
|
13033
|
+
this.cachedSqliteDb = null;
|
|
13034
|
+
this.cachedSqliteDbPath = null;
|
|
13017
13035
|
}
|
|
13018
13036
|
completedDebounceTimer = null;
|
|
13019
13037
|
completedDebouncePending = null;
|
|
@@ -13418,13 +13436,35 @@ ${effect.notification.body || ""}`.trim();
|
|
|
13418
13436
|
let rebuilt = false;
|
|
13419
13437
|
if (canonicalHistory.format === "hermes-json") {
|
|
13420
13438
|
const watchPath = canonicalHistory.watchPath.replace(/^~/, os11.homedir()).replace("{{sessionId}}", this.providerSessionId);
|
|
13421
|
-
|
|
13439
|
+
const now = Date.now();
|
|
13440
|
+
if (watchPath !== this.lastCanonicalHermesWatchPath || now - this.lastCanonicalHermesExistCheckAt >= 2e3) {
|
|
13441
|
+
this.lastCanonicalHermesWatchPath = watchPath;
|
|
13442
|
+
this.lastCanonicalHermesExistCheckAt = now;
|
|
13443
|
+
if (!fs5.existsSync(watchPath)) return false;
|
|
13444
|
+
} else if (this.lastCanonicalHermesSyncMtimeMs === 0) {
|
|
13445
|
+
if (!fs5.existsSync(watchPath)) return false;
|
|
13446
|
+
}
|
|
13422
13447
|
const stat = fs5.statSync(watchPath);
|
|
13423
13448
|
if (stat.mtimeMs <= this.lastCanonicalHermesSyncMtimeMs) return true;
|
|
13424
13449
|
rebuilt = rebuildHermesSavedHistoryFromCanonicalSession(this.providerSessionId);
|
|
13425
13450
|
if (rebuilt) this.lastCanonicalHermesSyncMtimeMs = stat.mtimeMs;
|
|
13426
13451
|
} else if (canonicalHistory.format === "claude-jsonl") {
|
|
13452
|
+
const now = Date.now();
|
|
13453
|
+
if (now - this.lastCanonicalClaudeCheckAt < 2e3 && this.lastCanonicalClaudeRebuildMtimeMs !== 0) {
|
|
13454
|
+
return true;
|
|
13455
|
+
}
|
|
13456
|
+
this.lastCanonicalClaudeCheckAt = now;
|
|
13457
|
+
const claudeProjectsDir = path11.join(os11.homedir(), ".claude", "projects");
|
|
13458
|
+
const workspaceSegment = typeof this.workingDir === "string" ? this.workingDir.replace(/[\\/]/g, "-").replace(/^-+/, "") : "";
|
|
13459
|
+
const transcriptFile = path11.join(claudeProjectsDir, workspaceSegment, `${this.providerSessionId}.jsonl`);
|
|
13460
|
+
let transcriptMtime = 0;
|
|
13461
|
+
try {
|
|
13462
|
+
transcriptMtime = fs5.statSync(transcriptFile).mtimeMs;
|
|
13463
|
+
} catch {
|
|
13464
|
+
}
|
|
13465
|
+
if (transcriptMtime > 0 && transcriptMtime <= this.lastCanonicalClaudeRebuildMtimeMs) return true;
|
|
13427
13466
|
rebuilt = rebuildClaudeSavedHistoryFromNativeProject(this.providerSessionId, this.workingDir);
|
|
13467
|
+
if (rebuilt) this.lastCanonicalClaudeRebuildMtimeMs = transcriptMtime || Date.now();
|
|
13428
13468
|
}
|
|
13429
13469
|
if (!rebuilt) return false;
|
|
13430
13470
|
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
|
|
@@ -13489,20 +13529,29 @@ ${effect.notification.body || ""}`.trim();
|
|
|
13489
13529
|
return Array.from({ length: count }, () => "?").join(", ");
|
|
13490
13530
|
}
|
|
13491
13531
|
querySqliteText(dbPath, query, params) {
|
|
13492
|
-
let db = null;
|
|
13493
13532
|
try {
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13533
|
+
if (this.cachedSqliteDb === null || this.cachedSqliteDbPath !== dbPath) {
|
|
13534
|
+
try {
|
|
13535
|
+
this.cachedSqliteDb?.close();
|
|
13536
|
+
} catch {
|
|
13537
|
+
}
|
|
13538
|
+
this.cachedSqliteDb = null;
|
|
13539
|
+
this.cachedSqliteDbPath = null;
|
|
13540
|
+
const DatabaseSync = getDatabaseSync();
|
|
13541
|
+
this.cachedSqliteDb = new DatabaseSync(dbPath, { readOnly: true });
|
|
13542
|
+
this.cachedSqliteDbPath = dbPath;
|
|
13543
|
+
}
|
|
13544
|
+
const row = this.cachedSqliteDb.prepare(query).get(...params);
|
|
13497
13545
|
const sessionId = typeof row?.id === "string" ? row.id.trim() : "";
|
|
13498
13546
|
return sessionId || null;
|
|
13499
13547
|
} catch {
|
|
13500
|
-
return null;
|
|
13501
|
-
} finally {
|
|
13502
13548
|
try {
|
|
13503
|
-
|
|
13549
|
+
this.cachedSqliteDb?.close();
|
|
13504
13550
|
} catch {
|
|
13505
13551
|
}
|
|
13552
|
+
this.cachedSqliteDb = null;
|
|
13553
|
+
this.cachedSqliteDbPath = null;
|
|
13554
|
+
return null;
|
|
13506
13555
|
}
|
|
13507
13556
|
}
|
|
13508
13557
|
};
|
|
@@ -15465,6 +15514,7 @@ var KNOWN_PROVIDER_FIELDS = /* @__PURE__ */ new Set([
|
|
|
15465
15514
|
"canonicalHistory",
|
|
15466
15515
|
"autoFixProfile",
|
|
15467
15516
|
"ideLevelScripts",
|
|
15517
|
+
"allowInputDuringGeneration",
|
|
15468
15518
|
"scripts",
|
|
15469
15519
|
"vscodeCommands",
|
|
15470
15520
|
"inputMethod",
|