@dp-bohrium/widget-cli 0.6.0 → 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 CHANGED
@@ -102,19 +102,6 @@ bohr-widget help [<命令路径>]
102
102
 
103
103
  完整步骤见[交付验收指南](https://dev.dp.tech/bohrium-widget-sdk/guides/delivery-checklist)。
104
104
 
105
- ## Panel 发现与观察计算任务(SDK 0.5.0)
106
-
107
- 需要在 Panel 可见期间发现当前会话的计算任务时,在作者 Manifest 声明
108
- `capabilities.tasks: { list: true }`;还要读取单个任务的后续快照时,同时声明
109
- `watch: true`。只需观察已知任务引用的旧 Panel 可继续单独声明 `{ watch: true }`。
110
-
111
- - `context.tasks.list({ cursor, limit })` 只返回 Host 授权、裁剪后的任务摘要;分页继续使用返回的
112
- `nextCursor`,不要解析或自行构造 cursor。
113
- - 首次读取与后续刷新须遵守 grant 的 `minPollMs`、`pageSize` 和 `callsPerMinute`;面板不可见或停用后停止轮询。
114
- - 列表项的 `taskId` 可传给 `context.tasks.watch`。`list` / `watch` 分别需要真实 grant,Manifest 声明、
115
- sample 或 CLI 校验通过都不代表目标 Host 已授权。
116
- - 这两个能力只用于发现和观察,不提供任务创建、调度或取消;任务提交仍由 Agent 与平台工具负责。
117
-
118
105
  ## file-preview 当前文件读写(SDK 0.5.0)
119
106
 
120
107
  按原来的 `create --template file-preview --ui vanilla|react` 创建工程。用户需要编辑文件时,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # `@dp-bohrium/widget-cli` 变更记录
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 75ef4f2: **破坏性变更**:移除 `tasks.list`、`tasks.watch` 及对应的 Manifest 申请、grant、协议类型、Schema、语料和 `context.tasks` 高层 API。依赖计算任务信息的 Widget 应改为消费 Host 主动下发的计算事件,并通过通用 `network.fetch` 查询目标平台。
8
+
3
9
  ## 0.6.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -41,11 +41,6 @@ npm run widget:pack -- --out artifacts/my-widget.zip
41
41
  `widget:pack` 生成 Widget ZIP;`pnpm pack` 是制作 npm `.tgz` 的内置命令。
42
42
  `check` 检查声明和样例,不执行界面;实际运行验收见[交付指南](https://dev.dp.tech/bohrium-widget-sdk/guides/delivery-checklist)。
43
43
 
44
- 需要列出当前会话计算任务的 Panel,在作者 Manifest 声明
45
- `capabilities.tasks: { list: true }`;还要持续观察单个任务时可同时声明
46
- `{ list: true, watch: true }`。Widget 只能在 Host 签发对应 grant 后调用能力,列表刷新频率须遵守
47
- `tasks.list` grant 的 `minPollMs`。
48
-
49
44
  ## 准备迁移候选
50
45
 
51
46
  保留已有源码、升级 SDK 或跨 profile 时,先读[准备迁移候选](https://dev.dp.tech/bohrium-widget-sdk/guides/migration),按指南准备并审阅独立候选,再安排后续验收。
@@ -65,7 +65,6 @@
65
65
  "properties": {
66
66
  "files": { "$ref": "#/$defs/FilesCapabilityRequest" },
67
67
  "events": { "$ref": "#/$defs/EventsCapabilityRequest" },
68
- "tasks": { "$ref": "#/$defs/TasksCapabilityRequest" },
69
68
  "state": { "$ref": "#/$defs/StateCapabilityRequest" },
70
69
  "actions": { "$ref": "#/$defs/ActionsCapabilityRequest" },
71
70
  "network": { "$ref": "#/$defs/NetworkCapabilityRequest" },
@@ -111,17 +110,6 @@
111
110
  }
112
111
  }
113
112
  },
114
- "TasksCapabilityRequest": {
115
- "description": "任务发现与观察能力的申请;list / watch 至少显式申请一项,已申请项固定为 true。",
116
- "title": "TasksCapabilityRequest",
117
- "type": "object",
118
- "additionalProperties": false,
119
- "minProperties": 1,
120
- "properties": {
121
- "list": { "const": true },
122
- "watch": { "const": true }
123
- }
124
- },
125
113
  "StateCapabilityRequest": {
126
114
  "description": "受限 UI 状态读写能力的申请;read / write 分别声明。",
127
115
  "title": "StateCapabilityRequest",
@@ -72,24 +72,6 @@
72
72
  },
73
73
  "fileReadResult": { "$ref": "#/$defs/FileReadResult" },
74
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
75
  "toolResultEnvelope": {
94
76
  "$ref": "#/$defs/ToolResultEnvelope"
95
77
  },
@@ -424,190 +406,6 @@
424
406
  }
