@amalgm/live 0.1.0
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/PURPOSE.md +103 -0
- package/README.md +45 -0
- package/dist/contracts/binding.d.ts +49 -0
- package/dist/contracts/binding.d.ts.map +1 -0
- package/dist/contracts/binding.js +23 -0
- package/dist/contracts/binding.js.map +1 -0
- package/dist/contracts/content.d.ts +42 -0
- package/dist/contracts/content.d.ts.map +1 -0
- package/dist/contracts/content.js +72 -0
- package/dist/contracts/content.js.map +1 -0
- package/dist/contracts/docs.d.ts +64 -0
- package/dist/contracts/docs.d.ts.map +1 -0
- package/dist/contracts/docs.js +51 -0
- package/dist/contracts/docs.js.map +1 -0
- package/dist/contracts/events.d.ts +45 -0
- package/dist/contracts/events.d.ts.map +1 -0
- package/dist/contracts/events.js +38 -0
- package/dist/contracts/events.js.map +1 -0
- package/dist/contracts/frames/gateway.d.ts +83 -0
- package/dist/contracts/frames/gateway.d.ts.map +1 -0
- package/dist/contracts/frames/gateway.js +35 -0
- package/dist/contracts/frames/gateway.js.map +1 -0
- package/dist/contracts/frames/stream.d.ts +59 -0
- package/dist/contracts/frames/stream.d.ts.map +1 -0
- package/dist/contracts/frames/stream.js +17 -0
- package/dist/contracts/frames/stream.js.map +1 -0
- package/dist/contracts/frames/tunnel.d.ts +78 -0
- package/dist/contracts/frames/tunnel.d.ts.map +1 -0
- package/dist/contracts/frames/tunnel.js +55 -0
- package/dist/contracts/frames/tunnel.js.map +1 -0
- package/dist/contracts/index.d.ts +19 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +19 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/mutation.d.ts +51 -0
- package/dist/contracts/mutation.d.ts.map +1 -0
- package/dist/contracts/mutation.js +55 -0
- package/dist/contracts/mutation.js.map +1 -0
- package/dist/contracts/presence.d.ts +46 -0
- package/dist/contracts/presence.d.ts.map +1 -0
- package/dist/contracts/presence.js +34 -0
- package/dist/contracts/presence.js.map +1 -0
- package/dist/contracts/resources.d.ts +52 -0
- package/dist/contracts/resources.d.ts.map +1 -0
- package/dist/contracts/resources.js +105 -0
- package/dist/contracts/resources.js.map +1 -0
- package/dist/contracts/snapshot.d.ts +24 -0
- package/dist/contracts/snapshot.d.ts.map +1 -0
- package/dist/contracts/snapshot.js +28 -0
- package/dist/contracts/snapshot.js.map +1 -0
- package/dist/contracts/validate.d.ts +32 -0
- package/dist/contracts/validate.d.ts.map +1 -0
- package/dist/contracts/validate.js +25 -0
- package/dist/contracts/validate.js.map +1 -0
- package/dist/detection/adapter-contract.d.ts +134 -0
- package/dist/detection/adapter-contract.d.ts.map +1 -0
- package/dist/detection/adapter-contract.js +162 -0
- package/dist/detection/adapter-contract.js.map +1 -0
- package/dist/detection/classify.d.ts +31 -0
- package/dist/detection/classify.d.ts.map +1 -0
- package/dist/detection/classify.js +28 -0
- package/dist/detection/classify.js.map +1 -0
- package/dist/detection/continuity.d.ts +54 -0
- package/dist/detection/continuity.d.ts.map +1 -0
- package/dist/detection/continuity.js +85 -0
- package/dist/detection/continuity.js.map +1 -0
- package/dist/detection/coverage.d.ts +43 -0
- package/dist/detection/coverage.d.ts.map +1 -0
- package/dist/detection/coverage.js +60 -0
- package/dist/detection/coverage.js.map +1 -0
- package/dist/detection/diff.d.ts +144 -0
- package/dist/detection/diff.d.ts.map +1 -0
- package/dist/detection/diff.js +187 -0
- package/dist/detection/diff.js.map +1 -0
- package/dist/detection/enrollment.d.ts +16 -0
- package/dist/detection/enrollment.d.ts.map +1 -0
- package/dist/detection/enrollment.js +70 -0
- package/dist/detection/enrollment.js.map +1 -0
- package/dist/detection/index.d.ts +29 -0
- package/dist/detection/index.d.ts.map +1 -0
- package/dist/detection/index.js +29 -0
- package/dist/detection/index.js.map +1 -0
- package/dist/detection/refusal.d.ts +33 -0
- package/dist/detection/refusal.d.ts.map +1 -0
- package/dist/detection/refusal.js +40 -0
- package/dist/detection/refusal.js.map +1 -0
- package/dist/entities/bytes.d.ts +18 -0
- package/dist/entities/bytes.d.ts.map +1 -0
- package/dist/entities/bytes.js +61 -0
- package/dist/entities/bytes.js.map +1 -0
- package/dist/entities/cloud.d.ts +82 -0
- package/dist/entities/cloud.d.ts.map +1 -0
- package/dist/entities/cloud.js +136 -0
- package/dist/entities/cloud.js.map +1 -0
- package/dist/entities/index.d.ts +23 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +23 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/moves.d.ts +42 -0
- package/dist/entities/moves.d.ts.map +1 -0
- package/dist/entities/moves.js +82 -0
- package/dist/entities/moves.js.map +1 -0
- package/dist/entities/repo-states.d.ts +121 -0
- package/dist/entities/repo-states.d.ts.map +1 -0
- package/dist/entities/repo-states.js +127 -0
- package/dist/entities/repo-states.js.map +1 -0
- package/dist/entities/rules.d.ts +104 -0
- package/dist/entities/rules.d.ts.map +1 -0
- package/dist/entities/rules.js +200 -0
- package/dist/entities/rules.js.map +1 -0
- package/dist/entities/types.d.ts +94 -0
- package/dist/entities/types.d.ts.map +1 -0
- package/dist/entities/types.js +40 -0
- package/dist/entities/types.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/machines/arbitration.d.ts +36 -0
- package/dist/machines/arbitration.d.ts.map +1 -0
- package/dist/machines/arbitration.js +37 -0
- package/dist/machines/arbitration.js.map +1 -0
- package/dist/machines/backoff.d.ts +36 -0
- package/dist/machines/backoff.d.ts.map +1 -0
- package/dist/machines/backoff.js +34 -0
- package/dist/machines/backoff.js.map +1 -0
- package/dist/machines/bootstrap.d.ts +65 -0
- package/dist/machines/bootstrap.d.ts.map +1 -0
- package/dist/machines/bootstrap.js +105 -0
- package/dist/machines/bootstrap.js.map +1 -0
- package/dist/machines/chunks.d.ts +51 -0
- package/dist/machines/chunks.d.ts.map +1 -0
- package/dist/machines/chunks.js +67 -0
- package/dist/machines/chunks.js.map +1 -0
- package/dist/machines/index.d.ts +14 -0
- package/dist/machines/index.d.ts.map +1 -0
- package/dist/machines/index.js +14 -0
- package/dist/machines/index.js.map +1 -0
- package/dist/machines/journal.d.ts +63 -0
- package/dist/machines/journal.d.ts.map +1 -0
- package/dist/machines/journal.js +71 -0
- package/dist/machines/journal.js.map +1 -0
- package/dist/machines/ordering.d.ts +53 -0
- package/dist/machines/ordering.d.ts.map +1 -0
- package/dist/machines/ordering.js +87 -0
- package/dist/machines/ordering.js.map +1 -0
- package/dist/machines/presence.d.ts +26 -0
- package/dist/machines/presence.d.ts.map +1 -0
- package/dist/machines/presence.js +49 -0
- package/dist/machines/presence.js.map +1 -0
- package/dist/merge/index.d.ts +9 -0
- package/dist/merge/index.d.ts.map +1 -0
- package/dist/merge/index.js +9 -0
- package/dist/merge/index.js.map +1 -0
- package/dist/merge/merge3.d.ts +39 -0
- package/dist/merge/merge3.d.ts.map +1 -0
- package/dist/merge/merge3.js +188 -0
- package/dist/merge/merge3.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presence receiver — arrival-clock TTL over replace-not-merge frames.
|
|
3
|
+
*
|
|
4
|
+
* A presence frame carries the FULL peer list for one resource; receivers
|
|
5
|
+
* replace their view and treat absence as the default that publishing
|
|
6
|
+
* re-earns (local-live-protocol.md §2). The server already expires stale
|
|
7
|
+
* publishers, but receivers must apply their OWN arrival-clock TTL — a
|
|
8
|
+
* frozen stream must not preserve ghosts.
|
|
9
|
+
*/
|
|
10
|
+
import { SERVER_TTL_MS } from '../contracts/presence.js';
|
|
11
|
+
export class PresenceView {
|
|
12
|
+
ttlMs;
|
|
13
|
+
#byResource = new Map();
|
|
14
|
+
constructor(ttlMs = SERVER_TTL_MS) {
|
|
15
|
+
this.ttlMs = ttlMs;
|
|
16
|
+
}
|
|
17
|
+
/** Replace one resource's peer view. `nowMs` is the receiver's clock (host-supplied — the SDK holds no clock). */
|
|
18
|
+
accept(frame, nowMs) {
|
|
19
|
+
const peers = new Map();
|
|
20
|
+
for (const peer of frame.peers) {
|
|
21
|
+
peers.set(peer.session, { ...peer, arrivedAtMs: nowMs });
|
|
22
|
+
}
|
|
23
|
+
if (peers.size === 0)
|
|
24
|
+
this.#byResource.delete(frame.resource);
|
|
25
|
+
else
|
|
26
|
+
this.#byResource.set(frame.resource, peers);
|
|
27
|
+
}
|
|
28
|
+
/** Live peers for a resource, with expired entries dropped as of `nowMs`. */
|
|
29
|
+
peers(resource, nowMs) {
|
|
30
|
+
const peers = this.#byResource.get(resource);
|
|
31
|
+
if (!peers)
|
|
32
|
+
return [];
|
|
33
|
+
const alive = [];
|
|
34
|
+
for (const [session, peer] of peers) {
|
|
35
|
+
if (nowMs - peer.arrivedAtMs > this.ttlMs)
|
|
36
|
+
peers.delete(session);
|
|
37
|
+
else
|
|
38
|
+
alive.push(peer);
|
|
39
|
+
}
|
|
40
|
+
if (peers.size === 0)
|
|
41
|
+
this.#byResource.delete(resource);
|
|
42
|
+
return alive;
|
|
43
|
+
}
|
|
44
|
+
/** Delivery was lost: presence is not replayed after a gap, so the view must not outlive its stream. */
|
|
45
|
+
clear() {
|
|
46
|
+
this.#byResource.clear();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=presence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence.js","sourceRoot":"","sources":["../../src/machines/presence.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAyC,MAAM,0BAA0B,CAAC;AAOhG,MAAM,OAAO,YAAY;IAGM;IAF7B,WAAW,GAAG,IAAI,GAAG,EAAiC,CAAC;IAEvD,YAA6B,QAAgB,aAAa;QAA7B,UAAK,GAAL,KAAK,CAAwB;IAAG,CAAC;IAE9D,kHAAkH;IAClH,MAAM,CAAC,KAAoB,EAAE,KAAa;QACxC,MAAM,K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
* `merge3` is the diff3 core; the doc-write decision policy
|
|
4
|
+
* (`decideDocWrite` — outcome selection, retention-ring base resolution,
|
|
5
|
+
* overwrite-deletes-text) joins it here as the next extraction slice
|
|
6
|
+
* (ROADMAP.md #1).
|
|
7
|
+
*/
|
|
8
|
+
export * from './merge3.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/merge/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The merge layer: the text-reconciliation engine behind live documents.
|
|
3
|
+
* `merge3` is the diff3 core; the doc-write decision policy
|
|
4
|
+
* (`decideDocWrite` — outcome selection, retention-ring base resolution,
|
|
5
|
+
* overwrite-deletes-text) joins it here as the next extraction slice
|
|
6
|
+
* (ROADMAP.md #1).
|
|
7
|
+
*/
|
|
8
|
+
export * from './merge3.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/merge/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal three-way line-based merge (diff3) for live-document reconcile —
|
|
3
|
+
* the engine behind every `MergeOutcome` in `contracts/docs.ts`.
|
|
4
|
+
*
|
|
5
|
+
* merge3(base, ours, theirs) — all three are whole-file strings — answers:
|
|
6
|
+
* given that both OURS and THEIRS evolved from BASE, what single text keeps
|
|
7
|
+
* both sides' changes? Hunks (line regions changed relative to BASE) that
|
|
8
|
+
* touch different base regions merge automatically; hunks that overlap are
|
|
9
|
+
* conflicts. On conflict this module NEVER picks a winner silently: the
|
|
10
|
+
* merged text keeps OURS for the conflicted region and the conflict is
|
|
11
|
+
* reported to the caller, which is responsible for preserving THEIRS
|
|
12
|
+
* durably (the engine writes a sidecar file — axiom: never a silent
|
|
13
|
+
* winner).
|
|
14
|
+
*
|
|
15
|
+
* No dependencies by design. The diff is a plain LCS over lines (common
|
|
16
|
+
* prefix/suffix trimmed first); regions too large to LCS degrade to a
|
|
17
|
+
* single whole-region hunk, which can only ever OVER-report a conflict,
|
|
18
|
+
* never lose an edit.
|
|
19
|
+
*/
|
|
20
|
+
/** An overlapping region: line indices into BASE, each side's text for it. */
|
|
21
|
+
export interface MergeConflict {
|
|
22
|
+
readonly baseStart: number;
|
|
23
|
+
readonly baseEnd: number;
|
|
24
|
+
readonly ours: string;
|
|
25
|
+
readonly theirs: string;
|
|
26
|
+
}
|
|
27
|
+
export interface MergeResult {
|
|
28
|
+
/** The merged text; for conflicted regions it keeps OURS. */
|
|
29
|
+
readonly text: string;
|
|
30
|
+
readonly conflicts: readonly MergeConflict[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Three-way merge of whole-file strings.
|
|
34
|
+
*
|
|
35
|
+
* Fast paths: either side identical to base (or to the other side)
|
|
36
|
+
* short-circuits without diffing.
|
|
37
|
+
*/
|
|
38
|
+
export declare function merge3(baseText: string, oursText: string, theirsText: string): MergeResult;
|
|
39
|
+
//# sourceMappingURL=merge3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge3.d.ts","sourceRoot":"","sources":["../../src/merge/merge3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAwBH,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;CAC9C;AA+GD;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,CA2D1F"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal three-way line-based merge (diff3) for live-document reconcile —
|
|
3
|
+
* the engine behind every `MergeOutcome` in `contracts/docs.ts`.
|
|
4
|
+
*
|
|
5
|
+
* merge3(base, ours, theirs) — all three are whole-file strings — answers:
|
|
6
|
+
* given that both OURS and THEIRS evolved from BASE, what single text keeps
|
|
7
|
+
* both sides' changes? Hunks (line regions changed relative to BASE) that
|
|
8
|
+
* touch different base regions merge automatically; hunks that overlap are
|
|
9
|
+
* conflicts. On conflict this module NEVER picks a winner silently: the
|
|
10
|
+
* merged text keeps OURS for the conflicted region and the conflict is
|
|
11
|
+
* reported to the caller, which is responsible for preserving THEIRS
|
|
12
|
+
* durably (the engine writes a sidecar file — axiom: never a silent
|
|
13
|
+
* winner).
|
|
14
|
+
*
|
|
15
|
+
* No dependencies by design. The diff is a plain LCS over lines (common
|
|
16
|
+
* prefix/suffix trimmed first); regions too large to LCS degrade to a
|
|
17
|
+
* single whole-region hunk, which can only ever OVER-report a conflict,
|
|
18
|
+
* never lose an edit.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Cap on the LCS DP table (cells = changed-lines² after prefix/suffix
|
|
22
|
+
* trim). 4M cells ≈ 16MB of Int32 — beyond it the changed region collapses
|
|
23
|
+
* into one hunk per side, trading merge granularity for bounded memory.
|
|
24
|
+
*/
|
|
25
|
+
const MAX_LCS_CELLS = 4 * 1024 * 1024;
|
|
26
|
+
/** Split into lines with their terminators kept, so join('') reassembles exactly. */
|
|
27
|
+
function splitLines(text) {
|
|
28
|
+
if (text === '')
|
|
29
|
+
return [];
|
|
30
|
+
return text.split(/(?<=\n)/);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Longest common subsequence between a[aStart..aEnd) and b[bStart..bEnd),
|
|
34
|
+
* returned as matched index pairs [aIndex, bIndex] in increasing order.
|
|
35
|
+
*/
|
|
36
|
+
function lcsMatches(a, aStart, aEnd, b, bStart, bEnd) {
|
|
37
|
+
const n = aEnd - aStart;
|
|
38
|
+
const m = bEnd - bStart;
|
|
39
|
+
const width = m + 1;
|
|
40
|
+
const table = new Int32Array((n + 1) * width);
|
|
41
|
+
for (let i = 1; i <= n; i += 1) {
|
|
42
|
+
const line = a[aStart + i - 1];
|
|
43
|
+
for (let j = 1; j <= m; j += 1) {
|
|
44
|
+
table[i * width + j] =
|
|
45
|
+
line === b[bStart + j - 1]
|
|
46
|
+
? table[(i - 1) * width + (j - 1)] + 1
|
|
47
|
+
: Math.max(table[(i - 1) * width + j], table[i * width + (j - 1)]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const matches = [];
|
|
51
|
+
let i = n;
|
|
52
|
+
let j = m;
|
|
53
|
+
while (i > 0 && j > 0) {
|
|
54
|
+
if (a[aStart + i - 1] === b[bStart + j - 1] &&
|
|
55
|
+
table[i * width + j] === table[(i - 1) * width + (j - 1)] + 1) {
|
|
56
|
+
matches.push([aStart + i - 1, bStart + j - 1]);
|
|
57
|
+
i -= 1;
|
|
58
|
+
j -= 1;
|
|
59
|
+
}
|
|
60
|
+
else if (table[(i - 1) * width + j] >= table[i * width + (j - 1)]) {
|
|
61
|
+
i -= 1;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
j -= 1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
matches.reverse();
|
|
68
|
+
return matches;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Regions where `side` differs from `base`, in base order. Outside these
|
|
72
|
+
* hunks the two arrays match line for line.
|
|
73
|
+
*/
|
|
74
|
+
function diffHunks(base, side) {
|
|
75
|
+
let prefix = 0;
|
|
76
|
+
const maxPrefix = Math.min(base.length, side.length);
|
|
77
|
+
while (prefix < maxPrefix && base[prefix] === side[prefix])
|
|
78
|
+
prefix += 1;
|
|
79
|
+
let baseEnd = base.length;
|
|
80
|
+
let sideEnd = side.length;
|
|
81
|
+
while (baseEnd > prefix && sideEnd > prefix && base[baseEnd - 1] === side[sideEnd - 1]) {
|
|
82
|
+
baseEnd -= 1;
|
|
83
|
+
sideEnd -= 1;
|
|
84
|
+
}
|
|
85
|
+
const n = baseEnd - prefix;
|
|
86
|
+
const m = sideEnd - prefix;
|
|
87
|
+
if (n === 0 && m === 0)
|
|
88
|
+
return [];
|
|
89
|
+
if (n === 0 || m === 0 || n * m > MAX_LCS_CELLS) {
|
|
90
|
+
return [{ baseStart: prefix, baseLength: n, sideStart: prefix, sideLength: m }];
|
|
91
|
+
}
|
|
92
|
+
const hunks = [];
|
|
93
|
+
let b = prefix;
|
|
94
|
+
let s = prefix;
|
|
95
|
+
for (const [mb, ms] of lcsMatches(base, prefix, baseEnd, side, prefix, sideEnd)) {
|
|
96
|
+
if (mb > b || ms > s) {
|
|
97
|
+
hunks.push({ baseStart: b, baseLength: mb - b, sideStart: s, sideLength: ms - s });
|
|
98
|
+
}
|
|
99
|
+
b = mb + 1;
|
|
100
|
+
s = ms + 1;
|
|
101
|
+
}
|
|
102
|
+
if (baseEnd > b || sideEnd > s) {
|
|
103
|
+
hunks.push({ baseStart: b, baseLength: baseEnd - b, sideStart: s, sideLength: sideEnd - s });
|
|
104
|
+
}
|
|
105
|
+
return hunks;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The side's lines corresponding to the group's base range [start, end).
|
|
109
|
+
* Between its own hunks a side matches the base line for line, so the range
|
|
110
|
+
* extends from the first hunk (pulled back by the matched lead-in) to the
|
|
111
|
+
* last hunk (pushed forward by the matched tail).
|
|
112
|
+
*/
|
|
113
|
+
function sideSlice(group, sideHunks, baseLines, sideLines) {
|
|
114
|
+
if (sideHunks.length === 0)
|
|
115
|
+
return baseLines.slice(group.start, group.end);
|
|
116
|
+
const first = sideHunks[0];
|
|
117
|
+
const last = sideHunks[sideHunks.length - 1];
|
|
118
|
+
const lo = first.sideStart - (first.baseStart - group.start);
|
|
119
|
+
const hi = last.sideStart + last.sideLength + (group.end - (last.baseStart + last.baseLength));
|
|
120
|
+
return sideLines.slice(lo, hi);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Three-way merge of whole-file strings.
|
|
124
|
+
*
|
|
125
|
+
* Fast paths: either side identical to base (or to the other side)
|
|
126
|
+
* short-circuits without diffing.
|
|
127
|
+
*/
|
|
128
|
+
export function merge3(baseText, oursText, theirsText) {
|
|
129
|
+
if (oursText === theirsText)
|
|
130
|
+
return { text: oursText, conflicts: [] };
|
|
131
|
+
if (oursText === baseText)
|
|
132
|
+
return { text: theirsText, conflicts: [] };
|
|
133
|
+
if (theirsText === baseText)
|
|
134
|
+
return { text: oursText, conflicts: [] };
|
|
135
|
+
const base = splitLines(baseText);
|
|
136
|
+
const ours = splitLines(oursText);
|
|
137
|
+
const theirs = splitLines(theirsText);
|
|
138
|
+
const hunks = [
|
|
139
|
+
...diffHunks(base, ours).map((h) => ({ ...h, side: 'ours' })),
|
|
140
|
+
...diffHunks(base, theirs).map((h) => ({ ...h, side: 'theirs' })),
|
|
141
|
+
].sort((a, b) => a.baseStart - b.baseStart || (a.side === b.side ? 0 : a.side === 'ours' ? -1 : 1));
|
|
142
|
+
// Group hunks whose base ranges overlap. Adjacent (touching) ranges stay
|
|
143
|
+
// separate — they merge cleanly — with one exception: insertions from both
|
|
144
|
+
// sides at the exact same base point have no defined order, so they group
|
|
145
|
+
// (and therefore conflict) too.
|
|
146
|
+
const groups = [];
|
|
147
|
+
for (const hunk of hunks) {
|
|
148
|
+
const group = groups[groups.length - 1];
|
|
149
|
+
const joins = group &&
|
|
150
|
+
(hunk.baseStart < group.end ||
|
|
151
|
+
(hunk.baseStart === group.end &&
|
|
152
|
+
hunk.baseLength === 0 &&
|
|
153
|
+
group.hunks.some((h) => h.side !== hunk.side && h.baseLength === 0 && h.baseStart === hunk.baseStart)));
|
|
154
|
+
if (joins) {
|
|
155
|
+
group.hunks.push(hunk);
|
|
156
|
+
group.end = Math.max(group.end, hunk.baseStart + hunk.baseLength);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
groups.push({ start: hunk.baseStart, end: hunk.baseStart + hunk.baseLength, hunks: [hunk] });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const out = [];
|
|
163
|
+
const conflicts = [];
|
|
164
|
+
let cursor = 0;
|
|
165
|
+
for (const group of groups) {
|
|
166
|
+
out.push(base.slice(cursor, group.start).join(''));
|
|
167
|
+
const oursHunks = group.hunks.filter((h) => h.side === 'ours');
|
|
168
|
+
const theirsHunks = group.hunks.filter((h) => h.side === 'theirs');
|
|
169
|
+
const oursRegion = sideSlice(group, oursHunks, base, ours).join('');
|
|
170
|
+
const theirsRegion = sideSlice(group, theirsHunks, base, theirs).join('');
|
|
171
|
+
if (theirsHunks.length === 0 || oursRegion === theirsRegion) {
|
|
172
|
+
out.push(oursRegion);
|
|
173
|
+
}
|
|
174
|
+
else if (oursHunks.length === 0) {
|
|
175
|
+
out.push(theirsRegion);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
// Overlap with different content on each side: keep OURS in the text,
|
|
179
|
+
// surface the conflict to the caller.
|
|
180
|
+
conflicts.push({ baseStart: group.start, baseEnd: group.end, ours: oursRegion, theirs: theirsRegion });
|
|
181
|
+
out.push(oursRegion);
|
|
182
|
+
}
|
|
183
|
+
cursor = group.end;
|
|
184
|
+
}
|
|
185
|
+
out.push(base.slice(cursor).join(''));
|
|
186
|
+
return { text: out.join(''), conflicts };
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=merge3.js.map
|
|
@@ -0,0 +1 @@
|
|
|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,EAAE,YAAY,EAAE,CAAC,CAAC;YACvG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvB,CAAC;QACD,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC;IACrB,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC;AAC3C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@amalgm/live",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Portable realtime SDK for Amalgm — wire contracts, mutation discipline, and delivery state machines behind host-injected adapters.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/amalgm-inc/amalgm-live.git"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./contracts": {
|
|
20
|
+
"types": "./dist/contracts/index.d.ts",
|
|
21
|
+
"default": "./dist/contracts/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./machines": {
|
|
24
|
+
"types": "./dist/machines/index.d.ts",
|
|
25
|
+
"default": "./dist/machines/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./adapters": {
|
|
28
|
+
"types": "./dist/adapters/index.d.ts",
|
|
29
|
+
"default": "./dist/adapters/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"PURPOSE.md"
|
|
35
|
+
],
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p tsconfig.json",
|
|
41
|
+
"test": "npm run build && node --test tests/",
|
|
42
|
+
"test:parity": "npm run build && node --test tests/parity/",
|
|
43
|
+
"test:conformance": "npm run build && node --test tests/conformance/"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"typescript": "^5.7.3"
|
|
47
|
+
}
|
|
48
|
+
}
|