@kumwe/studio-protocol 0.1.0-alpha.4 → 0.1.0-alpha.6

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.
@@ -14,110 +14,331 @@
14
14
  "payload"
15
15
  ],
16
16
  "properties": {
17
- "contractVersion": { "$ref": "common.schema.json#/$defs/contractVersion" },
18
- "kind": { "const": "preview-message" },
19
- "channelId": { "$ref": "common.schema.json#/$defs/stableId" },
20
- "sessionGeneration": { "$ref": "common.schema.json#/$defs/revision" },
21
- "sequence": { "type": "integer", "minimum": 0 },
22
- "type": { "$ref": "common.schema.json#/$defs/qualifiedName" },
17
+ "contractVersion": {
18
+ "$ref": "common.schema.json#/$defs/contractVersion"
19
+ },
20
+ "kind": {
21
+ "const": "preview-message"
22
+ },
23
+ "channelId": {
24
+ "$ref": "common.schema.json#/$defs/stableId"
25
+ },
26
+ "sessionGeneration": {
27
+ "$ref": "common.schema.json#/$defs/revision"
28
+ },
29
+ "sequence": {
30
+ "type": "integer",
31
+ "minimum": 0
32
+ },
33
+ "type": {
34
+ "enum": [
35
+ "studio.preview/activated",
36
+ "studio.preview/dispose",
37
+ "studio.preview/error",
38
+ "studio.preview/measure",
39
+ "studio.preview/measurements",
40
+ "studio.preview/ready",
41
+ "studio.preview/reload",
42
+ "studio.preview/render",
43
+ "studio.preview/rendered",
44
+ "studio.preview/select",
45
+ "studio.preview/teardown",
46
+ "studio.preview/viewport"
47
+ ]
48
+ },
23
49
  "payload": {
24
50
  "type": "object",
25
51
  "maxProperties": 1000,
26
- "propertyNames": { "$ref": "common.schema.json#/$defs/safeJsonMemberName" },
27
- "additionalProperties": { "$ref": "common.schema.json#/$defs/jsonValue" }
52
+ "propertyNames": {
53
+ "$ref": "common.schema.json#/$defs/safeJsonMemberName"
54
+ },
55
+ "additionalProperties": {
56
+ "$ref": "common.schema.json#/$defs/jsonValue"
57
+ }
28
58
  }
29
59
  },
