@dp-bohrium/widget-cli 0.1.0 → 0.2.0

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.
@@ -0,0 +1,2725 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "widget-runtime-contracts.schema.json",
4
+ "description": "Runtime 契约的汇总根容器;仅用于代码生成与符合性校验,不直接对外签发。",
5
+ "title": "Widget Runtime Contracts",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "widgetContributionKind",
10
+ "renderRequest",
11
+ "hostToWidgetMessage",
12
+ "widgetToHostMessage",
13
+ "capabilityRequest",
14
+ "capabilityResult",
15
+ "widgetError",
16
+ "resourceBudget"
17
+ ],
18
+ "properties": {
19
+ "widgetContributionKind": {
20
+ "$ref": "#/$defs/WidgetContributionKind"
21
+ },
22
+ "renderRequest": {
23
+ "$ref": "#/$defs/RenderRequest"
24
+ },
25
+ "hostToWidgetMessage": {
26
+ "$ref": "#/$defs/HostToWidgetMessage"
27
+ },
28
+ "widgetToHostMessage": {
29
+ "$ref": "#/$defs/WidgetToHostMessage"
30
+ },
31
+ "capabilityRequest": {
32
+ "$ref": "#/$defs/CapabilityRequest"
33
+ },
34
+ "capabilityResult": {
35
+ "$ref": "#/$defs/CapabilityResult"
36
+ },
37
+ "widgetError": {
38
+ "$ref": "#/$defs/WidgetError"
39
+ },
40
+ "resourceBudget": {
41
+ "$ref": "#/$defs/ResourceBudget"
42
+ },
43
+ "widgetEventBatch": {
44
+ "$ref": "#/$defs/WidgetEventBatch"
45
+ },
46
+ "toolLifecycleEvent": {
47
+ "$ref": "#/$defs/ToolLifecycleEvent"
48
+ },
49
+ "publicWidgetEvent": {
50
+ "$ref": "#/$defs/PublicWidgetEvent"
51
+ },
52
+ "widgetLiveEvent": {
53
+ "$ref": "#/$defs/WidgetLiveEvent"
54
+ },
55
+ "publicWidgetEventTopic": {
56
+ "$ref": "#/$defs/PublicWidgetEventTopic"
57
+ },
58
+ "widgetNetworkFetchOutput": {
59
+ "$ref": "#/$defs/WidgetNetworkFetchOutput"
60
+ },
61
+ "presentationCapabilityOutput": {
62
+ "$ref": "#/$defs/PresentationCapabilityOutput"
63
+ },
64
+ "presentationCapabilityResult": {
65
+ "$ref": "#/$defs/PresentationCapabilityResult"
66
+ },
67
+ "regionCapabilityResult": {
68
+ "$ref": "#/$defs/RegionCapabilityResult"
69
+ },
70
+ "fileDownloadResult": {
71
+ "$ref": "#/$defs/FileDownloadResult"
72
+ },
73
+ "fileReadResult": { "$ref": "#/$defs/FileReadResult" },
74
+ "fileWriteResult": { "$ref": "#/$defs/FileWriteResult" },
75
+ "taskObservationSnapshot": {
76
+ "$ref": "#/$defs/TaskObservationSnapshot"
77
+ },
78
+ "taskObservationEvent": {
79
+ "$ref": "#/$defs/TaskObservationEvent"
80
+ },
81
+ "taskObservationBatch": {
82
+ "$ref": "#/$defs/TaskObservationBatch"
83
+ },
84
+ "toolResultEnvelope": {
85
+ "$ref": "#/$defs/ToolResultEnvelope"
86
+ },
87
+ "uiStateResult": {
88
+ "$ref": "#/$defs/UiStateResult"
89
+ },
90
+ "uiStateWriteResult": {
91
+ "$ref": "#/$defs/UiStateWriteResult"
92
+ },
93
+ "hostUserService": {
94
+ "$ref": "#/$defs/HostUserService"
95
+ },
96
+ "hostUserAction": {
97
+ "$ref": "#/$defs/HostUserAction"
98
+ },
99
+ "hostUserProfileReadInput": {
100
+ "$ref": "#/$defs/HostUserProfileReadInput"
101
+ },
102
+ "hostUserProfileReadOutput": {
103
+ "$ref": "#/$defs/HostUserProfileReadOutput"
104
+ },
105
+ "hostUserEmailReadInput": {
106
+ "$ref": "#/$defs/HostUserEmailReadInput"
107
+ },
108
+ "hostUserEmailReadOutput": {
109
+ "$ref": "#/$defs/HostUserEmailReadOutput"
110
+ },
111
+ "hostUserServiceRequest": {
112
+ "$ref": "#/$defs/HostUserServiceRequest"
113
+ }
114
+ },
115
+ "$defs": {
116
+ "JsonValue": {
117
+ "description": "可序列化为 JSON 的任意值;null / boolean / number / string / 数组 / 对象的递归联合。",
118
+ "title": "JsonValue",
119
+ "oneOf": [
120
+ { "type": "null" },
121
+ { "type": "boolean" },
122
+ { "type": "number" },
123
+ { "type": "string" },
124
+ { "type": "array", "items": { "$ref": "#/$defs/JsonValue" } },
125
+ {
126
+ "type": "object",
127
+ "additionalProperties": { "$ref": "#/$defs/JsonValue" }
128
+ }
129
+ ]
130
+ },
131
+ "HostUserPermission": {
132
+ "description": "Host 用户数据权限名:个人资料或邮箱读取。",
133
+ "title": "HostUserPermission",
134
+ "enum": ["host.user.profile.read", "host.user.email.read"]
135
+ },
136
+ "HostUserService": {
137
+ "description": "Host 用户服务标识;固定为 host.user。",
138
+ "title": "HostUserService",
139
+ "const": "host.user"
140
+ },
141
+ "HostUserAction": {
142
+ "description": "Host 用户服务下的具体动作:个人资料或邮箱读取。",
143
+ "title": "HostUserAction",
144
+ "enum": ["profile.read", "email.read"]
145
+ },
146
+ "HostUserProfileReadInput": {
147
+ "description": "读取用户资料的请求输入;当前无需额外参数(null)。",
148
+ "title": "HostUserProfileReadInput",
149
+ "type": "null"
150
+ },
151
+ "HostUserProfileReadOutput": {
152
+ "description": "读取用户资料的结果;含稳定 userId 与展示名。",
153
+ "title": "HostUserProfileReadOutput",
154
+ "type": "object",
155
+ "additionalProperties": false,
156
+ "required": ["userId", "displayName"],
157
+ "properties": {
158
+ "userId": { "type": "string", "minLength": 1 },
159
+ "displayName": { "type": "string", "minLength": 1 }
160
+ }
161
+ },
162
+ "HostUserEmailReadInput": {
163
+ "description": "读取用户邮箱的请求输入;当前无需额外参数(null)。",
164
+ "title": "HostUserEmailReadInput",
165
+ "type": "null"
166
+ },
167
+ "HostUserEmailReadOutput": {
168
+ "description": "读取用户邮箱的结果;email 为地址或 null。",
169
+ "title": "HostUserEmailReadOutput",
170
+ "type": "object",
171
+ "additionalProperties": false,
172
+ "required": ["email"],
173
+ "properties": {
174
+ "email": {
175
+ "oneOf": [
176
+ { "type": "string", "minLength": 3, "maxLength": 320 },
177
+ { "type": "null" }
178
+ ]
179
+ }
180
+ }
181
+ },
182
+ "HostUserServiceRequest": {
183
+ "description": "Host 用户服务请求;以 action 判别资料或邮箱读取。",
184
+ "title": "HostUserServiceRequest",
185
+ "oneOf": [
186
+ {
187
+ "type": "object",
188
+ "additionalProperties": false,
189
+ "required": ["service", "action", "payload"],
190
+ "properties": {
191
+ "service": { "$ref": "#/$defs/HostUserService" },
192
+ "action": { "const": "profile.read" },
193
+ "payload": { "$ref": "#/$defs/HostUserProfileReadInput" }
194
+ }
195
+ },
196
+ {
197
+ "type": "object",
198
+ "additionalProperties": false,
199
+ "required": ["service", "action", "payload"],
200
+ "properties": {
201
+ "service": { "$ref": "#/$defs/HostUserService" },
202
+ "action": { "const": "email.read" },
203
+ "payload": { "$ref": "#/$defs/HostUserEmailReadInput" }
204
+ }
205
+ }
206
+ ]
207
+ },
208
+ "WidgetServicePermission": {
209
+ "description": "单条服务权限:服务名 + 允许的动作列表。",
210
+ "title": "WidgetServicePermission",
211
+ "type": "object",
212
+ "additionalProperties": false,
213
+ "required": ["service", "actions"],
214
+ "properties": {
215
+ "service": {
216
+ "type": "string",
217
+ "minLength": 1,
218
+ "maxLength": 128,
219
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
220
+ },
221
+ "actions": {
222
+ "type": "array",
223
+ "minItems": 1,
224
+ "maxItems": 32,
225
+ "uniqueItems": true,
226
+ "items": {
227
+ "type": "string",
228
+ "minLength": 1,
229
+ "maxLength": 128,
230
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
231
+ }
232
+ }
233
+ }
234
+ },
235
+ "WidgetServicePermissions": {
236
+ "description": "服务权限列表。",
237
+ "title": "WidgetServicePermissions",
238
+ "type": "array",
239
+ "minItems": 1,
240
+ "maxItems": 32,
241
+ "uniqueItems": true,
242
+ "items": { "$ref": "#/$defs/WidgetServicePermission" }
243
+ },
244
+ "WidgetContributionKind": {
245
+ "description": "Runtime 内部枚举;Forge 外部 Manifest 可声明的 Surface 仅为 file-preview 与 panel。tool-result 仅供受信任的内部 Host、Agent 事件与协议验证,不得作为外部作者 Contribution。",
246
+ "title": "WidgetContributionKind",
247
+ "enum": ["tool-result", "file-preview", "panel"]
248
+ },
249
+ "RenderState": {
250
+ "description": "渲染状态:loading / partial / complete / error。",
251
+ "title": "RenderState",
252
+ "enum": ["loading", "partial", "complete", "error"]
253
+ },
254
+ "ThemeMode": {
255
+ "description": "主题模式:light 或 dark。",
256
+ "title": "ThemeMode",
257
+ "enum": ["light", "dark"]
258
+ },
259
+ "Theme": {
260
+ "description": "渲染上下文中的主题:mode 与设计令牌表。",
261
+ "title": "Theme",
262
+ "type": "object",
263
+ "additionalProperties": false,
264
+ "required": ["mode", "tokens"],
265
+ "properties": {
266
+ "mode": { "$ref": "#/$defs/ThemeMode" },
267
+ "tokens": {
268
+ "type": "object",
269
+ "additionalProperties": false,
270
+ "required": [
271
+ "background",
272
+ "foreground",
273
+ "muted",
274
+ "mutedForeground",
275
+ "border",
276
+ "primary",
277
+ "danger"
278
+ ],
279
+ "properties": {
280
+ "background": { "type": "string", "minLength": 1 },
281
+ "foreground": { "type": "string", "minLength": 1 },
282
+ "muted": { "type": "string", "minLength": 1 },
283
+ "mutedForeground": { "type": "string", "minLength": 1 },
284
+ "border": { "type": "string", "minLength": 1 },
285
+ "primary": { "type": "string", "minLength": 1 },
286
+ "danger": { "type": "string", "minLength": 1 }
287
+ }
288
+ }
289
+ }
290
+ },
291
+ "FileReference": {
292
+ "description": "Host 签发的文件引用;仅含不透明 id、可选内容版本和展示元数据。引用本身不授予写权限,不含路径或 URL。",
293
+ "title": "FileReference",
294
+ "type": "object",
295
+ "additionalProperties": false,
296
+ "required": ["id", "kind", "name"],
297
+ "properties": {
298
+ "id": { "type": "string", "minLength": 1 },
299
+ "kind": { "enum": ["file", "directory"] },
300
+ "name": { "type": "string", "minLength": 1 },
301
+ "extension": {
302
+ "type": "string",
303
+ "pattern": "^[a-z0-9][a-z0-9.-]*$",
304
+ "maxLength": 32
305
+ },
306
+ "mimeType": { "type": "string", "minLength": 1, "maxLength": 255 },
307
+ "size": { "type": "integer", "minimum": 0 },
308
+ "revision": { "$ref": "#/$defs/FileRevision" }
309
+ }
310
+ },
311
+ "FileRevision": {
312
+ "description": "由存储执行端签发的文件内容版本,用于条件读取和保存;不是 RenderRequest.revision。",
313
+ "title": "FileRevision",
314
+ "type": "string",
315
+ "minLength": 1,
316
+ "maxLength": 256
317
+ },
318
+ "FileMutationId": {
319
+ "description": "一次逻辑保存的稳定标识;重试或确认结果时必须复用,相同标识不得提交不同内容。",
320
+ "title": "FileMutationId",
321
+ "type": "string",
322
+ "minLength": 1,
323
+ "maxLength": 128,
324
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
325
+ },
326
+ "FileReadInput": {
327
+ "description": "分块读取已授权文件;后续分块应携带首块返回的 expectedRevision,防止拼接不同版本。",
328
+ "title": "FileReadInput",
329
+ "type": "object",
330
+ "additionalProperties": false,
331
+ "required": ["file", "offset", "length", "encoding"],
332
+ "properties": {
333
+ "file": { "$ref": "#/$defs/FileReference" },
334
+ "offset": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
335
+ "length": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
336
+ "encoding": { "enum": ["utf8", "base64"] },
337
+ "expectedRevision": { "$ref": "#/$defs/FileRevision" }
338
+ }
339
+ },
340
+ "FileReadResult": {
341
+ "description": "文件读取结果;普通读取只要求内容与编码,原有游标和截断信息按 Host 能力返回。revision 可选且必须与本次读取的内容属于同一快照;请求 expectedRevision 时必须返回匹配版本。缺少 revision 的结果仅用于只读展示,不能据此条件保存。提供字节游标时 nextOffset 等于请求 offset + bytesRead,不按字符串长度计数。",
342
+ "title": "FileReadResult",
343
+ "type": "object",
344
+ "additionalProperties": false,
345
+ "required": ["content", "encoding"],
346
+ "properties": {
347
+ "content": { "type": "string" },
348
+ "encoding": { "enum": ["utf8", "base64"] },
349
+ "offset": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
350
+ "bytesRead": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
351
+ "nextOffset": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
352
+ "eof": { "type": "boolean" },
353
+ "truncated": { "type": "boolean" },
354
+ "revision": { "$ref": "#/$defs/FileRevision" }
355
+ }
356
+ },
357
+ "FileWriteInput": {
358
+ "description": "按 Host 授权范围对已有文件作整文件条件替换;Host 校验引用、作用域、权限和实际字节预算。超时不表示未写入,使用同一 mutationId 核对结果。",
359
+ "title": "FileWriteInput",
360
+ "type": "object",
361
+ "additionalProperties": false,
362
+ "required": ["file", "content", "encoding", "expectedRevision", "mutationId"],
363
+ "properties": {
364
+ "file": { "$ref": "#/$defs/FileReference" },
365
+ "content": { "type": "string" },
366
+ "encoding": { "enum": ["utf8", "base64"] },
367
+ "expectedRevision": { "$ref": "#/$defs/FileRevision" },
368
+ "mutationId": { "$ref": "#/$defs/FileMutationId" }
369
+ }
370
+ },
371
+ "FileWriteResult": {
372
+ "description": "执行端已确认持久化的保存回执;file.id 保持原文件引用身份,revision 是新内容版本。",
373
+ "title": "FileWriteResult",
374
+ "type": "object",
375
+ "additionalProperties": false,
376
+ "required": ["file", "revision", "bytesWritten", "mutationId"],
377
+ "properties": {
378
+ "file": { "$ref": "#/$defs/FileReference" },
379
+ "revision": { "$ref": "#/$defs/FileRevision" },
380
+ "bytesWritten": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
381
+ "mutationId": { "$ref": "#/$defs/FileMutationId" }
382
+ }
383
+ },
384
+ "FileDownloadResult": {
385
+ "description": "文件下载保存意图的结果:saved / started / cancelled。",
386
+ "title": "FileDownloadResult",
387
+ "type": "object",
388
+ "additionalProperties": false,
389
+ "required": ["status"],
390
+ "properties": {
391
+ "status": {
392
+ "enum": ["saved", "started", "cancelled"]
393
+ }
394
+ }
395
+ },
396
+ "TaskObservationSnapshot": {
397
+ "description": "任务观察的当前快照:taskId、status 与 updatedAt;progress、message 可选。",
398
+ "title": "TaskObservationSnapshot",
399
+ "type": "object",
400
+ "additionalProperties": false,
401
+ "required": ["taskId", "status", "updatedAt"],
402
+ "properties": {
403
+ "taskId": {
404
+ "type": "string",
405
+ "minLength": 1,
406
+ "maxLength": 256
407
+ },
408
+ "status": {
409
+ "enum": ["queued", "running", "succeeded", "failed", "cancelled", "expired"]
410
+ },
411
+ "progress": {
412
+ "type": "number",
413
+ "minimum": 0,
414
+ "maximum": 1
415
+ },
416
+ "message": {
417
+ "type": "string",
418
+ "maxLength": 1024
419
+ },
420
+ "updatedAt": {
421
+ "type": "string",
422
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
423
+ }
424
+ }
425
+ },
426
+ "TaskObservationEvent": {
427
+ "description": "任务观察流中的单条事件;payload 由服务端裁剪。",
428
+ "title": "TaskObservationEvent",
429
+ "type": "object",
430
+ "additionalProperties": false,
431
+ "required": ["id", "type", "occurredAt", "payload"],
432
+ "properties": {
433
+ "id": {
434
+ "type": "string",
435
+ "minLength": 1,
436
+ "maxLength": 256
437
+ },
438
+ "type": {
439
+ "enum": ["started", "progress", "succeeded", "failed", "cancelled", "expired"]
440
+ },
441
+ "occurredAt": {
442
+ "type": "string",
443
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
444
+ },
445
+ "payload": {
446
+ "$ref": "#/$defs/JsonValue"
447
+ }
448
+ }
449
+ },
450
+ "TaskObservationBatch": {
451
+ "description": "任务观察的一页结果:快照 + 有限事件页 + 游标。",
452
+ "title": "TaskObservationBatch",
453
+ "type": "object",
454
+ "additionalProperties": false,
455
+ "required": ["schemaVersion", "taskId", "cursor", "reset", "hasMore", "snapshot", "events"],
456
+ "properties": {
457
+ "schemaVersion": { "const": 1 },
458
+ "taskId": {
459
+ "type": "string",
460
+ "minLength": 1,
461
+ "maxLength": 256
462
+ },
463
+ "cursor": {
464
+ "type": "string",
465
+ "minLength": 1,
466
+ "maxLength": 256
467
+ },
468
+ "reset": { "type": "boolean" },
469
+ "hasMore": { "type": "boolean" },
470
+ "snapshot": { "$ref": "#/$defs/TaskObservationSnapshot" },
471
+ "events": {
472
+ "type": "array",
473
+ "maxItems": 100,
474
+ "items": { "$ref": "#/$defs/TaskObservationEvent" }
475
+ }
476
+ }
477
+ },
478
+ "ToolResultMetric": {
479
+ "description": "工具结果中的单个指标。",
480
+ "title": "ToolResultMetric",
481
+ "type": "object",
482
+ "additionalProperties": false,
483
+ "required": ["name", "value"],
484
+ "properties": {
485
+ "name": { "type": "string", "minLength": 1, "maxLength": 128 },
486
+ "value": { "type": "number" },
487
+ "unit": { "type": "string", "maxLength": 64 },
488
+ "label": { "type": "string", "maxLength": 128 }
489
+ }
490
+ },
491
+ "ToolResultArtifact": {
492
+ "description": "工具结果中的产物元数据,不含内容本身。",
493
+ "title": "ToolResultArtifact",
494
+ "type": "object",
495
+ "additionalProperties": false,
496
+ "required": ["id", "name"],
497
+ "properties": {
498
+ "id": { "type": "string", "minLength": 1, "maxLength": 256 },
499
+ "name": { "type": "string", "minLength": 1, "maxLength": 255 },
500
+ "kind": { "enum": ["file", "directory"] },
501
+ "mimeType": { "type": "string", "minLength": 1, "maxLength": 255 },
502
+ "size": { "type": "integer", "minimum": 0 },
503
+ "downloadable": { "type": "boolean" }
504
+ }
505
+ },
506
+ "ToolResultProvenance": {
507
+ "description": "工具结果的来源信息。",
508
+ "title": "ToolResultProvenance",
509
+ "type": "object",
510
+ "additionalProperties": false,
511
+ "required": ["source"],
512
+ "properties": {
513
+ "source": { "type": "string", "minLength": 1, "maxLength": 256 },
514
+ "kind": { "type": "string", "minLength": 1, "maxLength": 64 },
515
+ "label": { "type": "string", "maxLength": 256 }
516
+ }
517
+ },
518
+ "ToolResultNotice": {
519
+ "description": "工具结果中的提示或警告。",
520
+ "title": "ToolResultNotice",
521
+ "type": "object",
522
+ "additionalProperties": false,
523
+ "required": ["code", "message"],
524
+ "properties": {
525
+ "code": { "type": "string", "minLength": 1, "maxLength": 128 },
526
+ "message": { "type": "string", "minLength": 1, "maxLength": 1024 }
527
+ }
528
+ },
529
+ "ToolResultEnvelope": {
530
+ "description": "工具执行结果信封;仅供受信任的内部 Host 与 Agent 事件,不进入作者 Contribution。",
531
+ "title": "ToolResultEnvelope",
532
+ "type": "object",
533
+ "additionalProperties": false,
534
+ "required": ["schemaVersion", "status"],
535
+ "properties": {
536
+ "schemaVersion": { "const": 1 },
537
+ "status": { "enum": ["running", "succeeded", "failed", "cancelled"] },
538
+ "summary": { "type": "string", "maxLength": 2048 },
539
+ "data": { "$ref": "#/$defs/JsonValue" },
540
+ "metrics": {
541
+ "type": "array",
542
+ "maxItems": 64,
543
+ "items": { "$ref": "#/$defs/ToolResultMetric" }
544
+ },
545
+ "artifacts": {
546
+ "type": "array",
547
+ "maxItems": 64,
548
+ "items": { "$ref": "#/$defs/ToolResultArtifact" }
549
+ },
550
+ "provenance": {
551
+ "type": "array",
552
+ "maxItems": 32,
553
+ "items": { "$ref": "#/$defs/ToolResultProvenance" }
554
+ },
555
+ "warnings": {
556
+ "type": "array",
557
+ "maxItems": 32,
558
+ "items": { "$ref": "#/$defs/ToolResultNotice" }
559
+ },
560
+ "missing": {
561
+ "type": "array",
562
+ "maxItems": 32,
563
+ "items": { "$ref": "#/$defs/ToolResultNotice" }
564
+ }
565
+ }
566
+ },
567
+ "UiStateResult": {
568
+ "description": "受限 UI 状态读取结果。",
569
+ "title": "UiStateResult",
570
+ "type": "object",
571
+ "additionalProperties": false,
572
+ "required": ["found"],
573
+ "properties": {
574
+ "found": { "type": "boolean" },
575
+ "value": { "$ref": "#/$defs/JsonValue" }
576
+ }
577
+ },
578
+ "UiStateWriteResult": {
579
+ "description": "受限 UI 状态写入结果。",
580
+ "title": "UiStateWriteResult",
581
+ "type": "object",
582
+ "additionalProperties": false,
583
+ "required": ["status"],
584
+ "properties": { "status": { "const": "saved" } }
585
+ },
586
+ "GrantedCapability": {
587
+ "description": "Host 已授予的能力;多数分支附带调用与预算限制(ui.presentation / ui.region 除外)。",
588
+ "title": "GrantedCapability",
589
+ "oneOf": [
590
+ {
591
+ "type": "object",
592
+ "additionalProperties": false,
593
+ "required": ["name", "services", "limits"],
594
+ "properties": {
595
+ "name": { "const": "service.invoke" },
596
+ "services": { "$ref": "#/$defs/WidgetServicePermissions" },
597
+ "limits": {
598
+ "type": "object",
599
+ "additionalProperties": false,
600
+ "required": ["callsPerMinute", "requestBytes", "responseBytes"],
601
+ "properties": {
602
+ "callsPerMinute": { "type": "integer", "minimum": 1 },
603
+ "requestBytes": { "type": "integer", "minimum": 1 },
604
+ "responseBytes": { "type": "integer", "minimum": 1 }
605
+ }
606
+ }
607
+ }
608
+ },
609
+ {
610
+ "type": "object",
611
+ "additionalProperties": false,
612
+ "required": [
613
+ "name",
614
+ "limits"
615
+ ],
616
+ "properties": {
617
+ "name": {
618
+ "const": "files.list"
619
+ },
620
+ "limits": {
621
+ "type": "object",
622
+ "additionalProperties": false,
623
+ "required": [
624
+ "pageSize",
625
+ "callsPerMinute"
626
+ ],
627
+ "properties": {
628
+ "pageSize": {
629
+ "type": "integer",
630
+ "minimum": 1
631
+ },
632
+ "callsPerMinute": {
633
+ "type": "integer",
634
+ "minimum": 1
635
+ }
636
+ }
637
+ }
638
+ }
639
+ },
640
+ {
641
+ "type": "object",
642
+ "additionalProperties": false,
643
+ "required": [
644
+ "name",
645
+ "limits"
646
+ ],
647
+ "properties": {
648
+ "name": {
649
+ "const": "files.download"
650
+ },
651
+ "limits": {
652
+ "type": "object",
653
+ "additionalProperties": false,
654
+ "required": [
655
+ "bytesPerRun",
656
+ "callsPerMinute"
657
+ ],
658
+ "properties": {
659
+ "bytesPerRun": {
660
+ "type": "integer",
661
+ "minimum": 1
662
+ },
663
+ "callsPerMinute": {
664
+ "type": "integer",
665
+ "minimum": 1
666
+ }
667
+ }
668
+ }
669
+ }
670
+ },
671
+ {
672
+ "type": "object",
673
+ "additionalProperties": false,
674
+ "required": [
675
+ "name",
676
+ "limits"
677
+ ],
678
+ "properties": {
679
+ "name": {
680
+ "const": "files.metadata"
681
+ },
682
+ "limits": {
683
+ "type": "object",
684
+ "additionalProperties": false,
685
+ "required": [
686
+ "callsPerMinute"
687
+ ],
688
+ "properties": {
689
+ "callsPerMinute": {
690
+ "type": "integer",
691
+ "minimum": 1
692
+ }
693
+ }
694
+ }
695
+ }
696
+ },
697
+ {
698
+ "type": "object",
699
+ "additionalProperties": false,
700
+ "required": [
701
+ "name",
702
+ "limits"
703
+ ],
704
+ "properties": {
705
+ "name": {
706
+ "const": "files.read"
707
+ },
708
+ "limits": {
709
+ "type": "object",
710
+ "additionalProperties": false,
711
+ "required": [
712
+ "bytesPerRequest",
713
+ "bytesPerRun",
714
+ "callsPerMinute"
715
+ ],
716
+ "properties": {
717
+ "bytesPerRequest": {
718
+ "type": "integer",
719
+ "minimum": 1
720
+ },
721
+ "bytesPerRun": {
722
+ "type": "integer",
723
+ "minimum": 1
724
+ },
725
+ "callsPerMinute": {
726
+ "type": "integer",
727
+ "minimum": 1
728
+ }
729
+ }
730
+ }
731
+ }
732
+ },
733
+ {
734
+ "type": "object",
735
+ "additionalProperties": false,
736
+ "required": ["name", "limits"],
737
+ "properties": {
738
+ "name": { "const": "files.write" },
739
+ "limits": {
740
+ "type": "object",
741
+ "additionalProperties": false,
742
+ "required": ["bytesPerRequest", "bytesPerRun", "callsPerMinute"],
743
+ "properties": {
744
+ "bytesPerRequest": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
745
+ "bytesPerRun": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
746
+ "callsPerMinute": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }
747
+ }
748
+ }
749
+ }
750
+ },
751
+ {
752
+ "type": "object",
753
+ "additionalProperties": false,
754
+ "required": ["name", "topics", "limits"],
755
+ "properties": {
756
+ "name": {
757
+ "const": "events.read"
758
+ },
759
+ "topics": {
760
+ "type": "array",
761
+ "minItems": 1,
762
+ "maxItems": 32,
763
+ "uniqueItems": true,
764
+ "items": {
765
+ "type": "string",
766
+ "minLength": 1,
767
+ "maxLength": 128,
768
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
769
+ }
770
+ },
771
+ "limits": {
772
+ "type": "object",
773
+ "additionalProperties": false,
774
+ "required": [
775
+ "callsPerMinute",
776
+ "pageSize",
777
+ "minPollMs"
778
+ ],
779
+ "properties": {
780
+ "callsPerMinute": {
781
+ "type": "integer",
782
+ "minimum": 1,
783
+ "maximum": 9007199254740991
784
+ },
785
+ "pageSize": {
786
+ "type": "integer",
787
+ "minimum": 1,
788
+ "maximum": 100
789
+ },
790
+ "minPollMs": {
791
+ "type": "integer",
792
+ "minimum": 1000,
793
+ "maximum": 60000
794
+ }
795
+ }
796
+ }
797
+ }
798
+ },
799
+ {
800
+ "type": "object",
801
+ "additionalProperties": false,
802
+ "required": ["name", "limits"],
803
+ "properties": {
804
+ "name": { "const": "tasks.watch" },
805
+ "limits": {
806
+ "type": "object",
807
+ "additionalProperties": false,
808
+ "required": ["callsPerMinute", "pageSize", "minPollMs"],
809
+ "properties": {
810
+ "callsPerMinute": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
811
+ "pageSize": { "type": "integer", "minimum": 1, "maximum": 100 },
812
+ "minPollMs": { "type": "integer", "minimum": 1000, "maximum": 60000 }
813
+ }
814
+ }
815
+ }
816
+ },
817
+ {
818
+ "type": "object",
819
+ "additionalProperties": false,
820
+ "required": ["name", "limits"],
821
+ "properties": {
822
+ "name": { "const": "ui.state" },
823
+ "limits": {
824
+ "type": "object",
825
+ "additionalProperties": false,
826
+ "required": ["callsPerMinute", "bytesPerRun", "maxValueBytes"],
827
+ "properties": {
828
+ "callsPerMinute": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
829
+ "bytesPerRun": { "type": "integer", "minimum": 1, "maximum": 1048576 },
830
+ "maxValueBytes": { "type": "integer", "minimum": 1, "maximum": 262144 }
831
+ }
832
+ }
833
+ }
834
+ },
835
+ {
836
+ "type": "object",
837
+ "additionalProperties": false,
838
+ "required": [
839
+ "name",
840
+ "actions",
841
+ "limits"
842
+ ],
843
+ "properties": {
844
+ "name": {
845
+ "const": "actions.invoke"
846
+ },
847
+ "actions": {
848
+ "type": "array",
849
+ "minItems": 1,
850
+ "maxItems": 32,
851
+ "uniqueItems": true,
852
+ "items": {
853
+ "type": "string",
854
+ "minLength": 1,
855
+ "maxLength": 128,
856
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
857
+ }
858
+ },
859
+ "limits": {
860
+ "type": "object",
861
+ "additionalProperties": false,
862
+ "required": [
863
+ "callsPerMinute"
864
+ ],
865
+ "properties": {
866
+ "callsPerMinute": {
867
+ "type": "integer",
868
+ "minimum": 1,
869
+ "maximum": 9007199254740991
870
+ }
871
+ }
872
+ }
873
+ }
874
+ },
875
+ {
876
+ "type": "object",
877
+ "additionalProperties": false,
878
+ "required": ["name", "limits"],
879
+ "properties": {
880
+ "name": { "const": "network.fetch" },
881
+ "limits": { "$ref": "#/$defs/WidgetNetworkLimits" }
882
+ }
883
+ },
884
+ { "$ref": "#/$defs/GrantedPresentationCapability" },
885
+ { "$ref": "#/$defs/GrantedRegionCapability" }
886
+ ]
887
+ },
888
+ "GrantedRegionCapability": {
889
+ "description": "已授予的会话右侧区域替换能力。",
890
+ "title": "GrantedRegionCapability",
891
+ "type": "object",
892
+ "additionalProperties": false,
893
+ "required": ["name", "regions", "mode", "requiresHostConfirmation"],
894
+ "properties": {
895
+ "name": { "const": "ui.region" },
896
+ "regions": {
897
+ "type": "array",
898
+ "minItems": 1,
899
+ "maxItems": 1,
900
+ "uniqueItems": true,
901
+ "items": { "const": "session.rightRail" }
902
+ },
903
+ "mode": { "const": "replace" },
904
+ "requiresHostConfirmation": { "const": true }
905
+ }
906
+ },
907
+ "GrantedPresentationCapability": {
908
+ "description": "已授予的呈现能力;含 surfaces,requiresHostConfirmation 恒为 true。",
909
+ "title": "GrantedPresentationCapability",
910
+ "type": "object",
911
+ "additionalProperties": false,
912
+ "required": ["name", "surfaces", "requiresHostConfirmation"],
913
+ "properties": {
914
+ "name": { "const": "ui.presentation" },
915
+ "surfaces": {
916
+ "type": "array",
917
+ "minItems": 1,
918
+ "maxItems": 2,
919
+ "uniqueItems": true,
920
+ "items": { "enum": ["floating", "overlay"] }
921
+ },
922
+ "requiresHostConfirmation": { "const": true }
923
+ }
924
+ },
925
+ "WidgetRenderContext": {
926
+ "description": "渲染上下文:locale、theme、viewport、能力与关联 id。",
927
+ "title": "WidgetRenderContext",
928
+ "type": "object",
929
+ "additionalProperties": false,
930
+ "required": [
931
+ "locale",
932
+ "theme",
933
+ "viewport",
934
+ "capabilities",
935
+ "correlationId"
936
+ ],
937
+ "properties": {
938
+ "locale": { "type": "string", "minLength": 1 },
939
+ "theme": { "$ref": "#/$defs/Theme" },
940
+ "viewport": {
941
+ "type": "object",
942
+ "additionalProperties": false,
943
+ "required": ["width", "height"],
944
+ "properties": {
945
+ "width": { "type": "number", "minimum": 0 },
946
+ "height": { "type": "number", "minimum": 0 }
947
+ }
948
+ },
949
+ "capabilities": {
950
+ "type": "array",
951
+ "items": { "$ref": "#/$defs/GrantedCapability" }
952
+ },
953
+ "correlationId": { "type": "string", "minLength": 1 }
954
+ }
955
+ },
956
+ "ToolResultContent": {
957
+ "description": "tool-result 渲染内容;仅内部通道使用,外部作者不挂载。",
958
+ "title": "ToolResultContent",
959
+ "type": "object",
960
+ "additionalProperties": false,
961
+ "required": ["contribution", "tool", "input"],
962
+ "properties": {
963
+ "contribution": { "const": "tool-result" },
964
+ "tool": {
965
+ "type": "object",
966
+ "additionalProperties": false,
967
+ "required": ["name", "callId", "status"],
968
+ "properties": {
969
+ "name": { "type": "string", "minLength": 1 },
970
+ "callId": { "type": "string", "minLength": 1 },
971
+ "status": {
972
+ "enum": ["running", "succeeded", "failed", "cancelled"]
973
+ }
974
+ }
975
+ },
976
+ "input": { "$ref": "#/$defs/JsonValue" },
977
+ "result": { "$ref": "#/$defs/JsonValue" },
978
+ "envelope": { "$ref": "#/$defs/ToolResultEnvelope" },
979
+ "error": {
980
+ "type": "object",
981
+ "additionalProperties": false,
982
+ "required": ["code", "message"],
983
+ "properties": {
984
+ "code": { "type": "string", "minLength": 1 },
985
+ "message": { "type": "string", "minLength": 1 }
986
+ }
987
+ }
988
+ }
989
+ },
990
+ "FilePreviewContent": {
991
+ "description": "文件预览内容;contribution 必须为 file-preview。",
992
+ "title": "FilePreviewContent",
993
+ "type": "object",
994
+ "additionalProperties": false,
995
+ "required": ["contribution", "file"],
996
+ "properties": {
997
+ "contribution": { "const": "file-preview" },
998
+ "file": { "$ref": "#/$defs/FileReference" },
999
+ "preview": { "$ref": "#/$defs/JsonValue" }
1000
+ }
1001
+ },
1002
+ "PanelContent": {
1003
+ "description": "面板内容;contribution 必须为 panel。",
1004
+ "title": "PanelContent",
1005
+ "type": "object",
1006
+ "additionalProperties": false,
1007
+ "required": ["contribution", "id", "data"],
1008
+ "properties": {
1009
+ "contribution": { "const": "panel" },
1010
+ "id": { "type": "string", "minLength": 1 },
1011
+ "title": { "type": "string" },
1012
+ "data": { "$ref": "#/$defs/JsonValue" }
1013
+ }
1014
+ },
1015
+ "RenderRequestBase": {
1016
+ "description": "渲染请求公共字段:schemaVersion、requestId、instanceId、revision、state、context。",
1017
+ "title": "RenderRequestBase",
1018
+ "type": "object",
1019
+ "required": [
1020
+ "schemaVersion",
1021
+ "requestId",
1022
+ "instanceId",
1023
+ "revision",
1024
+ "state",
1025
+ "context"
1026
+ ],
1027
+ "properties": {
1028
+ "schemaVersion": { "const": 1 },
1029
+ "requestId": { "type": "string", "minLength": 1 },
1030
+ "instanceId": { "type": "string", "minLength": 1 },
1031
+ "revision": { "type": "integer", "minimum": 1 },
1032
+ "state": { "$ref": "#/$defs/RenderState" },
1033
+ "context": { "$ref": "#/$defs/WidgetRenderContext" }
1034
+ }
1035
+ },
1036
+ "ToolResultRenderRequest": {
1037
+ "description": "历史 Host 投影类型;仅供受信任的内部 Host 与协议验证。Forge 新插件不得声明或挂载 tool-result,工具结果应由 Runtime 逻辑映射到自定义 Panel。",
1038
+ "title": "ToolResultRenderRequest",
1039
+ "type": "object",
1040
+ "allOf": [
1041
+ { "$ref": "#/$defs/RenderRequestBase" },
1042
+ {
1043
+ "type": "object",
1044
+ "required": ["contribution", "content"],
1045
+ "properties": {
1046
+ "contribution": { "const": "tool-result" },
1047
+ "content": { "$ref": "#/$defs/ToolResultContent" }
1048
+ }
1049
+ }
1050
+ ],
1051
+ "unevaluatedProperties": false
1052
+ },
1053
+ "FilePreviewRenderRequest": {
1054
+ "description": "文件预览渲染请求:公共字段 + contribution=file-preview + content。",
1055
+ "title": "FilePreviewRenderRequest",
1056
+ "type": "object",
1057
+ "allOf": [
1058
+ { "$ref": "#/$defs/RenderRequestBase" },
1059
+ {
1060
+ "type": "object",
1061
+ "required": ["contribution", "content"],
1062
+ "properties": {
1063
+ "contribution": { "const": "file-preview" },
1064
+ "content": { "$ref": "#/$defs/FilePreviewContent" }
1065
+ }
1066
+ }
1067
+ ],
1068
+ "unevaluatedProperties": false
1069
+ },
1070
+ "PanelRenderRequest": {
1071
+ "description": "面板渲染请求:公共字段 + contribution=panel + content。",
1072
+ "title": "PanelRenderRequest",
1073
+ "type": "object",
1074
+ "allOf": [
1075
+ { "$ref": "#/$defs/RenderRequestBase" },
1076
+ {
1077
+ "type": "object",
1078
+ "required": ["contribution", "content"],
1079
+ "properties": {
1080
+ "contribution": { "const": "panel" },
1081
+ "content": { "$ref": "#/$defs/PanelContent" }
1082
+ }
1083
+ }
1084
+ ],
1085
+ "unevaluatedProperties": false
1086
+ },
1087
+ "RenderRequest": {
1088
+ "description": "完整渲染请求联合:tool-result(内部)/ file-preview / panel。",
1089
+ "title": "RenderRequest",
1090
+ "oneOf": [
1091
+ { "$ref": "#/$defs/ToolResultRenderRequest" },
1092
+ { "$ref": "#/$defs/FilePreviewRenderRequest" },
1093
+ { "$ref": "#/$defs/PanelRenderRequest" }
1094
+ ]
1095
+ },
1096
+ "CapabilityRequest": {
1097
+ "description": "Widget 发起的能力请求;以 operation 判别语义与 input。",
1098
+ "title": "CapabilityRequest",
1099
+ "oneOf": [
1100
+ {
1101
+ "type": "object",
1102
+ "additionalProperties": false,
1103
+ "required": ["operation", "input"],
1104
+ "properties": {
1105
+ "operation": { "const": "service.invoke" },
1106
+ "input": {
1107
+ "type": "object",
1108
+ "additionalProperties": false,
1109
+ "required": ["service", "action", "payload"],
1110
+ "properties": {
1111
+ "service": {
1112
+ "type": "string",
1113
+ "minLength": 1,
1114
+ "maxLength": 128,
1115
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
1116
+ },
1117
+ "action": {
1118
+ "type": "string",
1119
+ "minLength": 1,
1120
+ "maxLength": 128,
1121
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
1122
+ },
1123
+ "payload": { "$ref": "#/$defs/JsonValue" }
1124
+ }
1125
+ }
1126
+ }
1127
+ },
1128
+ {
1129
+ "type": "object",
1130
+ "additionalProperties": false,
1131
+ "required": [
1132
+ "operation",
1133
+ "input"
1134
+ ],
1135
+ "properties": {
1136
+ "operation": {
1137
+ "const": "files.list"
1138
+ },
1139
+ "input": {
1140
+ "type": "object",
1141
+ "additionalProperties": false,
1142
+ "required": [
1143
+ "directory"
1144
+ ],
1145
+ "properties": {
1146
+ "directory": {
1147
+ "$ref": "#/$defs/FileReference"
1148
+ },
1149
+ "cursor": {
1150
+ "type": "string"
1151
+ },
1152
+ "limit": {
1153
+ "type": "integer",
1154
+ "minimum": 1
1155
+ }
1156
+ }
1157
+ }
1158
+ }
1159
+ },
1160
+ {
1161
+ "type": "object",
1162
+ "additionalProperties": false,
1163
+ "required": [
1164
+ "operation",
1165
+ "input"
1166
+ ],
1167
+ "properties": {
1168
+ "operation": {
1169
+ "const": "files.metadata"
1170
+ },
1171
+ "input": {
1172
+ "type": "object",
1173
+ "additionalProperties": false,
1174
+ "required": [
1175
+ "reference"
1176
+ ],
1177
+ "properties": {
1178
+ "reference": {
1179
+ "$ref": "#/$defs/FileReference"
1180
+ }
1181
+ }
1182
+ }
1183
+ }
1184
+ },
1185
+ {
1186
+ "type": "object",
1187
+ "additionalProperties": false,
1188
+ "required": [
1189
+ "operation",
1190
+ "input"
1191
+ ],
1192
+ "properties": {
1193
+ "operation": {
1194
+ "const": "files.read"
1195
+ },
1196
+ "input": { "$ref": "#/$defs/FileReadInput" }
1197
+ }
1198
+ },
1199
+ {
1200
+ "type": "object",
1201
+ "additionalProperties": false,
1202
+ "required": ["operation", "input"],
1203
+ "properties": {
1204
+ "operation": { "const": "files.write" },
1205
+ "input": { "$ref": "#/$defs/FileWriteInput" }
1206
+ }
1207
+ },
1208
+ {
1209
+ "type": "object",
1210
+ "additionalProperties": false,
1211
+ "required": [
1212
+ "operation",
1213
+ "input"
1214
+ ],
1215
+ "properties": {
1216
+ "operation": {
1217
+ "const": "files.download"
1218
+ },
1219
+ "input": {
1220
+ "type": "object",
1221
+ "additionalProperties": false,
1222
+ "required": ["file", "suggestedName"],
1223
+ "properties": {
1224
+ "file": { "$ref": "#/$defs/FileReference" },
1225
+ "suggestedName": {
1226
+ "type": "string",
1227
+ "minLength": 1,
1228
+ "maxLength": 255,
1229
+ "pattern": "^[^\\\\/\\u0000-\\u001f]+$"
1230
+ }
1231
+ }
1232
+ }
1233
+ }
1234
+ },
1235
+ {
1236
+ "type": "object",
1237
+ "additionalProperties": false,
1238
+ "required": ["operation", "input"],
1239
+ "properties": {
1240
+ "operation": { "const": "tasks.watch" },
1241
+ "input": {
1242
+ "type": "object",
1243
+ "additionalProperties": false,
1244
+ "required": ["taskId"],
1245
+ "properties": {
1246
+ "taskId": { "type": "string", "minLength": 1, "maxLength": 256 },
1247
+ "cursor": { "type": "string", "minLength": 1, "maxLength": 256 },
1248
+ "limit": { "type": "integer", "minimum": 1, "maximum": 100 }
1249
+ }
1250
+ }
1251
+ }
1252
+ },
1253
+ {
1254
+ "type": "object",
1255
+ "additionalProperties": false,
1256
+ "required": ["operation", "input"],
1257
+ "properties": {
1258
+ "operation": { "const": "ui.state" },
1259
+ "input": {
1260
+ "oneOf": [
1261
+ {
1262
+ "type": "object",
1263
+ "additionalProperties": false,
1264
+ "required": ["action", "key"],
1265
+ "properties": {
1266
+ "action": { "const": "read" },
1267
+ "key": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9_.:-]+$" }
1268
+ }
1269
+ },
1270
+ {
1271
+ "type": "object",
1272
+ "additionalProperties": false,
1273
+ "required": ["action", "key", "value"],
1274
+ "properties": {
1275
+ "action": { "const": "write" },
1276
+ "key": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9_.:-]+$" },
1277
+ "value": { "$ref": "#/$defs/JsonValue" }
1278
+ }
1279
+ }
1280
+ ]
1281
+ }
1282
+ }
1283
+ },
1284
+ {
1285
+ "type": "object",
1286
+ "additionalProperties": false,
1287
+ "required": [
1288
+ "operation",
1289
+ "input"
1290
+ ],
1291
+ "properties": {
1292
+ "operation": {
1293
+ "const": "events.read"
1294
+ },
1295
+ "input": {
1296
+ "type": "object",
1297
+ "additionalProperties": false,
1298
+ "required": [
1299
+ "topic",
1300
+ "limit"
1301
+ ],
1302
+ "properties": {
1303
+ "topic": {
1304
+ "type": "string",
1305
+ "minLength": 1,
1306
+ "maxLength": 128,
1307
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
1308
+ },
1309
+ "cursor": {
1310
+ "type": "string",
1311
+ "minLength": 1,
1312
+ "maxLength": 256
1313
+ },
1314
+ "limit": {
1315
+ "type": "integer",
1316
+ "minimum": 1,
1317
+ "maximum": 100
1318
+ }
1319
+ }
1320
+ }
1321
+ }
1322
+ },
1323
+ {
1324
+ "type": "object",
1325
+ "additionalProperties": false,
1326
+ "required": [
1327
+ "operation",
1328
+ "input"
1329
+ ],
1330
+ "properties": {
1331
+ "operation": {
1332
+ "const": "actions.invoke"
1333
+ },
1334
+ "input": {
1335
+ "type": "object",
1336
+ "additionalProperties": false,
1337
+ "required": [
1338
+ "action",
1339
+ "idempotencyKey",
1340
+ "arguments"
1341
+ ],
1342
+ "properties": {
1343
+ "action": {
1344
+ "type": "string",
1345
+ "minLength": 1,
1346
+ "maxLength": 128,
1347
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
1348
+ },
1349
+ "idempotencyKey": {
1350
+ "type": "string",
1351
+ "minLength": 1,
1352
+ "maxLength": 256
1353
+ },
1354
+ "arguments": {
1355
+ "$ref": "#/$defs/JsonValue"
1356
+ }
1357
+ }
1358
+ }
1359
+ }
1360
+ },
1361
+ {
1362
+ "type": "object",
1363
+ "additionalProperties": false,
1364
+ "required": ["operation", "input"],
1365
+ "properties": {
1366
+ "operation": { "const": "network.fetch" },
1367
+ "input": { "$ref": "#/$defs/WidgetNetworkFetchInput" }
1368
+ }
1369
+ },
1370
+ { "$ref": "#/$defs/PresentationCapabilityRequest" },
1371
+ { "$ref": "#/$defs/RegionCapabilityRequest" }
1372
+ ]
1373
+ },
1374
+ "RegionCapabilityRequest": {
1375
+ "description": "区域能力请求:acquire 或 release。",
1376
+ "title": "RegionCapabilityRequest",
1377
+ "type": "object",
1378
+ "oneOf": [
1379
+ {
1380
+ "type": "object",
1381
+ "additionalProperties": false,
1382
+ "required": ["operation", "input"],
1383
+ "properties": {
1384
+ "operation": { "const": "ui.region" },
1385
+ "input": {
1386
+ "type": "object",
1387
+ "additionalProperties": false,
1388
+ "required": ["action", "region"],
1389
+ "properties": {
1390
+ "action": { "const": "acquire" },
1391
+ "region": { "const": "session.rightRail" }
1392
+ }
1393
+ }
1394
+ }
1395
+ },
1396
+ {
1397
+ "type": "object",
1398
+ "additionalProperties": false,
1399
+ "required": ["operation", "input"],
1400
+ "properties": {
1401
+ "operation": { "const": "ui.region" },
1402
+ "input": {
1403
+ "type": "object",
1404
+ "additionalProperties": false,
1405
+ "required": ["action"],
1406
+ "properties": { "action": { "const": "release" } }
1407
+ }
1408
+ }
1409
+ }
1410
+ ]
1411
+ },
1412
+ "PresentationCapabilityRequest": {
1413
+ "description": "呈现能力请求:present / change-surface、close,或 focus-boundary。",
1414
+ "title": "PresentationCapabilityRequest",
1415
+ "oneOf": [
1416
+ {
1417
+ "type": "object",
1418
+ "additionalProperties": false,
1419
+ "required": ["operation", "input"],
1420
+ "properties": {
1421
+ "operation": { "const": "ui.presentation" },
1422
+ "input": {
1423
+ "oneOf": [
1424
+ {
1425
+ "type": "object",
1426
+ "additionalProperties": false,
1427
+ "required": ["action", "surface"],
1428
+ "properties": {
1429
+ "action": { "enum": ["present", "change-surface"] },
1430
+ "surface": {
1431
+ "enum": ["workspace", "floating", "overlay"]
1432
+ }
1433
+ }
1434
+ },
1435
+ {
1436
+ "type": "object",
1437
+ "additionalProperties": false,
1438
+ "required": ["action"],
1439
+ "properties": {
1440
+ "action": { "const": "close" }
1441
+ }
1442
+ }
1443
+ ]
1444
+ }
1445
+ }
1446
+ },
1447
+ { "$ref": "#/$defs/FocusBoundaryPresentationCapabilityRequest" }
1448
+ ]
1449
+ },
1450
+ "FocusBoundaryPresentationCapabilityRequest": {
1451
+ "description": "呈现焦点边界请求:forward 或 backward。",
1452
+ "title": "FocusBoundaryPresentationCapabilityRequest",
1453
+ "oneOf": [
1454
+ {
1455
+ "type": "object",
1456
+ "additionalProperties": false,
1457
+ "required": ["operation", "input"],
1458
+ "properties": {
1459
+ "operation": { "const": "ui.presentation" },
1460
+ "input": {
1461
+ "type": "object",
1462
+ "additionalProperties": false,
1463
+ "required": ["action", "direction"],
1464
+ "properties": {
1465
+ "action": { "const": "focus-boundary" },
1466
+ "direction": { "enum": ["forward", "backward"] }
1467
+ }
1468
+ }
1469
+ }
1470
+ }
1471
+ ]
1472
+ },
1473
+ "WidgetNetworkLimits": {
1474
+ "description": "Host 托管网络的限制项:超时、并发、频率与字节数。",
1475
+ "title": "WidgetNetworkLimits",
1476
+ "type": "object",
1477
+ "additionalProperties": false,
1478
+ "required": [
1479
+ "timeoutMs",
1480
+ "maxRedirects",
1481
+ "maxConcurrentRequests",
1482
+ "callsPerMinute",
1483
+ "requestHeaderBytes",
1484
+ "responseHeaderBytes",
1485
+ "requestBodyBytes",
1486
+ "responseBodyBytes"
1487
+ ],
1488
+ "properties": {
1489
+ "timeoutMs": { "$ref": "#/$defs/PositiveInteger" },
1490
+ "maxRedirects": { "$ref": "#/$defs/PositiveInteger" },
1491
+ "maxConcurrentRequests": { "$ref": "#/$defs/PositiveInteger" },
1492
+ "callsPerMinute": { "$ref": "#/$defs/PositiveInteger" },
1493
+ "requestHeaderBytes": { "$ref": "#/$defs/PositiveInteger" },
1494
+ "responseHeaderBytes": { "$ref": "#/$defs/PositiveInteger" },
1495
+ "requestBodyBytes": { "$ref": "#/$defs/PositiveInteger" },
1496
+ "responseBodyBytes": { "$ref": "#/$defs/PositiveInteger" }
1497
+ }
1498
+ },
1499
+ "PositiveInteger": {
1500
+ "description": "正整数。",
1501
+ "title": "PositiveInteger",
1502
+ "type": "integer",
1503
+ "minimum": 1,
1504
+ "maximum": 9007199254740991
1505
+ },
1506
+ "NetworkHeaders": {
1507
+ "description": "HTTP 响应头集合。",
1508
+ "title": "NetworkHeaders",
1509
+ "type": "object",
1510
+ "maxProperties": 64,
1511
+ "propertyNames": {
1512
+ "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
1513
+ },
1514
+ "additionalProperties": {
1515
+ "type": "string",
1516
+ "maxLength": 16384
1517
+ }
1518
+ },
1519
+ "WidgetNetworkRequestHeaders": {
1520
+ "description": "Widget 发起网络请求时附加的请求头集合。",
1521
+ "title": "WidgetNetworkRequestHeaders",
1522
+ "type": "object",
1523
+ "maxProperties": 64,
1524
+ "propertyNames": {
1525
+ "allOf": [
1526
+ { "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$" },
1527
+ {
1528
+ "not": {
1529
+ "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])$"
1530
+ }
1531
+ }
1532
+ ]
1533
+ },
1534
+ "additionalProperties": {
1535
+ "type": "string",
1536
+ "maxLength": 16384
1537
+ }
1538
+ },
1539
+ "WidgetNetworkFetchInput": {
1540
+ "description": "Host 托管网络请求输入;url 由 Host 校验,auth 声明凭据需求。",
1541
+ "title": "WidgetNetworkFetchInput",
1542
+ "type": "object",
1543
+ "additionalProperties": false,
1544
+ "required": ["url", "auth"],
1545
+ "properties": {
1546
+ "url": { "type": "string", "minLength": 1, "maxLength": 8192 },
1547
+ "auth": { "enum": ["none", "optional", "required"] },
1548
+ "method": {
1549
+ "enum": ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"]
1550
+ },
1551
+ "headers": { "$ref": "#/$defs/WidgetNetworkRequestHeaders" },
1552
+ "body": { "type": "string" },
1553
+ "bodyEncoding": { "enum": ["utf8", "base64"] },
1554
+ "redirect": { "enum": ["follow", "manual", "error"] }
1555
+ },
1556
+ "dependentRequired": {
1557
+ "bodyEncoding": ["body"]
1558
+ }
1559
+ },
1560
+ "WidgetNetworkFetchOutput": {
1561
+ "description": "Host 托管网络请求结果;body 按 bodyEncoding 解释。",
1562
+ "title": "WidgetNetworkFetchOutput",
1563
+ "type": "object",
1564
+ "additionalProperties": false,
1565
+ "required": [
1566
+ "status",
1567
+ "statusText",
1568
+ "headers",
1569
+ "body",
1570
+ "bodyEncoding",
1571
+ "finalUrl",
1572
+ "redirected"
1573
+ ],
1574
+ "properties": {
1575
+ "status": { "type": "integer", "minimum": 100, "maximum": 599 },
1576
+ "statusText": { "type": "string", "maxLength": 256 },
1577
+ "headers": { "$ref": "#/$defs/NetworkHeaders" },
1578
+ "body": { "type": "string" },
1579
+ "bodyEncoding": { "enum": ["utf8", "base64"] },
1580
+ "finalUrl": { "type": "string", "minLength": 1, "maxLength": 8192 },
1581
+ "redirected": { "type": "boolean" }
1582
+ }
1583
+ },
1584
+ "PresentationCapabilityOutput": {
1585
+ "description": "呈现能力输出:present / change-surface / focus-boundary / close。",
1586
+ "title": "PresentationCapabilityOutput",
1587
+ "oneOf": [
1588
+ {
1589
+ "type": "object",
1590
+ "additionalProperties": false,
1591
+ "required": ["action", "surface"],
1592
+ "properties": {
1593
+ "action": { "enum": ["present", "change-surface"] },
1594
+ "surface": { "enum": ["workspace", "floating", "overlay"] }
1595
+ }
1596
+ },
1597
+ {
1598
+ "type": "object",
1599
+ "additionalProperties": false,
1600
+ "required": ["action"],
1601
+ "properties": {
1602
+ "action": { "const": "close" }
1603
+ }
1604
+ },
1605
+ {
1606
+ "type": "object",
1607
+ "additionalProperties": false,
1608
+ "required": ["action", "direction"],
1609
+ "properties": {
1610
+ "action": { "const": "focus-boundary" },
1611
+ "direction": { "enum": ["forward", "backward"] }
1612
+ }
1613
+ }
1614
+ ]
1615
+ },
1616
+ "PresentationCapabilityResult": {
1617
+ "description": "呈现能力请求的结果。",
1618
+ "title": "PresentationCapabilityResult",
1619
+ "oneOf": [
1620
+ {
1621
+ "type": "object",
1622
+ "additionalProperties": false,
1623
+ "required": ["ok", "data"],
1624
+ "properties": {
1625
+ "ok": { "const": true },
1626
+ "data": { "$ref": "#/$defs/PresentationCapabilityOutput" }
1627
+ }
1628
+ },
1629
+ {
1630
+ "type": "object",
1631
+ "additionalProperties": false,
1632
+ "required": ["ok", "reason", "message", "retryable"],
1633
+ "properties": {
1634
+ "ok": { "const": false },
1635
+ "reason": {
1636
+ "enum": [
1637
+ "unsupported",
1638
+ "permission-denied",
1639
+ "resource-limit",
1640
+ "invalid-reference",
1641
+ "timeout",
1642
+ "internal-error",
1643
+ "network-consent-denied",
1644
+ "network-policy-denied",
1645
+ "network-transport-unavailable",
1646
+ "network-request-too-large",
1647
+ "network-response-too-large",
1648
+ "network-rate-limited",
1649
+ "network-redirect-denied",
1650
+ "network-credential-unavailable",
1651
+ "network-scope-invalid",
1652
+ "network-dns-denied",
1653
+ "network-error"
1654
+ ]
1655
+ },
1656
+ "message": { "type": "string", "minLength": 1 },
1657
+ "retryable": { "type": "boolean" }
1658
+ }
1659
+ }
1660
+ ]
1661
+ },
1662
+ "RegionCapabilityResult": {
1663
+ "description": "区域能力请求的结果;成功时含不透明 leaseId。",
1664
+ "title": "RegionCapabilityResult",
1665
+ "oneOf": [
1666
+ {
1667
+ "type": "object",
1668
+ "additionalProperties": false,
1669
+ "required": ["ok", "data"],
1670
+ "properties": {
1671
+ "ok": { "const": true },
1672
+ "data": {
1673
+ "type": "object",
1674
+ "additionalProperties": false,
1675
+ "required": ["action", "region", "mode"],
1676
+ "properties": {
1677
+ "action": { "enum": ["acquire", "release"] },
1678
+ "region": { "const": "session.rightRail" },
1679
+ "mode": { "const": "replace" },
1680
+ "leaseId": { "type": "string", "minLength": 1, "maxLength": 256 }
1681
+ }
1682
+ }
1683
+ }
1684
+ },
1685
+ {
1686
+ "type": "object",
1687
+ "additionalProperties": false,
1688
+ "required": ["ok", "reason", "message", "retryable"],
1689
+ "properties": {
1690
+ "ok": { "const": false },
1691
+ "reason": {
1692
+ "enum": [
1693
+ "unsupported",
1694
+ "permission-denied",
1695
+ "resource-limit",
1696
+ "invalid-reference",
1697
+ "timeout",
1698
+ "internal-error"
1699
+ ]
1700
+ },
1701
+ "message": { "type": "string", "minLength": 1 },
1702
+ "retryable": { "type": "boolean" }
1703
+ }
1704
+ }
1705
+ ]
1706
+ },
1707
+ "CapabilityResult": {
1708
+ "description": "能力请求结果:成功时带 data,失败时带 reason / message / retryable。",
1709
+ "title": "CapabilityResult",
1710
+ "oneOf": [
1711
+ {
1712
+ "type": "object",
1713
+ "additionalProperties": false,
1714
+ "required": ["ok", "data"],
1715
+ "properties": {
1716
+ "ok": { "const": true },
1717
+ "data": { "$ref": "#/$defs/JsonValue" }
1718
+ }
1719
+ },
1720
+ {
1721
+ "type": "object",
1722
+ "additionalProperties": false,
1723
+ "required": ["ok", "reason", "message", "retryable"],
1724
+ "properties": {
1725
+ "ok": { "const": false },
1726
+ "reason": {
1727
+ "enum": [
1728
+ "unsupported",
1729
+ "permission-denied",
1730
+ "resource-limit",
1731
+ "invalid-reference",
1732
+ "timeout",
1733
+ "internal-error",
1734
+ "network-consent-denied",
1735
+ "network-policy-denied",
1736
+ "network-transport-unavailable",
1737
+ "network-request-too-large",
1738
+ "network-response-too-large",
1739
+ "network-rate-limited",
1740
+ "network-redirect-denied",
1741
+ "network-credential-unavailable",
1742
+ "network-scope-invalid",
1743
+ "network-dns-denied",
1744
+ "network-error",
1745
+ "revision-conflict",
1746
+ "mutation-conflict",
1747
+ "write-outcome-unknown"
1748
+ ]
1749
+ },
1750
+ "message": { "type": "string", "minLength": 1 },
1751
+ "retryable": { "type": "boolean" }
1752
+ }
1753
+ }
1754
+ ]
1755
+ },
1756
+ "WidgetError": {
1757
+ "description": "结构化稳定错误:code + phase + message + retryable + correlationId。",
1758
+ "title": "WidgetError",
1759
+ "type": "object",
1760
+ "additionalProperties": false,
1761
+ "required": ["code", "phase", "message", "retryable", "correlationId"],
1762
+ "properties": {
1763
+ "code": {
1764
+ "enum": [
1765
+ "BUNDLE_LOAD_FAILED",
1766
+ "DIGEST_MISMATCH",
1767
+ "RUNTIME_CONFIG_EXPIRED",
1768
+ "WIDGET_VERSION_REVOKED",
1769
+ "HOST_API_UNSUPPORTED",
1770
+ "HANDSHAKE_TIMEOUT",
1771
+ "MESSAGE_INVALID",
1772
+ "CHANNEL_MISMATCH",
1773
+ "MESSAGE_TOO_LARGE",
1774
+ "MESSAGE_RATE_LIMITED",
1775
+ "TOO_MANY_PENDING_REQUESTS",
1776
+ "CAPABILITY_UNDECLARED",
1777
+ "CAPABILITY_DENIED",
1778
+ "CAPABILITY_UNSUPPORTED",
1779
+ "CAPABILITY_TIMEOUT",
1780
+ "FILE_REFERENCE_INVALID",
1781
+ "FILE_PERMISSION_DENIED",
1782
+ "RESOURCE_LIMIT",
1783
+ "RENDER_FAILED",
1784
+ "UPDATE_FAILED",
1785
+ "WIDGET_CRASHED",
1786
+ "INSTANCE_DISPOSED"
1787
+ ]
1788
+ },
1789
+ "phase": {
1790
+ "enum": [
1791
+ "load",
1792
+ "handshake",
1793
+ "render",
1794
+ "update",
1795
+ "capability",
1796
+ "dispose"
1797
+ ]
1798
+ },
1799
+ "message": { "type": "string", "minLength": 1 },
1800
+ "retryable": { "type": "boolean" },
1801
+ "correlationId": { "type": "string", "minLength": 1 }
1802
+ }
1803
+ },
1804
+ "ResourceBudget": {
1805
+ "description": "Host 为当前运行签发的资源预算:包、Bridge、文件、超时、并发、重试与失败。",
1806
+ "title": "ResourceBudget",
1807
+ "type": "object",
1808
+ "additionalProperties": false,
1809
+ "required": [
1810
+ "version",
1811
+ "bundle",
1812
+ "bridge",
1813
+ "files",
1814
+ "timeouts",
1815
+ "concurrency",
1816
+ "retry",
1817
+ "failure"
1818
+ ],
1819
+ "properties": {
1820
+ "version": { "const": 1 },
1821
+ "bundle": {
1822
+ "type": "object",
1823
+ "additionalProperties": false,
1824
+ "required": [
1825
+ "compressedBytes",
1826
+ "expandedBytes",
1827
+ "fileCount",
1828
+ "singleFileBytes"
1829
+ ],
1830
+ "properties": {
1831
+ "compressedBytes": { "type": "integer", "minimum": 1 },
1832
+ "expandedBytes": { "type": "integer", "minimum": 1 },
1833
+ "fileCount": { "type": "integer", "minimum": 1 },
1834
+ "singleFileBytes": { "type": "integer", "minimum": 1 }
1835
+ }
1836
+ },
1837
+ "bridge": {
1838
+ "type": "object",
1839
+ "additionalProperties": false,
1840
+ "required": [
1841
+ "messageBytes",
1842
+ "messagesPerSecond",
1843
+ "pendingRequests"
1844
+ ],
1845
+ "properties": {
1846
+ "messageBytes": { "type": "integer", "minimum": 1 },
1847
+ "messagesPerSecond": { "type": "integer", "minimum": 1 },
1848
+ "pendingRequests": { "type": "integer", "minimum": 1 }
1849
+ }
1850
+ },
1851
+ "files": {
1852
+ "type": "object",
1853
+ "additionalProperties": false,
1854
+ "required": [
1855
+ "readBytesPerRequest",
1856
+ "readBytesPerRun",
1857
+ "callsPerMinute",
1858
+ "listPageSize"
1859
+ ],
1860
+ "properties": {
1861
+ "readBytesPerRequest": { "type": "integer", "minimum": 1 },
1862
+ "readBytesPerRun": { "type": "integer", "minimum": 1 },
1863
+ "callsPerMinute": { "type": "integer", "minimum": 1 },
1864
+ "listPageSize": { "type": "integer", "minimum": 1 },
1865
+ "writeBytesPerRequest": {
1866
+ "description": "写入单次原始字节上限;未签发时不得授权 files.write。",
1867
+ "type": "integer", "minimum": 1, "maximum": 9007199254740991
1868
+ },
1869
+ "writeBytesPerRun": {
1870
+ "description": "当前运行的累计写入原始字节上限;未签发时不得授权 files.write。",
1871
+ "type": "integer", "minimum": 1, "maximum": 9007199254740991
1872
+ }
1873
+ }
1874
+ },
1875
+ "timeouts": {
1876
+ "type": "object",
1877
+ "additionalProperties": false,
1878
+ "required": [
1879
+ "bundleLoadMs",
1880
+ "handshakeMs",
1881
+ "firstRenderMs",
1882
+ "updateMs",
1883
+ "capabilityMs",
1884
+ "disposeGraceMs"
1885
+ ],
1886
+ "properties": {
1887
+ "bundleLoadMs": { "type": "integer", "minimum": 1 },
1888
+ "handshakeMs": { "type": "integer", "minimum": 1 },
1889
+ "firstRenderMs": { "type": "integer", "minimum": 1 },
1890
+ "updateMs": { "type": "integer", "minimum": 1 },
1891
+ "capabilityMs": { "type": "integer", "minimum": 1 },
1892
+ "disposeGraceMs": { "type": "integer", "minimum": 1 }
1893
+ }
1894
+ },
1895
+ "concurrency": {
1896
+ "type": "object",
1897
+ "additionalProperties": false,
1898
+ "required": [
1899
+ "activeIframesPerPage",
1900
+ "activeIframesPerRun",
1901
+ "hiddenRecycleMs"
1902
+ ],
1903
+ "properties": {
1904
+ "activeIframesPerPage": { "type": "integer", "minimum": 1 },
1905
+ "activeIframesPerRun": { "type": "integer", "minimum": 1 },
1906
+ "hiddenRecycleMs": { "type": "integer", "minimum": 1 }
1907
+ }
1908
+ },
1909
+ "retry": {
1910
+ "type": "object",
1911
+ "additionalProperties": false,
1912
+ "required": [
1913
+ "maxAttempts",
1914
+ "initialDelayMs",
1915
+ "maxDelayMs",
1916
+ "totalMs"
1917
+ ],
1918
+ "properties": {
1919
+ "maxAttempts": { "type": "integer", "minimum": 1 },
1920
+ "initialDelayMs": { "type": "integer", "minimum": 1 },
1921
+ "maxDelayMs": { "type": "integer", "minimum": 1 },
1922
+ "totalMs": { "type": "integer", "minimum": 1 }
1923
+ }
1924
+ },
1925
+ "failure": {
1926
+ "type": "object",
1927
+ "additionalProperties": false,
1928
+ "required": ["consecutiveFailures", "windowMs"],
1929
+ "properties": {
1930
+ "consecutiveFailures": { "type": "integer", "minimum": 1 },
1931
+ "windowMs": { "type": "integer", "minimum": 1 }
1932
+ }
1933
+ }
1934
+ }
1935
+ },
1936
+ "InitPayload": {
1937
+ "description": "init 消息负载:实例、locale、theme、能力与资源预算。",
1938
+ "title": "InitPayload",
1939
+ "type": "object",
1940
+ "additionalProperties": false,
1941
+ "required": [
1942
+ "instanceId",
1943
+ "locale",
1944
+ "theme",
1945
+ "capabilities",
1946
+ "resourceBudget"
1947
+ ],
1948
+ "properties": {
1949
+ "instanceId": { "type": "string", "minLength": 1 },
1950
+ "locale": { "type": "string", "minLength": 1 },
1951
+ "theme": { "$ref": "#/$defs/Theme" },
1952
+ "capabilities": {
1953
+ "type": "array",
1954
+ "items": { "$ref": "#/$defs/GrantedCapability" }
1955
+ },
1956
+ "resourceBudget": { "$ref": "#/$defs/ResourceBudget" }
1957
+ }
1958
+ },
1959
+ "BridgeEnvelopeBase": {
1960
+ "description": "Bridge 信封公共字段:protocolVersion、channelId、messageId、sequence。",
1961
+ "title": "BridgeEnvelopeBase",
1962
+ "type": "object",
1963
+ "required": ["protocolVersion", "channelId", "messageId", "sequence"],
1964
+ "properties": {
1965
+ "protocolVersion": { "const": 1 },
1966
+ "channelId": { "type": "string", "minLength": 16 },
1967
+ "messageId": { "type": "string", "minLength": 1 },
1968
+ "sequence": { "type": "integer", "minimum": 1 }
1969
+ }
1970
+ },
1971
+ "InitMessage": {
1972
+ "description": "Host 下发初始上下文的 Bridge 消息。",
1973
+ "title": "InitMessage",
1974
+ "type": "object",
1975
+ "allOf": [
1976
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1977
+ {
1978
+ "type": "object",
1979
+ "required": ["type", "payload"],
1980
+ "properties": {
1981
+ "type": { "const": "init" },
1982
+ "payload": { "$ref": "#/$defs/InitPayload" }
1983
+ }
1984
+ }
1985
+ ],
1986
+ "unevaluatedProperties": false
1987
+ },
1988
+ "RenderMessage": {
1989
+ "description": "Host 下发完整渲染快照的 Bridge 消息;type 为 render 或 update。",
1990
+ "title": "RenderMessage",
1991
+ "type": "object",
1992
+ "allOf": [
1993
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
1994
+ {
1995
+ "type": "object",
1996
+ "required": ["type", "payload"],
1997
+ "properties": {
1998
+ "type": { "enum": ["render", "update"] },
1999
+ "payload": { "$ref": "#/$defs/RenderRequest" }
2000
+ }
2001
+ }
2002
+ ],
2003
+ "unevaluatedProperties": false
2004
+ },
2005
+ "CapabilityResultMessage": {
2006
+ "description": "Host 返回能力请求结果的 Bridge 消息。",
2007
+ "title": "CapabilityResultMessage",
2008
+ "type": "object",
2009
+ "allOf": [
2010
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
2011
+ {
2012
+ "type": "object",
2013
+ "required": ["type", "payload"],
2014
+ "properties": {
2015
+ "type": { "const": "capability-result" },
2016
+ "payload": {
2017
+ "type": "object",
2018
+ "additionalProperties": false,
2019
+ "required": ["requestId", "result"],
2020
+ "properties": {
2021
+ "requestId": { "type": "string", "minLength": 1 },
2022
+ "result": { "$ref": "#/$defs/CapabilityResult" }
2023
+ }
2024
+ }
2025
+ }
2026
+ }
2027
+ ],
2028
+ "unevaluatedProperties": false
2029
+ },
2030
+ "ErrorMessage": {
2031
+ "description": "任一方向的结构化错误 Bridge 消息。",
2032
+ "title": "ErrorMessage",
2033
+ "type": "object",
2034
+ "allOf": [
2035
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
2036
+ {
2037
+ "type": "object",
2038
+ "required": ["type", "payload"],
2039
+ "properties": {
2040
+ "type": { "const": "error" },
2041
+ "payload": { "$ref": "#/$defs/WidgetError" }
2042
+ }
2043
+ }
2044
+ ],
2045
+ "unevaluatedProperties": false
2046
+ },
2047
+ "DisposeMessage": {
2048
+ "description": "Host 通知销毁实例的终态 Bridge 消息。",
2049
+ "title": "DisposeMessage",
2050
+ "type": "object",
2051
+ "allOf": [
2052
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
2053
+ {
2054
+ "type": "object",
2055
+ "required": ["type", "payload"],
2056
+ "properties": {
2057
+ "type": { "const": "dispose" },
2058
+ "payload": {
2059
+ "type": "object",
2060
+ "additionalProperties": false,
2061
+ "required": ["reason", "deadlineMs"],
2062
+ "properties": {
2063
+ "reason": { "type": "string", "minLength": 1 },
2064
+ "deadlineMs": { "type": "integer", "minimum": 1 }
2065
+ }
2066
+ }
2067
+ }
2068
+ }
2069
+ ],
2070
+ "unevaluatedProperties": false
2071
+ },
2072
+ "ReadyMessage": {
2073
+ "description": "Widget 向 Host 上报就绪的 Bridge 消息;含 SDK 与 Host API 版本。",
2074
+ "title": "ReadyMessage",
2075
+ "type": "object",
2076
+ "allOf": [
2077
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
2078
+ {
2079
+ "type": "object",
2080
+ "required": ["type", "payload"],
2081
+ "properties": {
2082
+ "type": { "const": "ready" },
2083
+ "payload": {
2084
+ "type": "object",
2085
+ "additionalProperties": false,
2086
+ "required": ["widgetSdkVersion", "hostApiVersion"],
2087
+ "properties": {
2088
+ "widgetSdkVersion": { "type": "string", "minLength": 1 },
2089
+ "hostApiVersion": { "const": 1 }
2090
+ }
2091
+ }
2092
+ }
2093
+ }
2094
+ ],
2095
+ "unevaluatedProperties": false
2096
+ },
2097
+ "ResizeMessage": {
2098
+ "description": "Widget 请求调整视口尺寸的 Bridge 消息。",
2099
+ "title": "ResizeMessage",
2100
+ "type": "object",
2101
+ "allOf": [
2102
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
2103
+ {
2104
+ "type": "object",
2105
+ "required": ["type", "payload"],
2106
+ "properties": {
2107
+ "type": { "const": "resize" },
2108
+ "payload": {
2109
+ "type": "object",
2110
+ "additionalProperties": false,
2111
+ "required": ["width", "height"],
2112
+ "properties": {
2113
+ "width": { "type": "number", "minimum": 0 },
2114
+ "height": { "type": "number", "minimum": 0 }
2115
+ }
2116
+ }
2117
+ }
2118
+ }
2119
+ ],
2120
+ "unevaluatedProperties": false
2121
+ },
2122
+ "CapabilityRequestMessage": {
2123
+ "description": "Widget 发起能力请求的 Bridge 消息。",
2124
+ "title": "CapabilityRequestMessage",
2125
+ "type": "object",
2126
+ "allOf": [
2127
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
2128
+ {
2129
+ "type": "object",
2130
+ "required": ["type", "payload"],
2131
+ "properties": {
2132
+ "type": { "const": "capability-request" },
2133
+ "payload": {
2134
+ "type": "object",
2135
+ "additionalProperties": false,
2136
+ "required": ["requestId", "request"],
2137
+ "properties": {
2138
+ "requestId": { "type": "string", "minLength": 1 },
2139
+ "request": { "$ref": "#/$defs/CapabilityRequest" }
2140
+ }
2141
+ }
2142
+ }
2143
+ }
2144
+ ],
2145
+ "unevaluatedProperties": false
2146
+ },
2147
+ "HostToWidgetMessage": {
2148
+ "description": "Host → Widget 的 Bridge 消息联合。",
2149
+ "title": "HostToWidgetMessage",
2150
+ "oneOf": [
2151
+ { "$ref": "#/$defs/InitMessage" },
2152
+ { "$ref": "#/$defs/RenderMessage" },
2153
+ { "$ref": "#/$defs/WidgetEventMessage" },
2154
+ { "$ref": "#/$defs/CapabilityResultMessage" },
2155
+ { "$ref": "#/$defs/ErrorMessage" },
2156
+ { "$ref": "#/$defs/DisposeMessage" }
2157
+ ]
2158
+ },
2159
+ "WidgetToHostMessage": {
2160
+ "description": "Widget → Host 的 Bridge 消息联合。",
2161
+ "title": "WidgetToHostMessage",
2162
+ "oneOf": [
2163
+ { "$ref": "#/$defs/ReadyMessage" },
2164
+ { "$ref": "#/$defs/ResizeMessage" },
2165
+ { "$ref": "#/$defs/CapabilityRequestMessage" },
2166
+ { "$ref": "#/$defs/ErrorMessage" }
2167
+ ]
2168
+ },
2169
+ "PublicWidgetEventTopic": {
2170
+ "title": "PublicWidgetEventTopic",
2171
+ "description": "Agent Widget 从当前 Workflow 流公开的事件主题。",
2172
+ "enum": [
2173
+ "workflow.lifecycle",
2174
+ "tools.lifecycle",
2175
+ "approval.lifecycle",
2176
+ "interaction.lifecycle"
2177
+ ]
2178
+ },
2179
+ "PublicWidgetEvent": {
2180
+ "title": "PublicWidgetEvent",
2181
+ "description": "Agent Widget 从已解析 Workflow 事件构造并向 Widget Runtime 推送的事件联合。",
2182
+ "oneOf": [
2183
+ { "$ref": "#/$defs/WorkflowStartedPublicWidgetEvent" },
2184
+ { "$ref": "#/$defs/WorkflowDonePublicWidgetEvent" },
2185
+ { "$ref": "#/$defs/WorkflowErrorPublicWidgetEvent" },
2186
+ { "$ref": "#/$defs/ToolCallPublicWidgetEvent" },
2187
+ { "$ref": "#/$defs/ToolResultPublicWidgetEvent" },
2188
+ { "$ref": "#/$defs/SandboxApprovalRequestedPublicWidgetEvent" },
2189
+ { "$ref": "#/$defs/SandboxApprovedPublicWidgetEvent" },
2190
+ { "$ref": "#/$defs/SandboxDeniedPublicWidgetEvent" },
2191
+ { "$ref": "#/$defs/UserInputRequestedPublicWidgetEvent" },
2192
+ { "$ref": "#/$defs/ComputeReviewRequestedPublicWidgetEvent" }
2193
+ ]
2194
+ },
2195
+ "WidgetLiveEvent": {
2196
+ "title": "WidgetLiveEvent",
2197
+ "description": "Host 从当前 Runtime 向 iframe 主动推送的聚合事件;事件由 type 唯一标识。",
2198
+ "type": "object",
2199
+ "additionalProperties": false,
2200
+ "required": ["type", "payload"],
2201
+ "properties": {
2202
+ "type": {
2203
+ "$ref": "#/$defs/WidgetEventName"
2204
+ },
2205
+ "payload": {
2206
+ "type": "object",
2207
+ "additionalProperties": { "$ref": "#/$defs/JsonValue" }
2208
+ }
2209
+ }
2210
+ },
2211
+ "WidgetEventName": {
2212
+ "title": "WidgetEventName",
2213
+ "description": "已激活 Widget 可监听的实时事件;session.start 只用于激活,不在此列。",
2214
+ "type": "string",
2215
+ "enum": [
2216
+ "turn-start",
2217
+ "turn-end",
2218
+ "step-start",
2219
+ "step-end",
2220
+ "tool-call-generating",
2221
+ "tool-call-waiting",
2222
+ "tool-call-running",
2223
+ "tool-call-result",
2224
+ "tool-call-error",
2225
+ "workspace-file-changed",
2226
+ "workspace-tree-refresh",
2227
+ "workspace-file-opened",
2228
+ "ui-tool-opened",
2229
+ "ui-panel-focused",
2230
+ "host-surface-changed"
2231
+ ]
2232
+ },
2233
+ "PublicWidgetEventId": {
2234
+ "title": "PublicWidgetEventId",
2235
+ "description": "用于同一 Agent Widget Runtime 内去重的稳定事件标识。",
2236
+ "type": "string",
2237
+ "minLength": 1,
2238
+ "maxLength": 256
2239
+ },
2240
+ "PublicWidgetSessionId": {
2241
+ "title": "PublicWidgetSessionId",
2242
+ "description": "事件所属的 Session 标识。",
2243
+ "type": "string",
2244
+ "minLength": 1,
2245
+ "maxLength": 256
2246
+ },
2247
+ "PublicWidgetWorkflowId": {
2248
+ "title": "PublicWidgetWorkflowId",
2249
+ "description": "事件所属的 Workflow 标识。",
2250
+ "type": "string",
2251
+ "minLength": 1,
2252
+ "maxLength": 256
2253
+ },
2254
+ "PublicWidgetEventOccurredAt": {
2255
+ "title": "PublicWidgetEventOccurredAt",
2256
+ "description": "事件产生时间:YYYY-MM-DD + T + 非空格字符,以 Z 结尾。",
2257
+ "type": "string",
2258
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
2259
+ },
2260
+ "WorkflowStartedPublicWidgetEventPayload": {
2261
+ "title": "WorkflowStartedPublicWidgetEventPayload",
2262
+ "description": "Workflow 流已建立时公开的数据。",
2263
+ "type": "object",
2264
+ "additionalProperties": false,
2265
+ "required": ["protocolVersion"],
2266
+ "properties": {
2267
+ "protocolVersion": { "type": "integer", "minimum": 1 }
2268
+ }
2269
+ },
2270
+ "EmptyPublicWidgetEventPayload": {
2271
+ "title": "EmptyPublicWidgetEventPayload",
2272
+ "description": "没有额外业务字段的事件负载。",
2273
+ "type": "object",
2274
+ "additionalProperties": false
2275
+ },
2276
+ "WorkflowDonePublicWidgetEventPayload": {
2277
+ "title": "WorkflowDonePublicWidgetEventPayload",
2278
+ "description": "Workflow 正常结束时公开的数据。",
2279
+ "type": "object",
2280
+ "additionalProperties": false,
2281
+ "required": ["status"],
2282
+ "properties": {
2283
+ "status": { "enum": ["completed", "failed", "cancelled", "expired"] },
2284
+ "durationMs": { "type": "number", "minimum": 0 },
2285
+ "error": { "type": "string" }
2286
+ }
2287
+ },
2288
+ "WorkflowErrorPublicWidgetEventPayload": {
2289
+ "title": "WorkflowErrorPublicWidgetEventPayload",
2290
+ "description": "Workflow 错误事件公开的数据。",
2291
+ "type": "object",
2292
+ "additionalProperties": false,
2293
+ "required": ["terminal"],
2294
+ "properties": {
2295
+ "terminal": { "type": "boolean" },
2296
+ "error": { "type": "string" }
2297
+ }
2298
+ },
2299
+ "ToolCallPublicWidgetEventPayload": {
2300
+ "title": "ToolCallPublicWidgetEventPayload",
2301
+ "description": "tool-call 原始语义对应的公开数据。",
2302
+ "type": "object",
2303
+ "additionalProperties": false,
2304
+ "required": ["toolCallId", "toolName"],
2305
+ "properties": {
2306
+ "toolCallId": {
2307
+ "type": "string",
2308
+ "minLength": 1,
2309
+ "maxLength": 256
2310
+ },
2311
+ "toolName": {
2312
+ "type": "string",
2313
+ "minLength": 1,
2314
+ "maxLength": 128,
2315
+ "pattern": "^[A-Za-z0-9_.:-]+$"
2316
+ },
2317
+ "args": { "$ref": "#/$defs/JsonValue" },
2318
+ "executionState": { "enum": ["waiting", "running"] }
2319
+ }
2320
+ },
2321
+ "ToolResultPublicWidgetEventPayload": {
2322
+ "title": "ToolResultPublicWidgetEventPayload",
2323
+ "description": "tool-result 原始语义对应的公开数据。",
2324
+ "type": "object",
2325
+ "additionalProperties": false,
2326
+ "required": ["toolCallId", "output"],
2327
+ "properties": {
2328
+ "toolCallId": { "type": "string", "minLength": 1, "maxLength": 256 },
2329
+ "toolName": {
2330
+ "type": "string",
2331
+ "minLength": 1,
2332
+ "maxLength": 128,
2333
+ "pattern": "^[A-Za-z0-9_.:-]+$"
2334
+ },
2335
+ "output": { "$ref": "#/$defs/JsonValue" },
2336
+ "durationMs": { "type": "number", "minimum": 0 }
2337
+ }
2338
+ },
2339
+ "SandboxApprovalRequestedPublicWidgetEventPayload": {
2340
+ "title": "SandboxApprovalRequestedPublicWidgetEventPayload",
2341
+ "description": "沙盒审批请求公开的数据。",
2342
+ "type": "object",
2343
+ "additionalProperties": false,
2344
+ "required": ["approvalId", "mode"],
2345
+ "properties": {
2346
+ "approvalId": { "type": "string", "minLength": 1, "maxLength": 256 },
2347
+ "mode": { "enum": ["create", "reuse"] },
2348
+ "sandboxName": { "type": "string" },
2349
+ "resource": { "$ref": "#/$defs/JsonValue" },
2350
+ "existingSandboxes": {
2351
+ "type": "array",
2352
+ "items": {
2353
+ "type": "object",
2354
+ "additionalProperties": false,
2355
+ "required": ["id", "name"],
2356
+ "properties": {
2357
+ "id": { "type": "string", "minLength": 1 },
2358
+ "name": { "type": "string", "minLength": 1 }
2359
+ }
2360
+ }
2361
+ },
2362
+ "proxyAgentName": { "type": "string" }
2363
+ }
2364
+ },
2365
+ "SandboxApprovedPublicWidgetEventPayload": {
2366
+ "title": "SandboxApprovedPublicWidgetEventPayload",
2367
+ "description": "沙盒审批通过时公开的数据。",
2368
+ "type": "object",
2369
+ "additionalProperties": false,
2370
+ "required": ["sandboxId"],
2371
+ "properties": {
2372
+ "sandboxId": { "type": "string", "minLength": 1, "maxLength": 256 }
2373
+ }
2374
+ },
2375
+ "UserInputRequestedPublicWidgetEventPayload": {
2376
+ "title": "UserInputRequestedPublicWidgetEventPayload",
2377
+ "description": "用户输入请求公开的数据。",
2378
+ "type": "object",
2379
+ "additionalProperties": false,
2380
+ "properties": {
2381
+ "toolCallId": { "type": "string", "minLength": 1, "maxLength": 256 },
2382
+ "requestId": { "type": "string", "minLength": 1, "maxLength": 256 },
2383
+ "request": { "$ref": "#/$defs/JsonValue" },
2384
+ "schema": { "$ref": "#/$defs/JsonValue" },
2385
+ "title": { "type": "string" },
2386
+ "description": { "type": "string" },
2387
+ "retryAttempt": { "type": "integer", "minimum": 0 },
2388
+ "retryMessage": { "type": "string" },
2389
+ "cancellable": { "type": "boolean" },
2390
+ "timeoutSeconds": { "type": "number", "minimum": 0 },
2391
+ "proxyWorkflowId": { "type": "string" },
2392
+ "proxyAgentName": { "type": "string" }
2393
+ }
2394
+ },
2395
+ "ComputeReviewRequestedPublicWidgetEventPayload": {
2396
+ "title": "ComputeReviewRequestedPublicWidgetEventPayload",
2397
+ "description": "计算任务审批请求公开的数据。",
2398
+ "type": "object",
2399
+ "additionalProperties": false,
2400
+ "required": ["draftId", "toolCallId"],
2401
+ "properties": {
2402
+ "draftId": { "type": "string", "minLength": 1, "maxLength": 256 },
2403
+ "toolCallId": { "type": "string", "minLength": 1, "maxLength": 256 }
2404
+ }
2405
+ },
2406
+ "PublicWidgetEventBase": {
2407
+ "description": "公开事件公共字段:schemaVersion、id、occurredAt、sessionId、workflowId。",
2408
+ "title": "PublicWidgetEventBase",
2409
+ "type": "object",
2410
+ "required": [
2411
+ "schemaVersion",
2412
+ "id",
2413
+ "occurredAt",
2414
+ "sessionId",
2415
+ "workflowId"
2416
+ ],
2417
+ "properties": {
2418
+ "schemaVersion": { "const": 1 },
2419
+ "id": { "$ref": "#/$defs/PublicWidgetEventId" },
2420
+ "occurredAt": { "$ref": "#/$defs/PublicWidgetEventOccurredAt" },
2421
+ "sessionId": { "$ref": "#/$defs/PublicWidgetSessionId" },
2422
+ "workflowId": { "$ref": "#/$defs/PublicWidgetWorkflowId" }
2423
+ }
2424
+ },
2425
+ "WorkflowStartedPublicWidgetEvent": {
2426
+ "title": "WorkflowStartedPublicWidgetEvent",
2427
+ "description": "Workflow 流建立事件。",
2428
+ "type": "object",
2429
+ "allOf": [
2430
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2431
+ {
2432
+ "type": "object",
2433
+ "required": ["topic", "type", "payload"],
2434
+ "properties": {
2435
+ "topic": { "const": "workflow.lifecycle" },
2436
+ "type": { "const": "connected" },
2437
+ "payload": { "$ref": "#/$defs/WorkflowStartedPublicWidgetEventPayload" }
2438
+ }
2439
+ }
2440
+ ],
2441
+ "unevaluatedProperties": false
2442
+ },
2443
+ "WorkflowDonePublicWidgetEvent": {
2444
+ "title": "WorkflowDonePublicWidgetEvent",
2445
+ "description": "Workflow 正常终态事件。",
2446
+ "type": "object",
2447
+ "allOf": [
2448
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2449
+ {
2450
+ "type": "object",
2451
+ "required": ["topic", "type", "payload"],
2452
+ "properties": {
2453
+ "topic": { "const": "workflow.lifecycle" },
2454
+ "type": { "const": "done" },
2455
+ "payload": { "$ref": "#/$defs/WorkflowDonePublicWidgetEventPayload" }
2456
+ }
2457
+ }
2458
+ ],
2459
+ "unevaluatedProperties": false
2460
+ },
2461
+ "WorkflowErrorPublicWidgetEvent": {
2462
+ "title": "WorkflowErrorPublicWidgetEvent",
2463
+ "description": "Workflow 错误事件。",
2464
+ "type": "object",
2465
+ "allOf": [
2466
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2467
+ {
2468
+ "type": "object",
2469
+ "required": ["topic", "type", "payload"],
2470
+ "properties": {
2471
+ "topic": { "const": "workflow.lifecycle" },
2472
+ "type": { "const": "error" },
2473
+ "payload": { "$ref": "#/$defs/WorkflowErrorPublicWidgetEventPayload" }
2474
+ }
2475
+ }
2476
+ ],
2477
+ "unevaluatedProperties": false
2478
+ },
2479
+ "ToolCallPublicWidgetEvent": {
2480
+ "title": "ToolCallPublicWidgetEvent",
2481
+ "description": "tool-call 事件。",
2482
+ "type": "object",
2483
+ "allOf": [
2484
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2485
+ {
2486
+ "type": "object",
2487
+ "required": ["topic", "type", "payload"],
2488
+ "properties": {
2489
+ "topic": { "const": "tools.lifecycle" },
2490
+ "type": { "const": "tool-call" },
2491
+ "payload": { "$ref": "#/$defs/ToolCallPublicWidgetEventPayload" }
2492
+ }
2493
+ }
2494
+ ],
2495
+ "unevaluatedProperties": false
2496
+ },
2497
+ "ToolResultPublicWidgetEvent": {
2498
+ "title": "ToolResultPublicWidgetEvent",
2499
+ "description": "tool-result 事件。",
2500
+ "type": "object",
2501
+ "allOf": [
2502
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2503
+ {
2504
+ "type": "object",
2505
+ "required": ["topic", "type", "payload"],
2506
+ "properties": {
2507
+ "topic": { "const": "tools.lifecycle" },
2508
+ "type": { "const": "tool-result" },
2509
+ "payload": { "$ref": "#/$defs/ToolResultPublicWidgetEventPayload" }
2510
+ }
2511
+ }
2512
+ ],
2513
+ "unevaluatedProperties": false
2514
+ },
2515
+ "SandboxApprovalRequestedPublicWidgetEvent": {
2516
+ "title": "SandboxApprovalRequestedPublicWidgetEvent",
2517
+ "description": "sandbox-approval-requested 事件。",
2518
+ "type": "object",
2519
+ "allOf": [
2520
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2521
+ {
2522
+ "type": "object",
2523
+ "required": ["topic", "type", "payload"],
2524
+ "properties": {
2525
+ "topic": { "const": "approval.lifecycle" },
2526
+ "type": { "const": "sandbox-approval-requested" },
2527
+ "payload": { "$ref": "#/$defs/SandboxApprovalRequestedPublicWidgetEventPayload" }
2528
+ }
2529
+ }
2530
+ ],
2531
+ "unevaluatedProperties": false
2532
+ },
2533
+ "SandboxApprovedPublicWidgetEvent": {
2534
+ "title": "SandboxApprovedPublicWidgetEvent",
2535
+ "description": "sandbox-approved 事件。",
2536
+ "type": "object",
2537
+ "allOf": [
2538
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2539
+ {
2540
+ "type": "object",
2541
+ "required": ["topic", "type", "payload"],
2542
+ "properties": {
2543
+ "topic": { "const": "approval.lifecycle" },
2544
+ "type": { "const": "sandbox-approved" },
2545
+ "payload": { "$ref": "#/$defs/SandboxApprovedPublicWidgetEventPayload" }
2546
+ }
2547
+ }
2548
+ ],
2549
+ "unevaluatedProperties": false
2550
+ },
2551
+ "SandboxDeniedPublicWidgetEvent": {
2552
+ "title": "SandboxDeniedPublicWidgetEvent",
2553
+ "description": "sandbox-denied 事件。",
2554
+ "type": "object",
2555
+ "allOf": [
2556
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2557
+ {
2558
+ "type": "object",
2559
+ "required": ["topic", "type", "payload"],
2560
+ "properties": {
2561
+ "topic": { "const": "approval.lifecycle" },
2562
+ "type": { "const": "sandbox-denied" },
2563
+ "payload": { "$ref": "#/$defs/EmptyPublicWidgetEventPayload" }
2564
+ }
2565
+ }
2566
+ ],
2567
+ "unevaluatedProperties": false
2568
+ },
2569
+ "UserInputRequestedPublicWidgetEvent": {
2570
+ "title": "UserInputRequestedPublicWidgetEvent",
2571
+ "description": "user-input-requested 事件。",
2572
+ "type": "object",
2573
+ "allOf": [
2574
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2575
+ {
2576
+ "type": "object",
2577
+ "required": ["topic", "type", "payload"],
2578
+ "properties": {
2579
+ "topic": { "const": "interaction.lifecycle" },
2580
+ "type": { "const": "user-input-requested" },
2581
+ "payload": { "$ref": "#/$defs/UserInputRequestedPublicWidgetEventPayload" }
2582
+ }
2583
+ }
2584
+ ],
2585
+ "unevaluatedProperties": false
2586
+ },
2587
+ "ComputeReviewRequestedPublicWidgetEvent": {
2588
+ "title": "ComputeReviewRequestedPublicWidgetEvent",
2589
+ "description": "compute-review-requested 事件。",
2590
+ "type": "object",
2591
+ "allOf": [
2592
+ { "$ref": "#/$defs/PublicWidgetEventBase" },
2593
+ {
2594
+ "type": "object",
2595
+ "required": ["topic", "type", "payload"],
2596
+ "properties": {
2597
+ "topic": { "const": "interaction.lifecycle" },
2598
+ "type": { "const": "compute-review-requested" },
2599
+ "payload": { "$ref": "#/$defs/ComputeReviewRequestedPublicWidgetEventPayload" }
2600
+ }
2601
+ }
2602
+ ],
2603
+ "unevaluatedProperties": false
2604
+ },
2605
+ "WidgetEventMessage": {
2606
+ "title": "WidgetEventMessage",
2607
+ "description": "Host 通过当前 Widget MessageChannel 主动推送的 Workflow 事件。",
2608
+ "type": "object",
2609
+ "allOf": [
2610
+ { "$ref": "#/$defs/BridgeEnvelopeBase" },
2611
+ {
2612
+ "type": "object",
2613
+ "required": ["type", "payload"],
2614
+ "properties": {
2615
+ "type": { "const": "event" },
2616
+ "payload": { "$ref": "#/$defs/WidgetLiveEvent" }
2617
+ }
2618
+ }
2619
+ ],
2620
+ "unevaluatedProperties": false
2621
+ },
2622
+ "WidgetEvent": {
2623
+ "description": "低层 events.read 事件页中的单条原始事件;type 为受限标识、payload 为 JSON。",
2624
+ "type": "object",
2625
+ "additionalProperties": false,
2626
+ "required": [
2627
+ "id",
2628
+ "type",
2629
+ "payload"
2630
+ ],
2631
+ "properties": {
2632
+ "id": {
2633
+ "type": "string",
2634
+ "minLength": 1,
2635
+ "maxLength": 256
2636
+ },
2637
+ "type": {
2638
+ "type": "string",
2639
+ "minLength": 1,
2640
+ "maxLength": 128,
2641
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
2642
+ },
2643
+ "payload": {
2644
+ "$ref": "#/$defs/JsonValue"
2645
+ }
2646
+ }
2647
+ },
2648
+ "WidgetEventBatch": {
2649
+ "description": "低层 events.read 的一页事件:topic、cursor、reset、hasMore 与事件列表。",
2650
+ "type": "object",
2651
+ "additionalProperties": false,
2652
+ "required": [
2653
+ "schemaVersion",
2654
+ "topic",
2655
+ "cursor",
2656
+ "reset",
2657
+ "hasMore",
2658
+ "events"
2659
+ ],
2660
+ "properties": {
2661
+ "schemaVersion": {
2662
+ "const": 1
2663
+ },
2664
+ "topic": {
2665
+ "type": "string",
2666
+ "minLength": 1,
2667
+ "maxLength": 128,
2668
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
2669
+ },
2670
+ "cursor": {
2671
+ "type": "string",
2672
+ "minLength": 1,
2673
+ "maxLength": 256
2674
+ },
2675
+ "reset": {
2676
+ "type": "boolean"
2677
+ },
2678
+ "hasMore": {
2679
+ "type": "boolean"
2680
+ },
2681
+ "events": {
2682
+ "type": "array",
2683
+ "maxItems": 100,
2684
+ "items": {
2685
+ "$ref": "#/$defs/WidgetEvent"
2686
+ }
2687
+ },
2688
+ "snapshot": {
2689
+ "$ref": "#/$defs/JsonValue"
2690
+ }
2691
+ }
2692
+ },
2693
+ "ToolLifecycleEvent": {
2694
+ "description": "工具生命周期事件:started / completed / failed / cancelled。",
2695
+ "type": "object",
2696
+ "additionalProperties": false,
2697
+ "required": [
2698
+ "toolCallId",
2699
+ "toolName",
2700
+ "phase"
2701
+ ],
2702
+ "properties": {
2703
+ "toolCallId": {
2704
+ "type": "string",
2705
+ "minLength": 1,
2706
+ "maxLength": 256
2707
+ },
2708
+ "toolName": {
2709
+ "type": "string",
2710
+ "minLength": 1,
2711
+ "maxLength": 128,
2712
+ "pattern": "^[A-Za-z0-9_.:-]+$"
2713
+ },
2714
+ "phase": {
2715
+ "enum": [
2716
+ "started",
2717
+ "completed",
2718
+ "failed",
2719
+ "cancelled"
2720
+ ]
2721
+ }
2722
+ }
2723
+ }
2724
+ }
2725
+ }