@threadbase-sh/scanner 0.20.0 → 0.21.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/cli.js +29 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +28 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -6
- package/dist/index.js.map +1 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/persistent/conversation-reducer.d.ts +2 -1
- package/dist/persistent/conversation-reducer.d.ts.map +1 -1
- package/dist/persistent/conversation-stream.d.ts.map +1 -1
- package/dist/persistent/metadata-reducer.d.ts.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
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.
|
|
8
|
+
var version = "0.21.1";
|
|
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;
|
|
@@ -867,7 +885,7 @@ async function parseConversation(filePath, account) {
|
|
|
867
885
|
const message = reduceConvLine(state, entry);
|
|
868
886
|
if (message) {
|
|
869
887
|
messages.push(message);
|
|
870
|
-
if (message.text) textParts.push(message.text);
|
|
888
|
+
if (message.text && !message.isCompactSummary) textParts.push(message.text);
|
|
871
889
|
}
|
|
872
890
|
}
|
|
873
891
|
} catch (err) {
|
|
@@ -889,7 +907,9 @@ async function parseConversation(filePath, account) {
|
|
|
889
907
|
projectPath: state.cwd,
|
|
890
908
|
projectName: getShortProjectName2(state.cwd),
|
|
891
909
|
sessionId: state.sessionId || basename2(filePath, ".jsonl"),
|
|
892
|
-
sessionName: state.sessionName || deriveSessionNameFromFirstMessage(
|
|
910
|
+
sessionName: state.sessionName || deriveSessionNameFromFirstMessage(
|
|
911
|
+
messages.find((m) => m.role === "user" && m.text && !m.isCompactSummary) ?? null
|
|
912
|
+
),
|
|
893
913
|
messages,
|
|
894
914
|
fullText: textParts.join(" "),
|
|
895
915
|
timestamp: state.latestTimestamp || (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1132,7 +1152,7 @@ async function foldTail(filePath, resume) {
|
|
|
1132
1152
|
resume.state,
|
|
1133
1153
|
(message) => {
|
|
1134
1154
|
messages.push(message);
|
|
1135
|
-
if (message.text) textParts.push(message.text);
|
|
1155
|
+
if (message.text && !message.isCompactSummary) textParts.push(message.text);
|
|
1136
1156
|
return false;
|
|
1137
1157
|
},
|
|
1138
1158
|
(entry) => {
|
|
@@ -1156,7 +1176,9 @@ function assemble(filePath, account, messages, fullText, turnDurations, state) {
|
|
|
1156
1176
|
projectPath: state.cwd,
|
|
1157
1177
|
projectName: getShortProjectName2(state.cwd),
|
|
1158
1178
|
sessionId: state.sessionId || basename3(filePath, ".jsonl"),
|
|
1159
|
-
sessionName: state.sessionName || deriveSessionNameFromFirstMessage(
|
|
1179
|
+
sessionName: state.sessionName || deriveSessionNameFromFirstMessage(
|
|
1180
|
+
messages.find((m) => m.role === "user" && m.text && !m.isCompactSummary) ?? null
|
|
1181
|
+
),
|
|
1160
1182
|
messages,
|
|
1161
1183
|
fullText,
|
|
1162
1184
|
timestamp: state.latestTimestamp || (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -2431,7 +2453,7 @@ function extractCursorSearchText(content) {
|
|
|
2431
2453
|
function extractClaudeDelta(entry) {
|
|
2432
2454
|
const type = entry.type;
|
|
2433
2455
|
if (type !== "user" && type !== "assistant") return emptySearchDocument();
|
|
2434
|
-
if (entry.isMeta) return emptySearchDocument();
|
|
2456
|
+
if (entry.isMeta || entry.isCompactSummary === true) return emptySearchDocument();
|
|
2435
2457
|
const msg = entry.message;
|
|
2436
2458
|
const content = msg?.content;
|
|
2437
2459
|
const tools = [
|