@hydranium/protocol 1.0.0-next.10

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 (254) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +81 -0
  3. package/lib/abstract-logger.d.ts +66 -0
  4. package/lib/abstract-logger.d.ts.map +1 -0
  5. package/lib/abstract-logger.js +110 -0
  6. package/lib/abstract-logger.js.map +1 -0
  7. package/lib/browser-runtime.d.ts +124 -0
  8. package/lib/browser-runtime.d.ts.map +1 -0
  9. package/lib/browser-runtime.js +11 -0
  10. package/lib/browser-runtime.js.map +1 -0
  11. package/lib/client/data-events.d.ts +49 -0
  12. package/lib/client/data-events.d.ts.map +1 -0
  13. package/lib/client/data-events.js +60 -0
  14. package/lib/client/data-events.js.map +1 -0
  15. package/lib/client/data-port.d.ts +95 -0
  16. package/lib/client/data-port.d.ts.map +1 -0
  17. package/lib/client/data-port.js +11 -0
  18. package/lib/client/data-port.js.map +1 -0
  19. package/lib/client/data-session.d.ts +129 -0
  20. package/lib/client/data-session.d.ts.map +1 -0
  21. package/lib/client/data-session.js +179 -0
  22. package/lib/client/data-session.js.map +1 -0
  23. package/lib/client/index.d.ts +39 -0
  24. package/lib/client/index.d.ts.map +1 -0
  25. package/lib/client/index.js +55 -0
  26. package/lib/client/index.js.map +1 -0
  27. package/lib/client/message-relay.d.ts +111 -0
  28. package/lib/client/message-relay.d.ts.map +1 -0
  29. package/lib/client/message-relay.js +139 -0
  30. package/lib/client/message-relay.js.map +1 -0
  31. package/lib/client/post-message-transport.d.ts +77 -0
  32. package/lib/client/post-message-transport.d.ts.map +1 -0
  33. package/lib/client/post-message-transport.js +95 -0
  34. package/lib/client/post-message-transport.js.map +1 -0
  35. package/lib/clock.d.ts +111 -0
  36. package/lib/clock.d.ts.map +1 -0
  37. package/lib/clock.js +74 -0
  38. package/lib/clock.js.map +1 -0
  39. package/lib/data/data-protocol-methods.d.ts +39 -0
  40. package/lib/data/data-protocol-methods.d.ts.map +1 -0
  41. package/lib/data/data-protocol-methods.js +61 -0
  42. package/lib/data/data-protocol-methods.js.map +1 -0
  43. package/lib/data/data-server-protocol.d.ts +264 -0
  44. package/lib/data/data-server-protocol.d.ts.map +1 -0
  45. package/lib/data/data-server-protocol.js +11 -0
  46. package/lib/data/data-server-protocol.js.map +1 -0
  47. package/lib/data/diagnostics.d.ts +97 -0
  48. package/lib/data/diagnostics.d.ts.map +1 -0
  49. package/lib/data/diagnostics.js +25 -0
  50. package/lib/data/diagnostics.js.map +1 -0
  51. package/lib/data/events.d.ts +107 -0
  52. package/lib/data/events.d.ts.map +1 -0
  53. package/lib/data/events.js +11 -0
  54. package/lib/data/events.js.map +1 -0
  55. package/lib/data/index.d.ts +15 -0
  56. package/lib/data/index.d.ts.map +1 -0
  57. package/lib/data/index.js +38 -0
  58. package/lib/data/index.js.map +1 -0
  59. package/lib/data/methods.d.ts +57 -0
  60. package/lib/data/methods.d.ts.map +1 -0
  61. package/lib/data/methods.js +60 -0
  62. package/lib/data/methods.js.map +1 -0
  63. package/lib/data/requests.d.ts +65 -0
  64. package/lib/data/requests.d.ts.map +1 -0
  65. package/lib/data/requests.js +11 -0
  66. package/lib/data/requests.js.map +1 -0
  67. package/lib/debouncer.d.ts +75 -0
  68. package/lib/debouncer.d.ts.map +1 -0
  69. package/lib/debouncer.js +91 -0
  70. package/lib/debouncer.js.map +1 -0
  71. package/lib/errors.d.ts +84 -0
  72. package/lib/errors.d.ts.map +1 -0
  73. package/lib/errors.js +113 -0
  74. package/lib/errors.js.map +1 -0
  75. package/lib/host-diagnostics.d.ts +58 -0
  76. package/lib/host-diagnostics.d.ts.map +1 -0
  77. package/lib/host-diagnostics.js +18 -0
  78. package/lib/host-diagnostics.js.map +1 -0
  79. package/lib/index.d.ts +34 -0
  80. package/lib/index.d.ts.map +1 -0
  81. package/lib/index.js +56 -0
  82. package/lib/index.js.map +1 -0
  83. package/lib/latency-collector.d.ts +126 -0
  84. package/lib/latency-collector.d.ts.map +1 -0
  85. package/lib/latency-collector.js +137 -0
  86. package/lib/latency-collector.js.map +1 -0
  87. package/lib/logger.d.ts +119 -0
  88. package/lib/logger.d.ts.map +1 -0
  89. package/lib/logger.js +126 -0
  90. package/lib/logger.js.map +1 -0
  91. package/lib/model-server.d.ts +352 -0
  92. package/lib/model-server.d.ts.map +1 -0
  93. package/lib/model-server.js +160 -0
  94. package/lib/model-server.js.map +1 -0
  95. package/lib/model-service/args.d.ts +64 -0
  96. package/lib/model-service/args.d.ts.map +1 -0
  97. package/lib/model-service/args.js +11 -0
  98. package/lib/model-service/args.js.map +1 -0
  99. package/lib/model-service/index.d.ts +11 -0
  100. package/lib/model-service/index.d.ts.map +1 -0
  101. package/lib/model-service/index.js +31 -0
  102. package/lib/model-service/index.js.map +1 -0
  103. package/lib/model-service/reference-candidate.d.ts +56 -0
  104. package/lib/model-service/reference-candidate.d.ts.map +1 -0
  105. package/lib/model-service/reference-candidate.js +11 -0
  106. package/lib/model-service/reference-candidate.js.map +1 -0
  107. package/lib/noop-logger.d.ts +25 -0
  108. package/lib/noop-logger.d.ts.map +1 -0
  109. package/lib/noop-logger.js +36 -0
  110. package/lib/noop-logger.js.map +1 -0
  111. package/lib/observable-value.d.ts +72 -0
  112. package/lib/observable-value.d.ts.map +1 -0
  113. package/lib/observable-value.js +52 -0
  114. package/lib/observable-value.js.map +1 -0
  115. package/lib/patch-merge.d.ts +123 -0
  116. package/lib/patch-merge.d.ts.map +1 -0
  117. package/lib/patch-merge.js +104 -0
  118. package/lib/patch-merge.js.map +1 -0
  119. package/lib/profile-session.d.ts +87 -0
  120. package/lib/profile-session.d.ts.map +1 -0
  121. package/lib/profile-session.js +98 -0
  122. package/lib/profile-session.js.map +1 -0
  123. package/lib/profiling.d.ts +83 -0
  124. package/lib/profiling.d.ts.map +1 -0
  125. package/lib/profiling.js +20 -0
  126. package/lib/profiling.js.map +1 -0
  127. package/lib/project.d.ts +121 -0
  128. package/lib/project.d.ts.map +1 -0
  129. package/lib/project.js +34 -0
  130. package/lib/project.js.map +1 -0
  131. package/lib/rpc/bind-rpc-methods.d.ts +100 -0
  132. package/lib/rpc/bind-rpc-methods.d.ts.map +1 -0
  133. package/lib/rpc/bind-rpc-methods.js +110 -0
  134. package/lib/rpc/bind-rpc-methods.js.map +1 -0
  135. package/lib/rpc/create-rpc-proxy.d.ts +188 -0
  136. package/lib/rpc/create-rpc-proxy.d.ts.map +1 -0
  137. package/lib/rpc/create-rpc-proxy.js +158 -0
  138. package/lib/rpc/create-rpc-proxy.js.map +1 -0
  139. package/lib/rpc/index.d.ts +12 -0
  140. package/lib/rpc/index.d.ts.map +1 -0
  141. package/lib/rpc/index.js +31 -0
  142. package/lib/rpc/index.js.map +1 -0
  143. package/lib/rpc/wire-prefix.d.ts +37 -0
  144. package/lib/rpc/wire-prefix.d.ts.map +1 -0
  145. package/lib/rpc/wire-prefix.js +49 -0
  146. package/lib/rpc/wire-prefix.js.map +1 -0
  147. package/lib/testing/data-doubles.d.ts +121 -0
  148. package/lib/testing/data-doubles.d.ts.map +1 -0
  149. package/lib/testing/data-doubles.js +102 -0
  150. package/lib/testing/data-doubles.js.map +1 -0
  151. package/lib/testing/fake-clock.d.ts +35 -0
  152. package/lib/testing/fake-clock.d.ts.map +1 -0
  153. package/lib/testing/fake-clock.js +86 -0
  154. package/lib/testing/fake-clock.js.map +1 -0
  155. package/lib/testing/harness.d.ts +24 -0
  156. package/lib/testing/harness.d.ts.map +1 -0
  157. package/lib/testing/harness.js +11 -0
  158. package/lib/testing/harness.js.map +1 -0
  159. package/lib/testing/index.d.ts +13 -0
  160. package/lib/testing/index.d.ts.map +1 -0
  161. package/lib/testing/index.js +41 -0
  162. package/lib/testing/index.js.map +1 -0
  163. package/lib/testing/node/duplex-connection.d.ts +25 -0
  164. package/lib/testing/node/duplex-connection.d.ts.map +1 -0
  165. package/lib/testing/node/duplex-connection.js +34 -0
  166. package/lib/testing/node/duplex-connection.js.map +1 -0
  167. package/lib/testing/node/duplex-stream.d.ts +32 -0
  168. package/lib/testing/node/duplex-stream.d.ts.map +1 -0
  169. package/lib/testing/node/duplex-stream.js +35 -0
  170. package/lib/testing/node/duplex-stream.js.map +1 -0
  171. package/lib/testing/node/index.d.ts +11 -0
  172. package/lib/testing/node/index.d.ts.map +1 -0
  173. package/lib/testing/node/index.js +37 -0
  174. package/lib/testing/node/index.js.map +1 -0
  175. package/lib/testing/wait-for.d.ts +69 -0
  176. package/lib/testing/wait-for.d.ts.map +1 -0
  177. package/lib/testing/wait-for.js +67 -0
  178. package/lib/testing/wait-for.js.map +1 -0
  179. package/lib/tracer.d.ts +115 -0
  180. package/lib/tracer.d.ts.map +1 -0
  181. package/lib/tracer.js +205 -0
  182. package/lib/tracer.js.map +1 -0
  183. package/lib/transfer-diagnostic.d.ts +73 -0
  184. package/lib/transfer-diagnostic.d.ts.map +1 -0
  185. package/lib/transfer-diagnostic.js +45 -0
  186. package/lib/transfer-diagnostic.js.map +1 -0
  187. package/lib/transfer-document.d.ts +73 -0
  188. package/lib/transfer-document.d.ts.map +1 -0
  189. package/lib/transfer-document.js +46 -0
  190. package/lib/transfer-document.js.map +1 -0
  191. package/lib/transfer-element.d.ts +39 -0
  192. package/lib/transfer-element.d.ts.map +1 -0
  193. package/lib/transfer-element.js +11 -0
  194. package/lib/transfer-element.js.map +1 -0
  195. package/lib/uri.d.ts +62 -0
  196. package/lib/uri.d.ts.map +1 -0
  197. package/lib/uri.js +28 -0
  198. package/lib/uri.js.map +1 -0
  199. package/lib/util.d.ts +147 -0
  200. package/lib/util.d.ts.map +1 -0
  201. package/lib/util.js +211 -0
  202. package/lib/util.js.map +1 -0
  203. package/package.json +100 -0
  204. package/src/abstract-logger.ts +120 -0
  205. package/src/browser-runtime.ts +135 -0
  206. package/src/client/data-events.ts +71 -0
  207. package/src/client/data-port.ts +99 -0
  208. package/src/client/data-session.ts +209 -0
  209. package/src/client/index.ts +40 -0
  210. package/src/client/message-relay.ts +216 -0
  211. package/src/client/post-message-transport.ts +167 -0
  212. package/src/clock.ts +173 -0
  213. package/src/data/data-protocol-methods.ts +79 -0
  214. package/src/data/data-server-protocol.ts +296 -0
  215. package/src/data/diagnostics.ts +116 -0
  216. package/src/data/events.ts +127 -0
  217. package/src/data/index.ts +23 -0
  218. package/src/data/methods.ts +59 -0
  219. package/src/data/requests.ts +70 -0
  220. package/src/debouncer.ts +118 -0
  221. package/src/errors.ts +127 -0
  222. package/src/host-diagnostics.ts +63 -0
  223. package/src/index.ts +41 -0
  224. package/src/latency-collector.ts +231 -0
  225. package/src/logger.ts +172 -0
  226. package/src/model-server.ts +479 -0
  227. package/src/model-service/args.ts +67 -0
  228. package/src/model-service/index.ts +16 -0
  229. package/src/model-service/reference-candidate.ts +58 -0
  230. package/src/noop-logger.ts +36 -0
  231. package/src/observable-value.ts +92 -0
  232. package/src/patch-merge.ts +165 -0
  233. package/src/profile-session.ts +164 -0
  234. package/src/profiling.ts +113 -0
  235. package/src/project.ts +125 -0
  236. package/src/rpc/README.md +163 -0
  237. package/src/rpc/bind-rpc-methods.ts +180 -0
  238. package/src/rpc/create-rpc-proxy.ts +292 -0
  239. package/src/rpc/index.ts +16 -0
  240. package/src/rpc/wire-prefix.ts +48 -0
  241. package/src/testing/data-doubles.ts +178 -0
  242. package/src/testing/fake-clock.ts +106 -0
  243. package/src/testing/harness.ts +24 -0
  244. package/src/testing/index.ts +26 -0
  245. package/src/testing/node/duplex-connection.ts +50 -0
  246. package/src/testing/node/duplex-stream.ts +51 -0
  247. package/src/testing/node/index.ts +22 -0
  248. package/src/testing/wait-for.ts +94 -0
  249. package/src/tracer.ts +277 -0
  250. package/src/transfer-diagnostic.ts +92 -0
  251. package/src/transfer-document.ts +99 -0
  252. package/src/transfer-element.ts +43 -0
  253. package/src/uri.ts +61 -0
  254. package/src/util.ts +250 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CrossBreeze, EclipseSource and others.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # `@hydranium/protocol`
