@dp-bohrium/widget-cli 0.5.1 → 0.7.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.
- package/AGENTS.md +0 -13
- package/CHANGELOG.md +25 -0
- package/README.md +0 -5
- package/assets/schemas/widget-manifest.schema.json +0 -12
- package/assets/schemas/widget-runtime-contracts.schema.json +906 -272
- package/assets/toolchain.json +8 -8
- package/dist/cli.mjs +184 -14
- package/dist/core.d.mts +1 -364
- package/dist/core.mjs +1 -1
- package/dist/development-host.d.mts +40 -4
- package/dist/{dsh-BlpXm2Bv.mjs → dsh-BJWUB8Nq.mjs} +1308 -516
- package/dist/generated-runtime-contracts-qdyub_ED.d.mts +486 -0
- package/llms.txt +0 -3
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
//#region ../../.build/widget-stage-tools/tooling/compiler.mjs
|
|
7
7
|
/** 从当前安装的 SDK package.json 读取版本,插件作者不需要重复填写。 */
|
|
8
|
-
const WIDGET_SDK_VERSION = "0.
|
|
8
|
+
const WIDGET_SDK_VERSION = "0.10.0";
|
|
9
9
|
function compiledContribution(contribution) {
|
|
10
10
|
switch (contribution.type) {
|
|
11
11
|
case "panel": return {
|
|
@@ -165,6 +165,490 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
165
165
|
enumerable: true
|
|
166
166
|
}) : target, mod));
|
|
167
167
|
/** GENERATED FILE. Do not edit directly. */
|
|
168
|
+
const widgetDevelopmentPolicy = {
|
|
169
|
+
"required": [
|
|
170
|
+
"schemaVersion",
|
|
171
|
+
"source",
|
|
172
|
+
"code",
|
|
173
|
+
"phase",
|
|
174
|
+
"operation",
|
|
175
|
+
"severity",
|
|
176
|
+
"message"
|
|
177
|
+
],
|
|
178
|
+
"keys": [
|
|
179
|
+
"schemaVersion",
|
|
180
|
+
"source",
|
|
181
|
+
"code",
|
|
182
|
+
"sourceCode",
|
|
183
|
+
"phase",
|
|
184
|
+
"sourcePhase",
|
|
185
|
+
"operation",
|
|
186
|
+
"severity",
|
|
187
|
+
"message",
|
|
188
|
+
"retryable",
|
|
189
|
+
"correlationId",
|
|
190
|
+
"diagnostics",
|
|
191
|
+
"io"
|
|
192
|
+
],
|
|
193
|
+
"textMax": {
|
|
194
|
+
"code": 96,
|
|
195
|
+
"sourceCode": 96,
|
|
196
|
+
"sourcePhase": 96,
|
|
197
|
+
"operation": 96,
|
|
198
|
+
"message": 1024,
|
|
199
|
+
"field": 128,
|
|
200
|
+
"expected": 256,
|
|
201
|
+
"observed": 256,
|
|
202
|
+
"file": 256,
|
|
203
|
+
"excerpt": 1024
|
|
204
|
+
},
|
|
205
|
+
"maxDetails": 8,
|
|
206
|
+
"phases": [
|
|
207
|
+
"discovery",
|
|
208
|
+
"build",
|
|
209
|
+
"config",
|
|
210
|
+
"load",
|
|
211
|
+
"handshake",
|
|
212
|
+
"render",
|
|
213
|
+
"update",
|
|
214
|
+
"capability",
|
|
215
|
+
"dispose"
|
|
216
|
+
],
|
|
217
|
+
"severities": [
|
|
218
|
+
"warning",
|
|
219
|
+
"request-error",
|
|
220
|
+
"instance-failure"
|
|
221
|
+
],
|
|
222
|
+
"identifierPattern": "^[A-Za-z][A-Za-z0-9_.-]*$",
|
|
223
|
+
"filePattern": "^(?!/)(?!.*\\\\)(?!.*:)(?!.*(?:^|/)\\.{1,2}(?:/|$))[^\\u0000-\\u001f]+$"
|
|
224
|
+
};
|
|
225
|
+
function record(value) {
|
|
226
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
227
|
+
}
|
|
228
|
+
function keys(value, required, allowed = required) {
|
|
229
|
+
return required.every((key) => Object.hasOwn(value, key)) && Object.keys(value).every((key) => allowed.includes(key));
|
|
230
|
+
}
|
|
231
|
+
const identifier = new RegExp(widgetDevelopmentPolicy.identifierPattern, "u");
|
|
232
|
+
const sourceFile = new RegExp(widgetDevelopmentPolicy.filePattern, "u");
|
|
233
|
+
function text(value, max, empty = false) {
|
|
234
|
+
return typeof value === "string" && (empty || value.length > 0) && [...value].length <= max;
|
|
235
|
+
}
|
|
236
|
+
function correlation(value) {
|
|
237
|
+
return typeof value === "string" && value.length > 0;
|
|
238
|
+
}
|
|
239
|
+
function id(value) {
|
|
240
|
+
return text(value, widgetDevelopmentPolicy.textMax.code) && identifier.test(value);
|
|
241
|
+
}
|
|
242
|
+
function detail(value) {
|
|
243
|
+
if (!record(value)) return false;
|
|
244
|
+
if ("file" in value) return keys(value, [
|
|
245
|
+
"file",
|
|
246
|
+
"line",
|
|
247
|
+
"column"
|
|
248
|
+
], [
|
|
249
|
+
"file",
|
|
250
|
+
"line",
|
|
251
|
+
"column",
|
|
252
|
+
"excerpt"
|
|
253
|
+
]) && text(value["file"], widgetDevelopmentPolicy.textMax.file) && sourceFile.test(value["file"]) && Number.isSafeInteger(value["line"]) && Number(value["line"]) > 0 && Number.isSafeInteger(value["column"]) && Number(value["column"]) > 0 && (value["excerpt"] === void 0 || text(value["excerpt"], widgetDevelopmentPolicy.textMax.excerpt));
|
|
254
|
+
return keys(value, ["field"], [
|
|
255
|
+
"field",
|
|
256
|
+
"expected",
|
|
257
|
+
"observed"
|
|
258
|
+
]) && text(value["field"], widgetDevelopmentPolicy.textMax.field) && (value["expected"] === void 0 || text(value["expected"], widgetDevelopmentPolicy.textMax.expected, true)) && (value["observed"] === void 0 || text(value["observed"], widgetDevelopmentPolicy.textMax.observed, true));
|
|
259
|
+
}
|
|
260
|
+
function io(value) {
|
|
261
|
+
if (!record(value) || !keys(value, ["kind"], [
|
|
262
|
+
"kind",
|
|
263
|
+
"status",
|
|
264
|
+
"sourceCode"
|
|
265
|
+
]) || value["sourceCode"] !== void 0 && !id(value["sourceCode"])) return false;
|
|
266
|
+
if (value["kind"] === "http") return Number.isInteger(value["status"]) && Number(value["status"]) >= 100 && Number(value["status"]) <= 599 && !(Number(value["status"]) >= 200 && Number(value["status"]) < 300);
|
|
267
|
+
return (value["kind"] === "transport" || value["kind"] === "invalid-response") && value["status"] === void 0;
|
|
268
|
+
}
|
|
269
|
+
/** 与源头 Schema 同源限额的轻量边界判定,不加载 AJV 或 Runtime。 */
|
|
270
|
+
function isWidgetGuestDiagnostic(value) {
|
|
271
|
+
if (!record(value) || !keys(value, widgetDevelopmentPolicy.required, widgetDevelopmentPolicy.keys) || value["schemaVersion"] !== 1 || value["source"] !== "sdk" || !id(value["code"]) || !id(value["operation"]) || !widgetDevelopmentPolicy.phases.some((phase) => phase === value["phase"]) || !widgetDevelopmentPolicy.severities.some((severity) => severity === value["severity"]) || !text(value["message"], widgetDevelopmentPolicy.textMax.message)) return false;
|
|
272
|
+
if (value["retryable"] !== void 0 && typeof value["retryable"] !== "boolean" || value["correlationId"] !== void 0 && !correlation(value["correlationId"]) || value["sourceCode"] !== void 0 && !id(value["sourceCode"]) || value["sourcePhase"] !== void 0 && !id(value["sourcePhase"])) return false;
|
|
273
|
+
return (value["diagnostics"] === void 0 || Array.isArray(value["diagnostics"]) && value["diagnostics"].length <= widgetDevelopmentPolicy.maxDetails && value["diagnostics"].every(detail)) && (value["io"] === void 0 || io(value["io"]));
|
|
274
|
+
}
|
|
275
|
+
/** 失败回执仍需 Host 再匹配实际已发送的 request/revision。 */
|
|
276
|
+
function isWidgetRenderResult(value) {
|
|
277
|
+
if (!record(value) || !correlation(value["requestId"]) || !Number.isSafeInteger(value["revision"]) || Number(value["revision"]) < 1) return false;
|
|
278
|
+
if (value["outcome"] === "handled" || value["outcome"] === "superseded") return keys(value, [
|
|
279
|
+
"requestId",
|
|
280
|
+
"revision",
|
|
281
|
+
"outcome"
|
|
282
|
+
]);
|
|
283
|
+
return value["outcome"] === "failed" && keys(value, [
|
|
284
|
+
"requestId",
|
|
285
|
+
"revision",
|
|
286
|
+
"outcome",
|
|
287
|
+
"diagnostic"
|
|
288
|
+
]) && isWidgetGuestDiagnostic(value["diagnostic"]) && value["diagnostic"].correlationId === value["requestId"] && (value["diagnostic"].phase === "render" || value["diagnostic"].phase === "update");
|
|
289
|
+
}
|
|
290
|
+
function rule(input) {
|
|
291
|
+
const followUpActions = input.disposition === "repair" ? [
|
|
292
|
+
{
|
|
293
|
+
id: "build-project",
|
|
294
|
+
params: { target: "current-project" }
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: "refresh-preview",
|
|
298
|
+
params: { target: "current-project" }
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
id: "verify-scenario",
|
|
302
|
+
params: { target: "next-built-generation" }
|
|
303
|
+
}
|
|
304
|
+
] : [];
|
|
305
|
+
const value = {
|
|
306
|
+
id: input.id,
|
|
307
|
+
version: 1,
|
|
308
|
+
sources: [input.source],
|
|
309
|
+
codes: input.codes,
|
|
310
|
+
disposition: input.disposition ?? "inspect",
|
|
311
|
+
nextAction: input.nextAction ?? {
|
|
312
|
+
id: "inspect",
|
|
313
|
+
params: { area: input.area }
|
|
314
|
+
},
|
|
315
|
+
verification: input.verification ?? {
|
|
316
|
+
target: "current-attempt",
|
|
317
|
+
milestone: "diagnostics-updated"
|
|
318
|
+
},
|
|
319
|
+
guidance: input.guidance,
|
|
320
|
+
followUpActions
|
|
321
|
+
};
|
|
322
|
+
Object.freeze(value.sources);
|
|
323
|
+
Object.freeze(value.codes);
|
|
324
|
+
Object.freeze(value.nextAction.params);
|
|
325
|
+
Object.freeze(value.nextAction);
|
|
326
|
+
Object.freeze(value.verification);
|
|
327
|
+
for (const action of followUpActions) {
|
|
328
|
+
Object.freeze(action.params);
|
|
329
|
+
Object.freeze(action);
|
|
330
|
+
}
|
|
331
|
+
Object.freeze(followUpActions);
|
|
332
|
+
return Object.freeze(value);
|
|
333
|
+
}
|
|
334
|
+
/** 通用恢复目录;宿主绑定已有工具及权限,Guest 不指定这些规则。 */
|
|
335
|
+
const STANDARD_RULES = Object.freeze([
|
|
336
|
+
rule({
|
|
337
|
+
id: "runtime-render",
|
|
338
|
+
source: "sdk",
|
|
339
|
+
codes: ["RENDER_FAILED", "UPDATE_FAILED"],
|
|
340
|
+
area: "render",
|
|
341
|
+
disposition: "repair",
|
|
342
|
+
nextAction: {
|
|
343
|
+
id: "edit-project",
|
|
344
|
+
params: { evidence: "diagnostics" }
|
|
345
|
+
},
|
|
346
|
+
verification: {
|
|
347
|
+
target: "next-built-generation",
|
|
348
|
+
milestone: "scenario-passed"
|
|
349
|
+
},
|
|
350
|
+
guidance: "读取当前请求的源码诊断,修复处理器后构建并刷新预览,再重跑原失败场景;ready 不代表恢复。"
|
|
351
|
+
}),
|
|
352
|
+
rule({
|
|
353
|
+
id: "bundle-load",
|
|
354
|
+
source: "sdk",
|
|
355
|
+
codes: ["BUNDLE_LOAD_FAILED", "DIGEST_MISMATCH"],
|
|
356
|
+
area: "bundle",
|
|
357
|
+
guidance: "检查入口资源、响应类型、实际摘要、模块依赖及 CSP 证据,再选择修复;不能从超时猜测根因。"
|
|
358
|
+
}),
|
|
359
|
+
rule({
|
|
360
|
+
id: "runtime-lease",
|
|
361
|
+
source: "sdk",
|
|
362
|
+
codes: ["RUNTIME_CONFIG_EXPIRED", "FILE_REFERENCE_INVALID"],
|
|
363
|
+
area: "lease",
|
|
364
|
+
guidance: "核对当前 scope、配置和引用;通过已授权的 acquire/续期取得新凭据,不重用一次性票据。"
|
|
365
|
+
}),
|
|
366
|
+
rule({
|
|
367
|
+
id: "runtime-authorization",
|
|
368
|
+
source: "sdk",
|
|
369
|
+
codes: ["WIDGET_VERSION_REVOKED", "FILE_PERMISSION_DENIED"],
|
|
370
|
+
area: "capability",
|
|
371
|
+
disposition: "external-action",
|
|
372
|
+
nextAction: {
|
|
373
|
+
id: "request-external-action",
|
|
374
|
+
params: { reason: "authorization" }
|
|
375
|
+
},
|
|
376
|
+
guidance: "保留现场并请求目标授权恢复;不要重试被撤销资源或绕过权限。继续不受影响的工作。"
|
|
377
|
+
}),
|
|
378
|
+
rule({
|
|
379
|
+
id: "runtime-profile",
|
|
380
|
+
source: "sdk",
|
|
381
|
+
codes: ["HOST_API_UNSUPPORTED"],
|
|
382
|
+
area: "configuration",
|
|
383
|
+
guidance: "核对实际 Host 兼容声明与工具链;按声明选择迁移或宿主升级,不修改版本字段伪装支持。"
|
|
384
|
+
}),
|
|
385
|
+
rule({
|
|
386
|
+
id: "runtime-handshake",
|
|
387
|
+
source: "sdk",
|
|
388
|
+
codes: ["HANDSHAKE_TIMEOUT"],
|
|
389
|
+
area: "handshake",
|
|
390
|
+
guidance: "先确认资源加载,再检查 profile、frame 来源与连接阶段;补充证据后再建立新 attempt。"
|
|
391
|
+
}),
|
|
392
|
+
rule({
|
|
393
|
+
id: "runtime-protocol",
|
|
394
|
+
source: "sdk",
|
|
395
|
+
codes: [
|
|
396
|
+
"MESSAGE_INVALID",
|
|
397
|
+
"CHANNEL_MISMATCH",
|
|
398
|
+
"MESSAGE_TOO_LARGE",
|
|
399
|
+
"MESSAGE_RATE_LIMITED",
|
|
400
|
+
"TOO_MANY_PENDING_REQUESTS"
|
|
401
|
+
],
|
|
402
|
+
area: "runtime",
|
|
403
|
+
guidance: "检查协议、消息大小、频率及 pending 诊断;保留既有保护,修复生产方后再连接,不能提高预算掩盖错误。"
|
|
404
|
+
}),
|
|
405
|
+
rule({
|
|
406
|
+
id: "runtime-capability",
|
|
407
|
+
source: "sdk",
|
|
408
|
+
codes: [
|
|
409
|
+
"CAPABILITY_UNDECLARED",
|
|
410
|
+
"CAPABILITY_DENIED",
|
|
411
|
+
"CAPABILITY_UNSUPPORTED",
|
|
412
|
+
"CAPABILITY_TIMEOUT",
|
|
413
|
+
"RESOURCE_LIMIT"
|
|
414
|
+
],
|
|
415
|
+
area: "capability",
|
|
416
|
+
guidance: "区分未声明、未授权、未接线、预算与超时;检查操作是否可能已执行,再选择声明修复、可用替代或授权流程。"
|
|
417
|
+
}),
|
|
418
|
+
rule({
|
|
419
|
+
id: "runtime-lifetime",
|
|
420
|
+
source: "sdk",
|
|
421
|
+
codes: ["WIDGET_CRASHED", "INSTANCE_DISPOSED"],
|
|
422
|
+
area: "runtime",
|
|
423
|
+
guidance: "查询当前挂载尝试和末次诊断;区分正常释放与崩溃,修复后创建新 attempt,不复活旧实例。"
|
|
424
|
+
}),
|
|
425
|
+
rule({
|
|
426
|
+
id: "capability-authorization",
|
|
427
|
+
source: "host",
|
|
428
|
+
codes: [
|
|
429
|
+
"permission-denied",
|
|
430
|
+
"network-consent-denied",
|
|
431
|
+
"network-credential-unavailable"
|
|
432
|
+
],
|
|
433
|
+
area: "capability",
|
|
434
|
+
disposition: "external-action",
|
|
435
|
+
nextAction: {
|
|
436
|
+
id: "request-external-action",
|
|
437
|
+
params: { reason: "authorization" }
|
|
438
|
+
},
|
|
439
|
+
guidance: "按具体 operation 核对授权或凭据可用性;使用既有授权入口,不从聊天索取凭据或绕过拒绝。"
|
|
440
|
+
}),
|
|
441
|
+
rule({
|
|
442
|
+
id: "capability-policy",
|
|
443
|
+
source: "host",
|
|
444
|
+
codes: [
|
|
445
|
+
"unsupported",
|
|
446
|
+
"network-policy-denied",
|
|
447
|
+
"network-redirect-denied",
|
|
448
|
+
"network-scope-invalid",
|
|
449
|
+
"network-dns-denied"
|
|
450
|
+
],
|
|
451
|
+
area: "capability",
|
|
452
|
+
guidance: "核对宿主接线、当前作用域和网络策略;选择允许的操作或替代路径,不反复原样调用。"
|
|
453
|
+
}),
|
|
454
|
+
rule({
|
|
455
|
+
id: "capability-budget",
|
|
456
|
+
source: "host",
|
|
457
|
+
codes: [
|
|
458
|
+
"resource-limit",
|
|
459
|
+
"network-request-too-large",
|
|
460
|
+
"network-response-too-large"
|
|
461
|
+
],
|
|
462
|
+
area: "capability",
|
|
463
|
+
guidance: "读取已知预算维度,缩小请求或分块;未知维度继续排查,不销毁健康 Bridge 或自动提高额度。"
|
|
464
|
+
}),
|
|
465
|
+
rule({
|
|
466
|
+
id: "capability-rate",
|
|
467
|
+
source: "host",
|
|
468
|
+
codes: ["network-rate-limited"],
|
|
469
|
+
area: "capability",
|
|
470
|
+
disposition: "retry",
|
|
471
|
+
nextAction: {
|
|
472
|
+
id: "wait",
|
|
473
|
+
params: { milestone: "budget-reset" }
|
|
474
|
+
},
|
|
475
|
+
guidance: "仅在确认原操作未执行且允许重试时,按宿主预算等待;预算未知时先 inspect,不能忙轮询。"
|
|
476
|
+
}),
|
|
477
|
+
rule({
|
|
478
|
+
id: "capability-reference",
|
|
479
|
+
source: "host",
|
|
480
|
+
codes: ["invalid-reference"],
|
|
481
|
+
area: "lease",
|
|
482
|
+
guidance: "重新校验当前作用域与文件引用,通过已有授权入口取得有效引用。"
|
|
483
|
+
}),
|
|
484
|
+
rule({
|
|
485
|
+
id: "capability-conflict",
|
|
486
|
+
source: "host",
|
|
487
|
+
codes: [
|
|
488
|
+
"revision-conflict",
|
|
489
|
+
"mutation-conflict",
|
|
490
|
+
"write-outcome-unknown"
|
|
491
|
+
],
|
|
492
|
+
area: "operation-outcome",
|
|
493
|
+
verification: {
|
|
494
|
+
target: "original-operation",
|
|
495
|
+
milestone: "operation-confirmed"
|
|
496
|
+
},
|
|
497
|
+
guidance: "按原 revision 和 mutation 身份核对资源及操作结果,再决定是否提交新修改;不自动重放写入。"
|
|
498
|
+
}),
|
|
499
|
+
rule({
|
|
500
|
+
id: "capability-transport",
|
|
501
|
+
source: "host",
|
|
502
|
+
codes: [
|
|
503
|
+
"timeout",
|
|
504
|
+
"internal-error",
|
|
505
|
+
"network-transport-unavailable",
|
|
506
|
+
"network-error"
|
|
507
|
+
],
|
|
508
|
+
area: "operation-outcome",
|
|
509
|
+
guidance: "保留 transport/HTTP/格式分类,先确认原操作是否执行;无响应不等于未产生副作用。"
|
|
510
|
+
}),
|
|
511
|
+
rule({
|
|
512
|
+
id: "toolchain-build",
|
|
513
|
+
source: "toolchain",
|
|
514
|
+
codes: [
|
|
515
|
+
"WIDGET_CLI_BUILD_FAILED",
|
|
516
|
+
"WIDGET_CLI_BUILD_UNRESOLVED_IMPORT",
|
|
517
|
+
"WIDGET_DEV_BUILD_FAILED"
|
|
518
|
+
],
|
|
519
|
+
area: "toolchain",
|
|
520
|
+
disposition: "repair",
|
|
521
|
+
nextAction: {
|
|
522
|
+
id: "edit-project",
|
|
523
|
+
params: { evidence: "diagnostics" }
|
|
524
|
+
},
|
|
525
|
+
verification: {
|
|
526
|
+
target: "next-built-generation",
|
|
527
|
+
milestone: "scenario-passed"
|
|
528
|
+
},
|
|
529
|
+
guidance: "读取编译器与相对源码诊断,修复后用原执行工具构建,核对回执与新产物,再刷新并复验。"
|
|
530
|
+
}),
|
|
531
|
+
rule({
|
|
532
|
+
id: "toolchain-validation",
|
|
533
|
+
source: "toolchain",
|
|
534
|
+
codes: [
|
|
535
|
+
"WIDGET_CLI_MANIFEST_INVALID",
|
|
536
|
+
"WIDGET_CLI_VALIDATION_FAILED",
|
|
537
|
+
"WIDGET_CLI_PACK_VALIDATION_FAILED",
|
|
538
|
+
"WIDGET_DEV_PROJECT_INVALID"
|
|
539
|
+
],
|
|
540
|
+
area: "configuration",
|
|
541
|
+
disposition: "repair",
|
|
542
|
+
nextAction: {
|
|
543
|
+
id: "edit-project",
|
|
544
|
+
params: { evidence: "diagnostics" }
|
|
545
|
+
},
|
|
546
|
+
verification: {
|
|
547
|
+
target: "next-built-generation",
|
|
548
|
+
milestone: "scenario-passed"
|
|
549
|
+
},
|
|
550
|
+
guidance: "依据字段与预期值修复工程清单、入口或样例,再检查并构建;不要打包不完整产物。"
|
|
551
|
+
}),
|
|
552
|
+
rule({
|
|
553
|
+
id: "toolchain-profile",
|
|
554
|
+
source: "toolchain",
|
|
555
|
+
codes: [
|
|
556
|
+
"WIDGET_CLI_PROJECT_TOOLCHAIN_REQUIRED",
|
|
557
|
+
"WIDGET_CLI_PROJECT_PROFILE_MISMATCH",
|
|
558
|
+
"WIDGET_CLI_PROJECT_SDK_MISMATCH",
|
|
559
|
+
"WIDGET_CLI_BUILD_RECEIPT_MISMATCH",
|
|
560
|
+
"WIDGET_CLI_HOST_PROFILE_UNSUPPORTED",
|
|
561
|
+
"WIDGET_CLI_HOST_COMPAT_INVALID",
|
|
562
|
+
"WIDGET_CLI_NO_WIDGET_PROJECT"
|
|
563
|
+
],
|
|
564
|
+
area: "toolchain",
|
|
565
|
+
guidance: "运行 doctor/integration 并核对当前工程与目标宿主;显式采用或迁移工具链,再构建,不伪造 receipt。"
|
|
566
|
+
}),
|
|
567
|
+
rule({
|
|
568
|
+
id: "development-host",
|
|
569
|
+
source: "toolchain",
|
|
570
|
+
codes: [
|
|
571
|
+
"WIDGET_DEV_FAILED",
|
|
572
|
+
"WIDGET_DEV_UNAUTHORIZED",
|
|
573
|
+
"WIDGET_DEV_CLAIM_REJECTED",
|
|
574
|
+
"WIDGET_DEV_PROFILE_NOT_FOUND"
|
|
575
|
+
],
|
|
576
|
+
area: "host-bridge",
|
|
577
|
+
guidance: "读取失败阶段、端点状态和具体响应;区分未监听、403、超时与不兼容,再检查目标宿主。"
|
|
578
|
+
})
|
|
579
|
+
]);
|
|
580
|
+
const UNKNOWN_RULE = rule({
|
|
581
|
+
id: "unknown",
|
|
582
|
+
source: "host",
|
|
583
|
+
codes: [],
|
|
584
|
+
area: "runtime",
|
|
585
|
+
guidance: "查询当前状态、实际产物和最后失败阶段,补充证据后选择恢复路径;不要猜测命令或反复执行。"
|
|
586
|
+
});
|
|
587
|
+
const OUTCOME_RULE = rule({
|
|
588
|
+
id: "operation-outcome",
|
|
589
|
+
source: "host",
|
|
590
|
+
codes: [],
|
|
591
|
+
area: "operation-outcome",
|
|
592
|
+
verification: {
|
|
593
|
+
target: "original-operation",
|
|
594
|
+
milestone: "operation-confirmed"
|
|
595
|
+
},
|
|
596
|
+
guidance: "原操作可能已执行或部分完成。先按原操作身份核对资源,再决定后续动作,不自动重放。"
|
|
597
|
+
});
|
|
598
|
+
const REPEATED_RULE = rule({
|
|
599
|
+
id: "repeated-without-progress",
|
|
600
|
+
source: "host",
|
|
601
|
+
codes: [],
|
|
602
|
+
area: "runtime",
|
|
603
|
+
guidance: "相同故障没有新证据或产物,先补充诊断或改变排查策略,不重复同一编辑、构建或重试。"
|
|
604
|
+
});
|
|
605
|
+
/** 包含 unknown 与操作核对规则,Agent 可按 plan.ruleId 定位每个实际计划。 */
|
|
606
|
+
const WIDGET_RECOVERY_RULES = Object.freeze([
|
|
607
|
+
...STANDARD_RULES,
|
|
608
|
+
UNKNOWN_RULE,
|
|
609
|
+
OUTCOME_RULE,
|
|
610
|
+
REPEATED_RULE
|
|
611
|
+
]);
|
|
612
|
+
/** 根据稳定码选择通用规则;未知码明确走排查,不匹配自由文本。 */
|
|
613
|
+
function findWidgetRecoveryRule(diagnostic) {
|
|
614
|
+
return WIDGET_RECOVERY_RULES.find((value) => value.sources.includes(diagnostic.source) && value.codes.includes(diagnostic.code)) ?? UNKNOWN_RULE;
|
|
615
|
+
}
|
|
616
|
+
/** 纯规则选择,不运行工具;宿主仍须校验实际能力、权限、scope 与恢复预算。 */
|
|
617
|
+
function createWidgetRecoveryPlan(diagnostic, context = {}) {
|
|
618
|
+
let selected = findWidgetRecoveryRule(diagnostic);
|
|
619
|
+
if (context.executionState === "unknown" || context.executionState === "partial" || context.mayHaveExecuted === true && context.executionState !== "finished") selected = OUTCOME_RULE;
|
|
620
|
+
else if (context.progress?.repeated && !context.progress.hasNewEvidence) selected = REPEATED_RULE;
|
|
621
|
+
else if (selected.disposition === "retry" && (diagnostic.retryable !== true || context.executionState !== "not_started" || context.mayHaveExecuted !== false)) selected = OUTCOME_RULE;
|
|
622
|
+
if (selected.disposition === "repair" && !diagnostic.diagnostics?.length) return {
|
|
623
|
+
schemaVersion: 1,
|
|
624
|
+
ruleId: selected.id,
|
|
625
|
+
ruleVersion: selected.version,
|
|
626
|
+
...context.progress ? { progress: { ...context.progress } } : {},
|
|
627
|
+
disposition: "inspect",
|
|
628
|
+
nextAction: {
|
|
629
|
+
id: "inspect",
|
|
630
|
+
params: { area: diagnostic.source === "toolchain" ? "toolchain" : "render" }
|
|
631
|
+
},
|
|
632
|
+
followUpActions: [],
|
|
633
|
+
verification: {
|
|
634
|
+
target: "current-attempt",
|
|
635
|
+
milestone: "diagnostics-updated"
|
|
636
|
+
},
|
|
637
|
+
guidance: "缺少可定位的诊断,先查询编译或源码证据,再修复;不能仅凭错误码猜测补丁。"
|
|
638
|
+
};
|
|
639
|
+
return {
|
|
640
|
+
schemaVersion: 1,
|
|
641
|
+
ruleId: selected.id,
|
|
642
|
+
ruleVersion: selected.version,
|
|
643
|
+
disposition: selected.disposition,
|
|
644
|
+
...context.progress ? { progress: { ...context.progress } } : {},
|
|
645
|
+
nextAction: structuredClone(selected.nextAction),
|
|
646
|
+
followUpActions: structuredClone(selected.followUpActions),
|
|
647
|
+
verification: { ...selected.verification },
|
|
648
|
+
guidance: selected.guidance
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
/** GENERATED FILE. Do not edit directly. */
|
|
168
652
|
const widgetRuntimeContractsSchema = {
|
|
169
653
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
170
654
|
"$id": "widget-runtime-contracts.schema.json",
|
|
@@ -203,12 +687,6 @@ const widgetRuntimeContractsSchema = {
|
|
|
203
687
|
"fileDownloadResult": { "$ref": "#/$defs/FileDownloadResult" },
|
|
204
688
|
"fileReadResult": { "$ref": "#/$defs/FileReadResult" },
|
|
205
689
|
"fileWriteResult": { "$ref": "#/$defs/FileWriteResult" },
|
|
206
|
-
"taskObservationSnapshot": { "$ref": "#/$defs/TaskObservationSnapshot" },
|
|
207
|
-
"taskObservationEvent": { "$ref": "#/$defs/TaskObservationEvent" },
|
|
208
|
-
"taskObservationBatch": { "$ref": "#/$defs/TaskObservationBatch" },
|
|
209
|
-
"taskListField": { "$ref": "#/$defs/TaskListField" },
|
|
210
|
-
"taskListItem": { "$ref": "#/$defs/TaskListItem" },
|
|
211
|
-
"taskListPage": { "$ref": "#/$defs/TaskListPage" },
|
|
212
690
|
"toolResultEnvelope": { "$ref": "#/$defs/ToolResultEnvelope" },
|
|
213
691
|
"uiStateResult": { "$ref": "#/$defs/UiStateResult" },
|
|
214
692
|
"uiStateWriteResult": { "$ref": "#/$defs/UiStateWriteResult" },
|
|
@@ -218,7 +696,15 @@ const widgetRuntimeContractsSchema = {
|
|
|
218
696
|
"hostUserProfileReadOutput": { "$ref": "#/$defs/HostUserProfileReadOutput" },
|
|
219
697
|
"hostUserEmailReadInput": { "$ref": "#/$defs/HostUserEmailReadInput" },
|
|
220
698
|
"hostUserEmailReadOutput": { "$ref": "#/$defs/HostUserEmailReadOutput" },
|
|
221
|
-
"hostUserServiceRequest": { "$ref": "#/$defs/HostUserServiceRequest" }
|
|
699
|
+
"hostUserServiceRequest": { "$ref": "#/$defs/HostUserServiceRequest" },
|
|
700
|
+
"widgetDevelopmentDiagnostic": { "$ref": "#/$defs/WidgetDevelopmentDiagnostic" },
|
|
701
|
+
"widgetRecoveryContext": { "$ref": "#/$defs/WidgetRecoveryContext" },
|
|
702
|
+
"widgetRecoveryPlan": { "$ref": "#/$defs/WidgetRecoveryPlan" },
|
|
703
|
+
"widgetRecoveryRule": { "$ref": "#/$defs/WidgetRecoveryRule" },
|
|
704
|
+
"widgetDevelopmentOffer": { "$ref": "#/$defs/WidgetDevelopmentOffer" },
|
|
705
|
+
"widgetDevelopmentConnect": { "$ref": "#/$defs/WidgetDevelopmentConnect" },
|
|
706
|
+
"widgetRenderResult": { "$ref": "#/$defs/WidgetRenderResult" },
|
|
707
|
+
"widgetDevelopmentMessage": { "$ref": "#/$defs/WidgetDevelopmentMessage" }
|
|
222
708
|
},
|
|
223
709
|
"$defs": {
|
|
224
710
|
"JsonValue": {
|
|
@@ -599,222 +1085,6 @@ const widgetRuntimeContractsSchema = {
|
|
|
599
1085
|
"cancelled"
|
|
600
1086
|
] } }
|
|
601
1087
|
},
|
|
602
|
-
"TaskStatus": {
|
|
603
|
-
"description": "Host 投影给 Widget 的统一任务状态。",
|
|
604
|
-
"title": "TaskStatus",
|
|
605
|
-
"enum": [
|
|
606
|
-
"queued",
|
|
607
|
-
"running",
|
|
608
|
-
"succeeded",
|
|
609
|
-
"failed",
|
|
610
|
-
"cancelled",
|
|
611
|
-
"expired"
|
|
612
|
-
]
|
|
613
|
-
},
|
|
614
|
-
"TaskObservationSnapshot": {
|
|
615
|
-
"description": "任务观察的当前快照:taskId、status 与 updatedAt;progress、message 可选。",
|
|
616
|
-
"title": "TaskObservationSnapshot",
|
|
617
|
-
"type": "object",
|
|
618
|
-
"additionalProperties": false,
|
|
619
|
-
"required": [
|
|
620
|
-
"taskId",
|
|
621
|
-
"status",
|
|
622
|
-
"updatedAt"
|
|
623
|
-
],
|
|
624
|
-
"properties": {
|
|
625
|
-
"taskId": {
|
|
626
|
-
"type": "string",
|
|
627
|
-
"minLength": 1,
|
|
628
|
-
"maxLength": 256
|
|
629
|
-
},
|
|
630
|
-
"status": { "$ref": "#/$defs/TaskStatus" },
|
|
631
|
-
"progress": {
|
|
632
|
-
"type": "number",
|
|
633
|
-
"minimum": 0,
|
|
634
|
-
"maximum": 1
|
|
635
|
-
},
|
|
636
|
-
"message": {
|
|
637
|
-
"type": "string",
|
|
638
|
-
"maxLength": 1024
|
|
639
|
-
},
|
|
640
|
-
"updatedAt": {
|
|
641
|
-
"type": "string",
|
|
642
|
-
"pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
"TaskObservationEvent": {
|
|
647
|
-
"description": "任务观察流中的单条事件;payload 由服务端裁剪。",
|
|
648
|
-
"title": "TaskObservationEvent",
|
|
649
|
-
"type": "object",
|
|
650
|
-
"additionalProperties": false,
|
|
651
|
-
"required": [
|
|
652
|
-
"id",
|
|
653
|
-
"type",
|
|
654
|
-
"occurredAt",
|
|
655
|
-
"payload"
|
|
656
|
-
],
|
|
657
|
-
"properties": {
|
|
658
|
-
"id": {
|
|
659
|
-
"type": "string",
|
|
660
|
-
"minLength": 1,
|
|
661
|
-
"maxLength": 256
|
|
662
|
-
},
|
|
663
|
-
"type": { "enum": [
|
|
664
|
-
"started",
|
|
665
|
-
"progress",
|
|
666
|
-
"succeeded",
|
|
667
|
-
"failed",
|
|
668
|
-
"cancelled",
|
|
669
|
-
"expired"
|
|
670
|
-
] },
|
|
671
|
-
"occurredAt": {
|
|
672
|
-
"type": "string",
|
|
673
|
-
"pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
|
|
674
|
-
},
|
|
675
|
-
"payload": { "$ref": "#/$defs/JsonValue" }
|
|
676
|
-
}
|
|
677
|
-
},
|
|
678
|
-
"TaskObservationBatch": {
|
|
679
|
-
"description": "任务观察的一页结果:快照 + 有限事件页 + 游标。",
|
|
680
|
-
"title": "TaskObservationBatch",
|
|
681
|
-
"type": "object",
|
|
682
|
-
"additionalProperties": false,
|
|
683
|
-
"required": [
|
|
684
|
-
"schemaVersion",
|
|
685
|
-
"taskId",
|
|
686
|
-
"cursor",
|
|
687
|
-
"reset",
|
|
688
|
-
"hasMore",
|
|
689
|
-
"snapshot",
|
|
690
|
-
"events"
|
|
691
|
-
],
|
|
692
|
-
"properties": {
|
|
693
|
-
"schemaVersion": { "const": 1 },
|
|
694
|
-
"taskId": {
|
|
695
|
-
"type": "string",
|
|
696
|
-
"minLength": 1,
|
|
697
|
-
"maxLength": 256
|
|
698
|
-
},
|
|
699
|
-
"cursor": {
|
|
700
|
-
"type": "string",
|
|
701
|
-
"minLength": 1,
|
|
702
|
-
"maxLength": 256
|
|
703
|
-
},
|
|
704
|
-
"reset": { "type": "boolean" },
|
|
705
|
-
"hasMore": { "type": "boolean" },
|
|
706
|
-
"snapshot": { "$ref": "#/$defs/TaskObservationSnapshot" },
|
|
707
|
-
"events": {
|
|
708
|
-
"type": "array",
|
|
709
|
-
"maxItems": 100,
|
|
710
|
-
"items": { "$ref": "#/$defs/TaskObservationEvent" }
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
},
|
|
714
|
-
"TaskListField": {
|
|
715
|
-
"description": "任务列表中的受限展示字段;key 是稳定机器键,value 是 Host 裁剪后的展示文本。",
|
|
716
|
-
"title": "TaskListField",
|
|
717
|
-
"type": "object",
|
|
718
|
-
"additionalProperties": false,
|
|
719
|
-
"required": ["key", "value"],
|
|
720
|
-
"properties": {
|
|
721
|
-
"key": {
|
|
722
|
-
"description": "展示字段的稳定机器键,例如 machine 或 command。",
|
|
723
|
-
"type": "string",
|
|
724
|
-
"minLength": 1,
|
|
725
|
-
"maxLength": 64,
|
|
726
|
-
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]*$"
|
|
727
|
-
},
|
|
728
|
-
"value": {
|
|
729
|
-
"description": "Host 完成授权与裁剪后的展示文本。",
|
|
730
|
-
"type": "string",
|
|
731
|
-
"maxLength": 16384
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
},
|
|
735
|
-
"TaskListItem": {
|
|
736
|
-
"description": "Host 已授权发现的任务摘要;taskId 是可继续传给 tasks.watch 的不透明引用。",
|
|
737
|
-
"title": "TaskListItem",
|
|
738
|
-
"type": "object",
|
|
739
|
-
"additionalProperties": false,
|
|
740
|
-
"required": [
|
|
741
|
-
"taskId",
|
|
742
|
-
"kind",
|
|
743
|
-
"name",
|
|
744
|
-
"status",
|
|
745
|
-
"updatedAt",
|
|
746
|
-
"fields"
|
|
747
|
-
],
|
|
748
|
-
"properties": {
|
|
749
|
-
"taskId": {
|
|
750
|
-
"description": "可继续传给 tasks.watch 的 Host 不透明任务引用。",
|
|
751
|
-
"type": "string",
|
|
752
|
-
"minLength": 1,
|
|
753
|
-
"maxLength": 256
|
|
754
|
-
},
|
|
755
|
-
"kind": {
|
|
756
|
-
"description": "任务来源类型的稳定机器键。",
|
|
757
|
-
"type": "string",
|
|
758
|
-
"minLength": 1,
|
|
759
|
-
"maxLength": 64,
|
|
760
|
-
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]*$"
|
|
761
|
-
},
|
|
762
|
-
"name": {
|
|
763
|
-
"description": "任务的安全展示名称。",
|
|
764
|
-
"type": "string",
|
|
765
|
-
"minLength": 1,
|
|
766
|
-
"maxLength": 256
|
|
767
|
-
},
|
|
768
|
-
"status": { "$ref": "#/$defs/TaskStatus" },
|
|
769
|
-
"progress": {
|
|
770
|
-
"description": "可选执行进度,取值范围为 0 到 1。",
|
|
771
|
-
"type": "number",
|
|
772
|
-
"minimum": 0,
|
|
773
|
-
"maximum": 1
|
|
774
|
-
},
|
|
775
|
-
"message": {
|
|
776
|
-
"description": "Host 裁剪后的可选状态说明。",
|
|
777
|
-
"type": "string",
|
|
778
|
-
"maxLength": 1024
|
|
779
|
-
},
|
|
780
|
-
"updatedAt": {
|
|
781
|
-
"description": "任务摘要最后更新时间,使用 UTC ISO 8601 字符串。",
|
|
782
|
-
"type": "string",
|
|
783
|
-
"pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
|
|
784
|
-
},
|
|
785
|
-
"fields": {
|
|
786
|
-
"description": "任务面板可展示的受限附加字段。",
|
|
787
|
-
"type": "array",
|
|
788
|
-
"maxItems": 32,
|
|
789
|
-
"items": { "$ref": "#/$defs/TaskListField" }
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
},
|
|
793
|
-
"TaskListPage": {
|
|
794
|
-
"description": "Host 已授权任务摘要的一页结果;nextCursor 缺失表示当前页已到末尾。",
|
|
795
|
-
"title": "TaskListPage",
|
|
796
|
-
"type": "object",
|
|
797
|
-
"additionalProperties": false,
|
|
798
|
-
"required": ["schemaVersion", "tasks"],
|
|
799
|
-
"properties": {
|
|
800
|
-
"schemaVersion": {
|
|
801
|
-
"description": "任务列表页结构版本,当前固定为 1。",
|
|
802
|
-
"const": 1
|
|
803
|
-
},
|
|
804
|
-
"tasks": {
|
|
805
|
-
"description": "当前页中 Host 已授权的任务摘要。",
|
|
806
|
-
"type": "array",
|
|
807
|
-
"maxItems": 100,
|
|
808
|
-
"items": { "$ref": "#/$defs/TaskListItem" }
|
|
809
|
-
},
|
|
810
|
-
"nextCursor": {
|
|
811
|
-
"description": "下一页的不透明游标;缺失表示当前列表已到末尾。",
|
|
812
|
-
"type": "string",
|
|
813
|
-
"minLength": 1,
|
|
814
|
-
"maxLength": 512
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
1088
|
"ToolResultMetric": {
|
|
819
1089
|
"description": "工具结果中的单个指标。",
|
|
820
1090
|
"title": "ToolResultMetric",
|
|
@@ -1191,74 +1461,6 @@ const widgetRuntimeContractsSchema = {
|
|
|
1191
1461
|
}
|
|
1192
1462
|
}
|
|
1193
1463
|
},
|
|
1194
|
-
{
|
|
1195
|
-
"type": "object",
|
|
1196
|
-
"additionalProperties": false,
|
|
1197
|
-
"required": ["name", "limits"],
|
|
1198
|
-
"properties": {
|
|
1199
|
-
"name": { "const": "tasks.list" },
|
|
1200
|
-
"limits": {
|
|
1201
|
-
"type": "object",
|
|
1202
|
-
"additionalProperties": false,
|
|
1203
|
-
"required": [
|
|
1204
|
-
"callsPerMinute",
|
|
1205
|
-
"pageSize",
|
|
1206
|
-
"minPollMs"
|
|
1207
|
-
],
|
|
1208
|
-
"properties": {
|
|
1209
|
-
"callsPerMinute": {
|
|
1210
|
-
"type": "integer",
|
|
1211
|
-
"minimum": 1,
|
|
1212
|
-
"maximum": 9007199254740991
|
|
1213
|
-
},
|
|
1214
|
-
"pageSize": {
|
|
1215
|
-
"type": "integer",
|
|
1216
|
-
"minimum": 1,
|
|
1217
|
-
"maximum": 100
|
|
1218
|
-
},
|
|
1219
|
-
"minPollMs": {
|
|
1220
|
-
"type": "integer",
|
|
1221
|
-
"minimum": 1e3,
|
|
1222
|
-
"maximum": 6e4
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
},
|
|
1228
|
-
{
|
|
1229
|
-
"type": "object",
|
|
1230
|
-
"additionalProperties": false,
|
|
1231
|
-
"required": ["name", "limits"],
|
|
1232
|
-
"properties": {
|
|
1233
|
-
"name": { "const": "tasks.watch" },
|
|
1234
|
-
"limits": {
|
|
1235
|
-
"type": "object",
|
|
1236
|
-
"additionalProperties": false,
|
|
1237
|
-
"required": [
|
|
1238
|
-
"callsPerMinute",
|
|
1239
|
-
"pageSize",
|
|
1240
|
-
"minPollMs"
|
|
1241
|
-
],
|
|
1242
|
-
"properties": {
|
|
1243
|
-
"callsPerMinute": {
|
|
1244
|
-
"type": "integer",
|
|
1245
|
-
"minimum": 1,
|
|
1246
|
-
"maximum": 9007199254740991
|
|
1247
|
-
},
|
|
1248
|
-
"pageSize": {
|
|
1249
|
-
"type": "integer",
|
|
1250
|
-
"minimum": 1,
|
|
1251
|
-
"maximum": 100
|
|
1252
|
-
},
|
|
1253
|
-
"minPollMs": {
|
|
1254
|
-
"type": "integer",
|
|
1255
|
-
"minimum": 1e3,
|
|
1256
|
-
"maximum": 6e4
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
},
|
|
1262
1464
|
{
|
|
1263
1465
|
"type": "object",
|
|
1264
1466
|
"additionalProperties": false,
|
|
@@ -1715,65 +1917,11 @@ const widgetRuntimeContractsSchema = {
|
|
|
1715
1917
|
"additionalProperties": false,
|
|
1716
1918
|
"required": ["operation", "input"],
|
|
1717
1919
|
"properties": {
|
|
1718
|
-
"operation": { "const": "
|
|
1719
|
-
"input": {
|
|
1920
|
+
"operation": { "const": "ui.state" },
|
|
1921
|
+
"input": { "oneOf": [{
|
|
1720
1922
|
"type": "object",
|
|
1721
1923
|
"additionalProperties": false,
|
|
1722
|
-
"
|
|
1723
|
-
"cursor": {
|
|
1724
|
-
"type": "string",
|
|
1725
|
-
"minLength": 1,
|
|
1726
|
-
"maxLength": 512
|
|
1727
|
-
},
|
|
1728
|
-
"limit": {
|
|
1729
|
-
"type": "integer",
|
|
1730
|
-
"minimum": 1,
|
|
1731
|
-
"maximum": 100
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
},
|
|
1737
|
-
{
|
|
1738
|
-
"type": "object",
|
|
1739
|
-
"additionalProperties": false,
|
|
1740
|
-
"required": ["operation", "input"],
|
|
1741
|
-
"properties": {
|
|
1742
|
-
"operation": { "const": "tasks.watch" },
|
|
1743
|
-
"input": {
|
|
1744
|
-
"type": "object",
|
|
1745
|
-
"additionalProperties": false,
|
|
1746
|
-
"required": ["taskId"],
|
|
1747
|
-
"properties": {
|
|
1748
|
-
"taskId": {
|
|
1749
|
-
"type": "string",
|
|
1750
|
-
"minLength": 1,
|
|
1751
|
-
"maxLength": 256
|
|
1752
|
-
},
|
|
1753
|
-
"cursor": {
|
|
1754
|
-
"type": "string",
|
|
1755
|
-
"minLength": 1,
|
|
1756
|
-
"maxLength": 256
|
|
1757
|
-
},
|
|
1758
|
-
"limit": {
|
|
1759
|
-
"type": "integer",
|
|
1760
|
-
"minimum": 1,
|
|
1761
|
-
"maximum": 100
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
},
|
|
1767
|
-
{
|
|
1768
|
-
"type": "object",
|
|
1769
|
-
"additionalProperties": false,
|
|
1770
|
-
"required": ["operation", "input"],
|
|
1771
|
-
"properties": {
|
|
1772
|
-
"operation": { "const": "ui.state" },
|
|
1773
|
-
"input": { "oneOf": [{
|
|
1774
|
-
"type": "object",
|
|
1775
|
-
"additionalProperties": false,
|
|
1776
|
-
"required": ["action", "key"],
|
|
1924
|
+
"required": ["action", "key"],
|
|
1777
1925
|
"properties": {
|
|
1778
1926
|
"action": { "const": "read" },
|
|
1779
1927
|
"key": {
|
|
@@ -3199,204 +3347,848 @@ const widgetRuntimeContractsSchema = {
|
|
|
3199
3347
|
"type": { "const": "tool-result" },
|
|
3200
3348
|
"payload": { "$ref": "#/$defs/ToolResultPublicWidgetEventPayload" }
|
|
3201
3349
|
}
|
|
3202
|
-
}],
|
|
3203
|
-
"unevaluatedProperties": false
|
|
3350
|
+
}],
|
|
3351
|
+
"unevaluatedProperties": false
|
|
3352
|
+
},
|
|
3353
|
+
"SandboxApprovalRequestedPublicWidgetEvent": {
|
|
3354
|
+
"title": "SandboxApprovalRequestedPublicWidgetEvent",
|
|
3355
|
+
"description": "sandbox-approval-requested 事件。",
|
|
3356
|
+
"type": "object",
|
|
3357
|
+
"allOf": [{ "$ref": "#/$defs/PublicWidgetEventBase" }, {
|
|
3358
|
+
"type": "object",
|
|
3359
|
+
"required": [
|
|
3360
|
+
"topic",
|
|
3361
|
+
"type",
|
|
3362
|
+
"payload"
|
|
3363
|
+
],
|
|
3364
|
+
"properties": {
|
|
3365
|
+
"topic": { "const": "approval.lifecycle" },
|
|
3366
|
+
"type": { "const": "sandbox-approval-requested" },
|
|
3367
|
+
"payload": { "$ref": "#/$defs/SandboxApprovalRequestedPublicWidgetEventPayload" }
|
|
3368
|
+
}
|
|
3369
|
+
}],
|
|
3370
|
+
"unevaluatedProperties": false
|
|
3371
|
+
},
|
|
3372
|
+
"SandboxApprovedPublicWidgetEvent": {
|
|
3373
|
+
"title": "SandboxApprovedPublicWidgetEvent",
|
|
3374
|
+
"description": "sandbox-approved 事件。",
|
|
3375
|
+
"type": "object",
|
|
3376
|
+
"allOf": [{ "$ref": "#/$defs/PublicWidgetEventBase" }, {
|
|
3377
|
+
"type": "object",
|
|
3378
|
+
"required": [
|
|
3379
|
+
"topic",
|
|
3380
|
+
"type",
|
|
3381
|
+
"payload"
|
|
3382
|
+
],
|
|
3383
|
+
"properties": {
|
|
3384
|
+
"topic": { "const": "approval.lifecycle" },
|
|
3385
|
+
"type": { "const": "sandbox-approved" },
|
|
3386
|
+
"payload": { "$ref": "#/$defs/SandboxApprovedPublicWidgetEventPayload" }
|
|
3387
|
+
}
|
|
3388
|
+
}],
|
|
3389
|
+
"unevaluatedProperties": false
|
|
3390
|
+
},
|
|
3391
|
+
"SandboxDeniedPublicWidgetEvent": {
|
|
3392
|
+
"title": "SandboxDeniedPublicWidgetEvent",
|
|
3393
|
+
"description": "sandbox-denied 事件。",
|
|
3394
|
+
"type": "object",
|
|
3395
|
+
"allOf": [{ "$ref": "#/$defs/PublicWidgetEventBase" }, {
|
|
3396
|
+
"type": "object",
|
|
3397
|
+
"required": [
|
|
3398
|
+
"topic",
|
|
3399
|
+
"type",
|
|
3400
|
+
"payload"
|
|
3401
|
+
],
|
|
3402
|
+
"properties": {
|
|
3403
|
+
"topic": { "const": "approval.lifecycle" },
|
|
3404
|
+
"type": { "const": "sandbox-denied" },
|
|
3405
|
+
"payload": { "$ref": "#/$defs/EmptyPublicWidgetEventPayload" }
|
|
3406
|
+
}
|
|
3407
|
+
}],
|
|
3408
|
+
"unevaluatedProperties": false
|
|
3409
|
+
},
|
|
3410
|
+
"UserInputRequestedPublicWidgetEvent": {
|
|
3411
|
+
"title": "UserInputRequestedPublicWidgetEvent",
|
|
3412
|
+
"description": "user-input-requested 事件。",
|
|
3413
|
+
"type": "object",
|
|
3414
|
+
"allOf": [{ "$ref": "#/$defs/PublicWidgetEventBase" }, {
|
|
3415
|
+
"type": "object",
|
|
3416
|
+
"required": [
|
|
3417
|
+
"topic",
|
|
3418
|
+
"type",
|
|
3419
|
+
"payload"
|
|
3420
|
+
],
|
|
3421
|
+
"properties": {
|
|
3422
|
+
"topic": { "const": "interaction.lifecycle" },
|
|
3423
|
+
"type": { "const": "user-input-requested" },
|
|
3424
|
+
"payload": { "$ref": "#/$defs/UserInputRequestedPublicWidgetEventPayload" }
|
|
3425
|
+
}
|
|
3426
|
+
}],
|
|
3427
|
+
"unevaluatedProperties": false
|
|
3428
|
+
},
|
|
3429
|
+
"ComputeReviewRequestedPublicWidgetEvent": {
|
|
3430
|
+
"title": "ComputeReviewRequestedPublicWidgetEvent",
|
|
3431
|
+
"description": "compute-review-requested 事件。",
|
|
3432
|
+
"type": "object",
|
|
3433
|
+
"allOf": [{ "$ref": "#/$defs/PublicWidgetEventBase" }, {
|
|
3434
|
+
"type": "object",
|
|
3435
|
+
"required": [
|
|
3436
|
+
"topic",
|
|
3437
|
+
"type",
|
|
3438
|
+
"payload"
|
|
3439
|
+
],
|
|
3440
|
+
"properties": {
|
|
3441
|
+
"topic": { "const": "interaction.lifecycle" },
|
|
3442
|
+
"type": { "const": "compute-review-requested" },
|
|
3443
|
+
"payload": { "$ref": "#/$defs/ComputeReviewRequestedPublicWidgetEventPayload" }
|
|
3444
|
+
}
|
|
3445
|
+
}],
|
|
3446
|
+
"unevaluatedProperties": false
|
|
3447
|
+
},
|
|
3448
|
+
"WidgetEventMessage": {
|
|
3449
|
+
"title": "WidgetEventMessage",
|
|
3450
|
+
"description": "Host 通过当前 Widget MessageChannel 主动推送的 Workflow 事件。",
|
|
3451
|
+
"type": "object",
|
|
3452
|
+
"allOf": [{ "$ref": "#/$defs/BridgeEnvelopeBase" }, {
|
|
3453
|
+
"type": "object",
|
|
3454
|
+
"required": ["type", "payload"],
|
|
3455
|
+
"properties": {
|
|
3456
|
+
"type": { "const": "event" },
|
|
3457
|
+
"payload": { "$ref": "#/$defs/WidgetLiveEvent" }
|
|
3458
|
+
}
|
|
3459
|
+
}],
|
|
3460
|
+
"unevaluatedProperties": false
|
|
3461
|
+
},
|
|
3462
|
+
"WidgetEvent": {
|
|
3463
|
+
"description": "低层 events.read 事件页中的单条原始事件;type 为受限标识、payload 为 JSON。",
|
|
3464
|
+
"type": "object",
|
|
3465
|
+
"additionalProperties": false,
|
|
3466
|
+
"required": [
|
|
3467
|
+
"id",
|
|
3468
|
+
"type",
|
|
3469
|
+
"payload"
|
|
3470
|
+
],
|
|
3471
|
+
"properties": {
|
|
3472
|
+
"id": {
|
|
3473
|
+
"type": "string",
|
|
3474
|
+
"minLength": 1,
|
|
3475
|
+
"maxLength": 256
|
|
3476
|
+
},
|
|
3477
|
+
"type": {
|
|
3478
|
+
"type": "string",
|
|
3479
|
+
"minLength": 1,
|
|
3480
|
+
"maxLength": 128,
|
|
3481
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
|
|
3482
|
+
},
|
|
3483
|
+
"payload": { "$ref": "#/$defs/JsonValue" }
|
|
3484
|
+
}
|
|
3485
|
+
},
|
|
3486
|
+
"WidgetEventBatch": {
|
|
3487
|
+
"description": "低层 events.read 的一页事件:topic、cursor、reset、hasMore 与事件列表。",
|
|
3488
|
+
"type": "object",
|
|
3489
|
+
"additionalProperties": false,
|
|
3490
|
+
"required": [
|
|
3491
|
+
"schemaVersion",
|
|
3492
|
+
"topic",
|
|
3493
|
+
"cursor",
|
|
3494
|
+
"reset",
|
|
3495
|
+
"hasMore",
|
|
3496
|
+
"events"
|
|
3497
|
+
],
|
|
3498
|
+
"properties": {
|
|
3499
|
+
"schemaVersion": { "const": 1 },
|
|
3500
|
+
"topic": {
|
|
3501
|
+
"type": "string",
|
|
3502
|
+
"minLength": 1,
|
|
3503
|
+
"maxLength": 128,
|
|
3504
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
|
|
3505
|
+
},
|
|
3506
|
+
"cursor": {
|
|
3507
|
+
"type": "string",
|
|
3508
|
+
"minLength": 1,
|
|
3509
|
+
"maxLength": 256
|
|
3510
|
+
},
|
|
3511
|
+
"reset": { "type": "boolean" },
|
|
3512
|
+
"hasMore": { "type": "boolean" },
|
|
3513
|
+
"events": {
|
|
3514
|
+
"type": "array",
|
|
3515
|
+
"maxItems": 100,
|
|
3516
|
+
"items": { "$ref": "#/$defs/WidgetEvent" }
|
|
3517
|
+
},
|
|
3518
|
+
"snapshot": { "$ref": "#/$defs/JsonValue" }
|
|
3519
|
+
}
|
|
3520
|
+
},
|
|
3521
|
+
"ToolLifecycleEvent": {
|
|
3522
|
+
"description": "工具生命周期事件:started / completed / failed / cancelled。",
|
|
3523
|
+
"type": "object",
|
|
3524
|
+
"additionalProperties": false,
|
|
3525
|
+
"required": [
|
|
3526
|
+
"toolCallId",
|
|
3527
|
+
"toolName",
|
|
3528
|
+
"phase"
|
|
3529
|
+
],
|
|
3530
|
+
"properties": {
|
|
3531
|
+
"toolCallId": {
|
|
3532
|
+
"type": "string",
|
|
3533
|
+
"minLength": 1,
|
|
3534
|
+
"maxLength": 256
|
|
3535
|
+
},
|
|
3536
|
+
"toolName": {
|
|
3537
|
+
"type": "string",
|
|
3538
|
+
"minLength": 1,
|
|
3539
|
+
"maxLength": 128,
|
|
3540
|
+
"pattern": "^[A-Za-z0-9_.:-]+$"
|
|
3541
|
+
},
|
|
3542
|
+
"phase": { "enum": [
|
|
3543
|
+
"started",
|
|
3544
|
+
"completed",
|
|
3545
|
+
"failed",
|
|
3546
|
+
"cancelled"
|
|
3547
|
+
] }
|
|
3548
|
+
}
|
|
3549
|
+
},
|
|
3550
|
+
"WidgetDiagnosticDetail": {
|
|
3551
|
+
"title": "WidgetDiagnosticDetail",
|
|
3552
|
+
"description": "受控字段诊断或工程相对源码位置;不携带原始对象。",
|
|
3553
|
+
"oneOf": [{
|
|
3554
|
+
"type": "object",
|
|
3555
|
+
"additionalProperties": false,
|
|
3556
|
+
"required": ["field"],
|
|
3557
|
+
"properties": {
|
|
3558
|
+
"field": {
|
|
3559
|
+
"type": "string",
|
|
3560
|
+
"minLength": 1,
|
|
3561
|
+
"maxLength": 128
|
|
3562
|
+
},
|
|
3563
|
+
"expected": {
|
|
3564
|
+
"type": "string",
|
|
3565
|
+
"maxLength": 256
|
|
3566
|
+
},
|
|
3567
|
+
"observed": {
|
|
3568
|
+
"type": "string",
|
|
3569
|
+
"maxLength": 256
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
}, {
|
|
3573
|
+
"type": "object",
|
|
3574
|
+
"additionalProperties": false,
|
|
3575
|
+
"required": [
|
|
3576
|
+
"file",
|
|
3577
|
+
"line",
|
|
3578
|
+
"column"
|
|
3579
|
+
],
|
|
3580
|
+
"properties": {
|
|
3581
|
+
"file": {
|
|
3582
|
+
"type": "string",
|
|
3583
|
+
"minLength": 1,
|
|
3584
|
+
"maxLength": 256,
|
|
3585
|
+
"pattern": "^(?!/)(?!.*\\\\)(?!.*:)(?!.*(?:^|/)\\.{1,2}(?:/|$))[^\\u0000-\\u001f]+$"
|
|
3586
|
+
},
|
|
3587
|
+
"line": {
|
|
3588
|
+
"type": "integer",
|
|
3589
|
+
"minimum": 1
|
|
3590
|
+
},
|
|
3591
|
+
"column": {
|
|
3592
|
+
"type": "integer",
|
|
3593
|
+
"minimum": 1
|
|
3594
|
+
},
|
|
3595
|
+
"excerpt": {
|
|
3596
|
+
"type": "string",
|
|
3597
|
+
"minLength": 1,
|
|
3598
|
+
"maxLength": 1024
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
}]
|
|
3602
|
+
},
|
|
3603
|
+
"WidgetDiagnosticIO": {
|
|
3604
|
+
"title": "WidgetDiagnosticIO",
|
|
3605
|
+
"description": "保留 transport、HTTP 与非法响应事实;不包含 URL 或原始响应。",
|
|
3606
|
+
"oneOf": [{
|
|
3607
|
+
"type": "object",
|
|
3608
|
+
"additionalProperties": false,
|
|
3609
|
+
"required": ["kind"],
|
|
3610
|
+
"properties": {
|
|
3611
|
+
"kind": { "enum": ["transport", "invalid-response"] },
|
|
3612
|
+
"sourceCode": {
|
|
3613
|
+
"type": "string",
|
|
3614
|
+
"minLength": 1,
|
|
3615
|
+
"maxLength": 96,
|
|
3616
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
}, {
|
|
3620
|
+
"type": "object",
|
|
3621
|
+
"additionalProperties": false,
|
|
3622
|
+
"required": ["kind", "status"],
|
|
3623
|
+
"properties": {
|
|
3624
|
+
"kind": { "enum": ["http"] },
|
|
3625
|
+
"status": {
|
|
3626
|
+
"type": "integer",
|
|
3627
|
+
"minimum": 100,
|
|
3628
|
+
"maximum": 599,
|
|
3629
|
+
"not": {
|
|
3630
|
+
"minimum": 200,
|
|
3631
|
+
"maximum": 299
|
|
3632
|
+
}
|
|
3633
|
+
},
|
|
3634
|
+
"sourceCode": {
|
|
3635
|
+
"type": "string",
|
|
3636
|
+
"minLength": 1,
|
|
3637
|
+
"maxLength": 96,
|
|
3638
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
}]
|
|
3642
|
+
},
|
|
3643
|
+
"WidgetDevelopmentDiagnostic": {
|
|
3644
|
+
"title": "WidgetDevelopmentDiagnostic",
|
|
3645
|
+
"description": "可信出口的标准诊断;恢复指令和 scope 由宿主另行生成。",
|
|
3646
|
+
"type": "object",
|
|
3647
|
+
"additionalProperties": false,
|
|
3648
|
+
"required": [
|
|
3649
|
+
"schemaVersion",
|
|
3650
|
+
"source",
|
|
3651
|
+
"code",
|
|
3652
|
+
"phase",
|
|
3653
|
+
"operation",
|
|
3654
|
+
"severity",
|
|
3655
|
+
"message"
|
|
3656
|
+
],
|
|
3657
|
+
"properties": {
|
|
3658
|
+
"schemaVersion": { "const": 1 },
|
|
3659
|
+
"source": { "enum": [
|
|
3660
|
+
"sdk",
|
|
3661
|
+
"host",
|
|
3662
|
+
"toolchain"
|
|
3663
|
+
] },
|
|
3664
|
+
"code": {
|
|
3665
|
+
"type": "string",
|
|
3666
|
+
"minLength": 1,
|
|
3667
|
+
"maxLength": 96,
|
|
3668
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3669
|
+
},
|
|
3670
|
+
"sourceCode": {
|
|
3671
|
+
"type": "string",
|
|
3672
|
+
"minLength": 1,
|
|
3673
|
+
"maxLength": 96,
|
|
3674
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3675
|
+
},
|
|
3676
|
+
"phase": { "enum": [
|
|
3677
|
+
"discovery",
|
|
3678
|
+
"build",
|
|
3679
|
+
"config",
|
|
3680
|
+
"load",
|
|
3681
|
+
"handshake",
|
|
3682
|
+
"render",
|
|
3683
|
+
"update",
|
|
3684
|
+
"capability",
|
|
3685
|
+
"dispose"
|
|
3686
|
+
] },
|
|
3687
|
+
"sourcePhase": {
|
|
3688
|
+
"type": "string",
|
|
3689
|
+
"minLength": 1,
|
|
3690
|
+
"maxLength": 96,
|
|
3691
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3692
|
+
},
|
|
3693
|
+
"operation": {
|
|
3694
|
+
"type": "string",
|
|
3695
|
+
"minLength": 1,
|
|
3696
|
+
"maxLength": 96,
|
|
3697
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3698
|
+
},
|
|
3699
|
+
"severity": { "enum": [
|
|
3700
|
+
"warning",
|
|
3701
|
+
"request-error",
|
|
3702
|
+
"instance-failure"
|
|
3703
|
+
] },
|
|
3704
|
+
"message": {
|
|
3705
|
+
"type": "string",
|
|
3706
|
+
"minLength": 1,
|
|
3707
|
+
"maxLength": 1024
|
|
3708
|
+
},
|
|
3709
|
+
"retryable": { "type": "boolean" },
|
|
3710
|
+
"correlationId": { "$ref": "#/$defs/WidgetError/properties/correlationId" },
|
|
3711
|
+
"diagnostics": {
|
|
3712
|
+
"type": "array",
|
|
3713
|
+
"maxItems": 8,
|
|
3714
|
+
"items": { "$ref": "#/$defs/WidgetDiagnosticDetail" }
|
|
3715
|
+
},
|
|
3716
|
+
"io": { "$ref": "#/$defs/WidgetDiagnosticIO" }
|
|
3717
|
+
}
|
|
3718
|
+
},
|
|
3719
|
+
"WidgetRecoveryAction": {
|
|
3720
|
+
"title": "WidgetRecoveryAction",
|
|
3721
|
+
"description": "恢复动作的语义及类型化参数;可信宿主绑定已有工具,不包含任意命令。",
|
|
3722
|
+
"oneOf": [
|
|
3723
|
+
{
|
|
3724
|
+
"type": "object",
|
|
3725
|
+
"additionalProperties": false,
|
|
3726
|
+
"required": ["id", "params"],
|
|
3727
|
+
"properties": {
|
|
3728
|
+
"id": { "const": "inspect" },
|
|
3729
|
+
"params": {
|
|
3730
|
+
"type": "object",
|
|
3731
|
+
"additionalProperties": false,
|
|
3732
|
+
"required": ["area"],
|
|
3733
|
+
"properties": { "area": { "enum": [
|
|
3734
|
+
"toolchain",
|
|
3735
|
+
"host-bridge",
|
|
3736
|
+
"configuration",
|
|
3737
|
+
"bundle",
|
|
3738
|
+
"handshake",
|
|
3739
|
+
"render",
|
|
3740
|
+
"capability",
|
|
3741
|
+
"lease",
|
|
3742
|
+
"operation-outcome",
|
|
3743
|
+
"runtime"
|
|
3744
|
+
] } }
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
},
|
|
3748
|
+
{
|
|
3749
|
+
"type": "object",
|
|
3750
|
+
"additionalProperties": false,
|
|
3751
|
+
"required": ["id", "params"],
|
|
3752
|
+
"properties": {
|
|
3753
|
+
"id": { "const": "wait" },
|
|
3754
|
+
"params": {
|
|
3755
|
+
"type": "object",
|
|
3756
|
+
"additionalProperties": false,
|
|
3757
|
+
"required": ["milestone"],
|
|
3758
|
+
"properties": {
|
|
3759
|
+
"milestone": { "enum": ["budget-reset", "connection-restored"] },
|
|
3760
|
+
"retryAfterMs": {
|
|
3761
|
+
"type": "integer",
|
|
3762
|
+
"minimum": 1
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
},
|
|
3768
|
+
{
|
|
3769
|
+
"type": "object",
|
|
3770
|
+
"additionalProperties": false,
|
|
3771
|
+
"required": ["id", "params"],
|
|
3772
|
+
"properties": {
|
|
3773
|
+
"id": { "const": "edit-project" },
|
|
3774
|
+
"params": {
|
|
3775
|
+
"type": "object",
|
|
3776
|
+
"additionalProperties": false,
|
|
3777
|
+
"required": ["evidence"],
|
|
3778
|
+
"properties": { "evidence": { "const": "diagnostics" } }
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3781
|
+
},
|
|
3782
|
+
{
|
|
3783
|
+
"type": "object",
|
|
3784
|
+
"additionalProperties": false,
|
|
3785
|
+
"required": ["id", "params"],
|
|
3786
|
+
"properties": {
|
|
3787
|
+
"id": { "const": "build-project" },
|
|
3788
|
+
"params": {
|
|
3789
|
+
"type": "object",
|
|
3790
|
+
"additionalProperties": false,
|
|
3791
|
+
"required": ["target"],
|
|
3792
|
+
"properties": { "target": { "const": "current-project" } }
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
},
|
|
3796
|
+
{
|
|
3797
|
+
"type": "object",
|
|
3798
|
+
"additionalProperties": false,
|
|
3799
|
+
"required": ["id", "params"],
|
|
3800
|
+
"properties": {
|
|
3801
|
+
"id": { "const": "refresh-preview" },
|
|
3802
|
+
"params": {
|
|
3803
|
+
"type": "object",
|
|
3804
|
+
"additionalProperties": false,
|
|
3805
|
+
"required": ["target"],
|
|
3806
|
+
"properties": { "target": { "const": "current-project" } }
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
},
|
|
3810
|
+
{
|
|
3811
|
+
"type": "object",
|
|
3812
|
+
"additionalProperties": false,
|
|
3813
|
+
"required": ["id", "params"],
|
|
3814
|
+
"properties": {
|
|
3815
|
+
"id": { "const": "verify-scenario" },
|
|
3816
|
+
"params": {
|
|
3817
|
+
"type": "object",
|
|
3818
|
+
"additionalProperties": false,
|
|
3819
|
+
"required": ["target"],
|
|
3820
|
+
"properties": {
|
|
3821
|
+
"target": { "enum": ["current-attempt", "next-built-generation"] },
|
|
3822
|
+
"scenarioId": {
|
|
3823
|
+
"type": "string",
|
|
3824
|
+
"minLength": 1,
|
|
3825
|
+
"maxLength": 96,
|
|
3826
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
},
|
|
3832
|
+
{
|
|
3833
|
+
"type": "object",
|
|
3834
|
+
"additionalProperties": false,
|
|
3835
|
+
"required": ["id", "params"],
|
|
3836
|
+
"properties": {
|
|
3837
|
+
"id": { "const": "request-external-action" },
|
|
3838
|
+
"params": {
|
|
3839
|
+
"type": "object",
|
|
3840
|
+
"additionalProperties": false,
|
|
3841
|
+
"required": ["reason"],
|
|
3842
|
+
"properties": { "reason": { "enum": [
|
|
3843
|
+
"authorization",
|
|
3844
|
+
"host-support",
|
|
3845
|
+
"host-start",
|
|
3846
|
+
"credentials"
|
|
3847
|
+
] } }
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
},
|
|
3851
|
+
{
|
|
3852
|
+
"type": "object",
|
|
3853
|
+
"additionalProperties": false,
|
|
3854
|
+
"required": ["id", "params"],
|
|
3855
|
+
"properties": {
|
|
3856
|
+
"id": { "const": "stop-preview" },
|
|
3857
|
+
"params": {
|
|
3858
|
+
"type": "object",
|
|
3859
|
+
"additionalProperties": false,
|
|
3860
|
+
"required": ["target"],
|
|
3861
|
+
"properties": { "target": { "const": "current-preview" } }
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
]
|
|
3866
|
+
},
|
|
3867
|
+
"WidgetRecoveryVerification": {
|
|
3868
|
+
"title": "WidgetRecoveryVerification",
|
|
3869
|
+
"description": "恢复复验目标;下一成功构建须在取得回执后绑定实际产物。",
|
|
3870
|
+
"type": "object",
|
|
3871
|
+
"additionalProperties": false,
|
|
3872
|
+
"required": ["target", "milestone"],
|
|
3873
|
+
"properties": {
|
|
3874
|
+
"target": { "enum": [
|
|
3875
|
+
"current-attempt",
|
|
3876
|
+
"next-built-generation",
|
|
3877
|
+
"original-operation"
|
|
3878
|
+
] },
|
|
3879
|
+
"milestone": { "enum": [
|
|
3880
|
+
"diagnostics-updated",
|
|
3881
|
+
"render-handled",
|
|
3882
|
+
"scenario-passed",
|
|
3883
|
+
"operation-confirmed"
|
|
3884
|
+
] },
|
|
3885
|
+
"scenarioId": {
|
|
3886
|
+
"type": "string",
|
|
3887
|
+
"minLength": 1,
|
|
3888
|
+
"maxLength": 96,
|
|
3889
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3890
|
+
}
|
|
3891
|
+
}
|
|
3892
|
+
},
|
|
3893
|
+
"WidgetRecoveryPlan": {
|
|
3894
|
+
"title": "WidgetRecoveryPlan",
|
|
3895
|
+
"description": "可信宿主选择的恢复计划;不能由 Guest 的诊断 payload 指定。",
|
|
3896
|
+
"type": "object",
|
|
3897
|
+
"additionalProperties": false,
|
|
3898
|
+
"required": [
|
|
3899
|
+
"schemaVersion",
|
|
3900
|
+
"ruleId",
|
|
3901
|
+
"ruleVersion",
|
|
3902
|
+
"disposition",
|
|
3903
|
+
"nextAction",
|
|
3904
|
+
"verification",
|
|
3905
|
+
"guidance",
|
|
3906
|
+
"followUpActions"
|
|
3907
|
+
],
|
|
3908
|
+
"properties": {
|
|
3909
|
+
"progress": { "$ref": "#/$defs/WidgetRecoveryProgress" },
|
|
3910
|
+
"schemaVersion": { "const": 1 },
|
|
3911
|
+
"ruleId": {
|
|
3912
|
+
"type": "string",
|
|
3913
|
+
"minLength": 1,
|
|
3914
|
+
"maxLength": 96,
|
|
3915
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3916
|
+
},
|
|
3917
|
+
"ruleVersion": {
|
|
3918
|
+
"type": "integer",
|
|
3919
|
+
"minimum": 1
|
|
3920
|
+
},
|
|
3921
|
+
"disposition": { "enum": [
|
|
3922
|
+
"retry",
|
|
3923
|
+
"repair",
|
|
3924
|
+
"inspect",
|
|
3925
|
+
"external-action",
|
|
3926
|
+
"stop"
|
|
3927
|
+
] },
|
|
3928
|
+
"nextAction": { "$ref": "#/$defs/WidgetRecoveryAction" },
|
|
3929
|
+
"verification": { "$ref": "#/$defs/WidgetRecoveryVerification" },
|
|
3930
|
+
"guidance": {
|
|
3931
|
+
"type": "string",
|
|
3932
|
+
"minLength": 1,
|
|
3933
|
+
"maxLength": 4096
|
|
3934
|
+
},
|
|
3935
|
+
"followUpActions": {
|
|
3936
|
+
"description": "首项动作完成后的有限恢复步骤;宿主逐步验证前置条件,不原样盲目重放。",
|
|
3937
|
+
"type": "array",
|
|
3938
|
+
"maxItems": 8,
|
|
3939
|
+
"items": { "$ref": "#/$defs/WidgetRecoveryAction" }
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3204
3942
|
},
|
|
3205
|
-
"
|
|
3206
|
-
"title": "
|
|
3207
|
-
"description": "
|
|
3943
|
+
"WidgetRecoveryRule": {
|
|
3944
|
+
"title": "WidgetRecoveryRule",
|
|
3945
|
+
"description": "公共恢复规则目录条目;空 codes 仅用于显式 unknown 回退。",
|
|
3208
3946
|
"type": "object",
|
|
3209
|
-
"
|
|
3210
|
-
|
|
3211
|
-
"
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
"
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3947
|
+
"additionalProperties": false,
|
|
3948
|
+
"required": [
|
|
3949
|
+
"id",
|
|
3950
|
+
"version",
|
|
3951
|
+
"sources",
|
|
3952
|
+
"codes",
|
|
3953
|
+
"disposition",
|
|
3954
|
+
"nextAction",
|
|
3955
|
+
"verification",
|
|
3956
|
+
"guidance",
|
|
3957
|
+
"followUpActions"
|
|
3958
|
+
],
|
|
3959
|
+
"properties": {
|
|
3960
|
+
"id": {
|
|
3961
|
+
"type": "string",
|
|
3962
|
+
"minLength": 1,
|
|
3963
|
+
"maxLength": 96,
|
|
3964
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3965
|
+
},
|
|
3966
|
+
"version": {
|
|
3967
|
+
"type": "integer",
|
|
3968
|
+
"minimum": 1
|
|
3969
|
+
},
|
|
3970
|
+
"sources": {
|
|
3971
|
+
"type": "array",
|
|
3972
|
+
"minItems": 1,
|
|
3973
|
+
"maxItems": 3,
|
|
3974
|
+
"uniqueItems": true,
|
|
3975
|
+
"items": { "enum": [
|
|
3976
|
+
"sdk",
|
|
3977
|
+
"host",
|
|
3978
|
+
"toolchain"
|
|
3979
|
+
] }
|
|
3980
|
+
},
|
|
3981
|
+
"codes": {
|
|
3982
|
+
"type": "array",
|
|
3983
|
+
"maxItems": 64,
|
|
3984
|
+
"uniqueItems": true,
|
|
3985
|
+
"items": {
|
|
3986
|
+
"type": "string",
|
|
3987
|
+
"minLength": 1,
|
|
3988
|
+
"maxLength": 96,
|
|
3989
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$"
|
|
3990
|
+
}
|
|
3991
|
+
},
|
|
3992
|
+
"disposition": { "enum": [
|
|
3993
|
+
"retry",
|
|
3994
|
+
"repair",
|
|
3995
|
+
"inspect",
|
|
3996
|
+
"external-action",
|
|
3997
|
+
"stop"
|
|
3998
|
+
] },
|
|
3999
|
+
"nextAction": { "$ref": "#/$defs/WidgetRecoveryAction" },
|
|
4000
|
+
"verification": { "$ref": "#/$defs/WidgetRecoveryVerification" },
|
|
4001
|
+
"guidance": {
|
|
4002
|
+
"type": "string",
|
|
4003
|
+
"minLength": 1,
|
|
4004
|
+
"maxLength": 4096
|
|
4005
|
+
},
|
|
4006
|
+
"followUpActions": {
|
|
4007
|
+
"description": "首项动作完成后的有限恢复步骤;宿主逐步验证前置条件,不原样盲目重放。",
|
|
4008
|
+
"type": "array",
|
|
4009
|
+
"maxItems": 8,
|
|
4010
|
+
"items": { "$ref": "#/$defs/WidgetRecoveryAction" }
|
|
3220
4011
|
}
|
|
3221
|
-
}
|
|
3222
|
-
"unevaluatedProperties": false
|
|
4012
|
+
}
|
|
3223
4013
|
},
|
|
3224
|
-
"
|
|
3225
|
-
"title": "
|
|
3226
|
-
"description": "
|
|
4014
|
+
"WidgetDevelopmentExtension": {
|
|
4015
|
+
"title": "WidgetDevelopmentExtension",
|
|
4016
|
+
"description": "经 offer/connect 显式选择的开发扩展;不授予 capability。",
|
|
4017
|
+
"const": "development-diagnostics-v1"
|
|
4018
|
+
},
|
|
4019
|
+
"WidgetDevelopmentOffer": {
|
|
4020
|
+
"title": "WidgetDevelopmentOffer",
|
|
4021
|
+
"description": "独立于旧 bootstrap-ready 的支持声明,接收方仍须校验 frame 来源和挂载尝试。",
|
|
3227
4022
|
"type": "object",
|
|
3228
|
-
"
|
|
3229
|
-
|
|
3230
|
-
"
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
"
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
"
|
|
4023
|
+
"additionalProperties": false,
|
|
4024
|
+
"required": [
|
|
4025
|
+
"type",
|
|
4026
|
+
"protocolVersion",
|
|
4027
|
+
"extensions"
|
|
4028
|
+
],
|
|
4029
|
+
"properties": {
|
|
4030
|
+
"type": { "const": "widget-bootstrap-offer" },
|
|
4031
|
+
"protocolVersion": { "const": 1 },
|
|
4032
|
+
"extensions": {
|
|
4033
|
+
"type": "array",
|
|
4034
|
+
"minItems": 1,
|
|
4035
|
+
"maxItems": 1,
|
|
4036
|
+
"uniqueItems": true,
|
|
4037
|
+
"items": { "$ref": "#/$defs/WidgetDevelopmentExtension" }
|
|
3239
4038
|
}
|
|
3240
|
-
}
|
|
3241
|
-
"unevaluatedProperties": false
|
|
4039
|
+
}
|
|
3242
4040
|
},
|
|
3243
|
-
"
|
|
3244
|
-
"title": "
|
|
3245
|
-
"description": "
|
|
4041
|
+
"WidgetDevelopmentConnect": {
|
|
4042
|
+
"title": "WidgetDevelopmentConnect",
|
|
4043
|
+
"description": "仅在收到当前 iframe 合法 offer 后使用的扩展 connect;旧形状保持不变。",
|
|
3246
4044
|
"type": "object",
|
|
3247
|
-
"
|
|
4045
|
+
"additionalProperties": false,
|
|
4046
|
+
"required": [
|
|
4047
|
+
"type",
|
|
4048
|
+
"protocolVersion",
|
|
4049
|
+
"channelId",
|
|
4050
|
+
"initPayload",
|
|
4051
|
+
"extensions"
|
|
4052
|
+
],
|
|
4053
|
+
"properties": {
|
|
4054
|
+
"type": { "const": "widget-host-connect" },
|
|
4055
|
+
"protocolVersion": { "const": 1 },
|
|
4056
|
+
"channelId": {
|
|
4057
|
+
"type": "string",
|
|
4058
|
+
"minLength": 16
|
|
4059
|
+
},
|
|
4060
|
+
"initPayload": { "$ref": "#/$defs/InitPayload" },
|
|
4061
|
+
"extensions": {
|
|
4062
|
+
"type": "array",
|
|
4063
|
+
"minItems": 1,
|
|
4064
|
+
"maxItems": 1,
|
|
4065
|
+
"uniqueItems": true,
|
|
4066
|
+
"items": { "$ref": "#/$defs/WidgetDevelopmentExtension" }
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
},
|
|
4070
|
+
"WidgetRenderResult": {
|
|
4071
|
+
"title": "WidgetRenderResult",
|
|
4072
|
+
"description": "仅表示受管渲染处理器的处理结果,不代表视觉或业务验收。",
|
|
4073
|
+
"oneOf": [{
|
|
3248
4074
|
"type": "object",
|
|
4075
|
+
"additionalProperties": false,
|
|
3249
4076
|
"required": [
|
|
3250
|
-
"
|
|
3251
|
-
"
|
|
3252
|
-
"
|
|
4077
|
+
"requestId",
|
|
4078
|
+
"revision",
|
|
4079
|
+
"outcome"
|
|
3253
4080
|
],
|
|
3254
4081
|
"properties": {
|
|
3255
|
-
"
|
|
3256
|
-
"
|
|
3257
|
-
|
|
4082
|
+
"requestId": { "$ref": "#/$defs/RenderRequestBase/properties/requestId" },
|
|
4083
|
+
"revision": {
|
|
4084
|
+
"type": "integer",
|
|
4085
|
+
"minimum": 1
|
|
4086
|
+
},
|
|
4087
|
+
"outcome": { "enum": ["handled", "superseded"] }
|
|
3258
4088
|
}
|
|
3259
|
-
}
|
|
3260
|
-
"unevaluatedProperties": false
|
|
3261
|
-
},
|
|
3262
|
-
"UserInputRequestedPublicWidgetEvent": {
|
|
3263
|
-
"title": "UserInputRequestedPublicWidgetEvent",
|
|
3264
|
-
"description": "user-input-requested 事件。",
|
|
3265
|
-
"type": "object",
|
|
3266
|
-
"allOf": [{ "$ref": "#/$defs/PublicWidgetEventBase" }, {
|
|
4089
|
+
}, {
|
|
3267
4090
|
"type": "object",
|
|
4091
|
+
"additionalProperties": false,
|
|
3268
4092
|
"required": [
|
|
3269
|
-
"
|
|
3270
|
-
"
|
|
3271
|
-
"
|
|
4093
|
+
"requestId",
|
|
4094
|
+
"revision",
|
|
4095
|
+
"outcome",
|
|
4096
|
+
"diagnostic"
|
|
3272
4097
|
],
|
|
3273
4098
|
"properties": {
|
|
3274
|
-
"
|
|
3275
|
-
"
|
|
3276
|
-
|
|
4099
|
+
"requestId": { "$ref": "#/$defs/RenderRequestBase/properties/requestId" },
|
|
4100
|
+
"revision": {
|
|
4101
|
+
"type": "integer",
|
|
4102
|
+
"minimum": 1
|
|
4103
|
+
},
|
|
4104
|
+
"outcome": { "const": "failed" },
|
|
4105
|
+
"diagnostic": { "$ref": "#/$defs/WidgetRenderFailureDiagnostic" }
|
|
3277
4106
|
}
|
|
3278
|
-
}]
|
|
3279
|
-
"unevaluatedProperties": false
|
|
4107
|
+
}]
|
|
3280
4108
|
},
|
|
3281
|
-
"
|
|
3282
|
-
"title": "
|
|
3283
|
-
"description": "
|
|
4109
|
+
"WidgetDiagnosticMessage": {
|
|
4110
|
+
"title": "WidgetDiagnosticMessage",
|
|
4111
|
+
"description": "经协商的开发扩展 Bridge 消息;仍受现有通道与消息预算约束。",
|
|
3284
4112
|
"type": "object",
|
|
3285
|
-
"allOf": [{ "$ref": "#/$defs/
|
|
4113
|
+
"allOf": [{ "$ref": "#/$defs/BridgeEnvelopeBase" }, {
|
|
3286
4114
|
"type": "object",
|
|
3287
|
-
"required": [
|
|
3288
|
-
"topic",
|
|
3289
|
-
"type",
|
|
3290
|
-
"payload"
|
|
3291
|
-
],
|
|
4115
|
+
"required": ["type", "payload"],
|
|
3292
4116
|
"properties": {
|
|
3293
|
-
"
|
|
3294
|
-
"
|
|
3295
|
-
"payload": { "$ref": "#/$defs/ComputeReviewRequestedPublicWidgetEventPayload" }
|
|
4117
|
+
"type": { "const": "diagnostic" },
|
|
4118
|
+
"payload": { "$ref": "#/$defs/WidgetGuestDiagnostic" }
|
|
3296
4119
|
}
|
|
3297
4120
|
}],
|
|
3298
4121
|
"unevaluatedProperties": false
|
|
3299
4122
|
},
|
|
3300
|
-
"
|
|
3301
|
-
"title": "
|
|
3302
|
-
"description": "
|
|
4123
|
+
"WidgetRenderResultMessage": {
|
|
4124
|
+
"title": "WidgetRenderResultMessage",
|
|
4125
|
+
"description": "经协商的开发扩展 Bridge 消息;仍受现有通道与消息预算约束。",
|
|
3303
4126
|
"type": "object",
|
|
3304
4127
|
"allOf": [{ "$ref": "#/$defs/BridgeEnvelopeBase" }, {
|
|
3305
4128
|
"type": "object",
|
|
3306
4129
|
"required": ["type", "payload"],
|
|
3307
4130
|
"properties": {
|
|
3308
|
-
"type": { "const": "
|
|
3309
|
-
"payload": { "$ref": "#/$defs/
|
|
4131
|
+
"type": { "const": "render-result" },
|
|
4132
|
+
"payload": { "$ref": "#/$defs/WidgetRenderResult" }
|
|
3310
4133
|
}
|
|
3311
4134
|
}],
|
|
3312
4135
|
"unevaluatedProperties": false
|
|
3313
4136
|
},
|
|
3314
|
-
"
|
|
3315
|
-
"
|
|
3316
|
-
"
|
|
3317
|
-
"
|
|
3318
|
-
|
|
3319
|
-
"
|
|
3320
|
-
"
|
|
3321
|
-
|
|
3322
|
-
],
|
|
3323
|
-
"properties": {
|
|
3324
|
-
"id": {
|
|
3325
|
-
"type": "string",
|
|
3326
|
-
"minLength": 1,
|
|
3327
|
-
"maxLength": 256
|
|
3328
|
-
},
|
|
3329
|
-
"type": {
|
|
3330
|
-
"type": "string",
|
|
3331
|
-
"minLength": 1,
|
|
3332
|
-
"maxLength": 128,
|
|
3333
|
-
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
|
|
3334
|
-
},
|
|
3335
|
-
"payload": { "$ref": "#/$defs/JsonValue" }
|
|
3336
|
-
}
|
|
4137
|
+
"WidgetDevelopmentMessage": {
|
|
4138
|
+
"title": "WidgetDevelopmentMessage",
|
|
4139
|
+
"description": "扩展 profile 下的 Widget → Host 消息;原 WidgetToHostMessage 不扩展。",
|
|
4140
|
+
"oneOf": [
|
|
4141
|
+
{ "$ref": "#/$defs/WidgetToHostMessage" },
|
|
4142
|
+
{ "$ref": "#/$defs/WidgetDiagnosticMessage" },
|
|
4143
|
+
{ "$ref": "#/$defs/WidgetRenderResultMessage" }
|
|
4144
|
+
]
|
|
3337
4145
|
},
|
|
3338
|
-
"
|
|
3339
|
-
"
|
|
4146
|
+
"WidgetRecoveryContext": {
|
|
4147
|
+
"title": "WidgetRecoveryContext",
|
|
4148
|
+
"description": "复用工具执行结果语义的可信恢复上下文;缺失字段表示未知,不能授权重放。",
|
|
3340
4149
|
"type": "object",
|
|
3341
4150
|
"additionalProperties": false,
|
|
3342
|
-
"required": [
|
|
3343
|
-
"schemaVersion",
|
|
3344
|
-
"topic",
|
|
3345
|
-
"cursor",
|
|
3346
|
-
"reset",
|
|
3347
|
-
"hasMore",
|
|
3348
|
-
"events"
|
|
3349
|
-
],
|
|
3350
4151
|
"properties": {
|
|
3351
|
-
"
|
|
3352
|
-
"
|
|
3353
|
-
"
|
|
3354
|
-
"
|
|
3355
|
-
"
|
|
3356
|
-
"
|
|
3357
|
-
},
|
|
3358
|
-
"
|
|
3359
|
-
"type": "string",
|
|
3360
|
-
"minLength": 1,
|
|
3361
|
-
"maxLength": 256
|
|
3362
|
-
},
|
|
3363
|
-
"reset": { "type": "boolean" },
|
|
3364
|
-
"hasMore": { "type": "boolean" },
|
|
3365
|
-
"events": {
|
|
3366
|
-
"type": "array",
|
|
3367
|
-
"maxItems": 100,
|
|
3368
|
-
"items": { "$ref": "#/$defs/WidgetEvent" }
|
|
3369
|
-
},
|
|
3370
|
-
"snapshot": { "$ref": "#/$defs/JsonValue" }
|
|
4152
|
+
"progress": { "$ref": "#/$defs/WidgetRecoveryProgress" },
|
|
4153
|
+
"executionState": { "enum": [
|
|
4154
|
+
"not_started",
|
|
4155
|
+
"finished",
|
|
4156
|
+
"partial",
|
|
4157
|
+
"unknown"
|
|
4158
|
+
] },
|
|
4159
|
+
"mayHaveExecuted": { "type": "boolean" }
|
|
3371
4160
|
}
|
|
3372
4161
|
},
|
|
3373
|
-
"
|
|
3374
|
-
"
|
|
4162
|
+
"WidgetGuestDiagnostic": {
|
|
4163
|
+
"title": "WidgetGuestDiagnostic",
|
|
4164
|
+
"description": "Guest 仅声明 SDK 诊断事实,不得冒充 Host 或工具链。",
|
|
4165
|
+
"allOf": [{ "$ref": "#/$defs/WidgetDevelopmentDiagnostic" }, {
|
|
4166
|
+
"type": "object",
|
|
4167
|
+
"required": ["source"],
|
|
4168
|
+
"properties": { "source": { "const": "sdk" } }
|
|
4169
|
+
}]
|
|
4170
|
+
},
|
|
4171
|
+
"WidgetRenderFailureDiagnostic": {
|
|
4172
|
+
"title": "WidgetRenderFailureDiagnostic",
|
|
4173
|
+
"description": "失败处理回执的 SDK 请求诊断;接收方还须匹配当前 requestId。",
|
|
4174
|
+
"allOf": [{ "$ref": "#/$defs/WidgetGuestDiagnostic" }, {
|
|
4175
|
+
"type": "object",
|
|
4176
|
+
"required": ["correlationId"],
|
|
4177
|
+
"properties": {
|
|
4178
|
+
"correlationId": { "$ref": "#/$defs/WidgetDevelopmentDiagnostic/properties/correlationId" },
|
|
4179
|
+
"phase": { "enum": ["render", "update"] }
|
|
4180
|
+
}
|
|
4181
|
+
}]
|
|
4182
|
+
},
|
|
4183
|
+
"WidgetRecoveryProgress": {
|
|
4184
|
+
"title": "WidgetRecoveryProgress",
|
|
4185
|
+
"description": "可信宿主观察到的恢复进展;重复故障无新证据时不能重复同一修复。",
|
|
3375
4186
|
"type": "object",
|
|
3376
4187
|
"additionalProperties": false,
|
|
3377
|
-
"required": [
|
|
3378
|
-
"toolCallId",
|
|
3379
|
-
"toolName",
|
|
3380
|
-
"phase"
|
|
3381
|
-
],
|
|
4188
|
+
"required": ["repeated", "hasNewEvidence"],
|
|
3382
4189
|
"properties": {
|
|
3383
|
-
"
|
|
3384
|
-
|
|
3385
|
-
"minLength": 1,
|
|
3386
|
-
"maxLength": 256
|
|
3387
|
-
},
|
|
3388
|
-
"toolName": {
|
|
3389
|
-
"type": "string",
|
|
3390
|
-
"minLength": 1,
|
|
3391
|
-
"maxLength": 128,
|
|
3392
|
-
"pattern": "^[A-Za-z0-9_.:-]+$"
|
|
3393
|
-
},
|
|
3394
|
-
"phase": { "enum": [
|
|
3395
|
-
"started",
|
|
3396
|
-
"completed",
|
|
3397
|
-
"failed",
|
|
3398
|
-
"cancelled"
|
|
3399
|
-
] }
|
|
4190
|
+
"repeated": { "type": "boolean" },
|
|
4191
|
+
"hasNewEvidence": { "type": "boolean" }
|
|
3400
4192
|
}
|
|
3401
4193
|
}
|
|
3402
4194
|
}
|
|
@@ -10053,7 +10845,6 @@ const widgetManifestSchema = {
|
|
|
10053
10845
|
"properties": {
|
|
10054
10846
|
"files": { "$ref": "#/$defs/FilesCapabilityRequest" },
|
|
10055
10847
|
"events": { "$ref": "#/$defs/EventsCapabilityRequest" },
|
|
10056
|
-
"tasks": { "$ref": "#/$defs/TasksCapabilityRequest" },
|
|
10057
10848
|
"state": { "$ref": "#/$defs/StateCapabilityRequest" },
|
|
10058
10849
|
"actions": { "$ref": "#/$defs/ActionsCapabilityRequest" },
|
|
10059
10850
|
"network": { "$ref": "#/$defs/NetworkCapabilityRequest" },
|
|
@@ -10093,17 +10884,6 @@ const widgetManifestSchema = {
|
|
|
10093
10884
|
}
|
|
10094
10885
|
} }
|
|
10095
10886
|
},
|
|
10096
|
-
"TasksCapabilityRequest": {
|
|
10097
|
-
"description": "任务发现与观察能力的申请;list / watch 至少显式申请一项,已申请项固定为 true。",
|
|
10098
|
-
"title": "TasksCapabilityRequest",
|
|
10099
|
-
"type": "object",
|
|
10100
|
-
"additionalProperties": false,
|
|
10101
|
-
"minProperties": 1,
|
|
10102
|
-
"properties": {
|
|
10103
|
-
"list": { "const": true },
|
|
10104
|
-
"watch": { "const": true }
|
|
10105
|
-
}
|
|
10106
|
-
},
|
|
10107
10887
|
"StateCapabilityRequest": {
|
|
10108
10888
|
"description": "受限 UI 状态读写能力的申请;read / write 分别声明。",
|
|
10109
10889
|
"title": "StateCapabilityRequest",
|
|
@@ -10800,6 +11580,11 @@ compileDefinition("WidgetToHostMessage");
|
|
|
10800
11580
|
compileDefinition("CapabilityRequest");
|
|
10801
11581
|
const capabilityResultValidator = compileDefinition("CapabilityResult");
|
|
10802
11582
|
compileDefinition("WidgetError");
|
|
11583
|
+
const developmentDiagnosticValidator = compileDefinition("WidgetDevelopmentDiagnostic");
|
|
11584
|
+
compileDefinition("WidgetDevelopmentOffer");
|
|
11585
|
+
compileDefinition("WidgetDevelopmentConnect");
|
|
11586
|
+
compileDefinition("WidgetDevelopmentMessage");
|
|
11587
|
+
compileDefinition("WidgetRecoveryPlan");
|
|
10803
11588
|
compileDefinition("ResourceBudget");
|
|
10804
11589
|
compileDefinition("GrantedCapability");
|
|
10805
11590
|
compileDefinition("PublicWidgetEvent");
|
|
@@ -10827,10 +11612,17 @@ function validateRenderRequest(value) {
|
|
|
10827
11612
|
function validateCapabilityResult(value) {
|
|
10828
11613
|
return validateContract(capabilityResultValidator, value);
|
|
10829
11614
|
}
|
|
11615
|
+
/** 内部/Host 工具按源头 Schema 校验开发合同,不增加浏览器校验器入口。 */
|
|
11616
|
+
function validateWidgetDevelopmentDiagnostic(value) {
|
|
11617
|
+
return validateContract(developmentDiagnosticValidator, value);
|
|
11618
|
+
}
|
|
10830
11619
|
//#endregion
|
|
10831
11620
|
//#region src/project/validate.mjs
|
|
10832
11621
|
function loadContractValidators() {
|
|
10833
11622
|
return Promise.resolve({
|
|
11623
|
+
validateWidgetDevelopmentDiagnostic,
|
|
11624
|
+
createWidgetRecoveryPlan,
|
|
11625
|
+
isWidgetRenderResult,
|
|
10834
11626
|
validateWidgetManifest(value) {
|
|
10835
11627
|
return validateWidgetManifest(value);
|
|
10836
11628
|
},
|
|
@@ -11690,4 +12482,4 @@ async function scaffoldDshWidget(input, output, options) {
|
|
|
11690
12482
|
};
|
|
11691
12483
|
}
|
|
11692
12484
|
//#endregion
|
|
11693
|
-
export { normalizeArchivePath as a,
|
|
12485
|
+
export { normalizeArchivePath as a, loadContractValidators as c, prepareWidgetPackage as i, compileAuthorManifest as l, scaffoldDshWidget as n, checkWidgetProject as o, buildWidgetPackage as r, resolveWidgetProjects as s, auditDshPlugin as t };
|