@hydranium/glsp-server 1.0.0-next.117 → 1.0.0-next.123

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 (39) hide show
  1. package/lib/command/hydranium-glsp-recording-command.d.ts +1 -1
  2. package/lib/command/hydranium-glsp-recording-command.js +1 -1
  3. package/lib/messages/index.d.ts +1 -1
  4. package/lib/messages/index.d.ts.map +1 -1
  5. package/lib/messages/index.js +1 -1
  6. package/lib/messages/index.js.map +1 -1
  7. package/lib/state/abstract-hydranium-glsp-state.d.ts +52 -8
  8. package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
  9. package/lib/state/abstract-hydranium-glsp-state.js +77 -5
  10. package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
  11. package/lib/state/full-text-hydranium-glsp-state.d.ts +4 -4
  12. package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
  13. package/lib/state/full-text-hydranium-glsp-state.js +5 -10
  14. package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
  15. package/lib/state/reconcile-source-model-write.d.ts +2 -2
  16. package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
  17. package/lib/state/reconcile-source-model-write.js +1 -1
  18. package/lib/state/reconcile-source-model-write.js.map +1 -1
  19. package/lib/state/reconciling-multi-document-glsp-state.d.ts +54 -74
  20. package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
  21. package/lib/state/reconciling-multi-document-glsp-state.js +77 -102
  22. package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
  23. package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +16 -15
  24. package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
  25. package/lib/state/reconciling-transfer-hydranium-glsp-state.js +21 -25
  26. package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
  27. package/lib/storage/hydranium-glsp-storage.d.ts +103 -26
  28. package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
  29. package/lib/storage/hydranium-glsp-storage.js +199 -32
  30. package/lib/storage/hydranium-glsp-storage.js.map +1 -1
  31. package/package.json +7 -7
  32. package/src/command/hydranium-glsp-recording-command.ts +1 -1
  33. package/src/messages/index.ts +6 -1
  34. package/src/state/abstract-hydranium-glsp-state.ts +85 -8
  35. package/src/state/full-text-hydranium-glsp-state.ts +5 -10
  36. package/src/state/reconcile-source-model-write.ts +3 -3
  37. package/src/state/reconciling-multi-document-glsp-state.ts +78 -103
  38. package/src/state/reconciling-transfer-hydranium-glsp-state.ts +21 -25
  39. package/src/storage/hydranium-glsp-storage.ts +236 -33
@@ -15,9 +15,9 @@ 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 { MarkersReason, SetMarkersAction, StatusAction } from '@eclipse-glsp/protocol';
18
+ import { MarkersReason, MessageAction, SetMarkersAction, StatusAction } from '@eclipse-glsp/protocol';
19
19
  import { ActionDispatcher, ClientSessionManager, CommandStack, EditMode, GLSPServerError, Logger as GlspLogger, ModelState, ModelSubmissionHandler, ModelValidator, SOURCE_URI_ARG, SetEditModeAction, TEMPORARY_CLIENT_ID } from '@eclipse-glsp/server';
20
- import { Debouncer, defineMessage, DisposableCollection } from '@hydranium/protocol';
20
+ import { Debouncer, defineMessage, DisposableCollection, isDuplicateClientIdError, isSessionClosedError, SessionClosedError } from '@hydranium/protocol';
21
21
  import { inject, injectable, optional, postConstruct } from 'inversify';
22
22
  import { URI } from '@hydranium/langium';
23
23
  import { AstDocument } from '@hydranium/core';
