@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/cli.js CHANGED
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
  import pino2 from "pino";
6
6
 
7
7
  // package.json
8
- var version = "0.24.4";
8
+ var version = "0.24.5";
9
9
 
10
10
  // src/logger.ts
11
11
  import pino from "pino";
@@ -823,7 +823,8 @@ function initialConvState() {
823
823
  teamInfo: {}
824
824
  };
825
825
  }
826
- function reduceConvLine(state, entry) {
826
+ function reduceConvLine(state, rawEntry) {
827
+ const entry = asQueuedPromptUserEntry(rawEntry);
827
828
  if (entry.cwd && !state.cwd) state.cwd = entry.cwd;
828
829
  if (entry.sessionId && !state.sessionId) state.sessionId = entry.sessionId;
829
830
  state.nameSlots = applyClaudeNameEntry(state.nameSlots, entry);
@@ -979,7 +980,8 @@ function initialReducerState() {
979
980
  turnDurations: []
980
981
  };
981
982
  }
982
- function reduceLine(state, entry, tier) {
983
+ function reduceLine(state, rawEntry, tier) {
984
+ const entry = asQueuedPromptUserEntry(rawEntry);
983
985
  if (entry.cwd && !state.cwd) state.cwd = entry.cwd;
984
986
  if (entry.sessionId && !state.sessionId) state.sessionId = entry.sessionId;
985
987
  state.nameSlots = applyClaudeNameEntry(state.nameSlots, entry);
@@ -1088,6 +1090,18 @@ function getShortProjectName(fullPath) {
1088
1090
  }
1089
1091
 
1090
1092
  // src/parser.ts
1093
+ function asQueuedPromptUserEntry(entry) {
1094
+ if (entry.type !== "attachment") return entry;
1095
+ const att = entry.attachment;
1096
+ if (att?.type !== "queued_command" || att.commandMode !== "prompt") return entry;
1097
+ if (att.origin?.kind !== "human") return entry;
1098
+ return {
1099
+ ...entry,
1100
+ type: "user",
1101
+ attachment: void 0,
1102
+ message: { role: "user", content: att.prompt }
1103
+ };
1104
+ }
1091
1105
  function turnDurationOf(entry) {
1092
1106
  if (entry.type !== "system" || entry.subtype !== "turn_duration" || typeof entry.durationMs !== "number") {
1093
1107
  return null;
@@ -2928,7 +2942,7 @@ import { mkdirSync } from "fs";
2928
2942
  import { dirname as dirname6 } from "path";
2929
2943
 
2930
2944
  // src/persistent/schema.ts
2931
- var SCHEMA_VERSION = 11;
2945
+ var SCHEMA_VERSION = 12;
2932
2946
  var SCHEMA_SQL = `
2933
2947
  CREATE TABLE IF NOT EXISTS conversation_files (
2934
2948
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -3260,6 +3274,22 @@ function runMigrations(db) {
3260
3274
  }
3261
3275
  }
3262
3276
  }
3277
+ if (current >= 1 && current < 12 && tableExists(db, "conversation_files")) {
3278
+ if (tableExists(db, "message_checkpoints")) db.exec("DELETE FROM message_checkpoints");
3279
+ const assignments = [];
3280
+ if (hasColumn(db, "conversation_files", "last_indexed_offset")) {
3281
+ assignments.push("last_indexed_offset = 0");
3282
+ }
3283
+ if (hasColumn(db, "conversation_files", "last_indexed_line")) {
3284
+ assignments.push("last_indexed_line = 0");
3285
+ }
3286
+ if (hasColumn(db, "conversation_files", "reducer_state")) {
3287
+ assignments.push("reducer_state = NULL");
3288
+ }
3289
+ if (assignments.length > 0) {
3290
+ db.exec(`UPDATE conversation_files SET ${assignments.join(", ")}`);
3291
+ }
3292
+ }
3263
3293
  db.exec(SCHEMA_SQL);
3264
3294
  db.pragma(`user_version = ${SCHEMA_VERSION}`);
3265
3295
  }