@threadbase-sh/scanner 0.22.0 → 0.23.0

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
@@ -831,6 +831,7 @@ function finalizeMeta(state, filePath, account, tier) {
831
831
  provider: CLAUDE_CODE_PROVIDER,
832
832
  sessionId: state.sessionId || basename2(filePath, ".jsonl"),
833
833
  sessionName: resolveSessionName(state.nameSlots).name ?? "",
834
+ nameSlots: state.nameSlots,
834
835
  projectPath,
835
836
  projectName: getShortProjectName(projectPath),
836
837
  account,
@@ -1508,6 +1509,7 @@ function reduceCodexEntry(acc, entry, tier) {
1508
1509
  function finalizeCodexMeta(acc, filePath, account, tier) {
1509
1510
  if (acc.messageCount === 0) return null;
1510
1511
  const sessionId = acc.sessionId || basename4(filePath, ".jsonl");
1512
+ const nameSlots = { ...acc.nameSlots, ...codexNameSlotsFor(filePath, acc.sessionId) };
1511
1513
  const projectPath = acc.cwd;
1512
1514
  const kind = acc.lastAssistant === null && acc.toolNames.length > 0 ? "task" : "conversation";
1513
1515
  return {
@@ -1517,7 +1519,8 @@ function finalizeCodexMeta(acc, filePath, account, tier) {
1517
1519
  kind,
1518
1520
  externalSessionId: acc.sessionId || void 0,
1519
1521
  sessionId,
1520
- sessionName: resolveSessionName({ ...acc.nameSlots, ...codexNameSlotsFor(filePath, acc.sessionId) }).name ?? "",
1522
+ sessionName: resolveSessionName(nameSlots).name ?? "",
1523
+ nameSlots,
1521
1524
  projectPath,
1522
1525
  projectName: getShortProjectName3(projectPath),
1523
1526
  account,
@@ -1803,6 +1806,7 @@ function reduceCopilotEntry(acc, entry, tier) {
1803
1806
  function finalizeCopilotMeta(acc, filePath, account, tier) {
1804
1807
  if (acc.messageCount === 0) return null;
1805
1808
  const sessionId = acc.sessionId || sessionIdFromPath(filePath);
1809
+ const nameSlots = { ...acc.nameSlots, ...copilotNameSlotsFor(filePath) };
1806
1810
  const kind = acc.lastAssistant === null && acc.toolNames.length > 0 ? "task" : "conversation";
1807
1811
  return {
1808
1812
  id: filePath,
@@ -1811,7 +1815,8 @@ function finalizeCopilotMeta(acc, filePath, account, tier) {
1811
1815
  kind,
1812
1816
  externalSessionId: sessionId,
1813
1817
  sessionId,
1814
- sessionName: resolveSessionName({ ...acc.nameSlots, ...copilotNameSlotsFor(filePath) }).name ?? "",
1818
+ sessionName: resolveSessionName(nameSlots).name ?? "",
1819
+ nameSlots,
1815
1820
  projectPath: acc.cwd,
1816
1821
  projectName: getShortProjectName4(acc.cwd),
1817
1822
  account,
@@ -2213,6 +2218,7 @@ function reduceCursorEntry(acc, entry, tier) {
2213
2218
  function finalizeCursorMeta(acc, filePath, account, tier) {
2214
2219
  if (acc.messageCount === 0) return null;
2215
2220
  const sessionId = basename6(filePath, ".jsonl");
2221
+ const nameSlots = { ...acc.nameSlots, ...cursorNameSlotsFor(filePath, sessionId) };
2216
2222
  const isSubagent = SUBAGENT_PATH_RE2.test(filePath);
2217
2223
  const parent = isSubagent ? parentFromSubagentPath(filePath) : null;
2218
2224
  const { projectPath, projectName } = projectFromCursorPath(filePath);
@@ -2225,7 +2231,8 @@ function finalizeCursorMeta(acc, filePath, account, tier) {
2225
2231
  kind,
2226
2232
  externalSessionId: sessionId,
2227
2233
  sessionId,
2228
- sessionName: resolveSessionName({ ...acc.nameSlots, ...cursorNameSlotsFor(filePath, sessionId) }).name ?? "",
2234
+ sessionName: resolveSessionName(nameSlots).name ?? "",
2235
+ nameSlots,
2229
2236
  projectPath,
2230
2237
  projectName,
2231
2238
  account,
@@ -2782,7 +2789,7 @@ import { statSync as statSync5 } from "fs";
2782
2789
  // src/providers/parse.ts
2783
2790
  import { createReadStream as createReadStream7 } from "fs";
2784
2791
  import { createInterface as createInterface5 } from "readline";
2785
- async function parseMetaWithProvider(provider, filePath, account, tier, onEntry, onAccumulator) {
2792
+ async function parseMetaWithProvider(provider, filePath, account, tier, onEntry) {
2786
2793
  const log = getLogger();
2787
2794
  const acc = provider.createEmptyAccumulator();
2788
2795
  const rl = createInterface5({
@@ -2809,7 +2816,6 @@ async function parseMetaWithProvider(provider, filePath, account, tier, onEntry,
2809
2816
  log.warn({ filePath, provider: provider.name, err }, "provider parse: read failed");
2810
2817
  return null;
2811
2818
  }
2812
- onAccumulator?.(acc);
2813
2819
  return provider.finalize(acc, filePath, account, tier);
2814
2820
  }
2815
2821
 
@@ -3659,6 +3665,7 @@ function rowToMeta(row) {
3659
3665
  externalSessionId: row.external_session_id ?? void 0,
3660
3666
  sessionId: row.session_id,
3661
3667
  sessionName: row.session_name ?? "",
3668
+ nameSlots: row.name_slots ? JSON.parse(row.name_slots) : void 0,
3662
3669
  projectPath: row.project_path ?? "",
3663
3670
  projectName: row.project_name ?? "",
3664
3671
  account: row.account,
@@ -3691,7 +3698,7 @@ var ConversationsRepo = class {
3691
3698
  db;
3692
3699
  // Upsert by file_id (1 file = 1 conversation). Keyed on the unique file_id so
3693
3700
  // a re-index overwrites the prior summary in place.
3694
- upsert(fileId, meta, pageMessageCount = meta.messageCount, nameSlots) {
3701
+ upsert(fileId, meta, pageMessageCount = meta.messageCount) {
3695
3702
  this.db.prepare(
3696
3703
  `INSERT INTO conversations (
3697
3704
  file_id, source_path, provider, kind, external_session_id,
@@ -3790,7 +3797,7 @@ var ConversationsRepo = class {
3790
3797
  is_imported_from_claude: meta.isImportedFromClaude ? 1 : 0,
3791
3798
  is_imported_from_codex: meta.isImportedFromCodex ? 1 : 0,
3792
3799
  is_imported_from_cursor: meta.isImportedFromCursor ? 1 : 0,
3793
- name_slots: nameSlots ? JSON.stringify(nameSlots) : null
3800
+ name_slots: meta.nameSlots ? JSON.stringify(meta.nameSlots) : null
3794
3801
  });
3795
3802
  }
3796
3803
  getBySourcePath(sourcePath) {
@@ -4221,7 +4228,7 @@ var PersistentEngine = class {
4221
4228
  const base = resume ? this.fts.readDocument(fileId) ?? emptySearchDocument() : emptySearchDocument();
4222
4229
  const searchDoc = appendSearchDelta(base, searchDelta);
4223
4230
  const upsert = this.db.transaction(() => {
4224
- this.conversations.upsert(fileId, meta, state.pageMessageCount, state.nameSlots);
4231
+ this.conversations.upsert(fileId, meta, state.pageMessageCount);
4225
4232
  if (!this.fts.isCurrent(fileId, meta, searchDoc)) {
4226
4233
  this.fts.upsert(fileId, meta, searchDoc);
4227
4234
  }
@@ -4268,19 +4275,9 @@ var PersistentEngine = class {
4268
4275
  async indexFileWithProvider(provider, filePath, account, tier, stat6, resolveGitBranch) {
4269
4276
  const log = getLogger();
4270
4277
  let searchDoc = emptySearchDocument();
4271
- let transcriptSlots = {};
4272
- const meta = await parseMetaWithProvider(
4273
- provider,
4274
- filePath,
4275
- account,
4276
- tier,
4277
- (entry) => {
4278
- searchDoc = appendSearchDelta(searchDoc, extractSearchDelta(entry));
4279
- },
4280
- (acc) => {
4281
- transcriptSlots = acc.nameSlots ?? {};
4282
- }
4283
- );
4278
+ const meta = await parseMetaWithProvider(provider, filePath, account, tier, (entry) => {
4279
+ searchDoc = appendSearchDelta(searchDoc, extractSearchDelta(entry));
4280
+ });
4284
4281
  if (!meta) {
4285
4282
  this.markDeleted(filePath);
4286
4283
  return null;
@@ -4292,10 +4289,7 @@ var PersistentEngine = class {
4292
4289
  const fp = stat6.size > 0 ? fingerprint(filePath, stat6.size) : null;
4293
4290
  const fileId = this.files.ensure(filePath, account);
4294
4291
  const upsert = this.db.transaction(() => {
4295
- this.conversations.upsert(fileId, meta, meta.messageCount, {
4296
- ...transcriptSlots,
4297
- ...sideSlots
4298
- });
4292
+ this.conversations.upsert(fileId, meta, meta.messageCount);
4299
4293
  if (!this.fts.isCurrent(fileId, meta, searchDoc)) {
4300
4294
  this.fts.upsert(fileId, meta, searchDoc);
4301
4295
  }