@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.cjs CHANGED
@@ -921,6 +921,7 @@ function finalizeMeta(state, filePath, account, tier) {
921
921
  provider: CLAUDE_CODE_PROVIDER,
922
922
  sessionId: state.sessionId || (0, import_path3.basename)(filePath, ".jsonl"),
923
923
  sessionName: resolveSessionName(state.nameSlots).name ?? "",
924
+ nameSlots: state.nameSlots,
924
925
  projectPath,
925
926
  projectName: getShortProjectName(projectPath),
926
927
  account,
@@ -1598,6 +1599,7 @@ function reduceCodexEntry(acc, entry, tier) {
1598
1599
  function finalizeCodexMeta(acc, filePath, account, tier) {
1599
1600
  if (acc.messageCount === 0) return null;
1600
1601
  const sessionId = acc.sessionId || (0, import_path7.basename)(filePath, ".jsonl");
1602
+ const nameSlots = { ...acc.nameSlots, ...codexNameSlotsFor(filePath, acc.sessionId) };
1601
1603
  const projectPath = acc.cwd;
1602
1604
  const kind = acc.lastAssistant === null && acc.toolNames.length > 0 ? "task" : "conversation";
1603
1605
  return {
@@ -1607,7 +1609,8 @@ function finalizeCodexMeta(acc, filePath, account, tier) {
1607
1609
  kind,
1608
1610
  externalSessionId: acc.sessionId || void 0,
1609
1611
  sessionId,
1610
- sessionName: resolveSessionName({ ...acc.nameSlots, ...codexNameSlotsFor(filePath, acc.sessionId) }).name ?? "",
1612
+ sessionName: resolveSessionName(nameSlots).name ?? "",
1613
+ nameSlots,
1611
1614
  projectPath,
1612
1615
  projectName: getShortProjectName3(projectPath),
1613
1616
  account,
@@ -1893,6 +1896,7 @@ function reduceCopilotEntry(acc, entry, tier) {
1893
1896
  function finalizeCopilotMeta(acc, filePath, account, tier) {
1894
1897
  if (acc.messageCount === 0) return null;
1895
1898
  const sessionId = acc.sessionId || sessionIdFromPath(filePath);
1899
+ const nameSlots = { ...acc.nameSlots, ...copilotNameSlotsFor(filePath) };
1896
1900
  const kind = acc.lastAssistant === null && acc.toolNames.length > 0 ? "task" : "conversation";
1897
1901
  return {
1898
1902
  id: filePath,
@@ -1901,7 +1905,8 @@ function finalizeCopilotMeta(acc, filePath, account, tier) {
1901
1905
  kind,
1902
1906
  externalSessionId: sessionId,
1903
1907
  sessionId,
1904
- sessionName: resolveSessionName({ ...acc.nameSlots, ...copilotNameSlotsFor(filePath) }).name ?? "",
1908
+ sessionName: resolveSessionName(nameSlots).name ?? "",
1909
+ nameSlots,
1905
1910
  projectPath: acc.cwd,
1906
1911
  projectName: getShortProjectName4(acc.cwd),
1907
1912
  account,
@@ -2303,6 +2308,7 @@ function reduceCursorEntry(acc, entry, tier) {
2303
2308
  function finalizeCursorMeta(acc, filePath, account, tier) {
2304
2309
  if (acc.messageCount === 0) return null;
2305
2310
  const sessionId = (0, import_path9.basename)(filePath, ".jsonl");
2311
+ const nameSlots = { ...acc.nameSlots, ...cursorNameSlotsFor(filePath, sessionId) };
2306
2312
  const isSubagent = SUBAGENT_PATH_RE2.test(filePath);
2307
2313
  const parent = isSubagent ? parentFromSubagentPath(filePath) : null;
2308
2314
  const { projectPath, projectName } = projectFromCursorPath(filePath);
@@ -2315,7 +2321,8 @@ function finalizeCursorMeta(acc, filePath, account, tier) {
2315
2321
  kind,
2316
2322
  externalSessionId: sessionId,
2317
2323
  sessionId,
2318
- sessionName: resolveSessionName({ ...acc.nameSlots, ...cursorNameSlotsFor(filePath, sessionId) }).name ?? "",
2324
+ sessionName: resolveSessionName(nameSlots).name ?? "",
2325
+ nameSlots,
2319
2326
  projectPath,
2320
2327
  projectName,
2321
2328
  account,
@@ -2872,7 +2879,7 @@ var import_fs13 = require("fs");
2872
2879
  // src/providers/parse.ts
2873
2880
  var import_fs11 = require("fs");
2874
2881
  var import_readline5 = require("readline");
2875
- async function parseMetaWithProvider(provider, filePath, account, tier, onEntry, onAccumulator) {
2882
+ async function parseMetaWithProvider(provider, filePath, account, tier, onEntry) {
2876
2883
  const log = getLogger();
2877
2884
  const acc = provider.createEmptyAccumulator();
2878
2885
  const rl = (0, import_readline5.createInterface)({
@@ -2899,7 +2906,6 @@ async function parseMetaWithProvider(provider, filePath, account, tier, onEntry,
2899
2906
  log.warn({ filePath, provider: provider.name, err }, "provider parse: read failed");
2900
2907
  return null;
2901
2908
  }
2902
- onAccumulator?.(acc);
2903
2909
  return provider.finalize(acc, filePath, account, tier);
2904
2910
  }
2905
2911
 
@@ -3749,6 +3755,7 @@ function rowToMeta(row) {
3749
3755
  externalSessionId: row.external_session_id ?? void 0,
3750
3756
  sessionId: row.session_id,
3751
3757
  sessionName: row.session_name ?? "",
3758
+ nameSlots: row.name_slots ? JSON.parse(row.name_slots) : void 0,
3752
3759
  projectPath: row.project_path ?? "",
3753
3760
  projectName: row.project_name ?? "",
3754
3761
  account: row.account,
@@ -3781,7 +3788,7 @@ var ConversationsRepo = class {
3781
3788
  db;
3782
3789
  // Upsert by file_id (1 file = 1 conversation). Keyed on the unique file_id so
3783
3790
  // a re-index overwrites the prior summary in place.
3784
- upsert(fileId, meta, pageMessageCount = meta.messageCount, nameSlots) {
3791
+ upsert(fileId, meta, pageMessageCount = meta.messageCount) {
3785
3792
  this.db.prepare(
3786
3793
  `INSERT INTO conversations (
3787
3794
  file_id, source_path, provider, kind, external_session_id,
@@ -3880,7 +3887,7 @@ var ConversationsRepo = class {
3880
3887
  is_imported_from_claude: meta.isImportedFromClaude ? 1 : 0,
3881
3888
  is_imported_from_codex: meta.isImportedFromCodex ? 1 : 0,
3882
3889
  is_imported_from_cursor: meta.isImportedFromCursor ? 1 : 0,
3883
- name_slots: nameSlots ? JSON.stringify(nameSlots) : null
3890
+ name_slots: meta.nameSlots ? JSON.stringify(meta.nameSlots) : null
3884
3891
  });
3885
3892
  }
3886
3893
  getBySourcePath(sourcePath) {
@@ -4311,7 +4318,7 @@ var PersistentEngine = class {
4311
4318
  const base = resume ? this.fts.readDocument(fileId) ?? emptySearchDocument() : emptySearchDocument();
4312
4319
  const searchDoc = appendSearchDelta(base, searchDelta);
4313
4320
  const upsert = this.db.transaction(() => {
4314
- this.conversations.upsert(fileId, meta, state.pageMessageCount, state.nameSlots);
4321
+ this.conversations.upsert(fileId, meta, state.pageMessageCount);
4315
4322
  if (!this.fts.isCurrent(fileId, meta, searchDoc)) {
4316
4323
  this.fts.upsert(fileId, meta, searchDoc);
4317
4324
  }
@@ -4358,19 +4365,9 @@ var PersistentEngine = class {
4358
4365
  async indexFileWithProvider(provider, filePath, account, tier, stat6, resolveGitBranch) {
4359
4366
  const log = getLogger();
4360
4367
  let searchDoc = emptySearchDocument();
4361
- let transcriptSlots = {};
4362
- const meta = await parseMetaWithProvider(
4363
- provider,
4364
- filePath,
4365
- account,
4366
- tier,
4367
- (entry) => {
4368
- searchDoc = appendSearchDelta(searchDoc, extractSearchDelta(entry));
4369
- },
4370
- (acc) => {
4371
- transcriptSlots = acc.nameSlots ?? {};
4372
- }
4373
- );
4368
+ const meta = await parseMetaWithProvider(provider, filePath, account, tier, (entry) => {
4369
+ searchDoc = appendSearchDelta(searchDoc, extractSearchDelta(entry));
4370
+ });
4374
4371
  if (!meta) {
4375
4372
  this.markDeleted(filePath);
4376
4373
  return null;
@@ -4382,10 +4379,7 @@ var PersistentEngine = class {
4382
4379
  const fp = stat6.size > 0 ? fingerprint(filePath, stat6.size) : null;
4383
4380
  const fileId = this.files.ensure(filePath, account);
4384
4381
  const upsert = this.db.transaction(() => {
4385
- this.conversations.upsert(fileId, meta, meta.messageCount, {
4386
- ...transcriptSlots,
4387
- ...sideSlots
4388
- });
4382
+ this.conversations.upsert(fileId, meta, meta.messageCount);
4389
4383
  if (!this.fts.isCurrent(fileId, meta, searchDoc)) {
4390
4384
  this.fts.upsert(fileId, meta, searchDoc);
4391
4385
  }