chat-recall 0.7.72 → 0.7.73
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 +22 -13
- package/dist/mcp.js +19 -13
- package/dist/scan-worker.js +2 -1
- package/dist/watch.js +22 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9215,10 +9215,13 @@ function capPayload(v, capChars = SYNC_PAYLOAD_CAP) {
|
|
|
9215
9215
|
}
|
|
9216
9216
|
return v;
|
|
9217
9217
|
}
|
|
9218
|
-
var SYNC_PAYLOAD_BUDGET, SYNC_PAYLOAD_CAP_TIGHT, SYNC_PAYLOAD_CAP;
|
|
9218
|
+
var SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT, SYNC_PAYLOAD_BUDGET, SYNC_PAYLOAD_CAP_TIGHT, SYNC_PAYLOAD_CAP;
|
|
9219
9219
|
var init_trim = __esm({
|
|
9220
9220
|
"../engine/dist/transcript/trim.js"() {
|
|
9221
9221
|
"use strict";
|
|
9222
|
+
SYNC_TEXT_CAP = 2e5;
|
|
9223
|
+
SYNC_TEXT_BUDGET = 96 * 1024 * 1024;
|
|
9224
|
+
SYNC_TEXT_CAP_TIGHT = 2e3;
|
|
9222
9225
|
SYNC_PAYLOAD_BUDGET = 48 * 1024 * 1024;
|
|
9223
9226
|
SYNC_PAYLOAD_CAP_TIGHT = 200;
|
|
9224
9227
|
SYNC_PAYLOAD_CAP = 2e3;
|
|
@@ -9238,7 +9241,7 @@ async function parseClaudeTranscript(sessionPath, opts = {}) {
|
|
|
9238
9241
|
return parseMessagesFromFile(sessionPath, opts);
|
|
9239
9242
|
}
|
|
9240
9243
|
function parseClaudeTranscriptText(text, opts = {}) {
|
|
9241
|
-
const builder = new MessageBuilder(opts.payloadCap, opts.cut);
|
|
9244
|
+
const builder = new MessageBuilder(opts.payloadCap, opts.cut, opts.cutText);
|
|
9242
9245
|
let lineNumber = 0;
|
|
9243
9246
|
for (const line of text.split("\n")) {
|
|
9244
9247
|
lineNumber++;
|
|
@@ -9256,7 +9259,7 @@ function parseClaudeTranscriptText(text, opts = {}) {
|
|
|
9256
9259
|
}
|
|
9257
9260
|
async function parseMessagesFromFile(sessionPath, opts) {
|
|
9258
9261
|
const file = await open(sessionPath);
|
|
9259
|
-
const builder = new MessageBuilder(opts.payloadCap, opts.cut);
|
|
9262
|
+
const builder = new MessageBuilder(opts.payloadCap, opts.cut, opts.cutText);
|
|
9260
9263
|
try {
|
|
9261
9264
|
let lineNumber = 0;
|
|
9262
9265
|
for await (const line of file.readLines()) {
|
|
@@ -9361,8 +9364,10 @@ var init_claude2 = __esm({
|
|
|
9361
9364
|
calls = /* @__PURE__ */ new Map();
|
|
9362
9365
|
/** The last result of each tool_use id. */
|
|
9363
9366
|
results = /* @__PURE__ */ new Map();
|
|
9364
|
-
|
|
9367
|
+
cutText;
|
|
9368
|
+
constructor(payloadCap, cut, cutText) {
|
|
9365
9369
|
this.cap = cut ?? (payloadCap ? (v) => capPayload(v, payloadCap) : (v) => v);
|
|
9370
|
+
this.cutText = cutText ? (v) => cutText(v) : (v) => v;
|
|
9366
9371
|
}
|
|
9367
9372
|
add(line, obj2) {
|
|
9368
9373
|
if (!obj2 || typeof obj2 !== "object")
|
|
@@ -9389,7 +9394,7 @@ var init_claude2 = __esm({
|
|
|
9389
9394
|
if (!cleaned)
|
|
9390
9395
|
return;
|
|
9391
9396
|
const origin = userRecordOrigin(obj2, cleaned);
|
|
9392
|
-
this.messages.push({ line, role: "user", content: cleaned, timestamp, ...origin === "human" ? {} : { origin } });
|
|
9397
|
+
this.messages.push({ line, role: "user", content: this.cutText(cleaned), timestamp, ...origin === "human" ? {} : { origin } });
|
|
9393
9398
|
} else if (obj2.type === "attachment") {
|
|
9394
9399
|
const queued = queuedCommandPrompt(obj2);
|
|
9395
9400
|
if (!queued)
|
|
@@ -9397,7 +9402,7 @@ var init_claude2 = __esm({
|
|
|
9397
9402
|
const cleaned = stripBanners2(queued.text);
|
|
9398
9403
|
if (!cleaned)
|
|
9399
9404
|
return;
|
|
9400
|
-
this.messages.push({ line, role: "user", content: cleaned, timestamp, ...queued.origin === "human" ? {} : { origin: queued.origin } });
|
|
9405
|
+
this.messages.push({ line, role: "user", content: this.cutText(cleaned), timestamp, ...queued.origin === "human" ? {} : { origin: queued.origin } });
|
|
9401
9406
|
} else if (obj2.type === "assistant") {
|
|
9402
9407
|
const blocks = Array.isArray(obj2.message?.content) ? obj2.message.content : [];
|
|
9403
9408
|
const thinkingBlock = blocks.find((c) => c?.type === "thinking");
|
|
@@ -9428,7 +9433,7 @@ var init_claude2 = __esm({
|
|
|
9428
9433
|
this.messages.push({
|
|
9429
9434
|
line,
|
|
9430
9435
|
role: "assistant",
|
|
9431
|
-
content: text,
|
|
9436
|
+
content: this.cutText(text),
|
|
9432
9437
|
thinking,
|
|
9433
9438
|
toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
9434
9439
|
timestamp
|
|
@@ -9576,6 +9581,7 @@ function parseCodexTranscriptText(text, opts = {}) {
|
|
|
9576
9581
|
}
|
|
9577
9582
|
function codexLineHandler(messages, opts) {
|
|
9578
9583
|
const cap = opts.cut ?? (opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v);
|
|
9584
|
+
const cutText = (v) => opts.cutText ? opts.cutText(v) : v;
|
|
9579
9585
|
return (lineNum, line) => {
|
|
9580
9586
|
if (!line.trim())
|
|
9581
9587
|
return;
|
|
@@ -9585,14 +9591,14 @@ function codexLineHandler(messages, opts) {
|
|
|
9585
9591
|
const text = String(obj2.payload.message || "").trim();
|
|
9586
9592
|
if (!text || isCodexInjectedWrapper(text))
|
|
9587
9593
|
return;
|
|
9588
|
-
messages.push({ line: lineNum, role: "user", content: text, timestamp: obj2.timestamp });
|
|
9594
|
+
messages.push({ line: lineNum, role: "user", content: cutText(text), timestamp: obj2.timestamp });
|
|
9589
9595
|
} else if (obj2.type === "response_item" && obj2.payload?.type === "message") {
|
|
9590
9596
|
if (obj2.payload.role !== "assistant")
|
|
9591
9597
|
return;
|
|
9592
9598
|
const text = flattenCodexContent(obj2.payload.content);
|
|
9593
9599
|
if (!text.trim())
|
|
9594
9600
|
return;
|
|
9595
|
-
messages.push({ line: lineNum, role: "assistant", content: text, timestamp: obj2.timestamp });
|
|
9601
|
+
messages.push({ line: lineNum, role: "assistant", content: cutText(text), timestamp: obj2.timestamp });
|
|
9596
9602
|
} else if (obj2.type === "response_item" && obj2.payload?.type === "reasoning") {
|
|
9597
9603
|
const summary = Array.isArray(obj2.payload.summary) ? obj2.payload.summary.map((s) => s?.text || "").filter(Boolean).join("\n") : "";
|
|
9598
9604
|
if (!summary.trim())
|
|
@@ -17131,7 +17137,7 @@ async function parseOpenCodeTranscript(sessionId, opts = {}) {
|
|
|
17131
17137
|
const role = lastRole;
|
|
17132
17138
|
if (partData.type === "text" && partData.text?.trim()) {
|
|
17133
17139
|
lineNum++;
|
|
17134
|
-
messages.push({ line: lineNum, role, content: partData.text });
|
|
17140
|
+
messages.push({ line: lineNum, role, content: opts.cutText ? opts.cutText(partData.text) : partData.text });
|
|
17135
17141
|
} else if (partData.type === "tool" && partData.tool) {
|
|
17136
17142
|
lineNum++;
|
|
17137
17143
|
messages.push({
|
|
@@ -17167,6 +17173,9 @@ __export(transcript_exports, {
|
|
|
17167
17173
|
SYNC_PAYLOAD_BUDGET: () => SYNC_PAYLOAD_BUDGET,
|
|
17168
17174
|
SYNC_PAYLOAD_CAP: () => SYNC_PAYLOAD_CAP,
|
|
17169
17175
|
SYNC_PAYLOAD_CAP_TIGHT: () => SYNC_PAYLOAD_CAP_TIGHT,
|
|
17176
|
+
SYNC_TEXT_BUDGET: () => SYNC_TEXT_BUDGET,
|
|
17177
|
+
SYNC_TEXT_CAP: () => SYNC_TEXT_CAP,
|
|
17178
|
+
SYNC_TEXT_CAP_TIGHT: () => SYNC_TEXT_CAP_TIGHT,
|
|
17170
17179
|
TRANSCRIPT_VERSION: () => TRANSCRIPT_VERSION,
|
|
17171
17180
|
archiveRawSession: () => archiveRawSession,
|
|
17172
17181
|
budgetedCut: () => budgetedCut,
|
|
@@ -17225,7 +17234,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
17225
17234
|
return null;
|
|
17226
17235
|
const primaryPath = mainGroup.paths[0];
|
|
17227
17236
|
const merged = readSessionGroupText(mainGroup);
|
|
17228
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
17237
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget), cutText: budgetedCut(SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT) } : {};
|
|
17229
17238
|
const [tail, allSubagents] = await Promise.all([
|
|
17230
17239
|
Promise.resolve(parseClaudeTranscriptText(merged.text, cut)),
|
|
17231
17240
|
parseClaudeSubagents(primaryPath, cut)
|
|
@@ -17248,7 +17257,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
17248
17257
|
return { messages, subagents, mtime: merged.mtime || safeMtime(primaryPath), ...opts.payloadCap ? { payloadCap: opts.payloadCap } : {} };
|
|
17249
17258
|
}
|
|
17250
17259
|
if (tool === "opencode") {
|
|
17251
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
17260
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget), cutText: budgetedCut(SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT) } : {};
|
|
17252
17261
|
const messages = await parseOpenCodeTranscript(sessionId, cut);
|
|
17253
17262
|
if (messages.length === 0)
|
|
17254
17263
|
return null;
|
|
@@ -17260,7 +17269,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
17260
17269
|
const loc = getBackend("codex").findSession(sessionId);
|
|
17261
17270
|
if (!loc)
|
|
17262
17271
|
return null;
|
|
17263
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
17272
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget), cutText: budgetedCut(SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT) } : {};
|
|
17264
17273
|
const [messages, subagents] = await Promise.all([
|
|
17265
17274
|
parseCodexTranscript(loc.path, cut),
|
|
17266
17275
|
parseCodexSubagents(loc.path, cut)
|
package/dist/mcp.js
CHANGED
|
@@ -13010,10 +13010,13 @@ function capPayload(v, capChars = SYNC_PAYLOAD_CAP) {
|
|
|
13010
13010
|
}
|
|
13011
13011
|
return v;
|
|
13012
13012
|
}
|
|
13013
|
-
var SYNC_PAYLOAD_BUDGET, SYNC_PAYLOAD_CAP_TIGHT, SYNC_PAYLOAD_CAP;
|
|
13013
|
+
var SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT, SYNC_PAYLOAD_BUDGET, SYNC_PAYLOAD_CAP_TIGHT, SYNC_PAYLOAD_CAP;
|
|
13014
13014
|
var init_trim = __esm({
|
|
13015
13015
|
"../engine/dist/transcript/trim.js"() {
|
|
13016
13016
|
"use strict";
|
|
13017
|
+
SYNC_TEXT_CAP = 2e5;
|
|
13018
|
+
SYNC_TEXT_BUDGET = 96 * 1024 * 1024;
|
|
13019
|
+
SYNC_TEXT_CAP_TIGHT = 2e3;
|
|
13017
13020
|
SYNC_PAYLOAD_BUDGET = 48 * 1024 * 1024;
|
|
13018
13021
|
SYNC_PAYLOAD_CAP_TIGHT = 200;
|
|
13019
13022
|
SYNC_PAYLOAD_CAP = 2e3;
|
|
@@ -13030,7 +13033,7 @@ function stripBanners2(text) {
|
|
|
13030
13033
|
return out.replace(/[ \t]{2,}/g, " ").trim();
|
|
13031
13034
|
}
|
|
13032
13035
|
function parseClaudeTranscriptText(text, opts = {}) {
|
|
13033
|
-
const builder = new MessageBuilder(opts.payloadCap, opts.cut);
|
|
13036
|
+
const builder = new MessageBuilder(opts.payloadCap, opts.cut, opts.cutText);
|
|
13034
13037
|
let lineNumber = 0;
|
|
13035
13038
|
for (const line of text.split("\n")) {
|
|
13036
13039
|
lineNumber++;
|
|
@@ -13048,7 +13051,7 @@ function parseClaudeTranscriptText(text, opts = {}) {
|
|
|
13048
13051
|
}
|
|
13049
13052
|
async function parseMessagesFromFile(sessionPath, opts) {
|
|
13050
13053
|
const file = await open(sessionPath);
|
|
13051
|
-
const builder = new MessageBuilder(opts.payloadCap, opts.cut);
|
|
13054
|
+
const builder = new MessageBuilder(opts.payloadCap, opts.cut, opts.cutText);
|
|
13052
13055
|
try {
|
|
13053
13056
|
let lineNumber = 0;
|
|
13054
13057
|
for await (const line of file.readLines()) {
|
|
@@ -13153,8 +13156,10 @@ var init_claude2 = __esm({
|
|
|
13153
13156
|
calls = /* @__PURE__ */ new Map();
|
|
13154
13157
|
/** The last result of each tool_use id. */
|
|
13155
13158
|
results = /* @__PURE__ */ new Map();
|
|
13156
|
-
|
|
13159
|
+
cutText;
|
|
13160
|
+
constructor(payloadCap, cut, cutText) {
|
|
13157
13161
|
this.cap = cut ?? (payloadCap ? (v) => capPayload(v, payloadCap) : (v) => v);
|
|
13162
|
+
this.cutText = cutText ? (v) => cutText(v) : (v) => v;
|
|
13158
13163
|
}
|
|
13159
13164
|
add(line, obj2) {
|
|
13160
13165
|
if (!obj2 || typeof obj2 !== "object")
|
|
@@ -13181,7 +13186,7 @@ var init_claude2 = __esm({
|
|
|
13181
13186
|
if (!cleaned)
|
|
13182
13187
|
return;
|
|
13183
13188
|
const origin = userRecordOrigin(obj2, cleaned);
|
|
13184
|
-
this.messages.push({ line, role: "user", content: cleaned, timestamp, ...origin === "human" ? {} : { origin } });
|
|
13189
|
+
this.messages.push({ line, role: "user", content: this.cutText(cleaned), timestamp, ...origin === "human" ? {} : { origin } });
|
|
13185
13190
|
} else if (obj2.type === "attachment") {
|
|
13186
13191
|
const queued = queuedCommandPrompt(obj2);
|
|
13187
13192
|
if (!queued)
|
|
@@ -13189,7 +13194,7 @@ var init_claude2 = __esm({
|
|
|
13189
13194
|
const cleaned = stripBanners2(queued.text);
|
|
13190
13195
|
if (!cleaned)
|
|
13191
13196
|
return;
|
|
13192
|
-
this.messages.push({ line, role: "user", content: cleaned, timestamp, ...queued.origin === "human" ? {} : { origin: queued.origin } });
|
|
13197
|
+
this.messages.push({ line, role: "user", content: this.cutText(cleaned), timestamp, ...queued.origin === "human" ? {} : { origin: queued.origin } });
|
|
13193
13198
|
} else if (obj2.type === "assistant") {
|
|
13194
13199
|
const blocks = Array.isArray(obj2.message?.content) ? obj2.message.content : [];
|
|
13195
13200
|
const thinkingBlock = blocks.find((c) => c?.type === "thinking");
|
|
@@ -13220,7 +13225,7 @@ var init_claude2 = __esm({
|
|
|
13220
13225
|
this.messages.push({
|
|
13221
13226
|
line,
|
|
13222
13227
|
role: "assistant",
|
|
13223
|
-
content: text,
|
|
13228
|
+
content: this.cutText(text),
|
|
13224
13229
|
thinking,
|
|
13225
13230
|
toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
13226
13231
|
timestamp
|
|
@@ -13368,6 +13373,7 @@ function parseCodexTranscriptText(text, opts = {}) {
|
|
|
13368
13373
|
}
|
|
13369
13374
|
function codexLineHandler(messages, opts) {
|
|
13370
13375
|
const cap = opts.cut ?? (opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v);
|
|
13376
|
+
const cutText = (v) => opts.cutText ? opts.cutText(v) : v;
|
|
13371
13377
|
return (lineNum, line) => {
|
|
13372
13378
|
if (!line.trim())
|
|
13373
13379
|
return;
|
|
@@ -13377,14 +13383,14 @@ function codexLineHandler(messages, opts) {
|
|
|
13377
13383
|
const text = String(obj2.payload.message || "").trim();
|
|
13378
13384
|
if (!text || isCodexInjectedWrapper2(text))
|
|
13379
13385
|
return;
|
|
13380
|
-
messages.push({ line: lineNum, role: "user", content: text, timestamp: obj2.timestamp });
|
|
13386
|
+
messages.push({ line: lineNum, role: "user", content: cutText(text), timestamp: obj2.timestamp });
|
|
13381
13387
|
} else if (obj2.type === "response_item" && obj2.payload?.type === "message") {
|
|
13382
13388
|
if (obj2.payload.role !== "assistant")
|
|
13383
13389
|
return;
|
|
13384
13390
|
const text = flattenCodexContent(obj2.payload.content);
|
|
13385
13391
|
if (!text.trim())
|
|
13386
13392
|
return;
|
|
13387
|
-
messages.push({ line: lineNum, role: "assistant", content: text, timestamp: obj2.timestamp });
|
|
13393
|
+
messages.push({ line: lineNum, role: "assistant", content: cutText(text), timestamp: obj2.timestamp });
|
|
13388
13394
|
} else if (obj2.type === "response_item" && obj2.payload?.type === "reasoning") {
|
|
13389
13395
|
const summary = Array.isArray(obj2.payload.summary) ? obj2.payload.summary.map((s) => s?.text || "").filter(Boolean).join("\n") : "";
|
|
13390
13396
|
if (!summary.trim())
|
|
@@ -14498,7 +14504,7 @@ async function parseOpenCodeTranscript(sessionId, opts = {}) {
|
|
|
14498
14504
|
const role = lastRole;
|
|
14499
14505
|
if (partData.type === "text" && partData.text?.trim()) {
|
|
14500
14506
|
lineNum++;
|
|
14501
|
-
messages.push({ line: lineNum, role, content: partData.text });
|
|
14507
|
+
messages.push({ line: lineNum, role, content: opts.cutText ? opts.cutText(partData.text) : partData.text });
|
|
14502
14508
|
} else if (partData.type === "tool" && partData.tool) {
|
|
14503
14509
|
lineNum++;
|
|
14504
14510
|
messages.push({
|
|
@@ -14547,7 +14553,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
14547
14553
|
return null;
|
|
14548
14554
|
const primaryPath = mainGroup.paths[0];
|
|
14549
14555
|
const merged = readSessionGroupText(mainGroup);
|
|
14550
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
14556
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget), cutText: budgetedCut(SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT) } : {};
|
|
14551
14557
|
const [tail, allSubagents] = await Promise.all([
|
|
14552
14558
|
Promise.resolve(parseClaudeTranscriptText(merged.text, cut)),
|
|
14553
14559
|
parseClaudeSubagents(primaryPath, cut)
|
|
@@ -14570,7 +14576,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
14570
14576
|
return { messages, subagents, mtime: merged.mtime || safeMtime(primaryPath), ...opts.payloadCap ? { payloadCap: opts.payloadCap } : {} };
|
|
14571
14577
|
}
|
|
14572
14578
|
if (tool === "opencode") {
|
|
14573
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
14579
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget), cutText: budgetedCut(SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT) } : {};
|
|
14574
14580
|
const messages = await parseOpenCodeTranscript(sessionId, cut);
|
|
14575
14581
|
if (messages.length === 0)
|
|
14576
14582
|
return null;
|
|
@@ -14582,7 +14588,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
14582
14588
|
const loc = getBackend("codex").findSession(sessionId);
|
|
14583
14589
|
if (!loc)
|
|
14584
14590
|
return null;
|
|
14585
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
14591
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget), cutText: budgetedCut(SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT) } : {};
|
|
14586
14592
|
const [messages, subagents] = await Promise.all([
|
|
14587
14593
|
parseCodexTranscript(loc.path, cut),
|
|
14588
14594
|
parseCodexSubagents(loc.path, cut)
|
package/dist/scan-worker.js
CHANGED
|
@@ -5353,10 +5353,11 @@ var init_claude_prompt_origin = __esm({
|
|
|
5353
5353
|
});
|
|
5354
5354
|
|
|
5355
5355
|
// ../engine/dist/transcript/trim.js
|
|
5356
|
-
var SYNC_PAYLOAD_BUDGET;
|
|
5356
|
+
var SYNC_TEXT_BUDGET, SYNC_PAYLOAD_BUDGET;
|
|
5357
5357
|
var init_trim = __esm({
|
|
5358
5358
|
"../engine/dist/transcript/trim.js"() {
|
|
5359
5359
|
"use strict";
|
|
5360
|
+
SYNC_TEXT_BUDGET = 96 * 1024 * 1024;
|
|
5360
5361
|
SYNC_PAYLOAD_BUDGET = 48 * 1024 * 1024;
|
|
5361
5362
|
}
|
|
5362
5363
|
});
|
package/dist/watch.js
CHANGED
|
@@ -6350,10 +6350,13 @@ function capPayload(v, capChars = SYNC_PAYLOAD_CAP) {
|
|
|
6350
6350
|
}
|
|
6351
6351
|
return v;
|
|
6352
6352
|
}
|
|
6353
|
-
var SYNC_PAYLOAD_BUDGET, SYNC_PAYLOAD_CAP_TIGHT, SYNC_PAYLOAD_CAP;
|
|
6353
|
+
var SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT, SYNC_PAYLOAD_BUDGET, SYNC_PAYLOAD_CAP_TIGHT, SYNC_PAYLOAD_CAP;
|
|
6354
6354
|
var init_trim = __esm({
|
|
6355
6355
|
"../engine/dist/transcript/trim.js"() {
|
|
6356
6356
|
"use strict";
|
|
6357
|
+
SYNC_TEXT_CAP = 2e5;
|
|
6358
|
+
SYNC_TEXT_BUDGET = 96 * 1024 * 1024;
|
|
6359
|
+
SYNC_TEXT_CAP_TIGHT = 2e3;
|
|
6357
6360
|
SYNC_PAYLOAD_BUDGET = 48 * 1024 * 1024;
|
|
6358
6361
|
SYNC_PAYLOAD_CAP_TIGHT = 200;
|
|
6359
6362
|
SYNC_PAYLOAD_CAP = 2e3;
|
|
@@ -6373,7 +6376,7 @@ async function parseClaudeTranscript(sessionPath, opts = {}) {
|
|
|
6373
6376
|
return parseMessagesFromFile(sessionPath, opts);
|
|
6374
6377
|
}
|
|
6375
6378
|
function parseClaudeTranscriptText(text, opts = {}) {
|
|
6376
|
-
const builder = new MessageBuilder(opts.payloadCap, opts.cut);
|
|
6379
|
+
const builder = new MessageBuilder(opts.payloadCap, opts.cut, opts.cutText);
|
|
6377
6380
|
let lineNumber = 0;
|
|
6378
6381
|
for (const line of text.split("\n")) {
|
|
6379
6382
|
lineNumber++;
|
|
@@ -6391,7 +6394,7 @@ function parseClaudeTranscriptText(text, opts = {}) {
|
|
|
6391
6394
|
}
|
|
6392
6395
|
async function parseMessagesFromFile(sessionPath, opts) {
|
|
6393
6396
|
const file = await open(sessionPath);
|
|
6394
|
-
const builder = new MessageBuilder(opts.payloadCap, opts.cut);
|
|
6397
|
+
const builder = new MessageBuilder(opts.payloadCap, opts.cut, opts.cutText);
|
|
6395
6398
|
try {
|
|
6396
6399
|
let lineNumber = 0;
|
|
6397
6400
|
for await (const line of file.readLines()) {
|
|
@@ -6496,8 +6499,10 @@ var init_claude = __esm({
|
|
|
6496
6499
|
calls = /* @__PURE__ */ new Map();
|
|
6497
6500
|
/** The last result of each tool_use id. */
|
|
6498
6501
|
results = /* @__PURE__ */ new Map();
|
|
6499
|
-
|
|
6502
|
+
cutText;
|
|
6503
|
+
constructor(payloadCap, cut, cutText) {
|
|
6500
6504
|
this.cap = cut ?? (payloadCap ? (v) => capPayload(v, payloadCap) : (v) => v);
|
|
6505
|
+
this.cutText = cutText ? (v) => cutText(v) : (v) => v;
|
|
6501
6506
|
}
|
|
6502
6507
|
add(line, obj) {
|
|
6503
6508
|
if (!obj || typeof obj !== "object")
|
|
@@ -6524,7 +6529,7 @@ var init_claude = __esm({
|
|
|
6524
6529
|
if (!cleaned)
|
|
6525
6530
|
return;
|
|
6526
6531
|
const origin = userRecordOrigin(obj, cleaned);
|
|
6527
|
-
this.messages.push({ line, role: "user", content: cleaned, timestamp, ...origin === "human" ? {} : { origin } });
|
|
6532
|
+
this.messages.push({ line, role: "user", content: this.cutText(cleaned), timestamp, ...origin === "human" ? {} : { origin } });
|
|
6528
6533
|
} else if (obj.type === "attachment") {
|
|
6529
6534
|
const queued = queuedCommandPrompt(obj);
|
|
6530
6535
|
if (!queued)
|
|
@@ -6532,7 +6537,7 @@ var init_claude = __esm({
|
|
|
6532
6537
|
const cleaned = stripBanners(queued.text);
|
|
6533
6538
|
if (!cleaned)
|
|
6534
6539
|
return;
|
|
6535
|
-
this.messages.push({ line, role: "user", content: cleaned, timestamp, ...queued.origin === "human" ? {} : { origin: queued.origin } });
|
|
6540
|
+
this.messages.push({ line, role: "user", content: this.cutText(cleaned), timestamp, ...queued.origin === "human" ? {} : { origin: queued.origin } });
|
|
6536
6541
|
} else if (obj.type === "assistant") {
|
|
6537
6542
|
const blocks = Array.isArray(obj.message?.content) ? obj.message.content : [];
|
|
6538
6543
|
const thinkingBlock = blocks.find((c) => c?.type === "thinking");
|
|
@@ -6563,7 +6568,7 @@ var init_claude = __esm({
|
|
|
6563
6568
|
this.messages.push({
|
|
6564
6569
|
line,
|
|
6565
6570
|
role: "assistant",
|
|
6566
|
-
content: text,
|
|
6571
|
+
content: this.cutText(text),
|
|
6567
6572
|
thinking,
|
|
6568
6573
|
toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
6569
6574
|
timestamp
|
|
@@ -6711,6 +6716,7 @@ function parseCodexTranscriptText(text, opts = {}) {
|
|
|
6711
6716
|
}
|
|
6712
6717
|
function codexLineHandler(messages, opts) {
|
|
6713
6718
|
const cap = opts.cut ?? (opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v);
|
|
6719
|
+
const cutText = (v) => opts.cutText ? opts.cutText(v) : v;
|
|
6714
6720
|
return (lineNum, line) => {
|
|
6715
6721
|
if (!line.trim())
|
|
6716
6722
|
return;
|
|
@@ -6720,14 +6726,14 @@ function codexLineHandler(messages, opts) {
|
|
|
6720
6726
|
const text = String(obj.payload.message || "").trim();
|
|
6721
6727
|
if (!text || isCodexInjectedWrapper(text))
|
|
6722
6728
|
return;
|
|
6723
|
-
messages.push({ line: lineNum, role: "user", content: text, timestamp: obj.timestamp });
|
|
6729
|
+
messages.push({ line: lineNum, role: "user", content: cutText(text), timestamp: obj.timestamp });
|
|
6724
6730
|
} else if (obj.type === "response_item" && obj.payload?.type === "message") {
|
|
6725
6731
|
if (obj.payload.role !== "assistant")
|
|
6726
6732
|
return;
|
|
6727
6733
|
const text = flattenCodexContent(obj.payload.content);
|
|
6728
6734
|
if (!text.trim())
|
|
6729
6735
|
return;
|
|
6730
|
-
messages.push({ line: lineNum, role: "assistant", content: text, timestamp: obj.timestamp });
|
|
6736
|
+
messages.push({ line: lineNum, role: "assistant", content: cutText(text), timestamp: obj.timestamp });
|
|
6731
6737
|
} else if (obj.type === "response_item" && obj.payload?.type === "reasoning") {
|
|
6732
6738
|
const summary = Array.isArray(obj.payload.summary) ? obj.payload.summary.map((s) => s?.text || "").filter(Boolean).join("\n") : "";
|
|
6733
6739
|
if (!summary.trim())
|
|
@@ -16214,7 +16220,7 @@ async function parseOpenCodeTranscript(sessionId, opts = {}) {
|
|
|
16214
16220
|
const role = lastRole;
|
|
16215
16221
|
if (partData.type === "text" && partData.text?.trim()) {
|
|
16216
16222
|
lineNum++;
|
|
16217
|
-
messages.push({ line: lineNum, role, content: partData.text });
|
|
16223
|
+
messages.push({ line: lineNum, role, content: opts.cutText ? opts.cutText(partData.text) : partData.text });
|
|
16218
16224
|
} else if (partData.type === "tool" && partData.tool) {
|
|
16219
16225
|
lineNum++;
|
|
16220
16226
|
messages.push({
|
|
@@ -16250,6 +16256,9 @@ __export(transcript_exports, {
|
|
|
16250
16256
|
SYNC_PAYLOAD_BUDGET: () => SYNC_PAYLOAD_BUDGET,
|
|
16251
16257
|
SYNC_PAYLOAD_CAP: () => SYNC_PAYLOAD_CAP,
|
|
16252
16258
|
SYNC_PAYLOAD_CAP_TIGHT: () => SYNC_PAYLOAD_CAP_TIGHT,
|
|
16259
|
+
SYNC_TEXT_BUDGET: () => SYNC_TEXT_BUDGET,
|
|
16260
|
+
SYNC_TEXT_CAP: () => SYNC_TEXT_CAP,
|
|
16261
|
+
SYNC_TEXT_CAP_TIGHT: () => SYNC_TEXT_CAP_TIGHT,
|
|
16253
16262
|
TRANSCRIPT_VERSION: () => TRANSCRIPT_VERSION,
|
|
16254
16263
|
archiveRawSession: () => archiveRawSession,
|
|
16255
16264
|
budgetedCut: () => budgetedCut,
|
|
@@ -16308,7 +16317,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
16308
16317
|
return null;
|
|
16309
16318
|
const primaryPath = mainGroup.paths[0];
|
|
16310
16319
|
const merged = readSessionGroupText(mainGroup);
|
|
16311
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
16320
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget), cutText: budgetedCut(SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT) } : {};
|
|
16312
16321
|
const [tail, allSubagents] = await Promise.all([
|
|
16313
16322
|
Promise.resolve(parseClaudeTranscriptText(merged.text, cut)),
|
|
16314
16323
|
parseClaudeSubagents(primaryPath, cut)
|
|
@@ -16331,7 +16340,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
16331
16340
|
return { messages, subagents, mtime: merged.mtime || safeMtime(primaryPath), ...opts.payloadCap ? { payloadCap: opts.payloadCap } : {} };
|
|
16332
16341
|
}
|
|
16333
16342
|
if (tool === "opencode") {
|
|
16334
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
16343
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget), cutText: budgetedCut(SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT) } : {};
|
|
16335
16344
|
const messages = await parseOpenCodeTranscript(sessionId, cut);
|
|
16336
16345
|
if (messages.length === 0)
|
|
16337
16346
|
return null;
|
|
@@ -16343,7 +16352,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
16343
16352
|
const loc = getBackend("codex").findSession(sessionId);
|
|
16344
16353
|
if (!loc)
|
|
16345
16354
|
return null;
|
|
16346
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
16355
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget), cutText: budgetedCut(SYNC_TEXT_CAP, SYNC_TEXT_BUDGET, SYNC_TEXT_CAP_TIGHT) } : {};
|
|
16347
16356
|
const [messages, subagents] = await Promise.all([
|
|
16348
16357
|
parseCodexTranscript(loc.path, cut),
|
|
16349
16358
|
parseCodexSubagents(loc.path, cut)
|