@hydranium/protocol 1.0.0-next.37 → 1.0.0-next.371

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 (294) hide show
  1. package/README.md +44 -83
  2. package/lib/abstract-logger.d.ts +11 -0
  3. package/lib/abstract-logger.d.ts.map +1 -1
  4. package/lib/abstract-logger.js +16 -0
  5. package/lib/abstract-logger.js.map +1 -1
  6. package/lib/client/data-connection.d.ts +303 -0
  7. package/lib/client/data-connection.d.ts.map +1 -0
  8. package/lib/client/data-connection.js +534 -0
  9. package/lib/client/data-connection.js.map +1 -0
  10. package/lib/client/data-events.d.ts +18 -1
  11. package/lib/client/data-events.d.ts.map +1 -1
  12. package/lib/client/data-events.js +26 -0
  13. package/lib/client/data-events.js.map +1 -1
  14. package/lib/client/data-port.d.ts +34 -24
  15. package/lib/client/data-port.d.ts.map +1 -1
  16. package/lib/client/data-session.d.ts +691 -89
  17. package/lib/client/data-session.d.ts.map +1 -1
  18. package/lib/client/data-session.js +1155 -115
  19. package/lib/client/data-session.js.map +1 -1
  20. package/lib/client/index.d.ts +15 -9
  21. package/lib/client/index.d.ts.map +1 -1
  22. package/lib/client/index.js +15 -9
  23. package/lib/client/index.js.map +1 -1
  24. package/lib/client/message-relay.d.ts +6 -4
  25. package/lib/client/message-relay.d.ts.map +1 -1
  26. package/lib/client/message-relay.js +4 -4
  27. package/lib/client/message-relay.js.map +1 -1
  28. package/lib/client/post-message-transport.d.ts +69 -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 +173 -0
  33. package/lib/client/rpc-connection.d.ts.map +1 -0
  34. package/lib/client/rpc-connection.js +225 -0
  35. package/lib/client/rpc-connection.js.map +1 -0
  36. package/lib/client/worker-handshake.d.ts +94 -0
  37. package/lib/client/worker-handshake.d.ts.map +1 -0
  38. package/lib/client/worker-handshake.js +51 -0
  39. package/lib/client/worker-handshake.js.map +1 -0
  40. package/lib/client-ids.d.ts +45 -0
  41. package/lib/client-ids.d.ts.map +1 -0
  42. package/lib/client-ids.js +48 -0
  43. package/lib/client-ids.js.map +1 -0
  44. package/lib/clock.d.ts +50 -10
  45. package/lib/clock.d.ts.map +1 -1
  46. package/lib/clock.js +36 -1
  47. package/lib/clock.js.map +1 -1
  48. package/lib/console-logger.d.ts +23 -0
  49. package/lib/console-logger.d.ts.map +1 -0
  50. package/lib/console-logger.js +39 -0
  51. package/lib/console-logger.js.map +1 -0
  52. package/lib/data/data-protocol-methods.d.ts +4 -4
  53. package/lib/data/data-protocol-methods.d.ts.map +1 -1
  54. package/lib/data/data-protocol-methods.js +13 -1
  55. package/lib/data/data-protocol-methods.js.map +1 -1
  56. package/lib/data/data-server-protocol.d.ts +171 -48
  57. package/lib/data/data-server-protocol.d.ts.map +1 -1
  58. package/lib/data/events.d.ts +144 -33
  59. package/lib/data/events.d.ts.map +1 -1
  60. package/lib/data/requests.d.ts +76 -11
  61. package/lib/data/requests.d.ts.map +1 -1
  62. package/lib/debouncer.d.ts +7 -4
  63. package/lib/debouncer.d.ts.map +1 -1
  64. package/lib/debouncer.js +10 -10
  65. package/lib/debouncer.js.map +1 -1
  66. package/lib/errors.d.ts +218 -41
  67. package/lib/errors.d.ts.map +1 -1
  68. package/lib/errors.js +364 -55
  69. package/lib/errors.js.map +1 -1
  70. package/lib/format-log-arg.d.ts +33 -0
  71. package/lib/format-log-arg.d.ts.map +1 -0
  72. package/lib/format-log-arg.js +158 -0
  73. package/lib/format-log-arg.js.map +1 -0
  74. package/lib/glsp-edits-settled-actions.d.ts +54 -0
  75. package/lib/glsp-edits-settled-actions.d.ts.map +1 -0
  76. package/lib/glsp-edits-settled-actions.js +28 -0
  77. package/lib/glsp-edits-settled-actions.js.map +1 -0
  78. package/lib/glsp-request-model-args.d.ts +16 -0
  79. package/lib/glsp-request-model-args.d.ts.map +1 -0
  80. package/lib/glsp-request-model-args.js +19 -0
  81. package/lib/glsp-request-model-args.js.map +1 -0
  82. package/lib/glsp-save-model-actions.d.ts +55 -0
  83. package/lib/glsp-save-model-actions.d.ts.map +1 -0
  84. package/lib/glsp-save-model-actions.js +28 -0
  85. package/lib/glsp-save-model-actions.js.map +1 -0
  86. package/lib/index.d.ts +11 -0
  87. package/lib/index.d.ts.map +1 -1
  88. package/lib/index.js +11 -0
  89. package/lib/index.js.map +1 -1
  90. package/lib/latency-collector.d.ts +10 -4
  91. package/lib/latency-collector.d.ts.map +1 -1
  92. package/lib/latency-collector.js +2 -0
  93. package/lib/latency-collector.js.map +1 -1
  94. package/lib/logger.d.ts +38 -7
  95. package/lib/logger.d.ts.map +1 -1
  96. package/lib/logger.js +42 -4
  97. package/lib/logger.js.map +1 -1
  98. package/lib/messages/index.d.ts +4 -2
  99. package/lib/messages/index.d.ts.map +1 -1
  100. package/lib/messages/index.js +16 -4
  101. package/lib/messages/index.js.map +1 -1
  102. package/lib/messages/primitives.d.ts +59 -4
  103. package/lib/messages/primitives.d.ts.map +1 -1
  104. package/lib/messages/primitives.js +97 -4
  105. package/lib/messages/primitives.js.map +1 -1
  106. package/lib/model-server.d.ts +60 -13
  107. package/lib/model-server.d.ts.map +1 -1
  108. package/lib/model-server.js +4 -2
  109. package/lib/model-server.js.map +1 -1
  110. package/lib/model-service/base-version.d.ts +67 -0
  111. package/lib/model-service/base-version.d.ts.map +1 -0
  112. package/lib/model-service/base-version.js +44 -0
  113. package/lib/model-service/base-version.js.map +1 -0
  114. package/lib/model-service/index.d.ts +1 -1
  115. package/lib/model-service/index.d.ts.map +1 -1
  116. package/lib/model-service/index.js +4 -5
  117. package/lib/model-service/index.js.map +1 -1
  118. package/lib/model-service/reference-candidate.d.ts +5 -3
  119. package/lib/model-service/reference-candidate.d.ts.map +1 -1
  120. package/lib/node/index.d.ts +10 -0
  121. package/lib/node/index.d.ts.map +1 -0
  122. package/lib/node/index.js +29 -0
  123. package/lib/node/index.js.map +1 -0
  124. package/lib/node/process-memory.d.ts +66 -0
  125. package/lib/node/process-memory.d.ts.map +1 -0
  126. package/lib/node/process-memory.js +291 -0
  127. package/lib/node/process-memory.js.map +1 -0
  128. package/lib/noop-logger.d.ts.map +1 -1
  129. package/lib/noop-logger.js.map +1 -1
  130. package/lib/observable-value.js.map +1 -1
  131. package/lib/patch-merge.d.ts +63 -35
  132. package/lib/patch-merge.d.ts.map +1 -1
  133. package/lib/patch-merge.js +171 -25
  134. package/lib/patch-merge.js.map +1 -1
  135. package/lib/pending-work-tracker.d.ts +30 -0
  136. package/lib/pending-work-tracker.d.ts.map +1 -0
  137. package/lib/pending-work-tracker.js +47 -0
  138. package/lib/pending-work-tracker.js.map +1 -0
  139. package/lib/profile-session.d.ts +24 -8
  140. package/lib/profile-session.d.ts.map +1 -1
  141. package/lib/profile-session.js +13 -4
  142. package/lib/profile-session.js.map +1 -1
  143. package/lib/profiling.d.ts +15 -2
  144. package/lib/profiling.d.ts.map +1 -1
  145. package/lib/profiling.js.map +1 -1
  146. package/lib/project.d.ts +6 -2
  147. package/lib/project.d.ts.map +1 -1
  148. package/lib/project.js.map +1 -1
  149. package/lib/random-uuid.d.ts +14 -0
  150. package/lib/random-uuid.d.ts.map +1 -0
  151. package/lib/random-uuid.js +24 -0
  152. package/lib/random-uuid.js.map +1 -0
  153. package/lib/reconcile-write.d.ts +70 -0
  154. package/lib/reconcile-write.d.ts.map +1 -0
  155. package/lib/reconcile-write.js +69 -0
  156. package/lib/reconcile-write.js.map +1 -0
  157. package/lib/rpc/bind-rpc-methods.d.ts +6 -2
  158. package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
  159. package/lib/rpc/bind-rpc-methods.js +17 -7
  160. package/lib/rpc/bind-rpc-methods.js.map +1 -1
  161. package/lib/rpc/create-rpc-proxy.d.ts +3 -0
  162. package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
  163. package/lib/rpc/create-rpc-proxy.js +6 -1
  164. package/lib/rpc/create-rpc-proxy.js.map +1 -1
  165. package/lib/rpc/index.d.ts +1 -0
  166. package/lib/rpc/index.d.ts.map +1 -1
  167. package/lib/rpc/index.js +1 -0
  168. package/lib/rpc/index.js.map +1 -1
  169. package/lib/rpc/send-by-method-name.d.ts +76 -0
  170. package/lib/rpc/send-by-method-name.d.ts.map +1 -0
  171. package/lib/rpc/send-by-method-name.js +120 -0
  172. package/lib/rpc/send-by-method-name.js.map +1 -0
  173. package/lib/rpc/wire-prefix.js.map +1 -1
  174. package/lib/save-text-document.d.ts +40 -0
  175. package/lib/save-text-document.d.ts.map +1 -0
  176. package/lib/save-text-document.js +34 -0
  177. package/lib/save-text-document.js.map +1 -0
  178. package/lib/testing/catalogue-audit.js.map +1 -1
  179. package/lib/testing/data-doubles.d.ts +41 -12
  180. package/lib/testing/data-doubles.d.ts.map +1 -1
  181. package/lib/testing/data-doubles.js +56 -8
  182. package/lib/testing/data-doubles.js.map +1 -1
  183. package/lib/testing/fake-clock.d.ts +17 -2
  184. package/lib/testing/fake-clock.d.ts.map +1 -1
  185. package/lib/testing/fake-clock.js +61 -46
  186. package/lib/testing/fake-clock.js.map +1 -1
  187. package/lib/testing/index.d.ts +1 -0
  188. package/lib/testing/index.d.ts.map +1 -1
  189. package/lib/testing/index.js +4 -3
  190. package/lib/testing/index.js.map +1 -1
  191. package/lib/testing/node/duplex-connection.d.ts.map +1 -1
  192. package/lib/testing/node/duplex-connection.js +3 -2
  193. package/lib/testing/node/duplex-connection.js.map +1 -1
  194. package/lib/testing/node/duplex-stream.js.map +1 -1
  195. package/lib/testing/node/index.d.ts +1 -0
  196. package/lib/testing/node/index.d.ts.map +1 -1
  197. package/lib/testing/node/index.js +2 -2
  198. package/lib/testing/node/index.js.map +1 -1
  199. package/lib/testing/node/message-port-pair.d.ts +25 -0
  200. package/lib/testing/node/message-port-pair.d.ts.map +1 -0
  201. package/lib/testing/node/message-port-pair.js +26 -0
  202. package/lib/testing/node/message-port-pair.js.map +1 -0
  203. package/lib/testing/transfer-node-builder.d.ts +81 -0
  204. package/lib/testing/transfer-node-builder.d.ts.map +1 -0
  205. package/lib/testing/transfer-node-builder.js +47 -0
  206. package/lib/testing/transfer-node-builder.js.map +1 -0
  207. package/lib/testing/wait-for.d.ts +9 -3
  208. package/lib/testing/wait-for.d.ts.map +1 -1
  209. package/lib/testing/wait-for.js +57 -11
  210. package/lib/testing/wait-for.js.map +1 -1
  211. package/lib/tracer.d.ts.map +1 -1
  212. package/lib/tracer.js +5 -9
  213. package/lib/tracer.js.map +1 -1
  214. package/lib/transfer-diagnostic.js.map +1 -1
  215. package/lib/transfer-document.d.ts +96 -32
  216. package/lib/transfer-document.d.ts.map +1 -1
  217. package/lib/transfer-document.js +17 -9
  218. package/lib/transfer-document.js.map +1 -1
  219. package/lib/transfer-element.d.ts +4 -4
  220. package/lib/types.d.ts +32 -0
  221. package/lib/types.d.ts.map +1 -0
  222. package/lib/{model-service/args.js → types.js} +2 -2
  223. package/lib/types.js.map +1 -0
  224. package/lib/uri.d.ts.map +1 -1
  225. package/lib/uri.js.map +1 -1
  226. package/lib/util.d.ts +8 -2
  227. package/lib/util.d.ts.map +1 -1
  228. package/lib/util.js +32 -4
  229. package/lib/util.js.map +1 -1
  230. package/package.json +24 -40
  231. package/src/abstract-logger.ts +18 -0
  232. package/src/client/data-connection.ts +654 -0
  233. package/src/client/data-events.ts +38 -1
  234. package/src/client/data-port.ts +36 -25
  235. package/src/client/data-session.ts +1476 -137
  236. package/src/client/index.ts +15 -9
  237. package/src/client/message-relay.ts +6 -4
  238. package/src/client/post-message-transport.ts +224 -4
  239. package/src/client/rpc-connection.ts +302 -0
  240. package/src/client/worker-handshake.ts +121 -0
  241. package/src/client-ids.ts +49 -0
  242. package/src/clock.ts +68 -10
  243. package/src/console-logger.ts +39 -0
  244. package/src/data/data-protocol-methods.ts +14 -4
  245. package/src/data/data-server-protocol.ts +198 -48
  246. package/src/data/events.ts +150 -33
  247. package/src/data/requests.ts +82 -11
  248. package/src/debouncer.ts +11 -11
  249. package/src/errors.ts +453 -65
  250. package/src/format-log-arg.ts +176 -0
  251. package/src/glsp-edits-settled-actions.ts +62 -0
  252. package/src/glsp-request-model-args.ts +16 -0
  253. package/src/glsp-save-model-actions.ts +64 -0
  254. package/src/index.ts +11 -0
  255. package/src/latency-collector.ts +10 -3
  256. package/src/logger.ts +44 -8
  257. package/src/messages/index.ts +11 -2
  258. package/src/messages/primitives.ts +129 -5
  259. package/src/model-server.ts +64 -19
  260. package/src/model-service/base-version.ts +75 -0
  261. package/src/model-service/index.ts +4 -5
  262. package/src/model-service/reference-candidate.ts +5 -3
  263. package/src/node/index.ts +14 -0
  264. package/src/node/process-memory.ts +299 -0
  265. package/src/patch-merge.ts +230 -45
  266. package/src/pending-work-tracker.ts +47 -0
  267. package/src/profile-session.ts +31 -11
  268. package/src/profiling.ts +15 -2
  269. package/src/project.ts +6 -2
  270. package/src/random-uuid.ts +21 -0
  271. package/src/reconcile-write.ts +131 -0
  272. package/src/rpc/README.md +6 -6
  273. package/src/rpc/bind-rpc-methods.ts +18 -8
  274. package/src/rpc/create-rpc-proxy.ts +6 -1
  275. package/src/rpc/index.ts +1 -0
  276. package/src/rpc/send-by-method-name.ts +140 -0
  277. package/src/save-text-document.ts +39 -0
  278. package/src/testing/data-doubles.ts +141 -19
  279. package/src/testing/fake-clock.ts +76 -48
  280. package/src/testing/index.ts +4 -3
  281. package/src/testing/node/duplex-connection.ts +3 -2
  282. package/src/testing/node/index.ts +2 -2
  283. package/src/testing/node/message-port-pair.ts +40 -0
  284. package/src/testing/transfer-node-builder.ts +107 -0
  285. package/src/testing/wait-for.ts +61 -13
  286. package/src/tracer.ts +5 -9
  287. package/src/transfer-document.ts +116 -34
  288. package/src/transfer-element.ts +4 -4
  289. package/src/types.ts +30 -0
  290. package/src/util.ts +33 -6
  291. package/lib/model-service/args.d.ts +0 -64
  292. package/lib/model-service/args.d.ts.map +0 -1
  293. package/lib/model-service/args.js.map +0 -1
  294. package/src/model-service/args.ts +0 -67
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 CrossBreeze, 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.randomUuid = randomUuid;
12
+ /**
13
+ * A random v4 UUID. Not `crypto.randomUUID`: a browser offers it only in a
14
+ * secure context, and a client may be served over plain HTTP.
15
+ */
16
+ function randomUuid() {
17
+ const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16));
18
+ // Version 4, RFC 4122 variant.
19
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
20
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
21
+ const hex = Array.from(bytes, byte => byte.toString(16).padStart(2, '0')).join('');
22
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
23
+ }
24
+ //# sourceMappingURL=random-uuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random-uuid.js","sourceRoot":"","sources":["../src/random-uuid.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF;;;GAGG;AACH;IACG,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,+BAA+B;IAC/B,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnF,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;AAC9G,CAAC"}
@@ -0,0 +1,70 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, 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
+ import { type ConflictError } from './errors';
10
+ import { type BaseVersion, type ModelVersion } from './model-service/base-version';
11
+ import { type ConflictResolver } from './patch-merge';
12
+ /** A model and the version of the text it was read from, which a write based on it names. */
13
+ export interface VersionedModel<TModel> {
14
+ readonly model: TModel;
15
+ readonly baseVersion: ModelVersion;
16
+ }
17
+ /** The I/O and policy a {@link reconcileWrite} call needs. */
18
+ export interface ReconcileWriteHooks<TModel> {
19
+ /**
20
+ * Write `model`. Called with the caller's own `baseVersion` first, with the
21
+ * refetch's on a merged write, and with `'any'` for a merge that refetched
22
+ * nothing, where the resolver has already decided to win.
23
+ */
24
+ persist(model: TModel, baseVersion: BaseVersion): Promise<void>;
25
+ /**
26
+ * Current server-side model, or `undefined` when unavailable. Its version is
27
+ * read in the tick its text is: a later one lets a merged write overwrite an
28
+ * edit the merge never saw.
29
+ */
30
+ refetch(): Promise<VersionedModel<TModel> | undefined>;
31
+ /** The last in-sync model the user's intent is measured against. */
32
+ readonly base: TModel;
33
+ /** Asked for each conflict while writes remain. Its refetch callback runs {@link refetch} only when called. */
34
+ readonly conflictResolver: ConflictResolver;
35
+ /** Writes, the first included, after which a still-conflicting edit is dropped; 3 when absent. */
36
+ readonly maxWrites?: number;
37
+ /** Runs when the refetch is unavailable; absent, the edit is left unwritten. */
38
+ onUnavailable?(model: TModel, conflict: ConflictError): Promise<void>;
39
+ }
40
+ /**
41
+ * What {@link reconcileWrite} did. Every status but `persisted` follows a
42
+ * conflict, and carries the last one and the writes made, the first included.
43
+ */
44
+ export type ReconcileWriteOutcome =
45
+ /** The first write landed. */
46
+ {
47
+ readonly status: 'persisted';
48
+ } | {
49
+ /**
50
+ * `merged`: a merged write landed. `already-applied`: the refetch
51
+ * already held the edit, so nothing more was written. `unchanged`: the
52
+ * edit was empty, so the caller is behind the server. `conflict`: the
53
+ * resolver found a same-path collision. `dropped`: the writes ran out.
54
+ * `unavailable`: the refetch produced nothing and
55
+ * {@link ReconcileWriteHooks.onUnavailable} ran.
56
+ */
57
+ readonly status: 'merged' | 'already-applied' | 'unchanged' | 'conflict' | 'dropped' | 'unavailable';
58
+ /** The last conflict a write raised, which on `merged` is the one before the write that landed. */
59
+ readonly conflict: ConflictError;
60
+ /** Writes made, the first included. `dropped` is reported once they reach {@link ReconcileWriteHooks.maxWrites}. */
61
+ readonly writes: number;
62
+ };
63
+ /**
64
+ * Persist `model`, and on a `ConflictError` reconcile the user's `base → model`
65
+ * intent onto the refetched server model and write the merge, gated on the
66
+ * refetch's version, again on each conflict up to `maxWrites` writes. A
67
+ * non-conflict error is re-thrown.
68
+ */
69
+ export declare function reconcileWrite<TModel extends object>(model: TModel, baseVersion: BaseVersion, hooks: ReconcileWriteHooks<TModel>): Promise<ReconcileWriteOutcome>;
70
+ //# sourceMappingURL=reconcile-write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconcile-write.d.ts","sourceRoot":"","sources":["../src/reconcile-write.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,aAAa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1B,CAAC;AAEP;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,MAAM,SAAS,MAAM,EACvD,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAClC,OAAO,CAAC,qBAAqB,CAAC,CAmChC"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 CrossBreeze, 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.reconcileWrite = reconcileWrite;
12
+ const errors_1 = require("./errors");
13
+ const DEFAULT_MAX_WRITES = 3;
14
+ /**
15
+ * Persist `model`, and on a `ConflictError` reconcile the user's `base → model`
16
+ * intent onto the refetched server model and write the merge, gated on the
17
+ * refetch's version, again on each conflict up to `maxWrites` writes. A
18
+ * non-conflict error is re-thrown.
19
+ */
20
+ async function reconcileWrite(model, baseVersion, hooks) {
21
+ let candidate = model;
22
+ let candidateBaseVersion = baseVersion;
23
+ let previous;
24
+ const maxWrites = hooks.maxWrites ?? DEFAULT_MAX_WRITES;
25
+ for (let writes = 1;; writes++) {
26
+ const conflict = await persistOrConflict(hooks, candidate, candidateBaseVersion);
27
+ if (!conflict) {
28
+ return previous ? { status: 'merged', conflict: previous, writes } : { status: 'persisted' };
29
+ }
30
+ previous = conflict;
31
+ if (writes >= maxWrites) {
32
+ return { status: 'dropped', conflict, writes };
33
+ }
34
+ let refetched;
35
+ const outcome = await hooks.conflictResolver.resolve(hooks.base, model, async () => {
36
+ refetched = await hooks.refetch();
37
+ return refetched?.model;
38
+ });
39
+ switch (outcome.status) {
40
+ case 'merged':
41
+ candidate = outcome.merged;
42
+ candidateBaseVersion = refetched?.baseVersion ?? 'any';
43
+ continue;
44
+ case 'already-applied':
45
+ return { status: 'already-applied', conflict, writes };
46
+ case 'no-op':
47
+ return { status: 'unchanged', conflict, writes };
48
+ case 'conflict':
49
+ return { status: 'conflict', conflict, writes };
50
+ case 'unavailable':
51
+ await hooks.onUnavailable?.(model, conflict);
52
+ return { status: 'unavailable', conflict, writes };
53
+ }
54
+ }
55
+ }
56
+ /** The `ConflictError` the write raised, or `undefined` when it landed. */
57
+ async function persistOrConflict(hooks, model, baseVersion) {
58
+ try {
59
+ await hooks.persist(model, baseVersion);
60
+ return undefined;
61
+ }
62
+ catch (err) {
63
+ if (!(0, errors_1.isConflictError)(err)) {
64
+ throw err;
65
+ }
66
+ return err;
67
+ }
68
+ }
69
+ //# sourceMappingURL=reconcile-write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconcile-write.js","sourceRoot":"","sources":["../src/reconcile-write.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,qCAA+D;AAI/D,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAuD7B;;;;;GAKG;AACI,KAAK,yBACT,KAAa,EACb,WAAwB,EACxB,KAAkC;IAElC,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,oBAAoB,GAAG,WAAW,CAAC;IACvC,IAAI,QAAmC,CAAC;IACxC,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,kBAAkB,CAAC;IACxD,KAAK,IAAI,MAAM,GAAG,CAAC,GAAI,MAAM,EAAE,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACjF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QAChG,CAAC;QACD,QAAQ,GAAG,QAAQ,CA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AS,CAAC;IACpB,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACrB,IAAI,CAAC,IAAA,wBAAe,EAAC,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,GAAG,CAAC;QACb,CAAC;QACD,OAAO,GAAG,CAAC;IACd,CAAC;AACJ,CAAC"}
@@ -106,8 +106,12 @@ export interface BindRpcMethodsOptions {
106
106
  *
107
107
  * Errors thrown synchronously from a request handler — or surfaced as a
108
108
  * rejected promise — propagate back to the caller through vscode-jsonrpc's
109
- * standard error envelope, with the message rendered when
110
- * {@link BindRpcMethodsOptions.renderErrorMessage} is supplied. Errors from a
109
+ * standard error envelope, its message rendered when
110
+ * {@link BindRpcMethodsOptions.renderErrorMessage} is supplied. A
111
+ * `ResponseError` from another copy of `vscode-jsonrpc` is rebuilt on this
112
+ * package's copy, so its code and data reach the caller when `connection` comes
113
+ * from that copy too, as the framework's own connections do; over a connection
114
+ * from another copy the caller receives a generic `InternalError`. Errors from a
111
115
  * notification handler cannot propagate, and are routed to
112
116
  * {@link BindRpcMethodsOptions.onNotificationError} instead.
113
117
  *
@@ -1 +1 @@
1
- {"version":3,"file":"bind-rpc-methods.d.ts","sourceRoot":"","sources":["../../src/rpc/bind-rpc-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,SAAS,CAAC;AAIhE;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACnC;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IAE1D;;;;;;;;;OASG;IACH,QAAQ,C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,EAAE,OAAO,CAAC;IAE9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAE1E;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAEpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC;CAC1E;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC5C,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,EAC1D,MAAM,EAAE,CAAC,EACT,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,EAC1C,OAAO,GAAE,qBAA0B,GACnC,UAAU,CA6EZ"}
@@ -10,12 +10,21 @@
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.bindRpcMethods = bindRpcMethods;
12
12
  const vscode_jsonrpc_1 = require("vscode-jsonrpc");
13
+ const errors_1 = require("../errors");
13
14
  const util_1 = require("../util");
14
15
  const create_rpc_proxy_1 = require("./create-rpc-proxy");
15
16
  const wire_prefix_1 = require("./wire-prefix");
16
- /** The rejection to throw in place of `err`, with its message rendered. */
17
+ /**
18
+ * The rejection to throw in place of `err`. A `ResponseError` from another copy
19
+ * of `vscode-jsonrpc` is rebuilt on this package's, since a connection keeps the
20
+ * code only of its own copy's errors; one from this copy is thrown as is, so a
21
+ * subclass keeps its `toJson`, unless `render` rewrites its message.
22
+ */
17
23
  function renderRejection(err, render) {
18
- return err instanceof vscode_jsonrpc_1.ResponseError ? new vscode_jsonrpc_1.ResponseError(err.code, render(err), err.data) : err;
24
+ if (!(0, errors_1.isResponseError)(err) || (!render && err instanceof vscode_jsonrpc_1.ResponseError)) {
25
+ return err;
26
+ }
27
+ return new vscode_jsonrpc_1.ResponseError(err.code, render ? render(err) : err.message, err.data);
19
28
  }
20
29
  /**
21
30
  * Register each named method on `target` as a handler on `connection`
@@ -36,8 +45,12 @@ function renderRejection(err, render) {
36
45
  *
37
46
  * Errors thrown synchronously from a request handler — or surfaced as a
38
47
  * rejected promise — propagate back to the caller through vscode-jsonrpc's
39
- * standard error envelope, with the message rendered when
40
- * {@link BindRpcMethodsOptions.renderErrorMessage} is supplied. Errors from a
48
+ * standard error envelope, its message rendered when
49
+ * {@link BindRpcMethodsOptions.renderErrorMessage} is supplied. A
50
+ * `ResponseError` from another copy of `vscode-jsonrpc` is rebuilt on this
51
+ * package's copy, so its code and data reach the caller when `connection` comes
52
+ * from that copy too, as the framework's own connections do; over a connection
53
+ * from another copy the caller receives a generic `InternalError`. Errors from a
41
54
  * notification handler cannot propagate, and are routed to
42
55
  * {@link BindRpcMethodsOptions.onNotificationError} instead.
43
56
  *
@@ -93,9 +106,6 @@ function bindRpcMethods(connection, target, methodNames, options = {}) {
93
106
  else {
94
107
  const render = options.renderErrorMessage;
95
108
  disposables.push(resolved.onRequest(wireName, async (params) => {
96
- if (!render) {
97
- return dispatch(params);
98
- }
99
109
  try {
100
110
  // Awaited inside the try, or a rejected promise escapes it.
101
111
  return await dispatch(params);
@@ -1 +1 @@
1
- {"version":3,"file":"bind-rpc-methods.js","sourceRoot":"","sources":["../../src/rpc/bind-rpc-methods.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAoIlF,wCAqFC;AAvND,mDAAuE;AAEvE,kCAAgE;AAChE,yDAA2D;AAC3D,+CAA2D;AAsF3D,2EAA2E;AAC3E,SAAS,eAAe,CAAC,GAAY,EAAE,MAAiD;IACrF,OAAO,GAAG,YAAY,8BAAa,CAAC,CAAC,CAAC,IAAI,8BAAa,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAA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Q,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,MAAe,EAAE,EAAE;oBACnD,IAAI,CAAC;wBACF,QAAQ,CAAC,MAAM,CAAC,CAAC;oBACpB,CAAC;oBAAC,OAAO,GAAY,EAAE,CAAC;wBACrB,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;oBACtC,CAAC;gBACJ,CAAC,CAAC,CACJ,CAAC;YACL,CAAC;iBAAM,CAAC;gBACL,MAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;gBAC1C,WAAW,CAAC,IAAI,CACb,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAe,EAAE,EAAE;oBACpD,IAAI,CAAC;wBACF,4DAA4D;wBAC5D,OAAO,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;oBACjC,CAAC;oBAAC,OAAO,GAAY,EAAE,CAAC;wBACrB,MAAM,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;oBACtC,CAAC;gBACJ,CAAC,CAAC,CACJ,CAAC;YACL,CAAC;QACJ,CAAC;IACJ,CAAC,CAAC;IAEF,IAAI,UAAU,YAAY,OAAO,EAAE,CAAC;QACjC,KAAK,UAAU;aACX,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;aAClC,KAAK,CAAC,GAAG,EAAE;YACT,iEAAiE;YACjE,iEAAiE;YACjE,8CAA8C;QACjD,CAAC,CAAC,CAAC;IACT,CAAC;SAAM,CAAC;QACL,MAAM,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;IAED,OAAO;QACJ,OAAO;YACJ,SAAS,GAAG,IAAI,CAAC;YACjB,WAAW,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;KACH,CAAC;AACL,CAAC"}
@@ -169,6 +169,9 @@ export declare function defaultIsNotification(methodName: string): boolean;
169
169
  * params, results and errors, and a second layer here would double every
170
170
  * traced line.
171
171
  *
172
+ * A rejection whose code names one of the framework's typed errors is rethrown
173
+ * as that class, through {@link reviveProtocolError}.
174
+ *
172
175
  * Accepts either a ready connection or a `Promise<MessageConnection>` —
173
176
  * proxy methods called before the promise resolves queue until it does,
174
177
  * then dispatch, so adopters can wire the proxy before its underlying
@@ -1 +1 @@
1
- {"version":3,"file":"create-rpc-proxy.d.ts","sourceRoot":"","sources":["../../src/rpc/create-rpc-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAW,KAAK,KAAK,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,oBAAoB,CAAC;AAGhF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,iBAAiB;IAC/B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,mBAAmB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,qEAAqE;AACrE,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,iBAAiB,CAAC;AAE/D;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB,CAAC,MAAM,SAAS,MAAM,GAAG,KAAK;IACjE;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IAE1D;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAE3D;;;;;OA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;;;;;;OAUG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IAE1D;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAE3D;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAEpD;;;;;OAKG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;CAC5E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEjE;AAiBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,GAAG,KAAK,EAC3E,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,EAC1D,OAAO,GAAE,qBAAqB,CAAC,MAAM,CAAM,GAC3C,QAAQ,CAAC,CAAC,CAAC,CAgFb"}
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.defaultIsNotification = defaultIsNotification;
12
12
  exports.createRpcProxy = createRpcProxy;
13
13
  const vscode_jsonrpc_1 = require("vscode-jsonrpc");
14
+ const errors_1 = require("../errors");
14
15
  const bind_rpc_methods_1 = require("./bind-rpc-methods");
15
16
  const wire_prefix_1 = require("./wire-prefix");
16
17
  /**
@@ -61,6 +62,9 @@ function assertSingleArg(wireName, args) {
61
62
  * params, results and errors, and a second layer here would double every
62
63
  * traced line.
63
64
  *
65
+ * A rejection whose code names one of the framework's typed errors is rethrown
66
+ * as that class, through {@link reviveProtocolError}.
67
+ *
64
68
  * Accepts either a ready connection or a `Promise<MessageConnection>` —
65
69
  * proxy methods called before the promise resolves queue until it does,
66
70
  * then dispatch, so adopters can wire the proxy before its underlying
@@ -150,7 +154,8 @@ function createRpcProxy(connection, options = {}) {
150
154
  const capturedError = new Error(`RPC request '${wireName}' failed`);
151
155
  return resolvedConnection
152
156
  .then(connection => connection.sendRequest(wireName, args[0]))
153
- .catch((err) => {
157
+ .catch((rejection) => {
158
+ const err = (0, errors_1.reviveProtocolError)(rejection);
154
159
  if (err instanceof Error && capturedError.stack) {
155
160
  err.stack = `${err.stack ?? err.message}\nCaused by request from:\n${capturedError.stack}`;
156
161
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-rpc-proxy.js","sourceRoot":"","sources":["../../src/rpc/create-rpc-proxy.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AA6JlF,sDAEC;AAwDD,wCAkFC;AAvSD,mDAA6E;AAC7E,yDAAgF;AAChF,+CAA2D;AAyI3D;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,qBAAqB,CAAC,UAAkB;IACrD,OAAO,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe,CAAC,QAAgB,EAAE,IAAe;IACvD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACZ,eAAe,QAAQ,iBAAiB,IAAI,CAAC,MAAM,2DAA2D;YAC3G,uDAAuD,CAC5D,CAAC;IACL,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAgB,cAAc,CAC3B,UAA0D,EAC1D,UAAyC,EAAE;IAE3C,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,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CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;qBAC7D,KAAK,CAAC,CAAC,SAAkB,EAAE,EAAE;oBAC3B,MAAM,GAAG,GAAG,IAAA,4BAAmB,EAAC,SAAS,CAAC,CAAC;oBAC3C,IAAI,GAAG,YAAY,KAAK,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;wBAC/C,GAAG,CAAC,KAAK,GAAG,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,8BAA8B,aAAa,CAAC,KAAK,EAAE,CAAC;oBAC9F,CAAC;oBACD,MAAM,GAAG,CAAC;gBACb,CAAC,CAAC,CAAC;YACT,CAAC,CAAC;QACL,CAAC;KACH,CAAgB,CAAC;AACrB,CAAC"}
@@ -8,5 +8,6 @@
8
8
  ********************************************************************************/
9
9
  export * from './bind-rpc-methods';
10
10
  export * from './create-rpc-proxy';
11
+ export * from './send-by-method-name';
11
12
  export * from './wire-prefix';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
package/lib/rpc/index.js CHANGED
@@ -27,5 +27,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
27
27
  // specialised composition.
28
28
  __exportStar(require("./bind-rpc-methods"), exports);
29
29
  __exportStar(require("./create-rpc-proxy"), exports);
30
+ __exportStar(require("./send-by-method-name"), exports);
30
31
  __exportStar(require("./wire-prefix"), exports);
31
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kEAAkE;AAClE,+DAA+D;AAC/D,2BAA2B;AAE3B,qDAAmC;AACnC,qDAAmC;AACnC,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kEAAkE;AAClE,+DAA+D;AAC/D,2BAA2B;AAE3B,qDAAmC;AACnC,qDAAmC;AACnC,wDAAsC;AACtC,gDAA8B"}
@@ -0,0 +1,76 @@
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
+ /**
10
+ * `connection` with `sendRequest` and `sendNotification` sending a typed message
11
+ * by its method name, so it survives a message type built by another copy of
12
+ * `vscode-jsonrpc`. Wrap a connection wherever it is handed to code that sends
13
+ * another copy's typed messages, GLSP's clients and launchers in particular.
14
+ *
15
+ * **Why an install holds several copies.** Upstream pins exactly:
16
+ * - `@eclipse-glsp/*` 2.x pin `vscode-jsonrpc` `8.2.0`, and npm can nest a copy
17
+ * under each GLSP package, so GLSP's packages can split from each other: a
18
+ * connection one of them creates rejects the typed messages another builds.
19
+ * GLSP's upgrade to 9.x, which could let it share the framework's copy, is
20
+ * open as https://github.com/eclipse-glsp/glsp/issues/1720.
21
+ * - `vscode-languageserver@10.0.1` pins `vscode-languageserver-protocol`
22
+ * `3.18.1`, which pins `vscode-jsonrpc` `9.0.0`.
23
+ * - Theia brings protocol `3.17.5` and with it `vscode-jsonrpc` 8.
24
+ *
25
+ * npm hoists one version per name and nests the rest. `overrides` are read from
26
+ * the root manifest alone and never ship with a package, so the framework cannot
27
+ * collapse an adopter's tree.
28
+ *
29
+ * **What breaks across copies.**
30
+ * - Sending: a connection compares a typed message's parameter structure with
31
+ * its own copy's `ParameterStructures.auto` singleton by identity, so a
32
+ * `RequestType` or `NotificationType` built by another copy throws
33
+ * `Unknown parameter structure auto`. GLSP sends typed messages, in
34
+ * `BaseJsonrpcGLSPClient` and in `JsonrpcClientProxy.process`.
35
+ * `vscode-languageserver`'s connection resends by method name already, which
36
+ * is why LSP sends are unaffected.
37
+ * - Types: `ParameterStructures` has a private member, so TypeScript treats each
38
+ * copy's `MessageConnection` as a different type.
39
+ * - Errors: a connection keeps a thrown `ResponseError`'s code and data only
40
+ * when the error is an instance of its own copy's class, and sends a returned
41
+ * one of another copy as a successful result.
42
+ *
43
+ * **What is copy-safe.** Receiving a typed message from another copy, since the
44
+ * receive path compares only against its own `byName` and `byPosition`. With
45
+ * sends by method name, the LSP, data and GLSP heads run over a tree whose GLSP
46
+ * packages keep `vscode-jsonrpc` `8.2.0`.
47
+ *
48
+ * **How it works.** A `Proxy` whose `sendRequest` and `sendNotification` pass the
49
+ * typed message's `method` string; every other member is the connection's own.
50
+ * The parameters go out as the typed send packs them: the first
51
+ * `numberOfParams`, missing ones `null`, and a request's cancellation token
52
+ * from the position after them. Sent by method name, a single parameter goes by
53
+ * name when it is an object and by position otherwise, which matches `auto` and
54
+ * `byName` with an object, as `vscode-languageserver-protocol`'s types use it. A
55
+ * `byPosition` object or a `byName` non-object throws rather than going out in
56
+ * another shape, the packing read from the type's `toString()` since it cannot
57
+ * be compared by identity. So wrapping narrows what a connection accepts: its
58
+ * own copy sends such a type unwrapped. The result is typed as whichever copy's
59
+ * connection its context expects, or as `connection`'s own type without one.
60
+ * That type is the caller's assertion: it holds for the members both copies
61
+ * share, since the sends go by name and the receives are copy-safe.
62
+ *
63
+ * **Where it stops.** Errors: a rejection it produces is still its own copy's
64
+ * `ResponseError`, so recognise errors with `isResponseError`, and build a
65
+ * connection whose errors must keep their code from the framework's copy.
66
+ *
67
+ * See https://github.com/eclipse-emfcloud/hydranium/issues/279.
68
+ */
69
+ export declare function sendByMethodName<In extends {
70
+ sendRequest<R>(method: string, ...params: unknown[]): Promise<R>;
71
+ sendNotification(method: string, ...params: unknown[]): Promise<void>;
72
+ }, Out extends {
73
+ sendRequest<R>(method: string, ...params: unknown[]): Promise<R>;
74
+ sendNotification(method: string, ...params: unknown[]): Promise<void>;
75
+ } = In>(connection: In): Out;
76
+ //# sourceMappingURL=send-by-method-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-by-method-name.d.ts","sourceRoot":"","sources":["../../src/rpc/send-by-method-name.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAAgB,gBAAgB,CAC7B,EAAE,SAAS;IACR,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,EACD,GAAG,SAAS;IACT,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,GAAG,EAAE,EACP,UAAU,EAAE,EAAE,GAAG,GAAG,CAsBrB"}
@@ -0,0 +1,120 @@
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.sendByMethodName = sendByMethodName;
12
+ const vscode_jsonrpc_1 = require("vscode-jsonrpc");
13
+ /**
14
+ * `connection` with `sendRequest` and `sendNotification` sending a typed message
15
+ * by its method name, so it survives a message type built by another copy of
16
+ * `vscode-jsonrpc`. Wrap a connection wherever it is handed to code that sends
17
+ * another copy's typed messages, GLSP's clients and launchers in particular.
18
+ *
19
+ * **Why an install holds several copies.** Upstream pins exactly:
20
+ * - `@eclipse-glsp/*` 2.x pin `vscode-jsonrpc` `8.2.0`, and npm can nest a copy
21
+ * under each GLSP package, so GLSP's packages can split from each other: a
22
+ * connection one of them creates rejects the typed messages another builds.
23
+ * GLSP's upgrade to 9.x, which could let it share the framework's copy, is
24
+ * open as https://github.com/eclipse-glsp/glsp/issues/1720.
25
+ * - `vscode-languageserver@10.0.1` pins `vscode-languageserver-protocol`
26
+ * `3.18.1`, which pins `vscode-jsonrpc` `9.0.0`.
27
+ * - Theia brings protocol `3.17.5` and with it `vscode-jsonrpc` 8.
28
+ *
29
+ * npm hoists one version per name and nests the rest. `overrides` are read from
30
+ * the root manifest alone and never ship with a package, so the framework cannot
31
+ * collapse an adopter's tree.
32
+ *
33
+ * **What breaks across copies.**
34
+ * - Sending: a connection compares a typed message's parameter structure with
35
+ * its own copy's `ParameterStructures.auto` singleton by identity, so a
36
+ * `RequestType` or `NotificationType` built by another copy throws
37
+ * `Unknown parameter structure auto`. GLSP sends typed messages, in
38
+ * `BaseJsonrpcGLSPClient` and in `JsonrpcClientProxy.process`.
39
+ * `vscode-languageserver`'s connection resends by method name already, which
40
+ * is why LSP sends are unaffected.
41
+ * - Types: `ParameterStructures` has a private member, so TypeScript treats each
42
+ * copy's `MessageConnection` as a different type.
43
+ * - Errors: a connection keeps a thrown `ResponseError`'s code and data only
44
+ * when the error is an instance of its own copy's class, and sends a returned
45
+ * one of another copy as a successful result.
46
+ *
47
+ * **What is copy-safe.** Receiving a typed message from another copy, since the
48
+ * receive path compares only against its own `byName` and `byPosition`. With
49
+ * sends by method name, the LSP, data and GLSP heads run over a tree whose GLSP
50
+ * packages keep `vscode-jsonrpc` `8.2.0`.
51
+ *
52
+ * **How it works.** A `Proxy` whose `sendRequest` and `sendNotification` pass the
53
+ * typed message's `method` string; every other member is the connection's own.
54
+ * The parameters go out as the typed send packs them: the first
55
+ * `numberOfParams`, missing ones `null`, and a request's cancellation token
56
+ * from the position after them. Sent by method name, a single parameter goes by
57
+ * name when it is an object and by position otherwise, which matches `auto` and
58
+ * `byName` with an object, as `vscode-languageserver-protocol`'s types use it. A
59
+ * `byPosition` object or a `byName` non-object throws rather than going out in
60
+ * another shape, the packing read from the type's `toString()` since it cannot
61
+ * be compared by identity. So wrapping narrows what a connection accepts: its
62
+ * own copy sends such a type unwrapped. The result is typed as whichever copy's
63
+ * connection its context expects, or as `connection`'s own type without one.
64
+ * That type is the caller's assertion: it holds for the members both copies
65
+ * share, since the sends go by name and the receives are copy-safe.
66
+ *
67
+ * **Where it stops.** Errors: a rejection it produces is still its own copy's
68
+ * `ResponseError`, so recognise errors with `isResponseError`, and build a
69
+ * connection whose errors must keep their code from the framework's copy.
70
+ *
71
+ * See https://github.com/eclipse-emfcloud/hydranium/issues/279.
72
+ */
73
+ function sendByMethodName(connection) {
74
+ const sendRequest = (type, ...params) => typeof type === 'string'
75
+ ? connection.sendRequest(type, ...params)
76
+ : connection.sendRequest(type.method, ...argsOf(type, params, true));
77
+ const sendNotification = (type, ...params) => typeof type === 'string'
78
+ ? connection.sendNotification(type, ...params)
79
+ : connection.sendNotification(type.method, ...argsOf(type, params, false));
80
+ const wrapped = new Proxy(connection, {
81
+ get(target, property, receiver) {
82
+ if (property === 'sendRequest') {
83
+ return sendRequest;
84
+ }
85
+ if (property === 'sendNotification') {
86
+ return sendNotification;
87
+ }
88
+ return Reflect.get(target, property, receiver);
89
+ }
90
+ });
91
+ // Typed as the connection its context expects, which the doc above justifies.
92
+ return wrapped;
93
+ }
94
+ /** Whether `vscode-jsonrpc` sends `param` by name under `auto`. */
95
+ function isNamedParam(param) {
96
+ return param !== undefined && param !== null && !Array.isArray(param) && typeof param === 'object';
97
+ }
98
+ /**
99
+ * The arguments that send `type` by method name with the typed send's params:
100
+ * the first `numberOfParams` of `params`, missing ones `null`, then a request's
101
+ * cancellation token, which the typed send takes from that position. A request
102
+ * always ends in a token, `CancellationToken.None` when it has none, since a
103
+ * send by method name takes a token-shaped last argument for its token. Throws
104
+ * for the one-parameter packing a send by method name cannot express.
105
+ */
106
+ function argsOf(type, params, isRequest) {
107
+ const args = Array.from({ length: type.numberOfParams }, (_, i) => (i < params.length ? params[i] : null));
108
+ if (type.numberOfParams === 1) {
109
+ const packing = String(type.parameterStructures);
110
+ if ((packing === 'byPosition' && isNamedParam(args[0])) || (packing === 'byName' && !isNamedParam(args[0]))) {
111
+ throw new Error(`sendByMethodName cannot send '${type.method}' ${packing}: by method name, a single object goes by name and anything else by position.`);
112
+ }
113
+ }
114
+ if (!isRequest) {
115
+ return args;
116
+ }
117
+ const token = params[type.numberOfParams];
118
+ return [...args, vscode_jsonrpc_1.CancellationToken.is(token) ? token : vscode_jsonrpc_1.CancellationToken.None];
119
+ }
120
+ //# sourceMappingURL=send-by-method-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-by-method-name.js","sourceRoot":"","sources":["../../src/rpc/send-by-method-name.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,mDAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,0BASE,UAAc;IACb,MAAM,WAAW,GAAG,CAAC,IAA2B,EAAE,GAAG,MAAiB,EAAE,EAAE,CACvE,OAAO,IAAI,KAAK,Q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EAAE,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3D,OAAO;IACV,CAAC;IACD,MAAM,IAAI,SAAS,CAChB,GAAG,MAAM,sBAAsB,eAAe,qCAAqC;QAChF,qFAAqF;QACrF,yDAAyD,eAAe,cAAc;QACtF,6CAA6C,eAAe,gBAAgB;QAC5E,gBAAgB,eAAe,2CAA2C,CAC/E,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"wire-prefix.js","sourceRoot":"","sources":["../../src/rpc/wire-prefix.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,oCAA2C,eAAuB,EAAE,MAAc;IAC/E,IAAI,eAAe,KAAK,EAAE,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3D,OAAO;IACV,CAAC;IACD,MAAM,IAAI,SAAS,CAChB,GAAG,MAAM,sBAAsB,eAAe,qCAAqC;QAChF,qFAAqF;QACrF,yDAAyD,eAAe,cAAc;QACtF,6CAA6C,eAAe,gBAAgB;QAC5E,gBAAgB,eAAe,2CAA2C,CAC/E,CAAC;AACL,CAAC"}
@@ -0,0 +1,40 @@
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
+ import { RequestType } from 'vscode-jsonrpc';
10
+ /**
11
+ * LSP's `VersionedTextDocumentIdentifier`, declared field by field: this
12
+ * package carries no LSP dependency, and the fields are LSP's own.
13
+ */
14
+ export interface SaveTextDocumentParams {
15
+ readonly textDocument: {
16
+ readonly uri: string;
17
+ readonly version: number;
18
+ };
19
+ }
20
+ /**
21
+ * Ask the LSP head to persist the text it holds for a document, which it
22
+ * answers with `null` once the text is written. LSP itself has none: its
23
+ * `didSave` reports a write the editor made, so a host whose files only the
24
+ * server holds saves through this.
25
+ *
26
+ * It travels the connection the `didChange`s travel, so it arrives after
27
+ * them. The server refuses it with a `ConflictError` unless the version is the
28
+ * one the editor last declared and its buffer holds the server's current
29
+ * text, which a `workspace/applyEdit` still in flight breaks.
30
+ *
31
+ * A server that answers it advertises it as
32
+ * `ServerCapabilities.experimental[SaveTextDocumentRequest.method] = true`;
33
+ * a client checks that before sending, since a server without a handler
34
+ * answers `MethodNotFound`.
35
+ */
36
+ export declare namespace SaveTextDocumentRequest {
37
+ const method = "hydranium/saveTextDocument";
38
+ const type: RequestType<SaveTextDocumentParams, null, void>;
39
+ }
40
+ //# sourceMappingURL=save-text-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save-text-document.d.ts","sourceRoot":"","sources":["../src/save-text-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACpC,QAAQ,CAAC,YAAY,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5E;AAED;;;;;;;;;;;;;;;GAeG;AACH,yBAAiB,uBAAuB,CAAC;IAC/B,MAAM,MAAM,+BAA+B,CAAC;IAC5C,MAAM,IAAI,iDAA8D,CAAC;CAClF"}