@remnic/cli 1.0.14 → 1.0.16

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 +13 -9
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -97,6 +97,7 @@ import {
97
97
  offlineSyncStateFromSnapshot,
98
98
  readOfflineSyncState,
99
99
  summarizeOfflineSyncChangeset,
100
+ summarizeOfflineSyncPendingChanges,
100
101
  writeOfflineSyncState,
101
102
  buildActionConfidenceInputFromOptions,
102
103
  evaluateActionConfidence,
@@ -6882,14 +6883,16 @@ function isMissingOfflineContentError(error) {
6882
6883
  return /^missing decoded content for /.test(message);
6883
6884
  }
6884
6885
  async function hydrateOfflineSnapshotContent(args) {
6886
+ const snapshot = normalizeOfflineSyncSnapshot(args.snapshot);
6885
6887
  const neededFiles = offlineSnapshotContentFilesForApply({
6886
- snapshot: args.snapshot,
6888
+ snapshot,
6887
6889
  baseFiles: args.baseFiles,
6888
6890
  currentFiles: args.currentFiles
6889
6891
  });
6890
- if (neededFiles.length === 0) return args.snapshot;
6891
- const expectedByPath = new Map(args.snapshot.files.map((file) => [file.path, file]));
6892
+ if (neededFiles.length === 0) return { ...args.snapshot, files: snapshot.files };
6893
+ const expectedByPath = new Map(snapshot.files.map((file) => [file.path, file]));
6892
6894
  const contentByPath = /* @__PURE__ */ new Map();
6895
+ const updatedByPath = /* @__PURE__ */ new Map();
6893
6896
  try {
6894
6897
  for (const batch of chunkOfflineFileContentBatches(neededFiles)) {
6895
6898
  const partial = await fetchOfflineFiles({
@@ -6902,12 +6905,12 @@ async function hydrateOfflineSnapshotContent(args) {
6902
6905
  for (const file of partial.files) {
6903
6906
  const expected = expectedByPath.get(file.path);
6904
6907
  if (!expected) continue;
6905
- if (file.sha256 !== expected.sha256 || file.bytes !== expected.bytes) {
6906
- throw new Error(`remote file changed while fetching offline content: ${file.path}`);
6907
- }
6908
6908
  if (typeof file.contentBase64 !== "string") {
6909
6909
  throw new Error(`remote offline content response omitted contentBase64 for ${file.path}`);
6910
6910
  }
6911
+ if (file.sha256 !== expected.sha256 || file.bytes !== expected.bytes || file.mtimeMs !== expected.mtimeMs) {
6912
+ updatedByPath.set(file.path, file);
6913
+ }
6911
6914
  contentByPath.set(file.path, file.contentBase64);
6912
6915
  }
6913
6916
  }
@@ -6929,7 +6932,9 @@ async function hydrateOfflineSnapshotContent(args) {
6929
6932
  }
6930
6933
  return {
6931
6934
  ...args.snapshot,
6932
- files: args.snapshot.files.map((file) => {
6935
+ files: snapshot.files.map((file) => {
6936
+ const updated = updatedByPath.get(file.path);
6937
+ if (updated) return updated;
6933
6938
  const contentBase64 = contentByPath.get(file.path);
6934
6939
  return contentBase64 === void 0 ? file : { ...file, contentBase64 };
6935
6940
  })
@@ -7273,14 +7278,13 @@ Environment fallbacks:
7273
7278
  });
7274
7279
  }
7275
7280
  const storageIo = await createOfflineStorageIo(memoryDir);
7276
- const changeset = await buildOfflineSyncChangeset({
7281
+ const summary = await summarizeOfflineSyncPendingChanges({
7277
7282
  root: memoryDir,
7278
7283
  sourceId: localOfflineSourceId(memoryDir),
7279
7284
  baseFiles: state?.baseFiles ?? [],
7280
7285
  includeTranscripts,
7281
7286
  readFile: storageIo.readFile
7282
7287
  });
7283
- const summary = summarizeOfflineSyncChangeset(changeset);
7284
7288
  if (json) {
7285
7289
  console.log(JSON.stringify({ statePath: statePath ?? null, state, pending: summary }, null, 2));
7286
7290
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/cli",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "CLI for Remnic memory — init, query, doctor, daemon management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,9 +26,9 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "yaml": "^2.4.2",
29
- "@remnic/plugin-pi": "^1.0.0",
30
- "@remnic/server": "^1.0.5",
31
- "@remnic/core": "^1.1.20"
29
+ "@remnic/core": "^1.1.22",
30
+ "@remnic/plugin-pi": "^1.0.2",
31
+ "@remnic/server": "^1.0.5"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@remnic/bench": "^1.0.0",
@@ -76,12 +76,12 @@
76
76
  "@remnic/bench": "1.0.1",
77
77
  "@remnic/export-weclone": "1.0.1",
78
78
  "@remnic/import-weclone": "1.0.1",
79
- "@remnic/import-chatgpt": "0.1.0",
79
+ "@remnic/import-mem0": "0.1.0",
80
80
  "@remnic/import-claude": "0.1.0",
81
- "@remnic/import-gemini": "0.1.0",
81
+ "@remnic/import-chatgpt": "0.1.0",
82
82
  "@remnic/import-lossless-claw": "0.1.1",
83
- "@remnic/import-mem0": "0.1.0",
84
- "@remnic/import-supermemory": "0.1.2"
83
+ "@remnic/import-supermemory": "0.1.2",
84
+ "@remnic/import-gemini": "0.1.0"
85
85
  },
86
86
  "license": "MIT",
87
87
  "repository": {