425
407
  }
426
408
  },
427
- "TaskStatus": {
428
- "description": "Host 投影给 Widget 的统一任务状态。",
429
- "title": "TaskStatus",
430
- "enum": ["queued", "running", "succeeded", "failed", "cancelled", "expired"]
431
- },
432
- "TaskObservationSnapshot": {
433
- "description": "任务观察的当前快照:taskId、status 与 updatedAt;progress、message 可选。",
434
- "title": "TaskObservationSnapshot",
435
- "type": "object",
436
- "additionalProperties": false,
437
- "required": ["taskId", "status", "updatedAt"],
438
- "properties": {
439
- "taskId": {
440
- "type": "string",
441
- "minLength": 1,
442
- "maxLength": 256
443
- },
444
- "status": { "$ref": "#/$defs/TaskStatus" },
445
- "progress": {
446
- "type": "number",
447
- "minimum": 0,
448
- "maximum": 1
449
- },
450
- "message": {
451
- "type": "string",
452
- "maxLength": 1024
453
- },
454
- "updatedAt": {
455
- "type": "string",
456
- "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
457
- }
458
- }
459
- },
460
- "TaskObservationEvent": {
461
- "description": "任务观察流中的单条事件;payload 由服务端裁剪。",
462
- "title": "TaskObservationEvent",
463
- "type": "object",
464
- "additionalProperties": false,
465
- "required": ["id", "type", "occurredAt", "payload"],
466
- "properties": {
467
- "id": {
468
- "type": "string",
469
- "minLength": 1,
470
- "maxLength": 256
471
- },
472
- "type": {
473
- "enum": ["started", "progress", "succeeded", "failed", "cancelled", "expired"]
474
- },
475
- "occurredAt": {
476
- "type": "string",
477
- "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
478
- },
479
- "payload": {
480
- "$ref": "#/$defs/JsonValue"
481
- }
482
- }
483
- },
484
- "TaskObservationBatch": {
485
- "description": "任务观察的一页结果:快照 + 有限事件页 + 游标。",
486
- "title": "TaskObservationBatch",
487
- "type": "object",
488
- "additionalProperties": false,
489
- "required": ["schemaVersion", "taskId", "cursor", "reset", "hasMore", "snapshot", "events"],
490
- "properties": {
491
- "schemaVersion": { "const": 1 },
492
- "taskId": {
493
- "type": "string",
494
- "minLength": 1,
495
- "maxLength": 256
496
- },
497
- "cursor": {
498
- "type": "string",
499
- "minLength": 1,
500
- "maxLength": 256
501
- },
502
- "reset": { "type": "boolean" },
503
- "hasMore": { "type": "boolean" },
504
- "snapshot": { "$ref": "#/$defs/TaskObservationSnapshot" },
505
- "events": {
506
- "type": "array",
507
- "maxItems": 100,
508
- "items": { "$ref": "#/$defs/TaskObservationEvent" }
509
- }
510
- }
511
- },
512
- "TaskListField": {
513
- "description": "任务列表中的受限展示字段;key 是稳定机器键,value 是 Host 裁剪后的展示文本。",
514
- "title": "TaskListField",
515
- "type": "object",
516
- "additionalProperties": false,
517
- "required": ["key", "value"],
518
- "properties": {
519
- "key": {
520
- "description": "展示字段的稳定机器键,例如 machine 或 command。",
521
- "type": "string",
522
- "minLength": 1,
523
- "maxLength": 64,
524
- "pattern": "^[A-Za-z][A-Za-z0-9_.:-]*$"
525
- },
526
- "value": {
527
- "description": "Host 完成授权与裁剪后的展示文本。",
528
- "type": "string",
529
- "maxLength": 16384
530
- }
531
- }
532
- },
533
- "TaskListItem": {
534
- "description": "Host 已授权发现的任务摘要;taskId 是可继续传给 tasks.watch 的不透明引用。",
535
- "title": "TaskListItem",
536
- "type": "object",
537
- "additionalProperties": false,
538
- "required": ["taskId", "kind", "name", "status", "updatedAt", "fields"],
539
- "properties": {
540
- "taskId": {
541
- "description": "可继续传给 tasks.watch 的 Host 不透明任务引用。",
542
- "type": "string",
543
- "minLength": 1,
544
- "maxLength": 256
545
- },
546
- "kind": {
547
- "description": "任务来源类型的稳定机器键。",
548
- "type": "string",
549
- "minLength": 1,
550
- "maxLength": 64,
551
- "pattern": "^[A-Za-z][A-Za-z0-9_.:-]*$"
552
- },
553
- "name": {
554
- "description": "任务的安全展示名称。",
555
- "type": "string",
556
- "minLength": 1,
557
- "maxLength": 256
558
- },
559
- "status": {
560
- "$ref": "#/$defs/TaskStatus"
561
- },
562
- "progress": {
563
- "description": "可选执行进度,取值范围为 0 到 1。",
564
- "type": "number",
565
- "minimum": 0,
566
- "maximum": 1
567
- },
568
- "message": {
569
- "description": "Host 裁剪后的可选状态说明。",
570
- "type": "string",
571
- "maxLength": 1024
572
- },
573
- "updatedAt": {
574
- "description": "任务摘要最后更新时间,使用 UTC ISO 8601 字符串。",
575
- "type": "string",
576
- "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
577
- },
578
- "fields": {
579
- "description": "任务面板可展示的受限附加字段。",
580
- "type": "array",
581
- "maxItems": 32,
582
- "items": { "$ref": "#/$defs/TaskListField" }
583
- }
584
- }
585
- },
586
- "TaskListPage": {
587
- "description": "Host 已授权任务摘要的一页结果;nextCursor 缺失表示当前页已到末尾。",
588
- "title": "TaskListPage",
589
- "type": "object",
590
- "additionalProperties": false,
591
- "required": ["schemaVersion", "tasks"],
592
- "properties": {
593
- "schemaVersion": {
594
- "description": "任务列表页结构版本,当前固定为 1。",
595
- "const": 1
596
- },
597
- "tasks": {
598
- "description": "当前页中 Host 已授权的任务摘要。",
599
- "type": "array",
600
- "maxItems": 100,
601
- "items": { "$ref": "#/$defs/TaskListItem" }
602
- },
603
- "nextCursor": {
604
- "description": "下一页的不透明游标;缺失表示当前列表已到末尾。",
605
- "type": "string",
606
- "minLength": 1,
607
- "maxLength": 512
608
- }
609
- }
610
- },
611
409
  "ToolResultMetric": {
612
410
  "description": "工具结果中的单个指标。",
613
411
  "title": "ToolResultMetric",
@@ -930,42 +728,6 @@
930
728
  }
