webloom-framework 0.4.0 → 0.4.2

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/dist/testing.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { s as CreatePluginHostOptions, x as PluginHost } from './runtimeTypes-DquUCHz-.js';
2
- export { m as CapabilityRegistration, n as CapabilityRegistry, o as ContextExtensionInput, p as ContributionAdapter, q as ContributionAdapterInput, r as ContributionHandle, H as HostCapabilityRegistration, t as HostInspection, u as PermissionPolicyInput, v as PermissionPolicyResult, w as PluginConfigStore, y as RuntimeUnitAttributesInput, z as RuntimeUnitAvailabilityInput, A as RuntimeUnitParentScopeInput, B as RuntimeUnitSnapshot, D as StartupCapabilityError, E as StartupPluginError, F as createCapabilityRegistry, G as createInMemoryPluginConfigStore, I as createPluginHost, bP as createResourceStore, J as invokeCapabilityHandler } from './runtimeTypes-DquUCHz-.js';
3
- import { z as RuntimeWireMessage, a as RuntimeTransport } from './messagePortServiceTransport-B0FyJr43.js';
4
- export { C as CreateCapabilityBridgeOptions, b as CreatePluginIntentControllerOptions, M as MessagePortLike, r as RuntimeReceiveMetadata, y as RuntimeUnitImplementation, A as createCapabilityBridge, B as createMessagePortRuntimeTransport, D as createPluginIntentController, E as createResourceRegistry, G as createRuntimeUnitImplementationRegistry, J as validateTransferables } from './messagePortServiceTransport-B0FyJr43.js';
5
- export { C as CreateResourceScopeOptions, e as ResourceScopeOptions, n as SharedWorkerFactory, o as SharedWorkerScopeLike, f as StartSharedWorkerAppForTestingOptions, p as connectSharedWorkerForTesting, i as createLifecycleScope, j as createResourceScope, q as startSharedWorkerAppForTesting } from './sharedWorkerHost-Cb2a1_KD.js';
6
- export { c as createMessageBus } from './messageBus-CtrwkjrO.js';
1
+ import { ab as RuntimeWireMessage, v as CreatePluginHostOptions, A as PluginHost } from './runtimeTypes-CleHMFaq.js';
2
+ export { p as CapabilityRegistration, q as CapabilityRegistry, r as ContextExtensionInput, s as ContributionAdapter, t as ContributionAdapterInput, u as ContributionHandle, H as HostCapabilityRegistration, w as HostInspection, x as PermissionPolicyInput, y as PermissionPolicyResult, z as PluginConfigStore, a7 as RuntimeUnitAttributesInput, a8 as RuntimeUnitAvailabilityInput, a9 as RuntimeUnitParentScopeInput, aa as RuntimeUnitSnapshot, ac as StartupCapabilityError, ad as StartupPluginError, ae as createCapabilityRegistry, af as createInMemoryPluginConfigStore, ag as createPluginHost, ck as createResourceStore, ai as invokeCapabilityHandler } from './runtimeTypes-CleHMFaq.js';
3
+ import { R as RuntimeTransport } from './messagePortServiceTransport-DyNmdgoa.js';
4
+ export { C as CreateCapabilityBridgeOptions, b as CreatePluginIntentControllerOptions, M as MessagePortLike, d as RuntimeReceiveMetadata, e as RuntimeUnitImplementation, f as createCapabilityBridge, g as createMessagePortRuntimeTransport, h as createPluginIntentController, i as createResourceRegistry, l as createRuntimeUnitImplementationRegistry, v as validateTransferables } from './messagePortServiceTransport-DyNmdgoa.js';
5
+ export { C as CreateResourceScopeOptions, f as ResourceScopeOptions, o as SharedWorkerFactory, p as SharedWorkerScopeLike, g as StartSharedWorkerAppForTestingOptions, q as connectSharedWorkerForTesting, j as createLifecycleScope, k as createResourceScope, r as startSharedWorkerAppForTesting } from './sharedWorkerHost-BNMUW-8v.js';
6
+ export { c as createMessageBus } from './messageBus-BDtkjs6y.js';
7
7
 
