@dp-bohrium/widget-sdk 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +10 -4
- package/CHANGELOG.md +18 -1
- package/README.md +39 -17
- package/assets/licenses/ajv@8.20.0/LICENSE +22 -0
- package/assets/licenses/fast-deep-equal@3.1.3/LICENSE +21 -0
- package/assets/licenses/fast-uri@3.1.6/LICENSE +30 -0
- package/assets/licenses/json-schema-traverse@1.0.0/LICENSE +21 -0
- package/assets/licenses/require-from-string@2.0.2/license +21 -0
- package/assets/licenses/widget-contracts.LICENSE +21 -0
- package/assets/licenses/widget-sdk.LICENSE +21 -0
- package/assets/schemas/host-runtime-config.schema.json +305 -0
- package/assets/schemas/widget-manifest.schema.json +361 -0
- package/assets/schemas/widget-plugin-manifest.schema.json +162 -0
- package/assets/schemas/widget-runtime-contracts.schema.json +2870 -0
- package/assets/toolchain.json +24 -0
- package/conformance/bridge/capability-request.json +23 -0
- package/conformance/bridge/files-download-request.json +23 -0
- package/conformance/bridge/files-read-versioned-request.json +25 -0
- package/conformance/bridge/files-write-request.json +25 -0
- package/conformance/bridge/files-write-success.json +25 -0
- package/conformance/bridge/network-fetch-denied.json +16 -0
- package/conformance/bridge/network-fetch-request.json +19 -0
- package/conformance/bridge/network-fetch-success.json +22 -0
- package/conformance/bridge/presentation-change-surface-request.json +14 -0
- package/conformance/bridge/presentation-close-request.json +14 -0
- package/conformance/bridge/presentation-close-success.json +11 -0
- package/conformance/bridge/presentation-downgrade-success.json +14 -0
- package/conformance/bridge/presentation-focus-backward-request.json +14 -0
- package/conformance/bridge/presentation-focus-boundary-success.json +14 -0
- package/conformance/bridge/presentation-focus-forward-request.json +14 -0
- package/conformance/bridge/presentation-init.json +70 -0
- package/conformance/bridge/presentation-policy-denied.json +16 -0
- package/conformance/bridge/presentation-present-request.json +14 -0
- package/conformance/bridge/presentation-user-denied.json +16 -0
- package/conformance/bridge/ready.json +11 -0
- package/conformance/bridge/region-acquire-request.json +14 -0
- package/conformance/bridge/tasks-list-request.json +17 -0
- package/conformance/bridge/tasks-watch-request.json +18 -0
- package/conformance/bridge/ui-state-write-request.json +18 -0
- package/conformance/bundles/minimal-file-preview/entry.js +1 -0
- package/conformance/bundles/minimal-file-preview/manifest.json +12 -0
- package/conformance/bundles/minimal-file-preview/samples/file-preview.json +1 -0
- package/conformance/bundles/minimal-panel/entry.js +1 -0
- package/conformance/bundles/minimal-panel/manifest.json +11 -0
- package/conformance/bundles/minimal-panel/samples/panel.json +1 -0
- package/conformance/bundles/minimal-tool-result/entry.js +1 -0
- package/conformance/bundles/minimal-tool-result/manifest.json +11 -0
- package/conformance/bundles/minimal-tool-result/samples/tool-result.json +1 -0
- package/conformance/file-grants/write.json +8 -0
- package/conformance/file-responses/list.json +1 -0
- package/conformance/file-responses/metadata.json +11 -0
- package/conformance/file-responses/mutation-conflict.json +6 -0
- package/conformance/file-responses/permission-denied.json +6 -0
- package/conformance/file-responses/read-revision-only.json +8 -0
- package/conformance/file-responses/read-unversioned-range.json +12 -0
- package/conformance/file-responses/read-versioned.json +12 -0
- package/conformance/file-responses/resource-limit.json +1 -0
- package/conformance/file-responses/revision-conflict.json +6 -0
- package/conformance/file-responses/text-content.json +7 -0
- package/conformance/file-responses/write-outcome-unknown.json +6 -0
- package/conformance/file-responses/write-success.json +15 -0
- package/conformance/host-runtime-config/invalid-host-service-expiry.json +85 -0
- package/conformance/host-runtime-config/invalid-host-service-identity.json +85 -0
- package/conformance/host-runtime-config/invalid-host-service-permission.json +85 -0
- package/conformance/host-runtime-config/invalid-host-service-status.json +65 -0
- package/conformance/host-runtime-config/invalid-missing-manifest-fields.json +55 -0
- package/conformance/host-runtime-config/invalid-static-origins.json +60 -0
- package/conformance/host-runtime-config/valid-host-service-authorization-required.json +65 -0
- package/conformance/host-runtime-config/valid-host-service-authorization.json +85 -0
- package/conformance/host-runtime-config/valid-no-requested-permissions.json +52 -0
- package/conformance/host-runtime-config/valid.json +85 -0
- package/conformance/invalid-bridge-messages/network-fetch-mixed-case-forbidden-header.json +21 -0
- package/conformance/invalid-file-grants/extra-file-scope.json +9 -0
- package/conformance/invalid-file-grants/missing-write-limits.json +4 -0
- package/conformance/invalid-file-requests/arbitrary-path.json +16 -0
- package/conformance/invalid-file-requests/missing-expected-revision.json +14 -0
- package/conformance/invalid-file-requests/missing-mutation-id.json +14 -0
- package/conformance/invalid-file-requests/path-in-reference.json +16 -0
- package/conformance/invalid-file-results/read-empty-revision.json +5 -0
- package/conformance/invalid-file-results/read-null-revision.json +5 -0
- package/conformance/invalid-file-results/write-missing-mutation-id.json +11 -0
- package/conformance/invalid-manifests/missing-target.json +11 -0
- package/conformance/invalid-manifests/presentation-duplicate-surfaces.json +16 -0
- package/conformance/invalid-manifests/presentation-empty-surfaces.json +14 -0
- package/conformance/invalid-manifests/presentation-unknown-surface.json +16 -0
- package/conformance/invalid-manifests/unknown-field.json +12 -0
- package/conformance/invalid-network-requests/mixed-case-forbidden-header.json +11 -0
- package/conformance/invalid-presentation-grants/duplicate-surfaces.json +5 -0
- package/conformance/invalid-presentation-grants/empty-surfaces.json +5 -0
- package/conformance/invalid-presentation-grants/false-confirmation.json +5 -0
- package/conformance/invalid-presentation-grants/missing-confirmation.json +4 -0
- package/conformance/invalid-presentation-grants/unknown-surface.json +5 -0
- package/conformance/invalid-presentation-requests/change-surface-missing-surface.json +4 -0
- package/conformance/invalid-presentation-requests/close-with-surface.json +4 -0
- package/conformance/invalid-presentation-requests/focus-boundary-missing-direction.json +4 -0
- package/conformance/invalid-presentation-requests/focus-boundary-unknown-direction.json +4 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-coordinates.json +9 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-event-provenance.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-generation.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-identity.json +12 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-key.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-modifiers.json +11 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-selector.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-surface.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-target.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-timestamp.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-z-index.json +8 -0
- package/conformance/invalid-presentation-requests/present-missing-surface.json +4 -0
- package/conformance/invalid-presentation-requests/unknown-surface.json +4 -0
- package/conformance/invalid-presentation-requests/widget-controls-coordinates.json +9 -0
- package/conformance/invalid-presentation-requests/widget-controls-geometry.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-instance-id.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-principal.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-run-id.json +4 -0
- package/conformance/invalid-presentation-requests/widget-controls-widget-id.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-widget-version-id.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-z-index.json +4 -0
- package/conformance/invalid-render-inputs/malformed.json +17 -0
- package/conformance/manifests/valid-file-preview.json +12 -0
- package/conformance/manifests/valid-file-write-preview.json +30 -0
- package/conformance/manifests/valid-network.json +15 -0
- package/conformance/manifests/valid-panel.json +11 -0
- package/conformance/manifests/valid-presentation-panel.json +21 -0
- package/conformance/manifests/valid-region-panel.json +18 -0
- package/conformance/manifests/valid-tool-result.json +14 -0
- package/conformance/render-inputs/compatibility/literature-search-paper-results.json +75 -0
- package/conformance/render-inputs/compatibility/scientific-bibliography-bibtex.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-dataset-csv.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-manuscript-latex.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-manuscript-markdown.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-molecule-mol.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-molecule-mol2.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-notebook-ipynb.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-paper-pdf.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-protein-pdb.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-source-python.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-structure-cif.json +47 -0
- package/conformance/render-inputs/compatibility/scientific-structure-poscar.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-structure-stru.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-trajectory-xyz.json +10 -0
- package/conformance/render-inputs/compatibility/thinking-process-paper-search.json +25 -0
- package/conformance/render-inputs/compatibility/thinking-process-scholar-search.json +25 -0
- package/conformance/render-inputs/compatibility/thinking-process-web-search.json +25 -0
- package/conformance/render-inputs/compatibility/workspace-file-search.json +24 -0
- package/conformance/render-inputs/compatibility/workspace-file-tree.json +24 -0
- package/conformance/render-inputs/empty.json +10 -0
- package/conformance/render-inputs/file-preview.json +10 -0
- package/conformance/render-inputs/incremental-update.json +10 -0
- package/conformance/render-inputs/large.json +10 -0
- package/conformance/render-inputs/malformed.json +1 -0
- package/conformance/render-inputs/panel.json +10 -0
- package/conformance/render-inputs/partial-state-full-snapshot.json +40 -0
- package/conformance/render-inputs/tool-result.json +10 -0
- package/conformance/resource-budgets/corpus.json +431 -0
- package/dist/cli.mjs +15577 -0
- package/dist/contracts.d.ts +2 -0
- package/dist/contracts.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/{runtime-DVFTv55x.js → runtime-D7KxTtdu.js} +1 -1
- package/llms.txt +9 -1
- package/package.json +17 -3
- package/schemas/host-runtime-config.schema.json +305 -0
- package/schemas/widget-manifest.schema.json +361 -0
- package/schemas/widget-plugin-manifest.schema.json +162 -0
- package/schemas/widget-runtime-contracts.schema.json +2870 -0
package/AGENTS.md
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
# Widget SDK Agent 使用说明
|
|
2
2
|
|
|
3
|
-
`@dp-bohrium/widget-sdk` 是
|
|
3
|
+
`@dp-bohrium/widget-sdk` 是 Widget 作者的统一代码、类型与 Schema 入口。Agent 先读取 `llms.txt`,再
|
|
4
4
|
根据任务选择高层 Widget API、低层 Runtime API 或测试入口;不要自行实现 Bridge 握手。
|
|
5
5
|
|
|
6
6
|
## 常用动作
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
9
|
pnpm add @dp-bohrium/widget-sdk
|
|
10
|
+
pnpm dlx @dp-bohrium/widget-sdk create my-widget --template panel
|
|
10
11
|
```
|
|
11
12
|
|
|
12
|
-
1. 用 `activate(context)` 实现 Widget
|
|
13
|
+
1. 用 SDK 自带的 `bohr-widget` 创建工程,再用 `activate(context)` 实现 Widget;生成工程只直接依赖 SDK。
|
|
13
14
|
2. 在 Manifest 中声明所需 capability,再使用 `context.capabilities`、`context.files`、
|
|
14
15
|
`context.tasks`、`context.ui` 或 `context.network`。
|
|
15
16
|
3. 在测试中使用 `@dp-bohrium/widget-sdk/testing` 的 `MockWidgetHost`;生产 Bundle 使用
|
|
16
17
|
根入口,不把 testing 入口打进产物。
|
|
17
|
-
4.
|
|
18
|
+
4. 常用作者类型从根入口获取;完整协议用 `/contracts`,编辑器 Schema 用 `/schemas/*.json`。
|
|
19
|
+
SDK 与开发工具负责核对配套协议版本,作者无需直接安装 contracts;直接依赖的旧用法已废弃,
|
|
20
|
+
统一入口切换发布 R1 前迁移并移除,不恢复旧版本执行器。
|
|
21
|
+
5. 低层协议客户端从 `@dp-bohrium/widget-sdk/runtime` 导入。根入口的 `WidgetRenderContext`
|
|
22
|
+
表示渲染回调的 phase/signal,协议同名类型从 `/contracts` 导入。
|
|
18
23
|
|
|
19
24
|
## 错误恢复
|
|
20
25
|
|
|
@@ -30,4 +35,5 @@ pnpm add @dp-bohrium/widget-sdk
|
|
|
30
35
|
|
|
31
36
|
SDK 不授予权限、不上传或发布 Bundle、不决定 iframe/CSP 策略,也不保证脱离 Host 可以运行。
|
|
32
37
|
`ok=true` 只表示当前调用被 Runtime/Host 接受;真实授权、渲染和生产绑定由 Host 与平台负责。
|
|
33
|
-
发布包使用精确 SemVer;升级 SDK
|
|
38
|
+
发布包使用精确 SemVer;升级 SDK 时让开发工具核对配套协议和生成 Bundle 的 digest。
|
|
39
|
+
SDK 的 Node 命令与浏览器 Runtime 使用独立构建入口;不要从根入口或 `/runtime` 导入 CLI 模块。
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# `@dp-bohrium/widget-sdk` 变更记录
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7c21acf: SDK 发布包新增 `bohr-widget` 可执行入口并内置固定工具链资产,使新工程只需精确安装 SDK 即可完成
|
|
8
|
+
创建、构建、校验、开发和打包。现有 widget-cli 暂按现行发布治理复用同一份命令实现与原有分发身份,
|
|
9
|
+
作为过渡兼容分发;两种入口创建或迁移的新工程都只依赖 SDK,SDK bin 不根据旧工程依赖回选历史执行器。
|
|
10
|
+
两包同时安装时不保证同名命令保留旧 CLI 身份;旧工程须移除 CLI、重新安装,并由 SDK 重新构建 receipt
|
|
11
|
+
后再校验与打包,receipt 严格校验不变。
|
|
12
|
+
复用的命令源码与构建输入纳入 SDK 版本门禁;本次不改变 integration v2、工程锁或发布 Tag 协议。
|
|
13
|
+
Widget 作者 skill 同步改用 SDK 创建入口,避免 Agent 为新工程重新引入独立 CLI 依赖。
|
|
14
|
+
- 31e930e: 统一 Widget 作者入口:SDK 根入口导出常用作者类型,并新增 `/contracts`、`/schemas/*.json` 和
|
|
15
|
+
`/conformance/*` 子入口,使作者与 Host 无需直接安装 contracts。直接声明或导入 contracts 的旧用法
|
|
16
|
+
进入迁移期,统一入口切换发布 R1 前应迁移到 SDK;规范协议类型仍由 contracts 唯一维护。
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- @dp-bohrium/widget-contracts@0.6.0
|
|
4
21
|
|
|
5
22
|
## 0.5.0
|
|
6
23
|
|
package/README.md
CHANGED
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
Agent 使用入口:先读 [`llms.txt`](./llms.txt) 获取文档索引,再读 [`AGENTS.md`](./AGENTS.md)
|
|
4
4
|
获取安装、运行时调用和错误恢复规则。
|
|
5
5
|
|
|
6
|
-
Widget 开发者 SDK
|
|
7
|
-
|
|
6
|
+
Widget 开发者 SDK,也是创建、构建、校验、开发和打包 Widget 的统一安装入口。普通作者只实现
|
|
7
|
+
`activate(context)` 和可选的 `deactivate()`;SDK 自带的 `bohr-widget` 会生成 Widget Host 入口,
|
|
8
|
+
负责向 Host 宣告 Bundle、接收转移过来的 `MessagePort`,并暴露共享的
|
|
8
9
|
生命周期与能力协议。作者无需直接处理 `window.postMessage`,也无需手动启动插件。
|
|
9
10
|
|
|
10
11
|
激活事件目录、`context.events` 与低层 `topic` 的边界以本包的 `AGENTS.md`、本 README
|
|
11
|
-
|
|
12
|
+
和本包公开的类型与 Schema 为准;协议实现保持同一份事实源。
|
|
12
13
|
|
|
13
14
|
## 环境要求
|
|
14
15
|
|
|
15
16
|
| 项 | 要求 |
|
|
16
17
|
| --- | --- |
|
|
17
|
-
| Node.js | ≥ 20
|
|
18
|
+
| Node.js | ≥ 20(执行 `bohr-widget` 与构建时;Widget 产物运行在浏览器 iframe 内) |
|
|
18
19
|
| 源码格式 | 纯 ESM,必须经打包器处理后交付 |
|
|
19
20
|
| 运行环境 | 必须由 Bohrium Host 加载,脱离 Host 无法完成握手 |
|
|
20
21
|
| 产物格式 | Host iframe 为 `sandbox="allow-scripts"` 且无 `allow-same-origin` 时,打成 classic script / IIFE(隔离源下 `type="module"` 需要 CORS) |
|
|
21
22
|
|
|
22
23
|
## 安装
|
|
23
24
|
|
|
24
|
-
写 Widget
|
|
25
|
-
|
|
26
|
-
即可。
|
|
25
|
+
写 Widget、调用本地工具、消费 Host 协议都安装本包;contracts 作为 SDK 的精确传递依赖维护,
|
|
26
|
+
不再要求使用者单独选择版本。
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
npm install @dp-bohrium/widget-sdk
|
|
@@ -31,9 +31,27 @@ pnpm add @dp-bohrium/widget-sdk
|
|
|
31
31
|
yarn add @dp-bohrium/widget-sdk
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
新建工程只需调用 SDK 自带的命令,生成结果也只直接声明精确 SDK 版本:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm dlx @dp-bohrium/widget-sdk create my-widget --template panel
|
|
38
|
+
cd my-widget
|
|
39
|
+
pnpm install
|
|
40
|
+
pnpm exec bohr-widget build .
|
|
41
|
+
pnpm exec bohr-widget check .
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`@dp-bohrium/widget-cli` 的现有直接安装方式暂按现行发布治理保留,只作为过渡分发、
|
|
45
|
+
历史审计和废弃诊断。作者工程统一只直接安装 SDK;两包提供同名 `bohr-widget`,同时安装时
|
|
46
|
+
不保证保留旧 CLI 身份。旧工程须移除 CLI、重新安装,并由 SDK `build` 重建 receipt 后再打包,
|
|
47
|
+
见[单 SDK 迁移步骤](https://dev.dp.tech/bohrium-widget-sdk/reference/versioning)。SDK 不回选旧执行器,
|
|
48
|
+
receipt 校验保持严格。
|
|
49
|
+
|
|
50
|
+
常用作者类型从本包根入口导入;完整协议从 `@dp-bohrium/widget-sdk/contracts` 导入,
|
|
51
|
+
编辑器 Schema 使用 `@dp-bohrium/widget-sdk/schemas/*.json`。作者无需直接安装 contracts,
|
|
52
|
+
配套协议版本由 SDK 和开发工具核对。Host/控制面也通过本包 `/contracts`、`/schemas/*.json`、
|
|
53
|
+
`/conformance/*` 消费协议,不加载作者 Runtime。直接依赖 contracts 的旧用法已废弃,
|
|
54
|
+
本轮统一入口切换发布 R1 前移除,见[迁移计划](https://dev.dp.tech/bohrium-widget-sdk/reference/versioning)。
|
|
37
55
|
|
|
38
56
|
在自己的 `package.json` 里钉死精确 SemVer,不要用 `^` 或裸 `latest`。SDK 运行时会从已安装
|
|
39
57
|
包自身读取版本,插件源码和 Manifest 不需要再次填写 SDK 版本。
|
|
@@ -101,7 +119,7 @@ Manifest 是插件的静态声明,SDK 代码是隔离 iframe 内的运行时
|
|
|
101
119
|
|
|
102
120
|
```json
|
|
103
121
|
{
|
|
104
|
-
"$schema": "@dp-bohrium/widget-
|
|
122
|
+
"$schema": "@dp-bohrium/widget-sdk/schemas/widget-plugin-manifest.schema.json",
|
|
105
123
|
"name": "research",
|
|
106
124
|
"version": "1.0.0",
|
|
107
125
|
"entry": "src/widget.ts",
|
|
@@ -150,8 +168,8 @@ Manifest 的 `contributes.widget` 决定;运行时代码只认识统一的 `co
|
|
|
150
168
|
`context.render`、`context.capabilities` 和 `context.ui`。首帧和后续快照通过
|
|
151
169
|
`renderContext.phase` 区分,不需要维护两套回调。
|
|
152
170
|
|
|
153
|
-
Manifest
|
|
154
|
-
|
|
171
|
+
Manifest 的编辑器提示来自本包 `/schemas` 的 JSON Schema 和公开 TypeScript 类型,
|
|
172
|
+
不依赖某个 `defineManifest` 工厂。构建工具调用
|
|
155
173
|
`compileWidgetPluginManifest`,自动补齐 `schemaVersion`、`hostApiVersion`、SDK 版本和
|
|
156
174
|
宿主加载字段;它会直接读取 Manifest 内的 `samples`,只有构建器从别处生成样例时
|
|
157
175
|
才需要传入第二个参数。`createWidgetClient` 是协议级基础实现,不属于 Widget 作者 API;当前根入口只提供统一 Widget API,协议级代码应从
|
|
@@ -159,19 +177,23 @@ TypeScript 类型,不依赖某个 `defineManifest` 工厂。构建工具调用
|
|
|
159
177
|
|
|
160
178
|
受信任的内部 Host/协议测试仍可直接构造低层 Tool Result RenderRequest,但该能力不属于外部作者清单或公共示例。
|
|
161
179
|
|
|
162
|
-
SDK 发布包会生成 `dist/index.d.ts`
|
|
180
|
+
SDK 发布包会生成 `dist/index.d.ts` 与各子入口声明,并通过 `package.json` 的
|
|
163
181
|
`types`/`exports` 暴露。插件安装 `@dp-bohrium/widget-sdk` 后,编辑器会直接获得
|
|
164
182
|
`WidgetContext`、事件名、能力请求、渲染请求和生命周期返回值的类型提示;Manifest
|
|
165
|
-
|
|
183
|
+
编辑器提示由本包的 `/schemas` 和声明文件提供,Schema 在构建时从协议唯一源生成。
|
|
166
184
|
|
|
167
185
|
## 包入口
|
|
168
186
|
|
|
169
187
|
| 入口 | 内容 | 用途 |
|
|
170
188
|
| --- | --- | --- |
|
|
171
|
-
| `.` | `runWidgetHost`、`compileWidgetPluginManifest`
|
|
189
|
+
| `.` | `runWidgetHost`、`compileWidgetPluginManifest` 和常用作者类型 | 生成的生产 Bundle |
|
|
190
|
+
| `./contracts` | 完整协议类型、事件目录与判定函数 | 高级协议集成;同名协议类型显式从此处获取 |
|
|
191
|
+
| `./conformance/*` | 同源协议校验语料 | Host/控制面验证 |
|
|
192
|
+
| `./schemas/*.json` | 作者清单、宿主清单、运行配置与消息 Schema | 编辑器提示和工具校验 |
|
|
172
193
|
| `./testing` | `MemoryTransport`、`MockWidgetHost` | 单元测试 |
|
|
173
194
|
| `./runtime` | 低层 `WidgetClient`、transport 与 bootstrap 常量 | 协议级集成 |
|
|
174
195
|
| `./package.json` | 已安装包的元数据 | SDK 和构建工具自动读取版本,作者无需复制版本字符串 |
|
|
196
|
+
| `bohr-widget` | Node.js 命令入口 | 创建、构建、校验、开发和打包工程;不进入浏览器 Bundle |
|
|
175
197
|
|
|
176
198
|
根入口只导出插件运行时和 Manifest 编译所需的少量值,其余均为类型。低层
|
|
177
199
|
`MessagePortTransport` 与 bootstrap 消息不属于普通 Widget API。
|
|
@@ -339,7 +361,7 @@ import { MockWidgetHost } from "@dp-bohrium/widget-sdk/testing";
|
|
|
339
361
|
本地等待,已发出的服务端读取可能完成,但结果被忽略。
|
|
340
362
|
- Host 发来畸形 Bridge 信封或载荷时,transport 报结构化 `MESSAGE_INVALID` 并关闭
|
|
341
363
|
连接,不会让 Widget 悬等。
|
|
342
|
-
- Schema
|
|
364
|
+
- contracts 维护 Schema 与类型的内部唯一事实源;使用者从 SDK 的 `/contracts` 与 `/schemas/*` 公开出口读取。
|
|
343
365
|
|
|
344
366
|
## 许可证
|
|
345
367
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Evgeny Poberezkin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
|
|
2
|
+
Copyright (c) 2021-present The Fastify team <https://github.com/fastify/fastify#team>
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
* Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer in the
|
|
11
|
+
documentation and/or other materials provided with the distribution.
|
|
12
|
+
* The names of any contributors may not be used to endorse or promote
|
|
13
|
+
products derived from this software without specific prior written
|
|
14
|
+
permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
|
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
23
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
+
|
|
27
|
+
* * *
|
|
28
|
+
|
|
29
|
+
The complete list of contributors can be found at:
|
|
30
|
+
- https://github.com/garycourt/uri-js/graphs/contributors
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Evgeny Poberezkin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DP Technology
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DP Technology
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "host-runtime-config.schema.json",
|
|
4
|
+
"description": "Host 为一次 Widget 运行签发并下发给 agent-widget 的运行时配置,不直接发给 Widget。",
|
|
5
|
+
"title": "Widget Host Runtime Config",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"schemaVersion",
|
|
10
|
+
"hostApiVersion",
|
|
11
|
+
"configId",
|
|
12
|
+
"runId",
|
|
13
|
+
"mode",
|
|
14
|
+
"issuedAt",
|
|
15
|
+
"expiresAt",
|
|
16
|
+
"recheckAt",
|
|
17
|
+
"securityProfile",
|
|
18
|
+
"resourceBudget",
|
|
19
|
+
"runtime",
|
|
20
|
+
"network",
|
|
21
|
+
"bindings"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"schemaVersion": { "const": 1 },
|
|
25
|
+
"hostApiVersion": { "const": 1 },
|
|
26
|
+
"configId": { "$ref": "#/$defs/Identifier" },
|
|
27
|
+
"hostId": { "$ref": "#/$defs/Identifier" },
|
|
28
|
+
"runId": { "$ref": "#/$defs/Identifier" },
|
|
29
|
+
"mode": { "$ref": "#/$defs/Mode" },
|
|
30
|
+
"issuedAt": { "$ref": "#/$defs/Timestamp" },
|
|
31
|
+
"expiresAt": { "$ref": "#/$defs/Timestamp" },
|
|
32
|
+
"recheckAt": { "$ref": "#/$defs/Timestamp" },
|
|
33
|
+
"securityProfile": { "const": "runtime-security-profile-v1" },
|
|
34
|
+
"resourceBudget": {
|
|
35
|
+
"$ref": "widget-runtime-contracts.schema.json#/$defs/ResourceBudget"
|
|
36
|
+
},
|
|
37
|
+
"runtime": { "$ref": "#/$defs/RuntimeAuthority" },
|
|
38
|
+
"network": { "$ref": "#/$defs/NetworkAuthority" },
|
|
39
|
+
"bindings": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"items": {
|
|
42
|
+
"oneOf": [
|
|
43
|
+
{ "$ref": "#/$defs/LoadableBinding" },
|
|
44
|
+
{ "$ref": "#/$defs/FallbackBinding" }
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"$defs": {
|
|
50
|
+
"LoadableBinding": {
|
|
51
|
+
"description": "可加载绑定:状态为 loadable,携带冻结版本、摘要、Manifest、启动地址与能力授权。",
|
|
52
|
+
"title": "LoadableBinding",
|
|
53
|
+
"type": "object",
|
|
54
|
+
"additionalProperties": false,
|
|
55
|
+
"required": [
|
|
56
|
+
"status",
|
|
57
|
+
"bindingId",
|
|
58
|
+
"widgetId",
|
|
59
|
+
"widgetVersionId",
|
|
60
|
+
"digest",
|
|
61
|
+
"manifest",
|
|
62
|
+
"launch",
|
|
63
|
+
"grantedCapabilities"
|
|
64
|
+
],
|
|
65
|
+
"properties": {
|
|
66
|
+
"status": { "const": "loadable" },
|
|
67
|
+
"bindingId": { "$ref": "#/$defs/Identifier" },
|
|
68
|
+
"widgetId": { "$ref": "#/$defs/Identifier" },
|
|
69
|
+
"widgetVersionId": { "$ref": "#/$defs/Identifier" },
|
|
70
|
+
"digest": { "$ref": "#/$defs/Digest" },
|
|
71
|
+
"trustClass": {
|
|
72
|
+
"description": "控制面确认的信任等级;作者不能自行声明。",
|
|
73
|
+
"enum": ["external", "first-party"]
|
|
74
|
+
},
|
|
75
|
+
"runtimeProfile": {
|
|
76
|
+
"description": "控制面选择的部署配置;不授予 Cookie 或 Token 读取权限。",
|
|
77
|
+
"enum": ["public-isolated", "first-party-private"]
|
|
78
|
+
},
|
|
79
|
+
"manifest": {
|
|
80
|
+
"$ref": "widget-manifest.schema.json"
|
|
81
|
+
},
|
|
82
|
+
"launch": { "$ref": "#/$defs/Launch" },
|
|
83
|
+
"grantedCapabilities": { "$ref": "#/$defs/GrantedCapabilities" },
|
|
84
|
+
"serviceAccess": { "$ref": "#/$defs/WidgetServiceAccess" },
|
|
85
|
+
"serviceAuthorization": { "$ref": "#/$defs/HostServiceAuthorization" }
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"HostServiceAuthorization": {
|
|
89
|
+
"title": "HostServiceAuthorization",
|
|
90
|
+
"description": "Host-only evidence bound to the exact reviewed Widget bundle and current user grant.",
|
|
91
|
+
"oneOf": [
|
|
92
|
+
{ "$ref": "#/$defs/HostServiceAuthorizationRequired" },
|
|
93
|
+
{ "$ref": "#/$defs/HostServiceAuthorizationGranted" }
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"HostServiceAuthorizationRequired": {
|
|
97
|
+
"description": "需用户授权的 Host 服务证据:状态为 authorization-required。",
|
|
98
|
+
"title": "HostServiceAuthorizationRequired",
|
|
99
|
+
"type": "object",
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"required": [
|
|
102
|
+
"kind",
|
|
103
|
+
"policy",
|
|
104
|
+
"status",
|
|
105
|
+
"hostId",
|
|
106
|
+
"widgetVersionId",
|
|
107
|
+
"bundleDigest",
|
|
108
|
+
"reviewRevision",
|
|
109
|
+
"reviewedPermissions",
|
|
110
|
+
"grantedPermissions",
|
|
111
|
+
"expiresAt"
|
|
112
|
+
],
|
|
113
|
+
"properties": {
|
|
114
|
+
"kind": { "const": "host-service-authorization" },
|
|
115
|
+
"policy": { "const": "host-user-data-v1" },
|
|
116
|
+
"status": { "const": "authorization-required" },
|
|
117
|
+
"hostId": { "$ref": "#/$defs/Identifier" },
|
|
118
|
+
"widgetVersionId": { "$ref": "#/$defs/Identifier" },
|
|
119
|
+
"bundleDigest": { "$ref": "#/$defs/Digest" },
|
|
120
|
+
"reviewRevision": { "$ref": "#/$defs/Identifier" },
|
|
121
|
+
"reviewedPermissions": {
|
|
122
|
+
"$ref": "widget-manifest.schema.json#/$defs/HostUserPermissions"
|
|
123
|
+
},
|
|
124
|
+
"grantedPermissions": {
|
|
125
|
+
"type": "array",
|
|
126
|
+
"maxItems": 0
|
|
127
|
+
},
|
|
128
|
+
"expiresAt": { "$ref": "#/$defs/Timestamp" }
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"HostServiceAuthorizationGranted": {
|
|
132
|
+
"description": "已授予的 Host 服务证据:状态为 granted。",
|
|
133
|
+
"title": "HostServiceAuthorizationGranted",
|
|
134
|
+
"type": "object",
|
|
135
|
+
"additionalProperties": false,
|
|
136
|
+
"required": [
|
|
137
|
+
"kind",
|
|
138
|
+
"policy",
|
|
139
|
+
"status",
|
|
140
|
+
"hostId",
|
|
141
|
+
"widgetVersionId",
|
|
142
|
+
"bundleDigest",
|
|
143
|
+
"reviewRevision",
|
|
144
|
+
"grantRevision",
|
|
145
|
+
"reviewedPermissions",
|
|
146
|
+
"grantedPermissions",
|
|
147
|
+
"expiresAt"
|
|
148
|
+
],
|
|
149
|
+
"properties": {
|
|
150
|
+
"kind": { "const": "host-service-authorization" },
|
|
151
|
+
"policy": { "const": "host-user-data-v1" },
|
|
152
|
+
"status": { "const": "granted" },
|
|
153
|
+
"hostId": { "$ref": "#/$defs/Identifier" },
|
|
154
|
+
"widgetVersionId": { "$ref": "#/$defs/Identifier" },
|
|
155
|
+
"bundleDigest": { "$ref": "#/$defs/Digest" },
|
|
156
|
+
"reviewRevision": { "$ref": "#/$defs/Identifier" },
|
|
157
|
+
"grantRevision": { "$ref": "#/$defs/Identifier" },
|
|
158
|
+
"reviewedPermissions": {
|
|
159
|
+
"$ref": "widget-manifest.schema.json#/$defs/HostUserPermissions"
|
|
160
|
+
},
|
|
161
|
+
"grantedPermissions": {
|
|
162
|
+
"$ref": "widget-manifest.schema.json#/$defs/HostUserPermissions"
|
|
163
|
+
},
|
|
164
|
+
"expiresAt": { "$ref": "#/$defs/Timestamp" }
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"FallbackBinding": {
|
|
168
|
+
"description": "降级绑定:状态为 fallback,不含 Bundle 地址、摘要、Manifest 或能力授权。",
|
|
169
|
+
"title": "FallbackBinding",
|
|
170
|
+
"type": "object",
|
|
171
|
+
"additionalProperties": false,
|
|
172
|
+
"required": [
|
|
173
|
+
"status",
|
|
174
|
+
"bindingId",
|
|
175
|
+
"widgetId",
|
|
176
|
+
"widgetVersionId",
|
|
177
|
+
"contribution",
|
|
178
|
+
"reason"
|
|
179
|
+
],
|
|
180
|
+
"properties": {
|
|
181
|
+
"status": { "const": "fallback" },
|
|
182
|
+
"bindingId": { "$ref": "#/$defs/Identifier" },
|
|
183
|
+
"widgetId": { "$ref": "#/$defs/Identifier" },
|
|
184
|
+
"widgetVersionId": { "$ref": "#/$defs/Identifier" },
|
|
185
|
+
"contribution": {
|
|
186
|
+
"$ref": "widget-manifest.schema.json#/$defs/WidgetContributionConfig"
|
|
187
|
+
},
|
|
188
|
+
"reason": { "$ref": "#/$defs/FallbackReason" }
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"RuntimeAuthority": {
|
|
192
|
+
"description": "运行域授权:origin 与 catalogRevision。",
|
|
193
|
+
"title": "RuntimeAuthority",
|
|
194
|
+
"type": "object",
|
|
195
|
+
"additionalProperties": false,
|
|
196
|
+
"required": ["origin", "catalogRevision"],
|
|
197
|
+
"properties": {
|
|
198
|
+
"origin": { "$ref": "#/$defs/RuntimeOrigin" },
|
|
199
|
+
"catalogRevision": {
|
|
200
|
+
"type": "string",
|
|
201
|
+
"minLength": 1,
|
|
202
|
+
"maxLength": 128,
|
|
203
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
|
|
204
|
+
},
|
|
205
|
+
"profile": {
|
|
206
|
+
"enum": ["public-isolated", "first-party-private"]
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"NetworkAuthority": {
|
|
211
|
+
"description": "网络授权:mode、policyVersion 与限制。",
|
|
212
|
+
"title": "NetworkAuthority",
|
|
213
|
+
"type": "object",
|
|
214
|
+
"additionalProperties": false,
|
|
215
|
+
"required": ["mode", "policyVersion", "limits"],
|
|
216
|
+
"properties": {
|
|
217
|
+
"mode": { "enum": ["runtime-consent", "unavailable"] },
|
|
218
|
+
"policyVersion": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"minLength": 1,
|
|
221
|
+
"maxLength": 128,
|
|
222
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
|
|
223
|
+
},
|
|
224
|
+
"limits": {
|
|
225
|
+
"$ref": "widget-runtime-contracts.schema.json#/$defs/WidgetNetworkLimits"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"GrantedCapabilities": {
|
|
230
|
+
"description": "已授予能力列表。",
|
|
231
|
+
"title": "GrantedCapabilities",
|
|
232
|
+
"type": "array",
|
|
233
|
+
"items": {
|
|
234
|
+
"$ref": "widget-runtime-contracts.schema.json#/$defs/GrantedCapability"
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"Launch": {
|
|
238
|
+
"description": "一次性启动地址与有效期。",
|
|
239
|
+
"title": "Launch",
|
|
240
|
+
"type": "object",
|
|
241
|
+
"additionalProperties": false,
|
|
242
|
+
"required": ["url", "expiresAt"],
|
|
243
|
+
"properties": {
|
|
244
|
+
"url": { "type": "string", "pattern": "^https?://" },
|
|
245
|
+
"expiresAt": { "$ref": "#/$defs/Timestamp" }
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"RuntimeOrigin": {
|
|
249
|
+
"description": "隔离域运行源地址。",
|
|
250
|
+
"title": "RuntimeOrigin",
|
|
251
|
+
"type": "string",
|
|
252
|
+
"maxLength": 253,
|
|
253
|
+
"pattern": "^(?:https://[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::[0-9]{1,5})?|http://(?:localhost|127\\.0\\.0\\.1|\\[::1\\])(?::[0-9]{1,5})?)$"
|
|
254
|
+
},
|
|
255
|
+
"FallbackReason": {
|
|
256
|
+
"description": "降级原因枚举。",
|
|
257
|
+
"title": "FallbackReason",
|
|
258
|
+
"enum": [
|
|
259
|
+
"not-authorized",
|
|
260
|
+
"not-approved",
|
|
261
|
+
"delisted-for-new-use",
|
|
262
|
+
"revoked",
|
|
263
|
+
"host-api-unsupported",
|
|
264
|
+
"preview-not-allowed"
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
"Digest": {
|
|
268
|
+
"description": "内容摘要;形如 sha256:<hex>。",
|
|
269
|
+
"title": "Digest",
|
|
270
|
+
"type": "string",
|
|
271
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
272
|
+
},
|
|
273
|
+
"Identifier": {
|
|
274
|
+
"description": "不透明标识符。",
|
|
275
|
+
"title": "Identifier",
|
|
276
|
+
"type": "string",
|
|
277
|
+
"minLength": 1
|
|
278
|
+
},
|
|
279
|
+
"Mode": {
|
|
280
|
+
"description": "运行模式:preview 或 published。",
|
|
281
|
+
"title": "Mode",
|
|
282
|
+
"enum": ["preview", "published"]
|
|
283
|
+
},
|
|
284
|
+
"Timestamp": {
|
|
285
|
+
"description": "UTC 时间戳:YYYY-MM-DD + T + 非空格字符,以 Z 结尾。",
|
|
286
|
+
"title": "Timestamp",
|
|
287
|
+
"type": "string",
|
|
288
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}T[^ ]+Z$"
|
|
289
|
+
},
|
|
290
|
+
"WidgetServiceAccess": {
|
|
291
|
+
"title": "WidgetServiceAccess",
|
|
292
|
+
"description": "绑定当前不可变版本与摘要的审核投影;服务端每次调用仍须复核撤销和用户权限。",
|
|
293
|
+
"type": "object",
|
|
294
|
+
"additionalProperties": false,
|
|
295
|
+
"required": ["approvalId", "revision", "appId", "policyVersion", "expiresAt"],
|
|
296
|
+
"properties": {
|
|
297
|
+
"approvalId": { "$ref": "#/$defs/Identifier" },
|
|
298
|
+
"revision": { "$ref": "#/$defs/Identifier" },
|
|
299
|
+
"appId": { "$ref": "#/$defs/Identifier" },
|
|
300
|
+
"policyVersion": { "$ref": "#/$defs/Identifier" },
|
|
301
|
+
"expiresAt": { "$ref": "#/$defs/Timestamp" }
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|