@remnic/cli 9.66.0 → 9.66.1

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.
Files changed (2) hide show
  1. package/dist/index.js +415 -295
  2. package/package.json +32 -32
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ async function persistEnrichmentCandidate(storage, entityName, candidate) {
18
18
  }
19
19
 
20
20
  // src/index.ts
21
- import fs24 from "fs";
21
+ import fs26 from "fs";
22
22
  import os3 from "os";
23
23
  import path19 from "path";
24
24
  import { createHash as createHash4 } from "crypto";
@@ -27,10 +27,10 @@ import * as childProcess2 from "child_process";
27
27
  import { fileURLToPath as fileURLToPath5 } from "url";
28
28
  import { gzipSync } from "zlib";
29
29
  import {
30
- parseConfig as parseConfig15,
30
+ parseConfig as parseConfig17,
31
31
  isOpenaiApiKeyDisabled,
32
32
  resolveEnvVars,
33
- resolveRemnicConfigRecord as resolveRemnicConfigRecord14,
33
+ resolveRemnicConfigRecord as resolveRemnicConfigRecord16,
34
34
  Orchestrator as Orchestrator10,
35
35
  EngramAccessService as EngramAccessService2,
36
36
  initLogger as initLogger5,
@@ -192,12 +192,49 @@ async function runMeetingsBinaryCommand(rest) {
192
192
  }
193
193
  }
194
194
 
195
- // src/commands/wearables.ts
195
+ // src/commands/timeline.ts
196
196
  import fs2 from "fs";
197
197
  import {
198
- Orchestrator as Orchestrator2,
199
198
  parseConfig as parseConfig2,
200
199
  resolveRemnicConfigRecord as resolveRemnicConfigRecord2,
200
+ runTimelineCliCommand
201
+ } from "@remnic/core";
202
+ async function runTimelineBinaryCommand(rest) {
203
+ const timelineArgs = rest.length === 0 || rest[0] === "--help" || rest[0] === "-h" ? ["help"] : rest;
204
+ try {
205
+ let qa = { enabled: false, maxRangeDays: 31 };
206
+ let timelineEnabled = false;
207
+ try {
208
+ const configPath = resolveConfigPath();
209
+ const raw = fs2.existsSync(configPath) ? JSON.parse(fs2.readFileSync(configPath, "utf8")) : {};
210
+ const config = parseConfig2(resolveRemnicConfigRecord2(raw));
211
+ timelineEnabled = config.activity.timeline.enabled;
212
+ qa = config.activity.timeline.qa;
213
+ } catch {
214
+ console.error(
215
+ "timeline: failed to load the Remnic config \u2014 run `remnic doctor` and check the config file for errors"
216
+ );
217
+ process.exitCode = 1;
218
+ return;
219
+ }
220
+ const code = await runTimelineCliCommand(
221
+ { cards: null, qa, timelineEnabled },
222
+ timelineArgs,
223
+ { stdout: process.stdout, stderr: process.stderr }
224
+ );
225
+ if (code !== 0) process.exitCode = code;
226
+ } catch (err) {
227
+ console.error(err instanceof Error ? err.message : String(err));
228
+ process.exitCode = 1;
229
+ }
230
+ }
231
+
232
+ // src/commands/wearables.ts
233
+ import fs3 from "fs";
234
+ import {
235
+ Orchestrator as Orchestrator2,
236
+ parseConfig as parseConfig3,
237
+ resolveRemnicConfigRecord as resolveRemnicConfigRecord3,
201
238
  runWearablesCliCommand
202
239
  } from "@remnic/core";
