@hydranium/protocol 1.0.0-next.33 → 1.0.0-next.330

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 (285) hide show
  1. package/README.md +44 -83
  2. package/lib/abstract-logger.d.ts +5 -0
  3. package/lib/abstract-logger.d.ts.map +1 -1
  4. package/lib/abstract-logger.js +7 -0
  5. package/lib/abstract-logger.js.map +1 -1
  6. package/lib/client/data-connection.d.ts +302 -0
  7. package/lib/client/data-connection.d.ts.map +1 -0
  8. package/lib/client/data-connection.js +533 -0
  9. package/lib/client/data-connection.js.map +1 -0
  10. package/lib/client/data-events.d.ts +17 -1
  11. package/lib/client/data-events.d.ts.map +1 -1
  12. package/lib/client/data-events.js +25 -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 +684 -89
  17. package/lib/client/data-session.d.ts.map +1 -1
  18. package/lib/client/data-session.js +1148 -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 +4 -4
  25. package/lib/client/message-relay.js +4 -4
  26. package/lib/client/message-relay.js.map +1 -1
  27. package/lib/client/post-message-transport.d.ts +64 -3
  28. package/lib/client/post-message-transport.d.ts.map +1 -1
  29. package/lib/client/post-message-transport.js +175 -1
  30. package/lib/client/post-message-transport.js.map +1 -1
  31. package/lib/client/rpc-connection.d.ts +157 -0
  32. package/lib/client/rpc-connection.d.ts.map +1 -0
  33. package/lib/client/rpc-connection.js +214 -0
  34. package/lib/client/rpc-connection.js.map +1 -0
  35. package/lib/client/worker-handshake.d.ts +86 -0
  36. package/lib/client/worker-handshake.d.ts.map +1 -0
  37. package/lib/client/worker-handshake.js +51 -0
  38. package/lib/client/worker-handshake.js.map +1 -0
  39. package/lib/client-ids.d.ts +45 -0
  40. package/lib/client-ids.d.ts.map +1 -0
  41. package/lib/client-ids.js +48 -0
  42. package/lib/client-ids.js.map +1 -0
  43. package/lib/clock.d.ts +50 -10
  44. package/lib/clock.d.ts.map +1 -1
  45. package/lib/clock.js +36 -1
  46. package/lib/clock.js.map +1 -1
  47. package/lib/console-logger.d.ts +23 -0
  48. package/lib/console-logger.d.ts.map +1 -0
  49. package/lib/console-logger.js +39 -0
  50. package/lib/console-logger.js.map +1 -0
  51. package/lib/data/data-protocol-methods.d.ts +4 -4
  52. package/lib/data/data-protocol-methods.d.ts.map +1 -1
  53. package/lib/data/data-protocol-methods.js +13 -1
  54. package/lib/data/data-protocol-methods.js.map +1 -1
  55. package/lib/data/data-server-protocol.d.ts +170 -48
  56. package/lib/data/data-server-protocol.d.ts.map +1 -1
  57. package/lib/data/events.d.ts +137 -21
  58. package/lib/data/events.d.ts.map +1 -1
  59. package/lib/data/requests.d.ts +71 -11
  60. package/lib/data/requests.d.ts.map +1 -1
  61. package/lib/debouncer.d.ts +3 -3
  62. package/lib/debouncer.d.ts.map +1 -1
  63. package/lib/debouncer.js +6 -9
  64. package/lib/debouncer.js.map +1 -1
  65. package/lib/errors.d.ts +183 -30
  66. package/lib/errors.d.ts.map +1 -1
  67. package/lib/errors.js +268 -32
  68. package/lib/errors.js.map +1 -1
  69. package/lib/glsp-edits-settled-actions.d.ts +52 -0
  70. package/lib/glsp-edits-settled-actions.d.ts.map +1 -0
  71. package/lib/glsp-edits-settled-actions.js +28 -0
  72. package/lib/glsp-edits-settled-actions.js.map +1 -0
  73. package/lib/glsp-request-model-args.d.ts +16 -0
  74. package/lib/glsp-request-model-args.d.ts.map +1 -0
  75. package/lib/glsp-request-model-args.js +19 -0
  76. package/lib/glsp-request-model-args.js.map +1 -0
  77. package/lib/glsp-save-model-actions.d.ts +50 -0
  78. package/lib/glsp-save-model-actions.d.ts.map +1 -0
  79. package/lib/glsp-save-model-actions.js +28 -0
  80. package/lib/glsp-save-model-actions.js.map +1 -0
  81. package/lib/index.d.ts +10 -0
  82. package/lib/index.d.ts.map +1 -1
  83. package/lib/index.js +10 -0
  84. package/lib/index.js.map +1 -1
  85. package/lib/latency-collector.d.ts +8 -4
  86. package/lib/latency-collector.d.ts.map +1 -1
  87. package/lib/latency-collector.js.map +1 -1
  88. package/lib/logger.d.ts +38 -7
  89. package/lib/logger.d.ts.map +1 -1
  90. package/lib/logger.js +42 -4
  91. package/lib/logger.js.map +1 -1
  92. package/lib/messages/index.d.ts +4 -2
  93. package/lib/messages/index.d.ts.map +1 -1
  94. package/lib/messages/index.js +15 -4
  95. package/lib/messages/index.js.map +1 -1
  96. package/lib/messages/primitives.d.ts +59 -4
  97. package/lib/messages/primitives.d.ts.map +1 -1
  98. package/lib/messages/primitives.js +97 -4
  99. package/lib/messages/primitives.js.map +1 -1
  100. package/lib/model-server.d.ts +60 -13
  101. package/lib/model-server.d.ts.map +1 -1
  102. package/lib/model-server.js +4 -2
  103. package/lib/model-server.js.map +1 -1
  104. package/lib/model-service/base-version.d.ts +67 -0
  105. package/lib/model-service/base-version.d.ts.map +1 -0
  106. package/lib/model-service/base-version.js +44 -0
  107. package/lib/model-service/base-version.js.map +1 -0
  108. package/lib/model-service/index.d.ts +1 -1
  109. package/lib/model-service/index.d.ts.map +1 -1
  110. package/lib/model-service/index.js +4 -5
  111. package/lib/model-service/index.js.map +1 -1
  112. package/lib/model-service/reference-candidate.d.ts +5 -3
  113. package/lib/model-service/reference-candidate.d.ts.map +1 -1
  114. package/lib/node/index.d.ts +10 -0
  115. package/lib/node/index.d.ts.map +1 -0
  116. package/lib/node/index.js +29 -0
  117. package/lib/node/index.js.map +1 -0
  118. package/lib/node/process-memory.d.ts +66 -0
  119. package/lib/node/process-memory.d.ts.map +1 -0
  120. package/lib/node/process-memory.js +291 -0
  121. package/lib/node/process-memory.js.map +1 -0
  122. package/lib/noop-logger.d.ts.map +1 -1
  123. package/lib/noop-logger.js.map +1 -1
  124. package/lib/observable-value.js.map +1 -1
  125. package/lib/patch-merge.d.ts +63 -35
  126. package/lib/patch-merge.d.ts.map +1 -1
  127. package/lib/patch-merge.js +171 -25
  128. package/lib/patch-merge.js.map +1 -1
  129. package/lib/pending-work-tracker.d.ts +29 -0
  130. package/lib/pending-work-tracker.d.ts.map +1 -0
  131. package/lib/pending-work-tracker.js +46 -0
  132. package/lib/pending-work-tracker.js.map +1 -0
  133. package/lib/profile-session.d.ts +8 -4
  134. package/lib/profile-session.d.ts.map +1 -1
  135. package/lib/profile-session.js.map +1 -1
  136. package/lib/project.d.ts +4 -1
  137. package/lib/project.d.ts.map +1 -1
  138. package/lib/project.js.map +1 -1
  139. package/lib/random-uuid.d.ts +14 -0
  140. package/lib/random-uuid.d.ts.map +1 -0
  141. package/lib/random-uuid.js +24 -0
  142. package/lib/random-uuid.js.map +1 -0
  143. package/lib/reconcile-write.d.ts +67 -0
  144. package/lib/reconcile-write.d.ts.map +1 -0
  145. package/lib/reconcile-write.js +69 -0
  146. package/lib/reconcile-write.js.map +1 -0
  147. package/lib/rpc/bind-rpc-methods.d.ts +6 -2
  148. package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
  149. package/lib/rpc/bind-rpc-methods.js +17 -7
  150. package/lib/rpc/bind-rpc-methods.js.map +1 -1
  151. package/lib/rpc/create-rpc-proxy.d.ts +3 -0
  152. package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
  153. package/lib/rpc/create-rpc-proxy.js +6 -1
  154. package/lib/rpc/create-rpc-proxy.js.map +1 -1
  155. package/lib/rpc/index.d.ts +1 -0
  156. package/lib/rpc/index.d.ts.map +1 -1
  157. package/lib/rpc/index.js +1 -0
  158. package/lib/rpc/index.js.map +1 -1
  159. package/lib/rpc/send-by-method-name.d.ts +76 -0
  160. package/lib/rpc/send-by-method-name.d.ts.map +1 -0
  161. package/lib/rpc/send-by-method-name.js +120 -0
  162. package/lib/rpc/send-by-method-name.js.map +1 -0
  163. package/lib/rpc/wire-prefix.js.map +1 -1
  164. package/lib/save-text-document.d.ts +40 -0
  165. package/lib/save-text-document.d.ts.map +1 -0
  166. package/lib/save-text-document.js +34 -0
  167. package/lib/save-text-document.js.map +1 -0
  168. package/lib/testing/catalogue-audit.d.ts +1 -1
  169. package/lib/testing/catalogue-audit.js +1 -1
  170. package/lib/testing/catalogue-audit.js.map +1 -1
  171. package/lib/testing/data-doubles.d.ts +41 -12
  172. package/lib/testing/data-doubles.d.ts.map +1 -1
  173. package/lib/testing/data-doubles.js +56 -8
  174. package/lib/testing/data-doubles.js.map +1 -1
  175. package/lib/testing/fake-clock.d.ts +17 -2
  176. package/lib/testing/fake-clock.d.ts.map +1 -1
  177. package/lib/testing/fake-clock.js +61 -46
  178. package/lib/testing/fake-clock.js.map +1 -1
  179. package/lib/testing/index.d.ts +1 -0
  180. package/lib/testing/index.d.ts.map +1 -1
  181. package/lib/testing/index.js +4 -3
  182. package/lib/testing/index.js.map +1 -1
  183. package/lib/testing/node/duplex-connection.d.ts.map +1 -1
  184. package/lib/testing/node/duplex-connection.js +3 -2
  185. package/lib/testing/node/duplex-connection.js.map +1 -1
  186. package/lib/testing/node/duplex-stream.js.map +1 -1
  187. package/lib/testing/node/index.d.ts +1 -0
  188. package/lib/testing/node/index.d.ts.map +1 -1
  189. package/lib/testing/node/index.js +2 -2
  190. package/lib/testing/node/index.js.map +1 -1
  191. package/lib/testing/node/message-port-pair.d.ts +25 -0
  192. package/lib/testing/node/message-port-pair.d.ts.map +1 -0
  193. package/lib/testing/node/message-port-pair.js +26 -0
  194. package/lib/testing/node/message-port-pair.js.map +1 -0
  195. package/lib/testing/transfer-node-builder.d.ts +81 -0
  196. package/lib/testing/transfer-node-builder.d.ts.map +1 -0
  197. package/lib/testing/transfer-node-builder.js +47 -0
  198. package/lib/testing/transfer-node-builder.js.map +1 -0
  199. package/lib/testing/wait-for.d.ts +9 -3
  200. package/lib/testing/wait-for.d.ts.map +1 -1
  201. package/lib/testing/wait-for.js +57 -11
  202. package/lib/testing/wait-for.js.map +1 -1
  203. package/lib/tracer.d.ts.map +1 -1
  204. package/lib/tracer.js +5 -9
  205. package/lib/tracer.js.map +1 -1
  206. package/lib/transfer-diagnostic.js.map +1 -1
  207. package/lib/transfer-document.d.ts +95 -32
  208. package/lib/transfer-document.d.ts.map +1 -1
  209. package/lib/transfer-document.js +17 -9
  210. package/lib/transfer-document.js.map +1 -1
  211. package/lib/transfer-element.d.ts +4 -4
  212. package/lib/types.d.ts +32 -0
  213. package/lib/types.d.ts.map +1 -0
  214. package/lib/{model-service/args.js → types.js} +2 -2
  215. package/lib/types.js.map +1 -0
  216. package/lib/uri.d.ts.map +1 -1
  217. package/lib/uri.js.map +1 -1
  218. package/lib/util.d.ts +8 -2
  219. package/lib/util.d.ts.map +1 -1
  220. package/lib/util.js +32 -4
  221. package/lib/util.js.map +1 -1
  222. package/package.json +24 -40
  223. package/src/abstract-logger.ts +8 -0
  224. package/src/client/data-connection.ts +653 -0
  225. package/src/client/data-events.ts +37 -1
  226. package/src/client/data-port.ts +36 -25
  227. package/src/client/data-session.ts +1469 -137
  228. package/src/client/index.ts +15 -9
  229. package/src/client/message-relay.ts +4 -4
  230. package/src/client/post-message-transport.ts +219 -4
  231. package/src/client/rpc-connection.ts +281 -0
  232. package/src/client/worker-handshake.ts +113 -0
  233. package/src/client-ids.ts +49 -0
  234. package/src/clock.ts +68 -10
  235. package/src/console-logger.ts +39 -0
  236. package/src/data/data-protocol-methods.ts +14 -4
  237. package/src/data/data-server-protocol.ts +197 -48
  238. package/src/data/events.ts +143 -21
  239. package/src/data/requests.ts +77 -11
  240. package/src/debouncer.ts +7 -10
  241. package/src/errors.ts +326 -40
  242. package/src/glsp-edits-settled-actions.ts +60 -0
  243. package/src/glsp-request-model-args.ts +16 -0
  244. package/src/glsp-save-model-actions.ts +59 -0
  245. package/src/index.ts +10 -0
  246. package/src/latency-collector.ts +8 -3
  247. package/src/logger.ts +44 -8
  248. package/src/messages/index.ts +4 -2
  249. package/src/messages/primitives.ts +129 -5
  250. package/src/model-server.ts +64 -19
  251. package/src/model-service/base-version.ts +75 -0
  252. package/src/model-service/index.ts +4 -5
  253. package/src/model-service/reference-candidate.ts +5 -3
  254. package/src/node/index.ts +14 -0
  255. package/src/node/process-memory.ts +299 -0
  256. package/src/patch-merge.ts +230 -45
  257. package/src/pending-work-tracker.ts +46 -0
  258. package/src/profile-session.ts +9 -4
  259. package/src/project.ts +4 -1
  260. package/src/random-uuid.ts +21 -0
  261. package/src/reconcile-write.ts +128 -0
  262. package/src/rpc/README.md +6 -6
  263. package/src/rpc/bind-rpc-methods.ts +18 -8
  264. package/src/rpc/create-rpc-proxy.ts +6 -1
  265. package/src/rpc/index.ts +1 -0
  266. package/src/rpc/send-by-method-name.ts +140 -0
  267. package/src/save-text-document.ts +39 -0
  268. package/src/testing/catalogue-audit.ts +1 -1
  269. package/src/testing/data-doubles.ts +141 -19
  270. package/src/testing/fake-clock.ts +76 -48
  271. package/src/testing/index.ts +4 -3
  272. package/src/testing/node/duplex-connection.ts +3 -2
  273. package/src/testing/node/index.ts +2 -2
  274. package/src/testing/node/message-port-pair.ts +40 -0
  275. package/src/testing/transfer-node-builder.ts +107 -0
  276. package/src/testing/wait-for.ts +61 -13
  277. package/src/tracer.ts +5 -9
  278. package/src/transfer-document.ts +115 -34
  279. package/src/transfer-element.ts +4 -4
  280. package/src/types.ts +30 -0
  281. package/src/util.ts +33 -6
  282. package/lib/model-service/args.d.ts +0 -64
  283. package/lib/model-service/args.d.ts.map +0 -1
  284. package/lib/model-service/args.js.map +0 -1
  285. package/src/model-service/args.ts +0 -67
