@hydranium/protocol 1.0.0-next.17 → 1.0.0-next.173

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 (177) hide show
  1. package/README.md +35 -1
  2. package/lib/client/data-connection.d.ts +157 -0
  3. package/lib/client/data-connection.d.ts.map +1 -0
  4. package/lib/client/data-connection.js +236 -0
  5. package/lib/client/data-connection.js.map +1 -0
  6. package/lib/client/data-events.d.ts +13 -1
  7. package/lib/client/data-events.d.ts.map +1 -1
  8. package/lib/client/data-events.js +21 -0
  9. package/lib/client/data-events.js.map +1 -1
  10. package/lib/client/data-port.d.ts +25 -23
  11. package/lib/client/data-port.d.ts.map +1 -1
  12. package/lib/client/data-session.d.ts +440 -78
  13. package/lib/client/data-session.d.ts.map +1 -1
  14. package/lib/client/data-session.js +697 -106
  15. package/lib/client/data-session.js.map +1 -1
  16. package/lib/client/index.d.ts +13 -8
  17. package/lib/client/index.d.ts.map +1 -1
  18. package/lib/client/index.js +13 -8
  19. package/lib/client/index.js.map +1 -1
  20. package/lib/client/message-relay.d.ts +9 -3
  21. package/lib/client/message-relay.d.ts.map +1 -1
  22. package/lib/client/message-relay.js +11 -5
  23. package/lib/client/message-relay.js.map +1 -1
  24. package/lib/client/post-message-transport.d.ts +64 -3
  25. package/lib/client/post-message-transport.d.ts.map +1 -1
  26. package/lib/client/post-message-transport.js +175 -1
  27. package/lib/client/post-message-transport.js.map +1 -1
  28. package/lib/client/rpc-connection.d.ts +149 -0
  29. package/lib/client/rpc-connection.d.ts.map +1 -0
  30. package/lib/client/rpc-connection.js +188 -0
  31. package/lib/client/rpc-connection.js.map +1 -0
  32. package/lib/client-ids.d.ts +45 -0
  33. package/lib/client-ids.d.ts.map +1 -0
  34. package/lib/client-ids.js +48 -0
  35. package/lib/client-ids.js.map +1 -0
  36. package/lib/clock.d.ts +38 -0
  37. package/lib/clock.d.ts.map +1 -1
  38. package/lib/clock.js +36 -1
  39. package/lib/clock.js.map +1 -1
  40. package/lib/data/data-protocol-methods.d.ts +4 -4
  41. package/lib/data/data-protocol-methods.d.ts.map +1 -1
  42. package/lib/data/data-protocol-methods.js +11 -1
  43. package/lib/data/data-protocol-methods.js.map +1 -1
  44. package/lib/data/data-server-protocol.d.ts +111 -31
  45. package/lib/data/data-server-protocol.d.ts.map +1 -1
  46. package/lib/data/events.d.ts +103 -14
  47. package/lib/data/events.d.ts.map +1 -1
  48. package/lib/data/requests.d.ts +67 -11
  49. package/lib/data/requests.d.ts.map +1 -1
  50. package/lib/errors.d.ts +163 -17
  51. package/lib/errors.d.ts.map +1 -1
  52. package/lib/errors.js +219 -22
  53. package/lib/errors.js.map +1 -1
  54. package/lib/glsp-save-model-actions.d.ts +50 -0
  55. package/lib/glsp-save-model-actions.d.ts.map +1 -0
  56. package/lib/glsp-save-model-actions.js +28 -0
  57. package/lib/glsp-save-model-actions.js.map +1 -0
  58. package/lib/index.d.ts +3 -0
  59. package/lib/index.d.ts.map +1 -1
  60. package/lib/index.js +6 -0
  61. package/lib/index.js.map +1 -1
  62. package/lib/latency-collector.d.ts +8 -4
  63. package/lib/latency-collector.d.ts.map +1 -1
  64. package/lib/latency-collector.js.map +1 -1
  65. package/lib/messages/index.d.ts +29 -0
  66. package/lib/messages/index.d.ts.map +1 -0
  67. package/lib/messages/index.js +58 -0
  68. package/lib/messages/index.js.map +1 -0
  69. package/lib/messages/primitives.d.ts +188 -0
  70. package/lib/messages/primitives.d.ts.map +1 -0
  71. package/lib/messages/primitives.js +161 -0
  72. package/lib/messages/primitives.js.map +1 -0
  73. package/lib/model-server.d.ts +60 -13
  74. package/lib/model-server.d.ts.map +1 -1
  75. package/lib/model-server.js +4 -2
  76. package/lib/model-server.js.map +1 -1
  77. package/lib/model-service/based-on.d.ts +57 -0
  78. package/lib/model-service/based-on.d.ts.map +1 -0
  79. package/lib/model-service/based-on.js +37 -0
  80. package/lib/model-service/based-on.js.map +1 -0
  81. package/lib/model-service/index.d.ts +1 -1
  82. package/lib/model-service/index.d.ts.map +1 -1
  83. package/lib/model-service/index.js +4 -5
  84. package/lib/model-service/index.js.map +1 -1
  85. package/lib/patch-merge.d.ts +28 -27
  86. package/lib/patch-merge.d.ts.map +1 -1
  87. package/lib/patch-merge.js +66 -22
  88. package/lib/patch-merge.js.map +1 -1
  89. package/lib/profile-session.d.ts +8 -4
  90. package/lib/profile-session.d.ts.map +1 -1
  91. package/lib/profile-session.js.map +1 -1
  92. package/lib/rpc/bind-rpc-methods.d.ts +29 -3
  93. package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
  94. package/lib/rpc/bind-rpc-methods.js +22 -3
  95. package/lib/rpc/bind-rpc-methods.js.map +1 -1
  96. package/lib/rpc/create-rpc-proxy.d.ts +7 -0
  97. package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
  98. package/lib/rpc/create-rpc-proxy.js +6 -1
  99. package/lib/rpc/create-rpc-proxy.js.map +1 -1
  100. package/lib/testing/catalogue-audit.d.ts +80 -0
  101. package/lib/testing/catalogue-audit.d.ts.map +1 -0
  102. package/lib/testing/catalogue-audit.js +94 -0
  103. package/lib/testing/catalogue-audit.js.map +1 -0
  104. package/lib/testing/data-doubles.d.ts +13 -12
  105. package/lib/testing/data-doubles.d.ts.map +1 -1
  106. package/lib/testing/data-doubles.js +19 -5
  107. package/lib/testing/data-doubles.js.map +1 -1
  108. package/lib/testing/fake-clock.d.ts +9 -1
  109. package/lib/testing/fake-clock.d.ts.map +1 -1
  110. package/lib/testing/fake-clock.js +54 -45
  111. package/lib/testing/fake-clock.js.map +1 -1
  112. package/lib/testing/index.d.ts +1 -0
  113. package/lib/testing/index.d.ts.map +1 -1
  114. package/lib/testing/index.js +4 -1
  115. package/lib/testing/index.js.map +1 -1
  116. package/lib/testing/node/index.d.ts +1 -0
  117. package/lib/testing/node/index.d.ts.map +1 -1
  118. package/lib/testing/node/index.js +2 -2
  119. package/lib/testing/node/index.js.map +1 -1
  120. package/lib/testing/node/message-port-pair.d.ts +25 -0
  121. package/lib/testing/node/message-port-pair.d.ts.map +1 -0
  122. package/lib/testing/node/message-port-pair.js +26 -0
  123. package/lib/testing/node/message-port-pair.js.map +1 -0
  124. package/lib/transfer-diagnostic.d.ts +33 -0
  125. package/lib/transfer-diagnostic.d.ts.map +1 -1
  126. package/lib/transfer-diagnostic.js +23 -0
  127. package/lib/transfer-diagnostic.js.map +1 -1
  128. package/lib/transfer-document.d.ts +34 -5
  129. package/lib/transfer-document.d.ts.map +1 -1
  130. package/lib/transfer-document.js +14 -1
  131. package/lib/transfer-document.js.map +1 -1
  132. package/lib/util.d.ts +8 -0
  133. package/lib/util.d.ts.map +1 -1
  134. package/lib/util.js +32 -0
  135. package/lib/util.js.map +1 -1
  136. package/package.json +11 -2
  137. package/src/client/data-connection.ts +314 -0
  138. package/src/client/data-events.ts +33 -1
  139. package/src/client/data-port.ts +26 -24
  140. package/src/client/data-session.ts +880 -123
  141. package/src/client/index.ts +13 -8
  142. package/src/client/message-relay.ts +29 -7
  143. package/src/client/post-message-transport.ts +219 -4
  144. package/src/client/rpc-connection.ts +254 -0
  145. package/src/client-ids.ts +49 -0
  146. package/src/clock.ts +56 -0
  147. package/src/data/data-protocol-methods.ts +11 -3
  148. package/src/data/data-server-protocol.ts +132 -31
  149. package/src/data/events.ts +109 -14
  150. package/src/data/requests.ts +71 -11
  151. package/src/errors.ts +259 -24
  152. package/src/glsp-save-model-actions.ts +59 -0
  153. package/src/index.ts +6 -0
  154. package/src/latency-collector.ts +8 -3
  155. package/src/messages/index.ts +36 -0
  156. package/src/messages/primitives.ts +271 -0
  157. package/src/model-server.ts +63 -18
  158. package/src/model-service/based-on.ts +63 -0
  159. package/src/model-service/index.ts +4 -5
  160. package/src/patch-merge.ts +90 -37
  161. package/src/profile-session.ts +9 -4
  162. package/src/rpc/bind-rpc-methods.ts +49 -4
  163. package/src/rpc/create-rpc-proxy.ts +14 -1
  164. package/src/testing/catalogue-audit.ts +111 -0
  165. package/src/testing/data-doubles.ts +42 -17
  166. package/src/testing/fake-clock.ts +62 -47
  167. package/src/testing/index.ts +4 -1
  168. package/src/testing/node/index.ts +2 -2
  169. package/src/testing/node/message-port-pair.ts +40 -0
  170. package/src/transfer-diagnostic.ts +40 -0
  171. package/src/transfer-document.ts +41 -6
  172. package/src/util.ts +33 -0
  173. package/lib/model-service/args.d.ts +0 -64
  174. package/lib/model-service/args.d.ts.map +0 -1
  175. package/lib/model-service/args.js +0 -11
  176. package/lib/model-service/args.js.map +0 -1
  177. package/src/model-service/args.ts +0 -67
