chat-recall 0.5.23 → 0.5.25
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 +10 -0
- package/dist/auto-update.d.ts.map +1 -1
- package/dist/auto-update.js +66 -3
- package/dist/auto-update.js.map +1 -1
- package/dist/cli.js +91 -42
- package/dist/cli.js.map +1 -1
- package/dist/mcp.js +29 -8
- package/dist/watch.js +49 -29
- package/package.json +1 -1
package/dist/auto-update.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface UpdateDeps {
|
|
|
46
46
|
install: (tgzPath: string) => void;
|
|
47
47
|
restart: (platform: NodeJS.Platform) => void;
|
|
48
48
|
platform?: NodeJS.Platform;
|
|
49
|
+
/** Version actually on disk after the install — the post-condition check. */
|
|
50
|
+
verify?: () => string | null;
|
|
49
51
|
}
|
|
50
52
|
export interface UpdateResult {
|
|
51
53
|
updated: boolean;
|
|
@@ -55,6 +57,14 @@ export interface UpdateResult {
|
|
|
55
57
|
}
|
|
56
58
|
/** Execute a plan: download → checksum-verify → install → restart. */
|
|
57
59
|
export declare function executeAutoUpdate(plan: UpdatePlan, deps: UpdateDeps): Promise<UpdateResult>;
|
|
60
|
+
/**
|
|
61
|
+
* The npm prefix the RUNNING copy was installed into.
|
|
62
|
+
*
|
|
63
|
+
* `<prefix>/lib/node_modules/chat-recall/dist/auto-update.js` → `<prefix>`.
|
|
64
|
+
* Returns null when this file is not inside a node_modules tree (a source
|
|
65
|
+
* checkout, a bundled binary), where there is nothing to reinstall over.
|
|
66
|
+
*/
|
|
67
|
+
export declare function runningPrefix(moduleUrl?: string): string | null;
|
|
58
68
|
/**
|
|
59
69
|
* Full flow for one logged-in server. Best-effort — any failure returns a
|
|
60
70
|
* reason and never throws into the daemon loop.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-update.d.ts","sourceRoot":"","sources":["../src/auto-update.ts"],"names":[],"mappings":"AAyBA,MAAM,W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,MAAM,GAAG,SAAS,GAAG,UAAU,CAMjH;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAAG,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CAAE;AAE/F,sEAAsE;AACtE,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAkCjG;AASD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,SAAS,SAAkB,GAAG,MAAM,GAAG,IAAI,CAWxE;AAuCD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GACzB,OAAO,CAAC,YAAY,CAAC,CAkDvB"}
|
package/dist/auto-update.js
CHANGED
|
@@ -19,7 +19,7 @@ import { readFileSync } from 'node:fs';
|
|
|
19
19
|
import { fileURLToPath } from 'node:url';
|
|
20
20
|
import { fetchWithTimeout } from './http.js';
|
|
21
21
|
import { writeFileSync, mkdtempSync } from 'node:fs';
|
|
22
|
-
import { join, dirname } from 'node:path';
|
|
22
|
+
import { join, dirname, sep } from 'node:path';
|
|
23
23
|
import { tmpdir } from 'node:os';
|
|
24
24
|
import { createHash } from 'node:crypto';
|
|
25
25
|
/** semver-ish compare: -1 (a<b), 0 (a==b), 1 (a>b). Ignores prerelease tags. */
|
|
@@ -113,6 +113,24 @@ export async function executeAutoUpdate(plan, deps) {
|
|
|
113
113
|
catch (e) {
|
|
114
114
|
return { updated: false, reason: `install failed: ${e instanceof Error ? e.message : e}` };
|
|
115
115
|
}
|
|
116
|
+
// VERIFY THE BYTES ON DISK, because "npm exited 0" is not "the user now runs
|
|
117
|
+
// the new version". This reported `updated 0.5.18 → 0.5.24` on every sync for
|
|
118
|
+
// six releases while the copy on PATH never changed — npm had succeeded into a
|
|
119
|
+
// different prefix (see realInstall). An unverified success is the worst
|
|
120
|
+
// possible outcome: it silences the update notice too, so nothing ever
|
|
121
|
+
// complains again.
|
|
122
|
+
//
|
|
123
|
+
// `verify` is injectable so a test can drive both outcomes; the default reads
|
|
124
|
+
// the manifest of the package THIS file was loaded from.
|
|
125
|
+
const landed = (deps.verify ?? installedVersion)();
|
|
126
|
+
if (landed && plan.to && compareVersions(landed, plan.to) < 0) {
|
|
127
|
+
return {
|
|
128
|
+
updated: false,
|
|
129
|
+
reason: `install reported success but ${landed} is still on disk (wanted ${plan.to}) — `
|
|
130
|
+
+ 'the package that runs is not the one npm wrote. Reinstall by hand: '
|
|
131
|
+
+ `npm install -g ${plan.url}`,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
116
134
|
try {
|
|
117
135
|
deps.restart(deps.platform ?? process.platform);
|
|
118
136
|
}
|
|
@@ -126,9 +144,54 @@ async function realDownload(url) {
|
|
|
126
144
|
throw new Error(`HTTP ${res.status}`);
|
|
127
145
|
return Buffer.from(await res.arrayBuffer());
|
|
128
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* The npm prefix the RUNNING copy was installed into.
|
|
149
|
+
*
|
|
150
|
+
* `<prefix>/lib/node_modules/chat-recall/dist/auto-update.js` → `<prefix>`.
|
|
151
|
+
* Returns null when this file is not inside a node_modules tree (a source
|
|
152
|
+
* checkout, a bundled binary), where there is nothing to reinstall over.
|
|
153
|
+
*/
|
|
154
|
+
export function runningPrefix(moduleUrl = import.meta.url) {
|
|
155
|
+
const here = fileURLToPath(moduleUrl);
|
|
156
|
+
const marker = `${sep}node_modules${sep}`;
|
|
157
|
+
const at = here.lastIndexOf(marker);
|
|
158
|
+
if (at === -1)
|
|
159
|
+
return null;
|
|
160
|
+
// <prefix>/lib/node_modules/... → strip the trailing `/lib` too, because that
|
|
161
|
+
// is what `npm --prefix` expects.
|
|
162
|
+
const beforeNodeModules = here.slice(0, at);
|
|
163
|
+
return beforeNodeModules.endsWith(`${sep}lib`)
|
|
164
|
+
? beforeNodeModules.slice(0, -4)
|
|
165
|
+
: beforeNodeModules;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Install the new tarball OVER THE COPY THAT IS RUNNING.
|
|
169
|
+
*
|
|
170
|
+
* ── The silent no-op this fixes ───────────────────────────────────────────
|
|
171
|
+
* This was `npm install -g`, with a `--prefix ~/.local` fallback only if that
|
|
172
|
+
* THREW. On a machine with nvm, plain `npm install -g` succeeds — into nvm's
|
|
173
|
+
* prefix — so the fallback never ran, and a CLI living in `~/.local` (which is
|
|
174
|
+
* where install.sh puts it whenever the global prefix is not writable, i.e.
|
|
175
|
+
* exactly the population the fallback exists for) was never replaced. Measured
|
|
176
|
+
* on a real machine:
|
|
177
|
+
*
|
|
178
|
+
* ~/.nvm/versions/node/v23.9.0/lib/node_modules/chat-recall 0.5.24 (not on PATH)
|
|
179
|
+
* ~/.local/lib/node_modules/chat-recall 0.5.18 (on PATH)
|
|
180
|
+
*
|
|
181
|
+
* The updater reported `✓ updated 0.5.18 → 0.5.24` truthfully — it HAD installed
|
|
182
|
+
* 0.5.24 — while every command kept running 0.5.18, and it did so again on every
|
|
183
|
+
* sync, for every release. A self-updater that installs somewhere the user never
|
|
184
|
+
* runs is worse than none: it reports success forever.
|
|
185
|
+
*
|
|
186
|
+
* So target the prefix this file was loaded from, and fall back to npm's own
|
|
187
|
+
* global only when that cannot be determined.
|
|
188
|
+
*/
|
|
129
189
|
function realInstall(tgz) {
|
|
130
|
-
|
|
131
|
-
|
|
190
|
+
const prefix = runningPrefix();
|
|
191
|
+
if (prefix) {
|
|
192
|
+
execSync(`npm install -g --prefix "${prefix}" "${tgz}"`, { stdio: 'ignore' });
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
132
195
|
try {
|
|
133
196
|
execSync(`npm install -g "${tgz}"`, { stdio: 'ignore' });
|
|
134
197
|
}
|
package/dist/auto-update.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-update.js","sourceRoot":"","sources":["../src/auto-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"auto-update.js","sourceRoot":"","sources":["../src/auto-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,I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AC3F,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACjE,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,IAAI,EAAE;QAC3C,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY;QACxC,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW;QACrC,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW;QACrC,QAAQ,EAAE,IAAI,EAAE,QAAQ;KACzB,CAAC,CAAC;IAEH,8EAA8E;IAC9E,+EAA+E;IAC/E,4DAA4D;IAC5D,yEAAyE;IACzE,wEAAwE;IACxE,0EAA0E;IAC1E,kEAAkE;IAClE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;YACjE,iBAAiB,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACtG,CAAC;QAAC,MAAM,CAAC,CAAC,8BAA8B,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -2480,7 +2480,7 @@ var require_transport = __commonJS({
|
|
|
2480
2480
|
"use strict";
|
|
2481
2481
|
var { createRequire: createRequire3 } = __require("module");
|
|
2482
2482
|
var getCallers = require_caller();
|
|
2483
|
-
var { join: join61, isAbsolute: isAbsolute4, sep:
|
|
2483
|
+
var { join: join61, isAbsolute: isAbsolute4, sep: sep4 } = __require("node:path");
|
|
2484
2484
|
var sleep2 = require_atomic_sleep();
|
|
2485
2485
|
var onExit = require_on_exit_leak_free();
|
|
2486
2486
|
var ThreadStream = require_thread_stream();
|
|
@@ -2588,7 +2588,7 @@ var require_transport = __commonJS({
|
|
|
2588
2588
|
let fixTarget2;
|
|
2589
2589
|
for (const filePath of callers) {
|
|
2590
2590
|
try {
|
|
2591
|
-
const context3 = filePath === "node:repl" ? process.cwd() +
|
|
2591
|
+
const context3 = filePath === "node:repl" ? process.cwd() + sep4 : filePath;
|
|
2592
2592
|
fixTarget2 = createRequire3(context3).resolve(origin);
|
|
2593
2593
|
break;
|
|
2594
2594
|
} catch (err) {
|
|
@@ -6659,8 +6659,8 @@ function decodeDirName(dirName) {
|
|
|
6659
6659
|
}
|
|
6660
6660
|
for (let len = 2; len <= segments.length - i; len++) {
|
|
6661
6661
|
const joinedSegments = segments.slice(i, i + len);
|
|
6662
|
-
for (const
|
|
6663
|
-
const candidate = join5(currentPath, joinedSegments.join(
|
|
6662
|
+
for (const sep4 of ["-", "_", "."]) {
|
|
6663
|
+
const candidate = join5(currentPath, joinedSegments.join(sep4));
|
|
6664
6664
|
if (existsSync5(candidate)) {
|
|
6665
6665
|
currentPath = candidate;
|
|
6666
6666
|
i += len;
|
|
@@ -7134,13 +7134,13 @@ async function parseCodexSubagents(sessionPath) {
|
|
|
7134
7134
|
if (meta?.type !== "session_meta")
|
|
7135
7135
|
continue;
|
|
7136
7136
|
const payload = meta.payload || {};
|
|
7137
|
-
const
|
|
7138
|
-
if (!
|
|
7137
|
+
const spawn3 = payload.source?.subagent?.thread_spawn;
|
|
7138
|
+
if (!spawn3)
|
|
7139
7139
|
continue;
|
|
7140
|
-
if (
|
|
7140
|
+
if (spawn3.parent_thread_id !== parentId)
|
|
7141
7141
|
continue;
|
|
7142
7142
|
const id = fileName.replace(/\.jsonl$/i, "");
|
|
7143
|
-
const role = String(
|
|
7143
|
+
const role = String(spawn3.agent_role || payload.agent_role || "").toLowerCase();
|
|
7144
7144
|
const kind = role.includes("compact") ? "compact" : role.includes("aside") ? "aside" : role.includes("worker") || role.includes("explore") ? "explore" : "other";
|
|
7145
7145
|
let messages = [];
|
|
7146
7146
|
try {
|
|
@@ -7152,8 +7152,8 @@ async function parseCodexSubagents(sessionPath) {
|
|
|
7152
7152
|
subagents.push({
|
|
7153
7153
|
id,
|
|
7154
7154
|
kind,
|
|
7155
|
-
agentType:
|
|
7156
|
-
description:
|
|
7155
|
+
agentType: spawn3.agent_role || payload.agent_role,
|
|
7156
|
+
description: spawn3.agent_nickname || payload.agent_nickname,
|
|
7157
7157
|
filePath,
|
|
7158
7158
|
messageCount: messages.length,
|
|
7159
7159
|
toolUseCount,
|
|
@@ -7488,7 +7488,7 @@ async function archiveRawSession(store, sessionId) {
|
|
|
7488
7488
|
}
|
|
7489
7489
|
function detectForkPredecessor(sessionPath) {
|
|
7490
7490
|
const { readFileSync: readFileSync50, readdirSync: readdirSync35 } = requireFs();
|
|
7491
|
-
const { dirname: dirname28, join: join61, basename:
|
|
7491
|
+
const { dirname: dirname28, join: join61, basename: basename30 } = requirePath();
|
|
7492
7492
|
let text;
|
|
7493
7493
|
try {
|
|
7494
7494
|
text = readFileSync50(sessionPath, "utf-8");
|
|
@@ -7514,7 +7514,7 @@ function detectForkPredecessor(sessionPath) {
|
|
|
7514
7514
|
if (text.includes(`"uuid":"${headParent}"`))
|
|
7515
7515
|
return null;
|
|
7516
7516
|
const dir = dirname28(sessionPath);
|
|
7517
|
-
const self =
|
|
7517
|
+
const self = basename30(sessionPath);
|
|
7518
7518
|
let entries;
|
|
7519
7519
|
try {
|
|
7520
7520
|
entries = readdirSync35(dir);
|
|
@@ -7526,7 +7526,7 @@ function detectForkPredecessor(sessionPath) {
|
|
|
7526
7526
|
continue;
|
|
7527
7527
|
try {
|
|
7528
7528
|
if (readFileSync50(join61(dir, f), "utf-8").includes(`"uuid":"${headParent}"`)) {
|
|
7529
|
-
return
|
|
7529
|
+
return basename30(f, ".jsonl");
|
|
7530
7530
|
}
|
|
7531
7531
|
} catch {
|
|
7532
7532
|
}
|
|
@@ -9781,8 +9781,8 @@ var init_codex2 = __esm({
|
|
|
9781
9781
|
} catch {
|
|
9782
9782
|
continue;
|
|
9783
9783
|
}
|
|
9784
|
-
const
|
|
9785
|
-
if (!
|
|
9784
|
+
const spawn3 = meta?.payload?.source?.subagent?.thread_spawn;
|
|
9785
|
+
if (!spawn3 || spawn3.parent_thread_id !== parentUuid)
|
|
9786
9786
|
continue;
|
|
9787
9787
|
events.push(...this.parseRollout(path));
|
|
9788
9788
|
}
|
|
@@ -9975,10 +9975,10 @@ var init_codex2 = __esm({
|
|
|
9975
9975
|
const meta = JSON.parse(first);
|
|
9976
9976
|
const payload = meta?.payload || {};
|
|
9977
9977
|
projectPath = payload.cwd || "";
|
|
9978
|
-
const
|
|
9979
|
-
if (
|
|
9978
|
+
const spawn3 = payload.source?.subagent?.thread_spawn;
|
|
9979
|
+
if (spawn3 || payload.agent_role || payload.agent_nickname) {
|
|
9980
9980
|
isSubagent = true;
|
|
9981
|
-
parentId =
|
|
9981
|
+
parentId = spawn3?.parent_thread_id || null;
|
|
9982
9982
|
}
|
|
9983
9983
|
}
|
|
9984
9984
|
} catch {
|
|
@@ -19730,7 +19730,7 @@ var init_http = __esm({
|
|
|
19730
19730
|
CLI_VERSION = JSON.parse(readFileSync33(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
|
|
19731
19731
|
} catch {
|
|
19732
19732
|
try {
|
|
19733
|
-
if (true) CLI_VERSION = "0.5.
|
|
19733
|
+
if (true) CLI_VERSION = "0.5.25";
|
|
19734
19734
|
} catch {
|
|
19735
19735
|
}
|
|
19736
19736
|
}
|
|
@@ -20242,7 +20242,7 @@ var init_telemetry = __esm({
|
|
|
20242
20242
|
init_sync_client();
|
|
20243
20243
|
cliVersion2 = () => {
|
|
20244
20244
|
try {
|
|
20245
|
-
return true ? "0.5.
|
|
20245
|
+
return true ? "0.5.25" : "dev";
|
|
20246
20246
|
} catch {
|
|
20247
20247
|
return "dev";
|
|
20248
20248
|
}
|
|
@@ -20566,13 +20566,14 @@ __export(auto_update_exports, {
|
|
|
20566
20566
|
newerOf: () => newerOf,
|
|
20567
20567
|
planAutoUpdate: () => planAutoUpdate,
|
|
20568
20568
|
runAutoUpdate: () => runAutoUpdate,
|
|
20569
|
+
runningPrefix: () => runningPrefix,
|
|
20569
20570
|
tarballUrl: () => tarballUrl
|
|
20570
20571
|
});
|
|
20571
20572
|
import { execSync as execSync2 } from "node:child_process";
|
|
20572
20573
|
import { readFileSync as readFileSync36 } from "node:fs";
|
|
20573
20574
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
20574
20575
|
import { writeFileSync as writeFileSync8, mkdtempSync as mkdtempSync3 } from "node:fs";
|
|
20575
|
-
import { join as join43, dirname as dirname18 } from "node:path";
|
|
20576
|
+
import { join as join43, dirname as dirname18, sep as sep2 } from "node:path";
|
|
20576
20577
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
20577
20578
|
import { createHash as createHash12 } from "node:crypto";
|
|
20578
20579
|
function compareVersions(a, b) {
|
|
@@ -20628,6 +20629,13 @@ async function executeAutoUpdate(plan, deps) {
|
|
|
20628
20629
|
} catch (e) {
|
|
20629
20630
|
return { updated: false, reason: `install failed: ${e instanceof Error ? e.message : e}` };
|
|
20630
20631
|
}
|
|
20632
|
+
const landed = (deps.verify ?? installedVersion)();
|
|
20633
|
+
if (landed && plan.to && compareVersions(landed, plan.to) < 0) {
|
|
20634
|
+
return {
|
|
20635
|
+
updated: false,
|
|
20636
|
+
reason: `install reported success but ${landed} is still on disk (wanted ${plan.to}) \u2014 the package that runs is not the one npm wrote. Reinstall by hand: npm install -g ${plan.url}`
|
|
20637
|
+
};
|
|
20638
|
+
}
|
|
20631
20639
|
try {
|
|
20632
20640
|
deps.restart(deps.platform ?? process.platform);
|
|
20633
20641
|
} catch {
|
|
@@ -20639,7 +20647,20 @@ async function realDownload(url) {
|
|
|
20639
20647
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
20640
20648
|
return Buffer.from(await res.arrayBuffer());
|
|
20641
20649
|
}
|
|
20650
|
+
function runningPrefix(moduleUrl = import.meta.url) {
|
|
20651
|
+
const here = fileURLToPath2(moduleUrl);
|
|
20652
|
+
const marker = `${sep2}node_modules${sep2}`;
|
|
20653
|
+
const at = here.lastIndexOf(marker);
|
|
20654
|
+
if (at === -1) return null;
|
|
20655
|
+
const beforeNodeModules = here.slice(0, at);
|
|
20656
|
+
return beforeNodeModules.endsWith(`${sep2}lib`) ? beforeNodeModules.slice(0, -4) : beforeNodeModules;
|
|
20657
|
+
}
|
|
20642
20658
|
function realInstall(tgz) {
|
|
20659
|
+
const prefix = runningPrefix();
|
|
20660
|
+
if (prefix) {
|
|
20661
|
+
execSync2(`npm install -g --prefix "${prefix}" "${tgz}"`, { stdio: "ignore" });
|
|
20662
|
+
return;
|
|
20663
|
+
}
|
|
20643
20664
|
try {
|
|
20644
20665
|
execSync2(`npm install -g "${tgz}"`, { stdio: "ignore" });
|
|
20645
20666
|
} catch {
|
|
@@ -22217,7 +22238,7 @@ var init_sync_client = __esm({
|
|
|
22217
22238
|
ownVersion = JSON.parse(readFileSync37(join44(dir, "../package.json"), "utf-8")).version || ownVersion;
|
|
22218
22239
|
} catch {
|
|
22219
22240
|
try {
|
|
22220
|
-
if (true) ownVersion = "0.5.
|
|
22241
|
+
if (true) ownVersion = "0.5.25";
|
|
22221
22242
|
} catch {
|
|
22222
22243
|
}
|
|
22223
22244
|
}
|
|
@@ -22332,7 +22353,7 @@ var init_update_notice = __esm({
|
|
|
22332
22353
|
|
|
22333
22354
|
// ../engine/dist/core/which.js
|
|
22334
22355
|
import { existsSync as existsSync43, statSync as statSync39, accessSync, constants } from "node:fs";
|
|
22335
|
-
import { join as join46, isAbsolute as isAbsolute2, delimiter as delimiter2, sep as
|
|
22356
|
+
import { join as join46, isAbsolute as isAbsolute2, delimiter as delimiter2, sep as sep3 } from "node:path";
|
|
22336
22357
|
function executable(p) {
|
|
22337
22358
|
try {
|
|
22338
22359
|
if (!statSync39(p).isFile())
|
|
@@ -22360,7 +22381,7 @@ function candidates(name) {
|
|
|
22360
22381
|
function resolveOnPath(name) {
|
|
22361
22382
|
if (!name)
|
|
22362
22383
|
return null;
|
|
22363
|
-
if (name.includes("/") || isWindows && name.includes(
|
|
22384
|
+
if (name.includes("/") || isWindows && name.includes(sep3) || isAbsolute2(name)) {
|
|
22364
22385
|
for (const c of candidates(name))
|
|
22365
22386
|
if (executable(c))
|
|
22366
22387
|
return c;
|
|
@@ -23034,7 +23055,7 @@ var init_install_skills = __esm({
|
|
|
23034
23055
|
|
|
23035
23056
|
// ../engine/dist/core/artifact-codec.js
|
|
23036
23057
|
import { readFileSync as readFileSync42 } from "fs";
|
|
23037
|
-
import { join as join50 } from "path";
|
|
23058
|
+
import { basename as basename24, join as join50 } from "path";
|
|
23038
23059
|
import { homedir as homedir17 } from "os";
|
|
23039
23060
|
function parseCommandText(content, format, fallbackName) {
|
|
23040
23061
|
if (format === "toml") {
|
|
@@ -23162,8 +23183,7 @@ function emit(type, art, toTool, projectPath) {
|
|
|
23162
23183
|
};
|
|
23163
23184
|
}
|
|
23164
23185
|
function base(filePath) {
|
|
23165
|
-
|
|
23166
|
-
return b.replace(/\.(md|toml)$/, "");
|
|
23186
|
+
return basename24(filePath).replace(/\.(md|toml)$/, "");
|
|
23167
23187
|
}
|
|
23168
23188
|
var init_artifact_codec = __esm({
|
|
23169
23189
|
"../engine/dist/core/artifact-codec.js"() {
|
|
@@ -23198,7 +23218,7 @@ __export(toolkit_sync_exports, {
|
|
|
23198
23218
|
writeMcpEntry: () => writeMcpEntry
|
|
23199
23219
|
});
|
|
23200
23220
|
import { existsSync as existsSync47, mkdirSync as mkdirSync13, readFileSync as readFileSync43, writeFileSync as writeFileSync14, cpSync as cpSync2 } from "fs";
|
|
23201
|
-
import { dirname as dirname21, join as join51, basename as
|
|
23221
|
+
import { dirname as dirname21, join as join51, basename as basename25 } from "path";
|
|
23202
23222
|
import { homedir as homedir18 } from "os";
|
|
23203
23223
|
function supportedTargetsFor(type) {
|
|
23204
23224
|
return SUPPORTED_TARGETS[type];
|
|
@@ -23256,7 +23276,7 @@ function copySkill(row, toTool) {
|
|
|
23256
23276
|
const skillDir = row.extra.skillDir || dirname21(row.filePath);
|
|
23257
23277
|
if (!existsSync47(skillDir))
|
|
23258
23278
|
return { ok: false, status: 404, error: `Source dir missing: ${skillDir}` };
|
|
23259
|
-
const name = row.extra.skillName ||
|
|
23279
|
+
const name = row.extra.skillName || basename25(skillDir);
|
|
23260
23280
|
const targetDir = join51(skillsDirFor(toTool), name);
|
|
23261
23281
|
if (existsSync47(targetDir))
|
|
23262
23282
|
return { ok: false, status: 409, error: `Already exists: ${targetDir}` };
|
|
@@ -23654,7 +23674,7 @@ __export(toolkit_pull_exports, {
|
|
|
23654
23674
|
portableCommand: () => portableCommand
|
|
23655
23675
|
});
|
|
23656
23676
|
import { existsSync as existsSync48, mkdirSync as mkdirSync14, statSync as statSync42, writeFileSync as writeFileSync15 } from "node:fs";
|
|
23657
|
-
import { dirname as dirname22, join as join52, basename as
|
|
23677
|
+
import { dirname as dirname22, join as join52, basename as basename26, isAbsolute as isAbsolute3 } from "node:path";
|
|
23658
23678
|
function isExecutableFile(p) {
|
|
23659
23679
|
try {
|
|
23660
23680
|
return statSync42(p).isFile();
|
|
@@ -23671,7 +23691,7 @@ function portableCommand(cmd) {
|
|
|
23671
23691
|
}
|
|
23672
23692
|
if (isExecutableFile(cmd))
|
|
23673
23693
|
return { command: cmd, rewritten: false };
|
|
23674
|
-
const base2 =
|
|
23694
|
+
const base2 = basename26(cmd);
|
|
23675
23695
|
if (onPath(base2))
|
|
23676
23696
|
return { command: base2, rewritten: true };
|
|
23677
23697
|
return { missing: cmd };
|
|
@@ -24152,7 +24172,7 @@ __export(escalate_exports, {
|
|
|
24152
24172
|
extractLearnings: () => extractLearnings,
|
|
24153
24173
|
runEscalate: () => runEscalate
|
|
24154
24174
|
});
|
|
24155
|
-
import { basename as
|
|
24175
|
+
import { basename as basename27 } from "node:path";
|
|
24156
24176
|
function isNoiseUserMessage(content) {
|
|
24157
24177
|
const c = content.trimStart();
|
|
24158
24178
|
return c.length === 0 || c.length > 4e3 || c.startsWith("Caveat:") || c.startsWith("[Request interrupted") || c.includes("<command-name>") || c.includes("<local-command") || c.startsWith("<system-reminder>");
|
|
@@ -24219,10 +24239,10 @@ async function runEscalate(deps, opts) {
|
|
|
24219
24239
|
return null;
|
|
24220
24240
|
}
|
|
24221
24241
|
sessionId = row.sessionId;
|
|
24222
|
-
if (!projectName && row.projectPath) projectName =
|
|
24242
|
+
if (!projectName && row.projectPath) projectName = basename27(row.projectPath);
|
|
24223
24243
|
}
|
|
24224
24244
|
if (!sessionId) throw new Error("pass a session id or --latest");
|
|
24225
|
-
if (!projectName) projectName =
|
|
24245
|
+
if (!projectName) projectName = basename27(opts.cwd);
|
|
24226
24246
|
const convo = await deps.getSoft(`/api/conversations/${encodeURIComponent(sessionId)}?limit=0`);
|
|
24227
24247
|
if (!convo.data || convo.data.messages.length === 0) {
|
|
24228
24248
|
deps.log(`escalate: session ${sessionId} not synced yet${convo.message ? ` (${convo.message})` : ""} \u2014 nothing to do.`);
|
|
@@ -24552,10 +24572,10 @@ __export(collector_exports, {
|
|
|
24552
24572
|
isSecretRule: () => isSecretRule,
|
|
24553
24573
|
resolveCodeindexBin: () => resolveCodeindexBin
|
|
24554
24574
|
});
|
|
24555
|
-
import { spawn } from "node:child_process";
|
|
24575
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
24556
24576
|
import { execSync as execSync4 } from "node:child_process";
|
|
24557
24577
|
import { readFileSync as readFileSync44 } from "node:fs";
|
|
24558
|
-
import { join as join53, basename as
|
|
24578
|
+
import { join as join53, basename as basename28 } from "node:path";
|
|
24559
24579
|
async function resolveCodeindexBin(autoInstall = true) {
|
|
24560
24580
|
let st = checkCodeindexStatus();
|
|
24561
24581
|
if (!st.installed && autoInstall)
|
|
@@ -24567,7 +24587,7 @@ async function resolveCodeindexBin(autoInstall = true) {
|
|
|
24567
24587
|
}
|
|
24568
24588
|
function runMcp(binPath, workspace, calls, timeoutMs = 18e4) {
|
|
24569
24589
|
return new Promise((resolve3, reject) => {
|
|
24570
|
-
const p =
|
|
24590
|
+
const p = spawn2(binPath, ["--mcp", "--workspace", workspace], { stdio: ["pipe", "pipe", "ignore"] });
|
|
24571
24591
|
const res = /* @__PURE__ */ new Map();
|
|
24572
24592
|
let pending = "";
|
|
24573
24593
|
let failed = false;
|
|
@@ -24933,7 +24953,7 @@ async function collectCode(opts) {
|
|
|
24933
24953
|
file,
|
|
24934
24954
|
line: null,
|
|
24935
24955
|
rule: "god_module",
|
|
24936
|
-
title: `God module ${
|
|
24956
|
+
title: `God module ${basename28(file)}`,
|
|
24937
24957
|
snippet: `fan-in ${m.fan_in}, fan-out ${m.fan_out}`,
|
|
24938
24958
|
why: FINDING_WHY.coupling,
|
|
24939
24959
|
agentPrompt: couplingPrompt(file, m.fan_in ?? 0, m.fan_out ?? 0, Math.round((m.instability ?? 0) * 100) / 100)
|
|
@@ -25101,7 +25121,7 @@ async function collectCode(opts) {
|
|
|
25101
25121
|
file,
|
|
25102
25122
|
line: v.line ?? null,
|
|
25103
25123
|
rule: v.violation_type ?? "manifest_violation",
|
|
25104
|
-
title: `${v.violation_type} in ${
|
|
25124
|
+
title: `${v.violation_type} in ${basename28(file)}`,
|
|
25105
25125
|
snippet: v.description ?? "",
|
|
25106
25126
|
why: FINDING_WHY.manifest,
|
|
25107
25127
|
agentPrompt: manifestPrompt(v.violation_type ?? "", file, v.line ?? null, v.description ?? "")
|
|
@@ -25872,7 +25892,7 @@ var init_intent_drain = __esm({
|
|
|
25872
25892
|
ownVersion2 = JSON.parse(readFileSync46(join55(dir, "../package.json"), "utf-8")).version || ownVersion2;
|
|
25873
25893
|
} catch {
|
|
25874
25894
|
try {
|
|
25875
|
-
if (true) ownVersion2 = "0.5.
|
|
25895
|
+
if (true) ownVersion2 = "0.5.25";
|
|
25876
25896
|
} catch {
|
|
25877
25897
|
}
|
|
25878
25898
|
}
|
|
@@ -27382,7 +27402,7 @@ import { Command } from "commander";
|
|
|
27382
27402
|
import chalk from "chalk";
|
|
27383
27403
|
import { existsSync as existsSync56, readFileSync as readFileSync49, writeFileSync as writeFileSync21, realpathSync as realpathSync5 } from "fs";
|
|
27384
27404
|
import { homedir as homedir22 } from "os";
|
|
27385
|
-
import { join as join60, resolve as resolve2, dirname as dirname27, basename as
|
|
27405
|
+
import { join as join60, resolve as resolve2, dirname as dirname27, basename as basename29 } from "path";
|
|
27386
27406
|
|
|
27387
27407
|
// ../engine/dist/core/score-tier.js
|
|
27388
27408
|
var STRONG_RATIO = 0.85;
|
|
@@ -27410,6 +27430,33 @@ function tierAll(results) {
|
|
|
27410
27430
|
init_sync_client();
|
|
27411
27431
|
init_update_notice();
|
|
27412
27432
|
init_server_probe();
|
|
27433
|
+
|
|
27434
|
+
// src/open-browser.ts
|
|
27435
|
+
import { spawn } from "node:child_process";
|
|
27436
|
+
function isSafeUrl(url) {
|
|
27437
|
+
try {
|
|
27438
|
+
const u = new URL(url);
|
|
27439
|
+
return u.protocol === "https:" || u.protocol === "http:";
|
|
27440
|
+
} catch {
|
|
27441
|
+
return false;
|
|
27442
|
+
}
|
|
27443
|
+
}
|
|
27444
|
+
function openBrowser(url) {
|
|
27445
|
+
if (!isSafeUrl(url)) return false;
|
|
27446
|
+
if (process.env.CHAT_RECALL_NO_BROWSER === "1" || process.env.CI) return false;
|
|
27447
|
+
const [cmd, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
27448
|
+
try {
|
|
27449
|
+
const child = spawn(cmd, args, { stdio: "ignore", detached: true });
|
|
27450
|
+
child.on("error", () => {
|
|
27451
|
+
});
|
|
27452
|
+
child.unref();
|
|
27453
|
+
return true;
|
|
27454
|
+
} catch {
|
|
27455
|
+
return false;
|
|
27456
|
+
}
|
|
27457
|
+
}
|
|
27458
|
+
|
|
27459
|
+
// src/cli.ts
|
|
27413
27460
|
init_which();
|
|
27414
27461
|
init_collector_health();
|
|
27415
27462
|
init_telemetry_consent();
|
|
@@ -28355,7 +28402,7 @@ program.command("doctor").description("Quick health check across login, server,
|
|
|
28355
28402
|
}
|
|
28356
28403
|
}
|
|
28357
28404
|
for (const hooksJson of claudeHookConfigFiles()) {
|
|
28358
|
-
const profile =
|
|
28405
|
+
const profile = basename29(dirname27(hooksJson));
|
|
28359
28406
|
const label = `Claude hooks (${profile})`;
|
|
28360
28407
|
if (!existsSync57(hooksJson)) {
|
|
28361
28408
|
note(false, label, `no ${hooksJson} \u2014 run \`chat-recall install-hooks\``);
|
|
@@ -29806,6 +29853,8 @@ async function runLogin(serverUrl, opts) {
|
|
|
29806
29853
|
console.log(chalk.bold("To log in, open:"));
|
|
29807
29854
|
console.log(" " + chalk.cyan(p.url));
|
|
29808
29855
|
console.log(chalk.dim(` (if prompted, enter code: ${chalk.bold(p.userCode)} at ${p.verificationUri})`));
|
|
29856
|
+
const opened = openBrowser(p.url);
|
|
29857
|
+
if (opened) console.log(chalk.dim(" (opening your browser\u2026 if nothing happens, use the link above)"));
|
|
29809
29858
|
console.log(chalk.dim("After approving, come back to THIS terminal \u2014 it finishes the login by itself."));
|
|
29810
29859
|
console.log(chalk.dim("Waiting for approval\u2026"));
|
|
29811
29860
|
};
|