@dp-bohrium/widget-contracts 0.0.1

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 (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -0
  3. package/conformance/bridge/capability-request.json +23 -0
  4. package/conformance/bridge/network-fetch-denied.json +16 -0
  5. package/conformance/bridge/network-fetch-request.json +19 -0
  6. package/conformance/bridge/network-fetch-success.json +22 -0
  7. package/conformance/bridge/presentation-change-surface-request.json +14 -0
  8. package/conformance/bridge/presentation-close-request.json +14 -0
  9. package/conformance/bridge/presentation-close-success.json +11 -0
  10. package/conformance/bridge/presentation-downgrade-success.json +14 -0
  11. package/conformance/bridge/presentation-focus-backward-request.json +14 -0
  12. package/conformance/bridge/presentation-focus-boundary-success.json +14 -0
  13. package/conformance/bridge/presentation-focus-forward-request.json +14 -0
  14. package/conformance/bridge/presentation-init.json +70 -0
  15. package/conformance/bridge/presentation-policy-denied.json +16 -0
  16. package/conformance/bridge/presentation-present-request.json +14 -0
  17. package/conformance/bridge/presentation-user-denied.json +16 -0
  18. package/conformance/bridge/ready.json +11 -0
  19. package/conformance/bundles/minimal-file-preview/entry.js +1 -0
  20. package/conformance/bundles/minimal-file-preview/manifest.json +12 -0
  21. package/conformance/bundles/minimal-file-preview/samples/file-preview.json +1 -0
  22. package/conformance/bundles/minimal-panel/entry.js +1 -0
  23. package/conformance/bundles/minimal-panel/manifest.json +11 -0
  24. package/conformance/bundles/minimal-panel/samples/panel.json +1 -0
  25. package/conformance/bundles/minimal-tool-result/entry.js +1 -0
  26. package/conformance/bundles/minimal-tool-result/manifest.json +11 -0
  27. package/conformance/bundles/minimal-tool-result/samples/tool-result.json +1 -0
  28. package/conformance/file-responses/list.json +1 -0
  29. package/conformance/file-responses/metadata.json +11 -0
  30. package/conformance/file-responses/permission-denied.json +6 -0
  31. package/conformance/file-responses/resource-limit.json +1 -0
  32. package/conformance/file-responses/text-content.json +1 -0
  33. package/conformance/host-runtime-config/invalid-missing-manifest-fields.json +55 -0
  34. package/conformance/host-runtime-config/invalid-static-origins.json +60 -0
  35. package/conformance/host-runtime-config/valid.json +85 -0
  36. package/conformance/invalid-bridge-messages/network-fetch-mixed-case-forbidden-header.json +21 -0
  37. package/conformance/invalid-manifests/missing-target.json +11 -0
  38. package/conformance/invalid-manifests/presentation-duplicate-surfaces.json +16 -0
  39. package/conformance/invalid-manifests/presentation-empty-surfaces.json +14 -0
  40. package/conformance/invalid-manifests/presentation-unknown-surface.json +16 -0
  41. package/conformance/invalid-manifests/unknown-field.json +12 -0
  42. package/conformance/invalid-network-requests/mixed-case-forbidden-header.json +11 -0
  43. package/conformance/invalid-presentation-grants/duplicate-surfaces.json +5 -0
  44. package/conformance/invalid-presentation-grants/empty-surfaces.json +5 -0
  45. package/conformance/invalid-presentation-grants/false-confirmation.json +5 -0
  46. package/conformance/invalid-presentation-grants/missing-confirmation.json +4 -0
  47. package/conformance/invalid-presentation-grants/unknown-surface.json +5 -0
  48. package/conformance/invalid-presentation-requests/change-surface-missing-surface.json +4 -0
  49. package/conformance/invalid-presentation-requests/close-with-surface.json +4 -0
  50. package/conformance/invalid-presentation-requests/focus-boundary-missing-direction.json +4 -0
  51. package/conformance/invalid-presentation-requests/focus-boundary-unknown-direction.json +4 -0
  52. package/conformance/invalid-presentation-requests/focus-boundary-with-coordinates.json +9 -0
  53. package/conformance/invalid-presentation-requests/focus-boundary-with-event-provenance.json +8 -0
  54. package/conformance/invalid-presentation-requests/focus-boundary-with-generation.json +8 -0
  55. package/conformance/invalid-presentation-requests/focus-boundary-with-identity.json +12 -0
  56. package/conformance/invalid-presentation-requests/focus-boundary-with-key.json +8 -0
  57. package/conformance/invalid-presentation-requests/focus-boundary-with-modifiers.json +11 -0
  58. package/conformance/invalid-presentation-requests/focus-boundary-with-selector.json +8 -0
  59. package/conformance/invalid-presentation-requests/focus-boundary-with-surface.json +8 -0
  60. package/conformance/invalid-presentation-requests/focus-boundary-with-target.json +8 -0
  61. package/conformance/invalid-presentation-requests/focus-boundary-with-timestamp.json +8 -0
  62. package/conformance/invalid-presentation-requests/focus-boundary-with-z-index.json +8 -0
  63. package/conformance/invalid-presentation-requests/present-missing-surface.json +4 -0
  64. package/conformance/invalid-presentation-requests/unknown-surface.json +4 -0
  65. package/conformance/invalid-presentation-requests/widget-controls-coordinates.json +9 -0
  66. package/conformance/invalid-presentation-requests/widget-controls-geometry.json +8 -0
  67. package/conformance/invalid-presentation-requests/widget-controls-instance-id.json +8 -0
  68. package/conformance/invalid-presentation-requests/widget-controls-principal.json +8 -0
  69. package/conformance/invalid-presentation-requests/widget-controls-run-id.json +4 -0
  70. package/conformance/invalid-presentation-requests/widget-controls-widget-id.json +8 -0
  71. package/conformance/invalid-presentation-requests/widget-controls-widget-version-id.json +8 -0
  72. package/conformance/invalid-presentation-requests/widget-controls-z-index.json +4 -0
  73. package/conformance/invalid-render-inputs/malformed.json +17 -0
  74. package/conformance/manifests/valid-file-preview.json +12 -0
  75. package/conformance/manifests/valid-network.json +15 -0
  76. package/conformance/manifests/valid-panel.json +11 -0
  77. package/conformance/manifests/valid-presentation-panel.json +21 -0
  78. package/conformance/manifests/valid-tool-result.json +14 -0
  79. package/conformance/render-inputs/compatibility/literature-search-paper-results.json +75 -0
  80. package/conformance/render-inputs/compatibility/scientific-bibliography-bibtex.json +10 -0
  81. package/conformance/render-inputs/compatibility/scientific-dataset-csv.json +10 -0
  82. package/conformance/render-inputs/compatibility/scientific-manuscript-latex.json +10 -0
  83. package/conformance/render-inputs/compatibility/scientific-manuscript-markdown.json +10 -0
  84. package/conformance/render-inputs/compatibility/scientific-molecule-mol.json +10 -0
  85. package/conformance/render-inputs/compatibility/scientific-molecule-mol2.json +10 -0
  86. package/conformance/render-inputs/compatibility/scientific-notebook-ipynb.json +10 -0
  87. package/conformance/render-inputs/compatibility/scientific-paper-pdf.json +10 -0
  88. package/conformance/render-inputs/compatibility/scientific-protein-pdb.json +10 -0
  89. package/conformance/render-inputs/compatibility/scientific-source-python.json +10 -0
  90. package/conformance/render-inputs/compatibility/scientific-structure-cif.json +47 -0
  91. package/conformance/render-inputs/compatibility/scientific-structure-poscar.json +10 -0
  92. package/conformance/render-inputs/compatibility/scientific-structure-stru.json +10 -0
  93. package/conformance/render-inputs/compatibility/scientific-trajectory-xyz.json +10 -0
  94. package/conformance/render-inputs/compatibility/thinking-process-paper-search.json +25 -0
  95. package/conformance/render-inputs/compatibility/thinking-process-scholar-search.json +25 -0
  96. package/conformance/render-inputs/compatibility/thinking-process-web-search.json +25 -0
  97. package/conformance/render-inputs/compatibility/workspace-file-search.json +24 -0
  98. package/conformance/render-inputs/compatibility/workspace-file-tree.json +24 -0
  99. package/conformance/render-inputs/empty.json +10 -0
  100. package/conformance/render-inputs/file-preview.json +10 -0
  101. package/conformance/render-inputs/incremental-update.json +10 -0
  102. package/conformance/render-inputs/large.json +10 -0
  103. package/conformance/render-inputs/malformed.json +1 -0
  104. package/conformance/render-inputs/panel.json +10 -0
  105. package/conformance/render-inputs/partial-state-full-snapshot.json +40 -0
  106. package/conformance/render-inputs/tool-result.json +10 -0
  107. package/dist/generated-host-runtime-config.d.ts +246 -0
  108. package/dist/generated-host-runtime-config.js +3 -0
  109. package/dist/generated-manifest.d.ts +86 -0
  110. package/dist/generated-manifest.js +3 -0
  111. package/dist/generated-runtime-contracts.d.ts +401 -0
  112. package/dist/generated-runtime-contracts.js +3 -0
  113. package/dist/index.d.ts +22 -0
  114. package/dist/index.js +2 -0
  115. package/package.json +55 -0
  116. package/schemas/host-runtime-config.schema.json +185 -0
  117. package/schemas/widget-manifest.schema.json +227 -0
  118. package/schemas/widget-runtime-contracts.schema.json +1478 -0
@@ -0,0 +1,1478 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "widget-runtime-contracts.schema.json",
4
+ "title": "Widget Runtime Contracts",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "widgetSlot",
9
+ "renderRequest",
10
+ "hostToWidgetMessage",
11
+ "widgetToHostMessage",
12
+ "capabilityRequest",
13
+ "capabilityResult",
14
+ "widgetError",
15
+ "resourceBudget"
16
+ ],
17
+ "properties": {
18
+ "widgetSlot": {
19
+ "$ref": "#/$defs/WidgetSlot"
20
+ },
21
+ "renderRequest": {
22
+ "$ref": "#/$defs/RenderRequest"
23
+ },
24
+ "hostToWidgetMessage": {
25
+ "$ref": "#/$defs/HostToWidgetMessage"
26
+ },
27
+ "widgetToHostMessage": {
28
+ "$ref": "#/$defs/WidgetToHostMessage"
29
+ },
30
+ "capabilityRequest": {
31
+ "$ref": "#/$defs/CapabilityRequest"
32
+ },
33
+ "capabilityResult": {
34
+ "$ref": "#/$defs/CapabilityResult"
35
+ },
36
+ "widgetError": {
37
+ "$ref": "#/$defs/WidgetError"
38
+ },
39
+ "resourceBudget": {
40
+ "$ref": "#/$defs/ResourceBudget"
41
+ },
42
+ "widgetEventBatch": {
43
+ "$ref": "#/$defs/WidgetEventBatch"
44
+ },
45
+ "toolLifecycleEvent": {
46
+ "$ref": "#/$defs/ToolLifecycleEvent"
47
+ },
48
+ "widgetNetworkFetchOutput": {
49
+ "$ref": "#/$defs/WidgetNetworkFetchOutput"
50
+ },
51
+ "presentationCapabilityOutput": {
52
+ "$ref": "#/$defs/PresentationCapabilityOutput"
53
+ },
54
+ "presentationCapabilityResult": {
55
+ "$ref": "#/$defs/PresentationCapabilityResult"
56
+ }
57
+ },
58
+ "$defs": {
59
+ "JsonValue": {
60
+ "title": "JsonValue",
61
+ "oneOf": [
62
+ { "type": "null" },
63
+ { "type": "boolean" },
64
+ { "type": "number" },
65
+ { "type": "string" },
66
+ { "type": "array", "items": { "$ref": "#/$defs/JsonValue" } },
67
+ {
68
+ "type": "object",
69
+ "additionalProperties": { "$ref": "#/$defs/JsonValue" }
70
+ }
71
+ ]
72
+ },
73
+ "WidgetSlot": {
74
+ "title": "WidgetSlot",
75
+ "enum": ["tool-result", "file-preview", "panel"]
76
+ },
77
+ "RenderState": {
78
+ "title": "RenderState",
79
+ "enum": ["loading", "partial", "complete", "error"]
80
+ },
81
+ "ThemeMode": {
82
+ "title": "ThemeMode",
83
+ "enum": ["light", "dark"]
84
+ },
85
+ "Theme": {
86
+ "title": "Theme",
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": ["mode", "tokens"],
90
+ "properties": {
91
+ "mode": { "$ref": "#/$defs/ThemeMode" },
92
+ "tokens": {
93
+ "type": "object",
94
+ "additionalProperties": false,
95
+ "required": [
96
+ "background",
97
+ "foreground",
98
+ "muted",
99
+ "mutedForeground",
100
+ "border",
101
+ "primary",
102
+ "danger"
103
+ ],
104
+ "properties": {
105
+ "background": { "type": "string", "minLength": 1 },
106
+ "foreground": { "type": "string", "minLength": 1 },
107
+ "muted": { "type": "string", "minLength": 1 },
108
+ "mutedForeground": { "type": "string", "minLength": 1 },
109
+ "border": { "type": "string", "minLength": 1 },
110
+ "primary": { "type": "string", "minLength": 1 },
111
+ "danger": { "type": "string", "minLength": 1 }
112
+ }
113
+ }
114
+ }
115
+ },
116
+ "FileReference": {
117
+ "title": "FileReference",
118
+ "type": "object",
119
+ "additionalProperties": false,
120
+ "required": ["id", "kind", "name"],
121
+ "properties": {
122
+ "id": { "type": "string", "minLength": 1 },
123
+ "kind": { "enum": ["file", "directory"] },
124
+ "name": { "type": "string", "minLength": 1 },
125
+ "extension": {
126
+ "type": "string",
127
+ "pattern": "^[a-z0-9][a-z0-9.-]*$",
128
+ "maxLength": 32
129
+ },
130
+ "mimeType": { "type": "string", "minLength": 1, "maxLength": 255 },
131
+ "size": { "type": "integer", "minimum": 0 }
132
+ }
133
+ },
134
+ "GrantedCapability": {
135
+ "title": "GrantedCapability",
136
+ "oneOf": [
137
+ {
138
+ "type": "object",
139
+ "additionalProperties": false,
140
+ "required": [
141
+ "name",
142
+ "limits"
143
+ ],
144
+ "properties": {
145
+ "name": {
146
+ "const": "files.list"
147
+ },
148
+ "limits": {
149
+ "type": "object",
150
+ "additionalProperties": false,
151
+ "required": [
152
+ "pageSize",
153
+ "callsPerMinute"
154
+ ],
155
+ "properties": {
156
+ "pageSize": {
157
+ "type": "integer",
158
+ "minimum": 1
159
+ },
160
+ "callsPerMinute": {
161
+ "type": "integer",
162
+ "minimum": 1
163
+ }
164
+ }
165
+ }
166
+ }
167
+ },
168
+ {
169
+ "type": "object",
170
+ "additionalProperties": false,
171
+ "required": [
172
+ "name",
173
+ "limits"
174
+ ],
175
+ "properties": {
176
+ "name": {
177
+ "const": "files.metadata"
178
+ },
179
+ "limits": {
180
+ "type": "object",
181
+ "additionalProperties": false,
182
+ "required": [
183
+ "callsPerMinute"
184
+ ],
185
+ "properties": {
186
+ "callsPerMinute": {
187
+ "type": "integer",
188
+ "minimum": 1
189
+ }
190
+ }
191
+ }
192
+ }
193
+ },
194
+ {
195
+ "type": "object",
196
+ "additionalProperties": false,
197
+ "required": [
198
+ "name",
199
+ "limits"
200
+ ],
201
+ "properties": {
202
+ "name": {
203
+ "const": "files.read"
204
+ },
205
+ "limits": {
206
+ "type": "object",
207
+ "additionalProperties": false,
208
+ "required": [
209
+ "bytesPerRequest",
210
+ "bytesPerRun",
211
+ "callsPerMinute"
212
+ ],
213
+ "properties": {
214
+ "bytesPerRequest": {
215
+ "type": "integer",
216
+ "minimum": 1
217
+ },
218
+ "bytesPerRun": {
219
+ "type": "integer",
220
+ "minimum": 1
221
+ },
222
+ "callsPerMinute": {
223
+ "type": "integer",
224
+ "minimum": 1
225
+ }
226
+ }
227
+ }
228
+ }
229
+ },
230
+ {
231
+ "type": "object",
232
+ "additionalProperties": false,
233
+ "required": [
234
+ "name",
235
+ "topics",
236
+ "limits"
237
+ ],
238
+ "properties": {
239
+ "name": {
240
+ "const": "events.read"
241
+ },
242
+ "topics": {
243
+ "type": "array",
244
+ "minItems": 1,
245
+ "maxItems": 32,
246
+ "uniqueItems": true,
247
+ "items": {
248
+ "type": "string",
249
+ "minLength": 1,
250
+ "maxLength": 128,
251
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
252
+ }
253
+ },
254
+ "limits": {
255
+ "type": "object",
256
+ "additionalProperties": false,
257
+ "required": [
258
+ "callsPerMinute",
259
+ "pageSize",
260
+ "minPollMs"
261
+ ],
262
+ "properties": {
263
+ "callsPerMinute": {
264
+ "type": "integer",
265
+ "minimum": 1,
266
+ "maximum": 9007199254740991
267
+ },
268
+ "pageSize": {
269
+ "type": "integer",
270
+ "minimum": 1,
271
+ "maximum": 100
272
+ },
273
+ "minPollMs": {
274
+ "type": "integer",
275
+ "minimum": 1000,
276
+ "maximum": 60000
277
+ }
278
+ }
279
+ }
280
+ }
281
+ },
282
+ {
283
+ "type": "object",
284
+ "additionalProperties": false,
285
+ "required": [
286
+ "name",
287
+ "actions",
288
+ "limits"
289
+ ],
290
+ "properties": {
291
+ "name": {
292
+ "const": "actions.invoke"
293
+ },
294
+ "actions": {
295
+ "type": "array",
296
+ "minItems": 1,
297
+ "maxItems": 32,
298
+ "uniqueItems": true,
299
+ "items": {
300
+ "type": "string",
301
+ "minLength": 1,
302
+ "maxLength": 128,
303
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
304
+ }
305
+ },
306
+ "limits": {
307
+ "type": "object",
308
+ "additionalProperties": false,
309
+ "required": [
310
+ "callsPerMinute"
311
+ ],
312
+ "properties": {
313
+ "callsPerMinute": {
314
+ "type": "integer",
315
+ "minimum": 1,
316
+ "maximum": 9007199254740991
317
+ }
318
+ }
319
+ }
320
+ }
321
+ },
322
+ {
323
+ "type": "object",
324
+ "additionalProperties": false,
325
+ "required": ["name", "limits"],
326
+ "properties": {
327
+ "name": { "const": "network.fetch" },
328
+ "limits": { "$ref": "#/$defs/WidgetNetworkLimits" }
329
+ }
330
+ },
331
+ { "$ref": "#/$defs/GrantedPresentationCapability" }
332
+ ]
333
+ },
334
+ "GrantedPresentationCapability": {
335
+ "title": "GrantedPresentationCapability",
336
+ "type": "object",
337
+ "additionalProperties": false,
338
+ "required": ["name", "surfaces", "requiresHostConfirmation"],
339
+ "properties": {
340
+ "name": { "const": "ui.presentation" },
341
+ "surfaces": {
342
+ "type": "array",
343
+ "minItems": 1,
344
+ "maxItems": 2,
345
+ "uniqueItems": true,
346
+ "items": { "enum": ["floating", "overlay"] }
347
+ },
348
+ "requiresHostConfirmation": { "const": true }
349
+ }
350
+ },
351
+ "WidgetRenderContext": {
352
+ "title": "WidgetRenderContext",
353
+ "type": "object",
354
+ "additionalProperties": false,
355
+ "required": [
356
+ "locale",
357
+ "theme",
358
+ "viewport",
359
+ "capabilities",
360
+ "correlationId"
361
+ ],
362
+ "properties": {
363
+ "locale": { "type": "string", "minLength": 1 },
364
+ "theme": { "$ref": "#/$defs/Theme" },
365
+ "viewport": {
366
+ "type": "object",
367
+ "additionalProperties": false,
368
+ "required": ["width", "height"],
369
+ "properties": {
370
+ "width": { "type": "number", "minimum": 0 },
371
+ "height": { "type": "number", "minimum": 0 }
372
+ }
373
+ },
374
+ "capabilities": {
375
+ "type": "array",
376
+ "items": { "$ref": "#/$defs/GrantedCapability" }
377
+ },
378
+ "correlationId": { "type": "string", "minLength": 1 }
379
+ }
380
+ },
381
+ "ToolResultContent": {
382
+ "title": "ToolResultContent",
383
+ "type": "object",
384
+ "additionalProperties": false,
385
+ "required": ["slot", "tool", "input"],
386
+ "properties": {
387
+ "slot": { "const": "tool-result" },
388
+ "tool": {
389
+ "type": "object",
390
+ "additionalProperties": false,
391
+ "required": ["name", "callId", "status"],
392
+ "properties": {
393
+ "name": { "type": "string", "minLength": 1 },
394
+ "callId": { "type": "string", "minLength": 1 },
395
+ "status": {
396
+ "enum": ["running", "succeeded", "failed", "cancelled"]
397
+ }
398
+ }
399
+ },
400
+ "input": { "$ref": "#/$defs/JsonValue" },
401
+ "result": { "$ref": "#/$defs/JsonValue" },
402
+ "error": {
403
+ "type": "object",
404
+ "additionalProperties": false,
405
+ "required": ["code", "message"],
406
+ "properties": {
407
+ "code": { "type": "string", "minLength": 1 },
408
+ "message": { "type": "string", "minLength": 1 }
409
+ }
410
+ }
411
+ }
412
+ },
413
+ "FilePreviewContent": {
414
+ "title": "FilePreviewContent",
415
+ "type": "object",
416
+ "additionalProperties": false,
417
+ "required": ["slot", "file"],
418
+ "properties": {
419
+ "slot": { "const": "file-preview" },
420
+ "file": { "$ref": "#/$defs/FileReference" },
421
+ "preview": { "$ref": "#/$defs/JsonValue" }
422
+ }
423
+ },
424
+ "PanelContent": {
425
+ "title": "PanelContent",
426
+ "type": "object",
427
+ "additionalProperties": false,
428
+ "required": ["slot", "panelType", "data"],
429
+ "properties": {
430
+ "slot": { "const": "panel" },
431
+ "panelType": { "type": "string", "minLength": 1 },
432
+ "title": { "type": "string" },
433
+ "data": { "$ref": "#/$defs/JsonValue" }
434
+ }
435
+ },
436
+ "RenderRequestBase": {
437
+ "title": "RenderRequestBase",
438
+ "type": "object",
439
+ "required": [
440
+ "schemaVersion",
441
+ "requestId",
442
+ "instanceId",
443
+ "revision",
444
+ "state",
445
+ "context"
446
+ ],
447
+ "properties": {
448
+ "schemaVersion": { "const": 1 },
449
+ "requestId": { "type": "string", "minLength": 1 },
450
+ "instanceId": { "type": "string", "minLength": 1 },
451
+ "revision": { "type": "integer", "minimum": 1 },
452
+ "state": { "$ref": "#/$defs/RenderState" },
453
+ "context": { "$ref": "#/$defs/WidgetRenderContext" }
454
+ }
455
+ },
456
+ "ToolResultRenderRequest": {
457
+ "title": "ToolResultRenderRequest",
458
+ "type": "object",
459
+ "allOf": [
460
+ { "$ref": "#/$defs/RenderRequestBase" },
461
+ {
462
+ "type": "object",
463
+ "required": ["slot", "content"],
464
+ "properties": {
465
+ "slot": { "const": "tool-result" },
466
+ "content": { "$ref": "#/$defs/ToolResultContent" }
467
+ }
468
+ }
469
+ ],
470
+ "unevaluatedProperties": false
471
+ },
472
+ "FilePreviewRenderRequest": {
473
+ "title": "FilePreviewRenderRequest",
474
+ "type": "object",
475
+ "allOf": [
476
+ { "$ref": "#/$defs/RenderRequestBase" },
477
+ {
478
+ "type": "object",
479
+ "required": ["slot", "content"],
480
+ "properties": {
481
+ "slot": { "const": "file-preview" },
482
+ "content": { "$ref": "#/$defs/FilePreviewContent" }
483
+ }
484
+ }
485
+ ],
486
+ "unevaluatedProperties": false
487
+ },
488
+ "PanelRenderRequest": {
489
+ "title": "PanelRenderRequest",
490
+ "type": "object",
491
+ "allOf": [
492
+ { "$ref": "#/$defs/RenderRequestBase" },
493
+ {
494
+ "type": "object",
495
+ "required": ["slot", "content"],
496
+ "properties": {
497
+ "slot": { "const": "panel" },
498
+ "content": { "$ref": "#/$defs/PanelContent" }
499
+ }
500
+ }
501
+ ],
502
+ "unevaluatedProperties": false
503
+ },
504
+ "RenderRequest": {
505
+ "title": "RenderRequest",
506
+ "oneOf": [
507
+ { "$ref": "#/$defs/ToolResultRenderRequest" },
508
+ { "$ref": "#/$defs/FilePreviewRenderRequest" },
509
+ { "$ref": "#/$defs/PanelRenderRequest" }
510
+ ]
511
+ },
512
+ "CapabilityRequest": {
513
+ "title": "CapabilityRequest",
514
+ "oneOf": [
515
+ {
516
+ "type": "object",
517
+ "additionalProperties": false,
518
+ "required": [
519
+ "operation",
520
+ "input"
521
+ ],
522
+ "properties": {
523
+ "operation": {
524
+ "const": "files.list"
525
+ },
526
+ "input": {
527
+ "type": "object",
528
+ "additionalProperties": false,
529
+ "required": [
530
+ "directory"
531
+ ],
532
+ "properties": {
533
+ "directory": {
534
+ "$ref": "#/$defs/FileReference"
535
+ },
536
+ "cursor": {
537
+ "type": "string"
538
+ },
539
+ "limit": {
540
+ "type": "integer",
541
+ "minimum": 1
542
+ }
543
+ }
544
+ }
545
+ }
546
+ },
547
+ {
548
+ "type": "object",
549
+ "additionalProperties": false,
550
+ "required": [
551
+ "operation",
552
+ "input"
553
+ ],
554
+ "properties": {
555
+ "operation": {
556
+ "const": "files.metadata"
557
+ },
558
+ "input": {
559
+ "type": "object",
560
+ "additionalProperties": false,
561
+ "required": [
562
+ "reference"
563
+ ],
564
+ "properties": {
565
+ "reference": {
566
+ "$ref": "#/$defs/FileReference"
567
+ }
568
+ }
569
+ }
570
+ }
571
+ },
572
+ {
573
+ "type": "object",
574
+ "additionalProperties": false,
575
+ "required": [
576
+ "operation",
577
+ "input"
578
+ ],
579
+ "properties": {
580
+ "operation": {
581
+ "const": "files.read"
582
+ },
583
+ "input": {
584
+ "type": "object",
585
+ "additionalProperties": false,
586
+ "required": [
587
+ "file",
588
+ "offset",
589
+ "length",
590
+ "encoding"
591
+ ],
592
+ "properties": {
593
+ "file": {
594
+ "$ref": "#/$defs/FileReference"
595
+ },
596
+ "offset": {
597
+ "type": "integer",
598
+ "minimum": 0
599
+ },
600
+ "length": {
601
+ "type": "integer",
602
+ "minimum": 1
603
+ },
604
+ "encoding": {
605
+ "enum": [
606
+ "utf8",
607
+ "base64"
608
+ ]
609
+ }
610
+ }
611
+ }
612
+ }
613
+ },
614
+ {
615
+ "type": "object",
616
+ "additionalProperties": false,
617
+ "required": [
618
+ "operation",
619
+ "input"
620
+ ],
621
+ "properties": {
622
+ "operation": {
623
+ "const": "events.read"
624
+ },
625
+ "input": {
626
+ "type": "object",
627
+ "additionalProperties": false,
628
+ "required": [
629
+ "topic",
630
+ "limit"
631
+ ],
632
+ "properties": {
633
+ "topic": {
634
+ "type": "string",
635
+ "minLength": 1,
636
+ "maxLength": 128,
637
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
638
+ },
639
+ "cursor": {
640
+ "type": "string",
641
+ "minLength": 1,
642
+ "maxLength": 256
643
+ },
644
+ "limit": {
645
+ "type": "integer",
646
+ "minimum": 1,
647
+ "maximum": 100
648
+ }
649
+ }
650
+ }
651
+ }
652
+ },
653
+ {
654
+ "type": "object",
655
+ "additionalProperties": false,
656
+ "required": [
657
+ "operation",
658
+ "input"
659
+ ],
660
+ "properties": {
661
+ "operation": {
662
+ "const": "actions.invoke"
663
+ },
664
+ "input": {
665
+ "type": "object",
666
+ "additionalProperties": false,
667
+ "required": [
668
+ "action",
669
+ "idempotencyKey",
670
+ "arguments"
671
+ ],
672
+ "properties": {
673
+ "action": {
674
+ "type": "string",
675
+ "minLength": 1,
676
+ "maxLength": 128,
677
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
678
+ },
679
+ "idempotencyKey": {
680
+ "type": "string",
681
+ "minLength": 1,
682
+ "maxLength": 256
683
+ },
684
+ "arguments": {
685
+ "$ref": "#/$defs/JsonValue"
686
+ }
687
+ }
688
+ }
689
+ }
690
+ },
691
+ {
692
+ "type": "object",
693
+ "additionalProperties": false,
694
+ "required": ["operation", "input"],
695
+ "properties": {
696
+ "operation": { "const": "network.fetch" },
697
+ "input": { "$ref": "#/$defs/WidgetNetworkFetchInput" }
698
+ }
699
+ },
700
+ { "$ref": "#/$defs/PresentationCapabilityRequest" }
701
+ ]
702
+ },
703
+ "PresentationCapabilityRequest": {
704
+ "title": "PresentationCapabilityRequest",
705
+ "oneOf": [
706
+ {
707
+ "type": "object",
708
+ "additionalProperties": false,
709
+ "required": ["operation", "input"],
710
+ "properties": {
711
+ "operation": { "const": "ui.presentation" },
712
+ "input": {
713
+ "oneOf": [
714
+ {
715
+ "type": "object",
716
+ "additionalProperties": false,
717
+ "required": ["action", "surface"],
718
+ "properties": {
719
+ "action": { "enum": ["present", "change-surface"] },
720
+ "surface": {
721
+ "enum": ["workspace", "floating", "overlay"]
722
+ }
723
+ }
724
+ },
725
+ {
726
+ "type": "object",
727
+ "additionalProperties": false,
728
+ "required": ["action"],
729
+ "properties": {
730
+ "action": { "const": "close" }
731
+ }
732
+ }
733
+ ]
734
+ }
735
+ }
736
+ },
737
+ { "$ref": "#/$defs/FocusBoundaryPresentationCapabilityRequest" }
738
+ ]
739
+ },
740
+ "FocusBoundaryPresentationCapabilityRequest": {
741
+ "title": "FocusBoundaryPresentationCapabilityRequest",
742
+ "oneOf": [
743
+ {
744
+ "type": "object",
745
+ "additionalProperties": false,
746
+ "required": ["operation", "input"],
747
+ "properties": {
748
+ "operation": { "const": "ui.presentation" },
749
+ "input": {
750
+ "type": "object",
751
+ "additionalProperties": false,
752
+ "required": ["action", "direction"],
753
+ "properties": {
754
+ "action": { "const": "focus-boundary" },
755
+ "direction": { "enum": ["forward", "backward"] }
756
+ }
757
+ }
758
+ }
759
+ }
760
+ ]
761
+ },
762
+ "WidgetNetworkLimits": {
763
+ "title": "WidgetNetworkLimits",
764
+ "type": "object",
765
+ "additionalProperties": false,
766
+ "required": [
767
+ "timeoutMs",
768
+ "maxRedirects",
769
+ "maxConcurrentRequests",
770
+ "callsPerMinute",
771
+ "requestHeaderBytes",
772
+ "responseHeaderBytes",
773
+ "requestBodyBytes",
774
+ "responseBodyBytes"
775
+ ],
776
+ "properties": {
777
+ "timeoutMs": { "$ref": "#/$defs/PositiveInteger" },
778
+ "maxRedirects": { "$ref": "#/$defs/PositiveInteger" },
779
+ "maxConcurrentRequests": { "$ref": "#/$defs/PositiveInteger" },
780
+ "callsPerMinute": { "$ref": "#/$defs/PositiveInteger" },
781
+ "requestHeaderBytes": { "$ref": "#/$defs/PositiveInteger" },
782
+ "responseHeaderBytes": { "$ref": "#/$defs/PositiveInteger" },
783
+ "requestBodyBytes": { "$ref": "#/$defs/PositiveInteger" },
784
+ "responseBodyBytes": { "$ref": "#/$defs/PositiveInteger" }
785
+ }
786
+ },
787
+ "PositiveInteger": {
788
+ "title": "PositiveInteger",
789
+ "type": "integer",
790
+ "minimum": 1,
791
+ "maximum": 9007199254740991
792
+ },
793
+ "NetworkHeaders": {
794
+ "title": "NetworkHeaders",
795
+ "type": "object",
796
+ "maxProperties": 64,
797
+ "propertyNames": {
798
+ "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
799
+ },
800
+ "additionalProperties": {
801
+ "type": "string",
802
+ "maxLength": 16384
803
+ }
804
+ },
805
+ "WidgetNetworkRequestHeaders": {
806
+ "title": "WidgetNetworkRequestHeaders",
807
+ "type": "object",
808
+ "maxProperties": 64,
809
+ "propertyNames": {
810
+ "allOf": [
811
+ { "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$" },
812
+ {
813
+ "not": {
814
+ "pattern": "^(?:[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|[Cc][Oo][Oo][Kk][Ii][Ee]|[Pp][Rr][Oo][Xx][Yy]-[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|[Xx]-[Aa][Pp][Ii]-[Kk][Ee][Yy]|[Aa][Pp][Ii]-[Kk][Ee][Yy]|[Xx]-[Aa][Uu][Tt][Hh]-[Tt][Oo][Kk][Ee][Nn]|[Xx]-[Aa][Cc][Cc][Ee][Ss][Ss]-[Tt][Oo][Kk][Ee][Nn]|[Cc][Rr][Ee][Dd][Ee][Nn][Tt][Ii][Aa][Ll]-[Bb][Ii][Nn][Dd][Ii][Nn][Gg]-[Ii][Dd]|[Xx]-[Cc][Rr][Ee][Dd][Ee][Nn][Tt][Ii][Aa][Ll]-[Bb][Ii][Nn][Dd][Ii][Nn][Gg]-[Ii][Dd])$"
815
+ }
816
+ }
817
+ ]
818
+ },
819
+ "additionalProperties": {
820
+ "type": "string",
821
+ "maxLength": 16384
822
+ }
823
+ },
824
+ "WidgetNetworkFetchInput": {
825
+ "title": "WidgetNetworkFetchInput",
826
+ "type": "object",
827
+ "additionalProperties": false,
828
+ "required": ["url", "auth"],
829
+ "properties": {
830
+ "url": { "type": "string", "minLength": 1, "maxLength": 8192 },
831
+ "auth": { "enum": ["none", "optional", "required"] },
832
+ "method": {
833
+ "enum": ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"]
834
+ },
835
+ "headers": { "$ref": "#/$defs/WidgetNetworkRequestHeaders" },
836
+ "body": { "type": "string" },
837
+ "bodyEncoding": { "enum": ["utf8", "base64"] },
838
+ "redirect": { "enum": ["follow", "manual", "error"] }
839
+ },
840
+ "dependentRequired": {
841
+ "bodyEncoding": ["body"]
842
+ }
843
+ },
844
+ "WidgetNetworkFetchOutput": {
845
+ "title": "WidgetNetworkFetchOutput",
846
+ "type": "object",
847
+ "additionalProperties": false,
848
+ "required": [
849
+ "status",
850
+ "statusText",
851
+ "headers",
852
+ "body",
853
+ "bodyEncoding",
854
+ "finalUrl",
855
+ "redirected"
856
+ ],
857
+ "properties": {
858
+ "status": { "type": "integer", "minimum": 100, "maximum": 599 },
859
+ "statusText": { "type": "string", "maxLength": 256 },
860
+ "headers": { "$ref": "#/$defs/NetworkHeaders" },
861
+ "body": { "type": "string" },
862
+ "bodyEncoding": { "enum": ["utf8", "base64"] },
863
+ "finalUrl": { "type": "string", "minLength": 1, "maxLength": 8192 },
864
+ "redirected": { "type": "boolean" }
865
+ }
866
+ },
867
+ "PresentationCapabilityOutput": {
868
+ "title": "PresentationCapabilityOutput",
869
+ "oneOf": [
870
+ {
871
+ "type": "object",
872
+ "additionalProperties": false,
873
+ "required": ["action", "surface"],
874
+ "properties": {
875
+ "action": { "enum": ["present", "change-surface"] },
876
+ "surface": { "enum": ["workspace", "floating", "overlay"] }
877
+ }
878
+ },
879
+ {
880
+ "type": "object",
881
+ "additionalProperties": false,
882
+ "required": ["action"],
883
+ "properties": {
884
+ "action": { "const": "close" }
885
+ }
886
+ },
887
+ {
888
+ "type": "object",
889
+ "additionalProperties": false,
890
+ "required": ["action", "direction"],
891
+ "properties": {
892
+ "action": { "const": "focus-boundary" },
893
+ "direction": { "enum": ["forward", "backward"] }
894
+ }
895
+ }
896
+ ]
897
+ },
898
+ "PresentationCapabilityResult": {
899
+ "title": "PresentationCapabilityResult",
900
+ "oneOf": [
901
+ {
902
+ "type": "object",
903
+ "additionalProperties": false,
904
+ "required": ["ok", "data"],
905
+ "properties": {
906
+ "ok": { "const": true },
907
+ "data": { "$ref": "#/$defs/PresentationCapabilityOutput" }
908
+ }
909
+ },
910
+ {
911
+ "type": "object",
912
+ "additionalProperties": false,
913
+ "required": ["ok", "reason", "message", "retryable"],
914
+ "properties": {
915
+ "ok": { "const": false },
916
+ "reason": {
917
+ "enum": [
918
+ "unsupported",
919
+ "permission-denied",
920
+ "resource-limit",
921
+ "invalid-reference",
922
+ "timeout",
923
+ "internal-error",
924
+ "network-consent-denied",
925
+ "network-policy-denied",
926
+ "network-transport-unavailable",
927
+ "network-request-too-large",
928
+ "network-response-too-large",
929
+ "network-rate-limited",
930
+ "network-redirect-denied",
931
+ "network-credential-unavailable",
932
+ "network-scope-invalid",
933
+ "network-dns-denied",
934
+ "network-error"
935
+ ]
936
+ },
937
+ "message": { "type": "string", "minLength": 1 },
938
+ "retryable": { "type": "boolean" }
939
+ }
940
+ }
941
+ ]
942
+ },
943
+ "CapabilityResult": {
944
+ "title": "CapabilityResult",
945
+ "oneOf": [
946
+ {
947
+ "type": "object",
948
+ "additionalProperties": false,
949
+ "required": ["ok", "data"],
950
+ "properties": {
951
+ "ok": { "const": true },
952
+ "data": { "$ref": "#/$defs/JsonValue" }
953
+ }
954
+ },
955
+ {
956
+ "type": "object",
957
+ "additionalProperties": false,
958
+ "required": ["ok", "reason", "message", "retryable"],
959
+ "properties": {
960
+ "ok": { "const": false },
961
+ "reason": {
962
+ "enum": [
963
+ "unsupported",
964
+ "permission-denied",
965
+ "resource-limit",
966
+ "invalid-reference",
967
+ "timeout",
968
+ "internal-error",
969
+ "network-consent-denied",
970
+ "network-policy-denied",
971
+ "network-transport-unavailable",
972
+ "network-request-too-large",
973
+ "network-response-too-large",
974
+ "network-rate-limited",
975
+ "network-redirect-denied",
976
+ "network-credential-unavailable",
977
+ "network-scope-invalid",
978
+ "network-dns-denied",
979
+ "network-error"
980
+ ]
981
+ },
982
+ "message": { "type": "string", "minLength": 1 },
983
+ "retryable": { "type": "boolean" }
984
+ }
985
+ }
986
+ ]
987
+ },
988
+ "WidgetError": {
989
+ "title": "WidgetError",
990
+ "type": "object",
991
+ "additionalProperties": false,
992
+ "required": ["code", "phase", "message", "retryable", "correlationId"],
993
+ "properties": {
994
+ "code": {
995
+ "enum": [
996
+ "BUNDLE_LOAD_FAILED",
997
+ "DIGEST_MISMATCH",
998
+ "RUNTIME_CONFIG_EXPIRED",
999
+ "WIDGET_VERSION_REVOKED",
1000
+ "HOST_API_UNSUPPORTED",
1001
+ "HANDSHAKE_TIMEOUT",
1002
+ "MESSAGE_INVALID",
1003
+ "CHANNEL_MISMATCH",
1004
+ "MESSAGE_TOO_LARGE",
1005
+ "MESSAGE_RATE_LIMITED",
1006
+ "TOO_MANY_PENDING_REQUESTS",
1007
+ "CAPABILITY_UNDECLARED",
1008
+ "CAPABILITY_DENIED",
1009
+ "CAPABILITY_UNSUPPORTED",
1010
+ "CAPABILITY_TIMEOUT",
1011
+ "FILE_REFERENCE_INVALID",
1012
+ "FILE_PERMISSION_DENIED",
1013
+ "RESOURCE_LIMIT",
1014
+ "RENDER_FAILED",
1015
+ "UPDATE_FAILED",
1016
+ "WIDGET_CRASHED",
1017
+ "INSTANCE_DISPOSED"
1018
+ ]
1019
+ },
1020
+ "phase": {
1021
+ "enum": [
1022
+ "load",
1023
+ "handshake",
1024
+ "render",
1025
+ "update",
1026
+ "capability",
1027
+ "dispose"
1028
+ ]
1029
+ },
1030
+ "message": { "type": "string", "minLength": 1 },
1031
+ "retryable": { "type": "boolean" },
1032
+ "correlationId": { "type": "string", "minLength": 1 }
1033
+ }
1034
+ },
1035
+ "ResourceBudget": {
1036
+ "title": "ResourceBudget",
1037
+ "type": "object",
1038
+ "additionalProperties": false,
1039
+ "required": [
1040
+ "version",
1041
+ "bundle",
1042
+ "bridge",
1043
+ "files",
1044
+ "timeouts",
1045
+ "concurrency",
1046
+ "retry",
1047
+ "failure"
1048
+ ],
1049
+ "properties": {
1050
+ "version": { "const": 1 },
1051
+ "bundle": {
1052
+ "type": "object",
1053
+ "additionalProperties": false,
1054
+ "required": [
1055
+ "compressedBytes",
1056
+ "expandedBytes",
1057
+ "fileCount",
1058
+ "singleFileBytes"
1059
+ ],
1060
+ "properties": {
1061
+ "compressedBytes": { "type": "integer", "minimum": 1 },
1062
+ "expandedBytes": { "type": "integer", "minimum": 1 },
1063
+ "fileCount": { "type": "integer", "minimum": 1 },
1064
+ "singleFileBytes": { "type": "integer", "minimum": 1 }
1065
+ }
1066
+ },
1067
+ "bridge": {
1068
+ "type": "object",
1069
+ "additionalProperties": false,
1070
+ "required": [
1071
+ "messageBytes",
1072
+ "messagesPerSecond",
1073
+ "pendingRequests"
1074
+ ],
1075
+ "properties": {
1076
+ "messageBytes": { "type": "integer", "minimum": 1 },
1077
+ "messagesPerSecond": { "type": "integer", "minimum": 1 },
1078
+ "pendingRequests": { "type": "integer", "minimum": 1 }
1079
+ }
1080
+ },
1081
+ "files": {
1082
+ "type": "object",
1083
+ "additionalProperties": false,
1084
+ "required": [
1085
+ "readBytesPerRequest",
1086
+ "readBytesPerRun",
1087
+ "callsPerMinute",
1088
+ "listPageSize"
1089
+ ],
1090
+ "properties": {
1091
+ "readBytesPerRequest": { "type": "integer", "minimum": 1 },
1092
+ "readBytesPerRun": { "type": "integer", "minimum": 1 },
1093
+ "callsPerMinute": { "type": "integer", "minimum": 1 },
1094
+ "listPageSize": { "type": "integer", "minimum": 1 }
1095
+ }
1096
+ },
1097
+ "timeouts": {
1098
+ "type": "object",
1099
+ "additionalProperties": false,
1100
+ "required": [
1101
+ "bundleLoadMs",
1102
+ "handshakeMs",
1103
+ "firstRenderMs",
1104
+ "updateMs",
1105
+ "capabilityMs",
1106
+ "disposeGraceMs"
1107
+ ],
1108
+ "properties": {
1109
+ "bundleLoadMs": { "type": "integer", "minimum": 1 },
1110
+ "handshakeMs": { "type": "integer", "minimum": 1 },
1111
+ "firstRenderMs": { "type": "integer", "minimum": 1 },
1112
+ "updateMs": { "type": "integer", "minimum": 1 },
1113
+ "capabilityMs": { "type": "integer", "minimum": 1 },
1114
+ "disposeGraceMs": { "type": "integer", "minimum": 1 }
1115
+ }
1116
+ },
1117
+ "concurrency": {
1118
+ "type": "object",
1119
+ "additionalProperties": false,
1120
+ "required": [
1121
+ "activeIframesPerPage",
1122
+ "activeIframesPerRun",
1123
+ "hiddenRecycleMs"
1124
+ ],
1125
+ "properties": {
1126
+ "activeIframesPerPage": { "type": "integer", "minimum": 1 },
1127
+ "activeIframesPerRun": { "type": "integer", "minimum": 1 },
1128
+ "hiddenRecycleMs": { "type": "integer", "minimum": 1 }
1129
+ }
1130
+ },
1131
+ "retry": {
1132
+ "type": "object",
1133
+ "additionalProperties": false,
1134
+ "required": [
1135
+ "maxAttempts",
1136
+ "initialDelayMs",
1137
+ "maxDelayMs",
1138
+ "totalMs"
1139
+ ],
1140
+ "properties": {
1141
+ "maxAttempts": { "type": "integer", "minimum": 1 },
1142
+ "initialDelayMs": { "type": "integer", "minimum": 1 },
1143
+ "maxDelayMs": { "type": "integer", "minimum": 1 },
1144
+ "totalMs": { "type": "integer", "minimum": 1 }
1145
+ }
1146
+ },
1147
+ "failure": {
1148
+ "type": "object",
1149
+ "additionalProperties": false,
1150
+ "required": ["consecutiveFailures", "windowMs"],
1151
+ "properties": {
1152
+ "consecutiveFailures": { "type": "integer", "minimum": 1 },
1153
+ "windowMs": { "type": "integer", "minimum": 1 }
1154
+ }
1155
+ }
1156
+ }
1157
+ },
1158
+ "InitPayload": {
1159
+ "title": "InitPayload",
1160
+ "type": "object",
1161
+ "additionalProperties": false,
1162
+ "required": [
1163
+ "instanceId",
1164
+ "locale",
1165
+ "theme",
1166
+ "capabilities",
1167
+ "resourceBudget"
1168
+ ],
1169
+ "properties": {
1170
+ "instanceId": { "type": "string", "minLength": 1 },
1171
+ "locale": { "type": "string", "minLength": 1 },
1172
+ "theme": { "$ref": "#/$defs/Theme" },
1173
+ "capabilities": {
1174
+ "type": "array",
1175
+ "items": { "$ref": "#/$defs/GrantedCapability" }
1176
+ },
1177
+ "resourceBudget": { "$ref": "#/$defs/ResourceBudget" }
1178
+ }
1179
+ },
1180
+ "BridgeEnvelopeBase": {
1181
+ "title": "BridgeEnvelopeBase",
1182
+ "type": "object",
1183
+ "required": ["protocolVersion", "channelId", "messageId", "sequence"],
1184
+ "properties": {
1185
+ "protocolVersion": { "const": 1 },
1186
+ "channelId": { "type": "string", "minLength": 16 },
1187
+ "messageId": { "type": "string", "minLength": 1 },
1188
+ "sequence": { "type": "integer", "minimum": 1 }
1189
+ }
1190
+ },
1191
+ "InitMessage": {
1192
+ "title": "InitMessage",
1193
+ "type": "object",
1194
+ "allOf": [
1195
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1196
+ {
1197
+ "type": "object",
1198
+ "required": ["type", "payload"],
1199
+ "properties": {
1200
+ "type": { "const": "init" },
1201
+ "payload": { "$ref": "#/$defs/InitPayload" }
1202
+ }
1203
+ }
1204
+ ],
1205
+ "unevaluatedProperties": false
1206
+ },
1207
+ "RenderMessage": {
1208
+ "title": "RenderMessage",
1209
+ "type": "object",
1210
+ "allOf": [
1211
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1212
+ {
1213
+ "type": "object",
1214
+ "required": ["type", "payload"],
1215
+ "properties": {
1216
+ "type": { "enum": ["render", "update"] },
1217
+ "payload": { "$ref": "#/$defs/RenderRequest" }
1218
+ }
1219
+ }
1220
+ ],
1221
+ "unevaluatedProperties": false
1222
+ },
1223
+ "CapabilityResultMessage": {
1224
+ "title": "CapabilityResultMessage",
1225
+ "type": "object",
1226
+ "allOf": [
1227
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1228
+ {
1229
+ "type": "object",
1230
+ "required": ["type", "payload"],
1231
+ "properties": {
1232
+ "type": { "const": "capability-result" },
1233
+ "payload": {
1234
+ "type": "object",
1235
+ "additionalProperties": false,
1236
+ "required": ["requestId", "result"],
1237
+ "properties": {
1238
+ "requestId": { "type": "string", "minLength": 1 },
1239
+ "result": { "$ref": "#/$defs/CapabilityResult" }
1240
+ }
1241
+ }
1242
+ }
1243
+ }
1244
+ ],
1245
+ "unevaluatedProperties": false
1246
+ },
1247
+ "ErrorMessage": {
1248
+ "title": "ErrorMessage",
1249
+ "type": "object",
1250
+ "allOf": [
1251
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1252
+ {
1253
+ "type": "object",
1254
+ "required": ["type", "payload"],
1255
+ "properties": {
1256
+ "type": { "const": "error" },
1257
+ "payload": { "$ref": "#/$defs/WidgetError" }
1258
+ }
1259
+ }
1260
+ ],
1261
+ "unevaluatedProperties": false
1262
+ },
1263
+ "DisposeMessage": {
1264
+ "title": "DisposeMessage",
1265
+ "type": "object",
1266
+ "allOf": [
1267
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1268
+ {
1269
+ "type": "object",
1270
+ "required": ["type", "payload"],
1271
+ "properties": {
1272
+ "type": { "const": "dispose" },
1273
+ "payload": {
1274
+ "type": "object",
1275
+ "additionalProperties": false,
1276
+ "required": ["reason", "deadlineMs"],
1277
+ "properties": {
1278
+ "reason": { "type": "string", "minLength": 1 },
1279
+ "deadlineMs": { "type": "integer", "minimum": 1 }
1280
+ }
1281
+ }
1282
+ }
1283
+ }
1284
+ ],
1285
+ "unevaluatedProperties": false
1286
+ },
1287
+ "ReadyMessage": {
1288
+ "title": "ReadyMessage",
1289
+ "type": "object",
1290
+ "allOf": [
1291
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1292
+ {
1293
+ "type": "object",
1294
+ "required": ["type", "payload"],
1295
+ "properties": {
1296
+ "type": { "const": "ready" },
1297
+ "payload": {
1298
+ "type": "object",
1299
+ "additionalProperties": false,
1300
+ "required": ["widgetSdkVersion", "hostApiVersion"],
1301
+ "properties": {
1302
+ "widgetSdkVersion": { "type": "string", "minLength": 1 },
1303
+ "hostApiVersion": { "const": 1 }
1304
+ }
1305
+ }
1306
+ }
1307
+ }
1308
+ ],
1309
+ "unevaluatedProperties": false
1310
+ },
1311
+ "ResizeMessage": {
1312
+ "title": "ResizeMessage",
1313
+ "type": "object",
1314
+ "allOf": [
1315
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1316
+ {
1317
+ "type": "object",
1318
+ "required": ["type", "payload"],
1319
+ "properties": {
1320
+ "type": { "const": "resize" },
1321
+ "payload": {
1322
+ "type": "object",
1323
+ "additionalProperties": false,
1324
+ "required": ["width", "height"],
1325
+ "properties": {
1326
+ "width": { "type": "number", "minimum": 0 },
1327
+ "height": { "type": "number", "minimum": 0 }
1328
+ }
1329
+ }
1330
+ }
1331
+ }
1332
+ ],
1333
+ "unevaluatedProperties": false
1334
+ },
1335
+ "CapabilityRequestMessage": {
1336
+ "title": "CapabilityRequestMessage",
1337
+ "type": "object",
1338
+ "allOf": [
1339
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1340
+ {
1341
+ "type": "object",
1342
+ "required": ["type", "payload"],
1343
+ "properties": {
1344
+ "type": { "const": "capability-request" },
1345
+ "payload": {
1346
+ "type": "object",
1347
+ "additionalProperties": false,
1348
+ "required": ["requestId", "request"],
1349
+ "properties": {
1350
+ "requestId": { "type": "string", "minLength": 1 },
1351
+ "request": { "$ref": "#/$defs/CapabilityRequest" }
1352
+ }
1353
+ }
1354
+ }
1355
+ }
1356
+ ],
1357
+ "unevaluatedProperties": false
1358
+ },
1359
+ "HostToWidgetMessage": {
1360
+ "title": "HostToWidgetMessage",
1361
+ "oneOf": [
1362
+ { "$ref": "#/$defs/InitMessage" },
1363
+ { "$ref": "#/$defs/RenderMessage" },
1364
+ { "$ref": "#/$defs/CapabilityResultMessage" },
1365
+ { "$ref": "#/$defs/ErrorMessage" },
1366
+ { "$ref": "#/$defs/DisposeMessage" }
1367
+ ]
1368
+ },
1369
+ "WidgetToHostMessage": {
1370
+ "title": "WidgetToHostMessage",
1371
+ "oneOf": [
1372
+ { "$ref": "#/$defs/ReadyMessage" },
1373
+ { "$ref": "#/$defs/ResizeMessage" },
1374
+ { "$ref": "#/$defs/CapabilityRequestMessage" },
1375
+ { "$ref": "#/$defs/ErrorMessage" }
1376
+ ]
1377
+ },
1378
+ "WidgetEvent": {
1379
+ "type": "object",
1380
+ "additionalProperties": false,
1381
+ "required": [
1382
+ "id",
1383
+ "type",
1384
+ "payload"
1385
+ ],
1386
+ "properties": {
1387
+ "id": {
1388
+ "type": "string",
1389
+ "minLength": 1,
1390
+ "maxLength": 256
1391
+ },
1392
+ "type": {
1393
+ "type": "string",
1394
+ "minLength": 1,
1395
+ "maxLength": 128,
1396
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
1397
+ },
1398
+ "payload": {
1399
+ "$ref": "#/$defs/JsonValue"
1400
+ }
1401
+ }
1402
+ },
1403
+ "WidgetEventBatch": {
1404
+ "type": "object",
1405
+ "additionalProperties": false,
1406
+ "required": [
1407
+ "schemaVersion",
1408
+ "topic",
1409
+ "cursor",
1410
+ "reset",
1411
+ "hasMore",
1412
+ "events"
1413
+ ],
1414
+ "properties": {
1415
+ "schemaVersion": {
1416
+ "const": 1
1417
+ },
1418
+ "topic": {
1419
+ "type": "string",
1420
+ "minLength": 1,
1421
+ "maxLength": 128,
1422
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
1423
+ },
1424
+ "cursor": {
1425
+ "type": "string",
1426
+ "minLength": 1,
1427
+ "maxLength": 256
1428
+ },
1429
+ "reset": {
1430
+ "type": "boolean"
1431
+ },
1432
+ "hasMore": {
1433
+ "type": "boolean"
1434
+ },
1435
+ "events": {
1436
+ "type": "array",
1437
+ "maxItems": 100,
1438
+ "items": {
1439
+ "$ref": "#/$defs/WidgetEvent"
1440
+ }
1441
+ },
1442
+ "snapshot": {
1443
+ "$ref": "#/$defs/JsonValue"
1444
+ }
1445
+ }
1446
+ },
1447
+ "ToolLifecycleEvent": {
1448
+ "type": "object",
1449
+ "additionalProperties": false,
1450
+ "required": [
1451
+ "toolCallId",
1452
+ "toolName",
1453
+ "phase"
1454
+ ],
1455
+ "properties": {
1456
+ "toolCallId": {
1457
+ "type": "string",
1458
+ "minLength": 1,
1459
+ "maxLength": 256
1460
+ },
1461
+ "toolName": {
1462
+ "type": "string",
1463
+ "minLength": 1,
1464
+ "maxLength": 128,
1465
+ "pattern": "^[A-Za-z0-9_.:-]+$"
1466
+ },
1467
+ "phase": {
1468
+ "enum": [
1469
+ "started",
1470
+ "completed",
1471
+ "failed",
1472
+ "cancelled"
1473
+ ]
1474
+ }
1475
+ }
1476
+ }
1477
+ }
1478
+ }