@dp-bohrium/widget-contracts 0.0.1

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.
Files changed (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -0
  3. package/conformance/bridge/capability-request.json +23 -0
  4. package/conformance/bridge/network-fetch-denied.json +16 -0
  5. package/conformance/bridge/network-fetch-request.json +19 -0
  6. package/conformance/bridge/network-fetch-success.json +22 -0
  7. package/conformance/bridge/presentation-change-surface-request.json +14 -0
  8. package/conformance/bridge/presentation-close-request.json +14 -0
  9. package/conformance/bridge/presentation-close-success.json +11 -0
  10. package/conformance/bridge/presentation-downgrade-success.json +14 -0
  11. package/conformance/bridge/presentation-focus-backward-request.json +14 -0
  12. package/conformance/bridge/presentation-focus-boundary-success.json +14 -0
  13. package/conformance/bridge/presentation-focus-forward-request.json +14 -0
  14. package/conformance/bridge/presentation-init.json +70 -0
  15. package/conformance/bridge/presentation-policy-denied.json +16 -0
  16. package/conformance/bridge/presentation-present-request.json +14 -0
  17. package/conformance/bridge/presentation-user-denied.json +16 -0
  18. package/conformance/bridge/ready.json +11 -0
  19. package/conformance/bundles/minimal-file-preview/entry.js +1 -0
  20. package/conformance/bundles/minimal-file-preview/manifest.json +12 -0
  21. package/conformance/bundles/minimal-file-preview/samples/file-preview.json +1 -0
  22. package/conformance/bundles/minimal-panel/entry.js +1 -0
  23. package/conformance/bundles/minimal-panel/manifest.json +11 -0
  24. package/conformance/bundles/minimal-panel/samples/panel.json +1 -0
  25. package/conformance/bundles/minimal-tool-result/entry.js +1 -0
  26. package/conformance/bundles/minimal-tool-result/manifest.json +11 -0
  27. package/conformance/bundles/minimal-tool-result/samples/tool-result.json +1 -0
  28. package/conformance/file-responses/list.json +1 -0
  29. package/conformance/file-responses/metadata.json +11 -0
  30. package/conformance/file-responses/permission-denied.json +6 -0
  31. package/conformance/file-responses/resource-limit.json +1 -0
  32. package/conformance/file-responses/text-content.json +1 -0
  33. package/conformance/host-runtime-config/invalid-missing-manifest-fields.json +55 -0
  34. package/conformance/host-runtime-config/invalid-static-origins.json +60 -0
  35. package/conformance/host-runtime-config/valid.json +85 -0
  36. package/conformance/invalid-bridge-messages/network-fetch-mixed-case-forbidden-header.json +21 -0
  37. package/conformance/invalid-manifests/missing-target.json +11 -0
  38. package/conformance/invalid-manifests/presentation-duplicate-surfaces.json +16 -0
  39. package/conformance/invalid-manifests/presentation-empty-surfaces.json +14 -0
  40. package/conformance/invalid-manifests/presentation-unknown-surface.json +16 -0
  41. package/conformance/invalid-manifests/unknown-field.json +12 -0
  42. package/conformance/invalid-network-requests/mixed-case-forbidden-header.json +11 -0
  43. package/conformance/invalid-presentation-grants/duplicate-surfaces.json +5 -0
  44. package/conformance/invalid-presentation-grants/empty-surfaces.json +5 -0
  45. package/conformance/invalid-presentation-grants/false-confirmation.json +5 -0
  46. package/conformance/invalid-presentation-grants/missing-confirmation.json +4 -0
  47. package/conformance/invalid-presentation-grants/unknown-surface.json +5 -0
  48. package/conformance/invalid-presentation-requests/change-surface-missing-surface.json +4 -0
  49. package/conformance/invalid-presentation-requests/close-with-surface.json +4 -0
  50. package/conformance/invalid-presentation-requests/focus-boundary-missing-direction.json +4 -0
  51. package/conformance/invalid-presentation-requests/focus-boundary-unknown-direction.json +4 -0
  52. package/conformance/invalid-presentation-requests/focus-boundary-with-coordinates.json +9 -0
  53. package/conformance/invalid-presentation-requests/focus-boundary-with-event-provenance.json +8 -0
  54. package/conformance/invalid-presentation-requests/focus-boundary-with-generation.json +8 -0
  55. package/conformance/invalid-presentation-requests/focus-boundary-with-identity.json +12 -0
  56. package/conformance/invalid-presentation-requests/focus-boundary-with-key.json +8 -0
  57. package/conformance/invalid-presentation-requests/focus-boundary-with-modifiers.json +11 -0
  58. package/conformance/invalid-presentation-requests/focus-boundary-with-selector.json +8 -0
  59. package/conformance/invalid-presentation-requests/focus-boundary-with-surface.json +8 -0
  60. package/conformance/invalid-presentation-requests/focus-boundary-with-target.json +8 -0
  61. package/conformance/invalid-presentation-requests/focus-boundary-with-timestamp.json +8 -0
  62. package/conformance/invalid-presentation-requests/focus-boundary-with-z-index.json +8 -0
  63. package/conformance/invalid-presentation-requests/present-missing-surface.json +4 -0
  64. package/conformance/invalid-presentation-requests/unknown-surface.json +4 -0
  65. package/conformance/invalid-presentation-requests/widget-controls-coordinates.json +9 -0
  66. package/conformance/invalid-presentation-requests/widget-controls-geometry.json +8 -0
  67. package/conformance/invalid-presentation-requests/widget-controls-instance-id.json +8 -0
  68. package/conformance/invalid-presentation-requests/widget-controls-principal.json +8 -0
  69. package/conformance/invalid-presentation-requests/widget-controls-run-id.json +4 -0
  70. package/conformance/invalid-presentation-requests/widget-controls-widget-id.json +8 -0
  71. package/conformance/invalid-presentation-requests/widget-controls-widget-version-id.json +8 -0
  72. package/conformance/invalid-presentation-requests/widget-controls-z-index.json +4 -0
  73. package/conformance/invalid-render-inputs/malformed.json +17 -0
  74. package/conformance/manifests/valid-file-preview.json +12 -0
  75. package/conformance/manifests/valid-network.json +15 -0
  76. package/conformance/manifests/valid-panel.json +11 -0
  77. package/conformance/manifests/valid-presentation-panel.json +21 -0
  78. package/conformance/manifests/valid-tool-result.json +14 -0
  79. package/conformance/render-inputs/compatibility/literature-search-paper-results.json +75 -0
  80. package/conformance/render-inputs/compatibility/scientific-bibliography-bibtex.json +10 -0
  81. package/conformance/render-inputs/compatibility/scientific-dataset-csv.json +10 -0
  82. package/conformance/render-inputs/compatibility/scientific-manuscript-latex.json +10 -0
  83. package/conformance/render-inputs/compatibility/scientific-manuscript-markdown.json +10 -0
  84. package/conformance/render-inputs/compatibility/scientific-molecule-mol.json +10 -0
  85. package/conformance/render-inputs/compatibility/scientific-molecule-mol2.json +10 -0
  86. package/conformance/render-inputs/compatibility/scientific-notebook-ipynb.json +10 -0
  87. package/conformance/render-inputs/compatibility/scientific-paper-pdf.json +10 -0
  88. package/conformance/render-inputs/compatibility/scientific-protein-pdb.json +10 -0
  89. package/conformance/render-inputs/compatibility/scientific-source-python.json +10 -0
  90. package/conformance/render-inputs/compatibility/scientific-structure-cif.json +47 -0
  91. package/conformance/render-inputs/compatibility/scientific-structure-poscar.json +10 -0
  92. package/conformance/render-inputs/compatibility/scientific-structure-stru.json +10 -0
  93. package/conformance/render-inputs/compatibility/scientific-trajectory-xyz.json +10 -0
  94. package/conformance/render-inputs/compatibility/thinking-process-paper-search.json +25 -0
  95. package/conformance/render-inputs/compatibility/thinking-process-scholar-search.json +25 -0
  96. package/conformance/render-inputs/compatibility/thinking-process-web-search.json +25 -0
  97. package/conformance/render-inputs/compatibility/workspace-file-search.json +24 -0
  98. package/conformance/render-inputs/compatibility/workspace-file-tree.json +24 -0
  99. package/conformance/render-inputs/empty.json +10 -0
  100. package/conformance/render-inputs/file-preview.json +10 -0
  101. package/conformance/render-inputs/incremental-update.json +10 -0
  102. package/conformance/render-inputs/large.json +10 -0
  103. package/conformance/render-inputs/malformed.json +1 -0
  104. package/conformance/render-inputs/panel.json +10 -0
  105. package/conformance/render-inputs/partial-state-full-snapshot.json +40 -0
  106. package/conformance/render-inputs/tool-result.json +10 -0
  107. package/dist/generated-host-runtime-config.d.ts +246 -0
  108. package/dist/generated-host-runtime-config.js +3 -0
  109. package/dist/generated-manifest.d.ts +86 -0
  110. package/dist/generated-manifest.js +3 -0
  111. package/dist/generated-runtime-contracts.d.ts +401 -0
  112. package/dist/generated-runtime-contracts.js +3 -0
  113. package/dist/index.d.ts +22 -0
  114. package/dist/index.js +2 -0
  115. package/package.json +55 -0
  116. package/schemas/host-runtime-config.schema.json +185 -0
  117. package/schemas/widget-manifest.schema.json +227 -0
  118. package/schemas/widget-runtime-contracts.schema.json +1478 -0
package/LICENSE ADDED
@@ -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.
package/README.md ADDED
@@ -0,0 +1,190 @@
1
+ # @dp-bohrium/widget-contracts
2
+
3
+ Bohrium Widget Platform 的跨仓共享 Contract 包。它是 Manifest、Host
4
+ Runtime Config、Runtime Bridge 消息及其相关类型的唯一事实源,供 Shrimp、
5
+ Host Runtime、SDK Runtime 和 Widget 工具链共同消费。
6
+
7
+ 本包只提供版本化 JSON Schema、由 Schema 生成的 TypeScript 类型和
8
+ conformance fixtures,不提供生产 Runtime、AJV validator 或 Widget UI。
9
+
10
+ ## 安装
11
+
12
+ 当前版本从 Bohrium 内部 npm Registry 安装,并建议固定到明确版本:
13
+
14
+ ```bash
15
+ pnpm add @dp-bohrium/widget-contracts@0.0.1 \
16
+ --registry=https://registry.npmjs.org
17
+ ```
18
+
19
+ 运行环境要求 Node.js 20 或更高版本。
20
+
21
+ ## TypeScript 类型
22
+
23
+ 包的根入口是纯类型入口,运行时不会导出值,因此需要使用 `import type`:
24
+
25
+ ```ts
26
+ import type {
27
+ HostToWidgetMessage,
28
+ RenderRequest,
29
+ WidgetHostRuntimeConfig,
30
+ WidgetManifest,
31
+ WidgetToHostMessage,
32
+ } from "@dp-bohrium/widget-contracts";
33
+
34
+ function handleRender(request: RenderRequest) {
35
+ // request.slot 与 request.content.slot 保持类型级别的一致性。
36
+ return request.slot;
37
+ }
38
+ ```
39
+
40
+ 主要导出包括:
41
+
42
+ - `WidgetManifest`:Widget bundle 的 Manifest;
43
+ - `WidgetHostRuntimeConfig`:Shrimp 为一次运行解析出的 Host Runtime Config;
44
+ - `RenderRequest`:`tool-result`、`file-preview` 和 `panel` 三种 Slot 的渲染请求;
45
+ - `HostToWidgetMessage` / `WidgetToHostMessage`:双向 Bridge 消息联合类型;
46
+ - `CapabilityRequest` / `CapabilityResult`:能力请求与结果;
47
+ - `WidgetError`、`ResourceBudget` 以及相关的主题、文件和渲染上下文类型。
48
+
49
+ 开发期只维护一套当前 Contract:`WidgetManifest` 与
50
+ `WidgetHostRuntimeConfig` 均使用 `schemaVersion: 1` 和
51
+ `hostApiVersion: 1`。未知版本必须拒绝;当前字段发生破坏性调整时,所有 prerelease
52
+ 消费者随同升级,不维护并行的旧版 reader。
53
+
54
+ ## Host 托管网络能力
55
+
56
+ 当前 Host API 提供 `network.fetch`。Widget 只通过 Bridge 发送结构化请求,实际
57
+ 网络访问、运行时授权弹窗、策略执行和凭据注入均由 Host 侧 provider 负责:
58
+
59
+ - Manifest 使用 `requestedCapabilities.network.fetch: true` 声明需求;
60
+ - Host Runtime Config 用 `network` 下发策略版本和预算,并在 binding 中授予
61
+ `network.fetch`;
62
+ - Widget 只声明 `auth: none | optional | required`;凭据标识、凭据值、Authorization
63
+ header 和 Vault 内容均不得进入 iframe 或 Bridge;
64
+ - Widget 请求头大小写不敏感地拒绝 `Authorization`、`Cookie`、
65
+ `Proxy-Authorization`、`X-Api-Key`,以及 `Api-Key`、`X-Auth-Token`、
66
+ `X-Access-Token`、`Credential-Binding-Id`、`X-Credential-Binding-Id` 等价名称;
67
+ 请求头和响应头由不同 Schema authority 管理,响应头的结构合法不代表 Host 可以回传敏感信息;
68
+ - 公网 HTTPS 可以使用契约支持的方法;公网 HTTP 仅允许无正文、无凭据的 GET/HEAD,
69
+ 以兼容仍未提供 HTTPS 的学术站点;私网地址、跨 Origin 重定向和超限请求由
70
+ Host/Broker 拒绝;
71
+ - `runtime.origin` 与 `catalogRevision` 由 Host Config 注入,消费者不得写死
72
+ 当前 Runtime 域名。
73
+
74
+ `network.fetch` 只定义 Widget/Host 间的结构化能力契约,不让 Widget Runtime 依赖
75
+ Agent Widget。默认 provider、无头授权控制器和复用 Agent Widget primitives 的默认弹窗
76
+ 由 Host 组合;Host 也可以替换 presenter 或整个 provider,因此无需新增独立设计系统。
77
+
78
+ ## JSON Schema
79
+
80
+ Schema 文件通过包的子路径导出,可交给 AJV 或其他 JSON Schema 2020-12
81
+ 实现校验:
82
+
83
+ | 文件 | 责任 | 主要消费者 |
84
+ | --- | --- | --- |
85
+ | `schemas/widget-manifest.schema.json` | bundle 名称、入口、Slot、能力申请和样例 | 上传与管理侧 |
86
+ | `schemas/host-runtime-config.schema.json` | Shrimp 为一次运行选择的版本、Digest、授权和资源配置 | Host Runtime |
87
+ | `schemas/widget-runtime-contracts.schema.json` | iframe 启动后的 Bridge、Render、Capability、Error 和资源预算消息 | SDK Runtime / Host Runtime |
88
+
89
+ 例如,在支持 JSON module import 的 ESM 工程中:
90
+
91
+ ```ts
92
+ import manifestSchema from
93
+ "@dp-bohrium/widget-contracts/schemas/widget-manifest.schema.json" with {
94
+ type: "json",
95
+ };
96
+ ```
97
+
98
+ Schema 的 `$id` 使用包内相对标识(例如 `widget-manifest.schema.json`),**不是**可联网拉取的 URL。
99
+ 依赖方必须从已安装的 `@dp-bohrium/widget-contracts/schemas/*.json` 本地加载并按 `$id` 注册,再解析 `$ref`;不要假设校验器会访问网络。
100
+
101
+ 公开探测版从 `0.0.1` 起发布到 npmjs(`@dp-bohrium`)。历史内部 prerelease
102
+ (`0.1.0-alpha.*`)曾去掉 schema 文件名的 `.v1` 后缀、增加 Host 托管网络与
103
+ Panel 能力,并移除静态 `outboundOrigins`;那些变更已并入当前 Contract。
104
+
105
+ `host-runtime-config.schema.json` 通过包内 `$id`/`$ref` 指向 Manifest 与 Runtime
106
+ Schema。跨语言消费者必须先从已安装的 schema 文件注册这两个 `$id`,再编译
107
+ Host Runtime Config;不能假设校验器会访问网络获取 `$ref`。
108
+
109
+ ## Conformance fixtures
110
+
111
+ `conformance/` 与 Schema 一起发布,作为跨语言、跨仓实现的固定测试输入,
112
+ 不是另一套协议定义:
113
+
114
+ ```text
115
+ conformance/
116
+ ├── manifests/ # 合法 Manifest
117
+ ├── host-runtime-config/ # 合法/非法 Host Runtime Config
118
+ ├── render-inputs/ # 三种 Slot 的渲染请求及增量更新
119
+ ├── bridge/ # Bridge 消息样例
120
+ ├── file-responses/ # 文件能力响应样例
121
+ ├── invalid-network-requests/ # 必须拒绝的 network.fetch 请求
122
+ ├── invalid-bridge-messages/ # 必须拒绝的完整 Bridge 消息
123
+ ├── invalid-presentation-grants/ # 必须拒绝的展示授权
124
+ ├── invalid-presentation-requests/ # 必须拒绝的展示请求
125
+ └── invalid-* # 必须被拒绝的输入
126
+ ```
127
+
128
+ 展示能力的公开语料包含申请 `floating` 与 `overlay` 的
129
+ `manifests/valid-presentation-panel.json`、带 `ui.presentation` grant 的 init
130
+ 消息、`present` / `change-surface` / `close` 请求、两个方向的
131
+ `focus-boundary` 请求,以及降级成功、关闭成功、焦点边界成功、策略拒绝和用户拒绝结果。原有
132
+ `manifests/valid-panel.json` 刻意不申请展示能力,用于证明历史 Panel Manifest 仍兼容。
133
+ 对应的 invalid fixtures 分别拒绝空、重复或未知 surface,错误的确认标记,缺失或多余
134
+ surface,以及 Widget 提交的坐标、geometry、z-index 和运行/Widget 身份字段。
135
+ `focus-boundary` 只携带 `forward | backward`,严格拒绝 surface、目标/选择器、
136
+ 身份、runtime generation、坐标、层级、时间戳、按键/修饰键和 `isTrusted` 等事件来源字段。
137
+ 它和 `close` 都只是当前 MessageChannel 上的 Widget UX 请求;MessageChannel 只能标识
138
+ iframe 实例,不能证明物理按键或用户激活,最终授权与焦点目标始终由 Host 决定。
139
+
140
+ 需要读取 fixture 时可使用包导出的子路径,例如:
141
+
142
+ ```ts
143
+ const fixture = await import(
144
+ "@dp-bohrium/widget-contracts/conformance/manifests/valid-panel.json",
145
+ { with: { type: "json" } },
146
+ );
147
+ ```
148
+
149
+ ## 边界和版本约定
150
+
151
+ - `host-runtime-config.schema.json` 是 Shrimp 与 Host Runtime 之间的配置
152
+ Contract,不是 Widget 收到的 Bridge 消息;Host Runtime 只将必要视图通过
153
+ `init` 消息传给 Widget。
154
+ - 本包不实现 Runtime 行为,也不负责权限执行、iframe 隔离、CSP、资源治理
155
+ 或 fallback/revoke。
156
+ - Schema/validator 只负责结构和协议形状校验,不等于 Host Runtime 的安全策略
157
+ 决策。Host 必须另外校验时间顺序、隔离域、凭据和 query、Origin 规范化、
158
+ Manifest/审核/运行授权交集,以及 DNS/SSRF 等运行时策略。
159
+ - 凭据 binding 属于 Host provider 私有上下文;`credentialBindingId`、
160
+ `credentialValue` 和 Host 场景上下文都不是 Widget wire 字段。
161
+ - Schema 的 `schemaVersion` 与 Bridge 的 `protocolVersion` 属于协议版本;
162
+ 包版本使用 SemVer。新增兼容字段必须同时更新 Schema、生成类型、
163
+ fixtures 和 conformance 测试。
164
+ - 协议版本只由载荷里的 `schemaVersion`、`hostApiVersion`、`protocolVersion` 和
165
+ `resourceBudget.version` 承载,不进 schema 文件名或 `$id`。在进入稳定发布前,
166
+ Contract 只有一套当前定义;如需破坏性调整,直接更新 prerelease 消费者,不创建
167
+ V1/V2 sibling 或 `<name>.v2.schema.json`。
168
+ - 类型由仓库根目录的生成脚本维护,不应直接编辑 `src/generated-*.ts`。
169
+
170
+ ## 仓库开发
171
+
172
+ 在 `bohrium-widget-sdk` monorepo 中运行:
173
+
174
+ ```bash
175
+ pnpm --filter @dp-bohrium/widget-contracts generate:types
176
+ pnpm --filter @dp-bohrium/widget-contracts schema:check
177
+ pnpm --filter @dp-bohrium/widget-contracts typecheck
178
+ pnpm --filter @dp-bohrium/widget-contracts test
179
+ pnpm --filter @dp-bohrium/widget-contracts build
180
+ ```
181
+
182
+ 详细的协议设计见
183
+ [`docs/design/widget-contract-v1.md`](../../docs/design/widget-contract-v1.md)。
184
+
185
+ ## 发布状态
186
+
187
+ 当前 package metadata 配置为 Bohrium 内部受限 prerelease:Registry 为
188
+ `https://registry.npmjs.org/`、访问级别为 `public`、许可证为 `MIT`。
189
+ 如果未来要发布到公开 npm Registry,必须先同步确认许可证、访问级别、
190
+ Registry 和 CI 发布规则,再更新本 README 与 package metadata。
@@ -0,0 +1,23 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "widget-capability-1",
5
+ "sequence": 2,
6
+ "type": "capability-request",
7
+ "payload": {
8
+ "requestId": "capability-1",
9
+ "request": {
10
+ "operation": "files.read",
11
+ "input": {
12
+ "file": {
13
+ "id": "file-001",
14
+ "kind": "file",
15
+ "name": "result.txt"
16
+ },
17
+ "offset": 0,
18
+ "length": 1024,
19
+ "encoding": "utf8"
20
+ }
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "host-network-denied-1",
5
+ "sequence": 4,
6
+ "type": "capability-result",
7
+ "payload": {
8
+ "requestId": "network-request-1",
9
+ "result": {
10
+ "ok": false,
11
+ "reason": "network-consent-denied",
12
+ "message": "Network access was not authorized",
13
+ "retryable": false
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "widget-network-request-1",
5
+ "sequence": 3,
6
+ "type": "capability-request",
7
+ "payload": {
8
+ "requestId": "network-request-1",
9
+ "request": {
10
+ "operation": "network.fetch",
11
+ "input": {
12
+ "url": "https://api.example.test/v1/items?query=water",
13
+ "auth": "required",
14
+ "method": "GET",
15
+ "redirect": "follow"
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "host-network-success-1",
5
+ "sequence": 4,
6
+ "type": "capability-result",
7
+ "payload": {
8
+ "requestId": "network-request-1",
9
+ "result": {
10
+ "ok": true,
11
+ "data": {
12
+ "status": 200,
13
+ "statusText": "OK",
14
+ "headers": { "content-type": "application/json" },
15
+ "body": "{\"items\":[]}",
16
+ "bodyEncoding": "utf8",
17
+ "finalUrl": "https://api.example.test/v1/items?query=water",
18
+ "redirected": false
19
+ }
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "widget-presentation-change-1",
5
+ "sequence": 3,
6
+ "type": "capability-request",
7
+ "payload": {
8
+ "requestId": "presentation-change-1",
9
+ "request": {
10
+ "operation": "ui.presentation",
11
+ "input": { "action": "change-surface", "surface": "floating" }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "widget-presentation-close-1",
5
+ "sequence": 4,
6
+ "type": "capability-request",
7
+ "payload": {
8
+ "requestId": "presentation-close-1",
9
+ "request": {
10
+ "operation": "ui.presentation",
11
+ "input": { "action": "close" }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "host-presentation-close-1",
5
+ "sequence": 6,
6
+ "type": "capability-result",
7
+ "payload": {
8
+ "requestId": "presentation-close-1",
9
+ "result": { "ok": true, "data": { "action": "close" } }
10
+ }
11
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "host-presentation-downgrade-1",
5
+ "sequence": 5,
6
+ "type": "capability-result",
7
+ "payload": {
8
+ "requestId": "presentation-present-1",
9
+ "result": {
10
+ "ok": true,
11
+ "data": { "action": "present", "surface": "workspace" }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "widget-presentation-focus-backward-1",
5
+ "sequence": 8,
6
+ "type": "capability-request",
7
+ "payload": {
8
+ "requestId": "presentation-focus-backward-1",
9
+ "request": {
10
+ "operation": "ui.presentation",
11
+ "input": { "action": "focus-boundary", "direction": "backward" }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "host-presentation-focus-boundary-1",
5
+ "sequence": 9,
6
+ "type": "capability-result",
7
+ "payload": {
8
+ "requestId": "presentation-focus-forward-1",
9
+ "result": {
10
+ "ok": true,
11
+ "data": { "action": "focus-boundary", "direction": "forward" }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "widget-presentation-focus-forward-1",
5
+ "sequence": 7,
6
+ "type": "capability-request",
7
+ "payload": {
8
+ "requestId": "presentation-focus-forward-1",
9
+ "request": {
10
+ "operation": "ui.presentation",
11
+ "input": { "action": "focus-boundary", "direction": "forward" }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "host-presentation-init-1",
5
+ "sequence": 1,
6
+ "type": "init",
7
+ "payload": {
8
+ "instanceId": "presentation-instance-1",
9
+ "locale": "en-US",
10
+ "theme": {
11
+ "mode": "light",
12
+ "tokens": {
13
+ "background": "#ffffff",
14
+ "foreground": "#111111",
15
+ "muted": "#eeeeee",
16
+ "mutedForeground": "#666666",
17
+ "border": "#dddddd",
18
+ "primary": "#0066cc",
19
+ "danger": "#cc0000"
20
+ }
21
+ },
22
+ "capabilities": [
23
+ {
24
+ "name": "ui.presentation",
25
+ "surfaces": ["floating", "overlay"],
26
+ "requiresHostConfirmation": true
27
+ }
28
+ ],
29
+ "resourceBudget": {
30
+ "version": 1,
31
+ "bundle": {
32
+ "compressedBytes": 1,
33
+ "expandedBytes": 1,
34
+ "fileCount": 1,
35
+ "singleFileBytes": 1
36
+ },
37
+ "bridge": {
38
+ "messageBytes": 1,
39
+ "messagesPerSecond": 1,
40
+ "pendingRequests": 1
41
+ },
42
+ "files": {
43
+ "readBytesPerRequest": 1,
44
+ "readBytesPerRun": 1,
45
+ "callsPerMinute": 1,
46
+ "listPageSize": 1
47
+ },
48
+ "timeouts": {
49
+ "bundleLoadMs": 1,
50
+ "handshakeMs": 1,
51
+ "firstRenderMs": 1,
52
+ "updateMs": 1,
53
+ "capabilityMs": 1,
54
+ "disposeGraceMs": 1
55
+ },
56
+ "concurrency": {
57
+ "activeIframesPerPage": 1,
58
+ "activeIframesPerRun": 1,
59
+ "hiddenRecycleMs": 1
60
+ },
61
+ "retry": {
62
+ "maxAttempts": 1,
63
+ "initialDelayMs": 1,
64
+ "maxDelayMs": 1,
65
+ "totalMs": 1
66
+ },
67
+ "failure": { "consecutiveFailures": 1, "windowMs": 1 }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "host-presentation-policy-denied-1",
5
+ "sequence": 7,
6
+ "type": "capability-result",
7
+ "payload": {
8
+ "requestId": "presentation-change-1",
9
+ "result": {
10
+ "ok": false,
11
+ "reason": "permission-denied",
12
+ "message": "Host presentation policy denied the requested surface",
13
+ "retryable": false
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "widget-presentation-present-1",
5
+ "sequence": 2,
6
+ "type": "capability-request",
7
+ "payload": {
8
+ "requestId": "presentation-present-1",
9
+ "request": {
10
+ "operation": "ui.presentation",
11
+ "input": { "action": "present", "surface": "overlay" }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "host-presentation-user-denied-1",
5
+ "sequence": 8,
6
+ "type": "capability-result",
7
+ "payload": {
8
+ "requestId": "presentation-present-1",
9
+ "result": {
10
+ "ok": false,
11
+ "reason": "permission-denied",
12
+ "message": "User declined the presentation request",
13
+ "retryable": false
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "protocolVersion": 1,
3
+ "channelId": "0123456789abcdef0123456789abcdef",
4
+ "messageId": "widget-ready-1",
5
+ "sequence": 1,
6
+ "type": "ready",
7
+ "payload": {
8
+ "widgetSdkVersion": "0.0.1",
9
+ "hostApiVersion": 1
10
+ }
11
+ }
@@ -0,0 +1 @@
1
+ export const Widget = { render() {} };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "Minimal Structure Preview",
3
+ "widgetConfig": {
4
+ "schemaVersion": 1,
5
+ "hostApiVersion": 1,
6
+ "widgetSdkVersion": "0.0.1",
7
+ "entry": "entry.js",
8
+ "slot": { "type": "file-preview", "extensions": ["cif"] },
9
+ "requestedCapabilities": { "files": { "metadata": true, "read": true } },
10
+ "samples": [{ "id": "normal", "title": "Normal", "request": "samples/file-preview.json" }]
11
+ }
12
+ }
@@ -0,0 +1 @@
1
+ {"schemaVersion":1,"requestId":"bundle-file","instanceId":"bundle-file","revision":1,"slot":"file-preview","state":"complete","content":{"slot":"file-preview","file":{"id":"file","kind":"file","name":"x.cif","extension":"cif"}},"context":{"locale":"en-US","theme":{"mode":"light","tokens":{"background":"#fff","foreground":"#111","muted":"#eee","mutedForeground":"#666","border":"#ddd","primary":"#06c","danger":"#c00"}},"viewport":{"width":1,"height":1},"capabilities":[],"correlationId":"bundle-file"}}
@@ -0,0 +1 @@
1
+ export const Widget = { render() {} };
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "Minimal Analysis Summary",
3
+ "widgetConfig": {
4
+ "schemaVersion": 1,
5
+ "hostApiVersion": 1,
6
+ "widgetSdkVersion": "0.0.1",
7
+ "entry": "entry.js",
8
+ "slot": { "type": "panel", "panelType": "analysis-summary" },
9
+ "samples": [{ "id": "normal", "title": "Normal", "request": "samples/panel.json" }]
10
+ }
11
+ }
@@ -0,0 +1 @@
1
+ {"schemaVersion":1,"requestId":"bundle-panel","instanceId":"bundle-panel","revision":1,"slot":"panel","state":"complete","content":{"slot":"panel","panelType":"analysis-summary","data":{}},"context":{"locale":"en-US","theme":{"mode":"light","tokens":{"background":"#fff","foreground":"#111","muted":"#eee","mutedForeground":"#666","border":"#ddd","primary":"#06c","danger":"#c00"}},"viewport":{"width":1,"height":1},"capabilities":[],"correlationId":"bundle-panel"}}
@@ -0,0 +1 @@
1
+ export const Widget = { render() {} };
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "Minimal Simulation Result",
3
+ "widgetConfig": {
4
+ "schemaVersion": 1,
5
+ "hostApiVersion": 1,
6
+ "widgetSdkVersion": "0.0.1",
7
+ "entry": "entry.js",
8
+ "slot": { "type": "tool-result", "toolName": "simulation.run" },
9
+ "samples": [{ "id": "normal", "title": "Normal", "request": "samples/tool-result.json" }]
10
+ }
11
+ }
@@ -0,0 +1 @@
1
+ {"schemaVersion":1,"requestId":"bundle-tool","instanceId":"bundle-tool","revision":1,"slot":"tool-result","state":"complete","content":{"slot":"tool-result","tool":{"name":"simulation.run","callId":"call","status":"succeeded"},"input":{},"result":{}},"context":{"locale":"en-US","theme":{"mode":"light","tokens":{"background":"#fff","foreground":"#111","muted":"#eee","mutedForeground":"#666","border":"#ddd","primary":"#06c","danger":"#c00"}},"viewport":{"width":1,"height":1},"capabilities":[],"correlationId":"bundle-tool"}}
@@ -0,0 +1 @@
1
+ {"ok":true,"data":{"items":[{"id":"file-001","kind":"file","name":"result.txt"}],"nextCursor":null}}
@@ -0,0 +1,11 @@
1
+ {
2
+ "ok": true,
3
+ "data": {
4
+ "id": "file-001",
5
+ "kind": "file",
6
+ "name": "structure.cif",
7
+ "extension": "cif",
8
+ "mimeType": "chemical/x-cif",
9
+ "size": 128
10
+ }
11
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "ok": false,
3
+ "reason": "permission-denied",
4
+ "message": "Host denied this file operation",
5
+ "retryable": false
6
+ }
@@ -0,0 +1 @@
1
+ {"ok":false,"reason":"resource-limit","message":"request exceeds the file read budget","retryable":false}
@@ -0,0 +1 @@
1
+ {"ok":true,"data":{"encoding":"utf8","content":"simulation complete"}}