@threadbase-sh/scanner 0.20.0 → 0.21.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/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.20.0";
8
+ var version = "0.21.0";
9
9
 
10
10
  // src/logger.ts
11
11
  import pino from "pino";
@@ -536,8 +536,20 @@ function reduceConvLine(state, entry) {
536
536
  if (entry.lastPrompt && !state.lastPrompt) state.lastPrompt = entry.lastPrompt;
537
537
  return null;
538
538
  }
539
+ if (type === "system" && entry.subtype === "compact_boundary") {
540
+ const meta = entry.compactMetadata ?? {};
541
+ state.pendingCompaction = {
542
+ trigger: typeof meta.trigger === "string" ? meta.trigger : void 0,
543
+ preTokens: typeof meta.preTokens === "number" ? meta.preTokens : void 0,
544
+ postTokens: typeof meta.postTokens === "number" ? meta.postTokens : void 0
545
+ };
546
+ return null;
547
+ }
539
548
  if (type !== "user" && type !== "assistant") return null;
540
549
  if (entry.isMeta) return null;
550
+ const isCompactSummary = type === "user" && entry.isCompactSummary === true;
551
+ const compaction = isCompactSummary ? state.pendingCompaction : void 0;
552
+ if (isCompactSummary) delete state.pendingCompaction;
541
553
  const msg = entry.message;
542
554
  const toolUseBlocks = extractToolUseBlocks(msg?.content);
543
555
  for (const block of toolUseBlocks) state.pendingToolUses[block.id] = block;
@@ -597,7 +609,9 @@ function reduceConvLine(state, entry) {
597
609
  isSidechain: typeof entry.isSidechain === "boolean" ? entry.isSidechain : void 0,
598
610
  permissionMode: type === "user" ? entry.permissionMode : void 0,
599
611
  hasImages: hasImageBlocks(msg?.content) || void 0,
600
- attachment: entry.attachment !== void 0 ? entry.attachment : void 0
612
+ attachment: entry.attachment !== void 0 ? entry.attachment : void 0,
613
+ isCompactSummary: isCompactSummary || void 0,
614
+ compaction
601
615
  };
602
616
  }
603
617
  function applyTeamInfo(messages, state) {
@@ -685,6 +699,10 @@ function reduceLine(state, entry, tier) {
685
699
  if (type !== "user" && type !== "assistant") return;
686
700
  if (entry.isMeta) return;
687
701
  const msg = entry.message;
702
+ if (entry.isCompactSummary === true) {
703
+ if (extractTextContent(msg?.content)) state.pageMessageCount++;
704
+ return;
705
+ }
688
706
  if (state.model === null && msg?.model) state.model = msg.model;
689
707
  if (type === "user" && !state.firstUserSeen) {
690
708
  state.firstUserSeen = true;
@@ -2431,7 +2449,7 @@ function extractCursorSearchText(content) {
2431
2449
  function extractClaudeDelta(entry) {
2432
2450
  const type = entry.type;
2433
2451
  if (type !== "user" && type !== "assistant") return emptySearchDocument();
2434
- if (entry.isMeta) return emptySearchDocument();
2452
+ if (entry.isMeta || entry.isCompactSummary === true) return emptySearchDocument();
2435
2453
  const msg = entry.message;
2436
2454
  const content = msg?.content;
2437
2455
  const tools = [