931
729
  }
932
730
  },
933
- {
934
- "type": "object",
935
- "additionalProperties": false,
936
- "required": ["name", "limits"],
937
- "properties": {
938
- "name": { "const": "tasks.list" },
939
- "limits": {
940
- "type": "object",
941
- "additionalProperties": false,
942
- "required": ["callsPerMinute", "pageSize", "minPollMs"],
943
- "properties": {
944
- "callsPerMinute": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
945
- "pageSize": { "type": "integer", "minimum": 1, "maximum": 100 },
946
- "minPollMs": { "type": "integer", "minimum": 1000, "maximum": 60000 }
947
- }
948
- }
949
- }
950
- },
951
- {
952
- "type": "object",
953
- "additionalProperties": false,
954
- "required": ["name", "limits"],
955
- "properties": {
956
- "name": { "const": "tasks.watch" },
957
- "limits": {
958
- "type": "object",
959
- "additionalProperties": false,
960
- "required": ["callsPerMinute", "pageSize", "minPollMs"],
961
- "properties": {
962
- "callsPerMinute": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
963
- "pageSize": { "type": "integer", "minimum": 1, "maximum": 100 },
964
- "minPollMs": { "type": "integer", "minimum": 1000, "maximum": 60000 }
965
- }
966
- }
967
- }
968
- },
969
731
  {
970
732
  "type": "object",
971
733
  "additionalProperties": false,
@@ -1384,40 +1146,6 @@
1384
1146
  }
1385
1147
  }
1386
1148
  },
