chat-recall 0.5.32 → 0.6.0

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/mcp.js CHANGED
@@ -2034,7 +2034,7 @@ var require_thread_stream = __commonJS({
2034
2034
  var { version: version2 } = require_package();
2035
2035
  var { EventEmitter } = __require("events");
2036
2036
  var { Worker: Worker2 } = __require("worker_threads");
2037
- var { join: join53 } = __require("path");
2037
+ var { join: join54 } = __require("path");
2038
2038
  var { pathToFileURL } = __require("url");
2039
2039
  var { wait } = require_wait();
2040
2040
  var {
@@ -2077,7 +2077,7 @@ var require_thread_stream = __commonJS({
2077
2077
  function createWorker(stream, opts) {
2078
2078
  const { filename, workerData } = opts;
2079
2079
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
2080
- const toExecute = bundlerOverrides["thread-stream-worker"] || join53(__dirname, "lib", "worker.js");
2080
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join54(__dirname, "lib", "worker.js");
2081
2081
  const worker = new Worker2(toExecute, {
2082
2082
  ...opts.workerOpts,
2083
2083
  trackUnmanagedFds: false,
@@ -2480,7 +2480,7 @@ var require_transport = __commonJS({
2480
2480
  "use strict";
2481
2481
  var { createRequire: createRequire3 } = __require("module");
2482
2482
  var getCallers = require_caller();
2483
- var { join: join53, isAbsolute: isAbsolute3, sep: sep4 } = __require("node:path");
2483
+ var { join: join54, isAbsolute: isAbsolute3, sep: sep4 } = __require("node:path");
2484
2484
  var sleep = require_atomic_sleep();
2485
2485
  var onExit = require_on_exit_leak_free();
2486
2486
  var ThreadStream = require_thread_stream();
@@ -2543,7 +2543,7 @@ var require_transport = __commonJS({
2543
2543
  throw new Error("only one of target or targets can be specified");
2544
2544
  }
2545
2545
  if (targets) {
2546
- target = bundlerOverrides["pino-worker"] || join53(__dirname, "worker.js");
2546
+ target = bundlerOverrides["pino-worker"] || join54(__dirname, "worker.js");
2547
2547
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
2548
2548
  return {
2549
2549
  ...dest,
@@ -2561,7 +2561,7 @@ var require_transport = __commonJS({
2561
2561
  });
2562
2562
  });
2563
2563
  } else if (pipeline) {
2564
- target = bundlerOverrides["pino-worker"] || join53(__dirname, "worker.js");
2564
+ target = bundlerOverrides["pino-worker"] || join54(__dirname, "worker.js");
2565
2565
  options.pipelines = [pipeline.map((dest) => {
2566
2566
  return {
2567
2567
  ...dest,
@@ -2583,7 +2583,7 @@ var require_transport = __commonJS({
2583
2583
  return origin;
2584
2584
  }
2585
2585
  if (origin === "pino/file") {
2586
- return join53(__dirname, "..", "file.js");
2586
+ return join54(__dirname, "..", "file.js");
2587
2587
  }
2588
2588
  let fixTarget2;
2589
2589
  for (const filePath of callers) {
@@ -3572,7 +3572,7 @@ var require_safe_stable_stringify = __commonJS({
3572
3572
  return circularValue;
3573
3573
  }
3574
3574
  let res = "";
3575
- let join53 = ",";
3575
+ let join54 = ",";
3576
3576
  const originalIndentation = indentation;
3577
3577
  if (Array.isArray(value)) {
3578
3578
  if (value.length === 0) {
@@ -3586,7 +3586,7 @@ var require_safe_stable_stringify = __commonJS({
3586
3586
  indentation += spacer;
3587
3587
  res += `
3588
3588
  ${indentation}`;
3589
- join53 = `,
3589
+ join54 = `,
3590
3590
  ${indentation}`;
3591
3591
  }
3592
3592
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -3594,13 +3594,13 @@ ${indentation}`;
3594
3594
  for (; i < maximumValuesToStringify - 1; i++) {
3595
3595
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3596
3596
  res += tmp2 !== void 0 ? tmp2 : "null";
3597
- res += join53;
3597
+ res += join54;
3598
3598
  }
3599
3599
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3600
3600
  res += tmp !== void 0 ? tmp : "null";
3601
3601
  if (value.length - 1 > maximumBreadth) {
3602
3602
  const removedKeys = value.length - maximumBreadth - 1;
3603
- res += `${join53}"... ${getItemCount(removedKeys)} not stringified"`;
3603
+ res += `${join54}"... ${getItemCount(removedKeys)} not stringified"`;
3604
3604
  }
3605
3605
  if (spacer !== "") {
3606
3606
  res += `
@@ -3621,7 +3621,7 @@ ${originalIndentation}`;
3621
3621
  let separator = "";
3622
3622
  if (spacer !== "") {
3623
3623
  indentation += spacer;
3624
- join53 = `,
3624
+ join54 = `,
3625
3625
  ${indentation}`;
3626
3626
  whitespace = " ";
3627
3627
  }
@@ -3635,13 +3635,13 @@ ${indentation}`;
3635
3635
  const tmp = stringifyFnReplacer(key3, value, stack, replacer, spacer, indentation);
3636
3636
  if (tmp !== void 0) {
3637
3637
  res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
3638
- separator = join53;
3638
+ separator = join54;
3639
3639
  }
3640
3640
  }
3641
3641
  if (keyLength > maximumBreadth) {
3642
3642
  const removedKeys = keyLength - maximumBreadth;
3643
3643
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
3644
- separator = join53;
3644
+ separator = join54;
3645
3645
  }
3646
3646
  if (spacer !== "" && separator.length > 1) {
3647
3647
  res = `
@@ -3682,7 +3682,7 @@ ${originalIndentation}`;
3682
3682
  }
3683
3683
  const originalIndentation = indentation;
3684
3684
  let res = "";
3685
- let join53 = ",";
3685
+ let join54 = ",";
3686
3686
  if (Array.isArray(value)) {
3687
3687
  if (value.length === 0) {
3688
3688
  return "[]";
@@ -3695,7 +3695,7 @@ ${originalIndentation}`;
3695
3695
  indentation += spacer;
3696
3696
  res += `
3697
3697
  ${indentation}`;
3698
- join53 = `,
3698
+ join54 = `,
3699
3699
  ${indentation}`;
3700
3700
  }
3701
3701
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -3703,13 +3703,13 @@ ${indentation}`;
3703
3703
  for (; i < maximumValuesToStringify - 1; i++) {
3704
3704
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3705
3705
  res += tmp2 !== void 0 ? tmp2 : "null";
3706
- res += join53;
3706
+ res += join54;
3707
3707
  }
3708
3708
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3709
3709
  res += tmp !== void 0 ? tmp : "null";
3710
3710
  if (value.length - 1 > maximumBreadth) {
3711
3711
  const removedKeys = value.length - maximumBreadth - 1;
3712
- res += `${join53}"... ${getItemCount(removedKeys)} not stringified"`;
3712
+ res += `${join54}"... ${getItemCount(removedKeys)} not stringified"`;
3713
3713
  }
3714
3714
  if (spacer !== "") {
3715
3715
  res += `
@@ -3722,7 +3722,7 @@ ${originalIndentation}`;
3722
3722
  let whitespace = "";
3723
3723
  if (spacer !== "") {
3724
3724
  indentation += spacer;
3725
- join53 = `,
3725
+ join54 = `,
3726
3726
  ${indentation}`;
3727
3727
  whitespace = " ";
3728
3728
  }
@@ -3731,7 +3731,7 @@ ${indentation}`;
3731
3731
  const tmp = stringifyArrayReplacer(key3, value[key3], stack, replacer, spacer, indentation);
3732
3732
  if (tmp !== void 0) {
3733
3733
  res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
3734
- separator = join53;
3734
+ separator = join54;
3735
3735
  }
3736
3736
  }
3737
3737
  if (spacer !== "" && separator.length > 1) {
@@ -3789,20 +3789,20 @@ ${originalIndentation}`;
3789
3789
  indentation += spacer;
3790
3790
  let res2 = `
3791
3791
  ${indentation}`;
3792
- const join54 = `,
3792
+ const join55 = `,
3793
3793
  ${indentation}`;
3794
3794
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3795
3795
  let i = 0;
3796
3796
  for (; i < maximumValuesToStringify - 1; i++) {
3797
3797
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3798
3798
  res2 += tmp2 !== void 0 ? tmp2 : "null";
3799
- res2 += join54;
3799
+ res2 += join55;
3800
3800
  }
3801
3801
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3802
3802
  res2 += tmp !== void 0 ? tmp : "null";
3803
3803
  if (value.length - 1 > maximumBreadth) {
3804
3804
  const removedKeys = value.length - maximumBreadth - 1;
3805
- res2 += `${join54}"... ${getItemCount(removedKeys)} not stringified"`;
3805
+ res2 += `${join55}"... ${getItemCount(removedKeys)} not stringified"`;
3806
3806
  }
3807
3807
  res2 += `
3808
3808
  ${originalIndentation}`;
@@ -3818,16 +3818,16 @@ ${originalIndentation}`;
3818
3818
  return '"[Object]"';
3819
3819
  }
3820
3820
  indentation += spacer;
3821
- const join53 = `,
3821
+ const join54 = `,
3822
3822
  ${indentation}`;
3823
3823
  let res = "";
3824
3824
  let separator = "";
3825
3825
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
3826
3826
  if (isTypedArrayWithEntries(value)) {
3827
- res += stringifyTypedArray(value, join53, maximumBreadth);
3827
+ res += stringifyTypedArray(value, join54, maximumBreadth);
3828
3828
  keys = keys.slice(value.length);
3829
3829
  maximumPropertiesToStringify -= value.length;
3830
- separator = join53;
3830
+ separator = join54;
3831
3831
  }
3832
3832
  if (deterministic) {
3833
3833
  keys = sort(keys, comparator);
@@ -3838,13 +3838,13 @@ ${indentation}`;
3838
3838
  const tmp = stringifyIndent(key3, value[key3], stack, spacer, indentation);
3839
3839
  if (tmp !== void 0) {
3840
3840
  res += `${separator}${strEscape(key3)}: ${tmp}`;
3841
- separator = join53;
3841
+ separator = join54;
3842
3842
  }
3843
3843
  }
3844
3844
  if (keyLength > maximumBreadth) {
3845
3845
  const removedKeys = keyLength - maximumBreadth;
3846
3846
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
3847
- separator = join53;
3847
+ separator = join54;
3848
3848
  }
3849
3849
  if (separator !== "") {
3850
3850
  res = `
@@ -4432,58 +4432,58 @@ var init_logger = __esm({
4432
4432
  });
4433
4433
 
4434
4434
  // ../engine/dist/core/paths.js
4435
- import { existsSync, mkdirSync, renameSync, readdirSync, statSync, copyFileSync, rmSync } from "fs";
4435
+ import { existsSync, mkdirSync as mkdirSync2, renameSync, readdirSync, statSync as statSync2, copyFileSync, rmSync } from "fs";
4436
4436
  import { homedir } from "os";
4437
- import { join, dirname } from "path";
4437
+ import { join as join2, dirname as dirname2 } from "path";
4438
4438
  function getDataDir() {
4439
4439
  const override = process.env.CHAT_RECALL_DATA_DIR;
4440
4440
  if (override && override.trim())
4441
4441
  return override.trim();
4442
- return join(homedir(), ".chat-recall");
4442
+ return join2(homedir(), ".chat-recall");
4443
4443
  }
4444
4444
  function getIndexDir() {
4445
4445
  ensureMigrated();
4446
- const p = join(getDataDir(), "index");
4446
+ const p = join2(getDataDir(), "index");
4447
4447
  ensureDir(p);
4448
4448
  return p;
4449
4449
  }
4450
4450
  function getWalDir() {
4451
- const p = join(getIndexDir(), "wal");
4451
+ const p = join2(getIndexDir(), "wal");
4452
4452
  ensureDir(p);
4453
4453
  return p;
4454
4454
  }
4455
4455
  function getDiaryDir() {
4456
- const p = join(getIndexDir(), "diary");
4456
+ const p = join2(getIndexDir(), "diary");
4457
4457
  ensureDir(p);
4458
4458
  return p;
4459
4459
  }
4460
4460
  function getDetectorBinDir() {
4461
- return join(getDataDir(), "bin");
4461
+ return join2(getDataDir(), "bin");
4462
4462
  }
4463
4463
  function getIdentityFilePath() {
4464
4464
  ensureMigrated();
4465
4465
  ensureDir(getDataDir());
4466
- return join(getDataDir(), "identity.txt");
4466
+ return join2(getDataDir(), "identity.txt");
4467
4467
  }
4468
4468
  function legacyRoot() {
4469
- return join(homedir(), ".claude");
4469
+ return join2(homedir(), ".claude");
4470
4470
  }
4471
4471
  function legacyMappings() {
4472
4472
  const root = legacyRoot();
4473
4473
  const newRoot = getDataDir();
4474
4474
  return [
4475
- { legacyPath: join(root, "chat-recall-cache.db"), newPath: join(newRoot, "cache.db"), isDir: false },
4476
- { legacyPath: join(root, "chat-recall-index"), newPath: join(newRoot, "index"), isDir: true },
4477
- { legacyPath: join(root, "chat-recall-memory"), newPath: join(newRoot, "memory"), isDir: true },
4478
- { legacyPath: join(root, "chat-recall-identity.txt"), newPath: join(newRoot, "identity.txt"), isDir: false },
4479
- { legacyPath: join(root, "chat-recall-hooks"), newPath: join(newRoot, "hooks"), isDir: true },
4475
+ { legacyPath: join2(root, "chat-recall-cache.db"), newPath: join2(newRoot, "cache.db"), isDir: false },
4476
+ { legacyPath: join2(root, "chat-recall-index"), newPath: join2(newRoot, "index"), isDir: true },
4477
+ { legacyPath: join2(root, "chat-recall-memory"), newPath: join2(newRoot, "memory"), isDir: true },
4478
+ { legacyPath: join2(root, "chat-recall-identity.txt"), newPath: join2(newRoot, "identity.txt"), isDir: false },
4479
+ { legacyPath: join2(root, "chat-recall-hooks"), newPath: join2(newRoot, "hooks"), isDir: true },
4480
4480
  // The legacy settings directory was named just "chat-recall" (no
4481
4481
  // suffix) — odd choice. Move it to a clearer "settings" subdir.
4482
- { legacyPath: join(root, "chat-recall"), newPath: join(newRoot, "settings"), isDir: true },
4482
+ { legacyPath: join2(root, "chat-recall"), newPath: join2(newRoot, "settings"), isDir: true },
4483
4483
  // SQLite WAL/SHM siblings — must move with their main .db so they don't
4484
4484
  // get re-created and stale-out the migrated cache.
4485
- { legacyPath: join(root, "chat-recall-cache.db-wal"), newPath: join(newRoot, "cache.db-wal"), isDir: false },
4486
- { legacyPath: join(root, "chat-recall-cache.db-shm"), newPath: join(newRoot, "cache.db-shm"), isDir: false }
4485
+ { legacyPath: join2(root, "chat-recall-cache.db-wal"), newPath: join2(newRoot, "cache.db-wal"), isDir: false },
4486
+ { legacyPath: join2(root, "chat-recall-cache.db-shm"), newPath: join2(newRoot, "cache.db-shm"), isDir: false }
4487
4487
  ];
4488
4488
  }
4489
4489
  function ensureMigrated() {
@@ -4508,7 +4508,7 @@ function ensureMigrated() {
4508
4508
  if (m.isDir)
4509
4509
  copyDir(m.legacyPath, m.newPath);
4510
4510
  else {
4511
- ensureDir(dirname(m.newPath));
4511
+ ensureDir(dirname2(m.newPath));
4512
4512
  copyFileSync(m.legacyPath, m.newPath);
4513
4513
  }
4514
4514
  rmSync(m.legacyPath, { recursive: true, force: true });
@@ -4524,14 +4524,14 @@ function ensureMigrated() {
4524
4524
  }
4525
4525
  function ensureDir(p) {
4526
4526
  if (!existsSync(p))
4527
- mkdirSync(p, { recursive: true });
4527
+ mkdirSync2(p, { recursive: true });
4528
4528
  }
4529
4529
  function copyDir(src, dest) {
4530
4530
  ensureDir(dest);
4531
4531
  for (const entry of readdirSync(src)) {
4532
- const srcPath = join(src, entry);
4533
- const destPath = join(dest, entry);
4534
- const st = statSync(srcPath);
4532
+ const srcPath = join2(src, entry);
4533
+ const destPath = join2(dest, entry);
4534
+ const st = statSync2(srcPath);
4535
4535
  if (st.isDirectory())
4536
4536
  copyDir(srcPath, destPath);
4537
4537
  else if (st.isFile())
@@ -4550,11 +4550,11 @@ var init_paths = __esm({
4550
4550
 
4551
4551
  // ../engine/dist/core/project-resolver.js
4552
4552
  import { execSync } from "child_process";
4553
- import { createHash } from "crypto";
4554
- import { existsSync as existsSync2, readFileSync, realpathSync, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
4555
- import { basename, dirname as dirname2, isAbsolute, join as join2, resolve, sep } from "path";
4553
+ import { createHash as createHash2 } from "crypto";
4554
+ import { existsSync as existsSync2, readFileSync, realpathSync, readdirSync as readdirSync2, statSync as statSync3 } from "fs";
4555
+ import { basename, dirname as dirname3, isAbsolute, join as join3, resolve, sep } from "path";
4556
4556
  function getProjectsConfigPath() {
4557
- return join2(getDataDir(), "projects.json");
4557
+ return join3(getDataDir(), "projects.json");
4558
4558
  }
4559
4559
  function loadProjectsConfig() {
4560
4560
  if (cachedConfig && cachedConfig.mtime === Number.MAX_SAFE_INTEGER) {
@@ -4565,7 +4565,7 @@ function loadProjectsConfig() {
4565
4565
  cachedConfig = { mtime: 0, cfg: {} };
4566
4566
  return cachedConfig.cfg;
4567
4567
  }
4568
- const mtime = statSync2(path).mtimeMs;
4568
+ const mtime = statSync3(path).mtimeMs;
4569
4569
  if (cachedConfig && cachedConfig.mtime === mtime)
4570
4570
  return cachedConfig.cfg;
4571
4571
  try {
@@ -4665,7 +4665,7 @@ function matchDeclaredProject(realPath, projects) {
4665
4665
  function matchChild(realPath, parentRoot, children) {
4666
4666
  const sorted = [...children].sort((a, b) => b.path.length - a.path.length);
4667
4667
  for (const c of sorted) {
4668
- const childRoot = safeRealpath(join2(parentRoot, c.path));
4668
+ const childRoot = safeRealpath(join3(parentRoot, c.path));
4669
4669
  if (isInside(realPath, childRoot))
4670
4670
  return c;
4671
4671
  }
@@ -4689,7 +4689,7 @@ function resolveGit(realPath) {
4689
4689
  if (probe.kind === "failed") {
4690
4690
  console.error(`[project] could not read git remotes in ${toplevel} \u2014 filing it as a local-only repo for now, which is probably wrong: ${probe.reason}`);
4691
4691
  }
4692
- const hash = createHash("sha1").update(toplevel).digest("hex").slice(0, 12);
4692
+ const hash = createHash2("sha1").update(toplevel).digest("hex").slice(0, 12);
4693
4693
  return {
4694
4694
  id: `git-local:${hash}`,
4695
4695
  displayName: basename(toplevel),
@@ -4700,10 +4700,10 @@ function findGitToplevel(realPath) {
4700
4700
  let cur = realPath;
4701
4701
  let last = "";
4702
4702
  while (cur && cur !== last) {
4703
- if (existsSync2(join2(cur, ".git")))
4703
+ if (existsSync2(join3(cur, ".git")))
4704
4704
  return cur;
4705
4705
  last = cur;
4706
- cur = dirname2(cur);
4706
+ cur = dirname3(cur);
4707
4707
  }
4708
4708
  return null;
4709
4709
  }
@@ -4767,7 +4767,7 @@ function resolveAutoWorkspace(realPath, minRepos) {
4767
4767
  let last = "";
4768
4768
  let depth = 0;
4769
4769
  while (cur && cur !== last && depth < AUTO_WORKSPACE_MAX_DEPTH) {
4770
- if (!existsSync2(join2(cur, ".git"))) {
4770
+ if (!existsSync2(join3(cur, ".git"))) {
4771
4771
  const cached = workspaceCache.get(cur);
4772
4772
  let qualifies;
4773
4773
  if (cached === void 0) {
@@ -4782,7 +4782,7 @@ function resolveAutoWorkspace(realPath, minRepos) {
4782
4782
  }
4783
4783
  }
4784
4784
  last = cur;
4785
- cur = dirname2(cur);
4785
+ cur = dirname3(cur);
4786
4786
  depth++;
4787
4787
  }
4788
4788
  return null;
@@ -4798,12 +4798,12 @@ function countGitChildren(dir) {
4798
4798
  for (const name of entries) {
4799
4799
  if (name.startsWith("."))
4800
4800
  continue;
4801
- const child = join2(dir, name);
4801
+ const child = join3(dir, name);
4802
4802
  try {
4803
- const st = statSync2(child);
4803
+ const st = statSync3(child);
4804
4804
  if (!st.isDirectory())
4805
4805
  continue;
4806
- if (existsSync2(join2(child, ".git")))
4806
+ if (existsSync2(join3(child, ".git")))
4807
4807
  count++;
4808
4808
  } catch {
4809
4809
  }
@@ -5084,9 +5084,9 @@ __export(settings_exports, {
5084
5084
  saveSettings: () => saveSettings,
5085
5085
  settingsFilePath: () => settingsFilePath
5086
5086
  });
5087
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync, chmodSync, statSync as statSync3 } from "fs";
5087
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync, chmodSync as chmodSync2, statSync as statSync4 } from "fs";
5088
5088
  import { delimiter } from "path";
5089
- import { dirname as dirname3, join as join3 } from "path";
5089
+ import { dirname as dirname4, join as join4 } from "path";
5090
5090
  function whichSync(bin) {
5091
5091
  const path = process.env.PATH;
5092
5092
  if (!path)
@@ -5094,9 +5094,9 @@ function whichSync(bin) {
5094
5094
  for (const dir of path.split(delimiter)) {
5095
5095
  if (!dir)
5096
5096
  continue;
5097
- const full = join3(dir, bin);
5097
+ const full = join4(dir, bin);
5098
5098
  try {
5099
- const s = statSync3(full);
5099
+ const s = statSync4(full);
5100
5100
  if (s.isFile())
5101
5101
  return true;
5102
5102
  } catch {
@@ -5284,12 +5284,12 @@ function settingsFilePath() {
5284
5284
  return settingsPath();
5285
5285
  }
5286
5286
  function settingsPath() {
5287
- return join3(getDataDir(), "settings", "settings.json");
5287
+ return join4(getDataDir(), "settings", "settings.json");
5288
5288
  }
5289
5289
  function loadSourceSettings() {
5290
5290
  let mtimeMs = -1;
5291
5291
  try {
5292
- mtimeMs = statSync3(settingsPath()).mtimeMs;
5292
+ mtimeMs = statSync4(settingsPath()).mtimeMs;
5293
5293
  } catch {
5294
5294
  }
5295
5295
  if (_sourceSettingsCache && _sourceSettingsCache.mtimeMs === mtimeMs) {
@@ -5313,7 +5313,7 @@ function _resetSourceSettingsCache() {
5313
5313
  _sourceSettingsCache = null;
5314
5314
  }
5315
5315
  function secretsPath() {
5316
- return join3(getDataDir(), "secrets.env");
5316
+ return join4(getDataDir(), "secrets.env");
5317
5317
  }
5318
5318
  function _resetSecretsCacheForTests() {
5319
5319
  _secretsCache = null;
@@ -5325,7 +5325,7 @@ function loadSecrets() {
5325
5325
  return out;
5326
5326
  let mtimeMs = -1, size = -1;
5327
5327
  try {
5328
- const st = statSync3(p);
5328
+ const st = statSync4(p);
5329
5329
  mtimeMs = st.mtimeMs;
5330
5330
  size = st.size;
5331
5331
  } catch {
@@ -5357,11 +5357,11 @@ function loadSecrets() {
5357
5357
  function writeSecrets(secrets) {
5358
5358
  _secretsCache = null;
5359
5359
  const p = secretsPath();
5360
- mkdirSync2(dirname3(p), { recursive: true });
5360
+ mkdirSync3(dirname4(p), { recursive: true });
5361
5361
  const body = "# chat-recall secrets \u2014 NOT committed/synced. Mode 0600.\n" + Object.entries(secrets).filter(([, v]) => v).map(([k, v]) => `${k}=${v}`).join("\n") + "\n";
5362
5362
  writeFileSync(p, body);
5363
5363
  try {
5364
- chmodSync(p, 384);
5364
+ chmodSync2(p, 384);
5365
5365
  } catch {
5366
5366
  }
5367
5367
  }
@@ -5384,7 +5384,7 @@ function loadSettings() {
5384
5384
  return freshDefaults();
5385
5385
  let mtimeMs = -1, size = -1;
5386
5386
  try {
5387
- const st = statSync3(path);
5387
+ const st = statSync4(path);
5388
5388
  mtimeMs = st.mtimeMs;
5389
5389
  size = st.size;
5390
5390
  } catch {
@@ -5430,10 +5430,10 @@ function saveSettings(settings2) {
5430
5430
  }
5431
5431
  writeSecrets(secrets);
5432
5432
  const path = settingsPath();
5433
- mkdirSync2(dirname3(path), { recursive: true });
5433
+ mkdirSync3(dirname4(path), { recursive: true });
5434
5434
  writeFileSync(path, JSON.stringify(stripped, null, 2));
5435
5435
  try {
5436
- chmodSync(path, 384);
5436
+ chmodSync2(path, 384);
5437
5437
  } catch {
5438
5438
  }
5439
5439
  }
@@ -5572,9 +5572,9 @@ var init_settings = __esm({
5572
5572
  // ../engine/dist/core/home-approval.js
5573
5573
  import { existsSync as existsSync4, readdirSync as readdirSync3, realpathSync as realpathSync2 } from "fs";
5574
5574
  import { homedir as homedir2 } from "os";
5575
- import { join as join4, dirname as dirname4 } from "path";
5575
+ import { join as join5, dirname as dirname5 } from "path";
5576
5576
  function normalizeHomePath(p) {
5577
- const expanded = p.startsWith("~") ? join4(homedir2(), p.slice(1)) : p;
5577
+ const expanded = p.startsWith("~") ? join5(homedir2(), p.slice(1)) : p;
5578
5578
  const trimmed = expanded.replace(/[/\\]+$/, "");
5579
5579
  try {
5580
5580
  return realpathSync2(trimmed);
@@ -5586,23 +5586,23 @@ function legacyAutoSyncedHomes() {
5586
5586
  const home = homedir2();
5587
5587
  const out = [];
5588
5588
  const add = (dir, marker) => {
5589
- if (!existsSync4(join4(dir, marker)))
5589
+ if (!existsSync4(join5(dir, marker)))
5590
5590
  return;
5591
5591
  const n = normalizeHomePath(dir);
5592
5592
  if (!out.includes(n))
5593
5593
  out.push(n);
5594
5594
  };
5595
5595
  const bases = [
5596
- { base: join4(home, ".claude"), marker: "projects" },
5597
- { base: join4(home, ".gemini"), marker: "tmp" },
5598
- { base: join4(home, ".codex"), marker: "sessions" },
5599
- { base: join4(home, ".gemini", "antigravity-cli"), marker: "brain" },
5600
- { base: join4(home, ".local", "share", "opencode"), marker: "opencode.db" },
5601
- { base: join4(home, ".cursor"), marker: "chats" }
5596
+ { base: join5(home, ".claude"), marker: "projects" },
5597
+ { base: join5(home, ".gemini"), marker: "tmp" },
5598
+ { base: join5(home, ".codex"), marker: "sessions" },
5599
+ { base: join5(home, ".gemini", "antigravity-cli"), marker: "brain" },
5600
+ { base: join5(home, ".local", "share", "opencode"), marker: "opencode.db" },
5601
+ { base: join5(home, ".cursor"), marker: "chats" }
5602
5602
  ];
5603
5603
  for (const { base, marker } of bases) {
5604
5604
  add(base, marker);
5605
- const parent = dirname4(base);
5605
+ const parent = dirname5(base);
5606
5606
  const leaf = base.slice(parent.length + 1);
5607
5607
  try {
5608
5608
  for (const e of readdirSync3(parent, { withFileTypes: true })) {
@@ -5612,7 +5612,7 @@ function legacyAutoSyncedHomes() {
5612
5612
  continue;
5613
5613
  if (e.name === ".claude-code")
5614
5614
  continue;
5615
- add(join4(parent, e.name), marker);
5615
+ add(join5(parent, e.name), marker);
5616
5616
  }
5617
5617
  } catch {
5618
5618
  }
@@ -5655,13 +5655,13 @@ function primaryHomes() {
5655
5655
  } catch {
5656
5656
  s = void 0;
5657
5657
  }
5658
- const opencodeDb = env.CHAT_RECALL_OPENCODE_DB || s?.opencodeDbPath || join4(home, ".local", "share", "opencode", "opencode.db");
5658
+ const opencodeDb = env.CHAT_RECALL_OPENCODE_DB || s?.opencodeDbPath || join5(home, ".local", "share", "opencode", "opencode.db");
5659
5659
  const candidates2 = [
5660
- env.CHAT_RECALL_CLAUDE_HOME || s?.claudeHome || join4(home, ".claude"),
5661
- env.CHAT_RECALL_GEMINI_HOME || s?.geminiHome || join4(home, ".gemini"),
5662
- env.CHAT_RECALL_CODEX_HOME || s?.codexHome || join4(home, ".codex"),
5663
- env.CHAT_RECALL_AGY_HOME || s?.agyHome || join4(home, ".gemini", "antigravity-cli"),
5664
- env.CHAT_RECALL_CURSOR_HOME || s?.cursorHome || join4(home, ".cursor"),
5660
+ env.CHAT_RECALL_CLAUDE_HOME || s?.claudeHome || join5(home, ".claude"),
5661
+ env.CHAT_RECALL_GEMINI_HOME || s?.geminiHome || join5(home, ".gemini"),
5662
+ env.CHAT_RECALL_CODEX_HOME || s?.codexHome || join5(home, ".codex"),
5663
+ env.CHAT_RECALL_AGY_HOME || s?.agyHome || join5(home, ".gemini", "antigravity-cli"),
5664
+ env.CHAT_RECALL_CURSOR_HOME || s?.cursorHome || join5(home, ".cursor"),
5665
5665
  dirOf(opencodeDb)
5666
5666
  ];
5667
5667
  return candidates2.map(normalizeHomePath);
@@ -5721,22 +5721,22 @@ var init_home_approval = __esm({
5721
5721
  "../engine/dist/core/home-approval.js"() {
5722
5722
  "use strict";
5723
5723
  init_settings();
5724
- dirOf = (filePath) => dirname4(filePath);
5724
+ dirOf = (filePath) => dirname5(filePath);
5725
5725
  }
5726
5726
  });
5727
5727
 
5728
5728
  // ../engine/dist/core/tool-paths.js
5729
5729
  import { existsSync as existsSync5, readdirSync as readdirSync4 } from "fs";
5730
5730
  import { homedir as homedir3 } from "os";
5731
- import { join as join5, dirname as dirname5, basename as basename2 } from "path";
5731
+ import { join as join6, dirname as dirname6, basename as basename2 } from "path";
5732
5732
  function claudeHomeDir() {
5733
- return process.env.CHAT_RECALL_CLAUDE_HOME || sources().claudeHome || join5(homedir3(), ".claude");
5733
+ return process.env.CHAT_RECALL_CLAUDE_HOME || sources().claudeHome || join6(homedir3(), ".claude");
5734
5734
  }
5735
5735
  function claudeProjectDirs(opts = {}) {
5736
5736
  const home = homedir3();
5737
5737
  const dirs = [];
5738
5738
  const addHome = (d) => {
5739
- const p = join5(d, "projects");
5739
+ const p = join6(d, "projects");
5740
5740
  if (existsSync5(p) && !dirs.includes(p))
5741
5741
  dirs.push(p);
5742
5742
  };
@@ -5746,7 +5746,7 @@ function claudeProjectDirs(opts = {}) {
5746
5746
  try {
5747
5747
  for (const entry of readdirSync4(home, { withFileTypes: true })) {
5748
5748
  if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
5749
- addHome(join5(home, entry.name));
5749
+ addHome(join6(home, entry.name));
5750
5750
  }
5751
5751
  }
5752
5752
  } catch {
@@ -5756,44 +5756,44 @@ function claudeProjectDirs(opts = {}) {
5756
5756
  for (const d of process.env.CLAUDE_DIRS.split(",")) {
5757
5757
  const t = d.trim();
5758
5758
  if (t)
5759
- addHome(t.startsWith("~/") ? join5(home, t.slice(2)) : t);
5759
+ addHome(t.startsWith("~/") ? join6(home, t.slice(2)) : t);
5760
5760
  }
5761
5761
  }
5762
5762
  if (dirs.length === 0)
5763
- dirs.push(join5(claudeHomeDir(), "projects"));
5763
+ dirs.push(join6(claudeHomeDir(), "projects"));
5764
5764
  return applyDecisions(dirs, opts.includeExcluded);
5765
5765
  }
5766
5766
  function _setSourceExclusionFilter(fn) {
5767
5767
  _sourceExclusionFilter = fn;
5768
5768
  }
5769
5769
  function geminiHomeDir() {
5770
- return process.env.CHAT_RECALL_GEMINI_HOME || sources().geminiHome || join5(homedir3(), ".gemini");
5770
+ return process.env.CHAT_RECALL_GEMINI_HOME || sources().geminiHome || join6(homedir3(), ".gemini");
5771
5771
  }
5772
5772
  function opencodeDbPath() {
5773
- return process.env.CHAT_RECALL_OPENCODE_DB || sources().opencodeDbPath || join5(homedir3(), ".local", "share", "opencode", "opencode.db");
5773
+ return process.env.CHAT_RECALL_OPENCODE_DB || sources().opencodeDbPath || join6(homedir3(), ".local", "share", "opencode", "opencode.db");
5774
5774
  }
5775
5775
  function codexHomeDir() {
5776
- return process.env.CHAT_RECALL_CODEX_HOME || sources().codexHome || join5(homedir3(), ".codex");
5776
+ return process.env.CHAT_RECALL_CODEX_HOME || sources().codexHome || join6(homedir3(), ".codex");
5777
5777
  }
5778
5778
  function agyHomeDir() {
5779
- return process.env.CHAT_RECALL_AGY_HOME || sources().agyHome || join5(homedir3(), ".gemini", "antigravity-cli");
5779
+ return process.env.CHAT_RECALL_AGY_HOME || sources().agyHome || join6(homedir3(), ".gemini", "antigravity-cli");
5780
5780
  }
5781
5781
  function cursorHomeDir() {
5782
- return process.env.CHAT_RECALL_CURSOR_HOME || sources().cursorHome || join5(homedir3(), ".cursor");
5782
+ return process.env.CHAT_RECALL_CURSOR_HOME || sources().cursorHome || join6(homedir3(), ".cursor");
5783
5783
  }
5784
5784
  function cursorIdeHomeDir() {
5785
- return process.env.CHAT_RECALL_CURSOR_IDE_HOME || sources().cursorIdeHome || (process.platform === "darwin" ? join5(homedir3(), "Library", "Application Support", "Cursor") : join5(homedir3(), ".config", "Cursor"));
5785
+ return process.env.CHAT_RECALL_CURSOR_IDE_HOME || sources().cursorIdeHome || (process.platform === "darwin" ? join6(homedir3(), "Library", "Application Support", "Cursor") : join6(homedir3(), ".config", "Cursor"));
5786
5786
  }
5787
5787
  function siblingHomes(base, overridden, suffix) {
5788
5788
  const roots = [];
5789
5789
  const add = (home) => {
5790
- const root = suffix ? join5(home, suffix) : home;
5790
+ const root = suffix ? join6(home, suffix) : home;
5791
5791
  if (existsSync5(root) && !roots.includes(root))
5792
5792
  roots.push(root);
5793
5793
  };
5794
5794
  add(base);
5795
5795
  if (!overridden) {
5796
- const parent = dirname5(base);
5796
+ const parent = dirname6(base);
5797
5797
  const leaf = basename2(base);
5798
5798
  try {
5799
5799
  for (const entry of readdirSync4(parent, { withFileTypes: true })) {
@@ -5801,7 +5801,7 @@ function siblingHomes(base, overridden, suffix) {
5801
5801
  continue;
5802
5802
  if (entry.name === leaf || !entry.name.startsWith(leaf + "-"))
5803
5803
  continue;
5804
- add(join5(parent, entry.name));
5804
+ add(join6(parent, entry.name));
5805
5805
  }
5806
5806
  } catch {
5807
5807
  }
@@ -5815,7 +5815,7 @@ function applyDecisions(roots, includeExcluded) {
5815
5815
  if (!includeExcluded) {
5816
5816
  try {
5817
5817
  grandfatherLegacyHomes();
5818
- const approved = kept.filter((r) => isHomeSynced(dirname5(r)));
5818
+ const approved = kept.filter((r) => isHomeSynced(dirname6(r)));
5819
5819
  if (approved.length > 0)
5820
5820
  kept = approved;
5821
5821
  } catch {
@@ -5849,14 +5849,14 @@ function cursorChatDirs(opts = {}) {
5849
5849
  }
5850
5850
  function cursorIdeWorkspaceDirs(opts = {}) {
5851
5851
  const overridden = !!(process.env.CHAT_RECALL_CURSOR_IDE_HOME || sources().cursorIdeHome);
5852
- return applyExclusions(siblingHomes(cursorIdeHomeDir(), overridden, join5("User", "workspaceStorage")), opts.includeExcluded);
5852
+ return applyExclusions(siblingHomes(cursorIdeHomeDir(), overridden, join6("User", "workspaceStorage")), opts.includeExcluded);
5853
5853
  }
5854
5854
  function cursorIdeGlobalDbs(opts = {}) {
5855
5855
  const overridden = !!(process.env.CHAT_RECALL_CURSOR_IDE_HOME || sources().cursorIdeHome);
5856
- const roots = applyExclusions(siblingHomes(cursorIdeHomeDir(), overridden, join5("User", "globalStorage")), opts.includeExcluded);
5856
+ const roots = applyExclusions(siblingHomes(cursorIdeHomeDir(), overridden, join6("User", "globalStorage")), opts.includeExcluded);
5857
5857
  const dbs = [];
5858
5858
  for (const r of roots) {
5859
- const p = join5(r, "state.vscdb");
5859
+ const p = join6(r, "state.vscdb");
5860
5860
  if (existsSync5(p) && !dbs.includes(p))
5861
5861
  dbs.push(p);
5862
5862
  }
@@ -5866,10 +5866,10 @@ function opencodeDbPaths(opts = {}) {
5866
5866
  const primary = opencodeDbPath();
5867
5867
  const overridden = !!(process.env.CHAT_RECALL_OPENCODE_DB || sources().opencodeDbPath);
5868
5868
  const dbFile = basename2(primary);
5869
- const dirs = siblingHomes(dirname5(primary), overridden, "");
5869
+ const dirs = siblingHomes(dirname6(primary), overridden, "");
5870
5870
  const dbs = [];
5871
5871
  for (const d of dirs) {
5872
- const p = join5(d, dbFile);
5872
+ const p = join6(d, dbFile);
5873
5873
  if (existsSync5(p) && !dbs.includes(p))
5874
5874
  dbs.push(p);
5875
5875
  }
@@ -5903,7 +5903,7 @@ var init_tool_paths = __esm({
5903
5903
  });
5904
5904
 
5905
5905
  // ../engine/dist/core/secret-redactor.js
5906
- import { statSync as statSync4 } from "fs";
5906
+ import { statSync as statSync5 } from "fs";
5907
5907
  function secretOf(rule, m) {
5908
5908
  const raw = rule.secret != null ? m[rule.secret] : m[0];
5909
5909
  if (raw == null)
@@ -5961,7 +5961,7 @@ function isEnvRedactionRequested() {
5961
5961
  function settingsView() {
5962
5962
  let mtimeMs = -1;
5963
5963
  try {
5964
- mtimeMs = statSync4(settingsFilePath()).mtimeMs;
5964
+ mtimeMs = statSync5(settingsFilePath()).mtimeMs;
5965
5965
  } catch {
5966
5966
  }
5967
5967
  if (cache && cache.mtimeMs === mtimeMs)
@@ -6132,7 +6132,7 @@ function scanTextForFindings(text, opts = {}) {
6132
6132
  function privacyView() {
6133
6133
  let mtimeMs = -1;
6134
6134
  try {
6135
- mtimeMs = statSync4(settingsFilePath()).mtimeMs;
6135
+ mtimeMs = statSync5(settingsFilePath()).mtimeMs;
6136
6136
  } catch {
6137
6137
  }
6138
6138
  if (privacyCache && privacyCache.mtimeMs === mtimeMs)
@@ -6697,9 +6697,9 @@ var init_model_pricing = __esm({
6697
6697
  });
6698
6698
 
6699
6699
  // ../engine/dist/parsers/session.js
6700
- import { createReadStream, existsSync as existsSync6, readdirSync as readdirSync6, readFileSync as readFileSync3, statSync as statSync5, openSync, readSync, closeSync } from "fs";
6700
+ import { createReadStream, existsSync as existsSync6, readdirSync as readdirSync6, readFileSync as readFileSync3, statSync as statSync6, openSync, readSync, closeSync } from "fs";
6701
6701
  import { createInterface } from "readline";
6702
- import { join as join6, basename as basename3 } from "path";
6702
+ import { join as join7, basename as basename3 } from "path";
6703
6703
  function removeCodeBlocks(text) {
6704
6704
  let result = text.replace(/```[\s\S]*?```/g, "[code block]");
6705
6705
  result = result.replace(/`[^`]+`/g, "[code]");
@@ -6772,8 +6772,8 @@ function* iterAllSessionIndices(claudeDir) {
6772
6772
  for (const entry of entries) {
6773
6773
  if (!entry.isDirectory())
6774
6774
  continue;
6775
- const projectDir = join6(dir, entry.name);
6776
- const indexPath = join6(projectDir, "sessions-index.json");
6775
+ const projectDir = join7(dir, entry.name);
6776
+ const indexPath = join7(projectDir, "sessions-index.json");
6777
6777
  if (existsSync6(indexPath)) {
6778
6778
  const sessions = parseSessionsIndex(indexPath);
6779
6779
  if (sessions.length > 0) {
@@ -6784,13 +6784,13 @@ function* iterAllSessionIndices(claudeDir) {
6784
6784
  }
6785
6785
  function hasSubagentsDir(sessionPath) {
6786
6786
  const dir = sessionPath.slice(0, -6);
6787
- return existsSync6(join6(dir, "subagents"));
6787
+ return existsSync6(join7(dir, "subagents"));
6788
6788
  }
6789
6789
  function getSubagentPaths(sessionPath) {
6790
- const subagentsDir = join6(sessionPath.slice(0, -6), "subagents");
6790
+ const subagentsDir = join7(sessionPath.slice(0, -6), "subagents");
6791
6791
  if (!existsSync6(subagentsDir))
6792
6792
  return [];
6793
- return readdirSync6(subagentsDir).filter((f) => f.endsWith(".jsonl")).sort().map((f) => join6(subagentsDir, f));
6793
+ return readdirSync6(subagentsDir).filter((f) => f.endsWith(".jsonl")).sort().map((f) => join7(subagentsDir, f));
6794
6794
  }
6795
6795
  function getSubagentProjectPath(sessionPath, folderDerivedPath) {
6796
6796
  const subagentPaths = getSubagentPaths(sessionPath);
@@ -6857,12 +6857,12 @@ function readCwdFromJsonl(sessionPath) {
6857
6857
  function getSessionMtime(sessionPath) {
6858
6858
  const subagentPaths = getSubagentPaths(sessionPath);
6859
6859
  if (subagentPaths.length === 0) {
6860
- return statSync5(sessionPath).mtimeMs;
6860
+ return statSync6(sessionPath).mtimeMs;
6861
6861
  }
6862
- let maxMtime = statSync5(sessionPath).mtimeMs;
6862
+ let maxMtime = statSync6(sessionPath).mtimeMs;
6863
6863
  for (const p of subagentPaths) {
6864
6864
  try {
6865
- const m = statSync5(p).mtimeMs;
6865
+ const m = statSync6(p).mtimeMs;
6866
6866
  if (m > maxMtime)
6867
6867
  maxMtime = m;
6868
6868
  } catch {
@@ -7125,7 +7125,7 @@ function* getAllSessions(claudeDir) {
7125
7125
  for (const projDirEntry of dirEntries) {
7126
7126
  if (!projDirEntry.isDirectory())
7127
7127
  continue;
7128
- const projectPath = join6(dir, projDirEntry.name);
7128
+ const projectPath = join7(dir, projDirEntry.name);
7129
7129
  const files = readdirSync6(projectPath);
7130
7130
  for (const file of files) {
7131
7131
  if (!file.endsWith(".jsonl"))
@@ -7137,9 +7137,9 @@ function* getAllSessions(claudeDir) {
7137
7137
  const sessionId = basename3(file, ".jsonl");
7138
7138
  if (seenSessionIds.has(sessionId))
7139
7139
  continue;
7140
- const fullPath = join6(projectPath, file);
7140
+ const fullPath = join7(projectPath, file);
7141
7141
  try {
7142
- const stat3 = statSync5(fullPath);
7142
+ const stat3 = statSync6(fullPath);
7143
7143
  const derivedProjectPath = resolveProjectDirName(projDirEntry.name);
7144
7144
  const effectiveMtime = getSessionMtime(fullPath);
7145
7145
  let projectPath2 = "";
@@ -7186,7 +7186,7 @@ var init_session = __esm({
7186
7186
 
7187
7187
  // ../engine/dist/transcript/claude.js
7188
7188
  import { open, readdir, readFile, stat } from "fs/promises";
7189
- import { dirname as dirname6, join as join7, basename as basename4 } from "path";
7189
+ import { dirname as dirname7, join as join8, basename as basename4 } from "path";
7190
7190
  function stripBanners(text) {
7191
7191
  let out = text;
7192
7192
  for (const re of INJECTED_BANNERS2)
@@ -7303,7 +7303,7 @@ function messagesFromRawLines(raw) {
7303
7303
  }
7304
7304
  async function parseClaudeSubagents(sessionPath) {
7305
7305
  const sessionId = basename4(sessionPath).replace(/\.jsonl$/i, "");
7306
- const subagentsDir = join7(dirname6(sessionPath), sessionId, "subagents");
7306
+ const subagentsDir = join8(dirname7(sessionPath), sessionId, "subagents");
7307
7307
  let entries;
7308
7308
  try {
7309
7309
  entries = await readdir(subagentsDir);
@@ -7313,12 +7313,12 @@ async function parseClaudeSubagents(sessionPath) {
7313
7313
  const jsonlFiles = entries.filter((e) => e.endsWith(".jsonl"));
7314
7314
  const subagents = [];
7315
7315
  for (const fileName of jsonlFiles) {
7316
- const filePath = join7(subagentsDir, fileName);
7316
+ const filePath = join8(subagentsDir, fileName);
7317
7317
  const id = fileName.replace(/\.jsonl$/i, "");
7318
7318
  const kind = id.includes("acompact") ? "compact" : id.includes("aside_question") ? "aside" : id.includes("explore") || /^agent-a[0-9a-f]{16,}$/i.test(id) ? "explore" : "other";
7319
7319
  let agentType;
7320
7320
  let description;
7321
- const metaPath = join7(subagentsDir, `${id}.meta.json`);
7321
+ const metaPath = join8(subagentsDir, `${id}.meta.json`);
7322
7322
  try {
7323
7323
  const metaRaw = await readFile(metaPath, "utf-8");
7324
7324
  const meta = JSON.parse(metaRaw);
@@ -7441,9 +7441,9 @@ var init_gemini = __esm({
7441
7441
 
7442
7442
  // ../engine/dist/transcript/codex.js
7443
7443
  import { open as open2, readdir as readdir2, stat as stat2 } from "fs/promises";
7444
- import { dirname as dirname7, join as join8, basename as basename5 } from "path";
7444
+ import { dirname as dirname8, join as join9, basename as basename5 } from "path";
7445
7445
  async function parseCodexSubagents(sessionPath) {
7446
- const dayDir = dirname7(sessionPath);
7446
+ const dayDir = dirname8(sessionPath);
7447
7447
  const parentId = basename5(sessionPath).match(/([a-f0-9-]{36})\.jsonl$/i)?.[1];
7448
7448
  if (!parentId)
7449
7449
  return [];
@@ -7457,7 +7457,7 @@ async function parseCodexSubagents(sessionPath) {
7457
7457
  for (const fileName of entries) {
7458
7458
  if (!fileName.endsWith(".jsonl") || !fileName.startsWith("rollout-"))
7459
7459
  continue;
7460
- const filePath = join8(dayDir, fileName);
7460
+ const filePath = join9(dayDir, fileName);
7461
7461
  if (filePath === sessionPath)
7462
7462
  continue;
7463
7463
  let firstLine = "";
@@ -7678,7 +7678,7 @@ __export(raw_exports, {
7678
7678
  parseTranscriptFromContainer: () => parseTranscriptFromContainer
7679
7679
  });
7680
7680
  import { gzipSync, gunzipSync } from "zlib";
7681
- import { createHash as createHash2 } from "crypto";
7681
+ import { createHash as createHash3 } from "crypto";
7682
7682
  import * as fsMod from "fs";
7683
7683
  import * as pathMod from "path";
7684
7684
  function buildRawContainer(exp) {
@@ -7690,7 +7690,7 @@ function buildRawContainer(exp) {
7690
7690
  };
7691
7691
  }
7692
7692
  function containerSrcHash(c) {
7693
- const h = createHash2("sha1");
7693
+ const h = createHash3("sha1");
7694
7694
  h.update(c.tool);
7695
7695
  for (const f of c.files) {
7696
7696
  h.update("\0");
@@ -7839,7 +7839,7 @@ async function archiveRawSession(store2, sessionId) {
7839
7839
  }
7840
7840
  function detectForkPredecessor(sessionPath) {
7841
7841
  const { readFileSync: readFileSync44, readdirSync: readdirSync36 } = requireFs();
7842
- const { dirname: dirname20, join: join53, basename: basename25 } = requirePath();
7842
+ const { dirname: dirname21, join: join54, basename: basename25 } = requirePath();
7843
7843
  let text;
7844
7844
  try {
7845
7845
  text = readFileSync44(sessionPath, "utf-8");
@@ -7864,7 +7864,7 @@ function detectForkPredecessor(sessionPath) {
7864
7864
  return null;
7865
7865
  if (text.includes(`"uuid":"${headParent}"`))
7866
7866
  return null;
7867
- const dir = dirname20(sessionPath);
7867
+ const dir = dirname21(sessionPath);
7868
7868
  const self = basename25(sessionPath);
7869
7869
  let entries;
7870
7870
  try {
@@ -7876,7 +7876,7 @@ function detectForkPredecessor(sessionPath) {
7876
7876
  if (!f.endsWith(".jsonl") || f === self || f === "sessions-index.json")
7877
7877
  continue;
7878
7878
  try {
7879
- if (readFileSync44(join53(dir, f), "utf-8").includes(`"uuid":"${headParent}"`)) {
7879
+ if (readFileSync44(join54(dir, f), "utf-8").includes(`"uuid":"${headParent}"`)) {
7880
7880
  return basename25(f, ".jsonl");
7881
7881
  }
7882
7882
  } catch {
@@ -7903,15 +7903,15 @@ var init_raw = __esm({
7903
7903
 
7904
7904
  // ../engine/dist/transcript/shadow.js
7905
7905
  import { gzipSync as gzipSync2, gunzipSync as gunzipSync2 } from "zlib";
7906
- import { createHash as createHash3 } from "crypto";
7907
- import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync2, renameSync as renameSync2, statSync as statSync6 } from "fs";
7908
- import { dirname as dirname8, join as join9 } from "path";
7906
+ import { createHash as createHash4 } from "crypto";
7907
+ import { existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2, renameSync as renameSync2, statSync as statSync7 } from "fs";
7908
+ import { dirname as dirname9, join as join10 } from "path";
7909
7909
  function shadowRoot() {
7910
- return join9(getDataDir(), "shadow");
7910
+ return join10(getDataDir(), "shadow");
7911
7911
  }
7912
7912
  function shadowFileFor(tool, rawId) {
7913
7913
  const safe = rawId.replace(/[^A-Za-z0-9._-]/g, "_");
7914
- return join9(shadowRoot(), tool, `${safe}.gz`);
7914
+ return join10(shadowRoot(), tool, `${safe}.gz`);
7915
7915
  }
7916
7916
  function readShadowContainer(tool, rawId) {
7917
7917
  const path = shadowFileFor(tool, rawId);
@@ -7927,14 +7927,14 @@ function readShadowContainer(tool, rawId) {
7927
7927
  }
7928
7928
  function writeShadowContainer(tool, rawId, container) {
7929
7929
  const path = shadowFileFor(tool, rawId);
7930
- mkdirSync3(dirname8(path), { recursive: true });
7930
+ mkdirSync4(dirname9(path), { recursive: true });
7931
7931
  const gz = gzipSync2(JSON.stringify(container), { level: 6 });
7932
7932
  const tmp = `${path}.tmp-${process.pid}`;
7933
7933
  writeFileSync2(tmp, gz);
7934
7934
  renameSync2(tmp, path);
7935
7935
  }
7936
7936
  function sha1(s) {
7937
- return createHash3("sha1").update(s).digest("hex");
7937
+ return createHash4("sha1").update(s).digest("hex");
7938
7938
  }
7939
7939
  function lineKey(line) {
7940
7940
  try {
@@ -8092,11 +8092,11 @@ var init_shadow = __esm({
8092
8092
  });
8093
8093
 
8094
8094
  // ../engine/dist/core/live-session-scan.js
8095
- import { existsSync as existsSync8, readdirSync as readdirSync7, readFileSync as readFileSync5, statSync as statSync7, openSync as openSync2, readSync as readSync2, closeSync as closeSync2 } from "fs";
8096
- import { join as join10, basename as basename6 } from "path";
8097
- import { createHash as createHash4 } from "crypto";
8095
+ import { existsSync as existsSync8, readdirSync as readdirSync7, readFileSync as readFileSync5, statSync as statSync8, openSync as openSync2, readSync as readSync2, closeSync as closeSync2 } from "fs";
8096
+ import { join as join11, basename as basename6 } from "path";
8097
+ import { createHash as createHash5 } from "crypto";
8098
8098
  function lazyGeminiProjectsJson() {
8099
- return join10(geminiHomeDir(), "projects.json");
8099
+ return join11(geminiHomeDir(), "projects.json");
8100
8100
  }
8101
8101
  function detectTool(sessionId) {
8102
8102
  return getBackendForId(sessionId)?.id ?? "claude";
@@ -8136,7 +8136,7 @@ function sessionFileIndex() {
8136
8136
  for (const entry of entries) {
8137
8137
  if (!entry.isDirectory())
8138
8138
  continue;
8139
- const dir = join10(root, entry.name);
8139
+ const dir = join11(root, entry.name);
8140
8140
  let names;
8141
8141
  try {
8142
8142
  names = readdirSync7(dir);
@@ -8148,7 +8148,7 @@ function sessionFileIndex() {
8148
8148
  continue;
8149
8149
  const id = name.slice(0, -".jsonl".length);
8150
8150
  const located = {
8151
- path: join10(dir, name),
8151
+ path: join11(dir, name),
8152
8152
  projectDir: entry.name,
8153
8153
  projectPath: resolveProjectDirName(entry.name)
8154
8154
  };
@@ -8201,7 +8201,7 @@ function readSessionGroupText(group) {
8201
8201
  const parts = [];
8202
8202
  for (const p of group.paths) {
8203
8203
  try {
8204
- const st = statSync7(p);
8204
+ const st = statSync8(p);
8205
8205
  parts.push(`${p}:${st.mtimeMs}:${st.size}`);
8206
8206
  } catch {
8207
8207
  parts.push(`${p}:missing`);
@@ -8221,7 +8221,7 @@ function readSessionGroupText(group) {
8221
8221
  continue;
8222
8222
  }
8223
8223
  try {
8224
- mtime = Math.max(mtime, statSync7(p).mtimeMs);
8224
+ mtime = Math.max(mtime, statSync8(p).mtimeMs);
8225
8225
  } catch {
8226
8226
  }
8227
8227
  text = text ? mergeLineText(text, raw).text : raw;
@@ -8234,10 +8234,10 @@ function readSessionGroupText(group) {
8234
8234
  function resolveSessionContentPaths(sessionFile) {
8235
8235
  if (!hasSubagentsDir(sessionFile))
8236
8236
  return [sessionFile];
8237
- const subDir = join10(sessionFile.slice(0, -6), "subagents");
8237
+ const subDir = join11(sessionFile.slice(0, -6), "subagents");
8238
8238
  if (!existsSync8(subDir))
8239
8239
  return [sessionFile];
8240
- const subPaths = readdirSync7(subDir).filter((f) => f.endsWith(".jsonl")).sort().map((f) => join10(subDir, f));
8240
+ const subPaths = readdirSync7(subDir).filter((f) => f.endsWith(".jsonl")).sort().map((f) => join11(subDir, f));
8241
8241
  return [sessionFile, ...subPaths];
8242
8242
  }
8243
8243
  function loadGeminiProjectMap() {
@@ -8249,7 +8249,7 @@ function loadGeminiProjectMap() {
8249
8249
  try {
8250
8250
  const data = JSON.parse(readFileSync5(projectsPath, "utf-8"));
8251
8251
  for (const path of Object.keys(data.projects || {})) {
8252
- map.set(createHash4("sha256").update(path).digest("hex"), path);
8252
+ map.set(createHash5("sha256").update(path).digest("hex"), path);
8253
8253
  }
8254
8254
  } catch {
8255
8255
  }
@@ -8292,7 +8292,7 @@ function geminiIndex() {
8292
8292
  for (const proj of projs) {
8293
8293
  if (!proj.isDirectory())
8294
8294
  continue;
8295
- const chats = join10(tmpRoot, proj.name, "chats");
8295
+ const chats = join11(tmpRoot, proj.name, "chats");
8296
8296
  if (!existsSync8(chats))
8297
8297
  continue;
8298
8298
  let files;
@@ -8306,7 +8306,7 @@ function geminiIndex() {
8306
8306
  continue;
8307
8307
  const base = f.replace(/\.jsonl?$/, "");
8308
8308
  const located = {
8309
- path: join10(chats, f),
8309
+ path: join11(chats, f),
8310
8310
  projectDir: proj.name,
8311
8311
  projectPath: projMap.get(proj.name) || "",
8312
8312
  format: f.endsWith(".jsonl") ? "jsonl" : "json"
@@ -8419,15 +8419,15 @@ function findCodexSessionFileIn(root, sessionId) {
8419
8419
  for (const year of readdirSync7(root, { withFileTypes: true })) {
8420
8420
  if (!year.isDirectory())
8421
8421
  continue;
8422
- const yearPath = join10(root, year.name);
8422
+ const yearPath = join11(root, year.name);
8423
8423
  for (const month of readdirSync7(yearPath, { withFileTypes: true })) {
8424
8424
  if (!month.isDirectory())
8425
8425
  continue;
8426
- const monthPath = join10(yearPath, month.name);
8426
+ const monthPath = join11(yearPath, month.name);
8427
8427
  for (const day of readdirSync7(monthPath, { withFileTypes: true })) {
8428
8428
  if (!day.isDirectory())
8429
8429
  continue;
8430
- const dayPath = join10(monthPath, day.name);
8430
+ const dayPath = join11(monthPath, day.name);
8431
8431
  let files;
8432
8432
  try {
8433
8433
  files = readdirSync7(dayPath);
@@ -8438,7 +8438,7 @@ function findCodexSessionFileIn(root, sessionId) {
8438
8438
  if (!f.endsWith(".jsonl"))
8439
8439
  continue;
8440
8440
  if (f.includes(sessionId)) {
8441
- return { path: join10(dayPath, f), projectPath: "" };
8441
+ return { path: join11(dayPath, f), projectPath: "" };
8442
8442
  }
8443
8443
  }
8444
8444
  }
@@ -8447,11 +8447,11 @@ function findCodexSessionFileIn(root, sessionId) {
8447
8447
  function scanDir(dir) {
8448
8448
  for (const entry of readdirSync7(dir, { withFileTypes: true })) {
8449
8449
  if (entry.isDirectory()) {
8450
- const found = scanDir(join10(dir, entry.name));
8450
+ const found = scanDir(join11(dir, entry.name));
8451
8451
  if (found)
8452
8452
  return found;
8453
8453
  } else if (entry.name.endsWith(".jsonl")) {
8454
- const p = join10(dir, entry.name);
8454
+ const p = join11(dir, entry.name);
8455
8455
  try {
8456
8456
  const first = readFileSync5(p, "utf-8").split("\n")[0];
8457
8457
  if (!first)
@@ -8595,15 +8595,15 @@ var init_session_sentiment = __esm({
8595
8595
 
8596
8596
  // ../engine/dist/core/session-replay.js
8597
8597
  import { existsSync as existsSync9 } from "fs";
8598
- import { dirname as dirname9, resolve as pathResolve } from "path";
8598
+ import { dirname as dirname10, resolve as pathResolve } from "path";
8599
8599
  function findRepoRoot(filePath) {
8600
8600
  if (!filePath)
8601
8601
  return null;
8602
- let dir = pathResolve(dirname9(filePath));
8602
+ let dir = pathResolve(dirname10(filePath));
8603
8603
  for (let i = 0; i < 64; i++) {
8604
8604
  if (existsSync9(`${dir}/.git`))
8605
8605
  return dir;
8606
- const parent = dirname9(dir);
8606
+ const parent = dirname10(dir);
8607
8607
  if (parent === dir)
8608
8608
  return null;
8609
8609
  dir = parent;
@@ -9069,11 +9069,11 @@ var init_first_prompt = __esm({
9069
9069
  });
9070
9070
 
9071
9071
  // ../engine/dist/core/backends/tail-read.js
9072
- import { openSync as openSync4, readSync as readSync4, closeSync as closeSync4, statSync as statSync8 } from "node:fs";
9072
+ import { openSync as openSync4, readSync as readSync4, closeSync as closeSync4, statSync as statSync9 } from "node:fs";
9073
9073
  function readTailFromOffset(path, offset) {
9074
9074
  let size = 0;
9075
9075
  try {
9076
- size = statSync8(path).size;
9076
+ size = statSync9(path).size;
9077
9077
  } catch {
9078
9078
  return { text: "", newOffset: offset };
9079
9079
  }
@@ -9390,8 +9390,8 @@ var init_generic_engine = __esm({
9390
9390
  });
9391
9391
 
9392
9392
  // ../engine/dist/core/backends/claude.js
9393
- import { existsSync as existsSync11, readdirSync as readdirSync8, readFileSync as readFileSync6, statSync as statSync9, openSync as openSync5, readSync as readSync5, closeSync as closeSync5 } from "fs";
9394
- import { join as join11, basename as basename9 } from "path";
9393
+ import { existsSync as existsSync11, readdirSync as readdirSync8, readFileSync as readFileSync6, statSync as statSync10, openSync as openSync5, readSync as readSync5, closeSync as closeSync5 } from "fs";
9394
+ import { join as join12, basename as basename9 } from "path";
9395
9395
  function stripReminders(text) {
9396
9396
  return text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "").trim();
9397
9397
  }
@@ -9421,41 +9421,41 @@ var init_claude2 = __esm({
9421
9421
  }
9422
9422
  // ── Subpath helpers used by the parser/source layer ─────────────
9423
9423
  projectsDir() {
9424
- return join11(this.homeDir(), "projects");
9424
+ return join12(this.homeDir(), "projects");
9425
9425
  }
9426
9426
  plansDir() {
9427
- return join11(this.homeDir(), "plans");
9427
+ return join12(this.homeDir(), "plans");
9428
9428
  }
9429
9429
  todosDir() {
9430
- return join11(this.homeDir(), "todos");
9430
+ return join12(this.homeDir(), "todos");
9431
9431
  }
9432
9432
  /** Legacy task-list directory still used by older Claude Code releases. */
9433
9433
  tasksDir() {
9434
- return join11(this.homeDir(), "tasks");
9434
+ return join12(this.homeDir(), "tasks");
9435
9435
  }
9436
9436
  pasteCacheDir() {
9437
- return join11(this.homeDir(), "paste-cache");
9437
+ return join12(this.homeDir(), "paste-cache");
9438
9438
  }
9439
9439
  skillsDir() {
9440
- return join11(this.homeDir(), "skills");
9440
+ return join12(this.homeDir(), "skills");
9441
9441
  }
9442
9442
  agentsDir() {
9443
- return join11(this.homeDir(), "agents");
9443
+ return join12(this.homeDir(), "agents");
9444
9444
  }
9445
9445
  commandsDir() {
9446
- return join11(this.homeDir(), "commands");
9446
+ return join12(this.homeDir(), "commands");
9447
9447
  }
9448
9448
  pluginsManifestPath() {
9449
- return join11(this.homeDir(), "plugins", "installed_plugins.json");
9449
+ return join12(this.homeDir(), "plugins", "installed_plugins.json");
9450
9450
  }
9451
9451
  hooksFile() {
9452
- return join11(this.homeDir(), "hooks.json");
9452
+ return join12(this.homeDir(), "hooks.json");
9453
9453
  }
9454
9454
  settingsFile() {
9455
- return join11(this.homeDir(), "settings.json");
9455
+ return join12(this.homeDir(), "settings.json");
9456
9456
  }
9457
9457
  historyFile() {
9458
- return join11(this.homeDir(), "history.jsonl");
9458
+ return join12(this.homeDir(), "history.jsonl");
9459
9459
  }
9460
9460
  isAvailable() {
9461
9461
  return existsSync11(this.projectsDir());
@@ -9519,7 +9519,7 @@ var init_claude2 = __esm({
9519
9519
  let mtime = 0;
9520
9520
  for (const c of copies) {
9521
9521
  try {
9522
- mtime = Math.max(mtime, statSync9(c.path).mtimeMs);
9522
+ mtime = Math.max(mtime, statSync10(c.path).mtimeMs);
9523
9523
  } catch {
9524
9524
  }
9525
9525
  }
@@ -9550,9 +9550,9 @@ var init_claude2 = __esm({
9550
9550
  continue;
9551
9551
  if (filter && !proj.name.toLowerCase().includes(filter))
9552
9552
  continue;
9553
- const projPath = join11(root, proj.name);
9553
+ const projPath = join12(root, proj.name);
9554
9554
  const projectPath = resolveProjectDirName(proj.name);
9555
- const indexPath = join11(projPath, "sessions-index.json");
9555
+ const indexPath = join12(projPath, "sessions-index.json");
9556
9556
  if (existsSync11(indexPath)) {
9557
9557
  try {
9558
9558
  const indexData = JSON.parse(readFileSync6(indexPath, "utf-8"));
@@ -9592,10 +9592,10 @@ var init_claude2 = __esm({
9592
9592
  const sessionId = basename9(f, ".jsonl");
9593
9593
  if (seen.has(sessionId))
9594
9594
  continue;
9595
- const fullPath = join11(projPath, f);
9595
+ const fullPath = join12(projPath, f);
9596
9596
  let stat3;
9597
9597
  try {
9598
- stat3 = statSync9(fullPath);
9598
+ stat3 = statSync10(fullPath);
9599
9599
  } catch {
9600
9600
  continue;
9601
9601
  }
@@ -9813,7 +9813,7 @@ var init_claude2 = __esm({
9813
9813
  const events = this.readEvents(rawId);
9814
9814
  let fileMtime = 0;
9815
9815
  try {
9816
- fileMtime = statSync9(located.path).mtimeMs;
9816
+ fileMtime = statSync10(located.path).mtimeMs;
9817
9817
  } catch {
9818
9818
  }
9819
9819
  return liveScanEditsFromEvents(events, this.fileToolMap, {
@@ -9856,7 +9856,7 @@ var init_claude2 = __esm({
9856
9856
  continue;
9857
9857
  if (opts.projectFilter && !projEntry.name.toLowerCase().includes(opts.projectFilter.toLowerCase()))
9858
9858
  continue;
9859
- const projPath = join11(root, projEntry.name);
9859
+ const projPath = join12(root, projEntry.name);
9860
9860
  let files;
9861
9861
  try {
9862
9862
  files = readdirSync8(projPath);
@@ -9866,15 +9866,15 @@ var init_claude2 = __esm({
9866
9866
  for (const f of files) {
9867
9867
  if (!f.endsWith(".jsonl") || f === "sessions-index.json")
9868
9868
  continue;
9869
- const fp = join11(projPath, f);
9869
+ const fp = join12(projPath, f);
9870
9870
  try {
9871
- const st = statSync9(fp);
9871
+ const st = statSync10(fp);
9872
9872
  let mtime = st.mtimeMs;
9873
- const subDir = join11(projPath, f.slice(0, -6), "subagents");
9873
+ const subDir = join12(projPath, f.slice(0, -6), "subagents");
9874
9874
  if (existsSync11(subDir)) {
9875
9875
  for (const sub of readdirSync8(subDir)) {
9876
9876
  try {
9877
- const subSt = statSync9(join11(subDir, sub));
9877
+ const subSt = statSync10(join12(subDir, sub));
9878
9878
  if (subSt.mtimeMs > mtime)
9879
9879
  mtime = subSt.mtimeMs;
9880
9880
  } catch {
@@ -9939,7 +9939,7 @@ var init_claude2 = __esm({
9939
9939
  let total = 0;
9940
9940
  for (const located of findSessionFiles(this.toRawId(prefixedId))) {
9941
9941
  try {
9942
- total += statSync9(located.path).size;
9942
+ total += statSync10(located.path).size;
9943
9943
  } catch {
9944
9944
  }
9945
9945
  }
@@ -9976,9 +9976,9 @@ var init_claude2 = __esm({
9976
9976
  });
9977
9977
 
9978
9978
  // ../engine/dist/core/backends/gemini.js
9979
- import { createHash as createHash5 } from "crypto";
9980
- import { existsSync as existsSync12, readdirSync as readdirSync9, readFileSync as readFileSync7, statSync as statSync10 } from "fs";
9981
- import { basename as basename10, join as join12 } from "path";
9979
+ import { createHash as createHash6 } from "crypto";
9980
+ import { existsSync as existsSync12, readdirSync as readdirSync9, readFileSync as readFileSync7, statSync as statSync11 } from "fs";
9981
+ import { basename as basename10, join as join13 } from "path";
9982
9982
  function readSessionId(path, format) {
9983
9983
  try {
9984
9984
  if (format === "json") {
@@ -10028,30 +10028,30 @@ var init_gemini2 = __esm({
10028
10028
  }
10029
10029
  // ── Subpath helpers ────────────────────────────────────────────
10030
10030
  tmpDir() {
10031
- return join12(this.homeDir(), "tmp");
10031
+ return join13(this.homeDir(), "tmp");
10032
10032
  }
10033
10033
  projectsJson() {
10034
- return join12(this.homeDir(), "projects.json");
10034
+ return join13(this.homeDir(), "projects.json");
10035
10035
  }
10036
10036
  settingsFile() {
10037
- return join12(this.homeDir(), "settings.json");
10037
+ return join13(this.homeDir(), "settings.json");
10038
10038
  }
10039
10039
  extensionsDir() {
10040
- return join12(this.homeDir(), "extensions");
10040
+ return join13(this.homeDir(), "extensions");
10041
10041
  }
10042
10042
  antigravityBrainDir() {
10043
- return join12(this.homeDir(), "antigravity", "brain");
10043
+ return join13(this.homeDir(), "antigravity", "brain");
10044
10044
  }
10045
10045
  // Toolkit-artifact dirs. Gemini gained first-class Skills + Agents + (TOML)
10046
10046
  // Commands; all live directly under the home dir, mirroring Claude's layout.
10047
10047
  skillsDir() {
10048
- return join12(this.homeDir(), "skills");
10048
+ return join13(this.homeDir(), "skills");
10049
10049
  }
10050
10050
  commandsDir() {
10051
- return join12(this.homeDir(), "commands");
10051
+ return join13(this.homeDir(), "commands");
10052
10052
  }
10053
10053
  agentsDir() {
10054
- return join12(this.homeDir(), "agents");
10054
+ return join13(this.homeDir(), "agents");
10055
10055
  }
10056
10056
  isAvailable() {
10057
10057
  return geminiTmpDirs().length > 0;
@@ -10073,7 +10073,7 @@ var init_gemini2 = __esm({
10073
10073
  return null;
10074
10074
  let mtime = 0;
10075
10075
  try {
10076
- mtime = statSync10(located.path).mtimeMs;
10076
+ mtime = statSync11(located.path).mtimeMs;
10077
10077
  } catch {
10078
10078
  }
10079
10079
  return {
@@ -10097,7 +10097,7 @@ var init_gemini2 = __esm({
10097
10097
  const projectPath = projMap.get(projDir.name) || "";
10098
10098
  if (filter && !projectPath.toLowerCase().includes(filter))
10099
10099
  continue;
10100
- const chatsDir = join12(root, projDir.name, "chats");
10100
+ const chatsDir = join13(root, projDir.name, "chats");
10101
10101
  if (!existsSync12(chatsDir))
10102
10102
  continue;
10103
10103
  let files;
@@ -10109,10 +10109,10 @@ var init_gemini2 = __esm({
10109
10109
  for (const f of files) {
10110
10110
  if (!f.startsWith("session-") || !f.endsWith(".json") && !f.endsWith(".jsonl"))
10111
10111
  continue;
10112
- const fullPath = join12(chatsDir, f);
10112
+ const fullPath = join13(chatsDir, f);
10113
10113
  let stat3;
10114
10114
  try {
10115
- stat3 = statSync10(fullPath);
10115
+ stat3 = statSync11(fullPath);
10116
10116
  } catch {
10117
10117
  continue;
10118
10118
  }
@@ -10224,7 +10224,7 @@ var init_gemini2 = __esm({
10224
10224
  return [];
10225
10225
  let mtime = 0;
10226
10226
  try {
10227
- mtime = statSync10(located.path).mtimeMs;
10227
+ mtime = statSync11(located.path).mtimeMs;
10228
10228
  } catch {
10229
10229
  }
10230
10230
  const messages = readGeminiMessages(located.path, located.format);
@@ -10288,7 +10288,7 @@ var init_gemini2 = __esm({
10288
10288
  }
10289
10289
  let fileMtime = 0;
10290
10290
  try {
10291
- fileMtime = statSync10(located.path).mtimeMs;
10291
+ fileMtime = statSync11(located.path).mtimeMs;
10292
10292
  } catch {
10293
10293
  }
10294
10294
  const events = this.readEvents(this.toRawId(id));
@@ -10334,7 +10334,7 @@ var init_gemini2 = __esm({
10334
10334
  if (!haystack.includes(opts.projectFilter.toLowerCase()))
10335
10335
  continue;
10336
10336
  }
10337
- const chats = join12(tmpRoot, proj.name, "chats");
10337
+ const chats = join13(tmpRoot, proj.name, "chats");
10338
10338
  if (!existsSync12(chats))
10339
10339
  continue;
10340
10340
  let files;
@@ -10351,7 +10351,7 @@ var init_gemini2 = __esm({
10351
10351
  if (!isJsonl && !isJson)
10352
10352
  continue;
10353
10353
  try {
10354
- const st = statSync10(join12(chats, f));
10354
+ const st = statSync11(join13(chats, f));
10355
10355
  if (st.mtimeMs < opts.sinceMs)
10356
10356
  continue;
10357
10357
  const trimLen = isJsonl ? 6 : 5;
@@ -10383,7 +10383,7 @@ var init_gemini2 = __esm({
10383
10383
  const json = JSON.parse(readFileSync7(path, "utf-8"));
10384
10384
  const projects = json?.projects ?? {};
10385
10385
  for (const projectPath of Object.keys(projects)) {
10386
- const hash = createHash5("sha256").update(projectPath).digest("hex");
10386
+ const hash = createHash6("sha256").update(projectPath).digest("hex");
10387
10387
  map.set(hash, projectPath);
10388
10388
  }
10389
10389
  } catch {
@@ -10397,7 +10397,7 @@ var init_gemini2 = __esm({
10397
10397
  try {
10398
10398
  return {
10399
10399
  tool: "gemini",
10400
- mtime: statSync10(loc.path).mtimeMs,
10400
+ mtime: statSync11(loc.path).mtimeMs,
10401
10401
  files: [{ name: basename10(loc.path), bytes: readFileSync7(loc.path) }]
10402
10402
  };
10403
10403
  } catch {
@@ -10412,7 +10412,7 @@ var init_gemini2 = __esm({
10412
10412
  if (!loc)
10413
10413
  return 0;
10414
10414
  try {
10415
- return statSync10(loc.path).size;
10415
+ return statSync11(loc.path).size;
10416
10416
  } catch {
10417
10417
  return 0;
10418
10418
  }
@@ -10480,7 +10480,7 @@ __export(opencode_exports, {
10480
10480
  });
10481
10481
  import { existsSync as existsSync13 } from "fs";
10482
10482
  import { homedir as homedir4 } from "os";
10483
- import { dirname as dirname10, join as join13 } from "path";
10483
+ import { dirname as dirname11, join as join14 } from "path";
10484
10484
  function openReadonly(path) {
10485
10485
  return openSqliteReadonly(path);
10486
10486
  }
@@ -10507,15 +10507,15 @@ var init_opencode = __esm({
10507
10507
  return opencodeDbPath();
10508
10508
  }
10509
10509
  homeDir() {
10510
- return dirname10(this.dbPath());
10510
+ return dirname11(this.dbPath());
10511
10511
  }
10512
10512
  // ── Subpath helpers ────────────────────────────────────────────
10513
10513
  plansDir() {
10514
- return join13(this.homeDir(), "plans");
10514
+ return join14(this.homeDir(), "plans");
10515
10515
  }
10516
10516
  /** Root that holds OpenCode's global config dir (~/.config/opencode). */
10517
10517
  configRoot() {
10518
- return join13(process.env.HOME || homedir4(), ".config", "opencode");
10518
+ return join14(process.env.HOME || homedir4(), ".config", "opencode");
10519
10519
  }
10520
10520
  /**
10521
10521
  * Canonical OpenCode skills location. The current docs use the plural
@@ -10524,15 +10524,15 @@ var init_opencode = __esm({
10524
10524
  * plural canonical dir for "promote skill to OpenCode" actions.
10525
10525
  */
10526
10526
  skillsDir() {
10527
- return join13(this.configRoot(), "skills");
10527
+ return join14(this.configRoot(), "skills");
10528
10528
  }
10529
10529
  /** Custom slash commands — markdown with frontmatter, plural canonical dir. */
10530
10530
  commandsDir() {
10531
- return join13(this.configRoot(), "commands");
10531
+ return join14(this.configRoot(), "commands");
10532
10532
  }
10533
10533
  /** Agent/subagent definitions — markdown with frontmatter. */
10534
10534
  agentsDir() {
10535
- return join13(this.configRoot(), "agents");
10535
+ return join14(this.configRoot(), "agents");
10536
10536
  }
10537
10537
  /** Every configured OpenCode database, primary first. Unlike the other tools
10538
10538
  * OpenCode stores sessions in a FILE, so a second profile means a second db
@@ -11005,8 +11005,8 @@ var init_opencode = __esm({
11005
11005
  });
11006
11006
 
11007
11007
  // ../engine/dist/core/backends/codex.js
11008
- import { readdirSync as readdirSync10, readFileSync as readFileSync8, statSync as statSync11, openSync as openSync6, readSync as readSync6, closeSync as closeSync6 } from "fs";
11009
- import { basename as basename11, dirname as dirname11, join as join14 } from "path";
11008
+ import { readdirSync as readdirSync10, readFileSync as readFileSync8, statSync as statSync12, openSync as openSync6, readSync as readSync6, closeSync as closeSync6 } from "fs";
11009
+ import { basename as basename11, dirname as dirname12, join as join15 } from "path";
11010
11010
  function parseShellWrites(cmd) {
11011
11011
  const out = [];
11012
11012
  const firstLine = cmd.split("\n", 1)[0].trim();
@@ -11106,7 +11106,7 @@ function* walkRollouts(root) {
11106
11106
  return;
11107
11107
  }
11108
11108
  for (const e of entries) {
11109
- const full = join14(root, e.name);
11109
+ const full = join15(root, e.name);
11110
11110
  if (e.isDirectory()) {
11111
11111
  yield* walkRollouts(full);
11112
11112
  } else if (e.isFile() && e.name.startsWith("rollout-") && e.name.endsWith(".jsonl")) {
@@ -11163,29 +11163,29 @@ var init_codex2 = __esm({
11163
11163
  }
11164
11164
  // ── Subpath helpers ────────────────────────────────────────────
11165
11165
  sessionsDir() {
11166
- return join14(this.homeDir(), "sessions");
11166
+ return join15(this.homeDir(), "sessions");
11167
11167
  }
11168
11168
  configToml() {
11169
- return join14(this.homeDir(), "config.toml");
11169
+ return join15(this.homeDir(), "config.toml");
11170
11170
  }
11171
11171
  pluginsDir() {
11172
- return join14(this.homeDir(), ".tmp", "plugins", "plugins");
11172
+ return join15(this.homeDir(), ".tmp", "plugins", "plugins");
11173
11173
  }
11174
11174
  /** OpenAI-bundled, read-only system skills (imagegen, skill-creator, …). */
11175
11175
  skillsSystemDir() {
11176
- return join14(this.homeDir(), "skills", ".system");
11176
+ return join15(this.homeDir(), "skills", ".system");
11177
11177
  }
11178
11178
  /** User skills root. Direct children (excluding `.system`) are user-authored. */
11179
11179
  skillsDir() {
11180
- return join14(this.homeDir(), "skills");
11180
+ return join15(this.homeDir(), "skills");
11181
11181
  }
11182
11182
  /** Custom prompts (deprecated upstream in favor of skills) — flat *.md. */
11183
11183
  promptsDir() {
11184
- return join14(this.homeDir(), "prompts");
11184
+ return join15(this.homeDir(), "prompts");
11185
11185
  }
11186
11186
  /** Subagent definitions — one TOML file per agent. */
11187
11187
  agentsDir() {
11188
- return join14(this.homeDir(), "agents");
11188
+ return join15(this.homeDir(), "agents");
11189
11189
  }
11190
11190
  /** Any configured home having a sessions/ tree makes Codex available — a
11191
11191
  * machine whose only Codex profile is a secondary one still counts. */
@@ -11213,7 +11213,7 @@ var init_codex2 = __esm({
11213
11213
  return null;
11214
11214
  let mtime = 0;
11215
11215
  try {
11216
- mtime = statSync11(located.path).mtimeMs;
11216
+ mtime = statSync12(located.path).mtimeMs;
11217
11217
  } catch {
11218
11218
  }
11219
11219
  return {
@@ -11233,7 +11233,7 @@ var init_codex2 = __esm({
11233
11233
  for (const filePath of walkRollouts(root)) {
11234
11234
  let stat3;
11235
11235
  try {
11236
- stat3 = statSync11(filePath);
11236
+ stat3 = statSync12(filePath);
11237
11237
  } catch {
11238
11238
  continue;
11239
11239
  }
@@ -11429,7 +11429,7 @@ var init_codex2 = __esm({
11429
11429
  let mtime = 0;
11430
11430
  try {
11431
11431
  raw = readFileSync8(path, "utf-8");
11432
- mtime = statSync11(path).mtimeMs;
11432
+ mtime = statSync12(path).mtimeMs;
11433
11433
  } catch {
11434
11434
  return [];
11435
11435
  }
@@ -11529,7 +11529,7 @@ var init_codex2 = __esm({
11529
11529
  const events = this.readEvents(this.toRawId(id));
11530
11530
  let fileMtime = 0;
11531
11531
  try {
11532
- fileMtime = statSync11(located.path).mtimeMs;
11532
+ fileMtime = statSync12(located.path).mtimeMs;
11533
11533
  } catch {
11534
11534
  }
11535
11535
  return liveScanEditsFromEvents(events, this.fileToolMap, {
@@ -11585,15 +11585,15 @@ var init_codex2 = __esm({
11585
11585
  }
11586
11586
  for (const entry of entries) {
11587
11587
  if (entry.isDirectory()) {
11588
- scanDir(join14(dir, entry.name));
11588
+ scanDir(join15(dir, entry.name));
11589
11589
  continue;
11590
11590
  }
11591
11591
  if (!entry.name.endsWith(".jsonl"))
11592
11592
  continue;
11593
- const p = join14(dir, entry.name);
11593
+ const p = join15(dir, entry.name);
11594
11594
  let st;
11595
11595
  try {
11596
- st = statSync11(p);
11596
+ st = statSync12(p);
11597
11597
  } catch {
11598
11598
  continue;
11599
11599
  }
@@ -11660,7 +11660,7 @@ var init_codex2 = __esm({
11660
11660
  let mtime = 0;
11661
11661
  const push = (path, name) => {
11662
11662
  try {
11663
- const st = statSync11(path);
11663
+ const st = statSync12(path);
11664
11664
  files.push({ name, bytes: readFileSync8(path) });
11665
11665
  if (st.mtimeMs > mtime)
11666
11666
  mtime = st.mtimeMs;
@@ -11670,12 +11670,12 @@ var init_codex2 = __esm({
11670
11670
  push(loc.path, basename11(loc.path));
11671
11671
  const parentId = basename11(loc.path).match(/([a-f0-9-]{36})\.jsonl$/i)?.[1];
11672
11672
  if (parentId) {
11673
- const dayDir = dirname11(loc.path);
11673
+ const dayDir = dirname12(loc.path);
11674
11674
  try {
11675
11675
  for (const f of readdirSync10(dayDir)) {
11676
11676
  if (!f.endsWith(".jsonl") || !f.startsWith("rollout-"))
11677
11677
  continue;
11678
- const p = join14(dayDir, f);
11678
+ const p = join15(dayDir, f);
11679
11679
  if (p === loc.path)
11680
11680
  continue;
11681
11681
  try {
@@ -11702,7 +11702,7 @@ var init_codex2 = __esm({
11702
11702
  if (!loc)
11703
11703
  return 0;
11704
11704
  try {
11705
- return statSync11(loc.path).size;
11705
+ return statSync12(loc.path).size;
11706
11706
  } catch {
11707
11707
  return 0;
11708
11708
  }
@@ -11719,13 +11719,13 @@ var init_codex2 = __esm({
11719
11719
  });
11720
11720
 
11721
11721
  // ../engine/dist/core/backends/agy.js
11722
- import { existsSync as existsSync14, readdirSync as readdirSync11, readFileSync as readFileSync9, statSync as statSync12 } from "fs";
11723
- import { basename as basename12, dirname as dirname12, join as join15 } from "path";
11722
+ import { existsSync as existsSync14, readdirSync as readdirSync11, readFileSync as readFileSync9, statSync as statSync13 } from "fs";
11723
+ import { basename as basename12, dirname as dirname13, join as join16 } from "path";
11724
11724
  function agyTranscriptPath(logsDir) {
11725
- const full = join15(logsDir, "transcript_full.jsonl");
11725
+ const full = join16(logsDir, "transcript_full.jsonl");
11726
11726
  if (existsSync14(full))
11727
11727
  return full;
11728
- const primary = join15(logsDir, "transcript.jsonl");
11728
+ const primary = join16(logsDir, "transcript.jsonl");
11729
11729
  if (existsSync14(primary))
11730
11730
  return primary;
11731
11731
  return "";
@@ -11859,18 +11859,18 @@ var init_agy = __esm({
11859
11859
  }
11860
11860
  /** Resolve a session inside ONE brain root. */
11861
11861
  findSessionIn(brainDir, rawId) {
11862
- const sessionDir = join15(brainDir, rawId);
11862
+ const sessionDir = join16(brainDir, rawId);
11863
11863
  if (!existsSync14(sessionDir))
11864
11864
  return null;
11865
- const path = agyTranscriptPath(join15(sessionDir, ".system_generated", "logs"));
11865
+ const path = agyTranscriptPath(join16(sessionDir, ".system_generated", "logs"));
11866
11866
  if (!path)
11867
11867
  return null;
11868
11868
  let mtime = 0;
11869
11869
  try {
11870
- mtime = statSync12(path).mtimeMs;
11870
+ mtime = statSync13(path).mtimeMs;
11871
11871
  } catch {
11872
11872
  }
11873
- const projectPath = resolveAgyProject(dirname12(path), this.homeDir());
11873
+ const projectPath = resolveAgyProject(dirname13(path), this.homeDir());
11874
11874
  const projectDir = projectPath ? basename12(projectPath) : "";
11875
11875
  return {
11876
11876
  path,
@@ -11893,25 +11893,25 @@ var init_agy = __esm({
11893
11893
  continue;
11894
11894
  }
11895
11895
  for (const rawId of sessionDirs) {
11896
- const sessionPath = join15(brainDir, rawId);
11896
+ const sessionPath = join16(brainDir, rawId);
11897
11897
  try {
11898
- if (!statSync12(sessionPath).isDirectory())
11898
+ if (!statSync13(sessionPath).isDirectory())
11899
11899
  continue;
11900
11900
  } catch {
11901
11901
  continue;
11902
11902
  }
11903
- const filePath = agyTranscriptPath(join15(sessionPath, ".system_generated", "logs"));
11903
+ const filePath = agyTranscriptPath(join16(sessionPath, ".system_generated", "logs"));
11904
11904
  if (!filePath)
11905
11905
  continue;
11906
11906
  let stat3;
11907
11907
  try {
11908
- stat3 = statSync12(filePath);
11908
+ stat3 = statSync13(filePath);
11909
11909
  } catch {
11910
11910
  continue;
11911
11911
  }
11912
11912
  if (stat3.mtimeMs < cutoff)
11913
11913
  continue;
11914
- const projectPath = resolveAgyProject(dirname12(filePath), this.homeDir());
11914
+ const projectPath = resolveAgyProject(dirname13(filePath), this.homeDir());
11915
11915
  if (filter && (!projectPath || !projectPath.toLowerCase().includes(filter)))
11916
11916
  continue;
11917
11917
  const projectDir = projectPath ? basename12(projectPath) : "";
@@ -12168,18 +12168,18 @@ var init_agy = __esm({
12168
12168
  return [];
12169
12169
  }
12170
12170
  for (const rawId of sessionDirs) {
12171
- const sessionPath = join15(brainDir, rawId);
12171
+ const sessionPath = join16(brainDir, rawId);
12172
12172
  try {
12173
- if (!statSync12(sessionPath).isDirectory())
12173
+ if (!statSync13(sessionPath).isDirectory())
12174
12174
  continue;
12175
12175
  } catch {
12176
12176
  continue;
12177
12177
  }
12178
- const filePath = agyTranscriptPath(join15(sessionPath, ".system_generated", "logs"));
12178
+ const filePath = agyTranscriptPath(join16(sessionPath, ".system_generated", "logs"));
12179
12179
  if (!filePath)
12180
12180
  continue;
12181
12181
  try {
12182
- const st = statSync12(filePath);
12182
+ const st = statSync13(filePath);
12183
12183
  if (st.mtimeMs < opts.sinceMs)
12184
12184
  continue;
12185
12185
  candidates2.push({ rawId, mtime: st.mtimeMs });
@@ -12207,7 +12207,7 @@ var init_agy = __esm({
12207
12207
  try {
12208
12208
  return {
12209
12209
  tool: "agy",
12210
- mtime: statSync12(loc.path).mtimeMs,
12210
+ mtime: statSync13(loc.path).mtimeMs,
12211
12211
  files: [{ name: basename12(loc.path), bytes: readFileSync9(loc.path) }]
12212
12212
  };
12213
12213
  } catch {
@@ -12222,7 +12222,7 @@ var init_agy = __esm({
12222
12222
  if (!loc)
12223
12223
  return 0;
12224
12224
  try {
12225
- return statSync12(loc.path).size;
12225
+ return statSync13(loc.path).size;
12226
12226
  } catch {
12227
12227
  return 0;
12228
12228
  }
@@ -12239,8 +12239,8 @@ var init_agy = __esm({
12239
12239
  });
12240
12240
 
12241
12241
  // ../engine/dist/core/backends/cursor-store.js
12242
- import { existsSync as existsSync15, readdirSync as readdirSync12, readFileSync as readFileSync10, statSync as statSync13 } from "fs";
12243
- import { join as join16 } from "path";
12242
+ import { existsSync as existsSync15, readdirSync as readdirSync12, readFileSync as readFileSync10, statSync as statSync14 } from "fs";
12243
+ import { join as join17 } from "path";
12244
12244
  function cursorProjectSlug(absPath) {
12245
12245
  return absPath.replace(/[^a-zA-Z0-9]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
12246
12246
  }
@@ -12253,23 +12253,23 @@ function listChatsIn(chatsRoot) {
12253
12253
  return out;
12254
12254
  }
12255
12255
  for (const workspaceHash of hashDirs) {
12256
- const hashPath2 = join16(chatsRoot, workspaceHash);
12256
+ const hashPath2 = join17(chatsRoot, workspaceHash);
12257
12257
  let chatIds;
12258
12258
  try {
12259
- if (!statSync13(hashPath2).isDirectory())
12259
+ if (!statSync14(hashPath2).isDirectory())
12260
12260
  continue;
12261
12261
  chatIds = readdirSync12(hashPath2);
12262
12262
  } catch {
12263
12263
  continue;
12264
12264
  }
12265
12265
  for (const chatId of chatIds) {
12266
- const dir = join16(hashPath2, chatId);
12267
- const dbPath = join16(dir, "store.db");
12266
+ const dir = join17(hashPath2, chatId);
12267
+ const dbPath = join17(dir, "store.db");
12268
12268
  if (!existsSync15(dbPath))
12269
12269
  continue;
12270
12270
  let meta = {};
12271
12271
  try {
12272
- meta = JSON.parse(readFileSync10(join16(dir, "meta.json"), "utf-8"));
12272
+ meta = JSON.parse(readFileSync10(join17(dir, "meta.json"), "utf-8"));
12273
12273
  } catch {
12274
12274
  }
12275
12275
  if (meta.hasConversation === false)
@@ -12278,7 +12278,7 @@ function listChatsIn(chatsRoot) {
12278
12278
  let created = meta.createdAtMs ?? 0;
12279
12279
  if (!mtime || !created) {
12280
12280
  try {
12281
- const st = statSync13(dbPath);
12281
+ const st = statSync14(dbPath);
12282
12282
  mtime = mtime || st.mtimeMs;
12283
12283
  created = created || st.birthtimeMs || st.mtimeMs;
12284
12284
  } catch {
@@ -12308,20 +12308,20 @@ function findChat(chatsRoots, chatId) {
12308
12308
  continue;
12309
12309
  }
12310
12310
  for (const workspaceHash of hashDirs) {
12311
- const dir = join16(root, workspaceHash, chatId);
12312
- const dbPath = join16(dir, "store.db");
12311
+ const dir = join17(root, workspaceHash, chatId);
12312
+ const dbPath = join17(dir, "store.db");
12313
12313
  if (!existsSync15(dbPath))
12314
12314
  continue;
12315
12315
  let meta = {};
12316
12316
  try {
12317
- meta = JSON.parse(readFileSync10(join16(dir, "meta.json"), "utf-8"));
12317
+ meta = JSON.parse(readFileSync10(join17(dir, "meta.json"), "utf-8"));
12318
12318
  } catch {
12319
12319
  }
12320
12320
  let mtime = meta.updatedAtMs ?? 0;
12321
12321
  let created = meta.createdAtMs ?? 0;
12322
12322
  if (!mtime || !created) {
12323
12323
  try {
12324
- const st = statSync13(dbPath);
12324
+ const st = statSync14(dbPath);
12325
12325
  mtime = mtime || st.mtimeMs;
12326
12326
  created = created || st.birthtimeMs || st.mtimeMs;
12327
12327
  } catch {
@@ -12562,7 +12562,7 @@ function readStoreEvents(chat) {
12562
12562
  function transcriptPath(cursorHome, projectPath, chatId) {
12563
12563
  if (!projectPath)
12564
12564
  return null;
12565
- const p = join16(cursorHome, "projects", cursorProjectSlug(projectPath), "agent-transcripts", chatId, `${chatId}.jsonl`);
12565
+ const p = join17(cursorHome, "projects", cursorProjectSlug(projectPath), "agent-transcripts", chatId, `${chatId}.jsonl`);
12566
12566
  return existsSync15(p) ? p : null;
12567
12567
  }
12568
12568
  function readTranscriptEvents(rawText, mtimeFallback = 0) {
@@ -12624,8 +12624,8 @@ var init_cursor_store = __esm({
12624
12624
  });
12625
12625
 
12626
12626
  // ../engine/dist/core/backends/cursor-ide.js
12627
- import { existsSync as existsSync16, readFileSync as readFileSync11, readdirSync as readdirSync13, statSync as statSync14 } from "fs";
12628
- import { dirname as dirname13, join as join17 } from "path";
12627
+ import { existsSync as existsSync16, readFileSync as readFileSync11, readdirSync as readdirSync13, statSync as statSync15 } from "fs";
12628
+ import { dirname as dirname14, join as join18 } from "path";
12629
12629
  function jsonOf(value) {
12630
12630
  if (value == null)
12631
12631
  return null;
@@ -12669,7 +12669,7 @@ function pathFromUri(uri) {
12669
12669
  return uri.startsWith("/") ? uri : "";
12670
12670
  }
12671
12671
  function projectPathForWorkspace(workspaceDir) {
12672
- const meta = jsonOf(safeRead(join17(workspaceDir, "workspace.json")));
12672
+ const meta = jsonOf(safeRead(join18(workspaceDir, "workspace.json")));
12673
12673
  if (!meta)
12674
12674
  return "";
12675
12675
  const uri = typeof meta.workspace === "string" && meta.workspace || typeof meta.folder === "string" && meta.folder || "";
@@ -12692,9 +12692,9 @@ function workspaceIndex(workspaceRoots) {
12692
12692
  continue;
12693
12693
  }
12694
12694
  for (const id of entries) {
12695
- const dir = join17(root, id);
12695
+ const dir = join18(root, id);
12696
12696
  try {
12697
- if (!statSync14(dir).isDirectory())
12697
+ if (!statSync15(dir).isDirectory())
12698
12698
  continue;
12699
12699
  } catch {
12700
12700
  continue;
@@ -12779,7 +12779,7 @@ function listComposers(globalDbPath, workspaceRoots) {
12779
12779
  continue;
12780
12780
  }
12781
12781
  for (const workspaceId of entries) {
12782
- const wsDb = join17(root, workspaceId, "state.vscdb");
12782
+ const wsDb = join18(root, workspaceId, "state.vscdb");
12783
12783
  if (!existsSync16(wsDb))
12784
12784
  continue;
12785
12785
  const projectPath = wsIndex.get(workspaceId) || "";
@@ -13040,8 +13040,8 @@ var init_cursor_ide = __esm({
13040
13040
  });
13041
13041
 
13042
13042
  // ../engine/dist/core/backends/cursor.js
13043
- import { existsSync as existsSync17, readFileSync as readFileSync12, statSync as statSync15 } from "fs";
13044
- import { join as join18 } from "path";
13043
+ import { existsSync as existsSync17, readFileSync as readFileSync12, statSync as statSync16 } from "fs";
13044
+ import { join as join19 } from "path";
13045
13045
  var PREFIX5, CursorBackend, cursorBackend;
13046
13046
  var init_cursor = __esm({
13047
13047
  "../engine/dist/core/backends/cursor.js"() {
@@ -13093,7 +13093,7 @@ var init_cursor = __esm({
13093
13093
  if (r.surface === "cli") {
13094
13094
  let mtime2 = r.chat.updatedAtMs;
13095
13095
  try {
13096
- mtime2 = statSync15(r.chat.dbPath).mtimeMs || mtime2;
13096
+ mtime2 = statSync16(r.chat.dbPath).mtimeMs || mtime2;
13097
13097
  } catch {
13098
13098
  }
13099
13099
  return {
@@ -13106,7 +13106,7 @@ var init_cursor = __esm({
13106
13106
  }
13107
13107
  let mtime = r.composer.updatedAtMs;
13108
13108
  try {
13109
- mtime = statSync15(r.composer.globalDbPath).mtimeMs || mtime;
13109
+ mtime = statSync16(r.composer.globalDbPath).mtimeMs || mtime;
13110
13110
  } catch {
13111
13111
  }
13112
13112
  return {
@@ -13348,11 +13348,11 @@ var init_cursor = __esm({
13348
13348
  if (!lines)
13349
13349
  return null;
13350
13350
  const files = [{ name: `${r.chat.chatId}.jsonl`, bytes: Buffer.from(lines, "utf8") }];
13351
- const metaPath = join18(r.chat.dir, "meta.json");
13351
+ const metaPath = join19(r.chat.dir, "meta.json");
13352
13352
  if (existsSync17(metaPath)) {
13353
13353
  files.push({ name: "meta.json", bytes: readFileSync12(metaPath) });
13354
13354
  }
13355
- return { tool: "cursor", mtime: statSync15(r.chat.dbPath).mtimeMs, files };
13355
+ return { tool: "cursor", mtime: statSync16(r.chat.dbPath).mtimeMs, files };
13356
13356
  }
13357
13357
  const events = readComposerEvents(r.composer);
13358
13358
  if (events.length === 0)
@@ -13360,7 +13360,7 @@ var init_cursor = __esm({
13360
13360
  const body = events.map((e) => JSON.stringify(e)).join("\n") + "\n";
13361
13361
  return {
13362
13362
  tool: "cursor",
13363
- mtime: statSync15(r.composer.globalDbPath).mtimeMs,
13363
+ mtime: statSync16(r.composer.globalDbPath).mtimeMs,
13364
13364
  files: [{ name: `${r.composer.composerId}.jsonl`, bytes: Buffer.from(body, "utf8") }]
13365
13365
  };
13366
13366
  } catch {
@@ -13425,11 +13425,11 @@ var init_credentials_env = __esm({
13425
13425
  });
13426
13426
 
13427
13427
  // ../engine/dist/core/which.js
13428
- import { existsSync as existsSync19, statSync as statSync16, accessSync, constants } from "node:fs";
13429
- import { join as join20, isAbsolute as isAbsolute2, delimiter as delimiter2, sep as sep2 } from "node:path";
13428
+ import { existsSync as existsSync19, statSync as statSync17, accessSync as accessSync2, constants as constants2 } from "node:fs";
13429
+ import { join as join21, isAbsolute as isAbsolute2, delimiter as delimiter2, sep as sep2 } from "node:path";
13430
13430
  function executable(p) {
13431
13431
  try {
13432
- if (!statSync16(p).isFile())
13432
+ if (!statSync17(p).isFile())
13433
13433
  return false;
13434
13434
  } catch {
13435
13435
  return false;
@@ -13437,7 +13437,7 @@ function executable(p) {
13437
13437
  if (isWindows)
13438
13438
  return true;
13439
13439
  try {
13440
- accessSync(p, constants.X_OK);
13440
+ accessSync2(p, constants2.X_OK);
13441
13441
  return true;
13442
13442
  } catch {
13443
13443
  return false;
@@ -13465,7 +13465,7 @@ function resolveOnPath(name) {
13465
13465
  if (!dir)
13466
13466
  continue;
13467
13467
  for (const c of candidates(name)) {
13468
- const full = join20(dir, c);
13468
+ const full = join21(dir, c);
13469
13469
  if (existsSync19(full) && executable(full))
13470
13470
  return full;
13471
13471
  }
@@ -13484,8 +13484,8 @@ var init_which = __esm({
13484
13484
  });
13485
13485
 
13486
13486
  // ../engine/dist/core/collector-health.js
13487
- import { readFileSync as readFileSync13, writeFileSync as writeFileSync3, mkdirSync as mkdirSync5 } from "node:fs";
13488
- import { join as join21, dirname as dirname14 } from "node:path";
13487
+ import { readFileSync as readFileSync13, writeFileSync as writeFileSync3, mkdirSync as mkdirSync6 } from "node:fs";
13488
+ import { join as join22, dirname as dirname15 } from "node:path";
13489
13489
  function progressLine(h) {
13490
13490
  const p = h?.progress;
13491
13491
  if (!p || p.complete || p.total <= 0)
@@ -13504,7 +13504,7 @@ function readCollectorHealth() {
13504
13504
  function writeCollectorHealth(h) {
13505
13505
  try {
13506
13506
  const p = healthPath();
13507
- mkdirSync5(dirname14(p), { recursive: true });
13507
+ mkdirSync6(dirname15(p), { recursive: true });
13508
13508
  writeFileSync3(p, JSON.stringify(h));
13509
13509
  } catch {
13510
13510
  }
@@ -13567,7 +13567,7 @@ var init_collector_health = __esm({
13567
13567
  "../engine/dist/core/collector-health.js"() {
13568
13568
  "use strict";
13569
13569
  init_paths();
13570
- healthPath = () => join21(getDataDir(), "collector-health.json");
13570
+ healthPath = () => join22(getDataDir(), "collector-health.json");
13571
13571
  PROGRESS_WRITE_INTERVAL_MS = 2e3;
13572
13572
  lastProgressWrite = 0;
13573
13573
  STALE_AFTER_MS = 30 * 6e4;
@@ -13583,9 +13583,9 @@ var init_collector_health = __esm({
13583
13583
  });
13584
13584
 
13585
13585
  // ../engine/dist/types/code-intel.js
13586
- import { createHash as createHash6 } from "crypto";
13586
+ import { createHash as createHash7 } from "crypto";
13587
13587
  function shortHash(s) {
13588
- return createHash6("sha256").update(s).digest("hex").slice(0, 16);
13588
+ return createHash7("sha256").update(s).digest("hex").slice(0, 16);
13589
13589
  }
13590
13590
  function snippetKey(snippet) {
13591
13591
  return (snippet ?? "").replace(/\s+/g, " ").trim().slice(0, 200);
@@ -13626,11 +13626,11 @@ var init_code_intel = __esm({
13626
13626
  });
13627
13627
 
13628
13628
  // ../engine/dist/core/companions.js
13629
- import { existsSync as existsSync20, mkdirSync as mkdirSync6, statSync as statSync17, chmodSync as chmodSync3, unlinkSync, renameSync as renameSync3, createWriteStream, readFileSync as readFileSync14, writeFileSync as writeFileSync4 } from "node:fs";
13629
+ import { existsSync as existsSync20, mkdirSync as mkdirSync7, statSync as statSync18, chmodSync as chmodSync4, unlinkSync, renameSync as renameSync3, createWriteStream, readFileSync as readFileSync14, writeFileSync as writeFileSync4 } from "node:fs";
13630
13630
  import { homedir as homedir5 } from "node:os";
13631
- import { join as join22 } from "node:path";
13631
+ import { join as join23 } from "node:path";
13632
13632
  import { execSync as execSync2 } from "node:child_process";
13633
- import { createHash as createHash7 } from "node:crypto";
13633
+ import { createHash as createHash8 } from "node:crypto";
13634
13634
  function expectedCodeindexSha256(artifact) {
13635
13635
  return CODEINDEX_SHA256[artifact.replace(/^codeindex-/, "").replace(/\.exe$/, "")] ?? null;
13636
13636
  }
@@ -13677,7 +13677,7 @@ function checkCodeindexStatus() {
13677
13677
  status.installed = true;
13678
13678
  status.path = foundPath;
13679
13679
  try {
13680
- status.size = statSync17(foundPath).size;
13680
+ status.size = statSync18(foundPath).size;
13681
13681
  } catch {
13682
13682
  }
13683
13683
  try {
@@ -13730,7 +13730,7 @@ async function installCodeindex(opts = {}) {
13730
13730
  return status;
13731
13731
  if (!status.prebuiltAvailable)
13732
13732
  return status;
13733
- mkdirSync6(CODEINDEX_INSTALL_DIR, { recursive: true });
13733
+ mkdirSync7(CODEINDEX_INSTALL_DIR, { recursive: true });
13734
13734
  const tmpPath = `${CODEINDEX_BIN_PATH}.partial`;
13735
13735
  try {
13736
13736
  await downloadArtifact(status.artifactName, tmpPath);
@@ -13738,14 +13738,14 @@ async function installCodeindex(opts = {}) {
13738
13738
  if (!expected) {
13739
13739
  throw new Error(`No pinned checksum for ${status.artifactName} \u2014 refusing to install an unverified binary. Add its sha256 to CODEINDEX_SHA256 in companions.ts.`);
13740
13740
  }
13741
- const actual = createHash7("sha256").update(readFileSync14(tmpPath)).digest("hex");
13741
+ const actual = createHash8("sha256").update(readFileSync14(tmpPath)).digest("hex");
13742
13742
  if (actual !== expected) {
13743
13743
  throw new Error(`Checksum mismatch for ${status.artifactName}.
13744
13744
  expected ${expected}
13745
13745
  actual ${actual}
13746
13746
  Refusing to install. The release may have been re-uploaded, or something is serving different bytes.`);
13747
13747
  }
13748
- chmodSync3(tmpPath, 493);
13748
+ chmodSync4(tmpPath, 493);
13749
13749
  renameSync3(tmpPath, CODEINDEX_BIN_PATH);
13750
13750
  } catch (err) {
13751
13751
  try {
@@ -13772,24 +13772,24 @@ var init_companions = __esm({
13772
13772
  "x86_64-windows": "a96fc8c8949bb399a44cc0615b12e458460a529c69f01e8829cc39a20f45ab29",
13773
13773
  "aarch64-windows": "42620d56272cd9ba9d785569d8d754d6b4a3e80f36f28db3e0c483fd600ed117"
13774
13774
  };
13775
- CODEINDEX_INSTALL_DIR = join22(homedir5(), ".local", "bin");
13775
+ CODEINDEX_INSTALL_DIR = join23(homedir5(), ".local", "bin");
13776
13776
  CODEINDEX_BIN_NAME = process.platform === "win32" ? "codeindex.exe" : "codeindex";
13777
- CODEINDEX_BIN_PATH = join22(CODEINDEX_INSTALL_DIR, CODEINDEX_BIN_NAME);
13777
+ CODEINDEX_BIN_PATH = join23(CODEINDEX_INSTALL_DIR, CODEINDEX_BIN_NAME);
13778
13778
  }
13779
13779
  });
13780
13780
 
13781
13781
  // ../engine/dist/core/detector-install.js
13782
- import { createHash as createHash8 } from "crypto";
13783
- import { existsSync as existsSync21, mkdirSync as mkdirSync7, mkdtempSync, chmodSync as chmodSync4, renameSync as renameSync4, rmSync as rmSync2, writeFileSync as writeFileSync5, readFileSync as readFileSync15, statSync as statSync18, copyFileSync as copyFileSync2 } from "fs";
13784
- import { join as join23 } from "path";
13782
+ import { createHash as createHash9 } from "crypto";
13783
+ import { existsSync as existsSync21, mkdirSync as mkdirSync8, mkdtempSync, chmodSync as chmodSync5, renameSync as renameSync4, rmSync as rmSync2, writeFileSync as writeFileSync5, readFileSync as readFileSync15, statSync as statSync19, copyFileSync as copyFileSync2 } from "fs";
13784
+ import { join as join24 } from "path";
13785
13785
  function managedDetectorPath(name) {
13786
- return join23(getDetectorBinDir(), name + exeSuffix());
13786
+ return join24(getDetectorBinDir(), name + exeSuffix());
13787
13787
  }
13788
13788
  function receiptPath(name) {
13789
- return join23(getDetectorBinDir(), `${name}.receipt.json`);
13789
+ return join24(getDetectorBinDir(), `${name}.receipt.json`);
13790
13790
  }
13791
13791
  function sha256File(path) {
13792
- return createHash8("sha256").update(readFileSync15(path)).digest("hex");
13792
+ return createHash9("sha256").update(readFileSync15(path)).digest("hex");
13793
13793
  }
13794
13794
  function readReceipt(name) {
13795
13795
  try {
@@ -13801,7 +13801,7 @@ function readReceipt(name) {
13801
13801
  function verifiedSha(path) {
13802
13802
  let st;
13803
13803
  try {
13804
- st = statSync18(path);
13804
+ st = statSync19(path);
13805
13805
  } catch {
13806
13806
  return null;
13807
13807
  }
@@ -13819,7 +13819,7 @@ function configuredDir() {
13819
13819
  function resolveDetector(name) {
13820
13820
  const dir = configuredDir();
13821
13821
  if (dir) {
13822
- const p2 = join23(dir, name + exeSuffix());
13822
+ const p2 = join24(dir, name + exeSuffix());
13823
13823
  if (existsSync21(p2))
13824
13824
  return { path: p2, version: "operator-supplied", source: "configured" };
13825
13825
  return { error: "not-installed" };
@@ -13885,8 +13885,8 @@ var init_detector_install = __esm({
13885
13885
  // ../engine/dist/core/secret-scanner.js
13886
13886
  import { spawnSync } from "child_process";
13887
13887
  import { existsSync as existsSync22, unlinkSync as unlinkSync2, readFileSync as readFileSync16, mkdtempSync as mkdtempSync2, rmSync as rmSync3 } from "fs";
13888
- import { tmpdir } from "os";
13889
- import { join as join24 } from "path";
13888
+ import { tmpdir as tmpdir2 } from "os";
13889
+ import { join as join25 } from "path";
13890
13890
  function mask(s) {
13891
13891
  if (!s)
13892
13892
  return "";
@@ -13914,7 +13914,7 @@ function whichDetector(bin) {
13914
13914
  return null;
13915
13915
  }
13916
13916
  function spawnScoped(binary, args, opts) {
13917
- const scratch = mkdtempSync2(join24(tmpdir(), "cr-scan-tmp-"));
13917
+ const scratch = mkdtempSync2(join25(tmpdir2(), "cr-scan-tmp-"));
13918
13918
  try {
13919
13919
  return spawnSync(binary, args, {
13920
13920
  ...opts,
@@ -14232,7 +14232,7 @@ __export(collector_exports, {
14232
14232
  import { spawn } from "node:child_process";
14233
14233
  import { execSync as execSync3 } from "node:child_process";
14234
14234
  import { readFileSync as readFileSync17 } from "node:fs";
14235
- import { join as join25, basename as basename13 } from "node:path";
14235
+ import { join as join26, basename as basename13 } from "node:path";
14236
14236
  async function resolveCodeindexBin(autoInstall = true) {
14237
14237
  let st = checkCodeindexStatus();
14238
14238
  if (!st.installed && autoInstall)
@@ -14411,7 +14411,7 @@ async function collectCode(opts) {
14411
14411
  }
14412
14412
  const complexity = (r) => {
14413
14413
  try {
14414
- const txt = readFileSync17(join25(ws, r), "utf8");
14414
+ const txt = readFileSync17(join26(ws, r), "utf8");
14415
14415
  if (txt.length > 2e6)
14416
14416
  return 1;
14417
14417
  const m = txt.match(CF_RE);
@@ -15162,11 +15162,11 @@ var init_collector = __esm({
15162
15162
  });
15163
15163
 
15164
15164
  // ../engine/dist/core/source-discovery.js
15165
- import { createHash as createHash9 } from "crypto";
15166
- import { existsSync as existsSync24, readdirSync as readdirSync14, statSync as statSync20 } from "fs";
15167
- import { join as join27 } from "path";
15165
+ import { createHash as createHash10 } from "crypto";
15166
+ import { existsSync as existsSync24, readdirSync as readdirSync14, statSync as statSync21 } from "fs";
15167
+ import { join as join28 } from "path";
15168
15168
  function sourceId(path) {
15169
- return "src_" + createHash9("sha256").update(path).digest("hex").slice(0, 12);
15169
+ return "src_" + createHash10("sha256").update(path).digest("hex").slice(0, 12);
15170
15170
  }
15171
15171
  function installSourceExclusions(ids) {
15172
15172
  excludedIds = new Set((ids || []).filter((s) => typeof s === "string" && SOURCE_ID_RE.test(s)));
@@ -15205,7 +15205,7 @@ function countTranscripts(root, tool) {
15205
15205
  return;
15206
15206
  }
15207
15207
  for (const e of entries) {
15208
- const full = join27(dir, e.name);
15208
+ const full = join28(dir, e.name);
15209
15209
  if (e.isDirectory()) {
15210
15210
  walk(full, depth + 1);
15211
15211
  continue;
@@ -15214,7 +15214,7 @@ function countTranscripts(root, tool) {
15214
15214
  continue;
15215
15215
  sessions++;
15216
15216
  try {
15217
- const m = statSync20(full).mtimeMs;
15217
+ const m = statSync21(full).mtimeMs;
15218
15218
  if (m > newestMtime)
15219
15219
  newestMtime = m;
15220
15220
  } catch {
@@ -15226,7 +15226,7 @@ function countTranscripts(root, tool) {
15226
15226
  }
15227
15227
  function countOpencodeSessions(dbPath) {
15228
15228
  try {
15229
- const st = statSync20(dbPath);
15229
+ const st = statSync21(dbPath);
15230
15230
  return { sessions: 0, newestMtime: st.mtimeMs };
15231
15231
  } catch {
15232
15232
  return { sessions: 0, newestMtime: 0 };
@@ -15270,9 +15270,9 @@ var init_source_discovery = __esm({
15270
15270
 
15271
15271
  // ../engine/dist/core/home-discovery.js
15272
15272
  import { execFileSync as execFileSync2 } from "child_process";
15273
- import { existsSync as existsSync25, readdirSync as readdirSync15, readFileSync as readFileSync19, realpathSync as realpathSync3, statSync as statSync21 } from "fs";
15273
+ import { existsSync as existsSync25, readdirSync as readdirSync15, readFileSync as readFileSync19, realpathSync as realpathSync3, statSync as statSync22 } from "fs";
15274
15274
  import { homedir as homedir7, platform as osPlatform } from "os";
15275
- import { join as join28 } from "path";
15275
+ import { join as join29 } from "path";
15276
15276
  function candidateRoots(plat = osPlatform(), env = process.env) {
15277
15277
  const home = homedir7();
15278
15278
  const roots = [home];
@@ -15285,25 +15285,25 @@ function candidateRoots(plat = osPlatform(), env = process.env) {
15285
15285
  add(env.LOCALAPPDATA);
15286
15286
  add(env.USERPROFILE);
15287
15287
  } else if (plat === "darwin") {
15288
- add(join28(home, "Library", "Application Support"));
15288
+ add(join29(home, "Library", "Application Support"));
15289
15289
  add(env.XDG_CONFIG_HOME);
15290
15290
  } else {
15291
- add(env.XDG_CONFIG_HOME || join28(home, ".config"));
15292
- add(env.XDG_DATA_HOME || join28(home, ".local", "share"));
15291
+ add(env.XDG_CONFIG_HOME || join29(home, ".config"));
15292
+ add(env.XDG_DATA_HOME || join29(home, ".local", "share"));
15293
15293
  }
15294
15294
  return roots.filter((r) => existsSync25(r));
15295
15295
  }
15296
15296
  function identifyHome(dir) {
15297
- const has = (...parts) => existsSync25(join28(dir, ...parts));
15298
- if (has("projects") && dirHasTranscript(join28(dir, "projects"), (f) => f.endsWith(".jsonl"), 2))
15297
+ const has = (...parts) => existsSync25(join29(dir, ...parts));
15298
+ if (has("projects") && dirHasTranscript(join29(dir, "projects"), (f) => f.endsWith(".jsonl"), 2))
15299
15299
  return "claude";
15300
- if (has("sessions") && dirHasTranscript(join28(dir, "sessions"), (f) => f.startsWith("rollout-") && f.endsWith(".jsonl"), 4))
15300
+ if (has("sessions") && dirHasTranscript(join29(dir, "sessions"), (f) => f.startsWith("rollout-") && f.endsWith(".jsonl"), 4))
15301
15301
  return "codex";
15302
- if (has("tmp") && dirHasTranscript(join28(dir, "tmp"), (f) => f.startsWith("session-"), 3))
15302
+ if (has("tmp") && dirHasTranscript(join29(dir, "tmp"), (f) => f.startsWith("session-"), 3))
15303
15303
  return "gemini";
15304
- if (has("brain") && dirHasTranscript(join28(dir, "brain"), (f) => f.endsWith(".jsonl"), 4))
15304
+ if (has("brain") && dirHasTranscript(join29(dir, "brain"), (f) => f.endsWith(".jsonl"), 4))
15305
15305
  return "agy";
15306
- if (has("chats") && dirHasTranscript(join28(dir, "chats"), (f) => f === "store.db", 3))
15306
+ if (has("chats") && dirHasTranscript(join29(dir, "chats"), (f) => f === "store.db", 3))
15307
15307
  return "cursor";
15308
15308
  if (has("opencode.db"))
15309
15309
  return "opencode";
@@ -15323,7 +15323,7 @@ function dirHasTranscript(root, match, depth) {
15323
15323
  continue;
15324
15324
  if (e.isFile() && match(e.name))
15325
15325
  return true;
15326
- if (e.isDirectory() && dirHasTranscript(join28(root, e.name), match, depth - 1))
15326
+ if (e.isDirectory() && dirHasTranscript(join29(root, e.name), match, depth - 1))
15327
15327
  return true;
15328
15328
  }
15329
15329
  return false;
@@ -15354,12 +15354,12 @@ function countSessions(dir, tool) {
15354
15354
  if (SKIP.has(e.name))
15355
15355
  continue;
15356
15356
  if (e.isDirectory())
15357
- walk(join28(d, e.name), depth - 1);
15357
+ walk(join29(d, e.name), depth - 1);
15358
15358
  else if (s.match(e.name))
15359
15359
  n++;
15360
15360
  }
15361
15361
  };
15362
- walk(join28(dir, s.sub), s.depth);
15362
+ walk(join29(dir, s.sub), s.depth);
15363
15363
  return n;
15364
15364
  }
15365
15365
  function declaredHomes(env = process.env, plat = osPlatform()) {
@@ -15393,7 +15393,7 @@ function declaredHomes(env = process.env, plat = osPlatform()) {
15393
15393
  return out;
15394
15394
  }
15395
15395
  const home = homedir7();
15396
- const rcs = [".bashrc", ".bash_profile", ".zshrc", ".zprofile", ".profile"].map((f) => join28(home, f)).concat([join28(home, ".config", "fish", "config.fish")]);
15396
+ const rcs = [".bashrc", ".bash_profile", ".zshrc", ".zprofile", ".profile"].map((f) => join29(home, f)).concat([join29(home, ".config", "fish", "config.fish")]);
15397
15397
  for (const rc of rcs) {
15398
15398
  let text;
15399
15399
  try {
@@ -15408,7 +15408,7 @@ function declaredHomes(env = process.env, plat = osPlatform()) {
15408
15408
  add(d);
15409
15409
  }
15410
15410
  }
15411
- return out.map((p) => p.startsWith("~") ? join28(home, p.slice(1)) : p);
15411
+ return out.map((p) => p.startsWith("~") ? join29(home, p.slice(1)) : p);
15412
15412
  }
15413
15413
  function runningToolHomes(plat = osPlatform()) {
15414
15414
  const out = [];
@@ -15465,7 +15465,7 @@ function discoverHomes(opts = {}) {
15465
15465
  return;
15466
15466
  }
15467
15467
  try {
15468
- if (!statSync21(real).isDirectory())
15468
+ if (!statSync22(real).isDirectory())
15469
15469
  return;
15470
15470
  } catch {
15471
15471
  return;
@@ -15502,7 +15502,7 @@ function walkForHomes(dir, depth, visit) {
15502
15502
  for (const e of entries) {
15503
15503
  if (!e.isDirectory() || SKIP.has(e.name))
15504
15504
  continue;
15505
- const child = join28(dir, e.name);
15505
+ const child = join29(dir, e.name);
15506
15506
  visit(child);
15507
15507
  walkForHomes(child, depth - 1, visit);
15508
15508
  }
@@ -15722,7 +15722,7 @@ var init_opencode2 = __esm({
15722
15722
  });
15723
15723
 
15724
15724
  // ../engine/dist/transcript/index.js
15725
- import { statSync as statSync22 } from "fs";
15725
+ import { statSync as statSync23 } from "fs";
15726
15726
  async function parseTranscript(sessionId) {
15727
15727
  const tool = detectTool(sessionId);
15728
15728
  if (tool === "claude") {
@@ -15796,7 +15796,7 @@ async function parseTranscript(sessionId) {
15796
15796
  }
15797
15797
  function safeMtime(path) {
15798
15798
  try {
15799
- return statSync22(path).mtimeMs;
15799
+ return statSync23(path).mtimeMs;
15800
15800
  } catch {
15801
15801
  return 0;
15802
15802
  }
@@ -16293,11 +16293,11 @@ var init_entity_extractor = __esm({
16293
16293
  });
16294
16294
 
16295
16295
  // ../engine/dist/core/source-policy.js
16296
- import { statSync as statSync23 } from "fs";
16296
+ import { statSync as statSync24 } from "fs";
16297
16297
  function settings() {
16298
16298
  let mtimeMs = -1;
16299
16299
  try {
16300
- mtimeMs = statSync23(settingsFilePath()).mtimeMs;
16300
+ mtimeMs = statSync24(settingsFilePath()).mtimeMs;
16301
16301
  } catch {
16302
16302
  }
16303
16303
  if (cache2 && cache2.mtimeMs === mtimeMs)
@@ -16593,7 +16593,7 @@ var init_session_source = __esm({
16593
16593
  // ../engine/dist/core/utils.js
16594
16594
  import { existsSync as existsSync26, readdirSync as readdirSync16 } from "fs";
16595
16595
  import { homedir as homedir8 } from "os";
16596
- import { join as join29 } from "path";
16596
+ import { join as join30 } from "path";
16597
16597
  function splitByHeaders(markdown) {
16598
16598
  const lines = markdown.split("\n");
16599
16599
  const sections = [];
@@ -16636,17 +16636,17 @@ function getClaudeDirs() {
16636
16636
  for (const d of process.env.CLAUDE_DIRS.split(",")) {
16637
16637
  const trimmed = d.trim();
16638
16638
  if (trimmed) {
16639
- add(trimmed.startsWith("~/") ? join29(home, trimmed.slice(2)) : trimmed);
16639
+ add(trimmed.startsWith("~/") ? join30(home, trimmed.slice(2)) : trimmed);
16640
16640
  }
16641
16641
  }
16642
16642
  }
16643
- add(join29(home, ".claude"));
16643
+ add(join30(home, ".claude"));
16644
16644
  try {
16645
16645
  const entries = readdirSync16(home, { withFileTypes: true });
16646
16646
  for (const entry of entries) {
16647
16647
  if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
16648
- const candidate = join29(home, entry.name);
16649
- if (existsSync26(join29(candidate, "projects"))) {
16648
+ const candidate = join30(home, entry.name);
16649
+ if (existsSync26(join30(candidate, "projects"))) {
16650
16650
  add(candidate);
16651
16651
  }
16652
16652
  }
@@ -16658,12 +16658,12 @@ function getClaudeDirs() {
16658
16658
  function discoverSubdirs(subdir) {
16659
16659
  const result = [];
16660
16660
  for (const claudeDir of getClaudeDirs()) {
16661
- const path = join29(claudeDir, subdir);
16661
+ const path = join30(claudeDir, subdir);
16662
16662
  if (existsSync26(path)) {
16663
16663
  result.push(path);
16664
16664
  }
16665
16665
  }
16666
- return result.length > 0 ? result : [join29(homedir8(), ".claude", subdir)];
16666
+ return result.length > 0 ? result : [join30(homedir8(), ".claude", subdir)];
16667
16667
  }
16668
16668
  var init_utils = __esm({
16669
16669
  "../engine/dist/core/utils.js"() {
@@ -16672,10 +16672,10 @@ var init_utils = __esm({
16672
16672
  });
16673
16673
 
16674
16674
  // ../engine/dist/parsers/plan-source.js
16675
- import { existsSync as existsSync27, readdirSync as readdirSync17, readFileSync as readFileSync20, statSync as statSync24 } from "fs";
16675
+ import { existsSync as existsSync27, readdirSync as readdirSync17, readFileSync as readFileSync20, statSync as statSync25 } from "fs";
16676
16676
  import { homedir as homedir9 } from "os";
16677
- import { join as join30, basename as basename14 } from "path";
16678
- import { createHash as createHash10 } from "crypto";
16677
+ import { join as join31, basename as basename14 } from "path";
16678
+ import { createHash as createHash11 } from "crypto";
16679
16679
  function parseFrontmatter(content) {
16680
16680
  if (!content.startsWith("---"))
16681
16681
  return { body: content };
@@ -16772,9 +16772,9 @@ var init_plan_source = __esm({
16772
16772
  if (seenClaude.has(file))
16773
16773
  continue;
16774
16774
  seenClaude.add(file);
16775
- const filePath = join30(plansDir, file);
16775
+ const filePath = join31(plansDir, file);
16776
16776
  try {
16777
- const stat3 = statSync24(filePath);
16777
+ const stat3 = statSync25(filePath);
16778
16778
  const planName = basename14(file, ".md");
16779
16779
  const isAgentPlan = planName.includes("-agent-");
16780
16780
  const content = readFileSync20(filePath, "utf-8");
@@ -16816,9 +16816,9 @@ var init_plan_source = __esm({
16816
16816
  return;
16817
16817
  }
16818
16818
  for (const file of files) {
16819
- const filePath = join30(plansDir, file);
16819
+ const filePath = join31(plansDir, file);
16820
16820
  try {
16821
- const stat3 = statSync24(filePath);
16821
+ const stat3 = statSync25(filePath);
16822
16822
  const content = readFileSync20(filePath, "utf-8");
16823
16823
  const firstLine = content.split("\n").find((l) => l.trim())?.replace(/^#+\s*/, "").trim() || file;
16824
16824
  const planName = `${opencodeBackend.idPrefix}plan_${basename14(file, ".md")}`;
@@ -16851,7 +16851,7 @@ var init_plan_source = __esm({
16851
16851
  try {
16852
16852
  const data = JSON.parse(readFileSync20(projectsPath, "utf-8"));
16853
16853
  for (const path of Object.keys(data.projects || {})) {
16854
- projMap.set(createHash10("sha256").update(path).digest("hex"), path);
16854
+ projMap.set(createHash11("sha256").update(path).digest("hex"), path);
16855
16855
  }
16856
16856
  } catch {
16857
16857
  }
@@ -16864,7 +16864,7 @@ var init_plan_source = __esm({
16864
16864
  }
16865
16865
  for (const projDir of projDirs) {
16866
16866
  const projPath = projMap.get(projDir) || "";
16867
- const projRoot = join30(tmpRoot, projDir);
16867
+ const projRoot = join31(tmpRoot, projDir);
16868
16868
  let sessions;
16869
16869
  try {
16870
16870
  sessions = readdirSync17(projRoot);
@@ -16872,7 +16872,7 @@ var init_plan_source = __esm({
16872
16872
  continue;
16873
16873
  }
16874
16874
  for (const sess of sessions) {
16875
- const plansDir = join30(projRoot, sess, "plans");
16875
+ const plansDir = join31(projRoot, sess, "plans");
16876
16876
  if (!existsSync27(plansDir))
16877
16877
  continue;
16878
16878
  let files;
@@ -16882,9 +16882,9 @@ var init_plan_source = __esm({
16882
16882
  continue;
16883
16883
  }
16884
16884
  for (const file of files) {
16885
- const filePath = join30(plansDir, file);
16885
+ const filePath = join31(plansDir, file);
16886
16886
  try {
16887
- const stat3 = statSync24(filePath);
16887
+ const stat3 = statSync25(filePath);
16888
16888
  const content = readFileSync20(filePath, "utf-8");
16889
16889
  const firstLine = content.split("\n").find((l) => l.trim())?.replace(/^#+\s*/, "").trim() || file;
16890
16890
  const planName = `${geminiBackend.idPrefix}plan_${sess}_${basename14(file, ".md")}`;
@@ -16915,7 +16915,7 @@ var init_plan_source = __esm({
16915
16915
  for (const match of content.matchAll(fullPathPattern)) {
16916
16916
  let path = (match[1] || "").trim();
16917
16917
  if (path.startsWith("~/")) {
16918
- path = join30(homedir9(), path.slice(2));
16918
+ path = join31(homedir9(), path.slice(2));
16919
16919
  }
16920
16920
  for (const projectDir of knownProjects) {
16921
16921
  if (path.startsWith(projectDir)) {
@@ -17000,9 +17000,9 @@ var init_plan_source = __esm({
17000
17000
  const map = /* @__PURE__ */ new Map();
17001
17001
  const root = claudeBackend.projectsDir();
17002
17002
  for (const proj of safeReaddir(root)) {
17003
- const projPath = join30(root, proj);
17003
+ const projPath = join31(root, proj);
17004
17004
  for (const sessionEntry of safeReaddir(projPath)) {
17005
- const subDir = join30(projPath, sessionEntry, "subagents");
17005
+ const subDir = join31(projPath, sessionEntry, "subagents");
17006
17006
  if (!existsSync27(subDir))
17007
17007
  continue;
17008
17008
  for (const f of safeReaddir(subDir)) {
@@ -17081,7 +17081,7 @@ var init_plan_source = __esm({
17081
17081
  return links;
17082
17082
  }
17083
17083
  async *discoverAgyPlans() {
17084
- const brainDir = join30(agyBackend.homeDir(), "brain");
17084
+ const brainDir = join31(agyBackend.homeDir(), "brain");
17085
17085
  if (!existsSync27(brainDir))
17086
17086
  return;
17087
17087
  let sessionDirs;
@@ -17091,9 +17091,9 @@ var init_plan_source = __esm({
17091
17091
  return;
17092
17092
  }
17093
17093
  for (const rawId of sessionDirs) {
17094
- const sessionPath = join30(brainDir, rawId);
17094
+ const sessionPath = join31(brainDir, rawId);
17095
17095
  try {
17096
- if (!statSync24(sessionPath).isDirectory())
17096
+ if (!statSync25(sessionPath).isDirectory())
17097
17097
  continue;
17098
17098
  } catch {
17099
17099
  continue;
@@ -17105,9 +17105,9 @@ var init_plan_source = __esm({
17105
17105
  continue;
17106
17106
  }
17107
17107
  for (const file of files) {
17108
- const filePath = join30(sessionPath, file);
17108
+ const filePath = join31(sessionPath, file);
17109
17109
  try {
17110
- const stat3 = statSync24(filePath);
17110
+ const stat3 = statSync25(filePath);
17111
17111
  const content = readFileSync20(filePath, "utf-8");
17112
17112
  const firstLine = content.split("\n").find((l) => l.trim())?.replace(/^#+\s*/, "").trim() || file;
17113
17113
  const sessionLoc = agyBackend.findSession(rawId);
@@ -17137,8 +17137,8 @@ var init_plan_source = __esm({
17137
17137
  });
17138
17138
 
17139
17139
  // ../engine/dist/parsers/task-source.js
17140
- import { existsSync as existsSync28, readdirSync as readdirSync18, readFileSync as readFileSync21, statSync as statSync25 } from "fs";
17141
- import { join as join31 } from "path";
17140
+ import { existsSync as existsSync28, readdirSync as readdirSync18, readFileSync as readFileSync21, statSync as statSync26 } from "fs";
17141
+ import { join as join32 } from "path";
17142
17142
  var MAX_CHUNK_CHARS2, TaskSource;
17143
17143
  var init_task_source = __esm({
17144
17144
  "../engine/dist/parsers/task-source.js"() {
@@ -17176,10 +17176,10 @@ var init_task_source = __esm({
17176
17176
  return;
17177
17177
  }
17178
17178
  for (const file of files) {
17179
- const filePath = join31(todosDir, file);
17179
+ const filePath = join32(todosDir, file);
17180
17180
  let stat3;
17181
17181
  try {
17182
- stat3 = statSync25(filePath);
17182
+ stat3 = statSync26(filePath);
17183
17183
  } catch {
17184
17184
  continue;
17185
17185
  }
@@ -17225,9 +17225,9 @@ var init_task_source = __esm({
17225
17225
  if (!entry.isDirectory())
17226
17226
  continue;
17227
17227
  const sessionUuid = entry.name;
17228
- const taskDir = join31(tasksDir, sessionUuid);
17228
+ const taskDir = join32(tasksDir, sessionUuid);
17229
17229
  try {
17230
- const stat3 = statSync25(taskDir);
17230
+ const stat3 = statSync26(taskDir);
17231
17231
  const taskFiles = readdirSync18(taskDir).filter((f) => f.endsWith(".json"));
17232
17232
  if (taskFiles.length === 0)
17233
17233
  continue;
@@ -17300,7 +17300,7 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
17300
17300
  text,
17301
17301
  chunkType: "task_detail",
17302
17302
  projectPath: item.projectPath,
17303
- filePath: join31(taskDir, `${task.id}.json`),
17303
+ filePath: join32(taskDir, `${task.id}.json`),
17304
17304
  mtime: item.mtime
17305
17305
  });
17306
17306
  }
@@ -17357,7 +17357,7 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
17357
17357
  });
17358
17358
  for (const file of sorted) {
17359
17359
  try {
17360
- const content = readFileSync21(join31(taskDir, file), "utf-8");
17360
+ const content = readFileSync21(join32(taskDir, file), "utf-8");
17361
17361
  const task = JSON.parse(content);
17362
17362
  if (task.subject) {
17363
17363
  tasks.push(task);
@@ -17373,10 +17373,10 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
17373
17373
  });
17374
17374
 
17375
17375
  // ../engine/dist/parsers/claude-md-source.js
17376
- import { existsSync as existsSync29, readFileSync as readFileSync22, readdirSync as readdirSync19, statSync as statSync26 } from "fs";
17376
+ import { existsSync as existsSync29, readFileSync as readFileSync22, readdirSync as readdirSync19, statSync as statSync27 } from "fs";
17377
17377
  import { homedir as homedir10 } from "os";
17378
- import { join as join32, basename as basename15, dirname as dirname15 } from "path";
17379
- import { createHash as createHash11 } from "crypto";
17378
+ import { join as join33, basename as basename15, dirname as dirname16 } from "path";
17379
+ import { createHash as createHash12 } from "crypto";
17380
17380
  function discoverProjectDirs(claudeDir) {
17381
17381
  const dirs = [];
17382
17382
  const seen = /* @__PURE__ */ new Set();
@@ -17401,7 +17401,7 @@ function discoverProjectDirs(claudeDir) {
17401
17401
  }
17402
17402
  };
17403
17403
  if (claudeDir) {
17404
- scanProjectsDir(join32(claudeDir, "projects"));
17404
+ scanProjectsDir(join33(claudeDir, "projects"));
17405
17405
  return dirs;
17406
17406
  }
17407
17407
  const home = homedir10();
@@ -17409,7 +17409,7 @@ function discoverProjectDirs(claudeDir) {
17409
17409
  try {
17410
17410
  for (const entry of readdirSync19(home, { withFileTypes: true })) {
17411
17411
  if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
17412
- scanProjectsDir(join32(home, entry.name, "projects"));
17412
+ scanProjectsDir(join33(home, entry.name, "projects"));
17413
17413
  }
17414
17414
  }
17415
17415
  } catch {
@@ -17438,7 +17438,7 @@ function discoverProjectDirs(claudeDir) {
17438
17438
  } catch {
17439
17439
  }
17440
17440
  }
17441
- void createHash11;
17441
+ void createHash12;
17442
17442
  return dirs;
17443
17443
  }
17444
17444
  var MAX_CHUNK_CHARS3, NOTE_FILES, ClaudeMdSource;
@@ -17473,7 +17473,7 @@ var init_claude_md_source = __esm({
17473
17473
  const seen = /* @__PURE__ */ new Set();
17474
17474
  const seenKey = (path, tool) => `${tool}:${path}`;
17475
17475
  for (const note of NOTE_FILES) {
17476
- const p = join32(homedir10(), note.filename);
17476
+ const p = join33(homedir10(), note.filename);
17477
17477
  const key2 = seenKey(p, note.tool);
17478
17478
  if (existsSync29(p) && !seen.has(key2)) {
17479
17479
  seen.add(key2);
@@ -17485,7 +17485,7 @@ var init_claude_md_source = __esm({
17485
17485
  const projectDirs = discoverProjectDirs(this.claudeDir);
17486
17486
  for (const projectDir of projectDirs) {
17487
17487
  for (const note of NOTE_FILES) {
17488
- const p = join32(projectDir, note.filename);
17488
+ const p = join33(projectDir, note.filename);
17489
17489
  const key2 = seenKey(p, note.tool);
17490
17490
  if (existsSync29(p) && !seen.has(key2)) {
17491
17491
  seen.add(key2);
@@ -17499,7 +17499,7 @@ var init_claude_md_source = __esm({
17499
17499
  if (!existsSync29(searchDir))
17500
17500
  continue;
17501
17501
  for (const note of NOTE_FILES) {
17502
- const directPath = join32(searchDir, note.filename);
17502
+ const directPath = join33(searchDir, note.filename);
17503
17503
  const key2 = seenKey(directPath, note.tool);
17504
17504
  if (existsSync29(directPath) && !seen.has(key2)) {
17505
17505
  seen.add(key2);
@@ -17514,7 +17514,7 @@ var init_claude_md_source = __esm({
17514
17514
  if (!entry.isDirectory())
17515
17515
  continue;
17516
17516
  for (const note of NOTE_FILES) {
17517
- const p = join32(searchDir, entry.name, note.filename);
17517
+ const p = join33(searchDir, entry.name, note.filename);
17518
17518
  const key2 = seenKey(p, note.tool);
17519
17519
  if (existsSync29(p) && !seen.has(key2)) {
17520
17520
  seen.add(key2);
@@ -17570,8 +17570,8 @@ var init_claude_md_source = __esm({
17570
17570
  }
17571
17571
  fileToItem(filePath, filename, tool) {
17572
17572
  try {
17573
- const stat3 = statSync26(filePath);
17574
- const projectDir = dirname15(filePath);
17573
+ const stat3 = statSync27(filePath);
17574
+ const projectDir = dirname16(filePath);
17575
17575
  const projectName = basename15(projectDir);
17576
17576
  const projectPath = projectDir;
17577
17577
  const content = readFileSync22(filePath, "utf-8");
@@ -17599,9 +17599,9 @@ var init_claude_md_source = __esm({
17599
17599
  });
17600
17600
 
17601
17601
  // ../engine/dist/parsers/agent-memory-source.js
17602
- import { existsSync as existsSync30, readFileSync as readFileSync23, readdirSync as readdirSync20, statSync as statSync27 } from "fs";
17602
+ import { existsSync as existsSync30, readFileSync as readFileSync23, readdirSync as readdirSync20, statSync as statSync28 } from "fs";
17603
17603
  import { homedir as homedir11 } from "os";
17604
- import { join as join33, basename as basename16 } from "path";
17604
+ import { join as join34, basename as basename16 } from "path";
17605
17605
  function parseFrontmatter2(content) {
17606
17606
  const fm = {};
17607
17607
  let body = content;
@@ -17643,7 +17643,7 @@ function discoverMemoryDirs() {
17643
17643
  try {
17644
17644
  for (const entry of readdirSync20(home, { withFileTypes: true })) {
17645
17645
  if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
17646
- claudeRoots.push(join33(home, entry.name, "projects"));
17646
+ claudeRoots.push(join34(home, entry.name, "projects"));
17647
17647
  }
17648
17648
  }
17649
17649
  } catch {
@@ -17655,7 +17655,7 @@ function discoverMemoryDirs() {
17655
17655
  for (const entry of readdirSync20(projectsDir, { withFileTypes: true })) {
17656
17656
  if (!entry.isDirectory() || entry.name.startsWith("."))
17657
17657
  continue;
17658
- add(join33(projectsDir, entry.name, "memory"), entry.name);
17658
+ add(join34(projectsDir, entry.name, "memory"), entry.name);
17659
17659
  }
17660
17660
  } catch {
17661
17661
  }
@@ -17684,7 +17684,7 @@ var init_agent_memory_source = __esm({
17684
17684
  for (const entry of readdirSync20(memoryDir, { withFileTypes: true })) {
17685
17685
  if (!entry.isFile() || !entry.name.endsWith(".md"))
17686
17686
  continue;
17687
- const filePath = join33(memoryDir, entry.name);
17687
+ const filePath = join34(memoryDir, entry.name);
17688
17688
  if (seen.has(filePath))
17689
17689
  continue;
17690
17690
  seen.add(filePath);
@@ -17752,7 +17752,7 @@ var init_agent_memory_source = __esm({
17752
17752
  }
17753
17753
  fileToItem(filePath, filename, projectPath, _projectHash) {
17754
17754
  try {
17755
- const stat3 = statSync27(filePath);
17755
+ const stat3 = statSync28(filePath);
17756
17756
  const content = readFileSync23(filePath, "utf-8");
17757
17757
  const { fm } = parseFrontmatter2(content);
17758
17758
  const stem = filename.replace(/\.md$/, "");
@@ -17784,11 +17784,11 @@ var init_agent_memory_source = __esm({
17784
17784
  });
17785
17785
 
17786
17786
  // ../engine/dist/parsers/history-source.js
17787
- import { existsSync as existsSync31, readdirSync as readdirSync21, statSync as statSync28 } from "fs";
17787
+ import { existsSync as existsSync31, readdirSync as readdirSync21, statSync as statSync29 } from "fs";
17788
17788
  import { createReadStream as createReadStream3 } from "fs";
17789
17789
  import { createInterface as createInterface2 } from "readline";
17790
17790
  import { homedir as homedir12 } from "os";
17791
- import { join as join34 } from "path";
17791
+ import { join as join35 } from "path";
17792
17792
  var MAX_CHUNK_CHARS5, HistorySource;
17793
17793
  var init_history_source = __esm({
17794
17794
  "../engine/dist/parsers/history-source.js"() {
@@ -17813,12 +17813,12 @@ var init_history_source = __esm({
17813
17813
  try {
17814
17814
  for (const entry of readdirSync21(home, { withFileTypes: true })) {
17815
17815
  if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
17816
- tryAdd(join34(home, entry.name, "history.jsonl"));
17816
+ tryAdd(join35(home, entry.name, "history.jsonl"));
17817
17817
  }
17818
17818
  }
17819
17819
  } catch {
17820
17820
  }
17821
- this.historyPaths = paths.length > 0 ? paths : [join34(home, ".claude", "history.jsonl")];
17821
+ this.historyPaths = paths.length > 0 ? paths : [join35(home, ".claude", "history.jsonl")];
17822
17822
  }
17823
17823
  }
17824
17824
  async *discover() {
@@ -17827,7 +17827,7 @@ var init_history_source = __esm({
17827
17827
  const historyPath = this.historyPaths.find((p) => existsSync31(p));
17828
17828
  if (!historyPath)
17829
17829
  return;
17830
- const stat3 = statSync28(historyPath);
17830
+ const stat3 = statSync29(historyPath);
17831
17831
  const groups = await this.groupByProject();
17832
17832
  for (const [project, group] of groups) {
17833
17833
  const projectId = project.replace(/\//g, "-").replace(/^-/, "");
@@ -17968,9 +17968,9 @@ var init_history_source = __esm({
17968
17968
  });
17969
17969
 
17970
17970
  // ../engine/dist/parsers/paste-source.js
17971
- import { existsSync as existsSync32, readdirSync as readdirSync22, readFileSync as readFileSync24, statSync as statSync29 } from "fs";
17971
+ import { existsSync as existsSync32, readdirSync as readdirSync22, readFileSync as readFileSync24, statSync as statSync30 } from "fs";
17972
17972
  import { homedir as homedir13 } from "os";
17973
- import { join as join35, basename as basename17 } from "path";
17973
+ import { join as join36, basename as basename17 } from "path";
17974
17974
  var MAX_CHUNK_CHARS6, MAX_FILE_SIZE, PasteSource;
17975
17975
  var init_paste_source = __esm({
17976
17976
  "../engine/dist/parsers/paste-source.js"() {
@@ -17996,7 +17996,7 @@ var init_paste_source = __esm({
17996
17996
  try {
17997
17997
  for (const entry of readdirSync22(home, { withFileTypes: true })) {
17998
17998
  if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
17999
- tryAdd(join35(home, entry.name, "paste-cache"));
17999
+ tryAdd(join36(home, entry.name, "paste-cache"));
18000
18000
  }
18001
18001
  }
18002
18002
  } catch {
@@ -18016,9 +18016,9 @@ var init_paste_source = __esm({
18016
18016
  if (seen.has(file))
18017
18017
  continue;
18018
18018
  seen.add(file);
18019
- const filePath = join35(cacheDir, file);
18019
+ const filePath = join36(cacheDir, file);
18020
18020
  try {
18021
- const stat3 = statSync29(filePath);
18021
+ const stat3 = statSync30(filePath);
18022
18022
  if (stat3.size > MAX_FILE_SIZE)
18023
18023
  continue;
18024
18024
  if (stat3.size < 10)
@@ -18068,9 +18068,9 @@ var init_paste_source = __esm({
18068
18068
  });
18069
18069
 
18070
18070
  // ../engine/dist/parsers/gemini-source.js
18071
- import { existsSync as existsSync33, readdirSync as readdirSync23, readFileSync as readFileSync25, statSync as statSync30 } from "fs";
18072
- import { join as join36, basename as basename18 } from "path";
18073
- import { createHash as createHash12 } from "crypto";
18071
+ import { existsSync as existsSync33, readdirSync as readdirSync23, readFileSync as readFileSync25, statSync as statSync31 } from "fs";
18072
+ import { join as join37, basename as basename18 } from "path";
18073
+ import { createHash as createHash13 } from "crypto";
18074
18074
  function loadGeminiProjectMap2() {
18075
18075
  const map = /* @__PURE__ */ new Map();
18076
18076
  const projectsPath = geminiBackend.projectsJson();
@@ -18080,7 +18080,7 @@ function loadGeminiProjectMap2() {
18080
18080
  const data = JSON.parse(readFileSync25(projectsPath, "utf-8"));
18081
18081
  const projects = data.projects || {};
18082
18082
  for (const [path] of Object.entries(projects)) {
18083
- const hash = createHash12("sha256").update(path).digest("hex");
18083
+ const hash = createHash13("sha256").update(path).digest("hex");
18084
18084
  map.set(hash, path);
18085
18085
  }
18086
18086
  } catch {
@@ -18105,7 +18105,7 @@ var init_gemini_source = __esm({
18105
18105
  async *discover() {
18106
18106
  if (!isSourceEnabled("gemini", "sessions"))
18107
18107
  return;
18108
- const tmpDir = join36(this.geminiDir, "tmp");
18108
+ const tmpDir = join37(this.geminiDir, "tmp");
18109
18109
  if (!existsSync33(tmpDir))
18110
18110
  return;
18111
18111
  const seen = /* @__PURE__ */ new Set();
@@ -18113,15 +18113,15 @@ var init_gemini_source = __esm({
18113
18113
  for (const projectDirEntry of readdirSync23(tmpDir, { withFileTypes: true })) {
18114
18114
  if (!projectDirEntry.isDirectory())
18115
18115
  continue;
18116
- const chatsDir = join36(tmpDir, projectDirEntry.name, "chats");
18116
+ const chatsDir = join37(tmpDir, projectDirEntry.name, "chats");
18117
18117
  if (!existsSync33(chatsDir))
18118
18118
  continue;
18119
18119
  for (const file of readdirSync23(chatsDir)) {
18120
18120
  if (!file.endsWith(".json") || !file.startsWith("session-"))
18121
18121
  continue;
18122
- const filePath = join36(chatsDir, file);
18122
+ const filePath = join37(chatsDir, file);
18123
18123
  try {
18124
- const stat3 = statSync30(filePath);
18124
+ const stat3 = statSync31(filePath);
18125
18125
  const content = JSON.parse(readFileSync25(filePath, "utf-8"));
18126
18126
  const sessionId = content.sessionId || basename18(file, ".json");
18127
18127
  if (seen.has(sessionId))
@@ -18251,8 +18251,8 @@ var init_gemini_source = __esm({
18251
18251
  });
18252
18252
 
18253
18253
  // ../engine/dist/parsers/gemini-brain-source.js
18254
- import { existsSync as existsSync34, readdirSync as readdirSync24, readFileSync as readFileSync26, statSync as statSync31 } from "fs";
18255
- import { join as join37 } from "path";
18254
+ import { existsSync as existsSync34, readdirSync as readdirSync24, readFileSync as readFileSync26, statSync as statSync32 } from "fs";
18255
+ import { join as join38 } from "path";
18256
18256
  var MAX_CHUNK_CHARS8, GeminiBrainSource;
18257
18257
  var init_gemini_brain_source = __esm({
18258
18258
  "../engine/dist/parsers/gemini-brain-source.js"() {
@@ -18276,14 +18276,14 @@ var init_gemini_brain_source = __esm({
18276
18276
  for (const entry of sessions) {
18277
18277
  if (!entry.isDirectory())
18278
18278
  continue;
18279
- const sessionDir = join37(this.brainDir, entry.name);
18279
+ const sessionDir = join38(this.brainDir, entry.name);
18280
18280
  const files = readdirSync24(sessionDir).filter((f) => f.endsWith(".md") && !f.includes(".resolved") && !f.includes(".metadata"));
18281
18281
  if (files.length === 0)
18282
18282
  continue;
18283
18283
  for (const file of files) {
18284
- const filePath = join37(sessionDir, file);
18284
+ const filePath = join38(sessionDir, file);
18285
18285
  try {
18286
- const stat3 = statSync31(filePath);
18286
+ const stat3 = statSync32(filePath);
18287
18287
  const content = readFileSync26(filePath, "utf-8");
18288
18288
  const firstLine = content.split("\n").find((l) => l.trim() && !l.startsWith("#"))?.trim() || "";
18289
18289
  const heading = content.split("\n").find((l) => l.startsWith("#"))?.replace(/^#+\s*/, "").trim() || file;
@@ -18665,8 +18665,8 @@ var init_opencode_todo_source = __esm({
18665
18665
  });
18666
18666
 
18667
18667
  // ../engine/dist/parsers/codex-session-source.js
18668
- import { existsSync as existsSync37, readdirSync as readdirSync25, readFileSync as readFileSync27, statSync as statSync32 } from "fs";
18669
- import { join as join38, basename as basename19 } from "path";
18668
+ import { existsSync as existsSync37, readdirSync as readdirSync25, readFileSync as readFileSync27, statSync as statSync33 } from "fs";
18669
+ import { join as join39, basename as basename19 } from "path";
18670
18670
  function getCodexSessionsDir() {
18671
18671
  return codexBackend.sessionsDir();
18672
18672
  }
@@ -18727,7 +18727,7 @@ var init_codex_session_source = __esm({
18727
18727
  const jsonlFiles = this.collectJsonlFiles(this.sessionsDir);
18728
18728
  for (const filePath of jsonlFiles) {
18729
18729
  try {
18730
- const stat3 = statSync32(filePath);
18730
+ const stat3 = statSync33(filePath);
18731
18731
  const lines = readFileSync27(filePath, "utf-8").split("\n");
18732
18732
  const firstLine = lines.find((l) => l.trim());
18733
18733
  if (!firstLine)
@@ -18887,7 +18887,7 @@ var init_codex_session_source = __esm({
18887
18887
  if (!existsSync37(dir))
18888
18888
  return results;
18889
18889
  for (const entry of readdirSync25(dir, { withFileTypes: true })) {
18890
- const fullPath = join38(dir, entry.name);
18890
+ const fullPath = join39(dir, entry.name);
18891
18891
  if (entry.isDirectory()) {
18892
18892
  results.push(...this.collectJsonlFiles(fullPath));
18893
18893
  } else if (entry.isFile() && entry.name.startsWith("rollout-") && entry.name.endsWith(".jsonl")) {
@@ -18901,8 +18901,8 @@ var init_codex_session_source = __esm({
18901
18901
  });
18902
18902
 
18903
18903
  // ../engine/dist/parsers/diary-source.js
18904
- import { existsSync as existsSync38, mkdirSync as mkdirSync8, readdirSync as readdirSync26, readFileSync as readFileSync28, writeFileSync as writeFileSync6, statSync as statSync33 } from "fs";
18905
- import { join as join39, basename as basename20 } from "path";
18904
+ import { existsSync as existsSync38, mkdirSync as mkdirSync9, readdirSync as readdirSync26, readFileSync as readFileSync28, writeFileSync as writeFileSync6, statSync as statSync34 } from "fs";
18905
+ import { join as join40, basename as basename20 } from "path";
18906
18906
  var MAX_CHUNK_CHARS11, DiarySource;
18907
18907
  var init_diary_source = __esm({
18908
18908
  "../engine/dist/parsers/diary-source.js"() {
@@ -18921,12 +18921,12 @@ var init_diary_source = __esm({
18921
18921
  return;
18922
18922
  const agents = readdirSync26(this.diaryDir, { withFileTypes: true }).filter((d) => d.isDirectory());
18923
18923
  for (const agentDir of agents) {
18924
- const agentPath = join39(this.diaryDir, agentDir.name);
18924
+ const agentPath = join40(this.diaryDir, agentDir.name);
18925
18925
  const files = readdirSync26(agentPath).filter((f) => f.endsWith(".json"));
18926
18926
  for (const file of files) {
18927
- const filePath = join39(agentPath, file);
18927
+ const filePath = join40(agentPath, file);
18928
18928
  try {
18929
- const stat3 = statSync33(filePath);
18929
+ const stat3 = statSync34(filePath);
18930
18930
  const raw = readFileSync28(filePath, "utf-8");
18931
18931
  const entry = JSON.parse(raw);
18932
18932
  const entryId = basename20(file, ".json");
@@ -18991,13 +18991,13 @@ var init_diary_source = __esm({
18991
18991
  */
18992
18992
  static write(entry, diaryDir) {
18993
18993
  const dir = diaryDir || getDiaryDir();
18994
- const agentDir = join39(dir, entry.agent.toLowerCase().replace(/[^a-z0-9_-]/g, "_"));
18994
+ const agentDir = join40(dir, entry.agent.toLowerCase().replace(/[^a-z0-9_-]/g, "_"));
18995
18995
  if (!existsSync38(agentDir)) {
18996
- mkdirSync8(agentDir, { recursive: true });
18996
+ mkdirSync9(agentDir, { recursive: true });
18997
18997
  }
18998
18998
  const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
18999
18999
  const entryId = `diary_${entry.agent.toLowerCase()}_${ts}`;
19000
- const filePath = join39(agentDir, `${entryId}.json`);
19000
+ const filePath = join40(agentDir, `${entryId}.json`);
19001
19001
  const full = {
19002
19002
  ...entry,
19003
19003
  timestamp: entry.timestamp || (/* @__PURE__ */ new Date()).toISOString()
@@ -19010,14 +19010,14 @@ var init_diary_source = __esm({
19010
19010
  */
19011
19011
  static read(agentName, lastN = 10, diaryDir) {
19012
19012
  const dir = diaryDir || getDiaryDir();
19013
- const agentDir = join39(dir, agentName.toLowerCase().replace(/[^a-z0-9_-]/g, "_"));
19013
+ const agentDir = join40(dir, agentName.toLowerCase().replace(/[^a-z0-9_-]/g, "_"));
19014
19014
  if (!existsSync38(agentDir))
19015
19015
  return [];
19016
19016
  const files = readdirSync26(agentDir).filter((f) => f.endsWith(".json")).sort().reverse().slice(0, lastN);
19017
19017
  const entries = [];
19018
19018
  for (const file of files) {
19019
19019
  try {
19020
- const raw = readFileSync28(join39(agentDir, file), "utf-8");
19020
+ const raw = readFileSync28(join40(agentDir, file), "utf-8");
19021
19021
  entries.push(JSON.parse(raw));
19022
19022
  } catch {
19023
19023
  continue;
@@ -19062,9 +19062,9 @@ var init_redact_inline = __esm({
19062
19062
  });
19063
19063
 
19064
19064
  // ../engine/dist/parsers/skills-source.js
19065
- import { existsSync as existsSync39, readdirSync as readdirSync27, readFileSync as readFileSync29, statSync as statSync34 } from "fs";
19065
+ import { existsSync as existsSync39, readdirSync as readdirSync27, readFileSync as readFileSync29, statSync as statSync35 } from "fs";
19066
19066
  import { homedir as homedir14 } from "os";
19067
- import { join as join40 } from "path";
19067
+ import { join as join41 } from "path";
19068
19068
  function rebuildBody(content) {
19069
19069
  const { text, redacted } = redactInlineSecrets(content);
19070
19070
  const out = {};
@@ -19082,7 +19082,7 @@ function resolveRoots() {
19082
19082
  const home = homedir14();
19083
19083
  const all = [];
19084
19084
  if (isSourceEnabled("shared", "skills")) {
19085
- all.push({ path: join40(home, ".agents", "skills"), tool: "shared" });
19085
+ all.push({ path: join41(home, ".agents", "skills"), tool: "shared" });
19086
19086
  }
19087
19087
  if (isSourceEnabled("claude", "skills")) {
19088
19088
  all.push({ path: claudeBackend.skillsDir(), tool: "claude" });
@@ -19091,15 +19091,15 @@ function resolveRoots() {
19091
19091
  all.push({ path: geminiBackend.skillsDir(), tool: "gemini" });
19092
19092
  }
19093
19093
  if (isSourceEnabled("opencode", "skills")) {
19094
- all.push({ path: join40(home, ".config", "opencode", "skills"), tool: "opencode" }, { path: join40(home, ".config", "opencode", "skill"), tool: "opencode" }, { path: join40(home, ".opencode", "skill"), tool: "opencode" }, { path: join40(home, ".opencode", "skills"), tool: "opencode" });
19094
+ all.push({ path: join41(home, ".config", "opencode", "skills"), tool: "opencode" }, { path: join41(home, ".config", "opencode", "skill"), tool: "opencode" }, { path: join41(home, ".opencode", "skill"), tool: "opencode" }, { path: join41(home, ".opencode", "skills"), tool: "opencode" });
19095
19095
  }
19096
19096
  if (isSourceEnabled("codex", "skills")) {
19097
19097
  all.push({ path: codexBackend.skillsDir(), tool: "codex", skipChildren: [".system"] });
19098
19098
  all.push({ path: codexBackend.skillsSystemDir(), tool: "codex", readonly: true });
19099
19099
  }
19100
19100
  if (isSourceEnabled("cursor", "skills")) {
19101
- all.push({ path: join40(cursorHomeDir(), "skills"), tool: "cursor" });
19102
- all.push({ path: join40(cursorHomeDir(), "skills-cursor"), tool: "cursor", readonly: true });
19101
+ all.push({ path: join41(cursorHomeDir(), "skills"), tool: "cursor" });
19102
+ all.push({ path: join41(cursorHomeDir(), "skills-cursor"), tool: "cursor", readonly: true });
19103
19103
  }
19104
19104
  return all.filter((r) => existsSync39(r.path));
19105
19105
  }
@@ -19144,7 +19144,7 @@ var init_skills_source = __esm({
19144
19144
  const codexPluginsDir = codexBackend.pluginsDir();
19145
19145
  if (existsSync39(codexPluginsDir)) {
19146
19146
  for (const pluginName of readdirSync27(codexPluginsDir)) {
19147
- const skillsDir = join40(codexPluginsDir, pluginName, "skills");
19147
+ const skillsDir = join41(codexPluginsDir, pluginName, "skills");
19148
19148
  if (!existsSync39(skillsDir))
19149
19149
  continue;
19150
19150
  yield* this.fromSkillRoot({ path: skillsDir, tool: "codex" }, pluginName);
@@ -19161,16 +19161,16 @@ var init_skills_source = __esm({
19161
19161
  for (const name of entries) {
19162
19162
  if (root.skipChildren?.includes(name))
19163
19163
  continue;
19164
- const skillDir = join40(root.path, name);
19164
+ const skillDir = join41(root.path, name);
19165
19165
  let st;
19166
19166
  try {
19167
- st = statSync34(skillDir);
19167
+ st = statSync35(skillDir);
19168
19168
  } catch {
19169
19169
  continue;
19170
19170
  }
19171
19171
  if (!st.isDirectory())
19172
19172
  continue;
19173
- const skillMd = join40(skillDir, "SKILL.md");
19173
+ const skillMd = join41(skillDir, "SKILL.md");
19174
19174
  if (!existsSync39(skillMd))
19175
19175
  continue;
19176
19176
  let content;
@@ -19183,15 +19183,15 @@ var init_skills_source = __esm({
19183
19183
  const skillName = fm.name || name;
19184
19184
  let mtime = st.mtimeMs;
19185
19185
  try {
19186
- mtime = statSync34(skillMd).mtimeMs;
19186
+ mtime = statSync35(skillMd).mtimeMs;
19187
19187
  } catch {
19188
19188
  }
19189
19189
  const subdirs = {};
19190
19190
  try {
19191
19191
  for (const sub of readdirSync27(skillDir)) {
19192
- const subPath = join40(skillDir, sub);
19192
+ const subPath = join41(skillDir, sub);
19193
19193
  try {
19194
- const ss = statSync34(subPath);
19194
+ const ss = statSync35(subPath);
19195
19195
  if (ss.isDirectory()) {
19196
19196
  let count = 0;
19197
19197
  try {
@@ -19261,9 +19261,9 @@ var init_skills_source = __esm({
19261
19261
  });
19262
19262
 
19263
19263
  // ../engine/dist/parsers/mcps-source.js
19264
- import { existsSync as existsSync40, readdirSync as readdirSync28, readFileSync as readFileSync30, statSync as statSync35 } from "fs";
19264
+ import { existsSync as existsSync40, readdirSync as readdirSync28, readFileSync as readFileSync30, statSync as statSync36 } from "fs";
19265
19265
  import { homedir as homedir15 } from "os";
19266
- import { join as join41 } from "path";
19266
+ import { join as join42 } from "path";
19267
19267
  function readJson(path) {
19268
19268
  if (!existsSync40(path))
19269
19269
  return null;
@@ -19329,23 +19329,23 @@ var init_mcps_source = __esm({
19329
19329
  if (!isSourceEnabled("common", "mcps"))
19330
19330
  return;
19331
19331
  const home = homedir15();
19332
- yield* this.fromObject(readJson(join41(home, ".mcp.json"))?.mcpServers, {
19332
+ yield* this.fromObject(readJson(join42(home, ".mcp.json"))?.mcpServers, {
19333
19333
  tool: "claude",
19334
- filePath: join41(home, ".mcp.json"),
19334
+ filePath: join42(home, ".mcp.json"),
19335
19335
  scope: "global"
19336
19336
  });
19337
- yield* this.fromObject(readJson(join41(home, ".claude.json"))?.mcpServers, {
19337
+ yield* this.fromObject(readJson(join42(home, ".claude.json"))?.mcpServers, {
19338
19338
  tool: "claude",
19339
- filePath: join41(home, ".claude.json"),
19339
+ filePath: join42(home, ".claude.json"),
19340
19340
  scope: "user"
19341
19341
  });
19342
19342
  for (const path of [
19343
- join41(home, ".config", "opencode", "opencode.json"),
19344
- join41(home, ".config", "opencode", "opencode.jsonc"),
19345
- join41(home, ".config", "opencode", "config.json"),
19346
- join41(home, ".opencode", "opencode.json"),
19347
- join41(home, ".opencode", "opencode.jsonc"),
19348
- join41(home, ".opencode", "config.json")
19343
+ join42(home, ".config", "opencode", "opencode.json"),
19344
+ join42(home, ".config", "opencode", "opencode.jsonc"),
19345
+ join42(home, ".config", "opencode", "config.json"),
19346
+ join42(home, ".opencode", "opencode.json"),
19347
+ join42(home, ".opencode", "opencode.jsonc"),
19348
+ join42(home, ".opencode", "config.json")
19349
19349
  ]) {
19350
19350
  yield* this.fromObject(readJson(path)?.mcp, {
19351
19351
  tool: "opencode",
@@ -19360,13 +19360,13 @@ var init_mcps_source = __esm({
19360
19360
  filePath: geminiSettings,
19361
19361
  scope: "user"
19362
19362
  });
19363
- const cursorMcp = join41(cursorHomeDir(), "mcp.json");
19363
+ const cursorMcp = join42(cursorHomeDir(), "mcp.json");
19364
19364
  yield* this.fromObject(readJson(cursorMcp)?.mcpServers, {
19365
19365
  tool: "cursor",
19366
19366
  filePath: cursorMcp,
19367
19367
  scope: "user"
19368
19368
  });
19369
- const agyMcp = join41(home, ".gemini", "config", "mcp_config.json");
19369
+ const agyMcp = join42(home, ".gemini", "config", "mcp_config.json");
19370
19370
  yield* this.fromObject(readJson(agyMcp)?.mcpServers, {
19371
19371
  tool: "agy",
19372
19372
  filePath: agyMcp,
@@ -19376,7 +19376,7 @@ var init_mcps_source = __esm({
19376
19376
  const pluginsDir = codexBackend.pluginsDir();
19377
19377
  if (existsSync40(pluginsDir)) {
19378
19378
  for (const plugin of readdirSync28(pluginsDir)) {
19379
- const mcpPath = join41(pluginsDir, plugin, ".mcp.json");
19379
+ const mcpPath = join42(pluginsDir, plugin, ".mcp.json");
19380
19380
  yield* this.fromObject(readJson(mcpPath)?.mcpServers, {
19381
19381
  tool: "codex",
19382
19382
  filePath: mcpPath,
@@ -19390,7 +19390,7 @@ var init_mcps_source = __esm({
19390
19390
  return;
19391
19391
  let mtime = 0;
19392
19392
  try {
19393
- mtime = statSync35(ctx.filePath).mtimeMs;
19393
+ mtime = statSync36(ctx.filePath).mtimeMs;
19394
19394
  } catch {
19395
19395
  }
19396
19396
  for (const [name, cfgRaw] of Object.entries(obj)) {
@@ -19582,8 +19582,8 @@ var init_toolkit_format = __esm({
19582
19582
  });
19583
19583
 
19584
19584
  // ../engine/dist/parsers/slash-commands-source.js
19585
- import { existsSync as existsSync41, readdirSync as readdirSync29, readFileSync as readFileSync31, statSync as statSync36 } from "fs";
19586
- import { join as join42, basename as basename21 } from "path";
19585
+ import { existsSync as existsSync41, readdirSync as readdirSync29, readFileSync as readFileSync31, statSync as statSync37 } from "fs";
19586
+ import { join as join43, basename as basename21 } from "path";
19587
19587
  function rebuildBody2(content) {
19588
19588
  const { text, redacted } = redactInlineSecrets(content);
19589
19589
  const out = {};
@@ -19641,7 +19641,7 @@ var init_slash_commands_source = __esm({
19641
19641
  if (!entry.isDirectory() || entry.name.startsWith("."))
19642
19642
  continue;
19643
19643
  const projectPath = resolveProjectDirName(entry.name);
19644
- const cmdDir = join42(projectPath, ".claude", "commands");
19644
+ const cmdDir = join43(projectPath, ".claude", "commands");
19645
19645
  if (existsSync41(cmdDir))
19646
19646
  roots.push({ path: cmdDir, tool: "claude", scope: "project", projectPath, format: "md" });
19647
19647
  }
@@ -19659,7 +19659,7 @@ var init_slash_commands_source = __esm({
19659
19659
  roots.push({ path: codexBackend.promptsDir(), tool: "codex", scope: "user", projectPath: "", format: "md" });
19660
19660
  }
19661
19661
  if (isSourceEnabled("cursor", "commands")) {
19662
- roots.push({ path: join42(cursorHomeDir(), "commands"), tool: "cursor", scope: "user", projectPath: "", format: "md" });
19662
+ roots.push({ path: join43(cursorHomeDir(), "commands"), tool: "cursor", scope: "user", projectPath: "", format: "md" });
19663
19663
  }
19664
19664
  return roots;
19665
19665
  }
@@ -19673,9 +19673,9 @@ var init_slash_commands_source = __esm({
19673
19673
  continue;
19674
19674
  }
19675
19675
  for (const file of files) {
19676
- const filePath = join42(root.path, file);
19676
+ const filePath = join43(root.path, file);
19677
19677
  try {
19678
- const stat3 = statSync36(filePath);
19678
+ const stat3 = statSync37(filePath);
19679
19679
  const content = readFileSync31(filePath, "utf-8");
19680
19680
  const parsed = parseCommand(content, basename21(file, ext), root.format);
19681
19681
  yield {
@@ -19728,8 +19728,8 @@ var init_slash_commands_source = __esm({
19728
19728
  });
19729
19729
 
19730
19730
  // ../engine/dist/parsers/subagents-source.js
19731
- import { existsSync as existsSync42, readdirSync as readdirSync30, readFileSync as readFileSync32, statSync as statSync37 } from "fs";
19732
- import { join as join43, basename as basename22 } from "path";
19731
+ import { existsSync as existsSync42, readdirSync as readdirSync30, readFileSync as readFileSync32, statSync as statSync38 } from "fs";
19732
+ import { join as join44, basename as basename22 } from "path";
19733
19733
  function rebuildBody3(content) {
19734
19734
  const { text, redacted } = redactInlineSecrets(content);
19735
19735
  const out = {};
@@ -19789,7 +19789,7 @@ var init_subagents_source = __esm({
19789
19789
  if (!entry.isDirectory() || entry.name.startsWith("."))
19790
19790
  continue;
19791
19791
  const projectPath = resolveProjectDirName(entry.name);
19792
- const agentDir = join43(projectPath, ".claude", "agents");
19792
+ const agentDir = join44(projectPath, ".claude", "agents");
19793
19793
  if (existsSync42(agentDir))
19794
19794
  roots.push({ path: agentDir, tool: "claude", scope: "project", projectPath, format: "md" });
19795
19795
  }
@@ -19807,7 +19807,7 @@ var init_subagents_source = __esm({
19807
19807
  roots.push({ path: codexBackend.agentsDir(), tool: "codex", scope: "user", projectPath: "", format: "toml" });
19808
19808
  }
19809
19809
  if (isSourceEnabled("cursor", "agents")) {
19810
- roots.push({ path: join43(cursorHomeDir(), "agents"), tool: "cursor", scope: "user", projectPath: "", format: "md" });
19810
+ roots.push({ path: join44(cursorHomeDir(), "agents"), tool: "cursor", scope: "user", projectPath: "", format: "md" });
19811
19811
  }
19812
19812
  return roots;
19813
19813
  }
@@ -19821,9 +19821,9 @@ var init_subagents_source = __esm({
19821
19821
  continue;
19822
19822
  }
19823
19823
  for (const file of files) {
19824
- const filePath = join43(root.path, file);
19824
+ const filePath = join44(root.path, file);
19825
19825
  try {
19826
- const stat3 = statSync37(filePath);
19826
+ const stat3 = statSync38(filePath);
19827
19827
  const content = readFileSync32(filePath, "utf-8");
19828
19828
  const parsed = parseAgent(content, basename22(file, ext), root.format);
19829
19829
  yield {
@@ -19877,8 +19877,8 @@ var init_subagents_source = __esm({
19877
19877
  });
19878
19878
 
19879
19879
  // ../engine/dist/parsers/hooks-source.js
19880
- import { existsSync as existsSync43, readFileSync as readFileSync33, readdirSync as readdirSync31, statSync as statSync38 } from "fs";
19881
- import { join as join44 } from "path";
19880
+ import { existsSync as existsSync43, readFileSync as readFileSync33, readdirSync as readdirSync31, statSync as statSync39 } from "fs";
19881
+ import { join as join45 } from "path";
19882
19882
  function readJson2(path) {
19883
19883
  if (!existsSync43(path))
19884
19884
  return null;
@@ -19908,7 +19908,7 @@ var init_hooks_source = __esm({
19908
19908
  if (!entry.isDirectory() || entry.name.startsWith("."))
19909
19909
  continue;
19910
19910
  const projectPath = resolveProjectDirName(entry.name);
19911
- const settingsPath2 = join44(projectPath, ".claude", "settings.json");
19911
+ const settingsPath2 = join45(projectPath, ".claude", "settings.json");
19912
19912
  if (existsSync43(settingsPath2)) {
19913
19913
  yield* this.fromSettings(settingsPath2, "project", projectPath);
19914
19914
  }
@@ -19926,7 +19926,7 @@ var init_hooks_source = __esm({
19926
19926
  return;
19927
19927
  let mtime = 0;
19928
19928
  try {
19929
- mtime = statSync38(settingsPath2).mtimeMs;
19929
+ mtime = statSync39(settingsPath2).mtimeMs;
19930
19930
  } catch {
19931
19931
  }
19932
19932
  for (const [event, groups] of Object.entries(hooks)) {
@@ -20000,9 +20000,9 @@ var init_hooks_source = __esm({
20000
20000
  });
20001
20001
 
20002
20002
  // ../engine/dist/parsers/plugins-source.js
20003
- import { existsSync as existsSync44, readFileSync as readFileSync34, readdirSync as readdirSync32, statSync as statSync39 } from "fs";
20003
+ import { existsSync as existsSync44, readFileSync as readFileSync34, readdirSync as readdirSync32, statSync as statSync40 } from "fs";
20004
20004
  import { homedir as homedir16 } from "os";
20005
- import { join as join45 } from "path";
20005
+ import { join as join46 } from "path";
20006
20006
  function readJson3(path) {
20007
20007
  if (!existsSync44(path))
20008
20008
  return null;
@@ -20029,7 +20029,7 @@ var init_plugins_source = __esm({
20029
20029
  if (claudeJson?.plugins && typeof claudeJson.plugins === "object") {
20030
20030
  let mtime = 0;
20031
20031
  try {
20032
- mtime = statSync39(claudePluginsManifest).mtimeMs;
20032
+ mtime = statSync40(claudePluginsManifest).mtimeMs;
20033
20033
  } catch {
20034
20034
  }
20035
20035
  for (const [pluginRef, installs] of Object.entries(claudeJson.plugins)) {
@@ -20067,22 +20067,22 @@ var init_plugins_source = __esm({
20067
20067
  entries = [];
20068
20068
  }
20069
20069
  for (const name of entries) {
20070
- const dir = join45(gemRoot, name);
20070
+ const dir = join46(gemRoot, name);
20071
20071
  let st;
20072
20072
  try {
20073
- st = statSync39(dir);
20073
+ st = statSync40(dir);
20074
20074
  } catch {
20075
20075
  continue;
20076
20076
  }
20077
20077
  if (!st.isDirectory())
20078
20078
  continue;
20079
- const manifestPath = join45(dir, "gemini-extension.json");
20079
+ const manifestPath = join46(dir, "gemini-extension.json");
20080
20080
  const manifest = readJson3(manifestPath);
20081
20081
  if (!manifest || typeof manifest !== "object")
20082
20082
  continue;
20083
20083
  let mtime = st.mtimeMs;
20084
20084
  try {
20085
- mtime = statSync39(manifestPath).mtimeMs;
20085
+ mtime = statSync40(manifestPath).mtimeMs;
20086
20086
  } catch {
20087
20087
  }
20088
20088
  const mcpServers = manifest.mcpServers ? Object.keys(manifest.mcpServers) : [];
@@ -20115,20 +20115,20 @@ var init_plugins_source = __esm({
20115
20115
  entries = [];
20116
20116
  }
20117
20117
  for (const name of entries) {
20118
- const pluginDir = join45(codexPluginsRoot, name);
20118
+ const pluginDir = join46(codexPluginsRoot, name);
20119
20119
  let st;
20120
20120
  try {
20121
- st = statSync39(pluginDir);
20121
+ st = statSync40(pluginDir);
20122
20122
  } catch {
20123
20123
  continue;
20124
20124
  }
20125
20125
  if (!st.isDirectory())
20126
20126
  continue;
20127
- const appJson = readJson3(join45(pluginDir, ".codex-plugin", ".app.json"));
20128
- const pluginJson = readJson3(join45(pluginDir, ".codex-plugin", "plugin.json"));
20127
+ const appJson = readJson3(join46(pluginDir, ".codex-plugin", ".app.json"));
20128
+ const pluginJson = readJson3(join46(pluginDir, ".codex-plugin", "plugin.json"));
20129
20129
  const manifest = pluginJson || appJson || {};
20130
20130
  let mcpServers = [];
20131
- const mcpJson = readJson3(join45(pluginDir, ".mcp.json"));
20131
+ const mcpJson = readJson3(join46(pluginDir, ".mcp.json"));
20132
20132
  if (mcpJson?.mcpServers)
20133
20133
  mcpServers = Object.keys(mcpJson.mcpServers);
20134
20134
  yield {
@@ -20136,7 +20136,7 @@ var init_plugins_source = __esm({
20136
20136
  sourceType: "plugin",
20137
20137
  title: manifest.name || name,
20138
20138
  projectPath: "",
20139
- filePath: join45(pluginDir, ".codex-plugin"),
20139
+ filePath: join46(pluginDir, ".codex-plugin"),
20140
20140
  mtime: st.mtimeMs,
20141
20141
  contentPreview: (manifest.description || "").slice(0, 300),
20142
20142
  extra: {
@@ -20275,8 +20275,8 @@ var init_extractor_version = __esm({
20275
20275
  });
20276
20276
 
20277
20277
  // src/sync-ledger.ts
20278
- import { readFileSync as readFileSync35, writeFileSync as writeFileSync7, renameSync as renameSync5, mkdirSync as mkdirSync9 } from "node:fs";
20279
- import { join as join46, dirname as dirname16 } from "node:path";
20278
+ import { readFileSync as readFileSync35, writeFileSync as writeFileSync7, renameSync as renameSync5, mkdirSync as mkdirSync10 } from "node:fs";
20279
+ import { join as join47, dirname as dirname17 } from "node:path";
20280
20280
  function toRow(entry) {
20281
20281
  if (entry === void 0) return void 0;
20282
20282
  return typeof entry === "number" ? { m: entry, v: 0 } : entry;
@@ -20293,7 +20293,7 @@ function load() {
20293
20293
  }
20294
20294
  function persistNow(data) {
20295
20295
  const path = ledgerPath();
20296
- mkdirSync9(dirname16(path), { recursive: true });
20296
+ mkdirSync10(dirname17(path), { recursive: true });
20297
20297
  const tmp = `${path}.tmp`;
20298
20298
  writeFileSync7(tmp, JSON.stringify(data));
20299
20299
  renameSync5(tmp, path);
@@ -20368,7 +20368,7 @@ function saveItemVersions(server, versions) {
20368
20368
  const all = loadItemVersionsAll();
20369
20369
  all[server] = { ...all[server] || {}, ...versions };
20370
20370
  const path = itemVersionsPath();
20371
- mkdirSync9(dirname16(path), { recursive: true });
20371
+ mkdirSync10(dirname17(path), { recursive: true });
20372
20372
  const tmp = `${path}.tmp`;
20373
20373
  writeFileSync7(tmp, JSON.stringify(all));
20374
20374
  renameSync5(tmp, path);
@@ -20445,7 +20445,7 @@ function loadReconcile() {
20445
20445
  }
20446
20446
  function persistReconcile(data) {
20447
20447
  const path = reconcilePath();
20448
- mkdirSync9(dirname16(path), { recursive: true });
20448
+ mkdirSync10(dirname17(path), { recursive: true });
20449
20449
  const tmp = `${path}.tmp`;
20450
20450
  writeFileSync7(tmp, JSON.stringify(data));
20451
20451
  renameSync5(tmp, path);
@@ -20490,15 +20490,15 @@ var init_sync_ledger = __esm({
20490
20490
  "use strict";
20491
20491
  init_paths();
20492
20492
  init_extractor_version();
20493
- ledgerPath = () => join46(getDataDir(), "sync-ledger.json");
20493
+ ledgerPath = () => join47(getDataDir(), "sync-ledger.json");
20494
20494
  cache3 = null;
20495
20495
  LEDGER_FLUSH_MS = 2e3;
20496
20496
  pendingWrite = false;
20497
20497
  flushTimer = null;
20498
- itemVersionsPath = () => join46(getDataDir(), "item-versions.json");
20498
+ itemVersionsPath = () => join47(getDataDir(), "item-versions.json");
20499
20499
  itemVersionsCache = null;
20500
20500
  unackedCursorAttempts = 0;
20501
- reconcilePath = () => join46(getDataDir(), "sync-field-reconcile.json");
20501
+ reconcilePath = () => join47(getDataDir(), "sync-field-reconcile.json");
20502
20502
  reconcileCache = null;
20503
20503
  }
20504
20504
  });
@@ -20529,11 +20529,11 @@ var init_sync_fields = __esm({
20529
20529
  });
20530
20530
 
20531
20531
  // ../engine/dist/core/index-lock.js
20532
- import { existsSync as existsSync45, mkdirSync as mkdirSync10, openSync as openSync8, writeFileSync as writeFileSync8, readFileSync as readFileSync36, rmSync as rmSync4, statSync as statSync40, closeSync as closeSync8 } from "fs";
20533
- import { dirname as dirname17, join as join47 } from "path";
20532
+ import { existsSync as existsSync45, mkdirSync as mkdirSync11, openSync as openSync8, writeFileSync as writeFileSync8, readFileSync as readFileSync36, rmSync as rmSync4, statSync as statSync41, closeSync as closeSync8 } from "fs";
20533
+ import { dirname as dirname18, join as join48 } from "path";
20534
20534
  function acquireIndexLock(opts) {
20535
20535
  const lockPath = lockFilePath();
20536
- mkdirSync10(dirname17(lockPath), { recursive: true });
20536
+ mkdirSync11(dirname18(lockPath), { recursive: true });
20537
20537
  if (existsSync45(lockPath)) {
20538
20538
  if (!stealStaleLock(lockPath, opts.staleAfterMs ?? 10 * 6e4)) {
20539
20539
  return null;
@@ -20575,11 +20575,11 @@ function acquireIndexLock(opts) {
20575
20575
  };
20576
20576
  }
20577
20577
  function lockFilePath() {
20578
- return join47(getIndexDir(), ".compact.lock");
20578
+ return join48(getIndexDir(), ".compact.lock");
20579
20579
  }
20580
20580
  function stealStaleLock(lockPath, staleAfterMs) {
20581
20581
  try {
20582
- const s = statSync40(lockPath);
20582
+ const s = statSync41(lockPath);
20583
20583
  const age = Date.now() - s.mtimeMs;
20584
20584
  let payload;
20585
20585
  try {
@@ -20645,7 +20645,7 @@ var init_http = __esm({
20645
20645
  CLI_VERSION = JSON.parse(readFileSync37(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
20646
20646
  } catch {
20647
20647
  try {
20648
- if (true) CLI_VERSION = "0.5.32";
20648
+ if (true) CLI_VERSION = "0.6.0";
20649
20649
  } catch {
20650
20650
  }
20651
20651
  }
@@ -21142,16 +21142,16 @@ async function flush() {
21142
21142
  }
21143
21143
  function stableMark(value) {
21144
21144
  try {
21145
- const { createHash: createHash16 } = __require("node:crypto");
21146
- return createHash16("sha256").update(value).digest("hex").slice(0, 12);
21145
+ const { createHash: createHash17 } = __require("node:crypto");
21146
+ return createHash17("sha256").update(value).digest("hex").slice(0, 12);
21147
21147
  } catch {
21148
21148
  return "";
21149
21149
  }
21150
21150
  }
21151
21151
  function hashHost() {
21152
21152
  try {
21153
- const { createHash: createHash16 } = __require("node:crypto");
21154
- return createHash16("sha256").update(hostname()).digest("hex").slice(0, 12);
21153
+ const { createHash: createHash17 } = __require("node:crypto");
21154
+ return createHash17("sha256").update(hostname()).digest("hex").slice(0, 12);
21155
21155
  } catch {
21156
21156
  return "";
21157
21157
  }
@@ -21165,7 +21165,7 @@ var init_telemetry = __esm({
21165
21165
  init_sync_client();
21166
21166
  cliVersion2 = () => {
21167
21167
  try {
21168
- return true ? "0.5.32" : "dev";
21168
+ return true ? "0.6.0" : "dev";
21169
21169
  } catch {
21170
21170
  return "dev";
21171
21171
  }
@@ -21329,10 +21329,10 @@ __export(auto_update_exports, {
21329
21329
  import { execSync as execSync4 } from "node:child_process";
21330
21330
  import { readFileSync as readFileSync38 } from "node:fs";
21331
21331
  import { fileURLToPath as fileURLToPath2 } from "node:url";
21332
- import { writeFileSync as writeFileSync9, mkdtempSync as mkdtempSync3, rmSync as rmSync5, readdirSync as readdirSync33, statSync as statSync41 } from "node:fs";
21333
- import { join as join48, dirname as dirname18, sep as sep3 } from "node:path";
21334
- import { tmpdir as tmpdir2 } from "node:os";
21335
- import { createHash as createHash13 } from "node:crypto";
21332
+ import { writeFileSync as writeFileSync9, mkdtempSync as mkdtempSync3, rmSync as rmSync5, readdirSync as readdirSync33, statSync as statSync42 } from "node:fs";
21333
+ import { join as join49, dirname as dirname19, sep as sep3 } from "node:path";
21334
+ import { tmpdir as tmpdir3 } from "node:os";
21335
+ import { createHash as createHash14 } from "node:crypto";
21336
21336
  function compareVersions(a, b) {
21337
21337
  const pa = String(a).split("-")[0].split(".").map((n) => parseInt(n, 10) || 0);
21338
21338
  const pb = String(b).split("-")[0].split(".").map((n) => parseInt(n, 10) || 0);
@@ -21354,8 +21354,8 @@ function newerOf(a, b) {
21354
21354
  }
21355
21355
  function installedVersion() {
21356
21356
  try {
21357
- const here = dirname18(fileURLToPath2(import.meta.url));
21358
- const raw = readFileSync38(join48(here, "..", "package.json"), "utf-8");
21357
+ const here = dirname19(fileURLToPath2(import.meta.url));
21358
+ const raw = readFileSync38(join49(here, "..", "package.json"), "utf-8");
21359
21359
  return JSON.parse(raw).version || null;
21360
21360
  } catch {
21361
21361
  return null;
@@ -21368,7 +21368,7 @@ function planAutoUpdate(base, caps, ownVersion2, flag) {
21368
21368
  if (compareVersions(rel.version, ownVersion2) <= 0) return { update: false, reason: `already current (own ${ownVersion2} >= server ${rel.version})` };
21369
21369
  return { update: true, reason: `server ${rel.version} > own ${ownVersion2}`, url: tarballUrl(base), sha256: rel.sha256, from: ownVersion2, to: rel.version };
21370
21370
  }
21371
- function sweepStaleStaging(root = tmpdir2(), now = Date.now()) {
21371
+ function sweepStaleStaging(root = tmpdir3(), now = Date.now()) {
21372
21372
  const MKDTEMP_SUFFIX = /^cr-update-.{6}$/s;
21373
21373
  const COLD_MS = 60 * 60 * 1e3;
21374
21374
  let removed = 0;
@@ -21380,9 +21380,9 @@ function sweepStaleStaging(root = tmpdir2(), now = Date.now()) {
21380
21380
  }
21381
21381
  for (const name of entries) {
21382
21382
  if (!MKDTEMP_SUFFIX.test(name)) continue;
21383
- const dir = join48(root, name);
21383
+ const dir = join49(root, name);
21384
21384
  try {
21385
- const st = statSync41(dir);
21385
+ const st = statSync42(dir);
21386
21386
  if (!st.isDirectory() || now - st.mtimeMs < COLD_MS) continue;
21387
21387
  const inside = readdirSync33(dir);
21388
21388
  if (inside.length > 1 || inside.length === 1 && inside[0] !== "chat-recall.tgz") continue;
@@ -21401,16 +21401,16 @@ async function executeAutoUpdate(plan, deps) {
21401
21401
  } catch (e) {
21402
21402
  return { updated: false, reason: `download failed: ${e instanceof Error ? e.message : e}` };
21403
21403
  }
21404
- const got = createHash13("sha256").update(buf).digest("hex");
21404
+ const got = createHash14("sha256").update(buf).digest("hex");
21405
21405
  if (got !== plan.sha256) return { updated: false, reason: `checksum mismatch (expected ${plan.sha256.slice(0, 12)}\u2026, got ${got.slice(0, 12)}\u2026) \u2014 NOT installing` };
21406
- const dir = mkdtempSync3(join48(tmpdir2(), "cr-update-"));
21406
+ const dir = mkdtempSync3(join49(tmpdir3(), "cr-update-"));
21407
21407
  const discardStaging = () => {
21408
21408
  try {
21409
21409
  rmSync5(dir, { recursive: true, force: true });
21410
21410
  } catch {
21411
21411
  }
21412
21412
  };
21413
- const tgz = join48(dir, "chat-recall.tgz");
21413
+ const tgz = join49(dir, "chat-recall.tgz");
21414
21414
  writeFileSync9(tgz, buf);
21415
21415
  try {
21416
21416
  deps.install(tgz);
@@ -21538,10 +21538,10 @@ __export(sync_client_exports, {
21538
21538
  syncIncremental: () => syncIncremental,
21539
21539
  syncSessions: () => syncSessions
21540
21540
  });
21541
- import { join as join49, dirname as dirname19, basename as basename23 } from "node:path";
21542
- import { readFileSync as readFileSync39, writeFileSync as writeFileSync10, mkdirSync as mkdirSync11, mkdtempSync as mkdtempSync4, rmSync as rmSync6, chmodSync as chmodSync5, unlinkSync as unlinkSync3, readdirSync as readdirSync34, statSync as statSync42 } from "node:fs";
21543
- import { tmpdir as tmpdir3, hostname as hostname2 } from "node:os";
21544
- import { createHash as createHash14 } from "node:crypto";
21541
+ import { join as join50, dirname as dirname20, basename as basename23 } from "node:path";
21542
+ import { readFileSync as readFileSync39, writeFileSync as writeFileSync10, mkdirSync as mkdirSync12, mkdtempSync as mkdtempSync4, rmSync as rmSync6, chmodSync as chmodSync6, unlinkSync as unlinkSync3, readdirSync as readdirSync34, statSync as statSync43 } from "node:fs";
21543
+ import { tmpdir as tmpdir4, hostname as hostname2 } from "node:os";
21544
+ import { createHash as createHash15 } from "node:crypto";
21545
21545
  import { fileURLToPath as fileURLToPath3 } from "node:url";
21546
21546
  import { gzipSync as gzipSync3 } from "zlib";
21547
21547
  function classedError(errorClass, message) {
@@ -21574,12 +21574,12 @@ function classifyError(msg, err) {
21574
21574
  }
21575
21575
  function saveCredentials(c) {
21576
21576
  assertTransportSafe(c.serverUrl);
21577
- mkdirSync11(dirname19(credPath()), { recursive: true });
21577
+ mkdirSync12(dirname20(credPath()), { recursive: true });
21578
21578
  const targets = loadAllCredentials().filter((t) => t.serverUrl !== c.serverUrl);
21579
21579
  targets.unshift(c);
21580
21580
  writeFileSync10(credPath(), JSON.stringify({ targets }, null, 2));
21581
21581
  try {
21582
- chmodSync5(credPath(), 384);
21582
+ chmodSync6(credPath(), 384);
21583
21583
  } catch {
21584
21584
  }
21585
21585
  try {
@@ -21656,7 +21656,7 @@ function _resetTenantSecurityConfigCache() {
21656
21656
  _securityConfigCache.clear();
21657
21657
  }
21658
21658
  function syncConfigCachePath() {
21659
- return join49(getDataDir(), "sync-config-cache.json");
21659
+ return join50(getDataDir(), "sync-config-cache.json");
21660
21660
  }
21661
21661
  function readPersistedSyncConfigs() {
21662
21662
  try {
@@ -21669,7 +21669,7 @@ function persistSyncConfig(base, config2) {
21669
21669
  try {
21670
21670
  const all = readPersistedSyncConfigs();
21671
21671
  all[base] = { fetchedAt: Date.now(), config: config2 };
21672
- mkdirSync11(dirname19(syncConfigCachePath()), { recursive: true });
21672
+ mkdirSync12(dirname20(syncConfigCachePath()), { recursive: true });
21673
21673
  writeFileSync10(syncConfigCachePath(), JSON.stringify(all, null, 2));
21674
21674
  } catch {
21675
21675
  }
@@ -21934,7 +21934,7 @@ async function reconcileFields(opts = {}) {
21934
21934
  }
21935
21935
  return { sessions: fullRefs().length, scanned, pushed, absent, perTarget };
21936
21936
  }
21937
- function reapStaleScanDirs(dir = tmpdir3(), maxAgeMs = 6 * 36e5, now = Date.now()) {
21937
+ function reapStaleScanDirs(dir = tmpdir4(), maxAgeMs = 6 * 36e5, now = Date.now()) {
21938
21938
  let reaped = 0;
21939
21939
  let names;
21940
21940
  try {
@@ -21944,9 +21944,9 @@ function reapStaleScanDirs(dir = tmpdir3(), maxAgeMs = 6 * 36e5, now = Date.now(
21944
21944
  }
21945
21945
  for (const name of names) {
21946
21946
  if (!name.startsWith("cr-batchscan-")) continue;
21947
- const p = join49(dir, name);
21947
+ const p = join50(dir, name);
21948
21948
  try {
21949
- if (now - statSync42(p).mtimeMs < maxAgeMs) continue;
21949
+ if (now - statSync43(p).mtimeMs < maxAgeMs) continue;
21950
21950
  rmSync6(p, { recursive: true, force: true });
21951
21951
  reaped++;
21952
21952
  } catch {
@@ -21961,7 +21961,7 @@ function batchScanExternal(items, opts = {}) {
21961
21961
  let scanned = 0, slices = 0, scanMs = 0;
21962
21962
  if (items.length === 0) return { findings, scanned, slices, scanMs };
21963
21963
  reapStaleScanDirs();
21964
- let scanDir = mkdtempSync4(join49(tmpdir3(), "cr-batchscan-"));
21964
+ let scanDir = mkdtempSync4(join50(tmpdir4(), "cr-batchscan-"));
21965
21965
  let safeToId = /* @__PURE__ */ new Map();
21966
21966
  let bytesInDir = 0;
21967
21967
  const flushSlice = () => {
@@ -21992,13 +21992,13 @@ function batchScanExternal(items, opts = {}) {
21992
21992
  if (raw === null) continue;
21993
21993
  const safe = item.id.replace(/[^A-Za-z0-9_-]/g, "");
21994
21994
  safeToId.set(safe, item.id);
21995
- writeFileSync10(join49(scanDir, `${safe}.txt`), raw);
21995
+ writeFileSync10(join50(scanDir, `${safe}.txt`), raw);
21996
21996
  bytesInDir += Buffer.byteLength(raw);
21997
21997
  } catch {
21998
21998
  }
21999
21999
  if (bytesInDir >= maxBytes) {
22000
22000
  flushSlice();
22001
- scanDir = mkdtempSync4(join49(tmpdir3(), "cr-batchscan-"));
22001
+ scanDir = mkdtempSync4(join50(tmpdir4(), "cr-batchscan-"));
22002
22002
  }
22003
22003
  }
22004
22004
  flushSlice();
@@ -22321,7 +22321,7 @@ async function syncToTargetInScope(cred, opts = {}) {
22321
22321
  const kgSeen = /* @__PURE__ */ new Set();
22322
22322
  const kgEntityType = /* @__PURE__ */ new Map();
22323
22323
  const kgEntityNames = /* @__PURE__ */ new Set();
22324
- const kgKey = (subject, predicate, object, validFrom) => createHash14("sha1").update(`${subject}|${predicate}|${object}|${validFrom}`).digest("hex").slice(0, 16);
22324
+ const kgKey = (subject, predicate, object, validFrom) => createHash15("sha1").update(`${subject}|${predicate}|${object}|${validFrom}`).digest("hex").slice(0, 16);
22325
22325
  const accumulateKg = async (triples, sourceSession) => {
22326
22326
  for (const t of triples) {
22327
22327
  const key2 = kgKey(t.subject, t.predicate, t.object, t.validFrom ?? "");
@@ -22844,7 +22844,7 @@ async function buildConversationSync(ref, mtime, opts = {}) {
22844
22844
  } else if (opts.scanSecrets) {
22845
22845
  let tmp = null;
22846
22846
  try {
22847
- tmp = join49(tmpdir3(), `cr-scan-${ref.prefixedId.replace(/[^A-Za-z0-9_-]/g, "")}-${mtime}.txt`);
22847
+ tmp = join50(tmpdir4(), `cr-scan-${ref.prefixedId.replace(/[^A-Za-z0-9_-]/g, "")}-${mtime}.txt`);
22848
22848
  writeFileSync10(tmp, rawText);
22849
22849
  for (const f of scanFileForSecrets(tmp, { verifyOnly: opts.verifySecrets, tenantRules: opts.tenantRules })) {
22850
22850
  const verifiedAt = f.verified ? (/* @__PURE__ */ new Date()).toISOString() : null;
@@ -23072,11 +23072,11 @@ var init_sync_client = __esm({
23072
23072
  init_backends();
23073
23073
  ownVersion = "0.0.0";
23074
23074
  try {
23075
- const dir = dirname19(fileURLToPath3(import.meta.url));
23076
- ownVersion = JSON.parse(readFileSync39(join49(dir, "../package.json"), "utf-8")).version || ownVersion;
23075
+ const dir = dirname20(fileURLToPath3(import.meta.url));
23076
+ ownVersion = JSON.parse(readFileSync39(join50(dir, "../package.json"), "utf-8")).version || ownVersion;
23077
23077
  } catch {
23078
23078
  try {
23079
- if (true) ownVersion = "0.5.32";
23079
+ if (true) ownVersion = "0.6.0";
23080
23080
  } catch {
23081
23081
  }
23082
23082
  }
@@ -23088,14 +23088,14 @@ var init_sync_client = __esm({
23088
23088
  ]);
23089
23089
  walkProgressForUpload = null;
23090
23090
  lastServerPackSpec = null;
23091
- credPath = () => join49(getDataDir(), "credentials.json");
23091
+ credPath = () => join50(getDataDir(), "credentials.json");
23092
23092
  _securityConfigCache = /* @__PURE__ */ new Map();
23093
23093
  SECURITY_CONFIG_TTL_MS = 5 * 60 * 1e3;
23094
23094
  _syncConfigCache = /* @__PURE__ */ new Map();
23095
23095
  EMPTY_SYNC_CONFIG = { excludeTools: [], excludeProjects: [], excludeSources: [], approveSources: [] };
23096
23096
  _fetchTenantSyncConfigForTests = fetchTenantSyncConfig;
23097
23097
  SYNC_RULES_REFUSAL = /* @__PURE__ */ Symbol.for("chat-recall.syncRulesRefusal");
23098
- hashPath = (p) => p ? "p_" + createHash14("sha256").update(p).digest("hex").slice(0, 12) : "";
23098
+ hashPath = (p) => p ? "p_" + createHash15("sha256").update(p).digest("hex").slice(0, 12) : "";
23099
23099
  MAX_DERIVED_ROW_BYTES = 2 * 1024 * 1024;
23100
23100
  isLocalHost = isPrivateHost;
23101
23101
  CAPS_TTL_MS = 60 * 6e4;
@@ -23176,12 +23176,17 @@ var init_client_events = __esm({
23176
23176
  // src/update-notice.ts
23177
23177
  var update_notice_exports = {};
23178
23178
  __export(update_notice_exports, {
23179
+ newestKnown: () => newestKnown,
23179
23180
  printUpdateNotice: () => printUpdateNotice,
23180
23181
  refreshUpdateCheck: () => refreshUpdateCheck,
23181
23182
  updateNotice: () => updateNotice2
23182
23183
  });
23183
23184
  import { readFileSync as readFileSync41, writeFileSync as writeFileSync11 } from "node:fs";
23184
- import { join as join50 } from "node:path";
23185
+ import { join as join51 } from "node:path";
23186
+ function newestKnown(c) {
23187
+ const npm = c.npmVersion ?? "0.0.0";
23188
+ return compareVersions(npm, c.serverVersion) > 0 ? { version: npm, source: "npm" } : { version: c.serverVersion, source: "server" };
23189
+ }
23185
23190
  function readCheck() {
23186
23191
  try {
23187
23192
  const c = JSON.parse(readFileSync41(checkPath(), "utf-8"));
@@ -23200,8 +23205,24 @@ function updateNotice2() {
23200
23205
  const c = readCheck();
23201
23206
  if (!c) return null;
23202
23207
  const own = cliVersion();
23203
- if (compareVersions(c.serverVersion, own) <= 0) return null;
23204
- return `chat-recall ${c.serverVersion} is available (you have ${own}). Auto-update should apply it; force it now with: chat-recall update`;
23208
+ const { version: version2, source } = newestKnown(c);
23209
+ if (compareVersions(version2, own) <= 0) return null;
23210
+ const how = source === "npm" ? "The server you sync to has not rolled it yet \u2014 install it with: npm install -g chat-recall@latest" : "Auto-update should apply it; force it now with: chat-recall update";
23211
+ return `chat-recall ${version2} is available (you have ${own}). ${how}`;
23212
+ }
23213
+ async function fetchNpmLatest() {
23214
+ if (process.env.CHAT_RECALL_NO_NPM_CHECK === "1") return null;
23215
+ try {
23216
+ const res = await fetchWithTimeout(NPM_LATEST_URL, {
23217
+ headers: { accept: "application/vnd.npm.install-v1+json" }
23218
+ }, 5e3);
23219
+ if (!res.ok) return null;
23220
+ const body = await res.json();
23221
+ const v = body["dist-tags"]?.latest;
23222
+ return typeof v === "string" && v ? v : null;
23223
+ } catch {
23224
+ return null;
23225
+ }
23205
23226
  }
23206
23227
  async function refreshUpdateCheck(force = false) {
23207
23228
  const prev = readCheck();
@@ -23226,8 +23247,14 @@ async function refreshUpdateCheck(force = false) {
23226
23247
  } catch {
23227
23248
  return prev;
23228
23249
  }
23229
- if (newest === "0.0.0") return prev;
23230
- const next = { serverVersion: newest, checkedAt: Date.now() };
23250
+ const npmVersion = await fetchNpmLatest();
23251
+ if (newest === "0.0.0" && !npmVersion) return prev;
23252
+ const next = {
23253
+ // A server that answered nothing must not erase what we last knew from one.
23254
+ serverVersion: newest !== "0.0.0" ? newest : prev?.serverVersion ?? "0.0.0",
23255
+ checkedAt: Date.now()
23256
+ };
23257
+ if (npmVersion) next.npmVersion = npmVersion;
23231
23258
  writeCheck(next);
23232
23259
  return next;
23233
23260
  }
@@ -23247,7 +23274,7 @@ function printUpdateNotice() {
23247
23274
  } catch {
23248
23275
  }
23249
23276
  }
23250
- var CHECK_TTL_MS, checkPath, printed;
23277
+ var CHECK_TTL_MS, NPM_LATEST_URL, checkPath, printed;
23251
23278
  var init_update_notice = __esm({
23252
23279
  "src/update-notice.ts"() {
23253
23280
  "use strict";
@@ -23255,7 +23282,8 @@ var init_update_notice = __esm({
23255
23282
  init_auto_update();
23256
23283
  init_http();
23257
23284
  CHECK_TTL_MS = 6 * 3600 * 1e3;
23258
- checkPath = () => join50(getDataDir(), "update-check.json");
23285
+ NPM_LATEST_URL = "https://registry.npmjs.org/chat-recall";
23286
+ checkPath = () => join51(getDataDir(), "update-check.json");
23259
23287
  printed = false;
23260
23288
  }
23261
23289
  });
@@ -23271,11 +23299,11 @@ __export(install_skills_exports, {
23271
23299
  skillsSourceDir: () => skillsSourceDir,
23272
23300
  uninstallSkills: () => uninstallSkills
23273
23301
  });
23274
- import { readdirSync as readdirSync35, existsSync as existsSync47, mkdirSync as mkdirSync12, rmSync as rmSync7, cpSync, writeFileSync as writeFileSync12, readFileSync as readFileSync42, statSync as statSync43, realpathSync as realpathSync4 } from "fs";
23275
- import { createHash as createHash15 } from "crypto";
23276
- import { join as join51, basename as basename24 } from "path";
23302
+ import { readdirSync as readdirSync35, existsSync as existsSync47, mkdirSync as mkdirSync13, rmSync as rmSync7, cpSync, writeFileSync as writeFileSync12, readFileSync as readFileSync42, statSync as statSync44, realpathSync as realpathSync4 } from "fs";
23303
+ import { createHash as createHash16 } from "crypto";
23304
+ import { join as join52, basename as basename24 } from "path";
23277
23305
  function skillsSourceDir() {
23278
- return join51(import.meta.dirname, "..", "skills");
23306
+ return join52(import.meta.dirname, "..", "skills");
23279
23307
  }
23280
23308
  function version() {
23281
23309
  try {
@@ -23286,11 +23314,11 @@ function version() {
23286
23314
  }
23287
23315
  function skillsFingerprint() {
23288
23316
  const src = skillsSourceDir();
23289
- const h = createHash15("sha256");
23317
+ const h = createHash16("sha256");
23290
23318
  for (const name of bundledSkillNames()) {
23291
- for (const rel of filesUnder(join51(src, name)).sort()) {
23319
+ for (const rel of filesUnder(join52(src, name)).sort()) {
23292
23320
  h.update(name + "/" + rel);
23293
- h.update(readFileSync42(join51(src, name, rel)));
23321
+ h.update(readFileSync42(join52(src, name, rel)));
23294
23322
  }
23295
23323
  }
23296
23324
  return h.digest("hex").slice(0, 12);
@@ -23300,7 +23328,7 @@ function filesUnder(dir, prefix = "") {
23300
23328
  for (const e of readdirSync35(dir, { withFileTypes: true })) {
23301
23329
  if (e.name === MARKER) continue;
23302
23330
  const rel = prefix ? `${prefix}/${e.name}` : e.name;
23303
- if (e.isDirectory()) out.push(...filesUnder(join51(dir, e.name), rel));
23331
+ if (e.isDirectory()) out.push(...filesUnder(join52(dir, e.name), rel));
23304
23332
  else out.push(rel);
23305
23333
  }
23306
23334
  return out;
@@ -23311,7 +23339,7 @@ function skillStamp() {
23311
23339
  function bundledSkillNames() {
23312
23340
  const src = skillsSourceDir();
23313
23341
  if (!existsSync47(src)) return [];
23314
- return readdirSync35(src, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync47(join51(src, e.name, "SKILL.md"))).map((e) => e.name).sort();
23342
+ return readdirSync35(src, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync47(join52(src, e.name, "SKILL.md"))).map((e) => e.name).sort();
23315
23343
  }
23316
23344
  function realPathOrSelf(p) {
23317
23345
  try {
@@ -23324,7 +23352,7 @@ function claudeSkillTargets() {
23324
23352
  const targets = [];
23325
23353
  const seen = /* @__PURE__ */ new Set();
23326
23354
  for (const home of claudeHomeDirs()) {
23327
- const dir = join51(home, "skills");
23355
+ const dir = join52(home, "skills");
23328
23356
  const key2 = realPathOrSelf(dir);
23329
23357
  if (seen.has(key2)) continue;
23330
23358
  seen.add(key2);
@@ -23335,7 +23363,7 @@ function claudeSkillTargets() {
23335
23363
  dir,
23336
23364
  // Judge each profile on ITS OWN transcripts, not the primary's: a home
23337
23365
  // with no projects/ is a directory someone made, not a Claude install.
23338
- available: existsSync47(join51(home, "projects"))
23366
+ available: existsSync47(join52(home, "projects"))
23339
23367
  });
23340
23368
  }
23341
23369
  if (targets.length === 0) {
@@ -23357,11 +23385,11 @@ function skillTargets() {
23357
23385
  { id: "opencode", label: "OpenCode", dir: opencodeBackend.skillsDir(), available: opencodeBackend.isAvailable() },
23358
23386
  // Cursor DOES have its own dir (~/.cursor/skills). `skills-cursor` next to
23359
23387
  // it is Cursor's bundled set — read-only, never an install target.
23360
- { id: "cursor", label: "Cursor", dir: join51(cursorHomeDir(), "skills"), available: cursorBackend.isAvailable() }
23388
+ { id: "cursor", label: "Cursor", dir: join52(cursorHomeDir(), "skills"), available: cursorBackend.isAvailable() }
23361
23389
  ];
23362
23390
  }
23363
23391
  function isManaged(dir) {
23364
- return existsSync47(join51(dir, MARKER));
23392
+ return existsSync47(join52(dir, MARKER));
23365
23393
  }
23366
23394
  function installSkills(opts = {}) {
23367
23395
  const onlyAvailable = opts.onlyAvailable ?? true;
@@ -23378,15 +23406,15 @@ function installSkills(opts = {}) {
23378
23406
  continue;
23379
23407
  }
23380
23408
  for (const name of names) {
23381
- const dest = join51(t.dir, name);
23409
+ const dest = join52(t.dir, name);
23382
23410
  if (existsSync47(dest) && !isManaged(dest)) {
23383
23411
  skippedUserOwned.push(name);
23384
23412
  continue;
23385
23413
  }
23386
- mkdirSync12(t.dir, { recursive: true });
23414
+ mkdirSync13(t.dir, { recursive: true });
23387
23415
  rmSync7(dest, { recursive: true, force: true });
23388
- cpSync(join51(src, name), dest, { recursive: true });
23389
- writeFileSync12(join51(dest, MARKER), `${stamp}
23416
+ cpSync(join52(src, name), dest, { recursive: true });
23417
+ writeFileSync12(join52(dest, MARKER), `${stamp}
23390
23418
  `);
23391
23419
  installed.push(name);
23392
23420
  }
@@ -23405,7 +23433,7 @@ function uninstallSkills() {
23405
23433
  }
23406
23434
  for (const entry of readdirSync35(t.dir, { withFileTypes: true })) {
23407
23435
  if (!entry.isDirectory()) continue;
23408
- const dir = join51(t.dir, entry.name);
23436
+ const dir = join52(t.dir, entry.name);
23409
23437
  if (isManaged(dir) && (names.has(entry.name) || entry.name.startsWith("chat-recall"))) {
23410
23438
  rmSync7(dir, { recursive: true, force: true });
23411
23439
  removed.push(entry.name);
@@ -23422,7 +23450,7 @@ function skillsNeedRefresh() {
23422
23450
  for (const t of skillTargets()) {
23423
23451
  if (!t.available) continue;
23424
23452
  for (const name of names) {
23425
- const marker = join51(t.dir, name, MARKER);
23453
+ const marker = join52(t.dir, name, MARKER);
23426
23454
  if (!existsSync47(marker)) return true;
23427
23455
  try {
23428
23456
  if (readFileSync42(marker, "utf-8").trim() !== cur) return true;
@@ -23440,7 +23468,7 @@ function skillStatus() {
23440
23468
  let installed = 0;
23441
23469
  let ver = null;
23442
23470
  for (const name of names) {
23443
- const marker = join51(t.dir, name, MARKER);
23471
+ const marker = join52(t.dir, name, MARKER);
23444
23472
  if (existsSync47(marker)) {
23445
23473
  installed++;
23446
23474
  try {
@@ -23481,15 +23509,15 @@ __export(service_installer_exports, {
23481
23509
  uninstallService: () => uninstallService
23482
23510
  });
23483
23511
  import { execSync as execSync5 } from "child_process";
23484
- import { existsSync as existsSync48, mkdirSync as mkdirSync13, rmSync as rmSync8, writeFileSync as writeFileSync13 } from "fs";
23512
+ import { existsSync as existsSync48, mkdirSync as mkdirSync14, rmSync as rmSync8, writeFileSync as writeFileSync13 } from "fs";
23485
23513
  import { homedir as homedir17 } from "os";
23486
- import { join as join52 } from "path";
23514
+ import { join as join53 } from "path";
23487
23515
  import { fileURLToPath as fileURLToPath4 } from "url";
23488
23516
  function resolveDaemonPaths() {
23489
23517
  const watchJs = fileURLToPath4(new URL("./watch.js", import.meta.url));
23490
23518
  const node = process.execPath;
23491
- const dataDir = join52(homedir17(), ".chat-recall");
23492
- const logFile = join52(dataDir, "watch.log");
23519
+ const dataDir = join53(homedir17(), ".chat-recall");
23520
+ const logFile = join53(dataDir, "watch.log");
23493
23521
  return { watchJs, node, logFile, dataDir };
23494
23522
  }
23495
23523
  function tryCmd(cmd) {
@@ -23514,7 +23542,7 @@ function isServiceRunning() {
23514
23542
  }
23515
23543
  function installService() {
23516
23544
  const { watchJs, node, logFile, dataDir } = resolveDaemonPaths();
23517
- mkdirSync13(dataDir, { recursive: true });
23545
+ mkdirSync14(dataDir, { recursive: true });
23518
23546
  if (process.platform === "linux") {
23519
23547
  return installSystemd(watchJs, node, logFile);
23520
23548
  }
@@ -23530,10 +23558,10 @@ function installService() {
23530
23558
  );
23531
23559
  }
23532
23560
  function installSystemd(watchJs, node, logFile) {
23533
- const unitDir = join52(homedir17(), ".config", "systemd", "user");
23534
- const unitPath = join52(unitDir, "chat-recall-watch.service");
23561
+ const unitDir = join53(homedir17(), ".config", "systemd", "user");
23562
+ const unitPath = join53(unitDir, "chat-recall-watch.service");
23535
23563
  const unit = renderSystemdUnit(watchJs, node, logFile);
23536
- mkdirSync13(unitDir, { recursive: true });
23564
+ mkdirSync14(unitDir, { recursive: true });
23537
23565
  writeFileSync13(unitPath, unit);
23538
23566
  try {
23539
23567
  execSync5("systemctl --user daemon-reload && systemctl --user enable chat-recall-watch.service && systemctl --user restart chat-recall-watch.service", { stdio: "inherit" });
@@ -23578,10 +23606,10 @@ function renderSystemdUnit(watchJs, node, logFile) {
23578
23606
  }
23579
23607
  function installLaunchd(watchJs, node, logFile) {
23580
23608
  const label = "com.chat-recall.watch";
23581
- const plistDir = join52(homedir17(), "Library", "LaunchAgents");
23582
- const plistPath = join52(plistDir, `${label}.plist`);
23609
+ const plistDir = join53(homedir17(), "Library", "LaunchAgents");
23610
+ const plistPath = join53(plistDir, `${label}.plist`);
23583
23611
  const plist = renderLaunchdPlist(watchJs, node, logFile, label);
23584
- mkdirSync13(plistDir, { recursive: true });
23612
+ mkdirSync14(plistDir, { recursive: true });
23585
23613
  writeFileSync13(plistPath, plist);
23586
23614
  try {
23587
23615
  try {
@@ -23635,7 +23663,7 @@ function uninstallService() {
23635
23663
  removed = true;
23636
23664
  } catch {
23637
23665
  }
23638
- const unitPath = join52(homedir17(), ".config", "systemd", "user", "chat-recall-watch.service");
23666
+ const unitPath = join53(homedir17(), ".config", "systemd", "user", "chat-recall-watch.service");
23639
23667
  if (existsSync48(unitPath)) {
23640
23668
  rmSync8(unitPath, { force: true });
23641
23669
  removed = true;
@@ -23647,7 +23675,7 @@ function uninstallService() {
23647
23675
  return removed;
23648
23676
  }
23649
23677
  if (process.platform === "darwin") {
23650
- const plistPath = join52(homedir17(), "Library", "LaunchAgents", "com.chat-recall.watch.plist");
23678
+ const plistPath = join53(homedir17(), "Library", "LaunchAgents", "com.chat-recall.watch.plist");
23651
23679
  try {
23652
23680
  execSync5(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
23653
23681
  } catch {
@@ -23692,6 +23720,124 @@ var init_service_installer = __esm({
23692
23720
  // src/mcp.ts
23693
23721
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
23694
23722
  import { spawn as spawn3 } from "child_process";
23723
+ import { createServer, connect } from "node:net";
23724
+ import { unlinkSync as unlinkSync4 } from "node:fs";
23725
+
23726
+ // src/mcp-socket.ts
23727
+ import { createHash } from "node:crypto";
23728
+ import { tmpdir } from "node:os";
23729
+ import { join } from "node:path";
23730
+ import { accessSync, chmodSync, constants, mkdirSync, statSync } from "node:fs";
23731
+ import { dirname } from "node:path";
23732
+ var MAX_PATH = 100;
23733
+ var fits = (dir) => dir.length + 1 + 16 + 5 <= MAX_PATH;
23734
+ function socketDirCandidates() {
23735
+ if (process.platform === "win32") {
23736
+ const out2 = [];
23737
+ if (process.env.LOCALAPPDATA) out2.push(join(process.env.LOCALAPPDATA, "chat-recall", "run"));
23738
+ if (process.env.TEMP) out2.push(join(process.env.TEMP, "chat-recall-run"));
23739
+ out2.push(join(tmpdir(), "chat-recall-run"));
23740
+ return out2;
23741
+ }
23742
+ const out = [];
23743
+ const xdg = process.env.XDG_RUNTIME_DIR;
23744
+ if (xdg && xdg.length > 0) {
23745
+ const p = join(xdg, "chat-recall");
23746
+ if (fits(p)) out.push(p);
23747
+ }
23748
+ const uid = typeof process.getuid === "function" ? process.getuid() : 0;
23749
+ const named = join(tmpdir(), `chat-recall-${uid}`);
23750
+ if (fits(named)) out.push(named);
23751
+ const last = `/tmp/chat-recall-${uid}`;
23752
+ if (!out.includes(last)) out.push(last);
23753
+ return out;
23754
+ }
23755
+ var MAX_MISSING_LEVELS = 8;
23756
+ function isDir(path) {
23757
+ try {
23758
+ return statSync(path).isDirectory();
23759
+ } catch {
23760
+ return false;
23761
+ }
23762
+ }
23763
+ function usableDir(dir) {
23764
+ if (!isDir(dir)) {
23765
+ const missing = [];
23766
+ let cur = dir;
23767
+ let base = false;
23768
+ while (missing.length < MAX_MISSING_LEVELS) {
23769
+ const parent = dirname(cur);
23770
+ if (parent === cur) break;
23771
+ missing.push(cur);
23772
+ if (isDir(parent)) {
23773
+ base = true;
23774
+ break;
23775
+ }
23776
+ cur = parent;
23777
+ }
23778
+ if (!base) return false;
23779
+ for (let i = missing.length - 1; i >= 0; i--) {
23780
+ try {
23781
+ mkdirSync(missing[i]);
23782
+ } catch {
23783
+ }
23784
+ if (!isDir(missing[i])) return false;
23785
+ }
23786
+ }
23787
+ try {
23788
+ accessSync(dir, constants.W_OK);
23789
+ return true;
23790
+ } catch {
23791
+ return false;
23792
+ }
23793
+ }
23794
+ function privateDir(dir) {
23795
+ if (process.platform === "win32") return true;
23796
+ try {
23797
+ chmodSync(dir, 448);
23798
+ return (statSync(dir).mode & 63) === 0;
23799
+ } catch {
23800
+ return false;
23801
+ }
23802
+ }
23803
+ function ensureSocketDir() {
23804
+ const candidates2 = socketDirCandidates();
23805
+ for (const dir of candidates2) {
23806
+ if (!usableDir(dir)) continue;
23807
+ if (!privateDir(dir)) continue;
23808
+ return dir;
23809
+ }
23810
+ throw new Error(`no private runtime directory for the MCP daemon (tried ${candidates2.join(", ")})`);
23811
+ }
23812
+ function restrictSocket(path) {
23813
+ if (process.platform === "win32") return;
23814
+ try {
23815
+ chmodSync(path, 384);
23816
+ } catch {
23817
+ }
23818
+ }
23819
+ function socketSlug(version2) {
23820
+ const key2 = [
23821
+ process.env.CHAT_RECALL_MCP_PROFILE ?? "",
23822
+ process.env.CHAT_RECALL_SERVER ?? "",
23823
+ version2
23824
+ ].join(" ");
23825
+ return createHash("sha256").update(key2).digest("hex").slice(0, 16);
23826
+ }
23827
+ function socketPath(dir, version2) {
23828
+ const slug = socketSlug(version2);
23829
+ if (process.platform === "win32") return "\\\\.\\pipe\\chat-recall-" + slug;
23830
+ return join(dir, `${slug}.sock`);
23831
+ }
23832
+ var SOCKET_FLAG = "--socket";
23833
+ function socketPathFromArgv(argv) {
23834
+ const i = argv.indexOf(SOCKET_FLAG);
23835
+ if (i === -1) return void 0;
23836
+ const v = argv[i + 1];
23837
+ return v && !v.startsWith("--") ? v : void 0;
23838
+ }
23839
+
23840
+ // src/mcp.ts
23695
23841
  import { fileURLToPath as fileURLToPath5 } from "node:url";
23696
23842
 
23697
23843
  // ../engine/dist/mcp/tools.js
@@ -23832,8 +23978,8 @@ function isMultiTenant() {
23832
23978
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
23833
23979
  import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ListPromptsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
23834
23980
  import { z } from "zod";
23835
- import { existsSync as existsSync23, readFileSync as readFileSync18, statSync as statSync19 } from "fs";
23836
- import { join as join26 } from "path";
23981
+ import { existsSync as existsSync23, readFileSync as readFileSync18, statSync as statSync20 } from "fs";
23982
+ import { join as join27 } from "path";
23837
23983
 
23838
23984
  // ../engine/dist/core/context.js
23839
23985
  init_tool_backend();
@@ -23980,8 +24126,8 @@ function sanitizeQuery(query) {
23980
24126
 
23981
24127
  // ../engine/dist/core/write-ahead-log.js
23982
24128
  init_paths();
23983
- import { existsSync as existsSync18, mkdirSync as mkdirSync4, appendFileSync, openSync as openSync7, closeSync as closeSync7, chmodSync as chmodSync2 } from "fs";
23984
- import { join as join19 } from "path";
24129
+ import { existsSync as existsSync18, mkdirSync as mkdirSync5, appendFileSync, openSync as openSync7, closeSync as closeSync7, chmodSync as chmodSync3 } from "fs";
24130
+ import { join as join20 } from "path";
23985
24131
  var REDACT_KEYS = /* @__PURE__ */ new Set([
23986
24132
  "content",
23987
24133
  "text",
@@ -23998,13 +24144,13 @@ var WriteAheadLog = class {
23998
24144
  constructor(walDir) {
23999
24145
  const dir = walDir || getWalDir();
24000
24146
  if (!existsSync18(dir)) {
24001
- mkdirSync4(dir, { recursive: true });
24147
+ mkdirSync5(dir, { recursive: true });
24002
24148
  try {
24003
- chmodSync2(dir, 448);
24149
+ chmodSync3(dir, 448);
24004
24150
  } catch {
24005
24151
  }
24006
24152
  }
24007
- this.walPath = join19(dir, "write_log.jsonl");
24153
+ this.walPath = join20(dir, "write_log.jsonl");
24008
24154
  if (!existsSync18(this.walPath)) {
24009
24155
  const fd = openSync7(this.walPath, "w", 384);
24010
24156
  closeSync7(fd);
@@ -24194,7 +24340,7 @@ function remoteCredentials() {
24194
24340
  if (fromEnv)
24195
24341
  return { base: fromEnv.serverUrl, token: fromEnv.token };
24196
24342
  try {
24197
- const raw = readFileSync18(join26(getDataDir(), "credentials.json"), "utf-8");
24343
+ const raw = readFileSync18(join27(getDataDir(), "credentials.json"), "utf-8");
24198
24344
  const parsed = JSON.parse(raw);
24199
24345
  if (Array.isArray(parsed.targets) && parsed.targets.length) {
24200
24346
  const valid = parsed.targets.filter((t) => t?.serverUrl);
@@ -26894,7 +27040,7 @@ _Edits stayed local or window was off \u2014 try increasing buffer_minutes._` }]
26894
27040
  }
26895
27041
  case "recall_project_context": {
26896
27042
  const params = RecallProjectContextSchema.parse(args);
26897
- const target = existsSync23(params.project_path) && statSync19(params.project_path).isDirectory() ? resolveProjectId(params.project_path).id : params.project_path;
27043
+ const target = existsSync23(params.project_path) && statSync20(params.project_path).isDirectory() ? resolveProjectId(params.project_path).id : params.project_path;
26898
27044
  const dossier = await remoteGetQS(`/api/projects/${encodeURIComponent(target)}/dossier`, { sessions: params.limit, tasks: params.tasks, plans: params.plans });
26899
27045
  return { content: [{ type: "text", text: dossier.markdown }] };
26900
27046
  }
@@ -28531,10 +28677,112 @@ function installCrashGuards() {
28531
28677
  reportClientEvent2("mcp_crash", { message: err.stack || err.message });
28532
28678
  });
28533
28679
  }
28680
+ var RELAY_VERSION = true ? "0.6.0" : "0.0.0";
28681
+ function daemonIdleSecs() {
28682
+ const raw = process.env.CHAT_RECALL_DAEMON_IDLE_SECS;
28683
+ if (raw === void 0) return 900;
28684
+ const n = Number.parseInt(raw.trim(), 10);
28685
+ return Number.isFinite(n) ? n : 900;
28686
+ }
28687
+ function addressIsLive(path) {
28688
+ return new Promise((resolve3) => {
28689
+ const probe = connect(path);
28690
+ probe.once("connect", () => {
28691
+ probe.destroy();
28692
+ resolve3(true);
28693
+ });
28694
+ probe.once("error", () => {
28695
+ probe.destroy();
28696
+ resolve3(false);
28697
+ });
28698
+ });
28699
+ }
28700
+ function listen(path) {
28701
+ return new Promise((resolve3) => {
28702
+ const server = createServer();
28703
+ server.once("error", async (err) => {
28704
+ if (err.code !== "EADDRINUSE") return resolve3(null);
28705
+ if (await addressIsLive(path)) return resolve3(null);
28706
+ try {
28707
+ unlinkSync4(path);
28708
+ } catch {
28709
+ }
28710
+ const retry = createServer();
28711
+ retry.once("error", () => resolve3(null));
28712
+ retry.listen(path, () => {
28713
+ restrictSocket(path);
28714
+ resolve3(retry);
28715
+ });
28716
+ });
28717
+ server.listen(path, () => {
28718
+ restrictSocket(path);
28719
+ resolve3(server);
28720
+ });
28721
+ });
28722
+ }
28723
+ async function runDaemon() {
28724
+ let path = socketPathFromArgv(process.argv);
28725
+ if (!path) {
28726
+ try {
28727
+ path = socketPath(ensureSocketDir(), RELAY_VERSION);
28728
+ } catch (err) {
28729
+ console.error(`[mcp] ${err.message}; sessions will run in-process`);
28730
+ return false;
28731
+ }
28732
+ }
28733
+ const server = await listen(path);
28734
+ if (!server) {
28735
+ return false;
28736
+ }
28737
+ let live = 0;
28738
+ let idleSince = Date.now();
28739
+ server.on("connection", (socket) => {
28740
+ live += 1;
28741
+ socket.on("close", () => {
28742
+ live -= 1;
28743
+ if (live === 0) idleSince = Date.now();
28744
+ });
28745
+ socket.on("error", () => {
28746
+ });
28747
+ void createMcpServer().connect(new StdioServerTransport(socket, socket)).catch((err) => console.error("[mcp] session failed to start:", err?.message ?? err));
28748
+ });
28749
+ console.error(`[mcp] daemon listening on ${path} (v${RELAY_VERSION})`);
28750
+ const idleSecs = daemonIdleSecs();
28751
+ if (idleSecs > 0) {
28752
+ const timer = setInterval(() => {
28753
+ if (live > 0) return;
28754
+ if (Date.now() - idleSince < idleSecs * 1e3) return;
28755
+ clearInterval(timer);
28756
+ server.close(() => {
28757
+ try {
28758
+ if (process.platform !== "win32") unlinkSync4(path);
28759
+ } catch {
28760
+ }
28761
+ process.exit(0);
28762
+ });
28763
+ }, 5e3);
28764
+ timer.unref();
28765
+ }
28766
+ const shutdown = () => {
28767
+ try {
28768
+ server.close();
28769
+ if (process.platform !== "win32") unlinkSync4(path);
28770
+ } catch {
28771
+ }
28772
+ process.exit(0);
28773
+ };
28774
+ process.on("SIGTERM", shutdown);
28775
+ process.on("SIGINT", shutdown);
28776
+ return true;
28777
+ }
28534
28778
  async function main() {
28535
28779
  installCrashGuards();
28536
- const transport2 = new StdioServerTransport();
28537
- await createMcpServer().connect(transport2);
28780
+ if (process.argv.includes("--daemon")) {
28781
+ if (!await runDaemon()) return;
28782
+ } else {
28783
+ const transport2 = new StdioServerTransport();
28784
+ await createMcpServer().connect(transport2);
28785
+ }
28538
28786
  void (async () => {
28539
28787
  try {
28540
28788
  const m = await Promise.resolve().then(() => (init_install_skills(), install_skills_exports));