chat-recall 0.7.21 → 0.7.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -443,30 +443,30 @@ var require_caller = __commonJS({
443
443
  var require_redact = __commonJS({
444
444
  "../../node_modules/@pinojs/redact/index.js"(exports, module) {
445
445
  "use strict";
446
- function deepClone(obj) {
447
- if (obj === null || typeof obj !== "object") {
448
- return obj;
446
+ function deepClone(obj2) {
447
+ if (obj2 === null || typeof obj2 !== "object") {
448
+ return obj2;
449
449
  }
450
- if (obj instanceof Date) {
451
- return new Date(obj.getTime());
450
+ if (obj2 instanceof Date) {
451
+ return new Date(obj2.getTime());
452
452
  }
453
- if (obj instanceof Array) {
453
+ if (obj2 instanceof Array) {
454
454
  const cloned = [];
455
- for (let i = 0; i < obj.length; i++) {
456
- cloned[i] = deepClone(obj[i]);
455
+ for (let i = 0; i < obj2.length; i++) {
456
+ cloned[i] = deepClone(obj2[i]);
457
457
  }
458
458
  return cloned;
459
459
  }
460
- if (typeof obj === "object") {
461
- const cloned = Object.create(Object.getPrototypeOf(obj));
462
- for (const key2 in obj) {
463
- if (Object.prototype.hasOwnProperty.call(obj, key2)) {
464
- cloned[key2] = deepClone(obj[key2]);
460
+ if (typeof obj2 === "object") {
461
+ const cloned = Object.create(Object.getPrototypeOf(obj2));
462
+ for (const key2 in obj2) {
463
+ if (Object.prototype.hasOwnProperty.call(obj2, key2)) {
464
+ cloned[key2] = deepClone(obj2[key2]);
465
465
  }
466
466
  }
467
467
  return cloned;
468
468
  }
469
- return obj;
469
+ return obj2;
470
470
  }
471
471
  function parsePath(path) {
472
472
  const parts = [];
@@ -511,8 +511,8 @@ var require_redact = __commonJS({
511
511
  }
512
512
  return parts;
513
513
  }
514
- function setValue(obj, parts, value) {
515
- let current = obj;
514
+ function setValue(obj2, parts, value) {
515
+ let current = obj2;
516
516
  for (let i = 0; i < parts.length - 1; i++) {
517
517
  const key2 = parts[i];
518
518
  if (typeof current !== "object" || current === null || !(key2 in current)) {
@@ -543,8 +543,8 @@ var require_redact = __commonJS({
543
543
  }
544
544
  return true;
545
545
  }
546
- function removeKey(obj, parts) {
547
- let current = obj;
546
+ function removeKey(obj2, parts) {
547
+ let current = obj2;
548
548
  for (let i = 0; i < parts.length - 1; i++) {
549
549
  const key2 = parts[i];
550
550
  if (typeof current !== "object" || current === null || !(key2 in current)) {
@@ -576,8 +576,8 @@ var require_redact = __commonJS({
576
576
  return true;
577
577
  }
578
578
  var PATH_NOT_FOUND = /* @__PURE__ */ Symbol("PATH_NOT_FOUND");
579
- function getValueIfExists(obj, parts) {
580
- let current = obj;
579
+ function getValueIfExists(obj2, parts) {
580
+ let current = obj2;
581
581
  for (const part of parts) {
582
582
  if (current === null || current === void 0) {
583
583
  return PATH_NOT_FOUND;
@@ -592,8 +592,8 @@ var require_redact = __commonJS({
592
592
  }
593
593
  return current;
594
594
  }
595
- function getValue(obj, parts) {
596
- let current = obj;
595
+ function getValue(obj2, parts) {
596
+ let current = obj2;
597
597
  for (const part of parts) {
598
598
  if (current === null || current === void 0) {
599
599
  return void 0;
@@ -605,30 +605,30 @@ var require_redact = __commonJS({
605
605
  }
606
606
  return current;
607
607
  }
608
- function redactPaths(obj, paths, censor, remove = false) {
608
+ function redactPaths(obj2, paths, censor, remove = false) {
609
609
  for (const path of paths) {
610
610
  const parts = parsePath(path);
611
611
  if (parts.includes("*")) {
612
- redactWildcardPath(obj, parts, censor, path, remove);
612
+ redactWildcardPath(obj2, parts, censor, path, remove);
613
613
  } else {
614
614
  if (remove) {
615
- removeKey(obj, parts);
615
+ removeKey(obj2, parts);
616
616
  } else {
617
- const value = getValueIfExists(obj, parts);
617
+ const value = getValueIfExists(obj2, parts);
618
618
  if (value === PATH_NOT_FOUND) {
619
619
  continue;
620
620
  }
621
621
  const actualCensor = typeof censor === "function" ? censor(value, parts) : censor;
622
- setValue(obj, parts, actualCensor);
622
+ setValue(obj2, parts, actualCensor);
623
623
  }
624
624
  }
625
625
  }
626
626
  }
627
- function redactWildcardPath(obj, parts, censor, originalPath, remove = false) {
627
+ function redactWildcardPath(obj2, parts, censor, originalPath, remove = false) {
628
628
  const wildcardIndex = parts.indexOf("*");
629
629
  if (wildcardIndex === parts.length - 1) {
630
630
  const parentParts = parts.slice(0, -1);
631
- let current = obj;
631
+ let current = obj2;
632
632
  for (const part of parentParts) {
633
633
  if (current === null || current === void 0) return;
634
634
  if (typeof current !== "object" || current === null) return;
@@ -666,10 +666,10 @@ var require_redact = __commonJS({
666
666
  }
667
667
  }
668
668
  } else {
669
- redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove);
669
+ redactIntermediateWildcard(obj2, parts, censor, wildcardIndex, originalPath, remove);
670
670
  }
671
671
  }
672
- function redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove = false) {
672
+ function redactIntermediateWildcard(obj2, parts, censor, wildcardIndex, originalPath, remove = false) {
673
673
  const beforeWildcard = parts.slice(0, wildcardIndex);
674
674
  const afterWildcard = parts.slice(wildcardIndex + 1);
675
675
  const pathArray = [];
@@ -710,9 +710,9 @@ var require_redact = __commonJS({
710
710
  }
711
711
  }
712
712
  if (beforeWildcard.length === 0) {
713
- traverse(obj, 0);
713
+ traverse(obj2, 0);
714
714
  } else {
715
- let current = obj;
715
+ let current = obj2;
716
716
  for (let i = 0; i < beforeWildcard.length; i++) {
717
717
  const part = beforeWildcard[i];
718
718
  if (current === null || current === void 0) return;
@@ -743,9 +743,9 @@ var require_redact = __commonJS({
743
743
  }
744
744
  return pathStructure;
745
745
  }
746
- function selectiveClone(obj, pathStructure) {
746
+ function selectiveClone(obj2, pathStructure) {
747
747
  if (!pathStructure) {
748
- return obj;
748
+ return obj2;
749
749
  }
750
750
  function cloneSelectively(source, pathMap, depth = 0) {
751
751
  if (!pathMap || pathMap.size === 0) {
@@ -781,7 +781,7 @@ var require_redact = __commonJS({
781
781
  }
782
782
  return cloned;
783
783
  }
784
- return cloneSelectively(obj, pathStructure);
784
+ return cloneSelectively(obj2, pathStructure);
785
785
  }
786
786
  function validatePath(path) {
787
787
  if (typeof path !== "string") {
@@ -840,17 +840,17 @@ var require_redact = __commonJS({
840
840
  } = options;
841
841
  validatePaths(paths);
842
842
  const pathStructure = buildPathStructure(paths);
843
- return function redact(obj) {
844
- if (strict && (obj === null || typeof obj !== "object")) {
845
- if (obj === null || obj === void 0) {
846
- return serialize ? serialize(obj) : obj;
843
+ return function redact(obj2) {
844
+ if (strict && (obj2 === null || typeof obj2 !== "object")) {
845
+ if (obj2 === null || obj2 === void 0) {
846
+ return serialize ? serialize(obj2) : obj2;
847
847
  }
848
- if (typeof obj !== "object") {
849
- return serialize ? serialize(obj) : obj;
848
+ if (typeof obj2 !== "object") {
849
+ return serialize ? serialize(obj2) : obj2;
850
850
  }
851
851
  }
852
- const cloned = selectiveClone(obj, pathStructure);
853
- const original = obj;
852
+ const cloned = selectiveClone(obj2, pathStructure);
853
+ const original = obj2;
854
854
  let actualCensor = censor;
855
855
  if (typeof censor === "function") {
856
856
  actualCensor = censor;
@@ -1838,10 +1838,10 @@ var require_on_exit_leak_free = __commonJS({
1838
1838
  }
1839
1839
  function callRefs(event) {
1840
1840
  for (const ref of refs[event]) {
1841
- const obj = ref.deref();
1841
+ const obj2 = ref.deref();
1842
1842
  const fn = ref.fn;
1843
- if (obj !== void 0) {
1844
- fn(obj, event);
1843
+ if (obj2 !== void 0) {
1844
+ fn(obj2, event);
1845
1845
  }
1846
1846
  }
1847
1847
  refs[event] = [];
@@ -1853,32 +1853,32 @@ var require_on_exit_leak_free = __commonJS({
1853
1853
  uninstall(event);
1854
1854
  }
1855
1855
  }
1856
- function _register(event, obj, fn) {
1857
- if (obj === void 0) {
1856
+ function _register(event, obj2, fn) {
1857
+ if (obj2 === void 0) {
1858
1858
  throw new Error("the object can't be undefined");
1859
1859
  }
1860
1860
  install(event);
1861
- const ref = new WeakRef(obj);
1861
+ const ref = new WeakRef(obj2);
1862
1862
  ref.fn = fn;
1863
1863
  ensureRegistry();
1864
- registry.register(obj, ref);
1864
+ registry.register(obj2, ref);
1865
1865
  refs[event].push(ref);
1866
1866
  }
1867
- function register(obj, fn) {
1868
- _register("exit", obj, fn);
1867
+ function register(obj2, fn) {
1868
+ _register("exit", obj2, fn);
1869
1869
  }
1870
- function registerBeforeExit(obj, fn) {
1871
- _register("beforeExit", obj, fn);
1870
+ function registerBeforeExit(obj2, fn) {
1871
+ _register("beforeExit", obj2, fn);
1872
1872
  }
1873
- function unregister(obj) {
1873
+ function unregister(obj2) {
1874
1874
  if (registry === void 0) {
1875
1875
  return;
1876
1876
  }
1877
- registry.unregister(obj);
1877
+ registry.unregister(obj2);
1878
1878
  for (const event of ["exit", "beforeExit"]) {
1879
1879
  refs[event] = refs[event].filter((ref) => {
1880
1880
  const _obj = ref.deref();
1881
- return _obj && _obj !== obj;
1881
+ return _obj && _obj !== obj2;
1882
1882
  });
1883
1883
  uninstall(event);
1884
1884
  }
@@ -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: join67 } = __require("path");
2037
+ var { join: join68 } = __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"] || join67(__dirname, "lib", "worker.js");
2080
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join68(__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: join67, isAbsolute: isAbsolute5, sep: sep4 } = __require("node:path");
2483
+ var { join: join68, isAbsolute: isAbsolute5, sep: sep4 } = __require("node:path");
2484
2484
  var sleep2 = 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"] || join67(__dirname, "worker.js");
2546
+ target = bundlerOverrides["pino-worker"] || join68(__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"] || join67(__dirname, "worker.js");
2564
+ target = bundlerOverrides["pino-worker"] || join68(__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 join67(__dirname, "..", "file.js");
2586
+ return join68(__dirname, "..", "file.js");
2587
2587
  }
2588
2588
  let fixTarget2;
2589
2589
  for (const filePath of callers) {
@@ -2706,14 +2706,14 @@ var require_tools = __commonJS({
2706
2706
  }
2707
2707
  return point < 32 ? JSON.stringify(str) : '"' + result + '"';
2708
2708
  }
2709
- function asJson(obj, msg, num, time) {
2709
+ function asJson(obj2, msg, num, time) {
2710
2710
  if (asJsonChan.hasSubscribers === false) {
2711
- return _asJson.call(this, obj, msg, num, time);
2711
+ return _asJson.call(this, obj2, msg, num, time);
2712
2712
  }
2713
2713
  const store = { instance: this, arguments };
2714
- return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time);
2714
+ return asJsonChan.traceSync(_asJson, store, this, obj2, msg, num, time);
2715
2715
  }
2716
- function _asJson(obj, msg, num, time) {
2716
+ function _asJson(obj2, msg, num, time) {
2717
2717
  const stringify2 = this[stringifySym];
2718
2718
  const stringifySafe = this[stringifySafeSym];
2719
2719
  const stringifiers = this[stringifiersSym];
@@ -2727,13 +2727,13 @@ var require_tools = __commonJS({
2727
2727
  data = data + chindings;
2728
2728
  let value;
2729
2729
  if (formatters.log) {
2730
- obj = formatters.log(obj);
2730
+ obj2 = formatters.log(obj2);
2731
2731
  }
2732
2732
  const wildcardStringifier = stringifiers[wildcardFirstSym];
2733
2733
  let propStr = "";
2734
- for (const key2 in obj) {
2735
- value = obj[key2];
2736
- if (Object.prototype.hasOwnProperty.call(obj, key2) && value !== void 0) {
2734
+ for (const key2 in obj2) {
2735
+ value = obj2[key2];
2736
+ if (Object.prototype.hasOwnProperty.call(obj2, key2) && value !== void 0) {
2737
2737
  if (serializers[key2]) {
2738
2738
  value = serializers[key2](value);
2739
2739
  } else if (key2 === errorKey && serializers.err) {
@@ -2899,13 +2899,13 @@ var require_tools = __commonJS({
2899
2899
  return { opts, stream };
2900
2900
  };
2901
2901
  }
2902
- function stringify(obj, stringifySafeFn) {
2902
+ function stringify(obj2, stringifySafeFn) {
2903
2903
  try {
2904
- return JSON.stringify(obj);
2904
+ return JSON.stringify(obj2);
2905
2905
  } catch (_) {
2906
2906
  try {
2907
2907
  const stringify2 = stringifySafeFn || this[stringifySafeSym];
2908
- return stringify2(obj);
2908
+ return stringify2(obj2);
2909
2909
  } catch (_2) {
2910
2910
  return '"[unable to serialize, circular reference is too complex to analyze]"';
2911
2911
  }
@@ -3355,29 +3355,29 @@ var require_proto = __commonJS({
3355
3355
  const errorKey = this[errorKeySym];
3356
3356
  const messageKey = this[messageKeySym];
3357
3357
  const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy;
3358
- let obj;
3358
+ let obj2;
3359
3359
  const streamWriteHook = this[hooksSym].streamWrite;
3360
3360
  if (_obj === void 0 || _obj === null) {
3361
- obj = {};
3361
+ obj2 = {};
3362
3362
  } else if (_obj instanceof Error) {
3363
- obj = { [errorKey]: _obj };
3363
+ obj2 = { [errorKey]: _obj };
3364
3364
  if (msg === void 0) {
3365
3365
  msg = _obj.message;
3366
3366
  }
3367
3367
  } else {
3368
- obj = _obj;
3368
+ obj2 = _obj;
3369
3369
  if (msg === void 0 && _obj[messageKey] === void 0 && _obj[errorKey]) {
3370
3370
  msg = _obj[errorKey].message;
3371
3371
  }
3372
3372
  }
3373
3373
  if (mixin) {
3374
- obj = mixinMergeStrategy(obj, mixin(obj, num, this));
3374
+ obj2 = mixinMergeStrategy(obj2, mixin(obj2, num, this));
3375
3375
  }
3376
- const s = this[asJsonSym](obj, msg, num, t);
3376
+ const s = this[asJsonSym](obj2, msg, num, t);
3377
3377
  const stream = this[streamSym];
3378
3378
  if (stream[needsMetadataGsym] === true) {
3379
3379
  stream.lastLevel = num;
3380
- stream.lastObj = obj;
3380
+ stream.lastObj = obj2;
3381
3381
  stream.lastMsg = msg;
3382
3382
  stream.lastTime = t.slice(this[timeSliceIndexSym]);
3383
3383
  stream.lastLogger = this;
@@ -3572,7 +3572,7 @@ var require_safe_stable_stringify = __commonJS({
3572
3572
  return circularValue;
3573
3573
  }
3574
3574
  let res = "";
3575
- let join67 = ",";
3575
+ let join68 = ",";
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
- join67 = `,
3589
+ join68 = `,
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 += join67;
3597
+ res += join68;
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 += `${join67}"... ${getItemCount(removedKeys)} not stringified"`;
3603
+ res += `${join68}"... ${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
- join67 = `,
3624
+ join68 = `,
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 = join67;
3638
+ separator = join68;
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 = join67;
3644
+ separator = join68;
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 join67 = ",";
3685
+ let join68 = ",";
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
- join67 = `,
3698
+ join68 = `,
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 += join67;
3706
+ res += join68;
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 += `${join67}"... ${getItemCount(removedKeys)} not stringified"`;
3712
+ res += `${join68}"... ${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
- join67 = `,
3725
+ join68 = `,
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 = join67;
3734
+ separator = join68;
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 join68 = `,
3792
+ const join69 = `,
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 += join68;
3799
+ res2 += join69;
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 += `${join68}"... ${getItemCount(removedKeys)} not stringified"`;
3805
+ res2 += `${join69}"... ${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 join67 = `,
3821
+ const join68 = `,
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, join67, maximumBreadth);
3827
+ res += stringifyTypedArray(value, join68, maximumBreadth);
3828
3828
  keys = keys.slice(value.length);
3829
3829
  maximumPropertiesToStringify -= value.length;
3830
- separator = join67;
3830
+ separator = join68;
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 = join67;
3841
+ separator = join68;
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 = join67;
3847
+ separator = join68;
3848
3848
  }
3849
3849
  if (separator !== "") {
3850
3850
  res = `
@@ -4959,30 +4959,30 @@ function declaredOrigin(value) {
4959
4959
  const kind = value.kind;
4960
4960
  return typeof kind === "string" && kind ? kind : void 0;
4961
4961
  }
4962
- function userRecordOrigin(obj, text) {
4963
- if (obj.isSidechain === true)
4962
+ function userRecordOrigin(obj2, text) {
4963
+ if (obj2.isSidechain === true)
4964
4964
  return "subagent";
4965
- if (obj.isCompactSummary === true)
4965
+ if (obj2.isCompactSummary === true)
4966
4966
  return "compact-summary";
4967
- const declared = declaredOrigin(obj.origin);
4967
+ const declared = declaredOrigin(obj2.origin);
4968
4968
  if (declared && declared !== "human")
4969
4969
  return declared;
4970
- if (obj.isMeta === true)
4970
+ if (obj2.isMeta === true)
4971
4971
  return "meta";
4972
4972
  if (declared === "human")
4973
4973
  return "human";
4974
4974
  return originFromText(text);
4975
4975
  }
4976
- function queuedCommandPrompt(obj) {
4977
- if (obj.type !== "attachment")
4976
+ function queuedCommandPrompt(obj2) {
4977
+ if (obj2.type !== "attachment")
4978
4978
  return null;
4979
- const att = obj.attachment;
4979
+ const att = obj2.attachment;
4980
4980
  if (!att || att.type !== "queued_command")
4981
4981
  return null;
4982
4982
  const text = promptText(att.prompt);
4983
4983
  if (!text)
4984
4984
  return null;
4985
- if (obj.isSidechain === true)
4985
+ if (obj2.isSidechain === true)
4986
4986
  return { text, origin: "subagent" };
4987
4987
  const declared = declaredOrigin(att.origin);
4988
4988
  if (declared)
@@ -7254,17 +7254,17 @@ function stripBanners(s) {
7254
7254
  function promptFromLine(raw, maxLength) {
7255
7255
  if (!raw.trim())
7256
7256
  return null;
7257
- let obj;
7257
+ let obj2;
7258
7258
  try {
7259
- obj = JSON.parse(raw);
7259
+ obj2 = JSON.parse(raw);
7260
7260
  } catch {
7261
7261
  return null;
7262
7262
  }
7263
- if (obj.type !== "user")
7263
+ if (obj2.type !== "user")
7264
7264
  return null;
7265
- if (obj.isSidechain === true)
7265
+ if (obj2.isSidechain === true)
7266
7266
  return null;
7267
- const message = obj.message;
7267
+ const message = obj2.message;
7268
7268
  if (!message)
7269
7269
  return null;
7270
7270
  const content = message.content;
@@ -8028,17 +8028,17 @@ var init_claude = __esm({
8028
8028
  lineNum++;
8029
8029
  if (!line.trim())
8030
8030
  continue;
8031
- let obj;
8031
+ let obj2;
8032
8032
  try {
8033
- obj = JSON.parse(line);
8033
+ obj2 = JSON.parse(line);
8034
8034
  } catch {
8035
8035
  continue;
8036
8036
  }
8037
- const tsIso = typeof obj.timestamp === "string" ? obj.timestamp : void 0;
8037
+ const tsIso = typeof obj2.timestamp === "string" ? obj2.timestamp : void 0;
8038
8038
  const ts = tsIso ? Date.parse(tsIso) || mtime : mtime;
8039
- if (obj.type === "queue-operation") {
8040
- if (obj.operation === "enqueue" && typeof obj.content === "string") {
8041
- const text = stripReminders(obj.content);
8039
+ if (obj2.type === "queue-operation") {
8040
+ if (obj2.operation === "enqueue" && typeof obj2.content === "string") {
8041
+ const text = stripReminders(obj2.content);
8042
8042
  if (text && originFromText(text) === "human") {
8043
8043
  const e = { kind: "user", ts, tsIso, line: lineNum, text };
8044
8044
  events.push(e);
@@ -8051,15 +8051,15 @@ var init_claude = __esm({
8051
8051
  }
8052
8052
  continue;
8053
8053
  }
8054
- const delivered = queuedCommandPrompt(obj);
8054
+ const delivered = queuedCommandPrompt(obj2);
8055
8055
  if (delivered) {
8056
8056
  const text = stripReminders(delivered.text);
8057
8057
  if (text && delivered.origin === "human")
8058
8058
  pushPrompt({ kind: "user", ts, tsIso, line: lineNum, text });
8059
8059
  continue;
8060
8060
  }
8061
- if (obj.type === "user") {
8062
- const msg = obj.message;
8061
+ if (obj2.type === "user") {
8062
+ const msg = obj2.message;
8063
8063
  const content = msg?.content;
8064
8064
  let text = "";
8065
8065
  const toolResults = [];
@@ -8092,7 +8092,7 @@ var init_claude = __esm({
8092
8092
  }
8093
8093
  }
8094
8094
  const spoken = stripReminders(text);
8095
- if (spoken && userRecordOrigin(obj, spoken) === "human") {
8095
+ if (spoken && userRecordOrigin(obj2, spoken) === "human") {
8096
8096
  pushPrompt({ kind: "user", ts, tsIso, line: lineNum, text: spoken });
8097
8097
  }
8098
8098
  for (const tr of toolResults) {
@@ -8108,13 +8108,13 @@ var init_claude = __esm({
8108
8108
  resultBytes: tr.body.length
8109
8109
  });
8110
8110
  }
8111
- } else if (obj.type === "summary") {
8112
- const summary = typeof obj.summary === "string" ? obj.summary : "";
8111
+ } else if (obj2.type === "summary") {
8112
+ const summary = typeof obj2.summary === "string" ? obj2.summary : "";
8113
8113
  if (summary) {
8114
8114
  events.push({ kind: "summary", ts, tsIso, line: lineNum, text: summary });
8115
8115
  }
8116
- } else if (obj.type === "assistant") {
8117
- const msg = obj.message;
8116
+ } else if (obj2.type === "assistant") {
8117
+ const msg = obj2.message;
8118
8118
  const content = msg?.content;
8119
8119
  if (!Array.isArray(content))
8120
8120
  continue;
@@ -8592,9 +8592,9 @@ function readCwdFromJsonl(sessionPath) {
8592
8592
  if (!line || !line.includes('"cwd"'))
8593
8593
  continue;
8594
8594
  try {
8595
- const obj = JSON.parse(line);
8596
- if (typeof obj.cwd === "string" && obj.cwd)
8597
- return obj.cwd;
8595
+ const obj2 = JSON.parse(line);
8596
+ if (typeof obj2.cwd === "string" && obj2.cwd)
8597
+ return obj2.cwd;
8598
8598
  } catch {
8599
8599
  }
8600
8600
  }
@@ -8676,25 +8676,25 @@ async function parseSessionFile(sessionPath, maxMessages = 50) {
8676
8676
  lineNum++;
8677
8677
  if (!line.trim())
8678
8678
  continue;
8679
- let obj;
8679
+ let obj2;
8680
8680
  try {
8681
- obj = JSON.parse(line);
8681
+ obj2 = JSON.parse(line);
8682
8682
  } catch {
8683
8683
  continue;
8684
8684
  }
8685
8685
  try {
8686
- const msgType = obj.type;
8687
- if (!content.metadata.gitBranch && obj.gitBranch) {
8688
- content.metadata.gitBranch = obj.gitBranch;
8686
+ const msgType = obj2.type;
8687
+ if (!content.metadata.gitBranch && obj2.gitBranch) {
8688
+ content.metadata.gitBranch = obj2.gitBranch;
8689
8689
  }
8690
- if (!content.metadata.slug && obj.slug) {
8691
- content.metadata.slug = obj.slug;
8690
+ if (!content.metadata.slug && obj2.slug) {
8691
+ content.metadata.slug = obj2.slug;
8692
8692
  }
8693
- if (msgType === "system" && obj.subtype === "turn_duration" && obj.durationMs) {
8694
- content.metadata.durationMs += obj.durationMs;
8693
+ if (msgType === "system" && obj2.subtype === "turn_duration" && obj2.durationMs) {
8694
+ content.metadata.durationMs += obj2.durationMs;
8695
8695
  }
8696
8696
  if (msgType === "file-history-snapshot") {
8697
- const snapshot2 = obj.snapshot;
8697
+ const snapshot2 = obj2.snapshot;
8698
8698
  if (snapshot2 && typeof snapshot2 === "object") {
8699
8699
  const backups = snapshot2.trackedFileBackups;
8700
8700
  if (backups && typeof backups === "object") {
@@ -8705,14 +8705,14 @@ async function parseSessionFile(sessionPath, maxMessages = 50) {
8705
8705
  }
8706
8706
  }
8707
8707
  if (msgType === "summary") {
8708
- const summary = obj.summary;
8708
+ const summary = obj2.summary;
8709
8709
  if (summary) {
8710
8710
  content.summaries.push(summary);
8711
8711
  }
8712
8712
  } else if (msgType === "user") {
8713
8713
  if (userCount >= maxMessages)
8714
8714
  continue;
8715
- const msg = obj.message;
8715
+ const msg = obj2.message;
8716
8716
  let text = "";
8717
8717
  if (msg && typeof msg === "object") {
8718
8718
  const msgContent = msg.content;
@@ -8741,18 +8741,18 @@ async function parseSessionFile(sessionPath, maxMessages = 50) {
8741
8741
  text = textParts.join("\n");
8742
8742
  }
8743
8743
  }
8744
- if (text && userRecordOrigin(obj, text) === "human")
8744
+ if (text && userRecordOrigin(obj2, text) === "human")
8745
8745
  recordPrompt(text, lineNum);
8746
8746
  } else if (msgType === "queue-operation") {
8747
- if (obj.operation === "enqueue" && typeof obj.content === "string" && originFromText(obj.content) === "human") {
8748
- recordPrompt(obj.content, lineNum, "enqueue");
8747
+ if (obj2.operation === "enqueue" && typeof obj2.content === "string" && originFromText(obj2.content) === "human") {
8748
+ recordPrompt(obj2.content, lineNum, "enqueue");
8749
8749
  }
8750
8750
  } else if (msgType === "attachment") {
8751
- const queued = queuedCommandPrompt(obj);
8751
+ const queued = queuedCommandPrompt(obj2);
8752
8752
  if (queued?.origin === "human")
8753
8753
  recordPrompt(queued.text, lineNum, "delivery");
8754
8754
  } else if (msgType === "assistant") {
8755
- const msg = obj.message;
8755
+ const msg = obj2.message;
8756
8756
  if (!msg || typeof msg !== "object")
8757
8757
  continue;
8758
8758
  if (msg.model && typeof msg.model === "string") {
@@ -8818,7 +8818,7 @@ async function parseSessionFile(sessionPath, maxMessages = 50) {
8818
8818
  }
8819
8819
  }
8820
8820
  }
8821
- const toolResult = obj.toolUseResult;
8821
+ const toolResult = obj2.toolUseResult;
8822
8822
  if (toolResult && typeof toolResult === "object" && toolCount < maxMessages) {
8823
8823
  const resultText2 = toolResult.result;
8824
8824
  const query = toolResult.query;
@@ -8910,10 +8910,10 @@ async function parseMessagesFromFile(sessionPath) {
8910
8910
  }
8911
8911
  function messagesFromRawLines(raw) {
8912
8912
  const toolResults = /* @__PURE__ */ new Map();
8913
- for (const { obj } of raw) {
8914
- if (obj?.type !== "user")
8913
+ for (const { obj: obj2 } of raw) {
8914
+ if (obj2?.type !== "user")
8915
8915
  continue;
8916
- const content = obj.message?.content;
8916
+ const content = obj2.message?.content;
8917
8917
  if (!Array.isArray(content))
8918
8918
  continue;
8919
8919
  for (const block of content) {
@@ -8926,12 +8926,12 @@ function messagesFromRawLines(raw) {
8926
8926
  }
8927
8927
  }
8928
8928
  const messages = [];
8929
- for (const { line, obj } of raw) {
8930
- if (!obj || typeof obj !== "object")
8929
+ for (const { line, obj: obj2 } of raw) {
8930
+ if (!obj2 || typeof obj2 !== "object")
8931
8931
  continue;
8932
- const timestamp = typeof obj.timestamp === "string" ? obj.timestamp : void 0;
8933
- if (obj.type === "user") {
8934
- const content = obj.message?.content;
8932
+ const timestamp = typeof obj2.timestamp === "string" ? obj2.timestamp : void 0;
8933
+ if (obj2.type === "user") {
8934
+ const content = obj2.message?.content;
8935
8935
  let text = "";
8936
8936
  if (typeof content === "string") {
8937
8937
  text = content;
@@ -8943,18 +8943,18 @@ function messagesFromRawLines(raw) {
8943
8943
  const cleaned = stripBanners2(text);
8944
8944
  if (!cleaned)
8945
8945
  continue;
8946
- const origin = userRecordOrigin(obj, cleaned);
8946
+ const origin = userRecordOrigin(obj2, cleaned);
8947
8947
  messages.push({ line, role: "user", content: cleaned, timestamp, ...origin === "human" ? {} : { origin } });
8948
- } else if (obj.type === "attachment") {
8949
- const queued = queuedCommandPrompt(obj);
8948
+ } else if (obj2.type === "attachment") {
8949
+ const queued = queuedCommandPrompt(obj2);
8950
8950
  if (!queued)
8951
8951
  continue;
8952
8952
  const cleaned = stripBanners2(queued.text);
8953
8953
  if (!cleaned)
8954
8954
  continue;
8955
8955
  messages.push({ line, role: "user", content: cleaned, timestamp, ...queued.origin === "human" ? {} : { origin: queued.origin } });
8956
- } else if (obj.type === "assistant") {
8957
- const blocks = Array.isArray(obj.message?.content) ? obj.message.content : [];
8956
+ } else if (obj2.type === "assistant") {
8957
+ const blocks = Array.isArray(obj2.message?.content) ? obj2.message.content : [];
8958
8958
  const thinkingBlock = blocks.find((c) => c?.type === "thinking");
8959
8959
  const textBlock = blocks.find((c) => c?.type === "text");
8960
8960
  const toolUses = blocks.filter((c) => c?.type === "tool_use");
@@ -8980,10 +8980,10 @@ function messagesFromRawLines(raw) {
8980
8980
  toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
8981
8981
  timestamp
8982
8982
  });
8983
- } else if (obj.type === "summary" && typeof obj.summary === "string") {
8984
- messages.push({ line, role: "summary", content: obj.summary });
8985
- } else if (obj.type === "system" && obj.subtype === "away_summary") {
8986
- const c = obj.content;
8983
+ } else if (obj2.type === "summary" && typeof obj2.summary === "string") {
8984
+ messages.push({ line, role: "summary", content: obj2.summary });
8985
+ } else if (obj2.type === "system" && obj2.subtype === "away_summary") {
8986
+ const c = obj2.content;
8987
8987
  const text = typeof c === "string" ? c : Array.isArray(c) ? c.filter((b) => b?.type === "text" && typeof b.text === "string").map((b) => b.text).join("\n") : "";
8988
8988
  if (text.trim())
8989
8989
  messages.push({ line, role: "summary", content: stripBanners2(text), timestamp });
@@ -9181,31 +9181,31 @@ function parseCodexTranscriptText(text) {
9181
9181
  if (!line.trim())
9182
9182
  continue;
9183
9183
  try {
9184
- const obj = JSON.parse(line);
9185
- if (obj.type === "event_msg" && obj.payload?.type === "user_message") {
9186
- const text2 = String(obj.payload.message || "").trim();
9184
+ const obj2 = JSON.parse(line);
9185
+ if (obj2.type === "event_msg" && obj2.payload?.type === "user_message") {
9186
+ const text2 = String(obj2.payload.message || "").trim();
9187
9187
  if (!text2 || isCodexInjectedWrapper(text2))
9188
9188
  continue;
9189
9189
  messages.push({
9190
9190
  line: lineNum,
9191
9191
  role: "user",
9192
9192
  content: text2,
9193
- timestamp: obj.timestamp
9193
+ timestamp: obj2.timestamp
9194
9194
  });
9195
- } else if (obj.type === "response_item" && obj.payload?.type === "message") {
9196
- if (obj.payload.role !== "assistant")
9195
+ } else if (obj2.type === "response_item" && obj2.payload?.type === "message") {
9196
+ if (obj2.payload.role !== "assistant")
9197
9197
  continue;
9198
- const text2 = flattenCodexContent(obj.payload.content);
9198
+ const text2 = flattenCodexContent(obj2.payload.content);
9199
9199
  if (!text2.trim())
9200
9200
  continue;
9201
9201
  messages.push({
9202
9202
  line: lineNum,
9203
9203
  role: "assistant",
9204
9204
  content: text2,
9205
- timestamp: obj.timestamp
9205
+ timestamp: obj2.timestamp
9206
9206
  });
9207
- } else if (obj.type === "response_item" && obj.payload?.type === "reasoning") {
9208
- const summary = Array.isArray(obj.payload.summary) ? obj.payload.summary.map((s) => s?.text || "").filter(Boolean).join("\n") : "";
9207
+ } else if (obj2.type === "response_item" && obj2.payload?.type === "reasoning") {
9208
+ const summary = Array.isArray(obj2.payload.summary) ? obj2.payload.summary.map((s) => s?.text || "").filter(Boolean).join("\n") : "";
9209
9209
  if (!summary.trim())
9210
9210
  continue;
9211
9211
  messages.push({
@@ -9213,10 +9213,10 @@ function parseCodexTranscriptText(text) {
9213
9213
  role: "assistant",
9214
9214
  content: "",
9215
9215
  thinking: summary,
9216
- timestamp: obj.timestamp
9216
+ timestamp: obj2.timestamp
9217
9217
  });
9218
- } else if (obj.type === "response_item" && obj.payload?.type === "function_call") {
9219
- let input = obj.payload.arguments || {};
9218
+ } else if (obj2.type === "response_item" && obj2.payload?.type === "function_call") {
9219
+ let input = obj2.payload.arguments || {};
9220
9220
  if (typeof input === "string") {
9221
9221
  try {
9222
9222
  input = JSON.parse(input);
@@ -9227,8 +9227,8 @@ function parseCodexTranscriptText(text) {
9227
9227
  line: lineNum,
9228
9228
  role: "assistant",
9229
9229
  content: "",
9230
- toolCalls: [{ name: obj.payload.name || "", input }],
9231
- timestamp: obj.timestamp
9230
+ toolCalls: [{ name: obj2.payload.name || "", input }],
9231
+ timestamp: obj2.timestamp
9232
9232
  });
9233
9233
  }
9234
9234
  } catch {
@@ -9673,7 +9673,7 @@ async function archiveRawSession(store, sessionId) {
9673
9673
  }
9674
9674
  function detectForkPredecessor(sessionPath) {
9675
9675
  const { readFileSync: readFileSync54, readdirSync: readdirSync36 } = requireFs();
9676
- const { dirname: dirname30, join: join67, basename: basename30 } = requirePath();
9676
+ const { dirname: dirname30, join: join68, basename: basename30 } = requirePath();
9677
9677
  let text;
9678
9678
  try {
9679
9679
  text = readFileSync54(sessionPath, "utf-8");
@@ -9710,7 +9710,7 @@ function detectForkPredecessor(sessionPath) {
9710
9710
  if (!f.endsWith(".jsonl") || f === self || f === "sessions-index.json")
9711
9711
  continue;
9712
9712
  try {
9713
- if (readFileSync54(join67(dir, f), "utf-8").includes(`"uuid":"${headParent}"`)) {
9713
+ if (readFileSync54(join68(dir, f), "utf-8").includes(`"uuid":"${headParent}"`)) {
9714
9714
  return basename30(f, ".jsonl");
9715
9715
  }
9716
9716
  } catch {
@@ -10804,30 +10804,30 @@ var init_codex2 = __esm({
10804
10804
  lineNum++;
10805
10805
  if (!line.trim())
10806
10806
  continue;
10807
- let obj;
10807
+ let obj2;
10808
10808
  try {
10809
- obj = JSON.parse(line);
10809
+ obj2 = JSON.parse(line);
10810
10810
  } catch {
10811
10811
  continue;
10812
10812
  }
10813
- const tsIso = typeof obj.timestamp === "string" ? obj.timestamp : void 0;
10813
+ const tsIso = typeof obj2.timestamp === "string" ? obj2.timestamp : void 0;
10814
10814
  const ts = tsIso ? Date.parse(tsIso) || mtime : mtime;
10815
- const payload = obj.payload || {};
10816
- if (obj.type === "event_msg" && payload.type === "user_message") {
10815
+ const payload = obj2.payload || {};
10816
+ if (obj2.type === "event_msg" && payload.type === "user_message") {
10817
10817
  const text = String(payload.message || "").trim();
10818
10818
  if (text && !isCodexInjectedWrapper2(text)) {
10819
10819
  events.push({ kind: "user", ts, tsIso, line: lineNum, text });
10820
10820
  }
10821
- } else if (obj.type === "response_item" && payload.type === "message" && payload.role === "user") {
10821
+ } else if (obj2.type === "response_item" && payload.type === "message" && payload.role === "user") {
10822
10822
  const text = flattenContent(payload.content).trim();
10823
10823
  if (text && !isCodexInjectedWrapper2(text)) {
10824
10824
  events.push({ kind: "user", ts, tsIso, line: lineNum, text });
10825
10825
  }
10826
- } else if (obj.type === "response_item" && payload.type === "message" && payload.role === "assistant") {
10826
+ } else if (obj2.type === "response_item" && payload.type === "message" && payload.role === "assistant") {
10827
10827
  const text = flattenContent(payload.content).trim();
10828
10828
  if (text)
10829
10829
  events.push({ kind: "assistant_text", ts, tsIso, line: lineNum, text });
10830
- } else if (obj.type === "response_item" && payload.type === "function_call") {
10830
+ } else if (obj2.type === "response_item" && payload.type === "function_call") {
10831
10831
  const toolName = String(payload.name || "");
10832
10832
  const callId = String(payload.call_id || "");
10833
10833
  let args = payload.arguments;
@@ -10851,7 +10851,7 @@ var init_codex2 = __esm({
10851
10851
  toolInput: args,
10852
10852
  command
10853
10853
  });
10854
- } else if (obj.type === "response_item" && payload.type === "function_call_output") {
10854
+ } else if (obj2.type === "response_item" && payload.type === "function_call_output") {
10855
10855
  const callId = String(payload.call_id || "");
10856
10856
  const out = payload.output;
10857
10857
  let body2 = "";
@@ -11111,14 +11111,14 @@ function extractProjectPathFromTranscript(path, homeDir) {
11111
11111
  for (const line of content.split("\n")) {
11112
11112
  if (!line.trim())
11113
11113
  continue;
11114
- let obj;
11114
+ let obj2;
11115
11115
  try {
11116
- obj = JSON.parse(line);
11116
+ obj2 = JSON.parse(line);
11117
11117
  } catch {
11118
11118
  continue;
11119
11119
  }
11120
- if (obj.source === "USER_EXPLICIT" && obj.type === "USER_INPUT" && typeof obj.content === "string") {
11121
- const match = obj.content.match(/format\s+\[URI\]\s*->\s*\[CorpusName\]:\s*\n?\s*([^\s\n]+)\s*->/);
11120
+ if (obj2.source === "USER_EXPLICIT" && obj2.type === "USER_INPUT" && typeof obj2.content === "string") {
11121
+ const match = obj2.content.match(/format\s+\[URI\]\s*->\s*\[CorpusName\]:\s*\n?\s*([^\s\n]+)\s*->/);
11122
11122
  if (match && match[1])
11123
11123
  return match[1].trim();
11124
11124
  }
@@ -11236,6 +11236,10 @@ var init_agy = __esm({
11236
11236
  sharedSettingsFile() {
11237
11237
  return join14(this.sharedRootDir(), "settings.json");
11238
11238
  }
11239
+ /** The global hooks file the CLI reads. It does not read hooks from its own home directory. */
11240
+ sharedHooksFile() {
11241
+ return join14(this.sharedRootDir(), "config", "hooks.json");
11242
+ }
11239
11243
  sharedProjectsJson() {
11240
11244
  return join14(this.sharedRootDir(), "projects.json");
11241
11245
  }
@@ -11332,9 +11336,9 @@ var init_agy = __esm({
11332
11336
  const lines = readFileSync7(filePath, "utf-8").split("\n").filter(Boolean);
11333
11337
  messageCount = lines.length;
11334
11338
  for (const line of lines) {
11335
- const obj = JSON.parse(line);
11336
- if (obj.source === "USER_EXPLICIT" && obj.type === "USER_INPUT" && typeof obj.content === "string") {
11337
- const content = obj.content;
11339
+ const obj2 = JSON.parse(line);
11340
+ if (obj2.source === "USER_EXPLICIT" && obj2.type === "USER_INPUT" && typeof obj2.content === "string") {
11341
+ const content = obj2.content;
11338
11342
  const match = content.match(/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/);
11339
11343
  const rawText = match ? match[1].trim() : content.trim();
11340
11344
  firstPrompt = flatString(rawText.slice(0, 200));
@@ -11443,27 +11447,27 @@ var init_agy = __esm({
11443
11447
  lineNum++;
11444
11448
  if (!line.trim())
11445
11449
  continue;
11446
- let obj;
11450
+ let obj2;
11447
11451
  try {
11448
- obj = JSON.parse(line);
11452
+ obj2 = JSON.parse(line);
11449
11453
  } catch {
11450
11454
  continue;
11451
11455
  }
11452
- const tsIso = typeof obj.created_at === "string" ? obj.created_at : void 0;
11456
+ const tsIso = typeof obj2.created_at === "string" ? obj2.created_at : void 0;
11453
11457
  const ts = tsIso ? Date.parse(tsIso) || mtimeFallback : mtimeFallback;
11454
- if (obj.source === "USER_EXPLICIT" && obj.type === "USER_INPUT") {
11455
- const content = typeof obj.content === "string" ? obj.content : "";
11458
+ if (obj2.source === "USER_EXPLICIT" && obj2.type === "USER_INPUT") {
11459
+ const content = typeof obj2.content === "string" ? obj2.content : "";
11456
11460
  const match = content.match(/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/);
11457
11461
  const text = match ? match[1].trim() : content.trim();
11458
11462
  if (text) {
11459
11463
  events.push({ kind: "user", ts, tsIso, line: lineNum, text });
11460
11464
  }
11461
- } else if (obj.source === "MODEL" && obj.type === "PLANNER_RESPONSE") {
11462
- const content = typeof obj.content === "string" ? obj.content.trim() : "";
11465
+ } else if (obj2.source === "MODEL" && obj2.type === "PLANNER_RESPONSE") {
11466
+ const content = typeof obj2.content === "string" ? obj2.content.trim() : "";
11463
11467
  if (content) {
11464
11468
  events.push({ kind: "assistant_text", ts, tsIso, line: lineNum, text: content });
11465
11469
  }
11466
- const tcs = Array.isArray(obj.tool_calls) ? obj.tool_calls : [];
11470
+ const tcs = Array.isArray(obj2.tool_calls) ? obj2.tool_calls : [];
11467
11471
  for (const tc of tcs) {
11468
11472
  let toolName = String(tc?.name || "");
11469
11473
  if (!toolName)
@@ -11491,12 +11495,12 @@ var init_agy = __esm({
11491
11495
  command
11492
11496
  });
11493
11497
  }
11494
- } else if (obj.source === "MODEL" && obj.type !== "PLANNER_RESPONSE") {
11495
- const resultBody = typeof obj.content === "string" ? obj.content : "";
11496
- const isError = obj.status === "ERROR" || obj.status === "FAILED";
11498
+ } else if (obj2.source === "MODEL" && obj2.type !== "PLANNER_RESPONSE") {
11499
+ const resultBody = typeof obj2.content === "string" ? obj2.content : "";
11500
+ const isError = obj2.status === "ERROR" || obj2.status === "FAILED";
11497
11501
  let matchedIndex = -1;
11498
11502
  for (let i = 0; i < pendingToolCalls.length; i++) {
11499
- if (matchesTool(obj.type, pendingToolCalls[i].name)) {
11503
+ if (matchesTool(obj2.type, pendingToolCalls[i].name)) {
11500
11504
  matchedIndex = i;
11501
11505
  break;
11502
11506
  }
@@ -11514,7 +11518,7 @@ var init_agy = __esm({
11514
11518
  toolName = popped.name;
11515
11519
  } else {
11516
11520
  toolUseId = `agy_tc_orphan_${toolUseCounter++}`;
11517
- toolName = obj.type.toLowerCase();
11521
+ toolName = obj2.type.toLowerCase();
11518
11522
  }
11519
11523
  }
11520
11524
  events.push({
@@ -11985,22 +11989,22 @@ function readTranscriptEvents(rawText, mtimeFallback = 0) {
11985
11989
  lineNum++;
11986
11990
  if (!line.trim())
11987
11991
  continue;
11988
- let obj;
11992
+ let obj2;
11989
11993
  try {
11990
- obj = JSON.parse(line);
11994
+ obj2 = JSON.parse(line);
11991
11995
  } catch {
11992
11996
  continue;
11993
11997
  }
11994
- if (!obj.role)
11998
+ if (!obj2.role)
11995
11999
  continue;
11996
- const message = obj.message;
12000
+ const message = obj2.message;
11997
12001
  const content = Array.isArray(message?.content) ? message.content : [];
11998
12002
  for (const part of content) {
11999
12003
  if (!part || typeof part !== "object")
12000
12004
  continue;
12001
12005
  const p = part;
12002
12006
  if (p.type === "text" && typeof p.text === "string") {
12003
- if (obj.role === "user") {
12007
+ if (obj2.role === "user") {
12004
12008
  const { text, ts } = unwrapUserText(p.text);
12005
12009
  if (ts)
12006
12010
  clock = ts;
@@ -14085,19 +14089,19 @@ function parsePiFile(path) {
14085
14089
  for (const line of raw.split("\n")) {
14086
14090
  if (!line.trim())
14087
14091
  continue;
14088
- let obj;
14092
+ let obj2;
14089
14093
  try {
14090
- obj = JSON.parse(line);
14094
+ obj2 = JSON.parse(line);
14091
14095
  } catch {
14092
14096
  continue;
14093
14097
  }
14094
- if (!obj || typeof obj !== "object")
14098
+ if (!obj2 || typeof obj2 !== "object")
14095
14099
  continue;
14096
- if (obj.type === "session" && !out.header) {
14097
- out.header = obj;
14100
+ if (obj2.type === "session" && !out.header) {
14101
+ out.header = obj2;
14098
14102
  continue;
14099
14103
  }
14100
- out.entries.push(obj);
14104
+ out.entries.push(obj2);
14101
14105
  }
14102
14106
  return out;
14103
14107
  }
@@ -14139,10 +14143,10 @@ function readPiHeader(path) {
14139
14143
  const firstLine = buf.toString("utf-8", 0, n).split("\n", 1)[0];
14140
14144
  if (!firstLine.trim())
14141
14145
  return null;
14142
- const obj = JSON.parse(firstLine);
14143
- if (!obj || typeof obj !== "object" || obj.type !== "session")
14146
+ const obj2 = JSON.parse(firstLine);
14147
+ if (!obj2 || typeof obj2 !== "object" || obj2.type !== "session")
14144
14148
  return null;
14145
- return obj;
14149
+ return obj2;
14146
14150
  } catch {
14147
14151
  return null;
14148
14152
  } finally {
@@ -14480,17 +14484,17 @@ var init_pi = __esm({
14480
14484
  lineNum++;
14481
14485
  if (!line.trim())
14482
14486
  continue;
14483
- let obj;
14487
+ let obj2;
14484
14488
  try {
14485
- obj = JSON.parse(line);
14489
+ obj2 = JSON.parse(line);
14486
14490
  } catch {
14487
14491
  continue;
14488
14492
  }
14489
- const tsIso = typeof obj.timestamp === "string" ? obj.timestamp : void 0;
14490
- const msgTs = typeof obj.message?.timestamp === "number" ? obj.message.timestamp : void 0;
14493
+ const tsIso = typeof obj2.timestamp === "string" ? obj2.timestamp : void 0;
14494
+ const msgTs = typeof obj2.message?.timestamp === "number" ? obj2.message.timestamp : void 0;
14491
14495
  const ts = tsIso ? Date.parse(tsIso) || mtimeFallback : msgTs ?? mtimeFallback;
14492
- if (obj.type === "message") {
14493
- const msg = obj.message || {};
14496
+ if (obj2.type === "message") {
14497
+ const msg = obj2.message || {};
14494
14498
  const role = msg.role;
14495
14499
  if (role === "user") {
14496
14500
  const text = piText(msg.content).trim();
@@ -14569,12 +14573,12 @@ var init_pi = __esm({
14569
14573
  }
14570
14574
  continue;
14571
14575
  }
14572
- if (obj.type === "compaction" && typeof obj.summary === "string" && obj.summary.trim()) {
14573
- events.push({ kind: "summary", ts, tsIso, line: lineNum, text: obj.summary.trim() });
14576
+ if (obj2.type === "compaction" && typeof obj2.summary === "string" && obj2.summary.trim()) {
14577
+ events.push({ kind: "summary", ts, tsIso, line: lineNum, text: obj2.summary.trim() });
14574
14578
  continue;
14575
14579
  }
14576
- if (obj.type === "branch_summary" && typeof obj.summary === "string" && obj.summary.trim()) {
14577
- events.push({ kind: "summary", ts, tsIso, line: lineNum, text: obj.summary.trim() });
14580
+ if (obj2.type === "branch_summary" && typeof obj2.summary === "string" && obj2.summary.trim()) {
14581
+ events.push({ kind: "summary", ts, tsIso, line: lineNum, text: obj2.summary.trim() });
14578
14582
  }
14579
14583
  }
14580
14584
  return events;
@@ -19566,7 +19570,7 @@ var require_anchors = __commonJS({
19566
19570
  var require_applyReviver = __commonJS({
19567
19571
  "../../node_modules/yaml/dist/doc/applyReviver.js"(exports) {
19568
19572
  "use strict";
19569
- function applyReviver(reviver, obj, key2, val) {
19573
+ function applyReviver(reviver, obj2, key2, val) {
19570
19574
  if (val && typeof val === "object") {
19571
19575
  if (Array.isArray(val)) {
19572
19576
  for (let i = 0, len = val.length; i < len; ++i) {
@@ -19606,7 +19610,7 @@ var require_applyReviver = __commonJS({
19606
19610
  }
19607
19611
  }
19608
19612
  }
19609
- return reviver.call(obj, key2, val);
19613
+ return reviver.call(obj2, key2, val);
19610
19614
  }
19611
19615
  exports.applyReviver = applyReviver;
19612
19616
  }
@@ -20542,10 +20546,10 @@ var require_stringify = __commonJS({
20542
20546
  return match.find((t) => t.format === item.format) ?? match[0];
20543
20547
  }
20544
20548
  let tagObj = void 0;
20545
- let obj;
20549
+ let obj2;
20546
20550
  if (identity.isScalar(item)) {
20547
- obj = item.value;
20548
- let match = tags.filter((t) => t.identify?.(obj));
20551
+ obj2 = item.value;
20552
+ let match = tags.filter((t) => t.identify?.(obj2));
20549
20553
  if (match.length > 1) {
20550
20554
  const testMatch = match.filter((t) => t.test);
20551
20555
  if (testMatch.length > 0)
@@ -20553,11 +20557,11 @@ var require_stringify = __commonJS({
20553
20557
  }
20554
20558
  tagObj = match.find((t) => t.format === item.format) ?? match.find((t) => !t.format);
20555
20559
  } else {
20556
- obj = item;
20557
- tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
20560
+ obj2 = item;
20561
+ tagObj = tags.find((t) => t.nodeClass && obj2 instanceof t.nodeClass);
20558
20562
  }
20559
20563
  if (!tagObj) {
20560
- const name = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj);
20564
+ const name = obj2?.constructor?.name ?? (obj2 === null ? "null" : typeof obj2);
20561
20565
  throw new Error(`Tag not resolved for ${name} value`);
20562
20566
  }
20563
20567
  return tagObj;
@@ -21113,23 +21117,23 @@ var require_YAMLMap = __commonJS({
21113
21117
  * A generic collection parsing method that can be extended
21114
21118
  * to other node classes that inherit from YAMLMap
21115
21119
  */
21116
- static from(schema, obj, ctx) {
21120
+ static from(schema, obj2, ctx) {
21117
21121
  const { keepUndefined, replacer } = ctx;
21118
21122
  const map = new this(schema);
21119
21123
  const add = (key2, value) => {
21120
21124
  if (typeof replacer === "function")
21121
- value = replacer.call(obj, key2, value);
21125
+ value = replacer.call(obj2, key2, value);
21122
21126
  else if (Array.isArray(replacer) && !replacer.includes(key2))
21123
21127
  return;
21124
21128
  if (value !== void 0 || keepUndefined)
21125
21129
  map.items.push(Pair.createPair(key2, value, ctx));
21126
21130
  };
21127
- if (obj instanceof Map) {
21128
- for (const [key2, value] of obj)
21131
+ if (obj2 instanceof Map) {
21132
+ for (const [key2, value] of obj2)
21129
21133
  add(key2, value);
21130
- } else if (obj && typeof obj === "object") {
21131
- for (const key2 of Object.keys(obj))
21132
- add(key2, obj[key2]);
21134
+ } else if (obj2 && typeof obj2 === "object") {
21135
+ for (const key2 of Object.keys(obj2))
21136
+ add(key2, obj2[key2]);
21133
21137
  }
21134
21138
  if (typeof schema.sortMapEntries === "function") {
21135
21139
  map.items.sort(schema.sortMapEntries);
@@ -21239,7 +21243,7 @@ var require_map = __commonJS({
21239
21243
  onError("Expected a mapping for this tag");
21240
21244
  return map2;
21241
21245
  },
21242
- createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
21246
+ createNode: (schema, obj2, ctx) => YAMLMap.YAMLMap.from(schema, obj2, ctx)
21243
21247
  };
21244
21248
  exports.map = map;
21245
21249
  }
@@ -21335,15 +21339,15 @@ var require_YAMLSeq = __commonJS({
21335
21339
  onComment
21336
21340
  });
21337
21341
  }
21338
- static from(schema, obj, ctx) {
21342
+ static from(schema, obj2, ctx) {
21339
21343
  const { replacer } = ctx;
21340
21344
  const seq = new this(schema);
21341
- if (obj && Symbol.iterator in Object(obj)) {
21345
+ if (obj2 && Symbol.iterator in Object(obj2)) {
21342
21346
  let i = 0;
21343
- for (let it of obj) {
21347
+ for (let it of obj2) {
21344
21348
  if (typeof replacer === "function") {
21345
- const key2 = obj instanceof Set ? it : String(i++);
21346
- it = replacer.call(obj, key2, it);
21349
+ const key2 = obj2 instanceof Set ? it : String(i++);
21350
+ it = replacer.call(obj2, key2, it);
21347
21351
  }
21348
21352
  seq.items.push(createNode.createNode(it, void 0, ctx));
21349
21353
  }
@@ -21377,7 +21381,7 @@ var require_seq = __commonJS({
21377
21381
  onError("Expected a sequence for this tag");
21378
21382
  return seq2;
21379
21383
  },
21380
- createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)
21384
+ createNode: (schema, obj2, ctx) => YAMLSeq.YAMLSeq.from(schema, obj2, ctx)
21381
21385
  };
21382
21386
  exports.seq = seq;
21383
21387
  }
@@ -26630,15 +26634,15 @@ var init_mcps_source = __esm({
26630
26634
  });
26631
26635
  }
26632
26636
  }
26633
- async *fromObject(obj, ctx) {
26634
- if (!obj || typeof obj !== "object")
26637
+ async *fromObject(obj2, ctx) {
26638
+ if (!obj2 || typeof obj2 !== "object")
26635
26639
  return;
26636
26640
  let mtime = 0;
26637
26641
  try {
26638
26642
  mtime = statSync32(ctx.filePath).mtimeMs;
26639
26643
  } catch {
26640
26644
  }
26641
- for (const [name, cfgRaw] of Object.entries(obj)) {
26645
+ for (const [name, cfgRaw] of Object.entries(obj2)) {
26642
26646
  const cfg = cfgRaw || {};
26643
26647
  const cmd = redactInlineSecrets(commandPreview(cfg)).text;
26644
26648
  const allow = Array.isArray(cfg.alwaysAllow) ? cfg.alwaysAllow.slice(0, 8) : [];
@@ -26836,11 +26840,11 @@ function parseScalarToml(text) {
26836
26840
  }
26837
26841
  return out;
26838
26842
  }
26839
- function stringifyScalarToml(obj) {
26843
+ function stringifyScalarToml(obj2) {
26840
26844
  const esc = (v) => v.includes("\n") ? `"""
26841
26845
  ${v}
26842
26846
  """` : `"${v.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
26843
- return Object.entries(obj).filter(([, v]) => v !== void 0 && v !== "").map(([k, v]) => `${k} = ${esc(v)}`).join("\n") + "\n";
26847
+ return Object.entries(obj2).filter(([, v]) => v !== void 0 && v !== "").map(([k, v]) => `${k} = ${esc(v)}`).join("\n") + "\n";
26844
26848
  }
26845
26849
  var init_toolkit_format = __esm({
26846
26850
  "../engine/dist/core/toolkit-format.js"() {
@@ -28036,7 +28040,7 @@ var init_http = __esm({
28036
28040
  CLI_VERSION = JSON.parse(readFileSync34(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
28037
28041
  } catch {
28038
28042
  try {
28039
- if (true) CLI_VERSION = "0.7.21";
28043
+ if (true) CLI_VERSION = "0.7.23";
28040
28044
  } catch {
28041
28045
  }
28042
28046
  }
@@ -28420,7 +28424,7 @@ function serverAllowsTelemetry(serverUrl) {
28420
28424
  function mayReport(serverUrl) {
28421
28425
  return userConsents() && serverAllowsTelemetry(serverUrl);
28422
28426
  }
28423
- function findSensitiveKeys(obj, where = "") {
28427
+ function findSensitiveKeys(obj2, where = "") {
28424
28428
  const out = [];
28425
28429
  const walk = (v, at) => {
28426
28430
  if (!v || typeof v !== "object") return;
@@ -28433,7 +28437,7 @@ function findSensitiveKeys(obj, where = "") {
28433
28437
  walk(val, at ? `${at}.${k}` : k);
28434
28438
  }
28435
28439
  };
28436
- walk(obj, where);
28440
+ walk(obj2, where);
28437
28441
  return out;
28438
28442
  }
28439
28443
  function assertNoSensitiveKeys(payload) {
@@ -28534,7 +28538,7 @@ var init_telemetry = __esm({
28534
28538
  init_sync_client();
28535
28539
  cliVersion2 = () => {
28536
28540
  try {
28537
- return true ? "0.7.21" : "dev";
28541
+ return true ? "0.7.23" : "dev";
28538
28542
  } catch {
28539
28543
  return "dev";
28540
28544
  }
@@ -31147,7 +31151,7 @@ var init_sync_client = __esm({
31147
31151
  ownVersion = JSON.parse(readFileSync39(join46(dir, "../package.json"), "utf-8")).version || ownVersion;
31148
31152
  } catch {
31149
31153
  try {
31150
- if (true) ownVersion = "0.7.21";
31154
+ if (true) ownVersion = "0.7.23";
31151
31155
  } catch {
31152
31156
  }
31153
31157
  }
@@ -33321,6 +33325,7 @@ __export(guard_registration_exports, {
33321
33325
  guardTargets: () => guardTargets,
33322
33326
  guardWrapperName: () => guardWrapperName,
33323
33327
  guardWrapperSource: () => guardWrapperSource,
33328
+ legacyAgyHooksFile: () => legacyAgyHooksFile,
33324
33329
  opencodeConfigDir: () => opencodeConfigDir,
33325
33330
  opencodePluginDir: () => opencodePluginDir,
33326
33331
  opencodePluginSource: () => opencodePluginSource,
@@ -33329,6 +33334,9 @@ __export(guard_registration_exports, {
33329
33334
  });
33330
33335
  import { homedir as homedir21 } from "os";
33331
33336
  import { join as join57 } from "path";
33337
+ function legacyAgyHooksFile() {
33338
+ return join57(agyBackend.homeDir(), "hooks.json");
33339
+ }
33332
33340
  function opencodeConfigDir() {
33333
33341
  const xdg = process.env.XDG_CONFIG_HOME;
33334
33342
  const base4 = xdg && xdg.trim() ? xdg : join57(homedir21(), ".config");
@@ -33355,7 +33363,7 @@ function guardTargets() {
33355
33363
  {
33356
33364
  tool: "agy",
33357
33365
  label: "Antigravity",
33358
- configPath: join57(agyBackend.homeDir(), "hooks.json"),
33366
+ configPath: agyBackend.sharedHooksFile(),
33359
33367
  homeDir: agyBackend.homeDir()
33360
33368
  },
33361
33369
  {
@@ -33505,14 +33513,24 @@ function ask(payload) {
33505
33513
  });
33506
33514
  }
33507
33515
 
33508
- export const ChatRecallGuard = async () => ({
33509
- "tool.execute.before": async (input, output) => {
33510
- const verdict = await ask({ tool: input?.tool, args: output?.args });
33511
- if (!verdict || !verdict.message) return;
33512
- if (verdict.block) throw new Error(verdict.message);
33513
- console.error(verdict.message);
33514
- },
33515
- });
33516
+ async function check(tool, args) {
33517
+ const verdict = await ask({ tool, args });
33518
+ if (!verdict || !verdict.message) return;
33519
+ if (verdict.block) throw new Error(verdict.message);
33520
+ console.error(verdict.message);
33521
+ }
33522
+
33523
+ async function setup(ctx) {
33524
+ await ctx.tool.hook("execute.before", (event) => check(event?.tool, event?.input));
33525
+ }
33526
+
33527
+ async function server() {
33528
+ return {
33529
+ "tool.execute.before": (input, output) => check(input?.tool, output?.args),
33530
+ };
33531
+ }
33532
+
33533
+ export default { id: "${GUARD_ID}", server, setup };
33516
33534
  `;
33517
33535
  }
33518
33536
  var GUARD_ID, AGY_MATCHER, CODEX_MATCHER, TIMEOUT_SECS, isOurs, asArray2;
@@ -33529,6 +33547,336 @@ var init_guard_registration = __esm({
33529
33547
  }
33530
33548
  });
33531
33549
 
33550
+ // ../engine/dist/core/message-registration.js
33551
+ var message_registration_exports = {};
33552
+ __export(message_registration_exports, {
33553
+ MESSAGES_ID: () => MESSAGES_ID,
33554
+ isOurPluginSource: () => isOurPluginSource,
33555
+ messageCommand: () => messageCommand,
33556
+ messageTargets: () => messageTargets,
33557
+ messageWrapperName: () => messageWrapperName,
33558
+ messageWrapperSource: () => messageWrapperSource,
33559
+ opencodeMessagesSource: () => opencodeMessagesSource,
33560
+ piAgentDir: () => piAgentDir2,
33561
+ piMessagesSource: () => piMessagesSource,
33562
+ registerMessages: () => registerMessages,
33563
+ unregisterMessages: () => unregisterMessages
33564
+ });
33565
+ import { homedir as homedir22 } from "os";
33566
+ import { join as join58 } from "path";
33567
+ function piAgentDir2() {
33568
+ const dir = process.env.PI_CODING_AGENT_DIR;
33569
+ return dir && dir.trim() ? dir : join58(homedir22(), ".pi", "agent");
33570
+ }
33571
+ function messageTargets() {
33572
+ return [
33573
+ {
33574
+ tool: "codex",
33575
+ label: "Codex",
33576
+ configPath: join58(codexBackend.homeDir(), "hooks.json"),
33577
+ homeDir: codexBackend.homeDir(),
33578
+ // Codex binds its approval to the hook's hash, and only a person can give it.
33579
+ note: "Codex asks you to approve a hook before it runs one. Run /hooks in Codex once to approve the message hook."
33580
+ },
33581
+ {
33582
+ tool: "agy",
33583
+ label: "Antigravity",
33584
+ configPath: agyBackend.sharedHooksFile(),
33585
+ homeDir: agyBackend.homeDir()
33586
+ },
33587
+ {
33588
+ tool: "cursor",
33589
+ label: "Cursor",
33590
+ configPath: join58(cursorBackend.homeDir(), "hooks.json"),
33591
+ homeDir: cursorBackend.homeDir(),
33592
+ note: "Cursor delivers a message at the start of a session and when the agent stops, as a follow-up prompt."
33593
+ },
33594
+ {
33595
+ tool: "opencode",
33596
+ label: "OpenCode",
33597
+ configPath: join58(opencodePluginDir(), `${MESSAGES_ID}.js`),
33598
+ homeDir: opencodeConfigDir()
33599
+ },
33600
+ {
33601
+ tool: "pi",
33602
+ label: "pi",
33603
+ configPath: join58(piAgentDir2(), "extensions", `${MESSAGES_ID}.js`),
33604
+ homeDir: piAgentDir2()
33605
+ }
33606
+ ];
33607
+ }
33608
+ function messageWrapperName(tool) {
33609
+ return `chat_recall_messages_${tool}.sh`;
33610
+ }
33611
+ function messageWrapperSource(tool, nodePath, hookEntry) {
33612
+ return `#!/bin/sh
33613
+ # Written by \`chat-recall install-hooks\`. Re-running replaces it.
33614
+ exec ${JSON.stringify(nodePath)} ${JSON.stringify(hookEntry)} --tool ${tool} "$@"
33615
+ `;
33616
+ }
33617
+ function messageCommand(wrapperPath, args = "") {
33618
+ const p = wrapperPath.includes(" ") ? `"${wrapperPath}"` : wrapperPath;
33619
+ return args ? `${p} ${args}` : p;
33620
+ }
33621
+ function mergeCodex2(config2, command) {
33622
+ const c = obj(config2);
33623
+ const hooks = obj(c.hooks);
33624
+ for (const event of CODEX_EVENTS) {
33625
+ const kept = asArray3(hooks[event]).filter((e) => !asArray3(e?.hooks).some((h) => isOurs2(h?.command)));
33626
+ kept.push({ hooks: [{ type: "command", command, timeout: TIMEOUT_SECS2 }] });
33627
+ hooks[event] = kept;
33628
+ }
33629
+ c.hooks = hooks;
33630
+ return c;
33631
+ }
33632
+ function stripCodex2(config2) {
33633
+ const c = obj(config2);
33634
+ const hooks = obj(c.hooks);
33635
+ let removed = 0;
33636
+ for (const event of CODEX_EVENTS) {
33637
+ const before = asArray3(hooks[event]);
33638
+ const kept = before.filter((e) => !asArray3(e?.hooks).some((h) => isOurs2(h?.command)));
33639
+ removed += before.length - kept.length;
33640
+ if (kept.length)
33641
+ hooks[event] = kept;
33642
+ else
33643
+ delete hooks[event];
33644
+ }
33645
+ if (Object.keys(hooks).length)
33646
+ c.hooks = hooks;
33647
+ else
33648
+ delete c.hooks;
33649
+ return { config: c, removed };
33650
+ }
33651
+ function mergeAgy2(config2, command) {
33652
+ const c = obj(config2);
33653
+ const run = (event) => [{ type: "command", command: `${command} --event ${event}`, timeout: TIMEOUT_SECS2 }];
33654
+ c[MESSAGES_ID] = {
33655
+ enabled: true,
33656
+ SessionStart: run("SessionStart"),
33657
+ PreInvocation: run("PreInvocation"),
33658
+ Stop: run("Stop")
33659
+ };
33660
+ return c;
33661
+ }
33662
+ function stripAgy2(config2) {
33663
+ const c = obj(config2);
33664
+ const had = Object.prototype.hasOwnProperty.call(c, MESSAGES_ID) ? 1 : 0;
33665
+ delete c[MESSAGES_ID];
33666
+ return { config: c, removed: had };
33667
+ }
33668
+ function mergeCursor2(config2, command) {
33669
+ const c = obj(config2);
33670
+ c.version = typeof c.version === "number" ? c.version : 1;
33671
+ const hooks = obj(c.hooks);
33672
+ for (const event of CURSOR_EVENTS) {
33673
+ const kept = asArray3(hooks[event]).filter((e) => !isOurs2(e?.command));
33674
+ kept.push({ command, timeout: TIMEOUT_SECS2 });
33675
+ hooks[event] = kept;
33676
+ }
33677
+ c.hooks = hooks;
33678
+ return c;
33679
+ }
33680
+ function stripCursor2(config2) {
33681
+ const c = obj(config2);
33682
+ const hooks = obj(c.hooks);
33683
+ let removed = 0;
33684
+ for (const event of CURSOR_EVENTS) {
33685
+ const before = asArray3(hooks[event]);
33686
+ const kept = before.filter((e) => !isOurs2(e?.command));
33687
+ removed += before.length - kept.length;
33688
+ if (kept.length)
33689
+ hooks[event] = kept;
33690
+ else
33691
+ delete hooks[event];
33692
+ }
33693
+ c.hooks = hooks;
33694
+ return { config: c, removed };
33695
+ }
33696
+ function registerMessages(tool, config2, command) {
33697
+ switch (tool) {
33698
+ case "codex":
33699
+ return mergeCodex2(config2, command);
33700
+ case "agy":
33701
+ return mergeAgy2(config2, command);
33702
+ case "cursor":
33703
+ return mergeCursor2(config2, command);
33704
+ }
33705
+ }
33706
+ function unregisterMessages(tool, config2) {
33707
+ switch (tool) {
33708
+ case "codex":
33709
+ return stripCodex2(config2);
33710
+ case "agy":
33711
+ return stripAgy2(config2);
33712
+ case "cursor":
33713
+ return stripCursor2(config2);
33714
+ }
33715
+ }
33716
+ function isOurPluginSource(source) {
33717
+ return source.includes(`${MESSAGES_ID}: written by`);
33718
+ }
33719
+ function runnerSource(wrapperPath) {
33720
+ return `import { spawn } from "child_process";
33721
+
33722
+ const HOOK = ${JSON.stringify(wrapperPath)};
33723
+
33724
+ function runHook(sessionId, event, cwd) {
33725
+ return new Promise((resolve) => {
33726
+ let out = "";
33727
+ let child;
33728
+ try {
33729
+ child = spawn(HOOK, [], { stdio: ["pipe", "pipe", "ignore"] });
33730
+ } catch {
33731
+ resolve("");
33732
+ return;
33733
+ }
33734
+ const done = setTimeout(() => { child.kill(); resolve(""); }, ${TIMEOUT_SECS2 * 1e3});
33735
+ child.stdout.on("data", (c) => { out += c; });
33736
+ child.on("error", () => { clearTimeout(done); resolve(""); });
33737
+ child.on("close", () => { clearTimeout(done); resolve(out.trim()); });
33738
+ child.stdin.end(JSON.stringify({ session_id: sessionId, hook_event_name: event, cwd }));
33739
+ });
33740
+ }
33741
+ `;
33742
+ }
33743
+ function opencodeMessagesSource(wrapperPath) {
33744
+ return `// ${MESSAGES_ID}: written by \`chat-recall install-hooks\`. Re-running replaces it.
33745
+ //
33746
+ // Reports each opencode session to chat-recall and adds the messages that
33747
+ // other sessions sent it to the next prompt.
33748
+ ${runnerSource(wrapperPath)}
33749
+ const RUN_END = new Set(["session.execution.succeeded", "session.execution.failed", "session.execution.interrupted", "session.idle"]);
33750
+
33751
+ async function setup(ctx) {
33752
+ const dir = ctx?.location?.directory;
33753
+ const started = new Set();
33754
+ const children = new Set();
33755
+ const isChild = async (id) => {
33756
+ if (children.has(id)) return true;
33757
+ try {
33758
+ const s = await ctx.session.get({ sessionID: id });
33759
+ if (s?.parentID) { children.add(id); return true; }
33760
+ } catch { /* unknown: treat as a main session */ }
33761
+ return false;
33762
+ };
33763
+ await ctx.session.hook("prompt", async (event) => {
33764
+ const id = event?.sessionID;
33765
+ if (!id || !event.prompt || (await isChild(id))) return;
33766
+ const parts = [];
33767
+ if (!started.has(id)) {
33768
+ started.add(id);
33769
+ parts.push(await runHook("opencode_" + id, "SessionStart", dir));
33770
+ }
33771
+ parts.push(await runHook("opencode_" + id, "UserPromptSubmit", dir));
33772
+ const text = parts.filter(Boolean).join("\\n\\n");
33773
+ if (text) event.prompt.text = [event.prompt.text, text].filter(Boolean).join("\\n\\n");
33774
+ });
33775
+ const controller = new AbortController();
33776
+ (async () => {
33777
+ try {
33778
+ for await (const ev of ctx.event.subscribe({ signal: controller.signal })) {
33779
+ const id = ev?.data?.sessionID ?? ev?.properties?.sessionID;
33780
+ if (!id || !started.has(id)) continue;
33781
+ if (RUN_END.has(ev.type)) await runHook("opencode_" + id, "Stop", dir);
33782
+ else if (ev.type === "session.deleted") {
33783
+ started.delete(id);
33784
+ await runHook("opencode_" + id, "SessionEnd", dir);
33785
+ }
33786
+ }
33787
+ } catch { /* the subscription ends with the plugin */ }
33788
+ })();
33789
+ return () => controller.abort();
33790
+ }
33791
+
33792
+ const pending = new Map();
33793
+ const children = new Set();
33794
+ let seq = 0;
33795
+
33796
+ function partId() {
33797
+ seq += 1;
33798
+ return "prt_" + Date.now().toString(16) + seq.toString(16).padStart(4, "0") + "chatrecall";
33799
+ }
33800
+
33801
+ async function server({ directory }) {
33802
+ return {
33803
+ event: async ({ event }) => {
33804
+ const info = event?.properties?.info;
33805
+ if (event?.type === "session.created" && info?.id) {
33806
+ if (info.parentID) { children.add(info.id); return; }
33807
+ const text = await runHook("opencode_" + info.id, "SessionStart", directory);
33808
+ if (text) pending.set(info.id, text);
33809
+ } else if (event?.type === "session.idle" && event.properties?.sessionID && !children.has(event.properties.sessionID)) {
33810
+ await runHook("opencode_" + event.properties.sessionID, "Stop", directory);
33811
+ } else if (event?.type === "session.deleted" && info?.id) {
33812
+ children.delete(info.id);
33813
+ pending.delete(info.id);
33814
+ await runHook("opencode_" + info.id, "SessionEnd", directory);
33815
+ }
33816
+ },
33817
+ "chat.message": async (input, output) => {
33818
+ const id = input?.sessionID;
33819
+ if (!id || children.has(id) || !output?.message) return;
33820
+ const before = pending.get(id) ?? "";
33821
+ pending.delete(id);
33822
+ const now = await runHook("opencode_" + id, "UserPromptSubmit", directory);
33823
+ const text = [before, now].filter(Boolean).join("\\n\\n");
33824
+ if (!text) return;
33825
+ output.parts.push({ id: partId(), sessionID: id, messageID: output.message.id, type: "text", text, synthetic: true });
33826
+ },
33827
+ };
33828
+ }
33829
+
33830
+ export default { id: "${MESSAGES_ID}", server, setup };
33831
+ `;
33832
+ }
33833
+ function piMessagesSource(wrapperPath) {
33834
+ return `// ${MESSAGES_ID}: written by \`chat-recall install-hooks\`. Re-running replaces it.
33835
+ //
33836
+ // Reports each pi session to chat-recall and adds the messages that other
33837
+ // sessions sent it to the next prompt.
33838
+ ${runnerSource(wrapperPath)}
33839
+ export default function (pi) {
33840
+ let pending = "";
33841
+ const idOf = (ctx) => "pi_" + ctx.sessionManager.getSessionId();
33842
+ const cwdOf = (ctx) => ctx.sessionManager.getCwd();
33843
+
33844
+ pi.on("session_start", async (_event, ctx) => {
33845
+ pending = await runHook(idOf(ctx), "SessionStart", cwdOf(ctx));
33846
+ });
33847
+ pi.on("before_agent_start", async (event, ctx) => {
33848
+ if (event.messageType !== "user") return;
33849
+ const now = await runHook(idOf(ctx), "UserPromptSubmit", cwdOf(ctx));
33850
+ const text = [pending, now].filter(Boolean).join("\\n\\n");
33851
+ pending = "";
33852
+ if (!text) return;
33853
+ return { message: { customType: "${MESSAGES_ID}", content: text, display: true } };
33854
+ });
33855
+ pi.on("agent_end", async (_event, ctx) => {
33856
+ await runHook(idOf(ctx), "Stop", cwdOf(ctx));
33857
+ });
33858
+ pi.on("session_shutdown", async (_event, ctx) => {
33859
+ await runHook(idOf(ctx), "SessionEnd", cwdOf(ctx));
33860
+ });
33861
+ }
33862
+ `;
33863
+ }
33864
+ var MESSAGES_ID, TIMEOUT_SECS2, isOurs2, asArray3, obj, CODEX_EVENTS, CURSOR_EVENTS;
33865
+ var init_message_registration = __esm({
33866
+ "../engine/dist/core/message-registration.js"() {
33867
+ "use strict";
33868
+ init_backends();
33869
+ init_guard_registration();
33870
+ MESSAGES_ID = "chat-recall-messages";
33871
+ TIMEOUT_SECS2 = 10;
33872
+ isOurs2 = (cmd) => typeof cmd === "string" && cmd.includes("chat_recall_messages_");
33873
+ asArray3 = (v) => Array.isArray(v) ? v : [];
33874
+ obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? { ...v } : {};
33875
+ CODEX_EVENTS = ["SessionStart", "UserPromptSubmit", "Stop", "SessionEnd"];
33876
+ CURSOR_EVENTS = ["sessionStart", "beforeSubmitPrompt", "stop", "sessionEnd"];
33877
+ }
33878
+ });
33879
+
33532
33880
  // src/install-hooks.ts
33533
33881
  var install_hooks_exports = {};
33534
33882
  __export(install_hooks_exports, {
@@ -33544,7 +33892,7 @@ __export(install_hooks_exports, {
33544
33892
  uninstallHooks: () => uninstallHooks
33545
33893
  });
33546
33894
  import { chmodSync as chmodSync5, copyFileSync as copyFileSync3, existsSync as existsSync52, mkdirSync as mkdirSync17, readFileSync as readFileSync46, realpathSync as realpathSync6, renameSync as renameSync6, unlinkSync as unlinkSync4, writeFileSync as writeFileSync17 } from "node:fs";
33547
- import { dirname as dirname24, join as join58 } from "node:path";
33895
+ import { dirname as dirname24, join as join59 } from "node:path";
33548
33896
  function isOurEntry(entry) {
33549
33897
  const cmd = entry?.hooks?.[0]?.command;
33550
33898
  if (typeof cmd !== "string") return false;
@@ -33554,8 +33902,8 @@ function claudeSettingsFiles() {
33554
33902
  const out = [];
33555
33903
  const seen = /* @__PURE__ */ new Set();
33556
33904
  for (const home of claudeHomeDirs()) {
33557
- if (!existsSync52(join58(home, "projects"))) continue;
33558
- const file = join58(home, "settings.json");
33905
+ if (!existsSync52(join59(home, "projects"))) continue;
33906
+ const file = join59(home, "settings.json");
33559
33907
  let key2;
33560
33908
  try {
33561
33909
  key2 = realpathSync6(file);
@@ -33571,9 +33919,9 @@ function claudeSettingsFiles() {
33571
33919
  }
33572
33920
  function findScript(distDir, name) {
33573
33921
  return [
33574
- join58(distDir, "..", "hooks", name),
33575
- join58(distDir, "..", "..", "hooks", name),
33576
- join58(distDir, "..", "..", "..", "hooks", name)
33922
+ join59(distDir, "..", "hooks", name),
33923
+ join59(distDir, "..", "..", "hooks", name),
33924
+ join59(distDir, "..", "..", "..", "hooks", name)
33577
33925
  ].find((p) => existsSync52(p));
33578
33926
  }
33579
33927
  function hookEntries(sel, paths) {
@@ -33638,7 +33986,7 @@ function writeJsonAtomic(file, value) {
33638
33986
  renameSync6(tmp, target);
33639
33987
  }
33640
33988
  function statePath() {
33641
- return join58(getHooksDir(), "install.json");
33989
+ return join59(getHooksDir(), "install.json");
33642
33990
  }
33643
33991
  function readState() {
33644
33992
  try {
@@ -33656,7 +34004,7 @@ async function installHooks(distDir, sel = ALL_HOOKS) {
33656
34004
  if (!sel[key2]) continue;
33657
34005
  const source = findScript(distDir, SCRIPTS[key2]);
33658
34006
  if (!source) continue;
33659
- const target = join58(scriptsDir, SCRIPTS[key2]);
34007
+ const target = join59(scriptsDir, SCRIPTS[key2]);
33660
34008
  copyFileSync3(source, target);
33661
34009
  chmodSync5(target, 493);
33662
34010
  scripts[key2] = target;
@@ -33668,7 +34016,16 @@ async function installHooks(distDir, sel = ALL_HOOKS) {
33668
34016
  cliEntry: resolveCliEntry(distDir),
33669
34017
  messageHookEntry: resolveMessageHookEntry(distDir)
33670
34018
  });
33671
- const report = { written: [], skipped: [], migrated: 0, shellSkipped, scriptsDir, selection: sel, guardTargets: [] };
34019
+ const report = {
34020
+ written: [],
34021
+ skipped: [],
34022
+ migrated: 0,
34023
+ shellSkipped,
34024
+ scriptsDir,
34025
+ selection: sel,
34026
+ guardTargets: [],
34027
+ messageTargets: []
34028
+ };
33672
34029
  for (const settingsFile of claudeSettingsFiles()) {
33673
34030
  const config2 = readJson4(settingsFile);
33674
34031
  if (!config2) {
@@ -33678,9 +34035,12 @@ async function installHooks(distDir, sel = ALL_HOOKS) {
33678
34035
  mergeOurEntries(config2, entries);
33679
34036
  writeJsonAtomic(settingsFile, config2);
33680
34037
  report.written.push(settingsFile);
33681
- report.migrated += migrateHooksJson(join58(dirname24(settingsFile), "hooks.json"));
34038
+ report.migrated += migrateHooksJson(join59(dirname24(settingsFile), "hooks.json"));
33682
34039
  }
33683
34040
  if (sel.guard && scripts.guard) report.guardTargets = await addGuardToOtherTools(scriptsDir, scripts.guard);
34041
+ if (sel.messages && !shellSkipped) {
34042
+ report.messageTargets = await addMessagesToOtherTools(scriptsDir, process.execPath, resolveMessageHookEntry(distDir));
34043
+ }
33684
34044
  writeJsonAtomic(statePath(), { version: cliVersion(), selection: sel });
33685
34045
  return report;
33686
34046
  }
@@ -33695,9 +34055,9 @@ function migrateHooksJson(file) {
33695
34055
  return removed;
33696
34056
  }
33697
34057
  async function uninstallHooks() {
33698
- const report = { removed: 0, files: [], guardRemoved: [] };
34058
+ const report = { removed: 0, files: [], guardRemoved: [], messagesRemoved: [] };
33699
34059
  for (const settingsFile of claudeSettingsFiles()) {
33700
- for (const file of [settingsFile, join58(dirname24(settingsFile), "hooks.json")]) {
34060
+ for (const file of [settingsFile, join59(dirname24(settingsFile), "hooks.json")]) {
33701
34061
  if (!existsSync52(file)) continue;
33702
34062
  const config2 = readJson4(file);
33703
34063
  if (!config2) continue;
@@ -33709,6 +34069,7 @@ async function uninstallHooks() {
33709
34069
  }
33710
34070
  }
33711
34071
  report.guardRemoved = await removeGuardFromOtherTools();
34072
+ report.messagesRemoved = await removeMessagesFromOtherTools();
33712
34073
  writeJsonAtomic(statePath(), { version: cliVersion(), selection: ALL_HOOKS, uninstalled: true });
33713
34074
  return report;
33714
34075
  }
@@ -33732,9 +34093,10 @@ async function ensureHooks(distDir) {
33732
34093
  async function addGuardToOtherTools(scriptsDir, guardScript) {
33733
34094
  const reg = await Promise.resolve().then(() => (init_guard_registration(), guard_registration_exports));
33734
34095
  const out = [];
34096
+ removeLegacyAgyGuard(reg);
33735
34097
  for (const target of reg.guardTargets()) {
33736
34098
  if (!existsSync52(target.homeDir)) continue;
33737
- const wrapper = join58(scriptsDir, reg.guardWrapperName(target.tool));
34099
+ const wrapper = join59(scriptsDir, reg.guardWrapperName(target.tool));
33738
34100
  writeFileSync17(wrapper, reg.guardWrapperSource(target.tool, guardScript));
33739
34101
  chmodSync5(wrapper, 493);
33740
34102
  mkdirSync17(dirname24(target.configPath), { recursive: true });
@@ -33751,6 +34113,7 @@ async function addGuardToOtherTools(scriptsDir, guardScript) {
33751
34113
  async function removeGuardFromOtherTools() {
33752
34114
  const reg = await Promise.resolve().then(() => (init_guard_registration(), guard_registration_exports));
33753
34115
  const out = [];
34116
+ removeLegacyAgyGuard(reg);
33754
34117
  for (const target of reg.guardTargets()) {
33755
34118
  if (!existsSync52(target.configPath)) continue;
33756
34119
  if (target.tool === "opencode") {
@@ -33765,6 +34128,53 @@ async function removeGuardFromOtherTools() {
33765
34128
  }
33766
34129
  return out;
33767
34130
  }
34131
+ function removeLegacyAgyGuard(reg) {
34132
+ const file = reg.legacyAgyHooksFile();
34133
+ if (!existsSync52(file)) return;
34134
+ const r = reg.unregisterGuard("agy", readJson4(file) ?? {});
34135
+ if (r.removed) writeJsonAtomic(file, r.config);
34136
+ }
34137
+ async function addMessagesToOtherTools(scriptsDir, nodePath, hookEntry) {
34138
+ const reg = await Promise.resolve().then(() => (init_message_registration(), message_registration_exports));
34139
+ const out = [];
34140
+ for (const target of reg.messageTargets()) {
34141
+ if (!existsSync52(target.homeDir)) continue;
34142
+ const wrapper = join59(scriptsDir, reg.messageWrapperName(target.tool));
34143
+ writeFileSync17(wrapper, reg.messageWrapperSource(target.tool, nodePath, hookEntry));
34144
+ chmodSync5(wrapper, 493);
34145
+ mkdirSync17(dirname24(target.configPath), { recursive: true });
34146
+ if (target.tool === "opencode") {
34147
+ writeFileSync17(target.configPath, reg.opencodeMessagesSource(wrapper));
34148
+ } else if (target.tool === "pi") {
34149
+ writeFileSync17(target.configPath, reg.piMessagesSource(wrapper));
34150
+ } else {
34151
+ const config2 = readJson4(target.configPath);
34152
+ if (!config2) continue;
34153
+ writeJsonAtomic(target.configPath, reg.registerMessages(target.tool, config2, reg.messageCommand(wrapper)));
34154
+ }
34155
+ out.push({ label: target.label, configPath: target.configPath, note: target.note });
34156
+ }
34157
+ return out;
34158
+ }
34159
+ async function removeMessagesFromOtherTools() {
34160
+ const reg = await Promise.resolve().then(() => (init_message_registration(), message_registration_exports));
34161
+ const out = [];
34162
+ for (const target of reg.messageTargets()) {
34163
+ if (!existsSync52(target.configPath)) continue;
34164
+ if (target.tool === "opencode" || target.tool === "pi") {
34165
+ if (!reg.isOurPluginSource(readFileSync46(target.configPath, "utf-8"))) continue;
34166
+ unlinkSync4(target.configPath);
34167
+ } else {
34168
+ const config2 = readJson4(target.configPath);
34169
+ if (!config2) continue;
34170
+ const r = reg.unregisterMessages(target.tool, config2);
34171
+ if (r.removed === 0) continue;
34172
+ writeJsonAtomic(target.configPath, r.config);
34173
+ }
34174
+ out.push({ label: target.label, configPath: target.configPath });
34175
+ }
34176
+ return out;
34177
+ }
33768
34178
  var ALL_HOOKS, SCRIPTS, HOOK_EVENTS;
33769
34179
  var init_install_hooks = __esm({
33770
34180
  "src/install-hooks.ts"() {
@@ -34432,7 +34842,7 @@ __export(collector_exports, {
34432
34842
  import { spawn as spawn3 } from "node:child_process";
34433
34843
  import { execSync as execSync4 } from "node:child_process";
34434
34844
  import { readFileSync as readFileSync47 } from "node:fs";
34435
- import { join as join59, basename as basename28 } from "node:path";
34845
+ import { join as join60, basename as basename28 } from "node:path";
34436
34846
  async function resolveCodeindexBin(autoInstall = true) {
34437
34847
  let st = checkCodeindexStatus();
34438
34848
  if (!st.installed && autoInstall)
@@ -34614,7 +35024,7 @@ async function collectCode(opts) {
34614
35024
  }
34615
35025
  const complexity = (r) => {
34616
35026
  try {
34617
- const txt = readFileSync47(join59(ws, r), "utf8");
35027
+ const txt = readFileSync47(join60(ws, r), "utf8");
34618
35028
  if (txt.length > 2e6)
34619
35029
  return 1;
34620
35030
  const m = txt.match(CF_RE);
@@ -35399,8 +35809,8 @@ __export(project_tasks_exports, {
35399
35809
  renderTeamTasksMd: () => renderTeamTasksMd
35400
35810
  });
35401
35811
  import { existsSync as existsSync54, readFileSync as readFileSync48, writeFileSync as writeFileSync18, mkdirSync as mkdirSync18, statSync as statSync46 } from "node:fs";
35402
- import { join as join60, dirname as dirname25 } from "node:path";
35403
- import { homedir as homedir22 } from "node:os";
35812
+ import { join as join61, dirname as dirname25 } from "node:path";
35813
+ import { homedir as homedir23 } from "node:os";
35404
35814
  function isTeamTaskStatus(v) {
35405
35815
  return !!v && TEAM_STATUSES.has(v);
35406
35816
  }
@@ -35450,7 +35860,7 @@ function parseTaskFile(content) {
35450
35860
  return out;
35451
35861
  }
35452
35862
  function ledgerPath2() {
35453
- return join60(homedir22(), ".chat-recall", "project-tasks-ledger.json");
35863
+ return join61(homedir23(), ".chat-recall", "project-tasks-ledger.json");
35454
35864
  }
35455
35865
  function readLedger() {
35456
35866
  try {
@@ -35483,7 +35893,7 @@ async function pushProjectTaskStatuses(base4, authHeaders, opts = {}) {
35483
35893
  continue;
35484
35894
  }
35485
35895
  for (const project of projects) {
35486
- const file = join60(project, fk.filename);
35896
+ const file = join61(project, fk.filename);
35487
35897
  if (!existsSync54(file)) continue;
35488
35898
  let mtime;
35489
35899
  try {
@@ -35568,7 +35978,7 @@ __export(intent_drain_exports, {
35568
35978
  runIntent: () => runIntent
35569
35979
  });
35570
35980
  import { existsSync as existsSync55, readFileSync as readFileSync49, writeFileSync as writeFileSync19, appendFileSync, mkdirSync as mkdirSync19 } from "node:fs";
35571
- import { join as join61 } from "node:path";
35981
+ import { join as join62 } from "node:path";
35572
35982
  import { fileURLToPath as fileURLToPath4 } from "node:url";
35573
35983
  import { dirname as dirname26 } from "node:path";
35574
35984
  function instructionTargets(rootPath, isGlobal) {
@@ -35582,16 +35992,16 @@ function instructionTargets(rootPath, isGlobal) {
35582
35992
  const tools = installed.length ? installed : [INSTRUCTION_TOOLS[0]];
35583
35993
  if (isGlobal) return [...new Set(tools.map((t) => instructionsPath(t.id)))];
35584
35994
  if (!rootPath) return [];
35585
- const present = INSTRUCTION_FILENAMES.map((f) => join61(rootPath, f)).filter((p) => existsSync55(p));
35995
+ const present = INSTRUCTION_FILENAMES.map((f) => join62(rootPath, f)).filter((p) => existsSync55(p));
35586
35996
  if (present.length) return present;
35587
- return [...new Set(tools.map((t) => join61(rootPath, instructionsFilename(t.id))))];
35997
+ return [...new Set(tools.map((t) => join62(rootPath, instructionsFilename(t.id))))];
35588
35998
  }
35589
35999
  function applyCodeRecommendation(intent) {
35590
36000
  try {
35591
36001
  const meta = JSON.parse(intent.name || "{}");
35592
36002
  if (intent.artifact_type === "write_tasks_file") {
35593
36003
  if (!meta.rootPath || !meta.content) return { status: "error", result: JSON.stringify({ error: "missing rootPath or content" }) };
35594
- const file = join61(meta.rootPath, meta.filename || "CODE_TASKS.md");
36004
+ const file = join62(meta.rootPath, meta.filename || "CODE_TASKS.md");
35595
36005
  writeFileSync19(file, meta.content);
35596
36006
  return { status: "done", result: JSON.stringify({ wrote: file }) };
35597
36007
  }
@@ -35796,10 +36206,10 @@ var init_intent_drain = __esm({
35796
36206
  ownVersion2 = "0.0.0";
35797
36207
  try {
35798
36208
  const dir = dirname26(fileURLToPath4(import.meta.url));
35799
- ownVersion2 = JSON.parse(readFileSync49(join61(dir, "../package.json"), "utf-8")).version || ownVersion2;
36209
+ ownVersion2 = JSON.parse(readFileSync49(join62(dir, "../package.json"), "utf-8")).version || ownVersion2;
35800
36210
  } catch {
35801
36211
  try {
35802
- if (true) ownVersion2 = "0.7.21";
36212
+ if (true) ownVersion2 = "0.7.23";
35803
36213
  } catch {
35804
36214
  }
35805
36215
  }
@@ -36001,47 +36411,47 @@ __export(team_merge_exports, {
36001
36411
  mergePullResult: () => mergePullResult
36002
36412
  });
36003
36413
  import { existsSync as existsSync56, mkdirSync as mkdirSync20, readFileSync as readFileSync50, rmSync as rmSync10, writeFileSync as writeFileSync20, statSync as statSync47 } from "fs";
36004
- import { dirname as dirname27, join as join62 } from "path";
36414
+ import { dirname as dirname27, join as join63 } from "path";
36005
36415
  import { createHash as createHash15 } from "crypto";
36006
36416
  function installPathFor(art, tool) {
36007
36417
  switch (art.type) {
36008
36418
  case "skill":
36009
36419
  switch (tool) {
36010
36420
  case "claude":
36011
- return join62(claudeBackend.skillsDir(), art.name, "SKILL.md");
36421
+ return join63(claudeBackend.skillsDir(), art.name, "SKILL.md");
36012
36422
  // Antigravity's OWN skills dir. It used to resolve to the shared
36013
36423
  // ~/.gemini/skills while toolkit-sync installed to
36014
36424
  // ~/.gemini/antigravity-cli/skills, so a team skill landed in one place
36015
36425
  // and a synced skill in the other.
36016
36426
  case "agy":
36017
- return join62(agyBackend.homeDir(), "skills", art.name, "SKILL.md");
36427
+ return join63(agyBackend.homeDir(), "skills", art.name, "SKILL.md");
36018
36428
  case "opencode":
36019
- return join62(opencodeBackend.skillsDir(), art.name, "SKILL.md");
36429
+ return join63(opencodeBackend.skillsDir(), art.name, "SKILL.md");
36020
36430
  // User skills go to ~/.codex/skills (NOT .system, which is OpenAI's bundle).
36021
36431
  case "codex":
36022
- return join62(codexBackend.skillsDir(), art.name, "SKILL.md");
36432
+ return join63(codexBackend.skillsDir(), art.name, "SKILL.md");
36023
36433
  case "cursor":
36024
- return join62(cursorHomeDir(), "skills", art.name, "SKILL.md");
36434
+ return join63(cursorHomeDir(), "skills", art.name, "SKILL.md");
36025
36435
  }
36026
36436
  break;
36027
36437
  case "agent":
36028
36438
  if (tool === "claude")
36029
- return join62(claudeBackend.agentsDir(), `${art.name}.md`);
36439
+ return join63(claudeBackend.agentsDir(), `${art.name}.md`);
36030
36440
  return null;
36031
36441
  case "command":
36032
36442
  if (tool === "claude")
36033
- return join62(claudeBackend.commandsDir(), `${art.name}.md`);
36443
+ return join63(claudeBackend.commandsDir(), `${art.name}.md`);
36034
36444
  return null;
36035
36445
  case "hook":
36036
36446
  if (tool === "claude")
36037
- return join62(claudeBackend.homeDir(), "chat-recall-hooks", `${art.name}.json`);
36447
+ return join63(claudeBackend.homeDir(), "chat-recall-hooks", `${art.name}.json`);
36038
36448
  return null;
36039
36449
  case "plan":
36040
36450
  switch (tool) {
36041
36451
  case "claude":
36042
- return join62(claudeBackend.plansDir(), `${art.name}.md`);
36452
+ return join63(claudeBackend.plansDir(), `${art.name}.md`);
36043
36453
  case "opencode":
36044
- return join62(opencodeBackend.plansDir(), `${art.name}.md`);
36454
+ return join63(opencodeBackend.plansDir(), `${art.name}.md`);
36045
36455
  case "agy":
36046
36456
  return null;
36047
36457
  // Antigravity plans live per-session
@@ -36052,11 +36462,11 @@ function installPathFor(art, tool) {
36052
36462
  }
36053
36463
  break;
36054
36464
  case "instructions":
36055
- return join62(getDataDir(), "team-instructions", tool, `${art.name}.md`);
36465
+ return join63(getDataDir(), "team-instructions", tool, `${art.name}.md`);
36056
36466
  case "mcp":
36057
- return join62(getDataDir(), "team-mcps", `${art.name}.json`);
36467
+ return join63(getDataDir(), "team-mcps", `${art.name}.json`);
36058
36468
  case "plugin":
36059
- return join62(getDataDir(), "team-plugins", tool, art.name, "manifest.json");
36469
+ return join63(getDataDir(), "team-plugins", tool, art.name, "manifest.json");
36060
36470
  }
36061
36471
  return null;
36062
36472
  }
@@ -36222,7 +36632,7 @@ var init_vault_crypto = __esm({
36222
36632
 
36223
36633
  // ../engine/dist/core/vault-source.js
36224
36634
  import { existsSync as existsSync57, readdirSync as readdirSync35, statSync as statSync48 } from "fs";
36225
- import { extname, join as join63 } from "path";
36635
+ import { extname, join as join64 } from "path";
36226
36636
  function* walkVaultSources() {
36227
36637
  const t = loadSettings().team.vault;
36228
36638
  const include2 = new Set(t.syncTools);
@@ -36259,7 +36669,7 @@ function* walkClaude() {
36259
36669
  if (proj.startsWith("."))
36260
36670
  continue;
36261
36671
  const projectPath = resolveProjectDirName(proj);
36262
- const projDir = join63(root, proj);
36672
+ const projDir = join64(root, proj);
36263
36673
  let entries = [];
36264
36674
  try {
36265
36675
  entries = readdirSync35(projDir);
@@ -36269,7 +36679,7 @@ function* walkClaude() {
36269
36679
  for (const f of entries) {
36270
36680
  if (extname(f) !== ".jsonl")
36271
36681
  continue;
36272
- const path = join63(projDir, f);
36682
+ const path = join64(projDir, f);
36273
36683
  const s = safeStat(path);
36274
36684
  if (!s)
36275
36685
  continue;
@@ -36299,7 +36709,7 @@ function* walkCursor() {
36299
36709
  }
36300
36710
  }
36301
36711
  function* walkCodex() {
36302
- const sessionsRoot = join63(codexBackend.homeDir(), "sessions");
36712
+ const sessionsRoot = join64(codexBackend.homeDir(), "sessions");
36303
36713
  if (!existsSync57(sessionsRoot))
36304
36714
  return;
36305
36715
  const stack = [sessionsRoot];
@@ -36312,7 +36722,7 @@ function* walkCodex() {
36312
36722
  continue;
36313
36723
  }
36314
36724
  for (const e of entries) {
36315
- const path = join63(dir, e.name);
36725
+ const path = join64(dir, e.name);
36316
36726
  if (e.isDirectory()) {
36317
36727
  stack.push(path);
36318
36728
  continue;
@@ -36328,7 +36738,7 @@ function* walkCodex() {
36328
36738
  }
36329
36739
  }
36330
36740
  function* walkAgy() {
36331
- const brainDir = join63(agyBackend.homeDir(), "brain");
36741
+ const brainDir = join64(agyBackend.homeDir(), "brain");
36332
36742
  if (!existsSync57(brainDir))
36333
36743
  return;
36334
36744
  let sessionDirs = [];
@@ -36338,16 +36748,16 @@ function* walkAgy() {
36338
36748
  return;
36339
36749
  }
36340
36750
  for (const rawId of sessionDirs) {
36341
- const sessionPath = join63(brainDir, rawId);
36751
+ const sessionPath = join64(brainDir, rawId);
36342
36752
  try {
36343
36753
  if (!statSync48(sessionPath).isDirectory())
36344
36754
  continue;
36345
36755
  } catch {
36346
36756
  continue;
36347
36757
  }
36348
- let filePath = join63(sessionPath, ".system_generated", "logs", "transcript.jsonl");
36758
+ let filePath = join64(sessionPath, ".system_generated", "logs", "transcript.jsonl");
36349
36759
  if (!existsSync57(filePath)) {
36350
- filePath = join63(sessionPath, ".system_generated", "logs", "transcript_full.jsonl");
36760
+ filePath = join64(sessionPath, ".system_generated", "logs", "transcript_full.jsonl");
36351
36761
  }
36352
36762
  if (!existsSync57(filePath))
36353
36763
  continue;
@@ -36386,7 +36796,7 @@ __export(vault_client_exports, {
36386
36796
  vaultSync: () => vaultSync
36387
36797
  });
36388
36798
  import { mkdirSync as mkdirSync21, readFileSync as readFileSync51, writeFileSync as writeFileSync21, existsSync as existsSync58 } from "fs";
36389
- import { dirname as dirname28, join as join64 } from "path";
36799
+ import { dirname as dirname28, join as join65 } from "path";
36390
36800
  function context2() {
36391
36801
  const s = loadSettings().team;
36392
36802
  if (!s.enabled)
@@ -36577,7 +36987,7 @@ async function vaultSync(passphrase) {
36577
36987
  }
36578
36988
  function importedPathFor(tool, sessionId) {
36579
36989
  const base4 = sessionId.replace(/^gemini_/, "").replace(/^codex_/, "").replace(/^agy_/, "").replace(/^cursor_/, "").replace(/^opencode_/, "");
36580
- return join64(IMPORTED_ROOT(), tool, `${base4}.jsonl`);
36990
+ return join65(IMPORTED_ROOT(), tool, `${base4}.jsonl`);
36581
36991
  }
36582
36992
  async function vaultRestore(passphrase, opts = {}) {
36583
36993
  const ctx = context2();
@@ -36666,7 +37076,7 @@ var init_vault_client = __esm({
36666
37076
  uploadKey = (sessionId, tool) => `${sessionId}\0${tool}`;
36667
37077
  VaultPassphraseMismatchError = class extends Error {
36668
37078
  };
36669
- IMPORTED_ROOT = () => join64(getDataDir(), "imported");
37079
+ IMPORTED_ROOT = () => join65(getDataDir(), "imported");
36670
37080
  }
36671
37081
  });
36672
37082
 
@@ -37229,14 +37639,14 @@ __export(service_installer_exports, {
37229
37639
  });
37230
37640
  import { execSync as execSync5 } from "child_process";
37231
37641
  import { existsSync as existsSync59, mkdirSync as mkdirSync22, readFileSync as readFileSync52, rmSync as rmSync11, writeFileSync as writeFileSync22 } from "fs";
37232
- import { homedir as homedir23 } from "os";
37233
- import { join as join65 } from "path";
37642
+ import { homedir as homedir24 } from "os";
37643
+ import { join as join66 } from "path";
37234
37644
  import { fileURLToPath as fileURLToPath5 } from "url";
37235
37645
  function resolveDaemonPaths() {
37236
37646
  const watchJs = fileURLToPath5(new URL("./watch.js", import.meta.url));
37237
37647
  const node = process.execPath;
37238
- const dataDir = join65(homedir23(), ".chat-recall");
37239
- const logFile = join65(dataDir, "watch.log");
37648
+ const dataDir = join66(homedir24(), ".chat-recall");
37649
+ const logFile = join66(dataDir, "watch.log");
37240
37650
  return { watchJs, node, logFile, dataDir };
37241
37651
  }
37242
37652
  function tryCmd(cmd) {
@@ -37263,7 +37673,7 @@ function refreshServiceDefinition() {
37263
37673
  if (process.platform !== "linux") return false;
37264
37674
  try {
37265
37675
  const { watchJs, node, logFile } = resolveDaemonPaths();
37266
- const unitPath = join65(homedir23(), ".config", "systemd", "user", "chat-recall-watch.service");
37676
+ const unitPath = join66(homedir24(), ".config", "systemd", "user", "chat-recall-watch.service");
37267
37677
  if (!existsSync59(unitPath)) return false;
37268
37678
  const current = readFileSync52(unitPath, "utf8");
37269
37679
  if (!current.includes(watchJs)) return false;
@@ -37294,8 +37704,8 @@ function installService() {
37294
37704
  );
37295
37705
  }
37296
37706
  function installSystemd(watchJs, node, logFile) {
37297
- const unitDir = join65(homedir23(), ".config", "systemd", "user");
37298
- const unitPath = join65(unitDir, "chat-recall-watch.service");
37707
+ const unitDir = join66(homedir24(), ".config", "systemd", "user");
37708
+ const unitPath = join66(unitDir, "chat-recall-watch.service");
37299
37709
  const unit = renderSystemdUnit(watchJs, node, logFile);
37300
37710
  mkdirSync22(unitDir, { recursive: true });
37301
37711
  writeFileSync22(unitPath, unit);
@@ -37381,8 +37791,8 @@ function renderSystemdUnit(watchJs, node, logFile) {
37381
37791
  }
37382
37792
  function installLaunchd(watchJs, node, logFile) {
37383
37793
  const label = "com.chat-recall.watch";
37384
- const plistDir = join65(homedir23(), "Library", "LaunchAgents");
37385
- const plistPath = join65(plistDir, `${label}.plist`);
37794
+ const plistDir = join66(homedir24(), "Library", "LaunchAgents");
37795
+ const plistPath = join66(plistDir, `${label}.plist`);
37386
37796
  const plist = renderLaunchdPlist(watchJs, node, logFile, label);
37387
37797
  mkdirSync22(plistDir, { recursive: true });
37388
37798
  writeFileSync22(plistPath, plist);
@@ -37438,7 +37848,7 @@ function uninstallService() {
37438
37848
  removed = true;
37439
37849
  } catch {
37440
37850
  }
37441
- const unitPath = join65(homedir23(), ".config", "systemd", "user", "chat-recall-watch.service");
37851
+ const unitPath = join66(homedir24(), ".config", "systemd", "user", "chat-recall-watch.service");
37442
37852
  if (existsSync59(unitPath)) {
37443
37853
  rmSync11(unitPath, { force: true });
37444
37854
  removed = true;
@@ -37450,7 +37860,7 @@ function uninstallService() {
37450
37860
  return removed;
37451
37861
  }
37452
37862
  if (process.platform === "darwin") {
37453
- const plistPath = join65(homedir23(), "Library", "LaunchAgents", "com.chat-recall.watch.plist");
37863
+ const plistPath = join66(homedir24(), "Library", "LaunchAgents", "com.chat-recall.watch.plist");
37454
37864
  try {
37455
37865
  execSync5(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
37456
37866
  } catch {
@@ -37987,8 +38397,8 @@ import { config } from "dotenv";
37987
38397
  import { Command } from "commander";
37988
38398
  import chalk2 from "chalk";
37989
38399
  import { existsSync as existsSync60, readFileSync as readFileSync53, writeFileSync as writeFileSync23 } from "fs";
37990
- import { homedir as homedir24 } from "os";
37991
- import { join as join66, resolve as resolve2, dirname as dirname29, basename as basename29 } from "path";
38400
+ import { homedir as homedir25 } from "os";
38401
+ import { join as join67, resolve as resolve2, dirname as dirname29, basename as basename29 } from "path";
37992
38402
 
37993
38403
  // ../engine/dist/core/score-tier.js
37994
38404
  var STRONG_RATIO = 0.85;
@@ -38415,10 +38825,10 @@ program.command("init").description("Set up chat-recall: connect to your server,
38415
38825
  } else if (target) {
38416
38826
  }
38417
38827
  if (!options.skipMcp) {
38418
- const projectRoot = join66(import.meta.dirname, "..");
38828
+ const projectRoot = join67(import.meta.dirname, "..");
38419
38829
  let mcpBinOnPath = false;
38420
38830
  mcpBinOnPath = isOnPath("chat-recall-mcp");
38421
- const launch = mcpBinOnPath ? { command: "chat-recall-mcp" } : { command: "node", args: [join66(projectRoot, "dist", "mcp-relay.js")] };
38831
+ const launch = mcpBinOnPath ? { command: "chat-recall-mcp" } : { command: "node", args: [join67(projectRoot, "dist", "mcp-relay.js")] };
38422
38832
  const MCP_ENV = { NODE_OPTIONS: "--max-old-space-size=1024" };
38423
38833
  const { registerMcpEverywhere: registerMcpEverywhere2 } = await Promise.resolve().then(() => (init_mcp_clients(), mcp_clients_exports));
38424
38834
  const MCP_CLIENT_FOR_BIN = {
@@ -38459,7 +38869,7 @@ program.command("init").description("Set up chat-recall: connect to your server,
38459
38869
  const detected = checkCodeindexStatus2();
38460
38870
  if (detected.installed && !forceInstall) {
38461
38871
  if (!options.skipMcp) {
38462
- const mcpJsonPath = join66(homedir24(), ".mcp.json");
38872
+ const mcpJsonPath = join67(homedir25(), ".mcp.json");
38463
38873
  const reg = registerCodeindexMcp2(mcpJsonPath, detected.path);
38464
38874
  }
38465
38875
  } else if (forceInstall) {
@@ -38468,7 +38878,7 @@ program.command("init").description("Set up chat-recall: connect to your server,
38468
38878
  if (result.installed) {
38469
38879
  const sizeMb = result.size ? `${(result.size / 1024 / 1024).toFixed(1)} MB` : "?";
38470
38880
  if (!options.skipMcp) {
38471
- const mcpJsonPath = join66(homedir24(), ".mcp.json");
38881
+ const mcpJsonPath = join67(homedir25(), ".mcp.json");
38472
38882
  const reg = registerCodeindexMcp2(mcpJsonPath, CODEINDEX_BIN_PATH2);
38473
38883
  }
38474
38884
  } else if (!result.prebuiltAvailable) {
@@ -39088,7 +39498,7 @@ program.command("doctor").description("Quick health check across login, server,
39088
39498
  }
39089
39499
  }
39090
39500
  }
39091
- const credFile = join66(getDataDir(), "credentials.json");
39501
+ const credFile = join67(getDataDir(), "credentials.json");
39092
39502
  if (!existsSync61(credFile)) {
39093
39503
  note(false, "Credentials file", `missing \u2014 run \`chat-recall login <server-url>\``);
39094
39504
  } else {
@@ -39113,7 +39523,7 @@ program.command("doctor").description("Quick health check across login, server,
39113
39523
  note(false, label, `${settingsFile} is not valid JSON, so no hook in it runs`);
39114
39524
  continue;
39115
39525
  }
39116
- const legacy = join66(dirname29(settingsFile), "hooks.json");
39526
+ const legacy = join67(dirname29(settingsFile), "hooks.json");
39117
39527
  try {
39118
39528
  const stranded = existsSync61(legacy) ? Object.values(JSON.parse(readFileSync54(legacy, "utf-8")).hooks || {}).flat().filter(isOurEntry2).length : 0;
39119
39529
  if (stranded) note(false, `Old hook file (${profile})`, `${stranded} chat-recall entr${stranded === 1 ? "y" : "ies"} in ${legacy}, which Claude Code does not read \u2014 run \`chat-recall install-hooks\` to move them`);
@@ -39161,12 +39571,32 @@ program.command("doctor").description("Quick health check across login, server,
39161
39571
  } catch (err) {
39162
39572
  note(false, "Decision guard", `check failed: ${err}`);
39163
39573
  }
39574
+ try {
39575
+ const reg = await Promise.resolve().then(() => (init_message_registration(), message_registration_exports));
39576
+ for (const target2 of reg.messageTargets()) {
39577
+ if (!existsSync61(target2.homeDir)) continue;
39578
+ const label = `Messages \u2014 ${target2.label}`;
39579
+ let registered = existsSync61(target2.configPath);
39580
+ if (registered) {
39581
+ try {
39582
+ const text = readFileSync54(target2.configPath, "utf-8");
39583
+ registered = text.includes("chat_recall_messages_") || reg.isOurPluginSource(text);
39584
+ } catch {
39585
+ registered = false;
39586
+ }
39587
+ }
39588
+ const detail = !registered ? "not registered \u2014 run `chat-recall install-hooks`" : target2.tool === "codex" ? `${target2.configPath} \u2014 approve it in Codex with /hooks` : target2.configPath;
39589
+ note(registered, label, detail);
39590
+ }
39591
+ } catch (err) {
39592
+ note(false, "Messages", `check failed: ${err}`);
39593
+ }
39164
39594
  try {
39165
39595
  const { skillTargets: skillTargets2, bundledSkillNames: bundledSkillNames2 } = await Promise.resolve().then(() => (init_install_skills(), install_skills_exports));
39166
39596
  const want = bundledSkillNames2().length;
39167
39597
  for (const t of skillTargets2()) {
39168
39598
  if (!t.available) continue;
39169
- const have = want === 0 ? 0 : bundledSkillNames2().filter((n) => existsSync61(join66(t.dir, n, ".chat-recall-managed"))).length;
39599
+ const have = want === 0 ? 0 : bundledSkillNames2().filter((n) => existsSync61(join67(t.dir, n, ".chat-recall-managed"))).length;
39170
39600
  note(
39171
39601
  have === want,
39172
39602
  `Skills \u2014 ${t.label}`,
@@ -39241,12 +39671,12 @@ program.command("doctor").description("Quick health check across login, server,
39241
39671
  note(watchRunning, "Watch daemon", watchRunning ? "running" : "not running (run `chat-recall watch --install-service` to keep collection running)");
39242
39672
  const dataDir = getDataDir();
39243
39673
  const legacyPaths = [
39244
- join66(dataDir, "cache.db"),
39245
- join66(dataDir, "cache.db-wal"),
39246
- join66(dataDir, "cache.db-shm"),
39247
- join66(dataDir, "index", "lancedb"),
39248
- join66(dataDir, "index", "knowledge_graph.db"),
39249
- join66(dataDir, "index", "metadata.db")
39674
+ join67(dataDir, "cache.db"),
39675
+ join67(dataDir, "cache.db-wal"),
39676
+ join67(dataDir, "cache.db-shm"),
39677
+ join67(dataDir, "index", "lancedb"),
39678
+ join67(dataDir, "index", "knowledge_graph.db"),
39679
+ join67(dataDir, "index", "metadata.db")
39250
39680
  ];
39251
39681
  const legacyPresent = legacyPaths.filter((p) => existsSync61(p));
39252
39682
  if (opts.purgeLocal) {
@@ -39319,7 +39749,7 @@ companions.command("install").description("Install codeindex (downloads from mun
39319
39749
  if (result.installed) {
39320
39750
  const sizeMb = result.size ? `${(result.size / 1024 / 1024).toFixed(1)} MB` : "?";
39321
39751
  console.log(chalk2.green(`\u2713 codeindex installed (${sizeMb}) \u2192 ${result.path}`));
39322
- const mcpJsonPath = join66(homedir24(), ".mcp.json");
39752
+ const mcpJsonPath = join67(homedir25(), ".mcp.json");
39323
39753
  const reg = registerCodeindexMcp2(mcpJsonPath, CODEINDEX_BIN_PATH2);
39324
39754
  if (reg.added) console.log(chalk2.dim(` Registered as MCP server in ${mcpJsonPath}`));
39325
39755
  else console.log(chalk2.dim(` Already registered as MCP server`));
@@ -39341,7 +39771,7 @@ companions.command("uninstall").description("Remove the codeindex binary chat-re
39341
39771
  const r = uninstallCodeindex2();
39342
39772
  if (r.removed) console.log(chalk2.green(`\u2713 Removed ${r.path}`));
39343
39773
  else console.log(chalk2.dim(` Nothing to remove at ${r.path}`));
39344
- const mcpJsonPath = join66(homedir24(), ".mcp.json");
39774
+ const mcpJsonPath = join67(homedir25(), ".mcp.json");
39345
39775
  const u = unregisterCodeindexMcp2(mcpJsonPath);
39346
39776
  if (u.removed) console.log(chalk2.dim(` Unregistered MCP server from ${mcpJsonPath}`));
39347
39777
  });
@@ -39894,8 +40324,8 @@ tasks.command("pull [dir]").description("Write TEAM_TASKS.md for your tasks in t
39894
40324
  const { resolveProjectId: resolveProjectId2 } = await Promise.resolve().then(() => (init_project_resolver(), project_resolver_exports));
39895
40325
  const { renderTeamTasksMd: renderTeamTasksMd2, parseTeamTasksFile: parseTeamTasksFile2 } = await Promise.resolve().then(() => (init_project_tasks(), project_tasks_exports));
39896
40326
  const { writeFileSync: writeFileSync24, readFileSync: readFileSync54, existsSync: existsSync61 } = await import("node:fs");
39897
- const { join: join67 } = await import("node:path");
39898
- const file = join67(cwd, "TEAM_TASKS.md");
40327
+ const { join: join68 } = await import("node:path");
40328
+ const file = join68(cwd, "TEAM_TASKS.md");
39899
40329
  if (!opts.force && existsSync61(file) && parseTeamTasksFile2(readFileSync54(file, "utf8")).length > 0) {
39900
40330
  console.error(chalk2.red("TEAM_TASKS.md has unpushed edits."), "Run", chalk2.bold("chat-recall tasks push"), "first, or", chalk2.bold("tasks pull --force"), "to discard.");
39901
40331
  process.exit(1);
@@ -39916,8 +40346,8 @@ tasks.command("push [dir]").description("Push TEAM_TASKS.md status edits back to
39916
40346
  try {
39917
40347
  const { parseTeamTasksFile: parseTeamTasksFile2 } = await Promise.resolve().then(() => (init_project_tasks(), project_tasks_exports));
39918
40348
  const { readFileSync: readFileSync54, existsSync: existsSync61 } = await import("node:fs");
39919
- const { join: join67 } = await import("node:path");
39920
- const file = join67(cwd, "TEAM_TASKS.md");
40349
+ const { join: join68 } = await import("node:path");
40350
+ const file = join68(cwd, "TEAM_TASKS.md");
39921
40351
  if (!existsSync61(file)) {
39922
40352
  console.error(chalk2.red("no TEAM_TASKS.md here \u2014"), "run", chalk2.bold("chat-recall tasks pull"), "first");
39923
40353
  process.exit(1);
@@ -40412,7 +40842,8 @@ program.command("install-hooks").description("Install the chat-recall hooks into
40412
40842
  const r2 = await uninstallHooks2();
40413
40843
  for (const f of r2.files) console.log(chalk2.green(`\u2713 Removed chat-recall hooks from ${f}`));
40414
40844
  for (const g of r2.guardRemoved) console.log(chalk2.green(`\u2713 Removed the guard from ${g.label} (${g.configPath})`));
40415
- if (r2.removed === 0 && r2.guardRemoved.length === 0) console.log(chalk2.dim("No chat-recall hooks were registered."));
40845
+ for (const m of r2.messagesRemoved) console.log(chalk2.green(`\u2713 Removed the message hook from ${m.label} (${m.configPath})`));
40846
+ if (r2.removed === 0 && r2.guardRemoved.length === 0 && r2.messagesRemoved.length === 0) console.log(chalk2.dim("No chat-recall hooks were registered."));
40416
40847
  console.log(chalk2.dim("The MCP server will not put them back. Run `chat-recall install-hooks` to install them again."));
40417
40848
  return;
40418
40849
  }
@@ -40432,6 +40863,10 @@ program.command("install-hooks").description("Install the chat-recall hooks into
40432
40863
  console.log(chalk2.green(`\u2713 Registered the guard for ${g.label}`));
40433
40864
  if (g.note) console.log(chalk2.yellow(` ! ${g.note}`));
40434
40865
  }
40866
+ for (const m of r.messageTargets) {
40867
+ console.log(chalk2.green(`\u2713 Registered the message hook for ${m.label} (${m.configPath})`));
40868
+ if (m.note) console.log(chalk2.yellow(` ! ${m.note}`));
40869
+ }
40435
40870
  if (r.shellSkipped) {
40436
40871
  console.log(chalk2.yellow("The five shell hooks are not installed on Windows: Claude Code runs hooks through cmd.exe, which cannot run them."));
40437
40872
  console.log(chalk2.dim(" The task-board and message hooks are installed. Under WSL, run this inside the WSL shell to get all of them."));
@@ -40709,8 +41144,8 @@ include.command("list", { isDefault: true }).description("Show paths opted back
40709
41144
  include.command("project <path>").description("Re-permit a path under a personal folder (substring match; e.g. ~/Documents/code)").action(async (path) => {
40710
41145
  const { loadSettings: loadSettings2, saveSettings: saveSettings2 } = await Promise.resolve().then(() => (init_settings(), settings_exports));
40711
41146
  const { resolve: resolve3 } = await import("node:path");
40712
- const { homedir: homedir25 } = await import("node:os");
40713
- const abs = resolve3(path.replace(/^~(?=\/|$)/, homedir25()));
41147
+ const { homedir: homedir26 } = await import("node:os");
41148
+ const abs = resolve3(path.replace(/^~(?=\/|$)/, homedir26()));
40714
41149
  const s = loadSettings2();
40715
41150
  s.sync.includeProjects = s.sync.includeProjects || [];
40716
41151
  if (s.sync.includeProjects.includes(abs)) {
@@ -40724,8 +41159,8 @@ include.command("project <path>").description("Re-permit a path under a personal
40724
41159
  include.command("remove <path>").description("Undo an opt-in (personal folder goes back to skipped)").action(async (path) => {
40725
41160
  const { loadSettings: loadSettings2, saveSettings: saveSettings2 } = await Promise.resolve().then(() => (init_settings(), settings_exports));
40726
41161
  const { resolve: resolve3 } = await import("node:path");
40727
- const { homedir: homedir25 } = await import("node:os");
40728
- const abs = resolve3(path.replace(/^~(?=\/|$)/, homedir25()));
41162
+ const { homedir: homedir26 } = await import("node:os");
41163
+ const abs = resolve3(path.replace(/^~(?=\/|$)/, homedir26()));
40729
41164
  const s = loadSettings2();
40730
41165
  const before = (s.sync.includeProjects || []).length;
40731
41166
  s.sync.includeProjects = (s.sync.includeProjects || []).filter((p) => p !== path && p !== abs);
@@ -40864,8 +41299,8 @@ program.command("projects").description("List distinct project ids discovered on
40864
41299
  exclude.command("project <path>").description("Exclude a project path from syncing (substring match on the project path; e.g. ~/.claude-pr-bot)").action(async (path) => {
40865
41300
  const { loadSettings: loadSettings2, saveSettings: saveSettings2 } = await Promise.resolve().then(() => (init_settings(), settings_exports));
40866
41301
  const { resolve: resolve3 } = await import("node:path");
40867
- const { homedir: homedir25 } = await import("node:os");
40868
- const abs = resolve3(path.replace(/^~(?=\/|$)/, homedir25()));
41302
+ const { homedir: homedir26 } = await import("node:os");
41303
+ const abs = resolve3(path.replace(/^~(?=\/|$)/, homedir26()));
40869
41304
  const s = loadSettings2();
40870
41305
  if (s.sync.excludeProjects.includes(abs)) {
40871
41306
  console.log(chalk2.dim(`Already excluded: ${abs}`));
@@ -40894,8 +41329,8 @@ exclude.command("tool <tool>").description("Exclude an AI tool entirely (claude
40894
41329
  exclude.command("remove <value>").description("Remove an exclusion (tool name or project path)").action(async (value) => {
40895
41330
  const { loadSettings: loadSettings2, saveSettings: saveSettings2 } = await Promise.resolve().then(() => (init_settings(), settings_exports));
40896
41331
  const { resolve: resolve3 } = await import("node:path");
40897
- const { homedir: homedir25 } = await import("node:os");
40898
- const abs = resolve3(value.replace(/^~(?=\/|$)/, homedir25()));
41332
+ const { homedir: homedir26 } = await import("node:os");
41333
+ const abs = resolve3(value.replace(/^~(?=\/|$)/, homedir26()));
40899
41334
  const s = loadSettings2();
40900
41335
  const beforeTools = s.sync.excludeTools.length;
40901
41336
  const beforeProjects = s.sync.excludeProjects.length;