@remnic/cli 9.45.1 → 9.45.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +45 -11
  2. package/package.json +29 -29
package/dist/index.js CHANGED
@@ -138,6 +138,7 @@ import {
138
138
  OPERATION_NAMES,
139
139
  validateCapabilitiesForMint
140
140
  } from "@remnic/core";
141
+ import { resolveRemnicPluginEntry } from "@remnic/core/plugin-id.js";
141
142
 
142
143
  // src/commands/meetings.ts
143
144
  import fs from "fs";
@@ -259,6 +260,7 @@ import {
259
260
  } from "@remnic/core/reconcile/plan.js";
260
261
  import {
261
262
  defaultConvergeCursorPath,
263
+ deriveConvergeCursorBase,
262
264
  readConvergeCursor,
263
265
  writeConvergeCursor
264
266
  } from "@remnic/core/reconcile/cursor.js";
@@ -810,6 +812,7 @@ async function postPeerFileDeletion(peerUrl, namespace, filePath, baseSha256, to
810
812
  }
811
813
  async function computeConvergePlan(options = {}) {
812
814
  const baseMap = /* @__PURE__ */ new Map();
815
+ const semanticAgreementMap = /* @__PURE__ */ new Map();
813
816
  const namespacesToPlan = /* @__PURE__ */ new Set();
814
817
  const localMap = /* @__PURE__ */ new Map();
815
818
  const localTombstones = /* @__PURE__ */ new Map();
@@ -825,6 +828,12 @@ async function computeConvergePlan(options = {}) {
825
828
  baseMap.set(ns, files);
826
829
  }
827
830
  }
