@threadbase-sh/streamer 1.59.0 → 1.59.1
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/cli.cjs +17 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/migrations/016_normalize_blank_project_path.sql +7 -0
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -144317,7 +144317,7 @@ var ConversationCache = class _ConversationCache {
|
|
|
144317
144317
|
"SELECT id, project_path, project_id, last_activity FROM conversation_meta WHERE project_path IS NOT NULL"
|
|
144318
144318
|
),
|
|
144319
144319
|
hasOrphanProjectId: db.prepare(
|
|
144320
|
-
"SELECT 1 FROM conversation_meta WHERE project_id IS NULL AND project_path IS NOT NULL LIMIT 1"
|
|
144320
|
+
"SELECT 1 FROM conversation_meta WHERE project_id IS NULL AND project_path IS NOT NULL AND project_path != '' LIMIT 1"
|
|
144321
144321
|
),
|
|
144322
144322
|
popularProjects: db.prepare(
|
|
144323
144323
|
`SELECT project_path, project_name, COUNT(*) as cnt
|
|
@@ -144914,10 +144914,11 @@ var ConversationCache = class _ConversationCache {
|
|
|
144914
144914
|
continue;
|
|
144915
144915
|
}
|
|
144916
144916
|
const scannerMetaJson = JSON.stringify(m2);
|
|
144917
|
+
const projectPath = m2.projectPath?.trim() || null;
|
|
144917
144918
|
this.stmts.upsertFull.run({
|
|
144918
144919
|
id,
|
|
144919
144920
|
file_path: canonicalPath2,
|
|
144920
|
-
project_path:
|
|
144921
|
+
project_path: projectPath,
|
|
144921
144922
|
project_name: m2.projectName ?? null,
|
|
144922
144923
|
title: m2.title ?? m2.sessionName ?? m2.projectName ?? null,
|
|
144923
144924
|
model: m2.model ?? null,
|
|
@@ -149840,7 +149841,7 @@ function isScannedSnapshotStale(snapshotTimestamp, fileMtimeMs) {
|
|
|
149840
149841
|
|
|
149841
149842
|
// src/scanner-manager.ts
|
|
149842
149843
|
var REFRESH_TTL_MS = 2e3;
|
|
149843
|
-
var ScannerManager = class {
|
|
149844
|
+
var ScannerManager = class _ScannerManager {
|
|
149844
149845
|
constructor(deps) {
|
|
149845
149846
|
this.deps = deps;
|
|
149846
149847
|
this.persistenceDisabled = deps.persistenceDisabled;
|
|
@@ -149861,6 +149862,12 @@ var ScannerManager = class {
|
|
|
149861
149862
|
allScanners = /* @__PURE__ */ new Set();
|
|
149862
149863
|
stalePaths = /* @__PURE__ */ new Set();
|
|
149863
149864
|
reconcileInFlight = null;
|
|
149865
|
+
lastAutoFullReconcileAt = 0;
|
|
149866
|
+
// reconcileMode() returns "full" on every poll while a permanent drift
|
|
149867
|
+
// condition holds (e.g. an orphan row) — without a cooldown each poll
|
|
149868
|
+
// re-walks the whole corpus back-to-back. refresh=1 and per-file
|
|
149869
|
+
// reconciles go through other paths and are unaffected.
|
|
149870
|
+
static AUTO_FULL_RECONCILE_COOLDOWN_MS = 6e4;
|
|
149864
149871
|
refreshInFlight = /* @__PURE__ */ new Map();
|
|
149865
149872
|
log = getLogger("server");
|
|
149866
149873
|
/**
|
|
@@ -150177,6 +150184,13 @@ var ScannerManager = class {
|
|
|
150177
150184
|
// in-flight cache write before shutting the DB.
|
|
150178
150185
|
startBackgroundReconcile(mode = "full") {
|
|
150179
150186
|
if (this.reconcileInFlight) return;
|
|
150187
|
+
if (mode === "full") {
|
|
150188
|
+
const now = Date.now();
|
|
150189
|
+
if (now - this.lastAutoFullReconcileAt < _ScannerManager.AUTO_FULL_RECONCILE_COOLDOWN_MS) {
|
|
150190
|
+
return;
|
|
150191
|
+
}
|
|
150192
|
+
this.lastAutoFullReconcileAt = now;
|
|
150193
|
+
}
|
|
150180
150194
|
const paths = mode === "files" ? this.takeStaleFiles() : [];
|
|
150181
150195
|
const task = (paths.length > 0 ? this.reconcileStaleFilesFromDisk(paths) : this.reconcileFromDisk()).finally(() => {
|
|
150182
150196
|
this.reconcileInFlight = null;
|