@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.js CHANGED
@@ -1054,6 +1054,7 @@ function reduceCodexEntry(acc, entry, tier) {
1054
1054
  if (role !== "user" && role !== "assistant") return;
1055
1055
  const text = extractCodexText(payload.content);
1056
1056
  if (!text) return;
1057
+ if (acc.messageCount === 0 && role === "user" && isCodexInjectedContext(text)) return;
1057
1058
  const sender = role;
1058
1059
  acc.messageCount++;
1059
1060
  acc.lastMessageSender = sender;
@@ -1087,7 +1088,10 @@ function finalizeCodexMeta(acc, filePath, account, tier) {
1087
1088
  kind,
1088
1089
  externalSessionId: acc.sessionId || void 0,
1089
1090
  sessionId,
1090
- sessionName: "",
1091
+ // Mirrors the Claude reducer: a rollout carries no slug, so the opening turn
1092
+ // is the only human-readable name source. Only useful because the injected
1093
+ // AGENTS.md turn is skipped above — otherwise every title would be that blob.
1094
+ sessionName: deriveSessionNameFromFirstMessage(acc.firstUser),
1091
1095
  projectPath,
1092
1096
  projectName: getShortProjectName3(projectPath),
1093
1097
  account,
@@ -1110,6 +1114,10 @@ function finalizeCodexMeta(acc, filePath, account, tier) {
1110
1114
  lastPrompt: acc.lastUser?.text || void 0
1111
1115
  };
1112
1116
  }
1117
+ function isCodexInjectedContext(text) {
1118
+ if (text.startsWith("# AGENTS.md") || text.includes("<INSTRUCTIONS>")) return true;
1119
+ return text.startsWith("<permissions instructions>") || text.includes("Filesystem sandboxing defines");
1120
+ }
1113
1121
  function getShortProjectName3(fullPath) {
1114
1122
  return fullPath.split("/").filter(Boolean).slice(-3).join("/");
1115
1123
  }
@@ -1783,7 +1791,7 @@ import { mkdirSync } from "fs";
1783
1791
  import { dirname as dirname3 } from "path";
1784
1792
 
1785
1793
  // src/persistent/schema.ts
1786
- var SCHEMA_VERSION = 6;
1794
+ var SCHEMA_VERSION = 7;
1787
1795
  var SCHEMA_SQL = `
1788
1796
  CREATE TABLE IF NOT EXISTS conversation_files (
1789
1797
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -2018,6 +2026,21 @@ function runMigrations(db) {
2018
2026
  }
2019
2027
  }
2020
2028
  }
2029
+ if (current >= 1 && current < 7 && tableExists(db, "conversation_files")) {
2030
+ const assignments = [];
2031
+ if (hasColumn(db, "conversation_files", "last_indexed_offset")) {
2032
+ assignments.push("last_indexed_offset = 0");
2033
+ }
2034
+ if (hasColumn(db, "conversation_files", "last_indexed_line")) {
2035
+ assignments.push("last_indexed_line = 0");
2036
+ }
2037
+ if (hasColumn(db, "conversation_files", "reducer_state")) {
2038
+ assignments.push("reducer_state = NULL");
2039
+ }
2040
+ if (assignments.length > 0) {
2041
+ db.exec(`UPDATE conversation_files SET ${assignments.join(", ")}`);
2042
+ }
2043
+ }
2021
2044
  db.exec(SCHEMA_SQL);
2022
2045
  db.pragma(`user_version = ${SCHEMA_VERSION}`);
2023
2046
  }