chat-recall 0.7.8 → 0.7.9

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/cli.js CHANGED
@@ -18640,7 +18640,7 @@ var init_http = __esm({
18640
18640
  CLI_VERSION = JSON.parse(readFileSync31(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
18641
18641
  } catch {
18642
18642
  try {
18643
- if (true) CLI_VERSION = "0.7.8";
18643
+ if (true) CLI_VERSION = "0.7.9";
18644
18644
  } catch {
18645
18645
  }
18646
18646
  }
@@ -19139,7 +19139,7 @@ var init_telemetry = __esm({
19139
19139
  init_sync_client();
19140
19140
  cliVersion2 = () => {
19141
19141
  try {
19142
- return true ? "0.7.8" : "dev";
19142
+ return true ? "0.7.9" : "dev";
19143
19143
  } catch {
19144
19144
  return "dev";
19145
19145
  }
@@ -19156,9 +19156,12 @@ __export(collector_health_exports, {
19156
19156
  STALE_AFTER_MS: () => STALE_AFTER_MS,
19157
19157
  applySyncOutcome: () => applySyncOutcome,
19158
19158
  collectorHealthPath: () => collectorHealthPath,
19159
+ crashesAtBoot: () => crashesAtBoot,
19159
19160
  judgeHealth: () => judgeHealth,
19161
+ markCleanExit: () => markCleanExit,
19160
19162
  progressLine: () => progressLine,
19161
19163
  readCollectorHealth: () => readCollectorHealth,
19164
+ recentCrashes: () => recentCrashes,
19162
19165
  reportWalkProgress: () => reportWalkProgress,
19163
19166
  updateCollectorHealth: () => updateCollectorHealth,
19164
19167
  writeCollectorHealth: () => writeCollectorHealth
@@ -19227,6 +19230,20 @@ function reportWalkProgress(p) {
19227
19230
  lastProgressWrite = now;
19228
19231
  updateCollectorHealth({ progress: p });
19229
19232
  }
19233
+ function crashesAtBoot(prior, procStart) {
19234
+ const history = (prior?.crashes ?? []).filter((t) => typeof t === "number");
19235
+ if (!prior)
19236
+ return history;
19237
+ const leftOnPurpose = typeof prior.cleanExitAt === "number" && prior.cleanExitAt >= prior.startedAt;
19238
+ return leftOnPurpose ? history : [...history, procStart];
19239
+ }
19240
+ function recentCrashes(crashes, now = Date.now()) {
19241
+ const cutoff = now - 36e5;
19242
+ return [...new Set(crashes.filter((t) => t > cutoff))].sort((a, b) => a - b).slice(-20);
19243
+ }
19244
+ function markCleanExit(now = Date.now()) {
19245
+ updateCollectorHealth({ cleanExitAt: now });
19246
+ }
19230
19247
  function judgeHealth(h, now = Date.now()) {
19231
19248
  if (!h)
19232
19249
  return { ok: true, summary: null, reasons: [] };
@@ -19236,7 +19253,7 @@ function judgeHealth(h, now = Date.now()) {
19236
19253
  reasons.push(`the collector has not reported for ${ago(silent)} \u2014 it may not be running`);
19237
19254
  }
19238
19255
  if (h.restartsLastHour >= CRASHLOOP_RESTARTS) {
19239
- reasons.push(`it restarted ${h.restartsLastHour} times in the last hour`);
19256
+ reasons.push(`it crashed ${h.restartsLastHour} times in the last hour`);
19240
19257
  }
19241
19258
  const targets = Object.entries(h.targets ?? {});
19242
19259
  const stale = targets.filter(([, t]) => t.lastOkAt === null || now - t.lastOkAt > STALE_AFTER_MS);
@@ -21455,7 +21472,7 @@ var init_sync_client = __esm({
21455
21472
  ownVersion = JSON.parse(readFileSync35(join42(dir, "../package.json"), "utf-8")).version || ownVersion;
21456
21473
  } catch {
21457
21474
  try {
21458
- if (true) ownVersion = "0.7.8";
21475
+ if (true) ownVersion = "0.7.9";
21459
21476
  } catch {
21460
21477
  }
21461
21478
  }
@@ -25616,7 +25633,7 @@ var init_intent_drain = __esm({
25616
25633
  ownVersion2 = JSON.parse(readFileSync45(join56(dir, "../package.json"), "utf-8")).version || ownVersion2;
25617
25634
  } catch {
25618
25635
  try {
25619
- if (true) ownVersion2 = "0.7.8";
25636
+ if (true) ownVersion2 = "0.7.9";
25620
25637
  } catch {
25621
25638
  }
25622
25639
  }
package/dist/mcp-relay.js CHANGED
@@ -192,7 +192,7 @@ function bridge(input, output, sock, exit, opts = {}) {
192
192
  }
193
193
 
194
194
  // src/mcp-relay.ts
195
- var VERSION = true ? "0.7.8" : "0.0.0";
195
+ var VERSION = true ? "0.7.9" : "0.0.0";
196
196
  var SERVER_URL = new URL("./mcp.js", import.meta.url);
197
197
  var SERVER_PATH = fileURLToPath(SERVER_URL);
198
198
  var START_TIMEOUT_MS = 15e3;
package/dist/mcp.js CHANGED
@@ -12416,7 +12416,7 @@ function judgeHealth(h, now = Date.now()) {
12416
12416
  reasons.push(`the collector has not reported for ${ago(silent)} \u2014 it may not be running`);
12417
12417
  }
12418
12418
  if (h.restartsLastHour >= CRASHLOOP_RESTARTS) {
12419
- reasons.push(`it restarted ${h.restartsLastHour} times in the last hour`);
12419
+ reasons.push(`it crashed ${h.restartsLastHour} times in the last hour`);
12420
12420
  }
12421
12421
  const targets = Object.entries(h.targets ?? {});
12422
12422
  const stale = targets.filter(([, t]) => t.lastOkAt === null || now - t.lastOkAt > STALE_AFTER_MS);
@@ -19548,7 +19548,7 @@ var init_http = __esm({
19548
19548
  CLI_VERSION = JSON.parse(readFileSync36(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
19549
19549
  } catch {
19550
19550
  try {
19551
- if (true) CLI_VERSION = "0.7.8";
19551
+ if (true) CLI_VERSION = "0.7.9";
19552
19552
  } catch {
19553
19553
  }
19554
19554
  }
@@ -20047,7 +20047,7 @@ var init_telemetry = __esm({
20047
20047
  init_sync_client();
20048
20048
  cliVersion2 = () => {
20049
20049
  try {
20050
- return true ? "0.7.8" : "dev";
20050
+ return true ? "0.7.9" : "dev";
20051
20051
  } catch {
20052
20052
  return "dev";
20053
20053
  }
@@ -22167,7 +22167,7 @@ var init_sync_client = __esm({
22167
22167
  ownVersion = JSON.parse(readFileSync38(join49(dir, "../package.json"), "utf-8")).version || ownVersion;
22168
22168
  } catch {
22169
22169
  try {
22170
- if (true) ownVersion = "0.7.8";
22170
+ if (true) ownVersion = "0.7.9";
22171
22171
  } catch {
22172
22172
  }
22173
22173
  }
@@ -28990,7 +28990,7 @@ function installCrashGuards() {
28990
28990
  reportClientEvent2("mcp_crash", { message: err.stack || err.message });
28991
28991
  });
28992
28992
  }
28993
- var RELAY_VERSION = true ? "0.7.8" : "0.0.0";
28993
+ var RELAY_VERSION = true ? "0.7.9" : "0.0.0";
28994
28994
  function daemonIdleSecs() {
28995
28995
  const raw = process.env.CHAT_RECALL_DAEMON_IDLE_SECS;
28996
28996
  if (raw === void 0) return 900;
package/dist/watch.js CHANGED
@@ -11845,7 +11845,21 @@ function reportWalkProgress(p) {
11845
11845
  lastProgressWrite = now;
11846
11846
  updateCollectorHealth({ progress: p });
11847
11847
  }
11848
- var healthPath, PROGRESS_WRITE_INTERVAL_MS, lastProgressWrite, STALE_AFTER_MS;
11848
+ function crashesAtBoot(prior, procStart) {
11849
+ const history = (prior?.crashes ?? []).filter((t) => typeof t === "number");
11850
+ if (!prior)
11851
+ return history;
11852
+ const leftOnPurpose = typeof prior.cleanExitAt === "number" && prior.cleanExitAt >= prior.startedAt;
11853
+ return leftOnPurpose ? history : [...history, procStart];
11854
+ }
11855
+ function recentCrashes(crashes, now = Date.now()) {
11856
+ const cutoff = now - 36e5;
11857
+ return [...new Set(crashes.filter((t) => t > cutoff))].sort((a, b) => a - b).slice(-20);
11858
+ }
11859
+ function markCleanExit(now = Date.now()) {
11860
+ updateCollectorHealth({ cleanExitAt: now });
11861
+ }
11862
+ var healthPath, PROGRESS_WRITE_INTERVAL_MS, lastProgressWrite, STALE_AFTER_MS, CRASHLOOP_RESTARTS;
11849
11863
  var init_collector_health = __esm({
11850
11864
  "../engine/dist/core/collector-health.js"() {
11851
11865
  "use strict";
@@ -11854,6 +11868,7 @@ var init_collector_health = __esm({
11854
11868
  PROGRESS_WRITE_INTERVAL_MS = 2e3;
11855
11869
  lastProgressWrite = 0;
11856
11870
  STALE_AFTER_MS = 30 * 6e4;
11871
+ CRASHLOOP_RESTARTS = 3;
11857
11872
  }
11858
11873
  });
11859
11874
 
@@ -18172,7 +18187,7 @@ var init_http = __esm({
18172
18187
  CLI_VERSION = JSON.parse(readFileSync32(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
18173
18188
  } catch {
18174
18189
  try {
18175
- if (true) CLI_VERSION = "0.7.8";
18190
+ if (true) CLI_VERSION = "0.7.9";
18176
18191
  } catch {
18177
18192
  }
18178
18193
  }
@@ -18667,7 +18682,7 @@ var init_telemetry = __esm({
18667
18682
  init_sync_client();
18668
18683
  cliVersion = () => {
18669
18684
  try {
18670
- return true ? "0.7.8" : "dev";
18685
+ return true ? "0.7.9" : "dev";
18671
18686
  } catch {
18672
18687
  return "dev";
18673
18688
  }
@@ -20757,7 +20772,7 @@ var init_sync_client = __esm({
20757
20772
  ownVersion = JSON.parse(readFileSync35(join42(dir, "../package.json"), "utf-8")).version || ownVersion;
20758
20773
  } catch {
20759
20774
  try {
20760
- if (true) ownVersion = "0.7.8";
20775
+ if (true) ownVersion = "0.7.9";
20761
20776
  } catch {
20762
20777
  }
20763
20778
  }
@@ -23894,7 +23909,7 @@ try {
23894
23909
  ownVersion2 = JSON.parse(readFileSync39(join48(dir, "../package.json"), "utf-8")).version || ownVersion2;
23895
23910
  } catch {
23896
23911
  try {
23897
- if (true) ownVersion2 = "0.7.8";
23912
+ if (true) ownVersion2 = "0.7.9";
23898
23913
  } catch {
23899
23914
  }
23900
23915
  }
@@ -24279,7 +24294,7 @@ async function runCollectorMigration(opts) {
24279
24294
  init_sync_ledger();
24280
24295
  init_collector_health();
24281
24296
  import { existsSync as existsSync50, readFileSync as readFileSync45, statSync as statSync45 } from "fs";
24282
- var CLI_VERSION3 = true ? "0.7.8" : "0.0.0";
24297
+ var CLI_VERSION3 = true ? "0.7.9" : "0.0.0";
24283
24298
  var DEBOUNCE_MS = 5e3;
24284
24299
  var PLANS_DIR = claudeBackend.plansDir();
24285
24300
  var TASKS_DIR = claudeBackend.tasksDir();
@@ -24533,20 +24548,16 @@ if (BOOT_CODE) {
24533
24548
  }
24534
24549
  var PROC_START = Date.now();
24535
24550
  var targetHealth = {};
24536
- function recentStarts() {
24537
- const prior = readCollectorHealth();
24538
- const cutoff = Date.now() - 36e5;
24539
- return [...prior?.starts ?? [], PROC_START].filter((t) => typeof t === "number" && t > cutoff).filter((t, i, a) => a.indexOf(t) === i).sort((a, b) => a - b).slice(-20);
24540
- }
24551
+ var BOOT_CRASHES = crashesAtBoot(readCollectorHealth(), PROC_START);
24541
24552
  function publishHealth() {
24542
- const starts = recentStarts();
24553
+ const crashes = recentCrashes(BOOT_CRASHES);
24543
24554
  updateCollectorHealth(Object.assign({
24544
24555
  v: 1,
24545
24556
  updatedAt: Date.now(),
24546
24557
  startedAt: PROC_START,
24547
- restartsLastHour: starts.length,
24558
+ restartsLastHour: crashes.length,
24548
24559
  targets: targetHealth
24549
- }, { starts }));
24560
+ }, { crashes, cleanExitAt: void 0, starts: void 0 }));
24550
24561
  }
24551
24562
  var SHADOW_PRUNE_MS = Number(process.env.CHAT_RECALL_SHADOW_PRUNE_MS) || 6 * 60 * 60 * 1e3;
24552
24563
  async function shadowPruneTick() {
@@ -24600,9 +24611,9 @@ function noteSyncOutcome(server, ok, err, accepted = 0) {
24600
24611
  }
24601
24612
  publishHealth();
24602
24613
  {
24603
- const n = recentStarts().length;
24604
- if (n >= 3) {
24605
- daemonLog.error(`WARNING: this collector has restarted ${n} times in the last hour. Sync is probably falling behind. Health: ${collectorHealthPath()}`);
24614
+ const n = recentCrashes(BOOT_CRASHES).length;
24615
+ if (n >= CRASHLOOP_RESTARTS) {
24616
+ daemonLog.error(`WARNING: this collector crashed ${n} times in the last hour. Sync is probably falling behind. Health: ${collectorHealthPath()}`);
24606
24617
  }
24607
24618
  }
24608
24619
  setInterval(() => {
@@ -24856,11 +24867,12 @@ if (process.platform === "win32") {
24856
24867
  process.on("SIGBREAK", () => shutdown("SIGBREAK"));
24857
24868
  process.on("SIGHUP", () => shutdown("SIGHUP"));
24858
24869
  }
24859
- process.on("exit", () => {
24870
+ process.on("exit", (code) => {
24860
24871
  try {
24861
24872
  flushLedger();
24862
24873
  } catch {
24863
24874
  }
24875
+ if (code === 0 || code === EXIT_CODE_CODE_CHANGED) markCleanExit();
24864
24876
  });
24865
24877
  export {
24866
24878
  _targetHealth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chat-recall",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/munhq/chat-recall.git"