chat-recall 0.7.38 → 0.7.39

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/watch.js CHANGED
@@ -10180,15 +10180,18 @@ var init_opencode = __esm({
10180
10180
  FROM part p JOIN (SELECT id, data FROM message WHERE session_id = ?) m ON p.message_id = m.id
10181
10181
  WHERE p.session_id = ?
10182
10182
  ORDER BY p.time_created ASC, p.id ASC
10183
- `).all(realId, realId);
10184
- const lines = [JSON.stringify({ kind: "session", row: session })];
10185
- for (const r of rows)
10186
- lines.push(JSON.stringify({ kind: "part", row: r }));
10183
+ `);
10184
+ const chunks = [Buffer.from(`${JSON.stringify({ kind: "session", row: session })}
10185
+ `, "utf-8")];
10186
+ for (const r of rows.iterate(realId, realId)) {
10187
+ chunks.push(Buffer.from(`${JSON.stringify({ kind: "part", row: r })}
10188
+ `, "utf-8"));
10189
+ }
10187
10190
  const mtime = session.time_updated || session.time_created || Date.now();
10188
10191
  return {
10189
10192
  tool: "opencode",
10190
10193
  mtime: Number(mtime),
10191
- files: [{ name: `${realId}.dump.jsonl`, bytes: Buffer.from(lines.join("\n") + "\n", "utf-8") }]
10194
+ files: [{ name: `${realId}.dump.jsonl`, bytes: Buffer.concat(chunks) }]
10192
10195
  };
10193
10196
  } catch {
10194
10197
  return null;
@@ -27815,7 +27818,7 @@ var init_http = __esm({
27815
27818
  CLI_VERSION = JSON.parse(readFileSync37(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
27816
27819
  } catch {
27817
27820
  try {
27818
- if (true) CLI_VERSION = "0.7.38";
27821
+ if (true) CLI_VERSION = "0.7.39";
27819
27822
  } catch {
27820
27823
  }
27821
27824
  }
@@ -28309,7 +28312,7 @@ var init_telemetry = __esm({
28309
28312
  init_sync_client();
28310
28313
  cliVersion = () => {
28311
28314
  try {
28312
- return true ? "0.7.38" : "dev";
28315
+ return true ? "0.7.39" : "dev";
28313
28316
  } catch {
28314
28317
  return "dev";
28315
28318
  }
@@ -30229,6 +30232,10 @@ async function syncToTargetInScope(cred, opts = {}) {
30229
30232
  scanMs: Math.round(scanMs)
30230
30233
  };
30231
30234
  }
30235
+ function exportByteLength(exp) {
30236
+ if (!exp) return 0;
30237
+ return exp.files.reduce((n, f) => n + f.bytes.length, 0);
30238
+ }
30232
30239
  async function scanTranscriptFindingsChunked(ref, tenantRules) {
30233
30240
  const backend = getBackendForId(ref.prefixedId);
30234
30241
  const findings = [];
@@ -30299,7 +30306,20 @@ async function buildConversationSync(ref, mtime, opts = {}) {
30299
30306
  const backend = getBackendForId(ref.prefixedId) ?? getBackend("claude");
30300
30307
  const exp = backend.exportRawSession(ref.prefixedId);
30301
30308
  let built;
30302
- if (exp) {
30309
+ const exportBytes = exportByteLength(exp);
30310
+ const overCeiling = exportBytes > FULL_BUILD_MAX_BYTES;
30311
+ if (exp && overCeiling) {
30312
+ console.error(`[sync] ${ref.prefixedId} export is ${(exportBytes / 1048576).toFixed(0)}MB (over the ${(FULL_BUILD_MAX_BYTES / 1048576).toFixed(0)}MB ceiling) \u2014 parsing it in place, no container copy, no shadow merge, no raw archive`);
30313
+ record({
30314
+ kind: "oversized_session",
30315
+ mb: Math.round(exportBytes / 1048576),
30316
+ tool: ref.toolId,
30317
+ dedupeKey: stableMark(ref.prefixedId)
30318
+ });
30319
+ includeRaw = false;
30320
+ includeMeta = false;
30321
+ }
30322
+ if (exp && !overCeiling) {
30303
30323
  try {
30304
30324
  built = buildRawContainer(exp);
30305
30325
  srcHash = containerSrcHash(built);
@@ -30323,7 +30343,7 @@ async function buildConversationSync(ref, mtime, opts = {}) {
30323
30343
  includeMeta = false;
30324
30344
  }
30325
30345
  }
30326
- const shadow = updateShadow(ref.rawId, exp, built);
30346
+ const shadow = overCeiling ? { container: null, status: "skipped", recovered: 0 } : updateShadow(ref.rawId, exp, built);
30327
30347
  if (shadow.container) {
30328
30348
  fullestContainer = shadow.container;
30329
30349
  if (shadow.status === "rewrite-merged" && shadow.recovered > 0) {
@@ -30724,7 +30744,7 @@ var init_sync_client = __esm({
30724
30744
  ownVersion = JSON.parse(readFileSync41(join47(dir, "../package.json"), "utf-8")).version || ownVersion;
30725
30745
  } catch {
30726
30746
  try {
30727
- if (true) ownVersion = "0.7.38";
30747
+ if (true) ownVersion = "0.7.39";
30728
30748
  } catch {
30729
30749
  }
30730
30750
  }
@@ -32530,7 +32550,7 @@ var init_intent_drain = __esm({
32530
32550
  ownVersion2 = JSON.parse(readFileSync45(join53(dir, "../package.json"), "utf-8")).version || ownVersion2;
32531
32551
  } catch {
32532
32552
  try {
32533
- if (true) ownVersion2 = "0.7.38";
32553
+ if (true) ownVersion2 = "0.7.39";
32534
32554
  } catch {
32535
32555
  }
32536
32556
  }
@@ -34234,6 +34254,7 @@ var init_collector = __esm({
34234
34254
  var service_installer_exports = {};
34235
34255
  __export(service_installer_exports, {
34236
34256
  ServiceInstallError: () => ServiceInstallError,
34257
+ WATCH_HEAP_MB: () => WATCH_HEAP_MB,
34237
34258
  installService: () => installService,
34238
34259
  isServiceRunning: () => isServiceRunning,
34239
34260
  platformName: () => platformName,
@@ -34344,9 +34365,8 @@ function renderSystemdUnit(watchJs, node, logFile) {
34344
34365
  // Bounded heap: the daemon does bursty batch work (transcript parse,
34345
34366
  // base64 payloads); V8's default old-space on a big-RAM box is ~4GB and
34346
34367
  // GC only gets aggressive near the ceiling — observed as a multi-GB RSS
34347
- // sawtooth. 1536MB keeps GC honest (768 OOMed on the largest subagent-fanout session) with plenty of headroom for the
34348
- // largest transcripts.
34349
- `ExecStart=${node} --max-old-space-size=1536 ${watchJs}`,
34368
+ // sawtooth. The ceiling below is measured, not guessed: see WATCH_HEAP_MB.
34369
+ `ExecStart=${node} --max-old-space-size=${WATCH_HEAP_MB} ${watchJs}`,
34350
34370
  // ALWAYS: the collector never ends its own work, so any exit systemd did
34351
34371
  // not ask for is a fault. Under on-failure a clean exit left it dead: on
34352
34372
  // 2026-09-16 the unit went "inactive (dead) … status=0/SUCCESS" and stayed
@@ -34419,7 +34439,7 @@ function renderLaunchdPlist(watchJs, node, logFile, label = "com.chat-recall.wat
34419
34439
  '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
34420
34440
  '<plist version="1.0"><dict>',
34421
34441
  ` <key>Label</key><string>${label}</string>`,
34422
- ` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=1536</string><string>${watchJs}</string></array>`,
34442
+ ` <key>ProgramArguments</key><array><string>${node}</string><string>--max-old-space-size=${WATCH_HEAP_MB}</string><string>${watchJs}</string></array>`,
34423
34443
  " <key>RunAtLoad</key><true/>",
34424
34444
  " <key>KeepAlive</key><true/>",
34425
34445
  ` <key>StandardOutPath</key><string>${logFile}</string>`,
@@ -34430,7 +34450,7 @@ function renderLaunchdPlist(watchJs, node, logFile, label = "com.chat-recall.wat
34430
34450
  }
34431
34451
  function installWindowsTask(watchJs, node, logFile) {
34432
34452
  const taskName = "chat-recall-watch";
34433
- const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=1536 \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
34453
+ const tr = `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"`;
34434
34454
  try {
34435
34455
  execSync5(`schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`, { stdio: "inherit" });
34436
34456
  try {
@@ -34443,7 +34463,7 @@ function installWindowsTask(watchJs, node, logFile) {
34443
34463
  return { definitionPath: null, logFile };
34444
34464
  }
34445
34465
  function renderWindowsTaskCommand(watchJs, node, taskName = "chat-recall-watch", logFile) {
34446
- const tr = logFile ? `cmd /c \\"\\"${node}\\" --max-old-space-size=1536 \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"` : `\\"${node}\\" --max-old-space-size=1536 \\"${watchJs}\\"`;
34466
+ const tr = logFile ? `cmd /c \\"\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\" >> \\"${logFile}\\" 2>&1\\"` : `\\"${node}\\" --max-old-space-size=${WATCH_HEAP_MB} \\"${watchJs}\\"`;
34447
34467
  return `schtasks /create /tn "${taskName}" /tr "${tr}" /sc onlogon /rl LIMITED /f`;
34448
34468
  }
34449
34469
  function uninstallService() {
@@ -34494,10 +34514,11 @@ function platformName() {
34494
34514
  if (process.platform === "win32") return "Scheduled Task";
34495
34515
  return process.platform;
34496
34516
  }
34497
- var ServiceInstallError;
34517
+ var WATCH_HEAP_MB, ServiceInstallError;
34498
34518
  var init_service_installer = __esm({
34499
34519
  "src/service-installer.ts"() {
34500
34520
  "use strict";
34521
+ WATCH_HEAP_MB = 640;
34501
34522
  ServiceInstallError = class extends Error {
34502
34523
  hint;
34503
34524
  constructor(message, hint) {
@@ -34882,7 +34903,7 @@ var init_indexer = __esm({
34882
34903
  init_collector_migrate();
34883
34904
  init_sync_ledger();
34884
34905
  init_collector_health();
34885
- CLI_VERSION3 = true ? "0.7.38" : "0.0.0";
34906
+ CLI_VERSION3 = true ? "0.7.39" : "0.0.0";
34886
34907
  DEBOUNCE_MS = 5e3;
34887
34908
  PLANS_DIR = claudeBackend.plansDir();
34888
34909
  TASKS_DIR = claudeBackend.tasksDir();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chat-recall",
3
- "version": "0.7.38",
3
+ "version": "0.7.39",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/munhq/chat-recall.git"