@hydranium/glsp-server 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.
- package/LICENSE +21 -0
- package/README.md +97 -0
- package/lib/browser/index.d.ts +10 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +15 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/start-glsp-server-in-worker.d.ts +121 -0
- package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -0
- package/lib/browser/start-glsp-server-in-worker.js +102 -0
- package/lib/browser/start-glsp-server-in-worker.js.map +1 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts +132 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-recording-command.js +159 -0
- package/lib/command/hydranium-glsp-recording-command.js.map +1 -0
- package/lib/command/index.d.ts +10 -0
- package/lib/command/index.d.ts.map +1 -0
- package/lib/command/index.js +10 -0
- package/lib/command/index.js.map +1 -0
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts +61 -0
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts.map +1 -0
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js +93 -0
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js.map +1 -0
- package/lib/computed-bounds/index.d.ts +10 -0
- package/lib/computed-bounds/index.d.ts.map +1 -0
- package/lib/computed-bounds/index.js +10 -0
- package/lib/computed-bounds/index.js.map +1 -0
- package/lib/dispatcher/index.d.ts +10 -0
- package/lib/dispatcher/index.d.ts.map +1 -0
- package/lib/dispatcher/index.js +10 -0
- package/lib/dispatcher/index.js.map +1 -0
- package/lib/dispatcher/server-action-dispatcher.d.ts +52 -0
- package/lib/dispatcher/server-action-dispatcher.d.ts.map +1 -0
- package/lib/dispatcher/server-action-dispatcher.js +79 -0
- package/lib/dispatcher/server-action-dispatcher.js.map +1 -0
- package/lib/index.d.ts +19 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +20 -0
- package/lib/index.js.map +1 -0
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +75 -0
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -0
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +100 -0
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -0
- package/lib/launcher/glsp-app-module.d.ts +87 -0
- package/lib/launcher/glsp-app-module.d.ts.map +1 -0
- package/lib/launcher/glsp-app-module.js +71 -0
- package/lib/launcher/glsp-app-module.js.map +1 -0
- package/lib/launcher/glsp-framework-overrides.d.ts +32 -0
- package/lib/launcher/glsp-framework-overrides.d.ts.map +1 -0
- package/lib/launcher/glsp-framework-overrides.js +49 -0
- package/lib/launcher/glsp-framework-overrides.js.map +1 -0
- package/lib/launcher/glsp-server-overrides.d.ts +39 -0
- package/lib/launcher/glsp-server-overrides.d.ts.map +1 -0
- package/lib/launcher/glsp-server-overrides.js +45 -0
- package/lib/launcher/glsp-server-overrides.js.map +1 -0
- package/lib/launcher/hydranium-glsp-server.d.ts +62 -0
- package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -0
- package/lib/launcher/hydranium-glsp-server.js +101 -0
- package/lib/launcher/hydranium-glsp-server.js.map +1 -0
- package/lib/launcher/index.d.ts +12 -0
- package/lib/launcher/index.d.ts.map +1 -0
- package/lib/launcher/index.js +22 -0
- package/lib/launcher/index.js.map +1 -0
- package/lib/logging/glsp-client-logger.d.ts +110 -0
- package/lib/logging/glsp-client-logger.d.ts.map +1 -0
- package/lib/logging/glsp-client-logger.js +151 -0
- package/lib/logging/glsp-client-logger.js.map +1 -0
- package/lib/logging/index.d.ts +10 -0
- package/lib/logging/index.d.ts.map +1 -0
- package/lib/logging/index.js +10 -0
- package/lib/logging/index.js.map +1 -0
- package/lib/node/index.d.ts +10 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +13 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/start-glsp-server.d.ts +122 -0
- package/lib/node/start-glsp-server.d.ts.map +1 -0
- package/lib/node/start-glsp-server.js +103 -0
- package/lib/node/start-glsp-server.js.map +1 -0
- package/lib/state/abstract-hydranium-glsp-state.d.ts +333 -0
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -0
- package/lib/state/abstract-hydranium-glsp-state.js +451 -0
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -0
- package/lib/state/full-text-hydranium-glsp-state.d.ts +43 -0
- package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -0
- package/lib/state/full-text-hydranium-glsp-state.js +60 -0
- package/lib/state/full-text-hydranium-glsp-state.js.map +1 -0
- package/lib/state/hydranium-glsp-index.d.ts +220 -0
- package/lib/state/hydranium-glsp-index.d.ts.map +1 -0
- package/lib/state/hydranium-glsp-index.js +320 -0
- package/lib/state/hydranium-glsp-index.js.map +1 -0
- package/lib/state/hydranium-shared-core-services.d.ts +90 -0
- package/lib/state/hydranium-shared-core-services.d.ts.map +1 -0
- package/lib/state/hydranium-shared-core-services.js +89 -0
- package/lib/state/hydranium-shared-core-services.js.map +1 -0
- package/lib/state/index.d.ts +17 -0
- package/lib/state/index.d.ts.map +1 -0
- package/lib/state/index.js +17 -0
- package/lib/state/index.js.map +1 -0
- package/lib/state/model-ready-timeout-error.d.ts +28 -0
- package/lib/state/model-ready-timeout-error.d.ts.map +1 -0
- package/lib/state/model-ready-timeout-error.js +36 -0
- package/lib/state/model-ready-timeout-error.js.map +1 -0
- package/lib/state/reconcile-source-model-write.d.ts +43 -0
- package/lib/state/reconcile-source-model-write.d.ts.map +1 -0
- package/lib/state/reconcile-source-model-write.js +47 -0
- package/lib/state/reconcile-source-model-write.js.map +1 -0
- package/lib/state/reconciling-multi-document-glsp-state.d.ts +164 -0
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -0
- package/lib/state/reconciling-multi-document-glsp-state.js +222 -0
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -0
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +91 -0
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -0
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js +129 -0
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -0
- package/lib/storage/hydranium-glsp-storage.d.ts +348 -0
- package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -0
- package/lib/storage/hydranium-glsp-storage.js +634 -0
- package/lib/storage/hydranium-glsp-storage.js.map +1 -0
- package/lib/storage/index.d.ts +11 -0
- package/lib/storage/index.d.ts.map +1 -0
- package/lib/storage/index.js +11 -0
- package/lib/storage/index.js.map +1 -0
- package/lib/storage/save-conflict-policy.d.ts +56 -0
- package/lib/storage/save-conflict-policy.d.ts.map +1 -0
- package/lib/storage/save-conflict-policy.js +19 -0
- package/lib/storage/save-conflict-policy.js.map +1 -0
- package/lib/submission/hydranium-glsp-submission-handler.d.ts +109 -0
- package/lib/submission/hydranium-glsp-submission-handler.d.ts.map +1 -0
- package/lib/submission/hydranium-glsp-submission-handler.js +157 -0
- package/lib/submission/hydranium-glsp-submission-handler.js.map +1 -0
- package/lib/submission/index.d.ts +10 -0
- package/lib/submission/index.d.ts.map +1 -0
- package/lib/submission/index.js +10 -0
- package/lib/submission/index.js.map +1 -0
- package/lib/testing/glsp-harness.d.ts +170 -0
- package/lib/testing/glsp-harness.d.ts.map +1 -0
- package/lib/testing/glsp-harness.js +231 -0
- package/lib/testing/glsp-harness.js.map +1 -0
- package/lib/testing/index.d.ts +11 -0
- package/lib/testing/index.d.ts.map +1 -0
- package/lib/testing/index.js +13 -0
- package/lib/testing/index.js.map +1 -0
- package/lib/testing/make-noop-glsp-logger.d.ts +42 -0
- package/lib/testing/make-noop-glsp-logger.d.ts.map +1 -0
- package/lib/testing/make-noop-glsp-logger.js +47 -0
- package/lib/testing/make-noop-glsp-logger.js.map +1 -0
- package/lib/util/index.d.ts +10 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +10 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/service-identifier.d.ts +46 -0
- package/lib/util/service-identifier.d.ts.map +1 -0
- package/lib/util/service-identifier.js +47 -0
- package/lib/util/service-identifier.js.map +1 -0
- package/lib/validation/diagnostic-markers.d.ts +48 -0
- package/lib/validation/diagnostic-markers.d.ts.map +1 -0
- package/lib/validation/diagnostic-markers.js +68 -0
- package/lib/validation/diagnostic-markers.js.map +1 -0
- package/lib/validation/hydranium-glsp-model-validator.d.ts +51 -0
- package/lib/validation/hydranium-glsp-model-validator.d.ts.map +1 -0
- package/lib/validation/hydranium-glsp-model-validator.js +118 -0
- package/lib/validation/hydranium-glsp-model-validator.js.map +1 -0
- package/lib/validation/index.d.ts +11 -0
- package/lib/validation/index.d.ts.map +1 -0
- package/lib/validation/index.js +11 -0
- package/lib/validation/index.js.map +1 -0
- package/package.json +111 -0
- package/src/browser/index.ts +15 -0
- package/src/browser/start-glsp-server-in-worker.ts +202 -0
- package/src/command/hydranium-glsp-recording-command.ts +183 -0
- package/src/command/index.ts +10 -0
- package/src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts +103 -0
- package/src/computed-bounds/index.ts +10 -0
- package/src/dispatcher/index.ts +10 -0
- package/src/dispatcher/server-action-dispatcher.ts +72 -0
- package/src/index.ts +20 -0
- package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +117 -0
- package/src/launcher/glsp-app-module.ts +106 -0
- package/src/launcher/glsp-framework-overrides.ts +51 -0
- package/src/launcher/glsp-server-overrides.ts +46 -0
- package/src/launcher/hydranium-glsp-server.ts +104 -0
- package/src/launcher/index.ts +22 -0
- package/src/logging/glsp-client-logger.ts +184 -0
- package/src/logging/index.ts +10 -0
- package/src/node/index.ts +13 -0
- package/src/node/start-glsp-server.ts +214 -0
- package/src/state/abstract-hydranium-glsp-state.ts +503 -0
- package/src/state/full-text-hydranium-glsp-state.ts +63 -0
- package/src/state/hydranium-glsp-index.ts +337 -0
- package/src/state/hydranium-shared-core-services.ts +92 -0
- package/src/state/index.ts +17 -0
- package/src/state/model-ready-timeout-error.ts +33 -0
- package/src/state/reconcile-source-model-write.ts +77 -0
- package/src/state/reconciling-multi-document-glsp-state.ts +248 -0
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +132 -0
- package/src/storage/hydranium-glsp-storage.ts +660 -0
- package/src/storage/index.ts +11 -0
- package/src/storage/save-conflict-policy.ts +52 -0
- package/src/submission/hydranium-glsp-submission-handler.ts +170 -0
- package/src/submission/index.ts +10 -0
- package/src/testing/glsp-harness.ts +422 -0
- package/src/testing/index.ts +14 -0
- package/src/testing/make-noop-glsp-logger.ts +66 -0
- package/src/util/index.ts +10 -0
- package/src/util/service-identifier.ts +49 -0
- package/src/validation/diagnostic-markers.ts +93 -0
- package/src/validation/hydranium-glsp-model-validator.ts +105 -0
- package/src/validation/index.ts +11 -0
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
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;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
import { DefaultGLSPServer, GLSPServerError, RejectAction } from '@eclipse-glsp/server';
|
|
16
|
+
import { injectable } from 'inversify';
|
|
17
|
+
/**
|
|
18
|
+
* The GLSP server the framework binds in place of upstream's
|
|
19
|
+
* {@link DefaultGLSPServer}, so a failed REQUEST reaches its reader with the
|
|
20
|
+
* text the thrower wrote.
|
|
21
|
+
*
|
|
22
|
+
* **What breaks without it.** Upstream projects a failing request's detail as
|
|
23
|
+
* `error.cause?.toString()` whenever the error is a {@link GLSPServerError},
|
|
24
|
+
* and that one value feeds both the server log and the client's
|
|
25
|
+
* {@link RejectAction}. A {@link GLSPServerError} carrying no `cause` therefore
|
|
26
|
+
* reaches no reader at all — not the toast, not the details pane, not the log —
|
|
27
|
+
* while a plain `Error` survives, because the other branch reads the error
|
|
28
|
+
* itself. The typed error is the trap, and it is the one upstream's own
|
|
29
|
+
* `getOrThrow` helper raises: that helper's signature cannot pass a `cause`, so
|
|
30
|
+
* an adopter using the sanctioned helper has no fix available on their side.
|
|
31
|
+
* Restating the cause at each throw site is the alternative, and it costs
|
|
32
|
+
* every adopter a rule they must know and cannot apply to `getOrThrow`.
|
|
33
|
+
*
|
|
34
|
+
* Only the REQUEST path needs this. Non-request actions fail through
|
|
35
|
+
* upstream's `handleProcessError`, which reads `message` directly.
|
|
36
|
+
*
|
|
37
|
+
* Adopters who bind their own GLSP server should extend this class rather than
|
|
38
|
+
* {@link DefaultGLSPServer}; the framework's server-container override replaces
|
|
39
|
+
* whatever the adopter's `ServerModule` bound, so a subclass of upstream's
|
|
40
|
+
* server would be discarded.
|
|
41
|
+
*/
|
|
42
|
+
let HydraniumGlspServer = class HydraniumGlspServer extends DefaultGLSPServer {
|
|
43
|
+
/**
|
|
44
|
+
* The detail projected into the client's {@link RejectAction} and the server
|
|
45
|
+
* log when a request fails.
|
|
46
|
+
*
|
|
47
|
+
* A {@link GLSPServerError} with no `cause` falls back to its `message`; a
|
|
48
|
+
* nullish `cause` counts as absent, matching the optional chaining upstream
|
|
49
|
+
* applies. Anything else stringifies as upstream does, so a plain `Error`
|
|
50
|
+
* keeps its `"Error: …"` prefix and callers that match on it still match.
|
|
51
|
+
*/
|
|
52
|
+
requestFailureDetail(error) {
|
|
53
|
+
if (error instanceof GLSPServerError) {
|
|
54
|
+
return error.cause === undefined || error.cause === null ? error.message : String(error.cause);
|
|
55
|
+
}
|
|
56
|
+
return error === undefined || error === null ? undefined : String(error);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Lifted verbatim from `@eclipse-glsp/server` 2.7.0's
|
|
60
|
+
* {@link DefaultGLSPServer.handleClientRequest}, with the detail computation
|
|
61
|
+
* delegated to {@link requestFailureDetail}. Nothing else here — the
|
|
62
|
+
* timeout branch, the response dispatch, the nested send-failure handling —
|
|
63
|
+
* relates to that fallback.
|
|
64
|
+
*
|
|
65
|
+
* **This body does not track upstream.** A release that changes request
|
|
66
|
+
* handling would silently not apply, on the path every request takes. There
|
|
67
|
+
* is no narrower seam to override: upstream computes the detail inline. The
|
|
68
|
+
* accompanying test pins upstream's own source for this method, so a bump
|
|
69
|
+
* that changes it fails rather than diverging quietly; re-lift the body when
|
|
70
|
+
* it does.
|
|
71
|
+
*/
|
|
72
|
+
async handleClientRequest(clientSession, action, clientId) {
|
|
73
|
+
try {
|
|
74
|
+
const response = action.timeout !== undefined
|
|
75
|
+
? await clientSession.actionDispatcher.requestUntil(action, action.timeout, true)
|
|
76
|
+
: await clientSession.actionDispatcher.request(action);
|
|
77
|
+
if (response) {
|
|
78
|
+
this.sendResponseToClient(clientId, response);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const detail = this.requestFailureDetail(error);
|
|
83
|
+
this.logger.error(`Failed to handle request '${action.kind}' (${action.requestId}):`, detail);
|
|
84
|
+
try {
|
|
85
|
+
const reject = RejectAction.create(`Failed to handle request '${action.kind}' (${action.requestId})`, {
|
|
86
|
+
responseId: action.requestId,
|
|
87
|
+
detail
|
|
88
|
+
});
|
|
89
|
+
this.sendResponseToClient(clientId, reject);
|
|
90
|
+
}
|
|
91
|
+
catch (sendError) {
|
|
92
|
+
this.logger.error(`Failed to send rejection for request '${action.requestId}':`, sendError);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
HydraniumGlspServer = __decorate([
|
|
98
|
+
injectable()
|
|
99
|
+
], HydraniumGlspServer);
|
|
100
|
+
export { HydraniumGlspServer };
|
|
101
|
+
//# sourceMappingURL=hydranium-glsp-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-server.js","sourceRoot":"","sources":["../../src/launcher/hydranium-glsp-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAElF,OAAO,EAEJ,iBAAiB,EACjB,eAAe,EACf,YAAY,EAGd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,iBAAiB;IACvD;;;;;;;;OAQG;IACO,oBAAoB,CAAC,KAAc;QAC1C,IAAI,KAAK,YAAY,eAAe,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClG,CAAC;QACD,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;;;;;;;OAaG;IACgB,KAAK,CAAC,mBAAmB,CACzC,aAA4B,EAC5B,MAAqC,EACrC,QAAgB;QAEhB,IAAI,CAAC;YACF,MAAM,QAAQ,GACX,MAAM,CAAC,OAAO,KAAK,SAAS;gBACzB,CAAC,CAAC,MAAM,aAAa,CAAC,gBAAgB,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC;gBACjF,CAAC,CAAC,MAAM,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC7D,IAAI,QAAQ,EAAE,CAAC;gBACZ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjD,CAAC;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,MAAM,CAAC,IAAI,MAAM,MAAM,CAAC,SAAS,IAAI,EAAE,MAAM,CAAC,CAAC;YAC9F,IAAI,CAAC;gBACF,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,6BAA6B,MAAM,CAAC,IAAI,MAAM,MAAM,CAAC,SAAS,GAAG,EAAE;oBACnG,UAAU,EAAE,MAAM,CAAC,SAAS;oBAC5B,MAAM;iBACR,CAAC,CAAC;gBACH,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC/C,CAAC;YAAC,OAAO,SAAkB,EAAE,CAAC;gBAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,MAAM,CAAC,SAAS,IAAI,EAAE,SAAS,CAAC,CAAC;YAC/F,CAAC;QACJ,CAAC;IACJ,CAAC;CACH,CAAA;AA1DY,mBAAmB;IAD/B,UAAU,EAAE;GACA,mBAAmB,CA0D/B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
export * from './glsp-app-module.js';
|
|
10
|
+
export * from './abstract-hydranium-glsp-diagram-module.js';
|
|
11
|
+
export * from './hydranium-glsp-server.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/launcher/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,sBAAsB,CAAC;AACrC,cAAc,6CAA6C,CAAC;AAI5D,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
export * from './glsp-app-module.js';
|
|
10
|
+
export * from './abstract-hydranium-glsp-diagram-module.js';
|
|
11
|
+
// Exported so an adopter binding their own GLSP server extends the framework's
|
|
12
|
+
// rather than upstream's — the server-container override discards a subclass of
|
|
13
|
+
// `DefaultGLSPServer`.
|
|
14
|
+
export * from './hydranium-glsp-server.js';
|
|
15
|
+
// The socket bringup lives in `@hydranium/glsp-server/node` and the worker
|
|
16
|
+
// bringup in `@hydranium/glsp-server/browser`, not here: each pulls the
|
|
17
|
+
// upstream build for its platform, which the portable `.` entry must stay free
|
|
18
|
+
// of. `glsp-framework-overrides.js` and `glsp-server-overrides.js` are
|
|
19
|
+
// deliberately NOT re-exported — they are the bindings those two bringups share,
|
|
20
|
+
// reached by relative import, and an adopter composing a container by hand wants
|
|
21
|
+
// the launcher rather than its internals.
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/launcher/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,sBAAsB,CAAC;AACrC,cAAc,6CAA6C,CAAC;AAC5D,+EAA+E;AAC/E,gFAAgF;AAChF,uBAAuB;AACvB,cAAc,4BAA4B,CAAC;AAC3C,2EAA2E;AAC3E,wEAAwE;AACxE,+EAA+E;AAC/E,uEAAuE;AACvE,iFAAiF;AACjF,iFAAiF;AACjF,0CAA0C"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023-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 Logger as GlspLogger, LogLevel } from '@eclipse-glsp/server';
|
|
10
|
+
import { LspLogger, type LspLoggerOptions, type ServerSharedServices } from '@hydranium/core';
|
|
11
|
+
import { type LogThreshold } from '@hydranium/protocol';
|
|
12
|
+
/**
|
|
13
|
+
* Options accepted by {@link GlspClientLogger}. Extends
|
|
14
|
+
* {@link LspLoggerOptions} (which carries the optional `component`
|
|
15
|
+
* label) with the GLSP-specific per-instance {@link logLevel} threshold.
|
|
16
|
+
*/
|
|
17
|
+
export interface GlspClientLoggerOptions extends LspLoggerOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Per-instance NARROWING of the framework threshold. Omit it — the default
|
|
20
|
+
* tracks `Logger.getLevel()` live, which is what makes one
|
|
21
|
+
* `HYDRANIUM_LOG_LEVEL` / one LSP setting govern GLSP output too.
|
|
22
|
+
*
|
|
23
|
+
* It can only narrow, never widen, and that is not a policy choice:
|
|
24
|
+
* `AbstractLogger.send` gates every emission on the process-wide threshold
|
|
25
|
+
* before it reaches the output channel, so a value more verbose than the
|
|
26
|
+
* global is silently ineffective. Set it only to make ONE component quieter
|
|
27
|
+
* than the rest.
|
|
28
|
+
*/
|
|
29
|
+
readonly logLevel?: LogLevel;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Map the framework's {@link LogThreshold} onto GLSP's numeric enum.
|
|
33
|
+
*
|
|
34
|
+
* Two vocabularies have to meet here: ours is a string union with `'off'` and
|
|
35
|
+
* `'trace'`, GLSP's a numeric enum whose most verbose tier is `debug`. `'off'`
|
|
36
|
+
* becomes `none`, and **`'trace'` also becomes `debug`** — GLSP has no finer
|
|
37
|
+
* tier, and mapping it to `none` would silence GLSP at the most verbose
|
|
38
|
+
* framework setting, which is the opposite of what asking for `trace` means.
|
|
39
|
+
*/
|
|
40
|
+
export declare function glspLogLevelOf(threshold: LogThreshold): LogLevel;
|
|
41
|
+
/**
|
|
42
|
+
* Adapter from {@link LspLogger} (the framework's LSP-bound logger in
|
|
43
|
+
* `@hydranium/core`) to GLSP's server-side {@link GlspLogger}
|
|
44
|
+
* abstract base. Lets the GLSP container resolve a logger whose output
|
|
45
|
+
* lines interleave with the LSP head's existing log channel — the only
|
|
46
|
+
* way to debug request/response flow across the two heads in one place.
|
|
47
|
+
*
|
|
48
|
+
* GLSP-specific concerns layered on top of {@link LspLogger}:
|
|
49
|
+
*
|
|
50
|
+
* - A {@link logLevel} field, because GLSP's `Logger` contract declares one.
|
|
51
|
+
* **It tracks the framework's process-wide threshold by default**, resolving
|
|
52
|
+
* `Logger.getLevel()` through {@link glspLogLevelOf} on every read — so
|
|
53
|
+
* `HYDRANIUM_LOG_LEVEL`, the LSP log-level setting and the Theia preference
|
|
54
|
+
* all reach GLSP output without a second knob. Assigning the field (or
|
|
55
|
+
* passing `logLevel`) pins an explicit per-instance NARROWING; see
|
|
56
|
+
* {@link GlspClientLoggerOptions.logLevel} for why it cannot widen.
|
|
57
|
+
* Resolved lazily rather than captured in the constructor: the root logger is
|
|
58
|
+
* built during container setup, before the LSP client has sent its
|
|
59
|
+
* configuration, so a captured value would freeze the launch-time default.
|
|
60
|
+
* - The {@link caller} accessor satisfies GLSP's abstract `Logger.caller`
|
|
61
|
+
* contract; it is backed by {@link LspLogger}'s `component` field.
|
|
62
|
+
* - {@link info} / {@link warn} / {@link error} / {@link debug} accept GLSP's
|
|
63
|
+
* `(message, ...params)` shape and {@link combine} the params into the
|
|
64
|
+
* message via {@link formatParam} so objects render as JSON and errors
|
|
65
|
+
* render with stack. GLSP server code routinely calls
|
|
66
|
+
* `logger.error('Failed', error)` expecting the second argument to be
|
|
67
|
+
* surfaced in the log line.
|
|
68
|
+
*
|
|
69
|
+
* Subclasses can override {@link withUri} to render workspace-relative
|
|
70
|
+
* paths instead of stringified URIs (the typical adopter customisation,
|
|
71
|
+
* mirroring what an adopter does in its LSP-side logger).
|
|
72
|
+
*/
|
|
73
|
+
export declare class GlspClientLogger extends LspLogger implements GlspLogger {
|
|
74
|
+
/**
|
|
75
|
+
* Explicit per-instance narrowing, or `undefined` to track the framework
|
|
76
|
+
* threshold. Kept separate from the resolved value so {@link derive} can pass
|
|
77
|
+
* the OVERRIDE to children rather than the resolution — passing the resolved
|
|
78
|
+
* level would pin every child at whatever the global happened to be when the
|
|
79
|
+
* parent was derived, and container-time derivation is exactly when that
|
|
80
|
+
* value is still the launch-time default.
|
|
81
|
+
*/
|
|
82
|
+
protected logLevelOverride?: LogLevel;
|
|
83
|
+
constructor(services: ServerSharedServices, options?: GlspClientLoggerOptions);
|
|
84
|
+
/** GLSP's `Logger.logLevel` contract; the framework threshold unless pinned. */
|
|
85
|
+
get logLevel(): LogLevel;
|
|
86
|
+
set logLevel(level: LogLevel);
|
|
87
|
+
/** GLSP's `Logger.caller` contract; reads {@link LspLogger.component}. */
|
|
88
|
+
get caller(): string | undefined;
|
|
89
|
+
info(message: string, ...params: unknown[]): this;
|
|
90
|
+
warn(message: string, ...params: unknown[]): this;
|
|
91
|
+
error(message: string, ...params: unknown[]): this;
|
|
92
|
+
debug(message: string, ...params: unknown[]): this;
|
|
93
|
+
/** True when {@link logLevel} permits emission at the given level. */
|
|
94
|
+
protected enabled(level: LogLevel): boolean;
|
|
95
|
+
/** Concatenate a message with its varargs, formatting each via {@link formatParam}. */
|
|
96
|
+
protected combine(message: string, params: readonly unknown[]): string;
|
|
97
|
+
/** Format a single param: errors → `message\nstack`; everything else → JSON.stringify(p, undefined, 4). */
|
|
98
|
+
protected formatParam(param: unknown): string;
|
|
99
|
+
/**
|
|
100
|
+
* Override of {@link LspLogger.derive} that carries the per-instance
|
|
101
|
+
* narrowing. The base `derive(component)` constructs the subclass with
|
|
102
|
+
* `{ component }` only, which would drop it.
|
|
103
|
+
*
|
|
104
|
+
* It passes {@link logLevelOverride}, NOT `this.logLevel`: an unpinned parent
|
|
105
|
+
* must yield an unpinned child, or every derived logger freezes at the
|
|
106
|
+
* threshold in force when the container was built.
|
|
107
|
+
*/
|
|
108
|
+
protected derive(component: string): this;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=glsp-client-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-client-logger.d.ts","sourceRoot":"","sources":["../../src/logging/glsp-client-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,IAAI,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC9D;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CAC/B;AAED;;;;;;;;GAQG;A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ource 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 { LogLevel } from '@eclipse-glsp/server';
|
|
10
|
+
import { LspLogger } from '@hydranium/core';
|
|
11
|
+
import { Logger } from '@hydranium/protocol';
|
|
12
|
+
/**
|
|
13
|
+
* Map the framework's {@link LogThreshold} onto GLSP's numeric enum.
|
|
14
|
+
*
|
|
15
|
+
* Two vocabularies have to meet here: ours is a string union with `'off'` and
|
|
16
|
+
* `'trace'`, GLSP's a numeric enum whose most verbose tier is `debug`. `'off'`
|
|
17
|
+
* becomes `none`, and **`'trace'` also becomes `debug`** — GLSP has no finer
|
|
18
|
+
* tier, and mapping it to `none` would silence GLSP at the most verbose
|
|
19
|
+
* framework setting, which is the opposite of what asking for `trace` means.
|
|
20
|
+
*/
|
|
21
|
+
export function glspLogLevelOf(threshold) {
|
|
22
|
+
switch (threshold) {
|
|
23
|
+
case 'off':
|
|
24
|
+
return LogLevel.none;
|
|
25
|
+
case 'error':
|
|
26
|
+
return LogLevel.error;
|
|
27
|
+
case 'warn':
|
|
28
|
+
return LogLevel.warn;
|
|
29
|
+
case 'info':
|
|
30
|
+
return LogLevel.info;
|
|
31
|
+
case 'debug':
|
|
32
|
+
case 'trace':
|
|
33
|
+
return LogLevel.debug;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Adapter from {@link LspLogger} (the framework's LSP-bound logger in
|
|
38
|
+
* `@hydranium/core`) to GLSP's server-side {@link GlspLogger}
|
|
39
|
+
* abstract base. Lets the GLSP container resolve a logger whose output
|
|
40
|
+
* lines interleave with the LSP head's existing log channel — the only
|
|
41
|
+
* way to debug request/response flow across the two heads in one place.
|
|
42
|
+
*
|
|
43
|
+
* GLSP-specific concerns layered on top of {@link LspLogger}:
|
|
44
|
+
*
|
|
45
|
+
* - A {@link logLevel} field, because GLSP's `Logger` contract declares one.
|
|
46
|
+
* **It tracks the framework's process-wide threshold by default**, resolving
|
|
47
|
+
* `Logger.getLevel()` through {@link glspLogLevelOf} on every read — so
|
|
48
|
+
* `HYDRANIUM_LOG_LEVEL`, the LSP log-level setting and the Theia preference
|
|
49
|
+
* all reach GLSP output without a second knob. Assigning the field (or
|
|
50
|
+
* passing `logLevel`) pins an explicit per-instance NARROWING; see
|
|
51
|
+
* {@link GlspClientLoggerOptions.logLevel} for why it cannot widen.
|
|
52
|
+
* Resolved lazily rather than captured in the constructor: the root logger is
|
|
53
|
+
* built during container setup, before the LSP client has sent its
|
|
54
|
+
* configuration, so a captured value would freeze the launch-time default.
|
|
55
|
+
* - The {@link caller} accessor satisfies GLSP's abstract `Logger.caller`
|
|
56
|
+
* contract; it is backed by {@link LspLogger}'s `component` field.
|
|
57
|
+
* - {@link info} / {@link warn} / {@link error} / {@link debug} accept GLSP's
|
|
58
|
+
* `(message, ...params)` shape and {@link combine} the params into the
|
|
59
|
+
* message via {@link formatParam} so objects render as JSON and errors
|
|
60
|
+
* render with stack. GLSP server code routinely calls
|
|
61
|
+
* `logger.error('Failed', error)` expecting the second argument to be
|
|
62
|
+
* surfaced in the log line.
|
|
63
|
+
*
|
|
64
|
+
* Subclasses can override {@link withUri} to render workspace-relative
|
|
65
|
+
* paths instead of stringified URIs (the typical adopter customisation,
|
|
66
|
+
* mirroring what an adopter does in its LSP-side logger).
|
|
67
|
+
*/
|
|
68
|
+
export class GlspClientLogger extends LspLogger {
|
|
69
|
+
/**
|
|
70
|
+
* Explicit per-instance narrowing, or `undefined` to track the framework
|
|
71
|
+
* threshold. Kept separate from the resolved value so {@link derive} can pass
|
|
72
|
+
* the OVERRIDE to children rather than the resolution — passing the resolved
|
|
73
|
+
* level would pin every child at whatever the global happened to be when the
|
|
74
|
+
* parent was derived, and container-time derivation is exactly when that
|
|
75
|
+
* value is still the launch-time default.
|
|
76
|
+
*/
|
|
77
|
+
logLevelOverride;
|
|
78
|
+
constructor(services, options = {}) {
|
|
79
|
+
super(services, options);
|
|
80
|
+
this.logLevelOverride = options.logLevel;
|
|
81
|
+
}
|
|
82
|
+
/** GLSP's `Logger.logLevel` contract; the framework threshold unless pinned. */
|
|
83
|
+
get logLevel() {
|
|
84
|
+
return this.logLevelOverride ?? glspLogLevelOf(Logger.getLevel());
|
|
85
|
+
}
|
|
86
|
+
set logLevel(level) {
|
|
87
|
+
this.logLevelOverride = level;
|
|
88
|
+
}
|
|
89
|
+
/** GLSP's `Logger.caller` contract; reads {@link LspLogger.component}. */
|
|
90
|
+
get caller() {
|
|
91
|
+
return this.component;
|
|
92
|
+
}
|
|
93
|
+
info(message, ...params) {
|
|
94
|
+
if (this.enabled(LogLevel.info)) {
|
|
95
|
+
super.info(this.combine(message, params));
|
|
96
|
+
}
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
warn(message, ...params) {
|
|
100
|
+
if (this.enabled(LogLevel.warn)) {
|
|
101
|
+
super.warn(this.combine(message, params));
|
|
102
|
+
}
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
error(message, ...params) {
|
|
106
|
+
if (this.enabled(LogLevel.error)) {
|
|
107
|
+
super.error(this.combine(message, params));
|
|
108
|
+
}
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
debug(message, ...params) {
|
|
112
|
+
if (this.enabled(LogLevel.debug)) {
|
|
113
|
+
super.debug(this.combine(message, params));
|
|
114
|
+
}
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
/** True when {@link logLevel} permits emission at the given level. */
|
|
118
|
+
enabled(level) {
|
|
119
|
+
return this.logLevel !== LogLevel.none && level <= this.logLevel;
|
|
120
|
+
}
|
|
121
|
+
/** Concatenate a message with its varargs, formatting each via {@link formatParam}. */
|
|
122
|
+
combine(message, params) {
|
|
123
|
+
return params.length === 0 ? message : `${message} ${params.map(p => this.formatParam(p)).join(',\n')}`;
|
|
124
|
+
}
|
|
125
|
+
/** Format a single param: errors → `message\nstack`; everything else → JSON.stringify(p, undefined, 4). */
|
|
126
|
+
formatParam(param) {
|
|
127
|
+
if (param instanceof Error) {
|
|
128
|
+
return `${param.message}\n${param.stack ?? ''}`;
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
return JSON.stringify(param, undefined, 4);
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return '';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Override of {@link LspLogger.derive} that carries the per-instance
|
|
139
|
+
* narrowing. The base `derive(component)` constructs the subclass with
|
|
140
|
+
* `{ component }` only, which would drop it.
|
|
141
|
+
*
|
|
142
|
+
* It passes {@link logLevelOverride}, NOT `this.logLevel`: an unpinned parent
|
|
143
|
+
* must yield an unpinned child, or every derived logger freezes at the
|
|
144
|
+
* threshold in force when the container was built.
|
|
145
|
+
*/
|
|
146
|
+
derive(component) {
|
|
147
|
+
const Subclass = this.constructor;
|
|
148
|
+
return new Subclass(this.services, { logLevel: this.logLevelOverride, component });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=glsp-client-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-client-logger.js","sourceRoot":"","sources":["../../src/logging/glsp-client-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAA6B,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAoD,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAqB,MAAM,qBAAqB,CAAC;AAsBhE;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,SAAuB;IACnD,QAAQ,SAAS,EAAE,CAAC;QACjB,KAAK,KAAK;YACP,OAAO,QAAQ,CAAC,IAAI,CAAC;QACxB,KAAK,OAAO;YACT,OAAO,QAAQ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C;QACD,IAAI,CAAC;YACF,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACN,OAAO,EAAE,CAAC;QACb,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACgB,MAAM,CAAC,SAAiB;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAA8F,CAAC;QACrH,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC;IACtF,CAAC;CACH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './glsp-client-logger.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './glsp-client-logger.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './start-glsp-server.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAKlF,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
// Server-only entry (`@hydranium/glsp-server/node`). Holds the socket launcher,
|
|
10
|
+
// which binds GLSP's node `SocketServerLauncher` (`@eclipse-glsp/server/node`).
|
|
11
|
+
// The portable `.` entry stays free of that import so it bundles for the browser.
|
|
12
|
+
export * from './start-glsp-server.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,gFAAgF;AAChF,gFAAgF;AAChF,kFAAkF;AAClF,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023-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 Logger as GlspLogger, type ServerModule } from '@eclipse-glsp/server/node.js';
|
|
10
|
+
import { type ContainerModule } from 'inversify';
|
|
11
|
+
import type { Logger } from '@hydranium/protocol';
|
|
12
|
+
import type * as net from 'node:net';
|
|
13
|
+
import type { IntegratedServer } from '@hydranium/core';
|
|
14
|
+
import type { LspConnectionLike } from '@hydranium/core/node';
|
|
15
|
+
/**
|
|
16
|
+
* Options for {@link startGlspServer}.
|
|
17
|
+
*
|
|
18
|
+
* @see {@link startGlspServer} for the lifecycle semantics.
|
|
19
|
+
*/
|
|
20
|
+
export interface GlspServerOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Port to bind. Default `0` — OS-assigned ephemeral. Resolve the
|
|
23
|
+
* actual port off {@link StartedGlspServer.port} once `started`
|
|
24
|
+
* resolves (only then is the address info available).
|
|
25
|
+
*/
|
|
26
|
+
readonly port?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Host to bind. Default `'127.0.0.1'` (LOCAL ONLY) — the GLSP head is
|
|
29
|
+
* traffic-only-from-the-companion-client by design; rebinding to a
|
|
30
|
+
* routable address is an explicit opt-in that adopters must do
|
|
31
|
+
* deliberately.
|
|
32
|
+
*/
|
|
33
|
+
readonly host?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Adopter-supplied logger factory. Called once per Inversify resolution
|
|
36
|
+
* (with `caller` set to the requesting parent's class name) AND once
|
|
37
|
+
* per `LoggerFactory` invocation.
|
|
38
|
+
*
|
|
39
|
+
* **The threshold belongs in here, not beside it.** GLSP's own log level is
|
|
40
|
+
* a property of the logger this factory returns — e.g.
|
|
41
|
+
* `GlspClientLogger` filters
|
|
42
|
+
* each call against its own `logLevel` option. There is deliberately no
|
|
43
|
+
* launcher-level `logLevel`: the framework replaces GLSP's `Logger` binding
|
|
44
|
+
* outright, so anything passed to GLSP's app module would be discarded, and
|
|
45
|
+
* an option that looks authoritative and is discarded is worse than none.
|
|
46
|
+
*/
|
|
47
|
+
readonly createLogger: (caller?: string) => GlspLogger;
|
|
48
|
+
/**
|
|
49
|
+
* The GLSP {@link ServerModule} with per-diagram modules
|
|
50
|
+
* pre-configured via `new ServerModule().configureDiagramModule(...)`.
|
|
51
|
+
*/
|
|
52
|
+
readonly serverModule: ServerModule;
|
|
53
|
+
/**
|
|
54
|
+
* Additional Inversify modules to load on the app container AFTER GLSP's
|
|
55
|
+
* own app module (via `createAppModule`, which binds `InjectionContainer`
|
|
56
|
+
* plus the GLSP-version-specific app bindings) and the framework overrides
|
|
57
|
+
* that route GLSP's logger and logger factory through the adopter logger
|
|
58
|
+
* and add the shared Tracer. Adopters wire language-services bindings
|
|
59
|
+
* (e.g. their own shared-services symbol) here.
|
|
60
|
+
*/
|
|
61
|
+
readonly appModules?: ReadonlyArray<ContainerModule>;
|
|
62
|
+
/**
|
|
63
|
+
* Optional LSP connection used to register a port-discovery request
|
|
64
|
+
* handler. When both `lspConnection` and `portCommand` are set, the
|
|
65
|
+
* framework registers `lspConnection.onRequest(portCommand, () => port)`
|
|
66
|
+
* after the GLSP socket is listening — the standard handshake adopters
|
|
67
|
+
* use to bridge LSP clients to the GLSP head.
|
|
68
|
+
*/
|
|
69
|
+
readonly lspConnection?: LspConnectionLike;
|
|
70
|
+
/**
|
|
71
|
+
* LSP request method name to register. Required when `lspConnection` is
|
|
72
|
+
* set. Adopters define this constant in their own protocol package.
|
|
73
|
+
*/
|
|
74
|
+
readonly portCommand?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Optional framework-lifecycle logger. Receives `listening` / `error`
|
|
77
|
+
* lifecycle messages from the launcher itself (the GLSP container's
|
|
78
|
+
* own logger handles application-level GLSP logs).
|
|
79
|
+
*/
|
|
80
|
+
readonly logger?: Logger;
|
|
81
|
+
/**
|
|
82
|
+
* Optional diagnostic hook called for every incoming `net.Socket` the
|
|
83
|
+
* GLSP server's `net.Server` accepts. Fires as a side-effect of the
|
|
84
|
+
* framework's own `'connection'` listener — GLSP's per-connection setup
|
|
85
|
+
* runs independently from its own listener registered by
|
|
86
|
+
* `SocketServerLauncher`. Adopters typically attach `'data'` / `'close'`
|
|
87
|
+
* listeners inside the hook for byte-level observability when debugging
|
|
88
|
+
* wire-level handshake issues.
|
|
89
|
+
*/
|
|
90
|
+
readonly onClientConnection?: (socket: net.Socket) => void;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Live GLSP server handle returned by {@link startGlspServer}.
|
|
94
|
+
*
|
|
95
|
+
* - {@link IntegratedServer.started} resolves once the GLSP socket is
|
|
96
|
+
* listening AND (if configured) the port-discovery handler has been
|
|
97
|
+
* registered on the LSP connection.
|
|
98
|
+
* - {@link IntegratedServer.stopped} resolves once GLSP's
|
|
99
|
+
* `SocketServerLauncher.start` promise settles (i.e. the underlying
|
|
100
|
+
* `net.Server` has closed).
|
|
101
|
+
* - {@link port} is `undefined` until `started` resolves.
|
|
102
|
+
*/
|
|
103
|
+
export interface StartedGlspServer extends IntegratedServer {
|
|
104
|
+
readonly port: number | undefined;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Start a GLSP socket head. Builds the GLSP app container with framework-
|
|
108
|
+
* default `Logger` / `LoggerFactory` bindings, layers adopter modules,
|
|
109
|
+
* resolves {@link SocketServerLauncher}, configures the adopter
|
|
110
|
+
* {@link ServerModule}, and starts listening.
|
|
111
|
+
*
|
|
112
|
+
* **GLSP launcher coupling.** GLSP's {@link SocketServerLauncher} owns the
|
|
113
|
+
* `net.Server` and per-connection `MessageConnection` construction;
|
|
114
|
+
* the framework wrapper composes ABOVE that launcher rather than replacing
|
|
115
|
+
* it. The framework's own `startSocketServer`
|
|
116
|
+
* helper is NOT used here — it's designed for stdio/raw-JSON-RPC heads
|
|
117
|
+
* (data-server's pattern), not GLSP's Inversify-driven per-connection
|
|
118
|
+
* server-instance model. Bridging the two would lose GLSP's action-handler
|
|
119
|
+
* registry plumbing.
|
|
120
|
+
*/
|
|
121
|
+
export declare function startGlspServer(options: GlspServerOptions): StartedGlspServer;
|
|
122
|
+
//# sourceMappingURL=start-glsp-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-glsp-server.d.ts","sourceRoot":"","sources":["../../src/node/start-glsp-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,IAAI,UAAU,EACzB,KAAK,YAAY,EAKnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,KAAK,GAAG,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACrD;;;;;;OAMG;IACH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