@hydranium/protocol 1.0.0-next.14 → 1.0.0-next.140

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 (172) hide show
  1. package/README.md +35 -1
  2. package/lib/client/data-connection.d.ts +150 -0
  3. package/lib/client/data-connection.d.ts.map +1 -0
  4. package/lib/client/data-connection.js +211 -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 +17 -22
  11. package/lib/client/data-port.d.ts.map +1 -1
  12. package/lib/client/data-session.d.ts +301 -80
  13. package/lib/client/data-session.d.ts.map +1 -1
  14. package/lib/client/data-session.js +425 -107
  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 +179 -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 +22 -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/package.json +11 -2
  133. package/src/client/data-connection.ts +288 -0
  134. package/src/client/data-events.ts +33 -1
  135. package/src/client/data-port.ts +17 -23
  136. package/src/client/data-session.ts +549 -126
  137. package/src/client/index.ts +13 -8
  138. package/src/client/message-relay.ts +29 -7
  139. package/src/client/post-message-transport.ts +219 -4
  140. package/src/client/rpc-connection.ts +244 -0
  141. package/src/client-ids.ts +49 -0
  142. package/src/clock.ts +56 -0
  143. package/src/data/data-protocol-methods.ts +11 -3
  144. package/src/data/data-server-protocol.ts +132 -31
  145. package/src/data/events.ts +109 -14
  146. package/src/data/requests.ts +71 -11
  147. package/src/errors.ts +259 -24
  148. package/src/glsp-save-model-actions.ts +59 -0
  149. package/src/index.ts +6 -0
  150. package/src/latency-collector.ts +8 -3
  151. package/src/messages/index.ts +36 -0
  152. package/src/messages/primitives.ts +271 -0
  153. package/src/model-server.ts +63 -18
  154. package/src/model-service/based-on.ts +63 -0
  155. package/src/model-service/index.ts +4 -5
  156. package/src/patch-merge.ts +90 -37
  157. package/src/profile-session.ts +9 -4
  158. package/src/rpc/bind-rpc-methods.ts +49 -4
  159. package/src/rpc/create-rpc-proxy.ts +14 -1
  160. package/src/testing/catalogue-audit.ts +111 -0
  161. package/src/testing/data-doubles.ts +42 -17
  162. package/src/testing/fake-clock.ts +62 -47
  163. package/src/testing/index.ts +4 -1
  164. package/src/testing/node/index.ts +2 -2
  165. package/src/testing/node/message-port-pair.ts +40 -0
  166. package/src/transfer-diagnostic.ts +40 -0
  167. package/src/transfer-document.ts +29 -6
  168. package/lib/model-service/args.d.ts +0 -64
  169. package/lib/model-service/args.d.ts.map +0 -1
  170. package/lib/model-service/args.js +0 -11
  171. package/lib/model-service/args.js.map +0 -1
  172. package/src/model-service/args.ts +0 -67
@@ -9,6 +9,7 @@
9
9
  ********************************************************************************/
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.makeFakeClock = makeFakeClock;
12
+ const clock_1 = require("../clock");
12
13
  const util_1 = require("../util");
13
14
  /**
14
15
  * In-process {@link Clock} double for deterministic time. The real
@@ -20,67 +21,75 @@ const util_1 = require("../util");
20
21
  *
21
22
  * Server-free and DI-free — lives in `@hydranium/protocol/testing` so every
22
23
  * head can bind it without pulling in a server package.
24
+ *
25
+ * The clock is a `SystemClock` with its time replaced, so its methods live on
26
+ * its prototype and a spread of it carries none of them. Replace one by
27
+ * assigning it onto the clock, or layer over the clock with `Object.create`.
23
28
  */
