@hydranium/protocol 1.0.0-next.25 → 1.0.0-next.251

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 (250) hide show
  1. package/README.md +44 -49
  2. package/lib/abstract-logger.d.ts +5 -0
  3. package/lib/abstract-logger.d.ts.map +1 -1
  4. package/lib/abstract-logger.js +7 -0
  5. package/lib/abstract-logger.js.map +1 -1
  6. package/lib/client/data-connection.d.ts +245 -0
  7. package/lib/client/data-connection.d.ts.map +1 -0
  8. package/lib/client/data-connection.js +425 -0
  9. package/lib/client/data-connection.js.map +1 -0
  10. package/lib/client/data-events.d.ts +13 -1
  11. package/lib/client/data-events.d.ts.map +1 -1
  12. package/lib/client/data-events.js +21 -0
  13. package/lib/client/data-events.js.map +1 -1
  14. package/lib/client/data-port.d.ts +44 -27
  15. package/lib/client/data-port.d.ts.map +1 -1
  16. package/lib/client/data-session.d.ts +473 -81
  17. package/lib/client/data-session.d.ts.map +1 -1
  18. package/lib/client/data-session.js +743 -108
  19. package/lib/client/data-session.js.map +1 -1
  20. package/lib/client/index.d.ts +14 -9
  21. package/lib/client/index.d.ts.map +1 -1
  22. package/lib/client/index.js +14 -9
  23. package/lib/client/index.js.map +1 -1
  24. package/lib/client/message-relay.d.ts +10 -4
  25. package/lib/client/message-relay.d.ts.map +1 -1
  26. package/lib/client/message-relay.js +12 -6
  27. package/lib/client/message-relay.js.map +1 -1
  28. package/lib/client/post-message-transport.d.ts +64 -3
  29. package/lib/client/post-message-transport.d.ts.map +1 -1
  30. package/lib/client/post-message-transport.js +175 -1
  31. package/lib/client/post-message-transport.js.map +1 -1
  32. package/lib/client/rpc-connection.d.ts +157 -0
  33. package/lib/client/rpc-connection.d.ts.map +1 -0
  34. package/lib/client/rpc-connection.js +214 -0
  35. package/lib/client/rpc-connection.js.map +1 -0
  36. package/lib/client-ids.d.ts +45 -0
  37. package/lib/client-ids.d.ts.map +1 -0
  38. package/lib/client-ids.js +48 -0
  39. package/lib/client-ids.js.map +1 -0
  40. package/lib/clock.d.ts +38 -0
  41. package/lib/clock.d.ts.map +1 -1
  42. package/lib/clock.js +36 -1
  43. package/lib/clock.js.map +1 -1
  44. package/lib/console-logger.d.ts +23 -0
  45. package/lib/console-logger.d.ts.map +1 -0
  46. package/lib/console-logger.js +39 -0
  47. package/lib/console-logger.js.map +1 -0
  48. package/lib/data/data-protocol-methods.d.ts +4 -4
  49. package/lib/data/data-protocol-methods.d.ts.map +1 -1
  50. package/lib/data/data-protocol-methods.js +12 -1
  51. package/lib/data/data-protocol-methods.js.map +1 -1
  52. package/lib/data/data-server-protocol.d.ts +132 -41
  53. package/lib/data/data-server-protocol.d.ts.map +1 -1
  54. package/lib/data/events.d.ts +117 -21
  55. package/lib/data/events.d.ts.map +1 -1
  56. package/lib/data/requests.d.ts +69 -11
  57. package/lib/data/requests.d.ts.map +1 -1
  58. package/lib/debouncer.d.ts.map +1 -1
  59. package/lib/debouncer.js.map +1 -1
  60. package/lib/errors.d.ts +187 -29
  61. package/lib/errors.d.ts.map +1 -1
  62. package/lib/errors.js +270 -29
  63. package/lib/errors.js.map +1 -1
  64. package/lib/glsp-request-model-args.d.ts +16 -0
  65. package/lib/glsp-request-model-args.d.ts.map +1 -0
  66. package/lib/glsp-request-model-args.js +19 -0
  67. package/lib/glsp-request-model-args.js.map +1 -0
  68. package/lib/glsp-save-model-actions.d.ts +50 -0
  69. package/lib/glsp-save-model-actions.d.ts.map +1 -0
  70. package/lib/glsp-save-model-actions.js +28 -0
  71. package/lib/glsp-save-model-actions.js.map +1 -0
  72. package/lib/index.d.ts +7 -0
  73. package/lib/index.d.ts.map +1 -1
  74. package/lib/index.js +10 -0
  75. package/lib/index.js.map +1 -1
  76. package/lib/latency-collector.d.ts +8 -4
  77. package/lib/latency-collector.d.ts.map +1 -1
  78. package/lib/latency-collector.js.map +1 -1
  79. package/lib/logger.d.ts +22 -1
  80. package/lib/logger.d.ts.map +1 -1
  81. package/lib/logger.js +31 -3
  82. package/lib/logger.js.map +1 -1
  83. package/lib/messages/index.d.ts +30 -0
  84. package/lib/messages/index.d.ts.map +1 -0
  85. package/lib/messages/index.js +62 -0
  86. package/lib/messages/index.js.map +1 -0
  87. package/lib/messages/primitives.d.ts +188 -0
  88. package/lib/messages/primitives.d.ts.map +1 -0
  89. package/lib/messages/primitives.js +161 -0
  90. package/lib/messages/primitives.js.map +1 -0
  91. package/lib/model-server.d.ts +60 -13
  92. package/lib/model-server.d.ts.map +1 -1
  93. package/lib/model-server.js +4 -2
  94. package/lib/model-server.js.map +1 -1
  95. package/lib/model-service/base-version.d.ts +64 -0
  96. package/lib/model-service/base-version.d.ts.map +1 -0
  97. package/lib/model-service/base-version.js +43 -0
  98. package/lib/model-service/base-version.js.map +1 -0
  99. package/lib/model-service/index.d.ts +1 -1
  100. package/lib/model-service/index.d.ts.map +1 -1
  101. package/lib/model-service/index.js +4 -5
  102. package/lib/model-service/index.js.map +1 -1
  103. package/lib/model-service/reference-candidate.d.ts +5 -3
  104. package/lib/model-service/reference-candidate.d.ts.map +1 -1
  105. package/lib/{model-service/args.js → node/index.d.ts} +2 -3
  106. package/lib/node/index.d.ts.map +1 -0
  107. package/lib/node/index.js +29 -0
  108. package/lib/node/index.js.map +1 -0
  109. package/lib/node/process-memory.d.ts +66 -0
  110. package/lib/node/process-memory.d.ts.map +1 -0
  111. package/lib/node/process-memory.js +291 -0
  112. package/lib/node/process-memory.js.map +1 -0
  113. package/lib/noop-logger.d.ts.map +1 -1
  114. package/lib/noop-logger.js.map +1 -1
  115. package/lib/observable-value.js.map +1 -1
  116. package/lib/patch-merge.d.ts +35 -32
  117. package/lib/patch-merge.d.ts.map +1 -1
  118. package/lib/patch-merge.js +67 -23
  119. package/lib/patch-merge.js.map +1 -1
  120. package/lib/profile-session.d.ts +8 -4
  121. package/lib/profile-session.d.ts.map +1 -1
  122. package/lib/profile-session.js.map +1 -1
  123. package/lib/random-uuid.d.ts +14 -0
  124. package/lib/random-uuid.d.ts.map +1 -0
  125. package/lib/random-uuid.js +24 -0
  126. package/lib/random-uuid.js.map +1 -0
  127. package/lib/reconcile-write.d.ts +65 -0
  128. package/lib/reconcile-write.d.ts.map +1 -0
  129. package/lib/reconcile-write.js +67 -0
  130. package/lib/reconcile-write.js.map +1 -0
  131. package/lib/rpc/bind-rpc-methods.d.ts +33 -3
  132. package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
  133. package/lib/rpc/bind-rpc-methods.js +32 -3
  134. package/lib/rpc/bind-rpc-methods.js.map +1 -1
  135. package/lib/rpc/create-rpc-proxy.d.ts +10 -0
  136. package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
  137. package/lib/rpc/create-rpc-proxy.js +12 -2
  138. package/lib/rpc/create-rpc-proxy.js.map +1 -1
  139. package/lib/rpc/index.d.ts +1 -0
  140. package/lib/rpc/index.d.ts.map +1 -1
  141. package/lib/rpc/index.js +1 -0
  142. package/lib/rpc/index.js.map +1 -1
  143. package/lib/rpc/send-by-method-name.d.ts +76 -0
  144. package/lib/rpc/send-by-method-name.d.ts.map +1 -0
  145. package/lib/rpc/send-by-method-name.js +120 -0
  146. package/lib/rpc/send-by-method-name.js.map +1 -0
  147. package/lib/rpc/wire-prefix.js.map +1 -1
  148. package/lib/testing/catalogue-audit.d.ts +80 -0
  149. package/lib/testing/catalogue-audit.d.ts.map +1 -0
  150. package/lib/testing/catalogue-audit.js +94 -0
  151. package/lib/testing/catalogue-audit.js.map +1 -0
  152. package/lib/testing/data-doubles.d.ts +46 -15
  153. package/lib/testing/data-doubles.d.ts.map +1 -1
  154. package/lib/testing/data-doubles.js +58 -10
  155. package/lib/testing/data-doubles.js.map +1 -1
  156. package/lib/testing/fake-clock.d.ts +9 -1
  157. package/lib/testing/fake-clock.d.ts.map +1 -1
  158. package/lib/testing/fake-clock.js +54 -45
  159. package/lib/testing/fake-clock.js.map +1 -1
  160. package/lib/testing/index.d.ts +1 -0
  161. package/lib/testing/index.d.ts.map +1 -1
  162. package/lib/testing/index.js +5 -2
  163. package/lib/testing/index.js.map +1 -1
  164. package/lib/testing/node/duplex-connection.d.ts.map +1 -1
  165. package/lib/testing/node/duplex-connection.js +3 -2
  166. package/lib/testing/node/duplex-connection.js.map +1 -1
  167. package/lib/testing/node/duplex-stream.js.map +1 -1
  168. package/lib/testing/node/index.d.ts +1 -0
  169. package/lib/testing/node/index.d.ts.map +1 -1
  170. package/lib/testing/node/index.js +2 -2
  171. package/lib/testing/node/index.js.map +1 -1
  172. package/lib/testing/node/message-port-pair.d.ts +25 -0
  173. package/lib/testing/node/message-port-pair.d.ts.map +1 -0
  174. package/lib/testing/node/message-port-pair.js +26 -0
  175. package/lib/testing/node/message-port-pair.js.map +1 -0
  176. package/lib/testing/wait-for.d.ts +3 -2
  177. package/lib/testing/wait-for.d.ts.map +1 -1
  178. package/lib/testing/wait-for.js +40 -10
  179. package/lib/testing/wait-for.js.map +1 -1
  180. package/lib/tracer.d.ts.map +1 -1
  181. package/lib/tracer.js.map +1 -1
  182. package/lib/transfer-diagnostic.d.ts +33 -0
  183. package/lib/transfer-diagnostic.d.ts.map +1 -1
  184. package/lib/transfer-diagnostic.js +23 -0
  185. package/lib/transfer-diagnostic.js.map +1 -1
  186. package/lib/transfer-document.d.ts +70 -32
  187. package/lib/transfer-document.d.ts.map +1 -1
  188. package/lib/transfer-document.js +17 -9
  189. package/lib/transfer-document.js.map +1 -1
  190. package/lib/uri.d.ts.map +1 -1
  191. package/lib/uri.js.map +1 -1
  192. package/lib/util.d.ts +8 -0
  193. package/lib/util.d.ts.map +1 -1
  194. package/lib/util.js +32 -0
  195. package/lib/util.js.map +1 -1
  196. package/package.json +29 -37
  197. package/src/abstract-logger.ts +8 -0
  198. package/src/client/data-connection.ts +520 -0
  199. package/src/client/data-events.ts +33 -1
  200. package/src/client/data-port.ts +46 -28
  201. package/src/client/data-session.ts +951 -126
  202. package/src/client/index.ts +14 -9
  203. package/src/client/message-relay.ts +30 -8
  204. package/src/client/post-message-transport.ts +219 -4
  205. package/src/client/rpc-connection.ts +281 -0
  206. package/src/client-ids.ts +49 -0
  207. package/src/clock.ts +56 -0
  208. package/src/console-logger.ts +39 -0
  209. package/src/data/data-protocol-methods.ts +13 -4
  210. package/src/data/data-server-protocol.ts +157 -41
  211. package/src/data/events.ts +123 -21
  212. package/src/data/requests.ts +74 -11
  213. package/src/errors.ts +322 -36
  214. package/src/glsp-request-model-args.ts +16 -0
  215. package/src/glsp-save-model-actions.ts +59 -0
  216. package/src/index.ts +10 -0
  217. package/src/latency-collector.ts +8 -3
  218. package/src/logger.ts +28 -2
  219. package/src/messages/index.ts +37 -0
  220. package/src/messages/primitives.ts +271 -0
  221. package/src/model-server.ts +64 -19
  222. package/src/model-service/base-version.ts +72 -0
  223. package/src/model-service/index.ts +4 -5
  224. package/src/model-service/reference-candidate.ts +5 -3
  225. package/src/node/index.ts +14 -0
  226. package/src/node/process-memory.ts +299 -0
  227. package/src/patch-merge.ts +97 -42
  228. package/src/profile-session.ts +9 -4
  229. package/src/random-uuid.ts +21 -0
  230. package/src/reconcile-write.ts +124 -0
  231. package/src/rpc/README.md +4 -5
  232. package/src/rpc/bind-rpc-methods.ts +59 -4
  233. package/src/rpc/create-rpc-proxy.ts +20 -2
  234. package/src/rpc/index.ts +1 -0
  235. package/src/rpc/send-by-method-name.ts +140 -0
  236. package/src/testing/catalogue-audit.ts +111 -0
  237. package/src/testing/data-doubles.ts +149 -25
  238. package/src/testing/fake-clock.ts +62 -47
  239. package/src/testing/index.ts +5 -2
  240. package/src/testing/node/duplex-connection.ts +3 -2
  241. package/src/testing/node/index.ts +2 -2
  242. package/src/testing/node/message-port-pair.ts +40 -0
  243. package/src/testing/wait-for.ts +38 -11
  244. package/src/transfer-diagnostic.ts +40 -0
  245. package/src/transfer-document.ts +87 -34
  246. package/src/util.ts +33 -0
  247. package/lib/model-service/args.d.ts +0 -64
  248. package/lib/model-service/args.d.ts.map +0 -1
  249. package/lib/model-service/args.js.map +0 -1
  250. package/src/model-service/args.ts +0 -67
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
- import type { TransferSaveArgs, TransferUpdateArgs } from '../model-service/args';
9
+ import type { BaseVersion } from '../model-service/base-version';
10
10
  /** Get the current state of a single document. The server returns the latest built version. */