30
60
  "allOf": [
31
61
  {
32
- "if": { "properties": { "type": { "const": "studio.preview/ready" } } },
33
- "then": { "properties": { "payload": { "$ref": "#/$defs/ready" } } }
62
+ "if": {
63
+ "properties": {
64
+ "type": {
65
+ "const": "studio.preview/ready"
66
+ }
67
+ }
68
+ },
69
+ "then": {
70
+ "properties": {
71
+ "payload": {
72
+ "$ref": "#/$defs/ready"
73
+ }
74
+ }
75
+ }
76
+ },
77
+ {
78
+ "if": {
79
+ "properties": {
80
+ "type": {
81
+ "const": "studio.preview/render"
82
+ }
83
+ }
84
+ },
85
+ "then": {
86
+ "properties": {
87
+ "payload": {
88
+ "$ref": "#/$defs/render"
89
+ }
90
+ }
91
+ }
92
+ },
93
+ {
94
+ "if": {
95
+ "properties": {
96
+ "type": {
97
+ "const": "studio.preview/rendered"
98
+ }
99
+ }
100
+ },
101
+ "then": {
102
+ "properties": {
103
+ "payload": {
104
+ "$ref": "#/$defs/rendered"
105
+ }
106
+ }
107
+ }
108
+ },
109
+ {
110
+ "if": {
111
+ "properties": {
112
+ "type": {
113
+ "const": "studio.preview/select"
114
+ }
115
+ }
116
+ },
117
+ "then": {
118
+ "properties": {
119
+ "payload": {
120
+ "$ref": "#/$defs/select"
121
+ }
122
+ }
123
+ }
34
124
  },
35
125
  {
36
- "if": { "properties": { "type": { "const": "studio.preview/render" } } },
37
- "then": { "properties": { "payload": { "$ref": "#/$defs/render" } } }
126
+ "if": {
127
+ "properties": {
128
+ "type": {
129
+ "const": "studio.preview/measure"
130
+ }
131
+ }
132
+ },
133
+ "then": {
134
+ "properties": {
135
+ "payload": {
136
+ "$ref": "#/$defs/measure"
137
+ }
138
+ }
139
+ }
38
140
  },
39
141
  {
40
- "if": { "properties": { "type": { "const": "studio.preview/rendered" } } },
41
- "then": { "properties": { "payload": { "$ref": "#/$defs/rendered" } } }
142
+ "if": {
143
+ "properties": {
144
+ "type": {
145
+ "const": "studio.preview/measurements"
146
+ }
147
+ }
148
+ },
149
+ "then": {
150
+ "properties": {
151
+ "payload": {
152
+ "$ref": "#/$defs/measurements"
153
+ }
154
+ }
155
+ }
42
156
  },
43
157
  {
44
- "if": { "properties": { "type": { "const": "studio.preview/select" } } },
45
- "then": { "properties": { "payload": { "$ref": "#/$defs/select" } } }
158
+ "if": {
159
+ "properties": {
160
+ "type": {
161
+ "const": "studio.preview/error"
162
+ }
163
+ }
164
+ },
165
+ "then": {
166
+ "properties": {
167
+ "payload": {
168
+ "$ref": "#/$defs/error"
169
+ }
170
+ }
171
+ }
46
172
  },
47
173
  {
48
- "if": { "properties": { "type": { "const": "studio.preview/measure" } } },
49
- "then": { "properties": { "payload": { "$ref": "#/$defs/measure" } } }
174
+ "if": {
175
+ "properties": {
176
+ "type": {
177
+ "const": "studio.preview/reload"
178
+ }
179
+ }
180
+ },
181
+ "then": {
182
+ "properties": {
183
+ "payload": {
184
+ "$ref": "#/$defs/reload"
185
+ }
186
+ }
187
+ }
50
188
  },
51
189
  {
52
- "if": { "properties": { "type": { "const": "studio.preview/measurements" } } },
53
- "then": { "properties": { "payload": { "$ref": "#/$defs/measurements" } } }
190
+ "if": {
191
+ "properties": {
192
+ "type": {
193
+ "const": "studio.preview/teardown"
194
+ }
195
+ }
196
+ },
197
+ "then": {
198
+ "properties": {
199
+ "payload": {
200
+ "$ref": "#/$defs/teardown"
201
+ }
202
+ }
203
+ }
54
204
  },
55
205
  {
56
- "if": { "properties": { "type": { "const": "studio.preview/error" } } },
57
- "then": { "properties": { "payload": { "$ref": "#/$defs/error" } } }
206
+ "if": {
207
+ "properties": {
208
+ "type": {
209
+ "const": "studio.preview/activated"
210
+ }
211
+ }
212
+ },
213
+ "then": {
214
+ "properties": {
215
+ "payload": {
216
+ "$ref": "#/$defs/activated"
217
+ }
218
+ }
219
+ }
58
220
  },
59
221
  {
60
- "if": { "properties": { "type": { "const": "studio.preview/reload" } } },
61
- "then": { "properties": { "payload": { "$ref": "#/$defs/reload" } } }
222
+ "if": {
223
+ "properties": {
224
+ "type": {
225
+ "const": "studio.preview/viewport"
226
+ }
227
+ }
228
+ },
229
+ "then": {
230
+ "properties": {
231
+ "payload": {
232
+ "$ref": "#/$defs/viewport"
233
+ }
234
+ }
235
+ }
62
236
  },
63
237
  {
64
- "if": { "properties": { "type": { "const": "studio.preview/teardown" } } },
65
- "then": { "properties": { "payload": { "$ref": "#/$defs/teardown" } } }
238
+ "if": {
239
+ "properties": {
240
+ "type": {
241
+ "const": "studio.preview/dispose"
242
+ }
243
+ }
244
+ },
245
+ "then": {
246
+ "properties": {
247
+ "payload": {
248
+ "$ref": "#/$defs/dispose"
249
+ }
250
+ }
251
+ }
66
252
  }
67
253
  ],
