@hydranium/client-theia 1.0.0-next.123 → 1.0.0-next.127

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 (47) hide show
  1. package/README.md +33 -6
  2. package/lib/browser/channel-logger.d.ts +4 -3
  3. package/lib/browser/channel-logger.d.ts.map +1 -1
  4. package/lib/browser/channel-logger.js +9 -4
  5. package/lib/browser/channel-logger.js.map +1 -1
  6. package/lib/browser/editor-disk-sync.d.ts +133 -0
  7. package/lib/browser/editor-disk-sync.d.ts.map +1 -0
  8. package/lib/browser/editor-disk-sync.js +232 -0
  9. package/lib/browser/editor-disk-sync.js.map +1 -0
  10. package/lib/browser/hydranium-file-service.d.ts +44 -0
  11. package/lib/browser/hydranium-file-service.d.ts.map +1 -0
  12. package/lib/browser/hydranium-file-service.js +61 -0
  13. package/lib/browser/hydranium-file-service.js.map +1 -0
  14. package/lib/browser/index.d.ts +2 -0
  15. package/lib/browser/index.d.ts.map +1 -1
  16. package/lib/browser/index.js +2 -0
  17. package/lib/browser/index.js.map +1 -1
  18. package/lib/common/clock.d.ts +19 -0
  19. package/lib/common/clock.d.ts.map +1 -0
  20. package/lib/common/clock.js +13 -0
  21. package/lib/common/clock.js.map +1 -0
  22. package/lib/common/index.d.ts +1 -0
  23. package/lib/common/index.d.ts.map +1 -1
  24. package/lib/common/index.js +4 -3
  25. package/lib/common/index.js.map +1 -1
  26. package/lib/node/abstract-socket-forwarding-connection-handler.d.ts +8 -7
  27. package/lib/node/abstract-socket-forwarding-connection-handler.d.ts.map +1 -1
  28. package/lib/node/abstract-socket-forwarding-connection-handler.js +22 -6
  29. package/lib/node/abstract-socket-forwarding-connection-handler.js.map +1 -1
  30. package/lib/node/index.d.ts +1 -0
  31. package/lib/node/index.d.ts.map +1 -1
  32. package/lib/node/index.js +1 -0
  33. package/lib/node/index.js.map +1 -1
  34. package/lib/node/socket-channel-forwarder.d.ts +54 -0
  35. package/lib/node/socket-channel-forwarder.d.ts.map +1 -0
  36. package/lib/node/socket-channel-forwarder.js +93 -0
  37. package/lib/node/socket-channel-forwarder.js.map +1 -0
  38. package/package.json +12 -6
  39. package/src/browser/channel-logger.ts +9 -4
  40. package/src/browser/editor-disk-sync.ts +236 -0
  41. package/src/browser/hydranium-file-service.ts +56 -0
  42. package/src/browser/index.ts +2 -0
  43. package/src/common/clock.ts +20 -0
  44. package/src/common/index.ts +4 -3
  45. package/src/node/abstract-socket-forwarding-connection-handler.ts +13 -8
  46. package/src/node/index.ts +1 -0
  47. package/src/node/socket-channel-forwarder.ts +99 -0
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the MIT License which is available in the project root.
7
+ *
8
+ * SPDX-License-Identifier: MIT
9
+ ********************************************************************************/
10
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
11
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.HydraniumFileService = void 0;
18
+ const inversify_1 = require("@theia/core/shared/inversify");
19
+ const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
20
+ const files_1 = require("@theia/filesystem/lib/common/files");
21
+ /**
22
+ * Theia's `FileService`, refusing an incremental save once the file has
23
+ * changed since the editor read it.
24
+ *
25
+ * Theia's own check, which `write` and `update` share, passes a file whose
26
+ * mtime moved on when its size still matches the etag the editor read. That
27
+ * is safe for `write`, which replaces the file with the whole text, but
28
+ * `update` applies the editor's pending edits to the file as it is, so after a
29
+ * same-size change, the server saving those very edits included, it applies
30
+ * them a second time. Here `update` hands that check the etag with a `!`
31
+ * appended, which no file's etag can match: Theia writes an etag as the mtime
32
+ * in base 29 followed by the size in base 31, digits and lower-case letters
33
+ * only. An advanced mtime is then enough for Theia to refuse with its
34
+ * `FILE_MODIFIED_SINCE`. The editor's save then falls back to `write` with the
35
+ * whole text, which Theia checks as before: it writes when the size is
36
+ * unchanged, and asks the user otherwise. A same-size change by another
37
+ * process is therefore overwritten by that write rather than merged with the
38
+ * editor's edits. `write` is left as it is.
39
+ *
40
+ * It is the safety net behind `EditorDiskSync`, which acts only when the
41
+ * file holds the editor's buffer: a file holding some of the edits, as when a
42
+ * save participant ordered ahead of Theia's first one edits before its first
43
+ * await, is left to this check.
44
+ *
45
+ * A write within the file system's mtime resolution of the read goes unseen,
46
+ * as it does for Theia's own check. A file whose mtime moves while its text
47
+ * stays the same costs a whole-text write rather than the edits.
48
+ *
49
+ * The adopter binds it with `rebind(FileService).to(HydraniumFileService).inSingletonScope()`.
50
+ */
51
+ let HydraniumFileService = class HydraniumFileService extends file_service_1.FileService {
52
+ update(resource, changes, options) {
53
+ const strict = typeof options.etag === 'string' && options.etag !== files_1.ETAG_DISABLED ? { ...options, etag: `${options.etag}!` } : options;
54
+ return super.update(resource, changes, strict);
55
+ }
56
+ };
57
+ exports.HydraniumFileService = HydraniumFileService;
58
+ exports.HydraniumFileService = HydraniumFileService = __decorate([
59
+ (0, inversify_1.injectable)()
60
+ ], HydraniumFileService);
61
+ //# sourceMappingURL=hydranium-file-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydranium-file-service.js","sourceRoot":"","sources":["../../src/browser/hydranium-file-service.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;AAGlF,4DAA0D;AAC1D,6EAAqG;AACrG,8DAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,0BAAW;IACzC,MAAM,CACZ,QAAa,EACb,OAA6C,EAC7C,OAA8B;QAE9B,MAAM,MAAM,GACT,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,qBAAa,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAC3H,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;CACH,CAAA;AAVY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAUhC"}
@@ -12,4 +12,6 @@ export * from './browser-capture';
12
12
  export * from './memory-diagnostics-contribution';
