@omgbase/sync 0.4.7 → 0.4.11
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/src/coordinator.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { storagePath } from "@omgbase/core";
|
|
1
2
|
export class Coordinator {
|
|
2
3
|
engine;
|
|
3
4
|
source;
|
|
@@ -26,13 +27,16 @@ export class Coordinator {
|
|
|
26
27
|
}
|
|
27
28
|
const summary = { ingested: [], suppressed: [], conflicted: [], deleted: [] };
|
|
28
29
|
if (files.length > 0) {
|
|
30
|
+
// The engine answers in the surface's reference form (`/a.md`,
|
|
31
|
+
// spec/surface §1 "Paths"); a source speaks storage paths.
|
|
29
32
|
for (const r of await this.engine.observeMany(files)) {
|
|
33
|
+
const path = storagePath(r.path);
|
|
30
34
|
if (r.echo)
|
|
31
|
-
summary.suppressed.push(
|
|
35
|
+
summary.suppressed.push(path);
|
|
32
36
|
else if (r.conflicted)
|
|
33
|
-
summary.conflicted.push(
|
|
37
|
+
summary.conflicted.push(path);
|
|
34
38
|
else
|
|
35
|
-
summary.ingested.push(
|
|
39
|
+
summary.ingested.push(path);
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
for (const path of gonePaths) {
|
|
@@ -61,14 +65,16 @@ export class Coordinator {
|
|
|
61
65
|
if (digest.origin === "observed")
|
|
62
66
|
continue; // came from a source; don't echo back
|
|
63
67
|
for (const rev of digest.revisions) {
|
|
64
|
-
|
|
68
|
+
// `changes_since` reports the reference form; the source takes storage paths.
|
|
69
|
+
const path = storagePath(rev.path);
|
|
70
|
+
const doc = await this.engine.readDoc(path);
|
|
65
71
|
if (doc) {
|
|
66
|
-
await this.source.write(
|
|
67
|
-
written.push(
|
|
72
|
+
await this.source.write(path, doc.content);
|
|
73
|
+
written.push(path);
|
|
68
74
|
}
|
|
69
75
|
else if (this.source.remove) {
|
|
70
|
-
await this.source.remove(
|
|
71
|
-
removed.push(
|
|
76
|
+
await this.source.remove(path);
|
|
77
|
+
removed.push(path);
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
80
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { observeMany, observeDelete, changesSince, docsRead, } from "@omgbase/core";
|
|
1
|
+
import { observeMany, observeDelete, changesSince, docsRead, storagePath, } from "@omgbase/core";
|
|
2
2
|
/** In-process EngineClient: calls @omgbase/core directly against an open Store.
|
|
3
3
|
* Used by the local watcher/sync (no self-MCP-loop) and by tests. */
|
|
4
4
|
export class InProcessEngineClient {
|
|
@@ -24,7 +24,7 @@ export class InProcessEngineClient {
|
|
|
24
24
|
readDoc(path) {
|
|
25
25
|
const row = this.store.db
|
|
26
26
|
.prepare("SELECT doc_id, file_hash FROM docs WHERE repo_id = ? AND path = ? AND deleted_commit IS NULL")
|
|
27
|
-
.get(this.repoId, path);
|
|
27
|
+
.get(this.repoId, storagePath(path));
|
|
28
28
|
if (!row)
|
|
29
29
|
return Promise.resolve(null);
|
|
30
30
|
const res = docsRead(this.store, row.doc_id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omgbase/sync",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.11",
|
|
4
4
|
"description": "Open Markdown Graph Base — standalone store-to-store synchronizer: a coordinator over an EngineClient seam (in-process or MCP-client) and source adapters",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
56
|
-
"@omgbase/core": "^0.
|
|
56
|
+
"@omgbase/core": "^0.10.1",
|
|
57
57
|
"@omgbase/fs-adapter": "^0.2.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|