chat-recall 0.7.17 → 0.7.19

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.
@@ -16,6 +16,7 @@ export type FailureClass = 'rate_limited' | 'payment_required' | 'auth' | 'timeo
16
16
  * thrown by fetch itself, and by code that predates the tag.
17
17
  */
18
18
  export declare function classifyError(msg: string, err?: unknown): FailureClass;
19
+ import { type ArchiveFile } from './raw-archive-parts.js';
19
20
  import '@chat-recall/engine/core/backends/index.js';
20
21
  export interface Credentials {
21
22
  serverUrl: string;
@@ -221,6 +222,13 @@ export interface BuiltConversation {
221
222
  * a later mtime-only bump with identical content can skip the whole rebuild.
222
223
  * Undefined for the oversized-tail path (no full container is materialized). */
223
224
  srcHash?: string;
225
+ /** The raw archive, written to a temp file, when it is too large to send
226
+ * inline. The walk uploads it in parts once the conversation has landed. */
227
+ archive?: {
228
+ file: ArchiveFile;
229
+ tool: string;
230
+ mtime: number;
231
+ };
224
232
  }
225
233
  /** buildConversationSync's early-out when the caller passed a priorContentHash
226
234
  * that matches the freshly-exported content: nothing changed since the last
@@ -1 +1 @@
1
- {"version":3,"file":"sync-client.d.ts","sourceRoot":"","sources":["../src/sync-client.ts"],"names":[],"mappings":"AA0CA,OAAO,EAAoF,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAUrL,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,0CAA0C,CAAC;AA2ExG,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAI7E;AAgBD,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGvD;AAED,MAAM,MAAM,YAAY,GACpB,cAAc,GAAG,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GACpE,KAAK,GAAG,SAAS,GAAG,oBAAoB,GAAG,cAAc,GA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project-resolver.js';
69
69
  import { projectPathIncludes } from '@chat-recall/engine/core/project-path-match.js';
70
70
  import { extractEntities } from '@chat-recall/engine/core/entity-extractor.js';
71
71
  import { buildSourceRegistry } from '@chat-recall/engine/parsers/all-sources.js';
72
- import { getSyncedRows, markSynced, getLedgerData, persistLedgerData, fieldNeedsScan, markFieldCoverage, fieldNeedsFullPass, markFieldFullPassDone, syncMode, markFullResync, loadItemVersions, saveItemVersions, loadInventoryHashes, saveInventoryHashes, flushLedger, pruneLedgerTargets } from './sync-ledger.js';
72
+ import { getSyncedRows, markSynced, getLedgerData, persistLedgerData, fieldNeedsScan, markFieldCoverage, fieldNeedsFullPass, markFieldFullPassDone, syncMode, markFullResync, forgetFullCoverage, loadItemVersions, saveItemVersions, loadInventoryHashes, saveInventoryHashes, flushLedger, pruneLedgerTargets } from './sync-ledger.js';
73
73
  import { extractorVersionForTool, extractorVersionForId, extractorVersionForItem, toolOfId, EXTRACTOR_VERSION } from '@chat-recall/engine/core/extractor-version.js';
74
74
  import { SYNC_FIELDS } from '@chat-recall/engine/core/sync-fields.js';
75
75
  import { acquireIndexLock } from '@chat-recall/engine/core/index-lock.js';
@@ -188,7 +188,8 @@ export function classifyError(msg, err) {
188
188
  let walkProgressForUpload = null;
189
189
  let lastServerPackSpec = null;
190
190
  import { reportWalkProgress, readCollectorHealth, updateCollectorHealth } from '@chat-recall/engine/core/collector-health.js';
191
- import { withSessionScanScope } from '@chat-recall/engine/core/live-session-scan.js';
191
+ import { withSessionScanScope, resolveSessionContentGroups } from '@chat-recall/engine/core/live-session-scan.js';
192
+ import { writeArchiveFile, uploadArchiveFile } from './raw-archive-parts.js';
192
193
  import '@chat-recall/engine/core/backends/index.js'; // register the tool backends
193
194
  // Lives under the data dir so CHAT_RECALL_DATA_DIR isolates credentials the
194
195
  // same way it isolates the index (tests, multi-profile setups).
@@ -1330,6 +1331,14 @@ async function syncToTargetInScope(cred, opts = {}) {
1330
1331
  // that re-classifies the session as FULL on an mtime-only change then matches
1331
1332
  // this hash and skips the rebuild entirely.
1332
1333
  const shippedHash = new Map();
1334
+ // session_id → the backend's sourceLayout when this run read the session.
1335
+ // Every ack records it with the cursor, so the cursor and the bytes it
1336
+ // addresses come from the same read.
1337
+ const shippedLayout = new Map();
1338
+ const layoutOf = (id) => {
1339
+ const layout = shippedLayout.get(id);
1340
+ return layout ? { layout } : {};
1341
+ };
1333
1342
  // `flatten`: each add() is a GROUP of rows that must land in the same
1334
1343
  // POST (e.g. one session's findings — the server replaces a session's
1335
1344
  // findings wholesale, so splitting a session across two batches would
@@ -1401,7 +1410,7 @@ async function syncToTargetInScope(cred, opts = {}) {
1401
1410
  // acked: the server accepted the batch containing this conversation, so
1402
1411
  // the cursor is a real delivery receipt.
1403
1412
  return off > 0
1404
- ? { id: r.session_id, mtime: r.mtime, offset: off, size: off, hash, acked: true }
1413
+ ? { id: r.session_id, mtime: r.mtime, offset: off, size: off, hash, acked: true, full: true, ...layoutOf(r.session_id) }
1405
1414
  : { id: r.session_id, mtime: r.mtime, hash };
1406
1415
  }));
1407
1416
  }
@@ -1419,6 +1428,9 @@ async function syncToTargetInScope(cred, opts = {}) {
1419
1428
  // NOT go through the shared `post`/`submit` pool — it needs the response
1420
1429
  // body, which the shared path discards.
1421
1430
  const appendResults = { uploaded: 0, fullResyncNeeded: new Set() };
1431
+ /** Archives too large for the sync request, uploaded once the walk's
1432
+ * conversations have landed (an archive row is read through its session). */
1433
+ const pendingArchives = [];
1422
1434
  const postAppend = async (convs) => {
1423
1435
  const headers = { 'content-type': 'application/json' };
1424
1436
  if (cred.token)
@@ -1455,6 +1467,8 @@ async function syncToTargetInScope(cred, opts = {}) {
1455
1467
  offset: c.from_offset,
1456
1468
  size: c.from_offset, // size = new offset (file grew to here)
1457
1469
  acked: true, // server merged this tail
1470
+ chunkFinal: c.final === true, // completes a chunked full sync
1471
+ ...layoutOf(c.session_id),
1458
1472
  })));