13
13
  export * from './session-aware-connection-source';
14
14
  export * from './connection-diagnostics-contribution';
15
+ export * from './editor-disk-sync';
16
+ export * from './hydranium-file-service';
15
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC"}
@@ -29,4 +29,6 @@ __exportStar(require("./browser-capture"), exports);
29
29
  __exportStar(require("./memory-diagnostics-contribution"), exports);
30
30
  __exportStar(require("./session-aware-connection-source"), exports);
31
31
  __exportStar(require("./connection-diagnostics-contribution"), exports);
32
+ __exportStar(require("./editor-disk-sync"), exports);
33
+ __exportStar(require("./hydranium-file-service"), exports);
32
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,mDAAiC;AACjC,yDAAuC;AACvC,oDAAkC;AAClC,oEAAkD;AAClD,oEAAkD;AAClD,wEAAsD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,mDAAiC;AACjC,yDAAuC;AACvC,oDAAkC;AAClC,oEAAkD;AAClD,oEAAkD;AAClD,wEAAsD;AACtD,qDAAmC;AACnC,2DAAyC"}
@@ -0,0 +1,19 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import type { Clock as ProtocolClock } from '@hydranium/protocol';
10
+ /**
11
+ * The protocol's `Clock`, as a Theia container binds it: type and injection
12
+ * token under one identifier, as Theia declares its own. The framework's
13
+ * frontend and backend classes that time or bound something inject it as
14
+ * optional, and use a `SystemClock` when the container binds none, so a
15
+ * container can supply another clock.
16
+ */
17
+ export type Clock = ProtocolClock;
18
+ export declare const Clock: unique symbol;
19
+ //# sourceMappingURL=clock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/common/clock.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,GAAG,aAAa,CAAC;AAClC,eAAO,MAAM,KAAK,eAAkB,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the MIT License which is available in the project root.
7
+ *
8
+ * SPDX-License-Identifier: MIT
9
+ ********************************************************************************/
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.Clock = void 0;
12
+ exports.Clock = Symbol('Clock');
13
+ //# sourceMappingURL=clock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/common/clock.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAYrE,QAAA,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC"}
@@ -8,4 +8,5 @@
8
8
  ********************************************************************************/
9
9
  export * from './framed-socket-write-buffer';
10
10
  export * from './connection-resilience-options';
11
+ export * from './clock';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAKlF,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAKlF,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,SAAS,CAAC"}
@@ -22,9 +22,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
22
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- // Environment-neutral connection primitives, shared by the browser connection
26
- // source and the server connection service. Kept out of both tier barrels
27
- // because each side binds the same buffer for its own half of the socket.
25
+ // Environment-neutral primitives that the browser and the server tiers each
26
+ // bind for their own side, such as the buffer for each half of the socket.
27
+ // Kept out of both tier barrels for that reason.
28
28
  __exportStar(require("./framed-socket-write-buffer"), exports);
29
29
  __exportStar(require("./connection-resilience-options"), exports);
30
+ __exportStar(require("./clock"), exports);
30
31
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,8EAA8E;AAC9E,0EAA0E;AAC1E,0EAA0E;AAC1E,+DAA6C;AAC7C,kEAAgD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,4EAA4E;AAC5E,2EAA2E;AAC3E,iDAAiD;AACjD,+DAA6C;AAC7C,kEAAgD;AAChD,0CAAwB"}
@@ -8,6 +8,7 @@
8
8
  ********************************************************************************/