@@ -12,8 +12,14 @@
12
12
  * language identifier — consumers parameterise the document/root types
13
13
  * over `TRoot`.
14
14
  */
15
- import type { TransferClientArgs } from './model-service/args';
16
15
  import type { ReferenceCandidate } from './model-service/reference-candidate';
16
+ /** Identifies a client-document binding. */
17
+ export interface TransferClientArgs {
18
+ /** Document URI. */
19
+ uri: string;
20
+ /** Stable identifier for the client invoking the operation. */
21
+ clientId: string;
22
+ }
17
23
  /** Open a document on behalf of a client. */
18
24
  export interface OpenModelArgs extends TransferClientArgs {
19
25
  /**
@@ -35,19 +41,43 @@ export interface OpenModelArgs extends TransferClientArgs {
35
41
  * means read from the filesystem, which is the normal case.
36
42
  *
37
43
  * Honoured only on the first open of a URI: opening an already-open document
38
- * is a no-op, so passing `text` for one silently changes nothing. Write
39
- * through the update path instead.
44
+ * attaches the caller to the existing shared entry and does not replace its
45
+ * content with this seed. Write through the update path instead. The open
46
+ * response reads the current shared content after registration; a textual
47
+ * `didOpen` attach may separately refresh the build.
40
48
  */
41
49
  text?: string;
50
+ /**
51
+ * Kept on the server for this client's open until it closes, for the
52
+ * server's own open path to read. Only a client session's open keeps them,
53
+ * and a repeat open keeps the first open's.
54
+ */
55
+ options?: object;
42
56
  }
