@hydranium/protocol 1.0.0-next.24 → 1.0.0-next.242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/README.md +40 -3
  2. package/lib/abstract-logger.d.ts +5 -0
  3. package/lib/abstract-logger.d.ts.map +1 -1
  4. package/lib/abstract-logger.js +7 -0
  5. package/lib/abstract-logger.js.map +1 -1
  6. package/lib/client/data-connection.d.ts +245 -0
  7. package/lib/client/data-connection.d.ts.map +1 -0
  8. package/lib/client/data-connection.js +425 -0
  9. package/lib/client/data-connection.js.map +1 -0
  10. package/lib/client/data-events.d.ts +13 -1
  11. package/lib/client/data-events.d.ts.map +1 -1
  12. package/lib/client/data-events.js +21 -0
  13. package/lib/client/data-events.js.map +1 -1
  14. package/lib/client/data-port.d.ts +44 -27
  15. package/lib/client/data-port.d.ts.map +1 -1
  16. package/lib/client/data-session.d.ts +473 -81
  17. package/lib/client/data-session.d.ts.map +1 -1
  18. package/lib/client/data-session.js +743 -108
  19. package/lib/client/data-session.js.map +1 -1
  20. package/lib/client/index.d.ts +14 -9
  21. package/lib/client/index.d.ts.map +1 -1
  22. package/lib/client/index.js +14 -9
  23. package/lib/client/index.js.map +1 -1
  24. package/lib/client/message-relay.d.ts +10 -4
  25. package/lib/client/message-relay.d.ts.map +1 -1
  26. package/lib/client/message-relay.js +12 -6
  27. package/lib/client/message-relay.js.map +1 -1
  28. package/lib/client/post-message-transport.d.ts +64 -3
  29. package/lib/client/post-message-transport.d.ts.map +1 -1
  30. package/lib/client/post-message-transport.js +175 -1
  31. package/lib/client/post-message-transport.js.map +1 -1
  32. package/lib/client/rpc-connection.d.ts +157 -0
  33. package/lib/client/rpc-connection.d.ts.map +1 -0
  34. package/lib/client/rpc-connection.js +214 -0
  35. package/lib/client/rpc-connection.js.map +1 -0
  36. package/lib/client-ids.d.ts +45 -0
  37. package/lib/client-ids.d.ts.map +1 -0
  38. package/lib/client-ids.js +48 -0
  39. package/lib/client-ids.js.map +1 -0
  40. package/lib/clock.d.ts +38 -0
  41. package/lib/clock.d.ts.map +1 -1
  42. package/lib/clock.js +36 -1
  43. package/lib/clock.js.map +1 -1
  44. package/lib/console-logger.d.ts +23 -0
  45. package/lib/console-logger.d.ts.map +1 -0
  46. package/lib/console-logger.js +39 -0
  47. package/lib/console-logger.js.map +1 -0
  48. package/lib/data/data-protocol-methods.d.ts +4 -4
  49. package/lib/data/data-protocol-methods.d.ts.map +1 -1
  50. package/lib/data/data-protocol-methods.js +12 -1
  51. package/lib/data/data-protocol-methods.js.map +1 -1
  52. package/lib/data/data-server-protocol.d.ts +132 -41
  53. package/lib/data/data-server-protocol.d.ts.map +1 -1
  54. package/lib/data/events.d.ts +117 -21
  55. package/lib/data/events.d.ts.map +1 -1
  56. package/lib/data/requests.d.ts +69 -11
  57. package/lib/data/requests.d.ts.map +1 -1
  58. package/lib/debouncer.d.ts.map +1 -1
  59. package/lib/debouncer.js.map +1 -1
  60. package/lib/errors.d.ts +187 -29
  61. package/lib/errors.d.ts.map +1 -1
  62. package/lib/errors.js +270 -29
  63. package/lib/errors.js.map +1 -1
  64. package/lib/glsp-request-model-args.d.ts +16 -0
  65. package/lib/glsp-request-model-args.d.ts.map +1 -0
  66. package/lib/glsp-request-model-args.js +19 -0
  67. package/lib/glsp-request-model-args.js.map +1 -0
  68. package/lib/glsp-save-model-actions.d.ts +50 -0
  69. package/lib/glsp-save-model-actions.d.ts.map +1 -0
  70. package/lib/glsp-save-model-actions.js +28 -0
  71. package/lib/glsp-save-model-actions.js.map +1 -0
  72. package/lib/index.d.ts +7 -0
  73. package/lib/index.d.ts.map +1 -1
  74. package/lib/index.js +10 -0
  75. package/lib/index.js.map +1 -1
  76. package/lib/latency-collector.d.ts +8 -4
  77. package/lib/latency-collector.d.ts.map +1 -1
  78. package/lib/latency-collector.js.map +1 -1
  79. package/lib/logger.d.ts +22 -1
  80. package/lib/logger.d.ts.map +1 -1
  81. package/lib/logger.js +31 -3
  82. package/lib/logger.js.map +1 -1
  83. package/lib/messages/index.d.ts +30 -0
  84. package/lib/messages/index.d.ts.map +1 -0
  85. package/lib/messages/index.js +62 -0
  86. package/lib/messages/index.js.map +1 -0
  87. package/lib/messages/primitives.d.ts +188 -0
  88. package/lib/messages/primitives.d.ts.map +1 -0
  89. package/lib/messages/primitives.js +161 -0
  90. package/lib/messages/primitives.js.map +1 -0
  91. package/lib/model-server.d.ts +60 -13
  92. package/lib/model-server.d.ts.map +1 -1
  93. package/lib/model-server.js +4 -2
  94. package/lib/model-server.js.map +1 -1
  95. package/lib/model-service/base-version.d.ts +64 -0
  96. package/lib/model-service/base-version.d.ts.map +1 -0
  97. package/lib/model-service/base-version.js +43 -0
  98. package/lib/model-service/base-version.js.map +1 -0
  99. package/lib/model-service/index.d.ts +1 -1
  100. package/lib/model-service/index.d.ts.map +1 -1
  101. package/lib/model-service/index.js +4 -5
  102. package/lib/model-service/index.js.map +1 -1
  103. package/lib/model-service/reference-candidate.d.ts +5 -3
  104. package/lib/model-service/reference-candidate.d.ts.map +1 -1
  105. package/lib/{model-service/args.js → node/index.d.ts} +2 -3
  106. package/lib/node/index.d.ts.map +1 -0
  107. package/lib/node/index.js +29 -0
  108. package/lib/node/index.js.map +1 -0
  109. package/lib/node/process-memory.d.ts +66 -0
  110. package/lib/node/process-memory.d.ts.map +1 -0
  111. package/lib/node/process-memory.js +291 -0
  112. package/lib/node/process-memory.js.map +1 -0
  113. package/lib/noop-logger.d.ts.map +1 -1
  114. package/lib/noop-logger.js.map +1 -1
  115. package/lib/observable-value.js.map +1 -1
  116. package/lib/patch-merge.d.ts +35 -32
  117. package/lib/patch-merge.d.ts.map +1 -1
  118. package/lib/patch-merge.js +67 -23
  119. package/lib/patch-merge.js.map +1 -1
  120. package/lib/profile-session.d.ts +8 -4
  121. package/lib/profile-session.d.ts.map +1 -1
  122. package/lib/profile-session.js.map +1 -1
  123. package/lib/random-uuid.d.ts +14 -0
  124. package/lib/random-uuid.d.ts.map +1 -0
  125. package/lib/random-uuid.js +24 -0
  126. package/lib/random-uuid.js.map +1 -0
  127. package/lib/reconcile-write.d.ts +65 -0
  128. package/lib/reconcile-write.d.ts.map +1 -0
  129. package/lib/reconcile-write.js +67 -0
  130. package/lib/reconcile-write.js.map +1 -0
  131. package/lib/rpc/bind-rpc-methods.d.ts +33 -3
  132. package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
  133. package/lib/rpc/bind-rpc-methods.js +32 -3
  134. package/lib/rpc/bind-rpc-methods.js.map +1 -1
  135. package/lib/rpc/create-rpc-proxy.d.ts +10 -0
  136. package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
  137. package/lib/rpc/create-rpc-proxy.js +12 -2
  138. package/lib/rpc/create-rpc-proxy.js.map +1 -1
  139. package/lib/rpc/index.d.ts +1 -0
  140. package/lib/rpc/index.d.ts.map +1 -1
  141. package/lib/rpc/index.js +1 -0
  142. package/lib/rpc/index.js.map +1 -1
  143. package/lib/rpc/send-by-method-name.d.ts +76 -0
  144. package/lib/rpc/send-by-method-name.d.ts.map +1 -0
  145. package/lib/rpc/send-by-method-name.js +120 -0
  146. package/lib/rpc/send-by-method-name.js.map +1 -0
  147. package/lib/rpc/wire-prefix.js.map +1 -1
  148. package/lib/testing/catalogue-audit.d.ts +80 -0
  149. package/lib/testing/catalogue-audit.d.ts.map +1 -0
  150. package/lib/testing/catalogue-audit.js +94 -0
  151. package/lib/testing/catalogue-audit.js.map +1 -0
  152. package/lib/testing/data-doubles.d.ts +46 -15
  153. package/lib/testing/data-doubles.d.ts.map +1 -1
  154. package/lib/testing/data-doubles.js +58 -10
  155. package/lib/testing/data-doubles.js.map +1 -1
  156. package/lib/testing/fake-clock.d.ts +9 -1
  157. package/lib/testing/fake-clock.d.ts.map +1 -1
  158. package/lib/testing/fake-clock.js +54 -45
  159. package/lib/testing/fake-clock.js.map +1 -1
  160. package/lib/testing/index.d.ts +1 -0
  161. package/lib/testing/index.d.ts.map +1 -1
  162. package/lib/testing/index.js +5 -2
  163. package/lib/testing/index.js.map +1 -1
  164. package/lib/testing/node/duplex-connection.d.ts.map +1 -1
  165. package/lib/testing/node/duplex-connection.js +3 -2
  166. package/lib/testing/node/duplex-connection.js.map +1 -1
  167. package/lib/testing/node/duplex-stream.js.map +1 -1
  168. package/lib/testing/node/index.d.ts +1 -0
  169. package/lib/testing/node/index.d.ts.map +1 -1
  170. package/lib/testing/node/index.js +2 -2
  171. package/lib/testing/node/index.js.map +1 -1
  172. package/lib/testing/node/message-port-pair.d.ts +25 -0
  173. package/lib/testing/node/message-port-pair.d.ts.map +1 -0
  174. package/lib/testing/node/message-port-pair.js +26 -0
  175. package/lib/testing/node/message-port-pair.js.map +1 -0
  176. package/lib/testing/wait-for.d.ts +3 -2
  177. package/lib/testing/wait-for.d.ts.map +1 -1
  178. package/lib/testing/wait-for.js +40 -10
  179. package/lib/testing/wait-for.js.map +1 -1
  180. package/lib/tracer.d.ts.map +1 -1
  181. package/lib/tracer.js.map +1 -1
  182. package/lib/transfer-diagnostic.d.ts +33 -0
  183. package/lib/transfer-diagnostic.d.ts.map +1 -1
  184. package/lib/transfer-diagnostic.js +23 -0
  185. package/lib/transfer-diagnostic.js.map +1 -1
  186. package/lib/transfer-document.d.ts +70 -32
  187. package/lib/transfer-document.d.ts.map +1 -1
  188. package/lib/transfer-document.js +17 -9
  189. package/lib/transfer-document.js.map +1 -1
  190. package/lib/uri.d.ts.map +1 -1
  191. package/lib/uri.js.map +1 -1
  192. package/lib/util.d.ts +8 -0
  193. package/lib/util.d.ts.map +1 -1
  194. package/lib/util.js +32 -0
  195. package/lib/util.js.map +1 -1
  196. package/package.json +29 -37
  197. package/src/abstract-logger.ts +8 -0
  198. package/src/client/data-connection.ts +520 -0
  199. package/src/client/data-events.ts +33 -1
  200. package/src/client/data-port.ts +46 -28
  201. package/src/client/data-session.ts +951 -126
  202. package/src/client/index.ts +14 -9
  203. package/src/client/message-relay.ts +30 -8
  204. package/src/client/post-message-transport.ts +219 -4
  205. package/src/client/rpc-connection.ts +281 -0
  206. package/src/client-ids.ts +49 -0
  207. package/src/clock.ts +56 -0
  208. package/src/console-logger.ts +39 -0
  209. package/src/data/data-protocol-methods.ts +13 -4
  210. package/src/data/data-server-protocol.ts +157 -41
  211. package/src/data/events.ts +123 -21
  212. package/src/data/requests.ts +74 -11
  213. package/src/errors.ts +322 -36
  214. package/src/glsp-request-model-args.ts +16 -0
  215. package/src/glsp-save-model-actions.ts +59 -0
  216. package/src/index.ts +10 -0
  217. package/src/latency-collector.ts +8 -3
  218. package/src/logger.ts +28 -2
  219. package/src/messages/index.ts +37 -0
  220. package/src/messages/primitives.ts +271 -0
  221. package/src/model-server.ts +63 -18
  222. package/src/model-service/base-version.ts +72 -0
  223. package/src/model-service/index.ts +4 -5
  224. package/src/model-service/reference-candidate.ts +5 -3
  225. package/src/node/index.ts +14 -0
  226. package/src/node/process-memory.ts +299 -0
  227. package/src/patch-merge.ts +97 -42
  228. package/src/profile-session.ts +9 -4
  229. package/src/random-uuid.ts +21 -0
  230. package/src/reconcile-write.ts +124 -0
  231. package/src/rpc/README.md +4 -5
  232. package/src/rpc/bind-rpc-methods.ts +59 -4
  233. package/src/rpc/create-rpc-proxy.ts +20 -2
  234. package/src/rpc/index.ts +1 -0
  235. package/src/rpc/send-by-method-name.ts +140 -0
  236. package/src/testing/catalogue-audit.ts +111 -0
  237. package/src/testing/data-doubles.ts +149 -25
  238. package/src/testing/fake-clock.ts +62 -47
  239. package/src/testing/index.ts +5 -2
  240. package/src/testing/node/duplex-connection.ts +3 -2
  241. package/src/testing/node/index.ts +2 -2
  242. package/src/testing/node/message-port-pair.ts +40 -0
  243. package/src/testing/wait-for.ts +38 -11
  244. package/src/transfer-diagnostic.ts +40 -0
  245. package/src/transfer-document.ts +87 -34
  246. package/src/util.ts +33 -0
  247. package/lib/model-service/args.d.ts +0 -64
  248. package/lib/model-service/args.d.ts.map +0 -1
  249. package/lib/model-service/args.js.map +0 -1
  250. package/src/model-service/args.ts +0 -67
