@hydranium/protocol 1.0.0-next.9 → 1.0.0-next.90

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 (124) hide show
  1. package/README.md +35 -1
  2. package/lib/client/data-connection.d.ts +114 -0
  3. package/lib/client/data-connection.d.ts.map +1 -0
  4. package/lib/client/data-connection.js +128 -0
  5. package/lib/client/data-connection.js.map +1 -0
  6. package/lib/client/data-events.d.ts +9 -1
  7. package/lib/client/data-events.d.ts.map +1 -1
  8. package/lib/client/data-events.js +14 -0
  9. package/lib/client/data-events.js.map +1 -1
  10. package/lib/client/data-port.d.ts +17 -22
  11. package/lib/client/data-port.d.ts.map +1 -1
  12. package/lib/client/data-session.d.ts +95 -78
  13. package/lib/client/data-session.d.ts.map +1 -1
  14. package/lib/client/data-session.js +115 -108
  15. package/lib/client/data-session.js.map +1 -1
  16. package/lib/client/index.d.ts +10 -7
  17. package/lib/client/index.d.ts.map +1 -1
  18. package/lib/client/index.js +10 -7
  19. package/lib/client/index.js.map +1 -1
  20. package/lib/client/message-relay.d.ts +8 -2
  21. package/lib/client/message-relay.d.ts.map +1 -1
  22. package/lib/client/message-relay.js +10 -4
  23. package/lib/client/message-relay.js.map +1 -1
  24. package/lib/client/rpc-connection.d.ts +139 -0
  25. package/lib/client/rpc-connection.d.ts.map +1 -0
  26. package/lib/client/rpc-connection.js +171 -0
  27. package/lib/client/rpc-connection.js.map +1 -0
  28. package/lib/client-ids.d.ts +41 -0
  29. package/lib/client-ids.d.ts.map +1 -0
  30. package/lib/client-ids.js +44 -0
  31. package/lib/client-ids.js.map +1 -0
  32. package/lib/data/data-protocol-methods.d.ts +2 -2
  33. package/lib/data/data-protocol-methods.d.ts.map +1 -1
  34. package/lib/data/data-protocol-methods.js +6 -1
  35. package/lib/data/data-protocol-methods.js.map +1 -1
  36. package/lib/data/data-server-protocol.d.ts +35 -2
  37. package/lib/data/data-server-protocol.d.ts.map +1 -1
  38. package/lib/data/events.d.ts +70 -3
  39. package/lib/data/events.d.ts.map +1 -1
  40. package/lib/errors.d.ts +28 -11
  41. package/lib/errors.d.ts.map +1 -1
  42. package/lib/errors.js +35 -17
  43. package/lib/errors.js.map +1 -1
  44. package/lib/index.d.ts +2 -0
  45. package/lib/index.d.ts.map +1 -1
  46. package/lib/index.js +5 -0
  47. package/lib/index.js.map +1 -1
  48. package/lib/messages/index.d.ts +28 -0
  49. package/lib/messages/index.d.ts.map +1 -0
  50. package/lib/messages/index.js +52 -0
  51. package/lib/messages/index.js.map +1 -0
  52. package/lib/messages/primitives.d.ts +141 -0
  53. package/lib/messages/primitives.d.ts.map +1 -0
  54. package/lib/messages/primitives.js +138 -0
  55. package/lib/messages/primitives.js.map +1 -0
  56. package/lib/model-server.d.ts +27 -10
  57. package/lib/model-server.d.ts.map +1 -1
  58. package/lib/model-server.js +4 -2
  59. package/lib/model-server.js.map +1 -1
  60. package/lib/model-service/args.d.ts +14 -13
  61. package/lib/model-service/args.d.ts.map +1 -1
  62. package/lib/model-service/based-on.d.ts +55 -0
  63. package/lib/model-service/based-on.d.ts.map +1 -0
  64. package/lib/model-service/based-on.js +34 -0
  65. package/lib/model-service/based-on.js.map +1 -0
  66. package/lib/model-service/index.d.ts +1 -0
  67. package/lib/model-service/index.d.ts.map +1 -1
  68. package/lib/model-service/index.js +1 -0
  69. package/lib/model-service/index.js.map +1 -1
  70. package/lib/rpc/bind-rpc-methods.d.ts +29 -3
  71. package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
  72. package/lib/rpc/bind-rpc-methods.js +22 -3
  73. package/lib/rpc/bind-rpc-methods.js.map +1 -1
  74. package/lib/rpc/create-rpc-proxy.d.ts +7 -0
  75. package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
  76. package/lib/rpc/create-rpc-proxy.js +6 -1
  77. package/lib/rpc/create-rpc-proxy.js.map +1 -1
  78. package/lib/testing/catalogue-audit.d.ts +80 -0
  79. package/lib/testing/catalogue-audit.d.ts.map +1 -0
  80. package/lib/testing/catalogue-audit.js +94 -0
  81. package/lib/testing/catalogue-audit.js.map +1 -0
  82. package/lib/testing/data-doubles.d.ts +11 -12
  83. package/lib/testing/data-doubles.d.ts.map +1 -1
  84. package/lib/testing/data-doubles.js +14 -5
  85. package/lib/testing/data-doubles.js.map +1 -1
  86. package/lib/testing/index.d.ts +1 -0
  87. package/lib/testing/index.d.ts.map +1 -1
  88. package/lib/testing/index.js +4 -1
  89. package/lib/testing/index.js.map +1 -1
  90. package/lib/transfer-diagnostic.d.ts +33 -0
  91. package/lib/transfer-diagnostic.d.ts.map +1 -1
  92. package/lib/transfer-diagnostic.js +23 -0
  93. package/lib/transfer-diagnostic.js.map +1 -1
  94. package/lib/transfer-document.d.ts +15 -5
  95. package/lib/transfer-document.d.ts.map +1 -1
  96. package/lib/transfer-document.js +14 -1
  97. package/lib/transfer-document.js.map +1 -1
  98. package/package.json +11 -2
  99. package/src/client/data-connection.ts +181 -0
  100. package/src/client/data-events.ts +24 -1
  101. package/src/client/data-port.ts +17 -23
  102. package/src/client/data-session.ts +172 -131
  103. package/src/client/index.ts +10 -7
  104. package/src/client/message-relay.ts +28 -6
  105. package/src/client/rpc-connection.ts +230 -0
  106. package/src/client-ids.ts +45 -0
  107. package/src/data/data-protocol-methods.ts +6 -3
  108. package/src/data/data-server-protocol.ts +46 -2
  109. package/src/data/events.ts +74 -3
  110. package/src/errors.ts +41 -19
  111. package/src/index.ts +5 -0
  112. package/src/messages/index.ts +35 -0
  113. package/src/messages/primitives.ts +215 -0
  114. package/src/model-server.ts +30 -11
  115. package/src/model-service/args.ts +15 -13
  116. package/src/model-service/based-on.ts +60 -0
  117. package/src/model-service/index.ts +1 -0
  118. package/src/rpc/bind-rpc-methods.ts +49 -4
  119. package/src/rpc/create-rpc-proxy.ts +14 -1
  120. package/src/testing/catalogue-audit.ts +111 -0
  121. package/src/testing/data-doubles.ts +33 -17
  122. package/src/testing/index.ts +4 -1
  123. package/src/transfer-diagnostic.ts +40 -0
  124. package/src/transfer-document.ts +22 -6
