@hydranium/glsp-server 1.0.0-next.31 → 1.0.0-next.315

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 (217) hide show
  1. package/README.md +80 -88
  2. package/lib/browser/start-glsp-server-in-worker.d.ts +43 -42
  3. package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -1
  4. package/lib/browser/start-glsp-server-in-worker.js +62 -13
  5. package/lib/browser/start-glsp-server-in-worker.js.map +1 -1
  6. package/lib/command/diagram-edit-dropped-error.d.ts +31 -0
  7. package/lib/command/diagram-edit-dropped-error.d.ts.map +1 -0
  8. package/lib/command/diagram-edit-dropped-error.js +48 -0
  9. package/lib/command/diagram-edit-dropped-error.js.map +1 -0
  10. package/lib/command/hydranium-glsp-command-stack.d.ts +33 -0
  11. package/lib/command/hydranium-glsp-command-stack.d.ts.map +1 -0
  12. package/lib/command/hydranium-glsp-command-stack.js +63 -0
  13. package/lib/command/hydranium-glsp-command-stack.js.map +1 -0
  14. package/lib/command/hydranium-glsp-operation-action-handler.d.ts +64 -0
  15. package/lib/command/hydranium-glsp-operation-action-handler.d.ts.map +1 -0
  16. package/lib/command/hydranium-glsp-operation-action-handler.js +142 -0
  17. package/lib/command/hydranium-glsp-operation-action-handler.js.map +1 -0
  18. package/lib/command/hydranium-glsp-operation-command.d.ts +250 -0
  19. package/lib/command/hydranium-glsp-operation-command.d.ts.map +1 -0
  20. package/lib/command/hydranium-glsp-operation-command.js +491 -0
  21. package/lib/command/hydranium-glsp-operation-command.js.map +1 -0
  22. package/lib/command/hydranium-glsp-recording-command.d.ts +26 -87
  23. package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
  24. package/lib/command/hydranium-glsp-recording-command.js +40 -117
  25. package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
  26. package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts +23 -0
  27. package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts.map +1 -0
  28. package/lib/command/hydranium-glsp-undo-redo-action-handler.js +41 -0
  29. package/lib/command/hydranium-glsp-undo-redo-action-handler.js.map +1 -0
  30. package/lib/command/index.d.ts +5 -0
  31. package/lib/command/index.d.ts.map +1 -1
  32. package/lib/command/index.js +5 -0
  33. package/lib/command/index.js.map +1 -1
  34. package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts +1 -1
  35. package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts.map +1 -1
  36. package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js +2 -2
  37. package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js.map +1 -1
  38. package/lib/dispatcher/server-action-dispatcher.d.ts +25 -24
  39. package/lib/dispatcher/server-action-dispatcher.d.ts.map +1 -1
  40. package/lib/dispatcher/server-action-dispatcher.js +38 -26
  41. package/lib/dispatcher/server-action-dispatcher.js.map +1 -1
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.d.ts.map +1 -1
  44. package/lib/index.js +1 -0
  45. package/lib/index.js.map +1 -1
  46. package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +35 -59
  47. package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -1
  48. package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +60 -71
  49. package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -1
  50. package/lib/launcher/drop-notifications-to-gone-client.d.ts +23 -0
  51. package/lib/launcher/drop-notifications-to-gone-client.d.ts.map +1 -0
  52. package/lib/launcher/drop-notifications-to-gone-client.js +43 -0
  53. package/lib/launcher/drop-notifications-to-gone-client.js.map +1 -0
  54. package/lib/launcher/glsp-app-module.d.ts +1 -2
  55. package/lib/launcher/glsp-app-module.d.ts.map +1 -1
  56. package/lib/launcher/glsp-app-module.js.map +1 -1
  57. package/lib/launcher/glsp-connection-logger.d.ts +19 -0
  58. package/lib/launcher/glsp-connection-logger.d.ts.map +1 -0
  59. package/lib/launcher/glsp-connection-logger.js +24 -0
  60. package/lib/launcher/glsp-connection-logger.js.map +1 -0
  61. package/lib/launcher/glsp-server-overrides.d.ts +10 -8
  62. package/lib/launcher/glsp-server-overrides.d.ts.map +1 -1
  63. package/lib/launcher/glsp-server-overrides.js +25 -11
  64. package/lib/launcher/glsp-server-overrides.js.map +1 -1
  65. package/lib/launcher/hydranium-glsp-server.d.ts +60 -15
  66. package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -1
  67. package/lib/launcher/hydranium-glsp-server.js +145 -22
  68. package/lib/launcher/hydranium-glsp-server.js.map +1 -1
  69. package/lib/launcher/index.d.ts +2 -0
  70. package/lib/launcher/index.d.ts.map +1 -1
  71. package/lib/launcher/index.js +5 -4
  72. package/lib/launcher/index.js.map +1 -1
  73. package/lib/logging/glsp-client-logger.d.ts +10 -6
  74. package/lib/logging/glsp-client-logger.d.ts.map +1 -1
  75. package/lib/logging/glsp-client-logger.js +14 -7
  76. package/lib/logging/glsp-client-logger.js.map +1 -1
  77. package/lib/messages/index.d.ts +11 -6
  78. package/lib/messages/index.d.ts.map +1 -1
  79. package/lib/messages/index.js +11 -6
  80. package/lib/messages/index.js.map +1 -1
  81. package/lib/node/start-glsp-server.d.ts +50 -15
  82. package/lib/node/start-glsp-server.d.ts.map +1 -1
  83. package/lib/node/start-glsp-server.js +97 -30
  84. package/lib/node/start-glsp-server.js.map +1 -1
  85. package/lib/state/abstract-hydranium-glsp-state.d.ts +326 -102
  86. package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
  87. package/lib/state/abstract-hydranium-glsp-state.js +529 -139
  88. package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
  89. package/lib/state/diagram-status.d.ts +38 -0
  90. package/lib/state/diagram-status.d.ts.map +1 -0
  91. package/lib/state/diagram-status.js +27 -0
  92. package/lib/state/diagram-status.js.map +1 -0
  93. package/lib/state/full-text-hydranium-glsp-state.d.ts +22 -9
  94. package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
  95. package/lib/state/full-text-hydranium-glsp-state.js +45 -18
  96. package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
  97. package/lib/state/hydranium-glsp-index.d.ts +40 -29
  98. package/lib/state/hydranium-glsp-index.d.ts.map +1 -1
  99. package/lib/state/hydranium-glsp-index.js +82 -45
  100. package/lib/state/hydranium-glsp-index.js.map +1 -1
  101. package/lib/state/hydranium-shared-core-services.d.ts +16 -29
  102. package/lib/state/hydranium-shared-core-services.d.ts.map +1 -1
  103. package/lib/state/hydranium-shared-core-services.js +15 -28
  104. package/lib/state/hydranium-shared-core-services.js.map +1 -1
  105. package/lib/state/index.d.ts +1 -0
  106. package/lib/state/index.d.ts.map +1 -1
  107. package/lib/state/index.js +1 -0
  108. package/lib/state/index.js.map +1 -1
  109. package/lib/state/model-ready-timeout-error.d.ts.map +1 -1
  110. package/lib/state/model-ready-timeout-error.js.map +1 -1
  111. package/lib/state/reconcile-source-model-write.d.ts +13 -27
  112. package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
  113. package/lib/state/reconcile-source-model-write.js +44 -32
  114. package/lib/state/reconcile-source-model-write.js.map +1 -1
  115. package/lib/state/reconciling-multi-document-glsp-state.d.ts +125 -69
  116. package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
  117. package/lib/state/reconciling-multi-document-glsp-state.js +242 -100
  118. package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
  119. package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +36 -28
  120. package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
  121. package/lib/state/reconciling-transfer-hydranium-glsp-state.js +59 -42
  122. package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
  123. package/lib/status/diagram-status-reporter.d.ts +44 -0
  124. package/lib/status/diagram-status-reporter.d.ts.map +1 -0
  125. package/lib/status/diagram-status-reporter.js +88 -0
  126. package/lib/status/diagram-status-reporter.js.map +1 -0
  127. package/lib/status/hydranium-glsp-request-model-action-handler.d.ts +27 -0
  128. package/lib/status/hydranium-glsp-request-model-action-handler.d.ts.map +1 -0
  129. package/lib/status/hydranium-glsp-request-model-action-handler.js +52 -0
  130. package/lib/status/hydranium-glsp-request-model-action-handler.js.map +1 -0
  131. package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts +27 -0
  132. package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts.map +1 -0
  133. package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js +53 -0
  134. package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js.map +1 -0
  135. package/lib/status/index.d.ts +12 -0
  136. package/lib/status/index.d.ts.map +1 -0
  137. package/lib/status/index.js +12 -0
  138. package/lib/status/index.js.map +1 -0
  139. package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts +30 -0
  140. package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts.map +1 -0
  141. package/lib/storage/hydranium-glsp-request-save-model-action-handler.js +47 -0
  142. package/lib/storage/hydranium-glsp-request-save-model-action-handler.js.map +1 -0
  143. package/lib/storage/hydranium-glsp-storage.d.ts +324 -143
  144. package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
  145. package/lib/storage/hydranium-glsp-storage.js +569 -213
  146. package/lib/storage/hydranium-glsp-storage.js.map +1 -1
  147. package/lib/storage/index.d.ts +2 -1
  148. package/lib/storage/index.d.ts.map +1 -1
  149. package/lib/storage/index.js +2 -1
  150. package/lib/storage/index.js.map +1 -1
  151. package/lib/storage/save-delivery-policy.d.ts +51 -0
  152. package/lib/storage/save-delivery-policy.d.ts.map +1 -0
  153. package/lib/storage/{save-conflict-policy.js → save-delivery-policy.js} +7 -8
  154. package/lib/storage/save-delivery-policy.js.map +1 -0
  155. package/lib/submission/hydranium-glsp-submission-handler.d.ts +44 -4
  156. package/lib/submission/hydranium-glsp-submission-handler.d.ts.map +1 -1
  157. package/lib/submission/hydranium-glsp-submission-handler.js +82 -6
  158. package/lib/submission/hydranium-glsp-submission-handler.js.map +1 -1
  159. package/lib/testing/glsp-harness.d.ts +34 -7
  160. package/lib/testing/glsp-harness.d.ts.map +1 -1
  161. package/lib/testing/glsp-harness.js +47 -19
  162. package/lib/testing/glsp-harness.js.map +1 -1
  163. package/lib/validation/diagnostic-markers.d.ts +3 -3
  164. package/lib/validation/diagnostic-markers.d.ts.map +1 -1
  165. package/lib/validation/diagnostic-markers.js +1 -1
  166. package/lib/validation/diagnostic-markers.js.map +1 -1
  167. package/lib/validation/hydranium-glsp-model-validator.d.ts +1 -2
  168. package/lib/validation/hydranium-glsp-model-validator.d.ts.map +1 -1
  169. package/lib/validation/hydranium-glsp-model-validator.js +1 -1
  170. package/lib/validation/hydranium-glsp-model-validator.js.map +1 -1
  171. package/package.json +31 -52
  172. package/src/browser/start-glsp-server-in-worker.ts +79 -51
  173. package/src/command/diagram-edit-dropped-error.ts +51 -0
  174. package/src/command/hydranium-glsp-command-stack.ts +47 -0
  175. package/src/command/hydranium-glsp-operation-action-handler.ts +141 -0
  176. package/src/command/hydranium-glsp-operation-command.ts +602 -0
  177. package/src/command/hydranium-glsp-recording-command.ts +40 -121
  178. package/src/command/hydranium-glsp-undo-redo-action-handler.ts +29 -0
  179. package/src/command/index.ts +10 -0
  180. package/src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts +2 -2
  181. package/src/dispatcher/server-action-dispatcher.ts +39 -31
  182. package/src/index.ts +1 -0
  183. package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +79 -91
  184. package/src/launcher/drop-notifications-to-gone-client.ts +47 -0
  185. package/src/launcher/glsp-app-module.ts +1 -2
  186. package/src/launcher/glsp-connection-logger.ts +27 -0
  187. package/src/launcher/glsp-server-overrides.ts +27 -11
  188. package/src/launcher/hydranium-glsp-server.ts +153 -23
  189. package/src/launcher/index.ts +5 -4
  190. package/src/logging/glsp-client-logger.ts +16 -9
  191. package/src/messages/index.ts +16 -6
  192. package/src/node/start-glsp-server.ts +133 -40
  193. package/src/state/abstract-hydranium-glsp-state.ts +609 -154
  194. package/src/state/diagram-status.ts +41 -0
  195. package/src/state/full-text-hydranium-glsp-state.ts +46 -18
  196. package/src/state/hydranium-glsp-index.ts +85 -41
  197. package/src/state/hydranium-shared-core-services.ts +16 -29
  198. package/src/state/index.ts +1 -0
  199. package/src/state/reconcile-source-model-write.ts +51 -53
  200. package/src/state/reconciling-multi-document-glsp-state.ts +276 -102
  201. package/src/state/reconciling-transfer-hydranium-glsp-state.ts +67 -45
  202. package/src/status/diagram-status-reporter.ts +106 -0
  203. package/src/status/hydranium-glsp-request-model-action-handler.ts +43 -0
  204. package/src/status/hydranium-glsp-set-edit-mode-action-handler.ts +38 -0
  205. package/src/status/index.ts +12 -0
  206. package/src/storage/hydranium-glsp-request-save-model-action-handler.ts +40 -0
  207. package/src/storage/hydranium-glsp-storage.ts +647 -223
  208. package/src/storage/index.ts +2 -1
  209. package/src/storage/save-delivery-policy.ts +49 -0
  210. package/src/submission/hydranium-glsp-submission-handler.ts +91 -5
  211. package/src/testing/glsp-harness.ts +67 -25
  212. package/src/validation/diagnostic-markers.ts +3 -3
  213. package/src/validation/hydranium-glsp-model-validator.ts +4 -5
  214. package/lib/storage/save-conflict-policy.d.ts +0 -56
  215. package/lib/storage/save-conflict-policy.d.ts.map +0 -1
  216. package/lib/storage/save-conflict-policy.js.map +0 -1
  217. package/src/storage/save-conflict-policy.ts +0 -52
