@eclipse-glsp/server 2.6.0-next.3 → 2.7.0-next.6

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 (112) hide show
  1. package/lib/browser/di/app-module.d.ts +1 -1
  2. package/lib/browser/di/app-module.d.ts.map +1 -1
  3. package/lib/browser/di/app-module.js +5 -1
  4. package/lib/browser/di/app-module.js.map +1 -1
  5. package/lib/browser/di/browser-action-dispatch-scope.d.ts +39 -0
  6. package/lib/browser/di/browser-action-dispatch-scope.d.ts.map +1 -0
  7. package/lib/browser/di/browser-action-dispatch-scope.js +77 -0
  8. package/lib/browser/di/browser-action-dispatch-scope.js.map +1 -0
  9. package/lib/browser/di/browser-dispatch-context.d.ts +39 -0
  10. package/lib/browser/di/browser-dispatch-context.d.ts.map +1 -0
  11. package/lib/browser/di/browser-dispatch-context.js +57 -0
  12. package/lib/browser/di/browser-dispatch-context.js.map +1 -0
  13. package/lib/browser/di/sync-dispatch-context.d.ts +39 -0
  14. package/lib/browser/di/sync-dispatch-context.d.ts.map +1 -0
  15. package/lib/browser/di/sync-dispatch-context.js +57 -0
  16. package/lib/browser/di/sync-dispatch-context.js.map +1 -0
  17. package/lib/browser/index.d.ts +2 -1
  18. package/lib/browser/index.d.ts.map +1 -1
  19. package/lib/browser/index.js +2 -1
  20. package/lib/browser/index.js.map +1 -1
  21. package/lib/common/actions/action-dispatcher.d.ts +107 -5
  22. package/lib/common/actions/action-dispatcher.d.ts.map +1 -1
  23. package/lib/common/actions/action-dispatcher.js +199 -26
  24. package/lib/common/actions/action-dispatcher.js.map +1 -1
  25. package/lib/common/actions/client-action-handler.d.ts +1 -1
  26. package/lib/common/actions/client-action-handler.js +2 -2
  27. package/lib/common/actions/client-action-handler.js.map +1 -1
  28. package/lib/common/actions/global-action-provider.js +1 -2
  29. package/lib/common/actions/global-action-provider.js.map +1 -1
  30. package/lib/common/di/service-identifiers.d.ts +1 -1
  31. package/lib/common/features/clipboard/request-clipboard-data-action-handler.d.ts +1 -1
  32. package/lib/common/features/clipboard/request-clipboard-data-action-handler.js +1 -2
  33. package/lib/common/features/clipboard/request-clipboard-data-action-handler.js.map +1 -1
  34. package/lib/common/features/layout/computed-bounds-action-handler.d.ts +1 -1
  35. package/lib/common/features/layout/computed-bounds-action-handler.d.ts.map +1 -1
  36. package/lib/common/features/layout/computed-bounds-action-handler.js +1 -1
  37. package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
  38. package/lib/common/features/model/model-submission-handler.d.ts +6 -4
  39. package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
  40. package/lib/common/features/model/model-submission-handler.js +7 -5
  41. package/lib/common/features/model/model-submission-handler.js.map +1 -1
  42. package/lib/common/features/model/request-model-action-handler.d.ts +1 -1
  43. package/lib/common/features/model/request-model-action-handler.js +1 -1
  44. package/lib/common/features/progress/progress-service.js +1 -1
  45. package/lib/common/index.d.ts +2 -1
  46. package/lib/common/index.d.ts.map +1 -1
  47. package/lib/common/index.js +2 -1
  48. package/lib/common/index.js.map +1 -1
  49. package/lib/common/protocol/glsp-server.d.ts +4 -2
  50. package/lib/common/protocol/glsp-server.d.ts.map +1 -1
  51. package/lib/common/protocol/glsp-server.js +35 -4
  52. package/lib/common/protocol/glsp-server.js.map +1 -1
  53. package/lib/common/utils/action-channel.d.ts +58 -0
  54. package/lib/common/utils/action-channel.d.ts.map +1 -0
  55. package/lib/common/utils/action-channel.js +99 -0
  56. package/lib/common/utils/action-channel.js.map +1 -0
  57. package/lib/common/utils/action-queue.d.ts +58 -0
  58. package/lib/common/utils/action-queue.d.ts.map +1 -0
  59. package/lib/common/utils/action-queue.js +99 -0
  60. package/lib/common/utils/action-queue.js.map +1 -0
  61. package/lib/common/utils/promise-queue.d.ts +5 -1
  62. package/lib/common/utils/promise-queue.d.ts.map +1 -1
  63. package/lib/common/utils/promise-queue.js +5 -1
  64. package/lib/common/utils/promise-queue.js.map +1 -1
  65. package/lib/node/di/app-module.d.ts +1 -1
  66. package/lib/node/di/app-module.d.ts.map +1 -1
  67. package/lib/node/di/app-module.js +2 -0
  68. package/lib/node/di/app-module.js.map +1 -1
  69. package/lib/node/di/async-dispatch-context.d.ts +26 -0
  70. package/lib/node/di/async-dispatch-context.d.ts.map +1 -0
  71. package/lib/node/di/async-dispatch-context.js +35 -0
  72. package/lib/node/di/async-dispatch-context.js.map +1 -0
  73. package/lib/node/di/node-action-dispatch-scope.d.ts +26 -0
  74. package/lib/node/di/node-action-dispatch-scope.d.ts.map +1 -0
  75. package/lib/node/di/node-action-dispatch-scope.js +45 -0
  76. package/lib/node/di/node-action-dispatch-scope.js.map +1 -0
  77. package/lib/node/di/node-dispatch-context.d.ts +26 -0
  78. package/lib/node/di/node-dispatch-context.d.ts.map +1 -0
  79. package/lib/node/di/node-dispatch-context.js +35 -0
  80. package/lib/node/di/node-dispatch-context.js.map +1 -0
  81. package/lib/node/index.d.ts +2 -1
  82. package/lib/node/index.d.ts.map +1 -1
  83. package/lib/node/index.js +2 -1
  84. package/lib/node/index.js.map +1 -1
  85. package/package.json +4 -4
  86. package/src/browser/di/app-module.ts +6 -2
  87. package/src/browser/di/browser-action-dispatch-scope.spec.ts +75 -0
  88. package/src/browser/di/browser-action-dispatch-scope.ts +67 -0
  89. package/src/browser/index.ts +2 -1
  90. package/src/common/actions/action-dispatcher.ts +292 -25
  91. package/src/common/actions/client-action-handler.ts +2 -2
  92. package/src/common/actions/global-action-provider.ts +2 -2
  93. package/src/common/command/recording-command.spec.ts +1 -2
  94. package/src/common/di/service-identifiers.ts +1 -1
  95. package/src/common/features/clipboard/request-clipboard-data-action-handler.ts +2 -2
  96. package/src/common/features/contextactions/context-actions-provider-registry.spec.ts +2 -2
  97. package/src/common/features/layout/computed-bounds-action-handler.ts +6 -3
  98. package/src/common/features/model/model-submission-handler.ts +8 -5
  99. package/src/common/features/model/request-model-action-handler.ts +1 -1
  100. package/src/common/features/progress/progress-service.ts +1 -1
  101. package/src/common/index.ts +2 -1
  102. package/src/common/protocol/glsp-server.ts +41 -2
  103. package/src/common/test/mock-util.ts +17 -3
  104. package/src/common/utils/action-queue.spec.ts +133 -0
  105. package/src/common/utils/action-queue.ts +107 -0
  106. package/src/common/utils/promise-queue.spec.ts +6 -2
  107. package/src/common/utils/promise-queue.ts +5 -1
  108. package/src/node/actions/action-dispatcher.spec.ts +656 -0
  109. package/src/node/di/app-module.ts +4 -2
  110. package/src/node/di/node-action-dispatch-scope.ts +35 -0
  111. package/src/node/index.ts +2 -1
  112. package/src/common/actions/action-dispatcher.spec.ts +0 -291
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022-2023 EclipseSource and others.
2
+ * Copyright (c) 2022-2026 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -1 +1 @@
1
- {"version":3,"file":"app-module.d.ts","sourceRoot":"","sources":["../../../src/browser/di/app-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAgC,mBAAmB,EAA0B,MAAM,eAAe,CAAC;AAE1G,wBAAgB,eAAe,CAAC,OAAO,GAAE,mBAAwB,GAAG,eAAe,CAOlF"}
1
+ {"version":3,"file":"app-module.d.ts","sourceRoot":"","sources":["../../../src/browser/di/app-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAqD,mBAAmB,EAA0B,MAAM,eAAe,CAAC;AAG/H,wBAAgB,eAAe,CAAC,OAAO,GAAE,mBAAwB,GAAG,eAAe,CAUlF"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /********************************************************************************
3
- * Copyright (c) 2022-2023 EclipseSource and others.
3
+ * Copyright (c) 2022-2026 EclipseSource and others.
4
4
  *
5
5
  * This program and the accompanying materials are made available under the
6
6
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -18,10 +18,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.createAppModule = createAppModule;
19
19
  const inversify_1 = require("inversify");
20
20
  const common_1 = require("../../common/");
21
+ const browser_action_dispatch_scope_1 = require("./browser-action-dispatch-scope");
21
22
  function createAppModule(options = {}) {
22
23
  const resolvedOptions = { consoleLog: true, logLevel: common_1.LogLevel.info, ...options };
23
24
  return new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
24
25
  bind(common_1.InjectionContainer).toDynamicValue(dynamicContext => dynamicContext.container);
26
+ // Transient on purpose: a singleton at the server-container level would be shared across
27
+ // sessions and leak the browser flag between them.
28
+ bind(common_1.ActionDispatchScope).to(browser_action_dispatch_scope_1.BrowserActionDispatchScope);
25
29
  const context = { bind, unbind, isBound, rebind };
26
30
  (0, common_1.configureConsoleLogger)(context, resolvedOptions);
27
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"app-module.js","sourceRoot":"","sources":["../../../src/browser/di/app-module.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;AAKlF,0CAOC;AAVD,yCAA4C;AAC5C,0CAA0G;AAE1G,SAAgB,eAAe,CAAC,UAA+B,EAAE;IAC7D,MAAM,eAAe,GAAwB,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAQ,CAAC,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;IACvG,OAAO,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QACzD,IAAI,CAAC,2BAAkB,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACpF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAClD,IAAA,+BAAsB,EAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"app-module.js","sourceRoot":"","sources":["../../../src/browser/di/app-module.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;AAMlF,0CAUC;AAdD,yCAA4C;AAC5C,0CAA+H;AAC/H,mFAA6E;AAE7E,SAAgB,eAAe,CAAC,UAA+B,EAAE;IAC7D,MAAM,eAAe,GAAwB,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAQ,CAAC,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;IACvG,OAAO,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QACzD,IAAI,CAAC,2BAAkB,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACpF,yFAAyF;QACzF,mDAAmD;QACnD,IAAI,CAAC,4BAAmB,CAAC,CAAC,EAAE,CAAC,0DAA0B,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAClD,IAAA,+BAAsB,EAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,39 @@
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 Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action } from '@eclipse-glsp/protocol';
17
+ import { ActionDispatchScope } from '../../common/actions/action-dispatcher';
18
+ /**
19
+ * Browser-compatible {@link ActionDispatchScope} backed by a single boolean flag, used because
20
+ * available `AsyncLocalStorage` polyfills do not work reliably across browser engines (e.g. V8).
21
+ *
22
+ * The flag cannot distinguish "still inside the handler's async continuation" from "unrelated
23
+ * event fired during the handler's await". Any dispatch arriving in such a gap is observed as
24
+ * reentrant and routed inline. Client-originated actions are explicitly treated as non-reentrant
25
+ * to cover the dominant case, but server-side dispatches from non-handler contexts (timer
26
+ * callbacks, event listeners, adopter code) cannot be filtered this way and may interleave with
27
+ * the in-flight handler.
28
+ *
29
+ * The dispatcher normally serializes handler execution; the inline interleaving breaks that
30
+ * guarantee. A handler that pauses on `await` may resume to find that another handler has mutated
31
+ * state in between (model state, command stack, caches), leading to unexpected behavior.
32
+ * Avoid dispatching from non-handler contexts where possible.
33
+ */
34
+ export declare class BrowserActionDispatchScope implements ActionDispatchScope {
35
+ protected active: boolean;
36
+ enter<R>(callback: () => R): R;
37
+ isReentrant(action: Action): boolean;
38
+ }
39
+ //# sourceMappingURL=browser-action-dispatch-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-action-dispatch-scope.d.ts","sourceRoot":"","sources":["../../../src/browser/di/browser-action-dispatch-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAG7E;;;;;;;;;;;;;;;GAeG;AACH,qBACa,0BAA2B,YAAW,mBAAmB;IAClE,SAAS,CAAC,MAAM,UAAS;IAIzB,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAoB9B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAGvC"}
@@ -0,0 +1,77 @@
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 Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ 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;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.BrowserActionDispatchScope = void 0;
25
+ const inversify_1 = require("inversify");
26
+ const client_action_1 = require("../../common/protocol/client-action");
27
+ /**
28
+ * Browser-compatible {@link ActionDispatchScope} backed by a single boolean flag, used because
29
+ * available `AsyncLocalStorage` polyfills do not work reliably across browser engines (e.g. V8).
30
+ *
31
+ * The flag cannot distinguish "still inside the handler's async continuation" from "unrelated
32
+ * event fired during the handler's await". Any dispatch arriving in such a gap is observed as
33
+ * reentrant and routed inline. Client-originated actions are explicitly treated as non-reentrant
34
+ * to cover the dominant case, but server-side dispatches from non-handler contexts (timer
35
+ * callbacks, event listeners, adopter code) cannot be filtered this way and may interleave with
36
+ * the in-flight handler.
37
+ *
38
+ * The dispatcher normally serializes handler execution; the inline interleaving breaks that
39
+ * guarantee. A handler that pauses on `await` may resume to find that another handler has mutated
40
+ * state in between (model state, command stack, caches), leading to unexpected behavior.
41
+ * Avoid dispatching from non-handler contexts where possible.
42
+ */
43
+ let BrowserActionDispatchScope = class BrowserActionDispatchScope {
44
+ constructor() {
45
+ this.active = false;
46
+ }
47
+ // Assumes serial invocation by the dispatcher's queue processor; concurrent enter() calls
48
+ // would corrupt the prior-restore logic and leave the flag stuck.
49
+ enter(callback) {
50
+ const prior = this.active;
51
+ this.active = true;
52
+ let result;
53
+ try {
54
+ result = callback();
55
+ }
56
+ catch (error) {
57
+ this.active = prior;
58
+ throw error;
59
+ }
60
+ if (result instanceof Promise) {
61
+ // Cast required because TS cannot prove the .finally() result matches the generic R.
62
+ return result.finally(() => {
63
+ this.active = prior;
64
+ });
65
+ }
66
+ this.active = prior;
67
+ return result;
68
+ }
69
+ isReentrant(action) {
70
+ return this.active && !client_action_1.ClientAction.is(action);
71
+ }
72
+ };
73
+ exports.BrowserActionDispatchScope = BrowserActionDispatchScope;
74
+ exports.BrowserActionDispatchScope = BrowserActionDispatchScope = __decorate([
75
+ (0, inversify_1.injectable)()
76
+ ], BrowserActionDispatchScope);
77
+ //# sourceMappingURL=browser-action-dispatch-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-action-dispatch-scope.js","sourceRoot":"","sources":["../../../src/browser/di/browser-action-dispatch-scope.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAGlF,yCAAuC;AAEvC,uEAAmE;AAEnE;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAAhC;QACO,WAAM,GAAG,KAAK,CAAC;IA2B7B,CAAC;IAzBG,0FAA0F;IAC1F,kEAAkE;IAClE,KAAK,CAAI,QAAiB;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,MAAS,CAAC;QACd,IAAI,CAAC;YACD,MAAM,GAAG,QAAQ,EAAE,CAAC;QACxB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,MAAM,KAAK,CAAC;QAChB,CAAC;QACD,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;YAC5B,qFAAqF;YACrF,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE;gBACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACxB,CAAC,CAAiB,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,WAAW,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,4BAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACJ,CAAA;AA5BY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,sBAAU,GAAE;GACA,0BAA0B,CA4BtC"}
@@ -0,0 +1,39 @@
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 Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action } from '@eclipse-glsp/protocol';
17
+ import { ActionDispatchContext } from '../../common/actions/action-dispatcher';
18
+ /**
19
+ * Browser-compatible {@link ActionDispatchContext} that uses a simple flag instead of
20
+ * `AsyncLocalStorage`. V8's `await` uses the spec's `PerformPromiseThen` which bypasses
21
+ * patched `Promise.prototype.then`, breaking polyfill-based `AsyncLocalStorage` context
22
+ * propagation across `await` boundaries. This causes deadlocks in the action dispatcher's
23
+ * consumer loop.
24
+ *
25
+ * Since web workers are single-threaded with a single consumer loop, a flag-based approach
26
+ * is sufficient. The flag is set before processing and cleared via `promise.finally()` so
27
+ * it persists across the entire async chain.
28
+ *
29
+ * Unlike native `AsyncLocalStorage`, the flag cannot distinguish "within the handler's async
30
+ * continuation" from "new event that arrived during an await gap." To preserve sequential
31
+ * processing guarantees, {@link isInContext} always returns `false` for client-originated
32
+ * actions, ensuring they are queued rather than dispatched inline.
33
+ */
34
+ export declare class BrowserDispatchContext implements ActionDispatchContext {
35
+ protected active: boolean;
36
+ run<R>(callback: () => R): R;
37
+ isInContext(action: Action): boolean;
38
+ }
39
+ //# sourceMappingURL=browser-dispatch-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-dispatch-context.d.ts","sourceRoot":"","sources":["../../../src/browser/di/browser-dispatch-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAG/E;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,sBAAuB,YAAW,qBAAqB;IAChE,SAAS,CAAC,MAAM,UAAS;IAEzB,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAa5B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAGvC"}
@@ -0,0 +1,57 @@
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 Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.BrowserDispatchContext = void 0;
19
+ const client_action_1 = require("../../common/protocol/client-action");
20
+ /**
21
+ * Browser-compatible {@link ActionDispatchContext} that uses a simple flag instead of
22
+ * `AsyncLocalStorage`. V8's `await` uses the spec's `PerformPromiseThen` which bypasses
23
+ * patched `Promise.prototype.then`, breaking polyfill-based `AsyncLocalStorage` context
24
+ * propagation across `await` boundaries. This causes deadlocks in the action dispatcher's
25
+ * consumer loop.
26
+ *
27
+ * Since web workers are single-threaded with a single consumer loop, a flag-based approach
28
+ * is sufficient. The flag is set before processing and cleared via `promise.finally()` so
29
+ * it persists across the entire async chain.
30
+ *
31
+ * Unlike native `AsyncLocalStorage`, the flag cannot distinguish "within the handler's async
32
+ * continuation" from "new event that arrived during an await gap." To preserve sequential
33
+ * processing guarantees, {@link isInContext} always returns `false` for client-originated
34
+ * actions, ensuring they are queued rather than dispatched inline.
35
+ */
36
+ class BrowserDispatchContext {
37
+ constructor() {
38
+ this.active = false;
39
+ }
40
+ run(callback) {
41
+ const prior = this.active;
42
+ this.active = true;
43
+ const result = callback();
44
+ if (result instanceof Promise) {
45
+ return result.finally(() => {
46
+ this.active = prior;
47
+ });
48
+ }
49
+ this.active = prior;
50
+ return result;
51
+ }
52
+ isInContext(action) {
53
+ return this.active && !client_action_1.ClientAction.is(action);
54
+ }
55
+ }
56
+ exports.BrowserDispatchContext = BrowserDispatchContext;
57
+ //# sourceMappingURL=browser-dispatch-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-dispatch-context.js","sourceRoot":"","sources":["../../../src/browser/di/browser-dispatch-context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAIlF,uEAAmE;AAEnE;;;;;;;;;;;;;;;GAeG;AACH,MAAa,sBAAsB;IAAnC;QACc,WAAM,GAAG,KAAK,CAAC;IAkB7B,CAAC;IAhBG,GAAG,CAAI,QAAiB;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC;QAC1B,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;YAC5B,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE;gBACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACxB,CAAC,CAAiB,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,WAAW,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,4BAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACJ;AAnBD,wDAmBC"}
@@ -0,0 +1,39 @@
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 Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action } from '@eclipse-glsp/protocol';
17
+ import { ActionDispatchContext } from '../../common/actions/action-dispatcher';
18
+ /**
19
+ * Browser-compatible {@link ActionDispatchContext} that uses a simple flag instead of
20
+ * `AsyncLocalStorage`. V8's `await` uses the spec's `PerformPromiseThen` which bypasses
21
+ * patched `Promise.prototype.then`, breaking polyfill-based `AsyncLocalStorage` context
22
+ * propagation across `await` boundaries. This causes deadlocks in the action dispatcher's
23
+ * consumer loop.
24
+ *
25
+ * Since web workers are single-threaded with a single consumer loop, a flag-based approach
26
+ * is sufficient. The flag is set before processing and cleared via `promise.finally()` so
27
+ * it persists across the entire async chain.
28
+ *
29
+ * Unlike native `AsyncLocalStorage`, the flag cannot distinguish "within the handler's async
30
+ * continuation" from "new event that arrived during an await gap." To preserve sequential
31
+ * processing guarantees, {@link isInContext} always returns `false` for client-originated
32
+ * actions, ensuring they are queued rather than dispatched inline.
33
+ */
34
+ export declare class SyncDispatchContext implements ActionDispatchContext {
35
+ protected active: boolean;
36
+ run<R>(callback: () => R): R;
37
+ isInContext(action: Action): boolean;
38
+ }
39
+ //# sourceMappingURL=sync-dispatch-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-dispatch-context.d.ts","sourceRoot":"","sources":["../../../src/browser/di/sync-dispatch-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAG/E;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,mBAAoB,YAAW,qBAAqB;IAC7D,SAAS,CAAC,MAAM,UAAS;IAEzB,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAa5B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAGvC"}
@@ -0,0 +1,57 @@
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 Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SyncDispatchContext = void 0;
19
+ const client_action_1 = require("../../common/protocol/client-action");
20
+ /**
21
+ * Browser-compatible {@link ActionDispatchContext} that uses a simple flag instead of
22
+ * `AsyncLocalStorage`. V8's `await` uses the spec's `PerformPromiseThen` which bypasses
23
+ * patched `Promise.prototype.then`, breaking polyfill-based `AsyncLocalStorage` context
24
+ * propagation across `await` boundaries. This causes deadlocks in the action dispatcher's
25
+ * consumer loop.
26
+ *
27
+ * Since web workers are single-threaded with a single consumer loop, a flag-based approach
28
+ * is sufficient. The flag is set before processing and cleared via `promise.finally()` so
29
+ * it persists across the entire async chain.
30
+ *
31
+ * Unlike native `AsyncLocalStorage`, the flag cannot distinguish "within the handler's async
32
+ * continuation" from "new event that arrived during an await gap." To preserve sequential
33
+ * processing guarantees, {@link isInContext} always returns `false` for client-originated
34
+ * actions, ensuring they are queued rather than dispatched inline.
35
+ */
36
+ class SyncDispatchContext {
37
+ constructor() {
38
+ this.active = false;
39
+ }
40
+ run(callback) {
41
+ const prior = this.active;
42
+ this.active = true;
43
+ const result = callback();
44
+ if (result instanceof Promise) {
45
+ return result.finally(() => {
46
+ this.active = prior;
47
+ });
48
+ }
49
+ this.active = prior;
50
+ return result;
51
+ }
52
+ isInContext(action) {
53
+ return this.active && !client_action_1.ClientAction.is(action);
54
+ }
55
+ }
56
+ exports.SyncDispatchContext = SyncDispatchContext;
57
+ //# sourceMappingURL=sync-dispatch-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-dispatch-context.js","sourceRoot":"","sources":["../../../src/browser/di/sync-dispatch-context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAIlF,uEAAmE;AAEnE;;;;;;;;;;;;;;;GAeG;AACH,MAAa,mBAAmB;IAAhC;QACc,WAAM,GAAG,KAAK,CAAC;IAkB7B,CAAC;IAhBG,GAAG,CAAI,QAAiB;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC;QAC1B,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;YAC5B,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE;gBACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACxB,CAAC,CAAiB,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,WAAW,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,4BAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACJ;AAnBD,kDAmBC"}
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022-2024 EclipseSource and others.
2
+ * Copyright (c) 2022-2026 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -14,6 +14,7 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  export * from './di/app-module';
17
+ export * from './di/browser-action-dispatch-scope';
17
18
  export * from './launch/worker-server-launcher';
18
19
  export * from './reexport';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,iBAAiB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,iBAAiB,CAAC;AAChC,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,YAAY,CAAC"}
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /********************************************************************************
18
- * Copyright (c) 2022-2024 EclipseSource and others.
18
+ * Copyright (c) 2022-2026 EclipseSource and others.
19
19
  *
20
20
  * This program and the accompanying materials are made available under the
21
21
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -30,6 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
30
30
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
31
31
  ********************************************************************************/
32
32
  __exportStar(require("./di/app-module"), exports);
33
+ __exportStar(require("./di/browser-action-dispatch-scope"), exports);
33
34
  __exportStar(require("./launch/worker-server-launcher"), exports);
34
35
  __exportStar(require("./reexport"), exports);
35
36
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,kDAAgC;AAChC,kEAAgD;AAChD,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,kDAAgC;AAChC,qEAAmD;AACnD,kEAAgD;AAChD,6CAA2B"}
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022-2023 STMicroelectronics and others.
2
+ * Copyright (c) 2022-2026 STMicroelectronics and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,9 +13,9 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { Action, Disposable, MaybeArray } from '@eclipse-glsp/protocol';
16
+ import { Action, Deferred, Disposable, MaybeArray, RequestAction, ResponseAction } from '@eclipse-glsp/protocol';
17
+ import { ActionQueue } from '../utils/action-queue';
17
18
  import { Logger } from '../utils/logger';
18
- import { PromiseQueue } from '../utils/promise-queue';
19
19
  import { ActionHandler } from './action-handler';
20
20
  import { ActionHandlerRegistry } from './action-handler-registry';
21
21
  import { ClientActionForwarder } from './client-action-handler';
@@ -27,6 +27,8 @@ export declare const ActionDispatcher: unique symbol;
27
27
  export interface ActionDispatcher {
28
28
  /**
29
29
  * Processes the given action by dispatching it to all registered handlers.
30
+ * Responses matching a pending {@link request} short-circuit and resolve that
31
+ * request without being passed to handlers.
30
32
  *
31
33
  * @param action The action that should be dispatched.
32
34
  * @returns A promise indicating when the action processing is complete.
@@ -49,20 +51,120 @@ export interface ActionDispatcher {
49
51
  */
50
52
  dispatchAfterNextUpdate(actions: Action[]): void;
51
53
  dispatchAfterNextUpdate(...actions: Action[]): void;
54
+ /**
55
+ * Dispatches a request action and returns a promise that resolves when a matching response
56
+ * action is dispatched or rejects if the response is a {@link RejectAction}. The response is
57
+ * _not_ passed to the registered action handlers. Instead, it is the responsibility of the
58
+ * caller of this method to handle the response properly.
59
+ *
60
+ * If the request's `kind` is registered in `ClientActionKinds`, it is forwarded to the client
61
+ * via {@link ClientActionForwarder}. If server-side handlers are registered, they are also
62
+ * executed.
63
+ *
64
+ * Only the first matching response resolves the request. Any additional or late responses
65
+ * are dispatched as normal actions.
66
+ *
67
+ * The promise waits indefinitely until a response arrives or the dispatcher is disposed.
68
+ * Use {@link requestUntil} if a timeout is needed.
69
+ *
70
+ * Note: mutates `action.requestId` (if unset) and `action.timeout`.
71
+ *
72
+ * @param action The request action to dispatch.
73
+ * @returns A promise that resolves with the matching response action.
74
+ */
75
+ request<Res extends ResponseAction>(action: RequestAction<Res>): Promise<Res>;
76
+ /**
77
+ * Dispatches a request and waits for a response until the timeout given in `timeoutMs` has
78
+ * been reached. The returned promise is resolved when a response with a matching identifier
79
+ * is dispatched or when the timeout has been reached. That response is _not_ passed to the
80
+ * registered action handlers. Instead, it is the responsibility of the caller of this method
81
+ * to handle the response properly.
82
+ * If `rejectOnTimeout` is set to `false` (default) the returned promise will be resolved with
83
+ * no value, otherwise it will be rejected.
84
+ *
85
+ * Note: mutates `action.requestId` (if unset) and `action.timeout`.
86
+ *
87
+ * @param action The request action to dispatch.
88
+ * @param timeoutMs Maximum wait time in milliseconds. Defaults to
89
+ * {@link RequestAction.timeout} if set, otherwise 2000 ms.
90
+ * @param rejectOnTimeout Whether to reject the promise on timeout.
91
+ * @returns The matching response, or `undefined` on soft timeout.
92
+ */
93
+ requestUntil<Res extends ResponseAction>(action: RequestAction<Res>, timeoutMs?: number, rejectOnTimeout?: boolean): Promise<Res | undefined>;
52
94
  }
95
+ export declare const ActionDispatchScope: unique symbol;
96
+ /**
97
+ * Scope marker that lets the {@link ActionDispatcher} know whether a call to `dispatch()`
98
+ * originates from inside a running handler (reentrant) or from outside (external).
99
+ *
100
+ * The {@link DefaultActionDispatcher.processActionQueue} loop wraps each action in {@link enter}
101
+ * so that reentrant `dispatch()` calls (handler responses, injected dispatcher calls) can be
102
+ * recognized via {@link isReentrant} and executed inline instead of being queued.
103
+ *
104
+ * Used by the {@link DefaultActionDispatcher} implementation.
105
+ */
106
+ export interface ActionDispatchScope {
107
+ /**
108
+ * Executes the callback inside the dispatch scope. While the callback (and its full async
109
+ * continuation) is running, {@link isReentrant} returns `true` for reentrant calls.
110
+ */
111
+ enter<R>(callback: () => R): R;
112
+ /**
113
+ * Returns `true` if the given dispatch is reentrant — i.e. it originates from within a
114
+ * running {@link enter} callback (handler response or injected dispatcher call) and should
115
+ * run inline rather than being queued.
116
+ *
117
+ * Implementations may inspect the action to apply additional guards, e.g. to ensure
118
+ * client-originated actions are always queued regardless of scope state.
119
+ */
120
+ isReentrant(action: Action): boolean;
121
+ }
122
+ /**
123
+ * Default {@link ActionDispatcher}. External dispatches are queued and processed one at a
124
+ * time; dispatches made from within a running handler run inline with the containing action.
125
+ */
53
126
  export declare class DefaultActionDispatcher implements ActionDispatcher, Disposable {
127
+ protected static readonly STALE_TIMEOUT_GRACE_MS = 30000;
54
128
  protected actionHandlerRegistry: ActionHandlerRegistry;
55
129
  protected clientActionForwarder: ClientActionForwarder;
56
130
  protected logger: Logger;
57
131
  protected clientId: string;
58
- protected actionQueue: PromiseQueue<void>;
132
+ protected dispatchScope: ActionDispatchScope;
133
+ protected actionQueue: ActionQueue<Action>;
59
134
  protected postUpdateQueue: Action[];
135
+ protected readonly pendingRequests: Map<string, Deferred<ResponseAction | undefined>>;
136
+ protected readonly requestTimeouts: Map<string, NodeJS.Timeout>;
137
+ protected nextRequestId: number;
138
+ protected initialize(): void;
139
+ protected generateRequestId(): string;
60
140
  dispatch(action: Action): Promise<void>;
141
+ protected processActionQueue(): Promise<void>;
61
142
  protected doDispatch(action: Action): Promise<void>;
62
- protected executeHandler(handler: ActionHandler, request: Action): Promise<Action[]>;
143
+ protected executeHandler(handler: ActionHandler, action: Action): Promise<Action[]>;
63
144
  protected dispatchResponses(actions: Action[]): Promise<void>;
64
145
  dispatchAll(...actions: MaybeArray<Action>[]): Promise<void>;
65
146
  dispatchAfterNextUpdate(...actions: MaybeArray<Action>[]): void;
147
+ request<Res extends ResponseAction>(action: RequestAction<Res>): Promise<Res>;
148
+ requestUntil<Res extends ResponseAction>(action: RequestAction<Res>, timeoutMs?: number, rejectOnTimeout?: boolean): Promise<Res | undefined>;
149
+ protected doRequest<Res extends ResponseAction>(action: RequestAction<Res>, timeoutMs: number | undefined, rejectOnTimeout: boolean): Promise<Res | undefined>;
150
+ /**
151
+ * If the given action is a {@link SetModelAction} or {@link UpdateModelAction} and there are actions
152
+ * queued via {@link dispatchAfterNextUpdate}, drain and return them.
153
+ *
154
+ * @returns The drained actions, or an empty array if nothing to drain.
155
+ */
156
+ protected drainPostUpdateQueue(action: Action): Action[];
157
+ /**
158
+ * Checks whether the given action is a response matching a pending {@link request} or
159
+ * {@link requestUntil} call. If matched, resolves (or rejects) the corresponding deferred
160
+ * and returns `true` so the caller can short-circuit normal dispatch.
161
+ *
162
+ * For responses with a valid `responseId` but no matching pending request, checks for a stale
163
+ * timeout entry (timed-out request) and clears the `responseId` so the action is not forwarded
164
+ * by {@link ClientActionForwarder}. If no stale entry exists, the `responseId` is left intact
165
+ * for normal forwarding.
166
+ */
167
+ protected interceptPendingResponse(action: Action): boolean;
66
168
  dispose(): void;
67
169
  }
68
170
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"action-dispatcher.d.ts","sourceRoot":"","sources":["../../../src/common/actions/action-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,MAAM,EACN,UAAU,EACV,UAAU,EAMb,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAE3D;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;;OA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