@@ -0,0 +1,141 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { ResponseError } from 'vscode-jsonrpc';
10
+ /**
11
+ * The framework externalizes user-facing strings and SELECTS no locale: it
12
+ * relays the one its client declared and renders with whatever templates the
13
+ * adopter installed, defaulting to its English. Every such string carries a
14
+ * stable code beside that English, and exactly one side renders it — the side
15
+ * that knows the reading user's language.
16
+ *
17
+ * Which side that is depends on the message, not on the package. A server
18
+ * message is rendered by the server, at the one seam every carrier passes
19
+ * through, in the locale it was handed at init. A message the client tier raises
20
+ * is rendered there, because those fire when the server is unreachable. Nothing
21
+ * is rendered twice: two renders of one sentence are two authorities over it,
22
+ * and they diverge on the first reword.
23
+ *
24
+ * Codes are `hydranium/<unscoped-package>/<name>`. The package segment locates
25
+ * the declaration, so a message is declared in the package that raises it and a
26
+ * code never names a package it does not live in. `.` and `:` are forbidden in a
27
+ * segment: they are i18next's default key and namespace separators, where either
28
+ * silently becomes a nested lookup that misses.
29
+ */
30
+ export type MessageParams = Readonly<Record<string, string | number>>;
31
+ type Placeholder<S extends string> = S extends `${string}{${infer Name}}${infer Rest}` ? Name | Placeholder<Rest> : never;
32
+ export type ParamsOf<S extends string> = [Placeholder<S>] extends [never] ? Record<never, never> : Readonly<Record<Placeholder<S>, string | number>>;
33
+ /** Required exactly when the text has placeholders, absent when it does not. */
34
+ export type ParamsArg<S extends string> = [Placeholder<S>] extends [never] ? [] : [params: ParamsOf<S>];
35
+ /**
36
+ * Rejects a text argument already widened to `string`. Load-bearing rather than
37
+ * defensive: the whole compile-time guarantee is conditional on `S` inferring a
38
+ * literal, and for a concatenated or pre-widened text the placeholder set
39
+ * silently becomes empty, `format()` accepts no arguments, and the missing
40
+ * substitution surfaces only at runtime.
41
+ */
42
+ export type LiteralText<S extends string> = string extends S ? never : S;
43
+ export interface MessageDefinition<S extends string> {
44
+ readonly code: string;
45
+ readonly text: S;
46
+ format(...args: ParamsArg<S>): string;
47
+ }
48
+ /**
49
+ * Declare a message. Placeholder names are inferred from `text` rather than
50
+ * declared again in a type argument: a second spelling of every name is the
51
+ * repetition that drifts, since adding a placeholder to the sentence and not to
52
+ * the type compiles.
53
+ */
54
+ export declare function defineMessage<S extends string>(code: string, text: LiteralText<S>): MessageDefinition<S>;
55
+ /**
56
+ * Substitute `{name}` tokens, leaving an unfilled token in place.
57
+ *
58
+ * It must not throw. This runs over an adopter's translation as well as our own
59
+ * text, so a typo in a foreign catalogue has to degrade to a slightly wrong
60
+ * sentence rather than raise inside a toast render. Re-scanning the result to
61
+ * detect an unfilled token is what an earlier form did, and it cannot work:
62
+ * `String.replace` does not rescan replacement text, so the check could not tell
63
+ * an unfilled placeholder from user data shaped like one — an element literally
64
+ * named `{separator}` crashed at the authoring site.
65
+ */
66
+ export declare function interpolate(template: string, params: MessageParams): string;
67
+ export interface MessageIdentity {
68
+ readonly code: string;
69
+ readonly params: MessageParams;
70
+ }
71
+ /**
72
+ * Envelope for a protocol `data` field. Namespaced under one key so it co-exists
73
+ * with a carrier's own `data` conventions rather than occupying `data` itself.
74
+ */
75
+ export interface HydraniumMessageData {
76
+ readonly hydranium: MessageIdentity;
77
+ }
78
+ /** An identity plus its resolved English — everything a renderer needs, on any carrier. */
79
+ export interface ResolvedMessage extends MessageIdentity {
80
+ readonly text: string;
81
+ }
82
+ export declare function messageData<S extends string>(message: MessageDefinition<S>, ...args: ParamsArg<S>): HydraniumMessageData;
83
+ /**
84
+ * Identity plus resolved English, for a hand-off carrying a value rather than a
85
+ * protocol field. The result is structured-clone safe, so it survives a process
86
+ * hop where one intervenes and costs nothing where none does.
87
+ */
88
+ export declare function resolve<S extends string>(message: MessageDefinition<S>, ...args: ParamsArg<S>): ResolvedMessage;
89
+ /**
90
+ * Validates every field {@link MessageIdentity} declares, `params` included.
91
+ * A guard over foreign input that checks only `code` while declaring `params`
92
+ * non-optional hands `undefined` to the renderer, which fails with the worst
93
+ * polarity available: invisible in English, crashing only once a translation is
94
+ * loaded.
95
+ */
96
+ export declare function hasMessageIdentity(data: unknown): data is HydraniumMessageData;
97
+ /**
98
+ * A type alias rather than a subclass. Only `code`, `message` and `data` cross
99
+ * the wire, so a subclass buys nothing there: `instanceof` does not survive
100
+ * reconstruction, and the subclass costs an `Object.setPrototypeOf` in every
101
+ * constructor purely to undo what `ResponseError`'s own constructor does.
102
+ */
103
+ export type HydraniumResponseError = ResponseError<HydraniumMessageData>;
104
+ /**
105
+ * The numeric `code` and the message's catalogue code are unrelated and both are
106
+ * needed: `ResponseError.code` is an `integer`, so it cannot hold a
107
+ * `hydranium/…` key, and it is what a caller switches on after reconstruction.
108
+ */
109
+ export declare function messageError<S extends string>(code: number, message: MessageDefinition<S>, ...params: ParamsArg<S>): HydraniumResponseError;
110
+ /**
111
+ * Render on the side that knows the reading user's locale. `translations` is
112
+ * whatever flat `code → template` map the host exposes; omitting it is how an
113
+ * adopter without i18n opts out, and yields the English.
114
+ */
115
+ export declare function renderFrameworkMessage(message: ResolvedMessage, translations?: Record<string, string>): string;
116
+ export declare function resolvedFromResponseError(error: ResponseError<unknown>): ResolvedMessage | undefined;
117
+ /**
118
+ * The detail half of a `{detail}` placeholder. A technical error string is safe
119
+ * to pass as a parameter for the same reason a number is: it is not itself
120
+ * translatable text, so it needs no code of its own. A PROSE fragment is not,
121
+ * and must become one code per value instead.
122
+ */
123
+ export declare function describeError(error: unknown): string;
124
+ /**
125
+ * Recognises a declaration among a barrel's exports. The `format` check is what
126
+ * discriminates: a `code` + `text` pair alone admits any object that happens to
127
+ * carry both.
128
+ */
129
+ export declare function isMessageDeclaration(value: unknown): value is MessageDefinition<string>;
130
+ /**
131
+ * Every declaration a `./messages` barrel exports.
132
+ *
133
+ * A caller cannot get there with `Object.values(barrel).filter(isMessageDeclaration)`:
134
+ * a barrel's value type is a union of its declarations AND its functions, and
135
+ * `filter` will not narrow a function type down to a `MessageDefinition`, so the
136
+ * result stays the union and reading `.code` off it does not compile. Taking the
137
+ * barrel as an opaque object is what makes the one-liner work.
138
+ */
139
+ export declare function collectMessages(barrel: object): MessageDefinition<string>[];
140
+ export {};
141
+ //# sourceMappingURL=primitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/messages/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;AAEtE,KAAK,WAAW,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,MAAM,IAAI,IAAI,MAAM,IAAI,EAAE,GAAG,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;AAE1H,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACpE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GACpB,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;AAEvD,gFAAgF;AAChF,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAExG;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAA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AAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAU9E;AAED;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC,oBAAoB,CAAC,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC1C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC7B,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GACvB,sBAAsB,CAExB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAG9G;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,eAAe,GAAG,SAAS,CAEpG;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAAC,MAAM,CAAC,CASvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAE3E"}
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the MIT License which is available in the project root.
7
+ *
8
+ * SPDX-License-Identifier: MIT
9
+ ********************************************************************************/
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.defineMessage = defineMessage;
12
+ exports.interpolate = interpolate;
13
+ exports.messageData = messageData;
14
+ exports.resolve = resolve;
15
+ exports.hasMessageIdentity = hasMessageIdentity;
16
+ exports.messageError = messageError;
17
+ exports.renderFrameworkMessage = renderFrameworkMessage;
18
+ exports.resolvedFromResponseError = resolvedFromResponseError;
19
+ exports.describeError = describeError;
20
+ exports.isMessageDeclaration = isMessageDeclaration;
21
+ exports.collectMessages = collectMessages;
22
+ const vscode_jsonrpc_1 = require("vscode-jsonrpc");
23
+ /**
24
+ * Declare a message. Placeholder names are inferred from `text` rather than
25
+ * declared again in a type argument: a second spelling of every name is the
26
+ * repetition that drifts, since adding a placeholder to the sentence and not to
27
+ * the type compiles.
28
+ */
29
+ function defineMessage(code, text) {
30
+ const literal = text;
31
+ return { code, text: literal, format: (...args) => interpolate(literal, args[0] ?? {}) };
32
+ }
33
+ const PLACEHOLDER = /\{([^}]+)\}/g;
34
+ /**
35
+ * Substitute `{name}` tokens, leaving an unfilled token in place.
36
+ *
37
+ * It must not throw. This runs over an adopter's translation as well as our own
38
+ * text, so a typo in a foreign catalogue has to degrade to a slightly wrong
39
+ * sentence rather than raise inside a toast render. Re-scanning the result to
40
+ * detect an unfilled token is what an earlier form did, and it cannot work:
41
+ * `String.replace` does not rescan replacement text, so the check could not tell
42
+ * an unfilled placeholder from user data shaped like one — an element literally
43
+ * named `{separator}` crashed at the authoring site.
44
+ */
45
+ function interpolate(template, params) {
46
+ // Indexed rather than `key in params`: a hand-built or version-skewed
47
+ // identity can arrive with no params at all, and `in` throws on a non-object
48
+ // where a lookup degrades.
49
+ const lookup = params;
50
+ return template.replace(PLACEHOLDER, (match, key) => {
51
+ const value = lookup?.[key];
52
+ return value === undefined ? match : String(value);
53
+ });
54
+ }
55
+ function messageData(message, ...args) {
56
+ return { hydranium: { code: message.code, params: args[0] ?? {} } };
57
+ }
58
+ /**
59
+ * Identity plus resolved English, for a hand-off carrying a value rather than a
60
+ * protocol field. The result is structured-clone safe, so it survives a process
61
+ * hop where one intervenes and costs nothing where none does.
62
+ */
63
+ function resolve(message, ...args) {
64
+ return { code: message.code, text: message.format(...args), params: args[0] ?? {} };
65
+ }
66
+ /**
67
+ * Validates every field {@link MessageIdentity} declares, `params` included.
68
+ * A guard over foreign input that checks only `code` while declaring `params`
69
+ * non-optional hands `undefined` to the renderer, which fails with the worst
70
+ * polarity available: invisible in English, crashing only once a translation is
71
+ * loaded.
72
+ */
73
+ function hasMessageIdentity(data) {
74
+ if (typeof data !== 'object' || data === null || Array.isArray(data) || !('hydranium' in data)) {
75
+ return false;
76
+ }
77
+ const identity = data.hydranium;
78
+ if (typeof identity !== 'object' || identity === null || Array.isArray(identity)) {
79
+ return false;
80
+ }
81
+ const candidate = identity;
82
+ return typeof candidate.code === 'string' && typeof candidate.params === 'object' && candidate.params !== null;
83
+ }
84
+ /**
85
+ * The numeric `code` and the message's catalogue code are unrelated and both are
86
+ * needed: `ResponseError.code` is an `integer`, so it cannot hold a
87
+ * `hydranium/…` key, and it is what a caller switches on after reconstruction.
88
+ */
89
+ function messageError(code, message, ...params) {
90
+ return new vscode_jsonrpc_1.ResponseError(code, message.format(...params), messageData(message, ...params));
91
+ }
92
+ /**
93
+ * Render on the side that knows the reading user's locale. `translations` is
94
+ * whatever flat `code → template` map the host exposes; omitting it is how an
95
+ * adopter without i18n opts out, and yields the English.
96
+ */
97
+ function renderFrameworkMessage(message, translations) {
98
+ const template = translations?.[message.code];
99
+ return template ? interpolate(template, message.params) : message.text;
100
+ }
101
+ function resolvedFromResponseError(error) {
102
+ return hasMessageIdentity(error.data) ? { ...error.data.hydranium, text: error.message } : undefined;
103
+ }
104
+ /**
105
+ * The detail half of a `{detail}` placeholder. A technical error string is safe
106
+ * to pass as a parameter for the same reason a number is: it is not itself
107
+ * translatable text, so it needs no code of its own. A PROSE fragment is not,
108
+ * and must become one code per value instead.
109
+ */
110
+ function describeError(error) {
111
+ return error instanceof Error ? error.message : String(error);
112
+ }
113
+ /**
114
+ * Recognises a declaration among a barrel's exports. The `format` check is what
115
+ * discriminates: a `code` + `text` pair alone admits any object that happens to
116
+ * carry both.
117
+ */
118
+ function isMessageDeclaration(value) {
119
+ const candidate = value;
120
+ return (typeof candidate === 'object' &&
121
+ candidate !== null &&
122
+ typeof candidate.code === 'string' &&
123
+ typeof candidate.text === 'string' &&
124
+ typeof candidate.format === 'function');
125
+ }
126
+ /**
127
+ * Every declaration a `./messages` barrel exports.
128
+ *
129
+ * A caller cannot get there with `Object.values(barrel).filter(isMessageDeclaration)`:
130
+ * a barrel's value type is a union of its declarations AND its functions, and
131
+ * `filter` will not narrow a function type down to a `MessageDefinition`, so the
132
+ * result stays the union and reading `.code` off it does not compile. Taking the
133
+ * barrel as an opaque object is what makes the one-liner work.
134
+ */
135
+ function collectMessages(barrel) {
136
+ return Object.values(barrel).filter(isMessageDeclaration);
137
+ }
138
+ //# sourceMappingURL=primitives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/messages/primitives.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAwDlF,sCAGC;AAeD,kCASC;AAoBD,kCAEC;AAOD,0BAEC;AASD,gDAUC;AAeD,oCAMC;AAOD,wDAGC;AAED,8DAEC;AAQD,sCAEC;AAOD,oDASC;AAWD,0CAEC;AA7MD,mDAA+C;AAgD/C;;;;;GAKG;AACH,SAAgB,aAAa,CAAmB,IAAY,EAAE,IAAoB;IAC/E,MAAM,OAAO,GAAG,IAAS,CAAC;IAC1B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;AAC5F,CAAC;AAED,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,SAAgB,WAAW,CAAC,QAAgB,EAAE,MAAqB;IAChE,sEAAsE;IACtE,6EAA6E;IAC7E,2BAA2B;IAC3B,MAAM,MAAM,GAAG,MAAiE,CAAC;IACjF,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,EA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CAAC,IAAI,KAAK,QAAQ;QAClC,OAAO,SAAS,CAAC,MAAM,KAAK,UAAU,CACxC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAAC,MAAc;IAC3C,OAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAe,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAC5E,CAAC"}
@@ -46,8 +46,8 @@ export interface CloseModelArgs extends TransferClientArgs {
46
46
  export interface TransferUpdatedEvent<TDocument> {
47
47
  document: TDocument;
48
48
  sourceClientId: string;
49
- /** See `ModelDocumentUpdateReason` in `./data/events` for the canonical reason set + semantics. */
50
- reason: 'changed' | 'deleted' | 'rebuilt' | 'saved';
49
+ /** See `TransferDocumentUpdateReason` in `./data/events` for the canonical reason set + semantics. */
50
+ reason: 'changed' | 'rebuilt' | 'saved';
51
51
  }
52
52
  export interface TransferSavedEvent<TDocument> {
53
53
  /** The document as persisted — the state that reached disk, not the state at request time. */
@@ -114,10 +114,10 @@ export declare function isElementSource(object: unknown): object is ElementSourc
114
114
  /** An element of a document that does not yet exist on disk — used during element creation flows. */
115
115
  export interface SyntheticSource {
116
116
  /**
117
- * The document the element would belong to. That document must already be
118
- * LOADED — the default resolution takes its parse root as the synthetic
119
- * node's container and answers `undefined` when it is not, so a URI for a
120
- * file that exists on disk but was never opened resolves to nothing.
117
+ * The document the element would belong to. It need not be loaded, or
118
+ * exist — an unloaded URI materialises a transient empty document, so a
119
+ * folder is a valid anchor. A URI that IS loaded contributes that
120
+ * document's parse root as the container, putting its contents in scope.
121
121
  */
122
122
  uri: string;
123
123
  /**
@@ -126,6 +126,16 @@ export interface SyntheticSource {
126
126
  * it is what scoping filters candidates against.
127
127
  */
128
128
  type: string;
129
+ /**
130
+ * The grammar the element will belong to, as a language id.
131
+ *
132
+ * Optional because `uri` and `type` each answer on their own when
133
+ * unambiguous. Set it when neither is: a URI naming no file carries no
134
+ * extension to route on, and a `type` two grammars can produce identifies
135
+ * neither. Unset, such a source reaches the server's own policy, which
136
+ * answers the same way for every caller.
137
+ */
138
+ language?: string;
129
139
  }
130
140
  export declare function isSyntheticSource(object: unknown): object is SyntheticSource;
131
141
  /**
@@ -135,7 +145,7 @@ export declare function isSyntheticSource(object: unknown): object is SyntheticS
135
145
  export declare namespace ReferenceSource {
136
146
  function document(uri: string): DocumentSource;
137
147
  function element(name: string, type?: string): ElementSource;
138
- function synthetic(uri: string, type: string): SyntheticSource;
148
+ function synthetic(uri: string, type: string, language?: string): SyntheticSource;
139
149
  }
140
150
  /**
141
151
  * One step in a synthetic navigation path from a {@link ReferenceSource}
@@ -329,9 +339,10 @@ export interface FindNextNameArgs {
329
339
  */
330
340
  uri: string;
331
341
  /**
332
- * The AST `$type` of the element being named. Collisions are only looked for
333
- * among elements of that same type, so the returned name may still be taken
334
- * by an element of another type.
342
+ * The AST `$type` of the element being named. Collisions are looked for
343
+ * among elements of that type and of any subtype of it, so a supertype
344
+ * names a uniqueness scope its concrete types share; the returned name may
345
+ * still be taken by an element outside that hierarchy.
335
346
  */
336
347
  type: string;
337
348
  /**
@@ -348,5 +359,11 @@ export interface FindNextNameArgs {
348
359
  * See {@link NameTier} for what each tier covers.
349
360
  */
350
361
  tier?: NameTier;
362
+ /**
363
+ * The grammar to name under, routed as {@link SyntheticSource.language} —
364
+ * this call builds one. A caller that sets it there must set it here, or
365
+ * candidates and the name it proposes come from different grammars.
366
+ */
367
+ language?: string;
351
368
  }
352
369
  //# sourceMappingURL=model-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-server.d.ts","sourceRoot":"","sources":["../src/model-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAW9E,6CAA6C;AAC7C,MAAM,WAAW,aAAc,SAAQ,kBAAkB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C;CACpB"}
@@ -47,8 +47,10 @@ var ReferenceSource;
47
47
  return { name, type };
48
48
  }
