chat-recall 0.7.62 → 0.7.63
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 +64 -66
- package/dist/mcp.js +64 -66
- package/dist/scan-worker.js +1 -0
- package/dist/watch.js +64 -66
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9423,7 +9423,7 @@ var init_claude2 = __esm({
|
|
|
9423
9423
|
// ../engine/dist/transcript/codex.js
|
|
9424
9424
|
import { open as open2, readdir as readdir2, stat as stat2 } from "fs/promises";
|
|
9425
9425
|
import { dirname as dirname9, join as join13, basename as basename8 } from "path";
|
|
9426
|
-
async function parseCodexSubagents(sessionPath) {
|
|
9426
|
+
async function parseCodexSubagents(sessionPath, opts = {}) {
|
|
9427
9427
|
const dayDir = dirname9(sessionPath);
|
|
9428
9428
|
const parentId = basename8(sessionPath).match(/([a-f0-9-]{36})\.jsonl$/i)?.[1];
|
|
9429
9429
|
if (!parentId)
|
|
@@ -9476,7 +9476,7 @@ async function parseCodexSubagents(sessionPath) {
|
|
|
9476
9476
|
const kind = role.includes("compact") ? "compact" : role.includes("aside") ? "aside" : role.includes("worker") || role.includes("explore") ? "explore" : "other";
|
|
9477
9477
|
let messages = [];
|
|
9478
9478
|
try {
|
|
9479
|
-
messages = await parseCodexTranscript(filePath);
|
|
9479
|
+
messages = await parseCodexTranscript(filePath, opts);
|
|
9480
9480
|
} catch (e) {
|
|
9481
9481
|
log3.error({ err: e, filePath }, "Failed to parse Codex sub-agent");
|
|
9482
9482
|
}
|
|
@@ -9518,80 +9518,77 @@ function isCodexInjectedWrapper(text) {
|
|
|
9518
9518
|
const trimmed = text.trim();
|
|
9519
9519
|
return trimmed.startsWith("<environment_context>") || trimmed.startsWith("<permissions instructions>") || trimmed.startsWith("<user_instructions>") || trimmed.startsWith("<system_prompt>");
|
|
9520
9520
|
}
|
|
9521
|
-
async function parseCodexTranscript(sessionPath) {
|
|
9522
|
-
const
|
|
9523
|
-
|
|
9521
|
+
async function parseCodexTranscript(sessionPath, opts = {}) {
|
|
9522
|
+
const fh = await open2(sessionPath);
|
|
9523
|
+
const messages = [];
|
|
9524
|
+
const add = codexLineHandler(messages, opts);
|
|
9525
|
+
try {
|
|
9526
|
+
let lineNum = 0;
|
|
9527
|
+
for await (const line of fh.readLines())
|
|
9528
|
+
add(++lineNum, line);
|
|
9529
|
+
} finally {
|
|
9530
|
+
await fh.close();
|
|
9531
|
+
}
|
|
9532
|
+
return messages;
|
|
9524
9533
|
}
|
|
9525
|
-
function parseCodexTranscriptText(text) {
|
|
9534
|
+
function parseCodexTranscriptText(text, opts = {}) {
|
|
9526
9535
|
const messages = [];
|
|
9536
|
+
const add = codexLineHandler(messages, opts);
|
|
9527
9537
|
let lineNum = 0;
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
line: lineNum,
|
|
9563
|
-
role: "assistant",
|
|
9564
|
-
content: "",
|
|
9565
|
-
thinking: summary,
|
|
9566
|
-
timestamp: obj2.timestamp
|
|
9567
|
-
});
|
|
9568
|
-
} else if (obj2.type === "response_item" && obj2.payload?.type === "function_call") {
|
|
9569
|
-
let input = obj2.payload.arguments || {};
|
|
9570
|
-
if (typeof input === "string") {
|
|
9571
|
-
try {
|
|
9572
|
-
input = JSON.parse(input);
|
|
9573
|
-
} catch {
|
|
9574
|
-
}
|
|
9538
|
+
for (const line of text.split("\n"))
|
|
9539
|
+
add(++lineNum, line);
|
|
9540
|
+
return messages;
|
|
9541
|
+
}
|
|
9542
|
+
function codexLineHandler(messages, opts) {
|
|
9543
|
+
const cap = opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v;
|
|
9544
|
+
return (lineNum, line) => {
|
|
9545
|
+
if (!line.trim())
|
|
9546
|
+
return;
|
|
9547
|
+
try {
|
|
9548
|
+
const obj2 = JSON.parse(line);
|
|
9549
|
+
if (obj2.type === "event_msg" && obj2.payload?.type === "user_message") {
|
|
9550
|
+
const text = String(obj2.payload.message || "").trim();
|
|
9551
|
+
if (!text || isCodexInjectedWrapper(text))
|
|
9552
|
+
return;
|
|
9553
|
+
messages.push({ line: lineNum, role: "user", content: text, timestamp: obj2.timestamp });
|
|
9554
|
+
} else if (obj2.type === "response_item" && obj2.payload?.type === "message") {
|
|
9555
|
+
if (obj2.payload.role !== "assistant")
|
|
9556
|
+
return;
|
|
9557
|
+
const text = flattenCodexContent(obj2.payload.content);
|
|
9558
|
+
if (!text.trim())
|
|
9559
|
+
return;
|
|
9560
|
+
messages.push({ line: lineNum, role: "assistant", content: text, timestamp: obj2.timestamp });
|
|
9561
|
+
} else if (obj2.type === "response_item" && obj2.payload?.type === "reasoning") {
|
|
9562
|
+
const summary = Array.isArray(obj2.payload.summary) ? obj2.payload.summary.map((s) => s?.text || "").filter(Boolean).join("\n") : "";
|
|
9563
|
+
if (!summary.trim())
|
|
9564
|
+
return;
|
|
9565
|
+
messages.push({ line: lineNum, role: "assistant", content: "", thinking: cap(summary), timestamp: obj2.timestamp });
|
|
9566
|
+
} else if (obj2.type === "response_item" && obj2.payload?.type === "function_call") {
|
|
9567
|
+
let input = obj2.payload.arguments || {};
|
|
9568
|
+
if (typeof input === "string") {
|
|
9569
|
+
try {
|
|
9570
|
+
input = JSON.parse(input);
|
|
9571
|
+
} catch {
|
|
9575
9572
|
}
|
|
9576
|
-
messages.push({
|
|
9577
|
-
line: lineNum,
|
|
9578
|
-
role: "assistant",
|
|
9579
|
-
content: "",
|
|
9580
|
-
toolCalls: [{ name: obj2.payload.name || "", input }],
|
|
9581
|
-
timestamp: obj2.timestamp
|
|
9582
|
-
});
|
|
9583
9573
|
}
|
|
9584
|
-
|
|
9574
|
+
messages.push({
|
|
9575
|
+
line: lineNum,
|
|
9576
|
+
role: "assistant",
|
|
9577
|
+
content: "",
|
|
9578
|
+
toolCalls: [{ name: obj2.payload.name || "", input: cap(input) }],
|
|
9579
|
+
timestamp: obj2.timestamp
|
|
9580
|
+
});
|
|
9585
9581
|
}
|
|
9582
|
+
} catch {
|
|
9586
9583
|
}
|
|
9587
|
-
}
|
|
9588
|
-
return messages;
|
|
9584
|
+
};
|
|
9589
9585
|
}
|
|
9590
9586
|
var log3;
|
|
9591
9587
|
var init_codex = __esm({
|
|
9592
9588
|
"../engine/dist/transcript/codex.js"() {
|
|
9593
9589
|
"use strict";
|
|
9594
9590
|
init_logger();
|
|
9591
|
+
init_trim();
|
|
9595
9592
|
log3 = createLogger("transcript-codex");
|
|
9596
9593
|
}
|
|
9597
9594
|
});
|
|
@@ -17214,11 +17211,12 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
17214
17211
|
const loc = getBackend("codex").findSession(sessionId);
|
|
17215
17212
|
if (!loc)
|
|
17216
17213
|
return null;
|
|
17214
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap } : {};
|
|
17217
17215
|
const [messages, subagents] = await Promise.all([
|
|
17218
|
-
parseCodexTranscript(loc.path),
|
|
17219
|
-
parseCodexSubagents(loc.path)
|
|
17216
|
+
parseCodexTranscript(loc.path, cut),
|
|
17217
|
+
parseCodexSubagents(loc.path, cut)
|
|
17220
17218
|
]);
|
|
17221
|
-
return { messages, subagents, mtime: loc.mtime || safeMtime(loc.path) };
|
|
17219
|
+
return { messages, subagents, mtime: loc.mtime || safeMtime(loc.path), ...opts.payloadCap ? { payloadCap: opts.payloadCap } : {} };
|
|
17222
17220
|
}
|
|
17223
17221
|
try {
|
|
17224
17222
|
const backend = getBackend(tool);
|
package/dist/mcp.js
CHANGED
|
@@ -13229,7 +13229,7 @@ var init_claude2 = __esm({
|
|
|
13229
13229
|
// ../engine/dist/transcript/codex.js
|
|
13230
13230
|
import { open as open2, readdir as readdir2, stat as stat2 } from "fs/promises";
|
|
13231
13231
|
import { dirname as dirname12, join as join19, basename as basename12 } from "path";
|
|
13232
|
-
async function parseCodexSubagents(sessionPath) {
|
|
13232
|
+
async function parseCodexSubagents(sessionPath, opts = {}) {
|
|
13233
13233
|
const dayDir = dirname12(sessionPath);
|
|
13234
13234
|
const parentId = basename12(sessionPath).match(/([a-f0-9-]{36})\.jsonl$/i)?.[1];
|
|
13235
13235
|
if (!parentId)
|
|
@@ -13282,7 +13282,7 @@ async function parseCodexSubagents(sessionPath) {
|
|
|
13282
13282
|
const kind = role.includes("compact") ? "compact" : role.includes("aside") ? "aside" : role.includes("worker") || role.includes("explore") ? "explore" : "other";
|
|
13283
13283
|
let messages = [];
|
|
13284
13284
|
try {
|
|
13285
|
-
messages = await parseCodexTranscript(filePath);
|
|
13285
|
+
messages = await parseCodexTranscript(filePath, opts);
|
|
13286
13286
|
} catch (e) {
|
|
13287
13287
|
log3.error({ err: e, filePath }, "Failed to parse Codex sub-agent");
|
|
13288
13288
|
}
|
|
@@ -13324,80 +13324,77 @@ function isCodexInjectedWrapper2(text) {
|
|
|
13324
13324
|
const trimmed = text.trim();
|
|
13325
13325
|
return trimmed.startsWith("<environment_context>") || trimmed.startsWith("<permissions instructions>") || trimmed.startsWith("<user_instructions>") || trimmed.startsWith("<system_prompt>");
|
|
13326
13326
|
}
|
|
13327
|
-
async function parseCodexTranscript(sessionPath) {
|
|
13328
|
-
const
|
|
13329
|
-
|
|
13327
|
+
async function parseCodexTranscript(sessionPath, opts = {}) {
|
|
13328
|
+
const fh = await open2(sessionPath);
|
|
13329
|
+
const messages = [];
|
|
13330
|
+
const add = codexLineHandler(messages, opts);
|
|
13331
|
+
try {
|
|
13332
|
+
let lineNum = 0;
|
|
13333
|
+
for await (const line of fh.readLines())
|
|
13334
|
+
add(++lineNum, line);
|
|
13335
|
+
} finally {
|
|
13336
|
+
await fh.close();
|
|
13337
|
+
}
|
|
13338
|
+
return messages;
|
|
13330
13339
|
}
|
|
13331
|
-
function parseCodexTranscriptText(text) {
|
|
13340
|
+
function parseCodexTranscriptText(text, opts = {}) {
|
|
13332
13341
|
const messages = [];
|
|
13342
|
+
const add = codexLineHandler(messages, opts);
|
|
13333
13343
|
let lineNum = 0;
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
line: lineNum,
|
|
13369
|
-
role: "assistant",
|
|
13370
|
-
content: "",
|
|
13371
|
-
thinking: summary,
|
|
13372
|
-
timestamp: obj2.timestamp
|
|
13373
|
-
});
|
|
13374
|
-
} else if (obj2.type === "response_item" && obj2.payload?.type === "function_call") {
|
|
13375
|
-
let input = obj2.payload.arguments || {};
|
|
13376
|
-
if (typeof input === "string") {
|
|
13377
|
-
try {
|
|
13378
|
-
input = JSON.parse(input);
|
|
13379
|
-
} catch {
|
|
13380
|
-
}
|
|
13344
|
+
for (const line of text.split("\n"))
|
|
13345
|
+
add(++lineNum, line);
|
|
13346
|
+
return messages;
|
|
13347
|
+
}
|
|
13348
|
+
function codexLineHandler(messages, opts) {
|
|
13349
|
+
const cap = opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v;
|
|
13350
|
+
return (lineNum, line) => {
|
|
13351
|
+
if (!line.trim())
|
|
13352
|
+
return;
|
|
13353
|
+
try {
|
|
13354
|
+
const obj2 = JSON.parse(line);
|
|
13355
|
+
if (obj2.type === "event_msg" && obj2.payload?.type === "user_message") {
|
|
13356
|
+
const text = String(obj2.payload.message || "").trim();
|
|
13357
|
+
if (!text || isCodexInjectedWrapper2(text))
|
|
13358
|
+
return;
|
|
13359
|
+
messages.push({ line: lineNum, role: "user", content: text, timestamp: obj2.timestamp });
|
|
13360
|
+
} else if (obj2.type === "response_item" && obj2.payload?.type === "message") {
|
|
13361
|
+
if (obj2.payload.role !== "assistant")
|
|
13362
|
+
return;
|
|
13363
|
+
const text = flattenCodexContent(obj2.payload.content);
|
|
13364
|
+
if (!text.trim())
|
|
13365
|
+
return;
|
|
13366
|
+
messages.push({ line: lineNum, role: "assistant", content: text, timestamp: obj2.timestamp });
|
|
13367
|
+
} else if (obj2.type === "response_item" && obj2.payload?.type === "reasoning") {
|
|
13368
|
+
const summary = Array.isArray(obj2.payload.summary) ? obj2.payload.summary.map((s) => s?.text || "").filter(Boolean).join("\n") : "";
|
|
13369
|
+
if (!summary.trim())
|
|
13370
|
+
return;
|
|
13371
|
+
messages.push({ line: lineNum, role: "assistant", content: "", thinking: cap(summary), timestamp: obj2.timestamp });
|
|
13372
|
+
} else if (obj2.type === "response_item" && obj2.payload?.type === "function_call") {
|
|
13373
|
+
let input = obj2.payload.arguments || {};
|
|
13374
|
+
if (typeof input === "string") {
|
|
13375
|
+
try {
|
|
13376
|
+
input = JSON.parse(input);
|
|
13377
|
+
} catch {
|
|
13381
13378
|
}
|
|
13382
|
-
messages.push({
|
|
13383
|
-
line: lineNum,
|
|
13384
|
-
role: "assistant",
|
|
13385
|
-
content: "",
|
|
13386
|
-
toolCalls: [{ name: obj2.payload.name || "", input }],
|
|
13387
|
-
timestamp: obj2.timestamp
|
|
13388
|
-
});
|
|
13389
13379
|
}
|
|
13390
|
-
|
|
13380
|
+
messages.push({
|
|
13381
|
+
line: lineNum,
|
|
13382
|
+
role: "assistant",
|
|
13383
|
+
content: "",
|
|
13384
|
+
toolCalls: [{ name: obj2.payload.name || "", input: cap(input) }],
|
|
13385
|
+
timestamp: obj2.timestamp
|
|
13386
|
+
});
|
|
13391
13387
|
}
|
|
13388
|
+
} catch {
|
|
13392
13389
|
}
|
|
13393
|
-
}
|
|
13394
|
-
return messages;
|
|
13390
|
+
};
|
|
13395
13391
|
}
|
|
13396
13392
|
var log3;
|
|
13397
13393
|
var init_codex2 = __esm({
|
|
13398
13394
|
"../engine/dist/transcript/codex.js"() {
|
|
13399
13395
|
"use strict";
|
|
13400
13396
|
init_logger();
|
|
13397
|
+
init_trim();
|
|
13401
13398
|
log3 = createLogger("transcript-codex");
|
|
13402
13399
|
}
|
|
13403
13400
|
});
|
|
@@ -14564,11 +14561,12 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
14564
14561
|
const loc = getBackend("codex").findSession(sessionId);
|
|
14565
14562
|
if (!loc)
|
|
14566
14563
|
return null;
|
|
14564
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap } : {};
|
|
14567
14565
|
const [messages, subagents] = await Promise.all([
|
|
14568
|
-
parseCodexTranscript(loc.path),
|
|
14569
|
-
parseCodexSubagents(loc.path)
|
|
14566
|
+
parseCodexTranscript(loc.path, cut),
|
|
14567
|
+
parseCodexSubagents(loc.path, cut)
|
|
14570
14568
|
]);
|
|
14571
|
-
return { messages, subagents, mtime: loc.mtime || safeMtime(loc.path) };
|
|
14569
|
+
return { messages, subagents, mtime: loc.mtime || safeMtime(loc.path), ...opts.payloadCap ? { payloadCap: opts.payloadCap } : {} };
|
|
14572
14570
|
}
|
|
14573
14571
|
try {
|
|
14574
14572
|
const backend = getBackend(tool);
|
package/dist/scan-worker.js
CHANGED
package/dist/watch.js
CHANGED
|
@@ -6572,7 +6572,7 @@ var init_claude = __esm({
|
|
|
6572
6572
|
// ../engine/dist/transcript/codex.js
|
|
6573
6573
|
import { open as open2, readdir as readdir2, stat as stat2 } from "fs/promises";
|
|
6574
6574
|
import { dirname as dirname6, join as join9, basename as basename4 } from "path";
|
|
6575
|
-
async function parseCodexSubagents(sessionPath) {
|
|
6575
|
+
async function parseCodexSubagents(sessionPath, opts = {}) {
|
|
6576
6576
|
const dayDir = dirname6(sessionPath);
|
|
6577
6577
|
const parentId = basename4(sessionPath).match(/([a-f0-9-]{36})\.jsonl$/i)?.[1];
|
|
6578
6578
|
if (!parentId)
|
|
@@ -6625,7 +6625,7 @@ async function parseCodexSubagents(sessionPath) {
|
|
|
6625
6625
|
const kind = role.includes("compact") ? "compact" : role.includes("aside") ? "aside" : role.includes("worker") || role.includes("explore") ? "explore" : "other";
|
|
6626
6626
|
let messages = [];
|
|
6627
6627
|
try {
|
|
6628
|
-
messages = await parseCodexTranscript(filePath);
|
|
6628
|
+
messages = await parseCodexTranscript(filePath, opts);
|
|
6629
6629
|
} catch (e) {
|
|
6630
6630
|
log3.error({ err: e, filePath }, "Failed to parse Codex sub-agent");
|
|
6631
6631
|
}
|
|
@@ -6667,80 +6667,77 @@ function isCodexInjectedWrapper(text) {
|
|
|
6667
6667
|
const trimmed = text.trim();
|
|
6668
6668
|
return trimmed.startsWith("<environment_context>") || trimmed.startsWith("<permissions instructions>") || trimmed.startsWith("<user_instructions>") || trimmed.startsWith("<system_prompt>");
|
|
6669
6669
|
}
|
|
6670
|
-
async function parseCodexTranscript(sessionPath) {
|
|
6671
|
-
const
|
|
6672
|
-
|
|
6670
|
+
async function parseCodexTranscript(sessionPath, opts = {}) {
|
|
6671
|
+
const fh = await open2(sessionPath);
|
|
6672
|
+
const messages = [];
|
|
6673
|
+
const add = codexLineHandler(messages, opts);
|
|
6674
|
+
try {
|
|
6675
|
+
let lineNum = 0;
|
|
6676
|
+
for await (const line of fh.readLines())
|
|
6677
|
+
add(++lineNum, line);
|
|
6678
|
+
} finally {
|
|
6679
|
+
await fh.close();
|
|
6680
|
+
}
|
|
6681
|
+
return messages;
|
|
6673
6682
|
}
|
|
6674
|
-
function parseCodexTranscriptText(text) {
|
|
6683
|
+
function parseCodexTranscriptText(text, opts = {}) {
|
|
6675
6684
|
const messages = [];
|
|
6685
|
+
const add = codexLineHandler(messages, opts);
|
|
6676
6686
|
let lineNum = 0;
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
line: lineNum,
|
|
6712
|
-
role: "assistant",
|
|
6713
|
-
content: "",
|
|
6714
|
-
thinking: summary,
|
|
6715
|
-
timestamp: obj.timestamp
|
|
6716
|
-
});
|
|
6717
|
-
} else if (obj.type === "response_item" && obj.payload?.type === "function_call") {
|
|
6718
|
-
let input = obj.payload.arguments || {};
|
|
6719
|
-
if (typeof input === "string") {
|
|
6720
|
-
try {
|
|
6721
|
-
input = JSON.parse(input);
|
|
6722
|
-
} catch {
|
|
6723
|
-
}
|
|
6687
|
+
for (const line of text.split("\n"))
|
|
6688
|
+
add(++lineNum, line);
|
|
6689
|
+
return messages;
|
|
6690
|
+
}
|
|
6691
|
+
function codexLineHandler(messages, opts) {
|
|
6692
|
+
const cap = opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v;
|
|
6693
|
+
return (lineNum, line) => {
|
|
6694
|
+
if (!line.trim())
|
|
6695
|
+
return;
|
|
6696
|
+
try {
|
|
6697
|
+
const obj = JSON.parse(line);
|
|
6698
|
+
if (obj.type === "event_msg" && obj.payload?.type === "user_message") {
|
|
6699
|
+
const text = String(obj.payload.message || "").trim();
|
|
6700
|
+
if (!text || isCodexInjectedWrapper(text))
|
|
6701
|
+
return;
|
|
6702
|
+
messages.push({ line: lineNum, role: "user", content: text, timestamp: obj.timestamp });
|
|
6703
|
+
} else if (obj.type === "response_item" && obj.payload?.type === "message") {
|
|
6704
|
+
if (obj.payload.role !== "assistant")
|
|
6705
|
+
return;
|
|
6706
|
+
const text = flattenCodexContent(obj.payload.content);
|
|
6707
|
+
if (!text.trim())
|
|
6708
|
+
return;
|
|
6709
|
+
messages.push({ line: lineNum, role: "assistant", content: text, timestamp: obj.timestamp });
|
|
6710
|
+
} else if (obj.type === "response_item" && obj.payload?.type === "reasoning") {
|
|
6711
|
+
const summary = Array.isArray(obj.payload.summary) ? obj.payload.summary.map((s) => s?.text || "").filter(Boolean).join("\n") : "";
|
|
6712
|
+
if (!summary.trim())
|
|
6713
|
+
return;
|
|
6714
|
+
messages.push({ line: lineNum, role: "assistant", content: "", thinking: cap(summary), timestamp: obj.timestamp });
|
|
6715
|
+
} else if (obj.type === "response_item" && obj.payload?.type === "function_call") {
|
|
6716
|
+
let input = obj.payload.arguments || {};
|
|
6717
|
+
if (typeof input === "string") {
|
|
6718
|
+
try {
|
|
6719
|
+
input = JSON.parse(input);
|
|
6720
|
+
} catch {
|
|
6724
6721
|
}
|
|
6725
|
-
messages.push({
|
|
6726
|
-
line: lineNum,
|
|
6727
|
-
role: "assistant",
|
|
6728
|
-
content: "",
|
|
6729
|
-
toolCalls: [{ name: obj.payload.name || "", input }],
|
|
6730
|
-
timestamp: obj.timestamp
|
|
6731
|
-
});
|
|
6732
6722
|
}
|
|
6733
|
-
|
|
6723
|
+
messages.push({
|
|
6724
|
+
line: lineNum,
|
|
6725
|
+
role: "assistant",
|
|
6726
|
+
content: "",
|
|
6727
|
+
toolCalls: [{ name: obj.payload.name || "", input: cap(input) }],
|
|
6728
|
+
timestamp: obj.timestamp
|
|
6729
|
+
});
|
|
6734
6730
|
}
|
|
6731
|
+
} catch {
|
|
6735
6732
|
}
|
|
6736
|
-
}
|
|
6737
|
-
return messages;
|
|
6733
|
+
};
|
|
6738
6734
|
}
|
|
6739
6735
|
var log3;
|
|
6740
6736
|
var init_codex = __esm({
|
|
6741
6737
|
"../engine/dist/transcript/codex.js"() {
|
|
6742
6738
|
"use strict";
|
|
6743
6739
|
init_logger();
|
|
6740
|
+
init_trim();
|
|
6744
6741
|
log3 = createLogger("transcript-codex");
|
|
6745
6742
|
}
|
|
6746
6743
|
});
|
|
@@ -16297,11 +16294,12 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
16297
16294
|
const loc = getBackend("codex").findSession(sessionId);
|
|
16298
16295
|
if (!loc)
|
|
16299
16296
|
return null;
|
|
16297
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap } : {};
|
|
16300
16298
|
const [messages, subagents] = await Promise.all([
|
|
16301
|
-
parseCodexTranscript(loc.path),
|
|
16302
|
-
parseCodexSubagents(loc.path)
|
|
16299
|
+
parseCodexTranscript(loc.path, cut),
|
|
16300
|
+
parseCodexSubagents(loc.path, cut)
|
|
16303
16301
|
]);
|
|
16304
|
-
return { messages, subagents, mtime: loc.mtime || safeMtime(loc.path) };
|
|
16302
|
+
return { messages, subagents, mtime: loc.mtime || safeMtime(loc.path), ...opts.payloadCap ? { payloadCap: opts.payloadCap } : {} };
|
|
16305
16303
|
}
|
|
16306
16304
|
try {
|
|
16307
16305
|
const backend = getBackend(tool);
|