68
254
  "$defs": {
255
+ "previewMarker": {
256
+ "description": "A deterministic marker for one node in a canonical draft: the draft digest followed by its zero-based Blueprint preorder ordinal.",
257
+ "type": "string",
258
+ "pattern": "^studio\\.preview/node/[0-9a-f]{64}/(?:0|[1-9][0-9]{0,4})(?![\\s\\S])",
259
+ "maxLength": 90
260
+ },
69
261
  "ready": {
70
262
  "type": "object",
71
263
  "additionalProperties": false,
72
264
  "required": ["protocolVersion", "renderer", "viewports"],
73
265
  "properties": {
74
- "protocolVersion": { "$ref": "common.schema.json#/$defs/semanticVersion" },
75
- "renderer": { "$ref": "common.schema.json#/$defs/qualifiedName" },
266
+ "protocolVersion": {
267
+ "$ref": "common.schema.json#/$defs/semanticVersion"
268
+ },
269
+ "renderer": {
270
+ "$ref": "common.schema.json#/$defs/qualifiedName"
271
+ },
76
272
  "viewports": {
77
273
  "type": "array",
78
274
  "maxItems": 20,
79
- "items": { "$ref": "common.schema.json#/$defs/localName" }
275
+ "items": {
276
+ "$ref": "common.schema.json#/$defs/localName"
277
+ }
80
278
  }
81
279
  }
82
280
  },
83
281
  "render": {
84
282
  "type": "object",
85
283
  "additionalProperties": false,
86
- "required": ["artifactId", "draftDigest", "viewport"],
284
+ "required": ["artifactId", "draftDigest", "draftRevision", "requestId", "viewport"],
87
285
  "properties": {
88
- "artifactId": { "$ref": "common.schema.json#/$defs/stableId" },
286
+ "artifactId": {
287
+ "$ref": "common.schema.json#/$defs/stableId"
288
+ },
89
289
  "draftDigest": {
90
290
  "type": "string",
91
291
  "pattern": "^[a-f0-9]{64}(?![\\s\\S])"
92
292
  },
93
- "draftRevision": { "$ref": "common.schema.json#/$defs/revision" },
94
- "viewport": { "$ref": "common.schema.json#/$defs/localName" }
293
+ "draftRevision": {
294
+ "$ref": "common.schema.json#/$defs/revision"
295
+ },
296
+ "requestId": {
297
+ "$ref": "common.schema.json#/$defs/stableId",
298
+ "description": "A session-unique render attempt identifier. Retries use a new identifier even when draft and viewport are unchanged."
299
+ },
300
+ "viewport": {
301
+ "$ref": "common.schema.json#/$defs/localName"
302
+ }
95
303
  }
96
304
  },
97
305
  "rendered": {
98
306
  "type": "object",
99
307
  "additionalProperties": false,
100
- "required": ["draftDigest", "markers", "diagnostics"],
308
+ "required": ["requestId", "draftDigest", "markers", "markerMap", "diagnostics"],
101
309
  "properties": {
102
310
  "draftDigest": {
103
311
  "type": "string",
104
312
  "pattern": "^[a-f0-9]{64}(?![\\s\\S])"
105
313
  },
314
+ "requestId": {
315
+ "$ref": "common.schema.json#/$defs/stableId",
316
+ "description": "The exact render attempt this response settles."
317
+ },
106
318
  "markers": {
107
319
  "type": "array",
108
320
  "maxItems": 100000,
109
- "items": { "$ref": "common.schema.json#/$defs/stableId" }
321
+ "uniqueItems": true,
322
+ "items": {
323
+ "$ref": "#/$defs/previewMarker"
324
+ }
110
325
  },
111
326
  "markerMap": {
112
327
  "type": "object",
113
328
  "maxProperties": 100000,
114
- "propertyNames": { "$ref": "common.schema.json#/$defs/stableId" },
115
- "additionalProperties": { "$ref": "common.schema.json#/$defs/stableId" }
329
+ "propertyNames": {
330
+ "$ref": "#/$defs/previewMarker"
331
+ },
332
+ "additionalProperties": {
333
+ "$ref": "common.schema.json#/$defs/stableId"
334
+ }
116
335
  },
117
336
  "diagnostics": {
118
337
  "type": "array",
119
338
  "maxItems": 10000,
120
- "items": { "$ref": "common.schema.json#/$defs/diagnostic" }
339
+ "items": {
340
+ "$ref": "common.schema.json#/$defs/diagnostic"
341
+ }
121
342
  }
122
343
  }
123
344
  },
@@ -126,8 +347,13 @@
126
347
  "additionalProperties": false,
127
348
  "required": ["nodeId"],
128
349
  "properties": {
129
- "nodeId": { "$ref": "common.schema.json#/$defs/stableId" },
130
- "reveal": { "type": "boolean", "default": true }
350
+ "nodeId": {
351
+ "$ref": "common.schema.json#/$defs/stableId"
352
+ },
353
+ "reveal": {
354
+ "type": "boolean",
355
+ "default": true
356
+ }
131
357
  }
132
358
  },