8
8
  /** 可观察的 transport 发送记录。 */
9
9
  interface FakeTransportMessage {
package/dist/testing.js CHANGED
@@ -1,8 +1,8 @@
1
- export { startSharedWorkerAppForTesting } from './chunk-YOIH6H36.js';
1
+ export { startSharedWorkerAppForTesting } from './chunk-RRNUE457.js';
2
2
  export { createPluginIntentController } from './chunk-4DSINPZD.js';
3
- export { connectSharedWorkerForTesting, createCapabilityBridge, createMessagePortRuntimeTransport, validateTransferables } from './chunk-RAQOFUZY.js';
4
- import { createPluginHost } from './chunk-JHJZIO2H.js';
5
- export { StartupCapabilityError, StartupPluginError, createCapabilityRegistry, createInMemoryPluginConfigStore, createLifecycleScope, createMessageBus, createPluginHost, createResourceRegistry, createResourceScope, createResourceStore, createRuntimeUnitImplementationRegistry, invokeCapabilityHandler } from './chunk-JHJZIO2H.js';
3
+ export { connectSharedWorkerForTesting, createCapabilityBridge, createMessagePortRuntimeTransport, validateTransferables } from './chunk-XVD7ALPV.js';
4
+ import { createPluginHost } from './chunk-CKML74MG.js';
5
+ export { StartupCapabilityError, StartupPluginError, createCapabilityRegistry, createInMemoryPluginConfigStore, createLifecycleScope, createMessageBus, createPluginHost, createResourceRegistry, createResourceScope, createResourceStore, createRuntimeUnitImplementationRegistry, invokeCapabilityHandler } from './chunk-CKML74MG.js';
6
6
 
7
7
  // src/testing/fakes.ts
8
8
  function createFakeRuntimeTransport() {
@@ -1,5 +1,5 @@
1
- import { s as CreatePluginHostOptions, x as PluginHost, W as WindowApp } from './runtimeTypes-DquUCHz-.js';
2
- import { c as RuntimePluginDefinition } from './sharedWorkerHost-Cb2a1_KD.js';
1
+ import { v as CreatePluginHostOptions, A as PluginHost, W as WindowApp } from './runtimeTypes-CleHMFaq.js';
2
+ import { c as RuntimePluginDefinition } from './sharedWorkerHost-BNMUW-8v.js';
3
3
 
4
4
  interface CreateWindowAppOptions extends Omit<CreatePluginHostOptions, "runtime" | "runtimeUnitImplementationRegistry" | "runtimeInstanceId" | "runtimeId" | "capabilityBridge"> {
5
5
  /** Window Runtime 逻辑标识。 */
package/docs/api.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # WebLoom v4 API 说明
2
2
 
3
- WebLoom 0.4.0 只支持两个真实 JavaScript realm:`window-main` 和
3
+ WebLoom 0.4.2 只支持两个真实 JavaScript realm:`window-main` 和
4
4
  `shared-worker`。`runtime` 是受限的 `RuntimeKind`,不是可自由填写的环境标签;不支持
5
5
  的 Runtime 在装配边界 fail closed。
6
6
 
@@ -1,84 +1,130 @@
1
1
  # WebLoom v4 验证记录
2
2
 
3
3
  更新时间:2026-09-11(工作树验证)。本记录只写已经执行的命令和观察到的结果;
4
- 未执行的 registry、产品部署和跨浏览器验收不会由本地测试推断为通过。
4
+ 未执行的跨浏览器、产品部署和 registry-only 验收不会由本地测试推断为通过。
5
+
6
+ `webloom-framework@0.4.1` 已发布到 npm。本轮发布的是同一 v4 wire 的 patch 版本;registry
7
+ 返回的 `dist.integrity` 为
8
+ `sha512-/sXro/by2FDq6ZehsOUnuYT8JwaaK3o6bn0uN/ZhtQBWd/7dlTbVcxZF+BlGJ/4dAhqhNOlUWXyGJ5Vk77IOLw==`。
5
9
 
6
10
  ## 1. WebLoom 本仓库
7
11
 
8
- 以下门禁均通过:
12
+ 以下本地门禁均通过:
9
13
 
10
- - `pnpm test:types`:TypeScript 检查与契约 inventory gate 通过;当前 inventory 为 1 个
11
- capability identity。
12
- - `pnpm test`:17 个测试文件、105 个测试通过。
14
+ - `pnpm test:types`:TypeScript 检查、`.typecheck.ts` 负向类型 fixture、契约 inventory
15
+ gate 和临时 Git 基线回归自测均通过;正式源码 inventory 为 1 个 capability identity。
16
+ 负向 fixture 覆盖错误 request/response/item、local capability 跨 Runtime、错误 parser
17
+ 和旧字符串获取。基线自测验证“源码与 inventory 同时进入新 HEAD、但
18
+ `contractTestVersion` 未变”会在显式旧 commit 基线下失败。
19
+ - `pnpm test -- --reporter=dot`:17 个测试文件、106 个测试通过。
20
+ - `pnpm vitest run src/runtime/v4Acceptance.test.ts --reporter=verbose`:9 个 v4 acceptance
21
+ 测试通过,包括 AT-16。
13
22
  - `pnpm build`:四入口 `index`、`advanced`、`react`、`testing` 的 ESM 与 declaration
14
23
  构建通过。
15
24
  - `pnpm lint:boundaries`、`pnpm lint:v4`:通过。
16
- - `node scripts/real-browser-runtime-smoke.mjs`:通过。生产构建实际发出
17
- `assets/worker-C8NPoyKw.js` 与 protocol-mismatch fixture;Chromium 读取到
18
- `SharedWorkerGlobalScope`;覆盖双页共享
19
- Worker/runtime/unit、逐 peer service identity、typed stream `[1,2,3]`、transfer
20
- detach、reconnect 后旧 proxy revoke、terminal `stopping → disposed`、dispose 后迟到
21
- 连接和 protocol mismatch。
22
- - `pnpm run pack:consumer`:通过。tarball 文件清单和体积上限检查、声明/source-map 检查,
23
- 以及 core-only、advanced、React、Worker 四类独立 consumer 均通过。
25
+ - `pnpm run test:ablation`:AT-22 baseline 通过;删除 cancel、deadline、实例过滤、目录
26
+ 校验、revoke 五种机制后对应探针均按预期失败;恢复源码后再次通过。
27
+ - `pnpm run pack:consumer`:tarball gate、声明/source-map 检查,以及 core-only、advanced、
28
+ React、Worker 四类独立 consumer 均通过。
29
+
30
+ ### 真实 Chromium
31
+
32
+ `node scripts/real-browser-runtime-smoke.mjs` 使用 Vite production fixture 和真实
33
+ `SharedWorker` 通过。验证结果包括:
34
+
35
+ - 两个真实 Window 页面共享同一 `SharedWorkerGlobalScope`、同一 worker unit/setup,且每个
36
+ peer 的 service exposure 独立;覆盖 reverse RPC、typed stream `[1,2,3]`、基础 buffer
37
+ detach、重连后旧 proxy 撤销、terminal `stopping → disposed`、迟到连接和
38
+ `protocol_mismatch`。
39
+ - `transfer-matrix` 通过 10 个场景:RPC request/result 的正常与重复 transfer、不可达
40
+ request/result、stream request 与 item 的正常/重复/不可达 transfer、ready 前取消、发送
41
+ 后取消和发送前取消。
42
+ - 矩阵实际交付并回环验证 request/result/item 的业务 `MessagePort`,验证两个
43
+ `Uint8Array` view 仍共享 backing buffer;不可达资源返回 `transfer_invalid`,发送前取消
44
+ 保留 buffer/port,发送后取消保持已转移状态。
24
45
 
25
- 候选包的具体 `npm pack` metadata 和 `dist.integrity` 只写入下游 lockfile 和发布核对记录,
26
- 不嵌入本文件;本文件本身属于发布包,修改其中的完整性字符串会再次改变 tarball 内容。
46
+ 真实浏览器版本:Chrome for Testing `153.0.8010.12`,Linux x64,headless。Firefox、真实
47
+ Safari Playwright WebKit 本轮未执行,不能宣称兼容性已验收。
27
48
 
28
- 真实浏览器版本:Chrome for Testing `153.0.8010.12`,Linux x64,headless。Firefox、真实 Safari
29
- Playwright WebKit 本轮未执行,不能宣称兼容性已验收。
49
+ AT-16 `1/10/100 services × 1/2/10 peers` 测量在 `v4Acceptance.test.ts` 中执行:每次
50
+ 广播只构建一个公共 base snapshot,wire 侧按 peer 投影 grant,且不重复公开 runtime 字段。
51
+
52
+ ### Contract inventory 基线策略
53
+
54
+ 本地 `node scripts/check-contract-inventory.mjs` 保持以当前 `HEAD` 作为默认基线,便于
55
+ 检查未提交工作树。提交级 CI 应执行 `pnpm run test:contract-inventory:ci`:它优先使用
56
+ `CONTRACT_INVENTORY_BASELINE_REF` 或 GitHub Actions 的 `GITHUB_BASE_SHA`,否则使用
57
+ `git merge-base HEAD origin/main`,最终显式传入 `--baseline-ref <sha>`。该门禁不会把
58
+ 包含新源码和新 inventory 的当前提交当作自己的历史基线。
30
59
 
31
60
  ## 2. DemoWebLoom
32
61
 
33
62
  以下门禁均通过:
34
63
 
35
- - `./node_modules/.bin/tsc --noEmit`:通过。验证时使用当前 WebLoom 工作树的本地
36
- `node_modules` 链接;这只证明源码类型兼容,不替代 registry/frozen-install。
37
- - `node scripts/check-v4-boundary.mjs`:通过。
38
- - `node scripts/real-browser-smoke.mjs`:通过。生产构建覆盖首页、01–09 九章、01
39
- 插件 disable/enable、07 两页真实 SharedWorker call;07 验证共享 Worker/runtime/unit
40
- identity 与逐 peer service identity。
64
+ - `pnpm build`:v4 boundary、`tsc --noEmit` Vite production build 通过,九章入口及
65
+ real SharedWorker chunk 均生成。
66
+ - `node scripts/real-browser-smoke.mjs`:index、01–09 九章、01 插件 disable/enable、
67
+ 07 两页真实 SharedWorker call 均通过;验证共享 worker/runtime/unit identity 与逐 peer
68
+ service identity。
41
69
 
42
- Demo lockfile 已与上述本地候选的 `0.4.0` integrity 对齐;浏览器 smoke 使用当前本地
43
- 安装树构建,证明真实 realm 与交互,不替代 registry/frozen-install 证据。
70
+ Demo 的验证使用当前本地 WebLoom 工作树链接;这证明源码类型和真实浏览器交互,不替代
71
+ registry-only frozen install。Demo 已切换到 `0.4.1` 并在 frozen install 后完成类型、生产
72
+ 构建和真实 Chromium smoke;Keymaster 的 registry-only 四入口 consumer 也已从 npm
73
+ `0.4.1` 验证通过。
44
74
 
45
75
  ## 3. Keymaster
46
76
 
47
- 以下本地代码门禁通过:
48
-
49
- - `./node_modules/.bin/tsc -b`:通过。
50
- - 直接调用已安装的 `vitest`,按仓库 12-file batch 计划执行:216 个测试文件全部通过;
51
- 其中 Coordinator worker 113 tests、Vault service 79 tests 均单独通过。
77
+ 以下本地代码门禁均通过:
78
+
79
+ - `pnpm test:types`:`tsc -b`、Keymaster contract inventory gate 和临时 Git 基线回归自测
80
+ 通过,inventory 75 identity;Coordinator response/result 负向类型 fixture 通过
81
+ 编译保护。
82
+ - `pnpm test`:216 个测试文件全部通过(18 个常规批次加 2 个重型隔离批次);其中
83
+ Coordinator worker 113 tests、Vault service 79 tests 均通过。
84
+ - `pnpm build`:Vite production build 通过,3982 个 module transformed;生产产物扫描
85
+ 通过(13 个 HTML/JS/CSS 文件)。
86
+ - `pnpm lint:boundaries`:storage hard-switch、plugin boundary 和 Coordinator final-I/O
87
+ 审计均通过。
52
88
  - `git diff --check`:通过。
53
- - `node scripts/check-boundaries.mjs`、`node scripts/check-react-resource-boundaries.mjs`、
54
- `node scripts/check-coordinator-final-io-audit.mjs`:均通过。
55
89
 
56
- Keymaster `pnpm typecheck` workspace 依赖自检阶段尝试从 registry 获取
57
- `webloom-framework@0.4.0` 并返回 404;因此 canonical pnpm workspace 验证仍未关闭。
58
- 在本地已有依赖树上直接运行 Vitest `tsc -b` 只作为代码/测试证据,不能替代
59
- frozen install
90
+ 另外,在提交 `1edc117` detached 临时 checkout 中执行
91
+ `pnpm install --frozen-lockfile --ignore-scripts && pnpm test:types && pnpm test`:安装
92
+ 成功,`test:types` 通过,随后 216 个测试文件(18 个常规批次加 2 个重型隔离批次)全部
93
+ 通过。该 fresh-install 结果也覆盖了 `@keymaster/plugin-token-bsv21` 对
94
+ `@noble/secp256k1` 的直接声明,以及根测试 setup 对 `@noble/secp256k1` 和
95
+ `@noble/hashes` 的直接声明。
96
+
97
+ Local/S3 真实浏览器、CORS/CAS、重启、多 tab、恢复、app-view 外部环境和公开部署仍需
98
+ 产品环境证据;单元测试和 fresh-install 通过不等价于这些验收已经关闭。
99
+
100
+ ## 4. 发布与 registry 边界
60
101
 
61
- Keymaster 与 Demo 的包声明、workspace release exception 和 lockfile 已切到精确 `0.4.0`。
62
- lockfile 记录的是上述已测候选 tarball,最终发布前必须由 registry 的真实 `dist.integrity`
63
- 替换/确认。
102
+ 上一轮已实际完成 `webloom-framework@0.4.0` 的 registry integrity、Keymaster/Demo
103
+ lockfile 一致性、release-boundary registry-only consumer 验证;该版本是本轮的已发布
104
+ 基线。本轮已发布 `webloom-framework@0.4.1`,并从 registry 读取上述真实 `dist.integrity`。
105
+ Keymaster 与 Demo 的 package 声明和 lockfile 均已切换到该版本;Keymaster
106
+ `pnpm lint:webloom-release`、`pnpm verify:webloom-registry` 以及两仓 frozen-install 验证
107
+ 均通过,不能用本地 tarball 代替这些证据。
64
108
 
65
- ## 4. Registry 与发布边界
109
+ ## 5. Contract inventory CI
66
110
 
67
- 本轮执行结果为明确未通过(外部状态阻塞):
111
+ WebLoom 和 Keymaster 均新增 `.github/workflows/contract-inventory.yml`。workflow 使用
112
+ `actions/checkout` 的 `fetch-depth: 0`;PR 显式映射
113
+ `github.event.pull_request.base.sha`,main push 映射 `github.event.before`,然后执行
114
+ `pnpm test:types` 和 `pnpm run test:contract-inventory:ci`。job 名称固定为
115
+ `contract-inventory`,可作为仓库 required status check。
68
116
 
69
- - `npm view webloom-framework version dist.integrity versions --json` 返回当前 registry
70
- 版本 `0.3.0`,版本列表只有 `0.1.0`、`0.2.0`、`0.3.0`。
71
- - `node scripts/check-webloom-release-boundary.mjs` fail-closed:
72
- `webloom-framework@0.4.0` 不存在于 `https://registry.npmjs.org/`。
73
- - `node scripts/check-webloom-registry-consumer.mjs` fail-closed:registry-only 临时消费
74
- 目录返回 npm `ETARGET`,不能安装 `webloom-framework@0.4.0`。
117
+ workflow 文件已落地并已在本地用显式历史 baseline 验证脚本通过;GitHub branch protection
118
+ 中将 `contract-inventory` 设为 required 的远端仓库设置,本轮无法从当前失效的 GitHub
119
+ 认证态读取或修改,因此该设置仍需在仓库管理面确认。
75
120
 
76
- 因此当前结论是“源码与本地 tarball/Chromium 验收完成,`0.4.0` registry 发布、registry
77
- integrity 核对和 frozen downstream install 尚未完成”。不执行自动 npm publish,也不把
78
- 本地 tarball 或 workspace symlink 当作公开发布证据。
121
+ ## 6. 尚未关闭的跨环境验收
79
122
 
80
- ## 5. 尚未关闭的产品验收
123
+ - Firefox、真实 Safari、Playwright WebKit 的 module SharedWorker、双向 transfer 和 stream
124
+ 组合尚未执行。
125
+ - Keymaster 的 app-view、Local/S3/CORS/CAS、重启/多 tab、恢复 ledger、不可逆 I/O 和部署
126
+ 生产门禁没有本轮完整外部证据。
81
127
 
82
- Keymaster 的外部 app-view、不可逆 I/O、恢复/部署生产门禁,以及 Local/S3 的真实浏览器、
83
- CORS、CAS、重启/多 tab 和公开服务验收,本轮没有取得完整外部环境证据;这些项目仍保持
84
- 未验收状态。已有 Coordinator/恢复单元测试通过,不等价于上述产品/部署验收。
128
+ 因此当前结论是:核心代码修复、`0.4.1` 下游版本一致性、registry consumer inventory
129
+ workflow 已完成;GitHub required-check 远端设置仍待确认。跨浏览器与 Keymaster 产品/部署
130
+ 验收仍保持明确的未验收状态。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webloom-framework",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "通用前端插件生命周期框架",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -47,10 +47,12 @@
47
47
  "build": "tsup",
48
48
  "lint:boundaries": "node scripts/check-boundaries.mjs",
49
49
  "lint:v4": "node scripts/check-v4-boundary.mjs",
50
- "test:types": "tsc -p tsconfig.json --noEmit && node scripts/check-contract-inventory.mjs",
51
- "test:contract-inventory": "node scripts/check-contract-inventory.mjs",
50
+ "test:types": "tsc -p tsconfig.json --noEmit && pnpm test:contract-inventory",
51
+ "test:contract-inventory": "node scripts/check-contract-inventory.mjs && node scripts/check-contract-inventory-self-test.mjs",
52
+ "test:contract-inventory:ci": "node scripts/check-contract-inventory-ci.mjs",
52
53
  "test:browser:install": "playwright install chromium",
53
54
  "test:browser": "pnpm run test:browser:install && node scripts/real-browser-runtime-smoke.mjs",
55
+ "test:ablation": "node scripts/check-v4-ablation.mjs",
54
56
  "prepack": "pnpm test:types && pnpm test && pnpm build && pnpm lint:boundaries && pnpm lint:v4",
55
57
  "pack": "npm pack",
56
58
  "pack:consumer": "pnpm run prepack && node scripts/pack-consumer-smoke.mjs"