11
11
  export interface GetModelDocumentArgs {
12
12
  /** Document URI. */
@@ -37,22 +37,80 @@ export interface GetProjectForUriArgs {
37
37
  uri: string;
38
38
  }
39
39
  /**
40
- * Update a document's content. Wire-side projection of the facade's
41
- * {@link TransferUpdateArgs}; structurally identical so the data-server RPC
42
- * handler can forward straight to the in-process `ModelService.update`
43
- * without an args mapping.
40
+ * Update a document the session `clientId` has open. Generic over `TTransfer`
41
+ * so adopters parameterise the structured shape against their grammar's
42
+ * transfer-model overlay; passing a string is always allowed.
44
43
  */
45
- export type TransferUpdateDocumentArgs<TTransfer> = TransferUpdateArgs<TTransfer>;
46
- /** Persist a document to disk. Wire-side projection of {@link TransferSaveArgs}. */
47
- export type TransferSaveDocumentArgs<TTransfer> = TransferSaveArgs<TTransfer>;
44
+ export interface TransferUpdateDocumentArgs<TTransfer> {
45
+ /** Document URI. */
46
+ uri: string;
47
+ /** The id of a live session registered on this connection. */
48
+ clientId: string;
49
+ /** The whole structured model root, or its serialised textual form. */
50
+ model: TTransfer | string;
51
+ /**
52
+ * What this write was authored against. A `ModelVersion` is compared
53
+ * against the server's current text-document version for `uri` and throws
54
+ * `ConflictError` on mismatch; `'any'` writes unconditionally.
55
+ *
56
+ * **Required so that an ungated write is a decision rather than an
57
+ * omission.** An optional gate is indistinguishable from a forgotten one at
58
+ * the call site, and a file of twenty writes hides the one that lost the
59
+ * field. Nothing else here can see that, since the defect is an absence.
60
+ */
61
+ baseVersion: BaseVersion;
62
+ }
63
+ /** Update a document the session `clientId` has open, then persist it to disk. */
64
+ export interface TransferSaveDocumentArgs<TTransfer> extends TransferUpdateDocumentArgs<TTransfer> {
65
+ }
66
+ /** Persist the text the server holds for a document the session `clientId` has open, without writing a model. */
67
+ export type TransferPersistDocumentArgs = Omit<TransferUpdateDocumentArgs<never>, 'model'>;
68
+ /** Register a client session on the connection. */
69
+ export interface CreateSessionArgs {
70
+ /** The session's id, minted by the client; unique in the server process while the session is live. */
71
+ clientId: string;
72
+ /** What the participant is; kept as the server session's `label`. */
73
+ label?: string;
74
+ /**
75
+ * A token the client keeps for the session's lifetime. It is no secret: the
76
+ * wire carries no authentication. A later `createSession` for the same id
77
+ * carrying the same token, from any connection, ends the session it names
78
+ * and registers the id afresh, so a client whose connection dropped before
79
+ * the server noticed can register again. Without it the id stays refused
80
+ * until the server notices.
81
+ */
82
+ resumeToken?: string;
83
+ }
84
+ /** End a client session registered on the connection. */
85
+ export interface CloseSessionArgs {
86
+ clientId: string;
87
+ }
88
+ /** Create a document that exists nowhere yet, open for the session creating it. */
89
+ export interface CreateModelDocumentArgs {
90
+ uri: string;
91
+ /** The id of a live session registered on this connection. */
92
+ clientId: string;
93
+ /** The document's initial content; it reaches disk with the first save. */
94
+ text: string;
95
+ }
96
+ /**
97
+ * Write several documents a session has open, all or none. `clientId` is on
98
+ * the set rather than on each update: an id per update would allow a set
99
+ * mixing clients, which the server would have to refuse.
100
+ */
101
+ export interface TransferUpdateDocumentsArgs<TTransfer> {
102
+ /** The id of a live session registered on this connection. */
103
+ clientId: string;
104
+ updates: Omit<TransferUpdateDocumentArgs<TTransfer>, 'clientId'>[];
105
+ }
48
106
  /**
49
107
  * Identifies a per-document watch on the data server. Shared by both
50
108
  * `watchModelDocument` and `unwatchModelDocument` — the `(uri, clientId)`
51
109
  * pair is the watch key, so unwatching names the same watch that was
52
110
  * started. The `clientId` identifies the originator the same way it does
53
- * on facade-side mutations (`TransferUpdateArgs.clientId`,
54
- * `TransferSaveArgs.clientId`): it keys the per-`(uri, clientId)` watch
55
- * bucket so multiple watchers on the same wire stay distinct, AND it lets
111
+ * on the document writes (`TransferUpdateDocumentArgs.clientId`,
112
+ * `TransferSaveDocumentArgs.clientId`): it keys the per-`(uri, clientId)`
113
+ * watch bucket so multiple watchers on the same wire stay distinct, AND it lets
56
114
  * each watcher recognise its own echo on inbound `onDocumentUpdated` events
57
115
  * (the wire shape's `sourceClientId` carries the originating mutation's
58
116
  * `clientId`).
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/data/requests.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAElF,+FAA+F;AAC/F,MAAM,WAAW,oBAAoB;IAClC,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IAClC,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,CAAC,SAAS,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAElF,oFAAoF;AACpF,MAAM,MAAM,wBAAwB,CAAC,SAAS,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,sBAAsB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/data/requests.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,+FAA+F;AAC/F,MAAM,WAAW,oBAAoB;IAClC,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MA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CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;IACrC,CAAC;IAED,2CAA2C;IAC3C,OAAO;QACJ,IAAI,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;IAES,IAAI;QACX,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAClC,IAAI,CAAC,EAAE,EAAE,CAAC;IACb,CAAC;CACH"}
package/lib/errors.d.ts CHANGED
@@ -7,46 +7,73 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  import { ResponseError } from 'vscode-jsonrpc';
10
+ import { type HydraniumMessageData } from './messages/primitives';
11
+ import { type ModelVersion, type TextVersion } from './model-service/base-version';
10
12
  /**
11
- * Application-specific JSON-RPC error code for {@link ConflictError}.
12
- * Outside the reserved range (-32768 .. -32000) per JSON-RPC 2.0.
13
+ * The catalogue declaration behind {@link ConflictError}'s sentence. It words
14
+ * the version mismatch rather than stating it: the two numbers mean nothing to
15
+ * an end user, and they stay in {@link ConflictErrorData}.
16
+ *
17
+ * Its English must keep containing {@link CONFLICT_ERROR_MESSAGE_MARKER}: the
18
+ * marker is tier 3 of {@link isConflictError}'s ladder, and it matches on text.
19
+ * That tier only ever works untranslated, which is why it is the last resort
20
+ * behind the numeric code rather than the primary check.
21
+ */
22
+ export declare const STALE_BASE_VERSION_UPDATE: import("./messages/primitives").MessageDefinition<"The edit to {uri} was not applied: it was made to an older version of the document.">;
23
+ /**
24
+ * Every JSON-RPC error code the framework raises, from any package, keyed by
25
+ * the error it identifies.
26
+ *
27
+ * The framework reserves the block 42000 to 42999 for these, and an adopter's
28
+ * own codes stay outside it: after an RPC a guard matches on the code alone, so
29
+ * an adopter's error carrying one of these reads as the framework's. A new code
30
+ * takes the next unused number in the block, whichever package raises it, and
31
+ * is declared here, where tests hold every code distinct and inside the block.
32
+ * The block sits clear of the range JSON-RPC 2.0 reserves for itself, -32768
33
+ * to -32000.
34
+ */
35
+ export declare const HYDRANIUM_ERROR_CODES: {
36
+ readonly conflict: 42001;
37
+ readonly noActiveProfile: 42002;
38
+ readonly referenceSettleTimeout: 42003;
39
+ readonly sessionClosed: 42004;
40
+ readonly documentNotOpen: 42005;
41
+ readonly duplicateClientId: 42006;
42
+ readonly reservedClientId: 42007;
43
+ };
44
+ /**
45
+ * JSON-RPC error code for {@link ConflictError}.
13
46
  *
14
47
  * The code is the load-bearing identifier across realm boundaries —
15
48
  * `code` is a first-class field on the JSON-RPC error envelope and
16
49
  * survives wire reconstruction; the custom `Error` subclass name does
17
50
  * not.
18
51
  */
19
- export declare const CONFLICT_ERROR_CODE = 1001;
20
- /**
21
- * Structured payload carried in {@link ConflictError.data}, and the only place
22
- * a post-RPC caller can read the version mismatch from.
23
- */
24
- export interface ConflictErrorData {
52
+ export declare const CONFLICT_ERROR_CODE: 42001;
53
+ /** Structured payload carried in {@link ConflictError.data}. */
54
+ export interface ConflictErrorData extends HydraniumMessageData {
25
55
  readonly uri: string;
26
- /** The based-on version the caller authored against. */
27
- readonly expected: number;
56
+ /** The base version the caller authored against. */
57
+ readonly baseVersion: ModelVersion;
28
58
  /** The server's current text-document version at the time of the throw. */
29
- readonly actual: number;
59
+ readonly actualVersion: TextVersion;
30
60
  }
31
61
  /**
32
- * Thrown by `ModelService.update` / `ModelService.save` when the caller-
33
- * supplied based-on version no longer matches the server's current text-
62
+ * Thrown by a client session's `update` / `save` when the caller-
63
+ * supplied base version no longer matches the server's current text-
34
64
  * document version for the same URI — i.e. the snapshot the caller
35
65
  * authored against has been superseded by an intervening edit.
36
66
  *
37
67
  * Extends vscode-jsonrpc's {@link ResponseError} so the typed
38
68
  * {@link ConflictErrorData} payload rides on the standard JSON-RPC
39
69
  * error envelope (`code`, `message`, `data`) — all three fields are
40
- * preserved by RPC reconstruction. Adopters that catch the error on
41
- * the receiving side of an RPC call read the version mismatch from
42
- * `err.data` (the instance is reconstructed as a generic
43
- * `ResponseError`, so subclass getters / fields do not survive).
70
+ * preserved by RPC reconstruction. `createRpcProxy` revives it into
71
+ * this class on the receiving side; a path that does not leaves a
72
+ * plain `ResponseError`, readable through `err.data` only.
44
73
  *
45
- * Detection is opt-in via the optional `baseVersion` field on
46
- * `TransferUpdateArgs` / `TransferSaveArgs`; callers that omit the field get
47
- * no gating. This mirrors LSP's `OptionalVersionedTextDocumentIdentifier`
48
- * posture, so headless / CLI / batch tooling with no meaningful based-on
49
- * version can opt out explicitly.
74
+ * Detection is driven by the required `baseVersion` field of every write
75
+ * request; a caller with no meaningful base version passes
76
+ * `'any'` and gets no gating.
50
77
  *
51
78
  * Three reasonable adopter recovery strategies:
52
79
  *
@@ -60,11 +87,141 @@ export interface ConflictErrorData {
60
87
  * No auto-retry or auto-merge ships by default.
61
88
  */
62
89
  export declare class ConflictError extends ResponseError<ConflictErrorData> {
63
- constructor(uri: string, expected: number, actual: number);
90
+ constructor(uri: string, baseVersion: ModelVersion, actualVersion: TextVersion);
91
+ get uri(): string;
92
+ /**
93
+ * The base version the caller authored against.
94
+ *
95
+ * Must not be renamed to `expected`, nor its sibling to `actual`: a test
96
+ * reporter reads an error carrying both as an assertion failure, and
97
+ * vitest's formatter then ASSIGNS to them, which throws on an accessor and
98
+ * replaces the real failure with a `TypeError`.
99
+ */
100
+ get baseVersion(): ModelVersion;
101
+ /** The server's version at the time of the throw. Not `actual` — see {@link baseVersion}. */
102
+ get actualVersion(): TextVersion;
103
+ }
104
+ /**
105
+ * JSON-RPC code for {@link SessionClosedError}, beside {@link CONFLICT_ERROR_CODE}
106
+ * and for the same reason: the code survives reconstruction, the class does not.
107
+ */
108
+ export declare const SESSION_CLOSED_ERROR_CODE: 42004;
109
+ /** JSON-RPC code for {@link DocumentNotOpenError}. */
110
+ export declare const DOCUMENT_NOT_OPEN_ERROR_CODE: 42005;
111
+ /** JSON-RPC code for {@link DuplicateClientIdError}. */
112
+ export declare const DUPLICATE_CLIENT_ID_ERROR_CODE: 42006;
113
+ /** JSON-RPC code for {@link ReservedClientIdError}. */
114
+ export declare const RESERVED_CLIENT_ID_ERROR_CODE: 42007;
115
+ /**
116
+ * The catalogue declaration behind {@link SessionClosedError}'s default
117
+ * sentence. It names no client id: the sentence can reach an end user, and the
118
+ * id stays in {@link SessionClosedErrorData.clientId} for whoever needs it.
119
+ */
120
+ export declare const SESSION_CLOSED: import("./messages/primitives").MessageDefinition<"The editing session has ended.">;
121
+ /** Structured payload carried in {@link SessionClosedError.data}. */
122
+ export interface SessionClosedErrorData extends HydraniumMessageData {
123
+ readonly clientId: string;
124
+ }
125
+ /**
126
+ * Thrown by every call on a client session after it ended, and by an open that
127
+ * was still in flight when its session ended: by the server for its sessions,
128
+ * and by a client-side `DataSession` once disposed, so a caller handles both
129
+ * the same way. A caller recognises it with {@link isSessionClosedError}, never
130
+ * by its sentence.
131
+ */
132
+ export declare class SessionClosedError extends ResponseError<SessionClosedErrorData> {
133
+ /**
134
+ * `message` replaces the default English, for a caller that knows more than
135
+ * that the session is gone. The identity stays {@link SESSION_CLOSED}'s, so a
136
+ * translating renderer renders the catalogue sentence in its place.
137
+ */
138
+ constructor(clientId: string, message?: string);
139
+ get clientId(): string;
140
+ }
141
+ /**
142
+ * The catalogue declaration behind {@link DocumentNotOpenError}'s sentence. The
143
+ * client id stays in {@link DocumentNotOpenErrorData.clientId}.
144
+ */
145
+ export declare const DOCUMENT_NOT_OPEN: import("./messages/primitives").MessageDefinition<"The document {uri} is not open in this editing session.">;
146
+ /** Structured payload carried in {@link DocumentNotOpenError.data}. */
147
+ export interface DocumentNotOpenErrorData extends HydraniumMessageData {
148
+ readonly uri: string;
149
+ readonly clientId: string;
150
+ }
151
+ /**
152
+ * Thrown when a client session writes a document it does not have open.
153
+ *
154
+ * A session writes only what it has open, so this is the answer both to a write
155
+ * that never opened and to one whose open was closed underneath it — by the
156
+ * session itself, or by the document being deleted.
157
+ */
158
+ export declare class DocumentNotOpenError extends ResponseError<DocumentNotOpenErrorData> {
159
+ constructor(uri: string, clientId: string);
64
160
  get uri(): string;
65
- get expected(): number;
66
- get actual(): number;
161
+ get clientId(): string;
162
+ }
163
+ /**
164
+ * The catalogue declaration behind {@link DuplicateClientIdError}'s sentence.
165
+ * The client id stays in {@link DuplicateClientIdErrorData.clientId}.
166
+ */
167
+ export declare const DUPLICATE_CLIENT_ID: import("./messages/primitives").MessageDefinition<"Could not start an editing session: its identifier is still in use by another editor.">;
168
+ /** Structured payload carried in {@link DuplicateClientIdError.data}. */
169
+ export interface DuplicateClientIdErrorData extends HydraniumMessageData {
170
+ readonly clientId: string;
171
+ }
172
+ /**
173
+ * Thrown when a client session is started under an id that is already live in
174
+ * the process. The id frees up once its holder ends or closes its last
175
+ * document, so a caller may retry.
176
+ *
177
+ * Ids are unique process-wide because the id is also the author label on every
178
+ * version and the key a client recognises its own echoes by; two participants
179
+ * sharing one would each take the other's writes for their own.
180
+ */
181
+ export declare class DuplicateClientIdError extends ResponseError<DuplicateClientIdErrorData> {
182
+ constructor(clientId: string);
183
+ get clientId(): string;
67
184
  }
185
+ /**
186
+ * Thrown when a client session is started under an id the framework reserves
187
+ * for one of its own participants. A reserved id never frees up, so a caller
188
+ * that retries on {@link DuplicateClientIdError} stops on this one.
189
+ *
190
+ * It carries no message identity: a host that picks a reserved id has a bug,
191
+ * and no sentence addressed to an end user is true for it.
192
+ */
193
+ export declare class ReservedClientIdError extends ResponseError<{
194
+ readonly clientId: string;
195
+ }> {
196
+ constructor(clientId: string);
197
+ get clientId(): string;
198
+ }
199
+ /**
200
+ * Whether `error` is a `ResponseError` from any copy of `vscode-jsonrpc`. An
201
+ * install holds several copies, and `instanceof` recognises only its own. An
202
+ * error that merely carries an integer `code` has no `toJson`, and is not one.
203
+ */
204
+ export declare function isResponseError(error: unknown): error is ResponseError<unknown>;
205
+ /**
206
+ * `error` as an instance of the typed error class its code names, with its
207
+ * message, data and stack kept, or `error` itself when its code names none or
208
+ * its data lacks the fields that class reads.
209
+ * An RPC reconstructs every rejection as a plain `ResponseError`, which has
210
+ * none of the class getters.
211
+ */
212
+ export declare function reviveProtocolError(error: unknown): unknown;
213
+ /**
214
+ * Whether `error` is a {@link SessionClosedError}: by name in-process, by code
215
+ * when it arrives as a plain `ResponseError`, through a path that does not
216
+ * {@link reviveProtocolError revive} it.
217
+ */
218
+ export declare function isSessionClosedError(error: unknown): error is SessionClosedError;
219
+ /** Whether `error` is a {@link DocumentNotOpenError}; see {@link isSessionClosedError}. */
220
+ export declare function isDocumentNotOpenError(error: unknown): error is DocumentNotOpenError;
221
+ /** Whether `error` is a {@link DuplicateClientIdError}; see {@link isSessionClosedError}. */
222
+ export declare function isDuplicateClientIdError(error: unknown): error is DuplicateClientIdError;
223
+ /** Whether `error` is a {@link ReservedClientIdError}; see {@link isSessionClosedError}. */
224
+ export declare function isReservedClientIdError(error: unknown): error is ReservedClientIdError;
68
225
  /**
69
226
  * Type guard for {@link ConflictError}. Detection ladder:
70
227
  *
@@ -74,11 +231,12 @@ export declare class ConflictError extends ResponseError<ConflictErrorData> {
74
231
  * canonical wire-side check; the JSON-RPC `code` field is preserved
75
232
  * across reconstruction, so any adopter catching after an RPC call
76
233
  * hits this branch.
77
- * 3. `error.message.includes('Stale-based update for ')` — fallback
78
- * for transports that re-wrap the message and drop the code (rare).
234
+ * 3. `error.message` contains the marker {@link STALE_BASE_VERSION_UPDATE}'s
235
+ * English carries — fallback for transports that re-wrap the message
236
+ * and drop the code (rare).
79
237
  *
80
- * `instanceof ConflictError` alone would silently return `false` on the
81
- * reconstructed shape, so callers do not use it.
238
+ * `instanceof ConflictError` alone returns `false` on a rejection that was
239
+ * not {@link reviveProtocolError revived}, so callers do not use it.
82
240
  */
83
241
  export declare function isConflictError(error: unknown): error is ConflictError;
84
242
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;kF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