@ethisyscore/protocol 0.7.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/dist/index.cjs +265 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +899 -0
- package/dist/index.d.ts +899 -0
- package/dist/index.js +236 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,899 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const BRIDGE_VERSION: "2026-06";
|
|
4
|
+
type BridgeVersion = typeof BRIDGE_VERSION;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* How a plugin's UI is rendered to the end user.
|
|
8
|
+
*
|
|
9
|
+
* - `host-rendered`: the host application renders the plugin UI from a declarative description.
|
|
10
|
+
* - `remote-runtime`: the plugin ships its own runtime that the host loads into an isolation boundary.
|
|
11
|
+
* - `first-party-host-extension`: the plugin is bundled with the host as a first-party extension
|
|
12
|
+
* sharing the host's runtime.
|
|
13
|
+
*/
|
|
14
|
+
declare const RenderMode: z.ZodEnum<["host-rendered", "remote-runtime", "first-party-host-extension"]>;
|
|
15
|
+
type RenderMode = z.infer<typeof RenderMode>;
|
|
16
|
+
/**
|
|
17
|
+
* Plugin classification enum — wire values mirror the C# `JsonStringEnumMemberName`
|
|
18
|
+
* tokens on `PluginType` (`CORE`, `PLATFORM_APP`, `TENANT_APP`), so the TypeScript schema
|
|
19
|
+
* round-trips through the .NET serialiser and through the JSON Schema enum gates.
|
|
20
|
+
*
|
|
21
|
+
* Earlier revisions accepted the C# member names (`Core`, `PlatformPlugin`, `TenantPlugin`),
|
|
22
|
+
* which silently disagreed with the wire format. Exported as a dedicated Zod enum so
|
|
23
|
+
* downstream consumers can validate `type` independently of the full manifest.
|
|
24
|
+
*/
|
|
25
|
+
declare const PluginType: z.ZodEnum<["CORE", "PLATFORM_APP", "TENANT_APP"]>;
|
|
26
|
+
type PluginType = z.infer<typeof PluginType>;
|
|
27
|
+
/**
|
|
28
|
+
* UI sub-shape of the plugin manifest.
|
|
29
|
+
*
|
|
30
|
+
* Mirrors a strict subset of the C# `UiContributions` record. Only the fields the TS contract
|
|
31
|
+
* currently consumes are modelled here — future tasks extend this schema additively as new
|
|
32
|
+
* fields (pages, surfaces, navigation, etc.) come in.
|
|
33
|
+
*
|
|
34
|
+
* Wire-shape parity: every member is optional, matching the C# `UiContributions` record
|
|
35
|
+
* where each sibling (`MenuItems`, `Pages`, `Surfaces`, `PortalContributions`, ...) is
|
|
36
|
+
* nullable / property-omitted. Omitting `portalContributions` leaves it `undefined` on
|
|
37
|
+
* parse — the consumer is responsible for treating undefined as "no contributions".
|
|
38
|
+
*
|
|
39
|
+
* The schema is `.passthrough()` so unrecognised UI sibling fields (e.g. `pages`,
|
|
40
|
+
* `surfaces`, `declarativeSurfaces`, `workerPages`, `navigation`) survive parse → re-emit
|
|
41
|
+
* unchanged instead of being silently stripped. The documented permissive intent
|
|
42
|
+
* (additive evolution of UI contributions) requires this — Zod object schemas strip
|
|
43
|
+
* unknown keys by default.
|
|
44
|
+
*/
|
|
45
|
+
declare const PluginUi: z.ZodObject<{
|
|
46
|
+
/**
|
|
47
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
48
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
49
|
+
*/
|
|
50
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
52
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
53
|
+
priority: z.ZodNumber;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
56
|
+
capability: string;
|
|
57
|
+
priority: number;
|
|
58
|
+
}, {
|
|
59
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
60
|
+
capability: string;
|
|
61
|
+
priority: number;
|
|
62
|
+
}>, "many">>;
|
|
63
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
64
|
+
/**
|
|
65
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
66
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
67
|
+
*/
|
|
68
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
69
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
70
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
71
|
+
priority: z.ZodNumber;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
74
|
+
capability: string;
|
|
75
|
+
priority: number;
|
|
76
|
+
}, {
|
|
77
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
78
|
+
capability: string;
|
|
79
|
+
priority: number;
|
|
80
|
+
}>, "many">>;
|
|
81
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
82
|
+
/**
|
|
83
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
84
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
85
|
+
*/
|
|
86
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
87
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
88
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
89
|
+
priority: z.ZodNumber;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
92
|
+
capability: string;
|
|
93
|
+
priority: number;
|
|
94
|
+
}, {
|
|
95
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
96
|
+
capability: string;
|
|
97
|
+
priority: number;
|
|
98
|
+
}>, "many">>;
|
|
99
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
100
|
+
type PluginUi = z.infer<typeof PluginUi>;
|
|
101
|
+
/**
|
|
102
|
+
* Canonical plugin manifest contract. Mirrors the C# `PluginManifest` record on the .NET side.
|
|
103
|
+
*
|
|
104
|
+
* The schema is intentionally permissive about additional fields the host hasn't been taught
|
|
105
|
+
* yet — `.passthrough()` keeps unknown root fields on the parsed object so a manifest
|
|
106
|
+
* round-trip (parse → re-emit) does not silently drop fields the C# / JSON Schema layers
|
|
107
|
+
* still recognise. Use a future `.strict()` variant for trust-boundary ingest where unknown
|
|
108
|
+
* keys must be rejected.
|
|
109
|
+
*/
|
|
110
|
+
declare const PluginManifest: z.ZodObject<{
|
|
111
|
+
id: z.ZodString;
|
|
112
|
+
name: z.ZodString;
|
|
113
|
+
version: z.ZodString;
|
|
114
|
+
type: z.ZodEnum<["CORE", "PLATFORM_APP", "TENANT_APP"]>;
|
|
115
|
+
owner: z.ZodString;
|
|
116
|
+
compatibleCoreVersion: z.ZodEffects<z.ZodString, string, string>;
|
|
117
|
+
renderMode: z.ZodDefault<z.ZodEnum<["host-rendered", "remote-runtime", "first-party-host-extension"]>>;
|
|
118
|
+
bridgeVersion: z.ZodOptional<z.ZodString>;
|
|
119
|
+
ui: z.ZodOptional<z.ZodObject<{
|
|
120
|
+
/**
|
|
121
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
122
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
123
|
+
*/
|
|
124
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
125
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
126
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
127
|
+
priority: z.ZodNumber;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
130
|
+
capability: string;
|
|
131
|
+
priority: number;
|
|
132
|
+
}, {
|
|
133
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
134
|
+
capability: string;
|
|
135
|
+
priority: number;
|
|
136
|
+
}>, "many">>;
|
|
137
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
138
|
+
/**
|
|
139
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
140
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
141
|
+
*/
|
|
142
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
143
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
144
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
145
|
+
priority: z.ZodNumber;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
148
|
+
capability: string;
|
|
149
|
+
priority: number;
|
|
150
|
+
}, {
|
|
151
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
152
|
+
capability: string;
|
|
153
|
+
priority: number;
|
|
154
|
+
}>, "many">>;
|
|
155
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
156
|
+
/**
|
|
157
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
158
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
159
|
+
*/
|
|
160
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
161
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
162
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
163
|
+
priority: z.ZodNumber;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
166
|
+
capability: string;
|
|
167
|
+
priority: number;
|
|
168
|
+
}, {
|
|
169
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
170
|
+
capability: string;
|
|
171
|
+
priority: number;
|
|
172
|
+
}>, "many">>;
|
|
173
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
174
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
175
|
+
id: z.ZodString;
|
|
176
|
+
name: z.ZodString;
|
|
177
|
+
version: z.ZodString;
|
|
178
|
+
type: z.ZodEnum<["CORE", "PLATFORM_APP", "TENANT_APP"]>;
|
|
179
|
+
owner: z.ZodString;
|
|
180
|
+
compatibleCoreVersion: z.ZodEffects<z.ZodString, string, string>;
|
|
181
|
+
renderMode: z.ZodDefault<z.ZodEnum<["host-rendered", "remote-runtime", "first-party-host-extension"]>>;
|
|
182
|
+
bridgeVersion: z.ZodOptional<z.ZodString>;
|
|
183
|
+
ui: z.ZodOptional<z.ZodObject<{
|
|
184
|
+
/**
|
|
185
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
186
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
187
|
+
*/
|
|
188
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
189
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
190
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
191
|
+
priority: z.ZodNumber;
|
|
192
|
+
}, "strip", z.ZodTypeAny, {
|
|
193
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
194
|
+
capability: string;
|
|
195
|
+
priority: number;
|
|
196
|
+
}, {
|
|
197
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
198
|
+
capability: string;
|
|
199
|
+
priority: number;
|
|
200
|
+
}>, "many">>;
|
|
201
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
202
|
+
/**
|
|
203
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
204
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
205
|
+
*/
|
|
206
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
207
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
208
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
209
|
+
priority: z.ZodNumber;
|
|
210
|
+
}, "strip", z.ZodTypeAny, {
|
|
211
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
212
|
+
capability: string;
|
|
213
|
+
priority: number;
|
|
214
|
+
}, {
|
|
215
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
216
|
+
capability: string;
|
|
217
|
+
priority: number;
|
|
218
|
+
}>, "many">>;
|
|
219
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
220
|
+
/**
|
|
221
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
222
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
223
|
+
*/
|
|
224
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
225
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
226
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
227
|
+
priority: z.ZodNumber;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
230
|
+
capability: string;
|
|
231
|
+
priority: number;
|
|
232
|
+
}, {
|
|
233
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
234
|
+
capability: string;
|
|
235
|
+
priority: number;
|
|
236
|
+
}>, "many">>;
|
|
237
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
238
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
239
|
+
id: z.ZodString;
|
|
240
|
+
name: z.ZodString;
|
|
241
|
+
version: z.ZodString;
|
|
242
|
+
type: z.ZodEnum<["CORE", "PLATFORM_APP", "TENANT_APP"]>;
|
|
243
|
+
owner: z.ZodString;
|
|
244
|
+
compatibleCoreVersion: z.ZodEffects<z.ZodString, string, string>;
|
|
245
|
+
renderMode: z.ZodDefault<z.ZodEnum<["host-rendered", "remote-runtime", "first-party-host-extension"]>>;
|
|
246
|
+
bridgeVersion: z.ZodOptional<z.ZodString>;
|
|
247
|
+
ui: z.ZodOptional<z.ZodObject<{
|
|
248
|
+
/**
|
|
249
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
250
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
251
|
+
*/
|
|
252
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
253
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
254
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
255
|
+
priority: z.ZodNumber;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
258
|
+
capability: string;
|
|
259
|
+
priority: number;
|
|
260
|
+
}, {
|
|
261
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
262
|
+
capability: string;
|
|
263
|
+
priority: number;
|
|
264
|
+
}>, "many">>;
|
|
265
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
266
|
+
/**
|
|
267
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
268
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
269
|
+
*/
|
|
270
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
271
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
272
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
273
|
+
priority: z.ZodNumber;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
276
|
+
capability: string;
|
|
277
|
+
priority: number;
|
|
278
|
+
}, {
|
|
279
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
280
|
+
capability: string;
|
|
281
|
+
priority: number;
|
|
282
|
+
}>, "many">>;
|
|
283
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
284
|
+
/**
|
|
285
|
+
* Plugin contributions to well-known host UI slots. Optional: omitting the field leaves
|
|
286
|
+
* it `undefined`, matching the C# `UiContributions.PortalContributions` null encoding.
|
|
287
|
+
*/
|
|
288
|
+
portalContributions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
289
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
290
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
291
|
+
priority: z.ZodNumber;
|
|
292
|
+
}, "strip", z.ZodTypeAny, {
|
|
293
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
294
|
+
capability: string;
|
|
295
|
+
priority: number;
|
|
296
|
+
}, {
|
|
297
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
298
|
+
capability: string;
|
|
299
|
+
priority: number;
|
|
300
|
+
}>, "many">>;
|
|
301
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
302
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
303
|
+
type PluginManifest = z.infer<typeof PluginManifest>;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* The closed v1 host slot taxonomy.
|
|
307
|
+
*
|
|
308
|
+
* The host owns the slot taxonomy; plugins target slot names by string. Adding a new slot
|
|
309
|
+
* is a coordinated host change — plugins cannot introduce slot names ad hoc.
|
|
310
|
+
*/
|
|
311
|
+
declare const KNOWN_SLOTS: readonly ["sidebar", "header", "dashboard", "command-palette", "entity-detail"];
|
|
312
|
+
/**
|
|
313
|
+
* Zod schema for a host slot name. Rejects values outside the closed v1 taxonomy.
|
|
314
|
+
*/
|
|
315
|
+
declare const HostSlot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
316
|
+
type HostSlot = z.infer<typeof HostSlot>;
|
|
317
|
+
/**
|
|
318
|
+
* A single plugin contribution targeting a host slot.
|
|
319
|
+
*
|
|
320
|
+
* - `slot`: the host slot the contribution targets (must be one of {@link KNOWN_SLOTS}).
|
|
321
|
+
* - `capability`: the capability gate the viewer must hold for the host to render the contribution.
|
|
322
|
+
* Must be a non-empty, non-whitespace string — whitespace-only values would render an
|
|
323
|
+
* unaddressable contribution or, depending on host interpretation, an accidentally
|
|
324
|
+
* unrestricted one. Wire-form parity with the C# `PortalContribution.Capability` init guard
|
|
325
|
+
* and the JSON Schemas, which all reject whitespace-only strings.
|
|
326
|
+
* - `priority`: arbitration weight when multiple plugins target the same slot. Higher wins.
|
|
327
|
+
* Range `0..1000` inclusive to keep the priority space bounded and reviewable.
|
|
328
|
+
*/
|
|
329
|
+
declare const PortalContribution: z.ZodObject<{
|
|
330
|
+
slot: z.ZodEnum<["sidebar", "header", "dashboard", "command-palette", "entity-detail"]>;
|
|
331
|
+
capability: z.ZodEffects<z.ZodString, string, string>;
|
|
332
|
+
priority: z.ZodNumber;
|
|
333
|
+
}, "strip", z.ZodTypeAny, {
|
|
334
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
335
|
+
capability: string;
|
|
336
|
+
priority: number;
|
|
337
|
+
}, {
|
|
338
|
+
slot: "sidebar" | "header" | "dashboard" | "command-palette" | "entity-detail";
|
|
339
|
+
capability: string;
|
|
340
|
+
priority: number;
|
|
341
|
+
}>;
|
|
342
|
+
type PortalContribution = z.infer<typeof PortalContribution>;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* The closed set of reactive rule kinds supported by the SDUI runtime.
|
|
346
|
+
*
|
|
347
|
+
* Plugins declare reactivity via these five kinds; the host owns evaluation order
|
|
348
|
+
* and side-effect semantics. Adding a new kind is a coordinated host change.
|
|
349
|
+
*/
|
|
350
|
+
declare const KNOWN_RULE_KINDS: readonly ["when", "visible", "required", "compute", "validate"];
|
|
351
|
+
/**
|
|
352
|
+
* The closed JsonLogic operator subset permitted in reactive rule expressions.
|
|
353
|
+
*
|
|
354
|
+
* The vocabulary is intentionally minimal: comparison, boolean, arithmetic, and `var`.
|
|
355
|
+
* No custom operators, no async, no loops, no mutation. Adding an operator is a
|
|
356
|
+
* coordinated protocol change — plugins cannot extend the vocabulary ad hoc.
|
|
357
|
+
*/
|
|
358
|
+
declare const KNOWN_OPERATORS: readonly ["==", "!=", ">", "<", ">=", "<=", "and", "or", "not", "+", "-", "*", "/", "%", "var"];
|
|
359
|
+
/**
|
|
360
|
+
* Zod schema for a reactive rule kind. Rejects values outside {@link KNOWN_RULE_KINDS}.
|
|
361
|
+
*/
|
|
362
|
+
declare const RuleKind: z.ZodEnum<["when", "visible", "required", "compute", "validate"]>;
|
|
363
|
+
type RuleKind = z.infer<typeof RuleKind>;
|
|
364
|
+
/**
|
|
365
|
+
* Literal scalar values permitted inside a reactive expression tree.
|
|
366
|
+
*
|
|
367
|
+
* Functions, `undefined`, and arbitrary objects are intentionally rejected to keep
|
|
368
|
+
* the expression vocabulary serialisable and free of host-side side effects.
|
|
369
|
+
*/
|
|
370
|
+
type LiteralValue = string | number | boolean | null;
|
|
371
|
+
/**
|
|
372
|
+
* Operator name from the closed JsonLogic subset {@link KNOWN_OPERATORS}.
|
|
373
|
+
*/
|
|
374
|
+
type OperatorName = (typeof KNOWN_OPERATORS)[number];
|
|
375
|
+
/**
|
|
376
|
+
* An operator-object form for {@link Expr} — a single-key record whose key is one of the
|
|
377
|
+
* closed {@link KNOWN_OPERATORS} and whose value is itself an {@link Expr}.
|
|
378
|
+
*
|
|
379
|
+
* The mapped-then-indexed shape `{ [K in OperatorName]: Record<K, Expr> }[OperatorName]`
|
|
380
|
+
* collapses to the discriminated union
|
|
381
|
+
* `{ "==": Expr } | { "!=": Expr } | ... | { var: Expr }`. Unlike the earlier optional-key
|
|
382
|
+
* form (`{ [K in OperatorName]?: Expr }`), this:
|
|
383
|
+
*
|
|
384
|
+
* - rejects the empty object literal `{}` at compile time;
|
|
385
|
+
* - rejects multi-key objects like `{ "==": a, "!=": b }` at compile time;
|
|
386
|
+
* - matches the runtime schema, which requires exactly one known operator key.
|
|
387
|
+
*
|
|
388
|
+
* Authors and tooling no longer have to wait for a Zod parse failure to discover an
|
|
389
|
+
* impossible-on-the-wire expression — the TypeScript compiler rejects it first.
|
|
390
|
+
*
|
|
391
|
+
* Modelled as an interface so the recursive `Expr` reference is resolved lazily; a plain
|
|
392
|
+
* `type` alias with an indexed mapped type triggers TS2456 (circular reference) under
|
|
393
|
+
* tsup's `--dts` build.
|
|
394
|
+
*/
|
|
395
|
+
interface ExprObject extends Partial<Record<OperatorName, Expr>> {
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* A JsonLogic expression in the closed operator subset.
|
|
399
|
+
*
|
|
400
|
+
* An expression is one of:
|
|
401
|
+
* - a {@link LiteralValue} (`string | number | boolean | null`)
|
|
402
|
+
* - an array of expressions (operand list)
|
|
403
|
+
* - an {@link ExprObject} (single-key object whose key is from {@link KNOWN_OPERATORS})
|
|
404
|
+
*
|
|
405
|
+
* The discriminated form lets consumers narrow on `typeof expr` / `Array.isArray` / object
|
|
406
|
+
* key inspection without resorting to `unknown` casts.
|
|
407
|
+
*
|
|
408
|
+
* Runtime validation (the `Expr` Zod schema below) is the authoritative check that the
|
|
409
|
+
* object carries exactly one known operator key. The TypeScript type narrows the *kind* of
|
|
410
|
+
* value an author may construct (it rules out arbitrary string keys); the schema enforces
|
|
411
|
+
* the single-key invariant on the wire.
|
|
412
|
+
*/
|
|
413
|
+
type Expr = LiteralValue | Expr[] | ExprObject;
|
|
414
|
+
/**
|
|
415
|
+
* Zod schema for a single reactive rule: a {@link RuleKind} paired with an expression
|
|
416
|
+
* built from the closed JsonLogic operator subset.
|
|
417
|
+
*/
|
|
418
|
+
declare const ReactiveRule: z.ZodObject<{
|
|
419
|
+
kind: z.ZodEnum<["when", "visible", "required", "compute", "validate"]>;
|
|
420
|
+
expr: z.ZodType<Expr, z.ZodTypeDef, Expr>;
|
|
421
|
+
}, "strip", z.ZodTypeAny, {
|
|
422
|
+
kind: "when" | "visible" | "required" | "compute" | "validate";
|
|
423
|
+
expr: Expr;
|
|
424
|
+
}, {
|
|
425
|
+
kind: "when" | "visible" | "required" | "compute" | "validate";
|
|
426
|
+
expr: Expr;
|
|
427
|
+
}>;
|
|
428
|
+
type ReactiveRule = z.infer<typeof ReactiveRule>;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* The closed v1 SDUI primitive vocabulary.
|
|
432
|
+
*
|
|
433
|
+
* Plugins author UI trees using only these primitive names; the host owns the rendering
|
|
434
|
+
* for each. Adding a new primitive is a coordinated host change — plugins cannot extend
|
|
435
|
+
* the vocabulary ad hoc. Deferred-vocabulary names (`Wizard`, `Timeline`, `Chart`,
|
|
436
|
+
* `EntityPicker`, `Detail`) are intentionally absent from v1 and are rejected by the
|
|
437
|
+
* {@link PrimitiveName} schema.
|
|
438
|
+
*
|
|
439
|
+
* `Portal` is the 17th primitive: it lets a plugin contribute a subtree into a host slot
|
|
440
|
+
* (see `./portal.ts` for the v1 slot taxonomy).
|
|
441
|
+
*/
|
|
442
|
+
declare const KNOWN_PRIMITIVES: readonly ["Page", "Section", "Stack", "Grid", "Form", "Field", "DataTable", "Card", "Stat", "Action", "Tabs", "Toolbar", "Filter", "EmptyState", "LoadingState", "ErrorState", "Portal"];
|
|
443
|
+
/**
|
|
444
|
+
* Zod schema for a SDUI primitive name. Rejects values outside the closed v1 vocabulary.
|
|
445
|
+
*/
|
|
446
|
+
declare const PrimitiveName: z.ZodEnum<["Page", "Section", "Stack", "Grid", "Form", "Field", "DataTable", "Card", "Stat", "Action", "Tabs", "Toolbar", "Filter", "EmptyState", "LoadingState", "ErrorState", "Portal"]>;
|
|
447
|
+
type PrimitiveName = z.infer<typeof PrimitiveName>;
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* A SDUI tree node.
|
|
451
|
+
*
|
|
452
|
+
* - `type`: one of the closed v1 primitive names (see {@link PrimitiveName}).
|
|
453
|
+
* - `props`: arbitrary per-primitive properties; the host owns interpretation.
|
|
454
|
+
* - `children`: optional child nodes; recursion is type-checked end-to-end.
|
|
455
|
+
* - `bindings`: optional reactive rules keyed by prop name (see {@link ReactiveRule}).
|
|
456
|
+
*
|
|
457
|
+
* The type alias and the Zod schema deliberately share the identifier `SduiNode` —
|
|
458
|
+
* TypeScript's declaration-merging rules allow a `type` and a `const` of the same name
|
|
459
|
+
* to coexist. The recursive schema is built with {@link z.lazy} so unknown primitives
|
|
460
|
+
* are rejected at any depth of the tree.
|
|
461
|
+
*/
|
|
462
|
+
type SduiNode = {
|
|
463
|
+
type: z.infer<typeof PrimitiveName>;
|
|
464
|
+
props?: Record<string, unknown>;
|
|
465
|
+
children?: SduiNode[];
|
|
466
|
+
bindings?: Record<string, z.infer<typeof ReactiveRule>>;
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* Recursive Zod schema for {@link SduiNode}.
|
|
470
|
+
*
|
|
471
|
+
* Validates the full tree: an unknown primitive at any depth fails the parse. `props`
|
|
472
|
+
* and `bindings` are permissive on the value side (props: `unknown`, bindings: a
|
|
473
|
+
* {@link ReactiveRule}) — the host owns prop semantics per primitive.
|
|
474
|
+
*/
|
|
475
|
+
declare const SduiNode: z.ZodType<SduiNode>;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* A single design-token category: a map of token name -> CSS value.
|
|
479
|
+
*
|
|
480
|
+
* The host owns the exact set of token names per category. At the protocol level we only
|
|
481
|
+
* enforce that values are strings; the schema deliberately admits an empty category so
|
|
482
|
+
* plugins can omit any category they do not care about.
|
|
483
|
+
*/
|
|
484
|
+
declare const TokenCategory: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
485
|
+
type TokenCategory = z.infer<typeof TokenCategory>;
|
|
486
|
+
/**
|
|
487
|
+
* The full token tree exchanged between host and plugin.
|
|
488
|
+
*
|
|
489
|
+
* Eight core categories carry the surface-level design language; six extended categories
|
|
490
|
+
* supply interaction-specific tokens (focus rings, overlays, dividers, shadows, inputs).
|
|
491
|
+
*
|
|
492
|
+
* Each category defaults to an empty record, mirroring the host-side `BridgeThemeTokens`
|
|
493
|
+
* shape in `sdk/app-bridge`.
|
|
494
|
+
*/
|
|
495
|
+
declare const BridgeThemeTokens: z.ZodObject<{
|
|
496
|
+
brand: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
497
|
+
background: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
498
|
+
text: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
499
|
+
status: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
500
|
+
border: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
501
|
+
radius: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
502
|
+
spacing: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
503
|
+
typography: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
504
|
+
focus: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
505
|
+
interaction: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
506
|
+
overlay: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
507
|
+
divider: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
508
|
+
shadow: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
509
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
510
|
+
}, "strip", z.ZodTypeAny, {
|
|
511
|
+
status: Record<string, string>;
|
|
512
|
+
brand: Record<string, string>;
|
|
513
|
+
background: Record<string, string>;
|
|
514
|
+
text: Record<string, string>;
|
|
515
|
+
border: Record<string, string>;
|
|
516
|
+
radius: Record<string, string>;
|
|
517
|
+
spacing: Record<string, string>;
|
|
518
|
+
typography: Record<string, string>;
|
|
519
|
+
focus: Record<string, string>;
|
|
520
|
+
interaction: Record<string, string>;
|
|
521
|
+
overlay: Record<string, string>;
|
|
522
|
+
divider: Record<string, string>;
|
|
523
|
+
shadow: Record<string, string>;
|
|
524
|
+
input: Record<string, string>;
|
|
525
|
+
}, {
|
|
526
|
+
status?: Record<string, string> | undefined;
|
|
527
|
+
brand?: Record<string, string> | undefined;
|
|
528
|
+
background?: Record<string, string> | undefined;
|
|
529
|
+
text?: Record<string, string> | undefined;
|
|
530
|
+
border?: Record<string, string> | undefined;
|
|
531
|
+
radius?: Record<string, string> | undefined;
|
|
532
|
+
spacing?: Record<string, string> | undefined;
|
|
533
|
+
typography?: Record<string, string> | undefined;
|
|
534
|
+
focus?: Record<string, string> | undefined;
|
|
535
|
+
interaction?: Record<string, string> | undefined;
|
|
536
|
+
overlay?: Record<string, string> | undefined;
|
|
537
|
+
divider?: Record<string, string> | undefined;
|
|
538
|
+
shadow?: Record<string, string> | undefined;
|
|
539
|
+
input?: Record<string, string> | undefined;
|
|
540
|
+
}>;
|
|
541
|
+
type BridgeThemeTokens = z.infer<typeof BridgeThemeTokens>;
|
|
542
|
+
/**
|
|
543
|
+
* Color scheme reported by the host. The plugin must subscribe to `onThemeChange`; the
|
|
544
|
+
* user can toggle modes at runtime without a route change.
|
|
545
|
+
*/
|
|
546
|
+
declare const BridgeThemeMode: z.ZodEnum<["light", "dark"]>;
|
|
547
|
+
type BridgeThemeMode = z.infer<typeof BridgeThemeMode>;
|
|
548
|
+
/**
|
|
549
|
+
* Accessibility signals piggy-backed on the theme payload.
|
|
550
|
+
*
|
|
551
|
+
* - `highContrast`: viewer has enabled the OS-level high-contrast preference.
|
|
552
|
+
* - `reducedMotion`: viewer has enabled the OS-level reduced-motion preference. Animation
|
|
553
|
+
* tokens should be disabled or shortened when this is `true`.
|
|
554
|
+
*/
|
|
555
|
+
declare const BridgeThemeAccessibility: z.ZodObject<{
|
|
556
|
+
highContrast: z.ZodBoolean;
|
|
557
|
+
reducedMotion: z.ZodBoolean;
|
|
558
|
+
}, "strip", z.ZodTypeAny, {
|
|
559
|
+
highContrast: boolean;
|
|
560
|
+
reducedMotion: boolean;
|
|
561
|
+
}, {
|
|
562
|
+
highContrast: boolean;
|
|
563
|
+
reducedMotion: boolean;
|
|
564
|
+
}>;
|
|
565
|
+
type BridgeThemeAccessibility = z.infer<typeof BridgeThemeAccessibility>;
|
|
566
|
+
/**
|
|
567
|
+
* The full theme payload delivered to a plugin surface.
|
|
568
|
+
*
|
|
569
|
+
* - `tokenVersion`: semantic version of the host's token schema. Plugins compare this
|
|
570
|
+
* against their `Manifest.TokenVersion` to detect incompatibilities at boot.
|
|
571
|
+
* - `mode`: current color scheme.
|
|
572
|
+
* - `accessibility`: viewer accessibility preferences.
|
|
573
|
+
* - `tokens`: full 14-category token tree.
|
|
574
|
+
*/
|
|
575
|
+
declare const BridgeTheme: z.ZodObject<{
|
|
576
|
+
tokenVersion: z.ZodString;
|
|
577
|
+
mode: z.ZodEnum<["light", "dark"]>;
|
|
578
|
+
accessibility: z.ZodObject<{
|
|
579
|
+
highContrast: z.ZodBoolean;
|
|
580
|
+
reducedMotion: z.ZodBoolean;
|
|
581
|
+
}, "strip", z.ZodTypeAny, {
|
|
582
|
+
highContrast: boolean;
|
|
583
|
+
reducedMotion: boolean;
|
|
584
|
+
}, {
|
|
585
|
+
highContrast: boolean;
|
|
586
|
+
reducedMotion: boolean;
|
|
587
|
+
}>;
|
|
588
|
+
tokens: z.ZodObject<{
|
|
589
|
+
brand: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
590
|
+
background: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
591
|
+
text: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
592
|
+
status: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
593
|
+
border: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
594
|
+
radius: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
595
|
+
spacing: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
596
|
+
typography: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
597
|
+
focus: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
598
|
+
interaction: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
599
|
+
overlay: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
600
|
+
divider: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
601
|
+
shadow: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
602
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
603
|
+
}, "strip", z.ZodTypeAny, {
|
|
604
|
+
status: Record<string, string>;
|
|
605
|
+
brand: Record<string, string>;
|
|
606
|
+
background: Record<string, string>;
|
|
607
|
+
text: Record<string, string>;
|
|
608
|
+
border: Record<string, string>;
|
|
609
|
+
radius: Record<string, string>;
|
|
610
|
+
spacing: Record<string, string>;
|
|
611
|
+
typography: Record<string, string>;
|
|
612
|
+
focus: Record<string, string>;
|
|
613
|
+
interaction: Record<string, string>;
|
|
614
|
+
overlay: Record<string, string>;
|
|
615
|
+
divider: Record<string, string>;
|
|
616
|
+
shadow: Record<string, string>;
|
|
617
|
+
input: Record<string, string>;
|
|
618
|
+
}, {
|
|
619
|
+
status?: Record<string, string> | undefined;
|
|
620
|
+
brand?: Record<string, string> | undefined;
|
|
621
|
+
background?: Record<string, string> | undefined;
|
|
622
|
+
text?: Record<string, string> | undefined;
|
|
623
|
+
border?: Record<string, string> | undefined;
|
|
624
|
+
radius?: Record<string, string> | undefined;
|
|
625
|
+
spacing?: Record<string, string> | undefined;
|
|
626
|
+
typography?: Record<string, string> | undefined;
|
|
627
|
+
focus?: Record<string, string> | undefined;
|
|
628
|
+
interaction?: Record<string, string> | undefined;
|
|
629
|
+
overlay?: Record<string, string> | undefined;
|
|
630
|
+
divider?: Record<string, string> | undefined;
|
|
631
|
+
shadow?: Record<string, string> | undefined;
|
|
632
|
+
input?: Record<string, string> | undefined;
|
|
633
|
+
}>;
|
|
634
|
+
}, "strip", z.ZodTypeAny, {
|
|
635
|
+
tokenVersion: string;
|
|
636
|
+
mode: "light" | "dark";
|
|
637
|
+
accessibility: {
|
|
638
|
+
highContrast: boolean;
|
|
639
|
+
reducedMotion: boolean;
|
|
640
|
+
};
|
|
641
|
+
tokens: {
|
|
642
|
+
status: Record<string, string>;
|
|
643
|
+
brand: Record<string, string>;
|
|
644
|
+
background: Record<string, string>;
|
|
645
|
+
text: Record<string, string>;
|
|
646
|
+
border: Record<string, string>;
|
|
647
|
+
radius: Record<string, string>;
|
|
648
|
+
spacing: Record<string, string>;
|
|
649
|
+
typography: Record<string, string>;
|
|
650
|
+
focus: Record<string, string>;
|
|
651
|
+
interaction: Record<string, string>;
|
|
652
|
+
overlay: Record<string, string>;
|
|
653
|
+
divider: Record<string, string>;
|
|
654
|
+
shadow: Record<string, string>;
|
|
655
|
+
input: Record<string, string>;
|
|
656
|
+
};
|
|
657
|
+
}, {
|
|
658
|
+
tokenVersion: string;
|
|
659
|
+
mode: "light" | "dark";
|
|
660
|
+
accessibility: {
|
|
661
|
+
highContrast: boolean;
|
|
662
|
+
reducedMotion: boolean;
|
|
663
|
+
};
|
|
664
|
+
tokens: {
|
|
665
|
+
status?: Record<string, string> | undefined;
|
|
666
|
+
brand?: Record<string, string> | undefined;
|
|
667
|
+
background?: Record<string, string> | undefined;
|
|
668
|
+
text?: Record<string, string> | undefined;
|
|
669
|
+
border?: Record<string, string> | undefined;
|
|
670
|
+
radius?: Record<string, string> | undefined;
|
|
671
|
+
spacing?: Record<string, string> | undefined;
|
|
672
|
+
typography?: Record<string, string> | undefined;
|
|
673
|
+
focus?: Record<string, string> | undefined;
|
|
674
|
+
interaction?: Record<string, string> | undefined;
|
|
675
|
+
overlay?: Record<string, string> | undefined;
|
|
676
|
+
divider?: Record<string, string> | undefined;
|
|
677
|
+
shadow?: Record<string, string> | undefined;
|
|
678
|
+
input?: Record<string, string> | undefined;
|
|
679
|
+
};
|
|
680
|
+
}>;
|
|
681
|
+
type BridgeTheme = z.infer<typeof BridgeTheme>;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Tool permission flags. Bit values mirror the C# `EthisysCore.Protocol.Security.ToolPermission`
|
|
685
|
+
* enum verbatim — these integers are part of the wire contract and must stay in sync.
|
|
686
|
+
*
|
|
687
|
+
* @remarks
|
|
688
|
+
* Combine atomic flags with bitwise OR (e.g. `ToolPermission.View | ToolPermission.Read`)
|
|
689
|
+
* and test membership with {@link hasPermission}. The composite values (`ReaderAccess`,
|
|
690
|
+
* `ContributorAccess`, `OwnerAccess`) are convenience aliases for the most common
|
|
691
|
+
* combinations.
|
|
692
|
+
*/
|
|
693
|
+
declare const ToolPermission: {
|
|
694
|
+
/** No permissions required. */
|
|
695
|
+
readonly None: 0;
|
|
696
|
+
/** Permission to assign resources or roles. */
|
|
697
|
+
readonly Assign: number;
|
|
698
|
+
/** Permission to view resources in a summary or listing context. */
|
|
699
|
+
readonly View: number;
|
|
700
|
+
/** Permission to delete resources. */
|
|
701
|
+
readonly Delete: number;
|
|
702
|
+
/** Permission to create or modify resources. Default for tools. */
|
|
703
|
+
readonly Write: number;
|
|
704
|
+
/** Permission to read detailed resource content. */
|
|
705
|
+
readonly Read: number;
|
|
706
|
+
/** Permission to approve workflows or submissions. */
|
|
707
|
+
readonly Approve: number;
|
|
708
|
+
/** Permission to publish resources globally across tenants. */
|
|
709
|
+
readonly PublishGlobal: number;
|
|
710
|
+
/** Composite: `View | Read` (18). */
|
|
711
|
+
readonly ReaderAccess: number;
|
|
712
|
+
/** Composite: `View | Write | Read` (26). */
|
|
713
|
+
readonly ContributorAccess: number;
|
|
714
|
+
/** Composite: all atomic permissions combined (127). */
|
|
715
|
+
readonly OwnerAccess: number;
|
|
716
|
+
};
|
|
717
|
+
type ToolPermission = (typeof ToolPermission)[keyof typeof ToolPermission];
|
|
718
|
+
/**
|
|
719
|
+
* Returns `true` when `set` contains every bit in `required`.
|
|
720
|
+
*
|
|
721
|
+
* Semantics match the C# `HasFlag` behaviour: a required mask with multiple bits demands
|
|
722
|
+
* that all of them are present in the granted set, not just any one of them.
|
|
723
|
+
*/
|
|
724
|
+
declare function hasPermission(set: number, required: number): boolean;
|
|
725
|
+
/**
|
|
726
|
+
* Runtime validator for a serialized `ToolPermission` value. Accepts a non-negative
|
|
727
|
+
* **signed 32-bit** integer (0..0x7FFFFFFF) because:
|
|
728
|
+
*
|
|
729
|
+
* 1. The C# `ToolPermission` enum's underlying type is `int` (signed 32-bit). Values
|
|
730
|
+
* outside that range have no in-protocol representation.
|
|
731
|
+
* 2. `hasPermission` performs `set & required` — JavaScript's bitwise `&` coerces both
|
|
732
|
+
* operands to signed 32-bit, so values at or above 0x80000000 silently overflow
|
|
733
|
+
* (the high bit becomes the sign bit). A schema that accepted them would let an
|
|
734
|
+
* out-of-range manifest validate while `hasPermission` returned nonsense.
|
|
735
|
+
*
|
|
736
|
+
* Callers may still combine atomic flags into composites the protocol has not named
|
|
737
|
+
* (e.g. `Write | Approve`) — any combination of the currently-defined bits fits inside
|
|
738
|
+
* the 32-bit signed range with margin.
|
|
739
|
+
*/
|
|
740
|
+
declare const ToolPermissionFlags: z.ZodNumber;
|
|
741
|
+
type ToolPermissionFlags = z.infer<typeof ToolPermissionFlags>;
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Audience claim pinned to the CoreConnect MCP boundary.
|
|
745
|
+
*
|
|
746
|
+
* Capability tokens are minted by the Api for a single audience. The literal type prevents
|
|
747
|
+
* accidental cross-audience reuse at parse time; cryptographic verification happens in the
|
|
748
|
+
* Api layer, not here.
|
|
749
|
+
*/
|
|
750
|
+
declare const CapabilityTokenAudience: z.ZodLiteral<"coreconnect-mcp">;
|
|
751
|
+
type CapabilityTokenAudience = z.infer<typeof CapabilityTokenAudience>;
|
|
752
|
+
/**
|
|
753
|
+
* Surface taxonomy that the capability token is bound to.
|
|
754
|
+
*
|
|
755
|
+
* - `page` — a top-level routed surface inside an extension.
|
|
756
|
+
* - `dialog` — modal dialog opened over the host.
|
|
757
|
+
* - `panel` — non-modal side panel.
|
|
758
|
+
* - `portal` — a contribution rendered into a host-owned slot (sidebar, header, etc.).
|
|
759
|
+
*
|
|
760
|
+
* @remarks
|
|
761
|
+
* Distinct from the manifest-level `SurfaceType` enum: that enum describes how a plugin
|
|
762
|
+
* *declares* a surface contribution, whereas this enum describes *which* surface a runtime
|
|
763
|
+
* capability token is bound to at invocation time.
|
|
764
|
+
*/
|
|
765
|
+
declare const CapabilityTokenSurfaceKind: z.ZodEnum<["page", "dialog", "panel", "portal"]>;
|
|
766
|
+
type CapabilityTokenSurfaceKind = z.infer<typeof CapabilityTokenSurfaceKind>;
|
|
767
|
+
/**
|
|
768
|
+
* Runtime implementation the surface is being rendered under.
|
|
769
|
+
*
|
|
770
|
+
* - `host-rendered` — host application renders the surface from a declarative description.
|
|
771
|
+
* - `worker-remote-dom` — plugin ships a remote runtime hosted in a Web Worker /
|
|
772
|
+
* isolation boundary, communicating with the host via remote-DOM.
|
|
773
|
+
* - `first-party-host-extension` — plugin is bundled with the host and shares its runtime.
|
|
774
|
+
*
|
|
775
|
+
* @remarks
|
|
776
|
+
* `worker-remote-dom` is the runtime-level analogue of the manifest's `remote-runtime`
|
|
777
|
+
* `RenderMode`. The names diverge intentionally: the manifest declares an intent
|
|
778
|
+
* (RenderMode.RemoteRuntime), and the token records the concrete runtime the host chose
|
|
779
|
+
* to honour it with.
|
|
780
|
+
*/
|
|
781
|
+
declare const CapabilityTokenRuntimeImplementation: z.ZodEnum<["host-rendered", "worker-remote-dom", "first-party-host-extension"]>;
|
|
782
|
+
type CapabilityTokenRuntimeImplementation = z.infer<typeof CapabilityTokenRuntimeImplementation>;
|
|
783
|
+
/**
|
|
784
|
+
* Claim shape for a CoreConnect capability token.
|
|
785
|
+
*
|
|
786
|
+
* The schema enforces structural validity only — cryptographic signature verification,
|
|
787
|
+
* issuer trust, and expiry enforcement live in the Api. JWT registered claims (`iss`,
|
|
788
|
+
* `sub`, `aud`, `iat`, `exp`, `jti`) are kept in their canonical lower-case form; the
|
|
789
|
+
* tenancy + surface claims use snake_case to match how the Api emits them on the wire.
|
|
790
|
+
*
|
|
791
|
+
* Tightenings (beyond the bare JWT shape):
|
|
792
|
+
*
|
|
793
|
+
* - All required string claims are `.min(1)` — empty `tenant_id` / `extension_id` / `jti`
|
|
794
|
+
* etc. are not meaningful tenancy values and must be rejected at parse time, not at
|
|
795
|
+
* downstream rendering.
|
|
796
|
+
* - `org_id`, `tenant_id`, `user_id`, `extension_id`, and `surface_instance_id` are
|
|
797
|
+
* contractually UUIDs — `.uuid()` rejects free-form identifiers before they reach the
|
|
798
|
+
* tenant boundary.
|
|
799
|
+
* - `iat` / `exp` are Unix seconds; non-negative integers only. A `.refine()` then asserts
|
|
800
|
+
* `exp > iat` so a token cannot validate with an expiry at-or-before its issuance.
|
|
801
|
+
*
|
|
802
|
+
* Cryptographic verification continues to be the Api's responsibility — these rules cover
|
|
803
|
+
* the structural plane.
|
|
804
|
+
*/
|
|
805
|
+
declare const CapabilityTokenClaims: z.ZodEffects<z.ZodObject<{
|
|
806
|
+
/** JWT issuer (`iss`) — the Api endpoint that minted the token. */
|
|
807
|
+
iss: z.ZodString;
|
|
808
|
+
/** JWT subject (`sub`) — typically the acting user principal. */
|
|
809
|
+
sub: z.ZodString;
|
|
810
|
+
/** JWT audience (`aud`) — pinned to the MCP boundary. */
|
|
811
|
+
aud: z.ZodLiteral<"coreconnect-mcp">;
|
|
812
|
+
/** JWT issued-at (`iat`) — Unix seconds, non-negative. */
|
|
813
|
+
iat: z.ZodNumber;
|
|
814
|
+
/** JWT expiry (`exp`) — Unix seconds, non-negative. */
|
|
815
|
+
exp: z.ZodNumber;
|
|
816
|
+
/** Organisation the surface is scoped to. */
|
|
817
|
+
org_id: z.ZodString;
|
|
818
|
+
/** Tenant the surface is scoped to within the organisation. */
|
|
819
|
+
tenant_id: z.ZodString;
|
|
820
|
+
/** Acting user principal. */
|
|
821
|
+
user_id: z.ZodString;
|
|
822
|
+
/** Identifier of the extension that owns the surface. */
|
|
823
|
+
extension_id: z.ZodString;
|
|
824
|
+
/** Specific version of the extension currently rendered. */
|
|
825
|
+
extension_version: z.ZodString;
|
|
826
|
+
/** Stable identifier of the surface instance (per open dialog/page). */
|
|
827
|
+
surface_instance_id: z.ZodString;
|
|
828
|
+
/** Taxonomic kind of the surface this token is bound to. */
|
|
829
|
+
surface_kind: z.ZodEnum<["page", "dialog", "panel", "portal"]>;
|
|
830
|
+
/** Runtime implementation rendering the surface. */
|
|
831
|
+
runtime_implementation: z.ZodEnum<["host-rendered", "worker-remote-dom", "first-party-host-extension"]>;
|
|
832
|
+
/** JWT identifier (`jti`) — unique per token, supports replay detection. */
|
|
833
|
+
jti: z.ZodString;
|
|
834
|
+
}, "strip", z.ZodTypeAny, {
|
|
835
|
+
iss: string;
|
|
836
|
+
sub: string;
|
|
837
|
+
aud: "coreconnect-mcp";
|
|
838
|
+
iat: number;
|
|
839
|
+
exp: number;
|
|
840
|
+
org_id: string;
|
|
841
|
+
tenant_id: string;
|
|
842
|
+
user_id: string;
|
|
843
|
+
extension_id: string;
|
|
844
|
+
extension_version: string;
|
|
845
|
+
surface_instance_id: string;
|
|
846
|
+
surface_kind: "page" | "dialog" | "panel" | "portal";
|
|
847
|
+
runtime_implementation: "host-rendered" | "first-party-host-extension" | "worker-remote-dom";
|
|
848
|
+
jti: string;
|
|
849
|
+
}, {
|
|
850
|
+
iss: string;
|
|
851
|
+
sub: string;
|
|
852
|
+
aud: "coreconnect-mcp";
|
|
853
|
+
iat: number;
|
|
854
|
+
exp: number;
|
|
855
|
+
org_id: string;
|
|
856
|
+
tenant_id: string;
|
|
857
|
+
user_id: string;
|
|
858
|
+
extension_id: string;
|
|
859
|
+
extension_version: string;
|
|
860
|
+
surface_instance_id: string;
|
|
861
|
+
surface_kind: "page" | "dialog" | "panel" | "portal";
|
|
862
|
+
runtime_implementation: "host-rendered" | "first-party-host-extension" | "worker-remote-dom";
|
|
863
|
+
jti: string;
|
|
864
|
+
}>, {
|
|
865
|
+
iss: string;
|
|
866
|
+
sub: string;
|
|
867
|
+
aud: "coreconnect-mcp";
|
|
868
|
+
iat: number;
|
|
869
|
+
exp: number;
|
|
870
|
+
org_id: string;
|
|
871
|
+
tenant_id: string;
|
|
872
|
+
user_id: string;
|
|
873
|
+
extension_id: string;
|
|
874
|
+
extension_version: string;
|
|
875
|
+
surface_instance_id: string;
|
|
876
|
+
surface_kind: "page" | "dialog" | "panel" | "portal";
|
|
877
|
+
runtime_implementation: "host-rendered" | "first-party-host-extension" | "worker-remote-dom";
|
|
878
|
+
jti: string;
|
|
879
|
+
}, {
|
|
880
|
+
iss: string;
|
|
881
|
+
sub: string;
|
|
882
|
+
aud: "coreconnect-mcp";
|
|
883
|
+
iat: number;
|
|
884
|
+
exp: number;
|
|
885
|
+
org_id: string;
|
|
886
|
+
tenant_id: string;
|
|
887
|
+
user_id: string;
|
|
888
|
+
extension_id: string;
|
|
889
|
+
extension_version: string;
|
|
890
|
+
surface_instance_id: string;
|
|
891
|
+
surface_kind: "page" | "dialog" | "panel" | "portal";
|
|
892
|
+
runtime_implementation: "host-rendered" | "first-party-host-extension" | "worker-remote-dom";
|
|
893
|
+
jti: string;
|
|
894
|
+
}>;
|
|
895
|
+
type CapabilityTokenClaims = z.infer<typeof CapabilityTokenClaims>;
|
|
896
|
+
|
|
897
|
+
declare const PROTOCOL_PACKAGE = "@ethisyscore/protocol";
|
|
898
|
+
|
|
899
|
+
export { BRIDGE_VERSION, BridgeTheme, BridgeThemeAccessibility, BridgeThemeMode, BridgeThemeTokens, type BridgeVersion, CapabilityTokenAudience, CapabilityTokenClaims, CapabilityTokenRuntimeImplementation, CapabilityTokenSurfaceKind, type Expr, type ExprObject, HostSlot, KNOWN_OPERATORS, KNOWN_PRIMITIVES, KNOWN_RULE_KINDS, KNOWN_SLOTS, type LiteralValue, type OperatorName, PROTOCOL_PACKAGE, PluginManifest, PluginType, PluginUi, PortalContribution, PrimitiveName, ReactiveRule, RenderMode, RuleKind, SduiNode, TokenCategory, ToolPermission, ToolPermissionFlags, hasPermission };
|