133
359
  "measure": {
@@ -135,11 +361,18 @@
135
361
  "additionalProperties": false,
136
362
  "required": ["requestId", "markers"],
137
363
  "properties": {
138
- "requestId": { "$ref": "common.schema.json#/$defs/stableId" },
364
+ "requestId": {
365
+ "$ref": "common.schema.json#/$defs/stableId",
366
+ "description": "A session-unique measurement attempt identifier, never reused for another render or measurement."
367
+ },
139
368
  "markers": {
140
369
  "type": "array",
370
+ "minItems": 1,
141
371
  "maxItems": 1000,
142
- "items": { "$ref": "common.schema.json#/$defs/stableId" }
372
+ "uniqueItems": true,
373
+ "items": {
374
+ "$ref": "#/$defs/previewMarker"
375
+ }
143
376
  }
144
377
  }
145
378
  },
@@ -148,7 +381,9 @@
148
381
  "additionalProperties": false,
149
382
  "required": ["requestId", "draftDigest", "measurements", "unknown", "viewport"],
150
383
  "properties": {
151
- "requestId": { "$ref": "common.schema.json#/$defs/stableId" },
384
+ "requestId": {
385
+ "$ref": "common.schema.json#/$defs/stableId"
386
+ },
152
387
  "draftDigest": {
153
388
  "type": "string",
154
389
  "pattern": "^[a-f0-9]{64}(?![\\s\\S])"
@@ -156,20 +391,29 @@
156
391
  "measurements": {
157
392
  "type": "object",
158
393
  "maxProperties": 1000,
159
- "propertyNames": { "$ref": "common.schema.json#/$defs/stableId" },
394
+ "propertyNames": {
395
+ "$ref": "#/$defs/previewMarker"
396
+ },
160
397
  "additionalProperties": {
161
398
  "type": "array",
162
399
  "minItems": 1,
163
400
  "maxItems": 1000,
164
- "items": { "$ref": "#/$defs/markerRect" }
401
+ "items": {
402
+ "$ref": "#/$defs/markerRect"
403
+ }
165
404
  }
166
405
  },
167
406
  "unknown": {
168
407
  "type": "array",
169
408
  "maxItems": 1000,
170
- "items": { "$ref": "common.schema.json#/$defs/stableId" }
409
+ "uniqueItems": true,
410
+ "items": {
411
+ "$ref": "#/$defs/previewMarker"
412
+ }
171
413
  },
172
- "viewport": { "$ref": "#/$defs/viewportMetrics" }
414
+ "viewport": {
415
+ "$ref": "#/$defs/viewportMetrics"
416
+ }
173
417
  }
174
418
  },
