chat-recall 0.7.67 → 0.7.69
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 +41 -11
- package/dist/cli.js.map +1 -1
- package/dist/mcp.js +35 -11
- package/dist/scan-worker.js +2 -0
- package/dist/sync-client.js +2 -2
- package/dist/sync-client.js.map +1 -1
- package/dist/walk-budget.d.ts +9 -0
- package/dist/walk-budget.d.ts.map +1 -1
- package/dist/walk-budget.js +9 -0
- package/dist/walk-budget.js.map +1 -1
- package/dist/watch.js +38 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9172,6 +9172,25 @@ var init_session = __esm({
|
|
|
9172
9172
|
function detach(s) {
|
|
9173
9173
|
return JSON.parse(JSON.stringify(s));
|
|
9174
9174
|
}
|
|
9175
|
+
function payloadLength(v) {
|
|
9176
|
+
if (v === void 0 || v === null)
|
|
9177
|
+
return 0;
|
|
9178
|
+
if (typeof v === "string")
|
|
9179
|
+
return v.length;
|
|
9180
|
+
try {
|
|
9181
|
+
return JSON.stringify(v)?.length ?? 0;
|
|
9182
|
+
} catch {
|
|
9183
|
+
return 0;
|
|
9184
|
+
}
|
|
9185
|
+
}
|
|
9186
|
+
function budgetedCut(capChars, budgetChars = SYNC_PAYLOAD_BUDGET, tightChars = SYNC_PAYLOAD_CAP_TIGHT) {
|
|
9187
|
+
let kept = 0;
|
|
9188
|
+
return (v) => {
|
|
9189
|
+
const out = capPayload(v, kept >= budgetChars ? Math.min(tightChars, capChars) : capChars);
|
|
9190
|
+
kept += payloadLength(out);
|
|
9191
|
+
return out;
|
|
9192
|
+
};
|
|
9193
|
+
}
|
|
9175
9194
|
function capPayload(v, capChars = SYNC_PAYLOAD_CAP) {
|
|
9176
9195
|
if (v === void 0)
|
|
9177
9196
|
return void 0;
|
|
@@ -9196,10 +9215,12 @@ function capPayload(v, capChars = SYNC_PAYLOAD_CAP) {
|
|
|
9196
9215
|
}
|
|
9197
9216
|
return v;
|
|
9198
9217
|
}
|
|
9199
|
-
var SYNC_PAYLOAD_CAP;
|
|
9218
|
+
var SYNC_PAYLOAD_BUDGET, SYNC_PAYLOAD_CAP_TIGHT, SYNC_PAYLOAD_CAP;
|
|
9200
9219
|
var init_trim = __esm({
|
|
9201
9220
|
"../engine/dist/transcript/trim.js"() {
|
|
9202
9221
|
"use strict";
|
|
9222
|
+
SYNC_PAYLOAD_BUDGET = 48 * 1024 * 1024;
|
|
9223
|
+
SYNC_PAYLOAD_CAP_TIGHT = 200;
|
|
9203
9224
|
SYNC_PAYLOAD_CAP = 2e3;
|
|
9204
9225
|
}
|
|
9205
9226
|
});
|
|
@@ -9217,7 +9238,7 @@ async function parseClaudeTranscript(sessionPath, opts = {}) {
|
|
|
9217
9238
|
return parseMessagesFromFile(sessionPath, opts);
|
|
9218
9239
|
}
|
|
9219
9240
|
function parseClaudeTranscriptText(text, opts = {}) {
|
|
9220
|
-
const builder = new MessageBuilder(opts.payloadCap);
|
|
9241
|
+
const builder = new MessageBuilder(opts.payloadCap, opts.cut);
|
|
9221
9242
|
let lineNumber = 0;
|
|
9222
9243
|
for (const line of text.split("\n")) {
|
|
9223
9244
|
lineNumber++;
|
|
@@ -9235,7 +9256,7 @@ function parseClaudeTranscriptText(text, opts = {}) {
|
|
|
9235
9256
|
}
|
|
9236
9257
|
async function parseMessagesFromFile(sessionPath, opts) {
|
|
9237
9258
|
const file = await open(sessionPath);
|
|
9238
|
-
const builder = new MessageBuilder(opts.payloadCap);
|
|
9259
|
+
const builder = new MessageBuilder(opts.payloadCap, opts.cut);
|
|
9239
9260
|
try {
|
|
9240
9261
|
let lineNumber = 0;
|
|
9241
9262
|
for await (const line of file.readLines()) {
|
|
@@ -9340,8 +9361,8 @@ var init_claude2 = __esm({
|
|
|
9340
9361
|
calls = /* @__PURE__ */ new Map();
|
|
9341
9362
|
/** The last result of each tool_use id. */
|
|
9342
9363
|
results = /* @__PURE__ */ new Map();
|
|
9343
|
-
constructor(payloadCap) {
|
|
9344
|
-
this.cap = payloadCap ? (v) => capPayload(v, payloadCap) : (v) => v;
|
|
9364
|
+
constructor(payloadCap, cut) {
|
|
9365
|
+
this.cap = cut ?? (payloadCap ? (v) => capPayload(v, payloadCap) : (v) => v);
|
|
9345
9366
|
}
|
|
9346
9367
|
add(line, obj2) {
|
|
9347
9368
|
if (!obj2 || typeof obj2 !== "object")
|
|
@@ -9554,7 +9575,7 @@ function parseCodexTranscriptText(text, opts = {}) {
|
|
|
9554
9575
|
return messages;
|
|
9555
9576
|
}
|
|
9556
9577
|
function codexLineHandler(messages, opts) {
|
|
9557
|
-
const cap = opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v;
|
|
9578
|
+
const cap = opts.cut ?? (opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v);
|
|
9558
9579
|
return (lineNum, line) => {
|
|
9559
9580
|
if (!line.trim())
|
|
9560
9581
|
return;
|
|
@@ -16341,6 +16362,9 @@ function walkSessionLimit(env = process.env) {
|
|
|
16341
16362
|
if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) return DEFAULT_WALK_MAX_SESSIONS;
|
|
16342
16363
|
return n;
|
|
16343
16364
|
}
|
|
16365
|
+
function hasAckedMtime(row) {
|
|
16366
|
+
return typeof row?.m === "number" && row.m > 0;
|
|
16367
|
+
}
|
|
16344
16368
|
function orderRefsForWalk(refs, isAcked) {
|
|
16345
16369
|
const fresh = [];
|
|
16346
16370
|
const acked = [];
|
|
@@ -17085,7 +17109,7 @@ async function parseOpenCodeTranscript(sessionId, opts = {}) {
|
|
|
17085
17109
|
WHERE p.session_id = ?
|
|
17086
17110
|
ORDER BY p.time_created ASC
|
|
17087
17111
|
`).iterate(realId, realId);
|
|
17088
|
-
const cap = opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v;
|
|
17112
|
+
const cap = opts.cut ?? (opts.payloadCap ? (v) => capPayload(v, opts.payloadCap) : (v) => v);
|
|
17089
17113
|
let lastMsgData = "";
|
|
17090
17114
|
let lastRole = "assistant";
|
|
17091
17115
|
let lineNum = 0;
|
|
@@ -17132,9 +17156,12 @@ var init_opencode2 = __esm({
|
|
|
17132
17156
|
var transcript_exports = {};
|
|
17133
17157
|
__export(transcript_exports, {
|
|
17134
17158
|
RAW_PARSE_MAX_BYTES: () => RAW_PARSE_MAX_BYTES,
|
|
17159
|
+
SYNC_PAYLOAD_BUDGET: () => SYNC_PAYLOAD_BUDGET,
|
|
17135
17160
|
SYNC_PAYLOAD_CAP: () => SYNC_PAYLOAD_CAP,
|
|
17161
|
+
SYNC_PAYLOAD_CAP_TIGHT: () => SYNC_PAYLOAD_CAP_TIGHT,
|
|
17136
17162
|
TRANSCRIPT_VERSION: () => TRANSCRIPT_VERSION,
|
|
17137
17163
|
archiveRawSession: () => archiveRawSession,
|
|
17164
|
+
budgetedCut: () => budgetedCut,
|
|
17138
17165
|
buildRawContainer: () => buildRawContainer,
|
|
17139
17166
|
canonicalEventsToMessages: () => canonicalEventsToMessages,
|
|
17140
17167
|
capPayload: () => capPayload,
|
|
@@ -17190,7 +17217,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
17190
17217
|
return null;
|
|
17191
17218
|
const primaryPath = mainGroup.paths[0];
|
|
17192
17219
|
const merged = readSessionGroupText(mainGroup);
|
|
17193
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap } : {};
|
|
17220
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
17194
17221
|
const [tail, allSubagents] = await Promise.all([
|
|
17195
17222
|
Promise.resolve(parseClaudeTranscriptText(merged.text, cut)),
|
|
17196
17223
|
parseClaudeSubagents(primaryPath, cut)
|
|
@@ -17213,7 +17240,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
17213
17240
|
return { messages, subagents, mtime: merged.mtime || safeMtime(primaryPath), ...opts.payloadCap ? { payloadCap: opts.payloadCap } : {} };
|
|
17214
17241
|
}
|
|
17215
17242
|
if (tool === "opencode") {
|
|
17216
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap } : {};
|
|
17243
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
17217
17244
|
const messages = await parseOpenCodeTranscript(sessionId, cut);
|
|
17218
17245
|
if (messages.length === 0)
|
|
17219
17246
|
return null;
|
|
@@ -17225,7 +17252,7 @@ async function parseTranscriptUncut(sessionId, opts) {
|
|
|
17225
17252
|
const loc = getBackend("codex").findSession(sessionId);
|
|
17226
17253
|
if (!loc)
|
|
17227
17254
|
return null;
|
|
17228
|
-
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap } : {};
|
|
17255
|
+
const cut = opts.payloadCap ? { payloadCap: opts.payloadCap, cut: budgetedCut(opts.payloadCap, opts.payloadBudget) } : {};
|
|
17229
17256
|
const [messages, subagents] = await Promise.all([
|
|
17230
17257
|
parseCodexTranscript(loc.path, cut),
|
|
17231
17258
|
parseCodexSubagents(loc.path, cut)
|
|
@@ -31313,7 +31340,7 @@ async function syncToTargetInScope(cred, opts = {}) {
|
|
|
31313
31340
|
};
|
|
31314
31341
|
let scanMs = 0, scanned = 0;
|
|
31315
31342
|
const walkMax = opts.limit ?? walkSessionLimit();
|
|
31316
|
-
const ordered = walkMax > 0 ? orderRefsForWalk(refs, (id) =>
|
|
31343
|
+
const ordered = walkMax > 0 ? orderRefsForWalk(refs, (id) => hasAckedMtime(ledger?.get(id))) : refs;
|
|
31317
31344
|
const slice = walkMax > 0 ? ordered.slice(0, walkMax) : ordered;
|
|
31318
31345
|
const unackedCount = walkMax > 0 ? refs.reduce((n, r) => n + (ledger?.get(r.prefixedId) ? 0 : 1), 0) : refs.length;
|
|
31319
31346
|
const trace = process.env.CHAT_RECALL_SYNC_TRACE === "1" ? (msg) => {
|
|
@@ -40762,6 +40789,8 @@ function tierAll(results) {
|
|
|
40762
40789
|
|
|
40763
40790
|
// src/cli.ts
|
|
40764
40791
|
init_sync_client();
|
|
40792
|
+
init_session_file_scan();
|
|
40793
|
+
init_live_session_scan();
|
|
40765
40794
|
init_credentials_env();
|
|
40766
40795
|
init_update_notice();
|
|
40767
40796
|
init_server_probe();
|
|
@@ -42194,6 +42223,7 @@ program.command("verify").description("Check that the server holds everything th
|
|
|
42194
42223
|
fileSize: (rawId) => claude.fileSize?.(rawId) ?? 0,
|
|
42195
42224
|
localContainerSize: (rawId) => {
|
|
42196
42225
|
try {
|
|
42226
|
+
if (sessionGroupsBytes(resolveSessionContentGroups(rawId)) > FULL_BUILD_MAX_BYTES) return null;
|
|
42197
42227
|
const exp = claude.exportRawSession?.(rawId);
|
|
42198
42228
|
if (!exp) return null;
|
|
42199
42229
|
const container = {
|