43
57
  /** Close a previously-opened document for the client. */
44
58
  export interface CloseModelArgs extends TransferClientArgs {
45
59
  }
46
60
  export interface TransferUpdatedEvent<TDocument> {
47
61
  document: TDocument;
62
+ /**
63
+ * The client whose write this event echoes: the author of the version on a
64
+ * `'changed'`, and the unknown-client id on a `'rebuilt'`, which echoes no
65
+ * write. A recipient compares it against its own id to recognise its echo.
66
+ */
48
67
  sourceClientId: string;
49
- /** See `ModelDocumentUpdateReason` in `./data/events` for the canonical reason set + semantics. */
50
- reason: 'changed' | 'deleted' | 'rebuilt' | 'saved';
68
+ /** See `TransferDocumentUpdateReason` in `./data/events` for the canonical reason set + semantics. */
69
+ reason: 'changed' | 'rebuilt' | 'saved';
70
+ /**
71
+ * The client whose write caused the build that produced this event, or the
72
+ * unknown-client id when no single client's did. On a `'changed'` it is the
73
+ * version's author. A `'rebuilt'` names the writer of another document, so
74
+ * it is a cause, never an echo: its diagnostics and references are new to
75
+ * that writer too.
76
+ *
77
+ * In-process only: the data head does not send it, and an event built
78
+ * elsewhere may leave it out, which a reader takes as "not known".
79
+ */
80
+ causedBy?: string;
51
81
  }
52
82
  export interface TransferSavedEvent<TDocument> {
53
83
  /** The document as persisted — the state that reached disk, not the state at request time. */
@@ -114,10 +144,10 @@ export declare function isElementSource(object: unknown): object is ElementSourc
114
144
  /** An element of a document that does not yet exist on disk — used during element creation flows. */
115
145
  export interface SyntheticSource {
116
146
  /**
117
- * The document the element would belong to. That document must already be
118
- * LOADED — the default resolution takes its parse root as the synthetic
119
- * node's container and answers `undefined` when it is not, so a URI for a
120
- * file that exists on disk but was never opened resolves to nothing.
147
+ * The document the element would belong to. It need not be loaded, or
148
+ * exist — an unloaded URI materialises a transient empty document, so a
149
+ * folder is a valid anchor. A URI that IS loaded contributes that
150
+ * document's parse root as the container, putting its contents in scope.
121
151
  */
122
152
  uri: string;
123
153
  /**
@@ -126,6 +156,16 @@ export interface SyntheticSource {
126
156
  * it is what scoping filters candidates against.
127
157
  */
128
158
  type: string;
159
+ /**
160
+ * The grammar the element will belong to, as a language id.
161
+ *
162
+ * Optional because `uri` and `type` each answer on their own when
163
+ * unambiguous. Set it when neither is: a URI naming no file carries no
164
+ * extension to route on, and a `type` two grammars can produce identifies
165
+ * neither. Unset, such a source reaches the server's own policy, which
166
+ * answers the same way for every caller.
167
+ */
168
+ language?: string;
129
169
  }
130
170
  export declare function isSyntheticSource(object: unknown): object is SyntheticSource;
131
171
  /**
@@ -135,7 +175,7 @@ export declare function isSyntheticSource(object: unknown): object is SyntheticS
135
175
  export declare namespace ReferenceSource {
136
176
  function document(uri: string): DocumentSource;
137
177
  function element(name: string, type?: string): ElementSource;
138
- function synthetic(uri: string, type: string): SyntheticSource;
178
+ function synthetic(uri: string, type: string, language?: string): SyntheticSource;
139
179
  }
140
180
  /**
141
181
  * One step in a synthetic navigation path from a {@link ReferenceSource}
@@ -329,9 +369,10 @@ export interface FindNextNameArgs {
329
369
  */
330
370
  uri: string;
331
371
  /**
332
- * The AST `$type` of the element being named. Collisions are only looked for
333
- * among elements of that same type, so the returned name may still be taken
334
- * by an element of another type.
372
+ * The AST `$type` of the element being named. Collisions are looked for
373
+ * among elements of that type and of any subtype of it, so a supertype
374
+ * names a uniqueness scope its concrete types share; the returned name may
375
+ * still be taken by an element outside that hierarchy.
335
376
  */
336
377
  type: string;
337
378
  /**
@@ -348,5 +389,11 @@ export interface FindNextNameArgs {
348
389
  * See {@link NameTier} for what each tier covers.
349
390
  */
350
391
  tier?: NameTier;
392
+ /**
393
+ * The grammar to name under, routed as {@link SyntheticSource.language} —
394
+ * this call builds one. A caller that sets it there must set it here, or
395
+ * candidates and the name it proposes come from different grammars.
396
+ */
397
+ language?: string;
351
398
  }
