@threadbase-sh/scanner 0.16.0 → 0.16.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/index.cjs CHANGED
@@ -1121,6 +1121,7 @@ function reduceCodexEntry(acc, entry, tier) {
1121
1121
  if (role !== "user" && role !== "assistant") return;
1122
1122
  const text = extractCodexText(payload.content);
1123
1123
  if (!text) return;
1124
+ if (acc.messageCount === 0 && role === "user" && isCodexInjectedContext(text)) return;
1124
1125
  const sender = role;
1125
1126
  acc.messageCount++;
1126
1127
  acc.lastMessageSender = sender;
@@ -1154,7 +1155,10 @@ function finalizeCodexMeta(acc, filePath, account, tier) {
1154
1155
  kind,
1155
1156
  externalSessionId: acc.sessionId || void 0,
1156
1157
  sessionId,
1157
- sessionName: "",
1158
+ // Mirrors the Claude reducer: a rollout carries no slug, so the opening turn
1159
+ // is the only human-readable name source. Only useful because the injected
1160
+ // AGENTS.md turn is skipped above — otherwise every title would be that blob.
1161
+ sessionName: deriveSessionNameFromFirstMessage(acc.firstUser),
1158
1162
  projectPath,
1159
1163
  projectName: getShortProjectName3(projectPath),
1160
1164
  account,
@@ -1177,6 +1181,10 @@ function finalizeCodexMeta(acc, filePath, account, tier) {
1177
1181
  lastPrompt: acc.lastUser?.text || void 0
1178
1182
  };
1179
1183
  }
1184
+ function isCodexInjectedContext(text) {
1185
+ if (text.startsWith("# AGENTS.md") || text.includes("<INSTRUCTIONS>")) return true;
1186
+ return text.startsWith("<permissions instructions>") || text.includes("Filesystem sandboxing defines");
1187
+ }
1180
1188
  function getShortProjectName3(fullPath) {
1181
1189
  return fullPath.split("/").filter(Boolean).slice(-3).join("/");
1182
1190
  }
@@ -1850,7 +1858,7 @@ var import_fs9 = require("fs");
1850
1858
  var import_path8 = require("path");
1851
1859
 
1852
1860
  // src/persistent/schema.ts
1853
- var SCHEMA_VERSION = 6;
1861
+ var SCHEMA_VERSION = 7;
1854
1862
  var SCHEMA_SQL = `
1855
1863
  CREATE TABLE IF NOT EXISTS conversation_files (
1856
1864
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -2085,6 +2093,21 @@ function runMigrations(db) {
2085
2093
  }
2086
2094
  }
2087
2095
  }
2096
+ if (current >= 1 && current < 7 && tableExists(db, "conversation_files")) {
2097
+ const assignments = [];
2098
+ if (hasColumn(db, "conversation_files", "last_indexed_offset")) {
2099
+ assignments.push("last_indexed_offset = 0");
2100
+ }
2101
+ if (hasColumn(db, "conversation_files", "last_indexed_line")) {
2102
+ assignments.push("last_indexed_line = 0");
2103
+ }
2104
+ if (hasColumn(db, "conversation_files", "reducer_state")) {
2105
+ assignments.push("reducer_state = NULL");
2106
+ }
2107
+ if (assignments.length > 0) {
2108
+ db.exec(`UPDATE conversation_files SET ${assignments.join(", ")}`);
2109
+ }
2110
+ }
2088
2111
  db.exec(SCHEMA_SQL);
2089
2112
  db.pragma(`user_version = ${SCHEMA_VERSION}`);
2090
2113
  }