1387
- {
1388
- "type": "object",
1389
- "additionalProperties": false,
1390
- "required": ["operation", "input"],
1391
- "properties": {
1392
- "operation": { "const": "tasks.list" },
1393
- "input": {
1394
- "type": "object",
1395
- "additionalProperties": false,
1396
- "properties": {
1397
- "cursor": { "type": "string", "minLength": 1, "maxLength": 512 },
1398
- "limit": { "type": "integer", "minimum": 1, "maximum": 100 }
1399
- }
1400
- }
1401
- }
1402
- },
1403
- {
1404
- "type": "object",
1405
- "additionalProperties": false,
1406
- "required": ["operation", "input"],
1407
- "properties": {
1408
- "operation": { "const": "tasks.watch" },
1409
- "input": {
1410
- "type": "object",
1411
- "additionalProperties": false,
1412
- "required": ["taskId"],
1413
- "properties": {
1414
- "taskId": { "type": "string", "minLength": 1, "maxLength": 256 },
1415
- "cursor": { "type": "string", "minLength": 1, "maxLength": 256 },
1416
- "limit": { "type": "integer", "minimum": 1, "maximum": 100 }
1417
- }
1418
- }
1419
- }
1420
- },
1421
1149
  {
1422
1150
  "type": "object",
1423
1151
  "additionalProperties": false,
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "formatVersion": 3,
3
3
  "packageName": "@dp-bohrium/widget-cli",
4
- "cli": "0.6.0",
4
+ "cli": "0.7.0",
5
5
  "profile": {
6
- "id": "widget-sdk-0.9.0",
7
- "sdk": "0.9.0"
6
+ "id": "widget-sdk-0.10.0",
7
+ "sdk": "0.10.0"
8
8
  },
9
9
  "protocol": {
10
10
  "schemaVersion": 1,
11
11
  "hostApiVersion": 1,
12
- "digest": "sha256:a4d13070cc867aa5ddb838201ed47eee8871c32d48fd1485ce6c531b7ebad2b9"
12
+ "digest": "sha256:00ae6aba78a5103a2e5318ecafd769a03d02048168cd73e4bea3d87e0f80366d"
13
13
  },
14
14
  "hostAcceptance": "unknown",
15
15
  "documentation": {
@@ -20,9 +20,9 @@
20
20
  "llms": "https://dev.dp.tech/bohrium-widget-sdk/llms.txt"
21
21
  },
22
22
  "digests": {
23
- "compiler": "sha256:a45a53ac079b9249e629ecdcfc78510aca276e8c3db786bd66daded8e75d08e3",
24
- "validators": "sha256:27340218c481b2b3b3964b598533f07d4cec820de148ef7ad9d00adc2e8162f9",
25
- "schemas": "sha256:a4d13070cc867aa5ddb838201ed47eee8871c32d48fd1485ce6c531b7ebad2b9",
23
+ "compiler": "sha256:b8ca913544930c6431fcccd04180fd7cf413366f719a89fdf973eb00bfe1495a",
24
+ "validators": "sha256:3229f4c649cd0ef27e0886a8037dc9f9ebf4e4e391c9c010738a915bf2704cec",
25
+ "schemas": "sha256:00ae6aba78a5103a2e5318ecafd769a03d02048168cd73e4bea3d87e0f80366d",
26
26
  "templates": "sha256:85be81d7ede0a1631c08a464ce7857ffcce71691bb8d75717d97513c6496a8e5"
27
27
  }
28
28
  }
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as normalizeArchivePath, c as loadContractValidators, i as prepareWidgetPackage, l as compileAuthorManifest, n as scaffoldDshWidget, o as checkWidgetProject, s as resolveWidgetProjects, t as auditDshPlugin } from "./dsh-BL6cMLrg.mjs";
2
+ import { a as normalizeArchivePath, c as loadContractValidators, i as prepareWidgetPackage, l as compileAuthorManifest, n as scaffoldDshWidget, o as checkWidgetProject, s as resolveWidgetProjects, t as auditDshPlugin } from "./dsh-BJWUB8Nq.mjs";
3
3
  import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
4
4
  import { constants, existsSync, fstatSync, lstatSync, readFileSync, readdirSync, realpathSync, statSync, watch } from "node:fs";
5
5
  import { chmod, lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
package/dist/core.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as RenderRequest } from "./generated-runtime-contracts-CbZY-iss.mjs";
1
+ import { t as RenderRequest } from "./generated-runtime-contracts-qdyub_ED.mjs";
2
2
  import { Buffer } from "node:buffer";
3
3
  //#region ../widget-sdk/src/protocol/generated-manifest.d.ts
4
4
  /** GENERATED FILE. Do not edit directly. */
