@dp-bohrium/widget-cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,305 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "host-runtime-config.schema.json",
4
+ "description": "Host 为一次 Widget 运行签发并下发给 agent-widget 的运行时配置,不直接发给 Widget。",
5
+ "title": "Widget Host Runtime Config",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schemaVersion",
10
+ "hostApiVersion",
11
+ "configId",
12
+ "runId",
13
+ "mode",
14
+ "issuedAt",
15
+ "expiresAt",
16
+ "recheckAt",
17
+ "securityProfile",
18
+ "resourceBudget",
19
+ "runtime",
20
+ "network",
21
+ "bindings"
22
+ ],
23
+ "properties": {
24
+ "schemaVersion": { "const": 1 },
25
+ "hostApiVersion": { "const": 1 },
26
+ "configId": { "$ref": "#/$defs/Identifier" },
27
+ "hostId": { "$ref": "#/$defs/Identifier" },
28
+ "runId": { "$ref": "#/$defs/Identifier" },
29
+ "mode": { "$ref": "#/$defs/Mode" },
30
+ "issuedAt": { "$ref": "#/$defs/Timestamp" },
31
+ "expiresAt": { "$ref": "#/$defs/Timestamp" },
32
+ "recheckAt": { "$ref": "#/$defs/Timestamp" },
33
+ "securityProfile": { "const": "runtime-security-profile-v1" },
34
+ "resourceBudget": {
35
+ "$ref": "widget-runtime-contracts.schema.json#/$defs/ResourceBudget"
36
+ },
37
+ "runtime": { "$ref": "#/$defs/RuntimeAuthority" },
38
+ "network": { "$ref": "#/$defs/NetworkAuthority" },
39
+ "bindings": {
40
+ "type": "array",
41
+ "items": {
42
+ "oneOf": [
43
+ { "$ref": "#/$defs/LoadableBinding" },
44
+ { "$ref": "#/$defs/FallbackBinding" }
45
+ ]
46
+ }
47
+ }
48
+ },
49
+ "$defs": {
50
+ "LoadableBinding": {
51
+ "description": "可加载绑定:状态为 loadable,携带冻结版本、摘要、Manifest、启动地址与能力授权。",
52
+ "title": "LoadableBinding",
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": [
56
+ "status",
57
+ "bindingId",
58
+ "widgetId",
59
+ "widgetVersionId",
60
+ "digest",
61
+ "manifest",
62
+ "launch",
63
+ "grantedCapabilities"
64
+ ],
65
+ "properties": {
66
+ "status": { "const": "loadable" },
67
+ "bindingId": { "$ref": "#/$defs/Identifier" },
68
+ "widgetId": { "$ref": "#/$defs/Identifier" },
69
+ "widgetVersionId": { "$ref": "#/$defs/Identifier" },
70
+ "digest": { "$ref": "#/$defs/Digest" },
71
+ "trustClass": {
72
+ "description": "控制面确认的信任等级;作者不能自行声明。",
73
+ "enum": ["external", "first-party"]
74
+ },
75
+ "runtimeProfile": {
76
+ "description": "控制面选择的部署配置;不授予 Cookie 或 Token 读取权限。",
77
+ "enum": ["public-isolated", "first-party-private"]
78
+ },
79
+ "manifest": {
80
+ "$ref": "widget-manifest.schema.json"
81
+ },
82
+ "launch": { "$ref": "#/$defs/Launch" },
83
+ "grantedCapabilities": { "$ref": "#/$defs/GrantedCapabilities" },
84
+ "serviceAccess": { "$ref": "#/$defs/WidgetServiceAccess" },
85
+ "serviceAuthorization": { "$ref": "#/$defs/HostServiceAuthorization" }
86
+ }
87
+ },
88
+ "HostServiceAuthorization": {
89
+ "title": "HostServiceAuthorization",
90
+ "description": "Host-only evidence bound to the exact reviewed Widget bundle and current user grant.",
91
+ "oneOf": [
92
+ { "$ref": "#/$defs/HostServiceAuthorizationRequired" },
93
+ { "$ref": "#/$defs/HostServiceAuthorizationGranted" }
94
+ ]
95
+ },
96
+ "HostServiceAuthorizationRequired": {
97
+ "description": "需用户授权的 Host 服务证据:状态为 authorization-required。",
98
+ "title": "HostServiceAuthorizationRequired",
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": [
102
+ "kind",
103
+ "policy",
104
+ "status",
105
+ "hostId",
106
+ "widgetVersionId",
107
+ "bundleDigest",
108
+ "reviewRevision",
109
+ "reviewedPermissions",
110
+ "grantedPermissions",
111
+ "expiresAt"
112
+ ],
113
+ "properties": {
114
+ "kind": { "const": "host-service-authorization" },
115
+ "policy": { "const": "host-user-data-v1" },
116
+ "status": { "const": "authorization-required" },
117
+ "hostId": { "$ref": "#/$defs/Identifier" },
118
+ "widgetVersionId": { "$ref": "#/$defs/Identifier" },
119
+ "bundleDigest": { "$ref": "#/$defs/Digest" },
120
+ "reviewRevision": { "$ref": "#/$defs/Identifier" },
121
+ "reviewedPermissions": {
122
+ "$ref": "widget-manifest.schema.json#/$defs/HostUserPermissions"
123
+ },
124
+ "grantedPermissions": {
125
+ "type": "array",
126
+ "maxItems": 0
127
+ },
128
+ "expiresAt": { "$ref": "#/$defs/Timestamp" }
129
+ }
130
+ },
131
+ "HostServiceAuthorizationGranted": {
132
+ "description": "已授予的 Host 服务证据:状态为 granted。",
133
+ "title": "HostServiceAuthorizationGranted",
134
+ "type": "object",
135
+ "additionalProperties": false,
136
+ "required": [
137
+ "kind",
138
+ "policy",
139
+ "status",
140
+ "hostId",
141
+ "widgetVersionId",
142
+ "bundleDigest",
143
+ "reviewRevision",
144
+ "grantRevision",
145
+ "reviewedPermissions",
146
+ "grantedPermissions",
147
+ "expiresAt"
148
+ ],
149
+ "properties": {
150
+ "kind": { "const": "host-service-authorization" },
151
+ "policy": { "const": "host-user-data-v1" },
152
+ "status": { "const": "granted" },
153
+ "hostId": { "$ref": "#/$defs/Identifier" },
154
+ "widgetVersionId": { "$ref": "#/$defs/Identifier" },
155
+ "bundleDigest": { "$ref": "#/$defs/Digest" },
156
+ "reviewRevision": { "$ref": "#/$defs/Identifier" },
157
+ "grantRevision": { "$ref": "#/$defs/Identifier" },
158
+ "reviewedPermissions": {
159
+ "$ref": "widget-manifest.schema.json#/$defs/HostUserPermissions"
160
+ },
161
+ "grantedPermissions": {
162
+ "$ref": "widget-manifest.schema.json#/$defs/HostUserPermissions"
163
+ },
164
+ "expiresAt": { "$ref": "#/$defs/Timestamp" }
165
+ }
166
+ },
167
+ "FallbackBinding": {
168
+ "description": "降级绑定:状态为 fallback,不含 Bundle 地址、摘要、Manifest 或能力授权。",
169
+ "title": "FallbackBinding",
170
+ "type": "object",
171
+ "additionalProperties": false,
172
+ "required": [
173
+ "status",
174
+ "bindingId",
175
+ "widgetId",
176
+ "widgetVersionId",
177
+ "contribution",
178
+ "reason"
179
+ ],
180
+ "properties": {
181
+ "status": { "const": "fallback" },
182
+ "bindingId": { "$ref": "#/$defs/Identifier" },
183
+ "widgetId": { "$ref": "#/$defs/Identifier" },
184
+ "widgetVersionId": { "$ref": "#/$defs/Identifier" },
185
+ "contribution": {
186
+ "$ref": "widget-manifest.schema.json#/$defs/WidgetContributionConfig"
187
+ },
188
+ "reason": { "$ref": "#/$defs/FallbackReason" }
189
+ }
190
+ },
191
+ "RuntimeAuthority": {
192
+ "description": "运行域授权:origin 与 catalogRevision。",
193
+ "title": "RuntimeAuthority",
194
+ "type": "object",
195
+ "additionalProperties": false,
196
+ "required": ["origin", "catalogRevision"],
197
+ "properties": {
198
+ "origin": { "$ref": "#/$defs/RuntimeOrigin" },
199
+ "catalogRevision": {
200
+ "type": "string",
201
+ "minLength": 1,
202
+ "maxLength": 128,
203
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
204
+ },
205
+ "profile": {
206
+ "enum": ["public-isolated", "first-party-private"]
207
+ }
208
+ }
209
+ },
210
+ "NetworkAuthority": {
211
+ "description": "网络授权:mode、policyVersion 与限制。",
212
+ "title": "NetworkAuthority",
213
+ "type": "object",
214
+ "additionalProperties": false,
215
+ "required": ["mode", "policyVersion", "limits"],
216
+ "properties": {
217
+ "mode": { "enum": ["runtime-consent", "unavailable"] },
218
+ "policyVersion": {
219
+ "type": "string",
220
+ "minLength": 1,
221
+ "maxLength": 128,
222
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
223
+ },
224
+ "limits": {
225
+ "$ref": "widget-runtime-contracts.schema.json#/$defs/WidgetNetworkLimits"
226
+ }
227
+ }
228
+ },
229
+ "GrantedCapabilities": {
230
+ "description": "已授予能力列表。",
231
+ "title": "GrantedCapabilities",
232
+ "type": "array",
233
+ "items": {
234
+ "$ref": "widget-runtime-contracts.schema.json#/$defs/GrantedCapability"
235
+ }
236
+ },
237
+ "Launch": {
238
+ "description": "一次性启动地址与有效期。",
239
+ "title": "Launch",
240
+ "type": "object",
241
+ "additionalProperties": false,
242
+ "required": ["url", "expiresAt"],
243
+ "properties": {
244
+ "url": { "type": "string", "pattern": "^https?://" },
245
+ "expiresAt": { "$ref": "#/$defs/Timestamp" }
246
+ }
247
+ },
248
+ "RuntimeOrigin": {
249
+ "description": "隔离域运行源地址。",
250
+ "title": "RuntimeOrigin",
251
+ "type": "string",
252
+ "maxLength": 253,
253
+ "pattern": "^(?:https://[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::[0-9]{1,5})?|http://(?:localhost|127\\.0\\.0\\.1|\\[::1\\])(?::[0-9]{1,5})?)$"
254
+ },
255
+ "FallbackReason": {
256
+ "description": "降级原因枚举。",
257
+ "title": "FallbackReason",
258
+ "enum": [
259
+ "not-authorized",
260
+ "not-approved",
261
+ "delisted-for-new-use",
262
+ "revoked",
263
+ "host-api-unsupported",
264
+ "preview-not-allowed"
265
+ ]
266
+ },
267
+ "Digest": {
268
+ "description": "内容摘要;形如 sha256:<hex>。",
269
+ "title": "Digest",
270
+ "type": "string",
271
+ "pattern": "^sha256:[0-9a-f]{64}$"
272
+ },
273
+ "Identifier": {
274
+ "description": "不透明标识符。",
275
+ "title": "Identifier",
276
+ "type": "string",
277
+ "minLength": 1
278
+ },
279
+ "Mode": {
280
+ "description": "运行模式:preview 或 published。",
281
+ "title": "Mode",
282
+ "enum": ["preview", "published"]
283
+ },
284
+ "Timestamp": {
285
+ "description": "UTC 时间戳:YYYY-MM-DD + T + 非空格字符,以 Z 结尾。",
286
+ "title": "Timestamp",
287
+ "type": "string",
288
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
289
+ },
290
+ "WidgetServiceAccess": {
291
+ "title": "WidgetServiceAccess",
292
+ "description": "绑定当前不可变版本与摘要的审核投影;服务端每次调用仍须复核撤销和用户权限。",
293
+ "type": "object",
294
+ "additionalProperties": false,
295
+ "required": ["approvalId", "revision", "appId", "policyVersion", "expiresAt"],
296
+ "properties": {
297
+ "approvalId": { "$ref": "#/$defs/Identifier" },
298
+ "revision": { "$ref": "#/$defs/Identifier" },
299
+ "appId": { "$ref": "#/$defs/Identifier" },
300
+ "policyVersion": { "$ref": "#/$defs/Identifier" },
301
+ "expiresAt": { "$ref": "#/$defs/Timestamp" }
302
+ }
303
+ }
304
+ }
305
+ }
@@ -0,0 +1,360 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "widget-manifest.schema.json",
4
+ "description": "打包阶段生成的宿主 Widget 清单;name / description 仅用于首次展示默认值,widgetConfig 为冻结运行配置。",
5
+ "title": "Widget Manifest",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["name", "widgetConfig"],
9
+ "properties": {
10
+ "name": { "type": "string", "minLength": 1, "maxLength": 128 },
11
+ "description": { "type": "string", "maxLength": 2000 },
12
+ "widgetConfig": { "$ref": "#/$defs/WidgetConfig" }
13
+ },
14
+ "$defs": {
15
+ "WidgetConfig": {
16
+ "description": "打包阶段生成的冻结 Widget 运行配置;字段由 CLI 从作者清单写入,作者不得再直接覆盖。",
17
+ "title": "WidgetConfig",
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "required": [
21
+ "schemaVersion",
22
+ "hostApiVersion",
23
+ "widgetSdkVersion",
24
+ "entry",
25
+ "contribution",
26
+ "samples"
27
+ ],
28
+ "properties": {
29
+ "schemaVersion": { "const": 1 },
30
+ "hostApiVersion": { "const": 1 },
31
+ "widgetSdkVersion": { "$ref": "#/$defs/WidgetSdkVersion" },
32
+ "entry": { "$ref": "#/$defs/EntryPath" },
33
+ "contribution": { "$ref": "#/$defs/WidgetContributionConfig" },
34
+ "activationEvents": {
35
+ "description": "声明 Host 何时允许激活该 Widget;激活条件不授予事件读取能力。",
36
+ "$ref": "#/$defs/ActivationEvents"
37
+ },
38
+ "requestedCapabilities": {
39
+ "$ref": "#/$defs/RequestedCapabilities"
40
+ },
41
+ "requestedPermissions": { "$ref": "#/$defs/HostUserPermissions" },
42
+ "runtime": { "$ref": "#/$defs/RuntimeOptions" },
43
+ "samples": { "$ref": "#/$defs/Samples" }
44
+ }
45
+ },
46
+ "HostUserPermission": {
47
+ "description": "Widget 可申请读取的 Host 用户数据权限名:个人资料或邮箱。",
48
+ "title": "HostUserPermission",
49
+ "enum": ["host.user.profile.read", "host.user.email.read"]
50
+ },
51
+ "HostUserPermissions": {
52
+ "description": "Widget 申请的 Host 用户数据权限列表。",
53
+ "title": "HostUserPermissions",
54
+ "type": "array",
55
+ "minItems": 1,
56
+ "maxItems": 2,
57
+ "uniqueItems": true,
58
+ "items": { "$ref": "#/$defs/HostUserPermission" }
59
+ },
60
+ "RequestedCapabilities": {
61
+ "description": "Widget 申请的能力集合;声明仅表示申请,最终由 Host 按次授权。",
62
+ "title": "RequestedCapabilities",
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "properties": {
66
+ "files": { "$ref": "#/$defs/FilesCapabilityRequest" },
67
+ "events": { "$ref": "#/$defs/EventsCapabilityRequest" },
68
+ "tasks": { "$ref": "#/$defs/TasksCapabilityRequest" },
69
+ "state": { "$ref": "#/$defs/StateCapabilityRequest" },
70
+ "actions": { "$ref": "#/$defs/ActionsCapabilityRequest" },
71
+ "network": { "$ref": "#/$defs/NetworkCapabilityRequest" },
72
+ "presentation": {
73
+ "$ref": "#/$defs/RequestedPresentationCapability"
74
+ },
75
+ "region": {
76
+ "$ref": "#/$defs/RequestedRegionCapability"
77
+ }
78
+ }
79
+ },
80
+ "FilesCapabilityRequest": {
81
+ "description": "文件能力的独立申请开关;保存已有文件必须单独申请 files.write 并获得 Host 授权,可写范围由 Host grant 决定。",
82
+ "title": "FilesCapabilityRequest",
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "properties": {
86
+ "list": { "type": "boolean" },
87
+ "metadata": { "type": "boolean" },
88
+ "read": { "type": "boolean" },
89
+ "download": { "type": "boolean" },
90
+ "write": { "type": "boolean" }
91
+ }
92
+ },
93
+ "EventsCapabilityRequest": {
94
+ "description": "事件读取能力的申请;topics 声明要读取的事件主题。",
95
+ "title": "EventsCapabilityRequest",
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": ["topics"],
99
+ "properties": {
100
+ "topics": {
101
+ "type": "array",
102
+ "minItems": 1,
103
+ "maxItems": 32,
104
+ "uniqueItems": true,
105
+ "items": {
106
+ "type": "string",
107
+ "minLength": 1,
108
+ "maxLength": 128,
109
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
110
+ }
111
+ }
112
+ }
113
+ },
114
+ "TasksCapabilityRequest": {
115
+ "description": "任务观察能力的申请;watch 固定为 true。",
116
+ "title": "TasksCapabilityRequest",
117
+ "type": "object",
118
+ "additionalProperties": false,
119
+ "required": ["watch"],
120
+ "properties": {
121
+ "watch": { "const": true }
122
+ }
123
+ },
124
+ "StateCapabilityRequest": {
125
+ "description": "受限 UI 状态读写能力的申请;read / write 分别声明。",
126
+ "title": "StateCapabilityRequest",
127
+ "type": "object",
128
+ "additionalProperties": false,
129
+ "required": ["read", "write"],
130
+ "properties": {
131
+ "read": { "type": "boolean" },
132
+ "write": { "type": "boolean" }
133
+ }
134
+ },
135
+ "ActionsCapabilityRequest": {
136
+ "description": "Host 自定义动作调用能力的申请;names 声明可调用的动作名。",
137
+ "title": "ActionsCapabilityRequest",
138
+ "type": "object",
139
+ "additionalProperties": false,
140
+ "required": ["names"],
141
+ "properties": {
142
+ "names": {
143
+ "type": "array",
144
+ "minItems": 1,
145
+ "maxItems": 32,
146
+ "uniqueItems": true,
147
+ "items": {
148
+ "type": "string",
149
+ "minLength": 1,
150
+ "maxLength": 128,
151
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
152
+ }
153
+ }
154
+ }
155
+ },
156
+ "NetworkCapabilityRequest": {
157
+ "description": "Host 托管网络能力的申请;fetch 固定为 true,目标域名由 Host 运行时按请求授权。",
158
+ "title": "NetworkCapabilityRequest",
159
+ "type": "object",
160
+ "additionalProperties": false,
161
+ "required": ["fetch"],
162
+ "properties": {
163
+ "fetch": { "const": true }
164
+ }
165
+ },
166
+ "RequestedPresentationCapability": {
167
+ "description": "呈现能力的申请;surfaces 声明期望的呈现表面。",
168
+ "title": "RequestedPresentationCapability",
169
+ "type": "object",
170
+ "additionalProperties": false,
171
+ "required": ["surfaces"],
172
+ "properties": {
173
+ "surfaces": {
174
+ "type": "array",
175
+ "minItems": 1,
176
+ "maxItems": 2,
177
+ "uniqueItems": true,
178
+ "items": { "enum": ["floating", "overlay"] }
179
+ }
180
+ }
181
+ },
182
+ "RequestedRegionCapability": {
183
+ "description": "会话右侧区域替换能力的申请;当前仅支持 session.rightRail + replace。",
184
+ "title": "RequestedRegionCapability",
185
+ "type": "object",
186
+ "additionalProperties": false,
187
+ "required": ["regions", "mode"],
188
+ "properties": {
189
+ "regions": {
190
+ "type": "array",
191
+ "minItems": 1,
192
+ "maxItems": 1,
193
+ "uniqueItems": true,
194
+ "items": { "const": "session.rightRail" }
195
+ },
196
+ "mode": { "const": "replace" }
197
+ }
198
+ },
199
+ "WidgetSdkVersion": {
200
+ "description": "构建该 Widget 时使用的 SDK 精确 SemVer 版本,不接受范围。",
201
+ "title": "WidgetSdkVersion",
202
+ "type": "string",
203
+ "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$"
204
+ },
205
+ "EntryPath": {
206
+ "description": "包内 ESM 入口路径;仅允许包内相对 POSIX 路径。",
207
+ "title": "EntryPath",
208
+ "type": "string",
209
+ "minLength": 1,
210
+ "maxLength": 256,
211
+ "pattern": "^(?!/)(?!.*\\.\\.)(?!.*\\\\)(?!.*://).+\\.m?js$"
212
+ },
213
+ "RuntimeOptions": {
214
+ "description": "运行时申请;worker 与 webAssembly 均为可选布尔开关。",
215
+ "title": "RuntimeOptions",
216
+ "type": "object",
217
+ "additionalProperties": false,
218
+ "properties": {
219
+ "worker": { "type": "boolean" },
220
+ "webAssembly": { "type": "boolean" }
221
+ }
222
+ },
223
+ "ActivationEvents": {
224
+ "title": "ActivationEvents",
225
+ "description": "Host 可用于启动 Widget 的公开激活信号。多个值表示任一信号命中即可激活;它们不授予 events.read 权限。工具名形式为 tool-call-<阶段>:<工具名>。",
226
+ "type": "array",
227
+ "minItems": 1,
228
+ "maxItems": 16,
229
+ "uniqueItems": true,
230
+ "items": { "$ref": "#/$defs/ActivationEvent" }
231
+ },
232
+ "ActivationEvent": {
233
+ "description": "公开 Widget 激活信号。高层 WidgetContext.events 使用事件 type;低层 events.read 的 topic 不填写在这里。",
234
+ "oneOf": [
235
+ {
236
+ "type": "string",
237
+ "enum": [
238
+ "session.start",
239
+ "turn-start",
240
+ "turn-end",
241
+ "step-start",
242
+ "step-end",
243
+ "tool-call-generating",
244
+ "tool-call-waiting",
245
+ "tool-call-running",
246
+ "tool-call-result",
247
+ "tool-call-error",
248
+ "workspace-file-changed",
249
+ "workspace-tree-refresh",
250
+ "workspace-file-opened",
251
+ "ui-tool-opened",
252
+ "ui-panel-focused",
253
+ "host-surface-changed"
254
+ ]
255
+ },
256
+ {
257
+ "type": "string",
258
+ "minLength": 1,
259
+ "maxLength": 128,
260
+ "pattern": "^tool-call-(?:generating|waiting|running|result|error):[A-Za-z0-9_.:-]+$"
261
+ }
262
+ ]
263
+ },
264
+ "Samples": {
265
+ "description": "同版本 RenderRequest 测试样例;至少一个,request 为相对 .json 路径。",
266
+ "title": "Samples",
267
+ "type": "array",
268
+ "minItems": 1,
269
+ "uniqueItems": true,
270
+ "items": {
271
+ "type": "object",
272
+ "additionalProperties": false,
273
+ "required": ["id", "title", "request"],
274
+ "properties": {
275
+ "id": {
276
+ "type": "string",
277
+ "minLength": 1,
278
+ "maxLength": 64,
279
+ "pattern": "^[A-Za-z0-9_-]+$"
280
+ },
281
+ "title": { "type": "string", "minLength": 1, "maxLength": 128 },
282
+ "request": {
283
+ "type": "string",
284
+ "minLength": 1,
285
+ "maxLength": 256,
286
+ "pattern": "^(?!/)(?!.*\\.\\.)(?!.*\\\\)(?!.*://).+\\.json$"
287
+ }
288
+ }
289
+ }
290
+ },
291
+ "WidgetContributionConfig": {
292
+ "description": "作者声明的扩展点配置:file-preview 声明扩展名集合,panel 绑定既有 Panel。",
293
+ "title": "WidgetContributionConfig",
294
+ "oneOf": [
295
+ {
296
+ "type": "object",
297
+ "additionalProperties": false,
298
+ "required": ["type", "extensions"],
299
+ "properties": {
300
+ "type": { "const": "file-preview" },
301
+ "extensions": {
302
+ "type": "array",
303
+ "minItems": 1,
304
+ "uniqueItems": true,
305
+ "items": {
306
+ "type": "string",
307
+ "minLength": 1,
308
+ "maxLength": 32,
309
+ "pattern": "^[a-z0-9][a-z0-9.-]*$"
310
+ }
311
+ }
312
+ }
313
+ },
314
+ { "$ref": "#/$defs/PanelContributionConfig" }
315
+ ]
316
+ },
317
+ "PanelContributionConfig": {
318
+ "title": "PanelContributionConfig",
319
+ "description": "绑定 Agent Widget 既有 Panel 的配置。",
320
+ "type": "object",
321
+ "additionalProperties": false,
322
+ "required": ["type", "id"],
323
+ "properties": {
324
+ "type": {
325
+ "description": "Panel 贡献类型。",
326
+ "const": "panel"
327
+ },
328
+ "id": {
329
+ "description": "Host 注册和查找 Panel 时使用的稳定类型标识。",
330
+ "type": "string",
331
+ "minLength": 1,
332
+ "maxLength": 128,
333
+ "pattern": "^[A-Za-z0-9_.:-]+$"
334
+ },
335
+ "placement": {
336
+ "oneOf": [
337
+ {
338
+ "type": "object",
339
+ "additionalProperties": false,
340
+ "required": ["kind"],
341
+ "properties": {
342
+ "kind": { "const": "panel" }
343
+ }
344
+ },
345
+ {
346
+ "type": "object",
347
+ "additionalProperties": false,
348
+ "required": ["kind", "region", "mode"],
349
+ "properties": {
350
+ "kind": { "const": "region" },
351
+ "region": { "const": "session.rightRail" },
352
+ "mode": { "const": "replace" }
353
+ }
354
+ }
355
+ ]
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }