@cello-protocol/daemon 0.0.122 → 0.0.123

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 (57) hide show
  1. package/dist/daemon.js +65 -12
  2. package/dist/daemon.js.map +1 -1
  3. package/dist/document-store.d.ts +0 -88
  4. package/dist/document-store.d.ts.map +1 -1
  5. package/dist/document-store.js +1 -344
  6. package/dist/document-store.js.map +1 -1
  7. package/dist/document-write-path.d.ts.map +1 -1
  8. package/dist/document-write-path.js +43 -10
  9. package/dist/document-write-path.js.map +1 -1
  10. package/dist/reconnect-drain.d.ts +7 -0
  11. package/dist/reconnect-drain.d.ts.map +1 -1
  12. package/dist/reconnect-drain.js +18 -4
  13. package/dist/reconnect-drain.js.map +1 -1
  14. package/dist/retry-queue.d.ts +9 -1
  15. package/dist/retry-queue.d.ts.map +1 -1
  16. package/dist/retry-queue.js +38 -9
  17. package/dist/retry-queue.js.map +1 -1
  18. package/dist/session-content-handlers.d.ts.map +1 -1
  19. package/dist/session-content-handlers.js +7 -1
  20. package/dist/session-content-handlers.js.map +1 -1
  21. package/dist/session-node-manager.d.ts +4 -1
  22. package/dist/session-node-manager.d.ts.map +1 -1
  23. package/dist/session-node-manager.js +64 -8
  24. package/dist/session-node-manager.js.map +1 -1
  25. package/package.json +3 -3
  26. package/dist/document-delivery-transport.d.ts +0 -78
  27. package/dist/document-delivery-transport.d.ts.map +0 -1
  28. package/dist/document-delivery-transport.js +0 -109
  29. package/dist/document-delivery-transport.js.map +0 -1
  30. package/dist/document-delivery.d.ts +0 -130
  31. package/dist/document-delivery.d.ts.map +0 -1
  32. package/dist/document-delivery.js +0 -246
  33. package/dist/document-delivery.js.map +0 -1
  34. package/dist/document-handshake.d.ts +0 -88
  35. package/dist/document-handshake.d.ts.map +0 -1
  36. package/dist/document-handshake.js +0 -239
  37. package/dist/document-handshake.js.map +0 -1
  38. package/dist/document-lifecycle.d.ts +0 -104
  39. package/dist/document-lifecycle.d.ts.map +0 -1
  40. package/dist/document-lifecycle.js +0 -363
  41. package/dist/document-lifecycle.js.map +0 -1
  42. package/dist/document-notify.d.ts +0 -130
  43. package/dist/document-notify.d.ts.map +0 -1
  44. package/dist/document-notify.js +0 -313
  45. package/dist/document-notify.js.map +0 -1
  46. package/dist/document-reachability.d.ts +0 -42
  47. package/dist/document-reachability.d.ts.map +0 -1
  48. package/dist/document-reachability.js +0 -72
  49. package/dist/document-reachability.js.map +0 -1
  50. package/dist/document-rejection.d.ts +0 -224
  51. package/dist/document-rejection.d.ts.map +0 -1
  52. package/dist/document-rejection.js +0 -374
  53. package/dist/document-rejection.js.map +0 -1
  54. package/dist/line-lcs.d.ts +0 -51
  55. package/dist/line-lcs.d.ts.map +0 -1
  56. package/dist/line-lcs.js +0 -71
  57. package/dist/line-lcs.js.map +0 -1
