chat-recall 0.7.20 → 0.7.21
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 +37 -10
- 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 +9001 -8996
- package/dist/cli.js.map +1 -1
- package/dist/install-hooks.d.ts +95 -0
- package/dist/install-hooks.d.ts.map +1 -0
- package/dist/install-hooks.js +352 -0
- package/dist/install-hooks.js.map +1 -0
- package/dist/mcp-relay.js +1 -1
- package/dist/mcp.js +1960 -924
- package/dist/mcp.js.map +1 -1
- package/dist/message-hook-core.d.ts +67 -0
- package/dist/message-hook-core.d.ts.map +1 -0
- package/dist/message-hook-core.js +77 -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 +423 -0
- package/dist/message-hook.js.map +1 -0
- package/dist/scan-worker.js +32 -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 +500 -483
- package/package.json +1 -1
- package/skills/chat-recall/SKILL.md +6 -1
- package/skills/chat-recall-sessions/SKILL.md +155 -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,27 @@ 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");
|
|
10815
10825
|
}
|
|
10816
10826
|
sharedProjectsJson() {
|
|
10817
|
-
return
|
|
10827
|
+
return join14(this.sharedRootDir(), "projects.json");
|
|
10818
10828
|
}
|
|
10819
10829
|
/** The DESKTOP app's brain, `~/.gemini/antigravity/brain`. The CLI's own is
|
|
10820
10830
|
* `homeDir()/brain`, reached through `agyBrainDirs()`. Both exist. */
|
|
10821
10831
|
desktopBrainDir() {
|
|
10822
|
-
return
|
|
10832
|
+
return join14(this.sharedRootDir(), "antigravity", "brain");
|
|
10823
10833
|
}
|
|
10824
10834
|
isAvailable() {
|
|
10825
10835
|
return agyBrainDirs().length > 0;
|
|
@@ -10846,10 +10856,10 @@ var init_agy = __esm({
|
|
|
10846
10856
|
}
|
|
10847
10857
|
/** Resolve a session inside ONE brain root. */
|
|
10848
10858
|
findSessionIn(brainDir, rawId) {
|
|
10849
|
-
const sessionDir =
|
|
10859
|
+
const sessionDir = join14(brainDir, rawId);
|
|
10850
10860
|
if (!existsSync12(sessionDir))
|
|
10851
10861
|
return null;
|
|
10852
|
-
const path = agyTranscriptPath(
|
|
10862
|
+
const path = agyTranscriptPath(join14(sessionDir, ".system_generated", "logs"));
|
|
10853
10863
|
if (!path)
|
|
10854
10864
|
return null;
|
|
10855
10865
|
let mtime = 0;
|
|
@@ -10880,14 +10890,14 @@ var init_agy = __esm({
|
|
|
10880
10890
|
continue;
|
|
10881
10891
|
}
|
|
10882
10892
|
for (const rawId of sessionDirs) {
|
|
10883
|
-
const sessionPath =
|
|
10893
|
+
const sessionPath = join14(brainDir, rawId);
|
|
10884
10894
|
try {
|
|
10885
10895
|
if (!statSync10(sessionPath).isDirectory())
|
|
10886
10896
|
continue;
|
|
10887
10897
|
} catch {
|
|
10888
10898
|
continue;
|
|
10889
10899
|
}
|
|
10890
|
-
const filePath = agyTranscriptPath(
|
|
10900
|
+
const filePath = agyTranscriptPath(join14(sessionPath, ".system_generated", "logs"));
|
|
10891
10901
|
if (!filePath)
|
|
10892
10902
|
continue;
|
|
10893
10903
|
let stat3;
|
|
@@ -11156,14 +11166,14 @@ var init_agy = __esm({
|
|
|
11156
11166
|
return [];
|
|
11157
11167
|
}
|
|
11158
11168
|
for (const rawId of sessionDirs) {
|
|
11159
|
-
const sessionPath =
|
|
11169
|
+
const sessionPath = join14(brainDir, rawId);
|
|
11160
11170
|
try {
|
|
11161
11171
|
if (!statSync10(sessionPath).isDirectory())
|
|
11162
11172
|
continue;
|
|
11163
11173
|
} catch {
|
|
11164
11174
|
continue;
|
|
11165
11175
|
}
|
|
11166
|
-
const filePath = agyTranscriptPath(
|
|
11176
|
+
const filePath = agyTranscriptPath(join14(sessionPath, ".system_generated", "logs"));
|
|
11167
11177
|
if (!filePath)
|
|
11168
11178
|
continue;
|
|
11169
11179
|
try {
|
|
@@ -11228,7 +11238,7 @@ var init_agy = __esm({
|
|
|
11228
11238
|
|
|
11229
11239
|
// ../engine/dist/core/backends/cursor-store.js
|
|
11230
11240
|
import { existsSync as existsSync13, readdirSync as readdirSync10, readFileSync as readFileSync9, statSync as statSync11 } from "fs";
|
|
11231
|
-
import { join as
|
|
11241
|
+
import { join as join15 } from "path";
|
|
11232
11242
|
function cursorProjectSlug(absPath) {
|
|
11233
11243
|
return absPath.replace(/[^a-zA-Z0-9]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
11234
11244
|
}
|
|
@@ -11241,7 +11251,7 @@ function listChatsIn(chatsRoot) {
|
|
|
11241
11251
|
return out;
|
|
11242
11252
|
}
|
|
11243
11253
|
for (const workspaceHash of hashDirs) {
|
|
11244
|
-
const hashPath3 =
|
|
11254
|
+
const hashPath3 = join15(chatsRoot, workspaceHash);
|
|
11245
11255
|
let chatIds;
|
|
11246
11256
|
try {
|
|
11247
11257
|
if (!statSync11(hashPath3).isDirectory())
|
|
@@ -11251,13 +11261,13 @@ function listChatsIn(chatsRoot) {
|
|
|
11251
11261
|
continue;
|
|
11252
11262
|
}
|
|
11253
11263
|
for (const chatId of chatIds) {
|
|
11254
|
-
const dir =
|
|
11255
|
-
const dbPath =
|
|
11264
|
+
const dir = join15(hashPath3, chatId);
|
|
11265
|
+
const dbPath = join15(dir, "store.db");
|
|
11256
11266
|
if (!existsSync13(dbPath))
|
|
11257
11267
|
continue;
|
|
11258
11268
|
let meta = {};
|
|
11259
11269
|
try {
|
|
11260
|
-
meta = JSON.parse(readFileSync9(
|
|
11270
|
+
meta = JSON.parse(readFileSync9(join15(dir, "meta.json"), "utf-8"));
|
|
11261
11271
|
} catch {
|
|
11262
11272
|
}
|
|
11263
11273
|
if (meta.hasConversation === false)
|
|
@@ -11296,13 +11306,13 @@ function findChat(chatsRoots, chatId) {
|
|
|
11296
11306
|
continue;
|
|
11297
11307
|
}
|
|
11298
11308
|
for (const workspaceHash of hashDirs) {
|
|
11299
|
-
const dir =
|
|
11300
|
-
const dbPath =
|
|
11309
|
+
const dir = join15(root, workspaceHash, chatId);
|
|
11310
|
+
const dbPath = join15(dir, "store.db");
|
|
11301
11311
|
if (!existsSync13(dbPath))
|
|
11302
11312
|
continue;
|
|
11303
11313
|
let meta = {};
|
|
11304
11314
|
try {
|
|
11305
|
-
meta = JSON.parse(readFileSync9(
|
|
11315
|
+
meta = JSON.parse(readFileSync9(join15(dir, "meta.json"), "utf-8"));
|
|
11306
11316
|
} catch {
|
|
11307
11317
|
}
|
|
11308
11318
|
let mtime = meta.updatedAtMs ?? 0;
|
|
@@ -11550,7 +11560,7 @@ function readStoreEvents(chat) {
|
|
|
11550
11560
|
function transcriptPath(cursorHome, projectPath, chatId) {
|
|
11551
11561
|
if (!projectPath)
|
|
11552
11562
|
return null;
|
|
11553
|
-
const p =
|
|
11563
|
+
const p = join15(cursorHome, "projects", cursorProjectSlug(projectPath), "agent-transcripts", chatId, `${chatId}.jsonl`);
|
|
11554
11564
|
return existsSync13(p) ? p : null;
|
|
11555
11565
|
}
|
|
11556
11566
|
function readTranscriptEvents(rawText, mtimeFallback = 0) {
|
|
@@ -11613,7 +11623,7 @@ var init_cursor_store = __esm({
|
|
|
11613
11623
|
|
|
11614
11624
|
// ../engine/dist/core/backends/cursor-ide.js
|
|
11615
11625
|
import { existsSync as existsSync14, readFileSync as readFileSync10, readdirSync as readdirSync11, statSync as statSync12 } from "fs";
|
|
11616
|
-
import { dirname as dirname12, join as
|
|
11626
|
+
import { dirname as dirname12, join as join16 } from "path";
|
|
11617
11627
|
function jsonOf(value) {
|
|
11618
11628
|
if (value == null)
|
|
11619
11629
|
return null;
|
|
@@ -11657,7 +11667,7 @@ function pathFromUri(uri) {
|
|
|
11657
11667
|
return uri.startsWith("/") ? uri : "";
|
|
11658
11668
|
}
|
|
11659
11669
|
function projectPathForWorkspace(workspaceDir) {
|
|
11660
|
-
const meta = jsonOf(safeRead(
|
|
11670
|
+
const meta = jsonOf(safeRead(join16(workspaceDir, "workspace.json")));
|
|
11661
11671
|
if (!meta)
|
|
11662
11672
|
return "";
|
|
11663
11673
|
const uri = typeof meta.workspace === "string" && meta.workspace || typeof meta.folder === "string" && meta.folder || "";
|
|
@@ -11680,7 +11690,7 @@ function workspaceIndex(workspaceRoots) {
|
|
|
11680
11690
|
continue;
|
|
11681
11691
|
}
|
|
11682
11692
|
for (const id of entries) {
|
|
11683
|
-
const dir =
|
|
11693
|
+
const dir = join16(root, id);
|
|
11684
11694
|
try {
|
|
11685
11695
|
if (!statSync12(dir).isDirectory())
|
|
11686
11696
|
continue;
|
|
@@ -11767,7 +11777,7 @@ function listComposers(globalDbPath, workspaceRoots) {
|
|
|
11767
11777
|
continue;
|
|
11768
11778
|
}
|
|
11769
11779
|
for (const workspaceId of entries) {
|
|
11770
|
-
const wsDb =
|
|
11780
|
+
const wsDb = join16(root, workspaceId, "state.vscdb");
|
|
11771
11781
|
if (!existsSync14(wsDb))
|
|
11772
11782
|
continue;
|
|
11773
11783
|
const projectPath = wsIndex.get(workspaceId) || "";
|
|
@@ -12029,7 +12039,7 @@ var init_cursor_ide = __esm({
|
|
|
12029
12039
|
|
|
12030
12040
|
// ../engine/dist/core/backends/cursor.js
|
|
12031
12041
|
import { existsSync as existsSync15, readFileSync as readFileSync11, statSync as statSync13 } from "fs";
|
|
12032
|
-
import { join as
|
|
12042
|
+
import { join as join17 } from "path";
|
|
12033
12043
|
var PREFIX4, CursorBackend, cursorBackend;
|
|
12034
12044
|
var init_cursor = __esm({
|
|
12035
12045
|
"../engine/dist/core/backends/cursor.js"() {
|
|
@@ -12336,7 +12346,7 @@ var init_cursor = __esm({
|
|
|
12336
12346
|
if (!lines)
|
|
12337
12347
|
return null;
|
|
12338
12348
|
const files = [{ name: `${r.chat.chatId}.jsonl`, bytes: Buffer.from(lines, "utf8") }];
|
|
12339
|
-
const metaPath =
|
|
12349
|
+
const metaPath = join17(r.chat.dir, "meta.json");
|
|
12340
12350
|
if (existsSync15(metaPath)) {
|
|
12341
12351
|
files.push({ name: "meta.json", bytes: readFileSync11(metaPath) });
|
|
12342
12352
|
}
|
|
@@ -12840,7 +12850,7 @@ var init_hermes = __esm({
|
|
|
12840
12850
|
// ../engine/dist/core/backends/pi.js
|
|
12841
12851
|
import { readdirSync as readdirSync12, readFileSync as readFileSync12, statSync as statSync14, openSync as openSync8, readSync as readSync8, closeSync as closeSync8 } from "fs";
|
|
12842
12852
|
import { createHash as createHash3 } from "crypto";
|
|
12843
|
-
import { basename as basename11, join as
|
|
12853
|
+
import { basename as basename11, join as join18 } from "path";
|
|
12844
12854
|
function parsePiFile(path) {
|
|
12845
12855
|
let raw;
|
|
12846
12856
|
try {
|
|
@@ -12888,7 +12898,7 @@ function* walkSessionFiles(root, depth = 2) {
|
|
|
12888
12898
|
for (const entry of entries) {
|
|
12889
12899
|
if (entry.name.startsWith("."))
|
|
12890
12900
|
continue;
|
|
12891
|
-
const path =
|
|
12901
|
+
const path = join18(root, entry.name);
|
|
12892
12902
|
if (entry.isDirectory()) {
|
|
12893
12903
|
yield* walkSessionFiles(path, depth - 1);
|
|
12894
12904
|
continue;
|
|
@@ -12938,7 +12948,7 @@ function dirSignature(root) {
|
|
|
12938
12948
|
if (!entry.isDirectory())
|
|
12939
12949
|
continue;
|
|
12940
12950
|
try {
|
|
12941
|
-
parts.push(`${entry.name}:${statSync14(
|
|
12951
|
+
parts.push(`${entry.name}:${statSync14(join18(root, entry.name)).mtimeMs}`);
|
|
12942
12952
|
} catch {
|
|
12943
12953
|
}
|
|
12944
12954
|
}
|
|
@@ -13056,7 +13066,7 @@ var init_pi = __esm({
|
|
|
13056
13066
|
entries2.push({
|
|
13057
13067
|
id: id || "",
|
|
13058
13068
|
projectPath: header?.cwd || "",
|
|
13059
|
-
projectDir: basename11(
|
|
13069
|
+
projectDir: basename11(join18(path, "..")),
|
|
13060
13070
|
mtime,
|
|
13061
13071
|
path
|
|
13062
13072
|
});
|
|
@@ -13109,7 +13119,7 @@ var init_pi = __esm({
|
|
|
13109
13119
|
return {
|
|
13110
13120
|
path,
|
|
13111
13121
|
format: "jsonl",
|
|
13112
|
-
projectDir: basename11(
|
|
13122
|
+
projectDir: basename11(join18(path, "..")),
|
|
13113
13123
|
projectPath: header.cwd || "",
|
|
13114
13124
|
mtime
|
|
13115
13125
|
};
|
|
@@ -13156,7 +13166,7 @@ var init_pi = __esm({
|
|
|
13156
13166
|
rawId,
|
|
13157
13167
|
prefixedId: this.toPrefixedId(rawId),
|
|
13158
13168
|
projectPath,
|
|
13159
|
-
projectDir: basename11(
|
|
13169
|
+
projectDir: basename11(join18(path, "..")),
|
|
13160
13170
|
fullPath: path,
|
|
13161
13171
|
created: header.timestamp || stat3.birthtime.toISOString(),
|
|
13162
13172
|
modified: stat3.mtime.toISOString(),
|
|
@@ -13506,7 +13516,7 @@ var init_backends = __esm({
|
|
|
13506
13516
|
|
|
13507
13517
|
// ../engine/dist/core/collector-health.js
|
|
13508
13518
|
import { readFileSync as readFileSync13, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4 } from "node:fs";
|
|
13509
|
-
import { join as
|
|
13519
|
+
import { join as join19, dirname as dirname13 } from "node:path";
|
|
13510
13520
|
function applySyncOutcome(prior, outcome, now = Date.now()) {
|
|
13511
13521
|
const t = { lastOkAt: prior?.lastOkAt ?? null, failures: prior?.failures ?? 0 };
|
|
13512
13522
|
if (prior?.lastError !== void 0)
|
|
@@ -13581,7 +13591,7 @@ var init_collector_health = __esm({
|
|
|
13581
13591
|
"../engine/dist/core/collector-health.js"() {
|
|
13582
13592
|
"use strict";
|
|
13583
13593
|
init_paths();
|
|
13584
|
-
healthPath = () =>
|
|
13594
|
+
healthPath = () => join19(getDataDir(), "collector-health.json");
|
|
13585
13595
|
PROGRESS_WRITE_INTERVAL_MS = 2e3;
|
|
13586
13596
|
lastProgressWrite = 0;
|
|
13587
13597
|
STALE_AFTER_MS = 30 * 6e4;
|
|
@@ -14016,7 +14026,7 @@ var init_secret_redactor = __esm({
|
|
|
14016
14026
|
// ../engine/dist/core/source-discovery.js
|
|
14017
14027
|
import { createHash as createHash4 } from "crypto";
|
|
14018
14028
|
import { existsSync as existsSync17, readdirSync as readdirSync13, statSync as statSync16 } from "fs";
|
|
14019
|
-
import { join as
|
|
14029
|
+
import { join as join20 } from "path";
|
|
14020
14030
|
function sourceId(path) {
|
|
14021
14031
|
return "src_" + createHash4("sha256").update(path).digest("hex").slice(0, 12);
|
|
14022
14032
|
}
|
|
@@ -14057,7 +14067,7 @@ function countTranscripts(root, tool) {
|
|
|
14057
14067
|
return;
|
|
14058
14068
|
}
|
|
14059
14069
|
for (const e of entries) {
|
|
14060
|
-
const full =
|
|
14070
|
+
const full = join20(dir, e.name);
|
|
14061
14071
|
if (e.isDirectory()) {
|
|
14062
14072
|
walk(full, depth + 1);
|
|
14063
14073
|
continue;
|
|
@@ -14129,10 +14139,10 @@ var init_source_discovery = __esm({
|
|
|
14129
14139
|
// ../engine/dist/core/home-discovery.js
|
|
14130
14140
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
14131
14141
|
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
|
|
14142
|
+
import { homedir as homedir6, platform as osPlatform } from "os";
|
|
14143
|
+
import { basename as basename12, join as join21 } from "path";
|
|
14134
14144
|
function candidateRoots(plat = osPlatform(), env = process.env) {
|
|
14135
|
-
const home =
|
|
14145
|
+
const home = homedir6();
|
|
14136
14146
|
const roots = [home];
|
|
14137
14147
|
const add = (p) => {
|
|
14138
14148
|
if (p && !roots.includes(p))
|
|
@@ -14143,11 +14153,11 @@ function candidateRoots(plat = osPlatform(), env = process.env) {
|
|
|
14143
14153
|
add(env.LOCALAPPDATA);
|
|
14144
14154
|
add(env.USERPROFILE);
|
|
14145
14155
|
} else if (plat === "darwin") {
|
|
14146
|
-
add(
|
|
14156
|
+
add(join21(home, "Library", "Application Support"));
|
|
14147
14157
|
add(env.XDG_CONFIG_HOME);
|
|
14148
14158
|
} else {
|
|
14149
|
-
add(env.XDG_CONFIG_HOME ||
|
|
14150
|
-
add(env.XDG_DATA_HOME ||
|
|
14159
|
+
add(env.XDG_CONFIG_HOME || join21(home, ".config"));
|
|
14160
|
+
add(env.XDG_DATA_HOME || join21(home, ".local", "share"));
|
|
14151
14161
|
}
|
|
14152
14162
|
return roots.filter((r) => existsSync18(r));
|
|
14153
14163
|
}
|
|
@@ -14160,14 +14170,14 @@ function piRootOf(home) {
|
|
|
14160
14170
|
return piSessionDirForHome(home);
|
|
14161
14171
|
}
|
|
14162
14172
|
function identifyHome(dir) {
|
|
14163
|
-
const has = (...parts) => existsSync18(
|
|
14164
|
-
if (has("projects") && dirHasTranscript(
|
|
14173
|
+
const has = (...parts) => existsSync18(join21(dir, ...parts));
|
|
14174
|
+
if (has("projects") && dirHasTranscript(join21(dir, "projects"), (f) => f.endsWith(".jsonl"), 2))
|
|
14165
14175
|
return "claude";
|
|
14166
|
-
if (has("sessions") && dirHasTranscript(
|
|
14176
|
+
if (has("sessions") && dirHasTranscript(join21(dir, "sessions"), (f) => f.startsWith("rollout-") && f.endsWith(".jsonl"), 4))
|
|
14167
14177
|
return "codex";
|
|
14168
|
-
if (has("brain") && dirHasTranscript(
|
|
14178
|
+
if (has("brain") && dirHasTranscript(join21(dir, "brain"), (f) => f.endsWith(".jsonl"), 4))
|
|
14169
14179
|
return "agy";
|
|
14170
|
-
if (has("chats") && dirHasTranscript(
|
|
14180
|
+
if (has("chats") && dirHasTranscript(join21(dir, "chats"), (f) => f === "store.db", 3))
|
|
14171
14181
|
return "cursor";
|
|
14172
14182
|
if (has("opencode.db"))
|
|
14173
14183
|
return "opencode";
|
|
@@ -14192,7 +14202,7 @@ function dirHasTranscript(root, match, depth) {
|
|
|
14192
14202
|
continue;
|
|
14193
14203
|
if (e.isFile() && match(e.name))
|
|
14194
14204
|
return true;
|
|
14195
|
-
if (e.isDirectory() && dirHasTranscript(
|
|
14205
|
+
if (e.isDirectory() && dirHasTranscript(join21(root, e.name), match, depth - 1))
|
|
14196
14206
|
return true;
|
|
14197
14207
|
}
|
|
14198
14208
|
return false;
|
|
@@ -14213,7 +14223,7 @@ function countSessions(dir, tool) {
|
|
|
14213
14223
|
if (SKIP.has(e.name))
|
|
14214
14224
|
continue;
|
|
14215
14225
|
if (e.isDirectory()) {
|
|
14216
|
-
walk2(
|
|
14226
|
+
walk2(join21(d, e.name), depth - 1);
|
|
14217
14227
|
continue;
|
|
14218
14228
|
}
|
|
14219
14229
|
if (isPiTranscriptName(e.name))
|
|
@@ -14250,12 +14260,12 @@ function countSessions(dir, tool) {
|
|
|
14250
14260
|
if (SKIP.has(e.name))
|
|
14251
14261
|
continue;
|
|
14252
14262
|
if (e.isDirectory())
|
|
14253
|
-
walk(
|
|
14263
|
+
walk(join21(d, e.name), depth - 1);
|
|
14254
14264
|
else if (s.match(e.name))
|
|
14255
14265
|
n++;
|
|
14256
14266
|
}
|
|
14257
14267
|
};
|
|
14258
|
-
walk(
|
|
14268
|
+
walk(join21(dir, s.sub), s.depth);
|
|
14259
14269
|
return n;
|
|
14260
14270
|
}
|
|
14261
14271
|
function declaredHomes(env = process.env, plat = osPlatform()) {
|
|
@@ -14292,8 +14302,8 @@ function declaredHomes(env = process.env, plat = osPlatform()) {
|
|
|
14292
14302
|
}
|
|
14293
14303
|
return out;
|
|
14294
14304
|
}
|
|
14295
|
-
const home =
|
|
14296
|
-
const rcs = [".bashrc", ".bash_profile", ".zshrc", ".zprofile", ".profile"].map((f) =>
|
|
14305
|
+
const home = homedir6();
|
|
14306
|
+
const rcs = [".bashrc", ".bash_profile", ".zshrc", ".zprofile", ".profile"].map((f) => join21(home, f)).concat([join21(home, ".config", "fish", "config.fish")]);
|
|
14297
14307
|
for (const rc of rcs) {
|
|
14298
14308
|
let text;
|
|
14299
14309
|
try {
|
|
@@ -14308,7 +14318,7 @@ function declaredHomes(env = process.env, plat = osPlatform()) {
|
|
|
14308
14318
|
add(d);
|
|
14309
14319
|
}
|
|
14310
14320
|
}
|
|
14311
|
-
return out.map((p) => p.startsWith("~") ?
|
|
14321
|
+
return out.map((p) => p.startsWith("~") ? join21(home, p.slice(1)) : p);
|
|
14312
14322
|
}
|
|
14313
14323
|
function runningToolHomes(plat = osPlatform()) {
|
|
14314
14324
|
const out = [];
|
|
@@ -14379,9 +14389,9 @@ function discoverHomes(opts = {}) {
|
|
|
14379
14389
|
found.set(real, { tool, path: real, via, sessions: countSessions(real, tool) });
|
|
14380
14390
|
if (tool === "hermes") {
|
|
14381
14391
|
try {
|
|
14382
|
-
for (const e of readdirSync14(
|
|
14392
|
+
for (const e of readdirSync14(join21(real, "profiles"), { withFileTypes: true })) {
|
|
14383
14393
|
if (e.isDirectory())
|
|
14384
|
-
consider(
|
|
14394
|
+
consider(join21(real, "profiles", e.name), via);
|
|
14385
14395
|
}
|
|
14386
14396
|
} catch {
|
|
14387
14397
|
}
|
|
@@ -14411,7 +14421,7 @@ function walkForHomes(dir, depth, visit) {
|
|
|
14411
14421
|
for (const e of entries) {
|
|
14412
14422
|
if (!e.isDirectory() || SKIP.has(e.name))
|
|
14413
14423
|
continue;
|
|
14414
|
-
const child =
|
|
14424
|
+
const child = join21(dir, e.name);
|
|
14415
14425
|
visit(child);
|
|
14416
14426
|
walkForHomes(child, depth - 1, visit);
|
|
14417
14427
|
}
|
|
@@ -14455,12 +14465,12 @@ var init_home_discovery = __esm({
|
|
|
14455
14465
|
// ../engine/dist/core/detector-install.js
|
|
14456
14466
|
import { createHash as createHash5 } from "crypto";
|
|
14457
14467
|
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
|
|
14468
|
+
import { join as join22 } from "path";
|
|
14459
14469
|
function managedDetectorPath(name) {
|
|
14460
|
-
return
|
|
14470
|
+
return join22(getDetectorBinDir(), name + exeSuffix());
|
|
14461
14471
|
}
|
|
14462
14472
|
function receiptPath(name) {
|
|
14463
|
-
return
|
|
14473
|
+
return join22(getDetectorBinDir(), `${name}.receipt.json`);
|
|
14464
14474
|
}
|
|
14465
14475
|
function sha256File(path) {
|
|
14466
14476
|
return createHash5("sha256").update(readFileSync15(path)).digest("hex");
|
|
@@ -14493,7 +14503,7 @@ function configuredDir() {
|
|
|
14493
14503
|
function resolveDetector(name) {
|
|
14494
14504
|
const dir = configuredDir();
|
|
14495
14505
|
if (dir) {
|
|
14496
|
-
const p2 =
|
|
14506
|
+
const p2 = join22(dir, name + exeSuffix());
|
|
14497
14507
|
if (existsSync19(p2))
|
|
14498
14508
|
return { path: p2, version: "operator-supplied", source: "configured" };
|
|
14499
14509
|
return { error: "not-installed" };
|
|
@@ -14560,7 +14570,7 @@ var init_detector_install = __esm({
|
|
|
14560
14570
|
import { spawnSync } from "child_process";
|
|
14561
14571
|
import { existsSync as existsSync20, unlinkSync, readFileSync as readFileSync16, mkdtempSync as mkdtempSync2, rmSync as rmSync3 } from "fs";
|
|
14562
14572
|
import { tmpdir } from "os";
|
|
14563
|
-
import { join as
|
|
14573
|
+
import { join as join23 } from "path";
|
|
14564
14574
|
function mask(s) {
|
|
14565
14575
|
if (!s)
|
|
14566
14576
|
return "";
|
|
@@ -14588,7 +14598,7 @@ function whichDetector(bin) {
|
|
|
14588
14598
|
return null;
|
|
14589
14599
|
}
|
|
14590
14600
|
function spawnScoped(binary, args, opts) {
|
|
14591
|
-
const scratch = mkdtempSync2(
|
|
14601
|
+
const scratch = mkdtempSync2(join23(tmpdir(), "cr-scan-tmp-"));
|
|
14592
14602
|
try {
|
|
14593
14603
|
return spawnSync(binary, args, {
|
|
14594
14604
|
...opts,
|
|
@@ -15158,9 +15168,9 @@ var init_transcript = __esm({
|
|
|
15158
15168
|
import { execSync } from "child_process";
|
|
15159
15169
|
import { createHash as createHash6 } from "crypto";
|
|
15160
15170
|
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
|
|
15171
|
+
import { basename as basename13, dirname as dirname14, isAbsolute as isAbsolute2, join as join24, resolve, sep } from "path";
|
|
15162
15172
|
function getProjectsConfigPath() {
|
|
15163
|
-
return
|
|
15173
|
+
return join24(getDataDir(), "projects.json");
|
|
15164
15174
|
}
|
|
15165
15175
|
function loadProjectsConfig() {
|
|
15166
15176
|
if (cachedConfig && cachedConfig.mtime === Number.MAX_SAFE_INTEGER) {
|
|
@@ -15272,7 +15282,7 @@ function matchDeclaredProject(realPath, projects) {
|
|
|
15272
15282
|
function matchChild(realPath, parentRoot, children) {
|
|
15273
15283
|
const sorted = [...children].sort((a, b) => b.path.length - a.path.length);
|
|
15274
15284
|
for (const c of sorted) {
|
|
15275
|
-
const childRoot = safeRealpath(
|
|
15285
|
+
const childRoot = safeRealpath(join24(parentRoot, c.path));
|
|
15276
15286
|
if (isInside(realPath, childRoot))
|
|
15277
15287
|
return c;
|
|
15278
15288
|
}
|
|
@@ -15307,7 +15317,7 @@ function findGitToplevel(realPath) {
|
|
|
15307
15317
|
let cur = realPath;
|
|
15308
15318
|
let last = "";
|
|
15309
15319
|
while (cur && cur !== last) {
|
|
15310
|
-
if (existsSync21(
|
|
15320
|
+
if (existsSync21(join24(cur, ".git")))
|
|
15311
15321
|
return cur;
|
|
15312
15322
|
last = cur;
|
|
15313
15323
|
cur = dirname14(cur);
|
|
@@ -15374,7 +15384,7 @@ function resolveAutoWorkspace(realPath, minRepos) {
|
|
|
15374
15384
|
let last = "";
|
|
15375
15385
|
let depth = 0;
|
|
15376
15386
|
while (cur && cur !== last && depth < AUTO_WORKSPACE_MAX_DEPTH) {
|
|
15377
|
-
if (!existsSync21(
|
|
15387
|
+
if (!existsSync21(join24(cur, ".git"))) {
|
|
15378
15388
|
const cached = workspaceCache.get(cur);
|
|
15379
15389
|
let qualifies;
|
|
15380
15390
|
if (cached === void 0) {
|
|
@@ -15405,12 +15415,12 @@ function countGitChildren(dir) {
|
|
|
15405
15415
|
for (const name of entries) {
|
|
15406
15416
|
if (name.startsWith("."))
|
|
15407
15417
|
continue;
|
|
15408
|
-
const child =
|
|
15418
|
+
const child = join24(dir, name);
|
|
15409
15419
|
try {
|
|
15410
15420
|
const st = statSync20(child);
|
|
15411
15421
|
if (!st.isDirectory())
|
|
15412
15422
|
continue;
|
|
15413
|
-
if (existsSync21(
|
|
15423
|
+
if (existsSync21(join24(child, ".git")))
|
|
15414
15424
|
count++;
|
|
15415
15425
|
} catch {
|
|
15416
15426
|
}
|
|
@@ -16119,8 +16129,8 @@ var init_source_registry = __esm({
|
|
|
16119
16129
|
|
|
16120
16130
|
// ../engine/dist/core/utils.js
|
|
16121
16131
|
import { existsSync as existsSync22, readdirSync as readdirSync16 } from "fs";
|
|
16122
|
-
import { homedir as
|
|
16123
|
-
import { join as
|
|
16132
|
+
import { homedir as homedir7 } from "os";
|
|
16133
|
+
import { join as join25 } from "path";
|
|
16124
16134
|
function splitByHeaders(markdown) {
|
|
16125
16135
|
const lines = markdown.split("\n");
|
|
16126
16136
|
const sections = [];
|
|
@@ -16150,7 +16160,7 @@ function splitByHeaders(markdown) {
|
|
|
16150
16160
|
return sections;
|
|
16151
16161
|
}
|
|
16152
16162
|
function getClaudeDirs() {
|
|
16153
|
-
const home =
|
|
16163
|
+
const home = homedir7();
|
|
16154
16164
|
const dirs = [];
|
|
16155
16165
|
const seen = /* @__PURE__ */ new Set();
|
|
16156
16166
|
const add = (dir) => {
|
|
@@ -16163,17 +16173,17 @@ function getClaudeDirs() {
|
|
|
16163
16173
|
for (const d of process.env.CLAUDE_DIRS.split(",")) {
|
|
16164
16174
|
const trimmed = d.trim();
|
|
16165
16175
|
if (trimmed) {
|
|
16166
|
-
add(trimmed.startsWith("~/") ?
|
|
16176
|
+
add(trimmed.startsWith("~/") ? join25(home, trimmed.slice(2)) : trimmed);
|
|
16167
16177
|
}
|
|
16168
16178
|
}
|
|
16169
16179
|
}
|
|
16170
|
-
add(
|
|
16180
|
+
add(join25(home, ".claude"));
|
|
16171
16181
|
try {
|
|
16172
16182
|
const entries = readdirSync16(home, { withFileTypes: true });
|
|
16173
16183
|
for (const entry of entries) {
|
|
16174
16184
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
16175
|
-
const candidate =
|
|
16176
|
-
if (existsSync22(
|
|
16185
|
+
const candidate = join25(home, entry.name);
|
|
16186
|
+
if (existsSync22(join25(candidate, "projects"))) {
|
|
16177
16187
|
add(candidate);
|
|
16178
16188
|
}
|
|
16179
16189
|
}
|
|
@@ -16185,12 +16195,12 @@ function getClaudeDirs() {
|
|
|
16185
16195
|
function discoverSubdirs(subdir) {
|
|
16186
16196
|
const result = [];
|
|
16187
16197
|
for (const claudeDir of getClaudeDirs()) {
|
|
16188
|
-
const path =
|
|
16198
|
+
const path = join25(claudeDir, subdir);
|
|
16189
16199
|
if (existsSync22(path)) {
|
|
16190
16200
|
result.push(path);
|
|
16191
16201
|
}
|
|
16192
16202
|
}
|
|
16193
|
-
return result.length > 0 ? result : [
|
|
16203
|
+
return result.length > 0 ? result : [join25(homedir7(), ".claude", subdir)];
|
|
16194
16204
|
}
|
|
16195
16205
|
var init_utils = __esm({
|
|
16196
16206
|
"../engine/dist/core/utils.js"() {
|
|
@@ -16200,8 +16210,8 @@ var init_utils = __esm({
|
|
|
16200
16210
|
|
|
16201
16211
|
// ../engine/dist/parsers/plan-source.js
|
|
16202
16212
|
import { existsSync as existsSync23, readdirSync as readdirSync17, readFileSync as readFileSync18, statSync as statSync22 } from "fs";
|
|
16203
|
-
import { homedir as
|
|
16204
|
-
import { join as
|
|
16213
|
+
import { homedir as homedir8 } from "os";
|
|
16214
|
+
import { join as join26, basename as basename14 } from "path";
|
|
16205
16215
|
function parseFrontmatter(content) {
|
|
16206
16216
|
if (!content.startsWith("---"))
|
|
16207
16217
|
return { body: content };
|
|
@@ -16296,7 +16306,7 @@ var init_plan_source = __esm({
|
|
|
16296
16306
|
if (seenClaude.has(file))
|
|
16297
16307
|
continue;
|
|
16298
16308
|
seenClaude.add(file);
|
|
16299
|
-
const filePath =
|
|
16309
|
+
const filePath = join26(plansDir, file);
|
|
16300
16310
|
try {
|
|
16301
16311
|
const stat3 = statSync22(filePath);
|
|
16302
16312
|
const planName = basename14(file, ".md");
|
|
@@ -16340,7 +16350,7 @@ var init_plan_source = __esm({
|
|
|
16340
16350
|
return;
|
|
16341
16351
|
}
|
|
16342
16352
|
for (const file of files) {
|
|
16343
|
-
const filePath =
|
|
16353
|
+
const filePath = join26(plansDir, file);
|
|
16344
16354
|
try {
|
|
16345
16355
|
const stat3 = statSync22(filePath);
|
|
16346
16356
|
const content = readFileSync18(filePath, "utf-8");
|
|
@@ -16371,7 +16381,7 @@ var init_plan_source = __esm({
|
|
|
16371
16381
|
for (const match of content.matchAll(fullPathPattern)) {
|
|
16372
16382
|
let path = (match[1] || "").trim();
|
|
16373
16383
|
if (path.startsWith("~/")) {
|
|
16374
|
-
path =
|
|
16384
|
+
path = join26(homedir8(), path.slice(2));
|
|
16375
16385
|
}
|
|
16376
16386
|
for (const projectDir of knownProjects) {
|
|
16377
16387
|
if (path.startsWith(projectDir)) {
|
|
@@ -16456,9 +16466,9 @@ var init_plan_source = __esm({
|
|
|
16456
16466
|
const map = /* @__PURE__ */ new Map();
|
|
16457
16467
|
const root = claudeBackend.projectsDir();
|
|
16458
16468
|
for (const proj of safeReaddir(root)) {
|
|
16459
|
-
const projPath =
|
|
16469
|
+
const projPath = join26(root, proj);
|
|
16460
16470
|
for (const sessionEntry of safeReaddir(projPath)) {
|
|
16461
|
-
const subDir =
|
|
16471
|
+
const subDir = join26(projPath, sessionEntry, "subagents");
|
|
16462
16472
|
if (!existsSync23(subDir))
|
|
16463
16473
|
continue;
|
|
16464
16474
|
for (const f of safeReaddir(subDir)) {
|
|
@@ -16533,7 +16543,7 @@ var init_plan_source = __esm({
|
|
|
16533
16543
|
return links;
|
|
16534
16544
|
}
|
|
16535
16545
|
async *discoverAgyPlans() {
|
|
16536
|
-
const brainDir =
|
|
16546
|
+
const brainDir = join26(agyBackend.homeDir(), "brain");
|
|
16537
16547
|
if (!existsSync23(brainDir))
|
|
16538
16548
|
return;
|
|
16539
16549
|
let sessionDirs;
|
|
@@ -16543,7 +16553,7 @@ var init_plan_source = __esm({
|
|
|
16543
16553
|
return;
|
|
16544
16554
|
}
|
|
16545
16555
|
for (const rawId of sessionDirs) {
|
|
16546
|
-
const sessionPath =
|
|
16556
|
+
const sessionPath = join26(brainDir, rawId);
|
|
16547
16557
|
try {
|
|
16548
16558
|
if (!statSync22(sessionPath).isDirectory())
|
|
16549
16559
|
continue;
|
|
@@ -16557,7 +16567,7 @@ var init_plan_source = __esm({
|
|
|
16557
16567
|
continue;
|
|
16558
16568
|
}
|
|
16559
16569
|
for (const file of files) {
|
|
16560
|
-
const filePath =
|
|
16570
|
+
const filePath = join26(sessionPath, file);
|
|
16561
16571
|
try {
|
|
16562
16572
|
const stat3 = statSync22(filePath);
|
|
16563
16573
|
const content = readFileSync18(filePath, "utf-8");
|
|
@@ -16590,7 +16600,7 @@ var init_plan_source = __esm({
|
|
|
16590
16600
|
|
|
16591
16601
|
// ../engine/dist/parsers/task-source.js
|
|
16592
16602
|
import { existsSync as existsSync24, readdirSync as readdirSync18, readFileSync as readFileSync19, statSync as statSync23 } from "fs";
|
|
16593
|
-
import { join as
|
|
16603
|
+
import { join as join27 } from "path";
|
|
16594
16604
|
var MAX_CHUNK_CHARS2, TaskSource;
|
|
16595
16605
|
var init_task_source = __esm({
|
|
16596
16606
|
"../engine/dist/parsers/task-source.js"() {
|
|
@@ -16628,7 +16638,7 @@ var init_task_source = __esm({
|
|
|
16628
16638
|
return;
|
|
16629
16639
|
}
|
|
16630
16640
|
for (const file of files) {
|
|
16631
|
-
const filePath =
|
|
16641
|
+
const filePath = join27(todosDir, file);
|
|
16632
16642
|
let stat3;
|
|
16633
16643
|
try {
|
|
16634
16644
|
stat3 = statSync23(filePath);
|
|
@@ -16677,7 +16687,7 @@ var init_task_source = __esm({
|
|
|
16677
16687
|
if (!entry.isDirectory())
|
|
16678
16688
|
continue;
|
|
16679
16689
|
const sessionUuid = entry.name;
|
|
16680
|
-
const taskDir =
|
|
16690
|
+
const taskDir = join27(tasksDir, sessionUuid);
|
|
16681
16691
|
try {
|
|
16682
16692
|
const stat3 = statSync23(taskDir);
|
|
16683
16693
|
const taskFiles = readdirSync18(taskDir).filter((f) => f.endsWith(".json"));
|
|
@@ -16752,7 +16762,7 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
|
|
|
16752
16762
|
text,
|
|
16753
16763
|
chunkType: "task_detail",
|
|
16754
16764
|
projectPath: item.projectPath,
|
|
16755
|
-
filePath:
|
|
16765
|
+
filePath: join27(taskDir, `${task.id}.json`),
|
|
16756
16766
|
mtime: item.mtime
|
|
16757
16767
|
});
|
|
16758
16768
|
}
|
|
@@ -16809,7 +16819,7 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
|
|
|
16809
16819
|
});
|
|
16810
16820
|
for (const file of sorted) {
|
|
16811
16821
|
try {
|
|
16812
|
-
const content = readFileSync19(
|
|
16822
|
+
const content = readFileSync19(join27(taskDir, file), "utf-8");
|
|
16813
16823
|
const task = JSON.parse(content);
|
|
16814
16824
|
if (task.subject) {
|
|
16815
16825
|
tasks.push(task);
|
|
@@ -16826,8 +16836,8 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
|
|
|
16826
16836
|
|
|
16827
16837
|
// ../engine/dist/parsers/claude-md-source.js
|
|
16828
16838
|
import { existsSync as existsSync25, readFileSync as readFileSync20, readdirSync as readdirSync19, statSync as statSync24 } from "fs";
|
|
16829
|
-
import { homedir as
|
|
16830
|
-
import { join as
|
|
16839
|
+
import { homedir as homedir9 } from "os";
|
|
16840
|
+
import { join as join28, basename as basename15, dirname as dirname15 } from "path";
|
|
16831
16841
|
import { createHash as createHash7 } from "crypto";
|
|
16832
16842
|
function discoverProjectDirs(claudeDir) {
|
|
16833
16843
|
const dirs = [];
|
|
@@ -16853,15 +16863,15 @@ function discoverProjectDirs(claudeDir) {
|
|
|
16853
16863
|
}
|
|
16854
16864
|
};
|
|
16855
16865
|
if (claudeDir) {
|
|
16856
|
-
scanProjectsDir(
|
|
16866
|
+
scanProjectsDir(join28(claudeDir, "projects"));
|
|
16857
16867
|
return dirs;
|
|
16858
16868
|
}
|
|
16859
|
-
const home =
|
|
16869
|
+
const home = homedir9();
|
|
16860
16870
|
scanProjectsDir(claudeBackend.projectsDir());
|
|
16861
16871
|
try {
|
|
16862
16872
|
for (const entry of readdirSync19(home, { withFileTypes: true })) {
|
|
16863
16873
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
16864
|
-
scanProjectsDir(
|
|
16874
|
+
scanProjectsDir(join28(home, entry.name, "projects"));
|
|
16865
16875
|
}
|
|
16866
16876
|
}
|
|
16867
16877
|
} catch {
|
|
@@ -16925,7 +16935,7 @@ var init_claude_md_source = __esm({
|
|
|
16925
16935
|
const seen = /* @__PURE__ */ new Set();
|
|
16926
16936
|
const seenKey = (path, tool) => `${tool}:${path}`;
|
|
16927
16937
|
for (const note of NOTE_FILES) {
|
|
16928
|
-
const p =
|
|
16938
|
+
const p = join28(homedir9(), note.filename);
|
|
16929
16939
|
const key2 = seenKey(p, note.tool);
|
|
16930
16940
|
if (existsSync25(p) && !seen.has(key2)) {
|
|
16931
16941
|
seen.add(key2);
|
|
@@ -16937,7 +16947,7 @@ var init_claude_md_source = __esm({
|
|
|
16937
16947
|
const projectDirs = discoverProjectDirs(this.claudeDir);
|
|
16938
16948
|
for (const projectDir of projectDirs) {
|
|
16939
16949
|
for (const note of NOTE_FILES) {
|
|
16940
|
-
const p =
|
|
16950
|
+
const p = join28(projectDir, note.filename);
|
|
16941
16951
|
const key2 = seenKey(p, note.tool);
|
|
16942
16952
|
if (existsSync25(p) && !seen.has(key2)) {
|
|
16943
16953
|
seen.add(key2);
|
|
@@ -16951,7 +16961,7 @@ var init_claude_md_source = __esm({
|
|
|
16951
16961
|
if (!existsSync25(searchDir))
|
|
16952
16962
|
continue;
|
|
16953
16963
|
for (const note of NOTE_FILES) {
|
|
16954
|
-
const directPath =
|
|
16964
|
+
const directPath = join28(searchDir, note.filename);
|
|
16955
16965
|
const key2 = seenKey(directPath, note.tool);
|
|
16956
16966
|
if (existsSync25(directPath) && !seen.has(key2)) {
|
|
16957
16967
|
seen.add(key2);
|
|
@@ -16966,7 +16976,7 @@ var init_claude_md_source = __esm({
|
|
|
16966
16976
|
if (!entry.isDirectory())
|
|
16967
16977
|
continue;
|
|
16968
16978
|
for (const note of NOTE_FILES) {
|
|
16969
|
-
const p =
|
|
16979
|
+
const p = join28(searchDir, entry.name, note.filename);
|
|
16970
16980
|
const key2 = seenKey(p, note.tool);
|
|
16971
16981
|
if (existsSync25(p) && !seen.has(key2)) {
|
|
16972
16982
|
seen.add(key2);
|
|
@@ -17052,8 +17062,8 @@ var init_claude_md_source = __esm({
|
|
|
17052
17062
|
|
|
17053
17063
|
// ../engine/dist/parsers/agent-memory-source.js
|
|
17054
17064
|
import { existsSync as existsSync26, readFileSync as readFileSync21, readdirSync as readdirSync20, statSync as statSync25 } from "fs";
|
|
17055
|
-
import { homedir as
|
|
17056
|
-
import { join as
|
|
17065
|
+
import { homedir as homedir10 } from "os";
|
|
17066
|
+
import { join as join29, basename as basename16 } from "path";
|
|
17057
17067
|
function parseFrontmatter2(content) {
|
|
17058
17068
|
const fm = {};
|
|
17059
17069
|
let body = content;
|
|
@@ -17090,12 +17100,12 @@ function discoverMemoryDirs() {
|
|
|
17090
17100
|
out.push({ memoryDir, projectHash });
|
|
17091
17101
|
}
|
|
17092
17102
|
};
|
|
17093
|
-
const home =
|
|
17103
|
+
const home = homedir10();
|
|
17094
17104
|
const claudeRoots = [claudeBackend.projectsDir()];
|
|
17095
17105
|
try {
|
|
17096
17106
|
for (const entry of readdirSync20(home, { withFileTypes: true })) {
|
|
17097
17107
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
17098
|
-
claudeRoots.push(
|
|
17108
|
+
claudeRoots.push(join29(home, entry.name, "projects"));
|
|
17099
17109
|
}
|
|
17100
17110
|
}
|
|
17101
17111
|
} catch {
|
|
@@ -17107,7 +17117,7 @@ function discoverMemoryDirs() {
|
|
|
17107
17117
|
for (const entry of readdirSync20(projectsDir, { withFileTypes: true })) {
|
|
17108
17118
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
17109
17119
|
continue;
|
|
17110
|
-
add(
|
|
17120
|
+
add(join29(projectsDir, entry.name, "memory"), entry.name);
|
|
17111
17121
|
}
|
|
17112
17122
|
} catch {
|
|
17113
17123
|
}
|
|
@@ -17136,7 +17146,7 @@ var init_agent_memory_source = __esm({
|
|
|
17136
17146
|
for (const entry of readdirSync20(memoryDir, { withFileTypes: true })) {
|
|
17137
17147
|
if (!entry.isFile() || !entry.name.endsWith(".md"))
|
|
17138
17148
|
continue;
|
|
17139
|
-
const filePath =
|
|
17149
|
+
const filePath = join29(memoryDir, entry.name);
|
|
17140
17150
|
if (seen.has(filePath))
|
|
17141
17151
|
continue;
|
|
17142
17152
|
seen.add(filePath);
|
|
@@ -17239,8 +17249,8 @@ var init_agent_memory_source = __esm({
|
|
|
17239
17249
|
import { existsSync as existsSync27, readdirSync as readdirSync21, statSync as statSync26 } from "fs";
|
|
17240
17250
|
import { createReadStream as createReadStream3 } from "fs";
|
|
17241
17251
|
import { createInterface as createInterface2 } from "readline";
|
|
17242
|
-
import { homedir as
|
|
17243
|
-
import { join as
|
|
17252
|
+
import { homedir as homedir11 } from "os";
|
|
17253
|
+
import { join as join30 } from "path";
|
|
17244
17254
|
var MAX_CHUNK_CHARS5, HistorySource;
|
|
17245
17255
|
var init_history_source = __esm({
|
|
17246
17256
|
"../engine/dist/parsers/history-source.js"() {
|
|
@@ -17255,7 +17265,7 @@ var init_history_source = __esm({
|
|
|
17255
17265
|
if (historyPath) {
|
|
17256
17266
|
this.historyPaths = [historyPath];
|
|
17257
17267
|
} else {
|
|
17258
|
-
const home =
|
|
17268
|
+
const home = homedir11();
|
|
17259
17269
|
const paths = [];
|
|
17260
17270
|
const tryAdd = (p) => {
|
|
17261
17271
|
if (existsSync27(p) && !paths.includes(p))
|
|
@@ -17265,12 +17275,12 @@ var init_history_source = __esm({
|
|
|
17265
17275
|
try {
|
|
17266
17276
|
for (const entry of readdirSync21(home, { withFileTypes: true })) {
|
|
17267
17277
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
17268
|
-
tryAdd(
|
|
17278
|
+
tryAdd(join30(home, entry.name, "history.jsonl"));
|
|
17269
17279
|
}
|
|
17270
17280
|
}
|
|
17271
17281
|
} catch {
|
|
17272
17282
|
}
|
|
17273
|
-
this.historyPaths = paths.length > 0 ? paths : [
|
|
17283
|
+
this.historyPaths = paths.length > 0 ? paths : [join30(home, ".claude", "history.jsonl")];
|
|
17274
17284
|
}
|
|
17275
17285
|
}
|
|
17276
17286
|
async *discover() {
|
|
@@ -17421,8 +17431,8 @@ var init_history_source = __esm({
|
|
|
17421
17431
|
|
|
17422
17432
|
// ../engine/dist/parsers/paste-source.js
|
|
17423
17433
|
import { existsSync as existsSync28, readdirSync as readdirSync22, readFileSync as readFileSync22, statSync as statSync27 } from "fs";
|
|
17424
|
-
import { homedir as
|
|
17425
|
-
import { join as
|
|
17434
|
+
import { homedir as homedir12 } from "os";
|
|
17435
|
+
import { join as join31, basename as basename17 } from "path";
|
|
17426
17436
|
var MAX_CHUNK_CHARS6, MAX_FILE_SIZE, PasteSource;
|
|
17427
17437
|
var init_paste_source = __esm({
|
|
17428
17438
|
"../engine/dist/parsers/paste-source.js"() {
|
|
@@ -17438,7 +17448,7 @@ var init_paste_source = __esm({
|
|
|
17438
17448
|
if (cacheDir) {
|
|
17439
17449
|
this.cacheDirs = [cacheDir];
|
|
17440
17450
|
} else {
|
|
17441
|
-
const home =
|
|
17451
|
+
const home = homedir12();
|
|
17442
17452
|
const dirs = [];
|
|
17443
17453
|
const tryAdd = (p) => {
|
|
17444
17454
|
if (existsSync28(p) && !dirs.includes(p))
|
|
@@ -17448,7 +17458,7 @@ var init_paste_source = __esm({
|
|
|
17448
17458
|
try {
|
|
17449
17459
|
for (const entry of readdirSync22(home, { withFileTypes: true })) {
|
|
17450
17460
|
if (entry.isDirectory() && entry.name.startsWith(".claude-") && entry.name !== ".claude-code") {
|
|
17451
|
-
tryAdd(
|
|
17461
|
+
tryAdd(join31(home, entry.name, "paste-cache"));
|
|
17452
17462
|
}
|
|
17453
17463
|
}
|
|
17454
17464
|
} catch {
|
|
@@ -17468,7 +17478,7 @@ var init_paste_source = __esm({
|
|
|
17468
17478
|
if (seen.has(file))
|
|
17469
17479
|
continue;
|
|
17470
17480
|
seen.add(file);
|
|
17471
|
-
const filePath =
|
|
17481
|
+
const filePath = join31(cacheDir, file);
|
|
17472
17482
|
try {
|
|
17473
17483
|
const stat3 = statSync27(filePath);
|
|
17474
17484
|
if (stat3.size > MAX_FILE_SIZE)
|
|
@@ -17521,7 +17531,7 @@ var init_paste_source = __esm({
|
|
|
17521
17531
|
|
|
17522
17532
|
// ../engine/dist/parsers/antigravity-brain-source.js
|
|
17523
17533
|
import { existsSync as existsSync29, readdirSync as readdirSync23, readFileSync as readFileSync23, statSync as statSync28 } from "fs";
|
|
17524
|
-
import { join as
|
|
17534
|
+
import { join as join32 } from "path";
|
|
17525
17535
|
var MAX_CHUNK_CHARS7, AntigravityBrainSource;
|
|
17526
17536
|
var init_antigravity_brain_source = __esm({
|
|
17527
17537
|
"../engine/dist/parsers/antigravity-brain-source.js"() {
|
|
@@ -17545,12 +17555,12 @@ var init_antigravity_brain_source = __esm({
|
|
|
17545
17555
|
for (const entry of sessions) {
|
|
17546
17556
|
if (!entry.isDirectory())
|
|
17547
17557
|
continue;
|
|
17548
|
-
const sessionDir =
|
|
17558
|
+
const sessionDir = join32(this.brainDir, entry.name);
|
|
17549
17559
|
const files = readdirSync23(sessionDir).filter((f) => f.endsWith(".md") && !f.includes(".resolved") && !f.includes(".metadata"));
|
|
17550
17560
|
if (files.length === 0)
|
|
17551
17561
|
continue;
|
|
17552
17562
|
for (const file of files) {
|
|
17553
|
-
const filePath =
|
|
17563
|
+
const filePath = join32(sessionDir, file);
|
|
17554
17564
|
try {
|
|
17555
17565
|
const stat3 = statSync28(filePath);
|
|
17556
17566
|
const content = readFileSync23(filePath, "utf-8");
|
|
@@ -17935,7 +17945,7 @@ var init_opencode_todo_source = __esm({
|
|
|
17935
17945
|
|
|
17936
17946
|
// ../engine/dist/parsers/codex-session-source.js
|
|
17937
17947
|
import { existsSync as existsSync32, readdirSync as readdirSync24, readFileSync as readFileSync24, statSync as statSync29 } from "fs";
|
|
17938
|
-
import { join as
|
|
17948
|
+
import { join as join33, basename as basename18 } from "path";
|
|
17939
17949
|
function getCodexSessionsDir() {
|
|
17940
17950
|
return codexBackend.sessionsDir();
|
|
17941
17951
|
}
|
|
@@ -18156,7 +18166,7 @@ var init_codex_session_source = __esm({
|
|
|
18156
18166
|
if (!existsSync32(dir))
|
|
18157
18167
|
return results;
|
|
18158
18168
|
for (const entry of readdirSync24(dir, { withFileTypes: true })) {
|
|
18159
|
-
const fullPath =
|
|
18169
|
+
const fullPath = join33(dir, entry.name);
|
|
18160
18170
|
if (entry.isDirectory()) {
|
|
18161
18171
|
results.push(...this.collectJsonlFiles(fullPath));
|
|
18162
18172
|
} else if (entry.isFile() && entry.name.startsWith("rollout-") && entry.name.endsWith(".jsonl")) {
|
|
@@ -18171,7 +18181,7 @@ var init_codex_session_source = __esm({
|
|
|
18171
18181
|
|
|
18172
18182
|
// ../engine/dist/parsers/diary-source.js
|
|
18173
18183
|
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
|
|
18184
|
+
import { join as join34, basename as basename19 } from "path";
|
|
18175
18185
|
var MAX_CHUNK_CHARS10, DiarySource;
|
|
18176
18186
|
var init_diary_source = __esm({
|
|
18177
18187
|
"../engine/dist/parsers/diary-source.js"() {
|
|
@@ -18190,10 +18200,10 @@ var init_diary_source = __esm({
|
|
|
18190
18200
|
return;
|
|
18191
18201
|
const agents = readdirSync25(this.diaryDir, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
18192
18202
|
for (const agentDir of agents) {
|
|
18193
|
-
const agentPath2 =
|
|
18203
|
+
const agentPath2 = join34(this.diaryDir, agentDir.name);
|
|
18194
18204
|
const files = readdirSync25(agentPath2).filter((f) => f.endsWith(".json"));
|
|
18195
18205
|
for (const file of files) {
|
|
18196
|
-
const filePath =
|
|
18206
|
+
const filePath = join34(agentPath2, file);
|
|
18197
18207
|
try {
|
|
18198
18208
|
const stat3 = statSync30(filePath);
|
|
18199
18209
|
const raw = readFileSync25(filePath, "utf-8");
|
|
@@ -18260,13 +18270,13 @@ var init_diary_source = __esm({
|
|
|
18260
18270
|
*/
|
|
18261
18271
|
static write(entry, diaryDir) {
|
|
18262
18272
|
const dir = diaryDir || getDiaryDir();
|
|
18263
|
-
const agentDir =
|
|
18273
|
+
const agentDir = join34(dir, entry.agent.toLowerCase().replace(/[^a-z0-9_-]/g, "_"));
|
|
18264
18274
|
if (!existsSync33(agentDir)) {
|
|
18265
18275
|
mkdirSync6(agentDir, { recursive: true });
|
|
18266
18276
|
}
|
|
18267
18277
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
18268
18278
|
const entryId = `diary_${entry.agent.toLowerCase()}_${ts}`;
|
|
18269
|
-
const filePath =
|
|
18279
|
+
const filePath = join34(agentDir, `${entryId}.json`);
|
|
18270
18280
|
const full = {
|
|
18271
18281
|
...entry,
|
|
18272
18282
|
timestamp: entry.timestamp || (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -18279,14 +18289,14 @@ var init_diary_source = __esm({
|
|
|
18279
18289
|
*/
|
|
18280
18290
|
static read(agentName, lastN = 10, diaryDir) {
|
|
18281
18291
|
const dir = diaryDir || getDiaryDir();
|
|
18282
|
-
const agentDir =
|
|
18292
|
+
const agentDir = join34(dir, agentName.toLowerCase().replace(/[^a-z0-9_-]/g, "_"));
|
|
18283
18293
|
if (!existsSync33(agentDir))
|
|
18284
18294
|
return [];
|
|
18285
18295
|
const files = readdirSync25(agentDir).filter((f) => f.endsWith(".json")).sort().reverse().slice(0, lastN);
|
|
18286
18296
|
const entries = [];
|
|
18287
18297
|
for (const file of files) {
|
|
18288
18298
|
try {
|
|
18289
|
-
const raw = readFileSync25(
|
|
18299
|
+
const raw = readFileSync25(join34(agentDir, file), "utf-8");
|
|
18290
18300
|
entries.push(JSON.parse(raw));
|
|
18291
18301
|
} catch {
|
|
18292
18302
|
continue;
|
|
@@ -18332,8 +18342,8 @@ var init_redact_inline = __esm({
|
|
|
18332
18342
|
|
|
18333
18343
|
// ../engine/dist/parsers/skills-source.js
|
|
18334
18344
|
import { existsSync as existsSync34, readdirSync as readdirSync26, readFileSync as readFileSync26, statSync as statSync31 } from "fs";
|
|
18335
|
-
import { homedir as
|
|
18336
|
-
import { join as
|
|
18345
|
+
import { homedir as homedir13 } from "os";
|
|
18346
|
+
import { join as join35 } from "path";
|
|
18337
18347
|
function rebuildBody(content) {
|
|
18338
18348
|
const { text, redacted } = redactInlineSecrets(content);
|
|
18339
18349
|
const out = {};
|
|
@@ -18348,34 +18358,34 @@ function rebuildBody(content) {
|
|
|
18348
18358
|
return out;
|
|
18349
18359
|
}
|
|
18350
18360
|
function resolveRoots() {
|
|
18351
|
-
const home =
|
|
18361
|
+
const home = homedir13();
|
|
18352
18362
|
const all = [];
|
|
18353
18363
|
if (isSourceEnabled("shared", "skills")) {
|
|
18354
|
-
all.push({ path:
|
|
18364
|
+
all.push({ path: join35(home, ".agents", "skills"), tool: "shared" });
|
|
18355
18365
|
}
|
|
18356
18366
|
if (isSourceEnabled("claude", "skills")) {
|
|
18357
18367
|
all.push({ path: claudeBackend.skillsDir(), tool: "claude" });
|
|
18358
18368
|
}
|
|
18359
18369
|
if (isSourceEnabled("hermes", "skills")) {
|
|
18360
|
-
all.push({ path:
|
|
18370
|
+
all.push({ path: join35(hermesBackend.homeDir(), "skills"), tool: "hermes", nested: true });
|
|
18361
18371
|
}
|
|
18362
18372
|
if (isSourceEnabled("pi", "skills")) {
|
|
18363
18373
|
all.push({ path: piBackend.skillsDir(), tool: "pi" });
|
|
18364
18374
|
}
|
|
18365
18375
|
if (isSourceEnabled("agy", "skills")) {
|
|
18366
|
-
all.push({ path:
|
|
18376
|
+
all.push({ path: join35(agyBackend.homeDir(), "skills"), tool: "agy" });
|
|
18367
18377
|
all.push({ path: agyBackend.sharedSkillsDir(), tool: "agy" });
|
|
18368
18378
|
}
|
|
18369
18379
|
if (isSourceEnabled("opencode", "skills")) {
|
|
18370
|
-
all.push({ path:
|
|
18380
|
+
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
18381
|
}
|
|
18372
18382
|
if (isSourceEnabled("codex", "skills")) {
|
|
18373
18383
|
all.push({ path: codexBackend.skillsDir(), tool: "codex", skipChildren: [".system"] });
|
|
18374
18384
|
all.push({ path: codexBackend.skillsSystemDir(), tool: "codex", readonly: true });
|
|
18375
18385
|
}
|
|
18376
18386
|
if (isSourceEnabled("cursor", "skills")) {
|
|
18377
|
-
all.push({ path:
|
|
18378
|
-
all.push({ path:
|
|
18387
|
+
all.push({ path: join35(cursorHomeDir(), "skills"), tool: "cursor" });
|
|
18388
|
+
all.push({ path: join35(cursorHomeDir(), "skills-cursor"), tool: "cursor", readonly: true });
|
|
18379
18389
|
}
|
|
18380
18390
|
return all.filter((r) => existsSync34(r.path));
|
|
18381
18391
|
}
|
|
@@ -18420,7 +18430,7 @@ var init_skills_source = __esm({
|
|
|
18420
18430
|
if (!isSourceEnabled("codex", "skills"))
|
|
18421
18431
|
return;
|
|
18422
18432
|
for (const { name: pluginName, dir } of codexBackend.installedPluginDirs()) {
|
|
18423
|
-
const skillsDir =
|
|
18433
|
+
const skillsDir = join35(dir, "skills");
|
|
18424
18434
|
if (!existsSync34(skillsDir))
|
|
18425
18435
|
continue;
|
|
18426
18436
|
yield* this.fromSkillRoot({ path: skillsDir, tool: "codex" }, pluginName);
|
|
@@ -18436,7 +18446,7 @@ var init_skills_source = __esm({
|
|
|
18436
18446
|
for (const name of entries) {
|
|
18437
18447
|
if (root.skipChildren?.includes(name))
|
|
18438
18448
|
continue;
|
|
18439
|
-
const skillDir =
|
|
18449
|
+
const skillDir = join35(root.path, name);
|
|
18440
18450
|
let st;
|
|
18441
18451
|
try {
|
|
18442
18452
|
st = statSync31(skillDir);
|
|
@@ -18445,7 +18455,7 @@ var init_skills_source = __esm({
|
|
|
18445
18455
|
}
|
|
18446
18456
|
if (!st.isDirectory())
|
|
18447
18457
|
continue;
|
|
18448
|
-
const skillMd =
|
|
18458
|
+
const skillMd = join35(skillDir, "SKILL.md");
|
|
18449
18459
|
if (!existsSync34(skillMd)) {
|
|
18450
18460
|
if (root.nested)
|
|
18451
18461
|
yield* this.fromSkillRoot({ ...root, path: skillDir, nested: false });
|
|
@@ -18467,7 +18477,7 @@ var init_skills_source = __esm({
|
|
|
18467
18477
|
const subdirs = {};
|
|
18468
18478
|
try {
|
|
18469
18479
|
for (const sub of readdirSync26(skillDir)) {
|
|
18470
|
-
const subPath =
|
|
18480
|
+
const subPath = join35(skillDir, sub);
|
|
18471
18481
|
try {
|
|
18472
18482
|
const ss = statSync31(subPath);
|
|
18473
18483
|
if (ss.isDirectory()) {
|
|
@@ -25870,9 +25880,9 @@ var require_dist = __commonJS({
|
|
|
25870
25880
|
|
|
25871
25881
|
// ../engine/dist/core/hermes-config.js
|
|
25872
25882
|
import { existsSync as existsSync35, readFileSync as readFileSync27 } from "fs";
|
|
25873
|
-
import { join as
|
|
25883
|
+
import { join as join36 } from "path";
|
|
25874
25884
|
function hermesConfigPath() {
|
|
25875
|
-
return
|
|
25885
|
+
return join36(hermesHomeDir(), "config.yaml");
|
|
25876
25886
|
}
|
|
25877
25887
|
function readHermesMcpServers(path = hermesConfigPath()) {
|
|
25878
25888
|
if (!existsSync35(path))
|
|
@@ -25929,8 +25939,8 @@ var init_hermes_config = __esm({
|
|
|
25929
25939
|
|
|
25930
25940
|
// ../engine/dist/parsers/mcps-source.js
|
|
25931
25941
|
import { existsSync as existsSync36, readFileSync as readFileSync28, statSync as statSync32 } from "fs";
|
|
25932
|
-
import { homedir as
|
|
25933
|
-
import { join as
|
|
25942
|
+
import { homedir as homedir14 } from "os";
|
|
25943
|
+
import { join as join37 } from "path";
|
|
25934
25944
|
function readJson(path) {
|
|
25935
25945
|
if (!existsSync36(path))
|
|
25936
25946
|
return null;
|
|
@@ -25996,24 +26006,24 @@ var init_mcps_source = __esm({
|
|
|
25996
26006
|
async *discover() {
|
|
25997
26007
|
if (!isSourceEnabled("common", "mcps"))
|
|
25998
26008
|
return;
|
|
25999
|
-
const home =
|
|
26000
|
-
yield* this.fromObject(readJson(
|
|
26009
|
+
const home = homedir14();
|
|
26010
|
+
yield* this.fromObject(readJson(join37(home, ".mcp.json"))?.mcpServers, {
|
|
26001
26011
|
tool: "claude",
|
|
26002
|
-
filePath:
|
|
26012
|
+
filePath: join37(home, ".mcp.json"),
|
|
26003
26013
|
scope: "global"
|
|
26004
26014
|
});
|
|
26005
|
-
yield* this.fromObject(readJson(
|
|
26015
|
+
yield* this.fromObject(readJson(join37(home, ".claude.json"))?.mcpServers, {
|
|
26006
26016
|
tool: "claude",
|
|
26007
|
-
filePath:
|
|
26017
|
+
filePath: join37(home, ".claude.json"),
|
|
26008
26018
|
scope: "user"
|
|
26009
26019
|
});
|
|
26010
26020
|
for (const path of [
|
|
26011
|
-
|
|
26012
|
-
|
|
26013
|
-
|
|
26014
|
-
|
|
26015
|
-
|
|
26016
|
-
|
|
26021
|
+
join37(home, ".config", "opencode", "opencode.json"),
|
|
26022
|
+
join37(home, ".config", "opencode", "opencode.jsonc"),
|
|
26023
|
+
join37(home, ".config", "opencode", "config.json"),
|
|
26024
|
+
join37(home, ".opencode", "opencode.json"),
|
|
26025
|
+
join37(home, ".opencode", "opencode.jsonc"),
|
|
26026
|
+
join37(home, ".opencode", "config.json")
|
|
26017
26027
|
]) {
|
|
26018
26028
|
yield* this.fromObject(readJson(path)?.mcp, {
|
|
26019
26029
|
tool: "opencode",
|
|
@@ -26028,7 +26038,7 @@ var init_mcps_source = __esm({
|
|
|
26028
26038
|
filePath: geminiSettings,
|
|
26029
26039
|
scope: "user"
|
|
26030
26040
|
});
|
|
26031
|
-
const cursorMcp =
|
|
26041
|
+
const cursorMcp = join37(cursorHomeDir(), "mcp.json");
|
|
26032
26042
|
yield* this.fromObject(readJson(cursorMcp)?.mcpServers, {
|
|
26033
26043
|
tool: "cursor",
|
|
26034
26044
|
filePath: cursorMcp,
|
|
@@ -26046,7 +26056,7 @@ var init_mcps_source = __esm({
|
|
|
26046
26056
|
filePath: piMcp,
|
|
26047
26057
|
scope: "user"
|
|
26048
26058
|
});
|
|
26049
|
-
const agyMcp =
|
|
26059
|
+
const agyMcp = join37(home, ".gemini", "config", "mcp_config.json");
|
|
26050
26060
|
yield* this.fromObject(readJson(agyMcp)?.mcpServers, {
|
|
26051
26061
|
tool: "agy",
|
|
26052
26062
|
filePath: agyMcp,
|
|
@@ -26054,7 +26064,7 @@ var init_mcps_source = __esm({
|
|
|
26054
26064
|
});
|
|
26055
26065
|
yield* this.fromCodexToml(codexBackend.configToml());
|
|
26056
26066
|
for (const { dir } of codexBackend.installedPluginDirs()) {
|
|
26057
|
-
const mcpPath =
|
|
26067
|
+
const mcpPath = join37(dir, ".mcp.json");
|
|
26058
26068
|
yield* this.fromObject(readJson(mcpPath)?.mcpServers, {
|
|
26059
26069
|
tool: "codex",
|
|
26060
26070
|
filePath: mcpPath,
|
|
@@ -26282,7 +26292,7 @@ var init_toolkit_format = __esm({
|
|
|
26282
26292
|
|
|
26283
26293
|
// ../engine/dist/parsers/slash-commands-source.js
|
|
26284
26294
|
import { existsSync as existsSync37, readdirSync as readdirSync27, readFileSync as readFileSync29, statSync as statSync33 } from "fs";
|
|
26285
|
-
import { join as
|
|
26295
|
+
import { join as join38, basename as basename20 } from "path";
|
|
26286
26296
|
function rebuildBody2(content) {
|
|
26287
26297
|
const { text, redacted } = redactInlineSecrets(content);
|
|
26288
26298
|
const out = {};
|
|
@@ -26341,7 +26351,7 @@ var init_slash_commands_source = __esm({
|
|
|
26341
26351
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
26342
26352
|
continue;
|
|
26343
26353
|
const projectPath = resolveProjectDirName(entry.name);
|
|
26344
|
-
const cmdDir =
|
|
26354
|
+
const cmdDir = join38(projectPath, ".claude", "commands");
|
|
26345
26355
|
if (existsSync37(cmdDir))
|
|
26346
26356
|
roots.push({ path: cmdDir, tool: "claude", scope: "project", projectPath, format: "md" });
|
|
26347
26357
|
}
|
|
@@ -26350,7 +26360,7 @@ var init_slash_commands_source = __esm({
|
|
|
26350
26360
|
}
|
|
26351
26361
|
}
|
|
26352
26362
|
if (isSourceEnabled("agy", "commands")) {
|
|
26353
|
-
roots.push({ path:
|
|
26363
|
+
roots.push({ path: join38(agyBackend.homeDir(), "commands"), tool: "agy", scope: "user", projectPath: "", format: "toml" });
|
|
26354
26364
|
roots.push({ path: agyBackend.sharedCommandsDir(), tool: "agy", scope: "user", projectPath: "", format: "toml" });
|
|
26355
26365
|
}
|
|
26356
26366
|
if (isSourceEnabled("opencode", "commands")) {
|
|
@@ -26360,7 +26370,7 @@ var init_slash_commands_source = __esm({
|
|
|
26360
26370
|
roots.push({ path: codexBackend.promptsDir(), tool: "codex", scope: "user", projectPath: "", format: "md" });
|
|
26361
26371
|
}
|
|
26362
26372
|
if (isSourceEnabled("cursor", "commands")) {
|
|
26363
|
-
roots.push({ path:
|
|
26373
|
+
roots.push({ path: join38(cursorHomeDir(), "commands"), tool: "cursor", scope: "user", projectPath: "", format: "md" });
|
|
26364
26374
|
}
|
|
26365
26375
|
if (isSourceEnabled("pi", "commands")) {
|
|
26366
26376
|
roots.push({ path: piBackend.promptsDir(), tool: "pi", scope: "user", projectPath: "", format: "md" });
|
|
@@ -26377,7 +26387,7 @@ var init_slash_commands_source = __esm({
|
|
|
26377
26387
|
continue;
|
|
26378
26388
|
}
|
|
26379
26389
|
for (const file of files) {
|
|
26380
|
-
const filePath =
|
|
26390
|
+
const filePath = join38(root.path, file);
|
|
26381
26391
|
try {
|
|
26382
26392
|
const stat3 = statSync33(filePath);
|
|
26383
26393
|
const content = readFileSync29(filePath, "utf-8");
|
|
@@ -26433,7 +26443,7 @@ var init_slash_commands_source = __esm({
|
|
|
26433
26443
|
|
|
26434
26444
|
// ../engine/dist/parsers/subagents-source.js
|
|
26435
26445
|
import { existsSync as existsSync38, readdirSync as readdirSync28, readFileSync as readFileSync30, statSync as statSync34 } from "fs";
|
|
26436
|
-
import { join as
|
|
26446
|
+
import { join as join39, basename as basename21 } from "path";
|
|
26437
26447
|
function rebuildBody3(content) {
|
|
26438
26448
|
const { text, redacted } = redactInlineSecrets(content);
|
|
26439
26449
|
const out = {};
|
|
@@ -26493,7 +26503,7 @@ var init_subagents_source = __esm({
|
|
|
26493
26503
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
26494
26504
|
continue;
|
|
26495
26505
|
const projectPath = resolveProjectDirName(entry.name);
|
|
26496
|
-
const agentDir =
|
|
26506
|
+
const agentDir = join39(projectPath, ".claude", "agents");
|
|
26497
26507
|
if (existsSync38(agentDir))
|
|
26498
26508
|
roots.push({ path: agentDir, tool: "claude", scope: "project", projectPath, format: "md" });
|
|
26499
26509
|
}
|
|
@@ -26502,7 +26512,7 @@ var init_subagents_source = __esm({
|
|
|
26502
26512
|
}
|
|
26503
26513
|
}
|
|
26504
26514
|
if (isSourceEnabled("agy", "agents")) {
|
|
26505
|
-
roots.push({ path:
|
|
26515
|
+
roots.push({ path: join39(agyBackend.homeDir(), "agents"), tool: "agy", scope: "user", projectPath: "", format: "md" });
|
|
26506
26516
|
roots.push({ path: agyBackend.sharedAgentsDir(), tool: "agy", scope: "user", projectPath: "", format: "md" });
|
|
26507
26517
|
}
|
|
26508
26518
|
if (isSourceEnabled("opencode", "agents")) {
|
|
@@ -26512,7 +26522,7 @@ var init_subagents_source = __esm({
|
|
|
26512
26522
|
roots.push({ path: codexBackend.agentsDir(), tool: "codex", scope: "user", projectPath: "", format: "toml" });
|
|
26513
26523
|
}
|
|
26514
26524
|
if (isSourceEnabled("cursor", "agents")) {
|
|
26515
|
-
roots.push({ path:
|
|
26525
|
+
roots.push({ path: join39(cursorHomeDir(), "agents"), tool: "cursor", scope: "user", projectPath: "", format: "md" });
|
|
26516
26526
|
}
|
|
26517
26527
|
return roots;
|
|
26518
26528
|
}
|
|
@@ -26526,7 +26536,7 @@ var init_subagents_source = __esm({
|
|
|
26526
26536
|
continue;
|
|
26527
26537
|
}
|
|
26528
26538
|
for (const file of files) {
|
|
26529
|
-
const filePath =
|
|
26539
|
+
const filePath = join39(root.path, file);
|
|
26530
26540
|
try {
|
|
26531
26541
|
const stat3 = statSync34(filePath);
|
|
26532
26542
|
const content = readFileSync30(filePath, "utf-8");
|
|
@@ -26583,7 +26593,7 @@ var init_subagents_source = __esm({
|
|
|
26583
26593
|
|
|
26584
26594
|
// ../engine/dist/parsers/hooks-source.js
|
|
26585
26595
|
import { existsSync as existsSync39, readFileSync as readFileSync31, readdirSync as readdirSync29, statSync as statSync35 } from "fs";
|
|
26586
|
-
import { join as
|
|
26596
|
+
import { join as join40 } from "path";
|
|
26587
26597
|
function readJson2(path) {
|
|
26588
26598
|
if (!existsSync39(path))
|
|
26589
26599
|
return null;
|
|
@@ -26613,7 +26623,7 @@ var init_hooks_source = __esm({
|
|
|
26613
26623
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
26614
26624
|
continue;
|
|
26615
26625
|
const projectPath = resolveProjectDirName(entry.name);
|
|
26616
|
-
const settingsPath2 =
|
|
26626
|
+
const settingsPath2 = join40(projectPath, ".claude", "settings.json");
|
|
26617
26627
|
if (existsSync39(settingsPath2)) {
|
|
26618
26628
|
yield* this.fromSettings(settingsPath2, "project", projectPath);
|
|
26619
26629
|
}
|
|
@@ -26706,8 +26716,8 @@ var init_hooks_source = __esm({
|
|
|
26706
26716
|
|
|
26707
26717
|
// ../engine/dist/parsers/plugins-source.js
|
|
26708
26718
|
import { existsSync as existsSync40, readFileSync as readFileSync32, readdirSync as readdirSync30, statSync as statSync36 } from "fs";
|
|
26709
|
-
import { homedir as
|
|
26710
|
-
import { join as
|
|
26719
|
+
import { homedir as homedir15 } from "os";
|
|
26720
|
+
import { join as join41 } from "path";
|
|
26711
26721
|
function readJson3(path) {
|
|
26712
26722
|
if (!existsSync40(path))
|
|
26713
26723
|
return null;
|
|
@@ -26728,7 +26738,7 @@ var init_plugins_source = __esm({
|
|
|
26728
26738
|
PluginsSource = class {
|
|
26729
26739
|
sourceType = "plugin";
|
|
26730
26740
|
async *discover() {
|
|
26731
|
-
const home =
|
|
26741
|
+
const home = homedir15();
|
|
26732
26742
|
const claudePluginsManifest = claudeBackend.pluginsManifestPath();
|
|
26733
26743
|
const claudeJson = isSourceEnabled("claude", "plugins") ? readJson3(claudePluginsManifest) : null;
|
|
26734
26744
|
if (claudeJson?.plugins && typeof claudeJson.plugins === "object") {
|
|
@@ -26772,7 +26782,7 @@ var init_plugins_source = __esm({
|
|
|
26772
26782
|
entries = [];
|
|
26773
26783
|
}
|
|
26774
26784
|
for (const name of entries) {
|
|
26775
|
-
const dir =
|
|
26785
|
+
const dir = join41(gemRoot, name);
|
|
26776
26786
|
let st;
|
|
26777
26787
|
try {
|
|
26778
26788
|
st = statSync36(dir);
|
|
@@ -26781,7 +26791,7 @@ var init_plugins_source = __esm({
|
|
|
26781
26791
|
}
|
|
26782
26792
|
if (!st.isDirectory())
|
|
26783
26793
|
continue;
|
|
26784
|
-
const manifestPath =
|
|
26794
|
+
const manifestPath = join41(dir, "gemini-extension.json");
|
|
26785
26795
|
const manifest = readJson3(manifestPath);
|
|
26786
26796
|
if (!manifest || typeof manifest !== "object")
|
|
26787
26797
|
continue;
|
|
@@ -26821,11 +26831,11 @@ var init_plugins_source = __esm({
|
|
|
26821
26831
|
}
|
|
26822
26832
|
if (!st.isDirectory())
|
|
26823
26833
|
continue;
|
|
26824
|
-
const appJson = readJson3(
|
|
26825
|
-
const pluginJson = readJson3(
|
|
26834
|
+
const appJson = readJson3(join41(pluginDir, ".codex-plugin", ".app.json"));
|
|
26835
|
+
const pluginJson = readJson3(join41(pluginDir, ".codex-plugin", "plugin.json"));
|
|
26826
26836
|
const manifest = pluginJson || appJson || {};
|
|
26827
26837
|
let mcpServers = [];
|
|
26828
|
-
const mcpJson = readJson3(
|
|
26838
|
+
const mcpJson = readJson3(join41(pluginDir, ".mcp.json"));
|
|
26829
26839
|
if (mcpJson?.mcpServers)
|
|
26830
26840
|
mcpServers = Object.keys(mcpJson.mcpServers);
|
|
26831
26841
|
yield {
|
|
@@ -26833,7 +26843,7 @@ var init_plugins_source = __esm({
|
|
|
26833
26843
|
sourceType: "plugin",
|
|
26834
26844
|
title: manifest.name || name,
|
|
26835
26845
|
projectPath: "",
|
|
26836
|
-
filePath:
|
|
26846
|
+
filePath: join41(pluginDir, ".codex-plugin"),
|
|
26837
26847
|
mtime: st.mtimeMs,
|
|
26838
26848
|
contentPreview: (manifest.description || "").slice(0, 300),
|
|
26839
26849
|
extra: {
|
|
@@ -27006,7 +27016,7 @@ __export(sync_ledger_exports, {
|
|
|
27006
27016
|
unackedCursorAttemptCount: () => unackedCursorAttemptCount
|
|
27007
27017
|
});
|
|
27008
27018
|
import { readFileSync as readFileSync33, writeFileSync as writeFileSync6, renameSync as renameSync4, mkdirSync as mkdirSync7, statSync as statSync37 } from "node:fs";
|
|
27009
|
-
import { join as
|
|
27019
|
+
import { join as join42, dirname as dirname16 } from "node:path";
|
|
27010
27020
|
function toRow(entry) {
|
|
27011
27021
|
if (entry === void 0) return void 0;
|
|
27012
27022
|
return typeof entry === "number" ? { m: entry, v: 0 } : entry;
|
|
@@ -27359,7 +27369,7 @@ var init_sync_ledger = __esm({
|
|
|
27359
27369
|
"use strict";
|
|
27360
27370
|
init_paths();
|
|
27361
27371
|
init_extractor_version();
|
|
27362
|
-
ledgerPath = () =>
|
|
27372
|
+
ledgerPath = () => join42(getDataDir(), "sync-ledger.json");
|
|
27363
27373
|
cache3 = null;
|
|
27364
27374
|
base = /* @__PURE__ */ new Map();
|
|
27365
27375
|
diskStamp = null;
|
|
@@ -27367,11 +27377,11 @@ var init_sync_ledger = __esm({
|
|
|
27367
27377
|
LEDGER_FLUSH_MS = 2e3;
|
|
27368
27378
|
pendingWrite = false;
|
|
27369
27379
|
flushTimer = null;
|
|
27370
|
-
itemVersionsPath = () =>
|
|
27380
|
+
itemVersionsPath = () => join42(getDataDir(), "item-versions.json");
|
|
27371
27381
|
itemVersionsCache = null;
|
|
27372
|
-
inventoryPath = () =>
|
|
27382
|
+
inventoryPath = () => join42(getDataDir(), "toolkit-inventory.json");
|
|
27373
27383
|
unackedCursorAttempts = 0;
|
|
27374
|
-
reconcilePath = () =>
|
|
27384
|
+
reconcilePath = () => join42(getDataDir(), "sync-field-reconcile.json");
|
|
27375
27385
|
reconcileCache = null;
|
|
27376
27386
|
SETTLE_QUIET_MS = 2 * 60 * 60 * 1e3;
|
|
27377
27387
|
}
|
|
@@ -27404,7 +27414,7 @@ var init_sync_fields = __esm({
|
|
|
27404
27414
|
|
|
27405
27415
|
// ../engine/dist/core/index-lock.js
|
|
27406
27416
|
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
|
|
27417
|
+
import { dirname as dirname17, join as join43 } from "path";
|
|
27408
27418
|
function acquireIndexLock(opts) {
|
|
27409
27419
|
const lockPath = lockFilePath(opts.file);
|
|
27410
27420
|
mkdirSync8(dirname17(lockPath), { recursive: true });
|
|
@@ -27449,7 +27459,7 @@ function acquireIndexLock(opts) {
|
|
|
27449
27459
|
};
|
|
27450
27460
|
}
|
|
27451
27461
|
function lockFilePath(file = ".compact.lock") {
|
|
27452
|
-
return
|
|
27462
|
+
return join43(getIndexDir(), file);
|
|
27453
27463
|
}
|
|
27454
27464
|
function stealStaleLock(lockPath, staleAfterMs) {
|
|
27455
27465
|
try {
|
|
@@ -27516,7 +27526,7 @@ var init_http = __esm({
|
|
|
27516
27526
|
CLI_VERSION = JSON.parse(readFileSync35(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
|
|
27517
27527
|
} catch {
|
|
27518
27528
|
try {
|
|
27519
|
-
if (true) CLI_VERSION = "0.7.
|
|
27529
|
+
if (true) CLI_VERSION = "0.7.21";
|
|
27520
27530
|
} catch {
|
|
27521
27531
|
}
|
|
27522
27532
|
}
|
|
@@ -28010,7 +28020,7 @@ var init_telemetry = __esm({
|
|
|
28010
28020
|
init_sync_client();
|
|
28011
28021
|
cliVersion = () => {
|
|
28012
28022
|
try {
|
|
28013
|
-
return true ? "0.7.
|
|
28023
|
+
return true ? "0.7.21" : "dev";
|
|
28014
28024
|
} catch {
|
|
28015
28025
|
return "dev";
|
|
28016
28026
|
}
|
|
@@ -28023,7 +28033,7 @@ var init_telemetry = __esm({
|
|
|
28023
28033
|
// src/raw-archive-parts.ts
|
|
28024
28034
|
import { createReadStream as createReadStream4, createWriteStream, openSync as openSync10, readSync as readSync9, closeSync as closeSync10, rmSync as rmSync5, statSync as statSync39 } from "node:fs";
|
|
28025
28035
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
28026
|
-
import { join as
|
|
28036
|
+
import { join as join44 } from "node:path";
|
|
28027
28037
|
import { randomBytes } from "node:crypto";
|
|
28028
28038
|
import { createGzip as createGzip2 } from "node:zlib";
|
|
28029
28039
|
import { once } from "node:events";
|
|
@@ -28053,7 +28063,7 @@ function* textLines(text) {
|
|
|
28053
28063
|
}
|
|
28054
28064
|
}
|
|
28055
28065
|
async function writeArchiveFile(source, meta, redact, dir = tmpdir2()) {
|
|
28056
|
-
const path =
|
|
28066
|
+
const path = join44(dir, `cr-archive-${randomBytes(8).toString("hex")}.json.gz`);
|
|
28057
28067
|
const gzip = createGzip2({ level: 6 });
|
|
28058
28068
|
const out = createWriteStream(path, { mode: 384 });
|
|
28059
28069
|
const done = once(out, "finish");
|
|
@@ -28393,8 +28403,8 @@ import { execSync as execSync2, execFileSync as execFileSync3 } from "node:child
|
|
|
28393
28403
|
import { readFileSync as readFileSync38, existsSync as existsSync43 } from "node:fs";
|
|
28394
28404
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
28395
28405
|
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
|
|
28406
|
+
import { join as join45, dirname as dirname18, sep as sep2, posix as pathPosix, win32 as pathWin32 } from "node:path";
|
|
28407
|
+
import { tmpdir as tmpdir3, homedir as homedir16 } from "node:os";
|
|
28398
28408
|
import { createHash as createHash8 } from "node:crypto";
|
|
28399
28409
|
function compareVersions(a, b) {
|
|
28400
28410
|
const pa = String(a).split("-")[0].split(".").map((n) => parseInt(n, 10) || 0);
|
|
@@ -28418,7 +28428,7 @@ function newerOf(a, b) {
|
|
|
28418
28428
|
function installedVersion() {
|
|
28419
28429
|
try {
|
|
28420
28430
|
const here = dirname18(fileURLToPath2(import.meta.url));
|
|
28421
|
-
const raw = readFileSync38(
|
|
28431
|
+
const raw = readFileSync38(join45(here, "..", "package.json"), "utf-8");
|
|
28422
28432
|
return JSON.parse(raw).version || null;
|
|
28423
28433
|
} catch {
|
|
28424
28434
|
return null;
|
|
@@ -28443,7 +28453,7 @@ function sweepStaleStaging(root = tmpdir3(), now = Date.now()) {
|
|
|
28443
28453
|
}
|
|
28444
28454
|
for (const name of entries) {
|
|
28445
28455
|
if (!MKDTEMP_SUFFIX.test(name)) continue;
|
|
28446
|
-
const dir =
|
|
28456
|
+
const dir = join45(root, name);
|
|
28447
28457
|
try {
|
|
28448
28458
|
const st = statSync40(dir);
|
|
28449
28459
|
if (!st.isDirectory() || now - st.mtimeMs < COLD_MS) continue;
|
|
@@ -28472,14 +28482,14 @@ async function executeAutoUpdate(plan, deps) {
|
|
|
28472
28482
|
}
|
|
28473
28483
|
const got = createHash8("sha256").update(buf).digest("hex");
|
|
28474
28484
|
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(
|
|
28485
|
+
const dir = mkdtempSync3(join45(tmpdir3(), "cr-update-"));
|
|
28476
28486
|
const discardStaging = () => {
|
|
28477
28487
|
try {
|
|
28478
28488
|
rmSync6(dir, { recursive: true, force: true });
|
|
28479
28489
|
} catch {
|
|
28480
28490
|
}
|
|
28481
28491
|
};
|
|
28482
|
-
const tgz =
|
|
28492
|
+
const tgz = join45(dir, "chat-recall.tgz");
|
|
28483
28493
|
writeFileSync8(tgz, buf);
|
|
28484
28494
|
if (deps.stopping?.()) {
|
|
28485
28495
|
discardStaging();
|
|
@@ -28559,7 +28569,7 @@ function realInstall(tgz) {
|
|
|
28559
28569
|
try {
|
|
28560
28570
|
npmInstall(npm, ["install", "-g", tgz]);
|
|
28561
28571
|
} catch {
|
|
28562
|
-
npmInstall(npm, ["install", "-g", "--prefix",
|
|
28572
|
+
npmInstall(npm, ["install", "-g", "--prefix", join45(homedir16(), ".local"), tgz]);
|
|
28563
28573
|
}
|
|
28564
28574
|
}
|
|
28565
28575
|
function acquireUpdateLock() {
|
|
@@ -28576,8 +28586,8 @@ function realRestart(platform2) {
|
|
|
28576
28586
|
if (c) execSync2(c.cmd, { stdio: "ignore", ...c.shell ? { shell: c.shell } : {} });
|
|
28577
28587
|
}
|
|
28578
28588
|
function updateStatePath() {
|
|
28579
|
-
const dir = process.env.CHAT_RECALL_DATA_DIR ||
|
|
28580
|
-
return
|
|
28589
|
+
const dir = process.env.CHAT_RECALL_DATA_DIR || join45(homedir16(), ".chat-recall");
|
|
28590
|
+
return join45(dir, "auto-update-state.json");
|
|
28581
28591
|
}
|
|
28582
28592
|
function readUpdateState() {
|
|
28583
28593
|
try {
|
|
@@ -28688,7 +28698,7 @@ var init_auto_update = __esm({
|
|
|
28688
28698
|
});
|
|
28689
28699
|
|
|
28690
28700
|
// src/sync-client.ts
|
|
28691
|
-
import { join as
|
|
28701
|
+
import { join as join46, dirname as dirname19, basename as basename22 } from "node:path";
|
|
28692
28702
|
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
28703
|
import { tmpdir as tmpdir4, hostname as hostname2 } from "node:os";
|
|
28694
28704
|
import { createHash as createHash9 } from "node:crypto";
|
|
@@ -28785,7 +28795,7 @@ async function fetchTenantSecurityConfig(cred) {
|
|
|
28785
28795
|
}
|
|
28786
28796
|
}
|
|
28787
28797
|
function syncConfigCachePath() {
|
|
28788
|
-
return
|
|
28798
|
+
return join46(getDataDir(), "sync-config-cache.json");
|
|
28789
28799
|
}
|
|
28790
28800
|
function readPersistedSyncConfigs() {
|
|
28791
28801
|
try {
|
|
@@ -29042,7 +29052,7 @@ function reapStaleScanDirs(dir = tmpdir4(), maxAgeMs = 6 * 36e5, now = Date.now(
|
|
|
29042
29052
|
}
|
|
29043
29053
|
for (const name of names) {
|
|
29044
29054
|
if (!name.startsWith("cr-batchscan-")) continue;
|
|
29045
|
-
const p =
|
|
29055
|
+
const p = join46(dir, name);
|
|
29046
29056
|
try {
|
|
29047
29057
|
if (now - statSync41(p).mtimeMs < maxAgeMs) continue;
|
|
29048
29058
|
rmSync7(p, { recursive: true, force: true });
|
|
@@ -29059,7 +29069,7 @@ function batchScanExternal(items, opts = {}) {
|
|
|
29059
29069
|
let scanned = 0, slices = 0, scanMs = 0;
|
|
29060
29070
|
if (items.length === 0) return { findings, scanned, slices, scanMs };
|
|
29061
29071
|
reapStaleScanDirs();
|
|
29062
|
-
let scanDir = mkdtempSync4(
|
|
29072
|
+
let scanDir = mkdtempSync4(join46(tmpdir4(), "cr-batchscan-"));
|
|
29063
29073
|
let safeToId = /* @__PURE__ */ new Map();
|
|
29064
29074
|
let bytesInDir = 0;
|
|
29065
29075
|
const flushSlice = () => {
|
|
@@ -29090,13 +29100,13 @@ function batchScanExternal(items, opts = {}) {
|
|
|
29090
29100
|
if (raw === null) continue;
|
|
29091
29101
|
const safe = item.id.replace(/[^A-Za-z0-9_-]/g, "");
|
|
29092
29102
|
safeToId.set(safe, item.id);
|
|
29093
|
-
writeFileSync9(
|
|
29103
|
+
writeFileSync9(join46(scanDir, `${safe}.txt`), raw);
|
|
29094
29104
|
bytesInDir += Buffer.byteLength(raw);
|
|
29095
29105
|
} catch {
|
|
29096
29106
|
}
|
|
29097
29107
|
if (bytesInDir >= maxBytes) {
|
|
29098
29108
|
flushSlice();
|
|
29099
|
-
scanDir = mkdtempSync4(
|
|
29109
|
+
scanDir = mkdtempSync4(join46(tmpdir4(), "cr-batchscan-"));
|
|
29100
29110
|
}
|
|
29101
29111
|
}
|
|
29102
29112
|
flushSlice();
|
|
@@ -30095,7 +30105,7 @@ async function buildConversationSync(ref, mtime, opts = {}) {
|
|
|
30095
30105
|
} else if (opts.scanSecrets) {
|
|
30096
30106
|
let tmp = null;
|
|
30097
30107
|
try {
|
|
30098
|
-
tmp =
|
|
30108
|
+
tmp = join46(tmpdir4(), `cr-scan-${ref.prefixedId.replace(/[^A-Za-z0-9_-]/g, "")}-${mtime}.txt`);
|
|
30099
30109
|
writeFileSync9(tmp, rawText);
|
|
30100
30110
|
for (const f of scanFileForSecrets(tmp, { verifyOnly: opts.verifySecrets, tenantRules: opts.tenantRules })) {
|
|
30101
30111
|
const verifiedAt = f.verified ? (/* @__PURE__ */ new Date()).toISOString() : null;
|
|
@@ -30372,10 +30382,10 @@ var init_sync_client = __esm({
|
|
|
30372
30382
|
ownVersion = "0.0.0";
|
|
30373
30383
|
try {
|
|
30374
30384
|
const dir = dirname19(fileURLToPath3(import.meta.url));
|
|
30375
|
-
ownVersion = JSON.parse(readFileSync39(
|
|
30385
|
+
ownVersion = JSON.parse(readFileSync39(join46(dir, "../package.json"), "utf-8")).version || ownVersion;
|
|
30376
30386
|
} catch {
|
|
30377
30387
|
try {
|
|
30378
|
-
if (true) ownVersion = "0.7.
|
|
30388
|
+
if (true) ownVersion = "0.7.21";
|
|
30379
30389
|
} catch {
|
|
30380
30390
|
}
|
|
30381
30391
|
}
|
|
@@ -30387,7 +30397,7 @@ var init_sync_client = __esm({
|
|
|
30387
30397
|
]);
|
|
30388
30398
|
walkProgressForUpload = null;
|
|
30389
30399
|
lastServerPackSpec = null;
|
|
30390
|
-
credPath = () =>
|
|
30400
|
+
credPath = () => join46(getDataDir(), "credentials.json");
|
|
30391
30401
|
_securityConfigCache = /* @__PURE__ */ new Map();
|
|
30392
30402
|
SECURITY_CONFIG_TTL_MS = 5 * 60 * 1e3;
|
|
30393
30403
|
_syncConfigCache = /* @__PURE__ */ new Map();
|
|
@@ -30411,8 +30421,8 @@ var init_sync_client = __esm({
|
|
|
30411
30421
|
|
|
30412
30422
|
// ../engine/dist/core/artifact-codec.js
|
|
30413
30423
|
import { readFileSync as readFileSync40 } from "fs";
|
|
30414
|
-
import { basename as basename23, join as
|
|
30415
|
-
import { homedir as
|
|
30424
|
+
import { basename as basename23, join as join47 } from "path";
|
|
30425
|
+
import { homedir as homedir17 } from "os";
|
|
30416
30426
|
function parseCommandText(content, format, fallbackName) {
|
|
30417
30427
|
if (format === "toml") {
|
|
30418
30428
|
const t = parseScalarToml(content);
|
|
@@ -30446,18 +30456,18 @@ function readInstructions(filePath, name) {
|
|
|
30446
30456
|
function commandPath(tool, name) {
|
|
30447
30457
|
switch (tool) {
|
|
30448
30458
|
case "claude":
|
|
30449
|
-
return
|
|
30459
|
+
return join47(claudeBackend.commandsDir(), `${name}.md`);
|
|
30450
30460
|
case "agy":
|
|
30451
|
-
return
|
|
30461
|
+
return join47(join47(agyBackend.homeDir(), "commands"), `${name}.toml`);
|
|
30452
30462
|
case "opencode":
|
|
30453
|
-
return
|
|
30463
|
+
return join47(opencodeBackend.commandsDir(), `${name}.md`);
|
|
30454
30464
|
case "codex":
|
|
30455
|
-
return
|
|
30465
|
+
return join47(codexBackend.promptsDir(), `${name}.md`);
|
|
30456
30466
|
case "cursor":
|
|
30457
|
-
return
|
|
30467
|
+
return join47(cursorHomeDir(), "commands", `${name}.md`);
|
|
30458
30468
|
// Pi's prompt templates are flat *.md files in the agent dir.
|
|
30459
30469
|
case "pi":
|
|
30460
|
-
return
|
|
30470
|
+
return join47(piBackend.promptsDir(), `${name}.md`);
|
|
30461
30471
|
// Hermes has no command files. copyArtifactToTool refuses this target first.
|
|
30462
30472
|
case "hermes":
|
|
30463
30473
|
throw new Error("Hermes has no command files");
|
|
@@ -30466,15 +30476,15 @@ function commandPath(tool, name) {
|
|
|
30466
30476
|
function agentPath(tool, name) {
|
|
30467
30477
|
switch (tool) {
|
|
30468
30478
|
case "claude":
|
|
30469
|
-
return
|
|
30479
|
+
return join47(claudeBackend.agentsDir(), `${name}.md`);
|
|
30470
30480
|
case "agy":
|
|
30471
|
-
return
|
|
30481
|
+
return join47(join47(agyBackend.homeDir(), "agents"), `${name}.md`);
|
|
30472
30482
|
case "opencode":
|
|
30473
|
-
return
|
|
30483
|
+
return join47(opencodeBackend.agentsDir(), `${name}.md`);
|
|
30474
30484
|
case "codex":
|
|
30475
|
-
return
|
|
30485
|
+
return join47(codexBackend.agentsDir(), `${name}.toml`);
|
|
30476
30486
|
case "cursor":
|
|
30477
|
-
return
|
|
30487
|
+
return join47(cursorHomeDir(), "agents", `${name}.md`);
|
|
30478
30488
|
// Pi has no named agent personas. copyArtifactToTool refuses this target first.
|
|
30479
30489
|
case "pi":
|
|
30480
30490
|
throw new Error("Pi has no agent files");
|
|
@@ -30511,23 +30521,23 @@ function instructionsFilename(tool) {
|
|
|
30511
30521
|
function instructionsPath(tool, projectPath) {
|
|
30512
30522
|
const file = instructionsFilename(tool);
|
|
30513
30523
|
if (projectPath)
|
|
30514
|
-
return
|
|
30524
|
+
return join47(projectPath, file);
|
|
30515
30525
|
switch (tool) {
|
|
30516
30526
|
case "claude":
|
|
30517
|
-
return
|
|
30527
|
+
return join47(claudeBackend.homeDir(), file);
|
|
30518
30528
|
case "agy":
|
|
30519
|
-
return
|
|
30529
|
+
return join47(agyBackend.homeDir(), file);
|
|
30520
30530
|
case "codex":
|
|
30521
|
-
return
|
|
30531
|
+
return join47(codexBackend.homeDir(), file);
|
|
30522
30532
|
case "opencode":
|
|
30523
|
-
return
|
|
30533
|
+
return join47(homedir17(), ".config", "opencode", file);
|
|
30524
30534
|
// Cursor has no single user-scope instructions FILE — user-level guidance
|
|
30525
30535
|
// is User Rules plus ~/.cursor/rules/*.mdc. AGENTS.md at the home root is
|
|
30526
30536
|
// the closest equivalent and is what a mirror can actually write.
|
|
30527
30537
|
case "cursor":
|
|
30528
|
-
return
|
|
30538
|
+
return join47(cursorHomeDir(), file);
|
|
30529
30539
|
case "pi":
|
|
30530
|
-
return
|
|
30540
|
+
return join47(piBackend.homeDir(), file);
|
|
30531
30541
|
case "hermes":
|
|
30532
30542
|
throw new Error("Hermes has no instruction file mapping");
|
|
30533
30543
|
}
|
|
@@ -30577,8 +30587,8 @@ var init_artifact_codec = __esm({
|
|
|
30577
30587
|
|
|
30578
30588
|
// ../engine/dist/core/toolkit-sync.js
|
|
30579
30589
|
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
|
|
30590
|
+
import { dirname as dirname20, join as join48, basename as basename24 } from "path";
|
|
30591
|
+
import { homedir as homedir18 } from "os";
|
|
30582
30592
|
function rowFromMemoryItem(type, item) {
|
|
30583
30593
|
const extra = item.extra || {};
|
|
30584
30594
|
return {
|
|
@@ -30598,16 +30608,16 @@ function skillsDirFor(tool) {
|
|
|
30598
30608
|
case "claude":
|
|
30599
30609
|
return claudeBackend.skillsDir();
|
|
30600
30610
|
case "agy":
|
|
30601
|
-
return
|
|
30611
|
+
return join48(agyBackend.homeDir(), "skills");
|
|
30602
30612
|
case "opencode":
|
|
30603
30613
|
return opencodeBackend.skillsDir();
|
|
30604
30614
|
case "codex":
|
|
30605
30615
|
return codexBackend.skillsDir();
|
|
30606
30616
|
// user skills, NOT .system
|
|
30607
30617
|
case "cursor":
|
|
30608
|
-
return
|
|
30618
|
+
return join48(cursorHomeDir(), "skills");
|
|
30609
30619
|
case "hermes":
|
|
30610
|
-
return
|
|
30620
|
+
return join48(hermesBackend.homeDir(), "skills");
|
|
30611
30621
|
case "pi":
|
|
30612
30622
|
return piBackend.skillsDir();
|
|
30613
30623
|
}
|
|
@@ -30615,13 +30625,13 @@ function skillsDirFor(tool) {
|
|
|
30615
30625
|
function skillDirsNamed(tool, name) {
|
|
30616
30626
|
const root = skillsDirFor(tool);
|
|
30617
30627
|
const found = [];
|
|
30618
|
-
if (existsSync44(
|
|
30619
|
-
found.push(
|
|
30628
|
+
if (existsSync44(join48(root, name)))
|
|
30629
|
+
found.push(join48(root, name));
|
|
30620
30630
|
if (tool !== "hermes" || !existsSync44(root))
|
|
30621
30631
|
return found;
|
|
30622
30632
|
for (const category of readdirSync33(root)) {
|
|
30623
|
-
const candidate =
|
|
30624
|
-
if (existsSync44(
|
|
30633
|
+
const candidate = join48(root, category, name);
|
|
30634
|
+
if (existsSync44(join48(candidate, "SKILL.md")))
|
|
30625
30635
|
found.push(candidate);
|
|
30626
30636
|
}
|
|
30627
30637
|
return found;
|
|
@@ -30631,7 +30641,7 @@ function copySkill(row, toTool) {
|
|
|
30631
30641
|
if (!existsSync44(skillDir))
|
|
30632
30642
|
return { ok: false, status: 404, error: `Source dir missing: ${skillDir}` };
|
|
30633
30643
|
const name = row.extra.skillName || basename24(skillDir);
|
|
30634
|
-
const targetDir =
|
|
30644
|
+
const targetDir = join48(skillsDirFor(toTool), name);
|
|
30635
30645
|
const existing = skillDirsNamed(toTool, name);
|
|
30636
30646
|
if (existing.length)
|
|
30637
30647
|
return { ok: false, status: 409, error: `Already exists: ${existing[0]}` };
|
|
@@ -30644,26 +30654,26 @@ function copySkill(row, toTool) {
|
|
|
30644
30654
|
}
|
|
30645
30655
|
}
|
|
30646
30656
|
function mcpJsonCandidates(tool) {
|
|
30647
|
-
const home =
|
|
30657
|
+
const home = homedir18();
|
|
30648
30658
|
switch (tool) {
|
|
30649
30659
|
case "claude":
|
|
30650
30660
|
return [
|
|
30651
|
-
{ path:
|
|
30652
|
-
{ path:
|
|
30661
|
+
{ path: join48(home, ".mcp.json"), key: "mcpServers" },
|
|
30662
|
+
{ path: join48(home, ".claude.json"), key: "mcpServers" }
|
|
30653
30663
|
];
|
|
30654
30664
|
case "gemini":
|
|
30655
|
-
return [{ path:
|
|
30665
|
+
return [{ path: join48(home, ".gemini", "settings.json"), key: "mcpServers" }];
|
|
30656
30666
|
case "agy":
|
|
30657
|
-
return [{ path:
|
|
30667
|
+
return [{ path: join48(home, ".gemini", "config", "mcp_config.json"), key: "mcpServers" }];
|
|
30658
30668
|
case "cursor":
|
|
30659
|
-
return [{ path:
|
|
30669
|
+
return [{ path: join48(cursorHomeDir(), "mcp.json"), key: "mcpServers" }];
|
|
30660
30670
|
case "pi":
|
|
30661
30671
|
return [{ path: piMcpConfigPath(), key: "mcpServers" }];
|
|
30662
30672
|
case "opencode":
|
|
30663
30673
|
return [
|
|
30664
|
-
{ path:
|
|
30665
|
-
{ path:
|
|
30666
|
-
{ path:
|
|
30674
|
+
{ path: join48(home, ".config", "opencode", "opencode.json"), key: "mcp" },
|
|
30675
|
+
{ path: join48(home, ".config", "opencode", "config.json"), key: "mcp" },
|
|
30676
|
+
{ path: join48(home, ".opencode", "config.json"), key: "mcp" }
|
|
30667
30677
|
];
|
|
30668
30678
|
default:
|
|
30669
30679
|
return [];
|
|
@@ -30671,7 +30681,7 @@ function mcpJsonCandidates(tool) {
|
|
|
30671
30681
|
}
|
|
30672
30682
|
function readMcpEntry(tool, name) {
|
|
30673
30683
|
if (tool === "codex")
|
|
30674
|
-
return readCodexMcpEntry(
|
|
30684
|
+
return readCodexMcpEntry(join48(homedir18(), ".codex", "config.toml"), name);
|
|
30675
30685
|
if (tool === "hermes")
|
|
30676
30686
|
return readHermesMcpServers()?.[name] ?? null;
|
|
30677
30687
|
for (const t of mcpJsonCandidates(tool)) {
|
|
@@ -30779,9 +30789,9 @@ function writeCodexMcpEntry(path, name, entry) {
|
|
|
30779
30789
|
function writeMcpEntry(toTool, name, entry) {
|
|
30780
30790
|
if (toTool === "hermes")
|
|
30781
30791
|
return writeHermesMcp(name, entry);
|
|
30782
|
-
const home =
|
|
30792
|
+
const home = homedir18();
|
|
30783
30793
|
if (toTool === "codex") {
|
|
30784
|
-
const path2 =
|
|
30794
|
+
const path2 = join48(home, ".codex", "config.toml");
|
|
30785
30795
|
if (!writeCodexMcpEntry(path2, name, entry))
|
|
30786
30796
|
return { ok: false, status: 409, error: `MCP "${name}" already exists in ${path2}.` };
|
|
30787
30797
|
return { ok: true, targetPath: path2 };
|
|
@@ -30789,19 +30799,19 @@ function writeMcpEntry(toTool, name, entry) {
|
|
|
30789
30799
|
let path;
|
|
30790
30800
|
let key2;
|
|
30791
30801
|
if (toTool === "claude") {
|
|
30792
|
-
path =
|
|
30802
|
+
path = join48(home, ".mcp.json");
|
|
30793
30803
|
key2 = "mcpServers";
|
|
30794
30804
|
} else if (toTool === "agy") {
|
|
30795
|
-
path =
|
|
30805
|
+
path = join48(home, ".gemini", "config", "mcp_config.json");
|
|
30796
30806
|
key2 = "mcpServers";
|
|
30797
30807
|
} else if (toTool === "cursor") {
|
|
30798
|
-
path =
|
|
30808
|
+
path = join48(cursorHomeDir(), "mcp.json");
|
|
30799
30809
|
key2 = "mcpServers";
|
|
30800
30810
|
} else if (toTool === "pi") {
|
|
30801
30811
|
path = piMcpConfigPath();
|
|
30802
30812
|
key2 = "mcpServers";
|
|
30803
30813
|
} else {
|
|
30804
|
-
path =
|
|
30814
|
+
path = join48(home, ".config", "opencode", "opencode.json");
|
|
30805
30815
|
key2 = "mcp";
|
|
30806
30816
|
}
|
|
30807
30817
|
let cfg = {};
|
|
@@ -30945,7 +30955,7 @@ async function removeArtifactFromTool(type, name, tool) {
|
|
|
30945
30955
|
return removeCommandOrAgent(type, name, tool);
|
|
30946
30956
|
}
|
|
30947
30957
|
function backupToTrash(src, label) {
|
|
30948
|
-
const dest =
|
|
30958
|
+
const dest = join48(getDataDir(), "trash", `${Date.now()}-${label.replace(/[^A-Za-z0-9._-]/g, "_")}`);
|
|
30949
30959
|
mkdirSync11(dirname20(dest), { recursive: true });
|
|
30950
30960
|
cpSync(src, dest, { recursive: true });
|
|
30951
30961
|
return dest;
|
|
@@ -30956,7 +30966,7 @@ function removeFailed(e, fallback) {
|
|
|
30956
30966
|
function removeSkill(name, tool) {
|
|
30957
30967
|
const found = skillDirsNamed(tool, name);
|
|
30958
30968
|
if (found.length === 0)
|
|
30959
|
-
return { ok: false, status: 404, error: `Not found: ${
|
|
30969
|
+
return { ok: false, status: 404, error: `Not found: ${join48(skillsDirFor(tool), name)}` };
|
|
30960
30970
|
if (found.length > 1)
|
|
30961
30971
|
return { ok: false, status: 409, error: `${found.length} skills named "${name}" for ${tool}; none removed` };
|
|
30962
30972
|
const dir = found[0];
|
|
@@ -31004,7 +31014,7 @@ function removeMcp(name, tool) {
|
|
|
31004
31014
|
}
|
|
31005
31015
|
}
|
|
31006
31016
|
if (tool === "codex") {
|
|
31007
|
-
const path =
|
|
31017
|
+
const path = join48(homedir18(), ".codex", "config.toml");
|
|
31008
31018
|
if (!existsSync44(path))
|
|
31009
31019
|
return { ok: false, status: 404, error: "config.toml not found" };
|
|
31010
31020
|
const before = readFileSync41(path, "utf-8");
|
|
@@ -31180,7 +31190,7 @@ var init_toolkit_sync = __esm({
|
|
|
31180
31190
|
|
|
31181
31191
|
// ../engine/dist/core/which.js
|
|
31182
31192
|
import { existsSync as existsSync46, statSync as statSync43, accessSync, constants } from "node:fs";
|
|
31183
|
-
import { join as
|
|
31193
|
+
import { join as join50, isAbsolute as isAbsolute3, delimiter as delimiter2, sep as sep3 } from "node:path";
|
|
31184
31194
|
function executable(p) {
|
|
31185
31195
|
try {
|
|
31186
31196
|
if (!statSync43(p).isFile())
|
|
@@ -31219,7 +31229,7 @@ function resolveOnPath(name) {
|
|
|
31219
31229
|
if (!dir)
|
|
31220
31230
|
continue;
|
|
31221
31231
|
for (const c of candidates(name)) {
|
|
31222
|
-
const full =
|
|
31232
|
+
const full = join50(dir, c);
|
|
31223
31233
|
if (existsSync46(full) && executable(full))
|
|
31224
31234
|
return full;
|
|
31225
31235
|
}
|
|
@@ -31247,7 +31257,7 @@ __export(toolkit_pull_exports, {
|
|
|
31247
31257
|
portableCommand: () => portableCommand
|
|
31248
31258
|
});
|
|
31249
31259
|
import { existsSync as existsSync47, mkdirSync as mkdirSync13, statSync as statSync44, writeFileSync as writeFileSync12 } from "node:fs";
|
|
31250
|
-
import { dirname as dirname22, join as
|
|
31260
|
+
import { dirname as dirname22, join as join51, basename as basename25, isAbsolute as isAbsolute4 } from "node:path";
|
|
31251
31261
|
function isExecutableFile(p) {
|
|
31252
31262
|
try {
|
|
31253
31263
|
return statSync44(p).isFile();
|
|
@@ -31417,8 +31427,8 @@ function executePull(rows, opts = {}) {
|
|
|
31417
31427
|
const outcomes = [];
|
|
31418
31428
|
for (const { name, body, truncated, redacted, tools } of skills) {
|
|
31419
31429
|
for (const tool of tools) {
|
|
31420
|
-
const dir =
|
|
31421
|
-
const file =
|
|
31430
|
+
const dir = join51(skillsDirFor(tool), name);
|
|
31431
|
+
const file = join51(dir, "SKILL.md");
|
|
31422
31432
|
if (existsSync47(file)) {
|
|
31423
31433
|
outcomes.push({ type: "skill", name, tool, status: "present" });
|
|
31424
31434
|
continue;
|
|
@@ -31789,7 +31799,7 @@ __export(shadow_prune_exports, {
|
|
|
31789
31799
|
pruneShadow: () => pruneShadow
|
|
31790
31800
|
});
|
|
31791
31801
|
import { readdirSync as readdirSync34, statSync as statSync47, unlinkSync as unlinkSync3 } from "fs";
|
|
31792
|
-
import { join as
|
|
31802
|
+
import { join as join54 } from "path";
|
|
31793
31803
|
function listShadows(isFullyAcked) {
|
|
31794
31804
|
const out = [];
|
|
31795
31805
|
const root = shadowRoot();
|
|
@@ -31800,7 +31810,7 @@ function listShadows(isFullyAcked) {
|
|
|
31800
31810
|
return out;
|
|
31801
31811
|
}
|
|
31802
31812
|
for (const tool of tools) {
|
|
31803
|
-
const dir =
|
|
31813
|
+
const dir = join54(root, tool);
|
|
31804
31814
|
let names;
|
|
31805
31815
|
try {
|
|
31806
31816
|
names = readdirSync34(dir);
|
|
@@ -31810,7 +31820,7 @@ function listShadows(isFullyAcked) {
|
|
|
31810
31820
|
for (const name of names) {
|
|
31811
31821
|
if (!name.endsWith(".gz"))
|
|
31812
31822
|
continue;
|
|
31813
|
-
const path =
|
|
31823
|
+
const path = join54(dir, name);
|
|
31814
31824
|
let st;
|
|
31815
31825
|
try {
|
|
31816
31826
|
st = statSync47(path);
|
|
@@ -31929,8 +31939,8 @@ var init_code_intel = __esm({
|
|
|
31929
31939
|
|
|
31930
31940
|
// ../engine/dist/core/companions.js
|
|
31931
31941
|
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
|
|
31942
|
+
import { homedir as homedir20 } from "node:os";
|
|
31943
|
+
import { join as join55 } from "node:path";
|
|
31934
31944
|
import { execSync as execSync3 } from "node:child_process";
|
|
31935
31945
|
import { createHash as createHash14 } from "node:crypto";
|
|
31936
31946
|
function expectedCodeindexSha256(artifact) {
|
|
@@ -32074,9 +32084,9 @@ var init_companions = __esm({
|
|
|
32074
32084
|
"x86_64-windows": "a96fc8c8949bb399a44cc0615b12e458460a529c69f01e8829cc39a20f45ab29",
|
|
32075
32085
|
"aarch64-windows": "42620d56272cd9ba9d785569d8d754d6b4a3e80f36f28db3e0c483fd600ed117"
|
|
32076
32086
|
};
|
|
32077
|
-
CODEINDEX_INSTALL_DIR =
|
|
32087
|
+
CODEINDEX_INSTALL_DIR = join55(homedir20(), ".local", "bin");
|
|
32078
32088
|
CODEINDEX_BIN_NAME = process.platform === "win32" ? "codeindex.exe" : "codeindex";
|
|
32079
|
-
CODEINDEX_BIN_PATH =
|
|
32089
|
+
CODEINDEX_BIN_PATH = join55(CODEINDEX_INSTALL_DIR, CODEINDEX_BIN_NAME);
|
|
32080
32090
|
}
|
|
32081
32091
|
});
|
|
32082
32092
|
|
|
@@ -32192,7 +32202,7 @@ __export(collector_exports, {
|
|
|
32192
32202
|
import { spawn as spawn2 } from "node:child_process";
|
|
32193
32203
|
import { execSync as execSync4 } from "node:child_process";
|
|
32194
32204
|
import { readFileSync as readFileSync47 } from "node:fs";
|
|
32195
|
-
import { join as
|
|
32205
|
+
import { join as join56, basename as basename26 } from "node:path";
|
|
32196
32206
|
async function resolveCodeindexBin(autoInstall = true) {
|
|
32197
32207
|
let st = checkCodeindexStatus();
|
|
32198
32208
|
if (!st.installed && autoInstall)
|
|
@@ -32374,7 +32384,7 @@ async function collectCode(opts) {
|
|
|
32374
32384
|
}
|
|
32375
32385
|
const complexity = (r) => {
|
|
32376
32386
|
try {
|
|
32377
|
-
const txt = readFileSync47(
|
|
32387
|
+
const txt = readFileSync47(join56(ws, r), "utf8");
|
|
32378
32388
|
if (txt.length > 2e6)
|
|
32379
32389
|
return 1;
|
|
32380
32390
|
const m = txt.match(CF_RE);
|
|
@@ -33139,14 +33149,14 @@ __export(service_installer_exports, {
|
|
|
33139
33149
|
});
|
|
33140
33150
|
import { execSync as execSync5 } from "child_process";
|
|
33141
33151
|
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
|
|
33152
|
+
import { homedir as homedir21 } from "os";
|
|
33153
|
+
import { join as join57 } from "path";
|
|
33144
33154
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
33145
33155
|
function resolveDaemonPaths() {
|
|
33146
33156
|
const watchJs = fileURLToPath5(new URL("./watch.js", import.meta.url));
|
|
33147
33157
|
const node = process.execPath;
|
|
33148
|
-
const dataDir =
|
|
33149
|
-
const logFile =
|
|
33158
|
+
const dataDir = join57(homedir21(), ".chat-recall");
|
|
33159
|
+
const logFile = join57(dataDir, "watch.log");
|
|
33150
33160
|
return { watchJs, node, logFile, dataDir };
|
|
33151
33161
|
}
|
|
33152
33162
|
function tryCmd(cmd) {
|
|
@@ -33173,7 +33183,7 @@ function refreshServiceDefinition() {
|
|
|
33173
33183
|
if (process.platform !== "linux") return false;
|
|
33174
33184
|
try {
|
|
33175
33185
|
const { watchJs, node, logFile } = resolveDaemonPaths();
|
|
33176
|
-
const unitPath =
|
|
33186
|
+
const unitPath = join57(homedir21(), ".config", "systemd", "user", "chat-recall-watch.service");
|
|
33177
33187
|
if (!existsSync51(unitPath)) return false;
|
|
33178
33188
|
const current = readFileSync48(unitPath, "utf8");
|
|
33179
33189
|
if (!current.includes(watchJs)) return false;
|
|
@@ -33204,8 +33214,8 @@ function installService() {
|
|
|
33204
33214
|
);
|
|
33205
33215
|
}
|
|
33206
33216
|
function installSystemd(watchJs, node, logFile) {
|
|
33207
|
-
const unitDir =
|
|
33208
|
-
const unitPath =
|
|
33217
|
+
const unitDir = join57(homedir21(), ".config", "systemd", "user");
|
|
33218
|
+
const unitPath = join57(unitDir, "chat-recall-watch.service");
|
|
33209
33219
|
const unit = renderSystemdUnit(watchJs, node, logFile);
|
|
33210
33220
|
mkdirSync17(unitDir, { recursive: true });
|
|
33211
33221
|
writeFileSync16(unitPath, unit);
|
|
@@ -33268,6 +33278,13 @@ function renderSystemdUnit(watchJs, node, logFile) {
|
|
|
33268
33278
|
"MemoryAccounting=yes",
|
|
33269
33279
|
"MemoryHigh=1G",
|
|
33270
33280
|
"MemoryMax=2G",
|
|
33281
|
+
// systemd-oomd kills the cgroup with the most reclaim activity once the
|
|
33282
|
+
// user slice passes its memory-pressure limit. A daemon that peaks at its
|
|
33283
|
+
// own MemoryHigh reclaims constantly, so it was the first cgroup chosen:
|
|
33284
|
+
// 13 kills in six hours on a 60 GB machine, and each restart began the
|
|
33285
|
+
// startup walk again, so the walk never finished. `avoid` ranks the unit
|
|
33286
|
+
// last for oomd; MemoryMax above still bounds the daemon itself.
|
|
33287
|
+
"ManagedOOMPreference=avoid",
|
|
33271
33288
|
// JOURNAL, not append:. The file version had no rotation and nothing to
|
|
33272
33289
|
// give it any: systemd holds the fd open, so the daemon cannot rename or
|
|
33273
33290
|
// truncate its own log without leaving systemd writing into a hole. It
|
|
@@ -33284,8 +33301,8 @@ function renderSystemdUnit(watchJs, node, logFile) {
|
|
|
33284
33301
|
}
|
|
33285
33302
|
function installLaunchd(watchJs, node, logFile) {
|
|
33286
33303
|
const label = "com.chat-recall.watch";
|
|
33287
|
-
const plistDir =
|
|
33288
|
-
const plistPath =
|
|
33304
|
+
const plistDir = join57(homedir21(), "Library", "LaunchAgents");
|
|
33305
|
+
const plistPath = join57(plistDir, `${label}.plist`);
|
|
33289
33306
|
const plist = renderLaunchdPlist(watchJs, node, logFile, label);
|
|
33290
33307
|
mkdirSync17(plistDir, { recursive: true });
|
|
33291
33308
|
writeFileSync16(plistPath, plist);
|
|
@@ -33341,7 +33358,7 @@ function uninstallService() {
|
|
|
33341
33358
|
removed = true;
|
|
33342
33359
|
} catch {
|
|
33343
33360
|
}
|
|
33344
|
-
const unitPath =
|
|
33361
|
+
const unitPath = join57(homedir21(), ".config", "systemd", "user", "chat-recall-watch.service");
|
|
33345
33362
|
if (existsSync51(unitPath)) {
|
|
33346
33363
|
rmSync9(unitPath, { force: true });
|
|
33347
33364
|
removed = true;
|
|
@@ -33353,7 +33370,7 @@ function uninstallService() {
|
|
|
33353
33370
|
return removed;
|
|
33354
33371
|
}
|
|
33355
33372
|
if (process.platform === "darwin") {
|
|
33356
|
-
const plistPath =
|
|
33373
|
+
const plistPath = join57(homedir21(), "Library", "LaunchAgents", "com.chat-recall.watch.plist");
|
|
33357
33374
|
try {
|
|
33358
33375
|
execSync5(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
|
|
33359
33376
|
} catch {
|
|
@@ -33404,8 +33421,8 @@ init_settings();
|
|
|
33404
33421
|
init_sync_client();
|
|
33405
33422
|
init_http();
|
|
33406
33423
|
import chokidar from "chokidar";
|
|
33407
|
-
import { dirname as dirname25, basename as basename27, join as
|
|
33408
|
-
import { homedir as
|
|
33424
|
+
import { dirname as dirname25, basename as basename27, join as join58, resolve as resolve2, sep as sep4 } from "path";
|
|
33425
|
+
import { homedir as homedir22 } from "os";
|
|
33409
33426
|
|
|
33410
33427
|
// src/intent-drain.ts
|
|
33411
33428
|
init_http();
|
|
@@ -33419,13 +33436,13 @@ init_opencode();
|
|
|
33419
33436
|
init_agy();
|
|
33420
33437
|
init_pi();
|
|
33421
33438
|
import { existsSync as existsSync48, readFileSync as readFileSync43, writeFileSync as writeFileSync13, appendFileSync, mkdirSync as mkdirSync14 } from "node:fs";
|
|
33422
|
-
import { join as
|
|
33439
|
+
import { join as join52 } from "node:path";
|
|
33423
33440
|
|
|
33424
33441
|
// src/project-tasks.ts
|
|
33425
33442
|
init_http();
|
|
33426
33443
|
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
|
|
33444
|
+
import { join as join49, dirname as dirname21 } from "node:path";
|
|
33445
|
+
import { homedir as homedir19 } from "node:os";
|
|
33429
33446
|
|
|
33430
33447
|
// ../engine/dist/core/secret-task-status.js
|
|
33431
33448
|
var SECRET_TASK_STATUSES = ["open", "rotated", "not-a-secret", "dismissed"];
|
|
@@ -33493,7 +33510,7 @@ function parseTaskFile(content) {
|
|
|
33493
33510
|
return out;
|
|
33494
33511
|
}
|
|
33495
33512
|
function ledgerPath2() {
|
|
33496
|
-
return
|
|
33513
|
+
return join49(homedir19(), ".chat-recall", "project-tasks-ledger.json");
|
|
33497
33514
|
}
|
|
33498
33515
|
function readLedger() {
|
|
33499
33516
|
try {
|
|
@@ -33530,7 +33547,7 @@ async function pushProjectTaskStatuses(base3, authHeaders, opts = {}) {
|
|
|
33530
33547
|
continue;
|
|
33531
33548
|
}
|
|
33532
33549
|
for (const project of projects) {
|
|
33533
|
-
const file =
|
|
33550
|
+
const file = join49(project, fk.filename);
|
|
33534
33551
|
if (!existsSync45(file)) continue;
|
|
33535
33552
|
let mtime;
|
|
33536
33553
|
try {
|
|
@@ -33594,16 +33611,16 @@ function instructionTargets(rootPath, isGlobal) {
|
|
|
33594
33611
|
const tools = installed.length ? installed : [INSTRUCTION_TOOLS[0]];
|
|
33595
33612
|
if (isGlobal) return [...new Set(tools.map((t) => instructionsPath(t.id)))];
|
|
33596
33613
|
if (!rootPath) return [];
|
|
33597
|
-
const present = INSTRUCTION_FILENAMES.map((f) =>
|
|
33614
|
+
const present = INSTRUCTION_FILENAMES.map((f) => join52(rootPath, f)).filter((p) => existsSync48(p));
|
|
33598
33615
|
if (present.length) return present;
|
|
33599
|
-
return [...new Set(tools.map((t) =>
|
|
33616
|
+
return [...new Set(tools.map((t) => join52(rootPath, instructionsFilename(t.id))))];
|
|
33600
33617
|
}
|
|
33601
33618
|
function applyCodeRecommendation(intent) {
|
|
33602
33619
|
try {
|
|
33603
33620
|
const meta = JSON.parse(intent.name || "{}");
|
|
33604
33621
|
if (intent.artifact_type === "write_tasks_file") {
|
|
33605
33622
|
if (!meta.rootPath || !meta.content) return { status: "error", result: JSON.stringify({ error: "missing rootPath or content" }) };
|
|
33606
|
-
const file =
|
|
33623
|
+
const file = join52(meta.rootPath, meta.filename || "CODE_TASKS.md");
|
|
33607
33624
|
writeFileSync13(file, meta.content);
|
|
33608
33625
|
return { status: "done", result: JSON.stringify({ wrote: file }) };
|
|
33609
33626
|
}
|
|
@@ -33729,10 +33746,10 @@ async function runIntent(intent, ctx) {
|
|
|
33729
33746
|
var ownVersion2 = "0.0.0";
|
|
33730
33747
|
try {
|
|
33731
33748
|
const dir = dirname23(fileURLToPath4(import.meta.url));
|
|
33732
|
-
ownVersion2 = JSON.parse(readFileSync43(
|
|
33749
|
+
ownVersion2 = JSON.parse(readFileSync43(join52(dir, "../package.json"), "utf-8")).version || ownVersion2;
|
|
33733
33750
|
} catch {
|
|
33734
33751
|
try {
|
|
33735
|
-
if (true) ownVersion2 = "0.7.
|
|
33752
|
+
if (true) ownVersion2 = "0.7.21";
|
|
33736
33753
|
} catch {
|
|
33737
33754
|
}
|
|
33738
33755
|
}
|
|
@@ -33800,8 +33817,8 @@ init_paths();
|
|
|
33800
33817
|
import { readFileSync as readFileSync44, writeFileSync as writeFileSync14, mkdirSync as mkdirSync15, statSync as statSync45 } from "fs";
|
|
33801
33818
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
33802
33819
|
import { createHash as createHash11 } from "crypto";
|
|
33803
|
-
import { join as
|
|
33804
|
-
var cursorPath = () =>
|
|
33820
|
+
import { join as join53, dirname as dirname24 } from "path";
|
|
33821
|
+
var cursorPath = () => join53(getDataDir(), "code-index-cursor.json");
|
|
33805
33822
|
function readCursor() {
|
|
33806
33823
|
try {
|
|
33807
33824
|
const raw = JSON.parse(readFileSync44(cursorPath(), "utf-8"));
|
|
@@ -33848,7 +33865,7 @@ function workspaceFingerprint(workspace, collectorVersion) {
|
|
|
33848
33865
|
const rel = entry.slice(3);
|
|
33849
33866
|
let stamp2 = "gone";
|
|
33850
33867
|
try {
|
|
33851
|
-
const s = statSync45(
|
|
33868
|
+
const s = statSync45(join53(workspace, rel));
|
|
33852
33869
|
stamp2 = `${s.size}:${Math.floor(s.mtimeMs)}`;
|
|
33853
33870
|
} catch {
|
|
33854
33871
|
}
|
|
@@ -34117,7 +34134,7 @@ async function runCollectorMigration(opts) {
|
|
|
34117
34134
|
init_sync_ledger();
|
|
34118
34135
|
init_collector_health();
|
|
34119
34136
|
import { existsSync as existsSync52, readFileSync as readFileSync49, statSync as statSync49 } from "fs";
|
|
34120
|
-
var CLI_VERSION3 = true ? "0.7.
|
|
34137
|
+
var CLI_VERSION3 = true ? "0.7.21" : "0.0.0";
|
|
34121
34138
|
var DEBOUNCE_MS = 5e3;
|
|
34122
34139
|
var PLANS_DIR = claudeBackend.plansDir();
|
|
34123
34140
|
var TASKS_DIR = claudeBackend.tasksDir();
|
|
@@ -34127,8 +34144,8 @@ var CODEX_SESSIONS_DIR = codexBackend.sessionsDir();
|
|
|
34127
34144
|
var PI_SESSION_DIRS = piBackend.sessionDirs();
|
|
34128
34145
|
var OPENCODE_DB_PATH = opencodeBackend.dbPath();
|
|
34129
34146
|
var OPENCODE_DB_DIR = dirname25(OPENCODE_DB_PATH);
|
|
34130
|
-
var CURRENT_RESUME_PATH =
|
|
34131
|
-
var LAST_CLEANUP_PATH =
|
|
34147
|
+
var CURRENT_RESUME_PATH = join58(claudeBackend.homeDir(), "current-resume");
|
|
34148
|
+
var LAST_CLEANUP_PATH = join58(claudeBackend.homeDir(), ".last-cleanup");
|
|
34132
34149
|
var debounceTimer = null;
|
|
34133
34150
|
var ticks = new TickQueue({
|
|
34134
34151
|
onError: (kind, err) => daemonLog.error(`${kind} tick failed: ${err instanceof Error ? err.message : err}`)
|
|
@@ -34388,7 +34405,7 @@ if (BOOT_CODE) {
|
|
|
34388
34405
|
daemonLog.info(`running bundle ${BOOT_CODE.path} (${BOOT_CODE.size} bytes)`);
|
|
34389
34406
|
}
|
|
34390
34407
|
{
|
|
34391
|
-
const r = rotateLogIfLarge(
|
|
34408
|
+
const r = rotateLogIfLarge(join58(getDataDir(), "watch.log"));
|
|
34392
34409
|
if (r.rotated) {
|
|
34393
34410
|
daemonLog.info(`rotated watch.log at ${(r.sizeBefore / 1048576).toFixed(0)}MB \u2192 watch.log.1 (copy+truncate; the path is preserved)`);
|
|
34394
34411
|
}
|
|
@@ -34568,13 +34585,13 @@ var WORKSPACE_MARKERS = [
|
|
|
34568
34585
|
function isCodeWorkspace(p) {
|
|
34569
34586
|
try {
|
|
34570
34587
|
const resolved = resolve2(p);
|
|
34571
|
-
if (resolved === sep4 || resolved ===
|
|
34588
|
+
if (resolved === sep4 || resolved === homedir22() || dirname25(resolved) === resolved) return false;
|
|
34572
34589
|
} catch {
|
|
34573
34590
|
return false;
|
|
34574
34591
|
}
|
|
34575
34592
|
return WORKSPACE_MARKERS.some((m) => {
|
|
34576
34593
|
try {
|
|
34577
|
-
return existsSync52(
|
|
34594
|
+
return existsSync52(join58(p, m));
|
|
34578
34595
|
} catch {
|
|
34579
34596
|
return false;
|
|
34580
34597
|
}
|