@@ -0,0 +1,157 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import type { MessageConnection } from 'vscode-jsonrpc';
10
+ import { type ResolvedMessage } from '../messages/primitives';
11
+ import { type RpcProxy } from '../rpc';
12
+ import type { DataPort } from './data-port';
13
+ /**
14
+ * The transport never opened. A complete sentence rather than a fragment: a
15
+ * fragment is nested inside a sentence the framework does not own, so no
16
+ * translator controls the whole and the composition cannot be made to read
17
+ * correctly in every language.
18
+ */
19
+ export declare const DATA_SERVER_CONNECT_FAILED: import("../messages/primitives").MessageDefinition<"Could not connect to the data server: {detail}">;
20
+ export declare const DATA_SERVER_NOT_READY: import("../messages/primitives").MessageDefinition<"The data server did not become ready: {detail}">;
21
+ /** The one method a connection needs of any server: its startup gate. */
22
+ export interface ReadyServer {
23
+ waitForReady(): Promise<void>;
24
+ }
25
+ /**
26
+ * Lifecycle reporting, for a host that raises warm-up UI around the two waits.
27
+ *
28
+ * Nothing fires until something asks for the connection — the generation is
29
+ * built on the first {@link RpcConnection.connected}. A host that wants the
30
+ * sequence at startup drives that call itself, or a workspace where nobody
31
+ * opens a document reports neither the connect nor the readiness its UI waits
32
+ * on.
33
+ */
34
+ export interface RpcConnectionLifecycle {
35
+ /** A generation is opening its transport, including on each reconnect. */
36
+ readonly onConnecting?: () => void;
37
+ /** The server's readiness gate has settled for a generation. */
38
+ readonly onReady?: () => void;
39
+ /**
40
+ * A generation failed to connect or to become ready. The failure is still
41
+ * reported through {@link DataPort.reportError} and still rejects the
42
+ * awaiting caller; this is for a host that also drives its own UI.
43
+ */
44
+ readonly onFailed?: (error: unknown) => void;
45
+ }
46
+ /** Everything {@link RpcConnection} needs once a subclass has resolved its defaults. */
47
+ export interface ResolvedRpcConnectionOptions<TClient extends object> {
48
+ readonly methodNamespace: string;
49
+ readonly clientMethods: readonly (keyof TClient & string)[];
50
+ readonly lifecycle: RpcConnectionLifecycle;
51
+ }
52
+ /**
53
+ * One connection generation: its connection, its proxy, and its readiness.
54
+ *
55
+ * Named by the `protected` reconnect seams {@link RpcConnection.currentGeneration}
56
+ * and {@link RpcConnection.awaitReady}, so an override has to name it too.
57
+ */
58
+ export interface RpcConnectionGeneration<TServer extends object> {
59
+ readonly connection: Promise<MessageConnection>;
60
+ readonly server: RpcProxy<TServer>;
61
+ /** Set on first use; the shared readiness gate for this generation. */
62
+ ready?: Promise<void>;
63
+ }
64
+ /**
65
+ * One JSON-RPC connection to a head, with the three jobs every host adapter
66
+ * would otherwise re-derive above {@link DataPort}:
67
+ *
68
+ * 1. **Build the typed proxy** over the port's connection, with the caller's
69
+ * wire prefix and client-method allowlist.
70
+ * 2. **Own the readiness gate** — `waitForReady` once per connection, shared
71
+ * across concurrent callers. A client can connect before the workspace walk
72
+ * finishes, and an early request is then answered correctly from an empty
73
+ * registry, which reads as a broken project tier rather than as a race.
74
+ * 3. **Own the reconnect policy**, by dropping its generation when the port
75
+ * disposes and building a fresh one on the next request.
76
+ *
77
+ * Bounded only by {@link ReadyServer}, so a head serving a slice of the data
78
+ * protocol — diagnostics alone, or one with methods excluded — is still a
79
+ * legal server here. `DataConnection` narrows the bound because its sessions
80
+ * call the document methods; nothing at this layer does.
81
+ */
82
+ export declare class RpcConnection<TServer extends ReadyServer, TClient extends object> {
83
+ protected readonly port: DataPort;
84
+ protected readonly client: TClient;
85
+ protected readonly methodNamespace: string;
86
+ protected readonly clientMethods: readonly (keyof TClient & string)[];
87
+ protected readonly lifecycle: RpcConnectionLifecycle;
88
+ /** The current generation, or `undefined` before the first request / after a teardown. */
89
+ protected generation?: RpcConnectionGeneration<TServer>;
90
+ protected disposed: boolean;
91
+ protected readonly portDisposeListener: {
92
+ dispose(): void;
93
+ };
94
+ constructor(port: DataPort, client: TClient, options: ResolvedRpcConnectionOptions<TClient>);
95
+ /**
96
+ * The connected, READY server proxy.
97
+ *
98
+ * Returns the proxy rather than `void` on purpose. A reconnect replaces the
99
+ * proxy, so a caller that cached one from an earlier call would go on
100
+ * addressing a dead connection with no error — handing it back per call
101
+ * makes the stale reference unrepresentable.
102
+ *
103
+ * Concurrent callers share one readiness promise, so `waitForReady` is
104
+ * awaited once per generation and not once per caller.
105
+ */
106
+ connected(): Promise<RpcProxy<TServer>>;
107
+ /**
108
+ * The current generation's proxy WITHOUT awaiting readiness — calls queue
109
+ * against the connection promise.
110
+ *
111
+ * **Protected, and that is the point.** An early request is answered
112
+ * correctly from a registry the workspace walk has not filled yet, which
113
+ * reads as a broken project tier rather than as a race — so every caller has
114
+ * to interpose the gate, and every caller forgetting to is a silent bug.
115
+ * {@link connected} is the public route and returns this same proxy once the
116
+ * gate has settled, which leaves nothing to forget. The one caller that
117
+ * cannot use it is {@link awaitReady}, whose whole job is running the gate.
118
+ *
119
+ * Read per access, never cached: a reconnect replaces the generation, and a
120
+ * held reference would address the dead one.
121
+ */
122
+ protected get server(): RpcProxy<TServer>;
123
+ /**
124
+ * Surface a failure the way this host does, through the port's sink.
125
+ *
126
+ * Here rather than only on the port so every participant sharing the
127
+ * connection reports through one route without being handed the transport.
128
+ */
129
+ reportError(error: unknown, reported: ResolvedMessage): void;
130
+ /** Tear down the current connection and stop tracking the port. Idempotent. */
131
+ dispose(): void;
132
+ /** The live generation, building one if there is none. */
133
+ protected currentGeneration(): RpcConnectionGeneration<TServer>;
134
+ /**
135
+ * The object whose {@link clientMethods} answer the server on each new
136
+ * generation: {@link client} itself. A subclass that must see a call before
137
+ * the client does returns an object that forwards each of them to it.
138
+ */
139
+ protected localTarget(): TClient;
140
+ /** Await the connection and the server's startup gate for one generation. */
141
+ protected awaitReady(generation: RpcConnectionGeneration<TServer>): Promise<void>;
142
+ /**
143
+ * Called once `generation` has passed its readiness gate, whichever request
144
+ * brought it up. A generation can replace one that failed at readiness
145
+ * without {@link dropGeneration}, so this, not a drop, is where state kept
146
+ * on the server is put back. It runs inside the readiness gate, so a throw
147
+ * from an override fails the generation as a refused gate would.
148
+ */
149
+ protected generationReady(_generation: RpcConnectionGeneration<TServer>): void;
150
+ /**
151
+ * Discard the current generation, disposing its connection if it opened.
152
+ * The next {@link connected} builds a fresh one.
153
+ */
154
+ protected dropGeneration(): void;
155
+ protected assertLive(): void;
156
+ }
157
+ //# sourceMappingURL=rpc-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-connection.d.ts","sourceRoot":"","sources":["../../src/client/rpc-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,eAAe,EAAyC,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,QAAQ,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,sGAGtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,sGAGjC,CAAC;AAEF,yEAAyE;AACzE,MAAM,WAAW,WAAW;IACzB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACpC,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C;AAYD,wFAAwF;AACxF,MAAM,WAAW,4BAA4B,CAAC,OAAO,SAAS,MAAM;IACjE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,aAAa,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AAK,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,CAGxC;IAED;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI,CAE3D;IAED,+EAA+E;IAC/E,OAAO,IAAI,IAAI,CAOd;IAED,0DAA0D;IAC1D,SAAS,CAAC,iBAAiB,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAmB9D;IAED;;;;OAIG;IACH,SAAS,CAAC,WAAW,IAAI,OAAO,CAE/B;IAED,6EAA6E;IAC7E,UAAgB,UAAU,CAAC,UAAU,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BtF;IAED;;;;;;OAMG;IACH,SAAS,CAAC,eAAe,CAAC,WAAW,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,IAAI,CAE7E;IAED;;;OAGG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI,CAO/B;IAED,SAAS,CAAC,UAAU,IAAI,IAAI,CAI3B;CACH"}
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the MIT License which is available in the project root.
7
+ *
8
+ * SPDX-License-Identifier: MIT
9
+ ********************************************************************************/
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.RpcConnection = exports.DATA_SERVER_NOT_READY = exports.DATA_SERVER_CONNECT_FAILED = void 0;
12
+ const primitives_1 = require("../messages/primitives");
13
+ const rpc_1 = require("../rpc");
14
+ /**
15
+ * The transport never opened. A complete sentence rather than a fragment: a
16
+ * fragment is nested inside a sentence the framework does not own, so no
17
+ * translator controls the whole and the composition cannot be made to read
18
+ * correctly in every language.
19
+ */
20
+ exports.DATA_SERVER_CONNECT_FAILED = (0, primitives_1.defineMessage)('hydranium/protocol/data-server-connect-failed', 'Could not connect to the data server: {detail}');
21
+ exports.DATA_SERVER_NOT_READY = (0, primitives_1.defineMessage)('hydranium/protocol/data-server-not-ready', 'The data server did not become ready: {detail}');
22
+ /** Calls each distinct lifecycle's hooks in order; one passed twice is called once. */
23
+ function composeLifecycles(...lifecycles) {
24
+ const present = [...new Set(lifecycles)].filter((lifecycle) => lifecycle !== undefined);
25
+ return {
26
+ onConnecting: () => present.forEach(lifecycle => lifecycle.onConnecting?.()),
27
+ onReady: () => present.forEach(lifecycle => lifecycle.onReady?.()),
28
+ onFailed: error => present.forEach(lifecycle => lifecycle.onFailed?.(error))
29
+ };
30
+ }
31
+ /**
32
+ * One JSON-RPC connection to a head, with the three jobs every host adapter
33
+ * would otherwise re-derive above {@link DataPort}:
34
+ *
35
+ * 1. **Build the typed proxy** over the port's connection, with the caller's
36
+ * wire prefix and client-method allowlist.
37
+ * 2. **Own the readiness gate** — `waitForReady` once per connection, shared
38
+ * across concurrent callers. A client can connect before the workspace walk
39
+ * finishes, and an early request is then answered correctly from an empty
40
+ * registry, which reads as a broken project tier rather than as a race.
41
+ * 3. **Own the reconnect policy**, by dropping its generation when the port
42
+ * disposes and building a fresh one on the next request.
43
+ *
44
+ * Bounded only by {@link ReadyServer}, so a head serving a slice of the data
45
+ * protocol — diagnostics alone, or one with methods excluded — is still a
46
+ * legal server here. `DataConnection` narrows the bound because its sessions
47
+ * call the document methods; nothing at this layer does.
48
+ */
49
+ class RpcConnection {
50
+ port;
51
+ client;
52
+ methodNamespace;
53
+ clientMethods;
54
+ lifecycle;
55
+ /** The current generation, or `undefined` before the first request / after a teardown. */
56
+ generation;
57
+ disposed = false;
58
+ portDisposeListener;
59
+ constructor(port, client, options) {
60
+ this.port = port;
61
+ this.client = client;
62
+ this.methodNamespace = options.methodNamespace;
63
+ this.clientMethods = options.clientMethods;
64
+ this.lifecycle = composeLifecycles(port.connectionLifecycle, options.lifecycle);
65
+ this.portDisposeListener = this.port.onDispose(() => this.dropGeneration());
66
+ }
67
+ /**
68
+ * The connected, READY server proxy.
69
+ *
70
+ * Returns the proxy rather than `void` on purpose. A reconnect replaces the
71
+ * proxy, so a caller that cached one from an earlier call would go on
72
+ * addressing a dead connection with no error — handing it back per call
73
+ * makes the stale reference unrepresentable.
74
+ *
75
+ * Concurrent callers share one readiness promise, so `waitForReady` is
76
+ * awaited once per generation and not once per caller.
77
+ */
78
+ async connected() {
79
+ this.assertLive();
80
+ const generation = this.currentGeneration();
81
+ if (!generation.ready) {
82
+ generation.ready = this.awaitReady(generation);
83
+ }
84
+ await generation.ready;
85
+ // Dropped while it opened: its transport is gone, so the call goes to the
86
+ // next generation, or rejects once this connection is disposed.
87
+ if (this.generation !== generation) {
88
+ return this.connected();
89
+ }
90
+ return generation.server;
91
+ }
92
+ /**
93
+ * The current generation's proxy WITHOUT awaiting readiness — calls queue
94
+ * against the connection promise.
95
+ *
96
+ * **Protected, and that is the point.** An early request is answered
97
+ * correctly from a registry the workspace walk has not filled yet, which
98
+ * reads as a broken project tier rather than as a race — so every caller has
99
+ * to interpose the gate, and every caller forgetting to is a silent bug.
100
+ * {@link connected} is the public route and returns this same proxy once the
101
+ * gate has settled, which leaves nothing to forget. The one caller that
102
+ * cannot use it is {@link awaitReady}, whose whole job is running the gate.
103
+ *
104
+ * Read per access, never cached: a reconnect replaces the generation, and a
105
+ * held reference would address the dead one.
106
+ */
107
+ get server() {
108
+ this.assertLive();
109
+ return this.currentGeneration().server;
110
+ }
111
+ /**
112
+ * Surface a failure the way this host does, through the port's sink.
113
+ *
114
+ * Here rather than only on the port so every participant sharing the
115
+ * connection reports through one route without being handed the transport.
116
+ */
117
+ reportError(error, reported) {
118
+ this.port.reportError(error, reported);
119
+ }
120
+ /** Tear down the current connection and stop tracking the port. Idempotent. */
121
+ dispose() {
122
+ if (this.disposed) {
123
+ return;
124
+ }
125
+ this.disposed = true;
126
+ this.portDisposeListener.dispose();
127
+ this.dropGeneration();
128
+ }
129
+ /** The live generation, building one if there is none. */
130
+ currentGeneration() {
131
+ if (this.generation) {
132
+ return this.generation;
133
+ }
134
+ this.lifecycle.onConnecting?.();
135
+ const connection = this.port.connect();
136
+ // Rejection is reported here rather than left to float: an unhandled
137
+ // rejection on a connection promise is the failure mode that reads as
138
+ // "the model is empty" instead of "the transport never opened".
139
+ connection.catch((error) => this.port.reportError(error, (0, primitives_1.resolve)(exports.DATA_SERVER_CONNECT_FAILED, { detail: (0, primitives_1.describeError)(error) })));
140
+ const server = (0, rpc_1.createRpcProxy)(connection, {
141
+ methodNamespace: this.methodNamespace,
142
+ localTarget: this.localTarget(),
143
+ localMethods: this.clientMethods
144
+ });
145
+ this.generation = { connection, server };
146
+ return this.generation;
147
+ }
148
+ /**
149
+ * The object whose {@link clientMethods} answer the server on each new
150
+ * generation: {@link client} itself. A subclass that must see a call before
151
+ * the client does returns an object that forwards each of them to it.
152
+ */
153
+ localTarget() {
154
+ return this.client;
155
+ }
156
+ /** Await the connection and the server's startup gate for one generation. */
157
+ async awaitReady(generation) {
158
+ try {
159
+ await generation.connection;
160
+ // Dropped meanwhile: writing the request would hit a closed transport.
161
+ if (this.generation !== generation) {
162
+ return;
163
+ }
164
+ await generation.server.waitForReady();
165
+ // Before `onReady`, so a failing restore reports a failure alone.
166
+ this.generationReady(generation);
167
+ this.lifecycle.onReady?.();
168
+ }
169
+ catch (error) {
170
+ // A dropped generation's request fails with its transport, which says
171
+ // nothing about whether the server is ready.
172
+ if (this.generation !== generation) {
173
+ return;
174
+ }
175
+ this.lifecycle.onFailed?.(error);
176
+ // Drop the generation so the next request retries rather than
177
+ // re-awaiting a settled rejection forever.
178
+ if (this.generation === generation) {
179
+ this.generation = undefined;
180
+ }
181
+ this.port.reportError(error, (0, primitives_1.resolve)(exports.DATA_SERVER_NOT_READY, { detail: (0, primitives_1.describeError)(error) }));
182
+ throw error;
183
+ }
184
+ }
185
+ /**
186
+ * Called once `generation` has passed its readiness gate, whichever request
187
+ * brought it up. A generation can replace one that failed at readiness
188
+ * without {@link dropGeneration}, so this, not a drop, is where state kept
189
+ * on the server is put back. It runs inside the readiness gate, so a throw
190
+ * from an override fails the generation as a refused gate would.
191
+ */
192
+ generationReady(_generation) {
193
+ // Nothing to put back at this layer.
194
+ }
195
+ /**
196
+ * Discard the current generation, disposing its connection if it opened.
197
+ * The next {@link connected} builds a fresh one.
198
+ */
199
+ dropGeneration() {
200
+ const generation = this.generation;
201
+ this.generation = undefined;
202
+ if (!generation) {
203
+ return;
204
+ }
205
+ generation.connection.then(connection => connection.dispose()).catch(() => undefined);
206
+ }
207
+ assertLive() {
208
+ if (this.disposed) {
209
+ throw new Error(`${this.constructor.name} is disposed`);
210
+ }
211
+ }
212
+ }
213
+ exports.RpcConnection = RpcConnection;
214
+ //# sourceMappingURL=rpc-connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-connection.js","sourceRoot":"","sources":["../../src/client/rpc-connection.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAGlF,uDAAqG;AACrG,gCAAuD;AAGvD;;;;;GAKG;AACU,QAAA,0BAA0B,GAAG,IAAA,0BAAa,EACpD,+CAA+C,EAC/C,gDAAgD,CAClD,CAAC;AAEW,QAAA,qBAAqB,GAAG,IAAA,0BAAa,EAC/C,0CAA0C,EAC1C,gDAAgD,CAClD,CAAC;AA6BF,uFAAuF;AACvF,SAAS,iBAAiB,CAAC,GAAG,UAAkD;IAC7E,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAuC,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;IAC7H,OAAO;QACJ,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,CAAC;QAC5E,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,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xC,CAAC;IAED;;;OAGG;IACO,cAAc;QACrB,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;YACf,OAAO;QACV,CAAC;QACD,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACzF,CAAC;IAES,UAAU;QACjB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,cAAc,CAAC,CAAC;QAC3D,CAAC;IACJ,CAAC;CACH"}
@@ -0,0 +1,45 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ /**
10
+ * Well-known values of the wire's `clientId` / `sourceClientId` field.
11
+ *
12
+ * The framework tracks each document as belonging to one or more "clients" —
13
+ * typically an LSP-text client (Monaco, VS Code, …), a GLSP diagram client,
14
+ * and/or a structured-form client — and keys its holds and watches per
15
+ * `(uri, clientId)`. These three values are not real participants, so a client
16
+ * minting its own id must avoid them.
17
+ *
18
+ * **Here rather than in the server package, because the side that has to
19
+ * RECOGNISE them is the client.** An inbound `onDocumentUpdated` carries
20
+ * `sourceClientId`, and a consumer deciding what to do with it is asking which
21
+ * of these it is — so a frontend would otherwise have to depend on the server
22
+ * tier to name three strings, and in practice retypes the literal instead.
23
+ */
24
+ /** Identifier for an LSP-text client (Monaco, VS Code, …). */
25
+ export declare const LANGUAGE_CLIENT_ID = "language-client";
26
+ /**
27
+ * The id an event names when no single client is behind it: the source of a
28
+ * `'rebuilt'` event, a document no client authored, or a build with more than
29
+ * one cause.
30
+ */
31
+ export declare const UNKNOWN_CLIENT_ID = "unknown";
32
+ /**
33
+ * Synthetic author id on the `onDocumentUpdated` broadcast a data-server
34
+ * emits for the build that follows a document's release, once no client holds
35
+ * it; by default that build reverts the document to its disk content,
36
+ * discarding unsaved edits. Not a real client: it lets consumers tell the
37
+ * release broadcast from client-authored updates.
38
+ */
39
+ export declare const DOCUMENT_RELEASE_CLIENT_ID = "document-release";
40
+ /**
41
+ * Every id the framework reserves, for a client checking that the identity it
42
+ * is about to mint collides with none of them.
43
+ */
44
+ export declare const FRAMEWORK_CLIENT_IDS: readonly string[];
45
+ //# sourceMappingURL=client-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-ids.d.ts","sourceRoot":"","sources":["../src/client-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;GAcG;AAEH,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAAwE,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the MIT License which is available in the project root.
7
+ *
8
+ * SPDX-License-Identifier: MIT
9
+ ********************************************************************************/
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.FRAMEWORK_CLIENT_IDS = exports.DOCUMENT_RELEASE_CLIENT_ID = exports.UNKNOWN_CLIENT_ID = exports.LANGUAGE_CLIENT_ID = void 0;
12
+ /**
13
+ * Well-known values of the wire's `clientId` / `sourceClientId` field.
14
+ *
15
+ * The framework tracks each document as belonging to one or more "clients" —
16
+ * typically an LSP-text client (Monaco, VS Code, …), a GLSP diagram client,
17
+ * and/or a structured-form client — and keys its holds and watches per
18
+ * `(uri, clientId)`. These three values are not real participants, so a client
19
+ * minting its own id must avoid them.
20
+ *
21
+ * **Here rather than in the server package, because the side that has to
22
+ * RECOGNISE them is the client.** An inbound `onDocumentUpdated` carries
23
+ * `sourceClientId`, and a consumer deciding what to do with it is asking which
24
+ * of these it is — so a frontend would otherwise have to depend on the server
25
+ * tier to name three strings, and in practice retypes the literal instead.
26
+ */
27
+ /** Identifier for an LSP-text client (Monaco, VS Code, …). */
28
+ exports.LANGUAGE_CLIENT_ID = 'language-client';
29
+ /**
30
+ * The id an event names when no single client is behind it: the source of a
31
+ * `'rebuilt'` event, a document no client authored, or a build with more than
32
+ * one cause.
33
+ */
34
+ exports.UNKNOWN_CLIENT_ID = 'unknown';
35
+ /**
36
+ * Synthetic author id on the `onDocumentUpdated` broadcast a data-server
37
+ * emits for the build that follows a document's release, once no client holds
38
+ * it; by default that build reverts the document to its disk content,
39
+ * discarding unsaved edits. Not a real client: it lets consumers tell the
40
+ * release broadcast from client-authored updates.
41
+ */
42
+ exports.DOCUMENT_RELEASE_CLIENT_ID = 'document-release';
43
+ /**
44
+ * Every id the framework reserves, for a client checking that the identity it
45
+ * is about to mint collides with none of them.
46
+ */
47
+ exports.FRAMEWORK_CLIENT_IDS = [exports.LANGUAGE_CLIENT_ID, exports.UNKNOWN_CLIENT_ID, exports.DOCUMENT_RELEASE_CLIENT_ID];
48
+ //# sourceMappingURL=client-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-ids.js","sourceRoot":"","sources":["../src/client-ids.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF;;;;;;;;;;;;;;GAcG;AAEH,8DAA8D;AACjD,QAAA,kBAAkB,GAAG,iBAAiB,CAAC;AAEpD;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE3C;;;;;;GAMG;AACU,QAAA,0BAA0B,GAAG,kBAAkB,CAAC;AAE7D;;;GAGG;AACU,QAAA,oBAAoB,GAAsB,CAAC,QAAA,kBAAkB,EAAE,QAAA,iBAAiB,EAAE,QAAA,0BAA0B,CAAC,CAAC"}
package/lib/clock.d.ts CHANGED
@@ -73,7 +73,28 @@ export interface Clock {
73
73
  */
74
74
  measure<T>(callback: () => Promise<T>): Promise<Timed<T>>;
75
75
  measure<T>(callback: () => T): Timed<T>;
76
+ /**
77
+ * Settle with `promise`, or with {@link TIMED_OUT} once `ms` have elapsed
78
+ * first. A promise that rejects first rejects this one; one that rejects
79
+ * after the timer is ignored. The timer is disposed the moment `promise`
80
+ * settles, so a won race leaves nothing scheduled, but `promise` itself
81
+ * runs on: nothing here can cancel it.
82
+ *
83
+ * Unlike VS Code's `raceTimeout`, this settles with a sentinel rather than
84
+ * `undefined`, so a promise resolving to `undefined` is not taken for a
85
+ * timeout; the caller branches on the result instead of passing an
86
+ * `onTimeout`.
87
+ *
88
+ * A custom implementation extends {@link SystemClock}, whose race runs over
89
+ * the subclass's {@link setTimer}.
90
+ */
91
+ raceTimer<T>(promise: Promise<T>, ms: number): Promise<T | typeof TIMED_OUT>;
76
92
  }