352
399
  //# sourceMappingURL=model-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-server.d.ts","sourceRoot":"","sources":["../src/model-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAW9E,6CAA6C;AAC7C,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACtD;;;;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;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -47,8 +47,10 @@ var ReferenceSource;
47
47
  return { name, type };
48
48
  }
49
49
  ReferenceSource.element = element;
50
- function synthetic(uri, type) {
51
- return { uri, type };
50
+ function synthetic(uri, type, language) {
51
+ // The key is omitted rather than set to `undefined`, so a source built
52
+ // without a language stays deep-equal to the two-argument form.
53
+ return language === undefined ? { uri, type } : { uri, type, language };
52
54
  }
53
55
  ReferenceSource.synthetic = synthetic;
54
56
  })(ReferenceSource || (exports.ReferenceSource = ReferenceSource = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"model-server.js","sourceRoot":"","sources":["../src/model-server.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAyGlF,4CAEC;AA4BD,0CAEC;AAmBD,8CASC;AAkED,0CASC;AAyDD,gDAQC;AA7MD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,MAAe;IAC7C,OAAO,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC;AACtG,CAAC;AA4BD,SAAgB,eAAe,CAAC,MAAe;IAC5C,OAAO,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AACxG,CAAC;AAmBD,SAAgB,iBAAiB,CAAC,MAAe;IAC9C,OAAO,CACJ,CAAC,CAAC,MAAM;QACR,OAAO,MAAM,KAAK,QAAQ;QAC1B,KAAK,IAAI,MAAM;QACf,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;QA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H,SAAgB,IAAI,CAAC,OAAyB,EAAE,SAA6B;QAC1E,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;IACjD,CAAC;IAFe,qBAAI,OAEnB,CAAA;AACJ,CAAC,EAlBgB,gBAAgB,gCAAhB,gBAAgB,QAkBhC"}
@@ -0,0 +1,57 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ declare const snapshotMarker: unique symbol;
10
+ /**
11
+ * A text-document version that came out of a SNAPSHOT read: a document
12
+ * envelope's `version`, which cannot move once the envelope exists.
13
+ *
14
+ * A plain number at runtime, usable anywhere a number is, and it travels the
15
+ * wire as one. The marker exists only so the compiler can tell it apart from a
16
+ * version read off a LIVE document, which is the same number type and is the
17
+ * defect the conflict gate exists to prevent: read at write time it is whatever
18
+ * the server is at now, which is the number the gate is about to compare it
19
+ * against, so the gate passes unconditionally and a concurrent edit is
20
+ * overwritten with nothing logged.
21
+ */
22
+ export type SnapshotVersion = number & {
23
+ readonly [snapshotMarker]: true;
24
+ };
25
+ /**
26
+ * What a write declares it was based on: a version from a snapshot read, or
27
+ * `'anything'`.
28
+ *
29
+ * `'anything'` is a precondition that always holds — the write accepts whatever
30
+ * the server currently has, and therefore overwrites it. It is the honest
31
+ * answer wherever the write was authored against no particular server version,
32
+ * and a lie anywhere a reader handed the writer a document. The field carrying
33
+ * it is required, so an ungated write is a word someone chose rather than a
34
+ * field someone forgot.
35
+ */
36
+ export type BasedOn = SnapshotVersion | 'anything';
37
+ /**
38
+ * Whether `basedOn` names a version, and so arms the gate.
39
+ *
40
+ * Branch on this rather than on `basedOn !== 'anything'`, which reads as "not
41
+ * based on anything" — the opposite of what the branch tests.
42
+ */
43
+ export declare function isSnapshotVersion(basedOn: BasedOn): basedOn is SnapshotVersion;
44
+ /**
45
+ * Mark a version as having come from a snapshot read.
46
+ *
47
+ * **For the envelope constructors, not for callers.** Every door that builds a
48
+ * document envelope applies it on the way in, so anything a read returns
49
+ * already carries it and a writer never needs this. A caller reaching for it is
50
+ * asserting a provenance the compiler was about to deny — the read-late defect
51
+ * written out where a reviewer can see it.
52
+ */
53
+ export declare function asSnapshotVersion(version: number): SnapshotVersion;
54
+ /** A snapshot version no write can match, so a write based on it conflicts. */
55
+ export declare const NO_MATCHING_VERSION: SnapshotVersion;
56
+ export {};
57
+ //# sourceMappingURL=based-on.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"based-on.d.ts","sourceRoot":"","sources":["../../src/model-service/based-on.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,CAAC,MAAM,cAAc,EAAE,OAAO,MAAM,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,UAAU,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,eAAe,CAE9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAElE;AAED,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,EAAE,eAAuC,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the MIT License which is available in the project root.
7
+ *
8
+ * SPDX-License-Identifier: MIT
9
+ ********************************************************************************/
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.NO_MATCHING_VERSION = void 0;
12
+ exports.isSnapshotVersion = isSnapshotVersion;
13
+ exports.asSnapshotVersion = asSnapshotVersion;
14
+ /**
15
+ * Whether `basedOn` names a version, and so arms the gate.
16
+ *
17
+ * Branch on this rather than on `basedOn !== 'anything'`, which reads as "not
18
+ * based on anything" — the opposite of what the branch tests.
19
+ */
20
+ function isSnapshotVersion(basedOn) {
21
+ return typeof basedOn === 'number';
22
+ }
23
+ /**
24
+ * Mark a version as having come from a snapshot read.
25
+ *
26
+ * **For the envelope constructors, not for callers.** Every door that builds a
27
+ * document envelope applies it on the way in, so anything a read returns
28
+ * already carries it and a writer never needs this. A caller reaching for it is
29
+ * asserting a provenance the compiler was about to deny — the read-late defect
30
+ * written out where a reviewer can see it.
31
+ */
32
+ function asSnapshotVersion(version) {
33
+ return version;
34
+ }
35
+ /** A snapshot version no write can match, so a write based on it conflicts. */
36
+ exports.NO_MATCHING_VERSION = asSnapshotVersion(-1);
37
+ //# sourceMappingURL=based-on.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"based-on.js","sourceRoot":"","sources":["../../src/model-service/based-on.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAqClF,8CAEC;AAWD,8CAEC;AArBD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,OAAgB;IAC/C,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC;AACtC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAAC,OAAe;IAC9C,OAAO,OAA0B,CAAC;AACrC,CAAC;AAED,+EAA+E;AAClE,QAAA,mBAAmB,GAAoB,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -6,6 +6,6 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
- export * from './args';
9
+ export * from './based-on';
10
10
  export * from './reference-candidate';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAOlF,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
@@ -22,10 +22,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
22
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- // Subpath barrel for the in-process `ModelService` facade contract. The
26
- // implementation lives in `@hydranium/core`; this package owns the
27
- // argument types so both the framework facade and the data-server wire
28
- // protocol can structurally agree on the lifecycle shape.
29
- __exportStar(require("./args"), exports);
25
+ // Generic payload types the data protocol shares with core: the based-on
26
+ // version, which the server's model service checks writes against, and the
27
+ // reference candidates, which core's scope and completion code produce.
28
+ __exportStar(require("./based-on"), exports);
30
29
  __exportStar(require("./reference-candidate"), exports);
31
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,wEAAwE;AACxE,mEAAmE;AACnE,uEAAuE;AACvE,0DAA0D;AAE1D,yCAAuB;AACvB,wDAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,yEAAyE;AACzE,2EAA2E;AAC3E,wEAAwE;AAExE,6CAA2B;AAC3B,wDAAsC"}
@@ -8,58 +8,58 @@
8
8
  ********************************************************************************/
9
9
  import { type Operation as JsonPatchOperation } from 'fast-json-patch';
10
10
  /**
11
- * Augment a user-intent JSON patch (computed `baseline → attempted`) with
11
+ * Augment a user-intent JSON patch (computed `base → ours`) with
12
12
  * `test` ops so a strict `applyPatch` against freshly-fetched server state
13
13
  * fails loudly when a foreign writer changed a path the user also changed.
14
14
  *
15
15
  * `fast-json-patch`'s `validateOperation: true` validates op structure and
16
16
  * path resolvability but NOT the pre-existing value — a plain `replace` /
17
17
  * `remove` silently overwrites whatever the foreign writer put there. For each
18
- * `replace` / `remove` op we prepend a `test` op carrying the baseline value at
18
+ * `replace` / `remove` op we prepend a `test` op carrying the base value at
19
19
  * that path, so a same-path divergence becomes a `TEST_OPERATION_FAILED` throw.
20
20
  * The caller treats that as a real field-level conflict (drop + refetch) rather
21
21
  * than silently clobbering the foreign edit.
22
22
  *
23
- * `add` ops are left unguarded: the path is new, so there is no baseline value
24
- * to test against, and add-vs-add overlaps are out of scope for this floor.
23
+ * `add` ops get no `test` op: the path is new, so there is no base value
24
+ * to test. {@link reconcileByPatchReplay} checks them against theirs
25
+ * instead; a caller applying this patch itself does not get that check.
25
26
  *
26
27
  * Used behind the framework's `ConflictError` contract by every reconcile
27
28
  * path — the GLSP recording command's undo/redo and forward-write, via
28
29
  * {@link ReconcilingConflictResolver}, and an adopter's form-widget save — so
29
30
  * they share one collision-detection rule.
30
31
  */
31
- export declare function augmentWithTestOps(baseline: object, userPatch: ReadonlyArray<JsonPatchOperation>): JsonPatchOperation[];
32
+ export declare function augmentWithTestOps(base: object, userPatch: ReadonlyArray<JsonPatchOperation>): JsonPatchOperation[];
32
33
  /**
33
- * Outcome of {@link reconcileByPatchReplay}. The caller persists / re-baselines
34
- * on `merged`, drops + surfaces the `fresh` root on `conflict`, and decides its
35
- * own fallback (e.g. force-retry) on `no-op` / `unavailable`.
34
+ * Outcome of {@link reconcileByPatchReplay}. The caller persists `merged` and
35
+ * takes it as the new base, drops + surfaces the `theirs` root on `conflict`, and
36
+ * decides its own fallback (e.g. force-retry) on `no-op` / `unavailable`.
36
37
  */
37
38
  export type ReconcileOutcome<T> = {
38
39
  /** The replay succeeded: the foreign writer touched no path the user did. */
39
40
  status: 'merged';
40
41
  /**
41
- * A fresh root built on the refetched server state, carrying both
42
- * intents. It is NOT the caller's `attempted` root — re-baseline on
43
- * this value, or the next write diffs against state the server never
44
- * had.
42
+ * A new root built on theirs, carrying both intents. It is NOT the
43
+ * caller's `ours` root — take this value as the new base, or the next
44
+ * write diffs against state the server never had.
45
45
  */
46
46
  merged: T;
47
47
  } | {
48
48
  /**
49
- * The user's root already equalled the baseline, so the version gate
49
+ * The user's root already equalled the base, so the version gate
50
50
  * fired on drift that changed nothing. No refetch was performed and
51
51
  * there is nothing to persist — retrying the same write reproduces it.
52
52
  */
53
53
  status: 'no-op';
54
54
  } | {
55
- /** A guarded `test` op tripped: user and foreign writer touched one path. */
55
+ /** User and foreign writer changed one path, or both added the same element or key. */
56
56
  status: 'conflict';
57
57
  /**
58
58
  * The server's current root, refetched and unmodified — the user's
59
59
  * intent was NOT applied to it. Surface it and drop the write; treating
60
60
  * it as a merge result silently discards what the user typed.
61
61
  */
62
- fresh: T;
62
+ theirs: T;
63
63
  } | {
64
64
  /**
65
65
  * The refetch produced nothing, so reconciliation could not be
@@ -70,22 +70,23 @@ export type ReconcileOutcome<T> = {
70
70
  };
71
71
  /**
72
72
  * Shared three-way reconcile for a `ConflictError`: diff the user's intent
73
- * (`baseline → attempted`), refetch the server's current root, and replay the
73
+ * (`base → ours`), refetch the server's current root (theirs), and replay the
74
74
  * intent on top under strict, {@link augmentWithTestOps}-guarded `applyPatch`.
75
75
  *
76
- * - `no-op` — the user's root equals the baseline, so the gate fired on a
76
+ * - `no-op` — the user's root equals the base, so the gate fired on a
77
77
  * benign version drift; nothing to replay (refetch is skipped).
78
78
  * - `unavailable` — the refetch produced nothing; caller falls back.
79
79
  * - `merged` — the foreign writer touched only paths the user did not; the
80
80
  * merged root carries both intents.
81
- * - `conflict` — a same-path divergence tripped a `test` op; caller drops the
82
- * write and surfaces `fresh`.
81
+ * - `conflict` — a same-path divergence tripped a `test` op, or an `add`
82
+ * collides with one the foreign writer made; caller drops the write and
83
+ * surfaces `theirs`.
83
84
  *
84
85
  * I/O is the caller's: `refetch` supplies the current root, and applying the
85
- * `merged` result (update vs save, re-baseline, UI refresh) stays at the call
86
+ * `merged` result (update vs save, new base, UI refresh) stays at the call
86
87
  * site so form and GLSP paths keep their own persistence semantics.
87
88
  */
88
- export declare function reconcileByPatchReplay<T extends object>(baseline: T, attempted: T, refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
89
+ export declare function reconcileByPatchReplay<T extends object>(base: T, ours: T, refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
89
90
  /**
90
91
  * Strategy for resolving a write that raced a foreign edit. One declarative
91
92
  * choice covers every conflict site — `execute` forward-write `(before,
@@ -95,12 +96,12 @@ export declare function reconcileByPatchReplay<T extends object>(baseline: T, at
95
96
  */
96
97
  export interface ConflictResolver {
97
98
  /**
98
- * Reconcile the user's `baseline → attempted` intent against the current
99
- * server state (`refetch`), returning a {@link ReconcileOutcome} the caller
99
+ * Reconcile the user's `base → ours` intent against the current
100
+ * server state (theirs, from `refetch`), returning a {@link ReconcileOutcome} the caller
100
101
  * acts on (persist `merged`, drop on `conflict`, fall back on `no-op` /
101
102
  * `unavailable`).
102
103
  */
103
- resolve<T extends object>(baseline: T, attempted: T, refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
104
+ resolve<T extends object>(base: T, ours: T, refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
104
105
  }
105
106
  /**
106
107
  * Default {@link ConflictResolver}: field-level three-way merge via
@@ -109,15 +110,15 @@ export interface ConflictResolver {
109
110
  * clobbered.
110
111
  */
111
112
  export declare class ReconcilingConflictResolver implements ConflictResolver {
112
- resolve<T extends object>(baseline: T, attempted: T, refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
113
+ resolve<T extends object>(base: T, ours: T, refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
113
114
  }
114
115
  /**
115
- * Last-writer-wins {@link ConflictResolver}: always reports the `attempted`
116
+ * Last-writer-wins {@link ConflictResolver}: always reports the `ours`
116
117
  * state as merged, without refetching or guarding. Suitable for single-client
117
118
  * tools or always-regenerated artifacts where a concurrent foreign edit may be
118
119
  * overwritten. A foreign edit to any field is clobbered.
119
120
  */
120
121
  export declare class ForceConflictResolver implements ConflictResolver {
121
- resolve<T extends object>(_baseline: T, attempted: T, _refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
122
+ resolve<T extends object>(_base: T, ours: T, _refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
122
123
  }
123
124
  //# sourceMappingURL=patch-merge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"patch-merge.d.ts","sourceRoot":"","sources":["../src/patch-merge.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAqD,KAAK,SAAS,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1H;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,EAAE,CASvH;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IACzB;IACG,6EAA6E;IAC7E,MAAM,EAAE,QAAQ,CAAC;IACjB;;;;;OAKG;IACH,MAAM,EAAE,CAAC,CAAC;CACZ,GACD;IACG;;;;OAIG;IACH,MAAM,EAAE,OAAO,CAAC;CAClB,GACD;IACG,6EAA6E;IAC7E,MAAM,EAAE,UAAU,CAAC;IACnB;;;;OAIG;IACH,KAAK,EAAE,CAAC,CAAC;CACX,GACD;IACG;;;;OAIG;IACH,MAAM,EAAE,aAAa,CAAC;CACxB,CAAC;AAEP;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,SA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ACrD,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;CAG1H"}
@@ -13,31 +13,32 @@ exports.augmentWithTestOps = augmentWithTestOps;
13
13
  exports.reconcileByPatchReplay = reconcileByPatchReplay;
14
14
  const fast_json_patch_1 = require("fast-json-patch");
15
15
  /**
16
- * Augment a user-intent JSON patch (computed `baseline → attempted`) with
16
+ * Augment a user-intent JSON patch (computed `base → ours`) with
17
17
  * `test` ops so a strict `applyPatch` against freshly-fetched server state
18
18
  * fails loudly when a foreign writer changed a path the user also changed.
19
19
  *
20
20
  * `fast-json-patch`'s `validateOperation: true` validates op structure and
21
21
  * path resolvability but NOT the pre-existing value — a plain `replace` /
22
22
  * `remove` silently overwrites whatever the foreign writer put there. For each
23
- * `replace` / `remove` op we prepend a `test` op carrying the baseline value at
23
+ * `replace` / `remove` op we prepend a `test` op carrying the base value at
24
24
  * that path, so a same-path divergence becomes a `TEST_OPERATION_FAILED` throw.
25
25
  * The caller treats that as a real field-level conflict (drop + refetch) rather
26
26
  * than silently clobbering the foreign edit.
27
27
  *
28
- * `add` ops are left unguarded: the path is new, so there is no baseline value
29
- * to test against, and add-vs-add overlaps are out of scope for this floor.
28
+ * `add` ops get no `test` op: the path is new, so there is no base value
29
+ * to test. {@link reconcileByPatchReplay} checks them against theirs
30
+ * instead; a caller applying this patch itself does not get that check.
30
31
  *
31
32
  * Used behind the framework's `ConflictError` contract by every reconcile
32
33
  * path — the GLSP recording command's undo/redo and forward-write, via
33
34
  * {@link ReconcilingConflictResolver}, and an adopter's form-widget save — so
34
35
  * they share one collision-detection rule.
35
36
  */
36
- function augmentWithTestOps(baseline, userPatch) {
37
+ function augmentWithTestOps(base, userPatch) {
37
38
  const augmented = [];
38
39
  for (const op of userPatch) {
39
40
  if (op.op === 'replace' || op.op === 'remove') {
40
- augmented.push({ op: 'test', path: op.path, value: (0, fast_json_patch_1.getValueByPointer)(baseline, op.path) });
41
+ augmented.push({ op: 'test', path: op.path, value: (0, fast_json_patch_1.getValueByPointer)(base, op.path) });
41
42
  }
42
43
  augmented.push(op);
43
44
  }
@@ -45,36 +46,79 @@ function augmentWithTestOps(baseline, userPatch) {
45
46
  }
46
47
  /**
47
48
  * Shared three-way reconcile for a `ConflictError`: diff the user's intent
48
- * (`baseline → attempted`), refetch the server's current root, and replay the
49
+ * (`base → ours`), refetch the server's current root (theirs), and replay the
49
50
  * intent on top under strict, {@link augmentWithTestOps}-guarded `applyPatch`.
50
51
  *
51
- * - `no-op` — the user's root equals the baseline, so the gate fired on a
52
+ * - `no-op` — the user's root equals the base, so the gate fired on a
52
53
  * benign version drift; nothing to replay (refetch is skipped).
53
54
  * - `unavailable` — the refetch produced nothing; caller falls back.
54
55
  * - `merged` — the foreign writer touched only paths the user did not; the
55
56
  * merged root carries both intents.
56
- * - `conflict` — a same-path divergence tripped a `test` op; caller drops the
57
- * write and surfaces `fresh`.
57
+ * - `conflict` — a same-path divergence tripped a `test` op, or an `add`
58
+ * collides with one the foreign writer made; caller drops the write and
59
+ * surfaces `theirs`.
58
60
  *
59
61
  * I/O is the caller's: `refetch` supplies the current root, and applying the
60
- * `merged` result (update vs save, re-baseline, UI refresh) stays at the call
62
+ * `merged` result (update vs save, new base, UI refresh) stays at the call
61
63
  * site so form and GLSP paths keep their own persistence semantics.
62
64
  */
63
- async function reconcileByPatchReplay(baseline, attempted, refetch) {
64
- const userPatch = (0, fast_json_patch_1.compare)(baseline, attempted);
65
+ async function reconcileByPatchReplay(base, ours, refetch) {
66
+ const userPatch = (0, fast_json_patch_1.compare)(base, ours);
65
67
  if (userPatch.length === 0) {
66
68
  return { status: 'no-op' };
67
69
  }
68
- const fresh = await refetch();
69
- if (!fresh) {
70
+ const theirs = await refetch();
71
+ if (!theirs) {
70
72
  return { status: 'unavailable' };
71
73
  }
74
+ if (addsCollide(base, theirs, userPatch)) {
75
+ return { status: 'conflict', theirs };
76
+ }
72
77
  try {
73
- const merged = (0, fast_json_patch_1.applyPatch)((0, fast_json_patch_1.deepClone)(fresh), augmentWithTestOps(baseline, userPatch), true).newDocument;
78
+ const merged = (0, fast_json_patch_1.applyPatch)((0, fast_json_patch_1.deepClone)(theirs), augmentWithTestOps(base, userPatch), true).newDocument;
74
79
  return { status: 'merged', merged };
75
80
  }
76
81
  catch {
77
- return { status: 'conflict', fresh };
82
+ return { status: 'conflict', theirs };
83
+ }
84
+ }
85
+ /**
86
+ * Whether an `add` of `userPatch` collides with one the foreign writer made:
87
+ * it inserts a value into an array that `theirs` holds more often than
88
+ * `base` did, or it adds an object key that `theirs` already holds.
89
+ *
90
+ * Replayed, the first inserts the value a second time and the second replaces
91
+ * the foreign value. Identical values conflict rather than being skipped:
92
+ * skipping drops one of two additions that merely happen to be equal.
93
+ */
94
+ function addsCollide(base, theirs, userPatch) {
95
+ // Through JSON, as `compare` clones the add values: an undefined-valued key
96
+ // in `theirs` would otherwise make an equal element count as another.
97
+ const comparable = JSON.parse(JSON.stringify(theirs));
98
+ return userPatch.some(op => {
99
+ if (op.op !== 'add') {
100
+ return false;
101
+ }
102
+ const cut = op.path.lastIndexOf('/');
103
+ const before = valueAt(base, op.path.slice(0, cut));
104
+ const now = valueAt(comparable, op.path.slice(0, cut));
105
+ if (Array.isArray(before)) {
106
+ return Array.isArray(now) && occurrences(now, op.value) > occurrences(before, op.value);
107
+ }
108
+ return typeof now === 'object' && now !== null && Object.hasOwn(now, (0, fast_json_patch_1.unescapePathComponent)(op.path.slice(cut + 1)));
109
+ });
110
+ }
111
+ /** How many elements of `array` deeply equal `value`, whatever their key order. */
112
+ function occurrences(array, value) {
113
+ return array.filter(element => (0, fast_json_patch_1._areEquals)(element, value)).length;
114
+ }
115
+ /** The value at `pointer`, or `undefined` when a step of it is missing. */
116
+ function valueAt(document, pointer) {
117
+ try {
118
+ return (0, fast_json_patch_1.getValueByPointer)(document, pointer);
119
+ }
120
+ catch {
121
+ return undefined;
78
122
  }
79
123
  }
80
124
  /**
@@ -84,20 +128,20 @@ async function reconcileByPatchReplay(baseline, attempted, refetch) {
84
128
  * clobbered.
85
129
  */
86
130
  class ReconcilingConflictResolver {
87
- resolve(baseline, attempted, refetch) {
88
- return reconcileByPatchReplay(baseline, attempted, refetch);
131
+ resolve(base, ours, refetch) {
132
+ return reconcileByPatchReplay(base, ours, refetch);
89
133
  }
90
134
  }
91
135
  exports.ReconcilingConflictResolver = ReconcilingConflictResolver;
92
136
  /**
93
- * Last-writer-wins {@link ConflictResolver}: always reports the `attempted`
137
+ * Last-writer-wins {@link ConflictResolver}: always reports the `ours`
94
138
  * state as merged, without refetching or guarding. Suitable for single-client
95
139
  * tools or always-regenerated artifacts where a concurrent foreign edit may be
96
140
  * overwritten. A foreign edit to any field is clobbered.
97
141
  */
98
142
  class ForceConflictResolver {
99
- async resolve(_baseline, attempted, _refetch) {
100
- return { status: 'merged', merged: attempted };
143
+ async resolve(_base, ours, _refetch) {
144
+ return { status: 'merged', merged: ours };
101
145
  }
102
146
  }
103
147
  exports.ForceConflictResolver = ForceConflictResolver;