175
419
  "markerRect": {
@@ -177,10 +421,26 @@
177
421
  "additionalProperties": false,
178
422
  "required": ["x", "y", "width", "height"],
179
423
  "properties": {
180
- "x": { "type": "number", "minimum": -100000000, "maximum": 100000000 },
181
- "y": { "type": "number", "minimum": -100000000, "maximum": 100000000 },
182
- "width": { "type": "number", "minimum": 0, "maximum": 100000000 },
183
- "height": { "type": "number", "minimum": 0, "maximum": 100000000 }
424
+ "x": {
425
+ "type": "number",
426
+ "minimum": -100000000,
427
+ "maximum": 100000000
428
+ },
429
+ "y": {
430
+ "type": "number",
431
+ "minimum": -100000000,
432
+ "maximum": 100000000
433
+ },
434
+ "width": {
435
+ "type": "number",
436
+ "minimum": 0,
437
+ "maximum": 100000000
438
+ },
439
+ "height": {
440
+ "type": "number",
441
+ "minimum": 0,
442
+ "maximum": 100000000
443
+ }
184
444
  }
185
445
  },
186
446
  "viewportMetrics": {
@@ -188,11 +448,31 @@
188
448
  "additionalProperties": false,
189
449
  "required": ["width", "height", "scrollX", "scrollY", "devicePixelRatio"],
190
450
  "properties": {
191
- "width": { "type": "number", "minimum": 0, "maximum": 100000000 },
192
- "height": { "type": "number", "minimum": 0, "maximum": 100000000 },
193
- "scrollX": { "type": "number", "minimum": -100000000, "maximum": 100000000 },
194
- "scrollY": { "type": "number", "minimum": -100000000, "maximum": 100000000 },
195
- "devicePixelRatio": { "type": "number", "exclusiveMinimum": 0, "maximum": 100 }
451
+ "width": {
452
+ "type": "number",
453
+ "minimum": 0,
454
+ "maximum": 100000000
455
+ },
456
+ "height": {
457
+ "type": "number",
458
+ "minimum": 0,
459
+ "maximum": 100000000
460
+ },
461
+ "scrollX": {
462
+ "type": "number",
463
+ "minimum": -100000000,
464
+ "maximum": 100000000
465
+ },
466
+ "scrollY": {
467
+ "type": "number",
468
+ "minimum": -100000000,
469
+ "maximum": 100000000
470
+ },
471
+ "devicePixelRatio": {
472
+ "type": "number",
473
+ "exclusiveMinimum": 0,
474
+ "maximum": 100
475
+ }
196
476
  }
197
477
  },
198
478
  "error": {
@@ -200,10 +480,18 @@
200
480
  "additionalProperties": false,
201
481
  "required": ["code", "message", "retryable"],
202
482
  "properties": {
203
- "code": { "$ref": "common.schema.json#/$defs/qualifiedName" },
204
- "message": { "$ref": "common.schema.json#/$defs/messageReference" },
205
- "retryable": { "type": "boolean" },
206
- "correlationId": { "$ref": "common.schema.json#/$defs/stableId" }
483
+ "code": {
484
+ "$ref": "common.schema.json#/$defs/qualifiedName"
485
+ },
486
+ "message": {
487
+ "$ref": "common.schema.json#/$defs/messageReference"
488
+ },
489
+ "retryable": {
490
+ "type": "boolean"
491
+ },
492
+ "correlationId": {
493
+ "$ref": "common.schema.json#/$defs/stableId"
494
+ }
207
495
  }
208
496
  },
209
497
  "reload": {
@@ -211,7 +499,9 @@
211
499
  "additionalProperties": false,
212
500
  "required": ["reason"],
213
501
  "properties": {
214
- "reason": { "$ref": "common.schema.json#/$defs/qualifiedName" }
502
+ "reason": {
503
+ "$ref": "common.schema.json#/$defs/qualifiedName"
504
+ }
215
505
  }
216
506
  },
