chat-recall 0.7.20 → 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/README.md +53 -11
- package/dist/board-hooks.d.ts +37 -27
- package/dist/board-hooks.d.ts.map +1 -1
- package/dist/board-hooks.js +50 -80
- package/dist/board-hooks.js.map +1 -1
- package/dist/cli.js +9526 -9086
- package/dist/cli.js.map +1 -1
- package/dist/install-hooks.d.ts +105 -0
- package/dist/install-hooks.d.ts.map +1 -0
- package/dist/install-hooks.js +424 -0
- package/dist/install-hooks.js.map +1 -0
- package/dist/mcp-relay.js +1 -1
- package/dist/mcp.js +2609 -1163
- package/dist/mcp.js.map +1 -1
- package/dist/message-hook-core.d.ts +93 -0
- package/dist/message-hook-core.d.ts.map +1 -0
- package/dist/message-hook-core.js +173 -0
- package/dist/message-hook-core.js.map +1 -0
- package/dist/message-hook.d.ts +2 -0
- package/dist/message-hook.d.ts.map +1 -0
- package/dist/message-hook.js +508 -0
- package/dist/message-hook.js.map +1 -0
- package/dist/scan-worker.js +36 -24
- package/dist/service-installer.d.ts.map +1 -1
- package/dist/service-installer.js +7 -0
- package/dist/service-installer.js.map +1 -1
- package/dist/watch.js +504 -483
- package/package.json +2 -2
- package/skills/chat-recall/SKILL.md +6 -1
- package/skills/chat-recall-sessions/SKILL.md +161 -0
package/dist/watch.js
CHANGED
|
@@ -2235,7 +2235,7 @@ var require_thread_stream = __commonJS({
|
|
|
2235
2235
|
var { version } = require_package();
|
|
2236
2236
|
var { EventEmitter } = __require("events");
|
|
2237
2237
|
var { Worker: Worker2 } = __require("worker_threads");
|
|
2238
|
-
var { join:
|
|
2238
|
+
var { join: join59 } = __require("path");
|
|
2239
2239
|
var { pathToFileURL } = __require("url");
|
|
2240
2240
|
var { wait } = require_wait();
|
|
2241
2241
|
var {
|
|
@@ -2278,7 +2278,7 @@ var require_thread_stream = __commonJS({
|
|
|
2278
2278
|
function createWorker(stream, opts) {
|
|
2279
2279
|
const { filename, workerData } = opts;
|
|
2280
2280
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
2281
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
2281
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join59(__dirname, "lib", "worker.js");
|
|
2282
2282
|
const worker = new Worker2(toExecute, {
|
|
2283
2283
|
...opts.workerOpts,
|
|
2284
2284
|
trackUnmanagedFds: false,
|
|
@@ -2681,7 +2681,7 @@ var require_transport = __commonJS({
|
|
|
2681
2681
|
"use strict";
|
|
2682
2682
|
var { createRequire: createRequire3 } = __require("module");
|
|
2683
2683
|
var getCallers = require_caller();
|
|
2684
|
-
var { join:
|
|
2684
|
+
var { join: join59, isAbsolute: isAbsolute5, sep: sep5 } = __require("node:path");
|
|
2685
2685
|
var sleep = require_atomic_sleep();
|
|
2686
2686
|
var onExit = require_on_exit_leak_free();
|
|
2687
2687
|
var ThreadStream = require_thread_stream();
|
|
@@ -2744,7 +2744,7 @@ var require_transport = __commonJS({
|
|
|
2744
2744
|
throw new Error("only one of target or targets can be specified");
|
|
2745
2745
|
}
|
|
2746
2746
|
if (targets) {
|
|
2747
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
2747
|
+
target = bundlerOverrides["pino-worker"] || join59(__dirname, "worker.js");
|
|
2748
2748
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
2749
2749
|
return {
|
|
2750
2750
|
...dest,
|
|
@@ -2762,7 +2762,7 @@ var require_transport = __commonJS({
|
|
|
2762
2762
|
});
|
|
2763
2763
|
});
|
|
2764
2764
|
} else if (pipeline) {
|
|
2765
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
2765
|
+
target = bundlerOverrides["pino-worker"] || join59(__dirname, "worker.js");
|
|
2766
2766
|
options.pipelines = [pipeline.map((dest) => {
|
|
2767
2767
|
return {
|
|
2768
2768
|
...dest,
|
|
@@ -2784,7 +2784,7 @@ var require_transport = __commonJS({
|
|
|
2784
2784
|
return origin;
|
|
2785
2785
|
}
|
|
2786
2786
|
if (origin === "pino/file") {
|
|
2787
|
-
return
|
|
2787
|
+
return join59(__dirname, "..", "file.js");
|
|
2788
2788
|
}
|
|
2789
2789
|
let fixTarget2;
|
|
2790
2790
|
for (const filePath of callers) {
|
|
@@ -3773,7 +3773,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
3773
3773
|
return circularValue;
|
|
3774
3774
|
}
|
|
3775
3775
|
let res = "";
|
|
3776
|
-
let
|
|
3776
|
+
let join59 = ",";
|
|
3777
3777
|
const originalIndentation = indentation;
|
|
3778
3778
|
if (Array.isArray(value)) {
|
|
3779
3779
|
if (value.length === 0) {
|
|
@@ -3787,7 +3787,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
3787
3787
|
indentation += spacer;
|
|
3788
3788
|
res += `
|
|
3789
3789
|
${indentation}`;
|
|
3790
|
-
|
|
3790
|
+
join59 = `,
|
|
3791
3791
|
${indentation}`;
|
|
3792
3792
|
}
|
|
3793
3793
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -3795,13 +3795,13 @@ ${indentation}`;
|
|
|
3795
3795
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
3796
3796
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
3797
3797
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
3798
|
-
res +=
|
|
3798
|
+
res += join59;
|
|
3799
3799
|
}
|
|
3800
3800
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
3801
3801
|
res += tmp !== void 0 ? tmp : "null";
|
|
3802
3802
|
if (value.length - 1 > maximumBreadth) {
|
|
3803
3803
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
3804
|
-
res += `${
|
|
3804
|
+
res += `${join59}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
3805
3805
|
}
|
|
3806
3806
|
if (spacer !== "") {
|
|
3807
3807
|
res += `
|
|
@@ -3822,7 +3822,7 @@ ${originalIndentation}`;
|
|
|
3822
3822
|
let separator = "";
|
|
3823
3823
|
if (spacer !== "") {
|
|
3824
3824
|
indentation += spacer;
|
|
3825
|
-
|
|
3825
|
+
join59 = `,
|
|
3826
3826
|
${indentation}`;
|
|
3827
3827
|
whitespace = " ";
|
|
3828
3828
|
}
|
|
@@ -3836,13 +3836,13 @@ ${indentation}`;
|
|
|
3836
3836
|
const tmp = stringifyFnReplacer(key3, value, stack, replacer, spacer, indentation);
|
|
3837
3837
|
if (tmp !== void 0) {
|
|
3838
3838
|
res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
|
|
3839
|
-
separator =
|
|
3839
|
+
separator = join59;
|
|
3840
3840
|
}
|
|
3841
3841
|
}
|
|
3842
3842
|
if (keyLength > maximumBreadth) {
|
|
3843
3843
|
const removedKeys = keyLength - maximumBreadth;
|
|
3844
3844
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
3845
|
-
separator =
|
|
3845
|
+
separator = join59;
|
|
3846
3846
|
}
|
|
3847
3847
|
if (spacer !== "" && separator.length > 1) {
|
|
3848
3848
|
res = `
|
|
@@ -3883,7 +3883,7 @@ ${originalIndentation}`;
|
|
|
3883
3883
|
}
|
|
3884
3884
|
const originalIndentation = indentation;
|
|
3885
3885
|
let res = "";
|
|
3886
|
-
let
|
|
3886
|
+
let join59 = ",";
|
|
3887
3887
|
if (Array.isArray(value)) {
|
|
3888
3888
|
if (value.length === 0) {
|
|
3889
3889
|
return "[]";
|
|
@@ -3896,7 +3896,7 @@ ${originalIndentation}`;
|
|
|
3896
3896
|
indentation += spacer;
|
|
3897
3897
|
res += `
|
|
3898
3898
|
${indentation}`;
|
|
3899
|
-
|
|
3899
|
+
join59 = `,
|
|
3900
3900
|
${indentation}`;
|
|
3901
3901
|
}
|
|
3902
3902
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -3904,13 +3904,13 @@ ${indentation}`;
|
|
|
3904
3904
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
3905
3905
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
3906
3906
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
3907
|
-
res +=
|
|
3907
|
+
res += join59;
|
|
3908
3908
|
}
|
|
3909
3909
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
3910
3910
|
res += tmp !== void 0 ? tmp : "null";
|
|
3911
3911
|
if (value.length - 1 > maximumBreadth) {
|
|
3912
3912
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
3913
|
-
res += `${
|
|
3913
|
+
res += `${join59}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
3914
3914
|
}
|
|
3915
3915
|
if (spacer !== "") {
|
|
3916
3916
|
res += `
|
|
@@ -3923,7 +3923,7 @@ ${originalIndentation}`;
|
|
|
3923
3923
|
let whitespace = "";
|
|
3924
3924
|
if (spacer !== "") {
|
|
3925
3925
|
indentation += spacer;
|
|
3926
|
-
|
|
3926
|
+
join59 = `,
|
|
3927
3927
|
${indentation}`;
|
|
3928
3928
|
whitespace = " ";
|
|
3929
3929
|
}
|
|
@@ -3932,7 +3932,7 @@ ${indentation}`;
|
|
|
3932
3932
|
const tmp = stringifyArrayReplacer(key3, value[key3], stack, replacer, spacer, indentation);
|
|
3933
3933
|
if (tmp !== void 0) {
|
|
3934
3934
|
res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
|
|
3935
|
-
separator =
|
|
3935
|
+
separator = join59;
|
|
3936
3936
|
}
|
|
3937
3937
|
}
|
|
3938
3938
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -3990,20 +3990,20 @@ ${originalIndentation}`;
|
|
|
3990
3990
|
indentation += spacer;
|
|
3991
3991
|
let res2 = `
|
|
3992
3992
|
${indentation}`;
|
|
3993
|
-
const
|
|
3993
|
+
const join60 = `,
|
|
3994
3994
|
${indentation}`;
|
|
3995
3995
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
3996
3996
|
let i = 0;
|
|
3997
3997
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
3998
3998
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
3999
3999
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
4000
|
-
res2 +=
|
|
4000
|
+
res2 += join60;
|
|
4001
4001
|
}
|
|
4002
4002
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
4003
4003
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
4004
4004
|
if (value.length - 1 > maximumBreadth) {
|
|
4005
4005
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
4006
|
-
res2 += `${
|
|
4006
|
+
res2 += `${join60}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
4007
4007
|
}
|
|
4008
4008
|
res2 += `
|
|
4009
4009
|
${originalIndentation}`;
|
|
@@ -4019,16 +4019,16 @@ ${originalIndentation}`;
|
|
|
4019
4019
|
return '"[Object]"';
|
|
4020
4020
|
}
|
|
4021
4021
|
indentation += spacer;
|
|
4022
|
-
const
|
|
4022
|
+
const join59 = `,
|
|
4023
4023
|
${indentation}`;
|
|
4024
4024
|
let res = "";
|
|
4025
4025
|
let separator = "";
|
|
4026
4026
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
4027
4027
|
if (isTypedArrayWithEntries(value)) {
|
|
4028
|
-
res += stringifyTypedArray(value,
|
|
4028
|
+
res += stringifyTypedArray(value, join59, maximumBreadth);
|
|
4029
4029
|
keys = keys.slice(value.length);
|
|
4030
4030
|
maximumPropertiesToStringify -= value.length;
|
|
4031
|
-
separator =
|
|
4031
|
+
separator = join59;
|
|
4032
4032
|
}
|
|
4033
4033
|
if (deterministic) {
|
|
4034
4034
|
keys = sort(keys, comparator);
|
|
@@ -4039,13 +4039,13 @@ ${indentation}`;
|
|
|
4039
4039
|
const tmp = stringifyIndent(key3, value[key3], stack, spacer, indentation);
|
|
4040
4040
|
if (tmp !== void 0) {
|
|
4041
4041
|
res += `${separator}${strEscape(key3)}: ${tmp}`;
|
|
4042
|
-
separator =
|
|
4042
|
+
separator = join59;
|
|
4043
4043
|
}
|
|
4044
4044
|
}
|
|
4045
4045
|
if (keyLength > maximumBreadth) {
|
|
4046
4046
|
const removedKeys = keyLength - maximumBreadth;
|
|
4047
4047
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
4048
|
-
separator =
|
|
4048
|
+
separator = join59;
|
|
4049
4049
|
}
|
|
4050
4050
|
if (separator !== "") {
|
|
4051
4051
|
res = `
|
|
@@ -4632,49 +4632,58 @@ var init_logger = __esm({
|
|
|
4632
4632
|
}
|
|
4633
4633
|
});
|
|
4634
4634
|
|
|
4635
|
-
// ../engine/dist/core/
|
|
4636
|
-
import {
|
|
4637
|
-
import {
|
|
4638
|
-
import { join, dirname } from "path";
|
|
4635
|
+
// ../engine/dist/core/data-dir.js
|
|
4636
|
+
import { homedir } from "node:os";
|
|
4637
|
+
import { join } from "node:path";
|
|
4639
4638
|
function getDataDir() {
|
|
4640
4639
|
const override = process.env.CHAT_RECALL_DATA_DIR;
|
|
4641
4640
|
if (override && override.trim())
|
|
4642
4641
|
return override.trim();
|
|
4643
4642
|
return join(homedir(), ".chat-recall");
|
|
4644
4643
|
}
|
|
4644
|
+
var init_data_dir = __esm({
|
|
4645
|
+
"../engine/dist/core/data-dir.js"() {
|
|
4646
|
+
"use strict";
|
|
4647
|
+
}
|
|
4648
|
+
});
|
|
4649
|
+
|
|
4650
|
+
// ../engine/dist/core/paths.js
|
|
4651
|
+
import { existsSync, mkdirSync, renameSync, readdirSync, statSync, copyFileSync, rmSync } from "fs";
|
|
4652
|
+
import { homedir as homedir2 } from "os";
|
|
4653
|
+
import { join as join2, dirname } from "path";
|
|
4645
4654
|
function getIndexDir() {
|
|
4646
4655
|
ensureMigrated();
|
|
4647
|
-
const p =
|
|
4656
|
+
const p = join2(getDataDir(), "index");
|
|
4648
4657
|
ensureDir(p);
|
|
4649
4658
|
return p;
|
|
4650
4659
|
}
|
|
4651
4660
|
function getDiaryDir() {
|
|
4652
|
-
const p =
|
|
4661
|
+
const p = join2(getIndexDir(), "diary");
|
|
4653
4662
|
ensureDir(p);
|
|
4654
4663
|
return p;
|
|
4655
4664
|
}
|
|
4656
4665
|
function getDetectorBinDir() {
|
|
4657
|
-
return
|
|
4666
|
+
return join2(getDataDir(), "bin");
|
|
4658
4667
|
}
|
|
4659
4668
|
function legacyRoot() {
|
|
4660
|
-
return
|
|
4669
|
+
return join2(homedir2(), ".claude");
|
|
4661
4670
|
}
|
|
4662
4671
|
function legacyMappings() {
|
|
4663
4672
|
const root = legacyRoot();
|
|
4664
4673
|
const newRoot = getDataDir();
|
|
4665
4674
|
return [
|
|
4666
|
-
{ legacyPath:
|
|
4667
|
-
{ legacyPath:
|
|
4668
|
-
{ legacyPath:
|
|
4669
|
-
{ legacyPath:
|
|
4670
|
-
{ legacyPath:
|
|
4675
|
+
{ legacyPath: join2(root, "chat-recall-cache.db"), newPath: join2(newRoot, "cache.db"), isDir: false },
|
|
4676
|
+
{ legacyPath: join2(root, "chat-recall-index"), newPath: join2(newRoot, "index"), isDir: true },
|
|
4677
|
+
{ legacyPath: join2(root, "chat-recall-memory"), newPath: join2(newRoot, "memory"), isDir: true },
|
|
4678
|
+
{ legacyPath: join2(root, "chat-recall-identity.txt"), newPath: join2(newRoot, "identity.txt"), isDir: false },
|
|
4679
|
+
{ legacyPath: join2(root, "chat-recall-hooks"), newPath: join2(newRoot, "hooks"), isDir: true },
|
|
4671
4680
|
// The legacy settings directory was named just "chat-recall" (no
|
|
4672
4681
|
// suffix) — odd choice. Move it to a clearer "settings" subdir.
|
|
4673
|
-
{ legacyPath:
|
|
4682
|
+
{ legacyPath: join2(root, "chat-recall"), newPath: join2(newRoot, "settings"), isDir: true },
|
|
4674
4683
|
// SQLite WAL/SHM siblings — must move with their main .db so they don't
|
|
4675
4684
|
// get re-created and stale-out the migrated cache.
|
|
4676
|
-
{ legacyPath:
|
|
4677
|
-
{ legacyPath:
|
|
4685
|
+
{ legacyPath: join2(root, "chat-recall-cache.db-wal"), newPath: join2(newRoot, "cache.db-wal"), isDir: false },
|
|
4686
|
+
{ legacyPath: join2(root, "chat-recall-cache.db-shm"), newPath: join2(newRoot, "cache.db-shm"), isDir: false }
|
|
4678
4687
|
];
|
|
4679
4688
|
}
|
|
4680
4689
|
function ensureMigrated() {
|
|
@@ -4720,8 +4729,8 @@ function ensureDir(p) {
|
|
|
4720
4729
|
function copyDir(src, dest) {
|
|
4721
4730
|
ensureDir(dest);
|
|
4722
4731
|
for (const entry of readdirSync(src)) {
|
|
4723
|
-
const srcPath =
|
|
4724
|
-
const destPath =
|
|
4732
|
+
const srcPath = join2(src, entry);
|
|
4733
|
+
const destPath = join2(dest, entry);
|
|
4725
4734
|
const st = statSync(srcPath);
|
|
4726
4735
|
if (st.isDirectory())
|
|
4727
4736
|
copyDir(srcPath, destPath);
|
|
@@ -4734,6 +4743,7 @@ var init_paths = __esm({
|
|
|
4734
4743
|
"../engine/dist/core/paths.js"() {
|
|
4735
4744
|
"use strict";
|
|
4736
4745
|
init_logger();
|
|
4746
|
+
init_data_dir();
|
|
4737
4747
|
log = createLogger("paths");
|
|
4738
4748
|
_migrationDone = false;
|
|
4739
4749
|
}
|
|
@@ -4742,7 +4752,7 @@ var init_paths = __esm({
|
|
|
4742
4752
|
// ../engine/dist/core/settings.js
|
|
4743
4753
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, writeFileSync, chmodSync, statSync as statSync2 } from "fs";
|
|
4744
4754
|
import { delimiter } from "path";
|
|
4745
|
-
import { dirname as dirname2, join as
|
|
4755
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
4746
4756
|
function whichSync(bin) {
|
|
4747
4757
|
const path = process.env.PATH;
|
|
4748
4758
|
if (!path)
|
|
@@ -4750,7 +4760,7 @@ function whichSync(bin) {
|
|
|
4750
4760
|
for (const dir of path.split(delimiter)) {
|
|
4751
4761
|
if (!dir)
|
|
4752
4762
|
continue;
|
|
4753
|
-
const full =
|
|
4763
|
+
const full = join3(dir, bin);
|
|
4754
4764
|
try {
|
|
4755
4765
|
const s = statSync2(full);
|
|
4756
4766
|
if (s.isFile())
|
|
@@ -4946,7 +4956,7 @@ function settingsFilePath() {
|
|
|
4946
4956
|
return settingsPath();
|
|
4947
4957
|
}
|
|
4948
4958
|
function settingsPath() {
|
|
4949
|
-
return
|
|
4959
|
+
return join3(getDataDir(), "settings", "settings.json");
|
|
4950
4960
|
}
|
|
4951
4961
|
function loadSourceSettings() {
|
|
4952
4962
|
let mtimeMs = -1;
|
|
@@ -4972,7 +4982,7 @@ function isSourceEnabled(tool, source) {
|
|
|
4972
4982
|
return block[source] !== false;
|
|
4973
4983
|
}
|
|
4974
4984
|
function secretsPath() {
|
|
4975
|
-
return
|
|
4985
|
+
return join3(getDataDir(), "secrets.env");
|
|
4976
4986
|
}
|
|
4977
4987
|
function loadSecrets() {
|
|
4978
4988
|
const out = {};
|
|
@@ -5133,10 +5143,10 @@ var init_settings = __esm({
|
|
|
5133
5143
|
|
|
5134
5144
|
// ../engine/dist/core/home-approval.js
|
|
5135
5145
|
import { existsSync as existsSync3, readdirSync as readdirSync2, realpathSync } from "fs";
|
|
5136
|
-
import { homedir as
|
|
5137
|
-
import { join as
|
|
5146
|
+
import { homedir as homedir3 } from "os";
|
|
5147
|
+
import { join as join4, dirname as dirname3 } from "path";
|
|
5138
5148
|
function normalizeHomePath(p) {
|
|
5139
|
-
const expanded = p.startsWith("~") ?
|
|
5149
|
+
const expanded = p.startsWith("~") ? join4(homedir3(), p.slice(1)) : p;
|
|
5140
5150
|
const trimmed = expanded.replace(/[/\\]+$/, "");
|
|
5141
5151
|
try {
|
|
5142
5152
|
return realpathSync(trimmed);
|
|
@@ -5145,22 +5155,22 @@ function normalizeHomePath(p) {
|
|
|
5145
5155
|
}
|
|
5146
5156
|
}
|
|
5147
5157
|
function legacyAutoSyncedHomes() {
|
|
5148
|
-
const home =
|
|
5158
|
+
const home = homedir3();
|
|
5149
5159
|
const out = [];
|
|
5150
5160
|
const add = (dir, marker) => {
|
|
5151
|
-
if (!existsSync3(
|
|
5161
|
+
if (!existsSync3(join4(dir, marker)))
|
|
5152
5162
|
return;
|
|
5153
5163
|
const n = normalizeHomePath(dir);
|
|
5154
5164
|
if (!out.includes(n))
|
|
5155
5165
|
out.push(n);
|
|
5156
5166
|
};
|
|
5157
5167
|
const bases = [
|
|
5158
|
-
{ base:
|
|
5159
|
-
{ base:
|
|
5160
|
-
{ base:
|
|
5161
|
-
{ base:
|
|
5162
|
-
{ base:
|
|
5163
|
-
{ base:
|
|
5168
|
+
{ base: join4(home, ".claude"), marker: "projects" },
|
|
5169
|
+
{ base: join4(home, ".gemini"), marker: "tmp" },
|
|
5170
|
+
{ base: join4(home, ".codex"), marker: "sessions" },
|
|
5171
|
+
{ base: join4(home, ".gemini", "antigravity-cli"), marker: "brain" },
|
|
5172
|
+
{ base: join4(home, ".local", "share", "opencode"), marker: "opencode.db" },
|
|
5173
|
+
{ base: join4(home, ".cursor"), marker: "chats" }
|
|
5164
5174
|
];
|
|
5165
5175
|
for (const { base: base3, marker } of bases) {
|
|
5166
5176
|
add(base3, marker);
|
|
@@ -5174,7 +5184,7 @@ function legacyAutoSyncedHomes() {
|
|
|
5174
5184
|
continue;
|
|
5175
5185
|
if (e.name === ".claude-code")
|
|
5176
5186
|
continue;
|
|
5177
|
-
add(
|
|
5187
|
+
add(join4(parent, e.name), marker);
|
|
5178
5188
|
}
|
|
5179
5189
|
} catch {
|
|
5180
5190
|
}
|
|
@@ -5209,17 +5219,17 @@ function grandfatherLegacyHomes() {
|
|
|
5209
5219
|
return { seeded };
|
|
5210
5220
|
}
|
|
5211
5221
|
function defaultPiHome() {
|
|
5212
|
-
return
|
|
5222
|
+
return join4(homedir3(), ".pi", "agent");
|
|
5213
5223
|
}
|
|
5214
5224
|
function defaultHermesHome() {
|
|
5215
5225
|
if (process.platform === "win32") {
|
|
5216
|
-
const local = process.env.LOCALAPPDATA?.trim() ||
|
|
5217
|
-
return
|
|
5226
|
+
const local = process.env.LOCALAPPDATA?.trim() || join4(homedir3(), "AppData", "Local");
|
|
5227
|
+
return join4(local, "hermes");
|
|
5218
5228
|
}
|
|
5219
|
-
return
|
|
5229
|
+
return join4(homedir3(), ".hermes");
|
|
5220
5230
|
}
|
|
5221
5231
|
function primaryHomes() {
|
|
5222
|
-
const home =
|
|
5232
|
+
const home = homedir3();
|
|
5223
5233
|
const env = process.env;
|
|
5224
5234
|
let s;
|
|
5225
5235
|
try {
|
|
@@ -5227,13 +5237,13 @@ function primaryHomes() {
|
|
|
5227
5237
|
} catch {
|
|
5228
5238
|
s = void 0;
|
|
5229
5239
|
}
|
|
5230
|
-
const opencodeDb = env.CHAT_RECALL_OPENCODE_DB || s?.opencodeDbPath ||
|
|
5240
|
+
const opencodeDb = env.CHAT_RECALL_OPENCODE_DB || s?.opencodeDbPath || join4(home, ".local", "share", "opencode", "opencode.db");
|
|
5231
5241
|
const candidates2 = [
|
|
5232
|
-
env.CHAT_RECALL_CLAUDE_HOME || s?.claudeHome ||
|
|
5233
|
-
env.CHAT_RECALL_GEMINI_HOME || s?.geminiHome ||
|
|
5234
|
-
env.CHAT_RECALL_CODEX_HOME || s?.codexHome ||
|
|
5235
|
-
env.CHAT_RECALL_AGY_HOME || s?.agyHome ||
|
|
5236
|
-
env.CHAT_RECALL_CURSOR_HOME || s?.cursorHome ||
|
|
5242
|
+
env.CHAT_RECALL_CLAUDE_HOME || s?.claudeHome || join4(home, ".claude"),
|
|
5243
|
+
env.CHAT_RECALL_GEMINI_HOME || s?.geminiHome || join4(home, ".gemini"),
|
|
5244
|
+
env.CHAT_RECALL_CODEX_HOME || s?.codexHome || join4(home, ".codex"),
|
|
5245
|
+
env.CHAT_RECALL_AGY_HOME || s?.agyHome || join4(home, ".gemini", "antigravity-cli"),
|
|
5246
|
+
env.CHAT_RECALL_CURSOR_HOME || s?.cursorHome || join4(home, ".cursor"),
|
|
5237
5247
|
dirOf(opencodeDb),
|
|
5238
5248
|
env.CHAT_RECALL_HERMES_HOME || s?.hermesHome || env.HERMES_HOME?.trim() || defaultHermesHome(),
|
|
5239
5249
|
env.CHAT_RECALL_PI_HOME || s?.piHome || env.PI_CODING_AGENT_DIR?.trim() || defaultPiHome()
|
|
@@ -5301,16 +5311,16 @@ var init_home_approval = __esm({
|
|
|
5301
5311
|
|
|
5302
5312
|
// ../engine/dist/core/tool-paths.js
|
|
5303
5313
|
import { existsSync as existsSync4, readdirSync as readdirSync3, readFileSync as readFileSync2, statSync as statSync3, realpathSync as realpathSync2 } from "fs";
|
|
5304
|
-
import { homedir as
|
|
5305
|
-
import { join as
|
|
5314
|
+
import { homedir as homedir4 } from "os";
|
|
5315
|
+
import { join as join5, dirname as dirname4, basename, isAbsolute } from "path";
|
|
5306
5316
|
function claudeHomeDir() {
|
|
5307
|
-
return process.env.CHAT_RECALL_CLAUDE_HOME || sources().claudeHome ||
|
|
5317
|
+
return process.env.CHAT_RECALL_CLAUDE_HOME || sources().claudeHome || join5(homedir4(), ".claude");
|
|
5308
5318
|
}
|
|
5309
5319
|
function claudeProjectDirs(opts = {}) {
|
|
5310
|
-
const home =
|
|
5320
|
+
const home = homedir4();
|
|
5311
5321
|
const dirs = [];
|
|
5312
5322
|
const addHome = (d) => {
|
|
5313
|
-
const p =
|
|
5323
|
+
const p = join5(d, "projects");
|
|
5314
5324
|
if (existsSync4(p) && !dirs.includes(p))
|
|
5315
5325
|
dirs.push(p);
|
|
5316
5326
|
};
|
|
@@ -5320,7 +5330,7 @@ function claudeProjectDirs(opts = {}) {
|
|
|
5320
5330
|
try {
|
|
5321
5331
|
for (const entry of readdirSync3(home, { withFileTypes: true })) {
|
|
5322
5332
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
5323
|
-
addHome(
|
|
5333
|
+
addHome(join5(home, entry.name));
|
|
5324
5334
|
}
|
|
5325
5335
|
}
|
|
5326
5336
|
} catch {
|
|
@@ -5330,47 +5340,47 @@ function claudeProjectDirs(opts = {}) {
|
|
|
5330
5340
|
for (const d of process.env.CLAUDE_DIRS.split(",")) {
|
|
5331
5341
|
const t = d.trim();
|
|
5332
5342
|
if (t)
|
|
5333
|
-
addHome(t.startsWith("~/") ?
|
|
5343
|
+
addHome(t.startsWith("~/") ? join5(home, t.slice(2)) : t);
|
|
5334
5344
|
}
|
|
5335
5345
|
}
|
|
5336
5346
|
if (dirs.length === 0)
|
|
5337
|
-
dirs.push(
|
|
5347
|
+
dirs.push(join5(claudeHomeDir(), "projects"));
|
|
5338
5348
|
return applyDecisions(dirs, opts.includeExcluded);
|
|
5339
5349
|
}
|
|
5340
5350
|
function _setSourceExclusionFilter(fn) {
|
|
5341
5351
|
_sourceExclusionFilter = fn;
|
|
5342
5352
|
}
|
|
5343
5353
|
function geminiHomeDir() {
|
|
5344
|
-
return process.env.CHAT_RECALL_GEMINI_HOME || sources().geminiHome ||
|
|
5354
|
+
return process.env.CHAT_RECALL_GEMINI_HOME || sources().geminiHome || join5(homedir4(), ".gemini");
|
|
5345
5355
|
}
|
|
5346
5356
|
function opencodeDbPath() {
|
|
5347
|
-
return process.env.CHAT_RECALL_OPENCODE_DB || sources().opencodeDbPath ||
|
|
5357
|
+
return process.env.CHAT_RECALL_OPENCODE_DB || sources().opencodeDbPath || join5(homedir4(), ".local", "share", "opencode", "opencode.db");
|
|
5348
5358
|
}
|
|
5349
5359
|
function hermesHomeDir() {
|
|
5350
5360
|
return process.env.CHAT_RECALL_HERMES_HOME || sources().hermesHome || process.env.HERMES_HOME?.trim() || defaultHermesHome();
|
|
5351
5361
|
}
|
|
5352
5362
|
function codexHomeDir() {
|
|
5353
|
-
return process.env.CHAT_RECALL_CODEX_HOME || sources().codexHome ||
|
|
5363
|
+
return process.env.CHAT_RECALL_CODEX_HOME || sources().codexHome || join5(homedir4(), ".codex");
|
|
5354
5364
|
}
|
|
5355
5365
|
function agyHomeDir() {
|
|
5356
|
-
return process.env.CHAT_RECALL_AGY_HOME || sources().agyHome ||
|
|
5366
|
+
return process.env.CHAT_RECALL_AGY_HOME || sources().agyHome || join5(homedir4(), ".gemini", "antigravity-cli");
|
|
5357
5367
|
}
|
|
5358
5368
|
function cursorHomeDir() {
|
|
5359
|
-
return process.env.CHAT_RECALL_CURSOR_HOME || sources().cursorHome ||
|
|
5369
|
+
return process.env.CHAT_RECALL_CURSOR_HOME || sources().cursorHome || join5(homedir4(), ".cursor");
|
|
5360
5370
|
}
|
|
5361
5371
|
function cursorIdeHomeDir() {
|
|
5362
|
-
return process.env.CHAT_RECALL_CURSOR_IDE_HOME || sources().cursorIdeHome || (process.platform === "darwin" ?
|
|
5372
|
+
return process.env.CHAT_RECALL_CURSOR_IDE_HOME || sources().cursorIdeHome || (process.platform === "darwin" ? join5(homedir4(), "Library", "Application Support", "Cursor") : join5(homedir4(), ".config", "Cursor"));
|
|
5363
5373
|
}
|
|
5364
5374
|
function piHomeDir() {
|
|
5365
5375
|
const raw = process.env.CHAT_RECALL_PI_HOME || sources().piHome || process.env.PI_CODING_AGENT_DIR?.trim();
|
|
5366
|
-
return raw ? expandTildePath(raw) :
|
|
5376
|
+
return raw ? expandTildePath(raw) : join5(homedir4(), ".pi", "agent");
|
|
5367
5377
|
}
|
|
5368
5378
|
function expandTildePath(value) {
|
|
5369
5379
|
const t = value.trim();
|
|
5370
5380
|
if (t === "~")
|
|
5371
|
-
return
|
|
5381
|
+
return homedir4();
|
|
5372
5382
|
if (t.startsWith("~/") || t.startsWith("~\\"))
|
|
5373
|
-
return
|
|
5383
|
+
return join5(homedir4(), t.slice(2));
|
|
5374
5384
|
return t;
|
|
5375
5385
|
}
|
|
5376
5386
|
function piSessionDir() {
|
|
@@ -5387,7 +5397,7 @@ function piSessionDirForHome(home) {
|
|
|
5387
5397
|
const env = piSessionDirEnv();
|
|
5388
5398
|
if (env && sameDir(home, piHomeDir()))
|
|
5389
5399
|
return env;
|
|
5390
|
-
return piSessionDirFromSettings(
|
|
5400
|
+
return piSessionDirFromSettings(join5(home, "settings.json")) || join5(home, "sessions");
|
|
5391
5401
|
}
|
|
5392
5402
|
function sameDir(a, b) {
|
|
5393
5403
|
if (a === b)
|
|
@@ -5445,18 +5455,18 @@ function piSessionDirs(opts = {}) {
|
|
|
5445
5455
|
return [dir];
|
|
5446
5456
|
}
|
|
5447
5457
|
function piSkillsDir() {
|
|
5448
|
-
return
|
|
5458
|
+
return join5(piHomeDir(), "skills");
|
|
5449
5459
|
}
|
|
5450
5460
|
function piPromptsDir() {
|
|
5451
|
-
return
|
|
5461
|
+
return join5(piHomeDir(), "prompts");
|
|
5452
5462
|
}
|
|
5453
5463
|
function piMcpConfigPath() {
|
|
5454
|
-
return
|
|
5464
|
+
return join5(piHomeDir(), "mcp.json");
|
|
5455
5465
|
}
|
|
5456
5466
|
function siblingHomes(base3, overridden, suffix) {
|
|
5457
5467
|
const roots = [];
|
|
5458
5468
|
const add = (home) => {
|
|
5459
|
-
const root = suffix ?
|
|
5469
|
+
const root = suffix ? join5(home, suffix) : home;
|
|
5460
5470
|
if (existsSync4(root) && !roots.includes(root))
|
|
5461
5471
|
roots.push(root);
|
|
5462
5472
|
};
|
|
@@ -5470,7 +5480,7 @@ function siblingHomes(base3, overridden, suffix) {
|
|
|
5470
5480
|
continue;
|
|
5471
5481
|
if (entry.name === leaf || !entry.name.startsWith(leaf + "-"))
|
|
5472
5482
|
continue;
|
|
5473
|
-
add(
|
|
5483
|
+
add(join5(parent, entry.name));
|
|
5474
5484
|
}
|
|
5475
5485
|
} catch {
|
|
5476
5486
|
}
|
|
@@ -5514,14 +5524,14 @@ function cursorChatDirs(opts = {}) {
|
|
|
5514
5524
|
}
|
|
5515
5525
|
function cursorIdeWorkspaceDirs(opts = {}) {
|
|
5516
5526
|
const overridden = !!(process.env.CHAT_RECALL_CURSOR_IDE_HOME || sources().cursorIdeHome);
|
|
5517
|
-
return applyExclusions(siblingHomes(cursorIdeHomeDir(), overridden,
|
|
5527
|
+
return applyExclusions(siblingHomes(cursorIdeHomeDir(), overridden, join5("User", "workspaceStorage")), opts.includeExcluded);
|
|
5518
5528
|
}
|
|
5519
5529
|
function cursorIdeGlobalDbs(opts = {}) {
|
|
5520
5530
|
const overridden = !!(process.env.CHAT_RECALL_CURSOR_IDE_HOME || sources().cursorIdeHome);
|
|
5521
|
-
const roots = applyExclusions(siblingHomes(cursorIdeHomeDir(), overridden,
|
|
5531
|
+
const roots = applyExclusions(siblingHomes(cursorIdeHomeDir(), overridden, join5("User", "globalStorage")), opts.includeExcluded);
|
|
5522
5532
|
const dbs = [];
|
|
5523
5533
|
for (const r of roots) {
|
|
5524
|
-
const p =
|
|
5534
|
+
const p = join5(r, "state.vscdb");
|
|
5525
5535
|
if (existsSync4(p) && !dbs.includes(p))
|
|
5526
5536
|
dbs.push(p);
|
|
5527
5537
|
}
|
|
@@ -5534,7 +5544,7 @@ function opencodeDbPaths(opts = {}) {
|
|
|
5534
5544
|
const dirs = siblingHomes(dirname4(primary), overridden, "");
|
|
5535
5545
|
const dbs = [];
|
|
5536
5546
|
for (const d of dirs) {
|
|
5537
|
-
const p =
|
|
5547
|
+
const p = join5(d, dbFile);
|
|
5538
5548
|
if (existsSync4(p) && !dbs.includes(p))
|
|
5539
5549
|
dbs.push(p);
|
|
5540
5550
|
}
|
|
@@ -5544,13 +5554,13 @@ function opencodeDbPaths(opts = {}) {
|
|
|
5544
5554
|
}
|
|
5545
5555
|
function hermesDbPaths(opts = {}) {
|
|
5546
5556
|
const root = hermesHomeDir();
|
|
5547
|
-
const dbs = [
|
|
5557
|
+
const dbs = [join5(root, "state.db")];
|
|
5548
5558
|
try {
|
|
5549
|
-
const profiles =
|
|
5559
|
+
const profiles = join5(root, "profiles");
|
|
5550
5560
|
for (const entry of readdirSync3(profiles, { withFileTypes: true })) {
|
|
5551
5561
|
if (!entry.isDirectory())
|
|
5552
5562
|
continue;
|
|
5553
|
-
const p =
|
|
5563
|
+
const p = join5(profiles, entry.name, "state.db");
|
|
5554
5564
|
if (existsSync4(p))
|
|
5555
5565
|
dbs.push(p);
|
|
5556
5566
|
}
|
|
@@ -5801,7 +5811,7 @@ var init_model_pricing = __esm({
|
|
|
5801
5811
|
// ../engine/dist/parsers/session.js
|
|
5802
5812
|
import { createReadStream, existsSync as existsSync5, readdirSync as readdirSync5, readFileSync as readFileSync3, statSync as statSync4, openSync, readSync, closeSync } from "fs";
|
|
5803
5813
|
import { createInterface } from "readline";
|
|
5804
|
-
import { join as
|
|
5814
|
+
import { join as join6, basename as basename2 } from "path";
|
|
5805
5815
|
function removeCodeBlocks(text) {
|
|
5806
5816
|
let result = text.replace(/```[\s\S]*?```/g, "[code block]");
|
|
5807
5817
|
result = result.replace(/`[^`]+`/g, "[code]");
|
|
@@ -5848,13 +5858,13 @@ function isValuableToolResult(content, toolName = "") {
|
|
|
5848
5858
|
}
|
|
5849
5859
|
function hasSubagentsDir(sessionPath) {
|
|
5850
5860
|
const dir = sessionPath.slice(0, -6);
|
|
5851
|
-
return existsSync5(
|
|
5861
|
+
return existsSync5(join6(dir, "subagents"));
|
|
5852
5862
|
}
|
|
5853
5863
|
function getSubagentPaths(sessionPath) {
|
|
5854
|
-
const subagentsDir =
|
|
5864
|
+
const subagentsDir = join6(sessionPath.slice(0, -6), "subagents");
|
|
5855
5865
|
if (!existsSync5(subagentsDir))
|
|
5856
5866
|
return [];
|
|
5857
|
-
return readdirSync5(subagentsDir).filter((f) => f.endsWith(".jsonl")).sort().map((f) =>
|
|
5867
|
+
return readdirSync5(subagentsDir).filter((f) => f.endsWith(".jsonl")).sort().map((f) => join6(subagentsDir, f));
|
|
5858
5868
|
}
|
|
5859
5869
|
function readCwdFromJsonl(sessionPath) {
|
|
5860
5870
|
try {
|
|
@@ -6146,7 +6156,7 @@ var init_session = __esm({
|
|
|
6146
6156
|
|
|
6147
6157
|
// ../engine/dist/transcript/claude.js
|
|
6148
6158
|
import { open, readdir, readFile, stat } from "fs/promises";
|
|
6149
|
-
import { dirname as dirname5, join as
|
|
6159
|
+
import { dirname as dirname5, join as join7, basename as basename3 } from "path";
|
|
6150
6160
|
function stripBanners(text) {
|
|
6151
6161
|
let out = text;
|
|
6152
6162
|
for (const re of INJECTED_BANNERS2)
|
|
@@ -6275,7 +6285,7 @@ function messagesFromRawLines(raw) {
|
|
|
6275
6285
|
}
|
|
6276
6286
|
async function parseClaudeSubagents(sessionPath) {
|
|
6277
6287
|
const sessionId = basename3(sessionPath).replace(/\.jsonl$/i, "");
|
|
6278
|
-
const subagentsDir =
|
|
6288
|
+
const subagentsDir = join7(dirname5(sessionPath), sessionId, "subagents");
|
|
6279
6289
|
let entries;
|
|
6280
6290
|
try {
|
|
6281
6291
|
entries = await readdir(subagentsDir);
|
|
@@ -6285,12 +6295,12 @@ async function parseClaudeSubagents(sessionPath) {
|
|
|
6285
6295
|
const jsonlFiles = entries.filter((e) => e.endsWith(".jsonl"));
|
|
6286
6296
|
const subagents = [];
|
|
6287
6297
|
for (const fileName of jsonlFiles) {
|
|
6288
|
-
const filePath =
|
|
6298
|
+
const filePath = join7(subagentsDir, fileName);
|
|
6289
6299
|
const id = fileName.replace(/\.jsonl$/i, "");
|
|
6290
6300
|
const kind = id.includes("acompact") ? "compact" : id.includes("aside_question") ? "aside" : id.includes("explore") || /^agent-a[0-9a-f]{16,}$/i.test(id) ? "explore" : "other";
|
|
6291
6301
|
let agentType;
|
|
6292
6302
|
let description;
|
|
6293
|
-
const metaPath =
|
|
6303
|
+
const metaPath = join7(subagentsDir, `${id}.meta.json`);
|
|
6294
6304
|
try {
|
|
6295
6305
|
const metaRaw = await readFile(metaPath, "utf-8");
|
|
6296
6306
|
const meta = JSON.parse(metaRaw);
|
|
@@ -6354,7 +6364,7 @@ var init_claude = __esm({
|
|
|
6354
6364
|
|
|
6355
6365
|
// ../engine/dist/transcript/codex.js
|
|
6356
6366
|
import { open as open2, readdir as readdir2, stat as stat2 } from "fs/promises";
|
|
6357
|
-
import { dirname as dirname6, join as
|
|
6367
|
+
import { dirname as dirname6, join as join8, basename as basename4 } from "path";
|
|
6358
6368
|
async function parseCodexSubagents(sessionPath) {
|
|
6359
6369
|
const dayDir = dirname6(sessionPath);
|
|
6360
6370
|
const parentId = basename4(sessionPath).match(/([a-f0-9-]{36})\.jsonl$/i)?.[1];
|
|
@@ -6370,7 +6380,7 @@ async function parseCodexSubagents(sessionPath) {
|
|
|
6370
6380
|
for (const fileName of entries) {
|
|
6371
6381
|
if (!fileName.endsWith(".jsonl") || !fileName.startsWith("rollout-"))
|
|
6372
6382
|
continue;
|
|
6373
|
-
const filePath =
|
|
6383
|
+
const filePath = join8(dayDir, fileName);
|
|
6374
6384
|
if (filePath === sessionPath)
|
|
6375
6385
|
continue;
|
|
6376
6386
|
let firstLine = "";
|
|
@@ -6955,7 +6965,7 @@ async function archiveRawSession(store, sessionId) {
|
|
|
6955
6965
|
}
|
|
6956
6966
|
function detectForkPredecessor(sessionPath) {
|
|
6957
6967
|
const { readFileSync: readFileSync50, readdirSync: readdirSync35 } = requireFs();
|
|
6958
|
-
const { dirname: dirname26, join:
|
|
6968
|
+
const { dirname: dirname26, join: join59, basename: basename28 } = requirePath();
|
|
6959
6969
|
let text;
|
|
6960
6970
|
try {
|
|
6961
6971
|
text = readFileSync50(sessionPath, "utf-8");
|
|
@@ -6992,7 +7002,7 @@ function detectForkPredecessor(sessionPath) {
|
|
|
6992
7002
|
if (!f.endsWith(".jsonl") || f === self || f === "sessions-index.json")
|
|
6993
7003
|
continue;
|
|
6994
7004
|
try {
|
|
6995
|
-
if (readFileSync50(
|
|
7005
|
+
if (readFileSync50(join59(dir, f), "utf-8").includes(`"uuid":"${headParent}"`)) {
|
|
6996
7006
|
return basename28(f, ".jsonl");
|
|
6997
7007
|
}
|
|
6998
7008
|
} catch {
|
|
@@ -7027,13 +7037,13 @@ var init_raw = __esm({
|
|
|
7027
7037
|
import { gzipSync as gzipSync2, gunzipSync as gunzipSync2 } from "zlib";
|
|
7028
7038
|
import { createHash as createHash2 } from "crypto";
|
|
7029
7039
|
import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync2, renameSync as renameSync2, statSync as statSync5, openSync as openSync2, readSync as readSync2, closeSync as closeSync2 } from "fs";
|
|
7030
|
-
import { dirname as dirname7, join as
|
|
7040
|
+
import { dirname as dirname7, join as join9 } from "path";
|
|
7031
7041
|
function shadowRoot() {
|
|
7032
|
-
return
|
|
7042
|
+
return join9(getDataDir(), "shadow");
|
|
7033
7043
|
}
|
|
7034
7044
|
function shadowFileFor(tool, rawId) {
|
|
7035
7045
|
const safe = rawId.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
7036
|
-
return
|
|
7046
|
+
return join9(shadowRoot(), tool, `${safe}.gz`);
|
|
7037
7047
|
}
|
|
7038
7048
|
function readShadowContainer(tool, rawId) {
|
|
7039
7049
|
const path = shadowFileFor(tool, rawId);
|
|
@@ -7296,7 +7306,7 @@ var init_shadow = __esm({
|
|
|
7296
7306
|
|
|
7297
7307
|
// ../engine/dist/core/live-session-scan.js
|
|
7298
7308
|
import { existsSync as existsSync7, readdirSync as readdirSync6, readFileSync as readFileSync5, statSync as statSync6, openSync as openSync3, readSync as readSync3, closeSync as closeSync3 } from "fs";
|
|
7299
|
-
import { join as
|
|
7309
|
+
import { join as join10, basename as basename5 } from "path";
|
|
7300
7310
|
function detectTool(sessionId) {
|
|
7301
7311
|
return getBackendForId(sessionId)?.id ?? "claude";
|
|
7302
7312
|
}
|
|
@@ -7365,7 +7375,7 @@ function sessionFileIndex() {
|
|
|
7365
7375
|
for (const entry of entries) {
|
|
7366
7376
|
if (!entry.isDirectory())
|
|
7367
7377
|
continue;
|
|
7368
|
-
const dir =
|
|
7378
|
+
const dir = join10(root, entry.name);
|
|
7369
7379
|
dirs.set(dir, dirMtime(dir));
|
|
7370
7380
|
let names;
|
|
7371
7381
|
try {
|
|
@@ -7378,7 +7388,7 @@ function sessionFileIndex() {
|
|
|
7378
7388
|
continue;
|
|
7379
7389
|
const id = name.slice(0, -".jsonl".length);
|
|
7380
7390
|
const located = {
|
|
7381
|
-
path:
|
|
7391
|
+
path: join10(dir, name),
|
|
7382
7392
|
projectDir: entry.name,
|
|
7383
7393
|
projectPath: projectPathOf(entry.name)
|
|
7384
7394
|
};
|
|
@@ -7477,10 +7487,10 @@ function readSessionGroupText(group) {
|
|
|
7477
7487
|
function resolveSessionContentPaths(sessionFile) {
|
|
7478
7488
|
if (!hasSubagentsDir(sessionFile))
|
|
7479
7489
|
return [sessionFile];
|
|
7480
|
-
const subDir =
|
|
7490
|
+
const subDir = join10(sessionFile.slice(0, -6), "subagents");
|
|
7481
7491
|
if (!existsSync7(subDir))
|
|
7482
7492
|
return [sessionFile];
|
|
7483
|
-
const subPaths = readdirSync6(subDir).filter((f) => f.endsWith(".jsonl")).sort().map((f) =>
|
|
7493
|
+
const subPaths = readdirSync6(subDir).filter((f) => f.endsWith(".jsonl")).sort().map((f) => join10(subDir, f));
|
|
7484
7494
|
return [sessionFile, ...subPaths];
|
|
7485
7495
|
}
|
|
7486
7496
|
function invalidateGeminiSessionIndex() {
|
|
@@ -7500,15 +7510,15 @@ function findCodexSessionFileIn(root, sessionId) {
|
|
|
7500
7510
|
for (const year of readdirSync6(root, { withFileTypes: true })) {
|
|
7501
7511
|
if (!year.isDirectory())
|
|
7502
7512
|
continue;
|
|
7503
|
-
const yearPath =
|
|
7513
|
+
const yearPath = join10(root, year.name);
|
|
7504
7514
|
for (const month of readdirSync6(yearPath, { withFileTypes: true })) {
|
|
7505
7515
|
if (!month.isDirectory())
|
|
7506
7516
|
continue;
|
|
7507
|
-
const monthPath =
|
|
7517
|
+
const monthPath = join10(yearPath, month.name);
|
|
7508
7518
|
for (const day of readdirSync6(monthPath, { withFileTypes: true })) {
|
|
7509
7519
|
if (!day.isDirectory())
|
|
7510
7520
|
continue;
|
|
7511
|
-
const dayPath =
|
|
7521
|
+
const dayPath = join10(monthPath, day.name);
|
|
7512
7522
|
let files;
|
|
7513
7523
|
try {
|
|
7514
7524
|
files = readdirSync6(dayPath);
|
|
@@ -7519,7 +7529,7 @@ function findCodexSessionFileIn(root, sessionId) {
|
|
|
7519
7529
|
if (!f.endsWith(".jsonl"))
|
|
7520
7530
|
continue;
|
|
7521
7531
|
if (f.includes(sessionId)) {
|
|
7522
|
-
return { path:
|
|
7532
|
+
return { path: join10(dayPath, f), projectPath: "" };
|
|
7523
7533
|
}
|
|
7524
7534
|
}
|
|
7525
7535
|
}
|
|
@@ -7528,11 +7538,11 @@ function findCodexSessionFileIn(root, sessionId) {
|
|
|
7528
7538
|
function scanDir(dir) {
|
|
7529
7539
|
for (const entry of readdirSync6(dir, { withFileTypes: true })) {
|
|
7530
7540
|
if (entry.isDirectory()) {
|
|
7531
|
-
const found = scanDir(
|
|
7541
|
+
const found = scanDir(join10(dir, entry.name));
|
|
7532
7542
|
if (found)
|
|
7533
7543
|
return found;
|
|
7534
7544
|
} else if (entry.name.endsWith(".jsonl")) {
|
|
7535
|
-
const p =
|
|
7545
|
+
const p = join10(dir, entry.name);
|
|
7536
7546
|
try {
|
|
7537
7547
|
const first = readFileSync5(p, "utf-8").split("\n")[0];
|
|
7538
7548
|
if (!first)
|
|
@@ -8658,7 +8668,7 @@ var init_generic_engine = __esm({
|
|
|
8658
8668
|
|
|
8659
8669
|
// ../engine/dist/core/backends/claude.js
|
|
8660
8670
|
import { existsSync as existsSync10, readdirSync as readdirSync7, readFileSync as readFileSync6, statSync as statSync8, openSync as openSync6, readSync as readSync6, closeSync as closeSync6 } from "fs";
|
|
8661
|
-
import { join as
|
|
8671
|
+
import { join as join11, basename as basename8 } from "path";
|
|
8662
8672
|
function stripReminders(text) {
|
|
8663
8673
|
return text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "").trim();
|
|
8664
8674
|
}
|
|
@@ -8690,41 +8700,41 @@ var init_claude2 = __esm({
|
|
|
8690
8700
|
}
|
|
8691
8701
|
// ── Subpath helpers used by the parser/source layer ─────────────
|
|
8692
8702
|
projectsDir() {
|
|
8693
|
-
return
|
|
8703
|
+
return join11(this.homeDir(), "projects");
|
|
8694
8704
|
}
|
|
8695
8705
|
plansDir() {
|
|
8696
|
-
return
|
|
8706
|
+
return join11(this.homeDir(), "plans");
|
|
8697
8707
|
}
|
|
8698
8708
|
todosDir() {
|
|
8699
|
-
return
|
|
8709
|
+
return join11(this.homeDir(), "todos");
|
|
8700
8710
|
}
|
|
8701
8711
|
/** Legacy task-list directory still used by older Claude Code releases. */
|
|
8702
8712
|
tasksDir() {
|
|
8703
|
-
return
|
|
8713
|
+
return join11(this.homeDir(), "tasks");
|
|
8704
8714
|
}
|
|
8705
8715
|
pasteCacheDir() {
|
|
8706
|
-
return
|
|
8716
|
+
return join11(this.homeDir(), "paste-cache");
|
|
8707
8717
|
}
|
|
8708
8718
|
skillsDir() {
|
|
8709
|
-
return
|
|
8719
|
+
return join11(this.homeDir(), "skills");
|
|
8710
8720
|
}
|
|
8711
8721
|
agentsDir() {
|
|
8712
|
-
return
|
|
8722
|
+
return join11(this.homeDir(), "agents");
|
|
8713
8723
|
}
|
|
8714
8724
|
commandsDir() {
|
|
8715
|
-
return
|
|
8725
|
+
return join11(this.homeDir(), "commands");
|
|
8716
8726
|
}
|
|
8717
8727
|
pluginsManifestPath() {
|
|
8718
|
-
return
|
|
8728
|
+
return join11(this.homeDir(), "plugins", "installed_plugins.json");
|
|
8719
8729
|
}
|
|
8720
8730
|
hooksFile() {
|
|
8721
|
-
return
|
|
8731
|
+
return join11(this.homeDir(), "hooks.json");
|
|
8722
8732
|
}
|
|
8723
8733
|
settingsFile() {
|
|
8724
|
-
return
|
|
8734
|
+
return join11(this.homeDir(), "settings.json");
|
|
8725
8735
|
}
|
|
8726
8736
|
historyFile() {
|
|
8727
|
-
return
|
|
8737
|
+
return join11(this.homeDir(), "history.jsonl");
|
|
8728
8738
|
}
|
|
8729
8739
|
isAvailable() {
|
|
8730
8740
|
return existsSync10(this.projectsDir());
|
|
@@ -8840,9 +8850,9 @@ var init_claude2 = __esm({
|
|
|
8840
8850
|
continue;
|
|
8841
8851
|
if (filter && !proj.name.toLowerCase().includes(filter))
|
|
8842
8852
|
continue;
|
|
8843
|
-
const projPath =
|
|
8853
|
+
const projPath = join11(root, proj.name);
|
|
8844
8854
|
const projectPath = resolveProjectDirName(proj.name);
|
|
8845
|
-
const indexPath =
|
|
8855
|
+
const indexPath = join11(projPath, "sessions-index.json");
|
|
8846
8856
|
const indexed = /* @__PURE__ */ new Set();
|
|
8847
8857
|
if (existsSync10(indexPath)) {
|
|
8848
8858
|
try {
|
|
@@ -8881,7 +8891,7 @@ var init_claude2 = __esm({
|
|
|
8881
8891
|
const sessionId = basename8(f, ".jsonl");
|
|
8882
8892
|
if (indexed.has(sessionId))
|
|
8883
8893
|
continue;
|
|
8884
|
-
const fullPath =
|
|
8894
|
+
const fullPath = join11(projPath, f);
|
|
8885
8895
|
let stat3;
|
|
8886
8896
|
try {
|
|
8887
8897
|
stat3 = statSync8(fullPath);
|
|
@@ -9181,7 +9191,7 @@ var init_claude2 = __esm({
|
|
|
9181
9191
|
continue;
|
|
9182
9192
|
if (opts.projectFilter && !projEntry.name.toLowerCase().includes(opts.projectFilter.toLowerCase()))
|
|
9183
9193
|
continue;
|
|
9184
|
-
const projPath =
|
|
9194
|
+
const projPath = join11(root, projEntry.name);
|
|
9185
9195
|
let files;
|
|
9186
9196
|
try {
|
|
9187
9197
|
files = readdirSync7(projPath);
|
|
@@ -9191,15 +9201,15 @@ var init_claude2 = __esm({
|
|
|
9191
9201
|
for (const f of files) {
|
|
9192
9202
|
if (!f.endsWith(".jsonl") || f === "sessions-index.json")
|
|
9193
9203
|
continue;
|
|
9194
|
-
const fp =
|
|
9204
|
+
const fp = join11(projPath, f);
|
|
9195
9205
|
try {
|
|
9196
9206
|
const st = statSync8(fp);
|
|
9197
9207
|
let mtime = st.mtimeMs;
|
|
9198
|
-
const subDir =
|
|
9208
|
+
const subDir = join11(projPath, f.slice(0, -6), "subagents");
|
|
9199
9209
|
if (existsSync10(subDir)) {
|
|
9200
9210
|
for (const sub of readdirSync7(subDir)) {
|
|
9201
9211
|
try {
|
|
9202
|
-
const subSt = statSync8(
|
|
9212
|
+
const subSt = statSync8(join11(subDir, sub));
|
|
9203
9213
|
if (subSt.mtimeMs > mtime)
|
|
9204
9214
|
mtime = subSt.mtimeMs;
|
|
9205
9215
|
} catch {
|
|
@@ -9369,8 +9379,8 @@ __export(opencode_exports, {
|
|
|
9369
9379
|
opencodeBackend: () => opencodeBackend
|
|
9370
9380
|
});
|
|
9371
9381
|
import { existsSync as existsSync11 } from "fs";
|
|
9372
|
-
import { homedir as
|
|
9373
|
-
import { dirname as dirname9, join as
|
|
9382
|
+
import { homedir as homedir5 } from "os";
|
|
9383
|
+
import { dirname as dirname9, join as join12 } from "path";
|
|
9374
9384
|
function openReadonly(path) {
|
|
9375
9385
|
return openSqliteReadonly(path);
|
|
9376
9386
|
}
|
|
@@ -9401,11 +9411,11 @@ var init_opencode = __esm({
|
|
|
9401
9411
|
}
|
|
9402
9412
|
// ── Subpath helpers ────────────────────────────────────────────
|
|
9403
9413
|
plansDir() {
|
|
9404
|
-
return
|
|
9414
|
+
return join12(this.homeDir(), "plans");
|
|
9405
9415
|
}
|
|
9406
9416
|
/** Root that holds OpenCode's global config dir (~/.config/opencode). */
|
|
9407
9417
|
configRoot() {
|
|
9408
|
-
return
|
|
9418
|
+
return join12(process.env.HOME || homedir5(), ".config", "opencode");
|
|
9409
9419
|
}
|
|
9410
9420
|
/**
|
|
9411
9421
|
* Canonical OpenCode skills location. The current docs use the plural
|
|
@@ -9414,15 +9424,15 @@ var init_opencode = __esm({
|
|
|
9414
9424
|
* plural canonical dir for "promote skill to OpenCode" actions.
|
|
9415
9425
|
*/
|
|
9416
9426
|
skillsDir() {
|
|
9417
|
-
return
|
|
9427
|
+
return join12(this.configRoot(), "skills");
|
|
9418
9428
|
}
|
|
9419
9429
|
/** Custom slash commands — markdown with frontmatter, plural canonical dir. */
|
|
9420
9430
|
commandsDir() {
|
|
9421
|
-
return
|
|
9431
|
+
return join12(this.configRoot(), "commands");
|
|
9422
9432
|
}
|
|
9423
9433
|
/** Agent/subagent definitions — markdown with frontmatter. */
|
|
9424
9434
|
agentsDir() {
|
|
9425
|
-
return
|
|
9435
|
+
return join12(this.configRoot(), "agents");
|
|
9426
9436
|
}
|
|
9427
9437
|
/** Every configured OpenCode database, primary first. Unlike the other tools
|
|
9428
9438
|
* OpenCode stores sessions in a FILE, so a second profile means a second db
|
|
@@ -9920,7 +9930,7 @@ var init_opencode = __esm({
|
|
|
9920
9930
|
|
|
9921
9931
|
// ../engine/dist/core/backends/codex.js
|
|
9922
9932
|
import { readdirSync as readdirSync8, readFileSync as readFileSync7, statSync as statSync9, openSync as openSync7, readSync as readSync7, closeSync as closeSync7 } from "fs";
|
|
9923
|
-
import { basename as basename9, dirname as dirname10, join as
|
|
9933
|
+
import { basename as basename9, dirname as dirname10, join as join13 } from "path";
|
|
9924
9934
|
function parseShellWrites(cmd) {
|
|
9925
9935
|
const out = [];
|
|
9926
9936
|
const firstLine = cmd.split("\n", 1)[0].trim();
|
|
@@ -10020,7 +10030,7 @@ function* walkRollouts(root) {
|
|
|
10020
10030
|
return;
|
|
10021
10031
|
}
|
|
10022
10032
|
for (const e of entries) {
|
|
10023
|
-
const full =
|
|
10033
|
+
const full = join13(root, e.name);
|
|
10024
10034
|
if (e.isDirectory()) {
|
|
10025
10035
|
yield* walkRollouts(full);
|
|
10026
10036
|
} else if (e.isFile() && e.name.startsWith("rollout-") && e.name.endsWith(".jsonl")) {
|
|
@@ -10077,10 +10087,10 @@ var init_codex2 = __esm({
|
|
|
10077
10087
|
}
|
|
10078
10088
|
// ── Subpath helpers ────────────────────────────────────────────
|
|
10079
10089
|
sessionsDir() {
|
|
10080
|
-
return
|
|
10090
|
+
return join13(this.homeDir(), "sessions");
|
|
10081
10091
|
}
|
|
10082
10092
|
configToml() {
|
|
10083
|
-
return
|
|
10093
|
+
return join13(this.homeDir(), "config.toml");
|
|
10084
10094
|
}
|
|
10085
10095
|
/**
|
|
10086
10096
|
* Plugins that are INSTALLED, one folder each:
|
|
@@ -10093,7 +10103,7 @@ var init_codex2 = __esm({
|
|
|
10093
10103
|
* reached a Linux PC that never installed the plugin.
|
|
10094
10104
|
*/
|
|
10095
10105
|
installedPluginDirs() {
|
|
10096
|
-
const cache4 =
|
|
10106
|
+
const cache4 = join13(this.homeDir(), "plugins", "cache");
|
|
10097
10107
|
const out = [];
|
|
10098
10108
|
const dirs = (p) => {
|
|
10099
10109
|
try {
|
|
@@ -10103,30 +10113,30 @@ var init_codex2 = __esm({
|
|
|
10103
10113
|
}
|
|
10104
10114
|
};
|
|
10105
10115
|
for (const market of dirs(cache4)) {
|
|
10106
|
-
for (const plugin of dirs(
|
|
10107
|
-
const versions = dirs(
|
|
10116
|
+
for (const plugin of dirs(join13(cache4, market))) {
|
|
10117
|
+
const versions = dirs(join13(cache4, market, plugin)).sort((a, b) => a.localeCompare(b, void 0, { numeric: true }));
|
|
10108
10118
|
const newest = versions[versions.length - 1];
|
|
10109
10119
|
if (newest)
|
|
10110
|
-
out.push({ name: plugin, dir:
|
|
10120
|
+
out.push({ name: plugin, dir: join13(cache4, market, plugin, newest) });
|
|
10111
10121
|
}
|
|
10112
10122
|
}
|
|
10113
10123
|
return out;
|
|
10114
10124
|
}
|
|
10115
10125
|
/** OpenAI-bundled, read-only system skills (imagegen, skill-creator, …). */
|
|
10116
10126
|
skillsSystemDir() {
|
|
10117
|
-
return
|
|
10127
|
+
return join13(this.homeDir(), "skills", ".system");
|
|
10118
10128
|
}
|
|
10119
10129
|
/** User skills root. Direct children (excluding `.system`) are user-authored. */
|
|
10120
10130
|
skillsDir() {
|
|
10121
|
-
return
|
|
10131
|
+
return join13(this.homeDir(), "skills");
|
|
10122
10132
|
}
|
|
10123
10133
|
/** Custom prompts (deprecated upstream in favor of skills) — flat *.md. */
|
|
10124
10134
|
promptsDir() {
|
|
10125
|
-
return
|
|
10135
|
+
return join13(this.homeDir(), "prompts");
|
|
10126
10136
|
}
|
|
10127
10137
|
/** Subagent definitions — one TOML file per agent. */
|
|
10128
10138
|
agentsDir() {
|
|
10129
|
-
return
|
|
10139
|
+
return join13(this.homeDir(), "agents");
|
|
10130
10140
|
}
|
|
10131
10141
|
/** Any configured home having a sessions/ tree makes Codex available — a
|
|
10132
10142
|
* machine whose only Codex profile is a secondary one still counts. */
|
|
@@ -10527,12 +10537,12 @@ var init_codex2 = __esm({
|
|
|
10527
10537
|
}
|
|
10528
10538
|
for (const entry of entries) {
|
|
10529
10539
|
if (entry.isDirectory()) {
|
|
10530
|
-
scanDir(
|
|
10540
|
+
scanDir(join13(dir, entry.name));
|
|
10531
10541
|
continue;
|
|
10532
10542
|
}
|
|
10533
10543
|
if (!entry.name.endsWith(".jsonl"))
|
|
10534
10544
|
continue;
|
|
10535
|
-
const p =
|
|
10545
|
+
const p = join13(dir, entry.name);
|
|
10536
10546
|
let st;
|
|
10537
10547
|
try {
|
|
10538
10548
|
st = statSync9(p);
|
|
@@ -10617,7 +10627,7 @@ var init_codex2 = __esm({
|
|
|
10617
10627
|
for (const f of readdirSync8(dayDir)) {
|
|
10618
10628
|
if (!f.endsWith(".jsonl") || !f.startsWith("rollout-"))
|
|
10619
10629
|
continue;
|
|
10620
|
-
const p =
|
|
10630
|
+
const p = join13(dayDir, f);
|
|
10621
10631
|
if (p === loc.path)
|
|
10622
10632
|
continue;
|
|
10623
10633
|
try {
|
|
@@ -10662,12 +10672,12 @@ var init_codex2 = __esm({
|
|
|
10662
10672
|
|
|
10663
10673
|
// ../engine/dist/core/backends/agy.js
|
|
10664
10674
|
import { existsSync as existsSync12, readdirSync as readdirSync9, readFileSync as readFileSync8, statSync as statSync10 } from "fs";
|
|
10665
|
-
import { basename as basename10, dirname as dirname11, join as
|
|
10675
|
+
import { basename as basename10, dirname as dirname11, join as join14 } from "path";
|
|
10666
10676
|
function agyTranscriptPath(logsDir) {
|
|
10667
|
-
const full =
|
|
10677
|
+
const full = join14(logsDir, "transcript_full.jsonl");
|
|
10668
10678
|
if (existsSync12(full))
|
|
10669
10679
|
return full;
|
|
10670
|
-
const primary =
|
|
10680
|
+
const primary = join14(logsDir, "transcript.jsonl");
|
|
10671
10681
|
if (existsSync12(primary))
|
|
10672
10682
|
return primary;
|
|
10673
10683
|
return "";
|
|
@@ -10799,27 +10809,31 @@ var init_agy = __esm({
|
|
|
10799
10809
|
return geminiHomeDir();
|
|
10800
10810
|
}
|
|
10801
10811
|
sharedSkillsDir() {
|
|
10802
|
-
return
|
|
10812
|
+
return join14(this.sharedRootDir(), "skills");
|
|
10803
10813
|
}
|
|
10804
10814
|
sharedCommandsDir() {
|
|
10805
|
-
return
|
|
10815
|
+
return join14(this.sharedRootDir(), "commands");
|
|
10806
10816
|
}
|
|
10807
10817
|
sharedAgentsDir() {
|
|
10808
|
-
return
|
|
10818
|
+
return join14(this.sharedRootDir(), "agents");
|
|
10809
10819
|
}
|
|
10810
10820
|
sharedExtensionsDir() {
|
|
10811
|
-
return
|
|
10821
|
+
return join14(this.sharedRootDir(), "extensions");
|
|
10812
10822
|
}
|
|
10813
10823
|
sharedSettingsFile() {
|
|
10814
|
-
return
|
|
10824
|
+
return join14(this.sharedRootDir(), "settings.json");
|
|
10825
|
+
}
|
|
10826
|
+
/** The global hooks file the CLI reads. It does not read hooks from its own home directory. */
|
|
10827
|
+
sharedHooksFile() {
|
|
10828
|
+
return join14(this.sharedRootDir(), "config", "hooks.json");
|
|
10815
10829
|
}
|
|
10816
10830
|
sharedProjectsJson() {
|
|
10817
|
-
return
|
|
10831
|
+
return join14(this.sharedRootDir(), "projects.json");
|
|
10818
10832
|
}
|
|
10819
10833
|
/** The DESKTOP app's brain, `~/.gemini/antigravity/brain`. The CLI's own is
|
|
10820
10834
|
* `homeDir()/brain`, reached through `agyBrainDirs()`. Both exist. */
|
|
10821
10835
|
desktopBrainDir() {
|
|
10822
|
-
return
|
|
10836
|
+
return join14(this.sharedRootDir(), "antigravity", "brain");
|
|
10823
10837
|
}
|
|
10824
10838
|
isAvailable() {
|
|
10825
10839
|
return agyBrainDirs().length > 0;
|
|
@@ -10846,10 +10860,10 @@ var init_agy = __esm({
|
|
|
10846
10860
|
}
|
|
10847
10861
|
/** Resolve a session inside ONE brain root. */
|
|
10848
10862
|
findSessionIn(brainDir, rawId) {
|
|
10849
|
-
const sessionDir =
|
|
10863
|
+
const sessionDir = join14(brainDir, rawId);
|
|
10850
10864
|
if (!existsSync12(sessionDir))
|
|
10851
10865
|
return null;
|
|
10852
|
-
const path = agyTranscriptPath(
|
|
10866
|
+
const path = agyTranscriptPath(join14(sessionDir, ".system_generated", "logs"));
|
|
10853
10867
|
if (!path)
|
|
10854
10868
|
return null;
|
|
10855
10869
|
let mtime = 0;
|
|
@@ -10880,14 +10894,14 @@ var init_agy = __esm({
|
|
|
10880
10894
|
continue;
|
|
10881
10895
|
}
|
|
10882
10896
|
for (const rawId of sessionDirs) {
|
|
10883
|
-
const sessionPath =
|
|
10897
|
+
const sessionPath = join14(brainDir, rawId);
|
|
10884
10898
|
try {
|
|
10885
10899
|
if (!statSync10(sessionPath).isDirectory())
|
|
10886
10900
|
continue;
|
|
10887
10901
|
} catch {
|
|
10888
10902
|
continue;
|
|
10889
10903
|
}
|
|
10890
|
-
const filePath = agyTranscriptPath(
|
|
10904
|
+
const filePath = agyTranscriptPath(join14(sessionPath, ".system_generated", "logs"));
|
|
10891
10905
|
if (!filePath)
|
|
10892
10906
|
continue;
|
|
10893
10907
|
let stat3;
|
|
@@ -11156,14 +11170,14 @@ var init_agy = __esm({
|
|
|
11156
11170
|
return [];
|
|
11157
11171
|
}
|
|
11158
11172
|
for (const rawId of sessionDirs) {
|
|
11159
|
-
const sessionPath =
|
|
11173
|
+
const sessionPath = join14(brainDir, rawId);
|
|
11160
11174
|
try {
|
|
11161
11175
|
if (!statSync10(sessionPath).isDirectory())
|
|
11162
11176
|
continue;
|
|
11163
11177
|
} catch {
|
|
11164
11178
|
continue;
|
|
11165
11179
|
}
|
|
11166
|
-
const filePath = agyTranscriptPath(
|
|
11180
|
+
const filePath = agyTranscriptPath(join14(sessionPath, ".system_generated", "logs"));
|
|
11167
11181
|
if (!filePath)
|
|
11168
11182
|
continue;
|
|
11169
11183
|
try {
|
|
@@ -11228,7 +11242,7 @@ var init_agy = __esm({
|
|
|
11228
11242
|
|
|
11229
11243
|
// ../engine/dist/core/backends/cursor-store.js
|
|
11230
11244
|
import { existsSync as existsSync13, readdirSync as readdirSync10, readFileSync as readFileSync9, statSync as statSync11 } from "fs";
|
|
11231
|
-
import { join as
|
|
11245
|
+
import { join as join15 } from "path";
|
|
11232
11246
|
function cursorProjectSlug(absPath) {
|
|
11233
11247
|
return absPath.replace(/[^a-zA-Z0-9]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
11234
11248
|
}
|
|
@@ -11241,7 +11255,7 @@ function listChatsIn(chatsRoot) {
|
|
|
11241
11255
|
return out;
|
|
11242
11256
|
}
|
|
11243
11257
|
for (const workspaceHash of hashDirs) {
|
|
11244
|
-
const hashPath3 =
|
|
11258
|
+
const hashPath3 = join15(chatsRoot, workspaceHash);
|
|
11245
11259
|
let chatIds;
|
|
11246
11260
|
try {
|
|
11247
11261
|
if (!statSync11(hashPath3).isDirectory())
|
|
@@ -11251,13 +11265,13 @@ function listChatsIn(chatsRoot) {
|
|
|
11251
11265
|
continue;
|
|
11252
11266
|
}
|
|
11253
11267
|
for (const chatId of chatIds) {
|
|
11254
|
-
const dir =
|
|
11255
|
-
const dbPath =
|
|
11268
|
+
const dir = join15(hashPath3, chatId);
|
|
11269
|
+
const dbPath = join15(dir, "store.db");
|
|
11256
11270
|
if (!existsSync13(dbPath))
|
|
11257
11271
|
continue;
|
|
11258
11272
|
let meta = {};
|
|
11259
11273
|
try {
|
|
11260
|
-
meta = JSON.parse(readFileSync9(
|
|
11274
|
+
meta = JSON.parse(readFileSync9(join15(dir, "meta.json"), "utf-8"));
|
|
11261
11275
|
} catch {
|
|
11262
11276
|
}
|
|
11263
11277
|
if (meta.hasConversation === false)
|
|
@@ -11296,13 +11310,13 @@ function findChat(chatsRoots, chatId) {
|
|
|
11296
11310
|
continue;
|
|
11297
11311
|
}
|
|
11298
11312
|
for (const workspaceHash of hashDirs) {
|
|
11299
|
-
const dir =
|
|
11300
|
-
const dbPath =
|
|
11313
|
+
const dir = join15(root, workspaceHash, chatId);
|
|
11314
|
+
const dbPath = join15(dir, "store.db");
|
|
11301
11315
|
if (!existsSync13(dbPath))
|
|
11302
11316
|
continue;
|
|
11303
11317
|
let meta = {};
|
|
11304
11318
|
try {
|
|
11305
|
-
meta = JSON.parse(readFileSync9(
|
|
11319
|
+
meta = JSON.parse(readFileSync9(join15(dir, "meta.json"), "utf-8"));
|
|
11306
11320
|
} catch {
|
|
11307
11321
|
}
|
|
11308
11322
|
let mtime = meta.updatedAtMs ?? 0;
|
|
@@ -11550,7 +11564,7 @@ function readStoreEvents(chat) {
|
|
|
11550
11564
|
function transcriptPath(cursorHome, projectPath, chatId) {
|
|
11551
11565
|
if (!projectPath)
|
|
11552
11566
|
return null;
|
|
11553
|
-
const p =
|
|
11567
|
+
const p = join15(cursorHome, "projects", cursorProjectSlug(projectPath), "agent-transcripts", chatId, `${chatId}.jsonl`);
|
|
11554
11568
|
return existsSync13(p) ? p : null;
|
|
11555
11569
|
}
|
|
11556
11570
|
function readTranscriptEvents(rawText, mtimeFallback = 0) {
|
|
@@ -11613,7 +11627,7 @@ var init_cursor_store = __esm({
|
|
|
11613
11627
|
|
|
11614
11628
|
// ../engine/dist/core/backends/cursor-ide.js
|
|
11615
11629
|
import { existsSync as existsSync14, readFileSync as readFileSync10, readdirSync as readdirSync11, statSync as statSync12 } from "fs";
|
|
11616
|
-
import { dirname as dirname12, join as
|
|
11630
|
+
import { dirname as dirname12, join as join16 } from "path";
|
|
11617
11631
|
function jsonOf(value) {
|
|
11618
11632
|
if (value == null)
|
|
11619
11633
|
return null;
|
|
@@ -11657,7 +11671,7 @@ function pathFromUri(uri) {
|
|
|
11657
11671
|
return uri.startsWith("/") ? uri : "";
|
|
11658
11672
|
}
|
|
11659
11673
|
function projectPathForWorkspace(workspaceDir) {
|
|
11660
|
-
const meta = jsonOf(safeRead(
|
|
11674
|
+
const meta = jsonOf(safeRead(join16(workspaceDir, "workspace.json")));
|
|
11661
11675
|
if (!meta)
|
|
11662
11676
|
return "";
|
|
11663
11677
|
const uri = typeof meta.workspace === "string" && meta.workspace || typeof meta.folder === "string" && meta.folder || "";
|
|
@@ -11680,7 +11694,7 @@ function workspaceIndex(workspaceRoots) {
|
|
|
11680
11694
|
continue;
|
|
11681
11695
|
}
|
|
11682
11696
|
for (const id of entries) {
|
|
11683
|
-
const dir =
|
|
11697
|
+
const dir = join16(root, id);
|
|
11684
11698
|
try {
|
|
11685
11699
|
if (!statSync12(dir).isDirectory())
|
|
11686
11700
|
continue;
|
|
@@ -11767,7 +11781,7 @@ function listComposers(globalDbPath, workspaceRoots) {
|
|
|
11767
11781
|
continue;
|
|
11768
11782
|
}
|
|
11769
11783
|
for (const workspaceId of entries) {
|
|
11770
|
-
const wsDb =
|
|
11784
|
+
const wsDb = join16(root, workspaceId, "state.vscdb");
|
|
11771
11785
|
if (!existsSync14(wsDb))
|
|
11772
11786
|
continue;
|
|
11773
11787
|
const projectPath = wsIndex.get(workspaceId) || "";
|
|
@@ -12029,7 +12043,7 @@ var init_cursor_ide = __esm({
|
|
|
12029
12043
|
|
|
12030
12044
|
// ../engine/dist/core/backends/cursor.js
|
|
12031
12045
|
import { existsSync as existsSync15, readFileSync as readFileSync11, statSync as statSync13 } from "fs";
|
|
12032
|
-
import { join as
|
|
12046
|
+
import { join as join17 } from "path";
|
|
12033
12047
|
var PREFIX4, CursorBackend, cursorBackend;
|
|
12034
12048
|
var init_cursor = __esm({
|
|
12035
12049
|
"../engine/dist/core/backends/cursor.js"() {
|
|
@@ -12336,7 +12350,7 @@ var init_cursor = __esm({
|
|
|
12336
12350
|
if (!lines)
|
|
12337
12351
|
return null;
|
|
12338
12352
|
const files = [{ name: `${r.chat.chatId}.jsonl`, bytes: Buffer.from(lines, "utf8") }];
|
|
12339
|
-
const metaPath =
|
|
12353
|
+
const metaPath = join17(r.chat.dir, "meta.json");
|
|
12340
12354
|
if (existsSync15(metaPath)) {
|
|
12341
12355
|
files.push({ name: "meta.json", bytes: readFileSync11(metaPath) });
|
|
12342
12356
|
}
|
|
@@ -12840,7 +12854,7 @@ var init_hermes = __esm({
|
|
|
12840
12854
|
// ../engine/dist/core/backends/pi.js
|
|
12841
12855
|
import { readdirSync as readdirSync12, readFileSync as readFileSync12, statSync as statSync14, openSync as openSync8, readSync as readSync8, closeSync as closeSync8 } from "fs";
|
|
12842
12856
|
import { createHash as createHash3 } from "crypto";
|
|
12843
|
-
import { basename as basename11, join as
|
|
12857
|
+
import { basename as basename11, join as join18 } from "path";
|
|
12844
12858
|
function parsePiFile(path) {
|
|
12845
12859
|
let raw;
|
|
12846
12860
|
try {
|
|
@@ -12888,7 +12902,7 @@ function* walkSessionFiles(root, depth = 2) {
|
|
|
12888
12902
|
for (const entry of entries) {
|
|
12889
12903
|
if (entry.name.startsWith("."))
|
|
12890
12904
|
continue;
|
|
12891
|
-
const path =
|
|
12905
|
+
const path = join18(root, entry.name);
|
|
12892
12906
|
if (entry.isDirectory()) {
|
|
12893
12907
|
yield* walkSessionFiles(path, depth - 1);
|
|
12894
12908
|
continue;
|
|
@@ -12938,7 +12952,7 @@ function dirSignature(root) {
|
|
|
12938
12952
|
if (!entry.isDirectory())
|
|
12939
12953
|
continue;
|
|
12940
12954
|
try {
|
|
12941
|
-
parts.push(`${entry.name}:${statSync14(
|
|
12955
|
+
parts.push(`${entry.name}:${statSync14(join18(root, entry.name)).mtimeMs}`);
|
|
12942
12956
|
} catch {
|
|
12943
12957
|
}
|
|
12944
12958
|
}
|
|
@@ -13056,7 +13070,7 @@ var init_pi = __esm({
|
|
|
13056
13070
|
entries2.push({
|
|
13057
13071
|
id: id || "",
|
|
13058
13072
|
projectPath: header?.cwd || "",
|
|
13059
|
-
projectDir: basename11(
|
|
13073
|
+
projectDir: basename11(join18(path, "..")),
|
|
13060
13074
|
mtime,
|
|
13061
13075
|
path
|
|
13062
13076
|
});
|
|
@@ -13109,7 +13123,7 @@ var init_pi = __esm({
|
|
|
13109
13123
|
return {
|
|
13110
13124
|
path,
|
|
13111
13125
|
format: "jsonl",
|
|
13112
|
-
projectDir: basename11(
|
|
13126
|
+
projectDir: basename11(join18(path, "..")),
|
|
13113
13127
|
projectPath: header.cwd || "",
|
|
13114
13128
|
mtime
|
|
13115
13129
|
};
|
|
@@ -13156,7 +13170,7 @@ var init_pi = __esm({
|
|
|
13156
13170
|
rawId,
|
|
13157
13171
|
prefixedId: this.toPrefixedId(rawId),
|
|
13158
13172
|
projectPath,
|
|
13159
|
-
projectDir: basename11(
|
|
13173
|
+
projectDir: basename11(join18(path, "..")),
|
|
13160
13174
|
fullPath: path,
|
|
13161
13175
|
created: header.timestamp || stat3.birthtime.toISOString(),
|
|
13162
13176
|
modified: stat3.mtime.toISOString(),
|
|
@@ -13506,7 +13520,7 @@ var init_backends = __esm({
|
|
|
13506
13520
|
|
|
13507
13521
|
// ../engine/dist/core/collector-health.js
|
|
13508
13522
|
import { readFileSync as readFileSync13, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4 } from "node:fs";
|
|
13509
|
-
import { join as
|
|
13523
|
+
import { join as join19, dirname as dirname13 } from "node:path";
|
|
13510
13524
|
function applySyncOutcome(prior, outcome, now = Date.now()) {
|
|
13511
13525
|
const t = { lastOkAt: prior?.lastOkAt ?? null, failures: prior?.failures ?? 0 };
|
|
13512
13526
|
if (prior?.lastError !== void 0)
|
|
@@ -13581,7 +13595,7 @@ var init_collector_health = __esm({
|
|
|
13581
13595
|
"../engine/dist/core/collector-health.js"() {
|
|
13582
13596
|
"use strict";
|
|
13583
13597
|
init_paths();
|
|
13584
|
-
healthPath = () =>
|
|
13598
|
+
healthPath = () => join19(getDataDir(), "collector-health.json");
|
|
13585
13599
|
PROGRESS_WRITE_INTERVAL_MS = 2e3;
|
|
13586
13600
|
lastProgressWrite = 0;
|
|
13587
13601
|
STALE_AFTER_MS = 30 * 6e4;
|
|
@@ -14016,7 +14030,7 @@ var init_secret_redactor = __esm({
|
|
|
14016
14030
|
// ../engine/dist/core/source-discovery.js
|
|
14017
14031
|
import { createHash as createHash4 } from "crypto";
|
|
14018
14032
|
import { existsSync as existsSync17, readdirSync as readdirSync13, statSync as statSync16 } from "fs";
|
|
14019
|
-
import { join as
|
|
14033
|
+
import { join as join20 } from "path";
|
|
14020
14034
|
function sourceId(path) {
|
|
14021
14035
|
return "src_" + createHash4("sha256").update(path).digest("hex").slice(0, 12);
|
|
14022
14036
|
}
|
|
@@ -14057,7 +14071,7 @@ function countTranscripts(root, tool) {
|
|
|
14057
14071
|
return;
|
|
14058
14072
|
}
|
|
14059
14073
|
for (const e of entries) {
|
|
14060
|
-
const full =
|
|
14074
|
+
const full = join20(dir, e.name);
|
|
14061
14075
|
if (e.isDirectory()) {
|
|
14062
14076
|
walk(full, depth + 1);
|
|
14063
14077
|
continue;
|
|
@@ -14129,10 +14143,10 @@ var init_source_discovery = __esm({
|
|
|
14129
14143
|
// ../engine/dist/core/home-discovery.js
|
|
14130
14144
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
14131
14145
|
import { existsSync as existsSync18, readdirSync as readdirSync14, readFileSync as readFileSync14, realpathSync as realpathSync3, statSync as statSync17 } from "fs";
|
|
14132
|
-
import { homedir as
|
|
14133
|
-
import { basename as basename12, join as
|
|
14146
|
+
import { homedir as homedir6, platform as osPlatform } from "os";
|
|
14147
|
+
import { basename as basename12, join as join21 } from "path";
|
|
14134
14148
|
function candidateRoots(plat = osPlatform(), env = process.env) {
|
|
14135
|
-
const home =
|
|
14149
|
+
const home = homedir6();
|
|
14136
14150
|
const roots = [home];
|
|
14137
14151
|
const add = (p) => {
|
|
14138
14152
|
if (p && !roots.includes(p))
|
|
@@ -14143,11 +14157,11 @@ function candidateRoots(plat = osPlatform(), env = process.env) {
|
|
|
14143
14157
|
add(env.LOCALAPPDATA);
|
|
14144
14158
|
add(env.USERPROFILE);
|
|
14145
14159
|
} else if (plat === "darwin") {
|
|
14146
|
-
add(
|
|
14160
|
+
add(join21(home, "Library", "Application Support"));
|
|
14147
14161
|
add(env.XDG_CONFIG_HOME);
|
|
14148
14162
|
} else {
|
|
14149
|
-
add(env.XDG_CONFIG_HOME ||
|
|
14150
|
-
add(env.XDG_DATA_HOME ||
|
|
14163
|
+
add(env.XDG_CONFIG_HOME || join21(home, ".config"));
|
|
14164
|
+
add(env.XDG_DATA_HOME || join21(home, ".local", "share"));
|
|
14151
14165
|
}
|
|
14152
14166
|
return roots.filter((r) => existsSync18(r));
|
|
14153
14167
|
}
|
|
@@ -14160,14 +14174,14 @@ function piRootOf(home) {
|
|
|
14160
14174
|
return piSessionDirForHome(home);
|
|
14161
14175
|
}
|
|
14162
14176
|
function identifyHome(dir) {
|
|
14163
|
-
const has = (...parts) => existsSync18(
|
|
14164
|
-
if (has("projects") && dirHasTranscript(
|
|
14177
|
+
const has = (...parts) => existsSync18(join21(dir, ...parts));
|
|
14178
|
+
if (has("projects") && dirHasTranscript(join21(dir, "projects"), (f) => f.endsWith(".jsonl"), 2))
|
|
14165
14179
|
return "claude";
|
|
14166
|
-
if (has("sessions") && dirHasTranscript(
|
|
14180
|
+
if (has("sessions") && dirHasTranscript(join21(dir, "sessions"), (f) => f.startsWith("rollout-") && f.endsWith(".jsonl"), 4))
|
|
14167
14181
|
return "codex";
|
|
14168
|
-
if (has("brain") && dirHasTranscript(
|
|
14182
|
+
if (has("brain") && dirHasTranscript(join21(dir, "brain"), (f) => f.endsWith(".jsonl"), 4))
|
|
14169
14183
|
return "agy";
|
|
14170
|
-
if (has("chats") && dirHasTranscript(
|
|
14184
|
+
if (has("chats") && dirHasTranscript(join21(dir, "chats"), (f) => f === "store.db", 3))
|
|
14171
14185
|
return "cursor";
|
|
14172
14186
|
if (has("opencode.db"))
|
|
14173
14187
|
return "opencode";
|
|
@@ -14192,7 +14206,7 @@ function dirHasTranscript(root, match, depth) {
|
|
|
14192
14206
|
continue;
|
|
14193
14207
|
if (e.isFile() && match(e.name))
|
|
14194
14208
|
return true;
|
|
14195
|
-
if (e.isDirectory() && dirHasTranscript(
|
|
14209
|
+
if (e.isDirectory() && dirHasTranscript(join21(root, e.name), match, depth - 1))
|
|
14196
14210
|
return true;
|
|
14197
14211
|
}
|
|
14198
14212
|
return false;
|
|
@@ -14213,7 +14227,7 @@ function countSessions(dir, tool) {
|
|
|
14213
14227
|
if (SKIP.has(e.name))
|
|
14214
14228
|
continue;
|
|
14215
14229
|
if (e.isDirectory()) {
|
|
14216
|
-
walk2(
|
|
14230
|
+
walk2(join21(d, e.name), depth - 1);
|
|
14217
14231
|
continue;
|
|
14218
14232
|
}
|
|
14219
14233
|
if (isPiTranscriptName(e.name))
|
|
@@ -14250,12 +14264,12 @@ function countSessions(dir, tool) {
|
|
|
14250
14264
|
if (SKIP.has(e.name))
|
|
14251
14265
|
continue;
|
|
14252
14266
|
if (e.isDirectory())
|
|
14253
|
-
walk(
|
|
14267
|
+
walk(join21(d, e.name), depth - 1);
|
|
14254
14268
|
else if (s.match(e.name))
|
|
14255
14269
|
n++;
|
|
14256
14270
|
}
|
|
14257
14271
|
};
|
|
14258
|
-
walk(
|
|
14272
|
+
walk(join21(dir, s.sub), s.depth);
|
|
14259
14273
|
return n;
|
|
14260
14274
|
}
|
|
14261
14275
|
function declaredHomes(env = process.env, plat = osPlatform()) {
|
|
@@ -14292,8 +14306,8 @@ function declaredHomes(env = process.env, plat = osPlatform()) {
|
|
|
14292
14306
|
}
|
|
14293
14307
|
return out;
|
|
14294
14308
|
}
|
|
14295
|
-
const home =
|
|
14296
|
-
const rcs = [".bashrc", ".bash_profile", ".zshrc", ".zprofile", ".profile"].map((f) =>
|
|
14309
|
+
const home = homedir6();
|
|
14310
|
+
const rcs = [".bashrc", ".bash_profile", ".zshrc", ".zprofile", ".profile"].map((f) => join21(home, f)).concat([join21(home, ".config", "fish", "config.fish")]);
|
|
14297
14311
|
for (const rc of rcs) {
|
|
14298
14312
|
let text;
|
|
14299
14313
|
try {
|
|
@@ -14308,7 +14322,7 @@ function declaredHomes(env = process.env, plat = osPlatform()) {
|
|
|
14308
14322
|
add(d);
|
|
14309
14323
|
}
|
|
14310
14324
|
}
|
|
14311
|
-
return out.map((p) => p.startsWith("~") ?
|
|
14325
|
+
return out.map((p) => p.startsWith("~") ? join21(home, p.slice(1)) : p);
|
|
14312
14326
|
}
|
|
14313
14327
|
function runningToolHomes(plat = osPlatform()) {
|
|
14314
14328
|
const out = [];
|
|
@@ -14379,9 +14393,9 @@ function discoverHomes(opts = {}) {
|
|
|
14379
14393
|
found.set(real, { tool, path: real, via, sessions: countSessions(real, tool) });
|
|
14380
14394
|
if (tool === "hermes") {
|
|
14381
14395
|
try {
|
|
14382
|
-
for (const e of readdirSync14(
|
|
14396
|
+
for (const e of readdirSync14(join21(real, "profiles"), { withFileTypes: true })) {
|
|
14383
14397
|
if (e.isDirectory())
|
|
14384
|
-
consider(
|
|
14398
|
+
consider(join21(real, "profiles", e.name), via);
|
|
14385
14399
|
}
|
|
14386
14400
|
} catch {
|
|
14387
14401
|
}
|
|
@@ -14411,7 +14425,7 @@ function walkForHomes(dir, depth, visit) {
|
|
|
14411
14425
|
for (const e of entries) {
|
|
14412
14426
|
if (!e.isDirectory() || SKIP.has(e.name))
|
|
14413
14427
|
continue;
|
|
14414
|
-
const child =
|
|
14428
|
+
const child = join21(dir, e.name);
|
|
14415
14429
|
visit(child);
|
|
14416
14430
|
walkForHomes(child, depth - 1, visit);
|
|
14417
14431
|
}
|
|
@@ -14455,12 +14469,12 @@ var init_home_discovery = __esm({
|
|
|
14455
14469
|
// ../engine/dist/core/detector-install.js
|
|
14456
14470
|
import { createHash as createHash5 } from "crypto";
|
|
14457
14471
|
import { existsSync as existsSync19, mkdirSync as mkdirSync5, mkdtempSync, chmodSync as chmodSync2, renameSync as renameSync3, rmSync as rmSync2, writeFileSync as writeFileSync4, readFileSync as readFileSync15, statSync as statSync18, copyFileSync as copyFileSync2 } from "fs";
|
|
14458
|
-
import { join as
|
|
14472
|
+
import { join as join22 } from "path";
|
|
14459
14473
|
function managedDetectorPath(name) {
|
|
14460
|
-
return
|
|
14474
|
+
return join22(getDetectorBinDir(), name + exeSuffix());
|
|
14461
14475
|
}
|
|
14462
14476
|
function receiptPath(name) {
|
|
14463
|
-
return
|
|
14477
|
+
return join22(getDetectorBinDir(), `${name}.receipt.json`);
|
|
14464
14478
|
}
|
|
14465
14479
|
function sha256File(path) {
|
|
14466
14480
|
return createHash5("sha256").update(readFileSync15(path)).digest("hex");
|
|
@@ -14493,7 +14507,7 @@ function configuredDir() {
|
|
|
14493
14507
|
function resolveDetector(name) {
|
|
14494
14508
|
const dir = configuredDir();
|
|
14495
14509
|
if (dir) {
|
|
14496
|
-
const p2 =
|
|
14510
|
+
const p2 = join22(dir, name + exeSuffix());
|
|
14497
14511
|
if (existsSync19(p2))
|
|
14498
14512
|
return { path: p2, version: "operator-supplied", source: "configured" };
|
|
14499
14513
|
return { error: "not-installed" };
|
|
@@ -14560,7 +14574,7 @@ var init_detector_install = __esm({
|
|
|
14560
14574
|
import { spawnSync } from "child_process";
|
|
14561
14575
|
import { existsSync as existsSync20, unlinkSync, readFileSync as readFileSync16, mkdtempSync as mkdtempSync2, rmSync as rmSync3 } from "fs";
|
|
14562
14576
|
import { tmpdir } from "os";
|
|
14563
|
-
import { join as
|
|
14577
|
+
import { join as join23 } from "path";
|
|
14564
14578
|
function mask(s) {
|
|
14565
14579
|
if (!s)
|
|
14566
14580
|
return "";
|
|
@@ -14588,7 +14602,7 @@ function whichDetector(bin) {
|
|
|
14588
14602
|
return null;
|
|
14589
14603
|
}
|
|
14590
14604
|
function spawnScoped(binary, args, opts) {
|
|
14591
|
-
const scratch = mkdtempSync2(
|
|
14605
|
+
const scratch = mkdtempSync2(join23(tmpdir(), "cr-scan-tmp-"));
|
|
14592
14606
|
try {
|
|
14593
14607
|
return spawnSync(binary, args, {
|
|
14594
14608
|
...opts,
|
|
@@ -15158,9 +15172,9 @@ var init_transcript = __esm({
|
|
|
15158
15172
|
import { execSync } from "child_process";
|
|
15159
15173
|
import { createHash as createHash6 } from "crypto";
|
|
15160
15174
|
import { existsSync as existsSync21, readFileSync as readFileSync17, realpathSync as realpathSync4, readdirSync as readdirSync15, statSync as statSync20 } from "fs";
|
|
15161
|
-
import { basename as basename13, dirname as dirname14, isAbsolute as isAbsolute2, join as
|
|
15175
|
+
import { basename as basename13, dirname as dirname14, isAbsolute as isAbsolute2, join as join24, resolve, sep } from "path";
|
|
15162
15176
|
function getProjectsConfigPath() {
|
|
15163
|
-
return
|
|
15177
|
+
return join24(getDataDir(), "projects.json");
|
|
15164
15178
|
}
|
|
15165
15179
|
function loadProjectsConfig() {
|
|
15166
15180
|
if (cachedConfig && cachedConfig.mtime === Number.MAX_SAFE_INTEGER) {
|
|
@@ -15272,7 +15286,7 @@ function matchDeclaredProject(realPath, projects) {
|
|
|
15272
15286
|
function matchChild(realPath, parentRoot, children) {
|
|
15273
15287
|
const sorted = [...children].sort((a, b) => b.path.length - a.path.length);
|
|
15274
15288
|
for (const c of sorted) {
|
|
15275
|
-
const childRoot = safeRealpath(
|
|
15289
|
+
const childRoot = safeRealpath(join24(parentRoot, c.path));
|
|
15276
15290
|
if (isInside(realPath, childRoot))
|
|
15277
15291
|
return c;
|
|
15278
15292
|
}
|
|
@@ -15307,7 +15321,7 @@ function findGitToplevel(realPath) {
|
|
|
15307
15321
|
let cur = realPath;
|
|
15308
15322
|
let last = "";
|
|
15309
15323
|
while (cur && cur !== last) {
|
|
15310
|
-
if (existsSync21(
|
|
15324
|
+
if (existsSync21(join24(cur, ".git")))
|
|
15311
15325
|
return cur;
|
|
15312
15326
|
last = cur;
|
|
15313
15327
|
cur = dirname14(cur);
|
|
@@ -15374,7 +15388,7 @@ function resolveAutoWorkspace(realPath, minRepos) {
|
|
|
15374
15388
|
let last = "";
|
|
15375
15389
|
let depth = 0;
|
|
15376
15390
|
while (cur && cur !== last && depth < AUTO_WORKSPACE_MAX_DEPTH) {
|
|
15377
|
-
if (!existsSync21(
|
|
15391
|
+
if (!existsSync21(join24(cur, ".git"))) {
|
|
15378
15392
|
const cached = workspaceCache.get(cur);
|
|
15379
15393
|
let qualifies;
|
|
15380
15394
|
if (cached === void 0) {
|
|
@@ -15405,12 +15419,12 @@ function countGitChildren(dir) {
|
|
|
15405
15419
|
for (const name of entries) {
|
|
15406
15420
|
if (name.startsWith("."))
|
|
15407
15421
|
continue;
|
|
15408
|
-
const child =
|
|
15422
|
+
const child = join24(dir, name);
|
|
15409
15423
|
try {
|
|
15410
15424
|
const st = statSync20(child);
|
|
15411
15425
|
if (!st.isDirectory())
|
|
15412
15426
|
continue;
|
|
15413
|
-
if (existsSync21(
|
|
15427
|
+
if (existsSync21(join24(child, ".git")))
|
|
15414
15428
|
count++;
|
|
15415
15429
|
} catch {
|
|
15416
15430
|
}
|
|
@@ -16119,8 +16133,8 @@ var init_source_registry = __esm({
|
|
|
16119
16133
|
|
|
16120
16134
|
// ../engine/dist/core/utils.js
|
|
16121
16135
|
import { existsSync as existsSync22, readdirSync as readdirSync16 } from "fs";
|
|
16122
|
-
import { homedir as
|
|
16123
|
-
import { join as
|
|
16136
|
+
import { homedir as homedir7 } from "os";
|
|
16137
|
+
import { join as join25 } from "path";
|
|
16124
16138
|
function splitByHeaders(markdown) {
|
|
16125
16139
|
const lines = markdown.split("\n");
|
|
16126
16140
|
const sections = [];
|
|
@@ -16150,7 +16164,7 @@ function splitByHeaders(markdown) {
|
|
|
16150
16164
|
return sections;
|
|
16151
16165
|
}
|
|
16152
16166
|
function getClaudeDirs() {
|
|
16153
|
-
const home =
|
|
16167
|
+
const home = homedir7();
|
|
16154
16168
|
const dirs = [];
|
|
16155
16169
|
const seen = /* @__PURE__ */ new Set();
|
|
16156
16170
|
const add = (dir) => {
|
|
@@ -16163,17 +16177,17 @@ function getClaudeDirs() {
|
|
|
16163
16177
|
for (const d of process.env.CLAUDE_DIRS.split(",")) {
|
|
16164
16178
|
const trimmed = d.trim();
|
|
16165
16179
|
if (trimmed) {
|
|
16166
|
-
add(trimmed.startsWith("~/") ?
|
|
16180
|
+
add(trimmed.startsWith("~/") ? join25(home, trimmed.slice(2)) : trimmed);
|
|
16167
16181
|
}
|
|
16168
16182
|
}
|
|
16169
16183
|
}
|
|
16170
|
-
add(
|
|
16184
|
+
add(join25(home, ".claude"));
|
|
16171
16185
|
try {
|
|
16172
16186
|
const entries = readdirSync16(home, { withFileTypes: true });
|
|
16173
16187
|
for (const entry of entries) {
|
|
16174
16188
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
16175
|
-
const candidate =
|
|
16176
|
-
if (existsSync22(
|
|
16189
|
+
const candidate = join25(home, entry.name);
|
|
16190
|
+
if (existsSync22(join25(candidate, "projects"))) {
|
|
16177
16191
|
add(candidate);
|
|
16178
16192
|
}
|
|
16179
16193
|
}
|
|
@@ -16185,12 +16199,12 @@ function getClaudeDirs() {
|
|
|
16185
16199
|
function discoverSubdirs(subdir) {
|
|
16186
16200
|
const result = [];
|
|
16187
16201
|
for (const claudeDir of getClaudeDirs()) {
|
|
16188
|
-
const path =
|
|
16202
|
+
const path = join25(claudeDir, subdir);
|
|
16189
16203
|
if (existsSync22(path)) {
|
|
16190
16204
|
result.push(path);
|
|
16191
16205
|
}
|
|
16192
16206
|
}
|
|
16193
|
-
return result.length > 0 ? result : [
|
|
16207
|
+
return result.length > 0 ? result : [join25(homedir7(), ".claude", subdir)];
|
|
16194
16208
|
}
|
|
16195
16209
|
var init_utils = __esm({
|
|
16196
16210
|
"../engine/dist/core/utils.js"() {
|
|
@@ -16200,8 +16214,8 @@ var init_utils = __esm({
|
|
|
16200
16214
|
|
|
16201
16215
|
// ../engine/dist/parsers/plan-source.js
|
|
16202
16216
|
import { existsSync as existsSync23, readdirSync as readdirSync17, readFileSync as readFileSync18, statSync as statSync22 } from "fs";
|
|
16203
|
-
import { homedir as
|
|
16204
|
-
import { join as
|
|
16217
|
+
import { homedir as homedir8 } from "os";
|
|
16218
|
+
import { join as join26, basename as basename14 } from "path";
|
|
16205
16219
|
function parseFrontmatter(content) {
|
|
16206
16220
|
if (!content.startsWith("---"))
|
|
16207
16221
|
return { body: content };
|
|
@@ -16296,7 +16310,7 @@ var init_plan_source = __esm({
|
|
|
16296
16310
|
if (seenClaude.has(file))
|
|
16297
16311
|
continue;
|
|
16298
16312
|
seenClaude.add(file);
|
|
16299
|
-
const filePath =
|
|
16313
|
+
const filePath = join26(plansDir, file);
|
|
16300
16314
|
try {
|
|
16301
16315
|
const stat3 = statSync22(filePath);
|
|
16302
16316
|
const planName = basename14(file, ".md");
|
|
@@ -16340,7 +16354,7 @@ var init_plan_source = __esm({
|
|
|
16340
16354
|
return;
|
|
16341
16355
|
}
|
|
16342
16356
|
for (const file of files) {
|
|
16343
|
-
const filePath =
|
|
16357
|
+
const filePath = join26(plansDir, file);
|
|
16344
16358
|
try {
|
|
16345
16359
|
const stat3 = statSync22(filePath);
|
|
16346
16360
|
const content = readFileSync18(filePath, "utf-8");
|
|
@@ -16371,7 +16385,7 @@ var init_plan_source = __esm({
|
|
|
16371
16385
|
for (const match of content.matchAll(fullPathPattern)) {
|
|
16372
16386
|
let path = (match[1] || "").trim();
|
|
16373
16387
|
if (path.startsWith("~/")) {
|
|
16374
|
-
path =
|
|
16388
|
+
path = join26(homedir8(), path.slice(2));
|
|
16375
16389
|
}
|
|
16376
16390
|
for (const projectDir of knownProjects) {
|
|
16377
16391
|
if (path.startsWith(projectDir)) {
|
|
@@ -16456,9 +16470,9 @@ var init_plan_source = __esm({
|
|
|
16456
16470
|
const map = /* @__PURE__ */ new Map();
|
|
16457
16471
|
const root = claudeBackend.projectsDir();
|
|
16458
16472
|
for (const proj of safeReaddir(root)) {
|
|
16459
|
-
const projPath =
|
|
16473
|
+
const projPath = join26(root, proj);
|
|
16460
16474
|
for (const sessionEntry of safeReaddir(projPath)) {
|
|
16461
|
-
const subDir =
|
|
16475
|
+
const subDir = join26(projPath, sessionEntry, "subagents");
|
|
16462
16476
|
if (!existsSync23(subDir))
|
|
16463
16477
|
continue;
|
|
16464
16478
|
for (const f of safeReaddir(subDir)) {
|
|
@@ -16533,7 +16547,7 @@ var init_plan_source = __esm({
|
|
|
16533
16547
|
return links;
|
|
16534
16548
|
}
|
|
16535
16549
|
async *discoverAgyPlans() {
|
|
16536
|
-
const brainDir =
|
|
16550
|
+
const brainDir = join26(agyBackend.homeDir(), "brain");
|
|
16537
16551
|
if (!existsSync23(brainDir))
|
|
16538
16552
|
return;
|
|
16539
16553
|
let sessionDirs;
|
|
@@ -16543,7 +16557,7 @@ var init_plan_source = __esm({
|
|
|
16543
16557
|
return;
|
|
16544
16558
|
}
|
|
16545
16559
|
for (const rawId of sessionDirs) {
|
|
16546
|
-
const sessionPath =
|
|
16560
|
+
const sessionPath = join26(brainDir, rawId);
|
|
16547
16561
|
try {
|
|
16548
16562
|
if (!statSync22(sessionPath).isDirectory())
|
|
16549
16563
|
continue;
|
|
@@ -16557,7 +16571,7 @@ var init_plan_source = __esm({
|
|
|
16557
16571
|
continue;
|
|
16558
16572
|
}
|
|
16559
16573
|
for (const file of files) {
|
|
16560
|
-
const filePath =
|
|
16574
|
+
const filePath = join26(sessionPath, file);
|
|
16561
16575
|
try {
|
|
16562
16576
|
const stat3 = statSync22(filePath);
|
|
16563
16577
|
const content = readFileSync18(filePath, "utf-8");
|
|
@@ -16590,7 +16604,7 @@ var init_plan_source = __esm({
|
|
|
16590
16604
|
|
|
16591
16605
|
// ../engine/dist/parsers/task-source.js
|
|
16592
16606
|
import { existsSync as existsSync24, readdirSync as readdirSync18, readFileSync as readFileSync19, statSync as statSync23 } from "fs";
|
|
16593
|
-
import { join as
|
|
16607
|
+
import { join as join27 } from "path";
|
|
16594
16608
|
var MAX_CHUNK_CHARS2, TaskSource;
|
|
16595
16609
|
var init_task_source = __esm({
|
|
16596
16610
|
"../engine/dist/parsers/task-source.js"() {
|
|
@@ -16628,7 +16642,7 @@ var init_task_source = __esm({
|
|
|
16628
16642
|
return;
|
|
16629
16643
|
}
|
|
16630
16644
|
for (const file of files) {
|
|
16631
|
-
const filePath =
|
|
16645
|
+
const filePath = join27(todosDir, file);
|
|
16632
16646
|
let stat3;
|
|
16633
16647
|
try {
|
|
16634
16648
|
stat3 = statSync23(filePath);
|
|
@@ -16677,7 +16691,7 @@ var init_task_source = __esm({
|
|
|
16677
16691
|
if (!entry.isDirectory())
|
|
16678
16692
|
continue;
|
|
16679
16693
|
const sessionUuid = entry.name;
|
|
16680
|
-
const taskDir =
|
|
16694
|
+
const taskDir = join27(tasksDir, sessionUuid);
|
|
16681
16695
|
try {
|
|
16682
16696
|
const stat3 = statSync23(taskDir);
|
|
16683
16697
|
const taskFiles = readdirSync18(taskDir).filter((f) => f.endsWith(".json"));
|
|
@@ -16752,7 +16766,7 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
|
|
|
16752
16766
|
text,
|
|
16753
16767
|
chunkType: "task_detail",
|
|
16754
16768
|
projectPath: item.projectPath,
|
|
16755
|
-
filePath:
|
|
16769
|
+
filePath: join27(taskDir, `${task.id}.json`),
|
|
16756
16770
|
mtime: item.mtime
|
|
16757
16771
|
});
|
|
16758
16772
|
}
|
|
@@ -16809,7 +16823,7 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
|
|
|
16809
16823
|
});
|
|
16810
16824
|
for (const file of sorted) {
|
|
16811
16825
|
try {
|
|
16812
|
-
const content = readFileSync19(
|
|
16826
|
+
const content = readFileSync19(join27(taskDir, file), "utf-8");
|
|
16813
16827
|
const task = JSON.parse(content);
|
|
16814
16828
|
if (task.subject) {
|
|
16815
16829
|
tasks.push(task);
|
|
@@ -16826,8 +16840,8 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
|
|
|
16826
16840
|
|
|
16827
16841
|
// ../engine/dist/parsers/claude-md-source.js
|
|
16828
16842
|
import { existsSync as existsSync25, readFileSync as readFileSync20, readdirSync as readdirSync19, statSync as statSync24 } from "fs";
|
|
16829
|
-
import { homedir as
|
|
16830
|
-
import { join as
|
|
16843
|
+
import { homedir as homedir9 } from "os";
|
|
16844
|
+
import { join as join28, basename as basename15, dirname as dirname15 } from "path";
|
|
16831
16845
|
import { createHash as createHash7 } from "crypto";
|
|
16832
16846
|
function discoverProjectDirs(claudeDir) {
|
|
16833
16847
|
const dirs = [];
|
|
@@ -16853,15 +16867,15 @@ function discoverProjectDirs(claudeDir) {
|
|
|
16853
16867
|
}
|
|
16854
16868
|
};
|
|
16855
16869
|
if (claudeDir) {
|
|
16856
|
-
scanProjectsDir(
|
|
16870
|
+
scanProjectsDir(join28(claudeDir, "projects"));
|
|
16857
16871
|
return dirs;
|
|
16858
16872
|
}
|
|
16859
|
-
const home =
|
|
16873
|
+
const home = homedir9();
|
|
16860
16874
|
scanProjectsDir(claudeBackend.projectsDir());
|
|
16861
16875
|
try {
|
|
16862
16876
|
for (const entry of readdirSync19(home, { withFileTypes: true })) {
|
|
16863
16877
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
16864
|
-
scanProjectsDir(
|
|
16878
|
+
scanProjectsDir(join28(home, entry.name, "projects"));
|
|
16865
16879
|
}
|
|
16866
16880
|
}
|
|
16867
16881
|
} catch {
|
|
@@ -16925,7 +16939,7 @@ var init_claude_md_source = __esm({
|
|
|
16925
16939
|
const seen = /* @__PURE__ */ new Set();
|
|
16926
16940
|
const seenKey = (path, tool) => `${tool}:${path}`;
|
|
16927
16941
|
for (const note of NOTE_FILES) {
|
|
16928
|
-
const p =
|
|
16942
|
+
const p = join28(homedir9(), note.filename);
|
|
16929
16943
|
const key2 = seenKey(p, note.tool);
|
|
16930
16944
|
if (existsSync25(p) && !seen.has(key2)) {
|
|
16931
16945
|
seen.add(key2);
|
|
@@ -16937,7 +16951,7 @@ var init_claude_md_source = __esm({
|
|
|
16937
16951
|
const projectDirs = discoverProjectDirs(this.claudeDir);
|
|
16938
16952
|
for (const projectDir of projectDirs) {
|
|
16939
16953
|
for (const note of NOTE_FILES) {
|
|
16940
|
-
const p =
|
|
16954
|
+
const p = join28(projectDir, note.filename);
|
|
16941
16955
|
const key2 = seenKey(p, note.tool);
|
|
16942
16956
|
if (existsSync25(p) && !seen.has(key2)) {
|
|
16943
16957
|
seen.add(key2);
|
|
@@ -16951,7 +16965,7 @@ var init_claude_md_source = __esm({
|
|
|
16951
16965
|
if (!existsSync25(searchDir))
|
|
16952
16966
|
continue;
|
|
16953
16967
|
for (const note of NOTE_FILES) {
|
|
16954
|
-
const directPath =
|
|
16968
|
+
const directPath = join28(searchDir, note.filename);
|
|
16955
16969
|
const key2 = seenKey(directPath, note.tool);
|
|
16956
16970
|
if (existsSync25(directPath) && !seen.has(key2)) {
|
|
16957
16971
|
seen.add(key2);
|
|
@@ -16966,7 +16980,7 @@ var init_claude_md_source = __esm({
|
|
|
16966
16980
|
if (!entry.isDirectory())
|
|
16967
16981
|
continue;
|
|
16968
16982
|
for (const note of NOTE_FILES) {
|
|
16969
|
-
const p =
|
|
16983
|
+
const p = join28(searchDir, entry.name, note.filename);
|
|
16970
16984
|
const key2 = seenKey(p, note.tool);
|
|
16971
16985
|
if (existsSync25(p) && !seen.has(key2)) {
|
|
16972
16986
|
seen.add(key2);
|
|
@@ -17052,8 +17066,8 @@ var init_claude_md_source = __esm({
|
|
|
17052
17066
|
|
|
17053
17067
|
// ../engine/dist/parsers/agent-memory-source.js
|
|
17054
17068
|
import { existsSync as existsSync26, readFileSync as readFileSync21, readdirSync as readdirSync20, statSync as statSync25 } from "fs";
|
|
17055
|
-
import { homedir as
|
|
17056
|
-
import { join as
|
|
17069
|
+
import { homedir as homedir10 } from "os";
|
|
17070
|
+
import { join as join29, basename as basename16 } from "path";
|
|
17057
17071
|
function parseFrontmatter2(content) {
|
|
17058
17072
|
const fm = {};
|
|
17059
17073
|
let body = content;
|
|
@@ -17090,12 +17104,12 @@ function discoverMemoryDirs() {
|
|
|
17090
17104
|
out.push({ memoryDir, projectHash });
|
|
17091
17105
|
}
|
|
17092
17106
|
};
|
|
17093
|
-
const home =
|
|
17107
|
+
const home = homedir10();
|
|
17094
17108
|
const claudeRoots = [claudeBackend.projectsDir()];
|
|
17095
17109
|
try {
|
|
17096
17110
|
for (const entry of readdirSync20(home, { withFileTypes: true })) {
|
|
17097
17111
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
17098
|
-
claudeRoots.push(
|
|
17112
|
+
claudeRoots.push(join29(home, entry.name, "projects"));
|
|
17099
17113
|
}
|
|
17100
17114
|
}
|
|
17101
17115
|
} catch {
|
|
@@ -17107,7 +17121,7 @@ function discoverMemoryDirs() {
|
|
|
17107
17121
|
for (const entry of readdirSync20(projectsDir, { withFileTypes: true })) {
|
|
17108
17122
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
17109
17123
|
continue;
|
|
17110
|
-
add(
|
|
17124
|
+
add(join29(projectsDir, entry.name, "memory"), entry.name);
|
|
17111
17125
|
}
|
|
17112
17126
|
} catch {
|
|
17113
17127
|
}
|
|
@@ -17136,7 +17150,7 @@ var init_agent_memory_source = __esm({
|
|
|
17136
17150
|
for (const entry of readdirSync20(memoryDir, { withFileTypes: true })) {
|
|
17137
17151
|
if (!entry.isFile() || !entry.name.endsWith(".md"))
|
|
17138
17152
|
continue;
|
|
17139
|
-
const filePath =
|
|
17153
|
+
const filePath = join29(memoryDir, entry.name);
|
|
17140
17154
|
if (seen.has(filePath))
|
|
17141
17155
|
continue;
|
|
17142
17156
|
seen.add(filePath);
|
|
@@ -17239,8 +17253,8 @@ var init_agent_memory_source = __esm({
|
|
|
17239
17253
|
import { existsSync as existsSync27, readdirSync as readdirSync21, statSync as statSync26 } from "fs";
|
|
17240
17254
|
import { createReadStream as createReadStream3 } from "fs";
|
|
17241
17255
|
import { createInterface as createInterface2 } from "readline";
|
|
17242
|
-
import { homedir as
|
|
17243
|
-
import { join as
|
|
17256
|
+
import { homedir as homedir11 } from "os";
|
|
17257
|
+
import { join as join30 } from "path";
|
|
17244
17258
|
var MAX_CHUNK_CHARS5, HistorySource;
|
|
17245
17259
|
var init_history_source = __esm({
|
|
17246
17260
|
"../engine/dist/parsers/history-source.js"() {
|
|
@@ -17255,7 +17269,7 @@ var init_history_source = __esm({
|
|
|
17255
17269
|
if (historyPath) {
|
|
17256
17270
|
this.historyPaths = [historyPath];
|
|
17257
17271
|
} else {
|
|
17258
|
-
const home =
|
|
17272
|
+
const home = homedir11();
|
|
17259
17273
|
const paths = [];
|
|
17260
17274
|
const tryAdd = (p) => {
|
|
17261
17275
|
if (existsSync27(p) && !paths.includes(p))
|
|
@@ -17265,12 +17279,12 @@ var init_history_source = __esm({
|
|
|
17265
17279
|
try {
|
|
17266
17280
|
for (const entry of readdirSync21(home, { withFileTypes: true })) {
|
|
17267
17281
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
17268
|
-
tryAdd(
|
|
17282
|
+
tryAdd(join30(home, entry.name, "history.jsonl"));
|
|
17269
17283
|
}
|
|
17270
17284
|
}
|
|
17271
17285
|
} catch {
|
|
17272
17286
|
}
|
|
17273
|
-
this.historyPaths = paths.length > 0 ? paths : [
|
|
17287
|
+
this.historyPaths = paths.length > 0 ? paths : [join30(home, ".claude", "history.jsonl")];
|
|
17274
17288
|
}
|
|
17275
17289
|
}
|
|
17276
17290
|
async *discover() {
|
|
@@ -17421,8 +17435,8 @@ var init_history_source = __esm({
|
|
|
17421
17435
|
|
|
17422
17436
|
// ../engine/dist/parsers/paste-source.js
|
|
17423
17437
|
import { existsSync as existsSync28, readdirSync as readdirSync22, readFileSync as readFileSync22, statSync as statSync27 } from "fs";
|
|
17424
|
-
import { homedir as
|
|
17425
|
-
import { join as
|
|
17438
|
+
import { homedir as homedir12 } from "os";
|
|
17439
|
+
import { join as join31, basename as basename17 } from "path";
|
|
17426
17440
|
var MAX_CHUNK_CHARS6, MAX_FILE_SIZE, PasteSource;
|
|
17427
17441
|
var init_paste_source = __esm({
|
|
17428
17442
|
"../engine/dist/parsers/paste-source.js"() {
|
|
@@ -17438,7 +17452,7 @@ var init_paste_source = __esm({
|
|
|
17438
17452
|
if (cacheDir) {
|
|
17439
17453
|
this.cacheDirs = [cacheDir];
|
|
17440
17454
|
} else {
|
|
17441
|
-
const home =
|
|
17455
|
+
const home = homedir12();
|
|
17442
17456
|
const dirs = [];
|
|
17443
17457
|
const tryAdd = (p) => {
|
|
17444
17458
|
if (existsSync28(p) && !dirs.includes(p))
|
|
@@ -17448,7 +17462,7 @@ var init_paste_source = __esm({
|
|
|
17448
17462
|
try {
|
|
17449
17463
|
for (const entry of readdirSync22(home, { withFileTypes: true })) {
|
|
17450
17464
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
17451
|
-
tryAdd(
|
|
17465
|
+
tryAdd(join31(home, entry.name, "paste-cache"));
|
|
17452
17466
|
}
|
|
17453
17467
|
}
|
|
17454
17468
|
} catch {
|
|
@@ -17468,7 +17482,7 @@ var init_paste_source = __esm({
|
|
|
17468
17482
|
if (seen.has(file))
|
|
17469
17483
|
continue;
|
|
17470
17484
|
seen.add(file);
|
|
17471
|
-
const filePath =
|
|
17485
|
+
const filePath = join31(cacheDir, file);
|
|
17472
17486
|
try {
|
|
17473
17487
|
const stat3 = statSync27(filePath);
|
|
17474
17488
|
if (stat3.size > MAX_FILE_SIZE)
|
|
@@ -17521,7 +17535,7 @@ var init_paste_source = __esm({
|
|
|
17521
17535
|
|
|
17522
17536
|
// ../engine/dist/parsers/antigravity-brain-source.js
|
|
17523
17537
|
import { existsSync as existsSync29, readdirSync as readdirSync23, readFileSync as readFileSync23, statSync as statSync28 } from "fs";
|
|
17524
|
-
import { join as
|
|
17538
|
+
import { join as join32 } from "path";
|
|
17525
17539
|
var MAX_CHUNK_CHARS7, AntigravityBrainSource;
|
|
17526
17540
|
var init_antigravity_brain_source = __esm({
|
|
17527
17541
|
"../engine/dist/parsers/antigravity-brain-source.js"() {
|
|
@@ -17545,12 +17559,12 @@ var init_antigravity_brain_source = __esm({
|
|
|
17545
17559
|
for (const entry of sessions) {
|
|
17546
17560
|
if (!entry.isDirectory())
|
|
17547
17561
|
continue;
|
|
17548
|
-
const sessionDir =
|
|
17562
|
+
const sessionDir = join32(this.brainDir, entry.name);
|
|
17549
17563
|
const files = readdirSync23(sessionDir).filter((f) => f.endsWith(".md") && !f.includes(".resolved") && !f.includes(".metadata"));
|
|
17550
17564
|
if (files.length === 0)
|
|
17551
17565
|
continue;
|
|
17552
17566
|
for (const file of files) {
|
|
17553
|
-
const filePath =
|
|
17567
|
+
const filePath = join32(sessionDir, file);
|
|
17554
17568
|
try {
|
|
17555
17569
|
const stat3 = statSync28(filePath);
|
|
17556
17570
|
const content = readFileSync23(filePath, "utf-8");
|
|
@@ -17935,7 +17949,7 @@ var init_opencode_todo_source = __esm({
|
|
|
17935
17949
|
|
|
17936
17950
|
// ../engine/dist/parsers/codex-session-source.js
|
|
17937
17951
|
import { existsSync as existsSync32, readdirSync as readdirSync24, readFileSync as readFileSync24, statSync as statSync29 } from "fs";
|
|
17938
|
-
import { join as
|
|
17952
|
+
import { join as join33, basename as basename18 } from "path";
|
|
17939
17953
|
function getCodexSessionsDir() {
|
|
17940
17954
|
return codexBackend.sessionsDir();
|
|
17941
17955
|
}
|
|
@@ -18156,7 +18170,7 @@ var init_codex_session_source = __esm({
|
|
|
18156
18170
|
if (!existsSync32(dir))
|
|
18157
18171
|
return results;
|
|
18158
18172
|
for (const entry of readdirSync24(dir, { withFileTypes: true })) {
|
|
18159
|
-
const fullPath =
|
|
18173
|
+
const fullPath = join33(dir, entry.name);
|
|
18160
18174
|
if (entry.isDirectory()) {
|
|
18161
18175
|
results.push(...this.collectJsonlFiles(fullPath));
|
|
18162
18176
|
} else if (entry.isFile() && entry.name.startsWith("rollout-") && entry.name.endsWith(".jsonl")) {
|
|
@@ -18171,7 +18185,7 @@ var init_codex_session_source = __esm({
|
|
|
18171
18185
|
|
|
18172
18186
|
// ../engine/dist/parsers/diary-source.js
|
|
18173
18187
|
import { existsSync as existsSync33, mkdirSync as mkdirSync6, readdirSync as readdirSync25, readFileSync as readFileSync25, writeFileSync as writeFileSync5, statSync as statSync30 } from "fs";
|
|
18174
|
-
import { join as
|
|
18188
|
+
import { join as join34, basename as basename19 } from "path";
|
|
18175
18189
|
var MAX_CHUNK_CHARS10, DiarySource;
|
|
18176
18190
|
var init_diary_source = __esm({
|
|
18177
18191
|
"../engine/dist/parsers/diary-source.js"() {
|
|
@@ -18190,10 +18204,10 @@ var init_diary_source = __esm({
|
|
|
18190
18204
|
return;
|
|
18191
18205
|
const agents = readdirSync25(this.diaryDir, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
18192
18206
|
for (const agentDir of agents) {
|
|
18193
|
-
const agentPath2 =
|
|
18207
|
+
const agentPath2 = join34(this.diaryDir, agentDir.name);
|
|
18194
18208
|
const files = readdirSync25(agentPath2).filter((f) => f.endsWith(".json"));
|
|
18195
18209
|
for (const file of files) {
|
|
18196
|
-
const filePath =
|
|
18210
|
+
const filePath = join34(agentPath2, file);
|
|
18197
18211
|
try {
|
|
18198
18212
|
const stat3 = statSync30(filePath);
|
|
18199
18213
|
const raw = readFileSync25(filePath, "utf-8");
|
|
@@ -18260,13 +18274,13 @@ var init_diary_source = __esm({
|
|
|
18260
18274
|
*/
|
|
18261
18275
|
static write(entry, diaryDir) {
|
|
18262
18276
|
const dir = diaryDir || getDiaryDir();
|
|
18263
|
-
const agentDir =
|
|
18277
|
+
const agentDir = join34(dir, entry.agent.toLowerCase().replace(/[^a-z0-9_-]/g, "_"));
|
|
18264
18278
|
if (!existsSync33(agentDir)) {
|
|
18265
18279
|
mkdirSync6(agentDir, { recursive: true });
|
|
18266
18280
|
}
|
|
18267
18281
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
18268
18282
|
const entryId = `diary_${entry.agent.toLowerCase()}_${ts}`;
|
|
18269
|
-
const filePath =
|
|
18283
|
+
const filePath = join34(agentDir, `${entryId}.json`);
|
|
18270
18284
|
const full = {
|
|
18271
18285
|
...entry,
|
|
18272
18286
|
timestamp: entry.timestamp || (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -18279,14 +18293,14 @@ var init_diary_source = __esm({
|
|
|
18279
18293
|
*/
|
|
18280
18294
|
static read(agentName, lastN = 10, diaryDir) {
|
|
18281
18295
|
const dir = diaryDir || getDiaryDir();
|
|
18282
|
-
const agentDir =
|
|
18296
|
+
const agentDir = join34(dir, agentName.toLowerCase().replace(/[^a-z0-9_-]/g, "_"));
|
|
18283
18297
|
if (!existsSync33(agentDir))
|
|
18284
18298
|
return [];
|
|
18285
18299
|
const files = readdirSync25(agentDir).filter((f) => f.endsWith(".json")).sort().reverse().slice(0, lastN);
|
|
18286
18300
|
const entries = [];
|
|
18287
18301
|
for (const file of files) {
|
|
18288
18302
|
try {
|
|
18289
|
-
const raw = readFileSync25(
|
|
18303
|
+
const raw = readFileSync25(join34(agentDir, file), "utf-8");
|
|
18290
18304
|
entries.push(JSON.parse(raw));
|
|
18291
18305
|
} catch {
|
|
18292
18306
|
continue;
|
|
@@ -18332,8 +18346,8 @@ var init_redact_inline = __esm({
|
|
|
18332
18346
|
|
|
18333
18347
|
// ../engine/dist/parsers/skills-source.js
|
|
18334
18348
|
import { existsSync as existsSync34, readdirSync as readdirSync26, readFileSync as readFileSync26, statSync as statSync31 } from "fs";
|
|
18335
|
-
import { homedir as
|
|
18336
|
-
import { join as
|
|
18349
|
+
import { homedir as homedir13 } from "os";
|
|
18350
|
+
import { join as join35 } from "path";
|
|
18337
18351
|
function rebuildBody(content) {
|
|
18338
18352
|
const { text, redacted } = redactInlineSecrets(content);
|
|
18339
18353
|
const out = {};
|
|
@@ -18348,34 +18362,34 @@ function rebuildBody(content) {
|
|
|
18348
18362
|
return out;
|
|
18349
18363
|
}
|
|
18350
18364
|
function resolveRoots() {
|
|
18351
|
-
const home =
|
|
18365
|
+
const home = homedir13();
|
|
18352
18366
|
const all = [];
|
|
18353
18367
|
if (isSourceEnabled("shared", "skills")) {
|
|
18354
|
-
all.push({ path:
|
|
18368
|
+
all.push({ path: join35(home, ".agents", "skills"), tool: "shared" });
|
|
18355
18369
|
}
|
|
18356
18370
|
if (isSourceEnabled("claude", "skills")) {
|
|
18357
18371
|
all.push({ path: claudeBackend.skillsDir(), tool: "claude" });
|
|
18358
18372
|
}
|
|
18359
18373
|
if (isSourceEnabled("hermes", "skills")) {
|
|
18360
|
-
all.push({ path:
|
|
18374
|
+
all.push({ path: join35(hermesBackend.homeDir(), "skills"), tool: "hermes", nested: true });
|
|
18361
18375
|
}
|
|
18362
18376
|
if (isSourceEnabled("pi", "skills")) {
|
|
18363
18377
|
all.push({ path: piBackend.skillsDir(), tool: "pi" });
|
|
18364
18378
|
}
|
|
18365
18379
|
if (isSourceEnabled("agy", "skills")) {
|
|
18366
|
-
all.push({ path:
|
|
18380
|
+
all.push({ path: join35(agyBackend.homeDir(), "skills"), tool: "agy" });
|
|
18367
18381
|
all.push({ path: agyBackend.sharedSkillsDir(), tool: "agy" });
|
|
18368
18382
|
}
|
|
18369
18383
|
if (isSourceEnabled("opencode", "skills")) {
|
|
18370
|
-
all.push({ path:
|
|
18384
|
+
all.push({ path: join35(home, ".config", "opencode", "skills"), tool: "opencode" }, { path: join35(home, ".config", "opencode", "skill"), tool: "opencode" }, { path: join35(home, ".opencode", "skill"), tool: "opencode" }, { path: join35(home, ".opencode", "skills"), tool: "opencode" });
|
|
18371
18385
|
}
|
|
18372
18386
|
if (isSourceEnabled("codex", "skills")) {
|
|
18373
18387
|
all.push({ path: codexBackend.skillsDir(), tool: "codex", skipChildren: [".system"] });
|
|
18374
18388
|
all.push({ path: codexBackend.skillsSystemDir(), tool: "codex", readonly: true });
|
|
18375
18389
|
}
|
|
18376
18390
|
if (isSourceEnabled("cursor", "skills")) {
|
|
18377
|
-
all.push({ path:
|
|
18378
|
-
all.push({ path:
|
|
18391
|
+
all.push({ path: join35(cursorHomeDir(), "skills"), tool: "cursor" });
|
|
18392
|
+
all.push({ path: join35(cursorHomeDir(), "skills-cursor"), tool: "cursor", readonly: true });
|
|
18379
18393
|
}
|
|
18380
18394
|
return all.filter((r) => existsSync34(r.path));
|
|
18381
18395
|
}
|
|
@@ -18420,7 +18434,7 @@ var init_skills_source = __esm({
|
|
|
18420
18434
|
if (!isSourceEnabled("codex", "skills"))
|
|
18421
18435
|
return;
|
|
18422
18436
|
for (const { name: pluginName, dir } of codexBackend.installedPluginDirs()) {
|
|
18423
|
-
const skillsDir =
|
|
18437
|
+
const skillsDir = join35(dir, "skills");
|
|
18424
18438
|
if (!existsSync34(skillsDir))
|
|
18425
18439
|
continue;
|
|
18426
18440
|
yield* this.fromSkillRoot({ path: skillsDir, tool: "codex" }, pluginName);
|
|
@@ -18436,7 +18450,7 @@ var init_skills_source = __esm({
|
|
|
18436
18450
|
for (const name of entries) {
|
|
18437
18451
|
if (root.skipChildren?.includes(name))
|
|
18438
18452
|
continue;
|
|
18439
|
-
const skillDir =
|
|
18453
|
+
const skillDir = join35(root.path, name);
|
|
18440
18454
|
let st;
|
|
18441
18455
|
try {
|
|
18442
18456
|
st = statSync31(skillDir);
|
|
@@ -18445,7 +18459,7 @@ var init_skills_source = __esm({
|
|
|
18445
18459
|
}
|
|
18446
18460
|
if (!st.isDirectory())
|
|
18447
18461
|
continue;
|
|
18448
|
-
const skillMd =
|
|
18462
|
+
const skillMd = join35(skillDir, "SKILL.md");
|
|
18449
18463
|
if (!existsSync34(skillMd)) {
|
|
18450
18464
|
if (root.nested)
|
|
18451
18465
|
yield* this.fromSkillRoot({ ...root, path: skillDir, nested: false });
|
|
@@ -18467,7 +18481,7 @@ var init_skills_source = __esm({
|
|
|
18467
18481
|
const subdirs = {};
|
|
18468
18482
|
try {
|
|
18469
18483
|
for (const sub of readdirSync26(skillDir)) {
|
|
18470
|
-
const subPath =
|
|
18484
|
+
const subPath = join35(skillDir, sub);
|
|
18471
18485
|
try {
|
|
18472
18486
|
const ss = statSync31(subPath);
|
|
18473
18487
|
if (ss.isDirectory()) {
|
|
@@ -25870,9 +25884,9 @@ var require_dist = __commonJS({
|
|
|
25870
25884
|
|
|
25871
25885
|
// ../engine/dist/core/hermes-config.js
|
|
25872
25886
|
import { existsSync as existsSync35, readFileSync as readFileSync27 } from "fs";
|
|
25873
|
-
import { join as
|
|
25887
|
+
import { join as join36 } from "path";
|
|
25874
25888
|
function hermesConfigPath() {
|
|
25875
|
-
return
|
|
25889
|
+
return join36(hermesHomeDir(), "config.yaml");
|
|
25876
25890
|
}
|
|
25877
25891
|
function readHermesMcpServers(path = hermesConfigPath()) {
|
|
25878
25892
|
if (!existsSync35(path))
|
|
@@ -25929,8 +25943,8 @@ var init_hermes_config = __esm({
|
|
|
25929
25943
|
|
|
25930
25944
|
// ../engine/dist/parsers/mcps-source.js
|
|
25931
25945
|
import { existsSync as existsSync36, readFileSync as readFileSync28, statSync as statSync32 } from "fs";
|
|
25932
|
-
import { homedir as
|
|
25933
|
-
import { join as
|
|
25946
|
+
import { homedir as homedir14 } from "os";
|
|
25947
|
+
import { join as join37 } from "path";
|
|
25934
25948
|
function readJson(path) {
|
|
25935
25949
|
if (!existsSync36(path))
|
|
25936
25950
|
return null;
|
|
@@ -25996,24 +26010,24 @@ var init_mcps_source = __esm({
|
|
|
25996
26010
|
async *discover() {
|
|
25997
26011
|
if (!isSourceEnabled("common", "mcps"))
|
|
25998
26012
|
return;
|
|
25999
|
-
const home =
|
|
26000
|
-
yield* this.fromObject(readJson(
|
|
26013
|
+
const home = homedir14();
|
|
26014
|
+
yield* this.fromObject(readJson(join37(home, ".mcp.json"))?.mcpServers, {
|
|
26001
26015
|
tool: "claude",
|
|
26002
|
-
filePath:
|
|
26016
|
+
filePath: join37(home, ".mcp.json"),
|
|
26003
26017
|
scope: "global"
|
|
26004
26018
|
});
|
|
26005
|
-
yield* this.fromObject(readJson(
|
|
26019
|
+
yield* this.fromObject(readJson(join37(home, ".claude.json"))?.mcpServers, {
|
|
26006
26020
|
tool: "claude",
|
|
26007
|
-
filePath:
|
|
26021
|
+
filePath: join37(home, ".claude.json"),
|
|
26008
26022
|
scope: "user"
|
|
26009
26023
|
});
|
|
26010
26024
|
for (const path of [
|
|
26011
|
-
|
|
26012
|
-
|
|
26013
|
-
|
|
26014
|
-
|
|
26015
|
-
|
|
26016
|
-
|
|
26025
|
+
join37(home, ".config", "opencode", "opencode.json"),
|
|
26026
|
+
join37(home, ".config", "opencode", "opencode.jsonc"),
|
|
26027
|
+
join37(home, ".config", "opencode", "config.json"),
|
|
26028
|
+
join37(home, ".opencode", "opencode.json"),
|
|
26029
|
+
join37(home, ".opencode", "opencode.jsonc"),
|
|
26030
|
+
join37(home, ".opencode", "config.json")
|
|
26017
26031
|
]) {
|
|
26018
26032
|
yield* this.fromObject(readJson(path)?.mcp, {
|
|
26019
26033
|
tool: "opencode",
|
|
@@ -26028,7 +26042,7 @@ var init_mcps_source = __esm({
|
|
|
26028
26042
|
filePath: geminiSettings,
|
|
26029
26043
|
scope: "user"
|
|
26030
26044
|
});
|
|
26031
|
-
const cursorMcp =
|
|
26045
|
+
const cursorMcp = join37(cursorHomeDir(), "mcp.json");
|
|
26032
26046
|
yield* this.fromObject(readJson(cursorMcp)?.mcpServers, {
|
|
26033
26047
|
tool: "cursor",
|
|
26034
26048
|
filePath: cursorMcp,
|
|
@@ -26046,7 +26060,7 @@ var init_mcps_source = __esm({
|
|
|
26046
26060
|
filePath: piMcp,
|
|
26047
26061
|
scope: "user"
|
|
26048
26062
|
});
|
|
26049
|
-
const agyMcp =
|
|
26063
|
+
const agyMcp = join37(home, ".gemini", "config", "mcp_config.json");
|
|
26050
26064
|
yield* this.fromObject(readJson(agyMcp)?.mcpServers, {
|
|
26051
26065
|
tool: "agy",
|
|
26052
26066
|
filePath: agyMcp,
|
|
@@ -26054,7 +26068,7 @@ var init_mcps_source = __esm({
|
|
|
26054
26068
|
});
|
|
26055
26069
|
yield* this.fromCodexToml(codexBackend.configToml());
|
|
26056
26070
|
for (const { dir } of codexBackend.installedPluginDirs()) {
|
|
26057
|
-
const mcpPath =
|
|
26071
|
+
const mcpPath = join37(dir, ".mcp.json");
|
|
26058
26072
|
yield* this.fromObject(readJson(mcpPath)?.mcpServers, {
|
|
26059
26073
|
tool: "codex",
|
|
26060
26074
|
filePath: mcpPath,
|
|
@@ -26282,7 +26296,7 @@ var init_toolkit_format = __esm({
|
|
|
26282
26296
|
|
|
26283
26297
|
// ../engine/dist/parsers/slash-commands-source.js
|
|
26284
26298
|
import { existsSync as existsSync37, readdirSync as readdirSync27, readFileSync as readFileSync29, statSync as statSync33 } from "fs";
|
|
26285
|
-
import { join as
|
|
26299
|
+
import { join as join38, basename as basename20 } from "path";
|
|
26286
26300
|
function rebuildBody2(content) {
|
|
26287
26301
|
const { text, redacted } = redactInlineSecrets(content);
|
|
26288
26302
|
const out = {};
|
|
@@ -26341,7 +26355,7 @@ var init_slash_commands_source = __esm({
|
|
|
26341
26355
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
26342
26356
|
continue;
|
|
26343
26357
|
const projectPath = resolveProjectDirName(entry.name);
|
|
26344
|
-
const cmdDir =
|
|
26358
|
+
const cmdDir = join38(projectPath, ".claude", "commands");
|
|
26345
26359
|
if (existsSync37(cmdDir))
|
|
26346
26360
|
roots.push({ path: cmdDir, tool: "claude", scope: "project", projectPath, format: "md" });
|
|
26347
26361
|
}
|
|
@@ -26350,7 +26364,7 @@ var init_slash_commands_source = __esm({
|
|
|
26350
26364
|
}
|
|
26351
26365
|
}
|
|
26352
26366
|
if (isSourceEnabled("agy", "commands")) {
|
|
26353
|
-
roots.push({ path:
|
|
26367
|
+
roots.push({ path: join38(agyBackend.homeDir(), "commands"), tool: "agy", scope: "user", projectPath: "", format: "toml" });
|
|
26354
26368
|
roots.push({ path: agyBackend.sharedCommandsDir(), tool: "agy", scope: "user", projectPath: "", format: "toml" });
|
|
26355
26369
|
}
|
|
26356
26370
|
if (isSourceEnabled("opencode", "commands")) {
|
|
@@ -26360,7 +26374,7 @@ var init_slash_commands_source = __esm({
|
|
|
26360
26374
|
roots.push({ path: codexBackend.promptsDir(), tool: "codex", scope: "user", projectPath: "", format: "md" });
|
|
26361
26375
|
}
|
|
26362
26376
|
if (isSourceEnabled("cursor", "commands")) {
|
|
26363
|
-
roots.push({ path:
|
|
26377
|
+
roots.push({ path: join38(cursorHomeDir(), "commands"), tool: "cursor", scope: "user", projectPath: "", format: "md" });
|
|
26364
26378
|
}
|
|
26365
26379
|
if (isSourceEnabled("pi", "commands")) {
|
|
26366
26380
|
roots.push({ path: piBackend.promptsDir(), tool: "pi", scope: "user", projectPath: "", format: "md" });
|
|
@@ -26377,7 +26391,7 @@ var init_slash_commands_source = __esm({
|
|
|
26377
26391
|
continue;
|
|
26378
26392
|
}
|
|
26379
26393
|
for (const file of files) {
|
|
26380
|
-
const filePath =
|
|
26394
|
+
const filePath = join38(root.path, file);
|
|
26381
26395
|
try {
|
|
26382
26396
|
const stat3 = statSync33(filePath);
|
|
26383
26397
|
const content = readFileSync29(filePath, "utf-8");
|
|
@@ -26433,7 +26447,7 @@ var init_slash_commands_source = __esm({
|
|
|
26433
26447
|
|
|
26434
26448
|
// ../engine/dist/parsers/subagents-source.js
|
|
26435
26449
|
import { existsSync as existsSync38, readdirSync as readdirSync28, readFileSync as readFileSync30, statSync as statSync34 } from "fs";
|
|
26436
|
-
import { join as
|
|
26450
|
+
import { join as join39, basename as basename21 } from "path";
|
|
26437
26451
|
function rebuildBody3(content) {
|
|
26438
26452
|
const { text, redacted } = redactInlineSecrets(content);
|
|
26439
26453
|
const out = {};
|
|
@@ -26493,7 +26507,7 @@ var init_subagents_source = __esm({
|
|
|
26493
26507
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
26494
26508
|
continue;
|
|
26495
26509
|
const projectPath = resolveProjectDirName(entry.name);
|
|
26496
|
-
const agentDir =
|
|
26510
|
+
const agentDir = join39(projectPath, ".claude", "agents");
|
|
26497
26511
|
if (existsSync38(agentDir))
|
|
26498
26512
|
roots.push({ path: agentDir, tool: "claude", scope: "project", projectPath, format: "md" });
|
|
26499
26513
|
}
|
|
@@ -26502,7 +26516,7 @@ var init_subagents_source = __esm({
|
|
|
26502
26516
|
}
|
|
26503
26517
|
}
|
|
26504
26518
|
if (isSourceEnabled("agy", "agents")) {
|
|
26505
|
-
roots.push({ path:
|
|
26519
|
+
roots.push({ path: join39(agyBackend.homeDir(), "agents"), tool: "agy", scope: "user", projectPath: "", format: "md" });
|
|
26506
26520
|
roots.push({ path: agyBackend.sharedAgentsDir(), tool: "agy", scope: "user", projectPath: "", format: "md" });
|
|
26507
26521
|
}
|
|
26508
26522
|
if (isSourceEnabled("opencode", "agents")) {
|
|
@@ -26512,7 +26526,7 @@ var init_subagents_source = __esm({
|
|
|
26512
26526
|
roots.push({ path: codexBackend.agentsDir(), tool: "codex", scope: "user", projectPath: "", format: "toml" });
|
|
26513
26527
|
}
|
|
26514
26528
|
if (isSourceEnabled("cursor", "agents")) {
|
|
26515
|
-
roots.push({ path:
|
|
26529
|
+
roots.push({ path: join39(cursorHomeDir(), "agents"), tool: "cursor", scope: "user", projectPath: "", format: "md" });
|
|
26516
26530
|
}
|
|
26517
26531
|
return roots;
|
|
26518
26532
|
}
|
|
@@ -26526,7 +26540,7 @@ var init_subagents_source = __esm({
|
|
|
26526
26540
|
continue;
|
|
26527
26541
|
}
|
|
26528
26542
|
for (const file of files) {
|
|
26529
|
-
const filePath =
|
|
26543
|
+
const filePath = join39(root.path, file);
|
|
26530
26544
|
try {
|
|
26531
26545
|
const stat3 = statSync34(filePath);
|
|
26532
26546
|
const content = readFileSync30(filePath, "utf-8");
|
|
@@ -26583,7 +26597,7 @@ var init_subagents_source = __esm({
|
|
|
26583
26597
|
|
|
26584
26598
|
// ../engine/dist/parsers/hooks-source.js
|
|
26585
26599
|
import { existsSync as existsSync39, readFileSync as readFileSync31, readdirSync as readdirSync29, statSync as statSync35 } from "fs";
|
|
26586
|
-
import { join as
|
|
26600
|
+
import { join as join40 } from "path";
|
|
26587
26601
|
function readJson2(path) {
|
|
26588
26602
|
if (!existsSync39(path))
|
|
26589
26603
|
return null;
|
|
@@ -26613,7 +26627,7 @@ var init_hooks_source = __esm({
|
|
|
26613
26627
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
26614
26628
|
continue;
|
|
26615
26629
|
const projectPath = resolveProjectDirName(entry.name);
|
|
26616
|
-
const settingsPath2 =
|
|
26630
|
+
const settingsPath2 = join40(projectPath, ".claude", "settings.json");
|
|
26617
26631
|
if (existsSync39(settingsPath2)) {
|
|
26618
26632
|
yield* this.fromSettings(settingsPath2, "project", projectPath);
|
|
26619
26633
|
}
|
|
@@ -26706,8 +26720,8 @@ var init_hooks_source = __esm({
|
|
|
26706
26720
|
|
|
26707
26721
|
// ../engine/dist/parsers/plugins-source.js
|
|
26708
26722
|
import { existsSync as existsSync40, readFileSync as readFileSync32, readdirSync as readdirSync30, statSync as statSync36 } from "fs";
|
|
26709
|
-
import { homedir as
|
|
26710
|
-
import { join as
|
|
26723
|
+
import { homedir as homedir15 } from "os";
|
|
26724
|
+
import { join as join41 } from "path";
|
|
26711
26725
|
function readJson3(path) {
|
|
26712
26726
|
if (!existsSync40(path))
|
|
26713
26727
|
return null;
|
|
@@ -26728,7 +26742,7 @@ var init_plugins_source = __esm({
|
|
|
26728
26742
|
PluginsSource = class {
|
|
26729
26743
|
sourceType = "plugin";
|
|
26730
26744
|
async *discover() {
|
|
26731
|
-
const home =
|
|
26745
|
+
const home = homedir15();
|
|
26732
26746
|
const claudePluginsManifest = claudeBackend.pluginsManifestPath();
|
|
26733
26747
|
const claudeJson = isSourceEnabled("claude", "plugins") ? readJson3(claudePluginsManifest) : null;
|
|
26734
26748
|
if (claudeJson?.plugins && typeof claudeJson.plugins === "object") {
|
|
@@ -26772,7 +26786,7 @@ var init_plugins_source = __esm({
|
|
|
26772
26786
|
entries = [];
|
|
26773
26787
|
}
|
|
26774
26788
|
for (const name of entries) {
|
|
26775
|
-
const dir =
|
|
26789
|
+
const dir = join41(gemRoot, name);
|
|
26776
26790
|
let st;
|
|
26777
26791
|
try {
|
|
26778
26792
|
st = statSync36(dir);
|
|
@@ -26781,7 +26795,7 @@ var init_plugins_source = __esm({
|
|
|
26781
26795
|
}
|
|
26782
26796
|
if (!st.isDirectory())
|
|
26783
26797
|
continue;
|
|
26784
|
-
const manifestPath =
|
|
26798
|
+
const manifestPath = join41(dir, "gemini-extension.json");
|
|
26785
26799
|
const manifest = readJson3(manifestPath);
|
|
26786
26800
|
if (!manifest || typeof manifest !== "object")
|
|
26787
26801
|
continue;
|
|
@@ -26821,11 +26835,11 @@ var init_plugins_source = __esm({
|
|
|
26821
26835
|
}
|
|
26822
26836
|
if (!st.isDirectory())
|
|
26823
26837
|
continue;
|
|
26824
|
-
const appJson = readJson3(
|
|
26825
|
-
const pluginJson = readJson3(
|
|
26838
|
+
const appJson = readJson3(join41(pluginDir, ".codex-plugin", ".app.json"));
|
|
26839
|
+
const pluginJson = readJson3(join41(pluginDir, ".codex-plugin", "plugin.json"));
|
|
26826
26840
|
const manifest = pluginJson || appJson || {};
|
|
26827
26841
|
let mcpServers = [];
|
|
26828
|
-
const mcpJson = readJson3(
|
|
26842
|
+
const mcpJson = readJson3(join41(pluginDir, ".mcp.json"));
|
|
26829
26843
|
if (mcpJson?.mcpServers)
|
|
26830
26844
|
mcpServers = Object.keys(mcpJson.mcpServers);
|
|
26831
26845
|
yield {
|
|
@@ -26833,7 +26847,7 @@ var init_plugins_source = __esm({
|
|
|
26833
26847
|
sourceType: "plugin",
|
|
26834
26848
|
title: manifest.name || name,
|
|
26835
26849
|
projectPath: "",
|
|
26836
|
-
filePath:
|
|
26850
|
+
filePath: join41(pluginDir, ".codex-plugin"),
|
|
26837
26851
|
mtime: st.mtimeMs,
|
|
26838
26852
|
contentPreview: (manifest.description || "").slice(0, 300),
|
|
26839
26853
|
extra: {
|
|
@@ -27006,7 +27020,7 @@ __export(sync_ledger_exports, {
|
|
|
27006
27020
|
unackedCursorAttemptCount: () => unackedCursorAttemptCount
|
|
27007
27021
|
});
|
|
27008
27022
|
import { readFileSync as readFileSync33, writeFileSync as writeFileSync6, renameSync as renameSync4, mkdirSync as mkdirSync7, statSync as statSync37 } from "node:fs";
|
|
27009
|
-
import { join as
|
|
27023
|
+
import { join as join42, dirname as dirname16 } from "node:path";
|
|
27010
27024
|
function toRow(entry) {
|
|
27011
27025
|
if (entry === void 0) return void 0;
|
|
27012
27026
|
return typeof entry === "number" ? { m: entry, v: 0 } : entry;
|
|
@@ -27359,7 +27373,7 @@ var init_sync_ledger = __esm({
|
|
|
27359
27373
|
"use strict";
|
|
27360
27374
|
init_paths();
|
|
27361
27375
|
init_extractor_version();
|
|
27362
|
-
ledgerPath = () =>
|
|
27376
|
+
ledgerPath = () => join42(getDataDir(), "sync-ledger.json");
|
|
27363
27377
|
cache3 = null;
|
|
27364
27378
|
base = /* @__PURE__ */ new Map();
|
|
27365
27379
|
diskStamp = null;
|
|
@@ -27367,11 +27381,11 @@ var init_sync_ledger = __esm({
|
|
|
27367
27381
|
LEDGER_FLUSH_MS = 2e3;
|
|
27368
27382
|
pendingWrite = false;
|
|
27369
27383
|
flushTimer = null;
|
|
27370
|
-
itemVersionsPath = () =>
|
|
27384
|
+
itemVersionsPath = () => join42(getDataDir(), "item-versions.json");
|
|
27371
27385
|
itemVersionsCache = null;
|
|
27372
|
-
inventoryPath = () =>
|
|
27386
|
+
inventoryPath = () => join42(getDataDir(), "toolkit-inventory.json");
|
|
27373
27387
|
unackedCursorAttempts = 0;
|
|
27374
|
-
reconcilePath = () =>
|
|
27388
|
+
reconcilePath = () => join42(getDataDir(), "sync-field-reconcile.json");
|
|
27375
27389
|
reconcileCache = null;
|
|
27376
27390
|
SETTLE_QUIET_MS = 2 * 60 * 60 * 1e3;
|
|
27377
27391
|
}
|
|
@@ -27404,7 +27418,7 @@ var init_sync_fields = __esm({
|
|
|
27404
27418
|
|
|
27405
27419
|
// ../engine/dist/core/index-lock.js
|
|
27406
27420
|
import { existsSync as existsSync41, mkdirSync as mkdirSync8, openSync as openSync9, writeFileSync as writeFileSync7, readFileSync as readFileSync34, rmSync as rmSync4, statSync as statSync38, closeSync as closeSync9 } from "fs";
|
|
27407
|
-
import { dirname as dirname17, join as
|
|
27421
|
+
import { dirname as dirname17, join as join43 } from "path";
|
|
27408
27422
|
function acquireIndexLock(opts) {
|
|
27409
27423
|
const lockPath = lockFilePath(opts.file);
|
|
27410
27424
|
mkdirSync8(dirname17(lockPath), { recursive: true });
|
|
@@ -27449,7 +27463,7 @@ function acquireIndexLock(opts) {
|
|
|
27449
27463
|
};
|
|
27450
27464
|
}
|
|
27451
27465
|
function lockFilePath(file = ".compact.lock") {
|
|
27452
|
-
return
|
|
27466
|
+
return join43(getIndexDir(), file);
|
|
27453
27467
|
}
|
|
27454
27468
|
function stealStaleLock(lockPath, staleAfterMs) {
|
|
27455
27469
|
try {
|
|
@@ -27516,7 +27530,7 @@ var init_http = __esm({
|
|
|
27516
27530
|
CLI_VERSION = JSON.parse(readFileSync35(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
|
|
27517
27531
|
} catch {
|
|
27518
27532
|
try {
|
|
27519
|
-
if (true) CLI_VERSION = "0.7.
|
|
27533
|
+
if (true) CLI_VERSION = "0.7.23";
|
|
27520
27534
|
} catch {
|
|
27521
27535
|
}
|
|
27522
27536
|
}
|
|
@@ -28010,7 +28024,7 @@ var init_telemetry = __esm({
|
|
|
28010
28024
|
init_sync_client();
|
|
28011
28025
|
cliVersion = () => {
|
|
28012
28026
|
try {
|
|
28013
|
-
return true ? "0.7.
|
|
28027
|
+
return true ? "0.7.23" : "dev";
|
|
28014
28028
|
} catch {
|
|
28015
28029
|
return "dev";
|
|
28016
28030
|
}
|
|
@@ -28023,7 +28037,7 @@ var init_telemetry = __esm({
|
|
|
28023
28037
|
// src/raw-archive-parts.ts
|
|
28024
28038
|
import { createReadStream as createReadStream4, createWriteStream, openSync as openSync10, readSync as readSync9, closeSync as closeSync10, rmSync as rmSync5, statSync as statSync39 } from "node:fs";
|
|
28025
28039
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
28026
|
-
import { join as
|
|
28040
|
+
import { join as join44 } from "node:path";
|
|
28027
28041
|
import { randomBytes } from "node:crypto";
|
|
28028
28042
|
import { createGzip as createGzip2 } from "node:zlib";
|
|
28029
28043
|
import { once } from "node:events";
|
|
@@ -28053,7 +28067,7 @@ function* textLines(text) {
|
|
|
28053
28067
|
}
|
|
28054
28068
|
}
|
|
28055
28069
|
async function writeArchiveFile(source, meta, redact, dir = tmpdir2()) {
|
|
28056
|
-
const path =
|
|
28070
|
+
const path = join44(dir, `cr-archive-${randomBytes(8).toString("hex")}.json.gz`);
|
|
28057
28071
|
const gzip = createGzip2({ level: 6 });
|
|
28058
28072
|
const out = createWriteStream(path, { mode: 384 });
|
|
28059
28073
|
const done = once(out, "finish");
|
|
@@ -28393,8 +28407,8 @@ import { execSync as execSync2, execFileSync as execFileSync3 } from "node:child
|
|
|
28393
28407
|
import { readFileSync as readFileSync38, existsSync as existsSync43 } from "node:fs";
|
|
28394
28408
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
28395
28409
|
import { writeFileSync as writeFileSync8, mkdtempSync as mkdtempSync3, rmSync as rmSync6, readdirSync as readdirSync31, statSync as statSync40, mkdirSync as mkdirSync9 } from "node:fs";
|
|
28396
|
-
import { join as
|
|
28397
|
-
import { tmpdir as tmpdir3, homedir as
|
|
28410
|
+
import { join as join45, dirname as dirname18, sep as sep2, posix as pathPosix, win32 as pathWin32 } from "node:path";
|
|
28411
|
+
import { tmpdir as tmpdir3, homedir as homedir16 } from "node:os";
|
|
28398
28412
|
import { createHash as createHash8 } from "node:crypto";
|
|
28399
28413
|
function compareVersions(a, b) {
|
|
28400
28414
|
const pa = String(a).split("-")[0].split(".").map((n) => parseInt(n, 10) || 0);
|
|
@@ -28418,7 +28432,7 @@ function newerOf(a, b) {
|
|
|
28418
28432
|
function installedVersion() {
|
|
28419
28433
|
try {
|
|
28420
28434
|
const here = dirname18(fileURLToPath2(import.meta.url));
|
|
28421
|
-
const raw = readFileSync38(
|
|
28435
|
+
const raw = readFileSync38(join45(here, "..", "package.json"), "utf-8");
|
|
28422
28436
|
return JSON.parse(raw).version || null;
|
|
28423
28437
|
} catch {
|
|
28424
28438
|
return null;
|
|
@@ -28443,7 +28457,7 @@ function sweepStaleStaging(root = tmpdir3(), now = Date.now()) {
|
|
|
28443
28457
|
}
|
|
28444
28458
|
for (const name of entries) {
|
|
28445
28459
|
if (!MKDTEMP_SUFFIX.test(name)) continue;
|
|
28446
|
-
const dir =
|
|
28460
|
+
const dir = join45(root, name);
|
|
28447
28461
|
try {
|
|
28448
28462
|
const st = statSync40(dir);
|
|
28449
28463
|
if (!st.isDirectory() || now - st.mtimeMs < COLD_MS) continue;
|
|
@@ -28472,14 +28486,14 @@ async function executeAutoUpdate(plan, deps) {
|
|
|
28472
28486
|
}
|
|
28473
28487
|
const got = createHash8("sha256").update(buf).digest("hex");
|
|
28474
28488
|
if (got !== plan.sha256) return { updated: false, reason: `checksum mismatch (expected ${plan.sha256.slice(0, 12)}\u2026, got ${got.slice(0, 12)}\u2026) \u2014 NOT installing` };
|
|
28475
|
-
const dir = mkdtempSync3(
|
|
28489
|
+
const dir = mkdtempSync3(join45(tmpdir3(), "cr-update-"));
|
|
28476
28490
|
const discardStaging = () => {
|
|
28477
28491
|
try {
|
|
28478
28492
|
rmSync6(dir, { recursive: true, force: true });
|
|
28479
28493
|
} catch {
|
|
28480
28494
|
}
|
|
28481
28495
|
};
|
|
28482
|
-
const tgz =
|
|
28496
|
+
const tgz = join45(dir, "chat-recall.tgz");
|
|
28483
28497
|
writeFileSync8(tgz, buf);
|
|
28484
28498
|
if (deps.stopping?.()) {
|
|
28485
28499
|
discardStaging();
|
|
@@ -28559,7 +28573,7 @@ function realInstall(tgz) {
|
|
|
28559
28573
|
try {
|
|
28560
28574
|
npmInstall(npm, ["install", "-g", tgz]);
|
|
28561
28575
|
} catch {
|
|
28562
|
-
npmInstall(npm, ["install", "-g", "--prefix",
|
|
28576
|
+
npmInstall(npm, ["install", "-g", "--prefix", join45(homedir16(), ".local"), tgz]);
|
|
28563
28577
|
}
|
|
28564
28578
|
}
|
|
28565
28579
|
function acquireUpdateLock() {
|
|
@@ -28576,8 +28590,8 @@ function realRestart(platform2) {
|
|
|
28576
28590
|
if (c) execSync2(c.cmd, { stdio: "ignore", ...c.shell ? { shell: c.shell } : {} });
|
|
28577
28591
|
}
|
|
28578
28592
|
function updateStatePath() {
|
|
28579
|
-
const dir = process.env.CHAT_RECALL_DATA_DIR ||
|
|
28580
|
-
return
|
|
28593
|
+
const dir = process.env.CHAT_RECALL_DATA_DIR || join45(homedir16(), ".chat-recall");
|
|
28594
|
+
return join45(dir, "auto-update-state.json");
|
|
28581
28595
|
}
|
|
28582
28596
|
function readUpdateState() {
|
|
28583
28597
|
try {
|
|
@@ -28688,7 +28702,7 @@ var init_auto_update = __esm({
|
|
|
28688
28702
|
});
|
|
28689
28703
|
|
|
28690
28704
|
// src/sync-client.ts
|
|
28691
|
-
import { join as
|
|
28705
|
+
import { join as join46, dirname as dirname19, basename as basename22 } from "node:path";
|
|
28692
28706
|
import { readFileSync as readFileSync39, writeFileSync as writeFileSync9, mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync4, rmSync as rmSync7, chmodSync as chmodSync3, unlinkSync as unlinkSync2, readdirSync as readdirSync32, statSync as statSync41 } from "node:fs";
|
|
28693
28707
|
import { tmpdir as tmpdir4, hostname as hostname2 } from "node:os";
|
|
28694
28708
|
import { createHash as createHash9 } from "node:crypto";
|
|
@@ -28785,7 +28799,7 @@ async function fetchTenantSecurityConfig(cred) {
|
|
|
28785
28799
|
}
|
|
28786
28800
|
}
|
|
28787
28801
|
function syncConfigCachePath() {
|
|
28788
|
-
return
|
|
28802
|
+
return join46(getDataDir(), "sync-config-cache.json");
|
|
28789
28803
|
}
|
|
28790
28804
|
function readPersistedSyncConfigs() {
|
|
28791
28805
|
try {
|
|
@@ -29042,7 +29056,7 @@ function reapStaleScanDirs(dir = tmpdir4(), maxAgeMs = 6 * 36e5, now = Date.now(
|
|
|
29042
29056
|
}
|
|
29043
29057
|
for (const name of names) {
|
|
29044
29058
|
if (!name.startsWith("cr-batchscan-")) continue;
|
|
29045
|
-
const p =
|
|
29059
|
+
const p = join46(dir, name);
|
|
29046
29060
|
try {
|
|
29047
29061
|
if (now - statSync41(p).mtimeMs < maxAgeMs) continue;
|
|
29048
29062
|
rmSync7(p, { recursive: true, force: true });
|
|
@@ -29059,7 +29073,7 @@ function batchScanExternal(items, opts = {}) {
|
|
|
29059
29073
|
let scanned = 0, slices = 0, scanMs = 0;
|
|
29060
29074
|
if (items.length === 0) return { findings, scanned, slices, scanMs };
|
|
29061
29075
|
reapStaleScanDirs();
|
|
29062
|
-
let scanDir = mkdtempSync4(
|
|
29076
|
+
let scanDir = mkdtempSync4(join46(tmpdir4(), "cr-batchscan-"));
|
|
29063
29077
|
let safeToId = /* @__PURE__ */ new Map();
|
|
29064
29078
|
let bytesInDir = 0;
|
|
29065
29079
|
const flushSlice = () => {
|
|
@@ -29090,13 +29104,13 @@ function batchScanExternal(items, opts = {}) {
|
|
|
29090
29104
|
if (raw === null) continue;
|
|
29091
29105
|
const safe = item.id.replace(/[^A-Za-z0-9_-]/g, "");
|
|
29092
29106
|
safeToId.set(safe, item.id);
|
|
29093
|
-
writeFileSync9(
|
|
29107
|
+
writeFileSync9(join46(scanDir, `${safe}.txt`), raw);
|
|
29094
29108
|
bytesInDir += Buffer.byteLength(raw);
|
|
29095
29109
|
} catch {
|
|
29096
29110
|
}
|
|
29097
29111
|
if (bytesInDir >= maxBytes) {
|
|
29098
29112
|
flushSlice();
|
|
29099
|
-
scanDir = mkdtempSync4(
|
|
29113
|
+
scanDir = mkdtempSync4(join46(tmpdir4(), "cr-batchscan-"));
|
|
29100
29114
|
}
|
|
29101
29115
|
}
|
|
29102
29116
|
flushSlice();
|
|
@@ -30095,7 +30109,7 @@ async function buildConversationSync(ref, mtime, opts = {}) {
|
|
|
30095
30109
|
} else if (opts.scanSecrets) {
|
|
30096
30110
|
let tmp = null;
|
|
30097
30111
|
try {
|
|
30098
|
-
tmp =
|
|
30112
|
+
tmp = join46(tmpdir4(), `cr-scan-${ref.prefixedId.replace(/[^A-Za-z0-9_-]/g, "")}-${mtime}.txt`);
|
|
30099
30113
|
writeFileSync9(tmp, rawText);
|
|
30100
30114
|
for (const f of scanFileForSecrets(tmp, { verifyOnly: opts.verifySecrets, tenantRules: opts.tenantRules })) {
|
|
30101
30115
|
const verifiedAt = f.verified ? (/* @__PURE__ */ new Date()).toISOString() : null;
|
|
@@ -30372,10 +30386,10 @@ var init_sync_client = __esm({
|
|
|
30372
30386
|
ownVersion = "0.0.0";
|
|
30373
30387
|
try {
|
|
30374
30388
|
const dir = dirname19(fileURLToPath3(import.meta.url));
|
|
30375
|
-
ownVersion = JSON.parse(readFileSync39(
|
|
30389
|
+
ownVersion = JSON.parse(readFileSync39(join46(dir, "../package.json"), "utf-8")).version || ownVersion;
|
|
30376
30390
|
} catch {
|
|
30377
30391
|
try {
|
|
30378
|
-
if (true) ownVersion = "0.7.
|
|
30392
|
+
if (true) ownVersion = "0.7.23";
|
|
30379
30393
|
} catch {
|
|
30380
30394
|
}
|
|
30381
30395
|
}
|
|
@@ -30387,7 +30401,7 @@ var init_sync_client = __esm({
|
|
|
30387
30401
|
]);
|
|
30388
30402
|
walkProgressForUpload = null;
|
|
30389
30403
|
lastServerPackSpec = null;
|
|
30390
|
-
credPath = () =>
|
|
30404
|
+
credPath = () => join46(getDataDir(), "credentials.json");
|
|
30391
30405
|
_securityConfigCache = /* @__PURE__ */ new Map();
|
|
30392
30406
|
SECURITY_CONFIG_TTL_MS = 5 * 60 * 1e3;
|
|
30393
30407
|
_syncConfigCache = /* @__PURE__ */ new Map();
|
|
@@ -30411,8 +30425,8 @@ var init_sync_client = __esm({
|
|
|
30411
30425
|
|
|
30412
30426
|
// ../engine/dist/core/artifact-codec.js
|
|
30413
30427
|
import { readFileSync as readFileSync40 } from "fs";
|
|
30414
|
-
import { basename as basename23, join as
|
|
30415
|
-
import { homedir as
|
|
30428
|
+
import { basename as basename23, join as join47 } from "path";
|
|
30429
|
+
import { homedir as homedir17 } from "os";
|
|
30416
30430
|
function parseCommandText(content, format, fallbackName) {
|
|
30417
30431
|
if (format === "toml") {
|
|
30418
30432
|
const t = parseScalarToml(content);
|
|
@@ -30446,18 +30460,18 @@ function readInstructions(filePath, name) {
|
|
|
30446
30460
|
function commandPath(tool, name) {
|
|
30447
30461
|
switch (tool) {
|
|
30448
30462
|
case "claude":
|
|
30449
|
-
return
|
|
30463
|
+
return join47(claudeBackend.commandsDir(), `${name}.md`);
|
|
30450
30464
|
case "agy":
|
|
30451
|
-
return
|
|
30465
|
+
return join47(join47(agyBackend.homeDir(), "commands"), `${name}.toml`);
|
|
30452
30466
|
case "opencode":
|
|
30453
|
-
return
|
|
30467
|
+
return join47(opencodeBackend.commandsDir(), `${name}.md`);
|
|
30454
30468
|
case "codex":
|
|
30455
|
-
return
|
|
30469
|
+
return join47(codexBackend.promptsDir(), `${name}.md`);
|
|
30456
30470
|
case "cursor":
|
|
30457
|
-
return
|
|
30471
|
+
return join47(cursorHomeDir(), "commands", `${name}.md`);
|
|
30458
30472
|
// Pi's prompt templates are flat *.md files in the agent dir.
|
|
30459
30473
|
case "pi":
|
|
30460
|
-
return
|
|
30474
|
+
return join47(piBackend.promptsDir(), `${name}.md`);
|
|
30461
30475
|
// Hermes has no command files. copyArtifactToTool refuses this target first.
|
|
30462
30476
|
case "hermes":
|
|
30463
30477
|
throw new Error("Hermes has no command files");
|
|
@@ -30466,15 +30480,15 @@ function commandPath(tool, name) {
|
|
|
30466
30480
|
function agentPath(tool, name) {
|
|
30467
30481
|
switch (tool) {
|
|
30468
30482
|
case "claude":
|
|
30469
|
-
return
|
|
30483
|
+
return join47(claudeBackend.agentsDir(), `${name}.md`);
|
|
30470
30484
|
case "agy":
|
|
30471
|
-
return
|
|
30485
|
+
return join47(join47(agyBackend.homeDir(), "agents"), `${name}.md`);
|
|
30472
30486
|
case "opencode":
|
|
30473
|
-
return
|
|
30487
|
+
return join47(opencodeBackend.agentsDir(), `${name}.md`);
|
|
30474
30488
|
case "codex":
|
|
30475
|
-
return
|
|
30489
|
+
return join47(codexBackend.agentsDir(), `${name}.toml`);
|
|
30476
30490
|
case "cursor":
|
|
30477
|
-
return
|
|
30491
|
+
return join47(cursorHomeDir(), "agents", `${name}.md`);
|
|
30478
30492
|
// Pi has no named agent personas. copyArtifactToTool refuses this target first.
|
|
30479
30493
|
case "pi":
|
|
30480
30494
|
throw new Error("Pi has no agent files");
|
|
@@ -30511,23 +30525,23 @@ function instructionsFilename(tool) {
|
|
|
30511
30525
|
function instructionsPath(tool, projectPath) {
|
|
30512
30526
|
const file = instructionsFilename(tool);
|
|
30513
30527
|
if (projectPath)
|
|
30514
|
-
return
|
|
30528
|
+
return join47(projectPath, file);
|
|
30515
30529
|
switch (tool) {
|
|
30516
30530
|
case "claude":
|
|
30517
|
-
return
|
|
30531
|
+
return join47(claudeBackend.homeDir(), file);
|
|
30518
30532
|
case "agy":
|
|
30519
|
-
return
|
|
30533
|
+
return join47(agyBackend.homeDir(), file);
|
|
30520
30534
|
case "codex":
|
|
30521
|
-
return
|
|
30535
|
+
return join47(codexBackend.homeDir(), file);
|
|
30522
30536
|
case "opencode":
|
|
30523
|
-
return
|
|
30537
|
+
return join47(homedir17(), ".config", "opencode", file);
|
|
30524
30538
|
// Cursor has no single user-scope instructions FILE — user-level guidance
|
|
30525
30539
|
// is User Rules plus ~/.cursor/rules/*.mdc. AGENTS.md at the home root is
|
|
30526
30540
|
// the closest equivalent and is what a mirror can actually write.
|
|
30527
30541
|
case "cursor":
|
|
30528
|
-
return
|
|
30542
|
+
return join47(cursorHomeDir(), file);
|
|
30529
30543
|
case "pi":
|
|
30530
|
-
return
|
|
30544
|
+
return join47(piBackend.homeDir(), file);
|
|
30531
30545
|
case "hermes":
|
|
30532
30546
|
throw new Error("Hermes has no instruction file mapping");
|
|
30533
30547
|
}
|
|
@@ -30577,8 +30591,8 @@ var init_artifact_codec = __esm({
|
|
|
30577
30591
|
|
|
30578
30592
|
// ../engine/dist/core/toolkit-sync.js
|
|
30579
30593
|
import { existsSync as existsSync44, mkdirSync as mkdirSync11, readFileSync as readFileSync41, readdirSync as readdirSync33, writeFileSync as writeFileSync10, cpSync, rmSync as rmSync8 } from "fs";
|
|
30580
|
-
import { dirname as dirname20, join as
|
|
30581
|
-
import { homedir as
|
|
30594
|
+
import { dirname as dirname20, join as join48, basename as basename24 } from "path";
|
|
30595
|
+
import { homedir as homedir18 } from "os";
|
|
30582
30596
|
function rowFromMemoryItem(type, item) {
|
|
30583
30597
|
const extra = item.extra || {};
|
|
30584
30598
|
return {
|
|
@@ -30598,16 +30612,16 @@ function skillsDirFor(tool) {
|
|
|
30598
30612
|
case "claude":
|
|
30599
30613
|
return claudeBackend.skillsDir();
|
|
30600
30614
|
case "agy":
|
|
30601
|
-
return
|
|
30615
|
+
return join48(agyBackend.homeDir(), "skills");
|
|
30602
30616
|
case "opencode":
|
|
30603
30617
|
return opencodeBackend.skillsDir();
|
|
30604
30618
|
case "codex":
|
|
30605
30619
|
return codexBackend.skillsDir();
|
|
30606
30620
|
// user skills, NOT .system
|
|
30607
30621
|
case "cursor":
|
|
30608
|
-
return
|
|
30622
|
+
return join48(cursorHomeDir(), "skills");
|
|
30609
30623
|
case "hermes":
|
|
30610
|
-
return
|
|
30624
|
+
return join48(hermesBackend.homeDir(), "skills");
|
|
30611
30625
|
case "pi":
|
|
30612
30626
|
return piBackend.skillsDir();
|
|
30613
30627
|
}
|
|
@@ -30615,13 +30629,13 @@ function skillsDirFor(tool) {
|
|
|
30615
30629
|
function skillDirsNamed(tool, name) {
|
|
30616
30630
|
const root = skillsDirFor(tool);
|
|
30617
30631
|
const found = [];
|
|
30618
|
-
if (existsSync44(
|
|
30619
|
-
found.push(
|
|
30632
|
+
if (existsSync44(join48(root, name)))
|
|
30633
|
+
found.push(join48(root, name));
|
|
30620
30634
|
if (tool !== "hermes" || !existsSync44(root))
|
|
30621
30635
|
return found;
|
|
30622
30636
|
for (const category of readdirSync33(root)) {
|
|
30623
|
-
const candidate =
|
|
30624
|
-
if (existsSync44(
|
|
30637
|
+
const candidate = join48(root, category, name);
|
|
30638
|
+
if (existsSync44(join48(candidate, "SKILL.md")))
|
|
30625
30639
|
found.push(candidate);
|
|
30626
30640
|
}
|
|
30627
30641
|
return found;
|
|
@@ -30631,7 +30645,7 @@ function copySkill(row, toTool) {
|
|
|
30631
30645
|
if (!existsSync44(skillDir))
|
|
30632
30646
|
return { ok: false, status: 404, error: `Source dir missing: ${skillDir}` };
|
|
30633
30647
|
const name = row.extra.skillName || basename24(skillDir);
|
|
30634
|
-
const targetDir =
|
|
30648
|
+
const targetDir = join48(skillsDirFor(toTool), name);
|
|
30635
30649
|
const existing = skillDirsNamed(toTool, name);
|
|
30636
30650
|
if (existing.length)
|
|
30637
30651
|
return { ok: false, status: 409, error: `Already exists: ${existing[0]}` };
|
|
@@ -30644,26 +30658,26 @@ function copySkill(row, toTool) {
|
|
|
30644
30658
|
}
|
|
30645
30659
|
}
|
|
30646
30660
|
function mcpJsonCandidates(tool) {
|
|
30647
|
-
const home =
|
|
30661
|
+
const home = homedir18();
|
|
30648
30662
|
switch (tool) {
|
|
30649
30663
|
case "claude":
|
|
30650
30664
|
return [
|
|
30651
|
-
{ path:
|
|
30652
|
-
{ path:
|
|
30665
|
+
{ path: join48(home, ".mcp.json"), key: "mcpServers" },
|
|
30666
|
+
{ path: join48(home, ".claude.json"), key: "mcpServers" }
|
|
30653
30667
|
];
|
|
30654
30668
|
case "gemini":
|
|
30655
|
-
return [{ path:
|
|
30669
|
+
return [{ path: join48(home, ".gemini", "settings.json"), key: "mcpServers" }];
|
|
30656
30670
|
case "agy":
|
|
30657
|
-
return [{ path:
|
|
30671
|
+
return [{ path: join48(home, ".gemini", "config", "mcp_config.json"), key: "mcpServers" }];
|
|
30658
30672
|
case "cursor":
|
|
30659
|
-
return [{ path:
|
|
30673
|
+
return [{ path: join48(cursorHomeDir(), "mcp.json"), key: "mcpServers" }];
|
|
30660
30674
|
case "pi":
|
|
30661
30675
|
return [{ path: piMcpConfigPath(), key: "mcpServers" }];
|
|
30662
30676
|
case "opencode":
|
|
30663
30677
|
return [
|
|
30664
|
-
{ path:
|
|
30665
|
-
{ path:
|
|
30666
|
-
{ path:
|
|
30678
|
+
{ path: join48(home, ".config", "opencode", "opencode.json"), key: "mcp" },
|
|
30679
|
+
{ path: join48(home, ".config", "opencode", "config.json"), key: "mcp" },
|
|
30680
|
+
{ path: join48(home, ".opencode", "config.json"), key: "mcp" }
|
|
30667
30681
|
];
|
|
30668
30682
|
default:
|
|
30669
30683
|
return [];
|
|
@@ -30671,7 +30685,7 @@ function mcpJsonCandidates(tool) {
|
|
|
30671
30685
|
}
|
|
30672
30686
|
function readMcpEntry(tool, name) {
|
|
30673
30687
|
if (tool === "codex")
|
|
30674
|
-
return readCodexMcpEntry(
|
|
30688
|
+
return readCodexMcpEntry(join48(homedir18(), ".codex", "config.toml"), name);
|
|
30675
30689
|
if (tool === "hermes")
|
|
30676
30690
|
return readHermesMcpServers()?.[name] ?? null;
|
|
30677
30691
|
for (const t of mcpJsonCandidates(tool)) {
|
|
@@ -30779,9 +30793,9 @@ function writeCodexMcpEntry(path, name, entry) {
|
|
|
30779
30793
|
function writeMcpEntry(toTool, name, entry) {
|
|
30780
30794
|
if (toTool === "hermes")
|
|
30781
30795
|
return writeHermesMcp(name, entry);
|
|
30782
|
-
const home =
|
|
30796
|
+
const home = homedir18();
|
|
30783
30797
|
if (toTool === "codex") {
|
|
30784
|
-
const path2 =
|
|
30798
|
+
const path2 = join48(home, ".codex", "config.toml");
|
|
30785
30799
|
if (!writeCodexMcpEntry(path2, name, entry))
|
|
30786
30800
|
return { ok: false, status: 409, error: `MCP "${name}" already exists in ${path2}.` };
|
|
30787
30801
|
return { ok: true, targetPath: path2 };
|
|
@@ -30789,19 +30803,19 @@ function writeMcpEntry(toTool, name, entry) {
|
|
|
30789
30803
|
let path;
|
|
30790
30804
|
let key2;
|
|
30791
30805
|
if (toTool === "claude") {
|
|
30792
|
-
path =
|
|
30806
|
+
path = join48(home, ".mcp.json");
|
|
30793
30807
|
key2 = "mcpServers";
|
|
30794
30808
|
} else if (toTool === "agy") {
|
|
30795
|
-
path =
|
|
30809
|
+
path = join48(home, ".gemini", "config", "mcp_config.json");
|
|
30796
30810
|
key2 = "mcpServers";
|
|
30797
30811
|
} else if (toTool === "cursor") {
|
|
30798
|
-
path =
|
|
30812
|
+
path = join48(cursorHomeDir(), "mcp.json");
|
|
30799
30813
|
key2 = "mcpServers";
|
|
30800
30814
|
} else if (toTool === "pi") {
|
|
30801
30815
|
path = piMcpConfigPath();
|
|
30802
30816
|
key2 = "mcpServers";
|
|
30803
30817
|
} else {
|
|
30804
|
-
path =
|
|
30818
|
+
path = join48(home, ".config", "opencode", "opencode.json");
|
|
30805
30819
|
key2 = "mcp";
|
|
30806
30820
|
}
|
|
30807
30821
|
let cfg = {};
|
|
@@ -30945,7 +30959,7 @@ async function removeArtifactFromTool(type, name, tool) {
|
|
|
30945
30959
|
return removeCommandOrAgent(type, name, tool);
|
|
30946
30960
|
}
|
|
30947
30961
|
function backupToTrash(src, label) {
|
|
30948
|
-
const dest =
|
|
30962
|
+
const dest = join48(getDataDir(), "trash", `${Date.now()}-${label.replace(/[^A-Za-z0-9._-]/g, "_")}`);
|
|
30949
30963
|
mkdirSync11(dirname20(dest), { recursive: true });
|
|
30950
30964
|
cpSync(src, dest, { recursive: true });
|
|
30951
30965
|
return dest;
|
|
@@ -30956,7 +30970,7 @@ function removeFailed(e, fallback) {
|
|
|
30956
30970
|
function removeSkill(name, tool) {
|
|
30957
30971
|
const found = skillDirsNamed(tool, name);
|
|
30958
30972
|
if (found.length === 0)
|
|
30959
|
-
return { ok: false, status: 404, error: `Not found: ${
|
|
30973
|
+
return { ok: false, status: 404, error: `Not found: ${join48(skillsDirFor(tool), name)}` };
|
|
30960
30974
|
if (found.length > 1)
|
|
30961
30975
|
return { ok: false, status: 409, error: `${found.length} skills named "${name}" for ${tool}; none removed` };
|
|
30962
30976
|
const dir = found[0];
|
|
@@ -31004,7 +31018,7 @@ function removeMcp(name, tool) {
|
|
|
31004
31018
|
}
|
|
31005
31019
|
}
|
|
31006
31020
|
if (tool === "codex") {
|
|
31007
|
-
const path =
|
|
31021
|
+
const path = join48(homedir18(), ".codex", "config.toml");
|
|
31008
31022
|
if (!existsSync44(path))
|
|
31009
31023
|
return { ok: false, status: 404, error: "config.toml not found" };
|
|
31010
31024
|
const before = readFileSync41(path, "utf-8");
|
|
@@ -31180,7 +31194,7 @@ var init_toolkit_sync = __esm({
|
|
|
31180
31194
|
|
|
31181
31195
|
// ../engine/dist/core/which.js
|
|
31182
31196
|
import { existsSync as existsSync46, statSync as statSync43, accessSync, constants } from "node:fs";
|
|
31183
|
-
import { join as
|
|
31197
|
+
import { join as join50, isAbsolute as isAbsolute3, delimiter as delimiter2, sep as sep3 } from "node:path";
|
|
31184
31198
|
function executable(p) {
|
|
31185
31199
|
try {
|
|
31186
31200
|
if (!statSync43(p).isFile())
|
|
@@ -31219,7 +31233,7 @@ function resolveOnPath(name) {
|
|
|
31219
31233
|
if (!dir)
|
|
31220
31234
|
continue;
|
|
31221
31235
|
for (const c of candidates(name)) {
|
|
31222
|
-
const full =
|
|
31236
|
+
const full = join50(dir, c);
|
|
31223
31237
|
if (existsSync46(full) && executable(full))
|
|
31224
31238
|
return full;
|
|
31225
31239
|
}
|
|
@@ -31247,7 +31261,7 @@ __export(toolkit_pull_exports, {
|
|
|
31247
31261
|
portableCommand: () => portableCommand
|
|
31248
31262
|
});
|
|
31249
31263
|
import { existsSync as existsSync47, mkdirSync as mkdirSync13, statSync as statSync44, writeFileSync as writeFileSync12 } from "node:fs";
|
|
31250
|
-
import { dirname as dirname22, join as
|
|
31264
|
+
import { dirname as dirname22, join as join51, basename as basename25, isAbsolute as isAbsolute4 } from "node:path";
|
|
31251
31265
|
function isExecutableFile(p) {
|
|
31252
31266
|
try {
|
|
31253
31267
|
return statSync44(p).isFile();
|
|
@@ -31417,8 +31431,8 @@ function executePull(rows, opts = {}) {
|
|
|
31417
31431
|
const outcomes = [];
|
|
31418
31432
|
for (const { name, body, truncated, redacted, tools } of skills) {
|
|
31419
31433
|
for (const tool of tools) {
|
|
31420
|
-
const dir =
|
|
31421
|
-
const file =
|
|
31434
|
+
const dir = join51(skillsDirFor(tool), name);
|
|
31435
|
+
const file = join51(dir, "SKILL.md");
|
|
31422
31436
|
if (existsSync47(file)) {
|
|
31423
31437
|
outcomes.push({ type: "skill", name, tool, status: "present" });
|
|
31424
31438
|
continue;
|
|
@@ -31789,7 +31803,7 @@ __export(shadow_prune_exports, {
|
|
|
31789
31803
|
pruneShadow: () => pruneShadow
|
|
31790
31804
|
});
|
|
31791
31805
|
import { readdirSync as readdirSync34, statSync as statSync47, unlinkSync as unlinkSync3 } from "fs";
|
|
31792
|
-
import { join as
|
|
31806
|
+
import { join as join54 } from "path";
|
|
31793
31807
|
function listShadows(isFullyAcked) {
|
|
31794
31808
|
const out = [];
|
|
31795
31809
|
const root = shadowRoot();
|
|
@@ -31800,7 +31814,7 @@ function listShadows(isFullyAcked) {
|
|
|
31800
31814
|
return out;
|
|
31801
31815
|
}
|
|
31802
31816
|
for (const tool of tools) {
|
|
31803
|
-
const dir =
|
|
31817
|
+
const dir = join54(root, tool);
|
|
31804
31818
|
let names;
|
|
31805
31819
|
try {
|
|
31806
31820
|
names = readdirSync34(dir);
|
|
@@ -31810,7 +31824,7 @@ function listShadows(isFullyAcked) {
|
|
|
31810
31824
|
for (const name of names) {
|
|
31811
31825
|
if (!name.endsWith(".gz"))
|
|
31812
31826
|
continue;
|
|
31813
|
-
const path =
|
|
31827
|
+
const path = join54(dir, name);
|
|
31814
31828
|
let st;
|
|
31815
31829
|
try {
|
|
31816
31830
|
st = statSync47(path);
|
|
@@ -31929,8 +31943,8 @@ var init_code_intel = __esm({
|
|
|
31929
31943
|
|
|
31930
31944
|
// ../engine/dist/core/companions.js
|
|
31931
31945
|
import { existsSync as existsSync50, mkdirSync as mkdirSync16, statSync as statSync48, chmodSync as chmodSync4, unlinkSync as unlinkSync4, renameSync as renameSync5, createWriteStream as createWriteStream2, readFileSync as readFileSync46, writeFileSync as writeFileSync15 } from "node:fs";
|
|
31932
|
-
import { homedir as
|
|
31933
|
-
import { join as
|
|
31946
|
+
import { homedir as homedir20 } from "node:os";
|
|
31947
|
+
import { join as join55 } from "node:path";
|
|
31934
31948
|
import { execSync as execSync3 } from "node:child_process";
|
|
31935
31949
|
import { createHash as createHash14 } from "node:crypto";
|
|
31936
31950
|
function expectedCodeindexSha256(artifact) {
|
|
@@ -32074,9 +32088,9 @@ var init_companions = __esm({
|
|
|
32074
32088
|
"x86_64-windows": "a96fc8c8949bb399a44cc0615b12e458460a529c69f01e8829cc39a20f45ab29",
|
|
32075
32089
|
"aarch64-windows": "42620d56272cd9ba9d785569d8d754d6b4a3e80f36f28db3e0c483fd600ed117"
|
|
32076
32090
|
};
|
|
32077
|
-
CODEINDEX_INSTALL_DIR =
|
|
32091
|
+
CODEINDEX_INSTALL_DIR = join55(homedir20(), ".local", "bin");
|
|
32078
32092
|
CODEINDEX_BIN_NAME = process.platform === "win32" ? "codeindex.exe" : "codeindex";
|
|
32079
|
-
CODEINDEX_BIN_PATH =
|
|
32093
|
+
CODEINDEX_BIN_PATH = join55(CODEINDEX_INSTALL_DIR, CODEINDEX_BIN_NAME);
|
|
32080
32094
|
}
|
|
32081
32095
|
});
|
|
32082
32096
|
|
|
@@ -32192,7 +32206,7 @@ __export(collector_exports, {
|
|
|
32192
32206
|
import { spawn as spawn2 } from "node:child_process";
|
|
32193
32207
|
import { execSync as execSync4 } from "node:child_process";
|
|
32194
32208
|
import { readFileSync as readFileSync47 } from "node:fs";
|
|
32195
|
-
import { join as
|
|
32209
|
+
import { join as join56, basename as basename26 } from "node:path";
|
|
32196
32210
|
async function resolveCodeindexBin(autoInstall = true) {
|
|
32197
32211
|
let st = checkCodeindexStatus();
|
|
32198
32212
|
if (!st.installed && autoInstall)
|
|
@@ -32374,7 +32388,7 @@ async function collectCode(opts) {
|
|
|
32374
32388
|
}
|
|
32375
32389
|
const complexity = (r) => {
|
|
32376
32390
|
try {
|
|
32377
|
-
const txt = readFileSync47(
|
|
32391
|
+
const txt = readFileSync47(join56(ws, r), "utf8");
|
|
32378
32392
|
if (txt.length > 2e6)
|
|
32379
32393
|
return 1;
|
|
32380
32394
|
const m = txt.match(CF_RE);
|
|
@@ -33139,14 +33153,14 @@ __export(service_installer_exports, {
|
|
|
33139
33153
|
});
|
|
33140
33154
|
import { execSync as execSync5 } from "child_process";
|
|
33141
33155
|
import { existsSync as existsSync51, mkdirSync as mkdirSync17, readFileSync as readFileSync48, rmSync as rmSync9, writeFileSync as writeFileSync16 } from "fs";
|
|
33142
|
-
import { homedir as
|
|
33143
|
-
import { join as
|
|
33156
|
+
import { homedir as homedir21 } from "os";
|
|
33157
|
+
import { join as join57 } from "path";
|
|
33144
33158
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
33145
33159
|
function resolveDaemonPaths() {
|
|
33146
33160
|
const watchJs = fileURLToPath5(new URL("./watch.js", import.meta.url));
|
|
33147
33161
|
const node = process.execPath;
|
|
33148
|
-
const dataDir =
|
|
33149
|
-
const logFile =
|
|
33162
|
+
const dataDir = join57(homedir21(), ".chat-recall");
|
|
33163
|
+
const logFile = join57(dataDir, "watch.log");
|
|
33150
33164
|
return { watchJs, node, logFile, dataDir };
|
|
33151
33165
|
}
|
|
33152
33166
|
function tryCmd(cmd) {
|
|
@@ -33173,7 +33187,7 @@ function refreshServiceDefinition() {
|
|
|
33173
33187
|
if (process.platform !== "linux") return false;
|
|
33174
33188
|
try {
|
|
33175
33189
|
const { watchJs, node, logFile } = resolveDaemonPaths();
|
|
33176
|
-
const unitPath =
|
|
33190
|
+
const unitPath = join57(homedir21(), ".config", "systemd", "user", "chat-recall-watch.service");
|
|
33177
33191
|
if (!existsSync51(unitPath)) return false;
|
|
33178
33192
|
const current = readFileSync48(unitPath, "utf8");
|
|
33179
33193
|
if (!current.includes(watchJs)) return false;
|
|
@@ -33204,8 +33218,8 @@ function installService() {
|
|
|
33204
33218
|
);
|
|
33205
33219
|
}
|
|
33206
33220
|
function installSystemd(watchJs, node, logFile) {
|
|
33207
|
-
const unitDir =
|
|
33208
|
-
const unitPath =
|
|
33221
|
+
const unitDir = join57(homedir21(), ".config", "systemd", "user");
|
|
33222
|
+
const unitPath = join57(unitDir, "chat-recall-watch.service");
|
|
33209
33223
|
const unit = renderSystemdUnit(watchJs, node, logFile);
|
|
33210
33224
|
mkdirSync17(unitDir, { recursive: true });
|
|
33211
33225
|
writeFileSync16(unitPath, unit);
|
|
@@ -33268,6 +33282,13 @@ function renderSystemdUnit(watchJs, node, logFile) {
|
|
|
33268
33282
|
"MemoryAccounting=yes",
|
|
33269
33283
|
"MemoryHigh=1G",
|
|
33270
33284
|
"MemoryMax=2G",
|
|
33285
|
+
// systemd-oomd kills the cgroup with the most reclaim activity once the
|
|
33286
|
+
// user slice passes its memory-pressure limit. A daemon that peaks at its
|
|
33287
|
+
// own MemoryHigh reclaims constantly, so it was the first cgroup chosen:
|
|
33288
|
+
// 13 kills in six hours on a 60 GB machine, and each restart began the
|
|
33289
|
+
// startup walk again, so the walk never finished. `avoid` ranks the unit
|
|
33290
|
+
// last for oomd; MemoryMax above still bounds the daemon itself.
|
|
33291
|
+
"ManagedOOMPreference=avoid",
|
|
33271
33292
|
// JOURNAL, not append:. The file version had no rotation and nothing to
|
|
33272
33293
|
// give it any: systemd holds the fd open, so the daemon cannot rename or
|
|
33273
33294
|
// truncate its own log without leaving systemd writing into a hole. It
|
|
@@ -33284,8 +33305,8 @@ function renderSystemdUnit(watchJs, node, logFile) {
|
|
|
33284
33305
|
}
|
|
33285
33306
|
function installLaunchd(watchJs, node, logFile) {
|
|
33286
33307
|
const label = "com.chat-recall.watch";
|
|
33287
|
-
const plistDir =
|
|
33288
|
-
const plistPath =
|
|
33308
|
+
const plistDir = join57(homedir21(), "Library", "LaunchAgents");
|
|
33309
|
+
const plistPath = join57(plistDir, `${label}.plist`);
|
|
33289
33310
|
const plist = renderLaunchdPlist(watchJs, node, logFile, label);
|
|
33290
33311
|
mkdirSync17(plistDir, { recursive: true });
|
|
33291
33312
|
writeFileSync16(plistPath, plist);
|
|
@@ -33341,7 +33362,7 @@ function uninstallService() {
|
|
|
33341
33362
|
removed = true;
|
|
33342
33363
|
} catch {
|
|
33343
33364
|
}
|
|
33344
|
-
const unitPath =
|
|
33365
|
+
const unitPath = join57(homedir21(), ".config", "systemd", "user", "chat-recall-watch.service");
|
|
33345
33366
|
if (existsSync51(unitPath)) {
|
|
33346
33367
|
rmSync9(unitPath, { force: true });
|
|
33347
33368
|
removed = true;
|
|
@@ -33353,7 +33374,7 @@ function uninstallService() {
|
|
|
33353
33374
|
return removed;
|
|
33354
33375
|
}
|
|
33355
33376
|
if (process.platform === "darwin") {
|
|
33356
|
-
const plistPath =
|
|
33377
|
+
const plistPath = join57(homedir21(), "Library", "LaunchAgents", "com.chat-recall.watch.plist");
|
|
33357
33378
|
try {
|
|
33358
33379
|
execSync5(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
|
|
33359
33380
|
} catch {
|
|
@@ -33404,8 +33425,8 @@ init_settings();
|
|
|
33404
33425
|
init_sync_client();
|
|
33405
33426
|
init_http();
|
|
33406
33427
|
import chokidar from "chokidar";
|
|
33407
|
-
import { dirname as dirname25, basename as basename27, join as
|
|
33408
|
-
import { homedir as
|
|
33428
|
+
import { dirname as dirname25, basename as basename27, join as join58, resolve as resolve2, sep as sep4 } from "path";
|
|
33429
|
+
import { homedir as homedir22 } from "os";
|
|
33409
33430
|
|
|
33410
33431
|
// src/intent-drain.ts
|
|
33411
33432
|
init_http();
|
|
@@ -33419,13 +33440,13 @@ init_opencode();
|
|
|
33419
33440
|
init_agy();
|
|
33420
33441
|
init_pi();
|
|
33421
33442
|
import { existsSync as existsSync48, readFileSync as readFileSync43, writeFileSync as writeFileSync13, appendFileSync, mkdirSync as mkdirSync14 } from "node:fs";
|
|
33422
|
-
import { join as
|
|
33443
|
+
import { join as join52 } from "node:path";
|
|
33423
33444
|
|
|
33424
33445
|
// src/project-tasks.ts
|
|
33425
33446
|
init_http();
|
|
33426
33447
|
import { existsSync as existsSync45, readFileSync as readFileSync42, writeFileSync as writeFileSync11, mkdirSync as mkdirSync12, statSync as statSync42 } from "node:fs";
|
|
33427
|
-
import { join as
|
|
33428
|
-
import { homedir as
|
|
33448
|
+
import { join as join49, dirname as dirname21 } from "node:path";
|
|
33449
|
+
import { homedir as homedir19 } from "node:os";
|
|
33429
33450
|
|
|
33430
33451
|
// ../engine/dist/core/secret-task-status.js
|
|
33431
33452
|
var SECRET_TASK_STATUSES = ["open", "rotated", "not-a-secret", "dismissed"];
|
|
@@ -33493,7 +33514,7 @@ function parseTaskFile(content) {
|
|
|
33493
33514
|
return out;
|
|
33494
33515
|
}
|
|
33495
33516
|
function ledgerPath2() {
|
|
33496
|
-
return
|
|
33517
|
+
return join49(homedir19(), ".chat-recall", "project-tasks-ledger.json");
|
|
33497
33518
|
}
|
|
33498
33519
|
function readLedger() {
|
|
33499
33520
|
try {
|
|
@@ -33530,7 +33551,7 @@ async function pushProjectTaskStatuses(base3, authHeaders, opts = {}) {
|
|
|
33530
33551
|
continue;
|
|
33531
33552
|
}
|
|
33532
33553
|
for (const project of projects) {
|
|
33533
|
-
const file =
|
|
33554
|
+
const file = join49(project, fk.filename);
|
|
33534
33555
|
if (!existsSync45(file)) continue;
|
|
33535
33556
|
let mtime;
|
|
33536
33557
|
try {
|
|
@@ -33594,16 +33615,16 @@ function instructionTargets(rootPath, isGlobal) {
|
|
|
33594
33615
|
const tools = installed.length ? installed : [INSTRUCTION_TOOLS[0]];
|
|
33595
33616
|
if (isGlobal) return [...new Set(tools.map((t) => instructionsPath(t.id)))];
|
|
33596
33617
|
if (!rootPath) return [];
|
|
33597
|
-
const present = INSTRUCTION_FILENAMES.map((f) =>
|
|
33618
|
+
const present = INSTRUCTION_FILENAMES.map((f) => join52(rootPath, f)).filter((p) => existsSync48(p));
|
|
33598
33619
|
if (present.length) return present;
|
|
33599
|
-
return [...new Set(tools.map((t) =>
|
|
33620
|
+
return [...new Set(tools.map((t) => join52(rootPath, instructionsFilename(t.id))))];
|
|
33600
33621
|
}
|
|
33601
33622
|
function applyCodeRecommendation(intent) {
|
|
33602
33623
|
try {
|
|
33603
33624
|
const meta = JSON.parse(intent.name || "{}");
|
|
33604
33625
|
if (intent.artifact_type === "write_tasks_file") {
|
|
33605
33626
|
if (!meta.rootPath || !meta.content) return { status: "error", result: JSON.stringify({ error: "missing rootPath or content" }) };
|
|
33606
|
-
const file =
|
|
33627
|
+
const file = join52(meta.rootPath, meta.filename || "CODE_TASKS.md");
|
|
33607
33628
|
writeFileSync13(file, meta.content);
|
|
33608
33629
|
return { status: "done", result: JSON.stringify({ wrote: file }) };
|
|
33609
33630
|
}
|
|
@@ -33729,10 +33750,10 @@ async function runIntent(intent, ctx) {
|
|
|
33729
33750
|
var ownVersion2 = "0.0.0";
|
|
33730
33751
|
try {
|
|
33731
33752
|
const dir = dirname23(fileURLToPath4(import.meta.url));
|
|
33732
|
-
ownVersion2 = JSON.parse(readFileSync43(
|
|
33753
|
+
ownVersion2 = JSON.parse(readFileSync43(join52(dir, "../package.json"), "utf-8")).version || ownVersion2;
|
|
33733
33754
|
} catch {
|
|
33734
33755
|
try {
|
|
33735
|
-
if (true) ownVersion2 = "0.7.
|
|
33756
|
+
if (true) ownVersion2 = "0.7.23";
|
|
33736
33757
|
} catch {
|
|
33737
33758
|
}
|
|
33738
33759
|
}
|
|
@@ -33800,8 +33821,8 @@ init_paths();
|
|
|
33800
33821
|
import { readFileSync as readFileSync44, writeFileSync as writeFileSync14, mkdirSync as mkdirSync15, statSync as statSync45 } from "fs";
|
|
33801
33822
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
33802
33823
|
import { createHash as createHash11 } from "crypto";
|
|
33803
|
-
import { join as
|
|
33804
|
-
var cursorPath = () =>
|
|
33824
|
+
import { join as join53, dirname as dirname24 } from "path";
|
|
33825
|
+
var cursorPath = () => join53(getDataDir(), "code-index-cursor.json");
|
|
33805
33826
|
function readCursor() {
|
|
33806
33827
|
try {
|
|
33807
33828
|
const raw = JSON.parse(readFileSync44(cursorPath(), "utf-8"));
|
|
@@ -33848,7 +33869,7 @@ function workspaceFingerprint(workspace, collectorVersion) {
|
|
|
33848
33869
|
const rel = entry.slice(3);
|
|
33849
33870
|
let stamp2 = "gone";
|
|
33850
33871
|
try {
|
|
33851
|
-
const s = statSync45(
|
|
33872
|
+
const s = statSync45(join53(workspace, rel));
|
|
33852
33873
|
stamp2 = `${s.size}:${Math.floor(s.mtimeMs)}`;
|
|
33853
33874
|
} catch {
|
|
33854
33875
|
}
|
|
@@ -34117,7 +34138,7 @@ async function runCollectorMigration(opts) {
|
|
|
34117
34138
|
init_sync_ledger();
|
|
34118
34139
|
init_collector_health();
|
|
34119
34140
|
import { existsSync as existsSync52, readFileSync as readFileSync49, statSync as statSync49 } from "fs";
|
|
34120
|
-
var CLI_VERSION3 = true ? "0.7.
|
|
34141
|
+
var CLI_VERSION3 = true ? "0.7.23" : "0.0.0";
|
|
34121
34142
|
var DEBOUNCE_MS = 5e3;
|
|
34122
34143
|
var PLANS_DIR = claudeBackend.plansDir();
|
|
34123
34144
|
var TASKS_DIR = claudeBackend.tasksDir();
|
|
@@ -34127,8 +34148,8 @@ var CODEX_SESSIONS_DIR = codexBackend.sessionsDir();
|
|
|
34127
34148
|
var PI_SESSION_DIRS = piBackend.sessionDirs();
|
|
34128
34149
|
var OPENCODE_DB_PATH = opencodeBackend.dbPath();
|
|
34129
34150
|
var OPENCODE_DB_DIR = dirname25(OPENCODE_DB_PATH);
|
|
34130
|
-
var CURRENT_RESUME_PATH =
|
|
34131
|
-
var LAST_CLEANUP_PATH =
|
|
34151
|
+
var CURRENT_RESUME_PATH = join58(claudeBackend.homeDir(), "current-resume");
|
|
34152
|
+
var LAST_CLEANUP_PATH = join58(claudeBackend.homeDir(), ".last-cleanup");
|
|
34132
34153
|
var debounceTimer = null;
|
|
34133
34154
|
var ticks = new TickQueue({
|
|
34134
34155
|
onError: (kind, err) => daemonLog.error(`${kind} tick failed: ${err instanceof Error ? err.message : err}`)
|
|
@@ -34388,7 +34409,7 @@ if (BOOT_CODE) {
|
|
|
34388
34409
|
daemonLog.info(`running bundle ${BOOT_CODE.path} (${BOOT_CODE.size} bytes)`);
|
|
34389
34410
|
}
|
|
34390
34411
|
{
|
|
34391
|
-
const r = rotateLogIfLarge(
|
|
34412
|
+
const r = rotateLogIfLarge(join58(getDataDir(), "watch.log"));
|
|
34392
34413
|
if (r.rotated) {
|
|
34393
34414
|
daemonLog.info(`rotated watch.log at ${(r.sizeBefore / 1048576).toFixed(0)}MB \u2192 watch.log.1 (copy+truncate; the path is preserved)`);
|
|
34394
34415
|
}
|
|
@@ -34568,13 +34589,13 @@ var WORKSPACE_MARKERS = [
|
|
|
34568
34589
|
function isCodeWorkspace(p) {
|
|
34569
34590
|
try {
|
|
34570
34591
|
const resolved = resolve2(p);
|
|
34571
|
-
if (resolved === sep4 || resolved ===
|
|
34592
|
+
if (resolved === sep4 || resolved === homedir22() || dirname25(resolved) === resolved) return false;
|
|
34572
34593
|
} catch {
|
|
34573
34594
|
return false;
|
|
34574
34595
|
}
|
|
34575
34596
|
return WORKSPACE_MARKERS.some((m) => {
|
|
34576
34597
|
try {
|
|
34577
|
-
return existsSync52(
|
|
34598
|
+
return existsSync52(join58(p, m));
|
|
34578
34599
|
} catch {
|
|
34579
34600
|
return false;
|
|
34580
34601
|
}
|