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