@@ -63,6 +63,17 @@ export const SOURCE_URI_MISSING = defineMessage('hydranium/glsp-server/source-ur
63
63
  * waiting on it.
64
64
  */
65
65
  export const DIAGRAM_READONLY_PARSE_ERROR = defineMessage('hydranium/glsp-server/diagram-readonly-parse-error', 'Read-only: this document has a syntax error. Fix it to edit the diagram again.');
66
+ /**
67
+ * The diagram's GLSP client id is still live as another participant's client
68
+ * id once the load has waited for it to free, so the diagram does not load.
69
+ *
70
+ * Rendered at the raise site, as {@link SAVE_TARGET_UNKNOWN} is and for the
71
+ * same reason, and dispatched to the client as a message of its own: a model
72
+ * request fails as a rejection whose detail is the English cause, which no user
73
+ * sees. It names the recovery: a host that numbers its diagram clients gives a
74
+ * reopened diagram a fresh id.
75
+ */
76
+ export const DIAGRAM_SESSION_REFUSED = defineMessage('hydranium/glsp-server/diagram-session-refused', 'Could not open this diagram: its identifier is still in use by another editor. Close the diagram and open it again.');
66
77
  /** Window (ms) over which back-to-back external rebuilds collapse into one resubmit. */
67
78
  const EXTERNAL_SUBMIT_DEBOUNCE_MS = 250;
68
79
  /**
@@ -111,11 +122,21 @@ function isStructuralDiagnostic(diagnostic) {
111
122
  * whole flow, and select a {@link SaveDeliveryPolicy} via the bound option to
112
123
  * tune how {@link saveSourceModel} delivers its result.
113
124
  *
114
- * **Default `saveSourceModel` flow.** Flushes the stored text of the primary and
115
- * every tracked secondary via `AstDocumentManager.save`, with no serializer in
116
- * the path — the update path already put the settled text in the store. The
117
- * bound {@link SaveDeliveryPolicy} (default {@link DEFAULT_SAVE_DELIVERY_POLICY},
118
- * `await`) decides await-vs-fire-and-forget and failure handling.
125
+ * **One client session per GLSP client session.** `init` registers the GLSP
126
+ * client id as a client session ({@link registerModelSession}) and hands it to
127
+ * the state as `modelSession`. The primary is opened through it on load, and
128
+ * every document that joins the write set as it joins
129
+ * ({@link openSecondary}); a document that leaves the write set stays open
130
+ * until the next save, so leaving never reverts the diagram's unsaved edits to
131
+ * it. Disposing the storage ends the session, which closes everything it has
132
+ * open.
133
+ *
134
+ * **Default `saveSourceModel` flow.** Flushes the stored text of every
135
+ * document the diagram's session has open via `AstDocumentManager.save`, with
136
+ * no serializer in the path — the update path already put the settled text in
137
+ * the store. The bound {@link SaveDeliveryPolicy} (default
138
+ * {@link DEFAULT_SAVE_DELIVERY_POLICY}, `await`) decides
139
+ * await-vs-fire-and-forget and failure handling.
119
140
  *
120
141
  * **tempId filter.** GLSP's `DefaultGlobalActionProvider` spins up a
121
142
  * throwaway per-diagram-type container with upstream's {@link TEMPORARY_CLIENT_ID}
@@ -126,9 +147,9 @@ function isStructuralDiagnostic(diagnostic) {
126
147
  * **Lifecycle ordering.** `init` runs after DI resolution and parks the
127
148
  * secondary-write-set watch, which outlives any single load.
128
149
  * {@link sessionDisposed} calls {@link dispose}, which drains
129
- * {@link toDispose} idempotently. Every transient subscription created in
130
- * {@link doLoadSourceModel} is parked on {@link toDispose} so the drain catches
131
- * them on client-detach.
150
+ * {@link toDispose} idempotently and then ends the client session. Every
151
+ * transient subscription created in {@link doLoadSourceModel} is parked on
152
+ * {@link toDispose} so the drain catches them on client-detach.
132
153
  */
133
154
  let HydraniumGlspStorage = class HydraniumGlspStorage {
134
155
  logger;
@@ -165,6 +186,22 @@ let HydraniumGlspStorage = class HydraniumGlspStorage {
165
186
  * with it rather than linger until the client detaches.
166
187
  */
167
188
  secondarySubscriptions = new Map();
189
+ /**
190
+ * Documents that left the write set since the last save. They stay open in
191
+ * the diagram's session until that save has persisted them, and are closed
192
+ * after it: closing a document as it leaves would revert the diagram's
193
+ * unsaved edits to it where the diagram was its last client.
194
+ */
195
+ departedSecondaries = new Set();
196
+ /**
197
+ * How long a load waits for a client id another participant holds to free
198
+ * before refusing. A reloaded client can reconnect under its old id before
199
+ * the server has noticed the old connection close, which ends that
200
+ * connection's sessions a moment later.
201
+ */
202
+ sessionWaitMs = 2_000;
203
+ /** Set by {@link dispose}; a disposed storage registers no session again. */
204
+ disposed = false;
168
205
  /**
169
206
  * Whether an external resubmit has ever been dispatched. Gates the
170
207
  * keep-the-last-valid-GModel branch, which needs to know a canvas is already
@@ -190,6 +227,7 @@ let HydraniumGlspStorage = class HydraniumGlspStorage {
190
227
  if (this.state.clientId === TEMPORARY_CLIENT_ID) {
191
228
  return;
192
229
  }
230
+ this.state.modelSession = this.registerModelSession();
193
231
  this.sessionManager.addListener(this, this.state.clientId);
194
232
  // Watched for this storage's whole lifetime rather than per load. The load
195
233
  // flow is a documented override point, so a subscription parked there would
@@ -197,6 +235,88 @@ let HydraniumGlspStorage = class HydraniumGlspStorage {
197
235
  // run long after any load.
198
236
  this.toDispose.push(this.state.onSecondaryUrisChanged(() => this.reconcileSecondarySubscriptions()));
199
237
  }
238
+ /**
239
+ * Register the diagram's client session under the GLSP client id, or
240
+ * `undefined` when another participant holds that id, which is logged.
241
+ *
242
+ * The diagram then refuses to load ({@link requireModelSession}). Taking
243
+ * the id over would end the other participant's session under it, and
244
+ * working without a session would share that participant's opens and
245
+ * echoes, so its close would take the diagram's documents with it.
246
+ */
247
+ registerModelSession() {
248
+ try {
249
+ return this.sharedServices.model.ModelService.createSession('diagram', this.state.clientId);
250
+ }
251
+ catch (error) {
252
+ if (!isDuplicateClientIdError(error)) {
253
+ throw error;
254
+ }
255
+ this.logger.warn(`Client id ${this.state.clientId} is held by another participant: this diagram has no session yet`);
256
+ return undefined;
257
+ }
258
+ }
259
+ /**
260
+ * The diagram's client session, registering it again when the id was held
261
+ * earlier. Throws `SessionClosedError` once the storage is disposed, and the
262
+ * refusal when the id is still held.
263
+ */
264
+ requireModelSession() {
265
+ if (this.disposed) {
266
+ throw new SessionClosedError(this.state.clientId, `The diagram of ${this.state.clientId} has closed; its client session has ended`);
267
+ }
268
+ if (!this.state.modelSession) {
269
+ this.state.modelSession = this.registerModelSession();
270
+ }
271
+ const session = this.state.modelSession;
272
+ if (!session) {
273
+ throw new GLSPServerError(this.sharedServices.MessageRenderer.renderMessage(DIAGRAM_SESSION_REFUSED), `clientId=${this.state.clientId} is still held by another participant, so this diagram has no client session`);
274
+ }
275
+ return session;
276
+ }
277
+ /**
278
+ * {@link requireModelSession} for the load: while the id is held, wait up to
279
+ * {@link sessionWaitMs} for its holder to end before refusing, and tell the
280
+ * user when it does not.
281
+ */
282
+ async awaitModelSession() {
283
+ if (!this.state.modelSession && !this.disposed) {
284
+ this.state.modelSession = this.registerModelSession();
285
+ }
286
+ if (!this.state.modelSession && !this.disposed) {
287
+ await this.waitForSessionEnd(this.state.clientId, this.sessionWaitMs);
288
+ }
289
+ try {
290
+ return this.requireModelSession();
291
+ }
292
+ catch (error) {
293
+ // A diagram closed while it waited has no client left to tell.
294
+ if (isSessionClosedError(error)) {
295
+ throw error;
296
+ }
297
+ this.logger.error(`Client id ${this.state.clientId} is still held by another participant: this diagram does not load`);
298
+ this.actionDispatcher
299
+ .dispatch(MessageAction.create(this.sharedServices.MessageRenderer.renderMessage(DIAGRAM_SESSION_REFUSED), { severity: 'ERROR' }))
300
+ .catch((dispatchError) => this.logger.warn(`Could not tell the client the diagram was refused: ${String(dispatchError)}`));
301
+ throw error;
302
+ }
303
+ }
304
+ /** Resolve once the client session under `clientId` ends, or after `timeoutMs`. */
305
+ waitForSessionEnd(clientId, timeoutMs) {
306
+ return new Promise(resolve => {
307
+ const subscriptions = new DisposableCollection();
308
+ const done = () => {
309
+ subscriptions.dispose();
310
+ resolve();
311
+ };
312
+ subscriptions.push(this.sharedServices.Clock.setTimer(done, timeoutMs));
313
+ subscriptions.push(this.sharedServices.workspace.TextDocuments.onDidCloseSession(event => {
314
+ if (event.clientId === clientId) {
315
+ done();
316
+ }
317
+ }));
318
+ });
319
+ }
200
320
  /**
201
321
  * Default load flow — {@link doLoadSourceModel}. Adopters whose load flow
202
322
  * needs more than the seams allow override this method.
@@ -210,8 +330,8 @@ let HydraniumGlspStorage = class HydraniumGlspStorage {
210
330
  const modelService = this.sharedServices.model.ModelService;
211
331
  // Open FIRST: a workspace-scanned-but-never-didOpened document rebuilds here,
212
332
  // so the capture below settles on a built root rather than a transient
213
- // mid-rebuild one.
214
- this.toDispose.push(await modelService.open({ uri: rootUri, clientId: this.state.clientId }));
333
+ // mid-rebuild one. Closed when the session ends.
334
+ await (await this.awaitModelSession()).open(rootUri);
215
335
  // GLSP's sessionDisposed is unreliable on Theia tab-close; dispose on client
216
336
  // detach so reopens don't accumulate stale onModelUpdated listeners.
217
337
  this.toDispose.push(modelService.onClientClosed(rootUri, this.state.clientId, () => {
@@ -283,14 +403,40 @@ let HydraniumGlspStorage = class HydraniumGlspStorage {
283
403
  if (!current.has(uri)) {
284
404
  subscription.dispose();
285
405
  this.secondarySubscriptions.delete(uri);
406
+ this.departedSecondaries.add(uri);
286
407
  }
287
408
  }
288
409
  for (const uri of current) {
289
410
  if (!this.secondarySubscriptions.has(uri)) {
411
+ this.departedSecondaries.delete(uri);
290
412
  this.secondarySubscriptions.set(uri, this.sharedServices.model.ModelService.onModelUpdated(uri, event => this.handleSecondaryUpdated(uri, event)));
413
+ this.openSecondary(uri);
291
414
  }
292
415
  }
293
416
  }
417
+ /**
418
+ * Open a document that joined the write set through the diagram's session,
419
+ * where it stays open until the diagram's next save after it leaves the set,
420
+ * or the diagram's end. A document that does not exist yet is left to the
421
+ * write that creates it, and a failed open is logged: the write that needs
422
+ * the document opens it again and fails there.
423
+ */
424
+ openSecondary(uri) {
425
+ const session = this.state.modelSession;
426
+ if (!session || !this.sharedServices.model.ModelService.getDocument(uri)) {
427
+ return;
428
+ }
429
+ session.open(uri).catch((error) => {
430
+ const detail = `Could not open ${uri} for ${this.state.clientId}: ${error instanceof Error ? error.message : String(error)}`;
431
+ // A session ending while the open reads is the diagram closing.
432
+ if (isSessionClosedError(error)) {
433
+ this.logger.debug(detail);
434
+ }
435
+ else {
436
+ this.logger.warn(detail);
437
+ }
438
+ });
439
+ }
294
440
  /**
295
441
  * React to a rebuild of a SECONDARY document by resubmitting the diagram, so
296
442
  * an external edit to (say) a layout file reaches the canvas.
@@ -529,23 +675,24 @@ let HydraniumGlspStorage = class HydraniumGlspStorage {
529
675
  return this.boundSaveDeliveryPolicy ?? DEFAULT_SAVE_DELIVERY_POLICY;
530
676
  }
531
677
  /**
532
- * Default save flow: persist the store's current text for every document this
533
- * diagram owns.
678
+ * Default save flow: persist the store's current text for every document the
679
+ * diagram's session has open.
534
680
  *
535
681
  * **A save persists, it does not author.** Every diagram gesture already
536
- * reached the store through `ModelService.update`, so the store holds the
682
+ * reached the store through the diagram's session, so the store holds the
537
683
  * settled text and disk is the only thing behind. Re-serializing from the AST
538
684
  * here cannot improve on that text and can only damage it: a serializer
539
- * normalises formatting and carries no comments, so a save would reflow and
540
- * strip a document nothing changed — which is what a pure bounds drag does to
541
- * the semantic file when only its layout moved.
685
+ * normalises formatting, and the comments the write path carries over keep
686
+ * none of the hand-formatting around them, so a save would reflow a document
687
+ * nothing changed — which is what a pure bounds drag does to the semantic
688
+ * file when only its layout moved.
542
689
  *
543
- * **The write set is the primary plus every tracked secondary**
544
- * (`AbstractHydraniumGlspState.trackSecondaryDocument`), so a document the
545
- * diagram wrote is persisted whether or not it is the one the client named.
546
- * The primary is flushed first, then secondaries in tracking order. A
547
- * document no client holds open is skipped — there is no stored text to
548
- * persist.
690
+ * **What is saved is the primary, every tracked secondary
691
+ * (`AbstractHydraniumGlspState.trackSecondaryDocument`) and every document
692
+ * that left the write set since the last save**, so a document the diagram
693
+ * wrote is persisted whether or not it is the one the client named. One the
694
+ * diagram's session does not have open is skipped, even when another client
695
+ * has it open: that client's unsaved edits are not the diagram's to persist.
549
696
  *
550
697
  * **A save therefore names documents the gesture did not aim at**, which is
551
698
  * why an unchanged one is not rewritten even though the user asked for a
@@ -585,18 +732,31 @@ let HydraniumGlspStorage = class HydraniumGlspStorage {
585
732
  return persisted;
586
733
  }
587
734
  /**
588
- * Save the stored text of `primaryUri` and every tracked secondary.
735
+ * Save the stored text of `primaryUri`, every tracked secondary and every
736
+ * document that left the write set since the last save, each only where
737
+ * the diagram's session has it open; then close those that left.
589
738
  *
590
739
  * Deduplicated, because a state that tracks its own primary as a secondary
591
740
  * would otherwise save it twice and fire two save notifications for one
592
- * save. A document no client holds open is skipped: there is no stored text
593
- * to persist, and `AstDocumentManager.save` throws on one.
741
+ * save. Every save is called in one synchronous step, so each takes its text
742
+ * before anything can close a document of the set: saved one after another,
743
+ * a GLSP session ending during the first write closes the rest unsaved.
594
744
  */
595
745
  async flushWriteSet(primaryUri) {
746
+ // Refused like the load: without a session the client id's opens are
747
+ // another participant's, and this would save them.
748
+ this.requireModelSession();
596
749
  const documents = this.sharedServices.workspace.AstDocumentManager;
597
- for (const target of new Set([primaryUri, ...this.state.secondaryUris])) {
598
- if (documents.isOpen(target)) {
599
- await documents.save(target, this.state.clientId);
750
+ const textDocuments = this.sharedServices.workspace.TextDocuments;
751
+ const clientId = this.state.clientId;
752
+ // Taken with the targets: a document leaving the set during the writes
753
+ // was not saved by them, and stays open for the next save.
754
+ const departed = [...this.departedSecondaries];
755
+ const targets = [...new Set([primaryUri, ...this.state.secondaryUris, ...departed])].filter(uri => textDocuments.isOpenInClient(uri, clientId));
756
+ await Promise.all(targets.map(target => documents.save(target, clientId)));
757
+ for (const uri of departed) {
758
+ if (this.departedSecondaries.delete(uri) && uri !== this.state.sourceUri) {
759
+ await this.state.modelSession?.close(uri);
600
760
  }
601
761
  }
602
762
  }
@@ -698,10 +858,14 @@ let HydraniumGlspStorage = class HydraniumGlspStorage {
698
858
  this.dispose();
699
859
  }
700
860
  /**
701
- * Cancel any pending resubmit and drain every subscription — those registered
861
+ * Cancel any pending resubmit, drain every subscription — those registered
702
862
  * during {@link doLoadSourceModel} and the per-secondary ones, which live
703
- * outside {@link toDispose} because they come and go with the write set.
863
+ * outside {@link toDispose} because they come and go with the write set —
864
+ * and end the diagram's client session, closing everything it has open.
704
865
  * Idempotent.
866
+ *
867
+ * The session ends last, once the detach listener is gone: its closes would
868
+ * otherwise report this storage's own teardown as a client detaching.
705
869
  */
706
870
  dispose() {
707
871
  this.resubmitDebouncer?.dispose();
@@ -710,6 +874,9 @@ let HydraniumGlspStorage = class HydraniumGlspStorage {
710
874
  }
711
875
  this.secondarySubscriptions.clear();
712
876
  this.toDispose.dispose();
877
+ this.disposed = true;
878
+ this.state.modelSession?.dispose();
879
+ this.state.modelSession = undefined;
713
880
  }
714
881
  };
715
882
  __decor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I,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC;IACvC,CAAC;CACH,CAAA;AAhyByC;IAAtC,MAAM,CAAC,UAAU,CAAC;8BAA6B,UAAU;oDAAC;AACG;IAA7D,MAAM,CAAC,cAAc,CAAC,kBAAkB,CAAC;;4DAA0D;AAC7D;IAAtC,MAAM,CAAC,UAAU,CAAC;;mDAA4E;AAC9C;IAAhD,MAAM,CAAC,oBAAoB,CAAC;;4DAA0D;AAC1C;IAA5C,MAAM,CAAC,gBAAgB,CAAC;;8DAAwD;AAC9B;IAAlD,MAAM,CAAC,sBAAsB,CAAC;;+DAA4F;AAClF;IAAxC,MAAM,CAAC,YAAY,CAAC;;0DAAuD;AASrB;IAAtD,MAAM,CAAC,cAAc,CAAC;IAAE,QAAQ,EAAE;;4DAAoD;AAS5B;IAA1D,MAAM,CAAC,kBAAkB,CAAC;IAAE,QAAQ,EAAE;;qEAAiE;AAwD9F;IADT,aAAa,EAAE;;;;gDAef;AAjGS,oBAAoB;IADhC,UAAU,EAAE;GACA,oBAAoB,CAmyBhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydranium/glsp-server",
3
- "version": "1.0.0-next.117",
3
+ "version": "1.0.0-next.123",
4
4
  "description": "GLSP protocol head for the hydranium framework. Peer of @hydranium/core/lsp and @hydranium/data-server; built on @hydranium/core.",
5
5
  "keywords": [
6
6
  "hydranium",
@@ -87,9 +87,9 @@
87
87
  "devDependencies": {
88
88
  "@eclipse-glsp/protocol": "2.7.0",
89
89
  "@eclipse-glsp/server": "2.7.0",
90
- "@hydranium/core": "1.0.0-next.117",
91
- "@hydranium/langium": "1.0.0-next.117",
92
- "@hydranium/protocol": "1.0.0-next.117",
90
+ "@hydranium/core": "1.0.0-next.123",
91
+ "@hydranium/langium": "1.0.0-next.123",
92
+ "@hydranium/protocol": "1.0.0-next.123",
93
93
  "inversify": "6.2.2",
94
94
  "reflect-metadata": "0.2.2",
95
95
  "rimraf": "^5.0.0",
@@ -100,9 +100,9 @@
100
100
  "peerDependencies": {
101
101
  "@eclipse-glsp/protocol": "^2.6.0",
102
102
  "@eclipse-glsp/server": "^2.6.0",
103
- "@hydranium/core": "1.0.0-next.117",
104
- "@hydranium/langium": "1.0.0-next.117",
105
- "@hydranium/protocol": "1.0.0-next.117",
103
+ "@hydranium/core": "1.0.0-next.123",
104
+ "@hydranium/langium": "1.0.0-next.123",
105
+ "@hydranium/protocol": "1.0.0-next.123",
106
106
  "inversify": "^6.0.0",
107
107
  "reflect-metadata": "^0.2.2",
108
108
  "vscode-jsonrpc": "9.0.1",
@@ -49,7 +49,7 @@ export type HydraniumGlspRecordingState<TSourceModel extends AnyObject> = Abstra
49
49
  * `modelState.updateSourceModel(newModel)` with the model only. The
50
50
  * framework lift overrides `postChange` so it also threads the snapshot
51
51
  * version taken at command start — letting the downstream
52
- * `ModelService.update` opt into the `ConflictError` gate. Undo / redo
52
+ * session `update` opt into the `ConflictError` gate. Undo / redo
53
53
  * postChange calls pass `'anything'`: the user authored against the recorded
54
54
  * patch, not against a specific server version, so re-applying it should
55
55
  * succeed regardless of intervening edits. The recorded patch itself encodes
@@ -22,4 +22,9 @@
22
22
  * discovers the codes exist.
23
23
  */
24
24
 
25
- export { DIAGRAM_READONLY_PARSE_ERROR, SAVE_TARGET_UNKNOWN, SOURCE_URI_MISSING } from '../storage/hydranium-glsp-storage.js';
25
+ export {
26
+ DIAGRAM_READONLY_PARSE_ERROR,
27
+ DIAGRAM_SESSION_REFUSED,
28
+ SAVE_TARGET_UNKNOWN,
29
+ SOURCE_URI_MISSING
30
+ } from '../storage/hydranium-glsp-storage.js';
@@ -12,6 +12,7 @@ import { Emitter, type Event } from 'vscode-jsonrpc';
12
12
  import { inject, injectable, optional } from 'inversify';
13
13
  import { type AstNode, DocumentState, URI } from '@hydranium/langium';
14
14
  import {
15
+ type ClientSession,
15
16
  type HydraniumScopeProvider,
16
17
  type LanguageTarget,
17
18
  type NameProvider,
@@ -26,7 +27,8 @@ import {
26
27
  type Disposable,
27
28
  type Logger,
28
29
  type Tracer,
29
- asSnapshotVersion
30
+ asSnapshotVersion,
31
+ NO_MATCHING_VERSION
30
32
  } from '@hydranium/protocol';
31
33
  import { type HydraniumGlspIndex } from './hydranium-glsp-index.js';
32
34
  import { HydraniumTypes } from './hydranium-shared-core-services.js';
@@ -95,6 +97,32 @@ export abstract class AbstractHydraniumGlspState<TRoot extends AstNode, TSourceM
95
97
  /** Narrows {@link DefaultModelState.index} to the framework-extended index type. */
96
98
  declare readonly index: HydraniumGlspIndex;
97
99
 
100
+ /**
101
+ * The client session this diagram works as, registered under `clientId` by
102
+ * the source-model storage and ended with the GLSP client session.
103
+ * `undefined` for GLSP's placeholder client, and when the id was held by
104
+ * another participant, in which case the diagram does not load.
105
+ *
106
+ * Every write of the diagram goes through this session, which writes only a
107
+ * document it has open and opens nothing. A one-shot write to a document
108
+ * outside the write set goes through
109
+ * {@link ClientSession.withOpen}, and a document the diagram brings into
110
+ * existence through {@link ClientSession.create}.
111
+ */
112
+ modelSession?: ClientSession<AstNode>;
113
+
114
+ /**
115
+ * {@link modelSession}, or a throw without one: the diagram never loaded or
116
+ * has ended. Looking `clientId` up through `ModelService.getSession` instead
117
+ * would write as whichever participant holds that id.
118
+ */
119
+ protected requireModelSession(): ClientSession<AstNode> {
120
+ if (!this.modelSession) {
121
+ throw new Error(`No client session is registered for ${this.clientId}; the diagram cannot write`);
122
+ }
123
+ return this.modelSession;
124
+ }
125
+
98
126
  protected _sourceUri!: string;
99
127
  protected _sourceRoot!: TRoot;
100
128
  protected _tracer?: Tracer;
@@ -253,8 +281,8 @@ export abstract class AbstractHydraniumGlspState<TRoot extends AstNode, TSourceM
253
281
  * until the next one, then re-read from the document store.
254
282
  *
255
283
  * Threaded by `HydraniumGlspRecordingCommand` into
256
- * {@link updateSourceModel} so the downstream `ModelService.update` /
257
- * `.save` call gates against what the command was authored on. See
284
+ * {@link updateSourceModel} so the downstream session `update` / `save`
285
+ * gates against what the command was authored on. See
258
286
  * `@hydranium/protocol#ConflictError` for the detection contract.
259
287
  *
260
288
  * **This, not a number read at write time, is what a write must be gated
@@ -267,7 +295,9 @@ export abstract class AbstractHydraniumGlspState<TRoot extends AstNode, TSourceM
267
295
 
268
296
  /**
269
297
  * Text-document version of {@link basedOn}. Mirrors the server-side
270
- * `TextDocuments.version(uri)` counter as of the snapshot.
298
+ * `TextDocuments.version(uri)` counter as of the snapshot, or is
299
+ * `NO_MATCHING_VERSION` when the store's text could not be tied to the
300
+ * root (see {@link readSnapshotVersion}).
271
301
  *
272
302
  * Falls back to `0` when the document is absent from `LangiumDocuments`
273
303
  * when the snapshot is taken — the same observable state callers see for a
@@ -381,10 +411,35 @@ export abstract class AbstractHydraniumGlspState<TRoot extends AstNode, TSourceM
381
411
  * answers with the version the write is about to be compared against, so the
382
412
  * gate passes unconditionally.
383
413
  *
384
- * Falls back to v0 for a URI the store does not know, matching what
414
+ * Falls back to v0 for a URI neither store knows, matching what
385
415
  * {@link version} reports for a document that was never opened.
416
+ *
417
+ * **The version of the text store, which the gate compares against.**
418
+ * When the store holds the text the root was parsed from, that is its
419
+ * version, even while the built document still carries an older number.
420
+ * When the store holds other text, `NO_MATCHING_VERSION`, so the write
421
+ * conflicts instead of overwriting text the root never saw: the
422
+ * reconciling states reconcile it, `FullTextHydraniumGlspState` throws the
423
+ * `ConflictError`. When the root keeps no syntax tree to read its text
424
+ * from, the built document's text stands in for it, unless the built
425
+ * document IS the store's, whose text says nothing about what was parsed;
426
+ * that also gets `NO_MATCHING_VERSION`.
386
427
  */
387
428
  protected readSnapshotVersion(uri: string): SnapshotVersion {
429
+ const document = this.sharedServices.model.ModelService.getDocument(uri);
430
+ const stored = document && this.sharedServices.workspace.TextDocuments.get(uri);
431
+ if (stored) {
432
+ const parsed = document.parseResult.value.$cstNode?.root.fullText;
433
+ if (parsed !== undefined) {
434
+ return parsed === stored.getText() ? asSnapshotVersion(stored.version) : NO_MATCHING_VERSION;
435
+ }
436
+ if (document.textDocument === stored) {
437
+ return NO_MATCHING_VERSION;
438
+ }
439
+ if (stored.version !== document.textDocument.version && stored.getText() === document.textDocument.getText()) {
440
+ return asSnapshotVersion(stored.version);
441
+ }
442
+ }
388
443
  return this.sharedServices.model.ModelService.snapshot(uri)?.version ?? asSnapshotVersion(0);
389
444
  }
390
445
 
@@ -417,6 +472,28 @@ export abstract class AbstractHydraniumGlspState<TRoot extends AstNode, TSourceM
417
472
  }
418
473
  }
419
474
 
475
+ /**
476
+ * The root that `uri`'s text parses to (the text store's, or the built
477
+ * document's when the store holds none), read once the document has
478
+ * validated; `undefined` when it cannot be read.
479
+ *
480
+ * **Parsed afresh, never the built root.** Operation handlers edit the
481
+ * built root in place, so until a rebuild replaces it, it already holds
482
+ * the edit being reconciled, and replaying the edit onto it applies it
483
+ * twice. The root is parsed, not linked: an encoder hook reading a
484
+ * reference's `ref` sees `undefined` on it.
485
+ */
486
+ protected async readCurrentRoot(uri: string): Promise<AstNode | undefined> {
487
+ const modelService = this.sharedServices.model.ModelService;
488
+ if (!(await modelService.validated(uri).catch(() => undefined))) {
489
+ return undefined;
490
+ }
491
+ const text = this.sharedServices.workspace.TextDocuments.get(uri)?.getText() ?? modelService.getDocument(uri)?.textDocument.getText();
492
+ return text === undefined
493
+ ? undefined
494
+ : this.sharedServices.workspace.LangiumDocumentFactory.fromString(text, URI.parse(uri)).parseResult.value;
495
+ }
496
+
420
497
  /**
421
498
  * Wait until the captured document reaches `state`, then run
422
499
  * {@link onReadyRefreshed} so consumers see a fresh AST. Wraps the
@@ -517,9 +594,9 @@ export abstract class AbstractHydraniumGlspState<TRoot extends AstNode, TSourceM
517
594
  * intersection at the recording-command call site.
518
595
  *
519
596
  * `basedOn` is the snapshot version taken at command start by
520
- * `HydraniumGlspRecordingCommand.execute`. Adopters that route through
521
- * `ModelService.update` / `.save` forward it as the args' `basedOn` field;
522
- * adopters whose write path doesn't go through `ModelService` ignore it.
597
+ * `HydraniumGlspRecordingCommand.execute`. Adopters that write through the
598
+ * diagram's session forward it as the args' `basedOn` field; adopters whose
599
+ * write path doesn't go through the session ignore it.
523
600
  * `'anything'` when the writer is not the recording command (an external
524
601
  * storage refresh, an undo replaying a recorded patch), which is a write
525
602
  * authored against no particular server version.