chat-recall 0.7.81 → 0.7.82

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.
@@ -2040,7 +2040,7 @@ var require_thread_stream = __commonJS({
2040
2040
  var { version } = require_package();
2041
2041
  var { EventEmitter } = __require("events");
2042
2042
  var { Worker } = __require("worker_threads");
2043
- var { join: join15 } = __require("path");
2043
+ var { join: join16 } = __require("path");
2044
2044
  var { pathToFileURL } = __require("url");
2045
2045
  var { wait } = require_wait();
2046
2046
  var {
@@ -2083,7 +2083,7 @@ var require_thread_stream = __commonJS({
2083
2083
  function createWorker(stream, opts) {
2084
2084
  const { filename, workerData } = opts;
2085
2085
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
2086
- const toExecute = bundlerOverrides["thread-stream-worker"] || join15(__dirname, "lib", "worker.js");
2086
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join16(__dirname, "lib", "worker.js");
2087
2087
  const worker = new Worker(toExecute, {
2088
2088
  ...opts.workerOpts,
2089
2089
  trackUnmanagedFds: false,
@@ -2486,7 +2486,7 @@ var require_transport = __commonJS({
2486
2486
  "use strict";
2487
2487
  var { createRequire: createRequire3 } = __require("module");
2488
2488
  var getCallers = require_caller();
2489
- var { join: join15, isAbsolute: isAbsolute2, sep } = __require("node:path");
2489
+ var { join: join16, isAbsolute: isAbsolute2, sep } = __require("node:path");
2490
2490
  var sleep = require_atomic_sleep();
2491
2491
  var onExit = require_on_exit_leak_free();
2492
2492
  var ThreadStream = require_thread_stream();
@@ -2549,7 +2549,7 @@ var require_transport = __commonJS({
2549
2549
  throw new Error("only one of target or targets can be specified");
2550
2550
  }
2551
2551
  if (targets) {
2552
- target = bundlerOverrides["pino-worker"] || join15(__dirname, "worker.js");
2552
+ target = bundlerOverrides["pino-worker"] || join16(__dirname, "worker.js");
2553
2553
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
2554
2554
  return {
2555
2555
  ...dest,
@@ -2567,7 +2567,7 @@ var require_transport = __commonJS({
2567
2567
  });
2568
2568
  });
2569
2569
  } else if (pipeline) {
2570
- target = bundlerOverrides["pino-worker"] || join15(__dirname, "worker.js");
2570
+ target = bundlerOverrides["pino-worker"] || join16(__dirname, "worker.js");
2571
2571
  options.pipelines = [pipeline.map((dest) => {
2572
2572
  return {
2573
2573
  ...dest,
@@ -2589,7 +2589,7 @@ var require_transport = __commonJS({
2589
2589
  return origin;
2590
2590
  }
2591
2591
  if (origin === "pino/file") {
2592
- return join15(__dirname, "..", "file.js");
2592
+ return join16(__dirname, "..", "file.js");
2593
2593
  }
2594
2594
  let fixTarget2;
2595
2595
  for (const filePath of callers) {
@@ -2917,11 +2917,11 @@ var require_tools = __commonJS({
2917
2917
  }
2918
2918
  }
2919
2919
  }
2920
- function buildFormatters(level2, bindings, log4) {
2920
+ function buildFormatters(level2, bindings, log6) {
2921
2921
  return {
2922
2922
  level: level2,
2923
2923
  bindings,
2924
- log: log4
2924
+ log: log6
2925
2925
  };
2926
2926
  }
2927
2927
  function normalizeDestFileDescriptor(destination) {
@@ -3304,11 +3304,11 @@ var require_proto = __commonJS({
3304
3304
  }
3305
3305
  } else instance[serializersSym] = serializers;
3306
3306
  if (options.hasOwnProperty("formatters")) {
3307
- const { level: level2, bindings: chindings, log: log4 } = options.formatters;
3307
+ const { level: level2, bindings: chindings, log: log6 } = options.formatters;
3308
3308
  instance[formattersSym] = buildFormatters(
3309
3309
  level2 || formatters.level,
3310
3310
  chindings || resetChildingsFormatter,
3311
- log4 || formatters.log
3311
+ log6 || formatters.log
3312
3312
  );
3313
3313
  } else {
3314
3314
  instance[formattersSym] = buildFormatters(
@@ -3578,7 +3578,7 @@ var require_safe_stable_stringify = __commonJS({
3578
3578
  return circularValue;
3579
3579
  }
3580
3580
  let res = "";
3581
- let join15 = ",";
3581
+ let join16 = ",";
3582
3582
  const originalIndentation = indentation;
3583
3583
  if (Array.isArray(value)) {
3584
3584
  if (value.length === 0) {
@@ -3592,7 +3592,7 @@ var require_safe_stable_stringify = __commonJS({
3592
3592
  indentation += spacer;
3593
3593
  res += `
3594
3594
  ${indentation}`;
3595
- join15 = `,
3595
+ join16 = `,
3596
3596
  ${indentation}`;
3597
3597
  }
3598
3598
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -3600,13 +3600,13 @@ ${indentation}`;
3600
3600
  for (; i < maximumValuesToStringify - 1; i++) {
3601
3601
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3602
3602
  res += tmp2 !== void 0 ? tmp2 : "null";
3603
- res += join15;
3603
+ res += join16;
3604
3604
  }
3605
3605
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3606
3606
  res += tmp !== void 0 ? tmp : "null";
3607
3607
  if (value.length - 1 > maximumBreadth) {
3608
3608
  const removedKeys = value.length - maximumBreadth - 1;
3609
- res += `${join15}"... ${getItemCount(removedKeys)} not stringified"`;
3609
+ res += `${join16}"... ${getItemCount(removedKeys)} not stringified"`;
3610
3610
  }
3611
3611
  if (spacer !== "") {
3612
3612
  res += `
@@ -3627,7 +3627,7 @@ ${originalIndentation}`;
3627
3627
  let separator = "";
3628
3628
  if (spacer !== "") {
3629
3629
  indentation += spacer;
3630
- join15 = `,
3630
+ join16 = `,
3631
3631
  ${indentation}`;
3632
3632
  whitespace = " ";
3633
3633
  }
@@ -3641,13 +3641,13 @@ ${indentation}`;
3641
3641
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
3642
3642
  if (tmp !== void 0) {
3643
3643
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3644
- separator = join15;
3644
+ separator = join16;
3645
3645
  }
3646
3646
  }
3647
3647
  if (keyLength > maximumBreadth) {
3648
3648
  const removedKeys = keyLength - maximumBreadth;
3649
3649
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
3650
- separator = join15;
3650
+ separator = join16;
3651
3651
  }
3652
3652
  if (spacer !== "" && separator.length > 1) {
3653
3653
  res = `
@@ -3688,7 +3688,7 @@ ${originalIndentation}`;
3688
3688
  }
3689
3689
  const originalIndentation = indentation;
3690
3690
  let res = "";
3691
- let join15 = ",";
3691
+ let join16 = ",";
3692
3692
  if (Array.isArray(value)) {
3693
3693
  if (value.length === 0) {
3694
3694
  return "[]";
@@ -3701,7 +3701,7 @@ ${originalIndentation}`;
3701
3701
  indentation += spacer;
3702
3702
  res += `
3703
3703
  ${indentation}`;
3704
- join15 = `,
3704
+ join16 = `,
3705
3705
  ${indentation}`;
3706
3706
  }
3707
3707
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -3709,13 +3709,13 @@ ${indentation}`;
3709
3709
  for (; i < maximumValuesToStringify - 1; i++) {
3710
3710
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3711
3711
  res += tmp2 !== void 0 ? tmp2 : "null";
3712
- res += join15;
3712
+ res += join16;
3713
3713
  }
3714
3714
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3715
3715
  res += tmp !== void 0 ? tmp : "null";
3716
3716
  if (value.length - 1 > maximumBreadth) {
3717
3717
  const removedKeys = value.length - maximumBreadth - 1;
3718
- res += `${join15}"... ${getItemCount(removedKeys)} not stringified"`;
3718
+ res += `${join16}"... ${getItemCount(removedKeys)} not stringified"`;
3719
3719
  }
3720
3720
  if (spacer !== "") {
3721
3721
  res += `
@@ -3728,7 +3728,7 @@ ${originalIndentation}`;
3728
3728
  let whitespace = "";
3729
3729
  if (spacer !== "") {
3730
3730
  indentation += spacer;
3731
- join15 = `,
3731
+ join16 = `,
3732
3732
  ${indentation}`;
3733
3733
  whitespace = " ";
3734
3734
  }
@@ -3737,7 +3737,7 @@ ${indentation}`;
3737
3737
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
3738
3738
  if (tmp !== void 0) {
3739
3739
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3740
- separator = join15;
3740
+ separator = join16;
3741
3741
  }
3742
3742
  }
3743
3743
  if (spacer !== "" && separator.length > 1) {
@@ -3795,20 +3795,20 @@ ${originalIndentation}`;
3795
3795
  indentation += spacer;
3796
3796
  let res2 = `
3797
3797
  ${indentation}`;
3798
- const join16 = `,
3798
+ const join17 = `,
3799
3799
  ${indentation}`;
3800
3800
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3801
3801
  let i = 0;
3802
3802
  for (; i < maximumValuesToStringify - 1; i++) {
3803
3803
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3804
3804
  res2 += tmp2 !== void 0 ? tmp2 : "null";
3805
- res2 += join16;
3805
+ res2 += join17;
3806
3806
  }
3807
3807
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3808
3808
  res2 += tmp !== void 0 ? tmp : "null";
3809
3809
  if (value.length - 1 > maximumBreadth) {
3810
3810
  const removedKeys = value.length - maximumBreadth - 1;
3811
- res2 += `${join16}"... ${getItemCount(removedKeys)} not stringified"`;
3811
+ res2 += `${join17}"... ${getItemCount(removedKeys)} not stringified"`;
3812
3812
  }
3813
3813
  res2 += `
3814
3814
  ${originalIndentation}`;
@@ -3824,16 +3824,16 @@ ${originalIndentation}`;
3824
3824
  return '"[Object]"';
3825
3825
  }
3826
3826
  indentation += spacer;
3827
- const join15 = `,
3827
+ const join16 = `,
3828
3828
  ${indentation}`;
3829
3829
  let res = "";
3830
3830
  let separator = "";
3831
3831
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
3832
3832
  if (isTypedArrayWithEntries(value)) {
3833
- res += stringifyTypedArray(value, join15, maximumBreadth);
3833
+ res += stringifyTypedArray(value, join16, maximumBreadth);
3834
3834
  keys = keys.slice(value.length);
3835
3835
  maximumPropertiesToStringify -= value.length;
3836
- separator = join15;
3836
+ separator = join16;
3837
3837
  }
3838
3838
  if (deterministic) {
3839
3839
  keys = sort(keys, comparator);
@@ -3844,13 +3844,13 @@ ${indentation}`;
3844
3844
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
3845
3845
  if (tmp !== void 0) {
3846
3846
  res += `${separator}${strEscape(key2)}: ${tmp}`;
3847
- separator = join15;
3847
+ separator = join16;
3848
3848
  }
3849
3849
  }
3850
3850
  if (keyLength > maximumBreadth) {
3851
3851
  const removedKeys = keyLength - maximumBreadth;
3852
3852
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
3853
- separator = join15;
3853
+ separator = join16;
3854
3854
  }
3855
3855
  if (separator !== "") {
3856
3856
  res = `
@@ -12847,6 +12847,314 @@ var init_derived = __esm({
12847
12847
  }
12848
12848
  });
12849
12849
 
12850
+ // ../engine/dist/core/detector-install.js
12851
+ var log4;
12852
+ var init_detector_install = __esm({
12853
+ "../engine/dist/core/detector-install.js"() {
12854
+ "use strict";
12855
+ init_paths();
12856
+ init_logger();
12857
+ log4 = createLogger("detector-install");
12858
+ }
12859
+ });
12860
+
12861
+ // ../engine/dist/core/secret-scanner.js
12862
+ function mask(s) {
12863
+ if (!s)
12864
+ return "";
12865
+ if (s.length <= 4)
12866
+ return "*".repeat(s.length);
12867
+ return "*".repeat(Math.min(s.length - 4, 60)) + s.slice(-4);
12868
+ }
12869
+ function looksLikeUuid(raw) {
12870
+ return UUID_RE2.test(raw.trim());
12871
+ }
12872
+ function scanTenantRules(text, tenantRules) {
12873
+ const out = [];
12874
+ const lines = text.split("\n");
12875
+ for (const r of tenantRules) {
12876
+ let re;
12877
+ try {
12878
+ re = new RegExp(r.regex, "g");
12879
+ } catch {
12880
+ continue;
12881
+ }
12882
+ for (let i = 0; i < lines.length; i++) {
12883
+ const line = lines[i];
12884
+ let m;
12885
+ while ((m = re.exec(line)) !== null) {
12886
+ if (!looksLikeUuid(m[0]))
12887
+ out.push({ detector: "tenant", rule: r.name, line: i + 1, preview: mask(m[0]) });
12888
+ if (re.lastIndex === m.index)
12889
+ re.lastIndex++;
12890
+ }
12891
+ }
12892
+ }
12893
+ return out;
12894
+ }
12895
+ var UUID_RE2;
12896
+ var init_secret_scanner = __esm({
12897
+ "../engine/dist/core/secret-scanner.js"() {
12898
+ "use strict";
12899
+ init_detector_install();
12900
+ UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
12901
+ }
12902
+ });
12903
+
12904
+ // ../engine/dist/core/secret-precision.js
12905
+ function isFuzzyFinding(_detector, rule) {
12906
+ if (!rule)
12907
+ return false;
12908
+ return FUZZY_RULES.has(rule.toLowerCase());
12909
+ }
12910
+ function keepFuzzyFindings() {
12911
+ const v = process.env.CHAT_RECALL_INCLUDE_FUZZY;
12912
+ return v === "1" || v === "true" || v === "yes";
12913
+ }
12914
+ function dropFuzzyFindings(items, pick) {
12915
+ if (keepFuzzyFindings())
12916
+ return items;
12917
+ return items.filter((t) => {
12918
+ const { detector, rule } = pick(t);
12919
+ return !isFuzzyFinding(detector, rule);
12920
+ });
12921
+ }
12922
+ var FUZZY_RULES;
12923
+ var init_secret_precision = __esm({
12924
+ "../engine/dist/core/secret-precision.js"() {
12925
+ "use strict";
12926
+ FUZZY_RULES = /* @__PURE__ */ new Set([
12927
+ "generic-api-key",
12928
+ // gitleaks: any high-entropy string → the #1 FP source
12929
+ "curl-auth-header",
12930
+ // matches any `Authorization:` header value, incl. examples
12931
+ "uri",
12932
+ // trufflehog URI: matches any URL with creds-looking parts
12933
+ "box",
12934
+ // trufflehog Box: matches base64/UUID-shaped strings
12935
+ "dockerhub",
12936
+ // FP-prone on image refs / digests
12937
+ "npmtoken",
12938
+ // overlaps UUIDs
12939
+ "shortcut",
12940
+ // FP-prone fuzzy matcher
12941
+ "privacy",
12942
+ // FP-prone fuzzy matcher
12943
+ "miro"
12944
+ // FP-prone fuzzy matcher
12945
+ ]);
12946
+ }
12947
+ });
12948
+
12949
+ // ../engine/dist/transcript/types.js
12950
+ var init_types = __esm({
12951
+ "../engine/dist/transcript/types.js"() {
12952
+ "use strict";
12953
+ }
12954
+ });
12955
+
12956
+ // ../engine/dist/transcript/opencode.js
12957
+ var log5;
12958
+ var init_opencode2 = __esm({
12959
+ "../engine/dist/transcript/opencode.js"() {
12960
+ "use strict";
12961
+ init_opencode_v2();
12962
+ init_logger();
12963
+ init_trim();
12964
+ log5 = createLogger("transcript-opencode");
12965
+ }
12966
+ });
12967
+
12968
+ // ../engine/dist/transcript/index.js
12969
+ var init_transcript = __esm({
12970
+ "../engine/dist/transcript/index.js"() {
12971
+ "use strict";
12972
+ init_live_session_scan();
12973
+ init_tool_backend();
12974
+ init_backends();
12975
+ init_types();
12976
+ init_claude();
12977
+ init_opencode2();
12978
+ init_codex();
12979
+ init_from_events();
12980
+ init_trim();
12981
+ init_types();
12982
+ init_trim();
12983
+ init_raw();
12984
+ init_shadow();
12985
+ init_claude();
12986
+ init_opencode2();
12987
+ init_codex();
12988
+ init_from_events();
12989
+ }
12990
+ });
12991
+
12992
+ // src/raw-archive-parts.ts
12993
+ import { createReadStream as createReadStream3, createWriteStream, openSync as openSync8, readSync as readSync8, closeSync as closeSync8, rmSync, statSync as statSync15 } from "node:fs";
12994
+ import { tmpdir } from "node:os";
12995
+ import { join as join15 } from "node:path";
12996
+ import { randomBytes } from "node:crypto";
12997
+ import { createGzip } from "node:zlib";
12998
+ import { once } from "node:events";
12999
+ import { readFileSync as readFileSync12 } from "node:fs";
13000
+ async function* fileLines(path) {
13001
+ let rest = "";
13002
+ const decoder = new TextDecoder("utf-8");
13003
+ for await (const chunk of createReadStream3(path, { highWaterMark: 1024 * 1024 })) {
13004
+ rest += decoder.decode(chunk, { stream: true });
13005
+ let nl = rest.indexOf("\n");
13006
+ while (nl >= 0) {
13007
+ yield rest.slice(0, nl + 1);
13008
+ rest = rest.slice(nl + 1);
13009
+ nl = rest.indexOf("\n");
13010
+ }
13011
+ }
13012
+ rest += decoder.decode();
13013
+ if (rest) yield rest;
13014
+ }
13015
+ function* textLines(text) {
13016
+ let at = 0;
13017
+ while (at < text.length) {
13018
+ const nl = text.indexOf("\n", at);
13019
+ const end = nl < 0 ? text.length : nl + 1;
13020
+ yield text.slice(at, end);
13021
+ at = end;
13022
+ }
13023
+ }
13024
+ async function writeArchiveFile(source, meta, redact, dir = tmpdir()) {
13025
+ const path = join15(dir, `cr-archive-${randomBytes(8).toString("hex")}.json.gz`);
13026
+ const gzip = createGzip({ level: 6 });
13027
+ const out = createWriteStream(path, { mode: 384 });
13028
+ const done = once(out, "finish");
13029
+ gzip.pipe(out);
13030
+ let size = 0;
13031
+ const write = async (s) => {
13032
+ size += Buffer.byteLength(s);
13033
+ if (!gzip.write(s)) await once(gzip, "drain");
13034
+ };
13035
+ try {
13036
+ await write(`{"v":1,"tool":${JSON.stringify(meta.tool)},"mtime":${Math.floor(meta.mtime)},"files":[`);
13037
+ for (const [i, f] of source.files.entries()) {
13038
+ await write(`${i ? "," : ""}{"name":${JSON.stringify(f.name)},"text":"`);
13039
+ const whole = () => source.kind === "memory" ? f.text : readFileSync12(f.path, "utf-8");
13040
+ if (source.kind !== "lines" && !f.name.endsWith(".jsonl")) {
13041
+ await write(escapeJson(redact(whole())));
13042
+ } else {
13043
+ const lines = source.kind === "memory" ? textLines(f.text) : source.kind === "disk" ? fileLines(f.path) : f.lines();
13044
+ for await (const line of lines) {
13045
+ const nl = line.endsWith("\n");
13046
+ const body = nl ? line.slice(0, -1) : line;
13047
+ await write(escapeJson((body ? redactJsonLine(body, redact) : body) + (nl ? "\n" : "")));
13048
+ }
13049
+ }
13050
+ await write('"}');
13051
+ }
13052
+ await write("]}");
13053
+ gzip.end();
13054
+ await done;
13055
+ } catch (err) {
13056
+ gzip.destroy();
13057
+ out.destroy();
13058
+ rmSync(path, { force: true });
13059
+ throw err;
13060
+ }
13061
+ return { path, gzSize: statSync15(path).size, size };
13062
+ }
13063
+ var escapeJson;
13064
+ var init_raw_archive_parts = __esm({
13065
+ "src/raw-archive-parts.ts"() {
13066
+ "use strict";
13067
+ init_transcript();
13068
+ escapeJson = (s) => JSON.stringify(s).slice(1, -1);
13069
+ }
13070
+ });
13071
+
13072
+ // src/yield-loop.ts
13073
+ function yieldToEventLoop() {
13074
+ return new Promise((resolve) => setImmediate(resolve));
13075
+ }
13076
+ var init_yield_loop = __esm({
13077
+ "src/yield-loop.ts"() {
13078
+ "use strict";
13079
+ }
13080
+ });
13081
+
13082
+ // src/heavy-session-work.ts
13083
+ var heavy_session_work_exports = {};
13084
+ __export(heavy_session_work_exports, {
13085
+ SYNC_CHUNK_BYTES: () => SYNC_CHUNK_BYTES,
13086
+ diskArchiveSource: () => diskArchiveSource,
13087
+ scanTranscriptFindingsChunked: () => scanTranscriptFindingsChunked,
13088
+ streamedArchiveSource: () => streamedArchiveSource,
13089
+ writeStreamedArchive: () => writeStreamedArchive
13090
+ });
13091
+ async function scanTranscriptFindingsChunked(ref, tenantRules) {
13092
+ const backend = getBackendForId(ref.prefixedId);
13093
+ const findings = [];
13094
+ if (!backend?.readFromOffset) return findings;
13095
+ let offset = 0;
13096
+ let lineBase = 0;
13097
+ for (; ; ) {
13098
+ await yieldToEventLoop();
13099
+ const chunk = await backend.readFromOffset(ref.prefixedId, offset, SYNC_CHUNK_BYTES);
13100
+ if (chunk.newOffset <= offset) break;
13101
+ offset = chunk.newOffset;
13102
+ if (chunk.skippedBytes) {
13103
+ lineBase += 1;
13104
+ continue;
13105
+ }
13106
+ try {
13107
+ for (const f of scanTextForFindings(chunk.text)) {
13108
+ findings.push({ session_id: ref.prefixedId, detector: "builtin", rule: f.rule, line: lineBase + f.line, preview: f.preview });
13109
+ }
13110
+ if (tenantRules && tenantRules.length > 0) {
13111
+ for (const f of scanTenantRules(chunk.text, tenantRules)) {
13112
+ findings.push({ session_id: ref.prefixedId, detector: f.detector, rule: f.rule, line: lineBase + f.line, preview: f.preview });
13113
+ }
13114
+ }
13115
+ } catch {
13116
+ }
13117
+ for (let i = chunk.text.indexOf("\n"); i >= 0; i = chunk.text.indexOf("\n", i + 1)) lineBase++;
13118
+ }
13119
+ return dropFuzzyFindings(findings, (f) => ({ detector: f.detector, rule: f.rule }));
13120
+ }
13121
+ function diskArchiveSource(ref) {
13122
+ if (ref.toolId !== "claude") return null;
13123
+ const groups = resolveSessionContentGroups(ref.rawId);
13124
+ if (groups.length === 0 || groups.some((g) => g.paths.length !== 1)) return null;
13125
+ return {
13126
+ kind: "disk",
13127
+ files: groups.map((g) => ({ name: g.name === "main" ? `${ref.rawId}.jsonl` : g.name, path: g.paths[0] }))
13128
+ };
13129
+ }
13130
+ function streamedArchiveSource(ref) {
13131
+ const disk = diskArchiveSource(ref);
13132
+ if (disk) return disk;
13133
+ const backend = getBackendForId(ref.prefixedId);
13134
+ if (ref.toolId === "claude" || !backend?.iterateRawSessionLines) return null;
13135
+ return { kind: "lines", files: [{ name: `${ref.rawId}.dump.jsonl`, lines: () => backend.iterateRawSessionLines(ref.prefixedId) }] };
13136
+ }
13137
+ async function writeStreamedArchive(ref, redact) {
13138
+ const source = streamedArchiveSource(ref);
13139
+ if (!source) return null;
13140
+ return writeArchiveFile(source, { tool: ref.toolId, mtime: Math.floor(ref.mtime ?? 0) || 0 }, redact);
13141
+ }
13142
+ var SYNC_CHUNK_BYTES;
13143
+ var init_heavy_session_work = __esm({
13144
+ "src/heavy-session-work.ts"() {
13145
+ "use strict";
13146
+ init_backends();
13147
+ init_tool_backend();
13148
+ init_live_session_scan();
13149
+ init_secret_redactor();
13150
+ init_secret_scanner();
13151
+ init_secret_precision();
13152
+ init_raw_archive_parts();
13153
+ init_yield_loop();
13154
+ SYNC_CHUNK_BYTES = 8 * 1024 * 1024;
13155
+ }
13156
+ });
13157
+
12850
13158
  // src/scan-worker.ts
12851
13159
  init_secret_redactor();
12852
13160
  init_raw();
@@ -12908,7 +13216,43 @@ async function runDerived(task) {
12908
13216
  );
12909
13217
  return { id: task.id, rows, redactions: count.redactions };
12910
13218
  }
13219
+ async function runFindings(task) {
13220
+ if (task.pack && task.packVersion !== installedPackVersion) {
13221
+ installServerRulePack(task.pack);
13222
+ installedPackVersion = task.packVersion;
13223
+ }
13224
+ await holdScanScopeOpen();
13225
+ const { scanTranscriptFindingsChunked: scanTranscriptFindingsChunked2 } = await Promise.resolve().then(() => (init_heavy_session_work(), heavy_session_work_exports));
13226
+ return { id: task.id, findings: await scanTranscriptFindingsChunked2(task.ref, task.tenantRules) };
13227
+ }
13228
+ async function runArchive(task) {
13229
+ if (task.pack && task.packVersion !== installedPackVersion) {
13230
+ installServerRulePack(task.pack);
13231
+ installedPackVersion = task.packVersion;
13232
+ }
13233
+ await holdScanScopeOpen();
13234
+ const { writeStreamedArchive: writeStreamedArchive2 } = await Promise.resolve().then(() => (init_heavy_session_work(), heavy_session_work_exports));
13235
+ const count = { redactions: 0 };
13236
+ const archive = await writeStreamedArchive2(task.ref, (text) => redactSecrets(text, { force: true, count }));
13237
+ return { id: task.id, archive, redactions: count.redactions };
13238
+ }
12911
13239
  parentPort?.on("message", async (task) => {
13240
+ if (task.task === "findings") {
13241
+ try {
13242
+ parentPort?.postMessage(await runFindings(task));
13243
+ } catch (err) {
13244
+ parentPort?.postMessage({ id: task.id, findings: [], error: err instanceof Error ? err.message : String(err) });
13245
+ }
13246
+ return;
13247
+ }
13248
+ if (task.task === "archive") {
13249
+ try {
13250
+ parentPort?.postMessage(await runArchive(task));
13251
+ } catch (err) {
13252
+ parentPort?.postMessage({ id: task.id, archive: null, redactions: 0, error: err instanceof Error ? err.message : String(err) });
13253
+ }
13254
+ return;
13255
+ }
12912
13256
  if (task.task === "derived") {
12913
13257
  try {
12914
13258
  parentPort?.postMessage(await runDerived(task));
@@ -1 +1 @@
1
- {"version":3,"file":"scan-worker.js","sourceRoot":"","sources":["../src/scan-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EACL,m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AC,CAAC,MAAM,CAAC,GAAG,CAAC,EAA0B,CAAC,CAAC;QAC1J,CAAC;QACD,OAAO;IACT,CAAC;IACD,IAAK,IAAoB,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7C,IAAI,CAAC;YACH,UAAU,EAAE,WAAW,CAAC,MAAM,UAAU,CAAC,IAAmB,CAAC,CAAC,CAAC;QACjE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,UAAU,EAAE,WAAW,CAAC;gBACtB,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;gBACtC,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aAChC,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO;IACT,CAAC;IACD,IAAI,MAAkB,CAAC;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,OAAO,CAAC,IAAgB,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,4EAA4E;QAC5E,kEAAkE;QAClE,MAAM,GAAG;YACP,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC;YACxC,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACxD,CAAC;IACJ,CAAC;IACD,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC"}
@@ -29,6 +29,8 @@ export type FailureClass = 'rate_limited' | 'payload_too_large' | 'payment_requi
29
29
  export declare function countsForBreaker(cls: FailureClass): boolean;
30
30
  export declare function classifyError(msg: string, err?: unknown): FailureClass;
31
31
  import { type ArchiveFile } from './raw-archive-parts.js';
32
+ import { SYNC_CHUNK_BYTES, scanTranscriptFindingsChunked } from './heavy-session-work.js';
33
+ export { SYNC_CHUNK_BYTES, scanTranscriptFindingsChunked };
32
34
  import '@chat-recall/engine/core/backends/index.js';
33
35
  /**
34
36
  * A sync target. `token` is the token itself. `secret` points to the place of the kit store that holds it
@@ -322,21 +324,6 @@ export declare function exportByteLength(exp: {
322
324
  /** Transcript bytes beyond which the derived computations (diff, outcome,
323
325
  * commits, markers) are skipped. They run in the scan worker and read the
324
326
  * whole transcript; a 353 MB session with 100 MB JSON lines OOMed the walk. */ export declare const DERIVED_MAX_BYTES: number;
325
- /** Bytes of transcript one chunk of a chunked sync carries: the head of an
326
- * oversized FULL sync, and each append. */
327
- export declare const SYNC_CHUNK_BYTES: number;
328
- /**
329
- * Secret findings for a whole transcript, read one chunk at a time.
330
- *
331
- * A chunked session never holds its full text, so it cannot use the one-pass
332
- * scan of the in-memory build. Line numbers are absolute: each chunk's
333
- * findings are shifted by the lines of the chunks before it. A line longer
334
- * than a chunk is skipped by the reader, and it counts as one line.
335
- */
336
- export declare function scanTranscriptFindingsChunked(ref: SessionRef, tenantRules?: Array<{
337
- name: string;
338
- regex: string;
339
- }>): Promise<BuiltConversation['findings']>;
340
327
  /** Ceiling on PRE-REDACTION session text materialized on disk at any one moment
341
328
  * by the optional external-detector batch scan. The batch dir is flushed and
342
329
  * deleted every time it crosses this, so a SIGKILL/OOM mid-scan can strand at
@@ -442,5 +429,4 @@ export declare function isSyncSkip(r: SyncResult | SyncSkip): r is SyncSkip;
442
429
  export declare function syncIncremental(opts?: {
443
430
  scope?: 'full' | 'changed';
444
431
  }): Promise<SyncResult | SyncSkip>;
445
- export {};
446
432
  //# sourceMappingURL=sync-client.d.ts.map