@@ -105,7 +105,6 @@ interface PanelContributionConfig {
105
105
  interface RequestedCapabilities$1 {
106
106
  files?: FilesCapabilityRequest$1;
107
107
  events?: EventsCapabilityRequest$1;
108
- tasks?: TasksCapabilityRequest$1;
109
108
  state?: StateCapabilityRequest$1;
110
109
  actions?: ActionsCapabilityRequest$1;
111
110
  network?: NetworkCapabilityRequest$1;
@@ -132,13 +131,6 @@ interface EventsCapabilityRequest$1 {
132
131
  */
133
132
  topics: [string, ...(string)[]];
134
133
  }
135
- /**
136
- * 任务发现与观察能力的申请;list / watch 至少显式申请一项,已申请项固定为 true。
137
- */
138
- interface TasksCapabilityRequest$1 {
139
- list?: true;
140
- watch?: true;
141
- }
142
134
  /**
143
135
  * 受限 UI 状态读写能力的申请;read / write 分别声明。
144
136
  */
@@ -280,7 +272,6 @@ interface WidgetFilePreviewContribution {
280
272
  interface RequestedCapabilities {
281
273
  files?: FilesCapabilityRequest;
282
274
  events?: EventsCapabilityRequest;
283
- tasks?: TasksCapabilityRequest;
284
275
  state?: StateCapabilityRequest;
285
276
  actions?: ActionsCapabilityRequest;
286
277
  network?: NetworkCapabilityRequest;
@@ -307,13 +298,6 @@ interface EventsCapabilityRequest {
307
298
  */
308
299
  topics: [string, ...(string)[]];
309
300
  }
310
- /**
311
- * 任务发现与观察能力的申请;list / watch 至少显式申请一项,已申请项固定为 true。
312
- */
313
- interface TasksCapabilityRequest {
314
- list?: true;
315
- watch?: true;
316
- }
317
301
  /**
318
302
  * 受限 UI 状态读写能力的申请;read / write 分别声明。
319
303
  */
package/dist/core.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { l as compileAuthorManifest, n as scaffoldDshWidget, o as checkWidgetProject, r as buildWidgetPackage, s as resolveWidgetProjects, t as auditDshPlugin } from "./dsh-BL6cMLrg.mjs";
1
+ import { l as compileAuthorManifest, n as scaffoldDshWidget, o as checkWidgetProject, r as buildWidgetPackage, s as resolveWidgetProjects, t as auditDshPlugin } from "./dsh-BJWUB8Nq.mjs";
2
2
  //#region src/core.mjs
3
3
  /** Validate a community template before registering it in a custom CLI. */
4
4
  function defineWidgetTemplate(template) {
@@ -1,4 +1,4 @@
1
- import { i as WidgetRenderResult, n as WidgetDevelopmentDiagnostic, r as WidgetRecoveryPlan } from "./generated-runtime-contracts-CbZY-iss.mjs";
1
+ import { i as WidgetRenderResult, n as WidgetDevelopmentDiagnostic, r as WidgetRecoveryPlan } from "./generated-runtime-contracts-qdyub_ED.mjs";
2
2
  //#region src/development-host.d.mts
3
3
  interface WidgetDevelopmentEndpointSetV1 {
4
4
  readonly claim: string;
@@ -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.9.0";
8
+ const WIDGET_SDK_VERSION = "0.10.0";
9
9
  function compiledContribution(contribution) {
10
10
  switch (contribution.type) {
11
11
  case "panel": return {
@@ -687,12 +687,6 @@ const widgetRuntimeContractsSchema = {
687
687
  "fileDownloadResult": { "$ref": "#/$defs/FileDownloadResult" },
688
688
  "fileReadResult": { "$ref": "#/$defs/FileReadResult" },
689
689
  "fileWriteResult": { "$ref": "#/$defs/FileWriteResult" },
690
- "taskObservationSnapshot": { "$ref": "#/$defs/TaskObservationSnapshot" },
691
- "taskObservationEvent": { "$ref": "#/$defs/TaskObservationEvent" },
692
- "taskObservationBatch": { "$ref": "#/$defs/TaskObservationBatch" },
693
- "taskListField": { "$ref": "#/$defs/TaskListField" },
694
- "taskListItem": { "$ref": "#/$defs/TaskListItem" },
695
- "taskListPage": { "$ref": "#/$defs/TaskListPage" },
696
690
  "toolResultEnvelope": { "$ref": "#/$defs/ToolResultEnvelope" },
697
691
  "uiStateResult": { "$ref": "#/$defs/UiStateResult" },
698
692
  "uiStateWriteResult": { "$ref": "#/$defs/UiStateWriteResult" },
@@ -1091,222 +1085,6 @@ const widgetRuntimeContractsSchema = {
1091
1085
  "cancelled"
1092
1086
  ] } }
1093
1087
  },
1094
- "TaskStatus": {
1095
- "description": "Host 投影给 Widget 的统一任务状态。",
1096
- "title": "TaskStatus",
1097
- "enum": [
1098
- "queued",
1099
- "running",
1100
- "succeeded",
1101
- "failed",
1102
- "cancelled",
1103
- "expired"
1104
- ]
1105
- },
1106
- "TaskObservationSnapshot": {
1107
- "description": "任务观察的当前快照:taskId、status 与 updatedAt;progress、message 可选。",
1108
- "title": "TaskObservationSnapshot",
1109
- "type": "object",
1110
- "additionalProperties": false,
1111
- "required": [
1112
- "taskId",
1113
- "status",
1114
- "updatedAt"
1115
- ],
1116
- "properties": {
1117
- "taskId": {
1118
- "type": "string",
1119
- "minLength": 1,
1120
- "maxLength": 256
1121
- },
1122
- "status": { "$ref": "#/$defs/TaskStatus" },
1123
- "progress": {
1124
- "type": "number",
1125
- "minimum": 0,
1126
- "maximum": 1
1127
- },
1128
- "message": {
1129
- "type": "string",
1130
- "maxLength": 1024
1131
- },
1132
- "updatedAt": {
1133
- "type": "string",
1134
- "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
1135
- }
1136
- }
1137
- },
1138
- "TaskObservationEvent": {
1139
- "description": "任务观察流中的单条事件;payload 由服务端裁剪。",
1140
- "title": "TaskObservationEvent",
1141
- "type": "object",
1142
- "additionalProperties": false,
1143
- "required": [
1144
- "id",
1145
- "type",
1146
- "occurredAt",
1147
- "payload"
1148
- ],
1149
- "properties": {
1150
- "id": {
1151
- "type": "string",
1152
- "minLength": 1,
1153
- "maxLength": 256
1154
- },
1155
- "type": { "enum": [
1156
- "started",
1157
- "progress",
1158
- "succeeded",
1159
- "failed",
1160
- "cancelled",
1161
- "expired"
1162
- ] },
1163
- "occurredAt": {
1164
- "type": "string",
1165
- "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
1166
- },
1167
- "payload": { "$ref": "#/$defs/JsonValue" }
1168
- }
1169
- },
1170
- "TaskObservationBatch": {
1171
- "description": "任务观察的一页结果:快照 + 有限事件页 + 游标。",
1172
- "title": "TaskObservationBatch",
1173
- "type": "object",
1174
- "additionalProperties": false,
1175
- "required": [
1176
- "schemaVersion",
1177
- "taskId",
1178
- "cursor",
1179
- "reset",
1180
- "hasMore",
1181
- "snapshot",
1182
- "events"
1183
- ],
1184
- "properties": {
1185
- "schemaVersion": { "const": 1 },
1186
- "taskId": {
1187
- "type": "string",
1188
- "minLength": 1,
1189
- "maxLength": 256
1190
- },
1191
- "cursor": {
1192
- "type": "string",
1193
- "minLength": 1,
1194
- "maxLength": 256
1195
- },
1196
- "reset": { "type": "boolean" },
1197
- "hasMore": { "type": "boolean" },
1198
- "snapshot": { "$ref": "#/$defs/TaskObservationSnapshot" },
1199
- "events": {
1200
- "type": "array",
1201
- "maxItems": 100,
1202
- "items": { "$ref": "#/$defs/TaskObservationEvent" }
1203
- }
1204
- }
1205
- },
1206
- "TaskListField": {
1207
- "description": "任务列表中的受限展示字段;key 是稳定机器键,value 是 Host 裁剪后的展示文本。",
1208
- "title": "TaskListField",
1209
- "type": "object",
1210
- "additionalProperties": false,
1211
- "required": ["key", "value"],
1212
- "properties": {
1213
- "key": {
1214
- "description": "展示字段的稳定机器键,例如 machine 或 command。",
1215
- "type": "string",
1216
- "minLength": 1,
1217
- "maxLength": 64,
1218
- "pattern": "^[A-Za-z][A-Za-z0-9_.:-]*$"
1219
- },
1220
- "value": {
1221
- "description": "Host 完成授权与裁剪后的展示文本。",
1222
- "type": "string",
1223
- "maxLength": 16384
1224
- }
1225
- }
1226
- },
1227
- "TaskListItem": {
1228
- "description": "Host 已授权发现的任务摘要;taskId 是可继续传给 tasks.watch 的不透明引用。",
1229
- "title": "TaskListItem",
1230
- "type": "object",
1231
- "additionalProperties": false,
1232
- "required": [
1233
- "taskId",
1234
- "kind",
1235
- "name",
1236
- "status",
1237
- "updatedAt",
1238
- "fields"
1239
- ],
1240
- "properties": {
1241
- "taskId": {
1242
- "description": "可继续传给 tasks.watch 的 Host 不透明任务引用。",
1243
- "type": "string",
1244
- "minLength": 1,
1245
- "maxLength": 256
1246
- },
1247
- "kind": {
1248
- "description": "任务来源类型的稳定机器键。",
1249
- "type": "string",
1250
- "minLength": 1,
1251
- "maxLength": 64,
1252
- "pattern": "^[A-Za-z][A-Za-z0-9_.:-]*$"
1253
- },
1254
- "name": {
1255
- "description": "任务的安全展示名称。",
1256
- "type": "string",
1257
- "minLength": 1,
1258
- "maxLength": 256
1259
- },
1260
- "status": { "$ref": "#/$defs/TaskStatus" },
1261
- "progress": {
1262
- "description": "可选执行进度,取值范围为 0 到 1。",
1263
- "type": "number",
1264
- "minimum": 0,
1265
- "maximum": 1
1266
- },
1267
- "message": {
1268
- "description": "Host 裁剪后的可选状态说明。",
1269
- "type": "string",
1270
- "maxLength": 1024
1271
- },
1272
- "updatedAt": {
1273
- "description": "任务摘要最后更新时间,使用 UTC ISO 8601 字符串。",
1274
- "type": "string",
1275
- "pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
1276
- },
1277
- "fields": {
1278
- "description": "任务面板可展示的受限附加字段。",
1279
- "type": "array",
1280
- "maxItems": 32,
1281
- "items": { "$ref": "#/$defs/TaskListField" }
1282
- }
1283
- }
1284
- },
1285
- "TaskListPage": {
1286
- "description": "Host 已授权任务摘要的一页结果;nextCursor 缺失表示当前页已到末尾。",
1287
- "title": "TaskListPage",
1288
- "type": "object",
1289
- "additionalProperties": false,
1290
- "required": ["schemaVersion", "tasks"],
1291
- "properties": {
1292
- "schemaVersion": {
1293
- "description": "任务列表页结构版本,当前固定为 1。",
1294
- "const": 1
1295
- },
1296
- "tasks": {
1297
- "description": "当前页中 Host 已授权的任务摘要。",
1298
- "type": "array",
1299
- "maxItems": 100,
1300
- "items": { "$ref": "#/$defs/TaskListItem" }
1301
- },
1302
- "nextCursor": {
1303
- "description": "下一页的不透明游标;缺失表示当前列表已到末尾。",
1304
- "type": "string",
1305
- "minLength": 1,
1306
- "maxLength": 512
1307
- }
1308
- }
1309
- },
1310
1088
  "ToolResultMetric": {
1311
1089
  "description": "工具结果中的单个指标。",
1312
1090
  "title": "ToolResultMetric",
@@ -1683,74 +1461,6 @@ const widgetRuntimeContractsSchema = {
1683
1461
  }
1684
1462
  }
1685
1463
  },
1686
- {
1687
- "type": "object",
1688
- "additionalProperties": false,
1689
- "required": ["name", "limits"],
1690
- "properties": {
1691
- "name": { "const": "tasks.list" },
1692
- "limits": {
1693
- "type": "object",
1694
- "additionalProperties": false,
1695
- "required": [
1696
- "callsPerMinute",
1697
- "pageSize",
1698
- "minPollMs"
1699
- ],
1700
- "properties": {
1701
- "callsPerMinute": {
1702
- "type": "integer",
1703
- "minimum": 1,
1704
- "maximum": 9007199254740991
1705
- },
1706
- "pageSize": {
1707
- "type": "integer",
1708
- "minimum": 1,
1709
- "maximum": 100
1710
- },
1711
- "minPollMs": {
1712
- "type": "integer",
1713
- "minimum": 1e3,
1714
- "maximum": 6e4
1715
- }
1716
- }
1717
- }
1718
- }
1719
- },
1720
- {
1721
- "type": "object",
1722
- "additionalProperties": false,
1723
- "required": ["name", "limits"],
1724
- "properties": {
1725
- "name": { "const": "tasks.watch" },
1726
- "limits": {
1727
- "type": "object",
1728
- "additionalProperties": false,
1729
- "required": [
1730
- "callsPerMinute",
1731
- "pageSize",
1732
- "minPollMs"
1733
- ],
1734
- "properties": {
1735
- "callsPerMinute": {
1736
- "type": "integer",
1737
- "minimum": 1,
1738
- "maximum": 9007199254740991
1739
- },
1740
- "pageSize": {
1741
- "type": "integer",
1742
- "minimum": 1,
1743
- "maximum": 100
1744
- },
1745
- "minPollMs": {
1746
- "type": "integer",
1747
- "minimum": 1e3,
1748
- "maximum": 6e4
1749
- }
1750
- }
1751
- }
1752
- }
1753
- },
1754
1464
  {
1755
1465
  "type": "object",
1756
1466
  "additionalProperties": false,
@@ -2202,60 +1912,6 @@ const widgetRuntimeContractsSchema = {
2202
1912
  }
2203
1913
  }
2204
1914
  },
2205
- {
2206
- "type": "object",
2207
- "additionalProperties": false,
2208
- "required": ["operation", "input"],
2209
- "properties": {
2210
- "operation": { "const": "tasks.list" },
2211
- "input": {
2212
- "type": "object",
2213
- "additionalProperties": false,
2214
- "properties": {
2215
- "cursor": {
2216
- "type": "string",
2217
- "minLength": 1,
2218
- "maxLength": 512
2219
- },
2220
- "limit": {
2221
- "type": "integer",
2222
- "minimum": 1,
2223
- "maximum": 100
2224
- }
2225
- }
2226
- }
2227
- }
2228
- },
2229
- {
2230
- "type": "object",
2231
- "additionalProperties": false,
2232
- "required": ["operation", "input"],
2233
- "properties": {
2234
- "operation": { "const": "tasks.watch" },
2235
- "input": {
2236
- "type": "object",
2237
- "additionalProperties": false,
2238
- "required": ["taskId"],
2239
- "properties": {
2240
- "taskId": {
2241
- "type": "string",
2242
- "minLength": 1,
2243
- "maxLength": 256
2244
- },
2245
- "cursor": {
2246
- "type": "string",
2247
- "minLength": 1,
2248
- "maxLength": 256
2249
- },
2250
- "limit": {
2251
- "type": "integer",
2252
- "minimum": 1,
2253
- "maximum": 100
2254
- }
2255
- }
2256
- }
2257
- }
2258
- },
2259
1915
  {
2260
1916
  "type": "object",
2261
1917
  "additionalProperties": false,
@@ -11189,7 +10845,6 @@ const widgetManifestSchema = {
11189
10845
  "properties": {
11190
10846
  "files": { "$ref": "#/$defs/FilesCapabilityRequest" },
11191
10847
  "events": { "$ref": "#/$defs/EventsCapabilityRequest" },
11192
- "tasks": { "$ref": "#/$defs/TasksCapabilityRequest" },
11193
10848
  "state": { "$ref": "#/$defs/StateCapabilityRequest" },
11194
10849
  "actions": { "$ref": "#/$defs/ActionsCapabilityRequest" },
11195
10850
  "network": { "$ref": "#/$defs/NetworkCapabilityRequest" },
@@ -11229,17 +10884,6 @@ const widgetManifestSchema = {
11229
10884
  }
11230
10885
  } }
11231
10886
  },
11232
- "TasksCapabilityRequest": {
11233
- "description": "任务发现与观察能力的申请;list / watch 至少显式申请一项,已申请项固定为 true。",
11234
- "title": "TasksCapabilityRequest",
11235
- "type": "object",
11236
- "additionalProperties": false,
11237
- "minProperties": 1,
11238
- "properties": {
11239
- "list": { "const": true },
11240
- "watch": { "const": true }
11241
- }
11242
- },
11243
10887
  "StateCapabilityRequest": {
11244
10888
  "description": "受限 UI 状态读写能力的申请;read / write 分别声明。",
11245
10889
  "title": "StateCapabilityRequest",
@@ -76,20 +76,6 @@ type GrantedCapability = ({
76
76
  pageSize: number;
77
77
  minPollMs: number;
78
78
  };
79
- } | {
80
- name: "tasks.list";
81
- limits: {
82
- callsPerMinute: number;
83
- pageSize: number;
84
- minPollMs: number;
85
- };
86
- } | {
87
- name: "tasks.watch";
88
- limits: {
89
- callsPerMinute: number;
90
- pageSize: number;
91
- minPollMs: number;
92
- };
93
79
  } | {
94
80
  name: "ui.state";
95
81
  limits: {
package/llms.txt CHANGED
@@ -44,9 +44,6 @@ pnpm exec bohr-widget --version --json
44
44
  - `create`: 创建 vanilla 或 React 工程并写 `widget-toolchain.json`;Panel ID 可自定义,
45
45
  `--panel-id workspace-files` 是可选的文件浏览面板预设。
46
46
  - `adopt`: 为旧工程显式写入工具链锁,先核对精确依赖、实际 SDK 与内置协议摘要、Manifest 和 samples。
47
- - SDK 0.5.0 的任务 Panel 在 Manifest 声明 `capabilities.tasks.list`;需要观察单个任务时再声明
48
- `tasks.watch`。列表刷新遵守 grant 的 `minPollMs`,面板不可见后停止轮询;CLI 校验通过不代表
49
- 目标 Host 已签发 grant,详见 AGENTS.md。
50
47
  - SDK 0.5.0 文件读写按需在 Manifest 声明 `capabilities.files.read/write`,再实现
51
48
  `context.files.read/write`;创建命令和模板保持原样。保存使用读取回执的内容版本与 mutationId,
52
49
  缺授权、版本或完整性证据时只读;冲突/未知结果保留草稿且不自动重试,详见 AGENTS.md。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dp-bohrium/widget-cli",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Bohrium Widget 插件工程的创建、校验、开发和打包工具。",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,7 +46,7 @@
46
46
  "@types/node": "^22.15.0",
47
47
  "tsdown": "0.22.14",
48
48
  "typescript": "5.9.3",
49
- "@dp-bohrium/widget-sdk": "0.9.0"
49
+ "@dp-bohrium/widget-sdk": "0.10.0"
50
50
  },
51
51
  "sideEffects": false,
52
52
  "publishConfig": {