@threadbase-sh/scanner 0.14.7 → 0.15.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 +16 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +27 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +26 -8
- package/dist/index.js.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.15.0";
|
|
9
9
|
|
|
10
10
|
// src/logger.ts
|
|
11
11
|
import pino from "pino";
|
|
@@ -1309,6 +1309,16 @@ function extractCodexText(content) {
|
|
|
1309
1309
|
return "";
|
|
1310
1310
|
}).filter(Boolean).map(cleanSystemTags).join(" ");
|
|
1311
1311
|
}
|
|
1312
|
+
function codexEntryToMessage(entry) {
|
|
1313
|
+
const payload = entry.payload;
|
|
1314
|
+
if (!payload || typeof payload !== "object") return null;
|
|
1315
|
+
if (entry.type !== "response_item" || payload.type !== "message") return null;
|
|
1316
|
+
const role = payload.role;
|
|
1317
|
+
if (role !== "user" && role !== "assistant") return null;
|
|
1318
|
+
const text = extractCodexText(payload.content);
|
|
1319
|
+
if (!text) return null;
|
|
1320
|
+
return { role, text, timestamp: asString(entry.timestamp) };
|
|
1321
|
+
}
|
|
1312
1322
|
function reduceCodexEntry(acc, entry, tier) {
|
|
1313
1323
|
const ts = asString(entry.timestamp);
|
|
1314
1324
|
if (ts && (!acc.latestTimestamp || ts > acc.latestTimestamp)) acc.latestTimestamp = ts;
|
|
@@ -1419,14 +1429,11 @@ async function parseCodexConversation(filePath, account) {
|
|
|
1419
1429
|
if (!cwd) cwd = asString(payload.cwd);
|
|
1420
1430
|
continue;
|
|
1421
1431
|
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
if (
|
|
1427
|
-
messages.push({ role, text, timestamp: ts });
|
|
1428
|
-
textParts.push(text);
|
|
1429
|
-
if (role === "user") lastUserText = text;
|
|
1432
|
+
const message = codexEntryToMessage(entry);
|
|
1433
|
+
if (!message) continue;
|
|
1434
|
+
messages.push(message);
|
|
1435
|
+
textParts.push(message.text);
|
|
1436
|
+
if (message.role === "user") lastUserText = message.text;
|
|
1430
1437
|
}
|
|
1431
1438
|
} catch (err) {
|
|
1432
1439
|
log.warn({ filePath, err }, "parseCodexConversation: read failed");
|