93
+ /**
94
+ * What {@link Clock.raceTimer} settles with when its timer fires first.
95
+ * Registered under a global key, so two copies of this package agree on it.
96
+ */
97
+ export declare const TIMED_OUT: unique symbol;
77
98
  /**
78
99
  * The result of {@link Clock.measure}: a callback's return value paired with
79
100
  * its elapsed wall-time in milliseconds. A plain value object — no methods, no
@@ -100,6 +121,10 @@ export interface Timed<T> {
100
121
  * Default {@link Clock}: delegates to the platform's `Date.now`,
101
122
  * `performance.now`, and `setTimeout`/`clearTimeout`. Bound everywhere in
102
123
  * production; swapped for `makeFakeClock` in tests.
124
+ *
125
+ * {@link measure} and {@link raceTimer} run over {@link stopwatch} and
126
+ * {@link setTimer}, so a clock that extends this one and replaces those
127
+ * measures and races on its own time, as the test clock does.
103
128
  */
104
129
  export declare class SystemClock implements Clock {
105
130
  now(): number;
@@ -107,5 +132,18 @@ export declare class SystemClock implements Clock {
107
132
  stopwatch(): Stopwatch;
108
133
  measure<T>(callback: () => Promise<T>): Promise<Timed<T>>;
109
134
  measure<T>(callback: () => T): Timed<T>;
135
+ /**
136
+ * The timer settles the race one microtask after it fires. A real timer
137
+ * runs only once pending resolutions are delivered, while a fake one fires
138
+ * inside its `advance`, so settling at once would let a promise already
139
+ * resolved when `advance` runs lose to a timer it beats in production. The
140
+ * deferral covers only that promise: one that settles through further
141
+ * chained reactions, such as a `.then` chain, an async function or
142
+ * `Promise.allSettled`, can still lose to an `advance` in the same turn,
143
+ * while it wins on the platform's timer. The handlers go on `promise`
144
+ * before {@link setTimer} runs, so a `setTimer` that throws still leaves
145
+ * `promise` observed.
146
+ */
147
+ raceTimer<T>(promise: Promise<T>, ms: number): Promise<T | typeof TIMED_OUT>;
110
148
  }
111
149
  //# 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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,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;;;;;;;kFAOkF;;;AAElF,iCAAoC;AA8FpC,MAAM,eAAe;IACC,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACnC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC;IACrB,OAAO,CAAqB;IAEtC,IAAI,SAAS;QACV,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;IAC3D,CAAC;IAED,GAAG;QACA,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,GAAG,EAAE,CAAC;QAC7C,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC;IAChB,CAAC;IAED,IAAI;QACD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC;IACpC,CAAC;CACH;AAED;;;;;;;;;;GAUG;AACH,SAAS,UAAU,CAAC,MAA8B;IAC/C,MAAM,CAAC,KAAK,EAA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KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACpG,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,MAAW,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,SAAS,CAAI,OAAmB,EAAE,EAAU;QACzC,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1D,+KAA+K;YAC/K,IAAI,KAA6B,CAAC;YAClC,OAAO,CAAC,IAAI,CACT,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