@threadbase-sh/scanner 0.19.0 → 0.19.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 +13 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +12 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/providers/cursor.d.ts +1 -1
- package/dist/providers/cursor.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1540,15 +1540,22 @@ function firstTimestampHint(content) {
|
|
|
1540
1540
|
}
|
|
1541
1541
|
return "";
|
|
1542
1542
|
}
|
|
1543
|
-
function parseCursorJsonlLine(line) {
|
|
1544
|
-
|
|
1543
|
+
function parseCursorJsonlLine(line, index) {
|
|
1544
|
+
const trimmed = line.trim();
|
|
1545
|
+
if (!trimmed) return null;
|
|
1545
1546
|
let entry;
|
|
1546
1547
|
try {
|
|
1547
|
-
entry = JSON.parse(
|
|
1548
|
+
entry = JSON.parse(trimmed);
|
|
1548
1549
|
} catch {
|
|
1549
1550
|
return null;
|
|
1550
1551
|
}
|
|
1551
|
-
|
|
1552
|
+
const message = cursorEntryToMessage(entry);
|
|
1553
|
+
if (!message || message.uuid) return message;
|
|
1554
|
+
return { ...message, uuid: cursorMessageUuid(trimmed, message.role, index) };
|
|
1555
|
+
}
|
|
1556
|
+
function cursorMessageUuid(line, role, index) {
|
|
1557
|
+
const hash = (0, import_crypto.createHash)("sha1").update(line).digest("hex").slice(0, 16);
|
|
1558
|
+
return index === void 0 ? `cursor-${role}-${hash}` : `cursor-${role}-${index}-${hash}`;
|
|
1552
1559
|
}
|
|
1553
1560
|
function cursorEntryToMessage(entry) {
|
|
1554
1561
|
if (looksLikeCursorChatEntry(entry)) {
|
|
@@ -1751,7 +1758,7 @@ async function parseCursorConversation(filePath, account) {
|
|
|
1751
1758
|
const rl = (0, import_readline3.createInterface)({ input: (0, import_fs5.createReadStream)(filePath), crlfDelay: Infinity });
|
|
1752
1759
|
try {
|
|
1753
1760
|
for await (const line of rl) {
|
|
1754
|
-
const message = parseCursorJsonlLine(line);
|
|
1761
|
+
const message = parseCursorJsonlLine(line, messages.length);
|
|
1755
1762
|
if (!message) continue;
|
|
1756
1763
|
if (message.timestamp && (!latestTimestamp || message.timestamp > latestTimestamp)) {
|
|
1757
1764
|
latestTimestamp = message.timestamp;
|