@@ -1,51 +0,0 @@
1
- /**
2
- * The line LCS, shared by the write path (DOD-DOC-WRITE-1) and the diff surfaces
3
- * (DOD-DOC-NOTIFY-1).
4
- *
5
- * One implementation, deliberately. These two need to agree about what changed — the write path
6
- * publishes hunks and the diff surfaces describe them to an operator — and two hand-rolled diffs
7
- * that must agree are two things to keep in step, which is how they stop agreeing.
8
- *
9
- * ── WHY A REAL LCS AND NOT A PREFIX/SUFFIX TRIM ───────────────────────────────────────────────
10
- *
11
- * Measured twice, in two units, with the same result. A prefix/suffix trim is correct only when
12
- * exactly one contiguous region changed; the moment a line is INSERTED or DELETED, everything after
13
- * it shifts and a naive positional walk reports the whole remainder as rewritten:
14
- *
15
- * inserting one line at the top of a 3-line file -> +4 -3, one range covering the file
16
- *
17
- * In the write path (WRITE-1) that published text the file did not contain — four of six ordinary
18
- * markdown edits. In the diff surfaces (NOTIFY-1) it made the overlap flag permanently true, which
19
- * is worse than useless: the flag exists so an agent can tell whether the peer touched what it
20
- * touched, and one that always says yes trains the agent to ignore it.
21
- *
22
- * A real LCS is also what emits SEPARATE runs for separated edits. One span from the first change
23
- * to the last would delete and re-insert everything between them as new operations, resurrecting
24
- * text a peer concurrently deleted — and under publish-on-intent, multi-edit publishes are the
25
- * modal case.
26
- */
27
- /** Above this many lines the table is not worth building — the caller falls back and says so. */
28
- export declare const LCS_LINE_LIMIT = 4000;
29
- /**
30
- * A contiguous run of changed lines, as HALF-OPEN index ranges into each side.
31
- *
32
- * `aStart === aEnd` is a pure insertion; `bStart === bEnd` is a pure deletion. Half-open because
33
- * the empty range then has an unambiguous spelling, which a closed range does not.
34
- */
35
- export interface LineRun {
36
- aStart: number;
37
- aEnd: number;
38
- bStart: number;
39
- bEnd: number;
40
- }
41
- /** Lines carrying their own trailing newline; the last line carries none. */
42
- export declare function toChunks(text: string): string[];
43
- /**
44
- * The runs of changed lines between two chunk arrays.
45
- *
46
- * Returns `null` when either side exceeds `LCS_LINE_LIMIT` — the quadratic table on a document
47
- * that large is the wrong kind of thorough, and a caller that silently degraded instead of being
48
- * told would report a whole-file rewrite as if it were a measurement.
49
- */
50
- export declare function lineRuns(a: readonly string[], b: readonly string[]): LineRun[] | null;
51
- //# sourceMappingURL=line-lcs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"line-lcs.d.ts","sourceRoot":"","sources":["../src/line-lcs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,iGAAiG;AACjG,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAG/C;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CA8BrF"}
package/dist/line-lcs.js DELETED
@@ -1,71 +0,0 @@
1
- /**
2
- * The line LCS, shared by the write path (DOD-DOC-WRITE-1) and the diff surfaces
3
- * (DOD-DOC-NOTIFY-1).
4
- *
5
- * One implementation, deliberately. These two need to agree about what changed — the write path
6
- * publishes hunks and the diff surfaces describe them to an operator — and two hand-rolled diffs
7
- * that must agree are two things to keep in step, which is how they stop agreeing.
8
- *
9
- * ── WHY A REAL LCS AND NOT A PREFIX/SUFFIX TRIM ───────────────────────────────────────────────
10
- *
11
- * Measured twice, in two units, with the same result. A prefix/suffix trim is correct only when
12
- * exactly one contiguous region changed; the moment a line is INSERTED or DELETED, everything after
13
- * it shifts and a naive positional walk reports the whole remainder as rewritten:
14
- *
15
- * inserting one line at the top of a 3-line file -> +4 -3, one range covering the file
16
- *
17
- * In the write path (WRITE-1) that published text the file did not contain — four of six ordinary
18
- * markdown edits. In the diff surfaces (NOTIFY-1) it made the overlap flag permanently true, which
19
- * is worse than useless: the flag exists so an agent can tell whether the peer touched what it
20
- * touched, and one that always says yes trains the agent to ignore it.
21
- *
22
- * A real LCS is also what emits SEPARATE runs for separated edits. One span from the first change
23
- * to the last would delete and re-insert everything between them as new operations, resurrecting
24
- * text a peer concurrently deleted — and under publish-on-intent, multi-edit publishes are the
25
- * modal case.
26
- */
27
- /** Above this many lines the table is not worth building — the caller falls back and says so. */
28
- export const LCS_LINE_LIMIT = 4000;
29
- /** Lines carrying their own trailing newline; the last line carries none. */
30
- export function toChunks(text) {
31
- const lines = text.split("\n");
32
- return lines.map((line, index) => (index < lines.length - 1 ? `${line}\n` : line));
33
- }
34
- /**
35
- * The runs of changed lines between two chunk arrays.
36
- *
37
- * Returns `null` when either side exceeds `LCS_LINE_LIMIT` — the quadratic table on a document
38
- * that large is the wrong kind of thorough, and a caller that silently degraded instead of being
39
- * told would report a whole-file rewrite as if it were a measurement.
40
- */
41
- export function lineRuns(a, b) {
42
- if (a.length > LCS_LINE_LIMIT || b.length > LCS_LINE_LIMIT)
43
- return null;
44
- const lcs = Array.from({ length: a.length + 1 }, () => new Array(b.length + 1).fill(0));
45
- for (let i = a.length - 1; i >= 0; i--) {
46
- for (let j = b.length - 1; j >= 0; j--) {
47
- lcs[i][j] = a[i] === b[j] ? lcs[i + 1][j + 1] + 1 : Math.max(lcs[i + 1][j], lcs[i][j + 1]);
48
- }
49
- }
50
- const runs = [];
51
- let i = 0;
52
- let j = 0;
53
- while (i < a.length || j < b.length) {
54
- if (i < a.length && j < b.length && a[i] === b[j]) {
55
- i++;
56
- j++;
57
- continue;
58
- }
59
- const aStart = i;
60
- const bStart = j;
61
- while ((i < a.length || j < b.length) && !(i < a.length && j < b.length && a[i] === b[j])) {
62
- if (j < b.length && (i === a.length || lcs[i][j + 1] >= lcs[i + 1][j]))
63
- j++;
64
- else
65
- i++;
66
- }
67
- runs.push({ aStart, aEnd: i, bStart, bEnd: j });
68
- }
69
- return runs;
70
- }
71
- //# sourceMappingURL=line-lcs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"line-lcs.js","sourceRoot":"","sources":["../src/line-lcs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,iGAAiG;AACjG,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAenC,6EAA6E;AAC7E,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACrF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,CAAoB,EAAE,CAAoB;IACjE,IAAI,CAAC,CAA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