@remnic/cli 9.3.517 → 9.3.518
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 +51 -18
- package/package.json +22 -22
package/dist/index.js
CHANGED
|
@@ -7040,6 +7040,29 @@ async function fetchOfflineFiles(args) {
|
|
|
7040
7040
|
}
|
|
7041
7041
|
);
|
|
7042
7042
|
}
|
|
7043
|
+
var APPEND_TOLERANT_RUNTIME_STATE_FILES = /* @__PURE__ */ new Set([
|
|
7044
|
+
"memory-lifecycle-ledger.jsonl",
|
|
7045
|
+
"recall_impressions.jsonl"
|
|
7046
|
+
]);
|
|
7047
|
+
function isAppendTolerantOfflineRuntimeFile(relPath) {
|
|
7048
|
+
if (!shouldPreferIncomingOfflineRuntimeFile(relPath)) return false;
|
|
7049
|
+
const parts = relPath.split("/");
|
|
7050
|
+
const basename = parts[parts.length - 1] ?? "";
|
|
7051
|
+
return APPEND_TOLERANT_RUNTIME_STATE_FILES.has(basename);
|
|
7052
|
+
}
|
|
7053
|
+
function offlineFileContentChunkMatchesExpected(options) {
|
|
7054
|
+
const { chunk, expected, offset } = options;
|
|
7055
|
+
if (chunk.path !== expected.path) return false;
|
|
7056
|
+
if (chunk.offset !== offset) return false;
|
|
7057
|
+
if (chunk.chunkBytes !== chunk.content.length) return false;
|
|
7058
|
+
if (offset + chunk.chunkBytes > expected.bytes) return false;
|
|
7059
|
+
if (chunk.bytes === expected.bytes && chunk.mtimeMs === expected.mtimeMs && (chunk.sha256 === void 0 || chunk.sha256 === expected.sha256)) {
|
|
7060
|
+
return true;
|
|
7061
|
+
}
|
|
7062
|
+
if (!isAppendTolerantOfflineRuntimeFile(expected.path)) return false;
|
|
7063
|
+
if (chunk.bytes < expected.bytes) return false;
|
|
7064
|
+
return true;
|
|
7065
|
+
}
|
|
7043
7066
|
var OFFLINE_SYNC_DIRECT_DEFAULT_MIN_BYTES = 16 * 1024 * 1024;
|
|
7044
7067
|
var OFFLINE_SYNC_FILES_CONTENT_MAX_BATCH_BYTES = 8 * 1024 * 1024;
|
|
7045
7068
|
var OFFLINE_SYNC_APPLY_MAX_REQUEST_BYTES = Math.floor(OFFLINE_SYNC_APPLY_MAX_BODY_BYTES / 2);
|
|
@@ -7067,6 +7090,9 @@ var OfflineRemoteFileChangedError = class extends Error {
|
|
|
7067
7090
|
function isOfflineRemoteFileChangedError(error) {
|
|
7068
7091
|
return error instanceof OfflineRemoteFileChangedError || error instanceof Error && error.message.startsWith("remote file changed while fetching offline content: ");
|
|
7069
7092
|
}
|
|
7093
|
+
function isOfflineHydrateChecksumMismatch(error, relPath) {
|
|
7094
|
+
return error instanceof Error && error.message === `offline sync upload checksum mismatch for ${relPath}`;
|
|
7095
|
+
}
|
|
7070
7096
|
function isOfflineLocalFileChangedError(error) {
|
|
7071
7097
|
return error instanceof Error && error.message.startsWith("local file changed while pushing offline content: ");
|
|
7072
7098
|
}
|
|
@@ -7429,29 +7455,36 @@ async function hydrateOfflineFileContent(args) {
|
|
|
7429
7455
|
Math.max(1, args.expected.bytes - offset)
|
|
7430
7456
|
)
|
|
7431
7457
|
});
|
|
7432
|
-
if (
|
|
7458
|
+
if (!offlineFileContentChunkMatchesExpected({ chunk, expected: args.expected, offset })) {
|
|
7433
7459
|
throw new OfflineRemoteFileChangedError(args.expected.path);
|
|
7434
7460
|
}
|
|
7435
7461
|
if (chunk.chunkBytes === 0 && args.expected.bytes > 0) {
|
|
7436
7462
|
throw new Error(`remote offline content chunk was empty before EOF: ${args.expected.path}`);
|
|
7437
7463
|
}
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7464
|
+
try {
|
|
7465
|
+
finalResult = await applyOfflineSyncFileContentChunk({
|
|
7466
|
+
root: args.memoryDir,
|
|
7467
|
+
sourceId: args.sourceId,
|
|
7468
|
+
path: args.expected.path,
|
|
7469
|
+
sha256: args.expected.sha256,
|
|
7470
|
+
bytes: args.expected.bytes,
|
|
7471
|
+
mtimeMs: args.expected.mtimeMs,
|
|
7472
|
+
offset,
|
|
7473
|
+
content: chunk.content,
|
|
7474
|
+
...args.baseSha256 ? { baseSha256: args.baseSha256 } : {},
|
|
7475
|
+
includeTranscripts: args.includeTranscripts,
|
|
7476
|
+
readFile: args.readFile,
|
|
7477
|
+
readFileDigest: args.readFileDigest,
|
|
7478
|
+
writeFile: args.writeFile,
|
|
7479
|
+
writeStagingFile: args.writeStagingFile,
|
|
7480
|
+
writeFileChunks: args.writeFileChunks
|
|
7481
|
+
});
|
|
7482
|
+
} catch (error) {
|
|
7483
|
+
if (isAppendTolerantOfflineRuntimeFile(args.expected.path) && isOfflineHydrateChecksumMismatch(error, args.expected.path)) {
|
|
7484
|
+
throw new OfflineRemoteFileChangedError(args.expected.path);
|
|
7485
|
+
}
|
|
7486
|
+
throw error;
|
|
7487
|
+
}
|
|
7455
7488
|
if (finalResult.conflict) {
|
|
7456
7489
|
return finalResult;
|
|
7457
7490
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/cli",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.518",
|
|
4
4
|
"description": "CLI for Remnic memory — init, query, doctor, daemon management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,20 +26,20 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"yaml": "^2.4.2",
|
|
29
|
-
"@remnic/plugin-pi": "^9.3.
|
|
30
|
-
"@remnic/server": "^9.3.
|
|
31
|
-
"@remnic/core": "^9.3.
|
|
29
|
+
"@remnic/plugin-pi": "^9.3.518",
|
|
30
|
+
"@remnic/server": "^9.3.518",
|
|
31
|
+
"@remnic/core": "^9.3.518"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@remnic/bench": "^9.3.
|
|
35
|
-
"@remnic/export-weclone": "^9.3.
|
|
36
|
-
"@remnic/import-weclone": "^9.3.
|
|
37
|
-
"@remnic/import-chatgpt": "^9.3.
|
|
38
|
-
"@remnic/import-claude": "^9.3.
|
|
39
|
-
"@remnic/import-gemini": "^9.3.
|
|
40
|
-
"@remnic/import-lossless-claw": "^9.3.
|
|
41
|
-
"@remnic/import-mem0": "^9.3.
|
|
42
|
-
"@remnic/import-supermemory": "^9.3.
|
|
34
|
+
"@remnic/bench": "^9.3.518",
|
|
35
|
+
"@remnic/export-weclone": "^9.3.518",
|
|
36
|
+
"@remnic/import-weclone": "^9.3.518",
|
|
37
|
+
"@remnic/import-chatgpt": "^9.3.518",
|
|
38
|
+
"@remnic/import-claude": "^9.3.518",
|
|
39
|
+
"@remnic/import-gemini": "^9.3.518",
|
|
40
|
+
"@remnic/import-lossless-claw": "^9.3.518",
|
|
41
|
+
"@remnic/import-mem0": "^9.3.518",
|
|
42
|
+
"@remnic/import-supermemory": "^9.3.518"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@remnic/bench": {
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"tsup": "^8.5.1",
|
|
75
75
|
"typescript": "^5.9.3",
|
|
76
|
-
"@remnic/export-weclone": "9.3.
|
|
77
|
-
"@remnic/bench": "9.3.
|
|
78
|
-
"@remnic/import-weclone": "9.3.
|
|
79
|
-
"@remnic/import-chatgpt": "9.3.
|
|
80
|
-
"@remnic/import-claude": "9.3.
|
|
81
|
-
"@remnic/import-gemini": "9.3.
|
|
82
|
-
"@remnic/import-
|
|
83
|
-
"@remnic/import-
|
|
84
|
-
"@remnic/import-
|
|
76
|
+
"@remnic/export-weclone": "9.3.518",
|
|
77
|
+
"@remnic/bench": "9.3.518",
|
|
78
|
+
"@remnic/import-weclone": "9.3.518",
|
|
79
|
+
"@remnic/import-chatgpt": "9.3.518",
|
|
80
|
+
"@remnic/import-claude": "9.3.518",
|
|
81
|
+
"@remnic/import-gemini": "9.3.518",
|
|
82
|
+
"@remnic/import-mem0": "9.3.518",
|
|
83
|
+
"@remnic/import-lossless-claw": "9.3.518",
|
|
84
|
+
"@remnic/import-supermemory": "9.3.518"
|
|
85
85
|
},
|
|
86
86
|
"license": "MIT",
|
|
87
87
|
"repository": {
|