203
240
  async function runWearablesBinaryCommand(rest) {
@@ -207,8 +244,8 @@ async function runWearablesBinaryCommand(rest) {
207
244
  let wearablesService;
208
245
  try {
209
246
  const configPath = resolveConfigPath();
210
- const raw = fs2.existsSync(configPath) ? JSON.parse(fs2.readFileSync(configPath, "utf8")) : {};
211
- const config = parseConfig2(resolveRemnicConfigRecord2(raw));
247
+ const raw = fs3.existsSync(configPath) ? JSON.parse(fs3.readFileSync(configPath, "utf8")) : {};
248
+ const config = parseConfig3(resolveRemnicConfigRecord3(raw));
212
249
  wearablesOrchestrator = new Orchestrator2(config);
213
250
  await wearablesOrchestrator.initialize();
214
251
  await wearablesOrchestrator.deferredReady;
@@ -245,8 +282,8 @@ async function runWearablesBinaryCommand(rest) {
245
282
  }
246
283
 
247
284
  // src/commands/location.ts
248
- import fs3 from "fs";
249
- import { parseConfig as parseConfig3, resolveRemnicConfigRecord as resolveRemnicConfigRecord3 } from "@remnic/core";
285
+ import fs4 from "fs";
286
+ import { parseConfig as parseConfig4, resolveRemnicConfigRecord as resolveRemnicConfigRecord4 } from "@remnic/core";
250
287
  import { backfillMemoryStorage, runLocationCliCommand } from "@remnic/core/location";
251
288
  async function runLocationBinaryCommand(rest) {
252
289
  const locationArgs = rest.length === 0 || rest[0] === "--help" || rest[0] === "-h" ? ["help"] : rest;
@@ -254,8 +291,8 @@ async function runLocationBinaryCommand(rest) {
254
291
  let config;
255
292
  try {
256
293
  const configPath = resolveConfigPath();
257
- const raw = fs3.existsSync(configPath) ? JSON.parse(fs3.readFileSync(configPath, "utf8")) : {};
258
- config = parseConfig3(resolveRemnicConfigRecord3(raw));
294
+ const raw = fs4.existsSync(configPath) ? JSON.parse(fs4.readFileSync(configPath, "utf8")) : {};
295
+ config = parseConfig4(resolveRemnicConfigRecord4(raw));
259
296
  } catch {
260
297
  console.error(
261
298
  "location: failed to load the Remnic config \u2014 run `remnic doctor` and check the config file for errors"
@@ -280,16 +317,16 @@ async function runLocationBinaryCommand(rest) {
280
317
  }
281
318
 
282
319
  // src/commands/okf.ts
283
- import fs4 from "fs";
284
- import { Orchestrator as Orchestrator3, parseConfig as parseConfig4, resolveRemnicConfigRecord as resolveRemnicConfigRecord4, runOkfCliCommand } from "@remnic/core";
320
+ import fs5 from "fs";
321
+ import { Orchestrator as Orchestrator3, parseConfig as parseConfig5, resolveRemnicConfigRecord as resolveRemnicConfigRecord5, runOkfCliCommand } from "@remnic/core";
285
322
  async function runOkfBinaryCommand(rest) {
286
323
  const argv = rest.length === 0 || rest[0] === "--help" || rest[0] === "-h" ? ["help"] : rest;
287
324
  let orchestrator;
288
325
  try {
289
326
  try {
290
327
  const configPath = resolveConfigPath();
291
- const raw = fs4.existsSync(configPath) ? JSON.parse(fs4.readFileSync(configPath, "utf8")) : {};
292
- const config2 = parseConfig4(resolveRemnicConfigRecord4(raw));
328
+ const raw = fs5.existsSync(configPath) ? JSON.parse(fs5.readFileSync(configPath, "utf8")) : {};
329
+ const config2 = parseConfig5(resolveRemnicConfigRecord5(raw));
293
330
  orchestrator = new Orchestrator3(config2);
294
331
  await orchestrator.initialize();
295
332
  await orchestrator.deferredReady;
@@ -318,9 +355,9 @@ async function runOkfBinaryCommand(rest) {
318
355
  }
319
356
 
320
357
  // src/commands/export-okf.ts
321
- import fs5 from "fs";
358
+ import fs6 from "fs";
322
359
  import path from "path";
323
- import { Orchestrator as Orchestrator4, parseConfig as parseConfig5, resolveRemnicConfigRecord as resolveRemnicConfigRecord5 } from "@remnic/core";
360
+ import { Orchestrator as Orchestrator4, parseConfig as parseConfig6, resolveRemnicConfigRecord as resolveRemnicConfigRecord6 } from "@remnic/core";
324
361
  import { exportOkfBundle, parseIncludeStatus } from "@remnic/core/export-okf";
325
362
  function takeFlag(rest, name) {
326
363
  const index = rest.indexOf(name);
@@ -348,8 +385,8 @@ async function runExportOkfBinaryCommand(rest) {
348
385
  if (!out) throw new Error("Missing --out");
349
386
  const namespace = takeFlag(args, "--namespace") ?? "";
350
387
  const configPath = resolveConfigPath();
351
- const raw = fs5.existsSync(configPath) ? JSON.parse(fs5.readFileSync(configPath, "utf8")) : {};
352
- const config = parseConfig5(resolveRemnicConfigRecord5(raw));
388
+ const raw = fs6.existsSync(configPath) ? JSON.parse(fs6.readFileSync(configPath, "utf8")) : {};
389
+ const config = parseConfig6(resolveRemnicConfigRecord6(raw));
353
390
  orchestrator = new Orchestrator4(config);
354
391
  await orchestrator.initialize();
355
392
  await orchestrator.deferredReady;
@@ -377,8 +414,8 @@ async function runExportOkfBinaryCommand(rest) {
377
414
  }
378
415
 
379
416
  // src/commands/codegraph.ts
380
- import fs6 from "fs";
381
- import { Orchestrator as Orchestrator5, parseConfig as parseConfig6, resolveRemnicConfigRecord as resolveRemnicConfigRecord6 } from "@remnic/core";
417
+ import fs7 from "fs";
418
+ import { Orchestrator as Orchestrator5, parseConfig as parseConfig7, resolveRemnicConfigRecord as resolveRemnicConfigRecord7 } from "@remnic/core";
382
419
  import {
383
420
  exportCodegraphOkfBundle,
384
421
  parseOkfCodegraphSymbolFilter
@@ -412,8 +449,8 @@ async function runCodegraphBinaryCommand(rest) {
412
449
  if (!project) throw new Error("Missing --project");
413
450
  if (!out) throw new Error("Missing --out");
414
451
  const configPath = resolveConfigPath();
415
- const raw = fs6.existsSync(configPath) ? JSON.parse(fs6.readFileSync(configPath, "utf8")) : {};
416
- const config = parseConfig6(resolveRemnicConfigRecord6(raw));
452
+ const raw = fs7.existsSync(configPath) ? JSON.parse(fs7.readFileSync(configPath, "utf8")) : {};
453
+ const config = parseConfig7(resolveRemnicConfigRecord7(raw));
417
454
  orchestrator = new Orchestrator5(config);
418
455
  await orchestrator.initialize();
419
456
  await orchestrator.deferredReady;
@@ -441,8 +478,8 @@ async function runCodegraphBinaryCommand(rest) {
441
478
  }
442
479
 
443
480
  // src/commands/standup.ts
444
- import fs7 from "fs";
445
- import { Orchestrator as Orchestrator6, parseConfig as parseConfig7, resolveRemnicConfigRecord as resolveRemnicConfigRecord7 } from "@remnic/core";
481
+ import fs8 from "fs";
482
+ import { Orchestrator as Orchestrator6, parseConfig as parseConfig8, resolveRemnicConfigRecord as resolveRemnicConfigRecord8 } from "@remnic/core";
446
483
  import { buildStandup, parseStandupDate, standupHelp } from "@remnic/core/standup";
447
484
  function takeFlag3(rest, name) {
448
485
  const index = rest.indexOf(name);
@@ -459,8 +496,8 @@ async function runStandupBinaryCommand(rest) {
459
496
  let orchestrator;
460
497
  try {
461
498
  const configPath = resolveConfigPath();
462
- const raw = fs7.existsSync(configPath) ? JSON.parse(fs7.readFileSync(configPath, "utf8")) : {};
463
- const config = parseConfig7(resolveRemnicConfigRecord7(raw));
499
+ const raw = fs8.existsSync(configPath) ? JSON.parse(fs8.readFileSync(configPath, "utf8")) : {};
500
+ const config = parseConfig8(resolveRemnicConfigRecord8(raw));
464
501
  orchestrator = new Orchestrator6(config);
465
502
  await orchestrator.initialize();
466
503
  await orchestrator.deferredReady;
@@ -475,15 +512,91 @@ async function runStandupBinaryCommand(rest) {
475
512
  }
476
513
  }
477
514
 
515
+ // src/commands/journal.ts
516
+ import fs9 from "fs";
517
+ import {
518
+ journalPath,
519
+ parseConfig as parseConfig9,
520
+ resolveRemnicConfigRecord as resolveRemnicConfigRecord9,
521
+ seedJournal,
522
+ todayJournalDate
523
+ } from "@remnic/core";
524
+ function takeFlag4(rest, name) {
525
+ const index = rest.indexOf(name);
526
+ if (index < 0) return void 0;
527
+ const value = rest[index + 1];
528
+ if (value === void 0 || value.startsWith("-")) throw new Error(`${name} requires a value`);
529
+ return value;
530
+ }
531
+ function journalHelp() {
532
+ return `Usage: remnic journal <show|edit-path|seed> [--date YYYY-MM-DD] [--force]
533
+
534
+ show Print the journal file for the date (default: today).
535
+ edit-path Print the journal file path.
536
+ seed Write the file only if it is absent. --force overwrites.
537
+ `;
538
+ }
539
+ function loadMemoryDir() {
540
+ const configPath = resolveConfigPath();
541
+ const raw = fs9.existsSync(configPath) ? JSON.parse(fs9.readFileSync(configPath, "utf8")) : {};
542
+ return parseConfig9(resolveRemnicConfigRecord9(raw)).memoryDir;
543
+ }
544
+ async function runJournalBinaryCommand(rest) {
545
+ if (rest.length === 0 || rest[0] === "--help" || rest[0] === "-h" || rest[0] === "help") {
546
+ console.log(journalHelp());
547
+ return;
548
+ }
549
+ let memoryDir;
550
+ try {
551
+ memoryDir = loadMemoryDir();
552
+ } catch {
553
+ console.error(
554
+ "journal: failed to load the Remnic config \u2014 run `remnic doctor` and check the config file for errors"
555
+ );
556
+ process.exitCode = 1;
557
+ return;
558
+ }
559
+ try {
560
+ const action = rest[0];
561
+ const date = takeFlag4(rest, "--date") ?? todayJournalDate();
562
+ const force = rest.includes("--force");
563
+ const filePath = journalPath(memoryDir, date);
564
+ if (action === "edit-path") {
565
+ console.log(filePath);
566
+ return;
567
+ }
568
+ if (action === "show") {
569
+ if (!fs9.existsSync(filePath)) {
570
+ console.error(`journal: no file at ${filePath}. Run remnic journal seed --date ${date}.`);
571
+ process.exitCode = 1;
572
+ return;
573
+ }
574
+ process.stdout.write(fs9.readFileSync(filePath, "utf8"));
575
+ return;
576
+ }
577
+ if (action === "seed") {
578
+ const result = seedJournal({ memoryDir, date, force });
579
+ console.log(result.wrote ? `wrote ${result.path}` : `unchanged ${result.path}`);
580
+ return;
581
+ }
582
+ console.error(`journal: unknown action "${action}".`);
583
+ console.error(journalHelp());
584
+ process.exitCode = 1;
585
+ } catch (err) {
586
+ console.error(err instanceof Error ? err.message : String(err));
587
+ process.exitCode = 1;
588
+ }
589
+ }
590
+
478
591
  // src/commands/external-wiki.ts
479
- import fs8 from "fs";
480
- import { parseConfig as parseConfig8, resolveRemnicConfigRecord as resolveRemnicConfigRecord8, runExternalWikiCliCommand } from "@remnic/core";
592
+ import fs10 from "fs";
593
+ import { parseConfig as parseConfig10, resolveRemnicConfigRecord as resolveRemnicConfigRecord10, runExternalWikiCliCommand } from "@remnic/core";
481
594
  async function runExternalWikiBinaryCommand(rest) {
482
595
  let roots;
483
596
  try {
484
597
  const configPath = resolveConfigPath();
485
- const raw = fs8.existsSync(configPath) ? JSON.parse(fs8.readFileSync(configPath, "utf8")) : {};
486
- roots = parseConfig8(resolveRemnicConfigRecord8(raw)).externalWikis;
598
+ const raw = fs10.existsSync(configPath) ? JSON.parse(fs10.readFileSync(configPath, "utf8")) : {};
599
+ roots = parseConfig10(resolveRemnicConfigRecord10(raw)).externalWikis;
487
600
  } catch {
488
601
  console.error(
489
602
  "external-wiki: failed to load the Remnic config - run `remnic doctor` and check the config file for errors"
@@ -504,14 +617,14 @@ async function runExternalWikiBinaryCommand(rest) {
504
617
  }
505
618
 
506
619
  // src/commands/procedural.ts
507
- import fs9 from "fs";
620
+ import fs11 from "fs";
508
621
  import {
509
622
  StorageManager,
510
623
  computeProcedureStats,
511
624
  formatProcedureStatsText,
512
625
  initLogger,
513
- parseConfig as parseConfig9,
514
- resolveRemnicConfigRecord as resolveRemnicConfigRecord9,
626
+ parseConfig as parseConfig11,
627
+ resolveRemnicConfigRecord as resolveRemnicConfigRecord11,
515
628
  runProcedureLibraryMaintenance
516
629
  } from "@remnic/core";
517
630
 
@@ -642,8 +755,8 @@ Shared with:
642
755
  process.exit(1);
643
756
  }
644
757
  const configPath = resolveConfigPath();
645
- const raw = fs9.existsSync(configPath) ? JSON.parse(fs9.readFileSync(configPath, "utf8")) : {};
646
- const config = parseConfig9(resolveRemnicConfigRecord9(raw));
758
+ const raw = fs11.existsSync(configPath) ? JSON.parse(fs11.readFileSync(configPath, "utf8")) : {};
759
+ const config = parseConfig11(resolveRemnicConfigRecord11(raw));
647
760
  const memoryDir = expandTilde(
648
761
  typeof memoryDirOverride === "string" && memoryDirOverride.length > 0 ? memoryDirOverride : config.memoryDir ?? resolveMemoryDir()
649
762
  );
@@ -698,12 +811,12 @@ function formatProcedureMaintenanceText(report) {
698
811
  }
699
812
 
700
813
  // src/commands/drift.ts
701
- import fs10 from "fs";
814
+ import fs12 from "fs";
702
815
  import {
703
816
  Orchestrator as Orchestrator7,
704
817
  initLogger as initLogger2,
705
- parseConfig as parseConfig10,
706
- resolveRemnicConfigRecord as resolveRemnicConfigRecord10,
818
+ parseConfig as parseConfig12,
819
+ resolveRemnicConfigRecord as resolveRemnicConfigRecord12,
707
820
  runPreferenceDriftScan
708
821
  } from "@remnic/core";
709
822
  async function runDriftBinaryCommand(rest) {
@@ -763,8 +876,8 @@ Resolve a drifted item with the existing review surface:
763
876
  process.exit(1);
764
877
  }
765
878
  const configPath = resolveConfigPath();
766
- const raw = fs10.existsSync(configPath) ? JSON.parse(fs10.readFileSync(configPath, "utf8")) : {};
767
- const config = parseConfig10(resolveRemnicConfigRecord10(raw));
879
+ const raw = fs12.existsSync(configPath) ? JSON.parse(fs12.readFileSync(configPath, "utf8")) : {};
880
+ const config = parseConfig12(resolveRemnicConfigRecord12(raw));
768
881
  const memoryDirOverridden = typeof memoryDirOverride === "string" && memoryDirOverride.length > 0;
769
882
  const memoryDir = expandTilde(
770
883
  memoryDirOverridden ? memoryDirOverride : config.memoryDir ?? resolveMemoryDir()
@@ -877,13 +990,13 @@ async function loadWecloneExportModule() {
877
990
  }
878
991
 
879
992
  // src/converge.ts
880
- import * as fs12 from "fs";
993
+ import * as fs14 from "fs";
881
994
  import { createHash as createHash3 } from "crypto";
882
995
  import * as path3 from "path";
883
996
  import {
884
997
  CONVERGE_CONFLICT_POLICIES,
885
998
  DEFAULT_CONVERGE_CONFLICT_POLICY,
886
- parseConfig as parseConfig11,
999
+ parseConfig as parseConfig13,
887
1000
  buildOfflineSyncSnapshotFromBase,
888
1001
  applyOfflineSyncFileContentChunk,
889
1002
  isInternalRemnicStatePath as isInternalRemnicStatePath3,
@@ -909,7 +1022,7 @@ import {
909
1022
 
910
1023
  // src/offline-storage-io.ts
911
1024
  import { createDecipheriv, createHash } from "crypto";
912
- import fs11 from "fs";
1025
+ import fs13 from "fs";
913
1026
  import { lstat, mkdtemp, readdir, rm } from "fs/promises";
914
1027
  import path2 from "path";
915
1028
  import {
@@ -1071,7 +1184,7 @@ async function* readOfflineSyncFileChunks(options) {
1071
1184
  });
1072
1185
  }
1073
1186
  async function readFilePrefix(filePath, length) {
1074
- const handle = await fs11.promises.open(filePath, "r");
1187
+ const handle = await fs13.promises.open(filePath, "r");
1075
1188
  try {
1076
1189
  const out = Buffer.alloc(length);
1077
1190
  const { bytesRead } = await handle.read(out, 0, length, 0);
@@ -1081,7 +1194,7 @@ async function readFilePrefix(filePath, length) {
1081
1194
  }
1082
1195
  }
1083
1196
  async function* readPlainOfflineFileChunks(filePath, chunkSize) {
1084
- const stream = fs11.createReadStream(filePath, { highWaterMark: chunkSize });
1197
+ const stream = fs13.createReadStream(filePath, { highWaterMark: chunkSize });
1085
1198
  for await (const chunk of stream) {
1086
1199
  yield Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
1087
1200
  }
@@ -1118,9 +1231,9 @@ async function* readEncryptedOfflineFileChunks(options) {
1118
1231
  });
1119
1232
  decipher.setAuthTag(authTag);
1120
1233
  decipher.setAAD(Buffer.concat([secureStoreEnvelopeHeaderAad(salt), aad]));
1121
- const output = fs11.createWriteStream(tempPath, { mode: 384 });
1234
+ const output = fs13.createWriteStream(tempPath, { mode: 384 });
1122
1235
  try {
1123
- const stream = fs11.createReadStream(options.filePath, {
1236
+ const stream = fs13.createReadStream(options.filePath, {
1124
1237
  start: MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE,
1125
1238
  highWaterMark: options.chunkSize
1126
1239
  });
@@ -1730,7 +1843,7 @@ async function readLocalTombstoneEvidence(rootDir) {
1730
1843
  for (const relativePath of TOMBSTONE_PATHS) {
1731
1844
  let content;
1732
1845
  try {
1733
- content = await fs12.promises.readFile(path3.join(rootDir, relativePath), "utf-8");
1846
+ content = await fs14.promises.readFile(path3.join(rootDir, relativePath), "utf-8");
1734
1847
  } catch (error) {
1735
1848
  if (error.code === "ENOENT") continue;
1736
1849
  throw error;
@@ -1745,7 +1858,7 @@ async function discoverCursorNamespaces(memoryDir, peerUrl) {
1745
1858
  const cursorDir = path3.join(path3.resolve(memoryDir), ".remnic", "state", "converge-cursors");
1746
1859
  let entries;
1747
1860
  try {
1748
- entries = await fs12.promises.readdir(cursorDir, { withFileTypes: true });
1861
+ entries = await fs14.promises.readdir(cursorDir, { withFileTypes: true });
1749
1862
  } catch (error) {
1750
1863
  if (error.code === "ENOENT") return [];
1751
1864
  throw error;
@@ -1821,7 +1934,7 @@ async function computeConvergePlan(options = {}) {
1821
1934
  let config = options.config;
1822
1935
  if (!config) {
1823
1936
  try {
1824
- config = parseConfig11({});
1937
+ config = parseConfig13({});
1825
1938
  } catch {
1826
1939
  }
1827
1940
  }
@@ -2072,7 +2185,7 @@ async function executeConvergeApply(options = {}) {
2072
2185
  let config = options.config;
2073
2186
  if (!config) {
2074
2187
  try {
2075
- config = parseConfig11({});
2188
+ config = parseConfig13({});
2076
2189
  } catch {
2077
2190
  }
2078
2191
  }
@@ -2235,7 +2348,7 @@ async function executeConvergeApply(options = {}) {
2235
2348
  if (current.sha256 !== entry.localSha256) {
2236
2349
  throw new Error(`local file changed during push: ${localPath}`);
2237
2350
  }
2238
- const stat2 = await fs12.promises.stat(filePath);
2351
+ const stat2 = await fs14.promises.stat(filePath);
2239
2352
  let chunks;
2240
2353
  let chunkOffset = 0;
2241
2354
  const resetChunks = async () => {
@@ -2512,7 +2625,7 @@ function formatConvergeApplyReport(result) {
2512
2625
  lines.push(formatConvergeReport(result.plan));
2513
2626
  return lines.join("\n");
2514
2627
  }
2515
- async function cmdConverge(action, rest, json, config = parseConfig11({})) {
2628
+ async function cmdConverge(action, rest, json, config = parseConfig13({})) {
2516
2629
  if (action === "help" || action === "--help" || action === "-h" || rest.includes("--help") || rest.includes("-h")) {
2517
2630
  console.log(`Usage: remnic converge <plan|apply> [options]
2518
2631
 
@@ -2718,8 +2831,8 @@ function renderReplayResult(result, targetNamespace, format) {
2718
2831
  }
2719
2832
 
2720
2833
  // src/quarantine-replay.ts
2721
- import * as fs13 from "fs";
2722
- import { EngramAccessService, Orchestrator as Orchestrator8, initLogger as initLogger3, parseConfig as parseConfig12, resolveRemnicConfigRecord as resolveRemnicConfigRecord11 } from "@remnic/core";
2834
+ import * as fs15 from "fs";
2835
+ import { EngramAccessService, Orchestrator as Orchestrator8, initLogger as initLogger3, parseConfig as parseConfig14, resolveRemnicConfigRecord as resolveRemnicConfigRecord13 } from "@remnic/core";
2723
2836
  import { WriteQuarantineStore } from "@remnic/core/write-quarantine.js";
2724
2837
  function valueFlag(args, flag) {
2725
2838
  const occurrences = args.filter((a) => a === flag).length;
@@ -2767,8 +2880,8 @@ async function runQuarantineReplay(rest, format, resolveConfigPath2) {
2767
2880
  let orchestrator;
2768
2881
  try {
2769
2882
  const configPath = resolveConfigPath2();
2770
- const raw = fs13.existsSync(configPath) ? JSON.parse(fs13.readFileSync(configPath, "utf8")) : {};
2771
- const config = parseConfig12(resolveRemnicConfigRecord11(raw));
2883
+ const raw = fs15.existsSync(configPath) ? JSON.parse(fs15.readFileSync(configPath, "utf8")) : {};
2884
+ const config = parseConfig14(resolveRemnicConfigRecord13(raw));
2772
2885
  orchestrator = new Orchestrator8(config);
2773
2886
  await orchestrator.initialize();
2774
2887
  await orchestrator.deferredReady;
@@ -2799,15 +2912,15 @@ async function runQuarantineReplay(rest, format, resolveConfigPath2) {
2799
2912
  }
2800
2913
 
2801
2914
  // src/offline-impression-rotation.ts
2802
- import fs14 from "fs";
2803
- import { parseConfig as parseConfig13, resolveRemnicConfigRecord as resolveRemnicConfigRecord12, drainPendingImpressionsForOfflineSync } from "@remnic/core";
2915
+ import fs16 from "fs";
2916
+ import { parseConfig as parseConfig15, resolveRemnicConfigRecord as resolveRemnicConfigRecord14, drainPendingImpressionsForOfflineSync } from "@remnic/core";
2804
2917
  import { LastRecallStore } from "@remnic/core/recall-state";
2805
2918
  function parseConfigQuietly(raw) {
2806
2919
  const originalWarn = console.warn;
2807
2920
  console.warn = () => {
2808
2921
  };
2809
2922
  try {
2810
- return parseConfig13(resolveRemnicConfigRecord12(raw));
2923
+ return parseConfig15(resolveRemnicConfigRecord14(raw));
2811
2924
  } finally {
2812
2925
  console.warn = originalWarn;
2813
2926
  }
@@ -2821,7 +2934,7 @@ var OFFLINE_CONFIG_KEYS = [
2821
2934
  function pickOfflineConfigRecord(raw) {
2822
2935
  let resolved;
2823
2936
  try {
2824
- resolved = resolveRemnicConfigRecord12(raw);
2937
+ resolved = resolveRemnicConfigRecord14(raw);
2825
2938
  } catch {
2826
2939
  resolved = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
2827
2940
  }
@@ -2834,7 +2947,7 @@ function pickOfflineConfigRecord(raw) {
2834
2947
  function resolveOfflineImpressionRotation(configPath) {
2835
2948
  let raw;
2836
2949
  try {
2837
- raw = fs14.existsSync(configPath) ? JSON.parse(fs14.readFileSync(configPath, "utf8")) : {};
2950
+ raw = fs16.existsSync(configPath) ? JSON.parse(fs16.readFileSync(configPath, "utf8")) : {};
2838
2951
  } catch {
2839
2952
  throw new Error(
2840
2953
  `cannot read recall-impression rotation from ${configPath}: config file could not be read as JSON`
@@ -3092,12 +3205,12 @@ function assertBenchModuleFreshForDevelopment() {
3092
3205
  }
3093
3206
 
3094
3207
  // src/cmd-security.ts
3095
- import fs15 from "fs";
3208
+ import fs17 from "fs";
3096
3209
  import {
3097
3210
  Orchestrator as Orchestrator9,
3098
- parseConfig as parseConfig14,
3211
+ parseConfig as parseConfig16,
3099
3212
  initLogger as initLogger4,
3100
- resolveRemnicConfigRecord as resolveRemnicConfigRecord13,
3213
+ resolveRemnicConfigRecord as resolveRemnicConfigRecord15,
3101
3214
  runAuditMemoryCliCommand,
3102
3215
  formatAuditMemoryReport
3103
3216
  } from "@remnic/core";
@@ -3112,8 +3225,8 @@ async function cmdSecurity(rest) {
3112
3225
  }
3113
3226
  initLogger4();
3114
3227
  const configPath = resolveConfigPath();
3115
- const raw = fs15.existsSync(configPath) ? JSON.parse(fs15.readFileSync(configPath, "utf8")) : {};
3116
- const config = parseConfig14(resolveRemnicConfigRecord13(raw));
3228
+ const raw = fs17.existsSync(configPath) ? JSON.parse(fs17.readFileSync(configPath, "utf8")) : {};
3229
+ const config = parseConfig16(resolveRemnicConfigRecord15(raw));
3117
3230
  const orchestrator = new Orchestrator9(config);
3118
3231
  await orchestrator.initialize();
3119
3232
  try {
@@ -3137,7 +3250,7 @@ async function cmdSecurity(rest) {
3137
3250
  }
3138
3251
 
3139
3252
  // src/daemon-service-candidates.ts
3140
- import fs16 from "fs";
3253
+ import fs18 from "fs";
3141
3254
  import path6 from "path";
3142
3255
  var LAUNCHD_LABEL = "ai.remnic.daemon";
3143
3256
  var LEGACY_REMNIC_SERVER_LAUNCHD_LABEL = "ai.remnic.server";
@@ -3159,7 +3272,7 @@ function systemdUnitPaths(homeDir) {
3159
3272
  function anyFileExists(paths) {
3160
3273
  return paths.some((candidate) => {
3161
3274
  try {
3162
- return fs16.statSync(candidate).isFile();
3275
+ return fs18.statSync(candidate).isFile();
3163
3276
  } catch {
3164
3277
  return false;
3165
3278
  }
@@ -3171,7 +3284,7 @@ function commandNames(command) {
3171
3284
  }
3172
3285
  function isRunnableNodeScript(filePath) {
3173
3286
  try {
3174
- const text = fs16.readFileSync(filePath, "utf8").slice(0, 4096);
3287
+ const text = fs18.readFileSync(filePath, "utf8").slice(0, 4096);
3175
3288
  const firstLine = text.split(/\r?\n/, 1)[0] ?? "";
3176
3289
  if (/^#!.*\bnode\b/.test(firstLine)) return true;
3177
3290
  if (firstLine.startsWith("#!")) return false;
@@ -3184,7 +3297,7 @@ function isRunnableNodeScript(filePath) {
3184
3297
  function resolveShimNodeScript(filePath) {
3185
3298
  let text;
3186
3299
  try {
3187
- text = fs16.readFileSync(filePath, "utf8").slice(0, 16384);
3300
+ text = fs18.readFileSync(filePath, "utf8").slice(0, 16384);
3188
3301
  } catch {
3189
3302
  return void 0;
3190
3303
  }
@@ -3196,8 +3309,8 @@ function resolveShimNodeScript(filePath) {
3196
3309
  const candidate = raw.replaceAll("${basedir}", basedir).replaceAll("$basedir", basedir).replaceAll("\\ ", " ");
3197
3310
  const resolved = path6.isAbsolute(candidate) ? candidate : path6.resolve(basedir, candidate);
3198
3311
  try {
3199
- if (fs16.statSync(resolved).isFile() && isRunnableNodeScript(resolved)) {
3200
- return fs16.realpathSync(resolved);
3312
+ if (fs18.statSync(resolved).isFile() && isRunnableNodeScript(resolved)) {
3313
+ return fs18.realpathSync(resolved);
3201
3314
  }
3202
3315
  } catch {
3203
3316
  }
@@ -3205,7 +3318,7 @@ function resolveShimNodeScript(filePath) {
3205
3318
  return void 0;
3206
3319
  }
3207
3320
  function resolveRunnableNodeScript(filePath) {
3208
- const realPath = fs16.realpathSync(filePath);
3321
+ const realPath = fs18.realpathSync(filePath);
3209
3322
  if (isRunnableNodeScript(realPath)) return realPath;
3210
3323
  return resolveShimNodeScript(realPath);
3211
3324
  }
@@ -3215,9 +3328,9 @@ function findCommandOnPath(command, pathEnv = process.env.PATH ?? "") {
3215
3328
  for (const name of commandNames(command)) {
3216
3329
  const candidate = path6.join(dir, name);
3217
3330
  try {
3218
- const stat2 = fs16.statSync(candidate);
3331
+ const stat2 = fs18.statSync(candidate);
3219
3332
  if (!stat2.isFile()) continue;
3220
- if (process.platform !== "win32") fs16.accessSync(candidate, fs16.constants.X_OK);
3333
+ if (process.platform !== "win32") fs18.accessSync(candidate, fs18.constants.X_OK);
3221
3334
  const runnable = resolveRunnableNodeScript(candidate);
3222
3335
  if (runnable) return runnable;
3223
3336
  } catch {
@@ -4690,7 +4803,7 @@ function finalizeBenchStatus(filePath) {
4690
4803
  }
4691
4804
 
4692
4805
  // src/bench-fallback.ts
4693
- import fs17 from "fs";
4806
+ import fs19 from "fs";
4694
4807
  import path10 from "path";
4695
4808
  var FALLBACK_RESULTS_DIRNAME = "fallback-runs";
4696
4809
  function buildBenchRunnerArgs(parsed, benchmarkId, outputDir) {
@@ -4762,7 +4875,7 @@ function createFallbackBenchOutputDir(resultsDir, benchmarkId, pid, startedAtMs
4762
4875
  );
4763
4876
  }
4764
4877
  function resolveFallbackBenchResultPath(outputDir) {
4765
- const entries = fs17.readdirSync(outputDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name).sort();
4878
+ const entries = fs19.readdirSync(outputDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name).sort();
4766
4879
  if (entries.length === 0) {
4767
4880
  throw new Error(`Fallback benchmark runner did not write a JSON result artifact in ${outputDir}`);
4768
4881
  }
@@ -4770,7 +4883,7 @@ function resolveFallbackBenchResultPath(outputDir) {
4770
4883
  }
4771
4884
 
4772
4885
  // src/openclaw-upgrade-swap.ts
4773
- import fs18 from "fs";
4886
+ import fs20 from "fs";
4774
4887
  import path11 from "path";
4775
4888
  function describeError(error) {
4776
4889
  return error instanceof Error ? error.message : String(error);
@@ -4782,7 +4895,7 @@ function createSiblingTempFilePath(targetPath, label) {
4782
4895
  function resolveAtomicWriteMode(targetPath, explicitMode) {
4783
4896
  if (explicitMode !== void 0) return explicitMode;
4784
4897
  try {
4785
- return fs18.statSync(targetPath).mode & 4095;
4898
+ return fs20.statSync(targetPath).mode & 4095;
4786
4899
  } catch (error) {
4787
4900
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
4788
4901
  return 384;
@@ -4792,8 +4905,8 @@ function resolveAtomicWriteMode(targetPath, explicitMode) {
4792
4905
  }
4793
4906
  function resolveAtomicReplacementPath(targetPath) {
4794
4907
  try {
4795
- if (fs18.lstatSync(targetPath).isSymbolicLink()) {
4796
- return fs18.realpathSync(targetPath);
4908
+ if (fs20.lstatSync(targetPath).isSymbolicLink()) {
4909
+ return fs20.realpathSync(targetPath);
4797
4910
  }
4798
4911
  } catch (error) {
4799
4912
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
@@ -4810,7 +4923,7 @@ function createSiblingSwapPath(targetDir, label) {
4810
4923
  function cleanupDisplacedDirectoryBestEffort(displacedDir, context) {
4811
4924
  if (!displacedDir) return void 0;
4812
4925
  try {
4813
- fs18.rmSync(displacedDir, { recursive: true, force: true });
4926
+ fs20.rmSync(displacedDir, { recursive: true, force: true });
4814
4927
  return void 0;
4815
4928
  } catch (error) {
4816
4929
  return `Warning: ${context}, but failed to remove the displaced plugin copy at ${displacedDir}: ${describeError(error)}`;
@@ -4818,43 +4931,43 @@ function cleanupDisplacedDirectoryBestEffort(displacedDir, context) {
4818
4931
  }
4819
4932
  function atomicWriteFileSync(targetPath, data, options = {}) {
4820
4933
  const resolvedTargetPath = resolveAtomicReplacementPath(targetPath);
4821
- fs18.mkdirSync(path11.dirname(resolvedTargetPath), { recursive: true });
4934
+ fs20.mkdirSync(path11.dirname(resolvedTargetPath), { recursive: true });
4822
4935
  const tempPath = createSiblingTempFilePath(resolvedTargetPath, "write");
4823
4936
  const mode = resolveAtomicWriteMode(resolvedTargetPath, options.mode);
4824
4937
  try {
4825
4938
  if (options.hooks?.writeTempFileSync) {
4826
4939
  options.hooks.writeTempFileSync(tempPath);
4827
4940
  } else {
4828
- fs18.writeFileSync(tempPath, data, { mode });
4941
+ fs20.writeFileSync(tempPath, data, { mode });
4829
4942
  }
4830
- fs18.chmodSync(tempPath, mode);
4831
- const renameTempFileSync = options.hooks?.renameTempFileSync ?? fs18.renameSync;
4943
+ fs20.chmodSync(tempPath, mode);
4944
+ const renameTempFileSync = options.hooks?.renameTempFileSync ?? fs20.renameSync;
4832
4945
  renameTempFileSync(tempPath, resolvedTargetPath);
4833
4946
  } catch (error) {
4834
- fs18.rmSync(tempPath, { force: true });
4947
+ fs20.rmSync(tempPath, { force: true });
4835
4948
  throw error;
4836
4949
  }
4837
4950
  }
4838
4951
  function atomicCopyFileSync(sourcePath, targetPath, options = {}) {
4839
- if (!fs18.existsSync(sourcePath)) return;
4952
+ if (!fs20.existsSync(sourcePath)) return;
4840
4953
  const resolvedTargetPath = resolveAtomicReplacementPath(targetPath);
4841
- fs18.mkdirSync(path11.dirname(resolvedTargetPath), { recursive: true });
4954
+ fs20.mkdirSync(path11.dirname(resolvedTargetPath), { recursive: true });
4842
4955
  const tempPath = createSiblingTempFilePath(resolvedTargetPath, "copy");
4843
- const mode = fs18.statSync(sourcePath).mode & 4095;
4956
+ const mode = fs20.statSync(sourcePath).mode & 4095;
4844
4957
  try {
4845
- const copyTempFileSync = options.hooks?.copyTempFileSync ?? fs18.copyFileSync;
4958
+ const copyTempFileSync = options.hooks?.copyTempFileSync ?? fs20.copyFileSync;
4846
4959
  copyTempFileSync(sourcePath, tempPath);
4847
- fs18.chmodSync(tempPath, mode);
4848
- const renameTempFileSync = options.hooks?.renameTempFileSync ?? fs18.renameSync;
4960
+ fs20.chmodSync(tempPath, mode);
4961
+ const renameTempFileSync = options.hooks?.renameTempFileSync ?? fs20.renameSync;
4849
4962
  renameTempFileSync(tempPath, resolvedTargetPath);
4850
4963
  } catch (error) {
4851
- fs18.rmSync(tempPath, { force: true });
4964
+ fs20.rmSync(tempPath, { force: true });
4852
4965
  throw error;
4853
4966
  }
4854
4967
  }
4855
4968
  function cleanupRollbackDirectory(rollbackDir) {
4856
4969
  if (!rollbackDir) return;
4857
- fs18.rmSync(rollbackDir, { recursive: true, force: true });
4970
+ fs20.rmSync(rollbackDir, { recursive: true, force: true });
4858
4971
  }
4859
4972
  function cleanupRollbackDirectoryBestEffort(rollbackDir) {
4860
4973
  if (!rollbackDir) return void 0;
@@ -4866,20 +4979,20 @@ function cleanupRollbackDirectoryBestEffort(rollbackDir) {
4866
4979
  }
4867
4980
  }
4868
4981
  function restoreDirectoryFromRollback(targetDir, rollbackDir) {
4869
- if (!fs18.existsSync(rollbackDir)) {
4982
+ if (!fs20.existsSync(rollbackDir)) {
4870
4983
  throw new Error(`Rollback directory is missing: ${rollbackDir}`);
4871
4984
  }
4872
- fs18.mkdirSync(path11.dirname(targetDir), { recursive: true });
4873
- const displacedDir = fs18.existsSync(targetDir) ? createSiblingSwapPath(targetDir, "rollback-restore") : void 0;
4985
+ fs20.mkdirSync(path11.dirname(targetDir), { recursive: true });
4986
+ const displacedDir = fs20.existsSync(targetDir) ? createSiblingSwapPath(targetDir, "rollback-restore") : void 0;
4874
4987
  if (displacedDir) {
4875
- fs18.renameSync(targetDir, displacedDir);
4988
+ fs20.renameSync(targetDir, displacedDir);
4876
4989
  }
4877
4990
  try {
4878
- fs18.renameSync(rollbackDir, targetDir);
4991
+ fs20.renameSync(rollbackDir, targetDir);
4879
4992
  } catch (restoreError) {
4880
- if (displacedDir && fs18.existsSync(displacedDir)) {
4993
+ if (displacedDir && fs20.existsSync(displacedDir)) {
4881
4994
  try {
4882
- fs18.renameSync(displacedDir, targetDir);
4995
+ fs20.renameSync(displacedDir, targetDir);
4883
4996
  } catch (revertError) {
4884
4997
  throw new AggregateError(
4885
4998
  [restoreError, revertError],
@@ -4895,23 +5008,23 @@ function restoreDirectoryFromRollback(targetDir, rollbackDir) {
4895
5008
  return cleanupDisplacedDirectoryBestEffort(displacedDir, `restored the previous plugin copy into ${targetDir}`);
4896
5009
  }
4897
5010
  function restoreDirectoryFromBackup(targetDir, backupDir) {
4898
- if (!fs18.existsSync(backupDir)) {
5011
+ if (!fs20.existsSync(backupDir)) {
4899
5012
  throw new Error(`Plugin backup directory is missing: ${backupDir}`);
4900
5013
  }
4901
- fs18.mkdirSync(path11.dirname(targetDir), { recursive: true });
5014
+ fs20.mkdirSync(path11.dirname(targetDir), { recursive: true });
4902
5015
  const stagedDir = createSiblingSwapPath(targetDir, "backup-restore");
4903
- const displacedDir = fs18.existsSync(targetDir) ? createSiblingSwapPath(targetDir, "pre-backup-restore") : void 0;
4904
- fs18.cpSync(backupDir, stagedDir, { recursive: true });
5016
+ const displacedDir = fs20.existsSync(targetDir) ? createSiblingSwapPath(targetDir, "pre-backup-restore") : void 0;
5017
+ fs20.cpSync(backupDir, stagedDir, { recursive: true });
4905
5018
  if (displacedDir) {
4906
- fs18.renameSync(targetDir, displacedDir);
5019
+ fs20.renameSync(targetDir, displacedDir);
4907
5020
  }
4908
5021
  try {
4909
- fs18.renameSync(stagedDir, targetDir);
5022
+ fs20.renameSync(stagedDir, targetDir);
4910
5023
  } catch (restoreError) {
4911
- fs18.rmSync(targetDir, { recursive: true, force: true });
4912
- if (displacedDir && fs18.existsSync(displacedDir)) {
5024
+ fs20.rmSync(targetDir, { recursive: true, force: true });
5025
+ if (displacedDir && fs20.existsSync(displacedDir)) {
4913
5026
  try {
4914
- fs18.renameSync(displacedDir, targetDir);
5027
+ fs20.renameSync(displacedDir, targetDir);
4915
5028
  } catch (revertError) {
4916
5029
  throw new AggregateError(
4917
5030
  [restoreError, revertError],
@@ -4919,7 +5032,7 @@ function restoreDirectoryFromBackup(targetDir, backupDir) {
4919
5032
  );
4920
5033
  }
4921
5034
  }
4922
- fs18.rmSync(stagedDir, { recursive: true, force: true });
5035
+ fs20.rmSync(stagedDir, { recursive: true, force: true });
4923
5036
  throw new Error(
4924
5037
  `Failed to restore the plugin backup into ${targetDir}. The durable backup remains preserved at ${backupDir}.`,
4925
5038
  { cause: restoreError }
@@ -4944,7 +5057,7 @@ function rollbackOpenclawUpgrade({
4944
5057
  let configRemovalAttempted = false;
4945
5058
  let pluginRestored = false;
4946
5059
  try {
4947
- if (rollbackDir && fs18.existsSync(rollbackDir)) {
5060
+ if (rollbackDir && fs20.existsSync(rollbackDir)) {
4948
5061
  const cleanupWarning = restoreDirectoryFromRollback(pluginDir, rollbackDir);
4949
5062
  notes.push(`Restored previous plugin from rollback copy at ${rollbackDir}`);
4950
5063
  if (cleanupWarning) notes.push(cleanupWarning);
@@ -4954,7 +5067,7 @@ function rollbackOpenclawUpgrade({
4954
5067
  rollbackRestoreError = error instanceof Error ? error.message : String(error);
4955
5068
  }
4956
5069
  try {
4957
- if (!pluginRestored && pluginBackupDir && fs18.existsSync(pluginBackupDir)) {
5070
+ if (!pluginRestored && pluginBackupDir && fs20.existsSync(pluginBackupDir)) {
4958
5071
  const cleanupWarning = restoreDirectoryFromBackup(pluginDir, pluginBackupDir);
4959
5072
  if (rollbackRestoreError) {
4960
5073
  notes.push(`Rollback copy restore failed; restored previous plugin from durable backup at ${pluginBackupDir}`);
@@ -4979,12 +5092,12 @@ function rollbackOpenclawUpgrade({
4979
5092
  notes.push("No previous plugin copy was available for automatic restore");
4980
5093
  }
4981
5094
  try {
4982
- if (configBackupPath && fs18.existsSync(configBackupPath)) {
5095
+ if (configBackupPath && fs20.existsSync(configBackupPath)) {
4983
5096
  restoreFileFromBackup(configPath, configBackupPath);
4984
5097
  notes.push(`Restored OpenClaw config from backup at ${configBackupPath}`);
4985
- } else if (removeConfigIfUnbacked && fs18.existsSync(configPath)) {
5098
+ } else if (removeConfigIfUnbacked && fs20.existsSync(configPath)) {
4986
5099
  configRemovalAttempted = true;
4987
- fs18.rmSync(configPath, { force: true });
5100
+ fs20.rmSync(configPath, { force: true });
4988
5101
  notes.push("Removed OpenClaw config created during the failed upgrade");
4989
5102
  }
4990
5103
  } catch (error) {
@@ -5037,7 +5150,7 @@ Run this manually when you're ready:
5037
5150
 
5038
5151
  // src/openclaw-managed-upgrade-loader.ts
5039
5152
  import { execFileSync } from "child_process";
5040
- import fs19 from "fs";
5153
+ import fs21 from "fs";
5041
5154
  import os from "os";
5042
5155
  import path12 from "path";
5043
5156
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "url";
@@ -5113,7 +5226,7 @@ function buildOpenclawManagedUpgradePackageSpec(version = "latest") {
5113
5226
  function readCliAdapterRange() {
5114
5227
  const moduleDir = path12.dirname(fileURLToPath3(import.meta.url));
5115
5228
  const manifestPath = path12.resolve(moduleDir, "../package.json");
5116
- const manifest = JSON.parse(fs19.readFileSync(manifestPath, "utf8"));
5229
+ const manifest = JSON.parse(fs21.readFileSync(manifestPath, "utf8"));
5117
5230
  if (manifest.name !== "@remnic/cli") {
5118
5231
  throw new Error(`Invalid @remnic/cli package manifest at ${manifestPath}.`);
5119
5232
  }
@@ -5157,7 +5270,7 @@ async function loadOpenclawManagedUpgradeModule(packageSpec, hooks = {}) {
5157
5270
  const adapterMissing = isSpecifierNotFoundError(error, OPENCLAW_PLUGIN_PACKAGE) || isSpecifierNotFoundError(error, MANAGED_UPGRADE_SPECIFIER) || isManagedUpgradeSubpathMissing(error);
5158
5271
  if (!adapterMissing) throw error;
5159
5272
  }
5160
- const temporaryRoot = fs19.mkdtempSync(path12.join(os.tmpdir(), "remnic-openclaw-upgrade-"));
5273
+ const temporaryRoot = fs21.mkdtempSync(path12.join(os.tmpdir(), "remnic-openclaw-upgrade-"));
5161
5274
  try {
5162
5275
  const toolingPackageSpec = `${OPENCLAW_PLUGIN_PACKAGE}@${readCliAdapterRange()}`;
5163
5276
  const installArgs = [
@@ -5172,12 +5285,12 @@ async function loadOpenclawManagedUpgradeModule(packageSpec, hooks = {}) {
5172
5285
  ];
5173
5286
  (hooks.runNpmInstall ?? runNpmInstall)(installArgs);
5174
5287
  const resolverPath = path12.join(temporaryRoot, "load-managed-upgrade.mjs");
5175
- fs19.writeFileSync(resolverPath, `export * from ${JSON.stringify(MANAGED_UPGRADE_SPECIFIER)};
5288
+ fs21.writeFileSync(resolverPath, `export * from ${JSON.stringify(MANAGED_UPGRADE_SPECIFIER)};
5176
5289
  `, "utf8");
5177
5290
  return await importModule(pathToFileURL2(resolverPath).href);
5178
5291
  } finally {
5179
5292
  try {
5180
- fs19.rmSync(temporaryRoot, { recursive: true, force: true });
5293
+ fs21.rmSync(temporaryRoot, { recursive: true, force: true });
5181
5294
  } catch (error) {
5182
5295
  const detail = error instanceof Error ? error.message : String(error);
5183
5296
  console.warn(`Could not remove temporary managed upgrade project at ${temporaryRoot}: ${detail}`);
@@ -5186,13 +5299,13 @@ async function loadOpenclawManagedUpgradeModule(packageSpec, hooks = {}) {
5186
5299
  }
5187
5300
 
5188
5301
  // src/remote-daemon.ts
5189
- import fs20 from "fs";
5302
+ import fs22 from "fs";
5190
5303
  function readCompatEnv(primary, legacy) {
5191
5304
  return process.env[primary] ?? process.env[legacy];
5192
5305
  }
5193
5306
  function readRemnicConfigRecord(configPath) {
5194
5307
  try {
5195
- const parsed = JSON.parse(fs20.readFileSync(configPath, "utf8"));
5308
+ const parsed = JSON.parse(fs22.readFileSync(configPath, "utf8"));
5196
5309
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
5197
5310
  return parsed;
5198
5311
  }
@@ -5421,7 +5534,7 @@ async function remoteRecallXray(daemon, request) {
5421
5534
  }
5422
5535
 
5423
5536
  // src/daemon-service.ts
5424
- import fs21 from "fs";
5537
+ import fs23 from "fs";
5425
5538
  import path13 from "path";
5426
5539
  import * as childProcess from "child_process";
5427
5540
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -5433,7 +5546,7 @@ function launchdUnloadPlist(plistPath, processApi = childProcess) {
5433
5546
  processApi.execFileSync("launchctl", ["unload", plistPath], { stdio: "pipe" });
5434
5547
  }
5435
5548
  function resolveServerBinDetails(options = {}) {
5436
- const existsSync4 = options.existsSync ?? fs21.existsSync;
5549
+ const existsSync4 = options.existsSync ?? fs23.existsSync;
5437
5550
  const findCommandOnPath2 = options.findCommandOnPath ?? findCommandOnPath;
5438
5551
  const moduleDir = options.moduleDir ?? thisModuleDir;
5439
5552
  const packageResolve = options.packageResolve ?? resolveImportSpecifier;
@@ -5492,8 +5605,8 @@ function resolveServerBin(options = {}) {
5492
5605
  return resolveServerBinDetails(options).path;
5493
5606
  }
5494
5607
  function readVerifiedDaemonPid(options) {
5495
- const readFileSync4 = options.readFileSync ?? fs21.readFileSync;
5496
- const unlinkSync = options.unlinkSync ?? fs21.unlinkSync;
5608
+ const readFileSync4 = options.readFileSync ?? fs23.readFileSync;
5609
+ const unlinkSync = options.unlinkSync ?? fs23.unlinkSync;
5497
5610
  const processKill = options.processKill ?? process.kill;
5498
5611
  const platform = options.platform ?? process.platform;
5499
5612
  const execFileSync4 = options.execFileSync ?? ((command, args, execOptions) => childProcess.execFileSync(command, args, execOptions));
@@ -5593,8 +5706,8 @@ function removePidFileBestEffort(file, unlinkSync) {
5593
5706
  }
5594
5707
  }
5595
5708
  function inspectLaunchdPlist(plistPath, options = {}) {
5596
- const existsSync4 = options.existsSync ?? fs21.existsSync;
5597
- const readFileSync4 = options.readFileSync ?? fs21.readFileSync;
5709
+ const existsSync4 = options.existsSync ?? fs23.existsSync;
5710
+ const readFileSync4 = options.readFileSync ?? fs23.readFileSync;
5598
5711
  if (!existsSync4(plistPath)) {
5599
5712
  return {
5600
5713
  installed: false,
@@ -5772,7 +5885,7 @@ function stripConfigArgv(args) {
5772
5885
  }
5773
5886
 
5774
5887
  // src/import-dispatch.ts
5775
- import fs22 from "fs";
5888
+ import fs24 from "fs";
5776
5889
  import {
5777
5890
  runImporter,
5778
5891
  validateImportBatchSize,
@@ -6292,7 +6405,7 @@ async function cmdImport(rest, targetFactory, disposeTarget, ioOverrides = {}) {
6292
6405
  let materializedTarget;
6293
6406
  let materializePromise;
6294
6407
  const io = {
6295
- readFile: ioOverrides.readFile ?? (async (p) => fs22.promises.readFile(p, "utf-8")),
6408
+ readFile: ioOverrides.readFile ?? (async (p) => fs24.promises.readFile(p, "utf-8")),
6296
6409
  loadAdapter: ioOverrides.loadAdapter ?? (async (name) => (await loadImporterModule(name)).adapter),
6297
6410
  runImporter: ioOverrides.runImporter ?? runImporter,
6298
6411
  getWriteTarget: async () => {
@@ -6405,7 +6518,7 @@ async function cmdCapture(rest, io) {
6405
6518
  }
6406
6519
 
6407
6520
  // src/import-lossless-claw-cmd.ts
6408
- import fs23 from "fs";
6521
+ import fs25 from "fs";
6409
6522
  import path15 from "path";
6410
6523
  import {
6411
6524
  applyLcmSchema,
@@ -6517,15 +6630,15 @@ async function loadImportLosslessClawModule() {
6517
6630
 
6518
6631
  // src/import-lossless-claw-cmd.ts
6519
6632
  function assertDirectoryOrAbsent(p, label) {
6520
- if (fs23.existsSync(p) && !fs23.statSync(p).isDirectory()) {
6633
+ if (fs25.existsSync(p) && !fs25.statSync(p).isDirectory()) {
6521
6634
  throw new Error(`${label} is not a directory: ${p}`);
6522
6635
  }
6523
6636
  }
6524
6637
  function assertFile(p, label) {
6525
- if (!fs23.existsSync(p)) {
6638
+ if (!fs25.existsSync(p)) {
6526
6639
  throw new Error(`${label} does not exist: ${p}`);
6527
6640
  }
6528
- if (!fs23.statSync(p).isFile()) {
6641
+ if (!fs25.statSync(p).isFile()) {
6529
6642
  throw new Error(`${label} is not a file: ${p}`);
6530
6643
  }
6531
6644
  }
@@ -6557,7 +6670,7 @@ async function cmdImportLosslessClaw(argv, io, deps = {}) {
6557
6670
  try {
6558
6671
  if (parsed.dryRun) {
6559
6672
  const lcmPath = path15.join(memoryDir, "state", "lcm.sqlite");
6560
- if (fs23.existsSync(lcmPath)) {
6673
+ if (fs25.existsSync(lcmPath)) {
6561
6674
  destDb = mod.openExistingLcmDatabaseReadOnly(lcmPath);
6562
6675
  } else {
6563
6676
  destDb = mod.openInMemoryDestinationDatabase();
@@ -7909,7 +8022,7 @@ async function resolveAllBenchmarks() {
7909
8022
  if (packageBenchmarks) {
7910
8023
  return packageBenchmarks.filter((entry) => entry.runnerAvailable).map((entry) => entry.id);
7911
8024
  }
7912
- if (!fs24.existsSync(EVAL_RUNNER_PATH)) {
8025
+ if (!fs26.existsSync(EVAL_RUNNER_PATH)) {
7913
8026
  return [];
7914
8027
  }
7915
8028
  return BENCHMARK_CATALOG.filter((entry) => entry.category !== "ingestion").map((entry) => entry.id);
@@ -7957,7 +8070,7 @@ async function runBenchViaFallback(parsed, benchmarkId, runtimeProfile) {
7957
8070
  `Fallback benchmark runner does not support provider-backed, gateway, or thinking/timeout flags (${unsupportedOptions.join(", ")}). Build/install @remnic/bench to use those options.`
7958
8071
  );
7959
8072
  }
7960
- if (!fs24.existsSync(EVAL_RUNNER_PATH)) {
8073
+ if (!fs26.existsSync(EVAL_RUNNER_PATH)) {
7961
8074
  console.error(
7962
8075
  "Benchmark runner not found. Expected eval runner at evals/run.ts or a phase-1 @remnic/bench runtime export."
7963
8076
  );
@@ -7967,7 +8080,7 @@ async function runBenchViaFallback(parsed, benchmarkId, runtimeProfile) {
7967
8080
  path19.join(CLI_REPO_ROOT, "node_modules", ".bin", "tsx"),
7968
8081
  path19.join(CLI_REPO_ROOT, "packages", "remnic-cli", "node_modules", ".bin", "tsx")
7969
8082
  ];
7970
- const tsxCmd = tsxCandidates.find((candidate) => fs24.existsSync(candidate)) ?? "tsx";
8083
+ const tsxCmd = tsxCandidates.find((candidate) => fs26.existsSync(candidate)) ?? "tsx";
7971
8084
  const fallbackOutputDir = createFallbackBenchOutputDir(
7972
8085
  parsed.resultsDir ?? resolveBenchOutputDir(),
7973
8086
  benchmarkId,
@@ -8112,9 +8225,9 @@ var PERSONAMEM_COMPLETION_MARKER = path19.join(
8112
8225
  );
8113
8226
  function resolveRealpathWithinDataset(datasetPath, relativePath) {
8114
8227
  try {
8115
- const datasetRoot = fs24.realpathSync(datasetPath);
8228
+ const datasetRoot = fs26.realpathSync(datasetPath);
8116
8229
  const candidatePath = path19.resolve(datasetRoot, relativePath);
8117
- const candidateRealPath = fs24.realpathSync(candidatePath);
8230
+ const candidateRealPath = fs26.realpathSync(candidatePath);
8118
8231
  const relativeToRoot = path19.relative(datasetRoot, candidateRealPath);
8119
8232
  if (relativeToRoot.startsWith("..") || path19.isAbsolute(relativeToRoot)) {
8120
8233
  return null;
@@ -8173,14 +8286,14 @@ function parseCsvRows(raw) {
8173
8286
  function isPersonaMemDatasetComplete(datasetPath) {
8174
8287
  try {
8175
8288
  const completionMarkerPath = path19.join(datasetPath, PERSONAMEM_COMPLETION_MARKER);
8176
- if (fs24.statSync(completionMarkerPath).isFile()) {
8289
+ if (fs26.statSync(completionMarkerPath).isFile()) {
8177
8290
  return true;
8178
8291
  }
8179
8292
  } catch {
8180
8293
  }
8181
8294
  const datasetFile = PERSONAMEM_DATASET_FILE_CANDIDATES.find((candidate) => {
8182
8295
  try {
8183
- return fs24.statSync(path19.join(datasetPath, candidate)).isFile();
8296
+ return fs26.statSync(path19.join(datasetPath, candidate)).isFile();
8184
8297
  } catch {
8185
8298
  return false;
8186
8299
  }
@@ -8189,7 +8302,7 @@ function isPersonaMemDatasetComplete(datasetPath) {
8189
8302
  return false;
8190
8303
  }
8191
8304
  try {
8192
- const rows = parseCsvRows(fs24.readFileSync(path19.join(datasetPath, datasetFile), "utf8"));
8305
+ const rows = parseCsvRows(fs26.readFileSync(path19.join(datasetPath, datasetFile), "utf8"));
8193
8306
  if (rows.length < 2) {
8194
8307
  return false;
8195
8308
  }
@@ -8204,7 +8317,7 @@ function isPersonaMemDatasetComplete(datasetPath) {
8204
8317
  }
8205
8318
  return historyPaths.every((relativePath) => {
8206
8319
  const resolvedPath = resolveRealpathWithinDataset(datasetPath, relativePath);
8207
- return resolvedPath !== null && fs24.statSync(resolvedPath).isFile();
8320
+ return resolvedPath !== null && fs26.statSync(resolvedPath).isFile();
8208
8321
  });
8209
8322
  } catch {
8210
8323
  return false;
@@ -8212,7 +8325,7 @@ function isPersonaMemDatasetComplete(datasetPath) {
8212
8325
  }
8213
8326
  function hasDatasetFile(datasetPath, relativePath) {
8214
8327
  try {
8215
- return fs24.statSync(path19.join(datasetPath, relativePath)).isFile();
8328
+ return fs26.statSync(path19.join(datasetPath, relativePath)).isFile();
8216
8329
  } catch {
8217
8330
  return false;
8218
8331
  }
@@ -8232,10 +8345,10 @@ function memoryAgentBenchDatasetHasRecSysSamples(datasetPath) {
8232
8345
  return candidateFilenames.some((filename) => {
8233
8346
  const filePath = path19.join(datasetPath, filename);
8234
8347
  try {
8235
- if (!fs24.statSync(filePath).isFile()) {
8348
+ if (!fs26.statSync(filePath).isFile()) {
8236
8349
  return false;
8237
8350
  }
8238
- const raw = fs24.readFileSync(filePath, "utf8");
8351
+ const raw = fs26.readFileSync(filePath, "utf8");
8239
8352
  return /"source"\s*:\s*"recsys[_-]/i.test(raw);
8240
8353
  } catch {
8241
8354
  return false;
@@ -8251,7 +8364,7 @@ function isMemoryAgentBenchDatasetComplete(datasetPath) {
8251
8364
  function isDatasetDownloaded(datasetPath, benchmarkId) {
8252
8365
  let stats;
8253
8366
  try {
8254
- stats = fs24.statSync(datasetPath);
8367
+ stats = fs26.statSync(datasetPath);
8255
8368
  } catch {
8256
8369
  return false;
8257
8370
  }
@@ -8261,7 +8374,7 @@ function isDatasetDownloaded(datasetPath, benchmarkId) {
8261
8374
  const marker = DOWNLOADED_DATASET_MARKERS[benchmarkId];
8262
8375
  if (!marker) {
8263
8376
  try {
8264
- return fs24.readdirSync(datasetPath).length > 0;
8377
+ return fs26.readdirSync(datasetPath).length > 0;
8265
8378
  } catch {
8266
8379
  return false;
8267
8380
  }
@@ -8269,7 +8382,7 @@ function isDatasetDownloaded(datasetPath, benchmarkId) {
8269
8382
  if (marker.allOf) {
8270
8383
  const hasAllRequiredFiles = marker.allOf.every((name) => {
8271
8384
  try {
8272
- return fs24.statSync(path19.join(datasetPath, name)).isFile();
8385
+ return fs26.statSync(path19.join(datasetPath, name)).isFile();
8273
8386
  } catch {
8274
8387
  return false;
8275
8388
  }
@@ -8281,7 +8394,7 @@ function isDatasetDownloaded(datasetPath, benchmarkId) {
8281
8394
  if (marker.anyOf) {
8282
8395
  const hasMarkerFile = marker.anyOf.some((name) => {
8283
8396
  try {
8284
- return fs24.statSync(path19.join(datasetPath, name)).isFile();
8397
+ return fs26.statSync(path19.join(datasetPath, name)).isFile();
8285
8398
  } catch {
8286
8399
  return false;
8287
8400
  }
@@ -8299,7 +8412,7 @@ function isDatasetDownloaded(datasetPath, benchmarkId) {
8299
8412
  }
8300
8413
  if (marker.ext) {
8301
8414
  try {
8302
- return fs24.readdirSync(datasetPath).some(
8415
+ return fs26.readdirSync(datasetPath).some(
8303
8416
  (name) => name.endsWith(marker.ext) && !marker.exclude?.includes(name)
8304
8417
  );
8305
8418
  } catch {
@@ -8311,7 +8424,7 @@ function isDatasetDownloaded(datasetPath, benchmarkId) {
8311
8424
  async function launchBenchUi(resultsDir) {
8312
8425
  const benchUiDir = path19.join(CLI_REPO_ROOT, "packages", "bench-ui");
8313
8426
  const pnpmCmd = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
8314
- if (!fs24.existsSync(path19.join(benchUiDir, "package.json"))) {
8427
+ if (!fs26.existsSync(path19.join(benchUiDir, "package.json"))) {
8315
8428
  console.error("ERROR: @remnic/bench-ui is not available in this checkout.");
8316
8429
  process.exit(1);
8317
8430
  }
@@ -8349,13 +8462,13 @@ function listDownloadableBenchmarks() {
8349
8462
  }
8350
8463
  function resolveDatasetDownloadScriptPath() {
8351
8464
  const bundled = path19.join(CLI_MODULE_DIR, "assets", "download-datasets.sh");
8352
- if (fs24.existsSync(bundled)) {
8465
+ if (fs26.existsSync(bundled)) {
8353
8466
  return bundled;
8354
8467
  }
8355
8468
  return path19.join(CLI_REPO_ROOT, "evals", "scripts", "download-datasets.sh");
8356
8469
  }
8357
8470
  function isRepoCheckout() {
8358
- return fs24.existsSync(path19.join(CLI_REPO_ROOT, "pnpm-workspace.yaml")) && fs24.existsSync(path19.join(CLI_REPO_ROOT, "evals", "scripts", "download-datasets.sh"));
8471
+ return fs26.existsSync(path19.join(CLI_REPO_ROOT, "pnpm-workspace.yaml")) && fs26.existsSync(path19.join(CLI_REPO_ROOT, "evals", "scripts", "download-datasets.sh"));
8359
8472
  }
8360
8473
  function runDatasetDownloadScript(scriptPath, benchmarkId, datasetRoot, jsonMode) {
8361
8474
  const stdio = jsonMode ? ["inherit", process.stderr, "inherit"] : "inherit";
@@ -8668,8 +8781,8 @@ async function exportBenchPackageResult(parsed) {
8668
8781
  ...reportCardProvenance ? { reportCardProvenance } : {}
8669
8782
  });
8670
8783
  if (parsed.output) {
8671
- fs24.mkdirSync(path19.dirname(parsed.output), { recursive: true });
8672
- fs24.writeFileSync(parsed.output, rendered);
8784
+ fs26.mkdirSync(path19.dirname(parsed.output), { recursive: true });
8785
+ fs26.writeFileSync(parsed.output, rendered);
8673
8786
  console.log(`Exported ${summary.id} as ${parsed.format} to ${parsed.output}`);
8674
8787
  return;
8675
8788
  }
@@ -8714,7 +8827,7 @@ async function manageBenchDatasets(parsed) {
8714
8827
  process.exit(1);
8715
8828
  }
8716
8829
  const scriptPath = resolveDatasetDownloadScriptPath();
8717
- if (!fs24.existsSync(scriptPath)) {
8830
+ if (!fs26.existsSync(scriptPath)) {
8718
8831
  console.error(`ERROR: dataset download script not found: ${scriptPath}`);
8719
8832
  process.exit(1);
8720
8833
  }
@@ -8914,7 +9027,7 @@ async function calibrateBenchJudges(parsed, rawArgs) {
8914
9027
  );
8915
9028
  process.exit(1);
8916
9029
  }
8917
- const sourceResultSha256 = createHash4("sha256").update(fs24.readFileSync(latest.path)).digest("hex");
9030
+ const sourceResultSha256 = createHash4("sha256").update(fs26.readFileSync(latest.path)).digest("hex");
8918
9031
  const expandedManifestPath = expandTilde(manifestPath);
8919
9032
  if (!bench.resolveLocalLabJudgeProviderConfig) {
8920
9033
  console.error(
@@ -9329,7 +9442,7 @@ function loadPinnedLoCoMoTaskSelector(parsed) {
9329
9442
  }
9330
9443
  let decoded;
9331
9444
  try {
9332
- decoded = JSON.parse(fs24.readFileSync(parsed.taskIdsFile, "utf8"));
9445
+ decoded = JSON.parse(fs26.readFileSync(parsed.taskIdsFile, "utf8"));
9333
9446
  } catch (error) {
9334
9447
  throw new Error(
9335
9448
  `Unable to read --task-ids-file ${parsed.taskIdsFile}: ${error instanceof Error ? error.message : String(error)}`
@@ -10004,7 +10117,7 @@ function resolveBenchReproDatasetDir(datasetDir) {
10004
10117
  return void 0;
10005
10118
  }
10006
10119
  try {
10007
- return fs24.realpathSync(datasetDir);
10120
+ return fs26.realpathSync(datasetDir);
10008
10121
  } catch {
10009
10122
  return datasetDir;
10010
10123
  }
@@ -10058,13 +10171,13 @@ async function writeBenchReproManifestForPackageRun(args) {
10058
10171
  }
10059
10172
  function loadStandaloneConvergeCommandConfig() {
10060
10173
  const configPath = resolveConfigPath();
10061
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
10062
- return parseConfig15(resolveRemnicConfigRecord14(raw));
10174
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
10175
+ return parseConfig17(resolveRemnicConfigRecord16(raw));
10063
10176
  }
10064
10177
  function parseConvergePluginConfig(value) {
10065
10178
  if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
10066
10179
  if (Object.keys(value).length === 0) return void 0;
10067
- return parseConfig15(resolveRemnicConfigRecord14(value));
10180
+ return parseConfig17(resolveRemnicConfigRecord16(value));
10068
10181
  }
10069
10182
  function loadConvergeCommandConfig() {
10070
10183
  if (readCompatEnv("REMNIC_CONFIG_PATH", "ENGRAM_CONFIG_PATH")) {
@@ -10087,13 +10200,13 @@ function resolveConfigPath(cliPath) {
10087
10200
  path19.join(resolveHomeDir(), ".config", "engram", "config.json")
10088
10201
  ];
10089
10202
  for (const candidate of candidates) {
10090
- if (fs24.existsSync(candidate)) return candidate;
10203
+ if (fs26.existsSync(candidate)) return candidate;
10091
10204
  }
10092
10205
  return path19.join(resolveHomeDir(), ".config", "remnic", "config.json");
10093
10206
  }
10094
10207
  function resolveExistingBenchRemnicConfigPath(cliPath) {
10095
10208
  const configPath = resolveConfigPath(cliPath);
10096
- if (fs24.existsSync(configPath)) {
10209
+ if (fs26.existsSync(configPath)) {
10097
10210
  return configPath;
10098
10211
  }
10099
10212
  if (cliPath) {
@@ -10103,7 +10216,7 @@ function resolveExistingBenchRemnicConfigPath(cliPath) {
10103
10216
  }
10104
10217
  function resolveExistingBenchOpenclawConfigPath(cliPath) {
10105
10218
  const configPath = resolveOpenclawConfigPath(cliPath);
10106
- if (fs24.existsSync(configPath)) {
10219
+ if (fs26.existsSync(configPath)) {
10107
10220
  return configPath;
10108
10221
  }
10109
10222
  if (cliPath) {
@@ -10210,8 +10323,8 @@ function resolveMemoryDir() {
10210
10323
  const envMemoryDir = readCompatEnv("REMNIC_MEMORY_DIR", "ENGRAM_MEMORY_DIR");
10211
10324
  if (envMemoryDir) return normalizeMemoryDirPath(envMemoryDir);
10212
10325
  const configPath = resolveConfigPath();
10213
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
10214
- const remnicCfg = resolveRemnicConfigRecord14(raw);
10326
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
10327
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
10215
10328
  if (typeof remnicCfg.memoryDir === "string" && remnicCfg.memoryDir.length > 0) {
10216
10329
  return normalizeMemoryDirPath(remnicCfg.memoryDir);
10217
10330
  }
@@ -10219,18 +10332,18 @@ function resolveMemoryDir() {
10219
10332
  const standalonePath = path19.join(home, ".remnic", "memory");
10220
10333
  const legacyStandalonePath = path19.join(home, ".engram", "memory");
10221
10334
  const openclawPath = path19.join(resolveOpenclawStateDir(), "workspace", "memory", "local");
10222
- if (fs24.existsSync(standalonePath)) return standalonePath;
10223
- if (fs24.existsSync(legacyStandalonePath)) return legacyStandalonePath;
10335
+ if (fs26.existsSync(standalonePath)) return standalonePath;
10336
+ if (fs26.existsSync(legacyStandalonePath)) return legacyStandalonePath;
10224
10337
  return openclawPath;
10225
10338
  })();
10226
10339
  const manifestPath = getManifestPath();
10227
- if (fs24.existsSync(manifestPath)) {
10340
+ if (fs26.existsSync(manifestPath)) {
10228
10341
  try {
10229
10342
  const active = getActiveSpace();
10230
10343
  if (active?.memoryDir) {
10231
10344
  const activeMemoryDir = normalizeMemoryDirPath(active.memoryDir);
10232
- if (!fs24.existsSync(activeMemoryDir)) {
10233
- fs24.mkdirSync(activeMemoryDir, { recursive: true });
10345
+ if (!fs26.existsSync(activeMemoryDir)) {
10346
+ fs26.mkdirSync(activeMemoryDir, { recursive: true });
10234
10347
  }
10235
10348
  return activeMemoryDir;
10236
10349
  }
@@ -10279,13 +10392,13 @@ function resolveOpenclawConfigPath(cliPath) {
10279
10392
  const envPath = process.env.OPENCLAW_CONFIG_PATH || process.env.OPENCLAW_ENGRAM_CONFIG_PATH;
10280
10393
  if (envPath) return path19.resolve(expandTilde(envPath));
10281
10394
  for (const candidate of DEFAULT_OPENCLAW_CONFIG_PATHS_FOR_DOCTOR) {
10282
- if (fs24.existsSync(candidate)) return candidate;
10395
+ if (fs26.existsSync(candidate)) return candidate;
10283
10396
  }
10284
10397
  return path19.join(resolveOpenclawStateDir(), "openclaw.json");
10285
10398
  }
10286
10399
  function readOpenclawConfig(configPath) {
10287
- if (!fs24.existsSync(configPath)) return {};
10288
- const raw = fs24.readFileSync(configPath, "utf-8");
10400
+ if (!fs26.existsSync(configPath)) return {};
10401
+ const raw = fs26.readFileSync(configPath, "utf-8");
10289
10402
  let parsed;
10290
10403
  try {
10291
10404
  parsed = JSON.parse(raw);
@@ -10387,9 +10500,9 @@ function formatOpenclawUpgradeStamp(now = /* @__PURE__ */ new Date()) {
10387
10500
  return `${yyyy}${mm}${dd}-${hh}${min}${ss}`;
10388
10501
  }
10389
10502
  function backupPathIfPresent(sourcePath, backupPath) {
10390
- if (!fs24.existsSync(sourcePath)) return false;
10391
- fs24.mkdirSync(path19.dirname(backupPath), { recursive: true });
10392
- fs24.cpSync(sourcePath, backupPath, { recursive: true });
10503
+ if (!fs26.existsSync(sourcePath)) return false;
10504
+ fs26.mkdirSync(path19.dirname(backupPath), { recursive: true });
10505
+ fs26.cpSync(sourcePath, backupPath, { recursive: true });
10393
10506
  return true;
10394
10507
  }
10395
10508
  function restartOpenclawGateway() {
@@ -10408,7 +10521,7 @@ function restartOpenclawGateway() {
10408
10521
  }
10409
10522
  function cmdInit() {
10410
10523
  const configPath = path19.join(process.cwd(), "remnic.config.json");
10411
- if (fs24.existsSync(configPath)) {
10524
+ if (fs26.existsSync(configPath)) {
10412
10525
  console.log(`Config already exists: ${configPath}`);
10413
10526
  return;
10414
10527
  }
@@ -10424,7 +10537,7 @@ function cmdInit() {
10424
10537
  authToken: "${REMNIC_AUTH_TOKEN}"
10425
10538
  }
10426
10539
  };
10427
- fs24.writeFileSync(configPath, JSON.stringify(template, null, 2) + "\n");
10540
+ fs26.writeFileSync(configPath, JSON.stringify(template, null, 2) + "\n");
10428
10541
  console.log(`Created ${configPath}`);
10429
10542
  console.log("\nSet these environment variables:");
10430
10543
  console.log(" export OPENAI_API_KEY=sk-...");
@@ -10846,9 +10959,9 @@ async function cmdQuery(queryText, json, explain) {
10846
10959
  }
10847
10960
  initLogger5();
10848
10961
  const configPath = resolveConfigPath();
10849
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
10850
- const remnicCfg = resolveRemnicConfigRecord14(raw);
10851
- const config = parseConfig15(remnicCfg);
10962
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
10963
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
10964
+ const config = parseConfig17(remnicCfg);
10852
10965
  const orchestrator = new Orchestrator10(config);
10853
10966
  await orchestrator.initialize();
10854
10967
  const service = new EngramAccessService2(orchestrator);
@@ -11026,9 +11139,9 @@ async function cmdXray(rest) {
11026
11139
  }
11027
11140
  initLogger5();
11028
11141
  const configPath = resolveConfigPath();
11029
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
11030
- const remnicCfg = resolveRemnicConfigRecord14(raw);
11031
- const config = parseConfig15(remnicCfg);
11142
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
11143
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
11144
+ const config = parseConfig17(remnicCfg);
11032
11145
  const orchestrator = new Orchestrator10(config);
11033
11146
  await orchestrator.initialize();
11034
11147
  await orchestrator.deferredReady;
@@ -11059,8 +11172,8 @@ async function runWhoKnowsCommand(rest, io) {
11059
11172
  async function withLocalService(fn) {
11060
11173
  initLogger5();
11061
11174
  const configPath = resolveConfigPath();
11062
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
11063
- const orchestrator = new Orchestrator10(parseConfig15(resolveRemnicConfigRecord14(raw)));
11175
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
11176
+ const orchestrator = new Orchestrator10(parseConfig17(resolveRemnicConfigRecord16(raw)));
11064
11177
  await orchestrator.initialize();
11065
11178
  await orchestrator.deferredReady;
11066
11179
  const service = new EngramAccessService2(orchestrator);
@@ -11092,9 +11205,9 @@ async function cmdPromotionCandidates(rest) {
11092
11205
  async function cmdVersions(rest) {
11093
11206
  initLogger5();
11094
11207
  const configPath = resolveConfigPath();
11095
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
11096
- const remnicCfg = resolveRemnicConfigRecord14(raw);
11097
- const config = parseConfig15(remnicCfg);
11208
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
11209
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
11210
+ const config = parseConfig17(remnicCfg);
11098
11211
  if (!config.versioningEnabled) {
11099
11212
  console.error("Page versioning is disabled (versioningEnabled = false).");
11100
11213
  process.exit(1);
@@ -11208,9 +11321,9 @@ Options:
11208
11321
  async function cmdEnrich(rest) {
11209
11322
  initLogger5();
11210
11323
  const configPath = resolveConfigPath();
11211
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
11212
- const remnicCfg = resolveRemnicConfigRecord14(raw);
11213
- const config = parseConfig15(remnicCfg);
11324
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
11325
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
11326
+ const config = parseConfig17(remnicCfg);
11214
11327
  const subcommand = rest[0];
11215
11328
  if (subcommand === "audit") {
11216
11329
  const memoryDir2 = expandTilde(config.memoryDir);
@@ -11402,9 +11515,9 @@ Registered providers:`);
11402
11515
  async function cmdExtensions(action, rest) {
11403
11516
  initLogger5();
11404
11517
  const configPath = resolveConfigPath();
11405
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
11406
- const remnicCfg = resolveRemnicConfigRecord14(raw);
11407
- const config = parseConfig15(remnicCfg);
11518
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
11519
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
11520
+ const config = parseConfig17(remnicCfg);
11408
11521
  const root = resolveExtensionsRoot(config);
11409
11522
  const noopLog = { warn: () => {
11410
11523
  }, debug: () => {
@@ -11453,7 +11566,7 @@ Root: ${root}`);
11453
11566
  const extensions = await discoverMemoryExtensions(root, warnLog);
11454
11567
  let entries = [];
11455
11568
  try {
11456
- entries = fs24.readdirSync(root);
11569
+ entries = fs26.readdirSync(root);
11457
11570
  } catch {
11458
11571
  console.log(`Extensions root does not exist: ${root}`);
11459
11572
  process.exitCode = 0;
@@ -11464,7 +11577,7 @@ Root: ${root}`);
11464
11577
  for (const entry of entries) {
11465
11578
  const entryPath = path19.join(root, entry);
11466
11579
  try {
11467
- if (!fs24.statSync(entryPath).isDirectory()) continue;
11580
+ if (!fs26.statSync(entryPath).isDirectory()) continue;
11468
11581
  } catch {
11469
11582
  continue;
11470
11583
  }
@@ -11496,9 +11609,9 @@ Root: ${root}`);
11496
11609
  async function cmdBriefing(rest) {
11497
11610
  initLogger5();
11498
11611
  const configPath = resolveConfigPath();
11499
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
11500
- const remnicCfg = resolveRemnicConfigRecord14(raw);
11501
- const config = parseConfig15(remnicCfg);
11612
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
11613
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
11614
+ const config = parseConfig17(remnicCfg);
11502
11615
  if (!config.briefing.enabled) {
11503
11616
  console.error("Briefing is disabled in config (briefing.enabled = false).");
11504
11617
  process.exit(1);
@@ -11576,10 +11689,10 @@ async function cmdBriefing(rest) {
11576
11689
  if (save) {
11577
11690
  try {
11578
11691
  const saveDir = resolveBriefingSaveDir(config.briefing.saveDir);
11579
- fs24.mkdirSync(saveDir, { recursive: true });
11692
+ fs26.mkdirSync(saveDir, { recursive: true });
11580
11693
  const filename = briefingFilename(new Date(result.window.to), format);
11581
11694
  const filePath = path19.join(saveDir, filename);
11582
- fs24.writeFileSync(filePath, payload + (payload.endsWith("\n") ? "" : "\n"));
11695
+ fs26.writeFileSync(filePath, payload + (payload.endsWith("\n") ? "" : "\n"));
11583
11696
  console.error(`Saved briefing: ${filePath}`);
11584
11697
  } catch (err) {
11585
11698
  console.error(`Failed to save briefing: ${err instanceof Error ? err.message : String(err)}`);
@@ -11597,7 +11710,7 @@ async function cmdDoctor() {
11597
11710
  detail: `${nodeVersion} (requires >= 22.12.0)`
11598
11711
  });
11599
11712
  const configPath = resolveConfigPath();
11600
- const configExists = fs24.existsSync(configPath);
11713
+ const configExists = fs26.existsSync(configPath);
11601
11714
  checks.push({ name: "Config file", ok: configExists, detail: configPath });
11602
11715
  let standaloneConfig;
11603
11716
  let standaloneConfigError;
@@ -11605,11 +11718,11 @@ async function cmdDoctor() {
11605
11718
  let configuredNs = { invalid: false };
11606
11719
  if (configExists) {
11607
11720
  try {
11608
- const raw = JSON.parse(fs24.readFileSync(configPath, "utf8"));
11609
- const remnicCfg = resolveRemnicConfigRecord14(raw);
11721
+ const raw = JSON.parse(fs26.readFileSync(configPath, "utf8"));
11722
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
11610
11723
  standaloneOpenaiApiKeyExplicitlyFalse = isOpenaiApiKeyDisabled(remnicCfg.openaiApiKey);
11611
11724
  configuredNs = readConfiguredNamespace(remnicCfg);
11612
- standaloneConfig = parseConfig15(remnicCfg);
11725
+ standaloneConfig = parseConfig17(remnicCfg);
11613
11726
  } catch (err) {
11614
11727
  standaloneConfigError = err instanceof Error ? err.message : String(err);
11615
11728
  }
@@ -11618,10 +11731,10 @@ async function cmdDoctor() {
11618
11731
  try {
11619
11732
  memoryDir = resolveMemoryDir();
11620
11733
  } catch {
11621
- memoryDir = parseConfig15({}).memoryDir;
11734
+ memoryDir = parseConfig17({}).memoryDir;
11622
11735
  }
11623
11736
  try {
11624
- fs24.mkdirSync(memoryDir, { recursive: true });
11737
+ fs26.mkdirSync(memoryDir, { recursive: true });
11625
11738
  checks.push({ name: "Memory directory", ok: true, detail: memoryDir });
11626
11739
  } catch {
11627
11740
  checks.push({ name: "Memory directory", ok: false, detail: `cannot create ${memoryDir}` });
@@ -11650,7 +11763,7 @@ async function cmdDoctor() {
11650
11763
  });
11651
11764
  if (nsPolicyCheck) checks.push(nsPolicyCheck);
11652
11765
  const openclawConfigPath = resolveOpenclawConfigPath();
11653
- const openclawConfigExists = fs24.existsSync(openclawConfigPath);
11766
+ const openclawConfigExists = fs26.existsSync(openclawConfigPath);
11654
11767
  let openclawConfig = {};
11655
11768
  let openclawConfigValid = false;
11656
11769
  let openclawPluginModeConfigured = false;
@@ -11658,7 +11771,7 @@ async function cmdDoctor() {
11658
11771
  let activeOpenclawEntryConfig = null;
11659
11772
  if (openclawConfigExists) {
11660
11773
  try {
11661
- const parsed = JSON.parse(fs24.readFileSync(openclawConfigPath, "utf-8"));
11774
+ const parsed = JSON.parse(fs26.readFileSync(openclawConfigPath, "utf-8"));
11662
11775
  if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
11663
11776
  openclawConfig = parsed;
11664
11777
  openclawConfigValid = true;
@@ -11738,9 +11851,9 @@ async function cmdDoctor() {
11738
11851
  let memDirOk = false;
11739
11852
  let memDirDetail = `${resolvedMemDir} (not found)`;
11740
11853
  let memDirRemediation = `Run \`remnic openclaw install --memory-dir "${resolvedMemDir}"\` to create the directory.`;
11741
- if (fs24.existsSync(resolvedMemDir)) {
11854
+ if (fs26.existsSync(resolvedMemDir)) {
11742
11855
  try {
11743
- const stat2 = fs24.statSync(resolvedMemDir);
11856
+ const stat2 = fs26.statSync(resolvedMemDir);
11744
11857
  if (stat2.isDirectory()) {
11745
11858
  memDirOk = true;
11746
11859
  memDirDetail = resolvedMemDir;
@@ -11895,12 +12008,12 @@ async function cmdDoctor() {
11895
12008
  }
11896
12009
  function cmdConfig() {
11897
12010
  const configPath = resolveConfigPath();
11898
- if (!fs24.existsSync(configPath)) {
12011
+ if (!fs26.existsSync(configPath)) {
11899
12012
  console.log("No config file found. Run `remnic init` to create one.");
11900
12013
  return;
11901
12014
  }
11902
12015
  console.log(`Config: ${configPath}`);
11903
- const rawConfig = fs24.readFileSync(configPath, "utf8");
12016
+ const rawConfig = fs26.readFileSync(configPath, "utf8");
11904
12017
  const redacted = rawConfig.replace(
11905
12018
  /("(?:openaiApiKey|localLlmApiKey|authToken|apiKey|remoteSearchApiKey|meilisearchApiKey|opikApiKey)"\s*:\s*")([^"]*)(")/g,
11906
12019
  "$1[REDACTED]$3"
@@ -12008,9 +12121,9 @@ async function cmdReview(action, rest) {
12008
12121
  const configPath = resolveConfigPath();
12009
12122
  let tombstonesConfig = null;
12010
12123
  try {
12011
- const rawCfg = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
12012
- const remnicCfg = resolveRemnicConfigRecord14(rawCfg);
12013
- const config = parseConfig15(remnicCfg);
12124
+ const rawCfg = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
12125
+ const remnicCfg = resolveRemnicConfigRecord16(rawCfg);
12126
+ const config = parseConfig17(remnicCfg);
12014
12127
  tombstonesConfig = {
12015
12128
  enabled: config.tombstonesEnabled,
12016
12129
  semanticMatch: config.tombstonesSemanticMatch,
@@ -12752,7 +12865,7 @@ async function pushOfflineFileContent(args) {
12752
12865
  }
12753
12866
  async function pushOfflineFileContentFromChunkReader(args) {
12754
12867
  const filePath = resolveOfflineDirectHydrationPath(args.memoryDir, args.file.path);
12755
- const stat2 = fs24.statSync(filePath);
12868
+ const stat2 = fs26.statSync(filePath);
12756
12869
  if (stat2.mtimeMs !== args.file.mtimeMs) {
12757
12870
  throw new Error(`local file changed while pushing offline content: ${args.file.path}`);
12758
12871
  }
@@ -13243,7 +13356,7 @@ function advanceOfflineBaseFilesForSuccessfulPush(options) {
13243
13356
  return [...next.values()].sort((left, right) => left.path.localeCompare(right.path));
13244
13357
  }
13245
13358
  async function runOfflineSyncOnce(options) {
13246
- fs24.mkdirSync(options.memoryDir, { recursive: true });
13359
+ fs26.mkdirSync(options.memoryDir, { recursive: true });
13247
13360
  let activeStatePath = options.statePath;
13248
13361
  let priorState = await readOfflineSyncState(activeStatePath);
13249
13362
  let syncNamespace = options.namespace ?? priorState?.namespace;
@@ -13876,7 +13989,7 @@ Environment fallbacks:
13876
13989
  const configPath = resolveConfigPath();
13877
13990
  let config;
13878
13991
  try {
13879
- const rawConfig = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
13992
+ const rawConfig = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
13880
13993
  config = parseConfigQuietly(pickOfflineConfigRecord(rawConfig));
13881
13994
  } catch {
13882
13995
  throw new Error(
@@ -13891,7 +14004,7 @@ Environment fallbacks:
13891
14004
  const statePath = statePathExplicit ? path19.resolve(expandTilde(stateOverride)) : remoteUrl !== void 0 ? defaultOfflineSyncStatePath(memoryDir, remoteUrl, namespace) : void 0;
13892
14005
  if (action === "prepare") {
13893
14006
  if (!remoteUrl || !token || !statePath) throw new Error("offline prepare requires remote URL and token");
13894
- fs24.mkdirSync(memoryDir, { recursive: true });
14007
+ fs26.mkdirSync(memoryDir, { recursive: true });
13895
14008
  const remoteSnapshot = await fetchOfflineSnapshot({
13896
14009
  remoteUrl,
13897
14010
  token,
@@ -13990,7 +14103,7 @@ Environment fallbacks:
13990
14103
  return;
13991
14104
  }
13992
14105
  if (action === "status") {
13993
- fs24.mkdirSync(memoryDir, { recursive: true });
14106
+ fs26.mkdirSync(memoryDir, { recursive: true });
13994
14107
  const state = statePath ? await readOfflineSyncState(statePath) : null;
13995
14108
  if (state && remoteUrl && statePath) {
13996
14109
  assertOfflineStateMatches({
@@ -14128,7 +14241,7 @@ function cmdDedup(json) {
14128
14241
  function readInstalledConnectorConfig(configPath, fallback) {
14129
14242
  if (!configPath) return fallback;
14130
14243
  try {
14131
- const parsed = JSON.parse(fs24.readFileSync(configPath, "utf8"));
14244
+ const parsed = JSON.parse(fs26.readFileSync(configPath, "utf8"));
14132
14245
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return fallback;
14133
14246
  const { token: _token, ...config } = parsed;
14134
14247
  return config;
@@ -14306,7 +14419,7 @@ async function cmdConnectors(action, rest, json) {
14306
14419
  const pub = factory();
14307
14420
  const available = await pub.isHostAvailable();
14308
14421
  const extRoot = available ? await pub.resolveExtensionRoot() : "(host not installed)";
14309
- const extensionExists = available && extRoot ? fs24.existsSync(extRoot) : false;
14422
+ const extensionExists = available && extRoot ? fs26.existsSync(extRoot) : false;
14310
14423
  publisherChecks.push({
14311
14424
  name: `Publisher: ${targetHostId}`,
14312
14425
  ok: !available || extensionExists,
@@ -14380,7 +14493,7 @@ async function cmdConnectors(action, rest, json) {
14380
14493
  let connectorsCfg;
14381
14494
  const configPath = resolveConfigPath();
14382
14495
  try {
14383
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
14496
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
14384
14497
  connectorsCfg = parseConfigQuietly(raw).connectors;
14385
14498
  } catch {
14386
14499
  process.stderr.write(
@@ -14456,9 +14569,9 @@ async function cmdConnectors(action, rest, json) {
14456
14569
  }
14457
14570
  initLogger5();
14458
14571
  const configPath = resolveConfigPath();
14459
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
14460
- const remnicCfg = resolveRemnicConfigRecord14(raw);
14461
- const config = parseConfig15(remnicCfg);
14572
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
14573
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
14574
+ const config = parseConfig17(remnicCfg);
14462
14575
  const orchestrator = new Orchestrator10(config);
14463
14576
  try {
14464
14577
  await orchestrator.initialize();
@@ -14581,9 +14694,9 @@ async function cmdConnectorsMarketplace(subAction, rest, json) {
14581
14694
  console.error(`connectors marketplace: ${err instanceof Error ? err.message : String(err)}`);
14582
14695
  process.exit(1);
14583
14696
  }
14584
- const rawConfig = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
14585
- const pluginConfig = resolveRemnicConfigRecord14(rawConfig);
14586
- const config = parseConfig15(pluginConfig);
14697
+ const rawConfig = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
14698
+ const pluginConfig = resolveRemnicConfigRecord16(rawConfig);
14699
+ const config = parseConfig17(pluginConfig);
14587
14700
  if (subAction === "generate") {
14588
14701
  let outputDir;
14589
14702
  try {
@@ -14603,13 +14716,13 @@ async function cmdConnectorsMarketplace(subAction, rest, json) {
14603
14716
  } else if (subAction === "validate") {
14604
14717
  const targetPath = rest.filter((a) => !a.startsWith("--"))[0] ?? path19.join(process.cwd(), "marketplace.json");
14605
14718
  const resolved = path19.resolve(targetPath);
14606
- if (!fs24.existsSync(resolved)) {
14719
+ if (!fs26.existsSync(resolved)) {
14607
14720
  console.error(`File not found: ${resolved}`);
14608
14721
  process.exit(1);
14609
14722
  }
14610
14723
  let parsed;
14611
14724
  try {
14612
- parsed = JSON.parse(fs24.readFileSync(resolved, "utf8"));
14725
+ parsed = JSON.parse(fs26.readFileSync(resolved, "utf8"));
14613
14726
  } catch {
14614
14727
  console.error(`Invalid JSON in ${resolved}`);
14615
14728
  process.exit(1);
@@ -14812,9 +14925,9 @@ async function cmdSpace(action, rest, json) {
14812
14925
  async function cmdLegacyBenchmark(action, rest, json) {
14813
14926
  initLogger5();
14814
14927
  const configPath = resolveConfigPath();
14815
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
14816
- const remnicCfg = resolveRemnicConfigRecord14(raw);
14817
- const config = parseConfig15(remnicCfg);
14928
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
14929
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
14930
+ const config = parseConfig17(remnicCfg);
14818
14931
  const orchestrator = new Orchestrator10(config);
14819
14932
  const service = new EngramAccessService2(orchestrator);
14820
14933
  const { runBenchSuite, loadBaseline, checkRegression } = await loadBenchModule();
@@ -15217,7 +15330,7 @@ function readPid() {
15217
15330
  function inferPort() {
15218
15331
  try {
15219
15332
  const configPath = resolveConfigPath();
15220
- const raw = JSON.parse(fs24.readFileSync(configPath, "utf8"));
15333
+ const raw = JSON.parse(fs26.readFileSync(configPath, "utf8"));
15221
15334
  return raw.server?.port ?? 4318;
15222
15335
  } catch {
15223
15336
  return 4318;
@@ -15312,13 +15425,13 @@ function daemonInstall() {
15312
15425
  process.exit(1);
15313
15426
  }
15314
15427
  const vars = { HOME: home, NODE_PATH: nodePath, REMNIC_SERVER_BIN: serverBin };
15315
- fs24.mkdirSync(LOGS_DIR, { recursive: true });
15428
+ fs26.mkdirSync(LOGS_DIR, { recursive: true });
15316
15429
  if (isMacOS()) {
15317
15430
  const templatePath = path19.resolve(import.meta.dirname, "../templates/launchd/ai.remnic.daemon.plist");
15318
- const template = fs24.readFileSync(templatePath, "utf8");
15431
+ const template = fs26.readFileSync(templatePath, "utf8");
15319
15432
  const plist = renderTemplate(template, vars);
15320
- fs24.mkdirSync(path19.dirname(LAUNCHD_PLIST_PATH), { recursive: true });
15321
- fs24.writeFileSync(LAUNCHD_PLIST_PATH, plist);
15433
+ fs26.mkdirSync(path19.dirname(LAUNCHD_PLIST_PATH), { recursive: true });
15434
+ fs26.writeFileSync(LAUNCHD_PLIST_PATH, plist);
15322
15435
  try {
15323
15436
  launchdLoadPlist(LAUNCHD_PLIST_PATH);
15324
15437
  } catch (err) {
@@ -15335,10 +15448,10 @@ function daemonInstall() {
15335
15448
  console.log(` Logs: ${LOGS_DIR}/daemon.log`);
15336
15449
  } else if (isLinux()) {
15337
15450
  const templatePath = path19.resolve(import.meta.dirname, "../templates/systemd/remnic.service");
15338
- const template = fs24.readFileSync(templatePath, "utf8");
15451
+ const template = fs26.readFileSync(templatePath, "utf8");
15339
15452
  const unit = renderTemplate(template, vars);
15340
- fs24.mkdirSync(path19.dirname(SYSTEMD_UNIT_PATH), { recursive: true });
15341
- fs24.writeFileSync(SYSTEMD_UNIT_PATH, unit);
15453
+ fs26.mkdirSync(path19.dirname(SYSTEMD_UNIT_PATH), { recursive: true });
15454
+ fs26.writeFileSync(SYSTEMD_UNIT_PATH, unit);
15342
15455
  try {
15343
15456
  childProcess2.execSync("systemctl --user daemon-reload", { stdio: "pipe" });
15344
15457
  } catch (err) {
@@ -15374,7 +15487,7 @@ function daemonUninstall() {
15374
15487
  } catch {
15375
15488
  }
15376
15489
  try {
15377
- fs24.unlinkSync(plistPath);
15490
+ fs26.unlinkSync(plistPath);
15378
15491
  removed = true;
15379
15492
  console.log(`Removed launchd service: ${plistPath}`);
15380
15493
  } catch {
@@ -15394,7 +15507,7 @@ function daemonUninstall() {
15394
15507
  let removed = false;
15395
15508
  for (const unitPath of SYSTEMD_UNIT_PATHS) {
15396
15509
  try {
15397
- fs24.unlinkSync(unitPath);
15510
+ fs26.unlinkSync(unitPath);
15398
15511
  removed = true;
15399
15512
  console.log(`Removed systemd service: ${unitPath}`);
15400
15513
  } catch {
@@ -15461,13 +15574,13 @@ async function daemonStatus() {
15461
15574
  console.log(` Port: ${port}`);
15462
15575
  console.log(` Service: ${serviceInstalled ? "installed" : "not installed"}`);
15463
15576
  console.log(` Platform: ${process.platform}`);
15464
- console.log(` PID file: ${fs24.existsSync(PID_FILE) ? PID_FILE : LEGACY_PID_FILE}`);
15465
- console.log(` Log file: ${fs24.existsSync(LOG_FILE) ? LOG_FILE : LEGACY_LOG_FILE}`);
15577
+ console.log(` PID file: ${fs26.existsSync(PID_FILE) ? PID_FILE : LEGACY_PID_FILE}`);
15578
+ console.log(` Log file: ${fs26.existsSync(LOG_FILE) ? LOG_FILE : LEGACY_LOG_FILE}`);
15466
15579
  try {
15467
15580
  const configPath = resolveConfigPath();
15468
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
15469
- const remnicCfg = resolveRemnicConfigRecord14(raw);
15470
- const config = parseConfig15(remnicCfg);
15581
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
15582
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
15583
+ const config = parseConfig17(remnicCfg);
15471
15584
  const extRoot = resolveExtensionsRoot(config);
15472
15585
  const noopLog = { warn: () => {
15473
15586
  }, debug: () => {
@@ -15506,9 +15619,9 @@ function daemonStart() {
15506
15619
  return;
15507
15620
  }
15508
15621
  }
15509
- fs24.mkdirSync(PID_DIR, { recursive: true });
15510
- fs24.mkdirSync(LOGS_DIR, { recursive: true });
15511
- const logStream = fs24.openSync(LOG_FILE, "a");
15622
+ fs26.mkdirSync(PID_DIR, { recursive: true });
15623
+ fs26.mkdirSync(LOGS_DIR, { recursive: true });
15624
+ const logStream = fs26.openSync(LOG_FILE, "a");
15512
15625
  const serverBin = resolveServerBin();
15513
15626
  const isSource = serverBin.endsWith(".ts");
15514
15627
  let cmd;
@@ -15530,7 +15643,7 @@ function daemonStart() {
15530
15643
  }
15531
15644
  });
15532
15645
  child.unref();
15533
- fs24.writeFileSync(PID_FILE, String(child.pid));
15646
+ fs26.writeFileSync(PID_FILE, String(child.pid));
15534
15647
  console.log(`Started remnic server (pid ${child.pid})`);
15535
15648
  console.log(` Log: ${LOG_FILE}`);
15536
15649
  }
@@ -15564,11 +15677,11 @@ function daemonStop() {
15564
15677
  console.log("Process not found (cleaning up PID file)");
15565
15678
  }
15566
15679
  try {
15567
- fs24.unlinkSync(PID_FILE);
15680
+ fs26.unlinkSync(PID_FILE);
15568
15681
  } catch {
15569
15682
  }
15570
15683
  try {
15571
- fs24.unlinkSync(LEGACY_PID_FILE);
15684
+ fs26.unlinkSync(LEGACY_PID_FILE);
15572
15685
  } catch {
15573
15686
  }
15574
15687
  }
@@ -15696,9 +15809,9 @@ async function promptYesNo(question, defaultYes = true) {
15696
15809
  async function cmdBinary(rest) {
15697
15810
  initLogger5();
15698
15811
  const configPath = resolveConfigPath();
15699
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
15700
- const remnicCfg = resolveRemnicConfigRecord14(raw);
15701
- const config = parseConfig15(remnicCfg);
15812
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
15813
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
15814
+ const config = parseConfig17(remnicCfg);
15702
15815
  const memoryDir = resolveMemoryDir();
15703
15816
  const blConfig = {
15704
15817
  enabled: config.binaryLifecycleEnabled,
@@ -15887,7 +16000,7 @@ async function cmdOpenclawInstall(opts) {
15887
16000
  } else if (slotIsActiveLegacy) {
15888
16001
  changes.push(` Slot left as "${REMNIC_OPENCLAW_LEGACY_PLUGIN_ID}" \u2014 re-run with --yes to activate the new entry`);
15889
16002
  }
15890
- if (!fs24.existsSync(memoryDir)) changes.push(`+ Will create memory directory: ${memoryDir}`);
16003
+ if (!fs26.existsSync(memoryDir)) changes.push(`+ Will create memory directory: ${memoryDir}`);
15891
16004
  if (hasLegacy && migrateLegacy) {
15892
16005
  changes.push(`~ Legacy '${REMNIC_OPENCLAW_LEGACY_PLUGIN_ID}' entry retained (safe to remove after verifying hooks fire)`);
15893
16006
  }
@@ -15907,8 +16020,8 @@ async function cmdOpenclawInstall(opts) {
15907
16020
  Resulting plugins.slots.memory: ${dryRunPlugins.slots?.memory ?? "(unset)"}`);
15908
16021
  return;
15909
16022
  }
15910
- if (fs24.existsSync(memoryDir)) {
15911
- const st = fs24.statSync(memoryDir);
16023
+ if (fs26.existsSync(memoryDir)) {
16024
+ const st = fs26.statSync(memoryDir);
15912
16025
  if (!st.isDirectory()) {
15913
16026
  throw new Error(
15914
16027
  `Cannot use ${memoryDir} as the memory directory \u2014 a file already exists at that path.
@@ -15916,12 +16029,12 @@ Remove it first and re-run, or choose a different path with --memory-dir.`
15916
16029
  );
15917
16030
  }
15918
16031
  } else {
15919
- fs24.mkdirSync(memoryDir, { recursive: true });
16032
+ fs26.mkdirSync(memoryDir, { recursive: true });
15920
16033
  console.log(`Created memory directory: ${memoryDir}`);
15921
16034
  }
15922
16035
  const configDir = path19.dirname(configPath);
15923
- if (!fs24.existsSync(configDir)) {
15924
- fs24.mkdirSync(configDir, { recursive: true });
16036
+ if (!fs26.existsSync(configDir)) {
16037
+ fs26.mkdirSync(configDir, { recursive: true });
15925
16038
  }
15926
16039
  atomicWriteFileSync(configPath, JSON.stringify(updatedConfig, null, 2) + "\n");
15927
16040
  console.log("\nDone! Summary of changes:");
@@ -15950,7 +16063,7 @@ async function cmdOpenclawUpgrade(opts) {
15950
16063
  const legacyPluginDirForBackup = opts.legacyPluginDirForBackup ? resolveOpenclawLegacyPluginDir(opts.legacyPluginDirForBackup) : void 0;
15951
16064
  const fallbackMemoryDir = path19.join(resolveOpenclawStateDir(), "workspace", "memory", "local");
15952
16065
  const packageSpec = buildOpenclawManagedUpgradePackageSpec(opts.version);
15953
- const configExistedBefore = fs24.existsSync(configPath);
16066
+ const configExistedBefore = fs26.existsSync(configPath);
15954
16067
  const existingConfig = readOpenclawConfig(configPath);
15955
16068
  const { entries, slots } = parseOpenclawPluginState(existingConfig, configPath);
15956
16069
  const preservedMemoryDir = opts.memoryDir ? path19.resolve(expandTilde(opts.memoryDir)) : resolveCurrentOpenclawMemoryDir(entries, slots, fallbackMemoryDir);
@@ -16175,15 +16288,15 @@ async function cmdOpenclawMigrateEngram(opts) {
16175
16288
  }
16176
16289
  function createOpenclawUpgradeBackupDir() {
16177
16290
  const backupsRoot = path19.join(resolveOpenclawStateDir(), "backups");
16178
- fs24.mkdirSync(backupsRoot, { recursive: true });
16179
- return fs24.mkdtempSync(path19.join(backupsRoot, `remnic-openclaw-upgrade-${formatOpenclawUpgradeStamp()}-`));
16291
+ fs26.mkdirSync(backupsRoot, { recursive: true });
16292
+ return fs26.mkdtempSync(path19.join(backupsRoot, `remnic-openclaw-upgrade-${formatOpenclawUpgradeStamp()}-`));
16180
16293
  }
16181
16294
  async function cmdTaxonomy(rest) {
16182
16295
  initLogger5();
16183
16296
  const configPath = resolveConfigPath();
16184
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
16185
- const remnicCfg = resolveRemnicConfigRecord14(raw);
16186
- const config = parseConfig15(remnicCfg);
16297
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
16298
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
16299
+ const config = parseConfig17(remnicCfg);
16187
16300
  if (!config.taxonomyEnabled) {
16188
16301
  console.error(
16189
16302
  "Taxonomy is disabled in config (taxonomyEnabled = false). Enable it to use taxonomy commands."
@@ -16219,8 +16332,8 @@ async function cmdTaxonomy(rest) {
16219
16332
  console.log(doc);
16220
16333
  if (config.taxonomyAutoGenResolver) {
16221
16334
  const resolverPath = path19.join(config.memoryDir, ".taxonomy", "RESOLVER.md");
16222
- fs24.mkdirSync(path19.dirname(resolverPath), { recursive: true });
16223
- fs24.writeFileSync(resolverPath, doc);
16335
+ fs26.mkdirSync(path19.dirname(resolverPath), { recursive: true });
16336
+ fs26.writeFileSync(resolverPath, doc);
16224
16337
  console.error(`Written: ${resolverPath}`);
16225
16338
  }
16226
16339
  break;
@@ -16266,7 +16379,7 @@ async function cmdTaxonomy(rest) {
16266
16379
  if (config.taxonomyAutoGenResolver) {
16267
16380
  const doc = generateResolverDocument(taxonomy);
16268
16381
  const resolverPath = path19.join(config.memoryDir, ".taxonomy", "RESOLVER.md");
16269
- fs24.writeFileSync(resolverPath, doc);
16382
+ fs26.writeFileSync(resolverPath, doc);
16270
16383
  console.error(`Regenerated: ${resolverPath}`);
16271
16384
  }
16272
16385
  break;
@@ -16297,7 +16410,7 @@ async function cmdTaxonomy(rest) {
16297
16410
  if (config.taxonomyAutoGenResolver) {
16298
16411
  const doc = generateResolverDocument(taxonomy);
16299
16412
  const resolverPath = path19.join(config.memoryDir, ".taxonomy", "RESOLVER.md");
16300
- fs24.writeFileSync(resolverPath, doc);
16413
+ fs26.writeFileSync(resolverPath, doc);
16301
16414
  console.error(`Regenerated: ${resolverPath}`);
16302
16415
  }
16303
16416
  break;
@@ -16488,12 +16601,12 @@ async function runTrainingExport(args, stdout = process.stdout) {
16488
16601
  `Unknown training-export format "${args.format}". ${validList}`
16489
16602
  );
16490
16603
  }
16491
- if (!fs24.existsSync(args.memoryDir)) {
16604
+ if (!fs26.existsSync(args.memoryDir)) {
16492
16605
  throw new Error(
16493
16606
  `--memory-dir "${args.memoryDir}" does not exist. Provide the path to an existing memory directory.`
16494
16607
  );
16495
16608
  }
16496
- if (!fs24.statSync(args.memoryDir).isDirectory()) {
16609
+ if (!fs26.statSync(args.memoryDir).isDirectory()) {
16497
16610
  throw new Error(
16498
16611
  `--memory-dir "${args.memoryDir}" is not a directory. Provide the path to a memory directory, not a file.`
16499
16612
  );
@@ -16579,10 +16692,10 @@ async function runTrainingExport(args, stdout = process.stdout) {
16579
16692
  }
16580
16693
  const formatted = adapter.formatRecords(records);
16581
16694
  const outDir = path19.dirname(args.output);
16582
- fs24.mkdirSync(outDir, { recursive: true });
16695
+ fs26.mkdirSync(outDir, { recursive: true });
16583
16696
  const tmpPath = `${args.output}.tmp-${process.pid}-${Date.now()}`;
16584
- fs24.writeFileSync(tmpPath, formatted, "utf-8");
16585
- fs24.renameSync(tmpPath, args.output);
16697
+ fs26.writeFileSync(tmpPath, formatted, "utf-8");
16698
+ fs26.renameSync(tmpPath, args.output);
16586
16699
  stdout.write(
16587
16700
  `Exported ${records.length} records to ${args.output} (${adapter.name} format)
16588
16701
  `
@@ -16760,7 +16873,7 @@ async function main(argv = process.argv.slice(2)) {
16760
16873
  }
16761
16874
  }, 500);
16762
16875
  };
16763
- fs24.watch(memoryDir, { recursive: true }, (_event, filename) => {
16876
+ fs26.watch(memoryDir, { recursive: true }, (_event, filename) => {
16764
16877
  if (filename && filename.startsWith(".")) return;
16765
16878
  rebuild();
16766
16879
  });
@@ -16768,12 +16881,12 @@ async function main(argv = process.argv.slice(2)) {
16768
16881
  });
16769
16882
  } else if (subAction === "validate") {
16770
16883
  const treeDir = outputDir;
16771
- if (!fs24.existsSync(treeDir)) {
16884
+ if (!fs26.existsSync(treeDir)) {
16772
16885
  console.error(`Context tree not found at ${treeDir}. Run 'remnic tree generate' first.`);
16773
16886
  process.exit(1);
16774
16887
  }
16775
16888
  const indexPath = path19.join(treeDir, "INDEX.md");
16776
- if (!fs24.existsSync(indexPath)) {
16889
+ if (!fs26.existsSync(indexPath)) {
16777
16890
  console.error(`INDEX.md missing in ${treeDir}. Tree may be corrupt \u2014 regenerate.`);
16778
16891
  process.exit(1);
16779
16892
  }
@@ -16960,6 +17073,10 @@ Other:
16960
17073
  await runMeetingsBinaryCommand(rest);
16961
17074
  break;
16962
17075
  }
17076
+ case "timeline": {
17077
+ await runTimelineBinaryCommand(rest);
17078
+ break;
17079
+ }
16963
17080
  case "location":
16964
17081
  await runLocationBinaryCommand(rest);
16965
17082
  break;
@@ -16972,6 +17089,9 @@ Other:
16972
17089
  case "standup":
16973
17090
  await runStandupBinaryCommand(rest);
16974
17091
  break;
17092
+ case "journal":
17093
+ await runJournalBinaryCommand(rest);
17094
+ break;
16975
17095
  case "codegraph":
16976
17096
  await runCodegraphBinaryCommand(rest);
16977
17097
  break;
@@ -16988,9 +17108,9 @@ Other:
16988
17108
  const targetFactory = async () => {
16989
17109
  if (!orchestratorSingleton) {
16990
17110
  const configPath = resolveConfigPath();
16991
- const raw = fs24.existsSync(configPath) ? JSON.parse(fs24.readFileSync(configPath, "utf8")) : {};
16992
- const remnicCfg = resolveRemnicConfigRecord14(raw);
16993
- const config = parseConfig15(remnicCfg);
17111
+ const raw = fs26.existsSync(configPath) ? JSON.parse(fs26.readFileSync(configPath, "utf8")) : {};
17112
+ const remnicCfg = resolveRemnicConfigRecord16(raw);
17113
+ const config = parseConfig17(remnicCfg);
16994
17114
  orchestratorSingleton = new Orchestrator10(config);
16995
17115
  await orchestratorSingleton.initialize();
16996
17116
  await orchestratorSingleton.deferredReady;