217
507
  "teardown": {
@@ -219,7 +509,74 @@
219
509
  "additionalProperties": false,
220
510
  "required": ["reason"],
221
511
  "properties": {
222
- "reason": { "$ref": "common.schema.json#/$defs/qualifiedName" }
512
+ "reason": {
513
+ "$ref": "common.schema.json#/$defs/qualifiedName"
514
+ }
515
+ }
516
+ },
517
+ "activated": {
518
+ "type": "object",
519
+ "additionalProperties": false,
520
+ "required": ["interaction", "marker"],
521
+ "properties": {
522
+ "interaction": {
523
+ "description": "How the author reached the region. The renderer reports intent, never raw input events.",
524
+ "enum": ["activate", "context-menu", "focus"]
525
+ },
526
+ "marker": {
527
+ "description": "A marker from the renderer's currently accepted inventory. The channel drops invented and stale markers.",
528
+ "$ref": "#/$defs/previewMarker"
529
+ }
530
+ }
531
+ },
532
+ "viewport": {
533
+ "description": "A semantic viewport role and explicit dimensions are alternatives, never a merge. Each branch is closed, so a payload naming both matches neither.",
534
+ "oneOf": [
535
+ {
536
+ "type": "object",
537
+ "additionalProperties": false,
538
+ "required": ["viewport"],
539
+ "properties": {
540
+ "viewport": {
541
+ "$ref": "common.schema.json#/$defs/localName",
542
+ "description": "The theme-declared semantic viewport role to render at."
543
+ }
544
+ }
545
+ },
546
+ {
547
+ "type": "object",
548
+ "additionalProperties": false,
549
+ "minProperties": 1,
550
+ "properties": {
551
+ "height": {
552
+ "description": "Bounded CSS-pixel height.",
553
+ "type": "integer",
554
+ "minimum": 240,
555
+ "maximum": 10000
556
+ },
557
+ "width": {
558
+ "description": "Bounded CSS-pixel width.",
559
+ "type": "integer",
560
+ "minimum": 240,
561
+ "maximum": 10000
562
+ }
563
+ }
564
+ }
565
+ ]
566
+ },
567
+ "dispose": {
568
+ "type": "object",
569
+ "additionalProperties": false,
570
+ "required": ["reason"],
571
+ "properties": {
572
+ "draftDigest": {
573
+ "description": "Revoke only the resources held for this render. Absent revokes every draft resource the renderer holds.",
574
+ "type": "string",
575
+ "pattern": "^[0-9a-f]{64}(?![\\s\\S])"
576
+ },
577
+ "reason": {
578
+ "$ref": "common.schema.json#/$defs/qualifiedName"
579
+ }
223
580
  }
224
581
  }
225
582
  }
@@ -0,0 +1,52 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.kumwe.org/studio/v1/preview-vector.schema.json",
4
+ "title": "Studio preview identity conformance vector",
5
+ "description": "One complete Blueprint draft, its exact render-attempt identity, and the SHA-256 plus deterministic marker inventory every implementation must reproduce under the preview identity profile.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "contractVersion",
10
+ "kind",
11
+ "id",
12
+ "description",
13
+ "profile",
14
+ "protocolVersion",
15
+ "draft",
16
+ "render",
17
+ "expect"
18
+ ],
19
+ "properties": {
20
+ "contractVersion": { "$ref": "common.schema.json#/$defs/contractVersion" },
21
+ "kind": { "const": "preview-vector" },
22
+ "id": { "$ref": "common.schema.json#/$defs/stableId" },
23
+ "description": { "type": "string", "minLength": 1, "maxLength": 1000 },
24
+ "profile": { "const": "studio.profile/preview-identity-v1" },
25
+ "protocolVersion": { "const": "0.1.0-draft.2" },
26
+ "draft": { "$ref": "blueprint.schema.json" },
27
+ "render": { "$ref": "preview-message.schema.json#/$defs/render" },
28
+ "expect": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["draftDigest", "markers", "markerMap"],
32
+ "properties": {
33
+ "draftDigest": {
34
+ "type": "string",
35
+ "pattern": "^[0-9a-f]{64}(?![\\s\\S])"
36
+ },
37
+ "markers": {
38
+ "type": "array",
39
+ "maxItems": 100000,
40
+ "uniqueItems": true,
41
+ "items": { "$ref": "preview-message.schema.json#/$defs/previewMarker" }
42
+ },
43
+ "markerMap": {
44
+ "type": "object",
45
+ "maxProperties": 100000,
46
+ "propertyNames": { "$ref": "preview-message.schema.json#/$defs/previewMarker" },
47
+ "additionalProperties": { "$ref": "common.schema.json#/$defs/stableId" }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }