@hydranium/protocol 1.0.0-next.60 → 1.0.0-next.61

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.
@@ -1 +1 @@
1
- {"version":3,"file":"data-session.js","sourceRoot":"","sources":["../../src/client/data-session.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAGlF,kCAAkI;AAClI,uDAA+E;AAC/E,gCAAuD;AAKvD;;;;;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;AAsBF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,WAAW;IAQC;IACA;IARH,eAAe,CAAS;IAC3C,0FAA0F;IAChF,UAAU,CAAyB;IACnC,QAAQ,GAAG,KAAK,CAAC;IACR,mBAAmB,CAAsB;IAE5D,YACsB,IAAc,EACd,MAAqC,EACxD,UAA8B,EAAE;QAFb,SAAI,GAAJ,IAAI,CAAU;QACd,WAAM,GAAN,MAAM,CAA+B;QAGxD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,8BAAuB,CAAC;QAC1E,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,+EAA+E;IAC/E,IAAI,QAAQ;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,SAAS;QACZ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC9C,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,i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AI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC/B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACtB,KAAK,IAAI,CAAC,IAAI;iBACV,SAAS,EAAE;iBACX,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;iBAC3E,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,MAAM;QACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAES,UAAU;QACjB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC9C,CAAC;IACJ,CAAC;CACH;AA5HD,kCA4HC"}
@@ -12,8 +12,9 @@
12
12
  *
13
13
  * Where `./data` is the wire *contract* and `./rpc` is the machinery that lowers
14
14
  * it onto a connection, this is what a client wraps around both: the seam a host
15
- * fills in (`DataPort`), the lifecycle above it (`DataSession` —
16
- * readiness gate, open/watch ordering, echo recognition, reconnect), the inbound
15
+ * fills in (`DataPort`), the connection above it (`DataConnection` — readiness
16
+ * gate and reconnect), the participants on that connection (`DataSession` —
17
+ * identity, open/watch ordering, echo recognition), the inbound
17
18
  * fan-out (`DataEvents`), and the two halves of the hop for hosts whose
18
19
  * client cannot hold a socket — `createPostMessageTransport` on the client
19
20
  * side and `relayToPostMessageChannel` on the side that does hold it.
@@ -31,9 +32,11 @@
31
32
  * anything new, and reach for the Theia package only for what genuinely needs
32
33
  * Theia DI.
33
34
  */
35
+ export * from './data-connection';
34
36
  export * from './data-events';
35
37
  export * from './data-port';
36
38
  export * from './data-session';
37
39
  export * from './message-relay';
38
40
  export * from './post-message-transport';
41
+ export * from './rpc-connection';
39
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC"}
@@ -28,8 +28,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  *
29
29
  * Where `./data` is the wire *contract* and `./rpc` is the machinery that lowers
30
30
  * it onto a connection, this is what a client wraps around both: the seam a host
31
- * fills in (`DataPort`), the lifecycle above it (`DataSession` —
32
- * readiness gate, open/watch ordering, echo recognition, reconnect), the inbound
31
+ * fills in (`DataPort`), the connection above it (`DataConnection` — readiness
32
+ * gate and reconnect), the participants on that connection (`DataSession` —
33
+ * identity, open/watch ordering, echo recognition), the inbound
33
34
  * fan-out (`DataEvents`), and the two halves of the hop for hosts whose
34
35
  * client cannot hold a socket — `createPostMessageTransport` on the client
35
36
  * side and `relayToPostMessageChannel` on the side that does hold it.
@@ -47,9 +48,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
47
48
  * anything new, and reach for the Theia package only for what genuinely needs
48
49
  * Theia DI.
49
50
  */
51
+ __exportStar(require("./data-connection"), exports);
50
52
  __exportStar(require("./data-events"), exports);
51
53
  __exportStar(require("./data-port"), exports);
52
54
  __exportStar(require("./data-session"), exports);
53
55
  __exportStar(require("./message-relay"), exports);
54
56
  __exportStar(require("./post-message-transport"), exports);
57
+ __exportStar(require("./rpc-connection"), exports);
55
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,kDAAgC;AAChC,2DAAyC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,oDAAkC;AAClC,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,kDAAgC;AAChC,2DAAyC;AACzC,mDAAiC"}
@@ -0,0 +1,116 @@
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 RpcProxy } from '../rpc';
11
+ import type { DataPort } from './data-port';
12
+ /**
13
+ * The transport never opened. A complete sentence rather than a fragment: a
14
+ * fragment is nested inside a sentence the framework does not own, so no
15
+ * translator controls the whole and the composition cannot be made to read
16
+ * correctly in every language.
17
+ */
18
+ export declare const DATA_SERVER_CONNECT_FAILED: import("../messages/primitives").MessageDefinition<"Could not connect to the data server: {detail}">;
19
+ export declare const DATA_SERVER_NOT_READY: import("../messages/primitives").MessageDefinition<"The data server did not become ready: {detail}">;
20
+ /** The one method a connection needs of any server: its startup gate. */
21
+ export interface ReadyServer {
22
+ waitForReady(): Promise<void>;
23
+ }
24
+ /** Lifecycle reporting, for a host that raises warm-up UI around the two waits. */
25
+ export interface RpcConnectionLifecycle {
26
+ /** A generation is opening its transport, including on each reconnect. */
27
+ readonly onConnecting?: () => void;
28
+ /** The server's readiness gate has settled for a generation. */
29
+ readonly onReady?: () => void;
30
+ /**
31
+ * A generation failed to connect or to become ready. The failure is still
32
+ * reported through {@link DataPort.reportError} and still rejects the
33
+ * awaiting caller; this is for a host that also drives its own UI.
34
+ */
35
+ readonly onFailed?: (error: unknown) => void;
36
+ }
37
+ /** Everything {@link RpcConnection} needs once a subclass has resolved its defaults. */
38
+ export interface ResolvedRpcConnectionOptions<TClient extends object> {
39
+ readonly methodNamespace: string;
40
+ readonly clientMethods: readonly (keyof TClient & string)[];
41
+ readonly lifecycle: RpcConnectionLifecycle;
42
+ }
43
+ /** One connection generation: its connection, its proxy, and its readiness. */
44
+ interface Generation<TServer extends object> {
45
+ readonly connection: Promise<MessageConnection>;
46
+ readonly server: RpcProxy<TServer>;
47
+ /** Set on first use; the shared readiness gate for this generation. */
48
+ ready?: Promise<void>;
49
+ }
50
+ /**
51
+ * One JSON-RPC connection to a head, with the three jobs every host adapter
52
+ * would otherwise re-derive above {@link DataPort}:
53
+ *
54
+ * 1. **Build the typed proxy** over the port's connection, with the caller's
55
+ * wire prefix and client-method allowlist.
56
+ * 2. **Own the readiness gate** — `waitForReady` once per connection, shared
57
+ * across concurrent callers. A client can connect before the workspace walk
58
+ * finishes, and an early request is then answered correctly from an empty
59
+ * registry, which reads as a broken project tier rather than as a race.
60
+ * 3. **Own the reconnect policy**, by dropping its generation when the port
61
+ * disposes and building a fresh one on the next request.
62
+ *
63
+ * Bounded only by {@link ReadyServer}, so a head serving a slice of the data
64
+ * protocol — diagnostics alone, or one with methods excluded — is still a
65
+ * legal server here. `DataConnection` narrows the bound because its sessions
66
+ * call the document methods; nothing at this layer does.
67
+ */
68
+ export declare class RpcConnection<TServer extends ReadyServer, TClient extends object> {
69
+ protected readonly port: DataPort;
70
+ protected readonly client: TClient;
71
+ protected readonly methodNamespace: string;
72
+ protected readonly clientMethods: readonly (keyof TClient & string)[];
73
+ protected readonly lifecycle: RpcConnectionLifecycle;
74
+ /** The current generation, or `undefined` before the first request / after a teardown. */
75
+ protected generation?: Generation<TServer>;
76
+ protected disposed: boolean;
77
+ protected readonly portDisposeListener: {
78
+ dispose(): void;
79
+ };
80
+ constructor(port: DataPort, client: TClient, options: ResolvedRpcConnectionOptions<TClient>);
81
+ /**
82
+ * The connected, READY server proxy.
83
+ *
84
+ * Returns the proxy rather than `void` on purpose. A reconnect replaces the
85
+ * proxy, so a caller that cached one from an earlier call would go on
86
+ * addressing a dead connection with no error — handing it back per call
87
+ * makes the stale reference unrepresentable.
88
+ *
89
+ * Concurrent callers share one readiness promise, so `waitForReady` is
90
+ * awaited once per generation and not once per caller.
91
+ */
92
+ connected(): Promise<RpcProxy<TServer>>;
93
+ /**
94
+ * The current generation's proxy WITHOUT awaiting readiness — calls queue
95
+ * against the connection promise.
96
+ *
97
+ * Read per access, never cached: a reconnect replaces the generation, and a
98
+ * held reference would address the dead one. Prefer {@link connected}, which
99
+ * also waits for the server's startup gate.
100
+ */
101
+ get server(): RpcProxy<TServer>;
102
+ /** Tear down the current connection and stop tracking the port. Idempotent. */
103
+ dispose(): void;
104
+ /** The live generation, building one if there is none. */
105
+ protected currentGeneration(): Generation<TServer>;
106
+ /** Await the connection and the server's startup gate for one generation. */
107
+ protected awaitReady(generation: Generation<TServer>): Promise<void>;
108
+ /**
109
+ * Discard the current generation, disposing its connection if it opened.
110
+ * The next {@link connected} builds a fresh one.
111
+ */
112
+ protected dropGeneration(): void;
113
+ protected assertLive(): void;
114
+ }
115
+ export {};
116
+ //# sourceMappingURL=rpc-connection.d.ts.map
@@ -0,0 +1 @@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
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
+ /**
23
+ * One JSON-RPC connection to a head, with the three jobs every host adapter
24
+ * would otherwise re-derive above {@link DataPort}:
25
+ *
26
+ * 1. **Build the typed proxy** over the port's connection, with the caller's
27
+ * wire prefix and client-method allowlist.
28
+ * 2. **Own the readiness gate** — `waitForReady` once per connection, shared
29
+ * across concurrent callers. A client can connect before the workspace walk
30
+ * finishes, and an early request is then answered correctly from an empty
31
+ * registry, which reads as a broken project tier rather than as a race.
32
+ * 3. **Own the reconnect policy**, by dropping its generation when the port
33
+ * disposes and building a fresh one on the next request.
34
+ *
35
+ * Bounded only by {@link ReadyServer}, so a head serving a slice of the data
36
+ * protocol — diagnostics alone, or one with methods excluded — is still a
37
+ * legal server here. `DataConnection` narrows the bound because its sessions
38
+ * call the document methods; nothing at this layer does.
39
+ */
40
+ class RpcConnection {
41
+ port;
42
+ client;
43
+ methodNamespace;
44
+ clientMethods;
45
+ lifecycle;
46
+ /** The current generation, or `undefined` before the first request / after a teardown. */
47
+ generation;
48
+ disposed = false;
49
+ portDisposeListener;
50
+ constructor(port, client, options) {
51
+ this.port = port;
52
+ this.client = client;
53
+ this.methodNamespace = options.methodNamespace;
54
+ this.clientMethods = options.clientMethods;
55
+ this.lifecycle = options.lifecycle;
56
+ this.portDisposeListener = this.port.onDispose(() => this.dropGeneration());
57
+ }
58
+ /**
59
+ * The connected, READY server proxy.
60
+ *
61
+ * Returns the proxy rather than `void` on purpose. A reconnect replaces the
62
+ * proxy, so a caller that cached one from an earlier call would go on
63
+ * addressing a dead connection with no error — handing it back per call
64
+ * makes the stale reference unrepresentable.
65
+ *
66
+ * Concurrent callers share one readiness promise, so `waitForReady` is
67
+ * awaited once per generation and not once per caller.
68
+ */
69
+ async connected() {
70
+ this.assertLive();
71
+ const generation = this.currentGeneration();
72
+ if (!generation.ready) {
73
+ generation.ready = this.awaitReady(generation);
74
+ }
75
+ await generation.ready;
76
+ return generation.server;
77
+ }
78
+ /**
79
+ * The current generation's proxy WITHOUT awaiting readiness — calls queue
80
+ * against the connection promise.
81
+ *
82
+ * Read per access, never cached: a reconnect replaces the generation, and a
83
+ * held reference would address the dead one. Prefer {@link connected}, which
84
+ * also waits for the server's startup gate.
85
+ */
86
+ get server() {
87
+ this.assertLive();
88
+ return this.currentGeneration().server;
89
+ }
90
+ /** Tear down the current connection and stop tracking the port. Idempotent. */
91
+ dispose() {
92
+ if (this.disposed) {
93
+ return;
94
+ }
95
+ this.disposed = true;
96
+ this.portDisposeListener.dispose();
97
+ this.dropGeneration();
98
+ }
99
+ /** The live generation, building one if there is none. */
100
+ currentGeneration() {
101
+ if (this.generation) {
102
+ return this.generation;
103
+ }
104
+ this.lifecycle.onConnecting?.();
105
+ const connection = this.port.connect();
106
+ // Rejection is reported here rather than left to float: an unhandled
107
+ // rejection on a connection promise is the failure mode that reads as
108
+ // "the model is empty" instead of "the transport never opened".
109
+ connection.catch((error) => this.port.reportError(error, (0, primitives_1.resolve)(exports.DATA_SERVER_CONNECT_FAILED, { detail: (0, primitives_1.describeError)(error) })));
110
+ const server = (0, rpc_1.createRpcProxy)(connection, {
111
+ methodNamespace: this.methodNamespace,
112
+ localTarget: this.client,
113
+ localMethods: this.clientMethods
114
+ });
115
+ this.generation = { connection, server };
116
+ return this.generation;
117
+ }
118
+ /** Await the connection and the server's startup gate for one generation. */
119
+ async awaitReady(generation) {
120
+ try {
121
+ await generation.connection;
122
+ await generation.server.waitForReady();
123
+ this.lifecycle.onReady?.();
124
+ }
125
+ catch (error) {
126
+ this.lifecycle.onFailed?.(error);
127
+ // Drop the generation so the next request retries rather than
128
+ // re-awaiting a settled rejection forever.
129
+ if (this.generation === generation) {
130
+ this.generation = undefined;
131
+ }
132
+ this.port.reportError(error, (0, primitives_1.resolve)(exports.DATA_SERVER_NOT_READY, { detail: (0, primitives_1.describeError)(error) }));
133
+ throw error;
134
+ }
135
+ }
136
+ /**
137
+ * Discard the current generation, disposing its connection if it opened.
138
+ * The next {@link connected} builds a fresh one.
139
+ */
140
+ dropGeneration() {
141
+ const generation = this.generation;
142
+ this.generation = undefined;
143
+ if (!generation) {
144
+ return;
145
+ }
146
+ generation.connection.then(connection => connection.dispose()).catch(() => undefined);
147
+ }
148
+ assertLive() {
149
+ if (this.disposed) {
150
+ throw new Error(`${this.constructor.name} is disposed`);
151
+ }
152
+ }
153
+ }
154
+ exports.RpcConnection = RpcConnection;
155
+ //# 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,uDAA+E;AAC/E,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;AAoCF;;;;;;;;;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,2CAA2C;YAC3C,IAAI,IAAI,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;gBAClC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC/B,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,IAAA,oBAAO,EAAC,6BAAqB,EAAE,EAAE,MAAM,EAAE,IAAA,0BAAa,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/F,MAAM,KAAK,CAAC;QACf,CAAC;IACJ,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;AA1HD,sCA0HC"}
@@ -23,6 +23,6 @@
23
23
  */
24
24
  export * from './primitives';
25
25
  export { STALE_BASED_UPDATE } from '../errors';
26
- export { DATA_SERVER_CONNECT_FAILED, DATA_SERVER_NOT_READY } from '../client/data-session';
26
+ export { DATA_SERVER_CONNECT_FAILED, DATA_SERVER_NOT_READY } from '../client/rpc-connection';
27
27
  export { RELAY_REPLAY_FAILED, RELAY_TRANSPORT_OPEN_FAILED, RELAY_TRANSPORT_READ_FAILED, RELAY_TRANSPORT_WRITE_FAILED } from '../client/message-relay';
28
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;GAcG;AAEH,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EACJ,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC9B,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;GAcG;AAEH,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EACJ,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC9B,MAAM,yBAAyB,CAAC"}
@@ -41,9 +41,9 @@ exports.RELAY_TRANSPORT_WRITE_FAILED = exports.RELAY_TRANSPORT_READ_FAILED = exp
41
41
  __exportStar(require("./primitives"), exports);
42
42
  var errors_1 = require("../errors");
43
43
  Object.defineProperty(exports, "STALE_BASED_UPDATE", { enumerable: true, get: function () { return errors_1.STALE_BASED_UPDATE; } });
44
- var data_session_1 = require("../client/data-session");
45
- Object.defineProperty(exports, "DATA_SERVER_CONNECT_FAILED", { enumerable: true, get: function () { return data_session_1.DATA_SERVER_CONNECT_FAILED; } });
46
- Object.defineProperty(exports, "DATA_SERVER_NOT_READY", { enumerable: true, get: function () { return data_session_1.DATA_SERVER_NOT_READY; } });
44
+ var rpc_connection_1 = require("../client/rpc-connection");
45
+ Object.defineProperty(exports, "DATA_SERVER_CONNECT_FAILED", { enumerable: true, get: function () { return rpc_connection_1.DATA_SERVER_CONNECT_FAILED; } });
46
+ Object.defineProperty(exports, "DATA_SERVER_NOT_READY", { enumerable: true, get: function () { return rpc_connection_1.DATA_SERVER_NOT_READY; } });
47
47
  var message_relay_1 = require("../client/message-relay");