49
49
  ReferenceSource.element = element;
50
- function synthetic(uri, type) {
51
- return { uri, type };
50
+ function synthetic(uri, type, language) {
51
+ // The key is omitted rather than set to `undefined`, so a source built
52
+ // without a language stays deep-equal to the two-argument form.
53
+ return language === undefined ? { uri, type } : { uri, type, language };
52
54
  }
53
55
  ReferenceSource.synthetic = synthetic;
54
56
  })(ReferenceSource || (exports.ReferenceSource = ReferenceSource = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"model-server.js","sourceRoot":"","sources":["../src/model-server.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAyGlF,4CAEC;AA4BD,0CAEC;AAmBD,8CASC;AAkED,0CASC;AAyDD,gDAQC;AA7MD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,MAAe;IAC7C,OAAO,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC;AACtG,CAAC;AA4BD,SAAgB,eAAe,CAAC,MAAe;IAC5C,OAAO,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AACxG,CAAC;AAmBD,SAAgB,iBAAiB,CAAC,MAAe;IAC9C,OAAO,CACJ,CAAC,CAAC,MAAM;QACR,OAAO,MAAM,KAAK,QAAQ;QAC1B,KAAK,IAAI,MAAM;QACf,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;QAC9B,MAAM,IAAI,MAAM;QAChB,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CACjC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,IAAiB,eAAe,CAU/B;AAVD,WAAiB,eAAe;IAC7B,SAAgB,QAAQ,CAAC,GAAW;QACjC,O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,gCAAhB,gBAAgB,QAkBhC"}
@@ -17,6 +17,7 @@
17
17
  * `./model-server.ts` re-exports them, so an import from either path
18
18
  * resolves.
19
19
  */
20
+ import type { BasedOn } from './based-on';
20
21
  /** Identifies a client-document binding. Every facade operation carries these fields. */
21
22
  export interface TransferClientArgs {
22
23
  /** Document URI. */
@@ -36,15 +37,16 @@ export interface TransferUpdateArgs<T> extends TransferClientArgs {
36
37
  /** Structured model root or its serialised textual form. */
37
38
  model: T | string;
38
39
  /**
39
- * Optional based-on version: the text-document version this update
40
- * was authored against. When set, the server compares against its
41
- * current text-document version for `uri` and throws
42
- * `ConflictError` on mismatch. Omit to opt out of the gate — mirrors
43
- * LSP's `OptionalVersionedTextDocumentIdentifier` posture, intended
44
- * for headless / CLI / batch tooling without a meaningful based-on
45
- * version.
40
+ * What this update was authored against. A `SnapshotVersion` is compared
41
+ * against the server's current text-document version for `uri` and throws
42
+ * `ConflictError` on mismatch; `'anything'` writes unconditionally.
43
+ *
44
+ * **Required so that an ungated write is a decision rather than an
45
+ * omission.** An optional gate is indistinguishable from a forgotten one at
46
+ * the call site, and a file of twenty writes hides the one that lost the
47
+ * field. Nothing else here can see that, since the defect is an absence.
46
48
  */
47
- baseVersion?: number;
49
+ basedOn: BasedOn;
48
50
  }
49
51
  /**
50
52
  * Persist a document to disk via the in-process facade. Same `model`
@@ -54,11 +56,10 @@ export interface TransferSaveArgs<T> extends TransferClientArgs {
54
56
  /** Structured model root or its serialised textual form. */
55
57
  model: T | string;
56
58
  /**
57
- * Optional based-on version — same semantics as
58
- * {@link TransferUpdateArgs.baseVersion}. `save` delegates the gating
59
- * check to its inner `update`, so this field threads through to the
60
- * same `ConflictError` site.
59
+ * Same semantics and same requirement as {@link TransferUpdateArgs.basedOn}.
60
+ * `save` delegates the gating check to its inner `update`, so this field
61
+ * threads through to the same `ConflictError` site.
61
62
  */
62
- baseVersion?: number;
63
+ basedOn: BasedOn;
63
64
  }
64
65
  //# sourceMappingURL=args.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/model-service/args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;GAUG;AAEH,yFAAyF;AACzF,MAAM,WAAW,kBAAkB;IAChC,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,CAAE,SAAQ,kBAAkB;IAC9D,4DAA4D;IAC5D,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;IAClB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,kBAAkB;IAC5D,4DAA4D;IAC5D,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;IAClB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACvB"}
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/model-service/args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,yFAAyF;AACzF,MAAM,WAAW,kBAAkB;IAChC,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,CAAE,SAAQ,kBAAkB;IAC9D,4DAA4D;IAC5D,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;IAClB;;;;;;;;;OASG;IACH,OAAO,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,kBAAkB;IAC5D,4DAA4D;IAC5D,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;CACnB"}
@@ -0,0 +1,55 @@
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
+ declare const snapshotMarker: unique symbol;
10
+ /**
11
+ * A text-document version that came out of a SNAPSHOT read: a document
12
+ * envelope's `version`, which cannot move once the envelope exists.
13
+ *
14
+ * A plain number at runtime, usable anywhere a number is, and it travels the
15
+ * wire as one. The marker exists only so the compiler can tell it apart from a
16
+ * version read off a LIVE document, which is the same number type and is the
17
+ * defect the conflict gate exists to prevent: read at write time it is whatever
18
+ * the server is at now, which is the number the gate is about to compare it
19
+ * against, so the gate passes unconditionally and a concurrent edit is
20
+ * overwritten with nothing logged.
21
+ */
22
+ export type SnapshotVersion = number & {
23
+ readonly [snapshotMarker]: true;
24
+ };
25
+ /**
26
+ * What a write declares it was based on: a version from a snapshot read, or
27
+ * `'anything'`.
28
+ *
29
+ * `'anything'` is a precondition that always holds — the write accepts whatever
30
+ * the server currently has, and therefore overwrites it. It is the honest
31
+ * answer wherever the write was authored against no particular server version,
32
+ * and a lie anywhere a reader handed the writer a document. The field carrying
33
+ * it is required, so an ungated write is a word someone chose rather than a
34
+ * field someone forgot.
35
+ */
36
+ export type BasedOn = SnapshotVersion | 'anything';
37
+ /**
38
+ * Whether `basedOn` names a version, and so arms the gate.
39
+ *
40
+ * Branch on this rather than on `basedOn !== 'anything'`, which reads as "not
41
+ * based on anything" — the opposite of what the branch tests.
42
+ */
43
+ export declare function isSnapshotVersion(basedOn: BasedOn): basedOn is SnapshotVersion;
44
+ /**
45
+ * Mark a version as having come from a snapshot read.
46
+ *
47
+ * **For the envelope constructors, not for callers.** Every door that builds a
48
+ * document envelope applies it on the way in, so anything a read returns
49
+ * already carries it and a writer never needs this. A caller reaching for it is
50
+ * asserting a provenance the compiler was about to deny — the read-late defect
51
+ * written out where a reviewer can see it.
52
+ */
53
+ export declare function asSnapshotVersion(version: number): SnapshotVersion;
54
+ export {};
55
+ //# sourceMappingURL=based-on.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"based-on.d.ts","sourceRoot":"","sources":["../../src/model-service/based-on.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,CAAC,MAAM,cAAc,EAAE,OAAO,MAAM,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,UAAU,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,eAAe,CAE9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAElE"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the MIT License which is available in the project root.
7
+ *
8
+ * SPDX-License-Identifier: MIT
9
+ ********************************************************************************/
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.isSnapshotVersion = isSnapshotVersion;
12
+ exports.asSnapshotVersion = asSnapshotVersion;
13
+ /**
14
+ * Whether `basedOn` names a version, and so arms the gate.
15
+ *
16
+ * Branch on this rather than on `basedOn !== 'anything'`, which reads as "not
17
+ * based on anything" — the opposite of what the branch tests.
18
+ */
19
+ function isSnapshotVersion(basedOn) {
20
+ return typeof basedOn === 'number';
21
+ }
22
+ /**
23
+ * Mark a version as having come from a snapshot read.
24
+ *
25
+ * **For the envelope constructors, not for callers.** Every door that builds a
26
+ * document envelope applies it on the way in, so anything a read returns
27
+ * already carries it and a writer never needs this. A caller reaching for it is
28
+ * asserting a provenance the compiler was about to deny — the read-late defect
29
+ * written out where a reviewer can see it.
30
+ */
31
+ function asSnapshotVersion(version) {
32
+ return version;
33
+ }
34
+ //# sourceMappingURL=based-on.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"based-on.js","sourceRoot":"","sources":["../../src/model-service/based-on.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAqClF,8CAEC;AAWD,8CAEC;AArBD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,OAAgB;IAC/C,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC;AACtC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAAC,OAAe;IAC9C,OAAO,OAA0B,CAAC;AACrC,CAAC"}
@@ -7,5 +7,6 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  export * from './args';
10
+ export * from './based-on';
10
11
  export * from './reference-candidate';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAOlF,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAOlF,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
@@ -27,5 +27,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
27
27
  // argument types so both the framework facade and the data-server wire
28
28
  // protocol can structurally agree on the lifecycle shape.
29
29
  __exportStar(require("./args"), exports);
30
+ __exportStar(require("./based-on"), exports);
30
31
  __exportStar(require("./reference-candidate"), exports);
31
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,wEAAwE;AACxE,mEAAmE;AACnE,uEAAuE;AACvE,0DAA0D;AAE1D,yCAAuB;AACvB,wDAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,wEAAwE;AACxE,mEAAmE;AACnE,uEAAuE;AACvE,0DAA0D;AAE1D,yCAAuB;AACvB,6CAA2B;AAC3B,wDAAsC"}