831
+ if (options.semanticAgreementsByNamespace) {
832
+ for (const [ns, agreements] of options.semanticAgreementsByNamespace) {
833
+ namespacesToPlan.add(ns);
834
+ semanticAgreementMap.set(ns, agreements);
835
+ }
836
+ }
828
837
  if (options.localFilesByNamespace) {
829
838
  for (const [ns, files] of options.localFilesByNamespace) {
830
839
  namespacesToPlan.add(ns);
@@ -949,13 +958,16 @@ async function computeConvergePlan(options = {}) {
949
958
  }
950
959
  }
951
960
  const memoryDir = options.cursorDir ?? config?.memoryDir;
952
- if (!options.baseFilesByNamespace && memoryDir && options.peerUrl) {
961
+ if (memoryDir && options.peerUrl && (!options.baseFilesByNamespace || !options.semanticAgreementsByNamespace)) {
953
962
  for (const ns of namespacesToPlan) {
954
963
  const cursorPath = defaultConvergeCursorPath(memoryDir, options.peerUrl, ns);
955
964
  const cursor = await readConvergeCursor(cursorPath);
956
- if (cursor?.baseFiles && cursor.baseFiles.length > 0) {
965
+ if (!options.baseFilesByNamespace && cursor?.baseFiles && cursor.baseFiles.length > 0) {
957
966
  baseMap.set(ns, cursor.baseFiles);
958
967
  }
968
+ if (!options.semanticAgreementsByNamespace && cursor?.semanticAgreements && cursor.semanticAgreements.length > 0) {
969
+ semanticAgreementMap.set(ns, cursor.semanticAgreements);
970
+ }
959
971
  }
960
972
  }
961
973
  const inputs = [];
@@ -978,7 +990,7 @@ async function computeConvergePlan(options = {}) {
978
990
  }
979
991
  const conflictPolicy = options.conflictPolicy ?? config?.converge.conflictPolicy ?? DEFAULT_CONVERGE_CONFLICT_POLICY;
980
992
  const plan = planReconciliation(inputs, { conflictPolicy });
981
- return collapseActiveFactDuplicates(plan, localManifests, peerManifests);
993
+ return collapseActiveFactDuplicates(plan, localManifests, peerManifests, semanticAgreementMap);
982
994
  }
983
995
  async function executeConvergeApply(options = {}) {
984
996
  const conflictPolicy = options.conflictPolicy ?? options.config?.converge.conflictPolicy ?? DEFAULT_CONVERGE_CONFLICT_POLICY;
@@ -1309,16 +1321,19 @@ async function updateCursorsForPlan(plan, options) {
1309
1321
  const namespaces = new Set(plan.byNamespace.map((n) => n.namespace));
1310
1322
  for (const ns of namespaces) {
1311
1323
  const cursorPath = defaultConvergeCursorPath(memoryDir, peerUrl, ns);
1312
- const baseFiles = plan.entries.filter((entry) => entry.namespace === ns && entry.reason !== "semantic_duplicate" && !(entry.reason === "local_modified_peer_deleted" && entry.resolution === "peer-wins") && !(entry.reason === "local_deleted_peer_modified" && entry.resolution === "local-wins")).map((entry) => ({
1313
- path: entry.path,
1314
- sha256: entry.localSha256 ?? entry.peerSha256 ?? "unknown"
1315
- }));
1324
+ const priorSemanticAgreements = options.semanticAgreementsByNamespace?.get(ns) ?? (await readConvergeCursor(cursorPath))?.semanticAgreements ?? [];
1325
+ const { baseFiles, semanticAgreements } = deriveConvergeCursorBase(
1326
+ plan.entries,
1327
+ ns,
1328
+ priorSemanticAgreements
1329
+ );
1316
1330
  const cursorState = {
1317
1331
  version: 1,
1318
1332
  peerUrl,
1319
1333
  namespace: ns,
1320
1334
  lastConvergedAt: (/* @__PURE__ */ new Date()).toISOString(),
1321
- baseFiles
1335
+ baseFiles,
1336
+ semanticAgreements
1322
1337
  };
1323
1338
  try {
1324
1339
  await writeConvergeCursor(cursorPath, cursorState);
@@ -7734,6 +7749,26 @@ async function writeBenchReproManifestForPackageRun(args) {
7734
7749
  console.warn(`WARNING: failed to write reproducibility manifest: ${message}`);
7735
7750
  }
7736
7751
  }
7752
+ function loadStandaloneConvergeCommandConfig() {
7753
+ const configPath = resolveConfigPath();
7754
+ const raw = fs12.existsSync(configPath) ? JSON.parse(fs12.readFileSync(configPath, "utf8")) : {};
7755
+ return parseConfig5(resolveRemnicConfigRecord4(raw));
7756
+ }
7757
+ function parseConvergePluginConfig(value) {
7758
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
7759
+ if (Object.keys(value).length === 0) return void 0;
7760
+ return parseConfig5(resolveRemnicConfigRecord4(value));
7761
+ }
7762
+ function loadConvergeCommandConfig() {
7763
+ if (readCompatEnv("REMNIC_CONFIG_PATH", "ENGRAM_CONFIG_PATH")) {
7764
+ return loadStandaloneConvergeCommandConfig();
7765
+ }
7766
+ const openclawConfig = readOpenclawConfig(resolveOpenclawConfigPath());
7767
+ const pluginEntry = resolveRemnicPluginEntry(openclawConfig);
7768
+ const pluginConfig = parseConvergePluginConfig(pluginEntry?.["config"]);
7769
+ if (pluginConfig) return pluginConfig;
7770
+ return loadStandaloneConvergeCommandConfig();
7771
+ }
7737
7772
  function resolveConfigPath(cliPath) {
7738
7773
  if (cliPath) return path15.resolve(expandTilde(cliPath));
7739
7774
  const envPath = readCompatEnv("REMNIC_CONFIG_PATH", "ENGRAM_CONFIG_PATH");
@@ -14547,9 +14582,7 @@ Options:
14547
14582
  await cmdConverge(action, args, json);
14548
14583
  break;
14549
14584
  }
14550
- const configPath = resolveConfigPath();
14551
- const raw = fs12.existsSync(configPath) ? JSON.parse(fs12.readFileSync(configPath, "utf8")) : {};
14552
- const config = parseConfig5(resolveRemnicConfigRecord4(raw));
14585
+ const config = loadConvergeCommandConfig();
14553
14586
  await cmdConverge(action, args, json, config);
14554
14587
  break;
14555
14588
  }
@@ -15087,6 +15120,7 @@ export {
15087
15120
  hydrateOfflineSnapshotContent,
15088
15121
  isOfflineMissingContentDeferrablePath,
15089
15122
  isOfflineSnapshotPostFallbackError,
15123
+ loadConvergeCommandConfig,
15090
15124
  main,
15091
15125
  offlinePartialHydrationForPaths,
15092
15126
  offlineSnapshotBasePostBody,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/cli",
3
- "version": "9.45.1",
3
+ "version": "9.45.3",
4
4
  "description": "CLI for Remnic memory — init, query, doctor, daemon management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,24 +26,24 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "yaml": "^2.4.2",
29
- "@remnic/server": "^9.45.1",
30
- "@remnic/plugin-pi": "^9.45.1",
31
- "@remnic/core": "^9.45.1"
29
+ "@remnic/plugin-pi": "^9.45.3",
30
+ "@remnic/server": "^9.45.3",
31
+ "@remnic/core": "^9.45.3"
32
32
  },
33
33
  "peerDependencies": {
34
- "@remnic/bench": "^9.45.1",
35
- "@remnic/export-weclone": "^9.45.1",
36
- "@remnic/import-weclone": "^9.45.1",
37
- "@remnic/import-chatgpt": "^9.45.1",
38
- "@remnic/import-claude": "^9.45.1",
39
- "@remnic/import-gemini": "^9.45.1",
40
- "@remnic/import-lossless-claw": "^9.45.1",
41
- "@remnic/import-mem0": "^9.45.1",
42
- "@remnic/import-supermemory": "^9.45.1",
43
- "@remnic/connector-limitless": "^9.45.1",
44
- "@remnic/connector-bee": "^9.45.1",
45
- "@remnic/connector-omi": "^9.45.1",
46
- "@remnic/capture-audio": "^9.45.1"
34
+ "@remnic/bench": "^9.45.3",
35
+ "@remnic/export-weclone": "^9.45.3",
36
+ "@remnic/import-weclone": "^9.45.3",
37
+ "@remnic/import-chatgpt": "^9.45.3",
38
+ "@remnic/import-claude": "^9.45.3",
39
+ "@remnic/import-gemini": "^9.45.3",
40
+ "@remnic/import-lossless-claw": "^9.45.3",
41
+ "@remnic/import-mem0": "^9.45.3",
42
+ "@remnic/import-supermemory": "^9.45.3",
43
+ "@remnic/connector-limitless": "^9.45.3",
44
+ "@remnic/connector-bee": "^9.45.3",
45
+ "@remnic/connector-omi": "^9.45.3",
46
+ "@remnic/capture-audio": "^9.45.3"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "@remnic/bench": {
@@ -89,18 +89,18 @@
89
89
  "devDependencies": {
90
90
  "tsup": "^8.5.1",
91
91
  "typescript": "^5.9.3",
92
- "@remnic/bench": "9.45.1",
93
- "@remnic/export-weclone": "9.45.1",
94
- "@remnic/import-weclone": "9.45.1",
95
- "@remnic/import-chatgpt": "9.45.1",
96
- "@remnic/import-claude": "9.45.1",
97
- "@remnic/import-mem0": "9.45.1",
98
- "@remnic/import-gemini": "9.45.1",
99
- "@remnic/import-lossless-claw": "9.45.1",
100
- "@remnic/import-supermemory": "9.45.1",
101
- "@remnic/connector-bee": "9.45.1",
102
- "@remnic/connector-limitless": "9.45.1",
103
- "@remnic/connector-omi": "9.45.1"
92
+ "@remnic/bench": "9.45.3",
93
+ "@remnic/export-weclone": "9.45.3",
94
+ "@remnic/import-weclone": "9.45.3",
95
+ "@remnic/import-chatgpt": "9.45.3",
96
+ "@remnic/import-gemini": "9.45.3",
97
+ "@remnic/import-claude": "9.45.3",
98
+ "@remnic/import-lossless-claw": "9.45.3",
99
+ "@remnic/import-supermemory": "9.45.3",
100
+ "@remnic/connector-limitless": "9.45.3",
101
+ "@remnic/import-mem0": "9.45.3",
102
+ "@remnic/connector-omi": "9.45.3",
103
+ "@remnic/connector-bee": "9.45.3"
104
104
  },
105
105
  "license": "MIT",
106
106
  "repository": {