24
29
  function makeFakeClock(options = {}) {
25
- let current = options.now ?? 0;
26
- const timers = [];
27
- const makeStopwatch = () => {
28
- const start = current;
29
- let lastLap = current;
30
+ return new VirtualClock(options.now ?? 0);
31
+ }
32
+ /**
33
+ * A `SystemClock` whose time, stopwatches and timers read one virtual axis, so
34
+ * the `measure` and `raceTimer` it inherits run on that axis too.
35
+ */
36
+ class VirtualClock extends clock_1.SystemClock {
37
+ current;
38
+ timers = [];
39
+ constructor(current) {
40
+ super();
41
+ this.current = current;
42
+ }
43
+ now() {
44
+ return this.current;
45
+ }
46
+ setTimer(callback, ms) {
47
+ const timer = { at: this.current + ms, callback, disposed: false, fired: false };
48
+ this.timers.push(timer);
49
+ return util_1.Disposable.create(() => {
50
+ timer.disposed = true;
51
+ });
52
+ }
53
+ stopwatch() {
54
+ const read = () => this.current;
55
+ const start = read();
56
+ let lastLap = start;
30
57
  let stopped;
31
58
  return {
32
59
  get elapsedMs() {
33
- return (stopped ?? current) - start;
60
+ return (stopped ?? read()) - start;
34
61
  },
35
62
  lap() {
36
- const at = stopped ?? current;
63
+ const at = stopped ?? read();
37
64
  const split = at - lastLap;
38
65
  lastLap = at;
39
66
  return split;
40
67
  },
41
68
  stop() {
42
- if (stopped === undefined) {
43
- stopped = current;
44
- }
69
+ stopped ??= read();
45
70
  return stopped - start;
46
71
  }
47
72
  };
48
- };
49
- return {
50
- now: () => current,
51
- setTimer(callback, ms) {
52
- const timer = { at: current + ms, callback, disposed: false, fired: false };
53
- timers.push(timer);
54
- return util_1.Disposable.create(() => {
55
- timer.disposed = true;
56
- });
57
- },
58
- stopwatch: makeStopwatch,
59
- measure: ((callback) => {
60
- const stopwatch = makeStopwatch();
61
- const result = callback();
62
- if (result instanceof Promise) {
63
- return result.then(value => ({ result: value, elapsedMs: stopwatch.elapsedMs }));
64
- }
65
- return { result: result, elapsedMs: stopwatch.elapsedMs };
66
- }),
67
- advance(ms) {
68
- const target = current + ms;
69
- // Fire due timers one at a time, re-scanning after each so a callback
70
- // that schedules a nearer timer still fires within this window.
71
- for (;;) {
72
- const next = timers
73
- .filter(timer => !timer.disposed && !timer.fired && timer.at <= target)
74
- .sort((left, right) => left.at - right.at)[0];
75
- if (!next) {
76
- break;
77
- }
78
- current = next.at;
79
- next.fired = true;
80
- next.callback();
73
+ }
74
+ pendingTimers() {
75
+ return this.timers.filter(timer => !timer.disposed && !timer.fired).length;
76
+ }
77
+ advance(ms) {
78
+ const target = this.current + ms;
79
+ // Fire due timers one at a time, re-scanning after each so a callback
80
+ // that schedules a nearer timer still fires within this window.
81
+ for (;;) {
82
+ const next = this.timers
83
+ .filter(timer => !timer.disposed && !timer.fired && timer.at <= target)
84
+ .sort((left, right) => left.at - right.at)[0];
85
+ if (!next) {
86
+ break;
81
87
  }
82
- current = target;
88
+ this.current = next.at;
89
+ next.fired = true;
90
+ next.callback();
83
91
  }
84
- };
92
+ this.current = target;
93
+ }
85
94
  }
86
95
  //# sourceMappingURL=fake-clock.js.map
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,IAAI,EAAE,CAAC;gBAC7B,MAAM,KAAK,GAAG,EAAE,GAAG,OAAO,CAAC;gBAC3B,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,KAAK,CAAC;YAChB,CAAC;YACD,IAAI;gBACD,OAAO,KAAK,IAAI,EAAE,CAAC;gBACnB,OAAO,OAAO,GAAG,KAAK,CAAC;YAC1B,CAAC;SACH,CAAC;IACL,CAAC;IAED,aAAa;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IAC9E,CAAC;IAED,OAAO,CAAC,EAAU;QACf,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QACjC,sEAAsE;QACtE,gEAAgE;QAChE,SAAS,CAAC;YACP,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM;iBACpB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,EAAE,IAAI,MAAM,CAAC;iBACtE,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,IAAI,CAAC,IAAI,EAAE,CAAC;gBACT,MAAM;YACT,CAAC;YACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YAClB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACzB,CAAC;CACH"}
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
+ export * from './catalogue-audit';
9
10
  export * from './data-doubles';
10
11
  export * from './fake-clock';
11
12
  export * from './harness';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAelF,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAiBlF,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
@@ -25,7 +25,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  // Subpath barrel for `@hydranium/protocol/testing` — the BROWSER-NEUTRAL shared
26
26
  // primitives: `makeFakeClock` (deterministic `Clock` double on one virtual time
27
27
  // axis), `waitFor` / `tick`, the client-side data-head doubles
28
- // (`makeFakeDataPort` / `makeCapturingDataClient`), and the `Harness` marker
28
+ // (`makeFakeDataPort` / `makeCapturingDataClient`), the translation-catalogue
29
+ // audit (`flattenCatalogue` / `findUndeclaredCodes` / `findSharedCodes`), and
30
+ // the `Harness` marker
29
31
  // interface every framework harness extends. Kept out of the main barrel so production bundles don't pull
30
32
  // the test scaffolding in by default; adopters opt in by importing from
31
33
  // `@hydranium/protocol/testing`.
@@ -34,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
34
36
  // duplex transports are NOT here: a `PassThrough` pair is in their exported
35
37
  // type, so they cannot be made portable and live at `./testing/node` instead.
36
38
  // The same rule the package surface uses — the portable name is the short one.
39
+ __exportStar(require("./catalogue-audit"), exports);
37
40
  __exportStar(require("./data-doubles"), exports);
38
41
  __exportStar(require("./fake-clock"), exports);
39
42
  __exportStar(require("./harness"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,gFAAgF;AAChF,+DAA+D;AAC/D,6EAA6E;AAC7E,0GAA0G;AAC1G,wEAAwE;AACxE,iCAAiC;AACjC,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAE/E,iDAA+B;AAC/B,+CAA6B;AAC7B,4CAA0B;AAC1B,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,gFAAgF;AAChF,+DAA+D;AAC/D,8EAA8E;AAC9E,8EAA8E;AAC9E,uBAAuB;AACvB,0GAA0G;AAC1G,wEAAwE;AACxE,iCAAiC;AACjC,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAE/E,oDAAkC;AAClC,iDAA+B;AAC/B,+CAA6B;AAC7B,4CAA0B;AAC1B,6CAA2B"}
@@ -8,4 +8,5 @@
8
8
  ********************************************************************************/
9
9
  export * from './duplex-connection';
10
10
  export * from './duplex-stream';
11
+ export * from './message-port-pair';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAYlF,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -23,8 +23,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  // Subpath barrel for `@hydranium/protocol/testing/node` — the test transports
26
- // that need a Node runtime: a crossed `PassThrough` pair and the in-process
27
- // `MessageConnection` bridge over it.
26
+ // that need a Node runtime.
28
27
  //
29
28
  // Separate from `./testing` because a `PassThrough` is in `DuplexStreamPair`'s
30
29
  // exported type and `StreamMessageReader` comes from `vscode-jsonrpc/node`, so
@@ -34,4 +33,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
34
33
  // their own.
35
34
  __exportStar(require("./duplex-connection"), exports);
36
35
  __exportStar(require("./duplex-stream"), exports);
36
+ __exportStar(require("./message-port-pair"), exports);
37
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,8EAA8E;AAC9E,4EAA4E;AAC5E,sCAAsC;AACtC,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,aAAa;AAEb,sDAAoC;AACpC,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,8EAA8E;AAC9E,4BAA4B;AAC5B,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,aAAa;AAEb,sDAAoC;AACpC,kDAAgC;AAChC,sDAAoC"}
@@ -0,0 +1,25 @@
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 type { TransferredMessagePort } from '../../client/post-message-transport';
10
+ /**
11
+ * The two ends of a `worker_threads` `MessageChannel`, typed as the transferred
12
+ * browser ports `createMessagePortTransport` takes. Node's port clones and keeps
13
+ * order as a browser's does, which is what lets a headless test stand in for a
14
+ * worker.
15
+ *
16
+ * `dispose` closes both ports. Node reports that as a close and a browser port
17
+ * reports nothing, so a test that asserts on a close does so before teardown.
18
+ */
19
+ export interface MessagePortPair {
20
+ readonly port1: TransferredMessagePort;
21
+ readonly port2: TransferredMessagePort;
22
+ dispose(): void;
23
+ }
24
+ export declare function makeMessagePortPair(): MessagePortPair;
25
+ //# sourceMappingURL=message-port-pair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-port-pair.d.ts","sourceRoot":"","sources":["../../../src/testing/node/message-port-pair.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAElF;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC7B,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,OAAO,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,mBAAmB,IAAI,eAAe,CAYrD"}
@@ -0,0 +1,26 @@
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.makeMessagePortPair = makeMessagePortPair;
12
+ const node_worker_threads_1 = require("node:worker_threads");
13
+ function makeMessagePortPair() {
14
+ const channel = new node_worker_threads_1.MessageChannel();
15
+ return {
16
+ // Node's port satisfies the structural type at runtime; the cast records
17
+ // one platform's port standing in for the other's.
18
+ port1: channel.port1,
19
+ port2: channel.port2,
20
+ dispose() {
21
+ channel.port1.close();
22
+ channel.port2.close();
23
+ }
24
+ };
25
+ }
26
+ //# sourceMappingURL=message-port-pair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-port-pair.js","sourceRoot":"","sources":["../../../src/testing/node/message-port-pair.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAoBlF,kDAYC;AA9BD,6DAAqD;AAkBrD,SAAgB,mBAAmB;IAChC,MAAM,OAAO,GAAG,IAAI,oCAAc,EAAE,CAAC;IACrC,OAAO;QACJ,yEAAyE;QACzE,mDAAmD;QACnD,KAAK,EAAE,OAAO,CAAC,KAA0C;QACzD,KAAK,EAAE,OAAO,CAAC,KAA0C;QACzD,OAAO;YACJ,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;KACH,CAAC;AACL,CAAC"}
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
+ import { type MessageParams, type ResolvedMessage } from './messages/primitives';
9
10
  /**
10
11
  * Generic, transport-friendly diagnostic shape used by the model-server protocol.
11
12
  *
@@ -55,6 +56,21 @@ export interface TransferDiagnostic {
55
56
  * is not usable as a rule identity on its own.
56
57
  */
57
58
  code?: number | string;
59
+ /**
60
+ * Substitutions for the placeholders in the message this {@link code} names,
61
+ * present only for a diagnostic raised from a framework message declaration.
62
+ *
63
+ * Without them a translated template renders with its `{name}` tokens left
64
+ * standing, because substitution leaves an unmatched token in place rather
65
+ * than raising — so a surface that translates from {@link code} alone is
66
+ * correct for a parameterless sentence and visibly wrong for a parameterised
67
+ * one. This is the field that makes the second case work; the LSP carrier has
68
+ * always moved the params, and no carrier below it did.
69
+ *
70
+ * Prefer {@link TransferDiagnostic.resolved} over reading this: it decides
71
+ * whether an identity is present at all, which a lone `params` cannot.
72
+ */
73
+ params?: MessageParams;
58
74
  }
59
75
  export declare namespace TransferDiagnostic {
60
76
  /** Path separator between AST nodes within an element location. */
@@ -65,6 +81,23 @@ export declare namespace TransferDiagnostic {
65
81
  const ELEMENT_PROPERTY_SEPARATOR = "^";
66
82
  function isError(diagnostic: TransferDiagnostic): boolean;
67
83
  function isParseError(diagnostic: TransferDiagnostic): boolean;
84
+ /**
85
+ * The diagnostic as a renderable message, for a surface that translates.
86
+ * `undefined` when it carries no framework identity — a syntactic error, an
87
+ * adopter's own check, a linker failure — which is the case a caller must
88
+ * distinguish rather than render.
89
+ *
90
+ * Hand the result to `renderFrameworkMessage` with whatever catalogue the
91
+ * host has loaded. The `text` is the server's English, so a code the
92
+ * catalogue does not carry still yields a complete sentence.
93
+ *
94
+ * `code` alone does not establish an identity: it also holds Langium's
95
+ * internal code and an adopter's own, and either would be looked up against a
96
+ * catalogue that cannot have it. Requiring `params` is what discriminates,
97
+ * and it is why a parameterless framework message still populates the field
98
+ * with an empty object rather than omitting it.
99
+ */
100
+ function resolved(diagnostic: TransferDiagnostic): ResolvedMessage | undefined;
68
101
  function getPath(diagnostic: TransferDiagnostic): string;
69
102
  function errors(diagnostics: TransferDiagnostic[]): TransferDiagnostic[];
70
103
  function hasErrors(diagnostics: TransferDiagnostic[]): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"transfer-diagnostic.d.ts","sourceRoot":"","sources":["../src/transfer-diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAChC;;;;;OAKG;IACH,IAAI,EAAE,cAAc,GAAG,eAAe,GAAG,kBAAkB,CAAC;IAC5D;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,EAAE,OAAO,GAAG,SA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AE,MAAM,GAAG,MAAM,CAAC;IACvB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,yBAAiB,kBAAkB,CAAC;IACjC,mEAAmE;IAC5D,MAAM,yBAAyB,MAAM,CAAC;IAC7C,wDAAwD;IACjD,MAAM,uBAAuB,MAAM,CAAC;IAC3C,sFAAsF;IAC/E,MAAM,0BAA0B,MAAM,CAAC;IAE9C,SAAgB,OAAO,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAE/D;IAED,SAAgB,YAAY,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAEpE;IAED;;;;;;;;;;;;;;;OAeG;IACH,SAAgB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,eAAe,GAAG,SAAS,CAKpF;IAED,SAAgB,OAAO,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAE9D;IAED,SAAgB,MAAM,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,EAAE,CAE9E;IAED,SAAgB,SAAS,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAEpE;IAED,SAAgB,cAAc,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAEzE;CACH"}
@@ -25,6 +25,29 @@ var TransferDiagnostic;
25
25
  return diagnostic.type === 'parsing-error';
26
26
  }
27
27
  TransferDiagnostic.isParseError = isParseError;
28
+ /**
29
+ * The diagnostic as a renderable message, for a surface that translates.
30
+ * `undefined` when it carries no framework identity — a syntactic error, an
31
+ * adopter's own check, a linker failure — which is the case a caller must
32
+ * distinguish rather than render.
33
+ *
34
+ * Hand the result to `renderFrameworkMessage` with whatever catalogue the
35
+ * host has loaded. The `text` is the server's English, so a code the
36
+ * catalogue does not carry still yields a complete sentence.
37
+ *
38
+ * `code` alone does not establish an identity: it also holds Langium's
39
+ * internal code and an adopter's own, and either would be looked up against a
40
+ * catalogue that cannot have it. Requiring `params` is what discriminates,
41
+ * and it is why a parameterless framework message still populates the field
42
+ * with an empty object rather than omitting it.
43
+ */
44
+ function resolved(diagnostic) {
45
+ if (typeof diagnostic.code !== 'string' || diagnostic.params === undefined) {
46
+ return undefined;
47
+ }
48
+ return { code: diagnostic.code, params: diagnostic.params, text: diagnostic.message };
49
+ }
50
+ TransferDiagnostic.resolved = resolved;
28
51
  function getPath(diagnostic) {
29
52
  return diagnostic.property ? `${diagnostic.element}${TransferDiagnostic.ELEMENT_PROPERTY_SEPARATOR}${diagnostic.property}` : diagnostic.element;
30
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transfer-diagnostic.js","sourceRoot":"","sources":["../src/transfer-diagnostic.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAqDlF,IAAiB,kBAAkB,CA+BlC;AA/BD,WAAiB,kBAAkB;IAChC,mEAAmE;IACtD,4CAAyB,GAAG,GAAG,CAAC;IAC7C,wDAAwD;IAC3C,0CAAuB,GAAG,GAAG,CAAC;IAC3C,sFAAsF;IACzE,6CAA0B,GAAG,GAAG,CAAC;IAE9C,SAAgB,OAAO,CAAC,UAA8B;QACnD,OAAO,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC;IAC1C,CAAC;IAFe,0BAAO,UAEtB,CAAA;IAED,SAAgB,YAAY,CAAC,UAA8B;QACxD,OAAO,UAAU,CAAC,IAAI,KAAK,eAAe,CAAC;IAC9C,CAAC;IAFe,+BAAY,eAE3B,CAAA;IAED,SAAgB,OAAO,CAAC,UAA8B;QACnD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,GAAG,mBAAA,0BAA0B,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;IAChI,CAAC;IAFe,0BAAO,UAEtB,CAAA;IAED,SAAgB,MAAM,CAAC,WAAiC;QACrD,OAAO,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;I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AAQ,WAKvB,CAAA;IAED,SAAgB,OAAO,CAAC,UAA8B;QACnD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,GAAG,mBAAA,0BAA0B,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;IAChI,CAAC;IAFe,0BAAO,UAEtB,CAAA;IAED,SAAgB,MAAM,CAAC,WAAiC;QACrD,OAAO,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAFe,yBAAM,SAErB,CAAA;IAED,SAAgB,SAAS,CAAC,WAAiC;QACxD,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAFe,4BAAS,YAExB,CAAA;IAED,SAAgB,cAAc,CAAC,WAAiC;QAC7D,OAAO,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAFe,iCAAc,iBAE7B,CAAA;AACJ,CAAC,EAtDgB,kBAAkB,kCAAlB,kBAAkB,QAsDlC"}
@@ -8,6 +8,7 @@
8
8
  ********************************************************************************/
9
9
  import type { TransferDiagnostic } from './transfer-diagnostic';
10
10
  import type { TransferElement } from './transfer-element';
11
+ import { type SnapshotVersion } from './model-service/based-on';
11
12
  /**
12
13
  * Wire envelope exchanged between the model-server's data-server head and
13
14
  * its clients. Carries a transfer-shaped root — never an AST root — plus
@@ -25,14 +26,13 @@ export interface TransferDocument<TTransfer extends TransferElement, TDiagnostic
25
26
  uri: string;
26
27
  /**
27
28
  * The document version this snapshot was taken at — sourced from the
28
- * server's text-document version counter. Callers that mutate the
29
- * document subsequently pass this value back as `TransferUpdateArgs.baseVersion`
30
- * (or `TransferSaveArgs.baseVersion`) so the server can detect stale-based
31
- * updates and reject them with `ConflictError`.
29
+ * server's text-document version counter. A caller that mutates the document
30
+ * subsequently sends this straight back as `TransferUpdateDocumentArgs.basedOn`, and
31
+ * the server rejects a stale-based update with `ConflictError`.
32
32
  *
33
33
  * See `@hydranium/protocol#errors` for the conflict-detection contract.
34
34
  */
35
- version: number;
35
+ version: SnapshotVersion;
36
36
  /**
37
37
  * Absent when the document does not exist — the server answers an unknown URI
38
38
  * with a shaped envelope rather than an error, so absence is an ordinary
@@ -41,6 +41,14 @@ export interface TransferDocument<TTransfer extends TransferElement, TDiagnostic
41
41
  */
42
42
  root?: TTransfer;
43
43
  diagnostics: TDiagnostic[];
44
+ /**
45
+ * Whether the server holds text for this document that its file does not,
46
+ * as the server last knew the file: set on every document a data server
47
+ * answers or sends that the server holds, and absent otherwise. A change
48
+ * after this snapshot arrives as `onDocumentDirtyChanged` to a client
49
+ * watching the document.
50
+ */
51
+ dirty?: boolean;
44
52
  }
45
53
  /**
46
54
  * A {@link TransferDocument} the server actually had, so `root` is present.
@@ -62,6 +70,15 @@ export declare namespace TransferDocument {
62
70
  * with it.
63
71
  */
64
72
  function assertLoaded<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(document: TransferDocument<TTransfer, TDiagnostic>): LoadedTransferDocument<TTransfer, TDiagnostic>;
73
+ /**
74
+ * The envelope for a document the server does not have — `root` absent, and
75
+ * the version a read of a URI the store never saw reports.
76
+ *
77
+ * Exists so the absent branch is built the same way the present one is: both
78
+ * doors mark the version as coming from a read, and neither asks a caller to
79
+ * do it.
80
+ */
81
+ function absent<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(uri: string, diagnostics?: TDiagnostic[]): TransferDocument<TTransfer, TDiagnostic>;
65
82
  /**
66
83
  * Construct a {@link TransferDocument} envelope. `diagnostics` defaults
67
84
  * to `[]` so test fixtures, fake protocol implementations, and the
@@ -1 +1 @@
1
- {"version":3,"file":"transfer-document.d.ts","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE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,GAAG,EAAE,MAAM,EACX,WAAW,GAAE,WAAW,EAAO,GAC/B,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAE1C;IAED;;;;;OAKG;IACH,SAAgB,MAAM,CAAC,SAAS,SAAS,eAAe,EAAE,WAAW,GAAG,kBAAkB,EACvF,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,EACf,WAAW,GAAE,WAAW,EAAO,GAC/B,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAE1C;CACH"}
@@ -9,6 +9,7 @@
9
9
  ********************************************************************************/
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.TransferDocument = void 0;
12
+ const based_on_1 = require("./model-service/based-on");
12
13
  var TransferDocument;
13
14
  (function (TransferDocument) {
14
15
  /**
@@ -32,6 +33,18 @@ var TransferDocument;
32
33
  return document;
33
34
  }
34
35
  TransferDocument.assertLoaded = assertLoaded;
36
+ /**
37
+ * The envelope for a document the server does not have — `root` absent, and
38
+ * the version a read of a URI the store never saw reports.
39
+ *
40
+ * Exists so the absent branch is built the same way the present one is: both
41
+ * doors mark the version as coming from a read, and neither asks a caller to
42
+ * do it.
43
+ */
44
+ function absent(uri, diagnostics = []) {
45
+ return { uri, version: (0, based_on_1.asSnapshotVersion)(0), root: undefined, diagnostics };
46
+ }
47
+ TransferDocument.absent = absent;
35
48
  /**
36
49
  * Construct a {@link TransferDocument} envelope. `diagnostics` defaults
37
50
  * to `[]` so test fixtures, fake protocol implementations, and the
@@ -39,7 +52,7 @@ var TransferDocument;
39
52
  * at every call site.
40
53
  */
41
54
  function create(uri, version, root, diagnostics = []) {
42
- return { uri, version, root, diagnostics };
55
+ return { uri, version: (0, based_on_1.asSnapshotVersion)(version), root, diagnostics };
43
56
  }
44
57
  TransferDocument.create = create;
45
58
  })(TransferDocument || (exports.TransferDocument = TransferDocument = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"transfer-document.js","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAmDlF,IAAiB,gBAAgB,CAwChC;AAxCD,WAAiB,gBAAgB;IAC9B;;;OAGG;IACH,SAAgB,QAAQ,CACrB,QAAkD;QAElD,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC;IACtC,CAAC;IAJe,yBAAQ,WAIvB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,YAAY,CACzB,QAAkD;QAElD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,QAAQ,CAAC;IACnB,CAAC;IAPe,6BAAY,eAO3B,CAAA;IAED;;;;;OAKG;IACH,SAAgB,MAAM,CACnB,GAAW,EACX,OAAe,EACf,IAAe,EACf,cAA6B,EAAE;QAE/B,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC9C,CAAC;IAPe,uBAAM,SAOrB,CAAA;AACJ,CAAC,EAxCgB,gBAAgB,gCAAhB,gBAAgB,QAwChC"}
1
+ {"version":3,"file":"transfer-document.js","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAIlF,uDAAmF;AAuDnF,IAAiB,gBAAgB,CAuDhC;AAvDD,WAAiB,gBAAgB;IAC9B;;;OAGG;IACH,SAAgB,QAAQ,CACrB,QAAkD;QAElD,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC;IACtC,CAAC;IAJe,yBAAQ,WAIvB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,YAAY,CACzB,QAAkD;QAElD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,QAAQ,CAAC;IACnB,CAAC;IAPe,6BAAY,eAO3B,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,MAAM,CACnB,GAAW,EACX,cAA6B,EAAE;QAE/B,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAA,4BAAiB,EAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;IAC/E,CAAC;IALe,uBAAM,SAKrB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,MAAM,CACnB,GAAW,EACX,OAAe,EACf,IAAe,EACf,cAA6B,EAAE;QAE/B,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAA,4BAAiB,EAAC,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC1E,CAAC;IAPe,uBAAM,SAOrB,CAAA;AACJ,CAAC,EAvDgB,gBAAgB,gCAAhB,gBAAgB,QAuDhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydranium/protocol",
3
- "version": "1.0.0-next.14",
3
+ "version": "1.0.0-next.140",
4
4
  "description": "Generic, language-agnostic types, constants, and pure utilities for the hydranium framework.",
5
5
  "keywords": [
6
6
  "hydranium",
@@ -41,6 +41,14 @@
41
41
  "types": "./lib/data/index.d.ts",
42
42
  "default": "./lib/data/index.js"
43
43
  },
44
+ "./messages": {
45
+ "types": "./lib/messages/index.d.ts",
46
+ "default": "./lib/messages/index.js"
47
+ },
48
+ "./lib/messages": {
49
+ "types": "./lib/messages/index.d.ts",
50
+ "default": "./lib/messages/index.js"
51
+ },
44
52
  "./testing": {
45
53
  "types": "./lib/testing/index.d.ts",
46
54
  "default": "./lib/testing/index.js"
@@ -88,7 +96,7 @@
88
96
  "vscode-jsonrpc": "9.0.1"
89
97
  },
90
98
  "peerDependencies": {
91
- "vscode-jsonrpc": "^8.0.0 || ^9.0.0"
99
+ "vscode-jsonrpc": "9.0.1"
92
100
  },
93
101
  "engines": {
94
102
  "node": ">=22.13"
@@ -96,5 +104,6 @@
96
104
  "publishConfig": {
97
105
  "access": "public"
98
106
  },
107
+ "//peerDependencies": "`vscode-jsonrpc` is EXACT rather than a range, because it is one link of an atomic chain with no independently movable link: `vscode-languageserver-protocol` depends on it at exactly 9.0.1, so any other value an adopter supplies is a SECOND physical copy rather than an upgrade. This wire stack breaks on copy identity rather than on structure — `ParameterStructures.auto` is a singleton compared by `===` in connection.js, so a request type built by one copy and sent over a connection owned by the other throws `Unknown parameter structure auto`. A caret or union range was rejected because npm then resolves a `vscode-jsonrpc@8.2.0` tree SILENTLY, with no diagnostic at all, and the failure surfaces only later at server init. Exact does not fail the install either — npm downgrades an unsatisfiable peer to a warning — but it is a NAMED ERESOLVE warning printing the required version beside the found one, and a hard error for anyone installing with `--strict-peer-deps`. It does NOT prevent a NESTED copy — `@eclipse-glsp/*` carries its own exact `vscode-jsonrpc@8.2.0` dependency and root `overrides` do not ship — so a consumer of the GLSP head must pin the chain in its own manifest, and docs/adopting/requirements.md carries the block to paste.",
99
108
  "//prepack": "The publish guard, and it deliberately is NOT a `prepare`: npm runs a workspace `prepare` BEFORE the root `postinstall` that applies patches/vscode-jsonrpc+9.0.1.patch, so building there fails on a cold clone and npm rolls the entire install back. `prepack` runs only when a tarball is made (`npm pack`, `npm publish`) and never on install, so it cannot break the install it has no business touching. It FAILS rather than rebuilds, because the rebuild is exactly the part that ordering defeats. What it defends against: `files` lists `lib`, `lib` is gitignored, and a `files` entry matching nothing is skipped SILENTLY — so `npm publish` from an unbuilt tree emits a tarball of `src` and nothing else, with no error."
100
109
  }