chat-recall 0.5.17 → 0.5.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-update.d.ts +11 -0
- package/dist/auto-update.d.ts.map +1 -1
- package/dist/auto-update.js +50 -2
- package/dist/auto-update.js.map +1 -1
- package/dist/cli.js +125 -106
- package/dist/mcp.js +62 -41
- package/dist/watch.js +85 -66
- package/package.json +1 -1
package/dist/watch.js
CHANGED
|
@@ -6808,8 +6808,8 @@ var init_claude = __esm({
|
|
|
6808
6808
|
|
|
6809
6809
|
// ../engine/dist/transcript/gemini.js
|
|
6810
6810
|
async function parseGeminiTranscript(sessionPath) {
|
|
6811
|
-
const { readFileSync:
|
|
6812
|
-
return parseGeminiTranscriptText(
|
|
6811
|
+
const { readFileSync: readFileSync47 } = await import("fs");
|
|
6812
|
+
return parseGeminiTranscriptText(readFileSync47(sessionPath, "utf-8"));
|
|
6813
6813
|
}
|
|
6814
6814
|
function parseGeminiTranscriptText(text) {
|
|
6815
6815
|
let content;
|
|
@@ -7265,11 +7265,11 @@ async function archiveRawSession(store, sessionId) {
|
|
|
7265
7265
|
return await store.putRawSession(sessionId, exp.tool, Math.floor(exp.mtime), gz, size);
|
|
7266
7266
|
}
|
|
7267
7267
|
function detectForkPredecessor(sessionPath) {
|
|
7268
|
-
const { readFileSync:
|
|
7269
|
-
const { dirname:
|
|
7268
|
+
const { readFileSync: readFileSync47, readdirSync: readdirSync34 } = requireFs();
|
|
7269
|
+
const { dirname: dirname26, join: join56, basename: basename27 } = requirePath();
|
|
7270
7270
|
let text;
|
|
7271
7271
|
try {
|
|
7272
|
-
text =
|
|
7272
|
+
text = readFileSync47(sessionPath, "utf-8");
|
|
7273
7273
|
} catch {
|
|
7274
7274
|
return null;
|
|
7275
7275
|
}
|
|
@@ -7291,7 +7291,7 @@ function detectForkPredecessor(sessionPath) {
|
|
|
7291
7291
|
return null;
|
|
7292
7292
|
if (text.includes(`"uuid":"${headParent}"`))
|
|
7293
7293
|
return null;
|
|
7294
|
-
const dir =
|
|
7294
|
+
const dir = dirname26(sessionPath);
|
|
7295
7295
|
const self = basename27(sessionPath);
|
|
7296
7296
|
let entries;
|
|
7297
7297
|
try {
|
|
@@ -7303,7 +7303,7 @@ function detectForkPredecessor(sessionPath) {
|
|
|
7303
7303
|
if (!f.endsWith(".jsonl") || f === self || f === "sessions-index.json")
|
|
7304
7304
|
continue;
|
|
7305
7305
|
try {
|
|
7306
|
-
if (
|
|
7306
|
+
if (readFileSync47(join56(dir, f), "utf-8").includes(`"uuid":"${headParent}"`)) {
|
|
7307
7307
|
return basename27(f, ".jsonl");
|
|
7308
7308
|
}
|
|
7309
7309
|
} catch {
|
|
@@ -19210,7 +19210,7 @@ var init_http = __esm({
|
|
|
19210
19210
|
CLI_VERSION = JSON.parse(readFileSync33(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
|
|
19211
19211
|
} catch {
|
|
19212
19212
|
try {
|
|
19213
|
-
if (true) CLI_VERSION = "0.5.
|
|
19213
|
+
if (true) CLI_VERSION = "0.5.19";
|
|
19214
19214
|
} catch {
|
|
19215
19215
|
}
|
|
19216
19216
|
}
|
|
@@ -19718,7 +19718,7 @@ var init_telemetry = __esm({
|
|
|
19718
19718
|
init_sync_client();
|
|
19719
19719
|
cliVersion = () => {
|
|
19720
19720
|
try {
|
|
19721
|
-
return true ? "0.5.
|
|
19721
|
+
return true ? "0.5.19" : "dev";
|
|
19722
19722
|
} catch {
|
|
19723
19723
|
return "dev";
|
|
19724
19724
|
}
|
|
@@ -19852,14 +19852,18 @@ var auto_update_exports = {};
|
|
|
19852
19852
|
__export(auto_update_exports, {
|
|
19853
19853
|
compareVersions: () => compareVersions,
|
|
19854
19854
|
executeAutoUpdate: () => executeAutoUpdate,
|
|
19855
|
+
installedVersion: () => installedVersion,
|
|
19855
19856
|
isAutoUpdateEnabled: () => isAutoUpdateEnabled,
|
|
19857
|
+
newerOf: () => newerOf,
|
|
19856
19858
|
planAutoUpdate: () => planAutoUpdate,
|
|
19857
19859
|
runAutoUpdate: () => runAutoUpdate,
|
|
19858
19860
|
tarballUrl: () => tarballUrl
|
|
19859
19861
|
});
|
|
19860
19862
|
import { execSync as execSync2 } from "node:child_process";
|
|
19863
|
+
import { readFileSync as readFileSync36 } from "node:fs";
|
|
19864
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
19861
19865
|
import { writeFileSync as writeFileSync8, mkdtempSync as mkdtempSync3 } from "node:fs";
|
|
19862
|
-
import { join as join43 } from "node:path";
|
|
19866
|
+
import { join as join43, dirname as dirname18 } from "node:path";
|
|
19863
19867
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
19864
19868
|
import { createHash as createHash11 } from "node:crypto";
|
|
19865
19869
|
function compareVersions(a, b) {
|
|
@@ -19876,6 +19880,20 @@ function isAutoUpdateEnabled(_edition, flag) {
|
|
|
19876
19880
|
if (flag === "1" || flag === "true" || flag === "on") return true;
|
|
19877
19881
|
return true;
|
|
19878
19882
|
}
|
|
19883
|
+
function newerOf(a, b) {
|
|
19884
|
+
if (!b) return a;
|
|
19885
|
+
if (!a) return b;
|
|
19886
|
+
return compareVersions(a, b) >= 0 ? a : b;
|
|
19887
|
+
}
|
|
19888
|
+
function installedVersion() {
|
|
19889
|
+
try {
|
|
19890
|
+
const here = dirname18(fileURLToPath2(import.meta.url));
|
|
19891
|
+
const raw = readFileSync36(join43(here, "..", "package.json"), "utf-8");
|
|
19892
|
+
return JSON.parse(raw).version || null;
|
|
19893
|
+
} catch {
|
|
19894
|
+
return null;
|
|
19895
|
+
}
|
|
19896
|
+
}
|
|
19879
19897
|
function planAutoUpdate(base2, caps, ownVersion3, flag) {
|
|
19880
19898
|
const rel = caps.cli;
|
|
19881
19899
|
if (!rel || !rel.version || !rel.sha256) return { update: false, reason: "server advertises no CLI release" };
|
|
@@ -19933,7 +19951,8 @@ async function runAutoUpdate(base2, authHeaders, ownVersion3, deps) {
|
|
|
19933
19951
|
} catch (e) {
|
|
19934
19952
|
return { updated: false, reason: `capabilities unreachable: ${e instanceof Error ? e.message : e}` };
|
|
19935
19953
|
}
|
|
19936
|
-
const
|
|
19954
|
+
const effectiveOwn = newerOf(ownVersion3, installedVersion());
|
|
19955
|
+
const plan = planAutoUpdate(base2, caps, effectiveOwn, process.env.CHAT_RECALL_AUTO_UPDATE);
|
|
19937
19956
|
if (!plan.update) return { updated: false, reason: plan.reason };
|
|
19938
19957
|
const result = await executeAutoUpdate(plan, {
|
|
19939
19958
|
download: deps?.download ?? realDownload,
|
|
@@ -19960,11 +19979,11 @@ var init_auto_update = __esm({
|
|
|
19960
19979
|
});
|
|
19961
19980
|
|
|
19962
19981
|
// src/sync-client.ts
|
|
19963
|
-
import { join as join44, dirname as
|
|
19964
|
-
import { readFileSync as
|
|
19982
|
+
import { join as join44, dirname as dirname19, basename as basename22 } from "node:path";
|
|
19983
|
+
import { readFileSync as readFileSync37, writeFileSync as writeFileSync9, mkdirSync as mkdirSync9, mkdtempSync as mkdtempSync4, rmSync as rmSync5, chmodSync as chmodSync3, unlinkSync as unlinkSync2, readdirSync as readdirSync32, statSync as statSync38 } from "node:fs";
|
|
19965
19984
|
import { tmpdir as tmpdir3, hostname as hostname2 } from "node:os";
|
|
19966
19985
|
import { createHash as createHash12 } from "node:crypto";
|
|
19967
|
-
import { fileURLToPath as
|
|
19986
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
19968
19987
|
import { gzipSync as gzipSync3 } from "zlib";
|
|
19969
19988
|
function classifyError(msg) {
|
|
19970
19989
|
const m = msg.toLowerCase();
|
|
@@ -19983,7 +20002,7 @@ function loadAllCredentials() {
|
|
|
19983
20002
|
const fromEnv = envCredentials();
|
|
19984
20003
|
if (fromEnv) return [{ serverUrl: fromEnv.serverUrl, token: fromEnv.token }];
|
|
19985
20004
|
try {
|
|
19986
|
-
const parsed = JSON.parse(
|
|
20005
|
+
const parsed = JSON.parse(readFileSync37(credPath(), "utf-8"));
|
|
19987
20006
|
if (Array.isArray(parsed?.targets)) return parsed.targets.filter((t) => t?.serverUrl).map((t) => ({ serverUrl: t.serverUrl, token: t.token || "" }));
|
|
19988
20007
|
if (parsed?.serverUrl) return [{ serverUrl: parsed.serverUrl, token: parsed.token || "" }];
|
|
19989
20008
|
} catch {
|
|
@@ -20046,7 +20065,7 @@ function syncConfigCachePath() {
|
|
|
20046
20065
|
}
|
|
20047
20066
|
function readPersistedSyncConfigs() {
|
|
20048
20067
|
try {
|
|
20049
|
-
return JSON.parse(
|
|
20068
|
+
return JSON.parse(readFileSync37(syncConfigCachePath(), "utf-8"));
|
|
20050
20069
|
} catch {
|
|
20051
20070
|
return {};
|
|
20052
20071
|
}
|
|
@@ -20055,7 +20074,7 @@ function persistSyncConfig(base2, config) {
|
|
|
20055
20074
|
try {
|
|
20056
20075
|
const all = readPersistedSyncConfigs();
|
|
20057
20076
|
all[base2] = { fetchedAt: Date.now(), config };
|
|
20058
|
-
mkdirSync9(
|
|
20077
|
+
mkdirSync9(dirname19(syncConfigCachePath()), { recursive: true });
|
|
20059
20078
|
writeFileSync9(syncConfigCachePath(), JSON.stringify(all, null, 2));
|
|
20060
20079
|
} catch {
|
|
20061
20080
|
}
|
|
@@ -21391,11 +21410,11 @@ var init_sync_client = __esm({
|
|
|
21391
21410
|
init_backends();
|
|
21392
21411
|
ownVersion = "0.0.0";
|
|
21393
21412
|
try {
|
|
21394
|
-
const dir =
|
|
21395
|
-
ownVersion = JSON.parse(
|
|
21413
|
+
const dir = dirname19(fileURLToPath3(import.meta.url));
|
|
21414
|
+
ownVersion = JSON.parse(readFileSync37(join44(dir, "../package.json"), "utf-8")).version || ownVersion;
|
|
21396
21415
|
} catch {
|
|
21397
21416
|
try {
|
|
21398
|
-
if (true) ownVersion = "0.5.
|
|
21417
|
+
if (true) ownVersion = "0.5.19";
|
|
21399
21418
|
} catch {
|
|
21400
21419
|
}
|
|
21401
21420
|
}
|
|
@@ -21420,7 +21439,7 @@ var init_sync_client = __esm({
|
|
|
21420
21439
|
});
|
|
21421
21440
|
|
|
21422
21441
|
// ../engine/dist/core/artifact-codec.js
|
|
21423
|
-
import { readFileSync as
|
|
21442
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
21424
21443
|
import { join as join45 } from "path";
|
|
21425
21444
|
import { homedir as homedir15 } from "os";
|
|
21426
21445
|
function parseCommandText(content, format, fallbackName) {
|
|
@@ -21444,13 +21463,13 @@ function parseAgentText(content, format, fallbackName) {
|
|
|
21444
21463
|
return { name: fm.name || fallbackName, description: fm.description || "", tools: fm.tools, body: body.trim() };
|
|
21445
21464
|
}
|
|
21446
21465
|
function readCommand(filePath, format) {
|
|
21447
|
-
return parseCommandText(
|
|
21466
|
+
return parseCommandText(readFileSync38(filePath, "utf-8"), format, base(filePath));
|
|
21448
21467
|
}
|
|
21449
21468
|
function readAgent(filePath, format) {
|
|
21450
|
-
return parseAgentText(
|
|
21469
|
+
return parseAgentText(readFileSync38(filePath, "utf-8"), format, base(filePath));
|
|
21451
21470
|
}
|
|
21452
21471
|
function readInstructions(filePath, name) {
|
|
21453
|
-
const content =
|
|
21472
|
+
const content = readFileSync38(filePath, "utf-8");
|
|
21454
21473
|
return { name, description: "", body: content };
|
|
21455
21474
|
}
|
|
21456
21475
|
function commandPath(tool, name) {
|
|
@@ -21566,8 +21585,8 @@ var init_artifact_codec = __esm({
|
|
|
21566
21585
|
});
|
|
21567
21586
|
|
|
21568
21587
|
// ../engine/dist/core/toolkit-sync.js
|
|
21569
|
-
import { existsSync as existsSync43, mkdirSync as mkdirSync10, readFileSync as
|
|
21570
|
-
import { dirname as
|
|
21588
|
+
import { existsSync as existsSync43, mkdirSync as mkdirSync10, readFileSync as readFileSync39, writeFileSync as writeFileSync10, cpSync } from "fs";
|
|
21589
|
+
import { dirname as dirname20, join as join46, basename as basename23 } from "path";
|
|
21571
21590
|
import { homedir as homedir16 } from "os";
|
|
21572
21591
|
function rowFromMemoryItem(type, item) {
|
|
21573
21592
|
const extra = item.extra || {};
|
|
@@ -21601,7 +21620,7 @@ function skillsDirFor(tool) {
|
|
|
21601
21620
|
}
|
|
21602
21621
|
}
|
|
21603
21622
|
function copySkill(row, toTool) {
|
|
21604
|
-
const skillDir = row.extra.skillDir ||
|
|
21623
|
+
const skillDir = row.extra.skillDir || dirname20(row.filePath);
|
|
21605
21624
|
if (!existsSync43(skillDir))
|
|
21606
21625
|
return { ok: false, status: 404, error: `Source dir missing: ${skillDir}` };
|
|
21607
21626
|
const name = row.extra.skillName || basename23(skillDir);
|
|
@@ -21609,7 +21628,7 @@ function copySkill(row, toTool) {
|
|
|
21609
21628
|
if (existsSync43(targetDir))
|
|
21610
21629
|
return { ok: false, status: 409, error: `Already exists: ${targetDir}` };
|
|
21611
21630
|
try {
|
|
21612
|
-
mkdirSync10(
|
|
21631
|
+
mkdirSync10(dirname20(targetDir), { recursive: true });
|
|
21613
21632
|
cpSync(skillDir, targetDir, { recursive: true });
|
|
21614
21633
|
return { ok: true, targetPath: targetDir };
|
|
21615
21634
|
} catch (e) {
|
|
@@ -21641,7 +21660,7 @@ function readMcpEntry(tool, name) {
|
|
|
21641
21660
|
if (!existsSync43(t.path))
|
|
21642
21661
|
continue;
|
|
21643
21662
|
try {
|
|
21644
|
-
const cfg = JSON.parse(
|
|
21663
|
+
const cfg = JSON.parse(readFileSync39(t.path, "utf-8"));
|
|
21645
21664
|
const block = cfg[t.key] || {};
|
|
21646
21665
|
if (block[name])
|
|
21647
21666
|
return block[name];
|
|
@@ -21655,7 +21674,7 @@ function readCodexMcpEntry(path, target) {
|
|
|
21655
21674
|
return null;
|
|
21656
21675
|
let content;
|
|
21657
21676
|
try {
|
|
21658
|
-
content =
|
|
21677
|
+
content = readFileSync39(path, "utf-8");
|
|
21659
21678
|
} catch {
|
|
21660
21679
|
return null;
|
|
21661
21680
|
}
|
|
@@ -21706,7 +21725,7 @@ function readCodexMcpEntry(path, target) {
|
|
|
21706
21725
|
function writeCodexMcpEntry(path, name, entry) {
|
|
21707
21726
|
let content = "";
|
|
21708
21727
|
if (existsSync43(path))
|
|
21709
|
-
content =
|
|
21728
|
+
content = readFileSync39(path, "utf-8");
|
|
21710
21729
|
const header = `[mcp_servers.${name}]`;
|
|
21711
21730
|
if (content.includes(header))
|
|
21712
21731
|
return false;
|
|
@@ -21735,7 +21754,7 @@ function writeCodexMcpEntry(path, name, entry) {
|
|
|
21735
21754
|
for (const [k, v] of Object.entries(entry.env))
|
|
21736
21755
|
lines.push(`${k} = ${escape(String(v))}`);
|
|
21737
21756
|
}
|
|
21738
|
-
mkdirSync10(
|
|
21757
|
+
mkdirSync10(dirname20(path), { recursive: true });
|
|
21739
21758
|
writeFileSync10(path, content + lines.join("\n") + "\n");
|
|
21740
21759
|
return true;
|
|
21741
21760
|
}
|
|
@@ -21768,12 +21787,12 @@ function writeMcpEntry(toTool, name, entry) {
|
|
|
21768
21787
|
let cfg = {};
|
|
21769
21788
|
if (existsSync43(path)) {
|
|
21770
21789
|
try {
|
|
21771
|
-
cfg = JSON.parse(
|
|
21790
|
+
cfg = JSON.parse(readFileSync39(path, "utf-8"));
|
|
21772
21791
|
} catch {
|
|
21773
21792
|
return { ok: false, status: 500, error: `Target config is malformed: ${path}` };
|
|
21774
21793
|
}
|
|
21775
21794
|
} else {
|
|
21776
|
-
mkdirSync10(
|
|
21795
|
+
mkdirSync10(dirname20(path), { recursive: true });
|
|
21777
21796
|
}
|
|
21778
21797
|
cfg[key2] = cfg[key2] || {};
|
|
21779
21798
|
if (cfg[key2][name])
|
|
@@ -21833,7 +21852,7 @@ function copyCommandOrAgent(type, row, toTool) {
|
|
|
21833
21852
|
if (existsSync43(out.path))
|
|
21834
21853
|
return { ok: false, status: 409, error: `Already exists: ${out.path}` };
|
|
21835
21854
|
try {
|
|
21836
|
-
mkdirSync10(
|
|
21855
|
+
mkdirSync10(dirname20(out.path), { recursive: true });
|
|
21837
21856
|
writeFileSync10(out.path, out.content);
|
|
21838
21857
|
return { ok: true, targetPath: out.path };
|
|
21839
21858
|
} catch (e) {
|
|
@@ -21853,7 +21872,7 @@ function copyInstructions(row, toTool) {
|
|
|
21853
21872
|
if (existsSync43(out.path))
|
|
21854
21873
|
return { ok: false, status: 409, error: `Already exists: ${out.path}` };
|
|
21855
21874
|
try {
|
|
21856
|
-
mkdirSync10(
|
|
21875
|
+
mkdirSync10(dirname20(out.path), { recursive: true });
|
|
21857
21876
|
writeFileSync10(out.path, out.content);
|
|
21858
21877
|
return { ok: true, targetPath: out.path };
|
|
21859
21878
|
} catch (e) {
|
|
@@ -22002,7 +22021,7 @@ __export(toolkit_pull_exports, {
|
|
|
22002
22021
|
portableCommand: () => portableCommand
|
|
22003
22022
|
});
|
|
22004
22023
|
import { existsSync as existsSync45, mkdirSync as mkdirSync12, statSync as statSync40, writeFileSync as writeFileSync12 } from "node:fs";
|
|
22005
|
-
import { delimiter as delimiter2, dirname as
|
|
22024
|
+
import { delimiter as delimiter2, dirname as dirname22, join as join48, basename as basename24, isAbsolute as isAbsolute2 } from "node:path";
|
|
22006
22025
|
function isExecutableFile(p) {
|
|
22007
22026
|
try {
|
|
22008
22027
|
return statSync40(p).isFile();
|
|
@@ -22214,7 +22233,7 @@ function executePull(rows, opts = {}) {
|
|
|
22214
22233
|
continue;
|
|
22215
22234
|
}
|
|
22216
22235
|
try {
|
|
22217
|
-
mkdirSync12(
|
|
22236
|
+
mkdirSync12(dirname22(out.path), { recursive: true });
|
|
22218
22237
|
writeFileSync12(out.path, out.content);
|
|
22219
22238
|
outcomes.push({ type, name, tool, status: "written", path: out.path, redactedContent: redacted });
|
|
22220
22239
|
} catch (e) {
|
|
@@ -22703,7 +22722,7 @@ var init_which = __esm({
|
|
|
22703
22722
|
});
|
|
22704
22723
|
|
|
22705
22724
|
// ../engine/dist/core/companions.js
|
|
22706
|
-
import { existsSync as existsSync49, mkdirSync as mkdirSync15, statSync as statSync44, chmodSync as chmodSync4, unlinkSync as unlinkSync4, renameSync as renameSync5, createWriteStream, readFileSync as
|
|
22725
|
+
import { existsSync as existsSync49, mkdirSync as mkdirSync15, statSync as statSync44, chmodSync as chmodSync4, unlinkSync as unlinkSync4, renameSync as renameSync5, createWriteStream, readFileSync as readFileSync44, writeFileSync as writeFileSync15 } from "node:fs";
|
|
22707
22726
|
import { homedir as homedir19 } from "node:os";
|
|
22708
22727
|
import { join as join53 } from "node:path";
|
|
22709
22728
|
import { execSync as execSync3 } from "node:child_process";
|
|
@@ -22815,7 +22834,7 @@ async function installCodeindex(opts = {}) {
|
|
|
22815
22834
|
if (!expected) {
|
|
22816
22835
|
throw new Error(`No pinned checksum for ${status.artifactName} \u2014 refusing to install an unverified binary. Add its sha256 to CODEINDEX_SHA256 in companions.ts.`);
|
|
22817
22836
|
}
|
|
22818
|
-
const actual = createHash16("sha256").update(
|
|
22837
|
+
const actual = createHash16("sha256").update(readFileSync44(tmpPath)).digest("hex");
|
|
22819
22838
|
if (actual !== expected) {
|
|
22820
22839
|
throw new Error(`Checksum mismatch for ${status.artifactName}.
|
|
22821
22840
|
expected ${expected}
|
|
@@ -22966,7 +22985,7 @@ __export(collector_exports, {
|
|
|
22966
22985
|
});
|
|
22967
22986
|
import { spawn as spawn2 } from "node:child_process";
|
|
22968
22987
|
import { execSync as execSync4 } from "node:child_process";
|
|
22969
|
-
import { readFileSync as
|
|
22988
|
+
import { readFileSync as readFileSync45 } from "node:fs";
|
|
22970
22989
|
import { join as join54, basename as basename25 } from "node:path";
|
|
22971
22990
|
async function resolveCodeindexBin(autoInstall = true) {
|
|
22972
22991
|
let st = checkCodeindexStatus();
|
|
@@ -23146,7 +23165,7 @@ async function collectCode(opts) {
|
|
|
23146
23165
|
}
|
|
23147
23166
|
const complexity = (r) => {
|
|
23148
23167
|
try {
|
|
23149
|
-
const txt =
|
|
23168
|
+
const txt = readFileSync45(join54(ws, r), "utf8");
|
|
23150
23169
|
if (txt.length > 2e6)
|
|
23151
23170
|
return 1;
|
|
23152
23171
|
const m = txt.match(CF_RE);
|
|
@@ -23903,21 +23922,21 @@ init_settings();
|
|
|
23903
23922
|
init_sync_client();
|
|
23904
23923
|
init_http();
|
|
23905
23924
|
import chokidar from "chokidar";
|
|
23906
|
-
import { dirname as
|
|
23925
|
+
import { dirname as dirname25, basename as basename26, join as join55, resolve as resolve2, sep as sep3 } from "path";
|
|
23907
23926
|
import { homedir as homedir20 } from "os";
|
|
23908
23927
|
|
|
23909
23928
|
// src/intent-drain.ts
|
|
23910
23929
|
init_http();
|
|
23911
23930
|
init_sync_client();
|
|
23912
23931
|
init_toolkit_sync();
|
|
23913
|
-
import { existsSync as existsSync46, readFileSync as
|
|
23932
|
+
import { existsSync as existsSync46, readFileSync as readFileSync41, writeFileSync as writeFileSync13, appendFileSync, mkdirSync as mkdirSync13 } from "node:fs";
|
|
23914
23933
|
import { join as join49 } from "node:path";
|
|
23915
23934
|
import { homedir as homedir18 } from "node:os";
|
|
23916
23935
|
|
|
23917
23936
|
// src/project-tasks.ts
|
|
23918
23937
|
init_http();
|
|
23919
|
-
import { existsSync as existsSync44, readFileSync as
|
|
23920
|
-
import { join as join47, dirname as
|
|
23938
|
+
import { existsSync as existsSync44, readFileSync as readFileSync40, writeFileSync as writeFileSync11, mkdirSync as mkdirSync11, statSync as statSync39 } from "node:fs";
|
|
23939
|
+
import { join as join47, dirname as dirname21 } from "node:path";
|
|
23921
23940
|
import { homedir as homedir17 } from "node:os";
|
|
23922
23941
|
|
|
23923
23942
|
// ../engine/dist/core/secret-task-status.js
|
|
@@ -23990,14 +24009,14 @@ function ledgerPath2() {
|
|
|
23990
24009
|
}
|
|
23991
24010
|
function readLedger() {
|
|
23992
24011
|
try {
|
|
23993
|
-
return JSON.parse(
|
|
24012
|
+
return JSON.parse(readFileSync40(ledgerPath2(), "utf8"));
|
|
23994
24013
|
} catch {
|
|
23995
24014
|
return {};
|
|
23996
24015
|
}
|
|
23997
24016
|
}
|
|
23998
24017
|
function writeLedger(l) {
|
|
23999
24018
|
try {
|
|
24000
|
-
mkdirSync11(
|
|
24019
|
+
mkdirSync11(dirname21(ledgerPath2()), { recursive: true });
|
|
24001
24020
|
} catch {
|
|
24002
24021
|
}
|
|
24003
24022
|
try {
|
|
@@ -24034,7 +24053,7 @@ async function pushProjectTaskStatuses(base2, authHeaders, opts = {}) {
|
|
|
24034
24053
|
if (ledger[file] === mtime) continue;
|
|
24035
24054
|
let changed;
|
|
24036
24055
|
try {
|
|
24037
|
-
changed = parseTaskFile(
|
|
24056
|
+
changed = parseTaskFile(readFileSync40(file, "utf8")).filter((t) => t.kind === fk.kind);
|
|
24038
24057
|
} catch {
|
|
24039
24058
|
continue;
|
|
24040
24059
|
}
|
|
@@ -24064,8 +24083,8 @@ async function pushProjectTaskStatuses(base2, authHeaders, opts = {}) {
|
|
|
24064
24083
|
}
|
|
24065
24084
|
|
|
24066
24085
|
// src/intent-drain.ts
|
|
24067
|
-
import { fileURLToPath as
|
|
24068
|
-
import { dirname as
|
|
24086
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
24087
|
+
import { dirname as dirname23 } from "node:path";
|
|
24069
24088
|
function applyCodeRecommendation(intent) {
|
|
24070
24089
|
try {
|
|
24071
24090
|
const meta = JSON.parse(intent.name || "{}");
|
|
@@ -24091,7 +24110,7 @@ function applyCodeRecommendation(intent) {
|
|
|
24091
24110
|
if (!meta.rootPath) return { status: "error", result: JSON.stringify({ error: "missing rootPath" }) };
|
|
24092
24111
|
file = join49(meta.rootPath, "CLAUDE.md");
|
|
24093
24112
|
}
|
|
24094
|
-
const existing = existsSync46(file) ?
|
|
24113
|
+
const existing = existsSync46(file) ? readFileSync41(file, "utf8") : "";
|
|
24095
24114
|
if (existing.includes(text)) return { status: "done", result: JSON.stringify({ skipped: "rule already present", file }) };
|
|
24096
24115
|
const block = `${existing && !existing.endsWith("\n") ? "\n" : ""}
|
|
24097
24116
|
## Rule (added by chat-recall recommendation)
|
|
@@ -24184,11 +24203,11 @@ async function runIntent(intent, ctx) {
|
|
|
24184
24203
|
}
|
|
24185
24204
|
var ownVersion2 = "0.0.0";
|
|
24186
24205
|
try {
|
|
24187
|
-
const dir =
|
|
24188
|
-
ownVersion2 = JSON.parse(
|
|
24206
|
+
const dir = dirname23(fileURLToPath4(import.meta.url));
|
|
24207
|
+
ownVersion2 = JSON.parse(readFileSync41(join49(dir, "../package.json"), "utf-8")).version || ownVersion2;
|
|
24189
24208
|
} catch {
|
|
24190
24209
|
try {
|
|
24191
|
-
if (true) ownVersion2 = "0.5.
|
|
24210
|
+
if (true) ownVersion2 = "0.5.19";
|
|
24192
24211
|
} catch {
|
|
24193
24212
|
}
|
|
24194
24213
|
}
|
|
@@ -24252,12 +24271,12 @@ init_auto_update();
|
|
|
24252
24271
|
|
|
24253
24272
|
// src/code-index-cursor.ts
|
|
24254
24273
|
init_paths();
|
|
24255
|
-
import { readFileSync as
|
|
24256
|
-
import { join as join50, dirname as
|
|
24274
|
+
import { readFileSync as readFileSync42, writeFileSync as writeFileSync14, mkdirSync as mkdirSync14 } from "fs";
|
|
24275
|
+
import { join as join50, dirname as dirname24 } from "path";
|
|
24257
24276
|
var cursorPath = () => join50(getDataDir(), "code-index-cursor.json");
|
|
24258
24277
|
function readCursor() {
|
|
24259
24278
|
try {
|
|
24260
|
-
const raw = JSON.parse(
|
|
24279
|
+
const raw = JSON.parse(readFileSync42(cursorPath(), "utf-8"));
|
|
24261
24280
|
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
24262
24281
|
const out = {};
|
|
24263
24282
|
for (const [k, v] of Object.entries(raw)) {
|
|
@@ -24272,7 +24291,7 @@ function readCursor() {
|
|
|
24272
24291
|
function writeCursor(c) {
|
|
24273
24292
|
try {
|
|
24274
24293
|
const p = cursorPath();
|
|
24275
|
-
mkdirSync14(
|
|
24294
|
+
mkdirSync14(dirname24(p), { recursive: true });
|
|
24276
24295
|
writeFileSync14(p, JSON.stringify(c));
|
|
24277
24296
|
} catch {
|
|
24278
24297
|
}
|
|
@@ -24399,13 +24418,13 @@ var daemonLog = {
|
|
|
24399
24418
|
|
|
24400
24419
|
// src/self-restart.ts
|
|
24401
24420
|
import { spawn } from "child_process";
|
|
24402
|
-
import { readFileSync as
|
|
24421
|
+
import { readFileSync as readFileSync43 } from "fs";
|
|
24403
24422
|
import { createHash as createHash14 } from "crypto";
|
|
24404
24423
|
var EXIT_CODE_CODE_CHANGED = 75;
|
|
24405
24424
|
function codeFingerprint(entry = process.argv[1]) {
|
|
24406
24425
|
if (!entry) return null;
|
|
24407
24426
|
try {
|
|
24408
|
-
const buf =
|
|
24427
|
+
const buf = readFileSync43(entry);
|
|
24409
24428
|
return {
|
|
24410
24429
|
path: entry,
|
|
24411
24430
|
size: buf.byteLength,
|
|
@@ -24531,8 +24550,8 @@ async function runCollectorMigration(opts) {
|
|
|
24531
24550
|
// auto-indexer/indexer.ts
|
|
24532
24551
|
init_sync_ledger();
|
|
24533
24552
|
init_collector_health();
|
|
24534
|
-
import { existsSync as existsSync50, readFileSync as
|
|
24535
|
-
var CLI_VERSION3 = true ? "0.5.
|
|
24553
|
+
import { existsSync as existsSync50, readFileSync as readFileSync46 } from "fs";
|
|
24554
|
+
var CLI_VERSION3 = true ? "0.5.19" : "0.0.0";
|
|
24536
24555
|
var DEBOUNCE_MS = 5e3;
|
|
24537
24556
|
var CLAUDE_DIR = claudeBackend.projectsDir();
|
|
24538
24557
|
var PLANS_DIR = claudeBackend.plansDir();
|
|
@@ -24542,7 +24561,7 @@ var DIARY_DIR = getDiaryDir();
|
|
|
24542
24561
|
var CODEX_SESSIONS_DIR = codexBackend.sessionsDir();
|
|
24543
24562
|
var GEMINI_TMP_DIR = geminiBackend.tmpDir();
|
|
24544
24563
|
var OPENCODE_DB_PATH = opencodeBackend.dbPath();
|
|
24545
|
-
var OPENCODE_DB_DIR =
|
|
24564
|
+
var OPENCODE_DB_DIR = dirname25(OPENCODE_DB_PATH);
|
|
24546
24565
|
var CURRENT_RESUME_PATH = join55(claudeBackend.homeDir(), "current-resume");
|
|
24547
24566
|
var LAST_CLEANUP_PATH = join55(claudeBackend.homeDir(), ".last-cleanup");
|
|
24548
24567
|
var debounceTimer = null;
|
|
@@ -24591,7 +24610,7 @@ var lastResumeAt = /* @__PURE__ */ new Map();
|
|
|
24591
24610
|
var RESUME_REARM_MS = 6e4;
|
|
24592
24611
|
async function onResumeSignal(path) {
|
|
24593
24612
|
try {
|
|
24594
|
-
const txt =
|
|
24613
|
+
const txt = readFileSync46(path, "utf-8");
|
|
24595
24614
|
const m = /--resume\s+([0-9a-fA-F-]{36})/.exec(txt);
|
|
24596
24615
|
if (!m) return;
|
|
24597
24616
|
const id = m[1];
|
|
@@ -24945,7 +24964,7 @@ var WORKSPACE_MARKERS = [
|
|
|
24945
24964
|
function isCodeWorkspace(p) {
|
|
24946
24965
|
try {
|
|
24947
24966
|
const resolved = resolve2(p);
|
|
24948
|
-
if (resolved === sep3 || resolved === homedir20() ||
|
|
24967
|
+
if (resolved === sep3 || resolved === homedir20() || dirname25(resolved) === resolved) return false;
|
|
24949
24968
|
} catch {
|
|
24950
24969
|
return false;
|
|
24951
24970
|
}
|