2
+
3
+ Generic, language-agnostic types, constants, and pure utilities for the
4
+ [Hydranium](https://github.com/eclipse-emfcloud/hydranium) framework.
5
+
6
+ This package is the contract surface shared between hydranium servers and
7
+ their clients. It contains:
8
+
9
+ - Cross-reference and reference-resolution types.
10
+ - The `TransferDocument<TTransfer, TDiagnostic>` transfer-document wrapper.
11
+ - The generic `DataServerProtocol` and `DataClientProtocol` RPC interfaces.
12
+ - Pure utility functions and version constants.
13
+
14
+ **Dependency budget:** one runtime dependency, `fast-json-patch`. Anything
15
+ heavier (transport, Inversify, Theia, Langium runtime) lives in consuming
16
+ packages.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ npm install @hydranium/protocol
22
+ ```
23
+
24
+ This is the only hydranium package a pure client needs. A form editor, a tree
25
+ view or a code generator talking to the data head depends on this and on
26
+ `vscode-jsonrpc` for the transport — never on `@hydranium/core`, which carries
27
+ the Langium runtime and does not bundle for a client.
28
+
29
+ ## The RPC pattern
30
+
31
+ The data head is not a bespoke wire format — it is a TypeScript interface, bound
32
+ on one side and proxied on the other. An adopter declares a contract `T`, binds
33
+ it with `bindRpcMethods`, and consumes it with `createRpcProxy<T>`; nothing
34
+ between the two is hand-written, and the compiler is what keeps the ends
35
+ agreeing.
36
+
37
+ ```
38
+ adopter contract T adopter contract T
39
+ │ │
40
+ ▼ ▼
41
+ bindRpcMethods createRpcProxy<T>
42
+ (server side) (caller side)
43
+ │ │
44
+ └──── MessageConnection ──────────────┘
45
+ (vscode-jsonrpc)
46
+ ```
47
+
48
+ The two helpers are deliberately symmetric — the same wire-name composition
49
+ rule, the same notification heuristic, the same deferred-connection support — so
50
+ a contract written once works on both ends with no per-method configuration.
51
+ Both are exported from the package root; there is no `/rpc` subpath.
52
+
53
+ Full reference — the options both ends must agree on, the reserved property
54
+ names, a worked example — is in
55
+ [`src/rpc/README.md`](./src/rpc/README.md), which ships in the tarball.
56
+
57
+ ## Subpaths
58
+
59
+ ```bash
60
+ @hydranium/protocol # transfer documents, references, RPC machinery
61
+ @hydranium/protocol/data # DataServerProtocol / DataClientProtocol
62
+ @hydranium/protocol/client # the host-neutral client tier
63
+ @hydranium/protocol/testing # test doubles and waiters
64
+ @hydranium/protocol/testing/node # the Node-only doubles
65
+ ```
66
+
67
+ The root barrel re-exports `data` and `client`, so those two subpaths buy a
68
+ narrower surface rather than reach; `testing` is only reachable by its own
69
+ specifier, which is what keeps the doubles out of a production bundle. The RPC
70
+ machinery documents itself in [`src/rpc/README.md`](./src/rpc/README.md).
71
+
72
+ ## Status
73
+
74
+ Alpha — pre-v0. The package is being populated incrementally, and its API is
75
+ not yet stable. See the [repository README](../../README.md) for the current
76
+ status and known limitations.
77
+
78
+ ## License
79
+
80
+ `MIT` — see this package's [`LICENSE`](./LICENSE), and the repository
81
+ [`NOTICE.md`](../../NOTICE.md) for third-party notices.
@@ -0,0 +1,66 @@
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 Clock } from './clock';
10
+ import { type LogLevel, Logger, type LogThreshold } from './logger';
11
+ /**
12
+ * Cross-side abstract base for the {@link Logger} family. Centralises:
13
+ * - the {@link LogLevel}/{@link LogThreshold} contract and threshold gating;
14
+ * - public `error`/`warn`/`info`/`debug`/`trace`/`log` methods;
15
+ * - component-prefix derivation ({@link for}, {@link sub}, {@link with}, {@link withUri}).
16
+ *
17
+ * Emission only — measuring (timing, memory, profiling) lives on the
18
+ * `Tracer`, which composes a Logger for its output.
19
+ * Subclasses provide platform-specific output via {@link emit} and instance
20
+ * creation via {@link derive}. Format is `[<Label> - HH:MM:SS.mmm]
21
+ * [<component>] <message>` so client and server lines interleave cleanly under
22
+ * one Output panel entry.
23
+ */
24
+ export declare abstract class AbstractLogger implements Logger {
25
+ protected component?: string | undefined;
26
+ constructor(component?: string | undefined);
27
+ /**
28
+ * Time source for this logger's timing helpers and timestamps. The base
29
+ * returns the process-wide {@link SystemClock}; subclasses with access to
30
+ * an injected {@link Clock} override this so logger time goes through the
31
+ * same fake-clock axis as the rest of the framework's gated logic. Inherited
32
+ * by derived loggers ({@link derive}), so a subclass override applies to its
33
+ * children without any extra wiring.
34
+ */
35
+ protected clock(): Clock;
36
+ /** Render the current wall-clock instant as `HH:MM:SS.mmm`, sourced from {@link clock}. */
37
+ protected timestamp(): string;
38
+ error(message?: string, ...args: unknown[]): this;
39
+ warn(message?: string, ...args: unknown[]): this;
40
+ info(message?: string, ...args: unknown[]): this;
41
+ debug(message?: string, ...args: unknown[]): this;
42
+ /** High-volume diagnostic lines, only emitted when the log level is set to 'trace'. */
43
+ trace(message?: string, ...args: unknown[]): this;
44
+ /** Info-level threshold rendered with the `Log` label instead of `Info`. */
45
+ log(message?: string, ...args: unknown[]): this;
46
+ /** Emit `message` at `threshold`, or do nothing when `threshold === 'off'`. */
47
+ logAt(threshold: LogThreshold, message: string): this;
48
+ /** Replace the component prefix with `component`. */
49
+ for(component: string): this;
50
+ /** Append `component` to the existing prefix as a nested `parent :: child` segment. */
51
+ sub(component: string): this;
52
+ /** Append `component` as a separate bracket: `[a] [b]` rather than `[a :: b]`. */
53
+ with(component: string): this;
54
+ /**
55
+ * Default URI labelling: stringify the URI. Subclasses with workspace
56
+ * awareness override to render workspace-relative paths.
57
+ */
58
+ withUri(uri: string): this;
59
+ /** Threshold-gated send. Subclasses can override the label by passing one explicitly. */
60
+ protected send(level: LogLevel, message?: string, args?: readonly unknown[], label?: string): void;
61
+ /** Subclasses implement platform-specific output (console + file sink, OutputChannel, etc.). */
62
+ protected abstract emit(level: LogLevel, label: string, message: string, args: readonly unknown[]): void;
63
+ /** Subclasses construct a new instance preserving their constructor dependencies. */
64
+ protected abstract derive(component: string): this;
65
+ }
66
+ //# sourceMappingURL=abstract-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-logger.d.ts","sourceRoot":"","sources":["../src/abstract-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,SAAS,CAAC;AAClD,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAK1F;;;;;;;;;;;;GAYG;AACH,8BAAsB,cAAe,YAAW,MAAM;IACvC,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM;gBAAlB,SAAS,CAAC,EAAE,MAAM,YAAA;IAExC;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,IAAI,KAAK;IAIxB,2FAA2F;IAC3F,SAAS,CAAC,SAAS,IAAI,MAAM;IAI7B,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,G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AC,SAAS,EAAE,MAAM,GAAG,IAAI;CACpD"}
@@ -0,0 +1,110 @@
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.AbstractLogger = void 0;
12
+ const clock_1 = require("./clock");
13
+ const logger_1 = require("./logger");
14
+ /** Default time source for every {@link AbstractLogger}; overridable per subclass via {@link AbstractLogger.clock}. */
15
+ const systemClock = new clock_1.SystemClock();
16
+ /**
17
+ * Cross-side abstract base for the {@link Logger} family. Centralises:
18
+ * - the {@link LogLevel}/{@link LogThreshold} contract and threshold gating;
19
+ * - public `error`/`warn`/`info`/`debug`/`trace`/`log` methods;
20
+ * - component-prefix derivation ({@link for}, {@link sub}, {@link with}, {@link withUri}).
21
+ *
22
+ * Emission only — measuring (timing, memory, profiling) lives on the
23
+ * `Tracer`, which composes a Logger for its output.
24
+ * Subclasses provide platform-specific output via {@link emit} and instance
25
+ * creation via {@link derive}. Format is `[<Label> - HH:MM:SS.mmm]
26
+ * [<component>] <message>` so client and server lines interleave cleanly under
27
+ * one Output panel entry.
28
+ */
29
+ class AbstractLogger {
30
+ component;
31
+ constructor(component) {
32
+ this.component = component;
33
+ }
34
+ /**
35
+ * Time source for this logger's timing helpers and timestamps. The base
36
+ * returns the process-wide {@link SystemClock}; subclasses with access to
37
+ * an injected {@link Clock} override this so logger time goes through the
38
+ * same fake-clock axis as the rest of the framework's gated logic. Inherited
39
+ * by derived loggers ({@link derive}), so a subclass override applies to its
40
+ * children without any extra wiring.
41
+ */
42
+ clock() {
43
+ return systemClock;
44
+ }
45
+ /** Render the current wall-clock instant as `HH:MM:SS.mmm`, sourced from {@link clock}. */
46
+ timestamp() {
47
+ return logger_1.Format.timestamp(new Date(this.clock().now()));
48
+ }
49
+ error(message, ...args) {
50
+ this.send('error', message, args);
51
+ return this;
52
+ }
53
+ warn(message, ...args) {
54
+ this.send('warn', message, args);
55
+ return this;
56
+ }
57
+ info(message, ...args) {
58
+ this.send('info', message, args);
59
+ return this;
60
+ }
61
+ debug(message, ...args) {
62
+ this.send('debug', message, args);
63
+ return this;
64
+ }
65
+ /** High-volume diagnostic lines, only emitted when the log level is set to 'trace'. */
66
+ trace(message, ...args) {
67
+ this.send('trace', message, args);
68
+ return this;
69
+ }
70
+ /** Info-level threshold rendered with the `Log` label instead of `Info`. */
71
+ log(message, ...args) {
72
+ this.send('info', message, args, 'Log');
73
+ return this;
74
+ }
75
+ /** Emit `message` at `threshold`, or do nothing when `threshold === 'off'`. */
76
+ logAt(threshold, message) {
77
+ if (threshold === 'off') {
78
+ return this;
79
+ }
80
+ return this[threshold](message);
81
+ }
82
+ /** Replace the component prefix with `component`. */
83
+ for(component) {
84
+ return this.derive(component);
85
+ }
86
+ /** Append `component` to the existing prefix as a nested `parent :: child` segment. */
87
+ sub(component) {
88
+ return this.derive(this.component ? `${this.component} :: ${component}` : component);
89
+ }
90
+ /** Append `component` as a separate bracket: `[a] [b]` rather than `[a :: b]`. */
91
+ with(component) {
92
+ return this.derive(this.component ? `${this.component}] [${component}` : component);
93
+ }
94
+ /**
95
+ * Default URI labelling: stringify the URI. Subclasses with workspace
96
+ * awareness override to render workspace-relative paths.
97
+ */
98
+ withUri(uri) {
99
+ return this.with(uri);
100
+ }
101
+ /** Threshold-gated send. Subclasses can override the label by passing one explicitly. */
102
+ send(level, message, args = [], label = logger_1.LEVEL_LABELS[level]) {
103
+ if (!message || !logger_1.Logger.isLevelEnabled(level)) {
104
+ return;
105
+ }
106
+ this.emit(level, label, message, args);
107
+ }
108
+ }
109
+ exports.AbstractLogger = AbstractLogger;
110
+ //# sourceMappingURL=abstract-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-logger.js","sourceRoot":"","sources":["../src/abstract-logger.ts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,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CAOH;AA3FD,wCA2FC"}
@@ -0,0 +1,124 @@
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
+ * One renderer-runtime reading — JS-heap + precise-renderer-memory + object/render
11
+ * counters, every field optional (a counter a source cannot produce is omitted).
12
+ */
13
+ export interface BrowserRuntimeSample {
14
+ /** JS heap used (CDP `JSHeapUsedSize` / `performance.memory.usedJSHeapSize`). */
15
+ jsHeapUsedBytes?: number;
16
+ /** JS heap total (CDP `JSHeapTotalSize` / `performance.memory.totalJSHeapSize`). */
17
+ jsHeapTotalBytes?: number;
18
+ /** JS heap limit (`performance.memory.jsHeapSizeLimit`; CDP does not report it). */
19
+ jsHeapLimitBytes?: number;
20
+ /** Total renderer memory across JS/DOM/workers (`measureUserAgentSpecificMemory` only). */
21
+ totalBytes?: number;
22
+ /** The precise API's per-type/per-container breakdown, passed through verbatim. */
23
+ breakdown?: unknown;
24
+ /** DOM node count (CDP `Nodes`) — a rising count is the classic Theia leak tell. */
25
+ nodes?: number;
26
+ /** Registered JS event listeners (CDP `JSEventListeners`) — the other leak tell. */
27
+ jsEventListeners?: number;
28
+ /** Live `Document` count (CDP `Documents`). */
29
+ documents?: number;
30
+ /** Frame count (CDP `Frames`). */
31
+ frames?: number;
32
+ /** Cumulative layout operations (CDP `LayoutCount`). */
33
+ layoutCount?: number;
34
+ /** Cumulative style recalculations (CDP `RecalcStyleCount`). */
35
+ recalcStyleCount?: number;
36
+ }
37
+ /**
38
+ * The `browser-runtime.json` artefact — renderer memory + object/render counters,
39
+ * graded by `source`. `before`/`after`/`delta` are present for a two-point source
40
+ * (CDP, before vs after the scenario — the delta is the leak signal); `after`-only
41
+ * for a single gauge read (the live "Dump Frontend State" command).
42
+ *
43
+ * - `cdp-performance` — full: JS heap + `nodes`/`jsEventListeners`/`documents`/
44
+ * `frames`/`layoutCount`/`recalcStyleCount`; two-point.
45
+ * - `measureUserAgentSpecificMemory` — precise renderer bytes by type/container
46
+ * (`totalBytes`/`breakdown`; cross-origin isolation only); after-only.
47
+ * - `performance.memory` — JS-heap gauge only (used/total/limit); after-only.
48
+ * - `unavailable` — neither API; `after` is empty.
49
+ */
50
+ export interface BrowserRuntimeReport {
51
+ /**
52
+ * Which API produced the reading, and therefore which sample fields CAN be
53
+ * populated — a reader must branch on it rather than assume a field is
54
+ * missing because the value was zero. Not a caller preference: each producer
55
+ * tries its best source and degrades, so the same code path can emit any of
56
+ * the four across runs.
57
+ */
58
+ source: 'cdp-performance' | 'measureUserAgentSpecificMemory' | 'performance.memory' | 'unavailable';
59
+ /**
60
+ * The pre-scenario reading, present only for a two-point capture. Its absence
61
+ * is what marks a report as a single gauge read, and {@link delta} is then
62
+ * absent with it.
63
+ */
64
+ before?: BrowserRuntimeSample;
65
+ /**
66
+ * The post-scenario reading, or the only reading for a single-point capture.
67
+ * Always present — an `unavailable` source yields an EMPTY object here rather
68
+ * than omitting the field, so presence proves nothing about content.
69
+ */
70
+ after: BrowserRuntimeSample;
71
+ /**
72
+ * Per-field `after − before`, computed only for the numeric CDP counters and
73
+ * only where both samples carry the field, so a counter can appear in
74
+ * {@link after} and be absent here. Positive means growth over the scenario,
75
+ * which on `nodes` or `jsEventListeners` is the leak signal the two-point
76
+ * capture exists for.
77
+ */
78
+ delta?: BrowserRuntimeSample;
79
+ }
80
+ /** One main-thread timeline entry — a `longtask` (jank) or a user-timing `measure` span. */
81
+ export interface BrowserTimelineEntry {
82
+ /**
83
+ * The runtime's own label — an attribution name for a long task, the app's
84
+ * mark name for a user-timing span. Not unique: one name recurs once per
85
+ * occurrence.
86
+ */
87
+ name: string;
88
+ /**
89
+ * The `PerformanceEntry` type. Only `longtask` and `measure` are observed,
90
+ * and only where the runtime lists them as supported — but the field is left
91
+ * open rather than a union, because it carries whatever the entry reported.
92
+ */
93
+ entryType: string;
94
+ /**
95
+ * Milliseconds from the PAGE's time origin (the `performance.now` domain).
96
+ * Not wall-clock: it cannot be compared with a server timestamp, with a
97
+ * `Date.now` reading, or with an entry captured from another page.
98
+ */
99
+ startTimeMs: number;
100
+ /**
101
+ * Milliseconds the entry spanned — main-thread blocking time for a long
102
+ * task, which the platform only reports above 50ms, and the mark-to-mark
103
+ * span for a `measure`.
104
+ */
105
+ durationMs: number;
106
+ }
107
+ /** Both browser-origin signals of one capture — the runtime report and the main-thread timeline. */
108
+ export interface BrowserStateReport {
109
+ /**
110
+ * The page-side single-point read taken at capture time. A caller holding a
111
+ * CDP session is expected to supersede it with the richer two-point report
112
+ * before writing `browser-runtime.json`, so this field is the floor rather
113
+ * than the final artefact.
114
+ */
115
+ runtime: BrowserRuntimeReport;
116
+ /**
117
+ * Entries in observer-delivery order, covering the span between starting the
118
+ * recorder and this capture. Empty carries two meanings this shape cannot
119
+ * separate — nothing janked, or the recorder was never started and the
120
+ * runtime supports neither entry type.
121
+ */
122
+ timeline: BrowserTimelineEntry[];
123
+ }
124
+ //# sourceMappingURL=browser-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-runtime.d.ts","sourceRoot":"","sources":["../src/browser-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAUlF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IAClC,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAoB;IAClC;;;;;;OAMG;IACH,MAAM,EAAE,iBAAiB,GAAG,gCAAgC,GAAG,oBAAoB,GAAG,aAAa,CAAC;IACpG;;;;OAIG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B;;;;OAIG;IACH,KAAK,EAAE,oBAAoB,CAAC;IAC5B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED,4FAA4F;AAC5F,MAAM,WAAW,oBAAoB;IAClC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACrB;AAED,oGAAoG;AACpG,MAAM,WAAW,kBAAkB;IAChC;;;;;OAKG;IACH,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,EAAE,oBAAoB,EAAE,CAAC;CACnC"}
@@ -0,0 +1,11 @@
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
+ //# sourceMappingURL=browser-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-runtime.js","sourceRoot":"","sources":["../src/browser-runtime.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF"}
@@ -0,0 +1,49 @@
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 { Emitter, type Event } from 'vscode-jsonrpc';
10
+ import type { DataClientProtocol, ProjectsChangedEvent, TransferDocumentSavedEvent, TransferDocumentUpdatedEvent } from '../data';
11
+ import type { Project } from '../project';
12
+ import type { TransferDiagnostic } from '../transfer-diagnostic';
13
+ import type { TransferElement } from '../transfer-element';
14
+ /**
15
+ * The inbound half of a data connection, fanned out to local listeners.
16
+ *
17
+ * A connection has exactly one `DataClientProtocol` bound to it, so whoever
18
+ * that is becomes the only thing able to see server pushes. That does not suit
19
+ * a host with more than one interested party — a properties panel, a tree, a
20
+ * status contribution — so this sits in the slot instead and re-emits.
21
+ *
22
+ * The `on*` methods are the WIRE names, matched against
23
+ * `DATA_CLIENT_PROTOCOL_METHODS`; the `onDid*` events are the local ones.
24
+ * Keeping the two sets of names distinct is what makes it obvious which side of
25
+ * the boundary a given member belongs to.
26
+ *
27
+ * **Relationship to `@hydranium/data-client-theia`'s `EmitterDataClient`: two
28
+ * host flavours of one idea, not a duplicate to be collapsed.** The difference
29
+ * is the event type: `EmitterDataClient` fans out to a `@theia/core` `Event`,
30
+ * which is what a Theia frontend's `@injectable()` client wants, while this one
31
+ * uses vscode-jsonrpc's and is therefore usable from a webview or a plain
32
+ * browser client too. Pick by host; neither is deprecated.
33
+ */
34
+ export declare class DataEvents<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic, TProject extends Project = Project> implements DataClientProtocol<TTransfer, TDiagnostic, TProject> {
35
+ protected readonly documentUpdatedEmitter: Emitter<TransferDocumentUpdatedEvent<TTransfer, TDiagnostic>>;
36
+ protected readonly documentSavedEmitter: Emitter<TransferDocumentSavedEvent<TTransfer, TDiagnostic>>;
37
+ protected readonly projectsChangedEmitter: Emitter<ProjectsChangedEvent<TProject>>;
38
+ /** A build-phase event for a watched document. Carries the originating `sourceClientId`. */
39
+ readonly onDidUpdateDocument: Event<TransferDocumentUpdatedEvent<TTransfer, TDiagnostic>>;
40
+ /** A watched document was persisted to disk. */
41
+ readonly onDidSaveDocument: Event<TransferDocumentSavedEvent<TTransfer, TDiagnostic>>;
42
+ /** The project set changed. */
43
+ readonly onDidChangeProjects: Event<ProjectsChangedEvent<TProject>>;
44
+ onDocumentUpdated(event: TransferDocumentUpdatedEvent<TTransfer, TDiagnostic>): void;
45
+ onDocumentSaved(event: TransferDocumentSavedEvent<TTransfer, TDiagnostic>): void;
46
+ onProjectsChanged(event: ProjectsChangedEvent<TProject>): void;
47
+ dispose(): void;
48
+ }
49
+ //# sourceMappingURL=data-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-events.d.ts","sourceRoot":"","sources":["../../src/client/data-events.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAClI,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,UAAU,CACpB,SAAS,SAAS,eAAe,EACjC,WAAW,SAAS,kBAAkB,GAAG,kBAAkB,EAC3D,QAAQ,SAAS,OAAO,GAAG,OAAO,CACnC,YAAW,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC;IAC9D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,gEAAuE;IAChH,SAAS,CAAC,QAAQ,CAAC,oBAAoB,8DAAqE;IAC5G,SAAS,CAAC,QAAQ,CAAC,sBAAsB,0CAAiD;IAE1F,4FAA4F;IAC5F,QAAQ,CAAC,mBAAmB,EAAE,KAAK,CAAC,4BAA4B,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAqC;IAC9H,gDAAgD;IAChD,QAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,0BAA0B,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAmC;IACxH,+BAA+B;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,KAAK,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAqC;IAIxG,iBAAiB,CAAC,KAAK,EAAE,4BAA4B,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,IAAI;IAIpF,eAAe,CAAC,KAAK,EAAE,0BAA0B,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,IAAI;IAIhF,iBAAiB,CAAC,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,IAAI;IAI9D,OAAO,IAAI,IAAI;CAKjB"}
@@ -0,0 +1,60 @@
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.DataEvents = void 0;
12
+ const vscode_jsonrpc_1 = require("vscode-jsonrpc");
13
+ /**
14
+ * The inbound half of a data connection, fanned out to local listeners.
15
+ *
16
+ * A connection has exactly one `DataClientProtocol` bound to it, so whoever
17
+ * that is becomes the only thing able to see server pushes. That does not suit
18
+ * a host with more than one interested party — a properties panel, a tree, a
19
+ * status contribution — so this sits in the slot instead and re-emits.
20
+ *
21
+ * The `on*` methods are the WIRE names, matched against
22
+ * `DATA_CLIENT_PROTOCOL_METHODS`; the `onDid*` events are the local ones.
23
+ * Keeping the two sets of names distinct is what makes it obvious which side of
24
+ * the boundary a given member belongs to.
25
+ *
26
+ * **Relationship to `@hydranium/data-client-theia`'s `EmitterDataClient`: two
27
+ * host flavours of one idea, not a duplicate to be collapsed.** The difference
28
+ * is the event type: `EmitterDataClient` fans out to a `@theia/core` `Event`,
29
+ * which is what a Theia frontend's `@injectable()` client wants, while this one
30
+ * uses vscode-jsonrpc's and is therefore usable from a webview or a plain
31
+ * browser client too. Pick by host; neither is deprecated.
32
+ */
33
+ class DataEvents {
34
+ documentUpdatedEmitter = new vscode_jsonrpc_1.Emitter();
35
+ documentSavedEmitter = new vscode_jsonrpc_1.Emitter();
36
+ projectsChangedEmitter = new vscode_jsonrpc_1.Emitter();
37
+ /** A build-phase event for a watched document. Carries the originating `sourceClientId`. */
38
+ onDidUpdateDocument = this.documentUpdatedEmitter.event;
39
+ /** A watched document was persisted to disk. */
40
+ onDidSaveDocument = this.documentSavedEmitter.event;
41
+ /** The project set changed. */
42
+ onDidChangeProjects = this.projectsChangedEmitter.event;
43
+ // --- DataClientProtocol (wire names) ---
44
+ onDocumentUpdated(event) {
45
+ this.documentUpdatedEmitter.fire(event);
46
+ }
47
+ onDocumentSaved(event) {
48
+ this.documentSavedEmitter.fire(event);
49
+ }
50
+ onProjectsChanged(event) {
51
+ this.projectsChangedEmitter.fire(event);
52
+ }
53
+ dispose() {
54
+ this.documentUpdatedEmitter.dispose();
55
+ this.documentSavedEmitter.dispose();
56
+ this.projectsChangedEmitter.dispose();
57
+ }
58
+ }
59
+ exports.DataEvents = DataEvents;
60
+ //# sourceMappingURL=data-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-events.js","sourceRoot":"","sources":["../../src/client/data-events.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,mDAAqD;AAMrD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,UAAU;IAKD,sBAAsB,GAAG,IAAI,wBAAO,EAAwD,CAAC;IAC7F,oBAAoB,GAAG,IAAI,wBAAO,EAAsD,CAAC;IACzF,sBAAsB,GAAG,IAAI,wBAAO,EAAkC,CAAC;IAE1F,4FAA4F;IACnF,mBAAmB,GAAgE,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC;IAC9H,gDAAgD;IACvC,iBAAiB,GAA8D,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC;IACxH,+BAA+B;IACtB,mBAAmB,GAA0C,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC;IAExG,0CAA0C;IAE1C,iBAAiB,CAAC,KAA2D;QAC1E,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,eAAe,CAAC,KAAyD;QACtE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,iBAAiB,CAAC,KAAqC;QACpD,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO;QACJ,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,CAAC;QACtC,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;CACH;AAnCD,gCAmCC"}
@@ -0,0 +1,95 @@
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 { Event, MessageConnection } from 'vscode-jsonrpc';
10
+ /**
11
+ * The one thing a host has to supply for the data head: a live JSON-RPC
12
+ * connection to the data server, plus the identity and failure sink that go
13
+ * with it.
14
+ *
15
+ * "Port" in the hexagonal sense — the host implements it, `DataSession`
16
+ * consumes it, and nothing on either side of the boundary imports the other.
17
+ *
18
+ * **This deliberately does NOT wrap the protocol methods.** `createRpcProxy`
19
+ * already takes a promise of a connection and produces the whole typed
20
+ * `DataServerProtocol` surface, so wrapping it would re-derive the framework's
21
+ * pass-throughs in a second place and lose the `as const satisfies keyof`
22
+ * method allowlists, which cannot drift. Everything a form or a tree actually
23
+ * does — the wire contract, the open/watch/update/close sequence, `baseVersion`
24
+ * conflict handling, echo filtering by `sourceClientId` — is host-invariant and
25
+ * lives above this interface. What varies between hosts is exactly the four
26
+ * members below.
27
+ *
28
+ * **Why the transport hop and not merely the protocol.** In a Theia frontend
29
+ * the client *is* the RPC endpoint and holds a `MessageConnection` directly. In
30
+ * a VS Code webview the client is a browser sandbox with no `net`, no reach into
31
+ * the extension host's connection, and only structured-clone `postMessage`. So
32
+ * the port abstracts *establishing* the connection, which lets a webview
33
+ * implementation ride the extension↔webview hop (see
34
+ * `createPostMessageTransport`) while a Theia one opens a channel — and
35
+ * lets both hand back the same `MessageConnection` the RPC machinery expects.
36
+ *
37
+ * Two constraints on an implementation:
38
+ *
39
+ * - **A webview implementation must import `vscode-jsonrpc/browser`**, not the
40
+ * package root. vscode-jsonrpc 9's root ships no runtime abstraction layer
41
+ * and throws `No runtime abstraction layer installed` on the first message.
42
+ * - **Return a connection that is already `listen()`ing.** The proxy queues
43
+ * calls on the promise but never calls `listen` itself.
44
+ */
45
+ export interface DataPort {
46
+ /**
47
+ * Stable identity of this client on the data server, passed as `clientId`
48
+ * on every document request.
49
+ *
50
+ * It has to be stable for the session because it is the echo key: an
51
+ * inbound `onDocumentUpdated` carries the originating mutation's
52
+ * `clientId` as `sourceClientId`, and a client that cannot recognise its
53
+ * own echo treats its own write as a concurrent third-party one. It also
54
+ * has to be distinct per client, since it keys the server's per-
55
+ * `(uri, clientId)` watch bucket.
56
+ *
57
+ * Avoid the three values the framework itself uses as sentinels —
58
+ * `'language-client'`, `'unknown'` and `'revert-on-close'`.
59
+ */
60
+ readonly clientId: string;
61
+ /**
62
+ * Open the transport and hand back a listening `MessageConnection`.
63
+ *
64
+ * Called at most once per connection generation. A rejection is a
65
+ * transport-construction failure and is reported through
66
+ * {@link reportError} by the consumer; it must leave the port reusable, so
67
+ * that a later generation can retry.
68
+ */
69
+ connect(): Promise<MessageConnection>;
70
+ /**
71
+ * Surface a failure to the user in whatever way the host does that — a
72
+ * notification, an output channel, a status entry.
73
+ *
74
+ * It exists because the alternative is worse in both directions: this tier
75
+ * cannot import a host's UI, and swallowing the error makes a dead
76
+ * connection look like an empty model. `context` names what was being
77
+ * attempted, not where in the code it happened.
78
+ */
79
+ reportError(error: unknown, context: string): void;
80
+ /**
81
+ * Fires when the host tears the transport down and the current connection
82
+ * is no longer usable — a language-server restart being the case that
83
+ * forces this to exist, since a restarted server binds new ephemeral ports
84
+ * and nothing re-discovers them.
85
+ *
86
+ * `DataSession` drops its connection generation on this event and
87
+ * builds a fresh one on the next request.
88
+ *
89
+ * A local `Event`, deliberately: nothing here crosses a structured-clone
90
+ * boundary, so the `Disposable` an `Event` hands back is safe even though a
91
+ * `Disposable` on the *wire* would not be.
92
+ */
93
+ readonly onDispose: Event<void>;
94
+ }
95
+ //# sourceMappingURL=data-port.d.ts.map