@threadbase-sh/scanner 0.24.4 → 0.24.5

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 CHANGED
@@ -753,7 +753,8 @@ function initialReducerState() {
753
753
  turnDurations: []
754
754
  };
755
755
  }
756
- function reduceLine(state, entry, tier) {
756
+ function reduceLine(state, rawEntry, tier) {
757
+ const entry = asQueuedPromptUserEntry(rawEntry);
757
758
  if (entry.cwd && !state.cwd) state.cwd = entry.cwd;
758
759
  if (entry.sessionId && !state.sessionId) state.sessionId = entry.sessionId;
759
760
  state.nameSlots = applyClaudeNameEntry(state.nameSlots, entry);
@@ -862,6 +863,18 @@ function getShortProjectName(fullPath) {
862
863
  }
863
864
 
864
865
  // src/parser.ts
866
+ function asQueuedPromptUserEntry(entry) {
867
+ if (entry.type !== "attachment") return entry;
868
+ const att = entry.attachment;
869
+ if (att?.type !== "queued_command" || att.commandMode !== "prompt") return entry;
870
+ if (att.origin?.kind !== "human") return entry;
871
+ return {
872
+ ...entry,
873
+ type: "user",
874
+ attachment: void 0,
875
+ message: { role: "user", content: att.prompt }
876
+ };
877
+ }
865
878
  function turnDurationOf(entry) {
866
879
  if (entry.type !== "system" || entry.subtype !== "turn_duration" || typeof entry.durationMs !== "number") {
867
880
  return null;
@@ -1066,7 +1079,8 @@ function initialConvState() {
1066
1079
  teamInfo: {}
1067
1080
  };
1068
1081
  }
1069
- function reduceConvLine(state, entry) {
1082
+ function reduceConvLine(state, rawEntry) {
1083
+ const entry = asQueuedPromptUserEntry(rawEntry);
1070
1084
  if (entry.cwd && !state.cwd) state.cwd = entry.cwd;
1071
1085
  if (entry.sessionId && !state.sessionId) state.sessionId = entry.sessionId;
1072
1086
  state.nameSlots = applyClaudeNameEntry(state.nameSlots, entry);
@@ -3057,7 +3071,7 @@ import { mkdirSync } from "fs";
3057
3071
  import { dirname as dirname6 } from "path";
3058
3072
 
3059
3073
  // src/persistent/schema.ts
3060
- var SCHEMA_VERSION = 11;
3074
+ var SCHEMA_VERSION = 12;
3061
3075
  var SCHEMA_SQL = `
3062
3076
  CREATE TABLE IF NOT EXISTS conversation_files (
3063
3077
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -3389,6 +3403,22 @@ function runMigrations(db) {
3389
3403
  }
3390
3404
  }
3391
3405
  }
3406
+ if (current >= 1 && current < 12 && tableExists(db, "conversation_files")) {
3407
+ if (tableExists(db, "message_checkpoints")) db.exec("DELETE FROM message_checkpoints");
3408
+ const assignments = [];
3409
+ if (hasColumn(db, "conversation_files", "last_indexed_offset")) {
3410
+ assignments.push("last_indexed_offset = 0");
3411
+ }
3412
+ if (hasColumn(db, "conversation_files", "last_indexed_line")) {
3413
+ assignments.push("last_indexed_line = 0");
3414
+ }
3415
+ if (hasColumn(db, "conversation_files", "reducer_state")) {
3416
+ assignments.push("reducer_state = NULL");
3417
+ }
3418
+ if (assignments.length > 0) {
3419
+ db.exec(`UPDATE conversation_files SET ${assignments.join(", ")}`);
3420
+ }
3421
+ }
3392
3422
  db.exec(SCHEMA_SQL);
3393
3423
  db.pragma(`user_version = ${SCHEMA_VERSION}`);
3394
3424
  }