1459
1473
  }
1460
1474
  catch { /* ledger — never fail an upload over it */ }
@@ -1496,10 +1510,10 @@ async function syncToTargetInScope(cred, opts = {}) {
1496
1510
  const mtime = conv.mtime;
1497
1511
  try {
1498
1512
  if (staged || !guarded) {
1499
- markSynced(base, [{ id, mtime, offset: conv.from_offset, size: conv.from_offset, acked: true }]);
1513
+ markSynced(base, [{ id, mtime, offset: conv.from_offset, size: conv.from_offset, acked: true, chunkedHead: true, ...layoutOf(id) }]);
1500
1514
  }
1501
1515
  else if (typeof guarded.o === 'number' && guarded.o > 0 && guarded.o <= fileSize) {
1502
- markSynced(base, [{ id, mtime, offset: guarded.o, size: guarded.o, acked: true }]);
1516
+ markSynced(base, [{ id, mtime, offset: guarded.o, size: guarded.o, acked: true, chunkedHead: true, ...layoutOf(id) }]);
1503
1517
  }
1504
1518
  else {
1505
1519
  // The server holds more than this file has: the file was truncated in
@@ -1661,12 +1675,12 @@ async function syncToTargetInScope(cred, opts = {}) {
1661
1675
  return ref.mtime >= (opts.sinceMs ?? 0) ? 'full' : 'skip';
1662
1676
  const ack = ledger.get(ref.prefixedId);
1663
1677
  const backend = backendFor(ref);
1664
- // A session that exists in more than one home cannot be tail-appended: the
1665
- // size is the SUM across copies while a byte offset addresses one file, so
1666
- // an append would ship bytes that do not match the recorded offset. Force
1667
- // FULL, which ships the unioned container and is correct either way.
1668
- const split = !!backend?.spansMultipleSources?.(ref.prefixedId);
1669
- const isAO = !!backend?.isAppendOnly?.() && !split;
1678
+ // The cursor of a session in more than one home is an offset into its
1679
+ // copies joined end to end. It addresses the same bytes only while the
1680
+ // copies before the last are unchanged; any other change is a FULL sync,
1681
+ // which ships the union and records the new layout.
1682
+ const sameLayout = (ack?.L ?? '') === (backend?.sourceLayout?.(ref.prefixedId) ?? '');
1683
+ const isAO = !!backend?.isAppendOnly?.() && sameLayout;
1670
1684
  const size = isAO ? (backend?.fileSize?.(ref.prefixedId) ?? 0) : 0;
1671
1685
  return syncMode(ack, ref.mtime, size, extractorVersionForTool(ref.toolId), isAO);
1672
1686
  };
@@ -1787,6 +1801,11 @@ async function syncToTargetInScope(cred, opts = {}) {
1787
1801
  skipped++;
1788
1802
  continue;
1789
1803
  }
1804
+ const layout = backendFor(ref)?.sourceLayout?.(ref.prefixedId) ?? '';
1805
+ if (layout)
1806
+ shippedLayout.set(ref.prefixedId, layout);
1807
+ else
1808
+ shippedLayout.delete(ref.prefixedId);
1790
1809
  trace?.(`build (${mode}) ${ref.prefixedId} · ${(sessionFileBytes(ref) / 1048576).toFixed(1)}MB`);
1791
1810
  // ── APPEND: tail-only ship (no raw_b64, no telemetry, no derived) ──
1792
1811
  // `promotedForFindings` flips true when the tail carried a secret finding:
@@ -1888,7 +1907,7 @@ async function syncToTargetInScope(cred, opts = {}) {
1888
1907
  const priorCursor = ackRow?.s ?? 0;
1889
1908
  const safeToAck = off > 0 && off <= priorCursor;
1890
1909
  markSynced(base, [safeToAck
1891
- ? { id: ref.prefixedId, mtime: ref.mtime, offset: off, size: off, hash: built.srcHash, acked: true }
1910
+ ? { id: ref.prefixedId, mtime: ref.mtime, offset: off, size: off, hash: built.srcHash, acked: true, ...layoutOf(ref.prefixedId) }
1892
1911
  : { id: ref.prefixedId, mtime: ref.mtime, hash: built.srcHash }]);
1893
1912
  }
1894
1913
  catch { /* ledger is local bookkeeping — never fail a sync over it */ }
@@ -1923,6 +1942,12 @@ async function syncToTargetInScope(cred, opts = {}) {
1923
1942
  await postChunkedHead(built.conv, sessionFileBytes(ref));
1924
1943
  else
1925
1944
  await convBatch.add(built.conv);
1945
+ if (built.archive) {
1946
+ pendingArchives.push({
1947
+ id: ref.prefixedId, ...built.archive,
1948
+ projectId: built.conv.project_id, projectPath: built.conv.project_path,
1949
+ });
1950
+ }
1926
1951
  // Ship this session's secret findings as one group (server replaces wholesale).
1927
1952
  if (built.findings.length > 0)
1928
1953
  await findingsBatch.add(built.findings);
@@ -2147,6 +2172,32 @@ async function syncToTargetInScope(cred, opts = {}) {
2147
2172
  // Barrier: wait for every pooled upload to land (and surface any fatal
2148
2173
  // error) before tombstones/prune, which must run strictly after all data.
2149
2174
  await drainInflight();
2175
+ // ── Raw archives in parts, straight to object storage ──
2176
+ // A server without object storage answers 'unsupported' once; the rest are
2177
+ // not tried. A failed upload clears the session's full-sync coverage, so the
2178
+ // settle full sync tries again when the session is next quiet.
2179
+ let archivesUnsupported = false;
2180
+ for (const a of pendingArchives) {
2181
+ try {
2182
+ if (!archivesUnsupported) {
2183
+ const r = await uploadArchiveFile(base, cred.token, {
2184
+ sessionId: a.id, tool: a.tool, mtime: a.mtime, projectId: a.projectId, projectPath: a.projectPath, file: a.file,
2185
+ });
2186
+ if (r === 'unsupported')
2187
+ archivesUnsupported = true;
2188
+ }
2189
+ }
2190
+ catch (err) {
2191
+ console.error(`[sync] raw archive for ${a.id} not uploaded (tried again when the session is next quiet): ${err instanceof Error ? err.message : err}`);
2192
+ try {
2193
+ forgetFullCoverage(base, a.id);
2194
+ }
2195
+ catch { /* ledger — best-effort */ }
2196
+ }
2197
+ finally {
2198
+ rmSync(a.file.path, { force: true });
2199
+ }
2200
+ }
2150
2201
  // ── Toolkit inventory. Sent after the barrier, so every item row it names
2151
2202
  // has landed. The server records which device has each item and deletes a
2152
2203
  // row only when no device has it any more (see reconcileToolkitInventory).
@@ -2323,6 +2374,8 @@ export async function buildConversationSync(ref, mtime, opts = {}) {
2323
2374
  let includeRaw = opts.includeRaw !== false;
2324
2375
  let includeMeta = opts.includeMeta !== false;
2325
2376
  let srcHash;
2377
+ // The caller wants the raw archive; size alone decides inline or in parts.
2378
+ const wantRaw = opts.includeRaw !== false;
2326
2379
  // Oversized transcript: ship it in chunks. This FULL sync carries the HEAD
2327
2380
  // chunk (the first SYNC_CHUNK_BYTES, cut at a line end) with from_offset at
2328
2381
  // the end of that chunk. The ledger records that offset, so syncMode sees the
@@ -2677,6 +2730,31 @@ export async function buildConversationSync(ref, mtime, opts = {}) {
2677
2730
  // Native tool title (Claude ai-title, OpenCode session.title) is NOT shipped
2678
2731
  // here — it's a derived field reconciled separately (sync-fields.ts), so a
2679
2732
  // title change never drags the conversation back through sync.
2733
+ // An archive too large to send inline goes up in parts after the walk. It is
2734
+ // written to a temp file now, while the container is in memory, or streamed
2735
+ // from disk for a session too large to export. Redacted the same way.
2736
+ let archive;
2737
+ if (wantRaw && !raw_b64) {
2738
+ try {
2739
+ const redact = (t) => redactSecrets(t, { force: true, count });
2740
+ let source = null;
2741
+ let archiveMtime = Math.floor(ref.mtime) || 0;
2742
+ let archiveTool = ref.toolId;
2743
+ if (container) {
2744
+ source = { kind: 'memory', files: container.files };
2745
+ archiveMtime = container.mtime;
2746
+ archiveTool = container.tool;
2747
+ }
2748
+ else if (oversized) {
2749
+ source = diskArchiveSource(ref);
2750
+ }
2751
+ if (source)
2752
+ archive = { file: await writeArchiveFile(source, { tool: archiveTool, mtime: archiveMtime }, redact), tool: archiveTool, mtime: archiveMtime };
2753
+ }
2754
+ catch (err) {
2755
+ console.error(`[sync] raw archive for ${ref.prefixedId} not written: ${err instanceof Error ? err.message : err}`);
2756
+ }
2757
+ }
2680
2758
  return {
2681
2759
  conv: {
2682
2760
  session_id: ref.prefixedId,
@@ -2709,6 +2787,23 @@ export async function buildConversationSync(ref, mtime, opts = {}) {
2709
2787
  findings,
2710
2788
  scanMs,
2711
2789
  srcHash,
2790
+ archive,
2791
+ };
2792
+ }
2793
+ /**
2794
+ * The files of a session too large to export, to stream from disk. Claude
2795
+ * only, and only when each logical file has one copy: copies in two profile
2796
+ * homes must be unioned record by record, which needs them in memory.
2797
+ */
2798
+ function diskArchiveSource(ref) {
2799
+ if (ref.toolId !== 'claude')
2800
+ return null;
2801
+ const groups = resolveSessionContentGroups(ref.rawId);
2802
+ if (groups.length === 0 || groups.some((g) => g.paths.length !== 1))
2803
+ return null;
2804
+ return {
2805
+ kind: 'disk',
2806
+ files: groups.map((g) => ({ name: g.name === 'main' ? `${ref.rawId}.jsonl` : g.name, path: g.paths[0] })),
2712
2807
  };
2713
2808
  }
2714
2809
  /**