@@ -1 +1 @@
1
- {"version":3,"file":"hydranium-glsp-recording-command.d.ts","sourceRoot":"","sources":["../../src/command/hydranium-glsp-recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAE5F;;;;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Y,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBpC;;;;OAIG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAgBtC"}
1
+ {"version":3,"file":"hydranium-glsp-recording-command.d.ts","sourceRoot":"","sources":["../../src/command/hydranium-glsp-recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,6BAA6B,EAAiC,MAAM,uCAAuC,CAAC;AAErH;;;;;;;;;GASG;AACH,MAAM,MAAM,2BAA2B,CAAC,YAAY,SAAS,SAAS,IAAI,0BAA0B,CAAC,OAAO,EAAE,YAAY,CAAC,GACxH,cAAc,CAAC,YAAY,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,6BAA6B,CAAC,YAAY,SAAS,SAAS,CAAE,SAAQ,oBAAoB,CAAC,YAAY,CAAC;IAQ/G,mFAAmF;IACnF,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAEhC;uEACmE;IACnE,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAE,MAAM,YAAY,CAAC,IAAI,CAAC;IACxD,0DAA0D;IAC1D,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAE,MAAM,YAAY,CAAC,IAAI,CAAC;IAd3D,UAAkB,UAAU,EAAE,2BAA2B,CAAC,YAAY,CAAC,CAAC;IAExE,uEAAuE;IACvE,SAAS,CAAC,YAAY,CAAC,EAAE,6BAA6B,CAAC,YAAY,CAAC,CAAC;IAErE,YACG,UAAU,EAAE,2BAA2B,CAAC,YAAY,CAAC;IACrD,mFAAmF;IAChE,KAAK,EAAE,MAAM,EAChC,SAAS,EAAE,MAAM,YAAY,CAAC,IAAI,CAAC;IACnC;uEACmE;IAChD,UAAU,CAAC,GAAE,MAAM,YAAY,CAAC,IAAI,CAAC,aAAA;IACxD,0DAA0D;IACvC,UAAU,CAAC,GAAE,MAAM,YAAY,CAAC,IAAI,CAAC,aAAA,EAG1D;IAEc,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CActC;IAED,sFAAsF;IACtF,UAAmB,UAAU,CAAC,SAAS,EAAE,YAAY,GAAG,IAAI,CAE3D;IAED;;;OAGG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAInC;IAED,8DAA8D;IAC/C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAInC;CACH"}
@@ -7,153 +7,76 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  import { JsonRecordingCommand } from '@eclipse-glsp/server';
10
+ import { HydraniumGlspOperationCommand, openOperationOf, runOperation } from './hydranium-glsp-operation-command.js';
10
11
  /**
11
- * GLSP {@link JsonRecordingCommand} base shared by all hydranium adopters.
12
- * Adds two things on top of GLSP's class:
13
- *
14
- * 1. A **time-labelled execute wrapper** so log lines record how long a
15
- * user-facing operation takes end-to-end — including the `postChange`
16
- * source-model update that re-parses the document. Otherwise the diff +
17
- * patch + persist work happens silently and is hard to attribute when
18
- * something is slow.
19
- * 2. A typed `state` field that exposes `updateSourceModel` for the
20
- * `postChange` bridge AND the framework `logger` for time-labelled
21
- * logging. GLSP's base class only types `modelState: JsonModelState`,
22
- * which lacks the framework's logger surface.
12
+ * GLSP {@link JsonRecordingCommand} base shared by all hydranium adopters: a
13
+ * handler mutates `sourceRoot` in the command's runnable, and the operation
14
+ * the command executes in writes the result once when it ends.
23
15
  *
24
16
  * **Optional undo/redo bridge hooks.** An adopter command can supply
25
- * `undoAction` / `redoAction` callbacks invoked alongside the patch apply, to
26
- * re-emit a side-effect the patch itself does not carry. Provided as optional
27
- * constructor args so adopters get that composition surface without
28
- * subclassing. Operation handlers that don't need bridge callbacks omit them.
17
+ * `undoAction` / `redoAction` callbacks, run when the operation is undone or
18
+ * redone and when a failed operation rolls back, to re-emit a side effect the
19
+ * model does not carry. During an undo or redo they run against throwaway
20
+ * copies, and a recording command executed there throws.
29
21
  *
30
- * **postChange semantics.** GLSP's `JsonRecordingCommand.postChange` calls
31
- * `modelState.updateSourceModel(newModel)` with the model only. The
32
- * framework lift overrides `postChange` so it also threads the based-on
33
- * version captured at command start — letting the downstream
34
- * `ModelService.update` opt into the `ConflictError` gate. Undo / redo
35
- * postChange calls run with version `undefined` (no gating): the user
36
- * authored against the recorded patch, not against a specific server
37
- * version, so re-applying it should succeed regardless of intervening
38
- * edits. The recorded patch itself encodes the semantic intent.
22
+ * A command executed outside an operation opens one of its own through
23
+ * `runExclusive`, so executing it from inside the boundary with no operation
24
+ * open deadlocks. Its undo and redo then undo and redo that operation without
25
+ * taking the boundary, which the caller holds, as the framework's undo handler
26
+ * does; taking it there would deadlock under that handler.
39
27
  */
40
28
  export class HydraniumGlspRecordingCommand extends JsonRecordingCommand {
41
29
  label;
42
30
  undoAction;
43
31
  redoAction;
44
- /**
45
- * Based-on version captured at {@link execute} start; threaded into
46
- * {@link postChange} so {@link AbstractHydraniumGlspState.updateSourceModel}
47
- * sees the version the user authored against. Cleared after `execute`
48
- * returns so undo / redo paths fall through to `updateSourceModel`
49
- * without a version (no gating).
50
- */
51
- activeVersion;
52
- /**
53
- * Source-model snapshots captured at {@link execute} — the state the
54
- * command left ({@link afterSnapshot}) and the state it started from
55
- * ({@link beforeSnapshot}). {@link undo} / {@link redo} reconcile the
56
- * recorded transition against the *current* source model via the state's
57
- * {@link AbstractHydraniumGlspState.conflictResolver}, so under the default
58
- * reconciling policy a concurrent edit to another field survives and a
59
- * same-field collision is dropped rather than clobbered.
60
- */
61
- beforeSnapshot;
62
- afterSnapshot;
32
+ /** The operation this command opened, when it executed outside one. */
33
+ ownOperation;
63
34
  constructor(modelState,
64
35
  /** Human-readable label for the operation; appears in the timing-pair log line. */
65
36
  label, doExecute,
66
- /** Optional bridge invoked alongside undo patch application; for adopters
67
- * that need to re-emit a side-effect the patch does not carry. */
37
+ /** Optional bridge invoked when the command is undone; for adopters
38
+ * that need to re-emit a side-effect the model does not carry. */
68
39
  undoAction,
69
- /** Optional bridge invoked alongside redo patch application. */
40
+ /** Optional bridge invoked when the command is redone. */
70
41
  redoAction) {
71
42
  super(modelState, doExecute);
72
43
  this.label = label;
73
44
  this.undoAction = undoAction;
74
45
  this.redoAction = redoAction;
75
46
  }
76
- /**
77
- * Time-label the full execute path: pre-state snapshot + `doExecute` +
78
- * post-state snapshot + patch-derive + `postChange` (which writes back
79
- * via {@link AbstractHydraniumGlspState.updateSourceModel}). The label combines
80
- * the operation name with the source-uri-stamped logger.
81
- *
82
- * Captures {@link AbstractHydraniumGlspState.version} at start so {@link postChange}
83
- * can thread the based-on version into `updateSourceModel`. The capture
84
- * is `try`/`finally`-scoped so undo / redo paths invoked later do not
85
- * see a stale captured version.
86
- */
87
47
  async execute() {
88
- const logger = this.modelState.logger.for('HydraniumGlspRecordingCommand');
89
- this.activeVersion = this.modelState.version;
90
- logger.debug(`Executing '${this.label}' (based-on doc.version=v${this.activeVersion})`);
91
- this.beforeSnapshot = this.deepClone(await this.getJsonObject());
92
- try {
93
- await this.modelState.tracer.for('HydraniumGlspRecordingCommand').time(`Execute command '${this.label}'`, () => super.execute());
94
- }
95
- finally {
96
- this.activeVersion = undefined;
48
+ const open = openOperationOf(this.modelState);
49
+ if (!open) {
50
+ const operation = new HydraniumGlspOperationCommand(this.modelState);
51
+ if ((await this.modelState.runExclusive(() => runOperation(operation, () => this))) === 'executed') {
52
+ this.ownOperation = operation;
53
+ }
54
+ return;
97
55
  }
98
- this.afterSnapshot = this.deepClone(await this.getJsonObject());
56
+ open.assertNotDuringUndoRedo(this.label);
57
+ const tracer = this.modelState.tracer.for('HydraniumGlspRecordingCommand');
58
+ tracer.debug(`Executing '${this.label}' (base version v${this.modelState.version})`);
59
+ await tracer.time(`Execute command '${this.label}'`, () => super.execute());
60
+ open.recordExecuted({ undo: () => this.undoAction?.(), redo: () => this.redoAction?.() });
99
61
  }
100
- /**
101
- * Override of GLSP's {@link JsonRecordingCommand.postChange} so the
102
- * call to {@link AbstractHydraniumGlspState.updateSourceModel} threads the
103
- * captured based-on version alongside the new model.
104
- *
105
- * During {@link execute} the version is the snapshot captured at
106
- * command start; during {@link undo} / {@link redo} it is `undefined`
107
- * — replaying a recorded patch does not author against a specific
108
- * server version, so no gate applies.
109
- */
110
- postChange(newModel) {
111
- return this.modelState.updateSourceModel(newModel, this.activeVersion);
62
+ /** Writes nothing: the operation the command executes in writes once when it ends. */
63
+ postChange(_newModel) {
64
+ // Written by the operation.
112
65
  }
113
66
  /**
114
- * Reconcile the recorded `after → before` transition against the
115
- * *current* source model via the state's
116
- * {@link AbstractHydraniumGlspState.conflictResolver}, invoke the optional adopter
117
- * `undoAction`, and persist via `postChange`. Under the default reconciling
118
- * policy the revert is replayed guarded by `test` ops, so a concurrent edit
119
- * to another field is preserved (merged) and a same-field collision is
120
- * dropped rather than clobbered; a force policy clobbers (last-writer-wins).
121
- * On anything but a clean merge the undo is a logged no-op — the side-effect
122
- * bridge and `postChange` only run on a merged result, preserving a
123
- * "bridge before commit" order.
67
+ * Inside an open operation does nothing: the operation runs the bridge, once
68
+ * for every recording command that executed.
124
69
  */
125
70
  async undo() {
126
- if (!this.undoPatch || this.beforeSnapshot === undefined || this.afterSnapshot === undefined) {
127
- return;
71
+ if (!openOperationOf(this.modelState)) {
72
+ await this.ownOperation?.undo();
128
73
  }
129
- const logger = this.modelState.logger.for('HydraniumGlspRecordingCommand');
130
- logger.debug(`Undoing '${this.label}' at doc.version=v${this.modelState.version}`);
131
- const outcome = await this.modelState.conflictResolver.resolve(this.afterSnapshot, this.beforeSnapshot, async () => this.getJsonObject());
132
- if (outcome.status !== 'merged') {
133
- logger.warn(`Undo '${this.label}' skipped (${outcome.status}); a foreign edit changed a shared field since the command ran`);
134
- return;
135
- }
136
- await this.undoAction?.();
137
- await this.postChange?.(outcome.merged);
138
74
  }
139
- /**
140
- * Reconcile the recorded `before → after` transition against the current
141
- * source model, invoke the optional adopter `redoAction`, and persist via
142
- * `postChange`. Same guarded merge / drop semantics as {@link undo}.
143
- */
75
+ /** Inside an open operation does nothing, as {@link undo}. */
144
76
  async redo() {
145
- if (!this.redoPatch || this.beforeSnapshot === undefined || this.afterSnapshot === undefined) {
146
- return;
147
- }
148
- const logger = this.modelState.logger.for('HydraniumGlspRecordingCommand');
149
- logger.debug(`Redoing '${this.label}' at doc.version=v${this.modelState.version}`);
150
- const outcome = await this.modelState.conflictResolver.resolve(this.beforeSnapshot, this.afterSnapshot, async () => this.getJsonObject());
151
- if (outcome.status !== 'merged') {
152
- logger.warn(`Redo '${this.label}' skipped (${outcome.status}); a foreign edit changed a shared field since the undo`);
153
- return;
77
+ if (!openOperationOf(this.modelState)) {
78
+ await this.ownOperation?.redo();
154
79
  }
155
- await this.redoAction?.();
156
- await this.postChange?.(outcome.merged);
157
80
  }
158
81
  }
159
82
  //# sourceMappingURL=hydranium-glsp-recording-command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hydranium-glsp-recording-command.js","sourceRoot":"","sources":["../../src/command/hydranium-glsp-recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAuC,oBAAoB,EAAqB,MAAM,sBAAsB,CAAC;AAiBpH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,6BAA8D,SAAQ,oBAAkC;IA2B5F;IAIA;IAEA;IA9BtB;;;;;;OAMG;IACO,aAAa,CAAU;IAEjC;;;;;;;;OAQG;IACO,cAAc,CAAgB;IAC9B,aAAa,CAAgB;IAEvC,YACG,UAAqD;IACrD,mFAAmF;IAChE,KAAa,EAChC,SAAmC;IACnC;uEACmE;IAChD,UAAqC;IACxD,gEAAgE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AAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE,CAChH,IAAI,CAAC,aAAa,EAAE,CACtB,CAAC;QACF,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,cAAc,OAAO,CAAC,MAAM,yDAAyD,CAAC,CAAC;YACtH,OAAO;QACV,CAAC;QACD,MAAM,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;QAC1B,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACH"}
1
+ {"version":3,"file":"hydranium-glsp-recording-command.js","sourceRoot":"","sources":["../../src/command/hydranium-glsp-recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAuC,oBAAoB,EAAqB,MAAM,sBAAsB,CAAC;AAGpH,OAAO,EAAE,6BAA6B,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAerH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,6BAA8D,SAAQ,oBAAkC;IAS5F,KAAK;IAIL,UAAU;IAEV,UAAU;IAZhC,uEAAuE;IAC7D,YAAY,CAA+C;IAErE,YACG,UAAqD;IACrD,mFAAmF;IAChE,KAAa,EAChC,SAAmC;IACnC;uEACmE;IAChD,UAAqC;IACxD,0DAA0D;IACvC,UAAqC;QAExD,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;qBARV,KAAK;0BAIL,UAAU;0BAEV,UAAU;IAGhC,CAAC;IAEQ,KAAK,CAAC,OAAO;QACnB,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAI,CAAC,IAAI,EAAE,CAAC;YACT,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAe,IAAI,CAAC,UAAU,CAAC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I,EAAE,CAAC;QACnC,CAAC;IACJ,CAAC;CACH"}
@@ -0,0 +1,23 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { type Action, UndoRedoActionHandler } from '@eclipse-glsp/server';
10
+ import { type AstNode } from '@hydranium/langium';
11
+ import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-glsp-state.js';
12
+ /**
13
+ * GLSP's undo and redo handler inside the state's `runExclusive`. GLSP's
14
+ * command stack moves its position before it undoes or redoes the entry, so
15
+ * the boundary covers the whole action: taken around the undo or redo alone,
16
+ * an undo arriving while an operation runs would move the position past an
17
+ * entry it then cannot undo.
18
+ */
19
+ export declare class HydraniumGlspUndoRedoActionHandler extends UndoRedoActionHandler {
20
+ protected readonly modelState: AbstractHydraniumGlspState<AstNode, unknown>;
21
+ execute(action: Action): Promise<Action[]>;
22
+ }
23
+ //# sourceMappingURL=hydranium-glsp-undo-redo-action-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydranium-glsp-undo-redo-action-handler.d.ts","sourceRoot":"","sources":["../../src/command/hydranium-glsp-undo-redo-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAc,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAE5F;;;;;;GAMG;AACH,qBACa,kCAAmC,SAAQ,qBAAqB;IACtD,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAG,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAExF,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAElD;CACH"}
@@ -0,0 +1,41 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ 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
+ var __metadata = (this && this.__metadata) || function (k, v) {
16
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
17
+ };
18
+ import { ModelState, UndoRedoActionHandler } from '@eclipse-glsp/server';
19
+ import { inject, injectable } from 'inversify';
20
+ /**
21
+ * GLSP's undo and redo handler inside the state's `runExclusive`. GLSP's
22
+ * command stack moves its position before it undoes or redoes the entry, so
23
+ * the boundary covers the whole action: taken around the undo or redo alone,
24
+ * an undo arriving while an operation runs would move the position past an
25
+ * entry it then cannot undo.
26
+ */
27
+ let HydraniumGlspUndoRedoActionHandler = class HydraniumGlspUndoRedoActionHandler extends UndoRedoActionHandler {
28
+ modelState;
29
+ execute(action) {
30
+ return this.modelState.runExclusive(() => super.execute(action));
31
+ }
32
+ };
33
+ __decorate([
34
+ inject(ModelState),
35
+ __metadata("design:type", Function)
36
+ ], HydraniumGlspUndoRedoActionHandler.prototype, "modelState", void 0);
37
+ HydraniumGlspUndoRedoActionHandler = __decorate([
38
+ injectable()
39
+ ], HydraniumGlspUndoRedoActionHandler);
40
+ export { HydraniumGlspUndoRedoActionHandler };
41
+ //# sourceMappingURL=hydranium-glsp-undo-redo-action-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydranium-glsp-undo-redo-action-handler.js","sourceRoot":"","sources":["../../src/command/hydranium-glsp-undo-redo-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,EAAe,UAAU,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG/C;;;;;;GAMG;AAEI,IAAM,kCAAkC,GAAxC,MAAM,kCAAmC,SAAQ,qBAAqB;IACnC,UAAU,CAAgD;IAExF,OAAO,CAAC,MAAc;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACpE,CAAC;CACH,CAAA;AALyC;IAAtC,MAAM,CAAC,UAAU,CAAC;;sEAA8E;AADvF,kCAAkC;IAD9C,UAAU,EAAE;GACA,kCAAkC,CAM9C"}
@@ -7,4 +7,9 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  export * from './hydranium-glsp-recording-command.js';
10
+ export * from './hydranium-glsp-command-stack.js';
11
+ export * from './hydranium-glsp-operation-action-handler.js';
12
+ export { HydraniumGlspOperationCommand, type OperationSideEffect, type OperationTransition, type UndoRedoDirection } from './hydranium-glsp-operation-command.js';
13
+ export * from './hydranium-glsp-undo-redo-action-handler.js';
14
+ export * from './diagram-edit-dropped-error.js';
10
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,8CAA8C,CAAC;AAC7D,OAAO,EACJ,6BAA6B,EAC7B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACxB,MAAM,uCAAuC,CAAC;AAC/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,iCAAiC,CAAC"}
@@ -7,4 +7,9 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  export * from './hydranium-glsp-recording-command.js';
10
+ export * from './hydranium-glsp-command-stack.js';
11
+ export * from './hydranium-glsp-operation-action-handler.js';
12
+ export { HydraniumGlspOperationCommand } from './hydranium-glsp-operation-command.js';
13
+ export * from './hydranium-glsp-undo-redo-action-handler.js';
14
+ export * from './diagram-edit-dropped-error.js';
10
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,8CAA8C,CAAC;AAC7D,OAAO,EACJ,6BAA6B,EAI/B,MAAM,uCAAuC,CAAC;AAC/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,iCAAiC,CAAC"}
@@ -23,7 +23,7 @@ import { type HydraniumGlspSubmissionHandler } from '../submission/hydranium-gls
23
23
  * very first `computedBounds` arrives with a revision the server has already
24
24
  * bumped, the subsequent `SetModelAction` response never fires and the diagram
25
25
  * stays stuck at "model loading…". Adopters need this initial-handshake case
26
- * surfaced as a warning so the failure mode is visible in logs.
26
+ * logged as an error: the diagram stays empty, so the requested load failed.
27
27
  *
28
28
  * **Handshake detection** uses
29
29
  * {@link HydraniumGlspSubmissionHandler.hasPendingInitialRequest} — true
@@ -1 +1 @@
1
- {"version":3,"file":"hydranium-glsp-computed-bounds-action-handler.d.ts","sourceRoot":"","sources":["../../src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,2BAA2B,EAC3B,KAAK,UAAU,EACf,KAAK,YAAY,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AAEzG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBACa,wCAAyC,SAAQ,2BAA2B;IACtF,mBAA2B,UAAU,EAAE,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpF,mBAA2B,iBAAiB,EAAE,8BAA8B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEtF,OAAO,CAAC,MAAM,EAAE,oBAAoB,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IAqBtE;;;;;;;;;;;;;;;OAeG;cACgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,oBAAoB,GAAG,IAAI;CAatF"}
1
+ {"version":3,"file":"hydranium-glsp-computed-bounds-action-handler.d.ts","sourceRoot":"","sources":["../../src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,2BAA2B,EAC3B,KAAK,UAAU,EACf,KAAK,YAAY,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AAEzG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBACa,wCAAyC,SAAQ,2BAA2B;IACtF,mBAA2B,UAAU,EAAE,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpF,mBAA2B,iBAAiB,EAAE,8BAA8B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEtF,OAAO,CAAC,MAAM,EAAE,oBAAoB,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAmBrE;IAED;;;;;;;;;;;;;;;OAeG;IACH,UAAmB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAYnF;CACH"}
@@ -27,7 +27,7 @@ import { injectable } from 'inversify';
27
27
  * very first `computedBounds` arrives with a revision the server has already
28
28
  * bumped, the subsequent `SetModelAction` response never fires and the diagram
29
29
  * stays stuck at "model loading…". Adopters need this initial-handshake case
30
- * surfaced as a warning so the failure mode is visible in logs.
30
+ * logged as an error: the diagram stays empty, so the requested load failed.
31
31
  *
32
32
  * **Handshake detection** uses
33
33
  * {@link HydraniumGlspSubmissionHandler.hasPendingInitialRequest} — true
@@ -46,7 +46,7 @@ let HydraniumGlspComputedBoundsActionHandler = class HydraniumGlspComputedBounds
46
46
  const model = this.modelState.root;
47
47
  if (action.revision !== model.revision) {
48
48
  if (this.submissionHandler.hasPendingInitialRequest()) {
49
- this.modelState.logger.warn(`ComputedBounds rejected (initial handshake): action.revision=${action.revision} model.revision=${model.revision} — ` +
49
+ this.modelState.logger.error(`ComputedBounds rejected (initial handshake): action.revision=${action.revision} model.revision=${model.revision} — ` +
50
50
  'initial SetModelAction will not fire (empty diagram)');
51
51
  }
52
52
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"hydranium-glsp-computed-bounds-action-handler.js","sourceRoot":"","sources":["../../src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAElF,OAAO,EAGJ,2BAA2B,EAG7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAIvC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEI,IAAM,wCAAwC,GAA9C,MAAM,wCAAyC,SAAQ,2BAA2B;IAI7E,OAAO,CAAC,MAA4B;QAC1C,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,gEAAgE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChH,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACnC,IAAI,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC;YACtC,IAAI,IAAI,CAAC,iBAAiB,CAAC,wBAAwB,EAAE,EAAE,CAAC;gBACrD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CACxB,gEAAgE,MAAM,CAAC,QAAQ,mBAAmB,KAAK,CAAC,QAAQ,KAAK;oBAClH,sDAAsD,CAC3D,CAAC;YACL,CAAC;iBAAM,CAAC;gBACL,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CACzB,mDAAmD,MAAM,CAAC,QAAQ,mBAAmB,KAAK,CAAC,QAAQ,KAAK;oBACrG,sDAAsD,CAC3D,CAAC;YACL,CAAC;YACD,OAAO,EAAE,CAAC;QACb,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,MAAM,CAAC,QAAQ,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3H,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACgB,WAAW,CAAC,IAAgB,EAAE,MAA4B;QAC1E,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;YACtC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YAC1F,MAAM,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;YAChD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CACzB,0BAA0B,OAAO,IAAI,QAAQ,uEAAuE,CACtH,CAAC;YACL,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;CACH,CAAA;AAtDY,wCAAwC;IADpD,UAAU,EAAE;GACA,wCAAwC,CAsDpD"}
1
+ {"version":3,"file":"hydranium-glsp-computed-bounds-action-handler.js","sourceRoot":"","sources":["../../src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAElF,OAAO,EAGJ,2BAA2B,EAG7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAIvC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEI,IAAM,wCAAwC,GAA9C,MAAM,wCAAyC,SAAQ,2BAA2B;IAI7E,OAAO,CAAC,MAA4B;QAC1C,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,gEAAgE,MAAM,CAAC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C,MAAM,CAAC,MAAM,CAAC;YAChD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CACzB,0BAA0B,OAAO,IAAI,QAAQ,uEAAuE,CACtH,CAAC;YACL,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;CACH,CAAA;AAtDY,wCAAwC;IADpD,UAAU,EAAE;GACA,wCAAwC,CAsDpD"}
@@ -6,47 +6,48 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
- import { type Action, DefaultActionDispatcher } from '@eclipse-glsp/server';
9
+ import { type Action, CheckEdgeResultAction, DefaultActionDispatcher } from '@eclipse-glsp/server';
10
10
  import { type Tracer } from '@hydranium/protocol';
11
- import { type GlspClientLogger } from '../logging/glsp-client-logger.js';
12
11
  /**
13
- * Server-side action dispatcher with built-in traffic observability:
14
- * every {@link DefaultActionDispatcher.dispatch} call is wrapped in a
15
- * {@link Tracer.time} pair that records the dispatch direction
16
- * (`→ client` vs `→ server`) and timing.
12
+ * Server-side action dispatcher with built-in traffic observability: while
13
+ * debug is enabled, each {@link DefaultActionDispatcher.dispatch} call runs
14
+ * inside {@link Tracer.time}, which logs it with its direction (`→ client` vs
15
+ * `→ server`) and timing only when it is slow or fails, and an action that
16
+ * {@link summarize} details gets its own debug line whatever its duration.
17
17
  *
18
18
  * **Why this lives in the framework (vs left as an adopter override).**
19
19
  * Debugging GLSP state, storage, and submission flows depends heavily on
20
- * seeing each action with timing and direction — especially when bringing
21
- * up a new adopter against an empty/partial diagram before its submission
22
- * flow is complete. Providing this dispatcher in the framework gives every
23
- * adopter the same observability primitive from the very first GLSP-head
24
- * launch.
20
+ * seeing slow or failing actions with timing and direction — especially when
21
+ * bringing up a new adopter against an empty/partial diagram before its
22
+ * submission flow is complete. Providing this dispatcher in the framework
23
+ * gives every adopter the same observability primitive from the very first
24
+ * GLSP-head launch.
25
25
  *
26
26
  * **Extension points.**
27
27
  * - {@link loggedKinds} — if set, filter the log lines (the dispatch
28
- * still happens; only the bracketed timing line is suppressed). Default
29
- * `undefined` means **every** action's dispatch is timed and logged.
30
- * - {@link summarize} — return a non-empty string to append `[summary]`
31
- * to the log line; default returns `''` (no extra bracket).
32
- *
33
- * Adopters bind it in a per-diagram module, as the `ActionDispatcher` service.
28
+ * still happens; only its timing and summary lines are suppressed).
29
+ * Default `undefined` times every action's dispatch while debug is enabled.
30
+ * - {@link summarize} — return a non-empty string to log it as a debug line
31
+ * for the dispatch; `''` logs none.
34
32
  */
35
33
  export declare class HydraniumGlspServerActionDispatcher extends DefaultActionDispatcher {
36
- /** Narrowed from `Logger`; DI binds {@link GlspClientLogger}. */
37
- protected readonly logger: GlspClientLogger;
38
34
  /** Caller-tagged tracer (auto-componented with this class name, like the logger). */
39
35
  protected readonly tracer: Tracer;
40
36
  /**
41
- * If set, the timing log line is emitted only when `action.kind` is in
42
- * this set. Subclasses override via field reassignment.
37
+ * If set, the timing and summary lines are emitted only when `action.kind`
38
+ * is in this set. Subclasses override via field reassignment.
43
39
  */
44
40
  protected readonly loggedKinds: ReadonlySet<string> | undefined;
45
41
  /**
46
- * Override to enrich the log line with payload-specific detail. Return an
47
- * empty string to suppress the bracket. Default returns `''`.
42
+ * Payload detail logged at debug before the dispatch, as
43
+ * `Dispatch action '<kind>' <direction> [<summary>]`, on every dispatch,
44
+ * fast or slow; `''` logs no line. The default details only an action whose
45
+ * outcome the log otherwise loses, each through a `format*` method. Called
46
+ * only when debug is enabled, so it may serialise the payload.
48
47
  */
49
- protected summarize(_action: Action): string;
48
+ protected summarize(action: Action): string;
49
+ /** An edge check's verdict, so the log shows whether the server let an edge tool connect. */
50
+ protected formatEdgeCheck(action: CheckEdgeResultAction): string;
50
51
  dispatch(action: Action): Promise<void>;
51
52
  }
52
53
  //# sourceMappingURL=server-action-dispatcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-action-dispatcher.d.ts","sourceRoot":"","sources":["../../src/dispatcher/server-action-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGzE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,mCAAoC,SAAQ,uBAAuB;IAC7E,iEAAiE;IACjE,mBAA2B,MAAM,EAAE,gBAAgB,CAAC;IAEpD,qFAAqF;IACtD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAElE;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAa;IAE5E;;;OAGG;IACH,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAInC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAWlD"}
1
+ {"version":3,"file":"server-action-dispatcher.d.ts","sourceRoot":"","sources":["../../src/dispatcher/server-action-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBACa,mCAAoC,SAAQ,uBAAuB;IAC7E,qFAAqF;IACtD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAElE;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAa;IAE5E;;;;;;OAMG;IACH,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK1C;IAED,6FAA6F;IAC7F,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CAE/D;IAEQ,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAY/C;CACH"}
@@ -15,57 +15,69 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
15
15
  var __metadata = (this && this.__metadata) || function (k, v) {
16
16
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
17
17
  };
18
- import { DefaultActionDispatcher } from '@eclipse-glsp/server';
18
+ import { CheckEdgeResultAction, DefaultActionDispatcher } from '@eclipse-glsp/server';
19
19
  import { inject, injectable } from 'inversify';
20
+ import { Logger } from '@hydranium/protocol';
20
21
  import { HydraniumTypes } from '../state/hydranium-shared-core-services.js';
21
22
  /**
22
- * Server-side action dispatcher with built-in traffic observability:
23
- * every {@link DefaultActionDispatcher.dispatch} call is wrapped in a
24
- * {@link Tracer.time} pair that records the dispatch direction
25
- * (`→ client` vs `→ server`) and timing.
23
+ * Server-side action dispatcher with built-in traffic observability: while
24
+ * debug is enabled, each {@link DefaultActionDispatcher.dispatch} call runs
25
+ * inside {@link Tracer.time}, which logs it with its direction (`→ client` vs
26
+ * `→ server`) and timing only when it is slow or fails, and an action that
27
+ * {@link summarize} details gets its own debug line whatever its duration.
26
28
  *
27
29
  * **Why this lives in the framework (vs left as an adopter override).**
28
30
  * Debugging GLSP state, storage, and submission flows depends heavily on
29
- * seeing each action with timing and direction — especially when bringing
30
- * up a new adopter against an empty/partial diagram before its submission
31
- * flow is complete. Providing this dispatcher in the framework gives every
32
- * adopter the same observability primitive from the very first GLSP-head
33
- * launch.
31
+ * seeing slow or failing actions with timing and direction — especially when
32
+ * bringing up a new adopter against an empty/partial diagram before its
33
+ * submission flow is complete. Providing this dispatcher in the framework
34
+ * gives every adopter the same observability primitive from the very first
35
+ * GLSP-head launch.
34
36
  *
35
37
  * **Extension points.**
36
38
  * - {@link loggedKinds} — if set, filter the log lines (the dispatch
37
- * still happens; only the bracketed timing line is suppressed). Default
38
- * `undefined` means **every** action's dispatch is timed and logged.
39
- * - {@link summarize} — return a non-empty string to append `[summary]`
40
- * to the log line; default returns `''` (no extra bracket).
41
- *
42
- * Adopters bind it in a per-diagram module, as the `ActionDispatcher` service.
39
+ * still happens; only its timing and summary lines are suppressed).
40
+ * Default `undefined` times every action's dispatch while debug is enabled.
41
+ * - {@link summarize} — return a non-empty string to log it as a debug line
42
+ * for the dispatch; `''` logs none.
43
43
  */
44
44
  let HydraniumGlspServerActionDispatcher = class HydraniumGlspServerActionDispatcher extends DefaultActionDispatcher {
45
45
  /** Caller-tagged tracer (auto-componented with this class name, like the logger). */
46
46
  tracer;
47
47
  /**
48
- * If set, the timing log line is emitted only when `action.kind` is in
49
- * this set. Subclasses override via field reassignment.
48
+ * If set, the timing and summary lines are emitted only when `action.kind`
49
+ * is in this set. Subclasses override via field reassignment.
50
50
  */
51
51
  loggedKinds = undefined;
52
52
  /**
53
- * Override to enrich the log line with payload-specific detail. Return an
54
- * empty string to suppress the bracket. Default returns `''`.
53
+ * Payload detail logged at debug before the dispatch, as
54
+ * `Dispatch action '<kind>' <direction> [<summary>]`, on every dispatch,
55
+ * fast or slow; `''` logs no line. The default details only an action whose
56
+ * outcome the log otherwise loses, each through a `format*` method. Called
57
+ * only when debug is enabled, so it may serialise the payload.
55
58
  */
56
- summarize(_action) {
59
+ summarize(action) {
60
+ if (CheckEdgeResultAction.is(action)) {
61
+ return this.formatEdgeCheck(action);
62
+ }
57
63
  return '';
58
64
  }
65
+ /** An edge check's verdict, so the log shows whether the server let an edge tool connect. */
66
+ formatEdgeCheck(action) {
67
+ return `edgeType=${action.edgeType} source=${action.sourceElementId} target=${action.targetElementId ?? 'none'} isValid=${action.isValid}`;
68
+ }
59
69
  dispatch(action) {
60
- if (this.loggedKinds && !this.loggedKinds.has(action.kind)) {
70
+ if (!Logger.isLevelEnabled('debug') || (this.loggedKinds && !this.loggedKinds.has(action.kind))) {
61
71
  return super.dispatch(action);
62
72
  }
63
73
  const direction = this.clientActionForwarder.shouldForwardToClient(action) ? '→ client' : '→ server';
74
+ const label = `Dispatch action '${action.kind}' ${direction}`;
64
75
  const summary = this.summarize(action);
65
- const label = summary
66
- ? `Dispatch action '${action.kind}' ${direction} [${summary}]`
67
- : `Dispatch action '${action.kind}' ${direction}`;
68
- return this.tracer.time(label, () => super.dispatch(action));
76
+ if (summary) {
77
+ // Its own line: `time` is silent on a fast success.
78
+ this.tracer.debug(`${label} [${summary}]`);
79
+ }
80
+ return this.tracer.time(label, () => super.dispatch(action), 'debug');
69
81
  }
70
82
  };
71
83
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"server-action-dispatcher.js","sourceRoot":"","sources":["../../src/dispatcher/server-action-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,EAAe,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEI,IAAM,mCAAmC,GAAzC,MAAM,mCAAoC,SAAQ,uBAAuB;IAI7E,qFAAqF;IACnC,MAAM,CAAU;IAElE;;;OAGG;IACgB,WAAW,GAAoC,SAAS,CAAC;IAE5E;;;OAGG;IACO,SAAS,CAAC,OAAe;QAChC,OAAO,EAAE,CAAC;IACb,CAAC;IAEQ,QAAQ,CAAC,MAAc;QAC7B,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1D,O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AAxCoD;IAAjD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC;;mEAAoC;AAFxD,mCAAmC;IAD/C,UAAU,EAAE;GACA,mCAAmC,CA0C/C"}
package/lib/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from './dispatcher/index.js';
12
12
  export * from './launcher/index.js';
13
13
  export * from './logging/index.js';
14
14
  export * from './state/index.js';
15
+ export * from './status/index.js';
15
16
  export * from './storage/index.js';
16
17
  export * from './submission/index.js';
17
18
  export * from './util/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
package/lib/index.js CHANGED
@@ -13,6 +13,7 @@ export * from './dispatcher/index.js';
13
13
  export * from './launcher/index.js';
14
14
  export * from './logging/index.js';
15
15
  export * from './state/index.js';
16
+ export * from './status/index.js';
16
17
  export * from './storage/index.js';
17
18
  export * from './submission/index.js';
18
19
  export * from './util/index.js';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,2EAA2E;AAC3E,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,2EAA2E;AAC3E,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}