48
48
  Object.defineProperty(exports, "RELAY_REPLAY_FAILED", { enumerable: true, get: function () { return message_relay_1.RELAY_REPLAY_FAILED; } });
49
49
  Object.defineProperty(exports, "RELAY_TRANSPORT_OPEN_FAILED", { enumerable: true, get: function () { return message_relay_1.RELAY_TRANSPORT_OPEN_FAILED; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;;AAElF;;;;;;;;;;;;;;GAcG;AAEH,+CAA6B;AAE7B,oCAA+C;AAAtC,4GAAA,kBAAkB,OAAA;AAC3B,uDAA2F;AAAlF,0HAAA,0BAA0B,OAAA;AAAE,qHAAA,qBAAqB,OAAA;AAC1D,yDAKiC;AAJ9B,oHAAA,mBAAmB,OAAA;AACnB,4HAAA,2BAA2B,OAAA;AAC3B,4HAAA,2BAA2B,OAAA;AAC3B,6HAAA,4BAA4B,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;;AAElF;;;;;;;;;;;;;;GAcG;AAEH,+CAA6B;AAE7B,oCAA+C;AAAtC,4GAAA,kBAAkB,OAAA;AAC3B,2DAA6F;AAApF,4HAAA,0BAA0B,OAAA;AAAE,uHAAA,qBAAqB,OAAA;AAC1D,yDAKiC;AAJ9B,oHAAA,mBAAmB,OAAA;AACnB,4HAAA,2BAA2B,OAAA;AAC3B,4HAAA,2BAA2B,OAAA;AAC3B,6HAAA,4BAA4B,OAAA"}
@@ -49,13 +49,6 @@ export interface FakeDataPortOptions {
49
49
  * which the consumer surfaces through {@link FakeDataPort.reported}.
50
50
  */
51
51
  connect(): MessageConnection | Promise<MessageConnection>;
52
- /**
53
- * Stable client identity. Defaults to `'fake-data-port'`, which avoids the
54
- * three sentinels the framework reserves (`'language-client'`, `'unknown'`,
55
- * `'revert-on-close'`); override it when a test needs two distinguishable
56
- * clients on one server.
57
- */
58
- clientId?: string;
59
52
  }
60
53
  /** A {@link DataPort} that records what passed through it. */
61
54
  export interface FakeDataPort extends DataPort {
@@ -1 +1 @@
1
- {"version":3,"file":"data-doubles.d.ts","sourceRoot":"","sources":["../../src/testing/data-doubles.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EACT,oBAAoB,EACpB,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,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,0CAA0C;AAC1C,MAAM,WAAW,mBAAmB;IACjC;;;;;;;;OAQG;IACH,OAAO,IAAI,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC3C;;;;;;OAMG;IACH,QAAQ,CA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
  return {
49
- clientId: options.clientId ?? 'fake-data-port',
50
49
  connections,
51
50
  reported,
52
51
  onDispose: disposeEmitter.event,
@@ -1 +1 @@
1
- {"version":3,"file":"data-doubles.js","sourceRoot":"","sources":["../../src/testing/data-doubles.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAiGlF,4CAwBC;AAmCD,0DAsCC;AAhMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,mDAAiE;AAgEjE;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,OAA4B;IAC1D,MAAM,WAAW,GAAwB,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAmD,EAAE,CAAC;IACpE,MAAM,cAAc,GAAG,IAAI,wBAAO,EAAQ,CAAC;IAC3C,OAAO;QACJ,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,gBAAgB;QAC9C,WAAW;QACX,QAAQ;QACR,SAAS,EAAE,cAAc,CAAC,KAAK;QAC/B,KAAK,CAAC,OAAO;YACV,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3C,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7B,OAAO,UAAU,CAAC;QACrB,CAAC;QACD,WAAW,CAAC,KAAc,EAAE,OAAwB;YACjD,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QACrC,CAAC;QACD,WAAW;YACR,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC;QACD,OAAO;YACJ,cAAc,CAAC,OAAO,EAAE,CAAC;QAC5B,CAAC;KACH,CAAC;AACL,CAAC;AAsBD;;;;;;;;;;;;GAYG;AACH,SAAgB,uBAAuB,CAIrC,YAA2E,EAAE;IAC5E,MAAM,OAAO,GAA2D,EAAE,CAAC;IAC3E,MAAM,KAAK,GAAyD,EAAE,CAAC;IACvE,MAAM,SAAS,GAAmC,EAAE,CAAC;IACrD,MAAM,MAA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gB,EACb,SAAS,CAAC,gBAAgB;YAC1B,CAAC,KAAK,CAAC,EAAE;gBACN,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC,CAAC;QACL,iBAAiB,EACd,SAAS,CAAC,iBAAiB;YAC3B,CAAC,KAAK,CAAC,EAAE;gBACN,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC;KACP,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AACzE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydranium/protocol",
3
- "version": "1.0.0-next.60",
3
+ "version": "1.0.0-next.61",
4
4
  "description": "Generic, language-agnostic types, constants, and pure utilities for the hydranium framework.",
5
5
  "keywords": [
6
6
  "hydranium",
@@ -0,0 +1,114 @@
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
+ import { DATA_CLIENT_PROTOCOL_METHODS, DATA_SERVER_WIRE_PREFIX, type DataClientProtocol, type DataServerProtocol } from '../data';
11
+ import type { TransferElement } from '../transfer-element';
12
+ import type { DataPort } from './data-port';
13
+ import { DataSession } from './data-session';
14
+ import { RpcConnection, type RpcConnectionLifecycle } from './rpc-connection';
15
+
16
+ /** Options for {@link DataConnection}. */
17
+ export interface DataConnectionOptions extends RpcConnectionLifecycle {
18
+ /**
19
+ * Wire namespace the server is addressed under. Defaults to the
20
+ * framework's {@link DATA_SERVER_WIRE_PREFIX}, which is what an unmodified
21
+ * `DataServer` binds. Override only alongside the server's own
22
+ * `methodNamespace` option — a mismatch turns every request into
23
+ * "Unhandled method" rather than failing at wire-up.
24
+ */
25
+ readonly methodNamespace?: string;
26
+ }
27
+
28
+ /** {@link DataConnectionOptions} for a client that does not speak {@link DataClientProtocol}. */
29
+ export interface DataConnectionOptionsWithMethods<TClient extends object> extends DataConnectionOptions {
30
+ /**
31
+ * Method names of the client to bind as inbound handlers. Declare it
32
+ * `as const satisfies ReadonlyArray<keyof YourClient & string>` so the list
33
+ * cannot drift from the interface.
34
+ */
35
+ readonly clientMethods: readonly (keyof TClient & string)[];
36
+ }
37
+
38
+ /**
39
+ * Trailing constructor arguments, required only when the client cannot take
40
+ * the framework's default method list.
41
+ *
42
+ * `bindRpcMethods` throws for a name the target does not implement, so a
43
+ * request/response-only client binding the default list fails at wire-up. The
44
+ * conditional turns that into a compile error.
45
+ */
46
+ export type DataConnectionArgs<TTransfer extends TransferElement, TClient extends object> =
47
+ TClient extends DataClientProtocol<TTransfer>
48
+ ? [options?: DataConnectionOptions & Partial<DataConnectionOptionsWithMethods<TClient>>]
49
+ : [options: DataConnectionOptionsWithMethods<TClient>];
50
+
51
+ /**
52
+ * A {@link RpcConnection} to the data head, carrying as many participants as
53
+ * the host has interested parties.
54
+ *
55
+ * Document operations live on the participants rather than here: they carry a
56
+ * `clientId`, which identifies a participant rather than a wire, and the server
57
+ * keys its holds and watches per `(uri, clientId)`. Two parties sharing one
58
+ * identity cannot tell each other's writes from their own echoes.
59
+ *
60
+ * Generic over the transfer root so this file names no grammar. An adopter
61
+ * binds the concrete root (or the union of them, for a multi-grammar head) at
62
+ * its own edge.
63
+ */
64
+ export class DataConnection<
65
+ TTransfer extends TransferElement,
66
+ TServer extends DataServerProtocol<TTransfer> = DataServerProtocol<TTransfer>,
67
+ TClient extends object = DataClientProtocol<TTransfer>
68
+ > extends RpcConnection<TServer, TClient> {
69
+ protected readonly sessions = new Set<DataSession<TTransfer, TServer>>();
70
+
71
+ constructor(port: DataPort, client: TClient, ...rest: DataConnectionArgs<TTransfer, TClient>) {
72
+ const [options = {}] = rest as [(DataConnectionOptions & Partial<DataConnectionOptionsWithMethods<TClient>>)?];
73
+ super(port, client, {
74
+ methodNamespace: options.methodNamespace ?? DATA_SERVER_WIRE_PREFIX,
75
+ // The default is reachable only where `TClient` satisfies
76
+ // `DataClientProtocol`, which the constructor's conditional enforces;
77
+ // the compiler cannot carry that through to the generic parameter.
78
+ clientMethods: options.clientMethods ?? (DATA_CLIENT_PROTOCOL_METHODS as unknown as readonly (keyof TClient & string)[]),
79
+ lifecycle: options
80
+ });
81
+ }
82
+
83
+ /**
84
+ * Mint a participant on this connection under `clientId`.
85
+ *
86
+ * `clientId` must be distinct per participant and stable for its lifetime:
87
+ * it keys the server's per-`(uri, clientId)` hold and watch, and it is the
88
+ * echo key an inbound `onDocumentUpdated` is matched against. Avoid the
89
+ * three values the framework uses as sentinels — `'language-client'`,
90
+ * `'unknown'` and `'revert-on-close'`.
91
+ */
92
+ createSession(clientId: string): DataSession<TTransfer, TServer> {
93
+ this.assertLive();
94
+ const session = new DataSession<TTransfer, TServer>(clientId, {
95
+ connected: () => this.connected(),
96
+ releaseSession: released => this.sessions.delete(released)
97
+ });
98
+ this.sessions.add(session);
99
+ return session;
100
+ }
101
+
102
+ /**
103
+ * Sessions are detached rather than disposed: the server releases every hold
104
+ * on a connection it sees close, so closing each document first sends
105
+ * requests over a connection this call is about to dispose.
106
+ */
107
+ override dispose(): void {
108
+ for (const session of [...this.sessions]) {
109
+ session.detach();
110
+ }
111
+ this.sessions.clear();
112
+ super.dispose();
113
+ }
114
+ }
@@ -12,12 +12,15 @@ import type { ResolvedMessage } from '../messages/primitives';
12
12
 
13
13
  /**
14
14
  * The one thing a host has to supply for the data head: a live JSON-RPC
15
- * connection to the data server, plus the identity and failure sink that go
16
- * with it.
15
+ * connection to the data server, plus the failure sink that goes with it.
17
16
  *
18
- * "Port" in the hexagonal sense — the host implements it, `DataSession`
17
+ * "Port" in the hexagonal sense — the host implements it, `DataConnection`
19
18
  * consumes it, and nothing on either side of the boundary imports the other.
20
19
  *
20
+ * Carries no identity. A `clientId` names a participant, and one transport
21
+ * serves as many as the host has; binding an identity here is what makes two
22
+ * of them share one, so it lives on `DataSession` instead.
23
+ *
21
24
  * **This deliberately does NOT wrap the protocol methods.** `createRpcProxy`
22
25
  * already takes a promise of a connection and produces the whole typed
23
26
  * `DataServerProtocol` surface, so wrapping it would re-derive the framework's
@@ -46,22 +49,6 @@ import type { ResolvedMessage } from '../messages/primitives';
46
49
  * calls on the promise but never calls `listen` itself.
47
50
  */
48
51
  export interface DataPort {
49
- /**
50
- * Stable identity of this client on the data server, passed as `clientId`
51
- * on every document request.
52
- *
53
- * It has to be stable for the session because it is the echo key: an
54
- * inbound `onDocumentUpdated` carries the originating mutation's
55
- * `clientId` as `sourceClientId`, and a client that cannot recognise its
56
- * own echo treats its own write as a concurrent third-party one. It also
57
- * has to be distinct per client, since it keys the server's per-
58
- * `(uri, clientId)` watch bucket.
59
- *
60
- * Avoid the three values the framework itself uses as sentinels —
61
- * `'language-client'`, `'unknown'` and `'revert-on-close'`.
62
- */
63
- readonly clientId: string;
64
-
65
52
  /**
66
53
  * Open the transport and hand back a listening `MessageConnection`.
67
54
  *