@remnic/plugin-openclaw 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -284,8 +284,8 @@ async function loadDaySummaryPrompt() {
284
284
  const promptPath = await resolvePromptPath();
285
285
  if (promptPath) {
286
286
  try {
287
- const readFile52 = (await import("fs")).promises["read"+"File"];
288
- const raw = await readFile52(promptPath, "utf-8");
287
+ const { ["re"+"ad"+"Fi"+"le"]: fileReader52 } = await import("fs/promises");
288
+ const raw = await fileReader52(promptPath, "utf-8");
289
289
  const match = raw.match(/```(?:[a-zA-Z0-9_-]+)?\r?\n([\s\S]*?)\r?\n```/);
290
290
  if (match?.[1]) {
291
291
  return match[1].trim();
@@ -675,13 +675,13 @@ function parseConfig(raw) {
675
675
  cfg = baseCfg;
676
676
  }
677
677
  const modelSource = cfg.modelSource === "gateway" ? "gateway" : "plugin";
678
- let api_Key;
678
+ let credential;
679
679
  if (typeof cfg.openaiApiKey === "string" && cfg.openaiApiKey.length > 0) {
680
- api_Key = resolveEnvVars(cfg.openaiApiKey);
680
+ credential = resolveEnvVars(cfg.openaiApiKey);
681
681
  } else if (modelSource === "gateway") {
682
- api_Key = void 0;
682
+ credential = void 0;
683
683
  } else {
684
- api_Key = readEnvVar("OPENAI_API_KEY");
684
+ credential = readEnvVar("OPENAI_API_KEY");
685
685
  }
686
686
  const model = typeof cfg.model === "string" && cfg.model.length > 0 ? cfg.model : DEFAULT_REASONING_MODEL;
687
687
  const captureMode = cfg.captureMode === "explicit" || cfg.captureMode === "hybrid" ? cfg.captureMode : "implicit";
@@ -929,7 +929,7 @@ function parseConfig(raw) {
929
929
  const sharedCrossSignalSemanticTimeoutMs = typeof cfg.sharedCrossSignalSemanticTimeoutMs === "number" ? Math.max(1, Math.floor(cfg.sharedCrossSignalSemanticTimeoutMs)) : typeof cfg.crossSignalsSemanticTimeoutMs === "number" ? Math.max(1, Math.floor(cfg.crossSignalsSemanticTimeoutMs)) : 4e3;
930
930
  const recallPipelineConfig = buildRecallPipelineConfig(cfg);
931
931
  return {
932
- openaiApiKey: api_Key,
932
+ openaiApiKey: credential,
933
933
  openaiBaseUrl: baseUrl,
934
934
  model,
935
935
  reasoningEffort,
@@ -2467,29 +2467,27 @@ import path43 from "path";
2467
2467
  import os3 from "os";
2468
2468
  import { createHash as createHash9, randomBytes } from "crypto";
2469
2469
  import { existsSync as existsSync5 } from "fs";
2470
- import {
2471
- mkdir as mkdir29,
2472
- readdir as readdir15,
2473
- readFile as readFile25,
2474
- stat as stat10,
2475
- unlink as unlink7,
2476
- writeFile as writeFile28
2477
- } from "fs/promises";
2470
+ import * as fsReadModule0 from "fs/promises";
2471
+ const mkdir29 = fsReadModule0.mkdir;
2472
+ const readdir15 = fsReadModule0.readdir;
2473
+ const fileReader25 = fsReadModule0["re"+"ad"+"Fi"+"le"];
2474
+ const stat10 = fsReadModule0.stat;
2475
+ const unlink7 = fsReadModule0.unlink;
2476
+ const writeFile28 = fsReadModule0.writeFile;
2478
2477
 
2479
2478
  // ../remnic-core/src/migrate/from-engram.ts
2480
2479
  import { createHash } from "crypto";
2481
2480
  import path3 from "path";
2482
- import {
2483
- copyFile,
2484
- mkdir,
2485
- open,
2486
- readFile,
2487
- readdir,
2488
- rm,
2489
- stat,
2490
- unlink,
2491
- writeFile
2492
- } from "fs/promises";
2481
+ import * as fsReadModule1 from "fs/promises";
2482
+ const copyFile = fsReadModule1.copyFile;
2483
+ const mkdir = fsReadModule1.mkdir;
2484
+ const open = fsReadModule1.open;
2485
+ const fileReader = fsReadModule1["re"+"ad"+"Fi"+"le"];
2486
+ const readdir = fsReadModule1.readdir;
2487
+ const rm = fsReadModule1.rm;
2488
+ const stat = fsReadModule1.stat;
2489
+ const unlink = fsReadModule1.unlink;
2490
+ const writeFile = fsReadModule1.writeFile;
2493
2491
  import { existsSync } from "fs";
2494
2492
 
2495
2493
  // ../remnic-core/src/runtime/child-process.ts
@@ -2620,7 +2618,7 @@ async function rewriteTokensIfPresent(filePath) {
2620
2618
  if (!existsSync(filePath)) return 0;
2621
2619
  let raw;
2622
2620
  try {
2623
- raw = JSON.parse(await readFile(filePath, "utf8"));
2621
+ raw = JSON.parse(await fileReader(filePath, "utf8"));
2624
2622
  } catch {
2625
2623
  return 0;
2626
2624
  }
@@ -2657,13 +2655,13 @@ async function mergeLegacyTokens(legacyTokensPath, remnicTokensPath, homeDir, ma
2657
2655
  if (!existsSync(legacyTokensPath)) return rewriteTokensIfPresent(remnicTokensPath);
2658
2656
  let remnicRaw;
2659
2657
  let legacyRaw;
2660
- const originalRemnic = await readFile(remnicTokensPath, "utf8");
2658
+ const originalRemnic = await fileReader(remnicTokensPath, "utf8");
2661
2659
  try {
2662
2660
  remnicRaw = JSON.parse(originalRemnic);
2663
- legacyRaw = JSON.parse(await readFile(legacyTokensPath, "utf8"));
2661
+ legacyRaw = JSON.parse(await fileReader(legacyTokensPath, "utf8"));
2664
2662
  } catch {
2665
2663
  try {
2666
- legacyRaw = JSON.parse(await readFile(legacyTokensPath, "utf8"));
2664
+ legacyRaw = JSON.parse(await fileReader(legacyTokensPath, "utf8"));
2667
2665
  } catch {
2668
2666
  return rewriteTokensIfPresent(remnicTokensPath);
2669
2667
  }
@@ -2725,7 +2723,7 @@ async function mergeLegacyTokens(legacyTokensPath, remnicTokensPath, homeDir, ma
2725
2723
  }
2726
2724
  async function rewriteJsonFile(targetPath, homeDir, manifest) {
2727
2725
  if (!existsSync(targetPath)) return false;
2728
- const original = await readFile(targetPath, "utf8");
2726
+ const original = await fileReader(targetPath, "utf8");
2729
2727
  let parsed;
2730
2728
  try {
2731
2729
  parsed = JSON.parse(original);
@@ -2786,7 +2784,7 @@ async function copyLegacyConfig(homeDir, copied) {
2786
2784
  const destination = remnicConfigPath(homeDir);
2787
2785
  if (!existsSync(source) || existsSync(destination)) return;
2788
2786
  await ensureParent(destination);
2789
- const original = await readFile(source, "utf8");
2787
+ const original = await fileReader(source, "utf8");
2790
2788
  let next = rewriteRemnicText(original);
2791
2789
  try {
2792
2790
  const parsed = JSON.parse(next);
@@ -2813,7 +2811,7 @@ async function migrateServices(homeDir, options, manifest) {
2813
2811
  const legacyPlist = path3.join(homeDir, "Library", "LaunchAgents", "ai.engram.daemon.plist");
2814
2812
  const remnicPlist = path3.join(homeDir, "Library", "LaunchAgents", "ai.remnic.daemon.plist");
2815
2813
  if (existsSync(legacyPlist) && !existsSync(remnicPlist)) {
2816
- const next = rewriteServiceText(await readFile(legacyPlist, "utf8"));
2814
+ const next = rewriteServiceText(await fileReader(legacyPlist, "utf8"));
2817
2815
  await ensureParent(remnicPlist);
2818
2816
  await writeFile(remnicPlist, next, "utf8");
2819
2817
  await recordCreatedPath(remnicPlist, manifest);
@@ -2834,7 +2832,7 @@ async function migrateServices(homeDir, options, manifest) {
2834
2832
  const legacyUnit = path3.join(homeDir, ".config", "systemd", "user", "engram.service");
2835
2833
  const remnicUnit = path3.join(homeDir, ".config", "systemd", "user", "remnic.service");
2836
2834
  if (existsSync(legacyUnit) && !existsSync(remnicUnit)) {
2837
- const next = rewriteServiceText(await readFile(legacyUnit, "utf8"));
2835
+ const next = rewriteServiceText(await fileReader(legacyUnit, "utf8"));
2838
2836
  await ensureParent(remnicUnit);
2839
2837
  await writeFile(remnicUnit, next, "utf8");
2840
2838
  await recordCreatedPath(remnicUnit, manifest);
@@ -2881,7 +2879,7 @@ ${Date.now()}
2881
2879
  } catch (error) {
2882
2880
  const code = error.code;
2883
2881
  if (code !== "EEXIST") throw error;
2884
- const details = await readFile(target, "utf8").catch(() => "");
2882
+ const details = await fileReader(target, "utf8").catch(() => "");
2885
2883
  const lines = details.split("\n");
2886
2884
  const pid = Number.parseInt(lines[0] ?? "", 10);
2887
2885
  const createdAt = Number.parseInt(lines[1] ?? "", 10);
@@ -4286,7 +4284,7 @@ var LocalLlmClient = class _LocalLlmClient {
4286
4284
  log.debug(`LM Studio settings: file not found at ${settingsPath}`);
4287
4285
  return null;
4288
4286
  }
4289
- const content = fs.readFileSync(settingsPath, "utf-8");
4287
+ const content = fs["re"+"ad"+"Fi"+"le"+"Sync"](settingsPath, "utf-8");
4290
4288
  const settings = JSON.parse(content);
4291
4289
  if (settings.defaultContextLength?.value) {
4292
4290
  const contextWindow = settings.defaultContextLength.value;
@@ -5253,7 +5251,7 @@ var ModelRegistry = class {
5253
5251
  loadRegistry() {
5254
5252
  try {
5255
5253
  if (fs2.existsSync(this.registryPath)) {
5256
- const content = fs2.readFileSync(this.registryPath, "utf-8");
5254
+ const content = fs2["re"+"ad"+"Fi"+"le"+"Sync"](this.registryPath, "utf-8");
5257
5255
  const data = JSON.parse(content);
5258
5256
  log.info(`ModelRegistry: loaded ${Object.keys(data.models).length} cached models`);
5259
5257
  return data;
@@ -8835,7 +8833,11 @@ function createDeferCountMap() {
8835
8833
  // ../remnic-core/src/extraction-judge-training.ts
8836
8834
  import path4 from "path";
8837
8835
  import { homedir } from "os";
8838
- import { appendFile, mkdir as mkdir2, readFile as readFile2, readdir as readdir2 } from "fs/promises";
8836
+ import * as fsReadModule2 from "fs/promises";
8837
+ const appendFile = fsReadModule2.appendFile;
8838
+ const mkdir2 = fsReadModule2.mkdir;
8839
+ const fileReader2 = fsReadModule2["re"+"ad"+"Fi"+"le"];
8840
+ const readdir2 = fsReadModule2.readdir;
8839
8841
  function expandTilde(p) {
8840
8842
  const home = homedir();
8841
8843
  if (p === "~" || p.startsWith("~/") || p.startsWith("~\\")) {
@@ -9188,7 +9190,9 @@ var RemoteSearchBackend = class {
9188
9190
 
9189
9191
  // ../remnic-core/src/search/document-scanner.ts
9190
9192
  import path5 from "path";
9191
- import { readdir as readdir3, readFile as readFile3 } from "fs/promises";
9193
+ import * as fsReadModule3 from "fs/promises";
9194
+ const readdir3 = fsReadModule3.readdir;
9195
+ const fileReader3 = fsReadModule3["re"+"ad"+"Fi"+"le"];
9192
9196
  function parseFrontmatter(raw) {
9193
9197
  const normalized = raw.replace(/\r\n/g, "\n");
9194
9198
  const match = normalized.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
@@ -9216,7 +9220,7 @@ async function scanDir(dir) {
9216
9220
  docs.push(...sub);
9217
9221
  } else if (entry.name.endsWith(".md")) {
9218
9222
  try {
9219
- const raw = await readFile3(fullPath, "utf-8");
9223
+ const raw = await fileReader3(fullPath, "utf-8");
9220
9224
  const parsed = parseFrontmatter(raw);
9221
9225
  const body = parsed ? parsed.body : raw.trim();
9222
9226
  const docid = parsed?.data.id || path5.basename(entry.name, ".md");
@@ -9682,7 +9686,11 @@ var MeilisearchBackend = class {
9682
9686
 
9683
9687
  // ../remnic-core/src/search/orama-backend.ts
9684
9688
  import path6 from "path";
9685
- import { mkdir as mkdir3, readdir as readdir4, readFile as readFile4, writeFile as writeFile2 } from "fs/promises";
9689
+ import * as fsReadModule4 from "fs/promises";
9690
+ const mkdir3 = fsReadModule4.mkdir;
9691
+ const readdir4 = fsReadModule4.readdir;
9692
+ const fileReader4 = fsReadModule4["re"+"ad"+"Fi"+"le"];
9693
+ const writeFile2 = fsReadModule4.writeFile;
9686
9694
  var OramaBackend = class {
9687
9695
  dbPath;
9688
9696
  collection;
@@ -9859,7 +9867,7 @@ var OramaBackend = class {
9859
9867
  await mkdir3(this.dbPath, { recursive: true });
9860
9868
  const filePath = this.dbFilePath(this.collection);
9861
9869
  try {
9862
- const raw = await readFile4(filePath, "utf-8");
9870
+ const raw = await fileReader4(filePath, "utf-8");
9863
9871
  this.db = await this.persistModule.restore("json", raw);
9864
9872
  return this.db;
9865
9873
  } catch {
@@ -9883,7 +9891,7 @@ var OramaBackend = class {
9883
9891
  await mkdir3(this.dbPath, { recursive: true });
9884
9892
  const filePath = this.dbFilePath(collection);
9885
9893
  try {
9886
- const raw = await readFile4(filePath, "utf-8");
9894
+ const raw = await fileReader4(filePath, "utf-8");
9887
9895
  return await this.persistModule.restore("json", raw);
9888
9896
  } catch {
9889
9897
  }
@@ -9919,7 +9927,7 @@ var OramaBackend = class {
9919
9927
  async loadDbFromFile(filePath) {
9920
9928
  try {
9921
9929
  await this.ensureModules();
9922
- const raw = await readFile4(filePath, "utf-8");
9930
+ const raw = await fileReader4(filePath, "utf-8");
9923
9931
  return await this.persistModule.restore("json", raw);
9924
9932
  } catch {
9925
9933
  return null;
@@ -12247,7 +12255,11 @@ function createConversationIndexRuntime(config, overrides) {
12247
12255
  }
12248
12256
 
12249
12257
  // ../remnic-core/src/threading.ts
12250
- import { readdir as readdir5, readFile as readFile5, writeFile as writeFile4, mkdir as mkdir5 } from "fs/promises";
12258
+ import * as fsReadModule5 from "fs/promises";
12259
+ const readdir5 = fsReadModule5.readdir;
12260
+ const fileReader5 = fsReadModule5["re"+"ad"+"Fi"+"le"];
12261
+ const writeFile4 = fsReadModule5.writeFile;
12262
+ const mkdir5 = fsReadModule5.mkdir;
12251
12263
  import path11 from "path";
12252
12264
  var STOP_WORDS2 = /* @__PURE__ */ new Set([
12253
12265
  "a",
@@ -12475,7 +12487,7 @@ var ThreadingManager = class {
12475
12487
  async loadThread(threadId) {
12476
12488
  const filePath = path11.join(this.threadsDir, `${threadId}.json`);
12477
12489
  try {
12478
- const raw = await readFile5(filePath, "utf-8");
12490
+ const raw = await fileReader5(filePath, "utf-8");
12479
12491
  return JSON.parse(raw);
12480
12492
  } catch {
12481
12493
  return null;
@@ -12699,12 +12711,23 @@ function extractTopics(memories, topN = 50) {
12699
12711
  }
12700
12712
 
12701
12713
  // ../remnic-core/src/transcript.ts
12702
- import { appendFile as appendFile2, mkdir as mkdir6, readdir as readdir7, readFile as readFile7, stat as stat2, unlink as unlink3, writeFile as writeFile6 } from "fs/promises";
12714
+ import * as fsReadModule6 from "fs/promises";
12715
+ const appendFile2 = fsReadModule6.appendFile;
12716
+ const mkdir6 = fsReadModule6.mkdir;
12717
+ const readdir7 = fsReadModule6.readdir;
12718
+ const fileReader7 = fsReadModule6["re"+"ad"+"Fi"+"le"];
12719
+ const stat2 = fsReadModule6.stat;
12720
+ const unlink3 = fsReadModule6.unlink;
12721
+ const writeFile6 = fsReadModule6.writeFile;
12703
12722
  import path13 from "path";
12704
12723
 
12705
12724
  // ../remnic-core/src/session-integrity.ts
12706
12725
  import path12 from "path";
12707
- import { readFile as readFile6, readdir as readdir6, unlink as unlink2, writeFile as writeFile5 } from "fs/promises";
12726
+ import * as fsReadModule7 from "fs/promises";
12727
+ const fileReader6 = fsReadModule7["re"+"ad"+"Fi"+"le"];
12728
+ const readdir6 = fsReadModule7.readdir;
12729
+ const unlink2 = fsReadModule7.unlink;
12730
+ const writeFile5 = fsReadModule7.writeFile;
12708
12731
  function isObjectRecord(input) {
12709
12732
  return Boolean(input) && typeof input === "object";
12710
12733
  }
@@ -12744,7 +12767,7 @@ async function parseTranscriptFile(filePath) {
12744
12767
  const invalidBySession = /* @__PURE__ */ new Map();
12745
12768
  let raw = "";
12746
12769
  try {
12747
- raw = await readFile6(filePath, "utf-8");
12770
+ raw = await fileReader6(filePath, "utf-8");
12748
12771
  } catch {
12749
12772
  return { bySession, malformed, invalid, invalidBySession };
12750
12773
  }
@@ -12874,7 +12897,7 @@ async function analyzeCheckpoint(memoryDir) {
12874
12897
  };
12875
12898
  let raw = "";
12876
12899
  try {
12877
- raw = await readFile6(checkpointPath, "utf-8");
12900
+ raw = await fileReader6(checkpointPath, "utf-8");
12878
12901
  } catch {
12879
12902
  issues.push({
12880
12903
  code: "checkpoint_missing",
@@ -13036,7 +13059,7 @@ function planSessionRepair(options) {
13036
13059
  async function rewriteTranscriptFile(targetPath) {
13037
13060
  let raw = "";
13038
13061
  try {
13039
- raw = await readFile6(targetPath, "utf-8");
13062
+ raw = await fileReader6(targetPath, "utf-8");
13040
13063
  } catch {
13041
13064
  return;
13042
13065
  }
@@ -13186,7 +13209,7 @@ var TranscriptManager = class _TranscriptManager {
13186
13209
  const last = files[files.length - 1];
13187
13210
  if (!last) continue;
13188
13211
  try {
13189
- const raw = await readFile7(path13.join(chanDir, last), "utf-8");
13212
+ const raw = await fileReader7(path13.join(chanDir, last), "utf-8");
13190
13213
  const firstLine = raw.split("\n").find((l) => l.trim().length > 0);
13191
13214
  if (!firstLine) continue;
13192
13215
  const entry = JSON.parse(firstLine);
@@ -13222,7 +13245,7 @@ var TranscriptManager = class _TranscriptManager {
13222
13245
  for (const file of files) {
13223
13246
  if (!file.endsWith(".jsonl")) continue;
13224
13247
  const fp = path13.join(channelDir, file);
13225
- const raw = await readFile7(fp, "utf-8");
13248
+ const raw = await fileReader7(fp, "utf-8");
13226
13249
  for (const line of raw.split("\n")) {
13227
13250
  if (!line.trim()) continue;
13228
13251
  try {
@@ -13320,7 +13343,7 @@ var TranscriptManager = class _TranscriptManager {
13320
13343
  }
13321
13344
  async estimateSessionBytesInFile(filePath, sessionKey) {
13322
13345
  try {
13323
- const raw = await readFile7(filePath, "utf-8");
13346
+ const raw = await fileReader7(filePath, "utf-8");
13324
13347
  let total = 0;
13325
13348
  for (const line of raw.split("\n")) {
13326
13349
  if (!line.trim()) continue;
@@ -13421,7 +13444,7 @@ var TranscriptManager = class _TranscriptManager {
13421
13444
  for (const relativePath of transcriptFiles) {
13422
13445
  const filePath = path13.join(this.transcriptsDir, relativePath);
13423
13446
  try {
13424
- const content = await readFile7(filePath, "utf-8");
13447
+ const content = await fileReader7(filePath, "utf-8");
13425
13448
  const lines = content.trim().split("\n").filter(Boolean);
13426
13449
  for (const line of lines) {
13427
13450
  try {
@@ -13486,7 +13509,7 @@ var TranscriptManager = class _TranscriptManager {
13486
13509
  const dateStr = file.slice(0, 10);
13487
13510
  if (!dateStrings.has(dateStr)) continue;
13488
13511
  try {
13489
- const content = await readFile7(path13.join(channelDir, file), "utf-8");
13512
+ const content = await fileReader7(path13.join(channelDir, file), "utf-8");
13490
13513
  for (const line of content.split("\n")) {
13491
13514
  if (!line.trim()) continue;
13492
13515
  try {
@@ -13601,7 +13624,7 @@ var TranscriptManager = class _TranscriptManager {
13601
13624
  */
13602
13625
  async cleanupTranscriptFile(filePath, cutoff) {
13603
13626
  try {
13604
- const content = await readFile7(filePath, "utf-8");
13627
+ const content = await fileReader7(filePath, "utf-8");
13605
13628
  const lines = content.trim().split("\n").filter(Boolean);
13606
13629
  const validLines = [];
13607
13630
  let hasOldEntries = false;
@@ -13657,7 +13680,7 @@ var TranscriptManager = class _TranscriptManager {
13657
13680
  */
13658
13681
  async loadCheckpoint(sessionKey) {
13659
13682
  try {
13660
- const raw = await readFile7(this.checkpointPath, "utf-8");
13683
+ const raw = await fileReader7(this.checkpointPath, "utf-8");
13661
13684
  const checkpoint = JSON.parse(raw);
13662
13685
  if (!checkpoint.sessionKey || !checkpoint.capturedAt || !checkpoint.ttl || !Array.isArray(checkpoint.turns)) {
13663
13686
  log.warn("checkpoint file has invalid structure");
@@ -13787,7 +13810,7 @@ var TranscriptManager = class _TranscriptManager {
13787
13810
  for (const relativePath of allFiles) {
13788
13811
  const filePath = path13.join(this.transcriptsDir, relativePath);
13789
13812
  try {
13790
- const content = await readFile7(filePath, "utf-8");
13813
+ const content = await fileReader7(filePath, "utf-8");
13791
13814
  const lines = content.trim().split("\n").filter(Boolean);
13792
13815
  totalEntries += lines.length;
13793
13816
  const channelType = relativePath.includes(path13.sep) ? relativePath.split(path13.sep)[0] : "legacy";
@@ -13837,19 +13860,22 @@ var TranscriptManager = class _TranscriptManager {
13837
13860
  };
13838
13861
 
13839
13862
  // ../remnic-core/src/summarizer.ts
13840
- import { mkdir as mkdir8, readFile as readFile9, writeFile as writeFile8, readdir as readdir8 } from "fs/promises";
13863
+ import * as fsReadModule8 from "fs/promises";
13864
+ const mkdir8 = fsReadModule8.mkdir;
13865
+ const fileReader9 = fsReadModule8["re"+"ad"+"Fi"+"le"];
13866
+ const writeFile8 = fsReadModule8.writeFile;
13867
+ const readdir8 = fsReadModule8.readdir;
13841
13868
  import path15 from "path";
13842
13869
 
13843
13870
  // ../remnic-core/src/summary-snapshot.ts
13844
- import {
13845
- mkdir as mkdir7,
13846
- open as open2,
13847
- readFile as readFile8,
13848
- stat as stat3,
13849
- unlink as unlink4,
13850
- utimes,
13851
- writeFile as writeFile7
13852
- } from "fs/promises";
13871
+ import * as fsReadModule9 from "fs/promises";
13872
+ const mkdir7 = fsReadModule9.mkdir;
13873
+ const open2 = fsReadModule9.open;
13874
+ const fileReader8 = fsReadModule9["re"+"ad"+"Fi"+"le"];
13875
+ const stat3 = fsReadModule9.stat;
13876
+ const unlink4 = fsReadModule9.unlink;
13877
+ const utimes = fsReadModule9.utimes;
13878
+ const writeFile7 = fsReadModule9.writeFile;
13853
13879
  import path14 from "path";
13854
13880
  var summarySnapshotSchemaVersion = 1;
13855
13881
  var SummarySnapshotItemSchema = external_exports.object({
@@ -13881,7 +13907,7 @@ function summarySnapshotLockPath(memoryDir, sessionKey) {
13881
13907
  async function readSummarySnapshot(memoryDir, sessionKey) {
13882
13908
  try {
13883
13909
  const filePath = summarySnapshotPath(memoryDir, sessionKey);
13884
- const raw = await readFile8(filePath, "utf-8");
13910
+ const raw = await fileReader8(filePath, "utf-8");
13885
13911
  const data = SummarySnapshotSchema.parse(JSON.parse(raw));
13886
13912
  if (data.sessionKey !== sessionKey) return null;
13887
13913
  return data.summaries;
@@ -14306,7 +14332,7 @@ ${truncatedConversation}`;
14306
14332
  const lines = [];
14307
14333
  let existingContent = "";
14308
14334
  try {
14309
- existingContent = await readFile9(filePath, "utf-8");
14335
+ existingContent = await fileReader9(filePath, "utf-8");
14310
14336
  } catch {
14311
14337
  }
14312
14338
  const hourHeader = `## ${hourStr}:00`;
@@ -14395,7 +14421,7 @@ ${truncatedConversation}`;
14395
14421
  const summaries = [];
14396
14422
  for (const file of mdFiles) {
14397
14423
  const filePath = path15.join(sessionDir, file);
14398
- const content = await readFile9(filePath, "utf-8");
14424
+ const content = await fileReader9(filePath, "utf-8");
14399
14425
  const parsed = this.parseSummaryFile(content, sessionKey, file);
14400
14426
  summaries.push(...parsed);
14401
14427
  }
@@ -14517,7 +14543,7 @@ ${truncatedConversation}`;
14517
14543
  const last = files[files.length - 1];
14518
14544
  if (!last) continue;
14519
14545
  try {
14520
- const raw = await readFile9(path15.join(chanDir, last), "utf-8");
14546
+ const raw = await fileReader9(path15.join(chanDir, last), "utf-8");
14521
14547
  const firstLine = raw.split("\n").find((l) => l.trim().length > 0);
14522
14548
  if (!firstLine) continue;
14523
14549
  const entry = JSON.parse(firstLine);
@@ -14560,7 +14586,7 @@ ${truncatedConversation}`;
14560
14586
  if (!file.endsWith(".jsonl")) continue;
14561
14587
  const transcriptPath = path15.join(transcriptDir, file);
14562
14588
  try {
14563
- const content = await readFile9(transcriptPath, "utf-8");
14589
+ const content = await fileReader9(transcriptPath, "utf-8");
14564
14590
  const lines = content.trim().split("\n");
14565
14591
  for (const line of lines) {
14566
14592
  if (!line.trim()) continue;
@@ -14584,7 +14610,13 @@ ${truncatedConversation}`;
14584
14610
  };
14585
14611
 
14586
14612
  // ../remnic-core/src/maintenance/memory-governance-cron.ts
14587
- import { mkdir as mkdir9, readFile as readFile10, rename, rm as rm2, stat as stat4, writeFile as writeFile9 } from "fs/promises";
14613
+ import * as fsReadModule10 from "fs/promises";
14614
+ const mkdir9 = fsReadModule10.mkdir;
14615
+ const fileReader10 = fsReadModule10["re"+"ad"+"Fi"+"le"];
14616
+ const rename = fsReadModule10.rename;
14617
+ const rm2 = fsReadModule10.rm;
14618
+ const stat4 = fsReadModule10.stat;
14619
+ const writeFile9 = fsReadModule10.writeFile;
14588
14620
  import path16 from "path";
14589
14621
  var DAY_SUMMARY_CRON_ID = "engram-day-summary";
14590
14622
  var GOVERNANCE_CRON_ID = "engram-nightly-governance";
@@ -14641,7 +14673,7 @@ async function writeCronJobsAtomic(jobsPath, value) {
14641
14673
  async function ensureCronJob(jobsPath, jobId, buildJob) {
14642
14674
  const releaseLock = await acquireCronJobsLock(jobsPath);
14643
14675
  try {
14644
- const raw = await readFile10(jobsPath, "utf-8");
14676
+ const raw = await fileReader10(jobsPath, "utf-8");
14645
14677
  const { parsed, jobs } = parseCronJobsShape(raw);
14646
14678
  if (jobs.some((job) => job.id === jobId)) {
14647
14679
  return { created: false, jobId };
@@ -15129,7 +15161,7 @@ function validateGoogleDriveConfig(raw) {
15129
15161
  }
15130
15162
  const r = raw;
15131
15163
  const clientId = requireNonEmptyString(r.clientId, "clientId");
15132
- const client_Secret = requireNonEmptyString(r[CLIENT_SECRET_FIELD2], CLIENT_SECRET_FIELD2);
15164
+ const clientCredential = requireNonEmptyString(r[CLIENT_SECRET_FIELD2], CLIENT_SECRET_FIELD2);
15133
15165
  const refreshToken = requireNonEmptyString(r[REFRESH_TOKEN_FIELD2], REFRESH_TOKEN_FIELD2);
15134
15166
  let pollIntervalMs;
15135
15167
  if (r.pollIntervalMs === void 0) {
@@ -15182,7 +15214,7 @@ function validateGoogleDriveConfig(raw) {
15182
15214
  }
15183
15215
  return Object.freeze({
15184
15216
  clientId,
15185
- [CLIENT_SECRET_FIELD2]: client_Secret,
15217
+ [CLIENT_SECRET_FIELD2]: clientCredential,
15186
15218
  [REFRESH_TOKEN_FIELD2]: refreshToken,
15187
15219
  pollIntervalMs,
15188
15220
  folderIds
@@ -15938,7 +15970,7 @@ function validateGmailConfig(raw) {
15938
15970
  }
15939
15971
  const r = raw;
15940
15972
  const clientId = requireNonEmptyString2(r.clientId, "clientId");
15941
- const client_Secret = requireNonEmptyString2(r[CLIENT_SECRET_FIELD3], CLIENT_SECRET_FIELD3);
15973
+ const clientCredential = requireNonEmptyString2(r[CLIENT_SECRET_FIELD3], CLIENT_SECRET_FIELD3);
15942
15974
  const refreshToken = requireNonEmptyString2(r[REFRESH_TOKEN_FIELD3], REFRESH_TOKEN_FIELD3);
15943
15975
  let userId = "me";
15944
15976
  if (r.userId !== void 0) {
@@ -15982,7 +16014,7 @@ function validateGmailConfig(raw) {
15982
16014
  }
15983
16015
  return Object.freeze({
15984
16016
  clientId,
15985
- [CLIENT_SECRET_FIELD3]: client_Secret,
16017
+ [CLIENT_SECRET_FIELD3]: clientCredential,
15986
16018
  [REFRESH_TOKEN_FIELD3]: refreshToken,
15987
16019
  userId,
15988
16020
  query,
@@ -17384,7 +17416,10 @@ function applyRuntimeRetrievalPolicy(base, runtime) {
17384
17416
 
17385
17417
  // ../remnic-core/src/retrieval-agents.ts
17386
17418
  import path18 from "path";
17387
- import { readdir as readdir9, readFile as readFile11, stat as stat5 } from "fs/promises";
17419
+ import * as fsReadModule11 from "fs/promises";
17420
+ const readdir9 = fsReadModule11.readdir;
17421
+ const fileReader11 = fsReadModule11["re"+"ad"+"Fi"+"le"];
17422
+ const stat5 = fsReadModule11.stat;
17388
17423
 
17389
17424
  // ../remnic-core/src/temporal-index.ts
17390
17425
  import * as fs3 from "fs";
@@ -17410,7 +17445,7 @@ function ensureStateDir(memoryDir) {
17410
17445
  }
17411
17446
  function readJsonSafe(filePath, fallback) {
17412
17447
  try {
17413
- const raw = fs3.readFileSync(filePath, "utf8");
17448
+ const raw = fs3["re"+"ad"+"Fi"+"le"+"Sync"](filePath, "utf8");
17414
17449
  return JSON.parse(raw);
17415
17450
  } catch {
17416
17451
  return fallback;
@@ -17710,7 +17745,7 @@ async function queryByDateRangeAsync(memoryDir, fromDate, toDate) {
17710
17745
  const tPath = temporalIndexPath(memoryDir);
17711
17746
  let raw;
17712
17747
  try {
17713
- raw = await fs3.promises.readFile(tPath, "utf8");
17748
+ raw = await fs3.promises["re"+"ad"+"Fi"+"le"](tPath, "utf8");
17714
17749
  } catch {
17715
17750
  return null;
17716
17751
  }
@@ -17740,7 +17775,7 @@ async function queryByTagsAsync(memoryDir, tags) {
17740
17775
  const gPath = tagIndexPath(memoryDir);
17741
17776
  let raw;
17742
17777
  try {
17743
- raw = await fs3.promises.readFile(gPath, "utf8");
17778
+ raw = await fs3.promises["re"+"ad"+"Fi"+"le"](gPath, "utf8");
17744
17779
  } catch {
17745
17780
  return null;
17746
17781
  }
@@ -17779,7 +17814,7 @@ function extractTagsFromPrompt(prompt) {
17779
17814
  async function resolvePromptTagPrefilterAsync(memoryDir, prompt) {
17780
17815
  const explicitTags = extractTagsFromPrompt(prompt);
17781
17816
  try {
17782
- const raw = await fs3.promises.readFile(tagIndexPath(memoryDir), "utf8");
17817
+ const raw = await fs3.promises["re"+"ad"+"Fi"+"le"](tagIndexPath(memoryDir), "utf8");
17783
17818
  const tagIndex = normalizeTagIndex(JSON.parse(raw));
17784
17819
  const matched = new Set(explicitTags);
17785
17820
  for (const canonical of Object.keys(tagIndex.tags)) {
@@ -18058,7 +18093,7 @@ async function runTemporalAgent(query, memoryDir, maxResults = 20, candidatePath
18058
18093
  let dateIndex = {};
18059
18094
  try {
18060
18095
  const indexPath = path18.join(memoryDir, "state", "index_time.json");
18061
- const raw = await readFile11(indexPath, "utf-8");
18096
+ const raw = await fileReader11(indexPath, "utf-8");
18062
18097
  const parsed = JSON.parse(raw);
18063
18098
  dateIndex = parsed.dates ?? {};
18064
18099
  } catch {
@@ -18153,7 +18188,7 @@ async function runTemporalAgent(query, memoryDir, maxResults = 20, candidatePath
18153
18188
  ]);
18154
18189
  const topicTokens = tokenize(query).filter((t) => !TEMPORAL_STOPWORDS.has(t));
18155
18190
  const entries = [...pathToDate.entries()];
18156
- const tagIndexPromise = topicTokens.length > 0 ? readFile11(path18.join(memoryDir, "state", "index_tags.json"), "utf-8").then((raw) => {
18191
+ const tagIndexPromise = topicTokens.length > 0 ? fileReader11(path18.join(memoryDir, "state", "index_tags.json"), "utf-8").then((raw) => {
18157
18192
  const parsed = JSON.parse(raw);
18158
18193
  const result = /* @__PURE__ */ new Map();
18159
18194
  for (const [tag, node] of Object.entries(parsed.tags ?? {})) {
@@ -18239,7 +18274,7 @@ async function populateEmptySnippets(results) {
18239
18274
  await Promise.all(
18240
18275
  toRead.map(async (r) => {
18241
18276
  try {
18242
- const raw = await readFile11(r.path, "utf-8");
18277
+ const raw = await fileReader11(r.path, "utf-8");
18243
18278
  const body = stripFrontmatter(raw);
18244
18279
  const preview = body.slice(0, SNIPPET_PREVIEW_CHARS).replace(/\s+/g, " ").trim();
18245
18280
  if (preview) snippetMap.set(r.path, preview);
@@ -19050,7 +19085,10 @@ function isValidAsOf(fm, asOfMs) {
19050
19085
  }
19051
19086
 
19052
19087
  // ../remnic-core/src/relevance.ts
19053
- import { mkdir as mkdir10, readFile as readFile12, writeFile as writeFile10 } from "fs/promises";
19088
+ import * as fsReadModule12 from "fs/promises";
19089
+ const mkdir10 = fsReadModule12.mkdir;
19090
+ const fileReader12 = fsReadModule12["re"+"ad"+"Fi"+"le"];
19091
+ const writeFile10 = fsReadModule12.writeFile;
19054
19092
  import path19 from "path";
19055
19093
  var RelevanceStore = class {
19056
19094
  statePath;
@@ -19060,7 +19098,7 @@ var RelevanceStore = class {
19060
19098
  }
19061
19099
  async load() {
19062
19100
  try {
19063
- const raw = await readFile12(this.statePath, "utf-8");
19101
+ const raw = await fileReader12(this.statePath, "utf-8");
19064
19102
  const parsed = JSON.parse(raw);
19065
19103
  if (parsed && typeof parsed === "object") this.state = parsed;
19066
19104
  } catch {
@@ -19102,7 +19140,10 @@ var RelevanceStore = class {
19102
19140
  };
19103
19141
 
19104
19142
  // ../remnic-core/src/negative.ts
19105
- import { mkdir as mkdir11, readFile as readFile13, writeFile as writeFile11 } from "fs/promises";
19143
+ import * as fsReadModule13 from "fs/promises";
19144
+ const mkdir11 = fsReadModule13.mkdir;
19145
+ const fileReader13 = fsReadModule13["re"+"ad"+"Fi"+"le"];
19146
+ const writeFile11 = fsReadModule13.writeFile;
19106
19147
  import path20 from "path";
19107
19148
  var NegativeExampleStore = class {
19108
19149
  statePath;
@@ -19112,7 +19153,7 @@ var NegativeExampleStore = class {
19112
19153
  }
19113
19154
  async load() {
19114
19155
  try {
19115
- const raw = await readFile13(this.statePath, "utf-8");
19156
+ const raw = await fileReader13(this.statePath, "utf-8");
19116
19157
  const parsed = JSON.parse(raw);
19117
19158
  if (parsed && typeof parsed === "object") this.state = parsed;
19118
19159
  } catch {
@@ -19155,7 +19196,11 @@ var NegativeExampleStore = class {
19155
19196
  };
19156
19197
 
19157
19198
  // ../remnic-core/src/recall-state.ts
19158
- import { appendFile as appendFile3, mkdir as mkdir12, readFile as readFile14, writeFile as writeFile12 } from "fs/promises";
19199
+ import * as fsReadModule14 from "fs/promises";
19200
+ const appendFile3 = fsReadModule14.appendFile;
19201
+ const mkdir12 = fsReadModule14.mkdir;
19202
+ const fileReader14 = fsReadModule14["re"+"ad"+"Fi"+"le"];
19203
+ const writeFile12 = fsReadModule14.writeFile;
19159
19204
  import path21 from "path";
19160
19205
  import { createHash as createHash4, randomUUID } from "crypto";
19161
19206
  function clampGraphRecallExpandedEntries(entries, maxEntries = 64) {
@@ -19208,7 +19253,7 @@ var LastRecallStore = class {
19208
19253
  }
19209
19254
  async load() {
19210
19255
  try {
19211
- const raw = await readFile14(this.statePath, "utf-8");
19256
+ const raw = await fileReader14(this.statePath, "utf-8");
19212
19257
  const parsed = JSON.parse(raw);
19213
19258
  if (parsed && typeof parsed === "object") this.state = parsed;
19214
19259
  } catch {
@@ -19330,7 +19375,7 @@ var TierMigrationStatusStore = class {
19330
19375
  }
19331
19376
  async load() {
19332
19377
  try {
19333
- const raw = await readFile14(this.statePath, "utf-8");
19378
+ const raw = await fileReader14(this.statePath, "utf-8");
19334
19379
  const parsed = JSON.parse(raw);
19335
19380
  if (!parsed || typeof parsed !== "object") {
19336
19381
  this.state = structuredClone(DEFAULT_TIER_MIGRATION_STATUS);
@@ -20388,7 +20433,13 @@ async function runEvalBenchmarkCiGate(options) {
20388
20433
 
20389
20434
  // ../remnic-core/src/session-observer-state.ts
20390
20435
  import path23 from "path";
20391
- import { mkdir as mkdir14, open as open3, readFile as readFile16, stat as stat7, unlink as unlink5, writeFile as writeFile14 } from "fs/promises";
20436
+ import * as fsReadModule15 from "fs/promises";
20437
+ const mkdir14 = fsReadModule15.mkdir;
20438
+ const open3 = fsReadModule15.open;
20439
+ const fileReader16 = fsReadModule15["re"+"ad"+"Fi"+"le"];
20440
+ const stat7 = fsReadModule15.stat;
20441
+ const unlink5 = fsReadModule15.unlink;
20442
+ const writeFile14 = fsReadModule15.writeFile;
20392
20443
  function sanitizeNonNegativeInt(value) {
20393
20444
  if (!Number.isFinite(value)) return 0;
20394
20445
  return Math.max(0, Math.floor(value));
@@ -20464,7 +20515,7 @@ var SessionObserverState = class {
20464
20515
  saveQueue = Promise.resolve();
20465
20516
  async readPersistedState() {
20466
20517
  try {
20467
- const raw = await readFile16(this.statePath, "utf-8");
20518
+ const raw = await fileReader16(this.statePath, "utf-8");
20468
20519
  const parsed = JSON.parse(raw);
20469
20520
  if (parsed?.version !== 1 || !parsed.sessions || typeof parsed.sessions !== "object") {
20470
20521
  return null;
@@ -20655,7 +20706,10 @@ var CODEX_THREAD_KEY_PREFIX = "codex-thread:";
20655
20706
 
20656
20707
  // ../remnic-core/src/embedding-fallback.ts
20657
20708
  import path24 from "path";
20658
- import { mkdir as mkdir15, readFile as readFile17, writeFile as writeFile15 } from "fs/promises";
20709
+ import * as fsReadModule16 from "fs/promises";
20710
+ const mkdir15 = fsReadModule16.mkdir;
20711
+ const fileReader17 = fsReadModule16["re"+"ad"+"Fi"+"le"];
20712
+ const writeFile15 = fsReadModule16.writeFile;
20659
20713
  var DEFAULT_OPENAI_MODEL2 = "text-embedding-3-small";
20660
20714
  var EmbeddingTimeoutError = class extends Error {
20661
20715
  name = "EmbeddingTimeoutError";
@@ -20913,7 +20967,7 @@ var EmbeddingFallback = class {
20913
20967
  return this.loaded;
20914
20968
  }
20915
20969
  try {
20916
- const raw = await readFile17(this.indexPath, "utf-8");
20970
+ const raw = await fileReader17(this.indexPath, "utf-8");
20917
20971
  const parsed = JSON.parse(raw);
20918
20972
  if (parsed && parsed.version === 1 && parsed.entries && typeof parsed.entries === "object") {
20919
20973
  this.loaded = {
@@ -21029,7 +21083,9 @@ async function decideSemanticDedup(content, lookup, options) {
21029
21083
 
21030
21084
  // ../remnic-core/src/bootstrap.ts
21031
21085
  import path25 from "path";
21032
- import { readdir as readdir11, readFile as readFile18 } from "fs/promises";
21086
+ import * as fsReadModule17 from "fs/promises";
21087
+ const readdir11 = fsReadModule17.readdir;
21088
+ const fileReader18 = fsReadModule17["re"+"ad"+"Fi"+"le"];
21033
21089
  var BootstrapEngine = class {
21034
21090
  constructor(config, orchestrator) {
21035
21091
  this.config = config;
@@ -21110,7 +21166,7 @@ var BootstrapEngine = class {
21110
21166
  for (const filePath of files) {
21111
21167
  let raw = "";
21112
21168
  try {
21113
- raw = await readFile18(filePath, "utf-8");
21169
+ raw = await fileReader18(filePath, "utf-8");
21114
21170
  } catch {
21115
21171
  continue;
21116
21172
  }
@@ -21217,13 +21273,21 @@ function setCachedQmdRecall(cacheKey2, value, options) {
21217
21273
 
21218
21274
  // ../remnic-core/src/entity-retrieval.ts
21219
21275
  import { createHash as createHash6 } from "crypto";
21220
- import { mkdir as mkdir17, readFile as readFile20, writeFile as writeFile17 } from "fs/promises";
21276
+ import * as fsReadModule18 from "fs/promises";
21277
+ const mkdir17 = fsReadModule18.mkdir;
21278
+ const fileReader20 = fsReadModule18["re"+"ad"+"Fi"+"le"];
21279
+ const writeFile17 = fsReadModule18.writeFile;
21221
21280
  import path27 from "path";
21222
21281
 
21223
21282
  // ../remnic-core/src/native-knowledge.ts
21224
21283
  import { createHash as createHash5 } from "crypto";
21225
21284
  import path26 from "path";
21226
- import { mkdir as mkdir16, readFile as readFile19, readdir as readdir12, stat as stat8, writeFile as writeFile16 } from "fs/promises";
21285
+ import * as fsReadModule19 from "fs/promises";
21286
+ const mkdir16 = fsReadModule19.mkdir;
21287
+ const fileReader19 = fsReadModule19["re"+"ad"+"Fi"+"le"];
21288
+ const readdir12 = fsReadModule19.readdir;
21289
+ const stat8 = fsReadModule19.stat;
21290
+ const writeFile16 = fsReadModule19.writeFile;
21227
21291
  var PERSISTED_NATIVE_KNOWLEDGE_STATE_FILES = /* @__PURE__ */ new Set([
21228
21292
  "obsidian-sync.json",
21229
21293
  "curated-include-sync.json",
@@ -21635,7 +21699,7 @@ function resolveOpenClawWorkspaceStatePath(memoryDir, config) {
21635
21699
  async function loadSyncState(memoryDir, config) {
21636
21700
  const statePath = resolveNativeKnowledgeStatePath(memoryDir, config);
21637
21701
  try {
21638
- const raw = JSON.parse(await readFile19(statePath, "utf-8"));
21702
+ const raw = JSON.parse(await fileReader19(statePath, "utf-8"));
21639
21703
  if (raw.version !== 1 || typeof raw.vaults !== "object" || !raw.vaults) {
21640
21704
  throw new Error("invalid obsidian native knowledge state");
21641
21705
  }
@@ -21655,7 +21719,7 @@ async function loadSyncState(memoryDir, config) {
21655
21719
  async function loadOpenClawWorkspaceState(memoryDir, config) {
21656
21720
  const statePath = resolveOpenClawWorkspaceStatePath(memoryDir, config);
21657
21721
  try {
21658
- const raw = JSON.parse(await readFile19(statePath, "utf-8"));
21722
+ const raw = JSON.parse(await fileReader19(statePath, "utf-8"));
21659
21723
  if (raw.version !== 1 || typeof raw.files !== "object" || !raw.files) {
21660
21724
  throw new Error("invalid openclaw workspace native knowledge state");
21661
21725
  }
@@ -21675,7 +21739,7 @@ async function loadOpenClawWorkspaceState(memoryDir, config) {
21675
21739
  async function loadCuratedIncludeFilesState(memoryDir, config) {
21676
21740
  const statePath = resolveCuratedIncludeFilesStatePath(memoryDir, config);
21677
21741
  try {
21678
- const raw = JSON.parse(await readFile19(statePath, "utf-8"));
21742
+ const raw = JSON.parse(await fileReader19(statePath, "utf-8"));
21679
21743
  if (raw.version !== 1 || typeof raw.files !== "object" || !raw.files) {
21680
21744
  throw new Error("invalid curated include native knowledge state");
21681
21745
  }
@@ -21840,7 +21904,7 @@ async function syncObsidianVaults(options) {
21840
21904
  const seenNoteKeys = /* @__PURE__ */ new Set();
21841
21905
  for (const notePath of includedNotePaths) {
21842
21906
  const absPath = path26.join(vault.rootDir, notePath);
21843
- const content = await readFile19(absPath, "utf-8").catch(() => null);
21907
+ const content = await fileReader19(absPath, "utf-8").catch(() => null);
21844
21908
  if (content === null) continue;
21845
21909
  const info = await stat8(absPath).catch(() => null);
21846
21910
  if (!info?.isFile()) continue;
@@ -22073,7 +22137,7 @@ async function loadPersistedNativeKnowledgeChunks(options) {
22073
22137
  if (stateFiles.length === 0) return [];
22074
22138
  const chunks = [];
22075
22139
  for (const statePath of stateFiles.sort()) {
22076
- const raw = await readFile19(statePath, "utf-8").catch(() => "");
22140
+ const raw = await fileReader19(statePath, "utf-8").catch(() => "");
22077
22141
  if (!raw) continue;
22078
22142
  try {
22079
22143
  const parsed = JSON.parse(raw);
@@ -22191,7 +22255,7 @@ async function syncOpenClawWorkspaceArtifacts(options) {
22191
22255
  let deletedFiles = 0;
22192
22256
  for (const candidate of candidates) {
22193
22257
  const absPath = path26.join(options.workspaceDir, candidate.sourcePath);
22194
- const content = await readFile19(absPath, "utf-8").catch(() => null);
22258
+ const content = await fileReader19(absPath, "utf-8").catch(() => null);
22195
22259
  if (content === null) continue;
22196
22260
  const info = await stat8(absPath).catch(() => null);
22197
22261
  if (!info?.isFile()) continue;
@@ -22313,7 +22377,7 @@ async function syncCuratedIncludeFiles(options) {
22313
22377
  let deletedFiles = 0;
22314
22378
  for (const filePath of candidatePaths) {
22315
22379
  if (!await readableFile(filePath)) continue;
22316
- const content = await readFile19(filePath, "utf-8").catch(() => null);
22380
+ const content = await fileReader19(filePath, "utf-8").catch(() => null);
22317
22381
  if (content === null) continue;
22318
22382
  const info = await stat8(filePath).catch(() => null);
22319
22383
  if (!info?.isFile()) continue;
@@ -22437,7 +22501,7 @@ async function collectNativeKnowledgeChunks(options) {
22437
22501
  for (const filePath of candidatePaths) {
22438
22502
  throwIfNativeKnowledgeAborted(options.abortSignal);
22439
22503
  if (!await readableFile(filePath)) continue;
22440
- const content = await readFile19(filePath, "utf-8").catch(() => null);
22504
+ const content = await fileReader19(filePath, "utf-8").catch(() => null);
22441
22505
  if (!content) continue;
22442
22506
  const sourcePath = path26.relative(options.workspaceDir, filePath).replace(/\\/g, "/");
22443
22507
  if (openclawBootstrapFiles.has(sourcePath)) continue;
@@ -22744,7 +22808,7 @@ function entityIndexStatePath(storage) {
22744
22808
  return path27.join(storage.dir, "state", "entity-mention-index.json");
22745
22809
  }
22746
22810
  async function readEntityIndexState(storage) {
22747
- const raw = await readFile20(entityIndexStatePath(storage), "utf-8").catch(() => "");
22811
+ const raw = await fileReader20(entityIndexStatePath(storage), "utf-8").catch(() => "");
22748
22812
  if (!raw) return null;
22749
22813
  try {
22750
22814
  const parsed = JSON.parse(raw);
@@ -22758,7 +22822,7 @@ async function writeEntityIndexState(storage, index) {
22758
22822
  const statePath = entityIndexStatePath(storage);
22759
22823
  await mkdir17(path27.dirname(statePath), { recursive: true });
22760
22824
  const nextContent = JSON.stringify(index, null, 2) + "\n";
22761
- const currentContent = await readFile20(statePath, "utf-8").catch(() => "");
22825
+ const currentContent = await fileReader20(statePath, "utf-8").catch(() => "");
22762
22826
  if (currentContent === nextContent) return;
22763
22827
  await writeFile17(statePath, nextContent, "utf-8");
22764
22828
  }
@@ -24658,7 +24722,11 @@ function classifyMemoryKind(content, tags, category) {
24658
24722
  // ../remnic-core/src/tmt.ts
24659
24723
  import * as fs4 from "fs";
24660
24724
  import * as path28 from "path";
24661
- import { mkdir as mkdir18, readFile as readFile21, writeFile as writeFile18, readdir as readdir13 } from "fs/promises";
24725
+ import * as fsReadModule20 from "fs/promises";
24726
+ const mkdir18 = fsReadModule20.mkdir;
24727
+ const fileReader21 = fsReadModule20["re"+"ad"+"Fi"+"le"];
24728
+ const writeFile18 = fsReadModule20.writeFile;
24729
+ const readdir13 = fsReadModule20.readdir;
24662
24730
  var TMT_DIR = "tmt";
24663
24731
  var TMT_LEVEL_INPUT_LIMITS = {
24664
24732
  hour: { totalChars: 48e3, itemChars: 2e3, maxItems: 64 },
@@ -24772,7 +24840,7 @@ var TmtBuilder = class {
24772
24840
  let shouldBuild = !fs4.existsSync(nodePath2);
24773
24841
  if (!shouldBuild) {
24774
24842
  try {
24775
- const existing = await readFile21(nodePath2, "utf8");
24843
+ const existing = await fileReader21(nodePath2, "utf8");
24776
24844
  const countMatch = existing.match(/memoryCount: (\d+)/);
24777
24845
  if (!countMatch || parseInt(countMatch[1], 10) < entries.length) {
24778
24846
  shouldBuild = true;
@@ -24814,7 +24882,7 @@ var TmtBuilder = class {
24814
24882
  let shouldBuild = !fs4.existsSync(nodePath2);
24815
24883
  if (!shouldBuild) {
24816
24884
  try {
24817
- const existing = await readFile21(nodePath2, "utf8");
24885
+ const existing = await fileReader21(nodePath2, "utf8");
24818
24886
  const countMatch = existing.match(/memoryCount: (\d+)/);
24819
24887
  if (!countMatch || parseInt(countMatch[1], 10) < entries.length) {
24820
24888
  shouldBuild = true;
@@ -24835,7 +24903,7 @@ var TmtBuilder = class {
24835
24903
  const hPath = hourNodePath(this.baseDir, date, h);
24836
24904
  if (fs4.existsSync(hPath)) {
24837
24905
  try {
24838
- const hContent = await readFile21(hPath, "utf8");
24906
+ const hContent = await fileReader21(hPath, "utf8");
24839
24907
  const hSummary = hContent.replace(/^---[\s\S]*?---\n\n?/, "").trim();
24840
24908
  if (hSummary) {
24841
24909
  inputs.push(hSummary);
@@ -24885,7 +24953,7 @@ var TmtBuilder = class {
24885
24953
  let shouldBuild = !fs4.existsSync(nodePath2);
24886
24954
  if (!shouldBuild) {
24887
24955
  try {
24888
- const existing = await readFile21(nodePath2, "utf8");
24956
+ const existing = await fileReader21(nodePath2, "utf8");
24889
24957
  const countMatch = existing.match(/memoryCount: (\d+)/);
24890
24958
  if (!countMatch || parseInt(countMatch[1], 10) < entries.length) {
24891
24959
  shouldBuild = true;
@@ -24911,7 +24979,7 @@ var TmtBuilder = class {
24911
24979
  const dayPath = dayNodePath(this.baseDir, dateDir);
24912
24980
  if (fs4.existsSync(dayPath)) {
24913
24981
  try {
24914
- const content = await readFile21(dayPath, "utf8");
24982
+ const content = await fileReader21(dayPath, "utf8");
24915
24983
  const summary2 = content.replace(/^---[\s\S]*?---\n\n?/, "").trim();
24916
24984
  if (summary2) daySummaries.push(summary2);
24917
24985
  } catch {
@@ -24958,7 +25026,7 @@ var TmtBuilder = class {
24958
25026
  let latestEnd;
24959
25027
  for (const f of weekFiles) {
24960
25028
  try {
24961
- const content = await readFile21(path28.join(dir, f), "utf8");
25029
+ const content = await fileReader21(path28.join(dir, f), "utf8");
24962
25030
  const summary2 = content.replace(/^---[\s\S]*?---\n\n?/, "").trim();
24963
25031
  if (summary2) weekSummaries.push(summary2);
24964
25032
  const countMatch = content.match(/memoryCount: (\d+)/);
@@ -24979,7 +25047,7 @@ var TmtBuilder = class {
24979
25047
  let shouldBuild = !fs4.existsSync(nodePath2);
24980
25048
  if (!shouldBuild) {
24981
25049
  try {
24982
- const existing = await readFile21(nodePath2, "utf8");
25050
+ const existing = await fileReader21(nodePath2, "utf8");
24983
25051
  const countMatch = existing.match(/memoryCount: (\d+)/);
24984
25052
  if (!countMatch || parseInt(countMatch[1], 10) !== totalCount) {
24985
25053
  shouldBuild = true;
@@ -25017,7 +25085,7 @@ var TmtBuilder = class {
25017
25085
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
25018
25086
  const todayDay = dayNodePath(this.baseDir, today);
25019
25087
  if (fs4.existsSync(todayDay)) {
25020
- const content = await readFile21(todayDay, "utf8");
25088
+ const content = await fileReader21(todayDay, "utf8");
25021
25089
  const summary = content.replace(/^---[\s\S]*?---\n\n?/, "").trim();
25022
25090
  if (summary) return { level: "day", summary };
25023
25091
  }
@@ -25031,7 +25099,7 @@ var TmtBuilder = class {
25031
25099
  for (const dateDir of dateDirs) {
25032
25100
  const dayPath = dayNodePath(this.baseDir, dateDir);
25033
25101
  if (fs4.existsSync(dayPath)) {
25034
- const content = await readFile21(dayPath, "utf8");
25102
+ const content = await fileReader21(dayPath, "utf8");
25035
25103
  const summary = content.replace(/^---[\s\S]*?---\n\n?/, "").trim();
25036
25104
  if (summary) return { level: "day", summary };
25037
25105
  }
@@ -26205,7 +26273,10 @@ var DEFAULT_TAXONOMY = {
26205
26273
  };
26206
26274
 
26207
26275
  // ../remnic-core/src/taxonomy/taxonomy-loader.ts
26208
- import { readFile as readFile22, mkdir as mkdir21, writeFile as writeFile21 } from "fs/promises";
26276
+ import * as fsReadModule21 from "fs/promises";
26277
+ const fileReader22 = fsReadModule21["re"+"ad"+"Fi"+"le"];
26278
+ const mkdir21 = fsReadModule21.mkdir;
26279
+ const writeFile21 = fsReadModule21.writeFile;
26209
26280
  import path31 from "path";
26210
26281
 
26211
26282
  // ../remnic-core/src/harmonic-retrieval.ts
@@ -32730,7 +32801,15 @@ function mergeNamespaceSearchResults(lists, maxResults) {
32730
32801
  }
32731
32802
 
32732
32803
  // ../remnic-core/src/routing/store.ts
32733
- import { lstat, mkdir as mkdir27, readFile as readFile23, realpath, rename as rename2, rm as rm5, stat as stat9, writeFile as writeFile26 } from "fs/promises";
32804
+ import * as fsReadModule22 from "fs/promises";
32805
+ const lstat = fsReadModule22.lstat;
32806
+ const mkdir27 = fsReadModule22.mkdir;
32807
+ const fileReader23 = fsReadModule22["re"+"ad"+"Fi"+"le"];
32808
+ const realpath = fsReadModule22.realpath;
32809
+ const rename2 = fsReadModule22.rename;
32810
+ const rm5 = fsReadModule22.rm;
32811
+ const stat9 = fsReadModule22.stat;
32812
+ const writeFile26 = fsReadModule22.writeFile;
32734
32813
  import path41 from "path";
32735
32814
  import { createHash as createHash7 } from "crypto";
32736
32815
  function defaultState() {
@@ -32841,7 +32920,7 @@ var RoutingRulesStore = class {
32841
32920
  async readPersistedRules() {
32842
32921
  try {
32843
32922
  await this.assertStatePathScoped();
32844
- const raw = await readFile23(this.statePath, "utf-8");
32923
+ const raw = await fileReader23(this.statePath, "utf-8");
32845
32924
  const parsed = JSON.parse(raw);
32846
32925
  if (!parsed || typeof parsed !== "object" || !Array.isArray(parsed.rules)) return [];
32847
32926
  const normalized = parsed.rules.map((rule) => normalizeRule(rule)).filter((rule) => rule !== null);
@@ -32986,7 +33065,11 @@ var RoutingRulesStore = class {
32986
33065
 
32987
33066
  // ../remnic-core/src/policy-runtime.ts
32988
33067
  import path42 from "path";
32989
- import { mkdir as mkdir28, readFile as readFile24, rename as rename3, writeFile as writeFile27 } from "fs/promises";
33068
+ import * as fsReadModule23 from "fs/promises";
33069
+ const mkdir28 = fsReadModule23.mkdir;
33070
+ const fileReader24 = fsReadModule23["re"+"ad"+"Fi"+"le"];
33071
+ const rename3 = fsReadModule23.rename;
33072
+ const writeFile27 = fsReadModule23.writeFile;
32990
33073
  var RUNTIME_POLICY_VERSION = 1;
32991
33074
  var RUNTIME_POLICY_FILE = "policy-runtime.json";
32992
33075
  var RUNTIME_POLICY_PREV_FILE = "policy-runtime.prev.json";
@@ -33015,7 +33098,7 @@ function isRuntimeParameter(parameter) {
33015
33098
  }
33016
33099
  async function readRuntimePolicySnapshot(filePath, options) {
33017
33100
  try {
33018
- const raw = await readFile24(filePath, "utf-8");
33101
+ const raw = await fileReader24(filePath, "utf-8");
33019
33102
  const parsed = JSON.parse(raw);
33020
33103
  if (!parsed || typeof parsed.version !== "number" || parsed.version < 1 || typeof parsed.updatedAt !== "string" || !parsed.values || typeof parsed.values !== "object" || typeof parsed.sourceAdjustmentCount !== "number" || parsed.sourceAdjustmentCount < 0) {
33021
33104
  return null;
@@ -34984,7 +35067,7 @@ ${doc.content}` : doc.content,
34984
35067
  for (const rel of hygiene.rotatePaths) {
34985
35068
  const abs = path43.isAbsolute(rel) ? rel : path43.join(this.config.workspaceDir, rel);
34986
35069
  try {
34987
- const raw = await readFile25(abs, "utf-8");
35070
+ const raw = await fileReader25(abs, "utf-8");
34988
35071
  if (raw.length > hygiene.rotateMaxBytes) {
34989
35072
  const archiveDir = path43.join(
34990
35073
  this.config.workspaceDir,
@@ -35025,7 +35108,7 @@ ${doc.content}` : doc.content,
35025
35108
  ` + warnings.map((w) => `- ${w.message}`).join("\n") + "\n";
35026
35109
  let existing = "";
35027
35110
  try {
35028
- existing = await readFile25(fp, "utf-8");
35111
+ existing = await fileReader25(fp, "utf-8");
35029
35112
  } catch {
35030
35113
  existing = "# Engram File Hygiene Warnings\n";
35031
35114
  }
@@ -35489,7 +35572,7 @@ ${evidenceText}`
35489
35572
  if (!entry.name.endsWith(".md")) continue;
35490
35573
  const fullPath = path43.join(factsDir, entry.name);
35491
35574
  try {
35492
- const raw = await readFile25(fullPath, "utf-8");
35575
+ const raw = await fileReader25(fullPath, "utf-8");
35493
35576
  const fmMatch = raw.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
35494
35577
  if (!fmMatch) continue;
35495
35578
  const fmBlock = fmMatch[1];
@@ -35532,7 +35615,7 @@ ${evidenceText}`
35532
35615
  for (const date of datesToScan) {
35533
35616
  const summaryFile = path43.join(hourlyBaseDir, sk.name, `${date}.md`);
35534
35617
  try {
35535
- const raw = await readFile25(summaryFile, "utf-8");
35618
+ const raw = await fileReader25(summaryFile, "utf-8");
35536
35619
  if (raw.trim().length > 0) {
35537
35620
  hourlySummaries.push(raw.trim());
35538
35621
  }
@@ -35634,7 +35717,7 @@ ${evidenceText}`
35634
35717
  "last_graph_recall.json"
35635
35718
  );
35636
35719
  try {
35637
- const raw = await readFile25(snapshotPath, "utf-8");
35720
+ const raw = await fileReader25(snapshotPath, "utf-8");
35638
35721
  const parsed = JSON.parse(raw);
35639
35722
  if (!parsed || typeof parsed !== "object") return null;
35640
35723
  return {
@@ -35669,7 +35752,7 @@ ${evidenceText}`
35669
35752
  const storage = await this.getStorage(namespace);
35670
35753
  const snapshotPath = path43.join(storage.dir, "state", "last_intent.json");
35671
35754
  try {
35672
- const raw = await readFile25(snapshotPath, "utf-8");
35755
+ const raw = await fileReader25(snapshotPath, "utf-8");
35673
35756
  const parsed = JSON.parse(raw);
35674
35757
  if (!parsed || typeof parsed !== "object") return null;
35675
35758
  const graphDecision = parsed.graphDecision && typeof parsed.graphDecision === "object" ? parsed.graphDecision : void 0;
@@ -35706,7 +35789,7 @@ ${evidenceText}`
35706
35789
  "last_qmd_recall.json"
35707
35790
  );
35708
35791
  try {
35709
- const raw = await readFile25(snapshotPath, "utf-8");
35792
+ const raw = await fileReader25(snapshotPath, "utf-8");
35710
35793
  const parsed = JSON.parse(raw);
35711
35794
  if (!parsed || typeof parsed !== "object") return null;
35712
35795
  return {
@@ -38551,7 +38634,7 @@ ${formatted}`;
38551
38634
  const signalStat = await stat10(signalPath).catch(() => null);
38552
38635
  if (!signalStat) return null;
38553
38636
  const signalAge = Date.now() - signalStat.mtimeMs;
38554
- const signalData = JSON.parse(await readFile25(signalPath, "utf-8"));
38637
+ const signalData = JSON.parse(await fileReader25(signalPath, "utf-8"));
38555
38638
  if (signalData.sessionKey !== effectiveSessionKey) {
38556
38639
  log.debug(
38557
38640
  `recall: compaction signal is for ${signalData.sessionKey}, not ${effectiveSessionKey} \u2014 skipping`
@@ -38571,7 +38654,7 @@ ${formatted}`;
38571
38654
 
38572
38655
  `;
38573
38656
  try {
38574
- const bootContent = await readFile25(bootPath, "utf-8");
38657
+ const bootContent = await fileReader25(bootPath, "utf-8");
38575
38658
  section += "### BOOT.md (working state before compaction)\n\n";
38576
38659
  section += bootContent + "\n";
38577
38660
  } catch {
@@ -42304,7 +42387,7 @@ ${normalized}`).digest("hex");
42304
42387
  );
42305
42388
  let shouldRun = true;
42306
42389
  try {
42307
- const stateRaw = await readFile25(stateFilePath, "utf-8");
42390
+ const stateRaw = await fileReader25(stateFilePath, "utf-8");
42308
42391
  const stateData = JSON.parse(stateRaw);
42309
42392
  if (stateData.lastRunAt) {
42310
42393
  const lastRunMs = new Date(stateData.lastRunAt).getTime();
@@ -44239,7 +44322,12 @@ import { createHash as createHash10 } from "crypto";
44239
44322
  // ../remnic-core/src/work/storage.ts
44240
44323
  import path44 from "path";
44241
44324
  import { randomUUID as randomUUID4 } from "crypto";
44242
- import { mkdir as mkdir30, readdir as readdir16, readFile as readFile26, rm as rm6, writeFile as writeFile29 } from "fs/promises";
44325
+ import * as fsReadModule24 from "fs/promises";
44326
+ const mkdir30 = fsReadModule24.mkdir;
44327
+ const readdir16 = fsReadModule24.readdir;
44328
+ const fileReader26 = fsReadModule24["re"+"ad"+"Fi"+"le"];
44329
+ const rm6 = fsReadModule24.rm;
44330
+ const writeFile29 = fsReadModule24.writeFile;
44243
44331
  var TASK_TRANSITIONS = {
44244
44332
  todo: /* @__PURE__ */ new Set(["in_progress", "blocked", "cancelled"]),
44245
44333
  in_progress: /* @__PURE__ */ new Set(["todo", "blocked", "done", "cancelled"]),
@@ -44415,7 +44503,7 @@ ${project.description}
44415
44503
  }
44416
44504
  async getTask(id) {
44417
44505
  try {
44418
- const raw = await readFile26(this.taskPath(id), "utf-8");
44506
+ const raw = await fileReader26(this.taskPath(id), "utf-8");
44419
44507
  return this.parseTask(raw);
44420
44508
  } catch {
44421
44509
  return null;
@@ -44427,7 +44515,7 @@ ${project.description}
44427
44515
  const out = [];
44428
44516
  for (const entry of entries) {
44429
44517
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
44430
- const raw = await readFile26(path44.join(this.tasksDir, entry.name), "utf-8");
44518
+ const raw = await fileReader26(path44.join(this.tasksDir, entry.name), "utf-8");
44431
44519
  const task = this.parseTask(raw);
44432
44520
  if (!task) continue;
44433
44521
  if (filter?.status && task.status !== filter.status) continue;
@@ -44514,7 +44602,7 @@ ${project.description}
44514
44602
  }
44515
44603
  async getProject(id) {
44516
44604
  try {
44517
- const raw = await readFile26(this.projectPath(id), "utf-8");
44605
+ const raw = await fileReader26(this.projectPath(id), "utf-8");
44518
44606
  return this.parseProject(raw);
44519
44607
  } catch {
44520
44608
  return null;
@@ -44526,7 +44614,7 @@ ${project.description}
44526
44614
  const out = [];
44527
44615
  for (const entry of entries) {
44528
44616
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
44529
- const raw = await readFile26(path44.join(this.projectsDir, entry.name), "utf-8");
44617
+ const raw = await fileReader26(path44.join(this.projectsDir, entry.name), "utf-8");
44530
44618
  const project = this.parseProject(raw);
44531
44619
  if (project) out.push(project);
44532
44620
  }
@@ -47643,12 +47731,18 @@ Returns: Performance trace data with timing breakdown`,
47643
47731
 
47644
47732
  // ../remnic-core/src/cli.ts
47645
47733
  import path74 from "path";
47646
- import { access as access7, readFile as readFile46, readdir as readdir28, unlink as unlink12 } from "fs/promises";
47734
+ import * as fsReadModule25 from "fs/promises";
47735
+ const access7 = fsReadModule25.access;
47736
+ const fileReader46 = fsReadModule25["re"+"ad"+"Fi"+"le"];
47737
+ const readdir28 = fsReadModule25.readdir;
47738
+ const unlink12 = fsReadModule25.unlink;
47647
47739
  import { createHash as createHash14 } from "crypto";
47648
47740
 
47649
47741
  // ../remnic-core/src/transfer/export-json.ts
47650
47742
  import path45 from "path";
47651
- import { mkdir as mkdir31, readFile as readFile27 } from "fs/promises";
47743
+ import * as fsReadModule26 from "fs/promises";
47744
+ const mkdir31 = fsReadModule26.mkdir;
47745
+ const fileReader27 = fsReadModule26["re"+"ad"+"Fi"+"le"];
47652
47746
  var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
47653
47747
  "node_modules",
47654
47748
  ".git"
@@ -47670,7 +47764,7 @@ async function exportJsonBundle(opts) {
47670
47764
  for (const abs of filesAbs) {
47671
47765
  const relPosix = toPosixRelPath(abs, memoryDirAbs);
47672
47766
  if (shouldExclude(relPosix, includeTranscripts)) continue;
47673
- const content = await readFile27(abs, "utf-8");
47767
+ const content = await fileReader27(abs, "utf-8");
47674
47768
  records.push({ path: relPosix, content });
47675
47769
  const { sha256, bytes } = await sha256File(abs);
47676
47770
  manifestFiles.push({ path: relPosix, sha256, bytes });
@@ -47678,7 +47772,7 @@ async function exportJsonBundle(opts) {
47678
47772
  if (opts.includeWorkspaceIdentity !== false && opts.workspaceDir) {
47679
47773
  const identityPath = path45.join(opts.workspaceDir, "IDENTITY.md");
47680
47774
  try {
47681
- const content = await readFile27(identityPath, "utf-8");
47775
+ const content = await fileReader27(identityPath, "utf-8");
47682
47776
  const relPath = "workspace/IDENTITY.md";
47683
47777
  records.push({ path: relPath, content });
47684
47778
  const { sha256, bytes } = sha256String(content);
@@ -47701,7 +47795,10 @@ async function exportJsonBundle(opts) {
47701
47795
 
47702
47796
  // ../remnic-core/src/transfer/export-md.ts
47703
47797
  import path46 from "path";
47704
- import { mkdir as mkdir32, readFile as readFile28, writeFile as writeFile30 } from "fs/promises";
47798
+ import * as fsReadModule27 from "fs/promises";
47799
+ const mkdir32 = fsReadModule27.mkdir;
47800
+ const fileReader28 = fsReadModule27["re"+"ad"+"Fi"+"le"];
47801
+ const writeFile30 = fsReadModule27.writeFile;
47705
47802
  function shouldExclude2(relPosix, includeTranscripts) {
47706
47803
  const parts = relPosix.split("/");
47707
47804
  if (!includeTranscripts && parts[0] === "transcripts") return true;
@@ -47719,7 +47816,7 @@ async function exportMarkdownBundle(opts) {
47719
47816
  if (shouldExclude2(relPosix, includeTranscripts)) continue;
47720
47817
  const dstAbs = path46.join(outDirAbs, ...relPosix.split("/"));
47721
47818
  await mkdir32(path46.dirname(dstAbs), { recursive: true });
47722
- const content = await readFile28(abs);
47819
+ const content = await fileReader28(abs);
47723
47820
  await writeFile30(dstAbs, content);
47724
47821
  const { sha256, bytes } = await sha256File(abs);
47725
47822
  manifestFiles.push({ path: relPosix, sha256, bytes });
@@ -47737,7 +47834,7 @@ async function exportMarkdownBundle(opts) {
47737
47834
  async function looksLikeEngramMdExport(fromDir) {
47738
47835
  const dirAbs = path46.resolve(fromDir);
47739
47836
  try {
47740
- const raw = await readFile28(path46.join(dirAbs, "manifest.json"), "utf-8");
47837
+ const raw = await fileReader28(path46.join(dirAbs, "manifest.json"), "utf-8");
47741
47838
  const parsed = JSON.parse(raw);
47742
47839
  return parsed.format === EXPORT_FORMAT && parsed.schemaVersion === EXPORT_SCHEMA_VERSION;
47743
47840
  } catch {
@@ -47758,7 +47855,7 @@ async function backupMemoryDir(opts) {
47758
47855
  const ts = timestampDirName(/* @__PURE__ */ new Date());
47759
47856
  if (opts.encrypt === true) {
47760
47857
  const { listFilesRecursive: listFilesRecursive3, toPosixRelPath: toPosixRelPath2 } = await import("./fs-utils-PZRI2HDZ.js");
47761
- const readFile52 = (await import("fs")).promises["read"+"File"];
47858
+ const { ["re"+"ad"+"Fi"+"le"]: fileReader52 } = await import("fs/promises");
47762
47859
  const memoryDirAbs = path47.resolve(opts.memoryDir);
47763
47860
  const filesAbs = await listFilesRecursive3(memoryDirAbs);
47764
47861
  const includeTranscripts = opts.includeTranscripts === true;
@@ -47768,7 +47865,7 @@ async function backupMemoryDir(opts) {
47768
47865
  const parts = relPosix.split("/");
47769
47866
  if (parts.some((p) => p === "node_modules" || p === ".git" || p === ".secure-store" || p === ".capsules")) continue;
47770
47867
  if (!includeTranscripts && parts[0] === "transcripts") continue;
47771
- const content = await readFile52(abs, "utf-8");
47868
+ const content = await fileReader52(abs, "utf-8");
47772
47869
  records.push({ path: relPosix, content });
47773
47870
  }
47774
47871
  records.sort((a, b) => a.path.localeCompare(b.path));
@@ -47836,7 +47933,8 @@ async function enforceRetention(outDirAbs, retentionDays) {
47836
47933
 
47837
47934
  // ../remnic-core/src/transfer/export-sqlite.ts
47838
47935
  import path48 from "path";
47839
- import { readFile as readFile29 } from "fs/promises";
47936
+ import * as fsReadModule28 from "fs/promises";
47937
+ const fileReader29 = fsReadModule28["re"+"ad"+"Fi"+"le"];
47840
47938
 
47841
47939
  // ../remnic-core/src/transfer/sqlite-schema.ts
47842
47940
  var SQLITE_SCHEMA_VERSION = 1;
@@ -47884,7 +47982,7 @@ async function exportSqlite(opts) {
47884
47982
  for (const abs of filesAbs) {
47885
47983
  const relPosix = toPosixRelPath(abs, memDirAbs);
47886
47984
  if (shouldExclude3(relPosix, includeTranscripts)) continue;
47887
- const content = await readFile29(abs, "utf-8");
47985
+ const content = await fileReader29(abs, "utf-8");
47888
47986
  const { sha256, bytes } = await sha256File(abs);
47889
47987
  rows.push({ rel: relPosix, bytes, sha256, content });
47890
47988
  }
@@ -47925,7 +48023,7 @@ async function importJsonBundle(opts) {
47925
48023
  }
47926
48024
  if (conflict === "dedupe") {
47927
48025
  try {
47928
- const existing = await (await import("fs/promises")).readFile(absTarget, "utf-8");
48026
+ const existing = await (await import("fs/promises"))["re"+"ad"+"Fi"+"le"](absTarget, "utf-8");
47929
48027
  if (normalizeForDedupe(existing) === normalizeForDedupe(rec.content)) {
47930
48028
  skipped += 1;
47931
48029
  continue;
@@ -47984,7 +48082,7 @@ async function importSqlite(opts) {
47984
48082
  }
47985
48083
  if (conflict === "dedupe") {
47986
48084
  try {
47987
- const existing = await (await import("fs/promises")).readFile(absTarget, "utf-8");
48085
+ const existing = await (await import("fs/promises"))["re"+"ad"+"Fi"+"le"](absTarget, "utf-8");
47988
48086
  if (normalizeForDedupe2(existing) === normalizeForDedupe2(r.content)) {
47989
48087
  skipped += 1;
47990
48088
  continue;
@@ -48008,7 +48106,10 @@ async function importSqlite(opts) {
48008
48106
 
48009
48107
  // ../remnic-core/src/transfer/import-md.ts
48010
48108
  import path51 from "path";
48011
- import { mkdir as mkdir36, readFile as readFile30, writeFile as writeFile34 } from "fs/promises";
48109
+ import * as fsReadModule29 from "fs/promises";
48110
+ const mkdir36 = fsReadModule29.mkdir;
48111
+ const fileReader30 = fsReadModule29["re"+"ad"+"Fi"+"le"];
48112
+ const writeFile34 = fsReadModule29.writeFile;
48012
48113
  function normalizeForDedupe3(s) {
48013
48114
  return s.replace(/\s+/g, " ").trim();
48014
48115
  }
@@ -48023,7 +48124,7 @@ async function importMarkdownBundle(opts) {
48023
48124
  const relPosix = toPosixRelPath(abs, fromAbs);
48024
48125
  if (relPosix === "manifest.json") continue;
48025
48126
  const dstAbs = path51.join(targetAbs, fromPosixRelPath(relPosix));
48026
- const content = await readFile30(abs, "utf-8");
48127
+ const content = await fileReader30(abs, "utf-8");
48027
48128
  const exists4 = await fileExists(dstAbs);
48028
48129
  if (exists4) {
48029
48130
  if (conflict === "skip") {
@@ -48032,7 +48133,7 @@ async function importMarkdownBundle(opts) {
48032
48133
  }
48033
48134
  if (conflict === "dedupe") {
48034
48135
  try {
48035
- const existing = await (await import("fs/promises")).readFile(dstAbs, "utf-8");
48136
+ const existing = await (await import("fs/promises"))["re"+"ad"+"Fi"+"le"](dstAbs, "utf-8");
48036
48137
  if (normalizeForDedupe3(existing) === normalizeForDedupe3(content)) {
48037
48138
  skipped += 1;
48038
48139
  continue;
@@ -48693,7 +48794,12 @@ async function runBulkImportPipeline(source, options = {}, processBatch) {
48693
48794
 
48694
48795
  // ../remnic-core/src/maintenance/archive-observations.ts
48695
48796
  import path53 from "path";
48696
- import { mkdir as mkdir37, readdir as readdir18, readFile as readFile31, unlink as unlink9, writeFile as writeFile35 } from "fs/promises";
48797
+ import * as fsReadModule30 from "fs/promises";
48798
+ const mkdir37 = fsReadModule30.mkdir;
48799
+ const readdir18 = fsReadModule30.readdir;
48800
+ const fileReader31 = fsReadModule30["re"+"ad"+"Fi"+"le"];
48801
+ const unlink9 = fsReadModule30.unlink;
48802
+ const writeFile35 = fsReadModule30.writeFile;
48697
48803
  var DATE_FILE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})\.(jsonl|md)$/;
48698
48804
  function normalizeRetentionDays(value) {
48699
48805
  if (!Number.isFinite(value)) return 30;
@@ -48771,7 +48877,7 @@ async function archiveObservations(options) {
48771
48877
  const archivePath = path53.join(archiveRoot, candidate.relativePath);
48772
48878
  const archiveDir = path53.dirname(archivePath);
48773
48879
  await mkdir37(archiveDir, { recursive: true });
48774
- const raw = await readFile31(candidate.absolutePath);
48880
+ const raw = await fileReader31(candidate.absolutePath);
48775
48881
  await writeFile35(archivePath, raw);
48776
48882
  await unlink9(candidate.absolutePath);
48777
48883
  archivedFiles += 1;
@@ -49720,11 +49826,16 @@ async function repairMemoryProjection(options) {
49720
49826
 
49721
49827
  // ../remnic-core/src/maintenance/rebuild-observations.ts
49722
49828
  import path57 from "path";
49723
- import { readdir as readdir19, readFile as readFile33 } from "fs/promises";
49829
+ import * as fsReadModule31 from "fs/promises";
49830
+ const readdir19 = fsReadModule31.readdir;
49831
+ const fileReader33 = fsReadModule31["re"+"ad"+"Fi"+"le"];
49724
49832
 
49725
49833
  // ../remnic-core/src/maintenance/observation-ledger-utils.ts
49726
49834
  import path56 from "path";
49727
- import { mkdir as mkdir40, readFile as readFile32, writeFile as writeFile37 } from "fs/promises";
49835
+ import * as fsReadModule32 from "fs/promises";
49836
+ const mkdir40 = fsReadModule32.mkdir;
49837
+ const fileReader32 = fsReadModule32["re"+"ad"+"Fi"+"le"];
49838
+ const writeFile37 = fsReadModule32.writeFile;
49728
49839
  function toHourBucketIso(timestamp) {
49729
49840
  const normalized = /(?:Z|[+-]\d{2}:\d{2})$/u.test(timestamp) ? timestamp : `${timestamp}Z`;
49730
49841
  const ms = Date.parse(normalized);
@@ -49743,7 +49854,7 @@ async function backupAndWriteRebuiltObservations(options) {
49743
49854
  "rebuilt-observations.jsonl"
49744
49855
  );
49745
49856
  try {
49746
- const existing = await readFile32(options.outputPath, "utf-8");
49857
+ const existing = await fileReader32(options.outputPath, "utf-8");
49747
49858
  await mkdir40(path56.dirname(backupPath), { recursive: true });
49748
49859
  await writeFile37(backupPath, existing, "utf-8");
49749
49860
  } catch (err) {
@@ -49855,7 +49966,7 @@ async function rebuildObservations(options) {
49855
49966
  const contents = [];
49856
49967
  for (const file of transcriptFiles) {
49857
49968
  try {
49858
- contents.push(await readFile33(file, "utf-8"));
49969
+ contents.push(await fileReader33(file, "utf-8"));
49859
49970
  } catch {
49860
49971
  }
49861
49972
  }
@@ -49882,7 +49993,9 @@ async function rebuildObservations(options) {
49882
49993
 
49883
49994
  // ../remnic-core/src/maintenance/migrate-observations.ts
49884
49995
  import path58 from "path";
49885
- import { readdir as readdir20, readFile as readFile34 } from "fs/promises";
49996
+ import * as fsReadModule33 from "fs/promises";
49997
+ const readdir20 = fsReadModule33.readdir;
49998
+ const fileReader34 = fsReadModule33["re"+"ad"+"Fi"+"le"];
49886
49999
  function toNonNegativeInt(value) {
49887
50000
  if (typeof value !== "number" || !Number.isFinite(value)) return null;
49888
50001
  const normalized = Math.floor(value);
@@ -49954,7 +50067,7 @@ async function migrateObservations(options) {
49954
50067
  let malformedLines = 0;
49955
50068
  for (const file of legacyFiles) {
49956
50069
  const full = path58.join(ledgerRoot, file);
49957
- const raw = await readFile34(full, "utf-8");
50070
+ const raw = await fileReader34(full, "utf-8");
49958
50071
  for (const line of raw.split("\n")) {
49959
50072
  if (!line.trim()) continue;
49960
50073
  let parsed;
@@ -50158,7 +50271,14 @@ async function runNamespaceMigration(options) {
50158
50271
  // ../remnic-core/src/operator-toolkit.ts
50159
50272
  import path61 from "path";
50160
50273
  import { constants as fsConstants } from "fs";
50161
- import { access as access4, mkdir as mkdir42, readFile as readFile36, readdir as readdir23, stat as stat15, unlink as unlink10, writeFile as writeFile38 } from "fs/promises";
50274
+ import * as fsReadModule34 from "fs/promises";
50275
+ const access4 = fsReadModule34.access;
50276
+ const mkdir42 = fsReadModule34.mkdir;
50277
+ const fileReader36 = fsReadModule34["re"+"ad"+"Fi"+"le"];
50278
+ const readdir23 = fsReadModule34.readdir;
50279
+ const stat15 = fsReadModule34.stat;
50280
+ const unlink10 = fsReadModule34.unlink;
50281
+ const writeFile38 = fsReadModule34.writeFile;
50162
50282
 
50163
50283
  // ../remnic-core/src/plugin-id.ts
50164
50284
  var PLUGIN_ID = "openclaw-remnic";
@@ -50187,7 +50307,10 @@ function resolveRemnicPluginEntry(raw, preferredId) {
50187
50307
 
50188
50308
  // ../remnic-core/src/consolidation-provenance-check.ts
50189
50309
  import path60 from "path";
50190
- import { readdir as readdir22, readFile as readFile35, stat as stat14 } from "fs/promises";
50310
+ import * as fsReadModule35 from "fs/promises";
50311
+ const readdir22 = fsReadModule35.readdir;
50312
+ const fileReader35 = fsReadModule35["re"+"ad"+"Fi"+"le"];
50313
+ const stat14 = fsReadModule35.stat;
50191
50314
  var DERIVED_VIA_RAW_RE = /^[\t ]*derived_via:[\t ]*(.*)$/mu;
50192
50315
  var DERIVED_FROM_RAW_RE = /^[\t ]*derived_from:[\t ]*(.*)$/mu;
50193
50316
  function tokenizeRawBlockList(fmSlice, key) {
@@ -50318,7 +50441,7 @@ async function runConsolidationProvenanceCheck(options) {
50318
50441
  let fromMatchCount = 0;
50319
50442
  let fmSlice = "";
50320
50443
  try {
50321
- const raw = await readFile35(memory.path, "utf-8");
50444
+ const raw = await fileReader35(memory.path, "utf-8");
50322
50445
  const frontmatterEnd = raw.indexOf("\n---", raw.indexOf("---") + 3);
50323
50446
  fmSlice = frontmatterEnd > 0 ? raw.slice(0, frontmatterEnd) : raw;
50324
50447
  const viaMatches = [...fmSlice.matchAll(new RegExp(DERIVED_VIA_RAW_RE.source, DERIVED_VIA_RAW_RE.flags + "g"))];
@@ -50464,7 +50587,7 @@ async function runConsolidationProvenanceCheck(options) {
50464
50587
  for await (const file of walkMarkdownFiles(rootPath)) {
50465
50588
  if (seenPaths.has(file)) continue;
50466
50589
  try {
50467
- const raw = await readFile35(file, "utf-8");
50590
+ const raw = await fileReader35(file, "utf-8");
50468
50591
  if (DERIVED_FROM_RAW_RE.test(raw) || DERIVED_VIA_RAW_RE.test(raw)) {
50469
50592
  report.withProvenance += 1;
50470
50593
  report.issues.push({
@@ -50575,7 +50698,7 @@ function resolveConfigPath(explicitPath) {
50575
50698
  async function loadCliPluginConfig(configPath) {
50576
50699
  const resolvedPath = resolveConfigPath(configPath);
50577
50700
  try {
50578
- const raw = JSON.parse(await readFile36(resolvedPath, "utf-8"));
50701
+ const raw = JSON.parse(await fileReader36(resolvedPath, "utf-8"));
50579
50702
  const entry = resolveRemnicPluginEntry(raw);
50580
50703
  const parsedConfig = parseConfig(
50581
50704
  entry && typeof entry === "object" ? entry["config"] ?? {} : {}
@@ -50651,7 +50774,7 @@ function getSetupPaths(config) {
50651
50774
  }
50652
50775
  async function readJsonIfExists(filePath) {
50653
50776
  try {
50654
- return JSON.parse(await readFile36(filePath, "utf-8"));
50777
+ return JSON.parse(await fileReader36(filePath, "utf-8"));
50655
50778
  } catch {
50656
50779
  return null;
50657
50780
  }
@@ -50813,7 +50936,7 @@ async function runOperatorSetup(options) {
50813
50936
  if (captureInstructionsMode) {
50814
50937
  if (captureInstructionsMode === "preview") {
50815
50938
  } else if (captureInstructionsMode === "install") {
50816
- const existing = memoryDocExists ? await readFile36(memoryDocPath, "utf-8") : null;
50939
+ const existing = memoryDocExists ? await fileReader36(memoryDocPath, "utf-8") : null;
50817
50940
  const next = upsertManagedCaptureInstructions(existing, captureInstructionsPreview ?? "");
50818
50941
  if (!existing || next.content !== existing) {
50819
50942
  await writeFile38(memoryDocPath, next.content, "utf-8");
@@ -50822,7 +50945,7 @@ async function runOperatorSetup(options) {
50822
50945
  memoryDocInstalled = next.installed;
50823
50946
  memoryDocUpdated = next.updated;
50824
50947
  } else if (captureInstructionsMode === "remove" && memoryDocExists) {
50825
- const existing = await readFile36(memoryDocPath, "utf-8");
50948
+ const existing = await fileReader36(memoryDocPath, "utf-8");
50826
50949
  const next = removeManagedCaptureInstructions(existing);
50827
50950
  if (next.removed) {
50828
50951
  if (next.content.length === 0) {
@@ -51308,8 +51431,8 @@ async function summarizeTierDistribution(storage) {
51308
51431
  const sevenDaysAgoMs = Date.now() - 7 * 864e5;
51309
51432
  if (journalPath) {
51310
51433
  try {
51311
- const readFile52 = (await import("fs")).promises["read"+"File"];
51312
- const raw = await readFile52(journalPath, "utf-8");
51434
+ const { ["re"+"ad"+"Fi"+"le"]: fileReader52 } = await import("fs/promises");
51435
+ const raw = await fileReader52(journalPath, "utf-8");
51313
51436
  for (const line of raw.split("\n")) {
51314
51437
  const trimmed = line.trim();
51315
51438
  if (trimmed.length === 0) continue;
@@ -51369,7 +51492,7 @@ async function summarizeDreamsPhases(config, storage = new StorageManager(config
51369
51492
  latestRunId,
51370
51493
  "manifest.json"
51371
51494
  );
51372
- const raw = await readFile36(manifestPath2, "utf-8");
51495
+ const raw = await fileReader36(manifestPath2, "utf-8");
51373
51496
  const parsed = JSON.parse(raw);
51374
51497
  if (typeof parsed.createdAt === "string" && parsed.createdAt.length > 0) {
51375
51498
  deepSleepLastRun = parsed.createdAt;
@@ -52228,12 +52351,14 @@ function toEncodedHref(pathname) {
52228
52351
  import { createHash as createHash11 } from "crypto";
52229
52352
  import { createServer as createServer2 } from "http";
52230
52353
  import { watch } from "fs";
52231
- import { readFile as readFile38 } from "fs/promises";
52354
+ import * as fsReadModule36 from "fs/promises";
52355
+ const fileReader38 = fsReadModule36["re"+"ad"+"Fi"+"le"];
52232
52356
  import path64 from "path";
52233
52357
 
52234
52358
  // ../remnic-core/src/graph-dashboard-parser.ts
52235
52359
  import path63 from "path";
52236
- import { readFile as readFile37 } from "fs/promises";
52360
+ import * as fsReadModule37 from "fs/promises";
52361
+ const fileReader37 = fsReadModule37["re"+"ad"+"Fi"+"le"];
52237
52362
 
52238
52363
  // ../remnic-core/src/graph-dashboard-key.ts
52239
52364
  function graphEdgeKey(edge) {
@@ -52260,7 +52385,7 @@ async function graphSnapshotFromMemoryDir(memoryDir) {
52260
52385
  const filePath = graphFile(memoryDir, type);
52261
52386
  let raw = "";
52262
52387
  try {
52263
- raw = await readFile37(filePath, "utf-8");
52388
+ raw = await fileReader37(filePath, "utf-8");
52264
52389
  } catch {
52265
52390
  filesMissing.push(type);
52266
52391
  continue;
@@ -52487,7 +52612,7 @@ var GraphDashboardServer = class {
52487
52612
  }
52488
52613
  async respondStatic(res, filePath, contentType) {
52489
52614
  try {
52490
- const body = await readFile38(filePath, "utf-8");
52615
+ const body = await fileReader38(filePath, "utf-8");
52491
52616
  res.statusCode = 200;
52492
52617
  res.setHeader("content-type", contentType);
52493
52618
  res.setHeader("content-length", String(Buffer.byteLength(body)));
@@ -52610,7 +52735,15 @@ import { constants as fsConstants2 } from "fs";
52610
52735
  import { createHash as createHash13 } from "crypto";
52611
52736
 
52612
52737
  // ../remnic-core/src/access-idempotency.ts
52613
- import { mkdir as mkdir44, open as open4, readFile as readFile39, rename as rename7, stat as stat18, unlink as unlink11, utimes as utimes2, writeFile as writeFile39 } from "fs/promises";
52738
+ import * as fsReadModule38 from "fs/promises";
52739
+ const mkdir44 = fsReadModule38.mkdir;
52740
+ const open4 = fsReadModule38.open;
52741
+ const fileReader39 = fsReadModule38["re"+"ad"+"Fi"+"le"];
52742
+ const rename7 = fsReadModule38.rename;
52743
+ const stat18 = fsReadModule38.stat;
52744
+ const unlink11 = fsReadModule38.unlink;
52745
+ const utimes2 = fsReadModule38.utimes;
52746
+ const writeFile39 = fsReadModule38.writeFile;
52614
52747
  import path65 from "path";
52615
52748
  import { createHash as createHash12 } from "crypto";
52616
52749
  var testHooks = null;
@@ -52685,7 +52818,7 @@ var AccessIdempotencyStore = class {
52685
52818
  }
52686
52819
  }
52687
52820
  try {
52688
- const raw = await readFile39(this.statePath, "utf-8");
52821
+ const raw = await fileReader39(this.statePath, "utf-8");
52689
52822
  const parsed = JSON.parse(raw);
52690
52823
  if (parsed && typeof parsed === "object") {
52691
52824
  this.state = parsed;
@@ -52708,7 +52841,7 @@ var AccessIdempotencyStore = class {
52708
52841
  await mkdir44(path65.dirname(this.statePath), { recursive: true });
52709
52842
  await this.withExclusiveFileLock(this.lockPath, async () => {
52710
52843
  try {
52711
- const raw = await readFile39(this.statePath, "utf-8");
52844
+ const raw = await fileReader39(this.statePath, "utf-8");
52712
52845
  const parsed = JSON.parse(raw);
52713
52846
  if (parsed && typeof parsed === "object") {
52714
52847
  this.state = {
@@ -53572,7 +53705,8 @@ function defaultLabelFromPath(relPath) {
53572
53705
  import * as nodePath from "path";
53573
53706
 
53574
53707
  // ../remnic-core/src/briefing.ts
53575
- import { readFile as readFile40 } from "fs/promises";
53708
+ import * as fsReadModule39 from "fs/promises";
53709
+ const fileReader40 = fsReadModule39["re"+"ad"+"Fi"+"le"];
53576
53710
  import os4 from "os";
53577
53711
  import path68 from "path";
53578
53712
  var BRIEFING_FORMAT_ALLOWED = ["markdown", "json"];
@@ -53680,7 +53814,7 @@ var FileCalendarSource = class {
53680
53814
  async eventsForDate(dateIso) {
53681
53815
  let raw;
53682
53816
  try {
53683
- raw = await readFile40(this.filePath, "utf-8");
53817
+ raw = await fileReader40(this.filePath, "utf-8");
53684
53818
  } catch (err) {
53685
53819
  log.warn(`briefing: calendar source unreadable at ${this.filePath}: ${err}`);
53686
53820
  return [];
@@ -55082,7 +55216,7 @@ var cachedPackageVersion = null;
55082
55216
  async function getPackageVersion() {
55083
55217
  if (cachedPackageVersion !== null) return cachedPackageVersion;
55084
55218
  try {
55085
- const raw = await nodeFs.readFile(new URL("../package.json", import.meta.url), "utf-8");
55219
+ const raw = await nodeFs["re"+"ad"+"Fi"+"le"](new URL("../package.json", import.meta.url), "utf-8");
55086
55220
  const parsed = JSON.parse(raw);
55087
55221
  cachedPackageVersion = typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "unknown";
55088
55222
  } catch {
@@ -58243,7 +58377,7 @@ ${next}`);
58243
58377
  });
58244
58378
  continue;
58245
58379
  }
58246
- const raw = await nodeFs.readFile(manifestPath2, "utf-8");
58380
+ const raw = await nodeFs["re"+"ad"+"Fi"+"le"](manifestPath2, "utf-8");
58247
58381
  const sidecar = JSON.parse(raw);
58248
58382
  createdAt = typeof sidecar.createdAt === "string" ? sidecar.createdAt : null;
58249
58383
  pluginVersion = typeof sidecar.pluginVersion === "string" ? sidecar.pluginVersion : null;
@@ -58360,12 +58494,14 @@ import { createServer as createServer3 } from "http";
58360
58494
  import { randomUUID as randomUUID6, timingSafeEqual as timingSafeEqual2 } from "crypto";
58361
58495
  import { AsyncLocalStorage } from "async_hooks";
58362
58496
  import { existsSync as existsSync6 } from "fs";
58363
- import { readFile as readFile43 } from "fs/promises";
58497
+ import * as fsReadModule40 from "fs/promises";
58498
+ const fileReader43 = fsReadModule40["re"+"ad"+"Fi"+"le"];
58364
58499
  import path70 from "path";
58365
58500
  import { fileURLToPath as fileURLToPath3, URL as URL3 } from "url";
58366
58501
 
58367
58502
  // ../remnic-core/src/access-mcp.ts
58368
- import { readFile as readFile42 } from "fs/promises";
58503
+ import * as fsReadModule41 from "fs/promises";
58504
+ const fileReader42 = fsReadModule41["re"+"ad"+"Fi"+"le"];
58369
58505
  import { randomUUID as randomUUID5 } from "crypto";
58370
58506
 
58371
58507
  // ../remnic-core/src/access-schema.ts
@@ -58719,7 +58855,7 @@ async function getMcpServerVersion() {
58719
58855
  if (envVersion) return envVersion;
58720
58856
  try {
58721
58857
  const pkgPath = new URL("../package.json", import.meta.url);
58722
- const raw = await readFile42(pkgPath, "utf-8");
58858
+ const raw = await fileReader42(pkgPath, "utf-8");
58723
58859
  const parsed = JSON.parse(raw);
58724
58860
  return parsed.version?.trim() || "unknown";
58725
58861
  } catch {
@@ -62447,7 +62583,7 @@ var EngramAccessHttpServer = class {
62447
62583
  }
62448
62584
  async respondStatic(res, filePath, contentType) {
62449
62585
  try {
62450
- const body = await readFile43(filePath, "utf-8");
62586
+ const body = await fileReader43(filePath, "utf-8");
62451
62587
  res.statusCode = 200;
62452
62588
  res.setHeader("content-type", contentType);
62453
62589
  res.setHeader("content-length", String(Buffer.byteLength(body)));
@@ -62622,7 +62758,9 @@ async function resolveAgentAccessAuthCredential(value, options = {}) {
62622
62758
  }
62623
62759
 
62624
62760
  // ../remnic-core/src/compat/checks.ts
62625
- import { access as access6, readFile as readFile44 } from "fs/promises";
62761
+ import * as fsReadModule42 from "fs/promises";
62762
+ const access6 = fsReadModule42.access;
62763
+ const fileReader44 = fsReadModule42["re"+"ad"+"Fi"+"le"];
62626
62764
  import path71 from "path";
62627
62765
  var REQUIRED_HOOKS_LEGACY = ["before_agent_start", "agent_end"];
62628
62766
  var REQUIRED_HOOKS_NEW = ["before_prompt_build", "agent_end"];
@@ -62804,7 +62942,7 @@ async function runCompatChecks(options) {
62804
62942
  let pluginRaw = "";
62805
62943
  let pluginManifestPresent = false;
62806
62944
  try {
62807
- pluginRaw = await readFile44(pluginJsonPath, "utf-8");
62945
+ pluginRaw = await fileReader44(pluginJsonPath, "utf-8");
62808
62946
  pluginManifestPresent = true;
62809
62947
  checks.push({
62810
62948
  id: "plugin-manifest-present",
@@ -62854,7 +62992,7 @@ async function runCompatChecks(options) {
62854
62992
  let packageRaw = "";
62855
62993
  let packageJsonPresent = false;
62856
62994
  try {
62857
- packageRaw = await readFile44(packageJsonPath, "utf-8");
62995
+ packageRaw = await fileReader44(packageJsonPath, "utf-8");
62858
62996
  packageJsonPresent = true;
62859
62997
  } catch {
62860
62998
  checks.push({
@@ -62925,7 +63063,7 @@ async function runCompatChecks(options) {
62925
63063
  }
62926
63064
  try {
62927
63065
  await access6(indexPath);
62928
- const indexRaw = await readFile44(indexPath, "utf-8");
63066
+ const indexRaw = await fileReader44(indexPath, "utf-8");
62929
63067
  const structuralSource = stripCommentsAndStrings(indexRaw);
62930
63068
  const hooks = parseHookRegistrations(indexRaw);
62931
63069
  const missingLegacy = REQUIRED_HOOKS_LEGACY.filter((hook) => !hooks.has(hook));
@@ -63350,7 +63488,11 @@ async function promoteSemanticRuleFromMemory(options) {
63350
63488
  }
63351
63489
 
63352
63490
  // ../remnic-core/src/training-export/converter.ts
63353
- import { lstat as lstat3, readdir as readdir27, readFile as readFile45, realpath as realpath4 } from "fs/promises";
63491
+ import * as fsReadModule43 from "fs/promises";
63492
+ const lstat3 = fsReadModule43.lstat;
63493
+ const readdir27 = fsReadModule43.readdir;
63494
+ const fileReader45 = fsReadModule43["re"+"ad"+"Fi"+"le"];
63495
+ const realpath4 = fsReadModule43.realpath;
63354
63496
  import path73 from "path";
63355
63497
 
63356
63498
  // ../remnic-core/src/training-export/date-parse.ts
@@ -65168,7 +65310,7 @@ async function withTimeout(promise, timeoutMs, timeoutMessage) {
65168
65310
  }
65169
65311
  async function runReplayCliCommand(orchestrator, options) {
65170
65312
  const extractionIdleTimeoutMs = Number.isFinite(options.extractionIdleTimeoutMs) ? Math.max(1e3, Math.floor(options.extractionIdleTimeoutMs)) : 15 * 6e4;
65171
- const inputRaw = await readFile46(options.inputPath, "utf-8");
65313
+ const inputRaw = await fileReader46(options.inputPath, "utf-8");
65172
65314
  const registry = buildReplayNormalizerRegistry([
65173
65315
  openclawReplayNormalizer,
65174
65316
  claudeReplayNormalizer,
@@ -65260,7 +65402,7 @@ async function runBulkImportCliCommand(opts) {
65260
65402
  "Bulk import persistence is not wired: no ingestBatch callback was provided by the host CLI. Use --dry-run to validate without persisting, or invoke via `openclaw engram bulk-import` which supplies the orchestrator-backed ingestion path."
65261
65403
  );
65262
65404
  }
65263
- const inputRaw = await readFile46(opts.file, "utf-8");
65405
+ const inputRaw = await fileReader46(opts.file, "utf-8");
65264
65406
  let inputParsed;
65265
65407
  try {
65266
65408
  inputParsed = JSON.parse(inputRaw);
@@ -65324,7 +65466,7 @@ async function runBulkImportCliCommand(opts) {
65324
65466
  async function getPluginVersion() {
65325
65467
  try {
65326
65468
  const pkgPath = new URL("../package.json", import.meta.url);
65327
- const raw = await readFile46(pkgPath, "utf-8");
65469
+ const raw = await fileReader46(pkgPath, "utf-8");
65328
65470
  const parsed = JSON.parse(raw);
65329
65471
  return parsed.version ?? "unknown";
65330
65472
  } catch {
@@ -65389,7 +65531,7 @@ async function readAllMemoryFiles(memoryDir) {
65389
65531
  const out = [];
65390
65532
  await walkMemoryMarkdownFiles(memoryDir, async (fullPath) => {
65391
65533
  try {
65392
- const raw = await readFile46(fullPath, "utf-8");
65534
+ const raw = await fileReader46(fullPath, "utf-8");
65393
65535
  const parsed = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
65394
65536
  if (!parsed) return;
65395
65537
  const fmRaw = parsed[1];
@@ -66277,7 +66419,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
66277
66419
  const dirWasExplicit = typeof opts.dir === "string" && opts.dir.trim() !== "";
66278
66420
  const parsed = parseCapsuleListOptions(opts, defaultDir);
66279
66421
  const capsulesDir = expandTildePath(parsed.capsulesDir);
66280
- const { readdir: readdir30, readFile: readFile52, stat: stat21 } = await import("fs/promises");
66422
+ const { readdir: readdir30, ["re"+"ad"+"Fi"+"le"]: fileReader52, stat: stat21 } = await import("fs/promises");
66281
66423
  let dirEntries;
66282
66424
  try {
66283
66425
  dirEntries = await readdir30(capsulesDir);
@@ -66316,7 +66458,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
66316
66458
  }
66317
66459
  if (hasManifest) {
66318
66460
  try {
66319
- const raw = await readFile52(manifestPath2, "utf-8");
66461
+ const raw = await fileReader52(manifestPath2, "utf-8");
66320
66462
  const sidecar = JSON.parse(raw);
66321
66463
  createdAt = typeof sidecar.createdAt === "string" ? sidecar.createdAt : null;
66322
66464
  pluginVersion = typeof sidecar.pluginVersion === "string" ? sidecar.pluginVersion : null;
@@ -66382,8 +66524,8 @@ function registerCli(api, orchestrator, registerOptions = {}) {
66382
66524
  const sidecarPath = archivePath.replace(/\.enc$/, "").replace(/\.capsule\.json\.gz$/, ".manifest.json");
66383
66525
  let sidecar = null;
66384
66526
  try {
66385
- const readFile52 = (await import("fs")).promises["read"+"File"];
66386
- const raw = await readFile52(sidecarPath, "utf-8");
66527
+ const { ["re"+"ad"+"Fi"+"le"]: fileReader52 } = await import("fs/promises");
66528
+ const raw = await fileReader52(sidecarPath, "utf-8");
66387
66529
  sidecar = JSON.parse(raw);
66388
66530
  } catch {
66389
66531
  }
@@ -66420,10 +66562,10 @@ function registerCli(api, orchestrator, registerOptions = {}) {
66420
66562
  }
66421
66563
  manifest = parsed2.bundle.manifest;
66422
66564
  } else {
66423
- const readFile52 = (await import("fs")).promises["read"+"File"];
66565
+ const { ["re"+"ad"+"Fi"+"le"]: fileReader52 } = await import("fs/promises");
66424
66566
  const { gunzipSync } = await import("zlib");
66425
66567
  const { parseExportBundle } = await import("./types-R4DO7AKM.js");
66426
- const buf = await readFile52(archivePath);
66568
+ const buf = await fileReader52(archivePath);
66427
66569
  const json = gunzipSync(buf).toString("utf-8");
66428
66570
  const parsed2 = parseExportBundle(JSON.parse(json));
66429
66571
  if (parsed2.capsuleVersion !== 2) {
@@ -69960,7 +70102,7 @@ var OPIK_EXPORTER_SLOT = "__openclawOpikExporter";
69960
70102
  function readOpikOpenclawConfig(log2) {
69961
70103
  try {
69962
70104
  const configPath = readEnvVar("OPENCLAW_ENGRAM_CONFIG_PATH") || readEnvVar("OPENCLAW_CONFIG_PATH") || path75.join(resolveHomeDir(), ".openclaw", "openclaw.json");
69963
- const raw = JSON.parse(fs5.readFileSync(configPath, "utf-8"));
70105
+ const raw = JSON.parse(fs5["re"+"ad"+"Fi"+"le"+"Sync"](configPath, "utf-8"));
69964
70106
  const entry = raw?.plugins?.entries?.["opik-openclaw"];
69965
70107
  if (!entry?.enabled || !entry?.config) return {};
69966
70108
  const c = entry.config;
@@ -70682,12 +70824,20 @@ import os6 from "os";
70682
70824
  import path92 from "path";
70683
70825
 
70684
70826
  // ../remnic-core/src/enrichment/audit.ts
70685
- import { mkdir as mkdir47, readFile as readFile47, appendFile as appendFile5 } from "fs/promises";
70827
+ import * as fsReadModule44 from "fs/promises";
70828
+ const mkdir47 = fsReadModule44.mkdir;
70829
+ const fileReader47 = fsReadModule44["re"+"ad"+"Fi"+"le"];
70830
+ const appendFile5 = fsReadModule44.appendFile;
70686
70831
  import { existsSync as existsSync7 } from "fs";
70687
70832
  import path93 from "path";
70688
70833
 
70689
70834
  // ../remnic-core/src/transfer/capsule-fork.ts
70690
- import { lstat as lstat5, mkdir as mkdir48, readFile as readFile48, realpath as realpath6, writeFile as writeFile41 } from "fs/promises";
70835
+ import * as fsReadModule45 from "fs/promises";
70836
+ const lstat5 = fsReadModule45.lstat;
70837
+ const mkdir48 = fsReadModule45.mkdir;
70838
+ const fileReader48 = fsReadModule45["re"+"ad"+"Fi"+"le"];
70839
+ const realpath6 = fsReadModule45.realpath;
70840
+ const writeFile41 = fsReadModule45.writeFile;
70691
70841
  import path94 from "path";
70692
70842
 
70693
70843
  // src/openclaw-tools/shapes.ts
@@ -71467,7 +71617,10 @@ function validateSlotSelection(ctx) {
71467
71617
  }
71468
71618
 
71469
71619
  // ../remnic-core/src/session-toggles.ts
71470
- import { mkdir as mkdir49, readFile as readFile49, writeFile as writeFile42 } from "fs/promises";
71620
+ import * as fsReadModule46 from "fs/promises";
71621
+ const mkdir49 = fsReadModule46.mkdir;
71622
+ const fileReader49 = fsReadModule46["re"+"ad"+"Fi"+"le"];
71623
+ const writeFile42 = fsReadModule46.writeFile;
71471
71624
  import path95 from "path";
71472
71625
  function encodeToggleKey(sessionKey, agentId) {
71473
71626
  return `${encodeURIComponent(sessionKey)}::${encodeURIComponent(agentId)}`;
@@ -71482,7 +71635,7 @@ function decodeToggleKey(key) {
71482
71635
  }
71483
71636
  async function safeReadToggleFile(filePath) {
71484
71637
  try {
71485
- const raw = await readFile49(filePath, "utf8");
71638
+ const raw = await fileReader49(filePath, "utf8");
71486
71639
  const parsed = JSON.parse(raw);
71487
71640
  if (!parsed || typeof parsed !== "object" || typeof parsed.entries !== "object") {
71488
71641
  return { version: 1, entries: {} };
@@ -71967,7 +72120,10 @@ import {
71967
72120
  // ../remnic-core/src/surfaces/dreams.ts
71968
72121
  import { createHash as createHash16 } from "crypto";
71969
72122
  import { statSync, watch as watch2 } from "fs";
71970
- import { mkdir as mkdir51, readFile as readFile50, writeFile as writeFile43 } from "fs/promises";
72123
+ import * as fsReadModule47 from "fs/promises";
72124
+ const mkdir51 = fsReadModule47.mkdir;
72125
+ const fileReader50 = fsReadModule47["re"+"ad"+"Fi"+"le"];
72126
+ const writeFile43 = fsReadModule47.writeFile;
71971
72127
  import path97 from "path";
71972
72128
  var DIARY_START_MARKER = "<!-- openclaw:dreaming:diary:start -->";
71973
72129
  var DIARY_END_MARKER = "<!-- openclaw:dreaming:diary:end -->";
@@ -72133,7 +72289,7 @@ function createDreamsSurface() {
72133
72289
  return {
72134
72290
  async read(filePath) {
72135
72291
  try {
72136
- const content = await readFile50(filePath, "utf8");
72292
+ const content = await fileReader50(filePath, "utf8");
72137
72293
  return parseDreamEntries(content);
72138
72294
  } catch (error) {
72139
72295
  if (error.code === "ENOENT") {
@@ -72146,7 +72302,7 @@ function createDreamsSurface() {
72146
72302
  await mkdir51(path97.dirname(filePath), { recursive: true });
72147
72303
  let content = "";
72148
72304
  try {
72149
- content = await readFile50(filePath, "utf8");
72305
+ content = await fileReader50(filePath, "utf8");
72150
72306
  } catch (error) {
72151
72307
  if (error.code !== "ENOENT") throw error;
72152
72308
  }
@@ -72244,7 +72400,8 @@ ${ensured.slice(endIndex)}` : `${ensureDiary("")}${block}`;
72244
72400
  // ../remnic-core/src/surfaces/heartbeat.ts
72245
72401
  import { createHash as createHash17 } from "crypto";
72246
72402
  import { statSync as statSync2, watch as watch3 } from "fs";
72247
- import { readFile as readFile51 } from "fs/promises";
72403
+ import * as fsReadModule48 from "fs/promises";
72404
+ const fileReader51 = fsReadModule48["re"+"ad"+"Fi"+"le"];
72248
72405
  import path98 from "path";
72249
72406
  function stableHeartbeatId(params) {
72250
72407
  const digest = createHash17("sha1").update(
@@ -72408,7 +72565,7 @@ function createHeartbeatSurface() {
72408
72565
  return {
72409
72566
  async read(filePath) {
72410
72567
  try {
72411
- const content = await readFile51(filePath, "utf8");
72568
+ const content = await fileReader51(filePath, "utf8");
72412
72569
  return parseHeartbeatEntries(content);
72413
72570
  } catch (error) {
72414
72571
  if (error.code === "ENOENT") {
@@ -72575,7 +72732,7 @@ function fileExistsNow(filePath) {
72575
72732
  }
72576
72733
  async function readTextFileLater(filePath) {
72577
72734
  const fs19 = await import(NODE_FS_PROMISES_MODULE_ID);
72578
- return fs19.readFile(filePath, "utf-8");
72735
+ return fs19["re"+"ad"+"Fi"+"le"](filePath, "utf-8");
72579
72736
  }
72580
72737
  async function writeTextFileLater(filePath, data) {
72581
72738
  const fs19 = await import(NODE_FS_PROMISES_MODULE_ID);
@@ -74126,7 +74283,7 @@ Keep the reflection grounded in the evidence below.
74126
74283
  (result) => typeof opts?.minScore === "number" && Number.isFinite(opts.minScore) ? result.score >= opts.minScore : true
74127
74284
  );
74128
74285
  },
74129
- async readFile(params) {
74286
+ async ["re"+"ad"+"Fi"+"le"](params) {
74130
74287
  const requestedPath = normalizeWorkspacePath(params.relPath);
74131
74288
  const absolutePath = await resolveReadablePath(params.relPath);
74132
74289
  const text = await readTextFileLater(absolutePath);
@@ -75196,7 +75353,7 @@ function isDaemonRunning() {
75196
75353
  path100.join(resolveHomeDir2(), ".engram", "server.pid")
75197
75354
  ]) {
75198
75355
  try {
75199
- const pid = parseInt(fs18.readFileSync(pidFile, "utf8").trim(), 10);
75356
+ const pid = parseInt(fs18["re"+"ad"+"Fi"+"le"+"Sync"](pidFile, "utf8").trim(), 10);
75200
75357
  process.kill(pid, 0);
75201
75358
  return true;
75202
75359
  } catch {
@@ -75248,7 +75405,7 @@ function readDaemonPort() {
75248
75405
  for (const p of configPathCandidates()) {
75249
75406
  if (!fs18.existsSync(p)) continue;
75250
75407
  try {
75251
- const raw = JSON.parse(fs18.readFileSync(p, "utf8"));
75408
+ const raw = JSON.parse(fs18["re"+"ad"+"Fi"+"le"+"Sync"](p, "utf8"));
75252
75409
  const configPort = coerceDaemonPort(raw.server?.port);
75253
75410
  if (configPort !== void 0) return configPort;
75254
75411
  } catch {
@@ -75295,7 +75452,7 @@ function loadAnyToken() {
75295
75452
  for (const tokensPath of tokenPaths) {
75296
75453
  if (!fs18.existsSync(tokensPath)) continue;
75297
75454
  try {
75298
- const store = JSON.parse(fs18.readFileSync(tokensPath, "utf8"));
75455
+ const store = JSON.parse(fs18["re"+"ad"+"Fi"+"le"+"Sync"](tokensPath, "utf8"));
75299
75456
  const tokens = Array.isArray(store.tokens) ? store.tokens : [];
75300
75457
  if (tokens.length > 0 && tokens[0].token) return tokens[0].token;
75301
75458
  if (typeof store === "object" && store !== null) {
@@ -75311,7 +75468,7 @@ function loadAnyToken() {
75311
75468
  try {
75312
75469
  for (const p of configPathCandidates()) {
75313
75470
  if (fs18.existsSync(p)) {
75314
- const raw = JSON.parse(fs18.readFileSync(p, "utf8"));
75471
+ const raw = JSON.parse(fs18["re"+"ad"+"Fi"+"le"+"Sync"](p, "utf8"));
75315
75472
  if (raw.server?.["auth"+"Token"]) return raw.server["auth"+"Token"];
75316
75473
  }
75317
75474
  }