chat-recall 0.5.32 → 0.6.0

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 CHANGED
@@ -163,6 +163,23 @@ any of it. Secrets are masked client-side before anything leaves the machine.
163
163
  }
164
164
  ```
165
165
 
166
+ `chat-recall-mcp` is a relay, not the server. It finds the background daemon for
167
+ your tool profile, starts one if there is none, and passes bytes to it. Every
168
+ session on a machine therefore shares one loaded engine instead of carrying its
169
+ own: a session costs about 50 MB rather than 87 MB, against a single shared
170
+ daemon, and background sync runs in one process instead of racing a lock in all
171
+ of them. The daemon exits 15 minutes after the last session closes.
172
+
173
+ Two knobs, both optional:
174
+
175
+ ```bash
176
+ CHAT_RECALL_NO_DAEMON=1 # load the whole server in each session instead
177
+ CHAT_RECALL_DAEMON_IDLE_SECS=0 # keep the daemon resident (default 900)
178
+ ```
179
+
180
+ If the daemon cannot be reached for any reason, the session loads the server
181
+ itself and works exactly as it did before — slower, never broken.
182
+
166
183
  Then install the hooks (one command sets up auto-save, pre-compact backup, and the resume-hint that warns when you're about to redo work):
167
184
 
168
185
  ```bash
