@kumwe/studio-protocol 0.1.0-alpha.2

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 (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/dist/guards.d.ts +4 -0
  4. package/dist/guards.d.ts.map +1 -0
  5. package/dist/guards.js +288 -0
  6. package/dist/guards.js.map +1 -0
  7. package/dist/index.d.ts +4 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +4 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/schemas.d.ts +24 -0
  12. package/dist/schemas.d.ts.map +1 -0
  13. package/dist/schemas.js +66 -0
  14. package/dist/schemas.js.map +1 -0
  15. package/dist/types.d.ts +989 -0
  16. package/dist/types.d.ts.map +1 -0
  17. package/dist/types.js +3 -0
  18. package/dist/types.js.map +1 -0
  19. package/package.json +38 -0
  20. package/schemas/block-definition.schema.json +218 -0
  21. package/schemas/blueprint.schema.json +236 -0
  22. package/schemas/command-vector.schema.json +64 -0
  23. package/schemas/command.schema.json +373 -0
  24. package/schemas/common.schema.json +222 -0
  25. package/schemas/content-model.schema.json +216 -0
  26. package/schemas/entry.schema.json +32 -0
  27. package/schemas/host-capabilities.schema.json +64 -0
  28. package/schemas/host-error.schema.json +42 -0
  29. package/schemas/manifest.json +117 -0
  30. package/schemas/media-asset.schema.json +83 -0
  31. package/schemas/media-reference.schema.json +112 -0
  32. package/schemas/media-upload-session.schema.json +109 -0
  33. package/schemas/pattern.schema.json +50 -0
  34. package/schemas/plugin-manifest.schema.json +124 -0
  35. package/schemas/preview-message.schema.json +226 -0
  36. package/schemas/provenance.schema.json +57 -0
  37. package/schemas/rich-text-projection.schema.json +70 -0
  38. package/schemas/rich-text.schema.json +174 -0
  39. package/schemas/schema-profile.schema.json +161 -0
  40. package/schemas/studio-config.schema.json +244 -0
  41. package/schemas/theme.schema.json +164 -0
  42. package/schemas/unresolved-contribution.schema.json +48 -0
@@ -0,0 +1,989 @@
1
+ export declare const STUDIO_CONTRACT_VERSION: "0.1-draft";
2
+ export type StudioContractVersion = typeof STUDIO_CONTRACT_VERSION;
3
+ export declare const STUDIO_WIRE_PROTOCOL_VERSION: "0.1.0-draft.1";
4
+ export type StudioWireProtocolVersion = typeof STUDIO_WIRE_PROTOCOL_VERSION;
5
+ export type JsonPrimitive = boolean | null | number | string;
6
+ export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
7
+ export interface JsonObject {
8
+ [key: string]: JsonValue;
9
+ }
10
+ export interface JsonSchema extends JsonObject {
11
+ $id?: string;
12
+ $schema?: string;
13
+ }
14
+ export type StableId = string;
15
+ export type Revision = string;
16
+ export type SemanticVersion = string;
17
+ export type QualifiedName = `${string}/${string}`;
18
+ export type LocalName = string;
19
+ export type PackageRelativePath = string;
20
+ export type NodeId = StableId;
21
+ export type BlockType = QualifiedName;
22
+ export interface MessageReference {
23
+ defaultMessage?: string;
24
+ key: QualifiedName;
25
+ }
26
+ export interface OwnerReference {
27
+ id: QualifiedName;
28
+ version: SemanticVersion;
29
+ }
30
+ export interface ArtifactReference {
31
+ id: StableId;
32
+ integrity?: string;
33
+ revision?: Revision;
34
+ version: SemanticVersion;
35
+ }
36
+ export interface LockedArtifactReference extends ArtifactReference {
37
+ revision: Revision;
38
+ }
39
+ export interface ResolvedEntryReference {
40
+ id: StableId;
41
+ integrity?: string;
42
+ revision: Revision;
43
+ }
44
+ export interface DiagnosticLocation {
45
+ artifactId?: StableId;
46
+ fieldPath?: LocalName[];
47
+ jsonPointer?: string;
48
+ nodeId?: NodeId;
49
+ }
50
+ export interface StudioDiagnostic {
51
+ code: QualifiedName;
52
+ location?: DiagnosticLocation;
53
+ message: MessageReference;
54
+ parameters?: Record<string, JsonPrimitive>;
55
+ remediations?: QualifiedName[];
56
+ severity: 'blocking' | 'error' | 'information' | 'warning';
57
+ }
58
+ export interface EntryFieldBindingSource {
59
+ fieldPath: LocalName[];
60
+ kind: 'entry-field';
61
+ }
62
+ export interface ContextValueBindingSource {
63
+ key: QualifiedName;
64
+ kind: 'context-value';
65
+ }
66
+ export interface StaticValueBindingSource {
67
+ kind: 'static-value';
68
+ value: JsonValue;
69
+ }
70
+ export interface ResourceReferenceBindingSource {
71
+ id: StableId;
72
+ kind: 'resource-reference';
73
+ resourceType: QualifiedName;
74
+ }
75
+ export interface QueryReferenceBindingSource {
76
+ kind: 'query-reference';
77
+ parameters: JsonObject;
78
+ query: QualifiedName;
79
+ version: SemanticVersion;
80
+ }
81
+ export type BindingSource = ContextValueBindingSource | EntryFieldBindingSource | QueryReferenceBindingSource | ResourceReferenceBindingSource | StaticValueBindingSource;
82
+ export interface BindingTransform {
83
+ arguments: JsonObject;
84
+ operator: QualifiedName;
85
+ version: SemanticVersion;
86
+ }
87
+ export interface FieldBinding {
88
+ fallback?: JsonValue;
89
+ onError: 'error' | 'fallback' | 'hide';
90
+ onNull: 'empty' | 'error' | 'fallback' | 'hide';
91
+ source: BindingSource;
92
+ transforms: BindingTransform[];
93
+ }
94
+ export interface NodeAuthoringPolicy {
95
+ allowedBlocks?: BlockType[];
96
+ mode: 'content' | 'designer' | 'locked' | 'structural' | 'variant';
97
+ requiredPermission?: QualifiedName;
98
+ }
99
+ export interface BlueprintNode {
100
+ authoring: NodeAuthoringPolicy;
101
+ bindings: Record<LocalName, FieldBinding>;
102
+ extensions?: Record<QualifiedName, JsonValue>;
103
+ id: NodeId;
104
+ properties: JsonObject;
105
+ responsive?: Record<LocalName, Record<LocalName, JsonValue>>;
106
+ slots: Record<LocalName, BlueprintNode[]>;
107
+ type: BlockType;
108
+ version: SemanticVersion;
109
+ }
110
+ export interface BlueprintBlockLock {
111
+ integrity?: string;
112
+ revision: Revision;
113
+ type: BlockType;
114
+ version: SemanticVersion;
115
+ }
116
+ export interface BlueprintDependencyLock {
117
+ blocks: BlueprintBlockLock[];
118
+ plugins?: LockedArtifactReference[];
119
+ theme: LockedArtifactReference;
120
+ }
121
+ export interface BlueprintDocument {
122
+ contractVersion: StudioContractVersion;
123
+ dependencyLock: BlueprintDependencyLock;
124
+ description?: MessageReference;
125
+ extensions?: Record<QualifiedName, JsonValue>;
126
+ id: StableId;
127
+ kind: 'blueprint';
128
+ label: MessageReference;
129
+ model: LockedArtifactReference;
130
+ owner: OwnerReference;
131
+ revision: Revision;
132
+ roots: BlueprintNode[];
133
+ status: 'draft' | 'published' | 'retired';
134
+ version: SemanticVersion;
135
+ }
136
+ export interface BlockSlotAcceptance {
137
+ types: BlockType[];
138
+ }
139
+ export interface BlockSlotDefinition {
140
+ accepts: BlockSlotAcceptance;
141
+ id: LocalName;
142
+ label: MessageReference;
143
+ maximum: number;
144
+ minimum: number;
145
+ ordered: boolean;
146
+ }
147
+ export interface BlockPortDefinition {
148
+ id: LocalName;
149
+ label: MessageReference;
150
+ multiple: boolean;
151
+ required: boolean;
152
+ valueType: string;
153
+ }
154
+ export interface RendererRequirement {
155
+ capability: QualifiedName;
156
+ surface: 'document' | 'email' | 'native' | 'preview' | 'web';
157
+ versions: string;
158
+ }
159
+ export interface BlockAccessibilityContract {
160
+ accessibleName: 'derived' | 'not-applicable' | 'required-binding' | 'required-property';
161
+ category: 'composite' | 'data-display' | 'decorative' | 'interactive' | 'landmark' | 'media' | 'structural' | 'text';
162
+ keyboard: MessageReference;
163
+ outputChecks: QualifiedName[];
164
+ reducedMotion: 'disable-motion' | 'not-applicable' | 'required';
165
+ }
166
+ export type BlockIcon = {
167
+ kind: 'asset';
168
+ integrity: string;
169
+ path: PackageRelativePath;
170
+ } | {
171
+ kind: 'symbol';
172
+ value: LocalName | QualifiedName;
173
+ };
174
+ export interface BlockPropertyControl {
175
+ control: QualifiedName;
176
+ help?: MessageReference;
177
+ label?: MessageReference;
178
+ property: LocalName;
179
+ }
180
+ export interface BlockFallback {
181
+ lossless: true;
182
+ type: BlockType;
183
+ versions: string;
184
+ }
185
+ export interface BlockDefinition {
186
+ accessibility: BlockAccessibilityContract;
187
+ category: QualifiedName;
188
+ contractVersion: StudioContractVersion;
189
+ description?: MessageReference;
190
+ extensions?: Record<QualifiedName, JsonValue>;
191
+ fallback?: BlockFallback;
192
+ icon?: BlockIcon;
193
+ kind: 'block-definition';
194
+ label: MessageReference;
195
+ editingModes: ('blueprint' | 'content')[];
196
+ owner: OwnerReference;
197
+ ports: BlockPortDefinition[];
198
+ propertyControls?: BlockPropertyControl[];
199
+ propertySchema: JsonSchema;
200
+ rendererRequirements: RendererRequirement[];
201
+ revision: Revision;
202
+ slots: BlockSlotDefinition[];
203
+ themeControls: LocalName[];
204
+ type: BlockType;
205
+ version: SemanticVersion;
206
+ }
207
+ export interface HostPortCapability {
208
+ id: QualifiedName;
209
+ operations: QualifiedName[];
210
+ version: SemanticVersion;
211
+ }
212
+ export interface HostFeatureCapability {
213
+ configuration?: JsonValue;
214
+ id: QualifiedName;
215
+ version: SemanticVersion;
216
+ }
217
+ export interface HostCapabilities {
218
+ capabilities: HostFeatureCapability[];
219
+ contractVersion: StudioContractVersion;
220
+ extensions?: Record<QualifiedName, JsonValue>;
221
+ host: {
222
+ generation: Revision;
223
+ id: QualifiedName;
224
+ version: SemanticVersion;
225
+ };
226
+ kind: 'host-capabilities';
227
+ ports: HostPortCapability[];
228
+ protocolVersions: SemanticVersion[];
229
+ }
230
+ export type ContentFieldKind = 'boolean' | 'collection' | 'date' | 'date-time' | 'decimal' | 'enum' | 'integer' | 'media' | 'money' | 'object' | 'resource' | 'rich-text' | 'string' | QualifiedName;
231
+ export interface FieldAuthoringMetadata {
232
+ control?: QualifiedName;
233
+ group?: LocalName;
234
+ hidden?: boolean;
235
+ order?: number;
236
+ placeholder?: MessageReference;
237
+ readOnly?: boolean;
238
+ width?: 'full' | 'half' | 'third' | 'two-thirds';
239
+ }
240
+ export interface FieldConstraints {
241
+ allowedMediaKinds?: MediaAsset['mediaKind'][];
242
+ maxItems?: number;
243
+ maxLength?: number;
244
+ maximum?: string;
245
+ minItems?: number;
246
+ minLength?: number;
247
+ minimum?: string;
248
+ scale?: number;
249
+ validator?: QualifiedName;
250
+ validatorArguments?: Record<string, JsonValue>;
251
+ }
252
+ export interface ContentModelEnumValue {
253
+ label: MessageReference;
254
+ value: LocalName;
255
+ }
256
+ export interface FieldDefinition {
257
+ authoring?: FieldAuthoringMetadata;
258
+ cardinality: 'many' | 'one';
259
+ constraints?: FieldConstraints;
260
+ defaultValue?: JsonValue;
261
+ description?: MessageReference;
262
+ enumValues?: ContentModelEnumValue[];
263
+ extensions?: Record<QualifiedName, JsonValue>;
264
+ fields?: FieldDefinition[];
265
+ id: LocalName;
266
+ itemKind?: Exclude<ContentFieldKind, 'collection'>;
267
+ kind: ContentFieldKind;
268
+ label: MessageReference;
269
+ localized: boolean;
270
+ required: boolean;
271
+ semanticRole?: QualifiedName;
272
+ }
273
+ export interface RelationshipAuthoringMetadata {
274
+ allowCreate: boolean;
275
+ control: QualifiedName;
276
+ displayField?: LocalName;
277
+ searchProvider?: QualifiedName;
278
+ }
279
+ export interface RelationshipDefinition {
280
+ authoring?: RelationshipAuthoringMetadata;
281
+ extensions?: Record<QualifiedName, JsonValue>;
282
+ id: LocalName;
283
+ kind: 'many-to-many' | 'many-to-one' | 'one-to-many' | 'one-to-one';
284
+ label: MessageReference;
285
+ onDelete: 'detach' | 'nullify' | 'restrict';
286
+ required: boolean;
287
+ sourceField: LocalName;
288
+ targetField?: LocalName;
289
+ targetModel: ArtifactReference;
290
+ }
291
+ export interface ContentModelDocument {
292
+ contractVersion: StudioContractVersion;
293
+ description?: MessageReference;
294
+ extensions?: Record<QualifiedName, JsonValue>;
295
+ fields: FieldDefinition[];
296
+ id: StableId;
297
+ kind: 'content-model';
298
+ label: MessageReference;
299
+ owner: OwnerReference;
300
+ relationships: RelationshipDefinition[];
301
+ revision: Revision;
302
+ status: 'draft' | 'published' | 'retired';
303
+ version: SemanticVersion;
304
+ }
305
+ export type PluginActivation = 'declarative' | 'executable';
306
+ export type PluginEntryRealm = 'application' | 'sandboxed-frame' | 'worker';
307
+ export interface PluginEntryModule {
308
+ integrity: string;
309
+ path: PackageRelativePath;
310
+ realm: PluginEntryRealm;
311
+ }
312
+ export type PluginContributionKind = 'block' | 'command' | 'field-adapter' | 'inspector' | 'locale' | 'panel' | 'pattern' | 'renderer-capability' | 'test-fixture' | 'transform';
313
+ export interface PluginContributionDeclaration {
314
+ executable?: boolean;
315
+ id: QualifiedName;
316
+ integrity: string;
317
+ kind: PluginContributionKind;
318
+ resource: PackageRelativePath;
319
+ version: SemanticVersion;
320
+ }
321
+ export interface PluginCapabilityRequirement {
322
+ id: QualifiedName;
323
+ versions: string;
324
+ }
325
+ export interface PluginDependency {
326
+ id: QualifiedName;
327
+ optional: boolean;
328
+ versions: string;
329
+ }
330
+ export interface PluginManifest {
331
+ activation: PluginActivation;
332
+ contractVersion: StudioContractVersion;
333
+ contributions: PluginContributionDeclaration[];
334
+ dependencies: PluginDependency[];
335
+ description?: MessageReference;
336
+ entryModules: PluginEntryModule[];
337
+ extensions?: Record<QualifiedName, JsonValue>;
338
+ id: QualifiedName;
339
+ kind: 'plugin-manifest';
340
+ label: MessageReference;
341
+ locales?: string[];
342
+ optionalCapabilities: PluginCapabilityRequirement[];
343
+ owner: OwnerReference;
344
+ permissions: QualifiedName[];
345
+ requiredCapabilities: PluginCapabilityRequirement[];
346
+ version: SemanticVersion;
347
+ }
348
+ export interface ThemeViewport {
349
+ base: boolean;
350
+ id: LocalName;
351
+ label: MessageReference;
352
+ order: number;
353
+ previewWidth: number;
354
+ }
355
+ export type ThemeDesignControlKind = 'boolean' | 'color-role' | 'enum' | 'integer' | 'layer-role' | 'motion-role' | 'radius-role' | 'shadow-role' | 'size-role' | 'spacing-role' | 'typography-role';
356
+ export interface ThemeDesignChoice {
357
+ deprecated?: boolean;
358
+ id: LocalName;
359
+ label: MessageReference;
360
+ }
361
+ export interface ThemeDesignControl {
362
+ choices: ThemeDesignChoice[];
363
+ description?: MessageReference;
364
+ id: LocalName;
365
+ kind: ThemeDesignControlKind;
366
+ label: MessageReference;
367
+ }
368
+ export interface ThemeRecipe {
369
+ blockType: QualifiedName;
370
+ designValues: Record<LocalName, JsonValue>;
371
+ id: LocalName;
372
+ label: MessageReference;
373
+ }
374
+ export interface ThemeRendererDeclaration {
375
+ exactPreview: boolean;
376
+ id: QualifiedName;
377
+ surfaces: RendererRequirement['surface'][];
378
+ version: SemanticVersion;
379
+ }
380
+ export interface ThemeBlockSupport {
381
+ renderer: QualifiedName;
382
+ type: QualifiedName;
383
+ versions: string;
384
+ }
385
+ export interface ThemeAlias {
386
+ equivalentMeaning: true;
387
+ from: LocalName;
388
+ kind: 'choice' | 'design-control' | 'recipe' | 'viewport';
389
+ to: LocalName;
390
+ }
391
+ export interface ThemeDocument {
392
+ aliases?: ThemeAlias[];
393
+ blockSupport: ThemeBlockSupport[];
394
+ contractVersion: StudioContractVersion;
395
+ description?: MessageReference;
396
+ designControls: ThemeDesignControl[];
397
+ extensions?: Record<QualifiedName, JsonValue>;
398
+ id: StableId;
399
+ kind: 'theme';
400
+ label: MessageReference;
401
+ owner: OwnerReference;
402
+ recipes: ThemeRecipe[];
403
+ renderers: ThemeRendererDeclaration[];
404
+ revision: Revision;
405
+ version: SemanticVersion;
406
+ viewports: ThemeViewport[];
407
+ }
408
+ export type HostErrorCategory = 'cancelled' | 'conflict' | 'forbidden' | 'incompatible' | 'internal' | 'invalid-request' | 'limit-exceeded' | 'not-found' | 'rate-limited' | 'unauthenticated' | 'unavailable' | 'validation-failed';
409
+ export interface HostPortError {
410
+ category: HostErrorCategory;
411
+ contractVersion: StudioContractVersion;
412
+ correlationId?: StableId;
413
+ diagnostics?: StudioDiagnostic[];
414
+ kind: 'host-error';
415
+ message: MessageReference;
416
+ retryAfterMilliseconds?: number;
417
+ retryable: boolean;
418
+ revision?: Revision;
419
+ }
420
+ export interface HostRequestContext {
421
+ expectedRevision?: Revision;
422
+ idempotencyKey?: StableId;
423
+ locale?: string;
424
+ operationId: QualifiedName;
425
+ protocolVersion: StudioWireProtocolVersion;
426
+ requestId: StableId;
427
+ resourceContextKey: StableId;
428
+ sessionGeneration: Revision;
429
+ }
430
+ export interface HostPortResult<TValue> {
431
+ revision?: Revision;
432
+ value: TValue;
433
+ }
434
+ export type StudioArtifact = BlueprintDocument | ContentModelDocument | EntryDocument;
435
+ export interface ArtifactPort {
436
+ dependencies(reference: ArtifactReference, context: HostRequestContext): Promise<HostPortResult<ArtifactReference[]>>;
437
+ load(reference: ArtifactReference, context: HostRequestContext): Promise<HostPortResult<StudioArtifact>>;
438
+ publish(reference: ArtifactReference, context: HostRequestContext): Promise<HostPortResult<null>>;
439
+ save(artifact: StudioArtifact, context: HostRequestContext): Promise<HostPortResult<null>>;
440
+ unpublish(reference: ArtifactReference, context: HostRequestContext): Promise<HostPortResult<null>>;
441
+ }
442
+ export interface ModelPort {
443
+ get(reference: ArtifactReference, context: HostRequestContext): Promise<HostPortResult<ContentModelDocument>>;
444
+ list(context: HostRequestContext): Promise<HostPortResult<ContentModelDocument[]>>;
445
+ }
446
+ export interface ResourceSearchQuery {
447
+ cursor?: string;
448
+ limit: number;
449
+ resourceType: QualifiedName;
450
+ search?: string;
451
+ }
452
+ export interface ResourceSearchHit {
453
+ id: StableId;
454
+ label: MessageReference;
455
+ resourceType: QualifiedName;
456
+ }
457
+ export interface ResourceSearchPage {
458
+ items: ResourceSearchHit[];
459
+ nextCursor?: string;
460
+ }
461
+ export interface ResourcePort {
462
+ search(query: ResourceSearchQuery, context: HostRequestContext): Promise<HostPortResult<ResourceSearchPage>>;
463
+ }
464
+ export interface PreviewPort {
465
+ cancel(draftDigest: string, context: HostRequestContext): Promise<HostPortResult<null>>;
466
+ render(payload: PreviewRenderPayload, context: HostRequestContext): Promise<HostPortResult<PreviewRenderedPayload>>;
467
+ }
468
+ export interface MediaHostPort {
469
+ get(assetId: StableId, context: HostRequestContext): Promise<HostPortResult<MediaAsset | null>>;
470
+ list(query: MediaQuery, context: HostRequestContext): Promise<HostPortResult<MediaPage>>;
471
+ }
472
+ export interface LocalizationPort {
473
+ messages(locale: string, namespaces: QualifiedName[], context: HostRequestContext): Promise<HostPortResult<Record<QualifiedName, string>>>;
474
+ }
475
+ export interface PermissionExplanation {
476
+ allowed: boolean;
477
+ reason?: MessageReference;
478
+ }
479
+ export interface PermissionSnapshot {
480
+ permissions: QualifiedName[];
481
+ sessionGeneration: Revision;
482
+ }
483
+ export interface PermissionPort {
484
+ explain(operation: QualifiedName, context: HostRequestContext): Promise<HostPortResult<PermissionExplanation>>;
485
+ refresh(context: HostRequestContext): Promise<HostPortResult<PermissionSnapshot>>;
486
+ }
487
+ export interface RecoveryPort {
488
+ discard(context: HostRequestContext): Promise<HostPortResult<null>>;
489
+ load(context: HostRequestContext): Promise<HostPortResult<JsonObject | null>>;
490
+ store(envelope: JsonObject, context: HostRequestContext): Promise<HostPortResult<null>>;
491
+ }
492
+ export interface TelemetryEvent {
493
+ attributes?: Record<string, JsonPrimitive>;
494
+ name: QualifiedName;
495
+ }
496
+ export interface TelemetryPort {
497
+ emit(event: TelemetryEvent, context: HostRequestContext): Promise<HostPortResult<null>>;
498
+ }
499
+ export interface HostAdapter {
500
+ artifact: ArtifactPort;
501
+ localization?: LocalizationPort;
502
+ media?: MediaHostPort;
503
+ model?: ModelPort;
504
+ permission?: PermissionPort;
505
+ preview?: PreviewPort;
506
+ recovery?: RecoveryPort;
507
+ resource?: ResourcePort;
508
+ telemetry?: TelemetryPort;
509
+ }
510
+ export type ExtensionLifecycleState = 'activating' | 'active' | 'disabled' | 'discovered' | 'installed-disabled' | 'purged' | 'rejected' | 'trust-revoked' | 'uninstalled-data-preserved' | 'verified';
511
+ export interface EntryDocument {
512
+ compositionOverrides?: Record<StableId, JsonValue>;
513
+ contractVersion: StudioContractVersion;
514
+ extensions?: Record<QualifiedName, JsonValue>;
515
+ id: StableId;
516
+ kind: 'entry';
517
+ locale?: string;
518
+ model: LockedArtifactReference;
519
+ revision: Revision;
520
+ status: 'archived' | 'draft' | 'in-review' | 'published';
521
+ translationOf?: StableId;
522
+ values: Record<LocalName, JsonValue>;
523
+ workflowState?: QualifiedName;
524
+ }
525
+ export type StudioAuthoringMode = 'blueprint' | 'content' | 'model';
526
+ export interface StudioDisplayPreferences {
527
+ calendar: LocalName;
528
+ hourCycle: 'h11' | 'h12' | 'h23' | 'h24';
529
+ measurementSystem?: 'metric' | 'uk' | 'us';
530
+ numberingSystem: LocalName;
531
+ }
532
+ export interface StudioResourceScope {
533
+ id: StableId;
534
+ kind: QualifiedName;
535
+ }
536
+ export interface StudioResourceContext {
537
+ key: StableId;
538
+ resource?: {
539
+ id: StableId;
540
+ type: QualifiedName;
541
+ };
542
+ revision?: Revision;
543
+ scopes: StudioResourceScope[];
544
+ surface: QualifiedName;
545
+ }
546
+ export interface StudioLimits {
547
+ maxChildrenPerSlot: number;
548
+ maxCommandBatch: number;
549
+ maxContributionsPerPlugin: number;
550
+ maxDepth: number;
551
+ maxExtensionBytes: number;
552
+ maxHistoryEntries: number;
553
+ maxLocaleBytes: number;
554
+ maxMediaBatch: number;
555
+ maxMediaUploadBytes: number;
556
+ maxNodes: number;
557
+ maxPluginCount: number;
558
+ maxPreviewBytes: number;
559
+ maxPreviewRequestsPerMinute: number;
560
+ maxPropertyBytes: number;
561
+ maxRichTextBytes: number;
562
+ maxRichTextDepth: number;
563
+ maxSlotsPerNode: number;
564
+ }
565
+ export interface StudioConfiguration {
566
+ actor: {
567
+ displayName: string;
568
+ id: StableId;
569
+ };
570
+ artifacts: {
571
+ blueprint?: LockedArtifactReference;
572
+ entry?: ResolvedEntryReference;
573
+ model?: LockedArtifactReference;
574
+ theme?: LockedArtifactReference;
575
+ };
576
+ blocks: BlueprintBlockLock[];
577
+ composite: 'hybrid' | 'single';
578
+ contractVersion: StudioContractVersion;
579
+ displayPreferences: StudioDisplayPreferences;
580
+ extensions?: Record<QualifiedName, JsonValue>;
581
+ features: {
582
+ clipboardMediaUpload: boolean;
583
+ collaboration: boolean;
584
+ customInspectors: boolean;
585
+ executablePlugins: boolean;
586
+ externalMediaImport: boolean;
587
+ offlineRecovery: boolean;
588
+ };
589
+ hostCapabilities: HostCapabilities;
590
+ limits: StudioLimits;
591
+ locale: {
592
+ direction: 'ltr' | 'rtl';
593
+ fallbacks: string[];
594
+ requested: string;
595
+ resolved: string;
596
+ timeZone: string;
597
+ };
598
+ mode: StudioAuthoringMode;
599
+ permissions: QualifiedName[];
600
+ plugins: LockedArtifactReference[];
601
+ protocolVersion: StudioWireProtocolVersion;
602
+ preview: {
603
+ allowApproximateRenderer: boolean;
604
+ enabled: boolean;
605
+ initialViewport?: LocalName;
606
+ sameOriginRequired: boolean;
607
+ };
608
+ sessionGeneration: Revision;
609
+ sessionId: StableId;
610
+ sessionState: 'editable' | 'read-only';
611
+ resourceContext: StudioResourceContext;
612
+ }
613
+ export interface ExperimentalShellConfiguration {
614
+ blockDefinitions: BlockDefinition[];
615
+ session: StudioConfiguration;
616
+ }
617
+ export interface CommandDestination {
618
+ parentNodeId?: NodeId;
619
+ position: number;
620
+ slot?: LocalName;
621
+ }
622
+ export interface CommandBase<TType extends QualifiedName, TPayload extends object> {
623
+ artifactId: StableId;
624
+ baseStateVersion: number;
625
+ contractVersion: StudioContractVersion;
626
+ expectedRevision?: Revision;
627
+ groupId?: StableId;
628
+ id: StableId;
629
+ kind: 'command';
630
+ payload: TPayload;
631
+ sessionGeneration: Revision;
632
+ type: TType;
633
+ }
634
+ export interface InsertNodePayload {
635
+ destination: CommandDestination;
636
+ node: BlueprintNode;
637
+ }
638
+ export type InsertNodeCommand = CommandBase<'studio.command/insert-node', InsertNodePayload>;
639
+ export interface RemoveNodePayload {
640
+ nodeId: NodeId;
641
+ }
642
+ export type RemoveNodeCommand = CommandBase<'studio.command/remove-node', RemoveNodePayload>;
643
+ export interface RestoreNodePayload {
644
+ destination: CommandDestination;
645
+ node: BlueprintNode;
646
+ }
647
+ export type RestoreNodeCommand = CommandBase<'studio.command/restore-node', RestoreNodePayload>;
648
+ export interface MoveNodePayload {
649
+ destination: CommandDestination;
650
+ nodeId: NodeId;
651
+ }
652
+ export type MoveNodeCommand = CommandBase<'studio.command/move-node', MoveNodePayload>;
653
+ export interface SetPropertyPayload {
654
+ nodeId: NodeId;
655
+ property: LocalName;
656
+ value: JsonValue;
657
+ viewport?: LocalName;
658
+ }
659
+ export type SetPropertyCommand = CommandBase<'studio.command/set-property', SetPropertyPayload>;
660
+ export interface DuplicateNodePayload {
661
+ destination?: CommandDestination;
662
+ idMap: Record<NodeId, NodeId>;
663
+ nodeId: NodeId;
664
+ }
665
+ export type DuplicateNodeCommand = CommandBase<'studio.command/duplicate-node', DuplicateNodePayload>;
666
+ export interface ReorderChildrenPayload {
667
+ order: NodeId[];
668
+ parentNodeId?: NodeId;
669
+ slot?: LocalName;
670
+ }
671
+ export type ReorderChildrenCommand = CommandBase<'studio.command/reorder-children', ReorderChildrenPayload>;
672
+ export interface UnsetPropertyPayload {
673
+ nodeId: NodeId;
674
+ property: LocalName;
675
+ viewport?: LocalName;
676
+ }
677
+ export type UnsetPropertyCommand = CommandBase<'studio.command/unset-property', UnsetPropertyPayload>;
678
+ export interface ResetInheritedPropertyPayload {
679
+ nodeId: NodeId;
680
+ property: LocalName;
681
+ }
682
+ export type ResetInheritedPropertyCommand = CommandBase<'studio.command/reset-inherited-property', ResetInheritedPropertyPayload>;
683
+ export interface SetBindingPayload {
684
+ binding: FieldBinding;
685
+ nodeId: NodeId;
686
+ port: LocalName;
687
+ }
688
+ export type SetBindingCommand = CommandBase<'studio.command/set-binding', SetBindingPayload>;
689
+ export interface RemoveBindingPayload {
690
+ nodeId: NodeId;
691
+ port: LocalName;
692
+ }
693
+ export type RemoveBindingCommand = CommandBase<'studio.command/remove-binding', RemoveBindingPayload>;
694
+ export interface SetFieldValuePayload {
695
+ fieldPath: LocalName[];
696
+ locale?: string;
697
+ value: JsonValue;
698
+ }
699
+ export type SetFieldValueCommand = CommandBase<'studio.command/set-field-value', SetFieldValuePayload>;
700
+ export type ProvenanceOrigin = 'authoring' | 'import' | 'migration' | 'pattern' | 'plugin' | 'system';
701
+ export interface ProvenanceActor {
702
+ displayName?: string;
703
+ id: StableId;
704
+ }
705
+ export interface ProvenanceEntry {
706
+ actor: ProvenanceActor;
707
+ commandCount?: number;
708
+ fromRevision?: Revision;
709
+ migrationId?: QualifiedName;
710
+ origin: ProvenanceOrigin;
711
+ recordedAt: string;
712
+ sessionId?: StableId;
713
+ source?: ArtifactReference;
714
+ toRevision: Revision;
715
+ }
716
+ export interface ProvenanceRecord {
717
+ artifact: {
718
+ id: StableId;
719
+ revision: Revision;
720
+ };
721
+ chain: ProvenanceEntry[];
722
+ contractVersion: StudioContractVersion;
723
+ extensions?: Record<QualifiedName, JsonValue>;
724
+ kind: 'provenance';
725
+ }
726
+ export type UnresolvedContributionReason = 'incompatible' | 'not-installed' | 'owner-disabled' | 'owner-revoked';
727
+ export interface UnresolvedContributionReference {
728
+ contribution: Exclude<PluginContributionKind, 'test-fixture'>;
729
+ id: QualifiedName;
730
+ version: SemanticVersion;
731
+ }
732
+ export interface UnresolvedContribution {
733
+ affectedNodes?: StableId[];
734
+ contractVersion: StudioContractVersion;
735
+ diagnostics?: StudioDiagnostic[];
736
+ kind: 'unresolved-contribution';
737
+ owner?: OwnerReference;
738
+ reason: UnresolvedContributionReason;
739
+ reference: UnresolvedContributionReference;
740
+ }
741
+ export interface PatternDocument {
742
+ blockDependencies: BlueprintBlockLock[];
743
+ contractVersion: StudioContractVersion;
744
+ description?: MessageReference;
745
+ extensions?: Record<QualifiedName, JsonValue>;
746
+ id: StableId;
747
+ kind: 'pattern';
748
+ label: MessageReference;
749
+ owner: OwnerReference;
750
+ revision: Revision;
751
+ roots: BlueprintNode[];
752
+ version: SemanticVersion;
753
+ }
754
+ export interface PatternReference {
755
+ id: StableId;
756
+ revision: Revision;
757
+ version: SemanticVersion;
758
+ }
759
+ export interface ApplyPatternPayload {
760
+ destination: CommandDestination;
761
+ idMap: Record<NodeId, NodeId>;
762
+ nodes: BlueprintNode[];
763
+ pattern: PatternReference;
764
+ }
765
+ export type ApplyPatternCommand = CommandBase<'studio.command/apply-pattern', ApplyPatternPayload>;
766
+ export interface BatchOperation<TType extends QualifiedName, TPayload extends object> {
767
+ payload: TPayload;
768
+ type: TType;
769
+ }
770
+ export type BlueprintBatchOperation = BatchOperation<'studio.command/duplicate-node', DuplicateNodePayload> | BatchOperation<'studio.command/insert-node', InsertNodePayload> | BatchOperation<'studio.command/move-node', MoveNodePayload> | BatchOperation<'studio.command/remove-binding', RemoveBindingPayload> | BatchOperation<'studio.command/remove-node', RemoveNodePayload> | BatchOperation<'studio.command/reorder-children', ReorderChildrenPayload> | BatchOperation<'studio.command/restore-node', RestoreNodePayload> | BatchOperation<'studio.command/set-binding', SetBindingPayload> | BatchOperation<'studio.command/set-property', SetPropertyPayload> | BatchOperation<'studio.command/unset-property', UnsetPropertyPayload>;
771
+ export interface BatchPayload {
772
+ operations: BlueprintBatchOperation[];
773
+ }
774
+ export type BatchCommand = CommandBase<'studio.command/batch', BatchPayload>;
775
+ export interface AddModelFieldPayload {
776
+ field: FieldDefinition;
777
+ position?: number;
778
+ }
779
+ export type AddModelFieldCommand = CommandBase<'studio.command/add-model-field', AddModelFieldPayload>;
780
+ export type BlueprintCommand = ApplyPatternCommand | BatchCommand | DuplicateNodeCommand | InsertNodeCommand | MoveNodeCommand | RemoveBindingCommand | RemoveNodeCommand | ReorderChildrenCommand | ResetInheritedPropertyCommand | RestoreNodeCommand | SetBindingCommand | SetPropertyCommand | UnsetPropertyCommand;
781
+ export type StudioCommand = AddModelFieldCommand | BlueprintCommand | SetFieldValueCommand;
782
+ export interface PreviewMessageBase<TType extends QualifiedName, TPayload extends object> {
783
+ channelId: StableId;
784
+ contractVersion: StudioContractVersion;
785
+ kind: 'preview-message';
786
+ payload: TPayload;
787
+ sequence: number;
788
+ sessionGeneration: Revision;
789
+ type: TType;
790
+ }
791
+ export interface PreviewReadyPayload {
792
+ protocolVersion: StudioWireProtocolVersion;
793
+ renderer: QualifiedName;
794
+ viewports: LocalName[];
795
+ }
796
+ export interface PreviewRenderPayload {
797
+ artifactId: StableId;
798
+ draftDigest: string;
799
+ draftRevision?: Revision;
800
+ viewport: LocalName;
801
+ }
802
+ export interface PreviewRenderedPayload {
803
+ diagnostics: StudioDiagnostic[];
804
+ draftDigest: string;
805
+ /** Opaque render markers in document order. */
806
+ markers: StableId[];
807
+ /** Optional mapping from an opaque marker to the node it renders. */
808
+ markerMap?: Record<StableId, NodeId>;
809
+ }
810
+ export interface PreviewSelectPayload {
811
+ nodeId: NodeId;
812
+ reveal?: boolean;
813
+ }
814
+ /** Axis-aligned rectangle in CSS pixels, relative to the preview viewport origin. */
815
+ export interface PreviewMarkerRect {
816
+ height: number;
817
+ width: number;
818
+ x: number;
819
+ y: number;
820
+ }
821
+ /** Preview viewport metrics captured at measurement time. */
822
+ export interface PreviewViewportMetrics {
823
+ devicePixelRatio: number;
824
+ height: number;
825
+ scrollX: number;
826
+ scrollY: number;
827
+ width: number;
828
+ }
829
+ export interface PreviewMeasurePayload {
830
+ /** Opaque render markers to measure, as a bounded explicit list. */
831
+ markers: StableId[];
832
+ requestId: StableId;
833
+ }
834
+ /**
835
+ * Volatile on-screen geometry for render markers. Measurements are never document
836
+ * state: they are bound to the render digest they were measured against and become
837
+ * meaningless as soon as a newer render or reload supersedes that digest.
838
+ */
839
+ export interface PreviewMeasurementsPayload {
840
+ /** Digest of the render the geometry was measured against. */
841
+ draftDigest: string;
842
+ /** One or more rectangles per measured marker; inline content fragments across lines. */
843
+ measurements: Record<StableId, PreviewMarkerRect[]>;
844
+ requestId: StableId;
845
+ /** Requested markers the renderer could not associate with any on-screen geometry. */
846
+ unknown: StableId[];
847
+ viewport: PreviewViewportMetrics;
848
+ }
849
+ export interface PreviewErrorPayload {
850
+ code: QualifiedName;
851
+ correlationId?: StableId;
852
+ message: MessageReference;
853
+ retryable: boolean;
854
+ }
855
+ export type PreviewReadyMessage = PreviewMessageBase<'studio.preview/ready', PreviewReadyPayload>;
856
+ export type PreviewRenderMessage = PreviewMessageBase<'studio.preview/render', PreviewRenderPayload>;
857
+ export type PreviewRenderedMessage = PreviewMessageBase<'studio.preview/rendered', PreviewRenderedPayload>;
858
+ export type PreviewSelectMessage = PreviewMessageBase<'studio.preview/select', PreviewSelectPayload>;
859
+ export type PreviewMeasureMessage = PreviewMessageBase<'studio.preview/measure', PreviewMeasurePayload>;
860
+ export type PreviewMeasurementsMessage = PreviewMessageBase<'studio.preview/measurements', PreviewMeasurementsPayload>;
861
+ export type PreviewErrorMessage = PreviewMessageBase<'studio.preview/error', PreviewErrorPayload>;
862
+ export interface PreviewReloadPayload {
863
+ reason: QualifiedName;
864
+ }
865
+ export type PreviewReloadMessage = PreviewMessageBase<'studio.preview/reload', PreviewReloadPayload>;
866
+ export interface PreviewTeardownPayload {
867
+ reason: QualifiedName;
868
+ }
869
+ export type PreviewTeardownMessage = PreviewMessageBase<'studio.preview/teardown', PreviewTeardownPayload>;
870
+ export type PreviewMessage = PreviewErrorMessage | PreviewMeasureMessage | PreviewMeasurementsMessage | PreviewReadyMessage | PreviewReloadMessage | PreviewRenderMessage | PreviewRenderedMessage | PreviewSelectMessage | PreviewTeardownMessage;
871
+ export interface MediaRendition {
872
+ height: number;
873
+ id: LocalName;
874
+ mediaType: string;
875
+ width: number;
876
+ }
877
+ export interface MediaMetadata {
878
+ altText?: string;
879
+ caption?: string;
880
+ credit?: string;
881
+ decorative?: boolean;
882
+ durationMilliseconds?: number;
883
+ focalPoint?: {
884
+ x: number;
885
+ y: number;
886
+ };
887
+ height?: number;
888
+ license?: string;
889
+ width?: number;
890
+ }
891
+ export interface MediaRenditionIntent {
892
+ fit?: 'contain' | 'cover' | 'fill' | 'scale-down';
893
+ preferredMediaTypes?: string[];
894
+ role: LocalName;
895
+ }
896
+ export type MediaCropIntent = {
897
+ height: number;
898
+ mode: 'aspect-ratio';
899
+ width: number;
900
+ } | {
901
+ height: number;
902
+ mode: 'rectangle';
903
+ width: number;
904
+ x: number;
905
+ y: number;
906
+ };
907
+ export type MediaAccessibility = {
908
+ altFieldPath: LocalName[];
909
+ captionFieldPath?: LocalName[];
910
+ mode: 'bound';
911
+ } | {
912
+ mode: 'decorative';
913
+ } | {
914
+ altText: string;
915
+ caption?: string;
916
+ mode: 'informative';
917
+ };
918
+ export interface MediaReference {
919
+ accessibility: MediaAccessibility;
920
+ assetId: StableId;
921
+ assetRevision?: Revision;
922
+ contractVersion: StudioContractVersion;
923
+ cropIntent?: MediaCropIntent;
924
+ focalPoint?: {
925
+ x: number;
926
+ y: number;
927
+ };
928
+ kind: 'media-reference';
929
+ renditionIntent?: MediaRenditionIntent;
930
+ usage: QualifiedName;
931
+ }
932
+ export interface MediaAsset {
933
+ byteSize: number;
934
+ contractVersion: StudioContractVersion;
935
+ extensions?: Record<QualifiedName, JsonValue>;
936
+ filename: string;
937
+ id: StableId;
938
+ kind: 'media-asset';
939
+ mediaKind: 'archive' | 'audio' | 'document' | 'image' | 'other' | 'video';
940
+ mediaType: string;
941
+ metadata: MediaMetadata;
942
+ renditions?: MediaRendition[];
943
+ revision: Revision;
944
+ state: 'archived' | 'processing' | 'quarantined' | 'ready' | 'rejected';
945
+ }
946
+ export type MediaUploadSessionState = 'authorized' | 'cancelled' | 'complete' | 'failed' | 'requested' | 'transferring' | 'verifying';
947
+ export interface MediaUploadRequestDescriptor {
948
+ byteSize: number;
949
+ checksum?: string;
950
+ filename: string;
951
+ mediaType: string;
952
+ purpose: QualifiedName;
953
+ }
954
+ export interface MediaUploadPlan {
955
+ chunkBytes?: number;
956
+ maximumBytes: number;
957
+ resumable: boolean;
958
+ }
959
+ export interface MediaUploadProgress {
960
+ totalBytes: number;
961
+ transferredBytes: number;
962
+ }
963
+ export interface MediaUploadAcceptedAsset {
964
+ id: StableId;
965
+ revision: Revision;
966
+ state: 'processing' | 'quarantined' | 'ready' | 'rejected';
967
+ }
968
+ export interface MediaUploadSession {
969
+ asset?: MediaUploadAcceptedAsset;
970
+ contractVersion: StudioContractVersion;
971
+ failure?: StudioDiagnostic;
972
+ id: StableId;
973
+ kind: 'media-upload-session';
974
+ plan?: MediaUploadPlan;
975
+ progress: MediaUploadProgress;
976
+ request: MediaUploadRequestDescriptor;
977
+ state: MediaUploadSessionState;
978
+ }
979
+ export interface MediaQuery {
980
+ cursor?: string;
981
+ limit: number;
982
+ mediaTypes?: string[];
983
+ search?: string;
984
+ }
985
+ export interface MediaPage {
986
+ assets: MediaAsset[];
987
+ nextCursor?: string;
988
+ }
989
+ //# sourceMappingURL=types.d.ts.map