@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.
@@ -3,7 +3,11 @@ import {
3
3
  } from "./chunk-UFU5GGGA.js";
4
4
 
5
5
  // ../remnic-core/src/boxes.ts
6
- import { mkdir, writeFile, readFile, readdir } from "fs/promises";
6
+ import * as fsReadModule0 from "fs/promises";
7
+ const mkdir = fsReadModule0.mkdir;
8
+ const writeFile = fsReadModule0.writeFile;
9
+ const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
10
+ const readdir = fsReadModule0.readdir;
7
11
  import path from "path";
8
12
  import { createHash } from "crypto";
9
13
  var BOX_DIR = "boxes";
@@ -102,7 +106,7 @@ var BoxBuilder = class {
102
106
  if (this.stateLoaded) return;
103
107
  this.stateLoaded = true;
104
108
  try {
105
- const raw = await readFile(this.openBoxStatePath, "utf-8");
109
+ const raw = await fileReader(this.openBoxStatePath, "utf-8");
106
110
  this.openBox = JSON.parse(raw);
107
111
  } catch {
108
112
  this.openBox = null;
@@ -121,7 +125,7 @@ var BoxBuilder = class {
121
125
  }
122
126
  async loadTraceIndex() {
123
127
  try {
124
- const raw = await readFile(this.tracesPath, "utf-8");
128
+ const raw = await fileReader(this.tracesPath, "utf-8");
125
129
  const parsed = JSON.parse(raw);
126
130
  parsed.traceLastSeen ??= {};
127
131
  return parsed;
@@ -310,7 +314,7 @@ var BoxBuilder = class {
310
314
  const results = await Promise.all(
311
315
  files.map(async (f) => {
312
316
  try {
313
- const raw = await readFile(path.join(dir, f), "utf-8");
317
+ const raw = await fileReader(path.join(dir, f), "utf-8");
314
318
  const parsed = parseBoxFrontmatter(raw);
315
319
  return parsed && new Date(parsed.sealedAt) >= cutoff ? parsed : null;
316
320
  } catch {
@@ -329,7 +333,7 @@ var BoxBuilder = class {
329
333
  await readDir(full);
330
334
  } else if (e.name.endsWith(".md")) {
331
335
  try {
332
- const raw = await readFile(full, "utf-8");
336
+ const raw = await fileReader(full, "utf-8");
333
337
  const parsed = parseBoxFrontmatter(raw);
334
338
  if (parsed && new Date(parsed.sealedAt) >= cutoff) boxes.push(parsed);
335
339
  } catch {
@@ -15,11 +15,22 @@ import {
15
15
 
16
16
  // ../remnic-core/src/compounding/engine.ts
17
17
  import { createHash } from "crypto";
18
- import { mkdir as mkdir2, readFile as readFile2, readdir as readdir2, unlink, writeFile as writeFile2 } from "fs/promises";
18
+ import * as fsReadModule0 from "fs/promises";
19
+ const mkdir2 = fsReadModule0.mkdir;
20
+ const fileReader2 = fsReadModule0["re"+"ad"+"Fi"+"le"];
21
+ const readdir2 = fsReadModule0.readdir;
22
+ const unlink = fsReadModule0.unlink;
23
+ const writeFile2 = fsReadModule0.writeFile;
19
24
  import path2 from "path";
20
25
 
21
26
  // ../remnic-core/src/shared-context/manager.ts
22
- import { mkdir, readFile, readdir, appendFile, writeFile, stat } from "fs/promises";
27
+ import * as fsReadModule1 from "fs/promises";
28
+ const mkdir = fsReadModule1.mkdir;
29
+ const fileReader = fsReadModule1["re"+"ad"+"Fi"+"le"];
30
+ const readdir = fsReadModule1.readdir;
31
+ const appendFile = fsReadModule1.appendFile;
32
+ const writeFile = fsReadModule1.writeFile;
33
+ const stat = fsReadModule1.stat;
23
34
  import path from "path";
24
35
  var SharedFeedbackEntrySchema = external_exports.object({
25
36
  agent: external_exports.string().min(1),
@@ -326,7 +337,7 @@ var SharedContextManager = class {
326
337
  }
327
338
  async readPriorities() {
328
339
  try {
329
- return await readFile(this.prioritiesPath, "utf-8");
340
+ return await fileReader(this.prioritiesPath, "utf-8");
330
341
  } catch {
331
342
  return "";
332
343
  }
@@ -336,7 +347,7 @@ var SharedContextManager = class {
336
347
  const files = (await readdir(this.roundtableDir)).filter((f) => f.endsWith(".md")).sort().reverse();
337
348
  const fp = files[0] ? path.join(this.roundtableDir, files[0]) : null;
338
349
  if (!fp) return "";
339
- return await readFile(fp, "utf-8");
350
+ return await fileReader(fp, "utf-8");
340
351
  } catch {
341
352
  return "";
342
353
  }
@@ -346,7 +357,7 @@ var SharedContextManager = class {
346
357
  const files = (await readdir(this.crossSignalsDir)).filter((f) => f.endsWith(".md")).sort().reverse();
347
358
  const fp = files[0] ? path.join(this.crossSignalsDir, files[0]) : null;
348
359
  if (!fp) return "";
349
- return await readFile(fp, "utf-8");
360
+ return await fileReader(fp, "utf-8");
350
361
  } catch {
351
362
  return "";
352
363
  }
@@ -398,7 +409,7 @@ title: ${opts.title.replace(/\n/g, " ").slice(0, 200)}
398
409
  const files = (await readdir(dayDir)).filter((f) => f.endsWith(".md")).sort();
399
410
  for (const f of files) {
400
411
  const p = path.join(dayDir, f);
401
- const raw = await readFile(p, "utf-8");
412
+ const raw = await fileReader(p, "utf-8");
402
413
  const title = (raw.match(/^title:\s*(.+)$/m)?.[1] ?? f).trim();
403
414
  outputs.push({ agent: a.name, path: p, title, raw });
404
415
  }
@@ -409,7 +420,7 @@ title: ${opts.title.replace(/\n/g, " ").slice(0, 200)}
409
420
  }
410
421
  const feedback = [];
411
422
  try {
412
- const raw = await readFile(this.feedbackInboxPath, "utf-8");
423
+ const raw = await fileReader(this.feedbackInboxPath, "utf-8");
413
424
  for (const line of raw.split("\n")) {
414
425
  if (!line.trim()) continue;
415
426
  try {
@@ -1096,7 +1107,7 @@ var CompoundingEngine = class {
1096
1107
  }
1097
1108
  async readMistakes() {
1098
1109
  try {
1099
- const raw = await readFile2(this.mistakesPath, "utf-8");
1110
+ const raw = await fileReader2(this.mistakesPath, "utf-8");
1100
1111
  const parsed = JSON.parse(raw);
1101
1112
  if (!parsed || !Array.isArray(parsed.patterns)) return null;
1102
1113
  if (!Array.isArray(parsed.registry)) {
@@ -1130,7 +1141,7 @@ var CompoundingEngine = class {
1130
1141
  }
1131
1142
  async readRubrics() {
1132
1143
  try {
1133
- const raw = await readFile2(this.rubricsIndexPath, "utf-8");
1144
+ const raw = await fileReader2(this.rubricsIndexPath, "utf-8");
1134
1145
  const parsed = JSON.parse(raw);
1135
1146
  if (!parsed || !Array.isArray(parsed.agents) || !Array.isArray(parsed.workflows)) return null;
1136
1147
  parsed.agents = parsed.agents.map((entry) => this.normalizeRubricEntry(entry));
@@ -1142,7 +1153,7 @@ var CompoundingEngine = class {
1142
1153
  }
1143
1154
  async readWeeklyArtifact(weekId) {
1144
1155
  try {
1145
- const raw = await readFile2(path2.join(this.weeklyDir, `${weekId}.json`), "utf-8");
1156
+ const raw = await fileReader2(path2.join(this.weeklyDir, `${weekId}.json`), "utf-8");
1146
1157
  const parsed = JSON.parse(raw);
1147
1158
  if (!parsed || parsed.weekId !== weekId || !Array.isArray(parsed.promotionCandidates)) {
1148
1159
  return null;
@@ -1205,7 +1216,7 @@ var CompoundingEngine = class {
1205
1216
  async readFeedbackEntriesForWeek(weekId) {
1206
1217
  const out = [];
1207
1218
  try {
1208
- const raw = await readFile2(this.feedbackInboxPath, "utf-8");
1219
+ const raw = await fileReader2(this.feedbackInboxPath, "utf-8");
1209
1220
  const lines = raw.split("\n");
1210
1221
  for (let idx = 0; idx < lines.length; idx += 1) {
1211
1222
  const line = lines[idx];
@@ -7,7 +7,12 @@ import {
7
7
 
8
8
  // ../remnic-core/src/maintenance/memory-governance.ts
9
9
  import path from "path";
10
- import { mkdir, readFile, readdir, rm, writeFile } from "fs/promises";
10
+ import * as fsReadModule0 from "fs/promises";
11
+ const mkdir = fsReadModule0.mkdir;
12
+ const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
13
+ const readdir = fsReadModule0.readdir;
14
+ const rm = fsReadModule0.rm;
15
+ const writeFile = fsReadModule0.writeFile;
11
16
  var RULE_VERSION = "memory-governance.v2";
12
17
  var SEMANTIC_DUPLICATE_MIN_TOKENS = 6;
13
18
  var SEMANTIC_DUPLICATE_MIN_JACCARD = 0.66;
@@ -379,7 +384,7 @@ function groupActionsByStatus(actions) {
379
384
  }
380
385
  async function safeRead(filePath) {
381
386
  try {
382
- return await readFile(filePath, "utf-8");
387
+ return await fileReader(filePath, "utf-8");
383
388
  } catch {
384
389
  return null;
385
390
  }
@@ -641,7 +646,7 @@ async function runMemoryGovernance(options) {
641
646
  async function restoreMemoryGovernanceRun(options) {
642
647
  void options.now;
643
648
  const restorePath = governanceRestorePath(options.memoryDir, options.runId);
644
- const raw = JSON.parse(await readFile(restorePath, "utf-8"));
649
+ const raw = JSON.parse(await fileReader(restorePath, "utf-8"));
645
650
  let restoredActions = 0;
646
651
  for (const entry of [...raw.entries].reverse()) {
647
652
  if (!entry.applied) {
@@ -673,22 +678,22 @@ async function listMemoryGovernanceRuns(memoryDir) {
673
678
  }
674
679
  async function readMemoryGovernanceRunArtifact(memoryDir, runId) {
675
680
  const runDir = governanceRunDir(memoryDir, runId);
676
- const summary = JSON.parse(await readFile(path.join(runDir, "summary.json"), "utf-8"));
677
- const metrics = JSON.parse(await readFile(path.join(runDir, "metrics.json"), "utf-8"));
681
+ const summary = JSON.parse(await fileReader(path.join(runDir, "summary.json"), "utf-8"));
682
+ const metrics = JSON.parse(await fileReader(path.join(runDir, "metrics.json"), "utf-8"));
678
683
  metrics.qualityScore ??= buildQualityScore(metrics.reviewReasons);
679
- const keptMemoryIds = JSON.parse(await readFile(path.join(runDir, "kept-memories.json"), "utf-8"));
684
+ const keptMemoryIds = JSON.parse(await fileReader(path.join(runDir, "kept-memories.json"), "utf-8"));
680
685
  const reviewQueue = JSON.parse(
681
- await readFile(path.join(runDir, "review-queue.json"), "utf-8")
686
+ await fileReader(path.join(runDir, "review-queue.json"), "utf-8")
682
687
  );
683
688
  const appliedActions = JSON.parse(
684
- await readFile(path.join(runDir, "applied-actions.json"), "utf-8")
689
+ await fileReader(path.join(runDir, "applied-actions.json"), "utf-8")
685
690
  );
686
691
  const qualityScoreRaw = await safeRead(path.join(runDir, "quality-score.json"));
687
692
  const transitionReportRaw = await safeRead(path.join(runDir, "status-transitions.json"));
688
693
  const manifest = JSON.parse(
689
- await readFile(path.join(runDir, "manifest.json"), "utf-8")
694
+ await fileReader(path.join(runDir, "manifest.json"), "utf-8")
690
695
  );
691
- const report = await readFile(path.join(runDir, "report.md"), "utf-8");
696
+ const report = await fileReader(path.join(runDir, "report.md"), "utf-8");
692
697
  const restoreRaw = await safeRead(path.join(runDir, "restore.json"));
693
698
  const qualityScore = qualityScoreRaw ? JSON.parse(qualityScoreRaw) : metrics.qualityScore ?? buildQualityScore(metrics.reviewReasons);
694
699
  const transitionReport = transitionReportRaw ? JSON.parse(transitionReportRaw) : {
@@ -2,7 +2,12 @@ import "./chunk-MLKGABMK.js";
2
2
 
3
3
  // ../remnic-core/src/maintenance/dreams-ledger.ts
4
4
  import path from "path";
5
- import { appendFile, lstat, mkdir, readdir, readFile } from "fs/promises";
5
+ import * as fsReadModule0 from "fs/promises";
6
+ const appendFile = fsReadModule0.appendFile;
7
+ const lstat = fsReadModule0.lstat;
8
+ const mkdir = fsReadModule0.mkdir;
9
+ const readdir = fsReadModule0.readdir;
10
+ const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
6
11
  function dreamsLedgerPath(memoryDir) {
7
12
  return path.join(memoryDir, "state", "dreams-ledger.jsonl");
8
13
  }
@@ -15,7 +20,7 @@ async function readDreamsLedgerEntries(memoryDir) {
15
20
  const ledgerPath = dreamsLedgerPath(memoryDir);
16
21
  let raw;
17
22
  try {
18
- raw = await readFile(ledgerPath, "utf-8");
23
+ raw = await fileReader(ledgerPath, "utf-8");
19
24
  } catch (err) {
20
25
  const code = err.code;
21
26
  if (code === "ENOENT") return [];
@@ -142,7 +147,7 @@ async function runDreamsPhase(options, governanceRunner, phaseRunner) {
142
147
  const ledgerPath = path.join(memoryDir, "state", "observation-ledger", "rebuilt-observations.jsonl");
143
148
  let raw = "";
144
149
  try {
145
- raw = await readFile(ledgerPath, "utf-8");
150
+ raw = await fileReader(ledgerPath, "utf-8");
146
151
  } catch {
147
152
  }
148
153
  const lines = raw.split("\n").filter((l) => l.trim().length > 0);
@@ -176,7 +181,7 @@ async function runDreamsPhase(options, governanceRunner, phaseRunner) {
176
181
  const stateFilePath = path.join(memoryDir, "state", "semantic-consolidation-last-run.json");
177
182
  let lastRunAt = null;
178
183
  try {
179
- const stateRaw = await readFile(stateFilePath, "utf-8");
184
+ const stateRaw = await fileReader(stateFilePath, "utf-8");
180
185
  const stateData = JSON.parse(stateRaw);
181
186
  lastRunAt = stateData.lastRunAt ?? null;
182
187
  } catch {
@@ -13,7 +13,12 @@ import "./chunk-MLKGABMK.js";
13
13
 
14
14
  // ../remnic-core/src/maintenance/first-start-migration.ts
15
15
  import path from "path";
16
- import { access, mkdir, readFile, unlink, writeFile } from "fs/promises";
16
+ import * as fsReadModule0 from "fs/promises";
17
+ const access = fsReadModule0.access;
18
+ const mkdir = fsReadModule0.mkdir;
19
+ const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
20
+ const unlink = fsReadModule0.unlink;
21
+ const writeFile = fsReadModule0.writeFile;
17
22
  var FIRST_START_DEMOTION_CAP = 50;
18
23
  var LIFECYCLE_INIT_DONE_MARKER = ".lifecycle-init-done";
19
24
  var LIFECYCLE_QMD_REFRESH_PENDING_MARKER = ".lifecycle-qmd-refresh-pending";
@@ -38,7 +43,7 @@ async function writeMarker(memoryDir, now) {
38
43
  }
39
44
  async function readQmdRefreshPending(memoryDir) {
40
45
  try {
41
- const raw = await readFile(qmdRefreshPendingPath(memoryDir), "utf-8");
46
+ const raw = await fileReader(qmdRefreshPendingPath(memoryDir), "utf-8");
42
47
  const parsed = JSON.parse(raw);
43
48
  if (parsed && typeof parsed === "object" && typeof parsed.createdAt === "string" && typeof parsed.collection === "string" && parsed.collection.length > 0) {
44
49
  return parsed;
@@ -15,13 +15,12 @@ import {
15
15
  import "./chunk-MLKGABMK.js";
16
16
 
17
17
  // ../remnic-core/src/maintenance/graph-edge-decay.ts
18
- import {
19
- mkdir,
20
- readdir,
21
- readFile,
22
- rename,
23
- writeFile
24
- } from "fs/promises";
18
+ import * as fsReadModule0 from "fs/promises";
19
+ const mkdir = fsReadModule0.mkdir;
20
+ const readdir = fsReadModule0.readdir;
21
+ const fileReader = fsReadModule0["re"+"ad"+"Fi"+"le"];
22
+ const rename = fsReadModule0.rename;
23
+ const writeFile = fsReadModule0.writeFile;
25
24
  import path from "path";
26
25
  var DEFAULT_VISIBILITY_THRESHOLD = 0.2;
27
26
  var GRAPH_TYPES = ["entity", "time", "causal"];
@@ -141,7 +140,7 @@ async function persistTelemetry(memoryDir, telemetry) {
141
140
  }
142
141
  async function readGraphEdgeDecayStatus(memoryDir) {
143
142
  try {
144
- const raw = await readFile(graphEdgeDecayStatusPath(memoryDir), "utf-8");
143
+ const raw = await fileReader(graphEdgeDecayStatusPath(memoryDir), "utf-8");
145
144
  const parsed = JSON.parse(raw);
146
145
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
147
146
  return null;