package/dist/cli.js CHANGED
@@ -19742,7 +19742,7 @@ var init_http = __esm({
19742
19742
  CLI_VERSION = JSON.parse(readFileSync33(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
19743
19743
  } catch {
19744
19744
  try {
19745
- if (true) CLI_VERSION = "0.5.32";
19745
+ if (true) CLI_VERSION = "0.6.0";
19746
19746
  } catch {
19747
19747
  }
19748
19748
  }
@@ -20262,7 +20262,7 @@ var init_telemetry = __esm({
20262
20262
  init_sync_client();
20263
20263
  cliVersion2 = () => {
20264
20264
  try {
20265
- return true ? "0.5.32" : "dev";
20265
+ return true ? "0.6.0" : "dev";
20266
20266
  } catch {
20267
20267
  return "dev";
20268
20268
  }
@@ -22352,7 +22352,7 @@ var init_sync_client = __esm({
22352
22352
  ownVersion = JSON.parse(readFileSync37(join44(dir, "../package.json"), "utf-8")).version || ownVersion;
22353
22353
  } catch {
22354
22354
  try {
22355
- if (true) ownVersion = "0.5.32";
22355
+ if (true) ownVersion = "0.6.0";
22356
22356
  } catch {
22357
22357
  }
22358
22358
  }
@@ -22387,12 +22387,17 @@ var init_sync_client = __esm({
22387
22387
  // src/update-notice.ts
22388
22388
  var update_notice_exports = {};
22389
22389
  __export(update_notice_exports, {
22390
+ newestKnown: () => newestKnown,
22390
22391
  printUpdateNotice: () => printUpdateNotice,
22391
22392
  refreshUpdateCheck: () => refreshUpdateCheck,
22392
22393
  updateNotice: () => updateNotice
22393
22394
  });
22394
22395
  import { readFileSync as readFileSync38, writeFileSync as writeFileSync10 } from "node:fs";
22395
22396
  import { join as join45 } from "node:path";
22397
+ function newestKnown(c) {
22398
+ const npm = c.npmVersion ?? "0.0.0";
22399
+ return compareVersions(npm, c.serverVersion) > 0 ? { version: npm, source: "npm" } : { version: c.serverVersion, source: "server" };
22400
+ }
22396
22401
  function readCheck() {
22397
22402
  try {
22398
22403
  const c = JSON.parse(readFileSync38(checkPath(), "utf-8"));
@@ -22411,8 +22416,24 @@ function updateNotice() {
22411
22416
  const c = readCheck();
22412
22417
  if (!c) return null;
22413
22418
  const own = cliVersion();
22414
- if (compareVersions(c.serverVersion, own) <= 0) return null;
22415
- return `chat-recall ${c.serverVersion} is available (you have ${own}). Auto-update should apply it; force it now with: chat-recall update`;
22419
+ const { version: version2, source } = newestKnown(c);
22420
+ if (compareVersions(version2, own) <= 0) return null;
22421
+ const how = source === "npm" ? "The server you sync to has not rolled it yet \u2014 install it with: npm install -g chat-recall@latest" : "Auto-update should apply it; force it now with: chat-recall update";
22422
+ return `chat-recall ${version2} is available (you have ${own}). ${how}`;
22423
+ }
22424
+ async function fetchNpmLatest() {
22425
+ if (process.env.CHAT_RECALL_NO_NPM_CHECK === "1") return null;
22426
+ try {
22427
+ const res = await fetchWithTimeout(NPM_LATEST_URL, {
22428
+ headers: { accept: "application/vnd.npm.install-v1+json" }
22429
+ }, 5e3);
22430
+ if (!res.ok) return null;
22431
+ const body = await res.json();
22432
+ const v = body["dist-tags"]?.latest;
22433
+ return typeof v === "string" && v ? v : null;
22434
+ } catch {
22435
+ return null;
22436
+ }
22416
22437
  }
22417
22438
  async function refreshUpdateCheck(force = false) {
22418
22439
  const prev = readCheck();
@@ -22437,8 +22458,14 @@ async function refreshUpdateCheck(force = false) {
22437
22458
  } catch {
22438
22459
  return prev;
22439
22460
  }
22440
- if (newest === "0.0.0") return prev;
22441
- const next = { serverVersion: newest, checkedAt: Date.now() };
22461
+ const npmVersion = await fetchNpmLatest();
22462
+ if (newest === "0.0.0" && !npmVersion) return prev;
22463
+ const next = {
22464
+ // A server that answered nothing must not erase what we last knew from one.
22465
+ serverVersion: newest !== "0.0.0" ? newest : prev?.serverVersion ?? "0.0.0",
22466
+ checkedAt: Date.now()
22467
+ };
22468
+ if (npmVersion) next.npmVersion = npmVersion;
22442
22469
  writeCheck(next);
22443
22470
  return next;
22444
22471
  }
@@ -22458,7 +22485,7 @@ function printUpdateNotice() {
22458
22485
  } catch {
22459
22486
  }
22460
22487
  }
22461
- var CHECK_TTL_MS, checkPath, printed;
22488
+ var CHECK_TTL_MS, NPM_LATEST_URL, checkPath, printed;
22462
22489
  var init_update_notice = __esm({
22463
22490
  "src/update-notice.ts"() {
22464
22491
  "use strict";
@@ -22466,6 +22493,7 @@ var init_update_notice = __esm({
22466
22493
  init_auto_update();
22467
22494
  init_http();
22468
22495
  CHECK_TTL_MS = 6 * 3600 * 1e3;
22496
+ NPM_LATEST_URL = "https://registry.npmjs.org/chat-recall";
22469
22497
  checkPath = () => join45(getDataDir(), "update-check.json");
22470
22498
  printed = false;
22471
22499
  }
@@ -26116,7 +26144,7 @@ var init_intent_drain = __esm({
26116
26144
  ownVersion2 = JSON.parse(readFileSync46(join55(dir, "../package.json"), "utf-8")).version || ownVersion2;
26117
26145
  } catch {
26118
26146
  try {
26119
- if (true) ownVersion2 = "0.5.32";
26147
+ if (true) ownVersion2 = "0.6.0";
26120
26148
  } catch {
26121
26149
  }
26122
26150
  }
@@ -28149,7 +28177,7 @@ program.command("init").description("Set up chat-recall: connect to your server,
28149
28177
  const projectRoot = join60(import.meta.dirname, "..");
28150
28178
  let mcpBinOnPath = false;
28151
28179
  mcpBinOnPath = isOnPath("chat-recall-mcp");
28152
- const launch = mcpBinOnPath ? { command: "chat-recall-mcp" } : { command: "node", args: [join60(projectRoot, "dist", "mcp.js")] };
28180
+ const launch = mcpBinOnPath ? { command: "chat-recall-mcp" } : { command: "node", args: [join60(projectRoot, "dist", "mcp-relay.js")] };
28153
28181
  const MCP_ENV = { NODE_OPTIONS: "--max-old-space-size=1024" };
28154
28182
  const { registerMcpEverywhere: registerMcpEverywhere2 } = await Promise.resolve().then(() => (init_mcp_clients(), mcp_clients_exports));
28155
28183
  const MCP_CLIENT_FOR_BIN = {
@@ -30773,9 +30801,9 @@ program.command("reconcile").description("Reconcile DERIVED FIELDS (e.g. native
30773
30801
  process.exit(1);
30774
30802
  }
30775
30803
  });
30776
- program.command("update").description("Update this CLI now from the server you sync to (same-origin, checksum-pinned) and report exactly why if it cannot").action(async () => {
30777
- const { runAutoUpdate: runAutoUpdate2 } = await Promise.resolve().then(() => (init_auto_update(), auto_update_exports));
30778
- const { refreshUpdateCheck: refreshUpdateCheck2 } = await Promise.resolve().then(() => (init_update_notice(), update_notice_exports));
30804
+ program.command("update").description("Update this CLI now from the server you sync to (same-origin, checksum-pinned) and report exactly why if it cannot. Use --from-npm when the server has not rolled the newest release yet.").option("--from-npm", "Install the newest published release straight from the npm registry instead of the server tarball").action(async (opts) => {
30805
+ const { runAutoUpdate: runAutoUpdate2, compareVersions: compareVersions2 } = await Promise.resolve().then(() => (init_auto_update(), auto_update_exports));
30806
+ const { refreshUpdateCheck: refreshUpdateCheck2, newestKnown: newestKnown2 } = await Promise.resolve().then(() => (init_update_notice(), update_notice_exports));
30779
30807
  const { cliVersion: cliVersion3 } = await Promise.resolve().then(() => (init_http(), http_exports));
30780
30808
  const targets = loadAllCredentials();
30781
30809
  if (!targets.length) {
@@ -30795,11 +30823,43 @@ program.command("update").description("Update this CLI now from the server you s
30795
30823
  if (/install failed|download failed|checksum/.test(r.reason)) installFailed = true;
30796
30824
  console.log((benign ? chalk2.dim("\u2022 ") : chalk2.red("\u2717 ")) + r.reason + chalk2.dim(` (${base3})`));
30797
30825
  }
30798
- await refreshUpdateCheck2(true);
30826
+ const check = await refreshUpdateCheck2(true);
30799
30827
  if (installFailed) {
30800
30828
  console.log(chalk2.dim("\nThe update was available but did not install \u2014 usually npm cannot write the global prefix. Retry with:"));
30801
30829
  console.log(chalk2.dim(` npm install -g chat-recall (or re-run the installer: curl -fsSL ${targets[0].serverUrl.replace(/\/+$/, "")}/install | sh)`));
30802
30830
  }
30831
+ if (check) {
30832
+ const own = cliVersion3();
30833
+ const { version: version2, source } = newestKnown2(check);
30834
+ const behind = source === "npm" && compareVersions2(version2, own) > 0;
30835
+ if (behind && !opts.fromNpm) {
30836
+ console.log(chalk2.yellow(`
30837
+ npm has ${version2}; the server you sync to still serves ${check.serverVersion}.`));
30838
+ console.log(chalk2.dim("The server tarball cannot deliver it until that deployment rolls. Get it now with:"));
30839
+ console.log(chalk2.dim(" chat-recall update --from-npm"));
30840
+ } else if (behind && opts.fromNpm) {
30841
+ console.log(chalk2.dim(`
30842
+ Installing ${version2} from npm\u2026`));
30843
+ try {
30844
+ const { execFileSync: execFileSync4 } = await import("node:child_process");
30845
+ execFileSync4("npm", ["install", "-g", `chat-recall@${version2}`], { stdio: "inherit" });
30846
+ const { installedVersion: installedVersion2 } = await Promise.resolve().then(() => (init_auto_update(), auto_update_exports));
30847
+ const landed = installedVersion2();
30848
+ if (landed && compareVersions2(landed, version2) >= 0) {
30849
+ console.log(chalk2.green(`\u2713 updated to ${landed} from npm`));
30850
+ } else {
30851
+ console.error(chalk2.red(`\u2717 npm reported success but ${landed ?? "an unknown version"} is still on disk \u2014 the package that runs is not the one npm wrote.`));
30852
+ process.exit(1);
30853
+ }
30854
+ } catch (e) {
30855
+ console.error(chalk2.red(`\u2717 npm install failed: ${e instanceof Error ? e.message : e}`));
30856
+ process.exit(1);
30857
+ }
30858
+ } else if (opts.fromNpm) {
30859
+ console.log(chalk2.dim(`
30860
+ npm has nothing newer than ${own} \u2014 nothing to do.`));
30861
+ }
30862
+ }
30803
30863
  });
30804
30864
  program.hook("preAction", () => {
30805
30865
  printUpdateNotice();