9
9
  import { type Channel, CommandService, type ConnectionHandler, type Disposable, ILogger, type MessageProvider, MessageService } from '@theia/core';
10
10
  import * as net from 'node:net';
11
+ import { Clock } from '../common/clock';
11
12
  /** Resolved configuration for a {@link AbstractSocketForwardingConnectionHandler}.
12
13
  * A head-specific subclass derives these from its own (adopter-facing) options
13
14
  * and passes them to `super(...)`. */
@@ -47,17 +48,17 @@ export interface SocketForwardingConnectionHandlerOptions {
47
48
  * the same wire protocol the server speaks, so the backend performs no semantic
48
49
  * re-proxy — it relays bytes only and stays oblivious to the server's method set.
49
50
  *
50
- * The single per-head variation — *which* byte forwarder bridges the channel and
51
- * the socket — is the abstract {@link forwardToSocketConnection} hook: the GLSP
52
- * head plugs in `@eclipse-glsp/theia-integration`'s `SocketConnectionForwarder`,
53
- * the data-server head its own `SocketChannelForwarder`. Keeping the forwarder
54
- * behind the hook is what lets the data head stay GLSP-free while sharing the
55
- * port-discovery + buffer-and-replay race fix + connect orchestration here.
51
+ * The byte forwarder that bridges the channel and the socket is
52
+ * {@link forwardToSocketConnection}; both heads use {@link SocketChannelForwarder},
53
+ * and the port discovery, buffer-and-replay race fix and connect orchestration
54
+ * here are shared.
56
55
  */
57
56
  export declare abstract class AbstractSocketForwardingConnectionHandler implements ConnectionHandler {
58
57
  protected messageService: MessageService;
59
58
  protected commandService: CommandService;
60
59
  protected readonly logger: ILogger;
60
+ /** The clock each {@link SocketChannelForwarder} bounds its flush on: the container's {@link Clock}, or a `SystemClock`. */
61
+ protected readonly clock: Clock;
61
62
  readonly path: string;
62
63
  protected readonly portCommand: string;
63
64
  protected readonly logComponent: string;
@@ -79,7 +80,7 @@ export declare abstract class AbstractSocketForwardingConnectionHandler implemen
79
80
  * relay both ways. Called once, after the socket is created and the
80
81
  * pre-forward buffer is about to be replayed.
81
82
  */
82
- protected abstract forwardToSocketConnection(clientChannel: Channel, socket: net.Socket): Disposable;
83
+ protected forwardToSocketConnection(clientChannel: Channel, socket: net.Socket): Disposable;
83
84
  /**
84
85
  * Re-fire pre-forward buffered `MessageProvider`s on the channel's internal
85
86
  * `onMessageEmitter` so the now-subscribed forwarder picks them up in arrival
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-socket-forwarding-connection-handler.d.ts","sourceRoot":"","sources":["../../src/node/abstract-socket-forwarding-connection-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,OAAO,EACZ,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,OAAO,EACP,KAAK,eAAe,EACpB,cAAc,EAChB,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAEhC;;uCAEu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BAEtD,OAAO,EAAE,wCAAwC;IAW7D,YAAY,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI;cAIvB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;cAyB3D,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;cAwB3B,eAAe,CAC5B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,gBAAgB,CAAC,EAAE;QAAE,SAAS,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,eAAe,EAAE,CAAA;KAAE,GACzE,OAAO,CAAC,IAAI,CAAC;IA8BhB;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,yBAAyB,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,UAAU;IAEpG;;;;;;;;;;OAUG;IACH,SAAS,CAAC,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,IAAI;CAiBvF"}
1
+ {"version":3,"file":"abstract-socket-forwarding-connection-handler.d.ts","sourceRoot":"","sources":["../../src/node/abstract-socket-forwarding-connection-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EACJ,KAAK,OAAO,EACZ,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,OAAO,EACP,KAAK,eAAe,EACpB,cAAc,EAChB,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGxC;;uCAEuC;AACvC,MAAM,WAAW,wCAAwC;IACtD,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;iEAC6D;IAC7D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;gCAC4B;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IA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I,CAAC;cAyB3D,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;cAwB3B,eAAe,CAC5B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,gBAAgB,CAAC,EAAE;QAAE,SAAS,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,eAAe,EAAE,CAAA;KAAE,GACzE,OAAO,CAAC,IAAI,CAAC;IA8BhB;;;;OAIG;IACH,SAAS,CAAC,yBAAyB,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,UAAU;IAI3F;;;;;;;;;;OAUG;IACH,SAAS,CAAC,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,IAAI;CAiBvF"}
@@ -51,11 +51,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
51
51
  };
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
53
  exports.AbstractSocketForwardingConnectionHandler = void 0;
54
+ const protocol_1 = require("@hydranium/protocol");
54
55
  const core_1 = require("@theia/core");
55
56
  const channel_1 = require("@theia/core/lib/common/message-rpc/channel");
56
57
  const promise_util_1 = require("@theia/core/lib/common/promise-util");
57
58
  const inversify_1 = require("@theia/core/shared/inversify");
58
59
  const net = __importStar(require("node:net"));
60
+ const clock_1 = require("../common/clock");
61
+ const socket_channel_forwarder_1 = require("./socket-channel-forwarder");
59
62
  /**
60
63
  * Cross-head base for the Theia backend half of a protocol head's transport:
61
64
  * it bridges a Theia browser-frontend {@link Channel} to a server's TCP socket
@@ -68,12 +71,10 @@ const net = __importStar(require("node:net"));
68
71
  * the same wire protocol the server speaks, so the backend performs no semantic
69
72
  * re-proxy — it relays bytes only and stays oblivious to the server's method set.
70
73
  *
71
- * The single per-head variation — *which* byte forwarder bridges the channel and
72
- * the socket — is the abstract {@link forwardToSocketConnection} hook: the GLSP
73
- * head plugs in `@eclipse-glsp/theia-integration`'s `SocketConnectionForwarder`,
74
- * the data-server head its own `SocketChannelForwarder`. Keeping the forwarder
75
- * behind the hook is what lets the data head stay GLSP-free while sharing the
76
- * port-discovery + buffer-and-replay race fix + connect orchestration here.
74
+ * The byte forwarder that bridges the channel and the socket is
75
+ * {@link forwardToSocketConnection}; both heads use {@link SocketChannelForwarder},
76
+ * and the port discovery, buffer-and-replay race fix and connect orchestration
77
+ * here are shared.
77
78
  */
78
79
  let AbstractSocketForwardingConnectionHandler = class AbstractSocketForwardingConnectionHandler {
79
80
  messageService;
@@ -82,6 +83,8 @@ let AbstractSocketForwardingConnectionHandler = class AbstractSocketForwardingCo
82
83
  // not the spawned language-server process, so the framework `LspLogger`
83
84
  // (which needs the Langium connection/services) is out of reach here.
84
85
  logger;
86
+ /** The clock each {@link SocketChannelForwarder} bounds its flush on: the container's {@link Clock}, or a `SystemClock`. */
87
+ clock = new protocol_1.SystemClock();
85
88
  path;
86
89
  portCommand;
87
90
  logComponent;
@@ -182,6 +185,14 @@ let AbstractSocketForwardingConnectionHandler = class AbstractSocketForwardingCo
182
185
  setTimeout(() => connected.reject('Timeout reached.'), this.connectTimeoutMs);
183
186
  return connected.promise;
184
187
  }
188
+ /**
189
+ * Bridge the Theia frontend `clientChannel` and the server `socket` so bytes
190
+ * relay both ways. Called once, after the socket is created and the
191
+ * pre-forward buffer is about to be replayed.
192
+ */
193
+ forwardToSocketConnection(clientChannel, socket) {
194
+ return new socket_channel_forwarder_1.SocketChannelForwarder(clientChannel, socket, this.clock);
195
+ }
185
196
  /**
186
197
  * Re-fire pre-forward buffered `MessageProvider`s on the channel's internal
187
198
  * `onMessageEmitter` so the now-subscribed forwarder picks them up in arrival
@@ -222,6 +233,11 @@ __decorate([
222
233
  (0, inversify_1.inject)(core_1.ILogger),
223
234
  __metadata("design:type", Object)
224
235
  ], AbstractSocketForwardingConnectionHandler.prototype, "logger", void 0);
236
+ __decorate([
237
+ (0, inversify_1.inject)(clock_1.Clock),
238
+ (0, inversify_1.optional)(),
239
+ __metadata("design:type", Object)
240
+ ], AbstractSocketForwardingConnectionHandler.prototype, "clock", void 0);
225
241
  exports.AbstractSocketForwardingConnectionHandler = AbstractSocketForwardingConnectionHandler = __decorate([
226
242
  (0, inversify_1.injectable)(),
227
243
  __metadata("design:paramtypes", [Object])
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-socket-forwarding-connection-handler.js","sourceRoot":"","sources":["../../src/node/abstract-socket-forwarding-connection-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElF,sCAQqB;AACrB,wEAA+E;AAC/E,sEAA+D;AAC/D,4DAAkE;AAClE,8CAAgC;AA8BhC;;;;;;;;;;;;;;;;;;GAkBG;AAEI,IAAe,yCAAyC,GAAxD,MAAe,yCAAyC;IAC1B,cAAc,CAAkB;IAChC,cAAc,CAAkB;IAClE,4EAA4E;IAC5E,wEAAwE;IACxE,sEAAsE;IAClC,MAAM,CAAW;IAE5C,IAAI,CAAS;IAEH,WAAW,CAAS;IACpB,YAAY,CAAS;IACrB,UAAU,CAAS;IACnB,eAAe,CAAS;IACxB,gBAAgB,CAAS;IACzB,gBAAgB,CAAS;IACzB,eAAe,CAAgC;IAElE,YAAY,OAAiD;QAC1D,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,GAAG,CAAC;QACtD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,KAAK,CAAC;QAC1D,IAAI,CAAC,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,CAAC,CAAC;QAC9E,OAAO,SAAS,CAAC,OAAO,CAAC;IAC5B,CAAC;IASD;;;;;;;;;;OAUG;IACO,sBAAsB,CAAC,OAAgB,EAAE,QAA2B;QAC3E,IAAI,CAAC,CAAC,OAAO,YAAY,2BAAiB,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,cAAc,QAAQ,CAAC,MAAM,8DAA8D,CAAC,CAAC;YACnI,OAAO;QACV,CAAC;QACD,MAAM,SAAS,GAAG,OAAsF,CAAC;QACzG,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CACb,IAAI,IAAI,CAAC,YAAY,cAAc,QAAQ,CAAC,MAAM,6EAA6E,CACjI,CAAC;YACF,OAAO;QACV,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,eAAe,QAAQ,CAAC,MAAM,yDAAyD,CAAC,CAAC;QAC/H,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAC/B,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,CAAC;IACJ,CAAC;CACH,CAAA;AAvJqB,8FAAyC;AAC1B;IAAjC,IAAA,kBAAM,EAAC,qBAAc,CAAC;8BAA4B,qBAAc;iFAAC;AAChC;IAAjC,IAAA,kBAAM,EAAC,qBAAc,CAAC;;iFAA2C;AAI9B;IAAnC,IAAA,kBAAM,EAAC,cAAO,CAAC;;yEAAqC;oDANlC,yCAAyC;IAD9D,IAAA,sBAAU,GAAE;;GACS,yCAAyC,CAuJ9D"}
1
+ {"version":3,"file":"abstract-socket-forwarding-connection-handler.js","sourceRoot":"","sources":["../../src/node/abstract-socket-forwarding-connection-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;;;;;;;;;;;;;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OAUG;IACO,sBAAsB,CAAC,OAAgB,EAAE,QAA2B;QAC3E,IAAI,CAAC,CAAC,OAAO,YAAY,2BAAiB,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,cAAc,QAAQ,CAAC,MAAM,8DAA8D,CAAC,CAAC;YACnI,OAAO;QACV,CAAC;QACD,MAAM,SAAS,GAAG,OAAsF,CAAC;QACzG,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CACb,IAAI,IAAI,CAAC,YAAY,cAAc,QAAQ,CAAC,MAAM,6EAA6E,CACjI,CAAC;YACF,OAAO;QACV,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,eAAe,QAAQ,CAAC,MAAM,yDAAyD,CAAC,CAAC;QAC/H,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAC/B,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,CAAC;IACJ,CAAC;CACH,CAAA;AA3JqB,8FAAyC;AAC1B;IAAjC,IAAA,kBAAM,EAAC,qBAAc,CAAC;8BAA4B,qBAAc;iFAAC;AAChC;IAAjC,IAAA,kBAAM,EAAC,qBAAc,CAAC;;iFAA2C;AAI9B;IAAnC,IAAA,kBAAM,EAAC,cAAO,CAAC;;yEAAqC;AAEP;IAA7C,IAAA,kBAAM,EAAC,aAAK,CAAC;IAAE,IAAA,oBAAQ,GAAE;;wEAAqD;oDAR5D,yCAAyC;IAD9D,IAAA,sBAAU,GAAE;;GACS,yCAAyC,CA2J9D"}
@@ -8,4 +8,5 @@
8
8
  ********************************************************************************/
9
9
  export * from './abstract-socket-forwarding-connection-handler';
10
10
  export * from './session-bound-frontend-connection-service';
11
+ export * from './socket-channel-forwarder';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,iDAAiD,CAAC;AAChE,cAAc,6CAA6C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,iDAAiD,CAAC;AAChE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4BAA4B,CAAC"}
package/lib/node/index.js CHANGED
@@ -24,4 +24,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  __exportStar(require("./abstract-socket-forwarding-connection-handler"), exports);
26
26
  __exportStar(require("./session-bound-frontend-connection-service"), exports);
27
+ __exportStar(require("./socket-channel-forwarder"), exports);
27
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kFAAgE;AAChE,8EAA4D"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kFAAgE;AAChE,8EAA4D;AAC5D,6DAA2C"}
@@ -0,0 +1,54 @@
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 '@hydranium/protocol';
10
+ import { type Channel, Disposable, DisposableCollection, type MessageProvider } from '@theia/core';
11
+ import type * as net from 'node:net';
12
+ import { type Message, type MessageConnection } from 'vscode-jsonrpc/node';
13
+ /**
14
+ * Relays JSON-RPC messages between a Theia browser-frontend {@link Channel} and
15
+ * a server's TCP socket — the backend half of a head's transport. The server
16
+ * speaks vscode-jsonrpc (Content-Length framed) on the socket; the frontend
17
+ * speaks the same protocol over the channel. This forwarder decodes each side
18
+ * and re-emits on the other.
19
+ *
20
+ * Behaves as `@eclipse-glsp/theia-integration`'s `SocketConnectionForwarder`
21
+ * does, and both heads use it, except that when the channel closes, the writes
22
+ * still queued go out before the socket ends. A page going away sends its last
23
+ * messages and closes its channel in the same tick, and the writer takes
24
+ * several turns per message, so destroying the socket on the close loses them.
25
+ */
26
+ export declare class SocketChannelForwarder implements Disposable {
27
+ protected readonly channel: Channel;
28
+ protected readonly socket: net.Socket;
29
+ /** Times {@link flushTimeoutMs}. */
30
+ protected readonly clock: Clock;
31
+ protected readonly toDispose: DisposableCollection;
32
+ /** The last write to the socket; the writer runs its writes one at a time, so this settles last. */
33
+ protected lastWrite: Promise<void>;
34
+ /**
35
+ * How long {@link endSocket} waits for the queued writes before it destroys
36
+ * the socket anyway. Without a bound, a server that stops reading holds the
37
+ * socket open for good, and with it the server's end of the connection.
38
+ */
39
+ protected readonly flushTimeoutMs: number;
40
+ constructor(channel: Channel, socket: net.Socket,
41
+ /** Times {@link flushTimeoutMs}. */
42
+ clock?: Clock);
43
+ /**
44
+ * Dispose `connection`, which destroys the socket, once the writes queued
45
+ * before the channel closed are out, or {@link flushTimeoutMs} has passed. A
46
+ * write has settled once the socket handed its bytes to the OS, and
47
+ * destroying the socket then loses nothing.
48
+ */
49
+ protected endSocket(connection: MessageConnection): Promise<void>;
50
+ protected decodeChannelMessage(provider: MessageProvider): Message;
51
+ protected writeToChannel(message: Message): void;
52
+ dispose(): void;
53
+ }
54
+ //# sourceMappingURL=socket-channel-forwarder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socket-channel-forwarder.d.ts","sourceRoot":"","sources":["../../src/node/socket-channel-forwarder.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,KAAK,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,KAAK,KAAK,GAAG,MAAM,UAAU,CAAC;AACrC,OAAO,EAEJ,KAAK,OAAO,EACZ,KAAK,iBAAiB,EAGxB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;GAYG;AACH,qBAAa,sBAAuB,YAAW,UAAU;IAYnD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO;IACnC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM;IACrC,oCAAoC;IACpC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK;IAdlC,SAAS,CAAC,QAAQ,CAAC,SAAS,uBAA8B;IAC1D,oGAAoG;IACpG,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAqB;IACvD;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAU;gBAG7B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,GAAG,CAAC,MAAM;IACrC,oCAAoC;IACjB,KAAK,GAAE,KAAyB;IAyBtD;;;;;OAKG;cACa,SAAS,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvE,SAAS,CAAC,oBAAoB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO;IAKlE,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAMhD,OAAO,IAAI,IAAI;CAGjB"}
@@ -0,0 +1,93 @@
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.SocketChannelForwarder = void 0;
12
+ const protocol_1 = require("@hydranium/protocol");
13
+ const core_1 = require("@theia/core");
14
+ const node_1 = require("vscode-jsonrpc/node");
15
+ /**
16
+ * Relays JSON-RPC messages between a Theia browser-frontend {@link Channel} and
17
+ * a server's TCP socket — the backend half of a head's transport. The server
18
+ * speaks vscode-jsonrpc (Content-Length framed) on the socket; the frontend
19
+ * speaks the same protocol over the channel. This forwarder decodes each side
20
+ * and re-emits on the other.
21
+ *
22
+ * Behaves as `@eclipse-glsp/theia-integration`'s `SocketConnectionForwarder`
23
+ * does, and both heads use it, except that when the channel closes, the writes
24
+ * still queued go out before the socket ends. A page going away sends its last
25
+ * messages and closes its channel in the same tick, and the writer takes
26
+ * several turns per message, so destroying the socket on the close loses them.
27
+ */
28
+ class SocketChannelForwarder {
29
+ channel;
30
+ socket;
31
+ clock;
32
+ toDispose = new core_1.DisposableCollection();
33
+ /** The last write to the socket; the writer runs its writes one at a time, so this settles last. */
34
+ lastWrite = Promise.resolve();
35
+ /**
36
+ * How long {@link endSocket} waits for the queued writes before it destroys
37
+ * the socket anyway. Without a bound, a server that stops reading holds the
38
+ * socket open for good, and with it the server's end of the connection.
39
+ */
40
+ flushTimeoutMs = 10_000;
41
+ constructor(channel, socket,
42
+ /** Times {@link flushTimeoutMs}. */
43
+ clock = new protocol_1.SystemClock()) {
44
+ this.channel = channel;
45
+ this.socket = socket;
46
+ this.clock = clock;
47
+ const reader = new node_1.SocketMessageReader(socket);
48
+ const writer = new node_1.SocketMessageWriter(socket);
49
+ const connection = (0, node_1.createMessageConnection)(reader, writer);
50
+ // Nothing here destroys the socket directly. `SocketMessageWriter.dispose()`
51
+ // destroys it itself, which covers both `dispose` and `endSocket`; and
52
+ // `connection.onClose` fires only from the reader's or writer's own close,
53
+ // which for a socket means the socket has already gone — so a destroy
54
+ // handler there is downstream of the effect it would be trying to cause.
55
+ this.toDispose.pushAll([
56
+ reader.listen(message => this.writeToChannel(message)),
57
+ channel.onMessage(provider => {
58
+ // A failed write means the socket is gone, which its own close reports.
59
+ this.lastWrite = writer.write(this.decodeChannelMessage(provider)).catch(() => undefined);
60
+ }),
61
+ channel.onClose(() => void this.endSocket(connection)),
62
+ connection.onClose(() => channel.close()),
63
+ core_1.Disposable.create(() => {
64
+ channel.close();
65
+ connection.dispose();
66
+ })
67
+ ]);
68
+ }
69
+ /**
70
+ * Dispose `connection`, which destroys the socket, once the writes queued
71
+ * before the channel closed are out, or {@link flushTimeoutMs} has passed. A
72
+ * write has settled once the socket handed its bytes to the OS, and
73
+ * destroying the socket then loses nothing.
74
+ */
75
+ async endSocket(connection) {
76
+ await this.clock.raceTimer(this.lastWrite, this.flushTimeoutMs);
77
+ connection.dispose();
78
+ }
79
+ decodeChannelMessage(provider) {
80
+ const buffer = provider().readBytes();
81
+ return JSON.parse(new TextDecoder().decode(buffer));
82
+ }
83
+ writeToChannel(message) {
84
+ const writeBuffer = this.channel.getWriteBuffer();
85
+ writeBuffer.writeBytes(new TextEncoder().encode(JSON.stringify(message)));
86
+ writeBuffer.commit();
87
+ }
88
+ dispose() {
89
+ this.toDispose.dispose();
90
+ }
91
+ }
92
+ exports.SocketChannelForwarder = SocketChannelForwarder;
93
+ //# sourceMappingURL=socket-channel-forwarder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socket-channel-forwarder.js","sourceRoot":"","sources":["../../src/node/socket-channel-forwarder.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,kDAA8D;AAC9D,sCAAmG;AAEnG,8CAM6B;AAE7B;;;;;;;;;;;;GAYG;AACH,MAAa,sBAAsB;IAYV;IACA;IAEA;IAdH,SAAS,GAAG,IAAI,2BAAoB,EAAE,CAAC;IAC1D,oGAAoG;IAC1F,SAAS,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IACvD;;;;OAIG;IACgB,cAAc,GAAW,MAAM,CAAC;IAEnD,YACs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,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,UAAU,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAES,oBAAoB,CAAC,QAAyB;QACrD,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAY,CAAC;IAClE,CAAC;IAES,cAAc,CAAC,OAAgB;QACtC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAClD,WAAW,CAAC,UAAU,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1E,WAAW,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;IAED,OAAO;QACJ,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;CACH;AAjED,wDAiEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydranium/client-theia",
3
- "version": "1.0.0-next.123",
3
+ "version": "1.0.0-next.127",
4
4
  "description": "Cross-head Theia client primitives shared by the hydranium protocol heads. Provides the socket-forwarding connection-handler base that the data-server and GLSP Theia integrations subclass, plus the preference-driven Output-channel logger; carries no head-specific dependency.",
5
5
  "keywords": [
6
6
  "hydranium",
@@ -78,20 +78,26 @@
78
78
  "watch": "tsc -b -w --preserveWatchOutput"
79
79
  },
80
80
  "devDependencies": {
81
- "@hydranium/protocol": "1.0.0-next.123",
81
+ "@hydranium/protocol": "1.0.0-next.127",
82
82
  "@theia/core": "^1.70.0",
83
+ "@theia/editor": "^1.70.0",
84
+ "@theia/filesystem": "^1.70.0",
83
85
  "@theia/output": "^1.70.0",
84
86
  "@types/node": "^22.0.0",
85
87
  "inversify": "6.2.2",
86
88
  "reflect-metadata": "0.2.2",
87
89
  "rimraf": "^5.0.0",
88
- "typescript": "^5.8.0"
90
+ "typescript": "^5.8.0",
91
+ "vscode-jsonrpc": "9.0.1"
89
92
  },
90
93
  "peerDependencies": {
91
- "@hydranium/protocol": "1.0.0-next.123",
94
+ "@hydranium/protocol": "1.0.0-next.127",
92
95
  "@theia/core": "^1.70.0",
96
+ "@theia/editor": "^1.70.0",
97
+ "@theia/filesystem": "^1.70.0",
93
98
  "@theia/output": "^1.70.0",
94
- "inversify": "^6.0.0"
99
+ "inversify": "^6.0.0",
100
+ "vscode-jsonrpc": "9.0.1"
95
101
  },
96
102
  "engines": {
97
103
  "node": ">=22.13"
@@ -99,6 +105,6 @@
99
105
  "publishConfig": {
100
106
  "access": "public"
101
107
  },
102
- "//peerDependencies": "@theia/core stays at 1.70 here, matching the sibling Theia packages, even though the connection-resilience bindings need 1.71: Theia only began binding `SocketWriteBuffer` then, and before that each connection built one privately, so there is no binding to rebind. Rather than split the package's floor for one feature, `bindConnectionResilience` probes for that binding and warns instead of installing when it is absent — a capability check rather than a version parse, so it answers about the container in front of it. Everything else the feature touches exists at 1.70, and the emitted declarations deliberately name no type that 1.70 lacks, so the package still compiles there. Verified by unpacking 1.70, 1.71 and 1.72, not inferred from a changelog.",
108
+ "//peerDependencies": "@theia/core stays at 1.70 here, matching the sibling Theia packages, even though the connection-resilience bindings need 1.71: Theia only began binding `SocketWriteBuffer` then, and before that each connection built one privately, so there is no binding to rebind. Rather than split the package's floor for one feature, `bindConnectionResilience` probes for that binding and warns instead of installing when it is absent — a capability check rather than a version parse, so it answers about the container in front of it. Everything else the feature touches exists at 1.70, and the emitted declarations deliberately name no type that 1.70 lacks, so the package still compiles there. Verified by unpacking 1.70, 1.71 and 1.72, not inferred from a changelog. `vscode-jsonrpc` is EXACT because it is one link of an atomic chain: `vscode-languageserver-protocol` depends on it at exactly 9.0.1, so any other value is a second physical copy, and this wire stack breaks on copy identity.",
103
109
  "//prepack": "The publish guard, and it deliberately is NOT a `prepare`: npm runs a workspace `prepare` BEFORE the root `postinstall` that applies patches/vscode-jsonrpc+9.0.1.patch, so building there fails on a cold clone and npm rolls the entire install back. `prepack` runs only when a tarball is made (`npm pack`, `npm publish`) and never on install, so it cannot break the install it has no business touching. It FAILS rather than rebuilds, because the rebuild is exactly the part that ordering defeats. What it defends against: `files` lists `lib`, `lib` is gitignored, and a `files` entry matching nothing is skipped SILENTLY — so `npm publish` from an unbuilt tree emits a tarball of `src` and nothing else, with no error."
104
110
  }
@@ -10,6 +10,7 @@
10
10
  import { AbstractLogger, DefaultTracer, type LogLevel, type MemoryReader, SystemClock } from '@hydranium/protocol';
11
11
  import { injectable, type interfaces, unmanaged, inject } from '@theia/core/shared/inversify';
12
12
  import { type OutputChannel, OutputChannelManager } from '@theia/output/lib/browser/output-channel';
13
+ import { Clock } from '../common/clock';
13
14
 
14
15
  /**
15
16
  * Configuration for a {@link ChannelLogger}, supplied once at bind time via
@@ -94,9 +95,10 @@ const ChannelLoggerBase = Symbol('ChannelLoggerBase');
94
95
 
95
96
  /**
96
97
  * Inversify token for the browser `Tracer` — a {@link DefaultTracer} over
97
- * the {@link ChannelLogger} (emit sink) + a {@link SystemClock} + a browser
98
- * heap reader. The browser head has no Langium `services.Tracer` slot, so this
99
- * is how frontend services that time obtain a tracer: `@inject(ChannelTracer)`.
98
+ * the {@link ChannelLogger} (emit sink) + the container's {@link Clock}, or a
99
+ * `SystemClock` when it binds none, + a browser heap reader. The browser head
100
+ * has no Langium `services.Tracer` slot, so this is how frontend services that
101
+ * time obtain a tracer: `@inject(ChannelTracer)`.
100
102
  * Bound by {@link bindChannelLogger}.
101
103
  */
102
104
  export const ChannelTracer = Symbol('ChannelTracer');
@@ -134,7 +136,10 @@ export function bindChannelLogger(bind: interfaces.Bind, options: ChannelLoggerO
134
136
  return parentName ? base.for(parentName) : base;
135
137
  });
136
138
  bind(ChannelTracer)
137
- .toDynamicValue(ctx => new DefaultTracer(ctx.container.get<ChannelLogger>(ChannelLoggerBase), new SystemClock(), readBrowserMemory))
139
+ .toDynamicValue(ctx => {
140
+ const clock = ctx.container.isBound(Clock) ? ctx.container.get<Clock>(Clock) : new SystemClock();
141
+ return new DefaultTracer(ctx.container.get<ChannelLogger>(ChannelLoggerBase), clock, readBrowserMemory);
142
+ })
138
143
  .inSingletonScope();
139
144
  }
140
145