@dp-bohrium/widget-sdk 0.9.0 → 0.10.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 +1 -1
- package/CHANGELOG.md +6 -0
- package/README.md +0 -7
- package/assets/schemas/widget-manifest.schema.json +0 -12
- package/assets/schemas/widget-runtime-contracts.schema.json +0 -272
- package/assets/toolchain.json +7 -7
- package/dist/cli.mjs +1 -1
- package/dist/{dsh-BL6cMLrg.mjs → dsh-BJWUB8Nq.mjs} +1 -357
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -11
- package/dist/protocol/generated-host-runtime-config.d.ts +0 -22
- package/dist/protocol/generated-manifest.d.ts +0 -8
- package/dist/protocol/generated-plugin-manifest.d.ts +0 -8
- package/dist/protocol/generated-runtime-contracts.d.ts +0 -139
- package/dist/protocol/index.d.ts +2 -2
- package/dist/runtime/index.js +1 -1
- package/dist/{runtime-9g5MfsgK.js → runtime-Bn_ee8xy.js} +1 -1
- package/dist/widget.d.ts +1 -41
- package/package.json +1 -1
- package/schemas/widget-manifest.schema.json +0 -12
- package/schemas/widget-runtime-contracts.schema.json +0 -272
- package/conformance/bridge/tasks-list-request.json +0 -17
- package/conformance/bridge/tasks-watch-request.json +0 -18
|
@@ -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 {
|
|
@@ -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",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { CompileWidgetPluginManifestOptions } from "./manifest.js";
|
|
2
2
|
export { compileWidgetPluginManifest } from "./manifest.js";
|
|
3
|
-
export type { CapabilityRequest, CapabilityResult, FileDownloadResult, FileMutationId, FilePreviewContent, FilePreviewRenderRequest, FileReadInput, FileReadResult, FileReference, FileRevision, FileWriteInput, FileWriteResult, GrantedCapability, JsonValue, PanelContent, PanelRenderRequest, RenderRequest, RenderState,
|
|
3
|
+
export type { CapabilityRequest, CapabilityResult, FileDownloadResult, FileMutationId, FilePreviewContent, FilePreviewRenderRequest, FileReadInput, FileReadResult, FileReference, FileRevision, FileWriteInput, FileWriteResult, GrantedCapability, JsonValue, PanelContent, PanelRenderRequest, RenderRequest, RenderState, Theme, ThemeMode, WidgetActivationEvent, WidgetActivationEvents, WidgetContribution, WidgetError, WidgetErrorCode, WidgetEventName, WidgetFilePreviewContribution, WidgetLiveEvent, WidgetNetworkFetchInput, WidgetNetworkFetchOutput, WidgetPanelContribution, WidgetPluginContributions, WidgetPluginManifest, WidgetToolPhase, } from "./protocol/index.js";
|
|
4
4
|
export { isWidgetActivationEvent, isWidgetEventName, WIDGET_ACTIVATION_EVENTS, WIDGET_EVENT_NAMES, } from "./protocol/index.js";
|
|
5
5
|
export type { HostUserEmail, HostUserEmailResult, HostUserProfile, HostUserProfileResult, WidgetHostUserClient, } from "./runtime/service.js";
|
|
6
|
-
export type { FileDownloadCapabilityResult, FileReadCapabilityResult, FileWriteCapabilityResult,
|
|
6
|
+
export type { FileDownloadCapabilityResult, FileReadCapabilityResult, FileWriteCapabilityResult, UiStateReadCapabilityResult, UiStateWriteCapabilityResult, WidgetActivation, WidgetCapabilityApi, WidgetContext, WidgetDisposable, WidgetEventApi, WidgetFileApi, WidgetHandle, WidgetHostOptions, WidgetModule, WidgetRenderContext, WidgetRenderHandler, WidgetUiApi, WidgetUiStateApi, } from "./widget.js";
|
|
7
7
|
export { runWidgetHost } from "./widget.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as createWidgetClient, l as WIDGET_SDK_VERSION } from "./runtime-
|
|
1
|
+
import { i as createWidgetClient, l as WIDGET_SDK_VERSION } from "./runtime-Bn_ee8xy.js";
|
|
2
2
|
import { a as projectWidgetRuntimeDiagnostic, c as WIDGET_EVENT_NAMES, d as isWidgetActivationEvent, l as isWidgetEventName, u as WIDGET_ACTIVATION_EVENTS } from "./widget-recovery-BF_sSUZX.js";
|
|
3
3
|
import { n as isWidgetGuestDiagnostic } from "./development-guards-COvBR0G1.js";
|
|
4
4
|
//#region src/manifest.ts
|
|
@@ -316,16 +316,6 @@ function createContext(client, payload, renderHandlers, lifetime) {
|
|
|
316
316
|
input
|
|
317
317
|
}, options)
|
|
318
318
|
},
|
|
319
|
-
tasks: {
|
|
320
|
-
list: (input = {}, options) => client.requestCapability({
|
|
321
|
-
operation: "tasks.list",
|
|
322
|
-
input
|
|
323
|
-
}, options),
|
|
324
|
-
watch: (input, options) => client.requestCapability({
|
|
325
|
-
operation: "tasks.watch",
|
|
326
|
-
input
|
|
327
|
-
}, options)
|
|
328
|
-
},
|
|
329
319
|
network: client.network,
|
|
330
320
|
services: client.services,
|
|
331
321
|
hostUser: client.hostUser,
|
|
@@ -134,20 +134,6 @@ export type GrantedCapability = ({
|
|
|
134
134
|
pageSize: number;
|
|
135
135
|
minPollMs: number;
|
|
136
136
|
};
|
|
137
|
-
} | {
|
|
138
|
-
name: "tasks.list";
|
|
139
|
-
limits: {
|
|
140
|
-
callsPerMinute: number;
|
|
141
|
-
pageSize: number;
|
|
142
|
-
minPollMs: number;
|
|
143
|
-
};
|
|
144
|
-
} | {
|
|
145
|
-
name: "tasks.watch";
|
|
146
|
-
limits: {
|
|
147
|
-
callsPerMinute: number;
|
|
148
|
-
pageSize: number;
|
|
149
|
-
minPollMs: number;
|
|
150
|
-
};
|
|
151
137
|
} | {
|
|
152
138
|
name: "ui.state";
|
|
153
139
|
limits: {
|
|
@@ -366,7 +352,6 @@ export interface PanelContributionConfig {
|
|
|
366
352
|
export interface RequestedCapabilities {
|
|
367
353
|
files?: FilesCapabilityRequest;
|
|
368
354
|
events?: EventsCapabilityRequest;
|
|
369
|
-
tasks?: TasksCapabilityRequest;
|
|
370
355
|
state?: StateCapabilityRequest;
|
|
371
356
|
actions?: ActionsCapabilityRequest;
|
|
372
357
|
network?: NetworkCapabilityRequest;
|
|
@@ -393,13 +378,6 @@ export interface EventsCapabilityRequest {
|
|
|
393
378
|
*/
|
|
394
379
|
topics: [string, ...(string)[]];
|
|
395
380
|
}
|
|
396
|
-
/**
|
|
397
|
-
* 任务发现与观察能力的申请;list / watch 至少显式申请一项,已申请项固定为 true。
|
|
398
|
-
*/
|
|
399
|
-
export interface TasksCapabilityRequest {
|
|
400
|
-
list?: true;
|
|
401
|
-
watch?: true;
|
|
402
|
-
}
|
|
403
381
|
/**
|
|
404
382
|
* 受限 UI 状态读写能力的申请;read / write 分别声明。
|
|
405
383
|
*/
|
|
@@ -105,7 +105,6 @@ export interface PanelContributionConfig {
|
|
|
105
105
|
export interface RequestedCapabilities {
|
|
106
106
|
files?: FilesCapabilityRequest;
|
|
107
107
|
events?: EventsCapabilityRequest;
|
|
108
|
-
tasks?: TasksCapabilityRequest;
|
|
109
108
|
state?: StateCapabilityRequest;
|
|
110
109
|
actions?: ActionsCapabilityRequest;
|
|
111
110
|
network?: NetworkCapabilityRequest;
|
|
@@ -132,13 +131,6 @@ export interface EventsCapabilityRequest {
|
|
|
132
131
|
*/
|
|
133
132
|
topics: [string, ...(string)[]];
|
|
134
133
|
}
|
|
135
|
-
/**
|
|
136
|
-
* 任务发现与观察能力的申请;list / watch 至少显式申请一项,已申请项固定为 true。
|
|
137
|
-
*/
|
|
138
|
-
export interface TasksCapabilityRequest {
|
|
139
|
-
list?: true;
|
|
140
|
-
watch?: true;
|
|
141
|
-
}
|
|
142
134
|
/**
|
|
143
135
|
* 受限 UI 状态读写能力的申请;read / write 分别声明。
|
|
144
136
|
*/
|
|
@@ -89,7 +89,6 @@ export interface WidgetFilePreviewContribution {
|
|
|
89
89
|
export interface RequestedCapabilities {
|
|
90
90
|
files?: FilesCapabilityRequest;
|
|
91
91
|
events?: EventsCapabilityRequest;
|
|
92
|
-
tasks?: TasksCapabilityRequest;
|
|
93
92
|
state?: StateCapabilityRequest;
|
|
94
93
|
actions?: ActionsCapabilityRequest;
|
|
95
94
|
network?: NetworkCapabilityRequest;
|
|
@@ -116,13 +115,6 @@ export interface EventsCapabilityRequest {
|
|
|
116
115
|
*/
|
|
117
116
|
topics: [string, ...(string)[]];
|
|
118
117
|
}
|
|
119
|
-
/**
|
|
120
|
-
* 任务发现与观察能力的申请;list / watch 至少显式申请一项,已申请项固定为 true。
|
|
121
|
-
*/
|
|
122
|
-
export interface TasksCapabilityRequest {
|
|
123
|
-
list?: true;
|
|
124
|
-
watch?: true;
|
|
125
|
-
}
|
|
126
118
|
/**
|
|
127
119
|
* 受限 UI 状态读写能力的申请;read / write 分别声明。
|
|
128
120
|
*/
|
|
@@ -80,20 +80,6 @@ export type GrantedCapability = ({
|
|
|
80
80
|
pageSize: number;
|
|
81
81
|
minPollMs: number;
|
|
82
82
|
};
|
|
83
|
-
} | {
|
|
84
|
-
name: "tasks.list";
|
|
85
|
-
limits: {
|
|
86
|
-
callsPerMinute: number;
|
|
87
|
-
pageSize: number;
|
|
88
|
-
minPollMs: number;
|
|
89
|
-
};
|
|
90
|
-
} | {
|
|
91
|
-
name: "tasks.watch";
|
|
92
|
-
limits: {
|
|
93
|
-
callsPerMinute: number;
|
|
94
|
-
pageSize: number;
|
|
95
|
-
minPollMs: number;
|
|
96
|
-
};
|
|
97
83
|
} | {
|
|
98
84
|
name: "ui.state";
|
|
99
85
|
limits: {
|
|
@@ -286,19 +272,6 @@ export type CapabilityRequest = ({
|
|
|
286
272
|
file: FileReference;
|
|
287
273
|
suggestedName: string;
|
|
288
274
|
};
|
|
289
|
-
} | {
|
|
290
|
-
operation: "tasks.list";
|
|
291
|
-
input: {
|
|
292
|
-
cursor?: string;
|
|
293
|
-
limit?: number;
|
|
294
|
-
};
|
|
295
|
-
} | {
|
|
296
|
-
operation: "tasks.watch";
|
|
297
|
-
input: {
|
|
298
|
-
taskId: string;
|
|
299
|
-
cursor?: string;
|
|
300
|
-
limit?: number;
|
|
301
|
-
};
|
|
302
275
|
} | {
|
|
303
276
|
operation: "ui.state";
|
|
304
277
|
input: ({
|
|
@@ -513,10 +486,6 @@ export type RegionCapabilityResult = ({
|
|
|
513
486
|
message: string;
|
|
514
487
|
retryable: boolean;
|
|
515
488
|
});
|
|
516
|
-
/**
|
|
517
|
-
* Host 投影给 Widget 的统一任务状态。
|
|
518
|
-
*/
|
|
519
|
-
export type TaskStatus = ("queued" | "running" | "succeeded" | "failed" | "cancelled" | "expired");
|
|
520
489
|
/**
|
|
521
490
|
* Host 用户服务标识;固定为 host.user。
|
|
522
491
|
*/
|
|
@@ -687,12 +656,6 @@ export interface WidgetRuntimeContracts {
|
|
|
687
656
|
fileDownloadResult?: FileDownloadResult;
|
|
688
657
|
fileReadResult?: FileReadResult;
|
|
689
658
|
fileWriteResult?: FileWriteResult;
|
|
690
|
-
taskObservationSnapshot?: TaskObservationSnapshot;
|
|
691
|
-
taskObservationEvent?: TaskObservationEvent;
|
|
692
|
-
taskObservationBatch?: TaskObservationBatch;
|
|
693
|
-
taskListField?: TaskListField;
|
|
694
|
-
taskListItem?: TaskListItem;
|
|
695
|
-
taskListPage?: TaskListPage;
|
|
696
659
|
toolResultEnvelope?: ToolResultEnvelope;
|
|
697
660
|
uiStateResult?: UiStateResult;
|
|
698
661
|
uiStateWriteResult?: UiStateWriteResult;
|
|
@@ -1220,108 +1183,6 @@ export interface FileWriteResult {
|
|
|
1220
1183
|
bytesWritten: number;
|
|
1221
1184
|
mutationId: FileMutationId;
|
|
1222
1185
|
}
|
|
1223
|
-
/**
|
|
1224
|
-
* 任务观察的当前快照:taskId、status 与 updatedAt;progress、message 可选。
|
|
1225
|
-
*/
|
|
1226
|
-
export interface TaskObservationSnapshot {
|
|
1227
|
-
taskId: string;
|
|
1228
|
-
status: TaskStatus;
|
|
1229
|
-
progress?: number;
|
|
1230
|
-
message?: string;
|
|
1231
|
-
updatedAt: string;
|
|
1232
|
-
}
|
|
1233
|
-
/**
|
|
1234
|
-
* 任务观察流中的单条事件;payload 由服务端裁剪。
|
|
1235
|
-
*/
|
|
1236
|
-
export interface TaskObservationEvent {
|
|
1237
|
-
id: string;
|
|
1238
|
-
type: ("started" | "progress" | "succeeded" | "failed" | "cancelled" | "expired");
|
|
1239
|
-
occurredAt: string;
|
|
1240
|
-
payload: JsonValue;
|
|
1241
|
-
}
|
|
1242
|
-
/**
|
|
1243
|
-
* 任务观察的一页结果:快照 + 有限事件页 + 游标。
|
|
1244
|
-
*/
|
|
1245
|
-
export interface TaskObservationBatch {
|
|
1246
|
-
schemaVersion: 1;
|
|
1247
|
-
taskId: string;
|
|
1248
|
-
cursor: string;
|
|
1249
|
-
reset: boolean;
|
|
1250
|
-
hasMore: boolean;
|
|
1251
|
-
snapshot: TaskObservationSnapshot;
|
|
1252
|
-
/**
|
|
1253
|
-
* @maxItems 100
|
|
1254
|
-
*/
|
|
1255
|
-
events: TaskObservationEvent[];
|
|
1256
|
-
}
|
|
1257
|
-
/**
|
|
1258
|
-
* 任务列表中的受限展示字段;key 是稳定机器键,value 是 Host 裁剪后的展示文本。
|
|
1259
|
-
*/
|
|
1260
|
-
export interface TaskListField {
|
|
1261
|
-
/**
|
|
1262
|
-
* 展示字段的稳定机器键,例如 machine 或 command。
|
|
1263
|
-
*/
|
|
1264
|
-
key: string;
|
|
1265
|
-
/**
|
|
1266
|
-
* Host 完成授权与裁剪后的展示文本。
|
|
1267
|
-
*/
|
|
1268
|
-
value: string;
|
|
1269
|
-
}
|
|
1270
|
-
/**
|
|
1271
|
-
* Host 已授权发现的任务摘要;taskId 是可继续传给 tasks.watch 的不透明引用。
|
|
1272
|
-
*/
|
|
1273
|
-
export interface TaskListItem {
|
|
1274
|
-
/**
|
|
1275
|
-
* 可继续传给 tasks.watch 的 Host 不透明任务引用。
|
|
1276
|
-
*/
|
|
1277
|
-
taskId: string;
|
|
1278
|
-
/**
|
|
1279
|
-
* 任务来源类型的稳定机器键。
|
|
1280
|
-
*/
|
|
1281
|
-
kind: string;
|
|
1282
|
-
/**
|
|
1283
|
-
* 任务的安全展示名称。
|
|
1284
|
-
*/
|
|
1285
|
-
name: string;
|
|
1286
|
-
status: TaskStatus;
|
|
1287
|
-
/**
|
|
1288
|
-
* 可选执行进度,取值范围为 0 到 1。
|
|
1289
|
-
*/
|
|
1290
|
-
progress?: number;
|
|
1291
|
-
/**
|
|
1292
|
-
* Host 裁剪后的可选状态说明。
|
|
1293
|
-
*/
|
|
1294
|
-
message?: string;
|
|
1295
|
-
/**
|
|
1296
|
-
* 任务摘要最后更新时间,使用 UTC ISO 8601 字符串。
|
|
1297
|
-
*/
|
|
1298
|
-
updatedAt: string;
|
|
1299
|
-
/**
|
|
1300
|
-
* 任务面板可展示的受限附加字段。
|
|
1301
|
-
*
|
|
1302
|
-
* @maxItems 32
|
|
1303
|
-
*/
|
|
1304
|
-
fields: TaskListField[];
|
|
1305
|
-
}
|
|
1306
|
-
/**
|
|
1307
|
-
* Host 已授权任务摘要的一页结果;nextCursor 缺失表示当前页已到末尾。
|
|
1308
|
-
*/
|
|
1309
|
-
export interface TaskListPage {
|
|
1310
|
-
/**
|
|
1311
|
-
* 任务列表页结构版本,当前固定为 1。
|
|
1312
|
-
*/
|
|
1313
|
-
schemaVersion: 1;
|
|
1314
|
-
/**
|
|
1315
|
-
* 当前页中 Host 已授权的任务摘要。
|
|
1316
|
-
*
|
|
1317
|
-
* @maxItems 100
|
|
1318
|
-
*/
|
|
1319
|
-
tasks: TaskListItem[];
|
|
1320
|
-
/**
|
|
1321
|
-
* 下一页的不透明游标;缺失表示当前列表已到末尾。
|
|
1322
|
-
*/
|
|
1323
|
-
nextCursor?: string;
|
|
1324
|
-
}
|
|
1325
1186
|
/**
|
|
1326
1187
|
* 受限 UI 状态读取结果。
|
|
1327
1188
|
*/
|