package/lib/clock.d.ts CHANGED
@@ -12,9 +12,11 @@ import { Disposable } from './util';
12
12
  * there is no `start` — you create it at the moment timing begins.
13
13
  *
14
14
  * Backed by a monotonic source (`performance.now`), so it is sub-millisecond
15
- * precise and immune to wall-clock jumps (NTP/DST adjustments can make a
16
- * `Date.now` delta go backwards; a stopwatch cannot). Use this for durations
17
- * and {@link Clock.now} for "what time is it" (timestamps, TTLs).
15
+ * precise and immune to wall-clock steps (a time sync or a manual change can
16
+ * make a `Date.now` delta go backwards; a stopwatch cannot). In Node on Linux
17
+ * it also leaves out time the system spends suspended, so a duration spanning
18
+ * a suspend reads as the awake time only. Use this for every duration, a TTL
19
+ * included, and {@link Clock.now} for "what time is it".
18
20
  *
19
21
  * It holds no scheduled resource and is therefore NOT a {@link Disposable} —
20
22
  * the disposable thing is a {@link Clock.setTimer}. Reads are lazy, so a fake
@@ -42,16 +44,16 @@ export interface Stopwatch {
42
44
  * testable instead of waiting on real wall-clock. The {@link SystemClock}
43
45
  * default delegates to the platform; tests bind `makeFakeClock`.
44
46
  *
45
- * Two distinct readings on purpose: {@link now} is wall-clock (for timestamps
46
- * and TTLs that compare against a file's mtime), while {@link stopwatch}
47
- * measures durations off a monotonic source. They are different clocks; do not
48
- * subtract two {@link now} readings to measure a duration.
47
+ * Two distinct readings on purpose: {@link now} is wall-clock, for a
48
+ * timestamp, while {@link stopwatch} measures durations off a monotonic
49
+ * source. They are different clocks; do not subtract two {@link now} readings
50
+ * to measure a duration. Framework code reads time only through a `Clock`, so
51
+ * a platform workaround lives in one place.
49
52
  *
50
53
  * A cross-head contract, so it carries no platform or DI-framework coupling.
51
54
  *
52
- * Note: the runtime health monitors (event-loop, memory) intentionally keep
53
- * the real wall-clock rather than taking a `Clock` — faking the time they
54
- * measure would invert their meaning.
55
+ * Note: code that measures real CPU, heap or event-loop time never takes the
56
+ * bound `Clock`: faking the time it measures would invert its meaning.
55
57
  */
56
58
  export interface Clock {
57
59
  /** Current wall-clock time in milliseconds (the `Date.now` reading). */
@@ -73,7 +75,28 @@ export interface Clock {
73
75
  */
74
76
  measure<T>(callback: () => Promise<T>): Promise<Timed<T>>;
75
77
  measure<T>(callback: () => T): Timed<T>;
78
+ /**
79
+ * Settle with `promise`, or with {@link TIMED_OUT} once `ms` have elapsed
80
+ * first. A promise that rejects first rejects this one; one that rejects
81
+ * after the timer is ignored. The timer is disposed the moment `promise`
82
+ * settles, so a won race leaves nothing scheduled, but `promise` itself
83
+ * runs on: nothing here can cancel it.
84
+ *
85
+ * Unlike VS Code's `raceTimeout`, this settles with a sentinel rather than
86
+ * `undefined`, so a promise resolving to `undefined` is not taken for a
87
+ * timeout; the caller branches on the result instead of passing an
88
+ * `onTimeout`.
89
+ *
90
+ * A custom implementation extends {@link SystemClock}, whose race runs over
91
+ * the subclass's {@link setTimer}.
92
+ */
93
+ raceTimer<T>(promise: Promise<T>, ms: number): Promise<T | typeof TIMED_OUT>;
76
94
  }
95
+ /**
96
+ * What {@link Clock.raceTimer} settles with when its timer fires first.
97
+ * Registered under a global key, so two copies of this package agree on it.
98
+ */
99
+ export declare const TIMED_OUT: unique symbol;
77
100
  /**
78
101
  * The result of {@link Clock.measure}: a callback's return value paired with
79
102
  * its elapsed wall-time in milliseconds. A plain value object — no methods, no
@@ -100,6 +123,10 @@ export interface Timed<T> {
100
123
  * Default {@link Clock}: delegates to the platform's `Date.now`,
101
124
  * `performance.now`, and `setTimeout`/`clearTimeout`. Bound everywhere in
102
125
  * production; swapped for `makeFakeClock` in tests.
126
+ *
127
+ * {@link measure} and {@link raceTimer} run over {@link stopwatch} and
128
+ * {@link setTimer}, so a clock that extends this one and replaces those
129
+ * measures and races on its own time, as the test clock does.
103
130
  */
104
131
  export declare class SystemClock implements Clock {
105
132
  now(): number;
@@ -107,5 +134,18 @@ export declare class SystemClock implements Clock {
107
134
  stopwatch(): Stopwatch;
108
135
  measure<T>(callback: () => Promise<T>): Promise<Timed<T>>;
109
136
  measure<T>(callback: () => T): Timed<T>;
137
+ /**
138
+ * The timer settles the race one microtask after it fires. A real timer
139
+ * runs only once pending resolutions are delivered, while a fake one fires
140
+ * inside its `advance`, so settling at once would let a promise already
141
+ * resolved when `advance` runs lose to a timer it beats in production. The
142
+ * deferral covers only that promise: one that settles through further
143
+ * chained reactions, such as a `.then` chain, an async function or
144
+ * `Promise.allSettled`, can still lose to an `advance` in the same turn,
145
+ * while it wins on the platform's timer. The handlers go on `promise`
146
+ * before {@link setTimer} runs, so a `setTimer` that throws still leaves
147
+ * `promise` observed.
148
+ */
149
+ raceTimer<T>(promise: Promise<T>, ms: number): Promise<T | typeof TIMED_OUT>;
110
150
  }
111
151
  //# sourceMappingURL=clock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,SAAS;IACvB,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,GAAG,IAAI,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,IAAI,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,KAAK;IACnB,wEAAwE;IACxE,GAAG,IAAI,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC;IACvD,yDAAyD;IACzD,SAAS,IAAI,SAAS,CAAC;IACvB;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC;IACrB;;;;;OAKG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;CACpB;AAyCD;;;;GAIG;AACH,qBAAa,WAAY,YAAW,KAAK;IACtC,GAAG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AAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,SAAS,CAAC,CAAC;CAC/E;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,eAA6C,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC;IACrB;;;;;OAKG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;CACpB;AAyCD;;;;;;;;GAQG;AACH,qBAAa,WAAY,YAAW,KAAK;IACtC,GAAG,IAAI,MAAM,CAEZ;IAED,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAIrD;IAED,SAAS,IAAI,SAAS,CAErB;IAED,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAUxC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,SAAS,CAAC,CAgB3E;CACH"}
package/lib/clock.js CHANGED
@@ -8,8 +8,13 @@
8
8
  * SPDX-License-Identifier: MIT
9
9
  ********************************************************************************/
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.SystemClock = void 0;
11
+ exports.SystemClock = exports.TIMED_OUT = void 0;
12
12
  const util_1 = require("./util");
13
+ /**
14
+ * What {@link Clock.raceTimer} settles with when its timer fires first.
15
+ * Registered under a global key, so two copies of this package agree on it.
16
+ */
17
+ exports.TIMED_OUT = Symbol.for('hydranium/protocol/timed-out');
13
18
  class SystemStopwatch {
14
19
  start = performance.now();
15
20
  lastLap = this.start;
@@ -48,6 +53,10 @@ function unrefTimer(handle) {
48
53
  * Default {@link Clock}: delegates to the platform's `Date.now`,
49
54
  * `performance.now`, and `setTimeout`/`clearTimeout`. Bound everywhere in
50
55
  * production; swapped for `makeFakeClock` in tests.
56
+ *
57
+ * {@link measure} and {@link raceTimer} run over {@link stopwatch} and
58
+ * {@link setTimer}, so a clock that extends this one and replaces those
59
+ * measures and races on its own time, as the test clock does.
51
60
  */
52
61
  class SystemClock {
53
62
  now() {
@@ -69,6 +78,32 @@ class SystemClock {
69
78
  }
70
79
  return { result: result, elapsedMs: stopwatch.elapsedMs };
71
80
  }
81
+ /**
82
+ * The timer settles the race one microtask after it fires. A real timer
83
+ * runs only once pending resolutions are delivered, while a fake one fires
84
+ * inside its `advance`, so settling at once would let a promise already
85
+ * resolved when `advance` runs lose to a timer it beats in production. The
86
+ * deferral covers only that promise: one that settles through further
87
+ * chained reactions, such as a `.then` chain, an async function or
88
+ * `Promise.allSettled`, can still lose to an `advance` in the same turn,
89
+ * while it wins on the platform's timer. The handlers go on `promise`
90
+ * before {@link setTimer} runs, so a `setTimer` that throws still leaves
91
+ * `promise` observed.
92
+ */
93
+ raceTimer(promise, ms) {
94
+ return new Promise((resolve, reject) => {
95
+ // eslint-disable-next-line prefer-const -- with a `const`, a `setTimer` that throws leaves it uninitialised, and the handlers' later read of it is an unhandled ReferenceError
96
+ let timer;
97
+ promise.then(value => {
98
+ timer?.dispose();
99
+ resolve(value);
100
+ }, (err) => {
101
+ timer?.dispose();
102
+ reject(err);
103
+ });
104
+ timer = this.setTimer(() => void Promise.resolve().then(() => resolve(exports.TIMED_OUT)), ms);
105
+ });
106
+ }
72
107
  }
73
108
  exports.SystemClock = SystemClock;
74
109
  //# sourceMappingURL=clock.js.map
package/lib/clock.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"clock.js","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":";AAAA;;;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KAAK,CAAC,EAAE;gBACL,KAAK,EAAE,OAAO,EAAE,CAAC;gBACjB,OAAO,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,EACD,CAAC,GAAY,EAAE,EAAE;gBACd,KAAK,EAAE,OAAO,EAAE,CAAC;gBACjB,MAAM,CAAC,GAAG,CAAC,CAAC;YACf,CAAC,CACH,CAAC;YACF,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,QAAA,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1F,CAAC,CAAC,CAAC;IACN,CAAC;CACH"}
@@ -0,0 +1,23 @@
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 { AbstractLogger } from './abstract-logger';
10
+ import { type LogLevel, type Logger } from './logger';
11
+ /**
12
+ * {@link Logger} that writes each line to `console`, at the method matching its
13
+ * level: the framework's `[Label - time] [component]` prefix and the message,
14
+ * then any trailing arguments as they are, so a browser console can expand
15
+ * them. For a browser page, webview or extension host, which has no other sink
16
+ * to hand. On Node, `info` and `debug` reach stdout, so a process whose stdout
17
+ * carries a protocol stream must not use it.
18
+ */
19
+ export declare class ConsoleLogger extends AbstractLogger implements Logger {
20
+ protected emit(level: LogLevel, label: string, message: string, args: readonly unknown[]): void;
21
+ protected derive(component: string): this;
22
+ }
23
+ //# sourceMappingURL=console-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-logger.d.ts","sourceRoot":"","sources":["../src/console-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAWtD;;;;;;;GAOG;AACH,qBAAa,aAAc,SAAQ,cAAe,YAAW,MAAM;IAChE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAE9F;IAED,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGxC;CACH"}
@@ -0,0 +1,39 @@
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.ConsoleLogger = void 0;
12
+ const abstract_logger_1 = require("./abstract-logger");
13
+ /** `console.trace` prints a stack with every line, so `trace` goes out at `debug`. */
14
+ const CONSOLE_METHODS = {
15
+ error: 'error',
16
+ warn: 'warn',
17
+ info: 'info',
18
+ debug: 'debug',
19
+ trace: 'debug'
20
+ };
21
+ /**
22
+ * {@link Logger} that writes each line to `console`, at the method matching its
23
+ * level: the framework's `[Label - time] [component]` prefix and the message,
24
+ * then any trailing arguments as they are, so a browser console can expand
25
+ * them. For a browser page, webview or extension host, which has no other sink
26
+ * to hand. On Node, `info` and `debug` reach stdout, so a process whose stdout
27
+ * carries a protocol stream must not use it.
28
+ */
29
+ class ConsoleLogger extends abstract_logger_1.AbstractLogger {
30
+ emit(level, label, message, args) {
31
+ console[CONSOLE_METHODS[level]](`${this.formatLinePrefix(label)} ${message}`, ...args);
32
+ }
33
+ derive(component) {
34
+ const Subclass = this.constructor;
35
+ return new Subclass(component);
36
+ }
37
+ }
38
+ exports.ConsoleLogger = ConsoleLogger;
39
+ //# sourceMappingURL=console-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-logger.js","sourceRoot":"","sources":["../src/console-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,uDAAmD;AAGnD,sFAAsF;AACtF,MAAM,eAAe,GAA0D;IAC5E,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,mBAA2B,SAAQ,gCAAc;IACpC,IAAI,CAAC,KAAe,EAAE,KAAa,EAAE,OAAe,EAAE,IAAwB;QACrF,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1F,CAAC;IAES,MAAM,CAAC,SAAiB;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAA+C,CAAC;QACtE,OAAO,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;CACH"}
@@ -7,7 +7,7 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  /** Request-method names on {@link DocumentServerProtocol}. */
10
- export declare const DOCUMENT_SERVER_PROTOCOL_METHODS: readonly ["openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady"];
10
+ export declare const DOCUMENT_SERVER_PROTOCOL_METHODS: readonly ["createSession", "closeSession", "createModelDocument", "updateModelDocuments", "openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "persistModelDocument", "deleteModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady"];
11
11
  /** Request-method names on {@link ProjectServerProtocol}. */
12
12
  export declare const PROJECT_SERVER_PROTOCOL_METHODS: readonly ["getProjects", "getProjectForUri"];
13
13
  /**
@@ -16,7 +16,7 @@ export declare const PROJECT_SERVER_PROTOCOL_METHODS: readonly ["getProjects", "
16
16
  * constraint makes the array typed against the interface — stale names (typos,
17
17
  * renamed methods) fail to typecheck.
18
18
  */
19
- export declare const DATA_SERVER_PROTOCOL_METHODS: readonly ["openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady", "getProjects", "getProjectForUri"];
19
+ export declare const DATA_SERVER_PROTOCOL_METHODS: readonly ["createSession", "closeSession", "createModelDocument", "updateModelDocuments", "openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "persistModelDocument", "deleteModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady", "getProjects", "getProjectForUri"];
20
20
  /**
21
21
  * Request-method names on {@link ReferenceServerProtocol}. NOT part of
22
22
  * {@link DATA_SERVER_PROTOCOL_METHODS} — adopters that compose the reference
@@ -25,7 +25,7 @@ export declare const DATA_SERVER_PROTOCOL_METHODS: readonly ["openModelDocument"
25
25
  */
26
26
  export declare const REFERENCE_SERVER_PROTOCOL_METHODS: readonly ["findReferenceCandidates", "resolveReference", "findNextName"];
27
27
  /** Notification-method names on {@link DocumentClientProtocol}. */
28
- export declare const DOCUMENT_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved"];
28
+ export declare const DOCUMENT_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved", "onDocumentDirtyChanged", "onDocumentDeleted", "onDocumentsBuilt"];
29
29
  /** Notification-method names on {@link ProjectClientProtocol}. */
30
30
  export declare const PROJECT_CLIENT_PROTOCOL_METHODS: readonly ["onProjectsChanged"];
31
31
  /**
@@ -35,5 +35,5 @@ export declare const PROJECT_CLIENT_PROTOCOL_METHODS: readonly ["onProjectsChang
35
35
  * data head's connection routes `<methodNamespace>onDocumentUpdated` etc. to
36
36
  * the bound client target.
37
37
  */
38
- export declare const DATA_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved", "onProjectsChanged"];
38
+ export declare const DATA_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved", "onDocumentDirtyChanged", "onDocumentDeleted", "onDocumentsBuilt", "onProjectsChanged"];
39
39
  //# sourceMappingURL=data-protocol-methods.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-protocol-methods.d.ts","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,oLAS6C,CAAC;AAE3F,6DAA6D;AAC7D,eAAO,MAAM,+BAA+B,8CAE3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,uNAG6C,CAAC;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,0EAI6C,CAAC;AAE5F,mEAAmE;AACnE,eAAO,MAAM,gCAAgC,mDAE5C,CAAC;AAEF,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,gCAA+F,CAAC;AAE5I;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,wEAG6C,CAAC"}
1
+ {"version":3,"file":"data-protocol-methods.d.ts","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,mTAe6C,CAAC;AAE3F,6DAA6D;AAC7D,eAAO,MAAM,+BAA+B,8CAE3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,sVAG6C,CAAC;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,0EAI4B,CAAC;AAE3E,mEAAmE;AACnE,eAAO,MAAM,gCAAgC,sHAM6C,CAAC;AAE3F,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,gCAA+F,CAAC;AAE5I;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,2IAG6C,CAAC"}
@@ -11,11 +11,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.DATA_CLIENT_PROTOCOL_METHODS = exports.PROJECT_CLIENT_PROTOCOL_METHODS = exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = exports.REFERENCE_SERVER_PROTOCOL_METHODS = exports.DATA_SERVER_PROTOCOL_METHODS = exports.PROJECT_SERVER_PROTOCOL_METHODS = exports.DOCUMENT_SERVER_PROTOCOL_METHODS = void 0;
12
12
  /** Request-method names on {@link DocumentServerProtocol}. */
13
13
  exports.DOCUMENT_SERVER_PROTOCOL_METHODS = [
14
+ 'createSession',
15
+ 'closeSession',
16
+ 'createModelDocument',
17
+ 'updateModelDocuments',
14
18
  'openModelDocument',
15
19
  'closeModelDocument',
16
20
  'getModelDocument',
17
21
  'updateModelDocument',
18
22
  'saveModelDocument',
23
+ 'persistModelDocument',
24
+ 'deleteModelDocument',
19
25
  'watchModelDocument',
20
26
  'unwatchModelDocument',
21
27
  'waitForReady'
@@ -44,7 +50,13 @@ exports.REFERENCE_SERVER_PROTOCOL_METHODS = [
44
50
  'findNextName'
45
51
  ];
46
52
  /** Notification-method names on {@link DocumentClientProtocol}. */
47
- exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = ['onDocumentUpdated', 'onDocumentSaved'];
53
+ exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = [
54
+ 'onDocumentUpdated',
55
+ 'onDocumentSaved',
56
+ 'onDocumentDirtyChanged',
57
+ 'onDocumentDeleted',
58
+ 'onDocumentsBuilt'
59
+ ];
48
60
  /** Notification-method names on {@link ProjectClientProtocol}. */
49
61
  exports.PROJECT_CLIENT_PROTOCOL_METHODS = ['onProjectsChanged'];
50
62
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"data-protocol-methods.js","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAalF,8DAA8D;AACjD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,cAAc;CACyE,CAAC;AAE3F,6DAA6D;AAChD,QAAA,+BAA+B,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAEhF,CAAC;AAEF;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC;AAEvF;;;;;GAKG;AACU,QAAA,iCAAiC,GAAG;IAC9C,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CAC0E,CAAC;AAE5F,mEAAmE;AACtD,QAAA,gCAAgC,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,CAEtF,CAAC;AAEF,kEAAkE;AACrD,QAAA,+BAA+B,GAAG,CAAC,mBAAmB,CAAwE,CAAC;AAE5I;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC"}
1
+ {"version":3,"file":"data-protocol-methods.js","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAalF,8DAA8D;AACjD,QAAA,gCAAgC,GAAG;IAC7C,eAAe;IACf,cAAc;IACd,qBAAqB;IACrB,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,sBAAsB;IACtB,qBAAqB;IACrB,oBAAoB;IACpB,sBAAsB;IACtB,cAAc;CACyE,CAAC;AAE3F,6DAA6D;AAChD,QAAA,+BAA+B,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAEhF,CAAC;AAEF;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,QAAA,gCAAgC;IACnC,GAAG,QAAA,+BAA+B;CACiD,CAAC;AAEvF;;;;;GAKG;AACU,QAAA,iCAAiC,GAAG;IAC9C,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CACyD,CAAC;AAE3E,mEAAmE;AACtD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,iBAAiB;IACjB,wBAAwB;IACxB,mBAAmB;IACnB,kBAAkB;CACqE,CAAC;AAE3F,kEAAkE;AACrD,QAAA,+BAA+B,GAAG,CAAC,mBAAmB,CAAwE,CAAC;AAE5I;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,QAAA,gCAAgC;IACnC,GAAG,QAAA,+BAA+B;CACiD,CAAC"}
@@ -9,11 +9,11 @@
9
9
  import type { TransferDiagnostic } from '../transfer-diagnostic';
10
10
  import type { TransferElement } from '../transfer-element';
11
11
  import type { Project } from '../project';
12
- import type { TransferDocument } from '../transfer-document';
12
+ import type { TransferCreatedDocument, TransferDocument, TransferSavedDocument, TransferWatchedDocument } from '../transfer-document';
13
13
  import type { CloseModelArgs, FindNextNameArgs, OpenModelArgs, ReferenceContext, ReferenceRequest } from '../model-server';
14
14
  import type { ReferenceCandidate, ReferenceTarget } from '../model-service/reference-candidate';
15
- import type { ProjectsChangedEvent, TransferDocumentSavedEvent, TransferDocumentUpdatedEvent } from './events';
16
- import type { GetModelDocumentArgs, GetProjectForUriArgs, TransferSaveDocumentArgs, WatchModelDocumentArgs, TransferUpdateDocumentArgs } from './requests';
15
+ import type { ProjectsChangedEvent, TransferDocumentDeletedEvent, TransferDocumentDirtyChangedEvent, TransferDocumentSavedEvent, TransferDocumentsBuiltEvent, TransferDocumentUpdatedEvent } from './events';
16
+ import type { CloseSessionArgs, CreateModelDocumentArgs, CreateSessionArgs, GetModelDocumentArgs, GetProjectForUriArgs, TransferDeleteDocumentArgs, TransferPersistDocumentArgs, TransferSaveDocumentArgs, WatchModelDocumentArgs, TransferUpdateDocumentArgs, TransferUpdateDocumentsArgs } from './requests';
17
17
  /**
18
18
  * Document-scoped slice of the data-server wire contract: the per-document
19
19
  * lifecycle (get / update / save), the per-`(uri, clientId)` watch
@@ -32,34 +32,74 @@ import type { GetModelDocumentArgs, GetProjectForUriArgs, TransferSaveDocumentAr
32
32
  */
33
33
  export interface DocumentServerProtocol<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic> {
34
34
  /**
35
- * Open a document for an editor session and return its current state.
36
- * Registers `(uri, clientId)` with the multi-client document manager
37
- * (so concurrent editors share one built document) and returns the
38
- * document at the server's configured target phase — the same shape
39
- * {@link getModelDocument} returns, except that `version` is taken from
40
- * the text-document store so the caller's first `baseVersion` write
41
- * cannot self-conflict. Idempotent in registration terms: opening an
42
- * already-open document refreshes the client registration. Note it does
43
- * NOT avoid a rebuild — a second client attaching triggers
44
- * `refreshContent`, which fires a change event, so mounting a form on a
45
- * document already open in a text editor rebuilds it.
35
+ * Register `args.clientId` as a client session owned by this connection.
36
+ * Rejects with a `DuplicateClientIdError` code when the id is live anywhere
37
+ * in the server process, and with a `ReservedClientIdError` code when the
38
+ * framework reserves it.
46
39
  *
47
- * The default `DataServer` impl delegates to `ModelService.open` then
48
- * reads the built state. Pair with {@link watchModelDocument} to receive
49
- * subsequent build-phase events (open returns a one-shot snapshot;
50
- * later validation diagnostics arrive on the watch channel).
40
+ * A request carrying a registered id acts as that session: it writes only
41
+ * what the session has open, failing with a `DocumentNotOpenError` code
42
+ * otherwise, and opens nothing implicitly; its open reads the file and takes
43
+ * no `languageId`, `version` or `text` seed. The session ends with
44
+ * {@link closeSession} or when the connection closes, and either closes
45
+ * every document it has open.
46
+ *
47
+ * A registration carrying the `resumeToken` an earlier registration of the
48
+ * same id carried ends that session first, from any connection, so a client
49
+ * whose connection dropped can register again before the server notices.
50
+ */
51
+ createSession(args: CreateSessionArgs): Promise<void>;
52
+ /**
53
+ * End a session this connection registered: close every document it has
54
+ * open, drop its watches, and free its id. A no-op for an id this
55
+ * connection did not register.
51
56
  */
52
- openModelDocument(args: OpenModelArgs): Promise<TransferDocument<TTransfer, TDiagnostic>>;
57
+ closeSession(args: CloseSessionArgs): Promise<void>;
53
58
  /**
54
- * Close an editor session for `(uri, clientId)`. Counterpart to
55
- * {@link openModelDocument}; the underlying document stays built until
56
- * every registered client has closed. The default `DataServer` impl
57
- * delegates to `ModelService.close` and ALSO releases any watch for the
58
- * same `(uri, clientId)` (closing a session frees its own watch — a
59
- * forgotten {@link unwatchModelDocument} would otherwise leak dispatch;
60
- * the implicit unwatch is idempotent). `watchModelDocument` is NOT
61
- * coupled the other way: opening does not force a watch, so a snapshot
62
- * reader can open without streaming.
59
+ * Create a document with `args.text`, open for the session, and return it
60
+ * as {@link openModelDocument} does, with the version the create made in
61
+ * `created`. The answer is read after the create, so it can already hold
62
+ * another client's write or an integrity repair; a write based on
63
+ * `created.version` then conflicts. It reaches disk with the first save.
64
+ * Fails when the file exists or any client has the URI open, and with a
65
+ * `SessionClosedError` code when `args.clientId` is not a session
66
+ * registered on this connection.
67
+ */
68
+ createModelDocument(args: CreateModelDocumentArgs): Promise<TransferCreatedDocument<TTransfer, TDiagnostic>>;
69
+ /**
70
+ * Write several documents the session has open, all or none: a conflict or
71
+ * a document not open fails the whole set before any text applies.
72
+ * Resolves to the documents in the order given, once the language client
73
+ * has answered the push of each, or the server-side bound on that wait
74
+ * passes, as {@link updateModelDocument} does. Only for a session
75
+ * registered on this connection.
76
+ */
77
+ updateModelDocuments(args: TransferUpdateDocumentsArgs<TTransfer>): Promise<TransferDocument<TTransfer, TDiagnostic>[]>;
78
+ /**
79
+ * Open a document for the client session `clientId` and return its current
80
+ * state. `clientId` must be a session this connection registered with
81
+ * {@link createSession}; any other id fails with the closed-session code,
82
+ * as every document request here does. The document is read from disk
83
+ * unless a client has it open already, so the request carries no
84
+ * `languageId`, `version` or `text` seed. Returns the document at
85
+ * the server's configured target phase, as {@link getModelDocument} does.
86
+ * A repeat open changes nothing.
87
+ *
88
+ * Pair with {@link watchModelDocument} to receive subsequent build-phase
89
+ * events (open returns a one-shot snapshot; later validation diagnostics
90
+ * arrive on the watch channel).
91
+ */
92
+ openModelDocument(args: Pick<OpenModelArgs, 'uri' | 'clientId' | 'options'>): Promise<TransferDocument<TTransfer, TDiagnostic>>;
93
+ /**
94
+ * Close the session's open of `uri`. Counterpart to
95
+ * {@link openModelDocument}; the document stays open until every client
96
+ * has closed it, and then the server releases it, by default reverting it
97
+ * to disk. The default
98
+ * `DataServer` impl ALSO releases any watch for the same
99
+ * `(uri, clientId)` (a forgotten {@link unwatchModelDocument} would
100
+ * otherwise leak dispatch; the implicit unwatch is idempotent).
101
+ * `watchModelDocument` is NOT coupled the other way: opening does not force
102
+ * a watch, so a snapshot reader can open without streaming.
63
103
  */
64
104
  closeModelDocument(args: CloseModelArgs): Promise<void>;
65
105
  /**
@@ -70,32 +110,68 @@ export interface DocumentServerProtocol<TTransfer extends TransferElement, TDiag
70
110
  */
71
111
  getModelDocument(args: GetModelDocumentArgs): Promise<TransferDocument<TTransfer, TDiagnostic>>;
72
112
  /**
73
- * Update a document's content. The response carries the latest built
74
- * state including diagnostics; callers observe convergence via that
75
- * response.
113
+ * Update a document's content as the session `clientId`, which must have
114
+ * it open. The response carries the latest built state including
115
+ * diagnostics; callers observe convergence via that response. It is sent
116
+ * once the language client has answered the push of the text, or the
117
+ * server-side bound on that wait passes, as {@link saveModelDocument}'s
118
+ * is, so an editor already shows the write when it arrives.
76
119
  */
77
120
  updateModelDocument(args: TransferUpdateDocumentArgs<TTransfer>): Promise<TransferDocument<TTransfer, TDiagnostic>>;
78
121
  /**
79
- * Persist a document to disk. The response is the post-save document
80
- * state (matches the file on disk). Save semantics depend on the
81
- * filesystem-provider wiring; rejection paths surface as awaited
122
+ * Write a document as the session `clientId`, which must have it open, and
123
+ * persist it to disk. The response is the build of the text written, with
124
+ * its version in `persisted`, sent once the language client has answered
125
+ * the push of that text, applied or refused, or a server-side bound on
126
+ * that wait passes; it does not wait again for a push that wait already
127
+ * gave up on and the client has not answered since. Save semantics depend
128
+ * on the filesystem-provider wiring; rejection paths surface as awaited
82
129
  * promise rejections.
83
130
  */
84
- saveModelDocument(args: TransferSaveDocumentArgs<TTransfer>): Promise<TransferDocument<TTransfer, TDiagnostic>>;
131
+ saveModelDocument(args: TransferSaveDocumentArgs<TTransfer>): Promise<TransferSavedDocument<TTransfer, TDiagnostic>>;
132
+ /**
133
+ * Persist the text the server holds for a document the session `clientId`
134
+ * has open, as it is: no update and no serialisation, so another client's
135
+ * unsaved text keeps its formatting. `baseVersion` is checked in the step
136
+ * that takes the text, so text that moved on fails with a `ConflictError`
137
+ * code. The saved event names this session, whoever wrote the text.
138
+ * Answers after the same language-client wait as {@link saveModelDocument},
139
+ * with the document's latest build, read after that wait, so another
140
+ * session's write during it shows; `persisted` carries the version written.
141
+ */
142
+ persistModelDocument(args: TransferPersistDocumentArgs): Promise<TransferSavedDocument<TTransfer, TDiagnostic>>;
143
+ /**
144
+ * Delete a document the session `clientId` has open, at once: its file,
145
+ * then the document, as a deletion a file watcher reports removes it. Every
146
+ * session's open of it closes and every client hears
147
+ * {@link DocumentClientProtocol.onDocumentDeleted} naming this session; the
148
+ * session's own watch is released, as {@link closeModelDocument} releases
149
+ * it. `baseVersion` is checked in the step that marks the document for
150
+ * deletion, so text that moved on fails with a `ConflictError` code. A file
151
+ * already gone deletes only the document; a file that cannot be removed
152
+ * fails the call and changes nothing. Resolves once the build that removes
153
+ * the document has run; a read then answers the URI without a model, unless
154
+ * an editor still has it open, whose buffer the document is built from.
155
+ */
156
+ deleteModelDocument(args: TransferDeleteDocumentArgs): Promise<void>;
85
157
  /**
86
158
  * Start watching `(uri, clientId)`. The server starts dispatching
87
159
  * {@link DocumentClientProtocol.onDocumentUpdated} on the paired wire
88
160
  * for every build-phase event on `uri`.
89
161
  *
90
- * Returns `Promise<void>` — the bidirectional pattern means the event
91
- * channel is the client interface, not a returned handle. Callers fan
92
- * out a single inbound `onDocumentUpdated` to multiple local listeners
93
- * with their own `Emitter<T>` (matching Theia's pattern). Pair every
94
- * `watchModelDocument` with {@link unwatchModelDocument} when no longer
95
- * needed; the server holds the watch record until the matching unwatch
96
- * lands.
162
+ * Answers with the key the watch's events name the document by, whether
163
+ * a document exists, taken once the watch is in place and the document
164
+ * is loaded as a read loads it, the text held at that moment, and the
165
+ * position of the last update or deletion event sent as of it, so an event
166
+ * the client heard while the watch was in flight tells by its own position
167
+ * whether it is newer than the answer. No handle: the event channel is the
168
+ * client interface. Callers fan out a single inbound `onDocumentUpdated` to
169
+ * multiple local listeners with their own `Emitter<T>` (matching Theia's
170
+ * pattern). Pair every `watchModelDocument` with
171
+ * {@link unwatchModelDocument} when no longer needed; the server holds the
172
+ * watch record until the matching unwatch lands.
97
173
  */
98
- watchModelDocument(args: WatchModelDocumentArgs): Promise<void>;
174
+ watchModelDocument(args: WatchModelDocumentArgs): Promise<TransferWatchedDocument>;
99
175
  /**
100
176
  * Stop watching `(uri, clientId)` previously started by
101
177
  * {@link watchModelDocument}. Idempotent — unwatching twice is a no-op.
@@ -171,6 +247,19 @@ export interface ProjectServerProtocol<TProject extends Project = Project> {
171
247
  */
172
248
  export interface DataServerProtocol<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic, TProject extends Project = Project> extends DocumentServerProtocol<TTransfer, TDiagnostic>, ProjectServerProtocol<TProject> {
173
249
  }
250
+ /**
251
+ * The diagnostic shape a server answers with, read back off its own
252
+ * declaration.
253
+ *
254
+ * This is what lets a client tier stay generic over the server alone and still
255
+ * describe what it hands back. Both parameters must be inferred: naming
256
+ * {@link TransferElement} for the transfer instead fails to match while that
257
+ * parameter is still generic, and a default declared against the constraint
258
+ * then stops satisfying it.
259
+ */
260
+ export type DiagnosticOf<TServer> = TServer extends DocumentServerProtocol<infer _TTransfer, infer TDiagnostic> ? TDiagnostic : TransferDiagnostic;
261
+ /** The project shape a server answers with, read back off its own declaration. */
262
+ export type ProjectOf<TServer> = TServer extends ProjectServerProtocol<infer TProject> ? TProject : Project;
174
263
  /**
175
264
  * Cross-reference / naming slice of the server surface — scope-aware
176
265
  * queries that resolve against the language's reference services. NOT part
@@ -181,11 +270,11 @@ export interface DataServerProtocol<TTransfer extends TransferElement, TDiagnost
181
270
  * source/URI (an `ElementSource` with no URI resolves to the sole
182
271
  * registered language; a multi-language workspace overrides).
183
272
  *
184
- * Generic over the transfer root type only — the resolution result
185
- * ({@link ReferenceTarget}) carries the resolved node's encoded subtree;
186
- * candidates and names are diagnostic-free.
273
+ * Not generic over a server's root type: {@link resolveReference} answers with
274
+ * a node a reference names, which is no document root, and candidates and
275
+ * names are diagnostic-free.
187
276
  */
188
- export interface ReferenceServerProtocol<TTransfer extends TransferElement> {
277
+ export interface ReferenceServerProtocol {
189
278
  /**
190
279
  * List the reference candidates reachable for the property named in `ctx`
191
280
  * from its (possibly synthetic) source. Backed by the language's
@@ -197,8 +286,11 @@ export interface ReferenceServerProtocol<TTransfer extends TransferElement> {
197
286
  * target's document URI, display fields, and the resolved node's encoded
198
287
  * transfer subtree. Resolves via the language's reference services;
199
288
  * `undefined` when the reference does not resolve.
289
+ *
290
+ * `TElement` is the caller's claim about the target node's type; nothing
291
+ * checks it, so leave it at the default unless the reference names one type.
200
292
  */
201
- resolveReference(ref: ReferenceRequest): Promise<ReferenceTarget<TTransfer> | undefined>;
293
+ resolveReference<TElement extends TransferElement = TransferElement>(ref: ReferenceRequest): Promise<ReferenceTarget<TElement> | undefined>;
202
294
  /**
203
295
  * Compute the next free name for a new element of `args.type` based on
204
296
  * `args.proposal`, unique within the `args.tier` scope (default
@@ -235,6 +327,36 @@ export interface DocumentClientProtocol<TTransfer extends TransferElement, TDiag
235
327
  * codepath, not a subscription codepath).
236
328
  */
237
329
  onDocumentSaved(event: TransferDocumentSavedEvent<TTransfer, TDiagnostic>): void;
330
+ /**
331
+ * Delivered when a subscribed document's text starts or stops differing
332
+ * from its file, as the server last knew it. Gated like
333
+ * {@link onDocumentSaved}; the answer at any one moment is the `dirty` of
334
+ * the documents the server sends. After a reconnect, a `DataSession`
335
+ * delivers here the answer of each document it restored, when that differs
336
+ * from the last this client was told: the flips while the connection was
337
+ * down reached no one.
338
+ */
339
+ onDocumentDirtyChanged(event: TransferDocumentDirtyChangedEvent): void;
340
+ /**
341
+ * Delivered when a document's backing file was removed. Separate from
342
+ * {@link onDocumentUpdated} for the same reason as {@link onDocumentSaved},
343
+ * and more strongly: there is no built state to deliver, and the build-phase
344
+ * path cannot report a deletion at all.
345
+ *
346
+ * Ungated, because on a browser host — where the workspace lives behind the
347
+ * head — no other source can observe a file disappearing. Recipients that
348
+ * only care about their own documents filter by URI.
349
+ */
350
+ onDocumentDeleted(event: TransferDocumentDeletedEvent): void;
351
+ /**
352
+ * Delivered once per build, naming the documents that reached the
353
+ * subscription phase and that
354
+ * nobody on this connection watches — chiefly the ones rebuilt as a cascade
355
+ * from a dependency's change, which no filesystem watcher can see because
356
+ * their own files did not change. The complement of
357
+ * {@link onDocumentUpdated}; carries URIs and no documents.
358
+ */
359
+ onDocumentsBuilt(event: TransferDocumentsBuiltEvent): void;
238
360
  }
239
361
  /**
240
362
  * Project-scoped slice of the client surface — the project-registry change