@threadbase-sh/scanner 0.24.3 → 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.cjs CHANGED
@@ -843,7 +843,8 @@ function initialReducerState() {
843
843
  turnDurations: []
844
844
  };
845
845
  }
846
- function reduceLine(state, entry, tier) {
846
+ function reduceLine(state, rawEntry, tier) {
847
+ const entry = asQueuedPromptUserEntry(rawEntry);
847
848
  if (entry.cwd && !state.cwd) state.cwd = entry.cwd;
848
849
  if (entry.sessionId && !state.sessionId) state.sessionId = entry.sessionId;
849
850
  state.nameSlots = applyClaudeNameEntry(state.nameSlots, entry);
@@ -952,6 +953,18 @@ function getShortProjectName(fullPath) {
952
953
  }
953
954
 
954
955
  // src/parser.ts
956
+ function asQueuedPromptUserEntry(entry) {
957
+ if (entry.type !== "attachment") return entry;
958
+ const att = entry.attachment;
959
+ if (att?.type !== "queued_command" || att.commandMode !== "prompt") return entry;
960
+ if (att.origin?.kind !== "human") return entry;
961
+ return {
962
+ ...entry,
963
+ type: "user",
964
+ attachment: void 0,
965
+ message: { role: "user", content: att.prompt }
966
+ };
967
+ }
955
968
  function turnDurationOf(entry) {
956
969
  if (entry.type !== "system" || entry.subtype !== "turn_duration" || typeof entry.durationMs !== "number") {
957
970
  return null;
@@ -1156,7 +1169,8 @@ function initialConvState() {
1156
1169
  teamInfo: {}
1157
1170
  };
1158
1171
  }
1159
- function reduceConvLine(state, entry) {
1172
+ function reduceConvLine(state, rawEntry) {
1173
+ const entry = asQueuedPromptUserEntry(rawEntry);
1160
1174
  if (entry.cwd && !state.cwd) state.cwd = entry.cwd;
1161
1175
  if (entry.sessionId && !state.sessionId) state.sessionId = entry.sessionId;
1162
1176
  state.nameSlots = applyClaudeNameEntry(state.nameSlots, entry);
@@ -3147,7 +3161,7 @@ var import_fs12 = require("fs");
3147
3161
  var import_path11 = require("path");
3148
3162
 
3149
3163
  // src/persistent/schema.ts
3150
- var SCHEMA_VERSION = 11;
3164
+ var SCHEMA_VERSION = 12;
3151
3165
  var SCHEMA_SQL = `
3152
3166
  CREATE TABLE IF NOT EXISTS conversation_files (
3153
3167
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -3479,6 +3493,22 @@ function runMigrations(db) {
3479
3493
  }
3480
3494
  }
3481
3495
  }
3496
+ if (current >= 1 && current < 12 && tableExists(db, "conversation_files")) {
3497
+ if (tableExists(db, "message_checkpoints")) db.exec("DELETE FROM message_checkpoints");
3498
+ const assignments = [];
3499
+ if (hasColumn(db, "conversation_files", "last_indexed_offset")) {
3500
+ assignments.push("last_indexed_offset = 0");
3501
+ }
3502
+ if (hasColumn(db, "conversation_files", "last_indexed_line")) {
3503
+ assignments.push("last_indexed_line = 0");
3504
+ }
3505
+ if (hasColumn(db, "conversation_files", "reducer_state")) {
3506
+ assignments.push("reducer_state = NULL");
3507
+ }
3508
+ if (assignments.length > 0) {
3509
+ db.exec(`UPDATE conversation_files SET ${assignments.join(", ")}`);
3510
+ }
3511
+ }
3482
3512
  db.exec(SCHEMA_SQL);
3483
3513
  db.pragma(`user_version = ${SCHEMA_VERSION}`);
3484
3514
  }