webloom-framework 0.4.0 → 0.4.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.
- package/README.md +1 -1
- package/dist/advanced.d.ts +5 -5
- package/dist/advanced.js +4 -4
- package/dist/{chunk-RAQOFUZY.js → chunk-ANA6GBEI.js} +3 -3
- package/dist/{chunk-RAQOFUZY.js.map → chunk-ANA6GBEI.js.map} +1 -1
- package/dist/{chunk-JHJZIO2H.js → chunk-HJKPKWI7.js} +8 -2
- package/dist/chunk-HJKPKWI7.js.map +1 -0
- package/dist/{chunk-YOIH6H36.js → chunk-SX46RHDI.js} +15 -15
- package/dist/chunk-SX46RHDI.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/{messagePortServiceTransport-B0FyJr43.d.ts → messagePortServiceTransport-BYprNvQY.d.ts} +1 -1
- package/dist/react.js +1 -1
- package/dist/{sharedWorkerHost-Cb2a1_KD.d.ts → sharedWorkerHost-KI7TIGdX.d.ts} +2 -0
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +4 -4
- package/dist/{windowRuntime-B6Ue8jso.d.ts → windowRuntime-BKkLPsAS.d.ts} +1 -1
- package/docs/api.md +1 -1
- package/docs/proposals/webloom-v4/verification.md +86 -55
- package/package.json +5 -3
- package/dist/chunk-JHJZIO2H.js.map +0 -1
- package/dist/chunk-YOIH6H36.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createMessagePortRuntimeTransport, createCapabilityBridge, createPeerScopeView, createCapabilityPeerView, createMessagePortServiceProvider } from './chunk-
|
|
2
|
-
import { RuntimeInitializationError, normalizeRuntimeLimits, createRuntimeBudget, createRuntimeMessageCodec, capabilityKey, materializePluginDefinitions, createRuntimeUnitImplementationRegistry, createPluginHost, RUNTIME_SNAPSHOT_TYPE, WebLoomError, cloneFrozenAttributes, RUNTIME_PROTOCOL_VERSION, validateDto } from './chunk-
|
|
1
|
+
import { createMessagePortRuntimeTransport, createCapabilityBridge, createPeerScopeView, createCapabilityPeerView, createMessagePortServiceProvider } from './chunk-ANA6GBEI.js';
|
|
2
|
+
import { RuntimeInitializationError, normalizeRuntimeLimits, createRuntimeBudget, createRuntimeMessageCodec, capabilityKey, materializePluginDefinitions, createRuntimeUnitImplementationRegistry, createPluginHost, RUNTIME_SNAPSHOT_TYPE, WebLoomError, cloneFrozenAttributes, RUNTIME_PROTOCOL_VERSION, validateDto } from './chunk-HJKPKWI7.js';
|
|
3
3
|
|
|
4
4
|
// src/runtime/sharedWorkerHost.ts
|
|
5
5
|
function makeId(prefix) {
|
|
@@ -37,8 +37,7 @@ function startSharedWorkerAppInternal(options, injectedScope) {
|
|
|
37
37
|
const services = runtimeState === "ready" && host ? host.serviceReferences().map((service) => ({ kind: service.kind, capabilityId: service.capabilityId, contractVersion: service.contractVersion, serviceInstanceId: service.serviceInstanceId, attributes: cloneFrozenAttributes(service.attributes), ...service.grantId !== void 0 ? { grantId: service.grantId } : {}, ...service.authorizationRevision !== void 0 ? { authorizationRevision: service.authorizationRevision } : {} })) : [];
|
|
38
38
|
return Object.freeze({ protocolVersion: RUNTIME_PROTOCOL_VERSION, runtimeId: options.id, runtimeKind: "shared-worker", runtimeInstanceId, revision, state: runtimeState, units: Object.freeze(units), services: Object.freeze(services) });
|
|
39
39
|
};
|
|
40
|
-
const emit = () => {
|
|
41
|
-
const snapshot = localSnapshot();
|
|
40
|
+
const emit = (snapshot = localSnapshot()) => {
|
|
42
41
|
for (const listener of [...listeners]) {
|
|
43
42
|
try {
|
|
44
43
|
listener(snapshot);
|
|
@@ -54,10 +53,10 @@ function startSharedWorkerAppInternal(options, injectedScope) {
|
|
|
54
53
|
if (owners.size === 0) return Object.freeze([]);
|
|
55
54
|
return Object.freeze(host.installed().flatMap((pluginId) => host.state(pluginId).units.filter((unit) => unit.instanceId !== void 0 && owners.has(unit.instanceId)).map((unit) => ({ pluginId: unit.pluginId, unitId: unit.unitId, runtime: unit.runtime, ...unit.instanceId !== void 0 ? { instanceId: unit.instanceId } : {}, state: unit.kind }))));
|
|
56
55
|
};
|
|
57
|
-
const wireSnapshot = (endpoint, nextRevision = endpoint.revision, exposures = endpoint.exposures) => {
|
|
58
|
-
localSnapshot();
|
|
56
|
+
const wireSnapshot = (endpoint, nextRevision = endpoint.revision, exposures = endpoint.exposures, base = localSnapshot()) => {
|
|
59
57
|
const services = [...exposures.values()].map((service) => ({ kind: service.kind, capabilityId: service.capabilityId, contractVersion: service.contractVersion, serviceInstanceId: service.serviceInstanceId, attributes: cloneFrozenAttributes(service.attributes), ...service.grantId !== void 0 ? { grantId: service.grantId } : {}, ...service.authorizationRevision !== void 0 ? { authorizationRevision: service.authorizationRevision } : {} }));
|
|
60
|
-
|
|
58
|
+
const state = base.state === "disconnected" ? "failed" : base.state;
|
|
59
|
+
return { type: RUNTIME_SNAPSHOT_TYPE, protocolVersion: base.protocolVersion, runtimeId: base.runtimeId, runtimeKind: base.runtimeKind, runtimeInstanceId: base.runtimeInstanceId, revision: nextRevision, state, units: projectedUnits(exposures), services: state === "ready" ? services : [] };
|
|
61
60
|
};
|
|
62
61
|
const validateProjectedSnapshot = (endpoint, exposures) => {
|
|
63
62
|
if (exposures.size > limits.maxSnapshotServices) throw new WebLoomError("resource_limit_exceeded", "Runtime service exposure limit exceeded", "dispatch");
|
|
@@ -65,22 +64,24 @@ function startSharedWorkerAppInternal(options, injectedScope) {
|
|
|
65
64
|
runtimeCodec.encode(snapshot);
|
|
66
65
|
validateDto(snapshot, { limits: { maxDepth: limits.maxDtoDepth, maxNodes: limits.maxDtoNodes, maxEdges: limits.maxDtoEdges, maxBudgetBytes: limits.maxMessageBudgetBytes }, phase: "dispatch" });
|
|
67
66
|
};
|
|
68
|
-
const publish = (endpoint, exposures = endpoint.exposures) => {
|
|
67
|
+
const publish = (endpoint, exposures = endpoint.exposures, base) => {
|
|
69
68
|
if (endpoint.closed) return;
|
|
70
69
|
const nextRevision = endpoint.revision + 1;
|
|
71
|
-
const snapshot = wireSnapshot(endpoint, nextRevision, exposures);
|
|
70
|
+
const snapshot = wireSnapshot(endpoint, nextRevision, exposures, base);
|
|
72
71
|
endpoint.transport.send(snapshot);
|
|
73
72
|
endpoint.revision = nextRevision;
|
|
74
73
|
};
|
|
75
74
|
const publishAll = () => {
|
|
75
|
+
const base = localSnapshot();
|
|
76
|
+
options.snapshotObserver?.(base);
|
|
76
77
|
for (const endpoint of endpoints) {
|
|
77
78
|
try {
|
|
78
|
-
publish(endpoint);
|
|
79
|
+
publish(endpoint, endpoint.exposures, base);
|
|
79
80
|
} catch {
|
|
80
81
|
closeEndpoint(endpoint, "Runtime snapshot publication failed");
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
|
-
emit();
|
|
84
|
+
emit(base);
|
|
84
85
|
};
|
|
85
86
|
const createEndpoint = (port) => {
|
|
86
87
|
if (!host) throw new Error("SharedWorker Host is unavailable");
|
|
@@ -359,8 +360,7 @@ function startSharedWorkerAppInternal(options, injectedScope) {
|
|
|
359
360
|
if (runtimeState === "ready" && !disposed) {
|
|
360
361
|
revision += 1;
|
|
361
362
|
publishAll();
|
|
362
|
-
}
|
|
363
|
-
emit();
|
|
363
|
+
} else emit();
|
|
364
364
|
});
|
|
365
365
|
} catch (error) {
|
|
366
366
|
runtimeState = "failed";
|
|
@@ -429,5 +429,5 @@ function startSharedWorkerAppForTesting(options) {
|
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
export { startSharedWorkerApp, startSharedWorkerAppForTesting };
|
|
432
|
-
//# sourceMappingURL=chunk-
|
|
433
|
-
//# sourceMappingURL=chunk-
|
|
432
|
+
//# sourceMappingURL=chunk-SX46RHDI.js.map
|
|
433
|
+
//# sourceMappingURL=chunk-SX46RHDI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/sharedWorkerHost.ts"],"names":[],"mappings":";;;;AA0GA,SAAS,OAAO,MAAA,EAAwB;AACtC,EAAA,IAAI;AAA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AAW,IAAA;AAAM,MAAA,YAAA,GAAe,UAAA;AAAY,MAAA,UAAA,EAAW;AAAG,MAAA,cAAA,GAAA,CAAkB,YAAY;AAAE,QAAA,MAAM,MAAA,GAAS,IAAA,GAAO,MAAM,IAAA,CAAK,OAAA,CAAQ,MAAM,CAAA,GAAI,EAAE,OAAA,EAAS,CAAA,QAAA,EAAW,iBAAiB,CAAA,CAAA,EAAI,OAAO,SAAA,EAAoB,SAAA,EAAW,CAAA,EAAG,QAAA,EAAU,CAAA,EAAG,OAAA,EAAS,EAAC,EAAG,MAAA,EAAQ,EAAC,EAAG,iBAAA,EAAmB,KAAA,EAAM;AAAG,QAAA,YAAA,GAAe,UAAA;AAAY,QAAA,UAAA,EAAW;AAAG,QAAA,KAAA,MAAW,YAAY,CAAC,GAAG,SAAS,CAAA,EAAG,aAAA,CAAc,UAAU,MAAM,CAAA;AAAG,QAAA,OAAO,MAAA;AAAA,MAAQ,CAAA,GAAG;AAAG,MAAA,OAAO,cAAA;AAAA,IAAgB;AAAA,GACrjB;AACA,EAAA,OAAO,GAAA;AACT;AAGO,SAAS,qBAAqB,OAAA,EAAuD;AAC1F,EAAA,OAAO,6BAA6B,OAAO,CAAA;AAC7C;AAGO,SAAS,+BAA+B,OAAA,EAAiE;AAC9G,EAAA,MAAM,EAAE,WAAA,EAAa,GAAG,cAAA,EAAe,GAAI,OAAA;AAC3C,EAAA,OAAO,4BAAA,CAA6B,gBAAgB,WAAW,CAAA;AACjE","file":"chunk-SX46RHDI.js","sourcesContent":["// SharedWorkerGlobalScope 内的 v4 Runtime。\n\nimport type { CapabilityPeer, RemoteCapability, ServiceReference } from \"../contracts/capability.js\";\nimport { capabilityKey } from \"../contracts/capability.js\";\nimport { WebLoomError, type LifecycleDisposeResult, type LifecycleScope, type RuntimeSnapshot } from \"../contracts/lifecycle.js\";\nimport { createRuntimeBudget, normalizeRuntimeLimits, validateDto, type RuntimeBudget, type RuntimeLimitsInput } from \"../transport/dto.js\";\nimport type { PluginManifest } from \"../contracts/plugin.js\";\nimport { createPluginHost, type CreatePluginHostOptions, type HostInspection, type PluginHost } from \"../host/createPluginHost.js\";\nimport { createRuntimeUnitImplementationRegistry } from \"../host/runtimeUnitImplementationRegistry.js\";\nimport { invokeCapabilityHandler } from \"../host/capabilityRegistry.js\";\nimport { materializePluginDefinitions, type RuntimePluginDefinition } from \"./pluginDefinitions.js\";\nimport { createCapabilityBridge } from \"../transport/serviceBridge.js\";\nimport { createMessagePortRuntimeTransport } from \"../transport/messagePortServiceTransport.js\";\nimport { createMessagePortServiceProvider } from \"../transport/messagePortServiceProvider.js\";\nimport { cloneFrozenAttributes } from \"../transport/dto.js\";\nimport { createRuntimeMessageCodec, RUNTIME_PROTOCOL_VERSION, RUNTIME_SNAPSHOT_TYPE } from \"./runtimeProtocol.js\";\nimport { RuntimeInitializationError, type RuntimeStatusListener, type RuntimeStatusSnapshot } from \"./runtimeTypes.js\";\nimport { createCapabilityPeerView, createPeerScopeView } from \"./peerView.js\";\n\nexport interface SharedWorkerScopeLike {\n /** SharedWorker 连接事件。 */\n onconnect: ((event: { ports: MessagePort[] }) => void) | null;\n}\n\nexport interface PeerExposureOptions {\n /** 领域授权标识。 */\n readonly grantId?: string;\n /** 授权修订。 */\n readonly authorizationRevision?: number;\n /** 无环公开属性。 */\n readonly attributes?: Readonly<Record<string, unknown>>;\n /** 领域授权检查。 */\n readonly authorize?: (context: import(\"../contracts/capability.js\").HandlerCallContext, request: unknown) => boolean | Promise<boolean>;\n /** 领域 Scope。 */\n readonly scope?: LifecycleScope;\n}\n\nexport interface PeerController {\n /** peer 标识。 */\n readonly peerId: string;\n /** 已观察到的页面 Runtime 实例;首个页面快照前为空。 */\n readonly runtimeInstanceId?: string;\n /** 对端 Window Runtime 类型。 */\n readonly runtime: \"window-main\";\n /** peer 子作用域。 */\n readonly scope: LifecycleScope;\n /** 传给普通 handler 的最小 PeerView。 */\n readonly view: CapabilityPeer;\n /** 获取页面暴露的 typed remote capability。 */\n capability<C extends RemoteCapability>(capability: C): import(\"../contracts/capability.js\").CapabilityClient<C>;\n /** 暴露 Worker 已注册的 capability。 */\n expose<C extends RemoteCapability>(capability: C, options?: PeerExposureOptions): { revoke(): void };\n /** 原子暴露一组 capability;任一项非法时不得部分开放。 */\n exposeGroup(entries: readonly { readonly capability: RemoteCapability; readonly options?: PeerExposureOptions }[]): { revoke(): void };\n /** 断开此 peer,不影响其它页面。 */\n disconnect(reason?: string): void;\n /** peer 诊断。 */\n inspect(): Readonly<Record<string, unknown>>;\n}\n\nexport interface StartSharedWorkerAppOptions extends Omit<CreatePluginHostOptions, \"runtime\" | \"runtimeUnitImplementationRegistry\" | \"runtimeId\" | \"runtimeInstanceId\"> {\n /** Worker Runtime 逻辑标识。 */\n readonly id: string;\n /** Worker realm 的插件定义。 */\n readonly plugins: readonly RuntimePluginDefinition[];\n /** 对每个新 peer 顶层暴露的能力。 */\n readonly expose?: readonly RemoteCapability[];\n /** 同步配置 peer 级策略。 */\n readonly configurePeer?: (peer: PeerController) => void;\n /** configurePeer 可管理的显式 capability allowlist;未设置时不开放动态能力。 */\n readonly peerExposureAllowlist?: readonly RemoteCapability[];\n /** 可信 transport 配额;只能使用默认值或收紧。 */\n readonly limits?: RuntimeLimitsInput;\n}\n\nexport interface StartSharedWorkerAppForTestingOptions extends StartSharedWorkerAppOptions {\n /** testing 入口注入的 SharedWorkerGlobalScope 替身。 */\n readonly globalScope: SharedWorkerScopeLike;\n /** 仅测试用:观察每次向所有 peer 广播前构建的公共快照。 */\n readonly snapshotObserver?: (snapshot: RuntimeStatusSnapshot) => void;\n}\n\nexport interface SharedWorkerApp {\n readonly runtimeKind: \"shared-worker\";\n readonly runtimeId: string;\n readonly runtimeInstanceId: string;\n ready(): Promise<void>;\n reconcile(): Promise<void>;\n state(): RuntimeStatusSnapshot;\n subscribe(listener: RuntimeStatusListener): () => void;\n inspect(): HostInspection;\n dispose(reason?: string): Promise<LifecycleDisposeResult>;\n}\n\ninterface Endpoint {\n readonly port: MessagePort;\n readonly scope: LifecycleScope;\n readonly transport: ReturnType<typeof createMessagePortRuntimeTransport>;\n readonly bridge: ReturnType<typeof createCapabilityBridge>;\n readonly provider: ReturnType<typeof createMessagePortServiceProvider>;\n readonly exposures: Map<string, ServiceReference>;\n readonly installTopLevelExposures: () => void;\n closed: boolean;\n revision: number;\n}\n\nfunction makeId(prefix: string): string {\n try { if (typeof crypto !== \"undefined\" && typeof crypto.randomUUID === \"function\") return `${prefix}:${crypto.randomUUID()}`; } catch { /* fallback */ }\n return `${prefix}:${Date.now().toString(36)}:${Math.random().toString(36).slice(2)}`;\n}\n\nfunction message(error: unknown): string { return error instanceof Error ? error.message : String(error); }\n\n/** 启动一个真实 SharedWorker Runtime;setup 异步完成前也会发布空 services 快照。 */\nfunction startSharedWorkerAppInternal(options: StartSharedWorkerAppOptions & Pick<StartSharedWorkerAppForTestingOptions, \"snapshotObserver\">, injectedScope?: SharedWorkerScopeLike): SharedWorkerApp {\n if (!options || typeof options.id !== \"string\" || options.id.trim() === \"\") throw new TypeError(\"SharedWorker runtime id must be a non-empty string\");\n const scope = injectedScope ?? ((globalThis as unknown as { onconnect?: unknown }).onconnect !== undefined ? globalThis as unknown as SharedWorkerScopeLike : undefined);\n if (!scope) throw new RuntimeInitializationError({ phase: \"validate\", error: \"startSharedWorkerApp must run in a SharedWorkerGlobalScope\" });\n const runtimeInstanceId = makeId(options.id);\n const limits = normalizeRuntimeLimits(options.limits);\n // One counter per direction is shared by every endpoint in this Runtime;\n // per-peer limits remain enforced inside each bridge/provider.\n const outboundBudget: RuntimeBudget = createRuntimeBudget(limits);\n const inboundBudget: RuntimeBudget = createRuntimeBudget(limits);\n const runtimeCodec = createRuntimeMessageCodec();\n const peerExposureAllowlist = options.peerExposureAllowlist === undefined\n ? undefined\n : new Set(options.peerExposureAllowlist.map((capability) => capabilityKey(capability)));\n const listeners = new Set<RuntimeStatusListener>();\n const endpoints = new Set<Endpoint>();\n let manifests: readonly PluginManifest[] = [];\n let runtimeState: RuntimeSnapshot[\"state\"] = \"starting\";\n let revision = 0;\n let disposed = false;\n let accepting = true;\n let host: PluginHost | undefined;\n let disposePromise: Promise<LifecycleDisposeResult> | undefined;\n\n const localSnapshot = (): RuntimeStatusSnapshot => {\n const currentHost = host;\n const units = currentHost ? currentHost.installed().flatMap((pluginId) => currentHost.state(pluginId).units.map((unit) => ({ pluginId: unit.pluginId, unitId: unit.unitId, runtime: unit.runtime, ...(unit.instanceId !== undefined ? { instanceId: unit.instanceId } : {}), state: unit.kind }))) : [];\n const services = runtimeState === \"ready\" && host ? host.serviceReferences().map((service) => ({ kind: service.kind, capabilityId: service.capabilityId, contractVersion: service.contractVersion, serviceInstanceId: service.serviceInstanceId, attributes: cloneFrozenAttributes(service.attributes), ...(service.grantId !== undefined ? { grantId: service.grantId } : {}), ...(service.authorizationRevision !== undefined ? { authorizationRevision: service.authorizationRevision } : {}) })) : [];\n return Object.freeze({ protocolVersion: RUNTIME_PROTOCOL_VERSION, runtimeId: options.id, runtimeKind: \"shared-worker\", runtimeInstanceId, revision, state: runtimeState, units: Object.freeze(units), services: Object.freeze(services) });\n };\n const emit = (snapshot: RuntimeStatusSnapshot = localSnapshot()): void => { for (const listener of [...listeners]) { try { listener(snapshot); } catch { /* observer isolation */ } } };\n const projectedUnits = (exposures: ReadonlyMap<string, ServiceReference>): readonly RuntimeSnapshot[\"units\"][number][] => {\n if (!host || exposures.size === 0) return Object.freeze([]);\n // A peer may only learn about the provider units behind services explicitly\n // visible in its projection. The local Host snapshot remains complete for\n // trusted inspection; the wire projection must not be a hidden-provider\n // index.\n const owners = new Set(\n host.capabilities.registrations()\n .filter((registration) => exposures.has(capabilityKey(registration.capability)))\n .map((registration) => registration.ownerId),\n );\n if (owners.size === 0) return Object.freeze([]);\n return Object.freeze(host.installed().flatMap((pluginId) => host!.state(pluginId).units\n .filter((unit) => unit.instanceId !== undefined && owners.has(unit.instanceId))\n .map((unit) => ({ pluginId: unit.pluginId, unitId: unit.unitId, runtime: unit.runtime, ...(unit.instanceId !== undefined ? { instanceId: unit.instanceId } : {}), state: unit.kind }))));\n };\n const wireSnapshot = (endpoint: Endpoint, nextRevision = endpoint.revision, exposures: ReadonlyMap<string, ServiceReference> = endpoint.exposures, base = localSnapshot()): RuntimeSnapshot & { readonly type: typeof RUNTIME_SNAPSHOT_TYPE } => {\n const services = [...exposures.values()].map((service) => ({ kind: service.kind, capabilityId: service.capabilityId, contractVersion: service.contractVersion, serviceInstanceId: service.serviceInstanceId, attributes: cloneFrozenAttributes(service.attributes), ...(service.grantId !== undefined ? { grantId: service.grantId } : {}), ...(service.authorizationRevision !== undefined ? { authorizationRevision: service.authorizationRevision } : {}) }));\n const state: RuntimeSnapshot[\"state\"] = base.state === \"disconnected\" ? \"failed\" : base.state;\n return { type: RUNTIME_SNAPSHOT_TYPE, protocolVersion: base.protocolVersion, runtimeId: base.runtimeId, runtimeKind: base.runtimeKind, runtimeInstanceId: base.runtimeInstanceId, revision: nextRevision, state, units: projectedUnits(exposures), services: state === \"ready\" ? services : [] };\n };\n const validateProjectedSnapshot = (endpoint: Endpoint, exposures: ReadonlyMap<string, ServiceReference>): void => {\n if (exposures.size > limits.maxSnapshotServices) throw new WebLoomError(\"resource_limit_exceeded\", \"Runtime service exposure limit exceeded\", \"dispatch\");\n const snapshot = wireSnapshot(endpoint, endpoint.revision + 1, exposures);\n runtimeCodec.encode(snapshot);\n validateDto(snapshot, { limits: { maxDepth: limits.maxDtoDepth, maxNodes: limits.maxDtoNodes, maxEdges: limits.maxDtoEdges, maxBudgetBytes: limits.maxMessageBudgetBytes }, phase: \"dispatch\" });\n };\n const publish = (endpoint: Endpoint, exposures = endpoint.exposures, base?: RuntimeStatusSnapshot): void => {\n if (endpoint.closed) return;\n const nextRevision = endpoint.revision + 1;\n const snapshot = wireSnapshot(endpoint, nextRevision, exposures, base);\n endpoint.transport.send(snapshot);\n // postMessage performs structured-clone synchronously. Advance the\n // per-peer revision only after that operation has succeeded.\n endpoint.revision = nextRevision;\n };\n const publishAll = (): void => {\n const base = localSnapshot();\n options.snapshotObserver?.(base);\n for (const endpoint of endpoints) {\n try { publish(endpoint, endpoint.exposures, base); } catch { closeEndpoint(endpoint, \"Runtime snapshot publication failed\"); }\n }\n emit(base);\n };\n\n const createEndpoint = (port: MessagePort): Endpoint => {\n if (!host) throw new Error(\"SharedWorker Host is unavailable\");\n const peerScope = host.rootScope.child(\"peer\", { attributes: { peerId: makeId(\"peer\") } });\n const transport = createMessagePortRuntimeTransport(port, { limits });\n const bridge = createCapabilityBridge({ transport, remoteRuntimeKind: \"window-main\", limits, budget: outboundBudget });\n const exposures = new Map<string, ServiceReference>();\n const exposurePolicies = new Map<string, PeerExposureOptions>();\n const peerId = peerScope.identity.attributes.peerId as string | undefined ?? makeId(\"peer\");\n const peerScopeView = createPeerScopeView(peerScope);\n const peerView: CapabilityPeer = createCapabilityPeerView({ peerId, scope: peerScopeView, bridge, capabilityScope: peerScope });\n let endpointForDisconnect: Endpoint | undefined;\n const exposeGroup = (entries: readonly { readonly capability: RemoteCapability; readonly options?: PeerExposureOptions }[], source: \"dynamic\" | \"top-level\" = \"dynamic\"): { revoke(): void } => {\n if (peerScope.state !== \"active\") throw new WebLoomError(\"service_revoked\", \"Peer scope is not active\", \"dispatch\", { capabilityId: entries[0]?.capability.id });\n const prepared: { key: string; reference: ServiceReference; options: PeerExposureOptions }[] = [];\n const keys = new Set<string>();\n for (const entry of entries) {\n const capability = entry.capability;\n const exposureOptions = entry.options ?? {};\n const key = capabilityKey(capability);\n if (source === \"dynamic\" && (!peerExposureAllowlist || !peerExposureAllowlist.has(key))) {\n throw new WebLoomError(\"capability_unavailable\", \"Capability is outside the peer exposure allowlist\", \"dispatch\", { capabilityId: capability.id });\n }\n const registration = host?.capabilities.registration(capability);\n if (!registration || (capability.kind !== \"rpc\" && capability.kind !== \"stream\") || registration.capability.kind !== capability.kind) {\n throw new Error(`Capability \"${capability.id}\" is not a remote capability registered by this Host`);\n }\n if (keys.has(key) || exposures.has(key)) throw new Error(`Capability \"${capability.id}\" is already exposed to this peer`);\n keys.add(key);\n const reference: ServiceReference = Object.freeze({\n ...registration.reference,\n serviceInstanceId: makeId(`exposure:${peerId}:${capability.id}`),\n attributes: cloneFrozenAttributes(exposureOptions.attributes ?? registration.reference.attributes),\n ...(exposureOptions.grantId !== undefined ? { grantId: exposureOptions.grantId } : {}),\n ...(exposureOptions.authorizationRevision !== undefined ? { authorizationRevision: exposureOptions.authorizationRevision } : {}),\n });\n prepared.push({ key, reference, options: exposureOptions });\n }\n const projected = new Map(exposures);\n for (const item of prepared) projected.set(item.key, item.reference);\n if (endpointForDisconnect) validateProjectedSnapshot(endpointForDisconnect, projected);\n else if (projected.size > limits.maxSnapshotServices) throw new WebLoomError(\"resource_limit_exceeded\", \"Runtime service exposure limit exceeded\", \"dispatch\");\n\n let active = true;\n let committed = false;\n const removers: (() => void)[] = [];\n const removeExposure = (key: string): void => {\n if (!active || !committed || !exposures.delete(key)) return;\n exposurePolicies.delete(key);\n // If the peer scope itself is being revoked, the group callback below\n // performs one grouped removal/publication. Avoid exposing an\n // intermediate per-item revision during that synchronous fence.\n if (endpointForDisconnect && peerScope.state === \"active\") {\n try { publish(endpointForDisconnect); } catch { closeEndpoint(endpointForDisconnect, \"Runtime snapshot publication failed\"); }\n }\n };\n const removeGroup = (): void => {\n if (!active) return;\n active = false;\n let changed = false;\n for (const item of prepared) {\n changed = exposures.delete(item.key) || changed;\n exposurePolicies.delete(item.key);\n }\n for (const remove of removers.splice(0)) remove();\n if (changed && endpointForDisconnect) {\n try { publish(endpointForDisconnect); } catch { closeEndpoint(endpointForDisconnect, \"Runtime snapshot publication failed\"); }\n }\n };\n try {\n for (const item of prepared) {\n if (item.options.scope) {\n if (item.options.scope.state !== \"active\") throw new WebLoomError(\"service_revoked\", \"Capability exposure scope is not active\", \"dispatch\", { capabilityId: item.reference.capabilityId });\n removers.push(item.options.scope.onRevoke(() => removeExposure(item.key)));\n }\n }\n removers.push(peerScope.onRevoke(() => removeGroup()));\n } catch (error) {\n for (const remove of removers.splice(0)) remove();\n throw error;\n }\n\n // The projected snapshot is sent before the local maps are changed. A\n // synchronous postMessage failure therefore cannot leave a locally\n // committed service that the peer never observed. Map insertion itself\n // is then a non-throwing commit step and advances exactly one revision\n // for the complete group.\n try {\n if (prepared.length > 0 && endpointForDisconnect) publish(endpointForDisconnect, projected);\n } catch (error) {\n active = false;\n for (const remove of removers.splice(0)) remove();\n throw error;\n }\n if (peerScope.state !== \"active\" || prepared.some((item) => item.options.scope !== undefined && item.options.scope.state !== \"active\")) {\n active = false;\n for (const remove of removers.splice(0)) remove();\n throw new WebLoomError(\"service_revoked\", \"Capability exposure scope was revoked before commit\", \"dispose\", { capabilityId: prepared[0]?.reference.capabilityId });\n }\n for (const item of prepared) {\n exposures.set(item.key, item.reference);\n exposurePolicies.set(item.key, item.options);\n }\n committed = true;\n // Scope callbacks are registered above and only run after this task; the\n // explicit handle remains the first-class idempotent revocation path.\n return { revoke: removeGroup };\n };\n let disconnectRequested: string | undefined;\n const configuredExposureKeys = new Set<string>();\n const peer: PeerController = {\n peerId,\n get runtimeInstanceId() { return bridge.runtimeInstanceId; },\n runtime: \"window-main\",\n scope: peerScope,\n view: peerView,\n capability: (capability) => bridge.getClient(capability, peerScope),\n expose(capability, exposureOptions = {}) {\n const result = exposeGroup([{ capability, options: exposureOptions }]);\n configuredExposureKeys.add(capabilityKey(capability));\n return result;\n },\n exposeGroup(entries) {\n const result = exposeGroup(entries);\n for (const entry of entries) configuredExposureKeys.add(capabilityKey(entry.capability));\n return result;\n },\n disconnect(reason = \"Peer disconnected\") {\n if (endpointForDisconnect) closeEndpoint(endpointForDisconnect, reason);\n else { disconnectRequested = reason; peerScope.revoke(reason); }\n },\n inspect: () => Object.freeze({ peerId, scopeId: peerScope.identity.scopeId, state: peerScope.state, exposedServiceCount: exposures.size, pendingCallCount: bridge.pendingCallCount, activeStreamCount: bridge.activeStreamCount }),\n };\n const installTopLevelExposures = (): void => {\n const entries: { readonly capability: RemoteCapability }[] = [];\n for (const capability of options.expose ?? []) {\n const key = capabilityKey(capability);\n if (exposures.has(key)) {\n if (configuredExposureKeys.has(key)) throw new Error(`Capability \"${capability.id}\" is exposed by configurePeer and top-level expose`);\n continue;\n }\n if (!host?.capabilities.registration(capability)) continue;\n entries.push({ capability });\n }\n // This is an installation path, not a configurePeer-owned exposure. A\n // single projected snapshot keeps the whole top-level set atomic.\n if (entries.length > 0) exposeGroup(entries, \"top-level\");\n };\n try { options.configurePeer?.(peer); } catch (error) {\n peerScope.revoke(\"configurePeer failed\");\n bridge.dispose(\"configurePeer failed\");\n transport.close?.();\n throw error;\n }\n const provider = createMessagePortServiceProvider({\n transport,\n peerScope,\n peer: peerView,\n budget: inboundBudget,\n limits,\n services: () => [...exposures.values()],\n peerForCall: (_call, reference) => {\n const registration = host?.capabilities.registration({ kind: reference.kind, id: reference.capabilityId, version: reference.contractVersion });\n return createCapabilityPeerView({ peerId, scope: peerScopeView, bridge, allowed: registration?.peerDependencies ?? [], capabilityScope: peerScope });\n },\n prepareRequest: (call) => {\n if (!host) throw new WebLoomError(\"service_stale\", \"SharedWorker Host is unavailable\", \"dispatch\");\n const registration = host.capabilities.registration({ kind: call.mode === \"stream\" ? \"stream\" : \"rpc\", id: call.capabilityId, version: call.contractVersion });\n if (!registration || registration.capability.kind !== (call.mode === \"stream\" ? \"stream\" : \"rpc\")) throw new WebLoomError(\"service_stale\", \"Runtime service exposure is stale\", \"dispatch\");\n const parser = registration.capability as typeof registration.capability & { request: { parse(value: unknown): unknown }; transfer?: { request?: (value: unknown) => readonly Transferable[] } };\n let value: unknown;\n try { value = parser.request.parse(call.request); } catch { throw new WebLoomError(\"request_validation_failed\", \"Capability request failed validation\", \"receive\"); }\n return { value, transfer: parser.transfer?.request?.(value) };\n },\n handleCall: async ({ message: call, request, reference, signal, deadlineAt, peer: callPeer }) => {\n if (!host) throw new Error(\"SharedWorker Host is unavailable\");\n const registration = host.capabilities.registration({ kind: reference.kind, id: reference.capabilityId, version: reference.contractVersion });\n const key = capabilityKey({ kind: reference.kind, id: reference.capabilityId, version: reference.contractVersion });\n const policy = exposurePolicies.get(key);\n if (!registration || !exposures.has(key)) throw new Error(\"Runtime service exposure is stale\");\n const handlerReference = reference;\n const context = { signal, deadlineAt, ...(call.operationId !== undefined ? { operationId: call.operationId } : {}), reference: handlerReference, origin: \"remote\" as const, peer: callPeer };\n if (policy?.authorize && !(await policy.authorize(context, request))) throw new WebLoomError(\"permission_denied\", \"Peer capability authorization denied\", \"dispatch\", { capabilityId: reference.capabilityId, serviceInstanceId: reference.serviceInstanceId });\n if (exposures.get(key)?.serviceInstanceId !== handlerReference.serviceInstanceId) throw new WebLoomError(\"service_stale\", \"Runtime service exposure was replaced while authorization was pending\", \"dispatch\", { serviceInstanceId: handlerReference.serviceInstanceId });\n if (peerScope.state !== \"active\" || signal.aborted) throw new WebLoomError(\"service_revoked\", \"Peer scope was revoked\", \"dispose\", { serviceInstanceId: reference.serviceInstanceId });\n if (policy?.scope && policy.scope.state !== \"active\") throw new WebLoomError(\"service_revoked\", \"Peer capability authorization scope is revoked\", \"dispose\", { serviceInstanceId: reference.serviceInstanceId });\n const handler = registration.handler as ((value: unknown, context: import(\"../contracts/capability.js\").HandlerCallContext) => unknown | Promise<unknown>) | undefined;\n if (!handler) throw new WebLoomError(\"service_stale\", \"Runtime service handler is unavailable\", \"dispatch\");\n return handler(request, context);\n },\n prepareResult: (value, call) => {\n const registration = host?.capabilities.registration({ kind: \"rpc\", id: call.capabilityId, version: call.contractVersion });\n if (!registration || registration.capability.kind !== \"rpc\") throw new Error(\"RPC capability registration disappeared\");\n const rpc = registration.capability as typeof registration.capability & { response: { parse(value: unknown): unknown }; transfer?: { response?: (value: unknown) => readonly Transferable[] } };\n const parsed = rpc.response.parse(value);\n const transfer = (rpc.transfer?.response?.(parsed) ?? []);\n return { value: parsed, transfer };\n },\n prepareItem: (value, call) => {\n const registration = host?.capabilities.registration({ kind: \"stream\", id: call.capabilityId, version: call.contractVersion });\n if (!registration || registration.capability.kind !== \"stream\") throw new Error(\"stream capability registration disappeared\");\n const stream = registration.capability as typeof registration.capability & { item: { parse(value: unknown): unknown }; transfer?: { item?: (value: unknown) => readonly Transferable[] } };\n const parsed = stream.item.parse(value);\n const transfer = stream.transfer?.item?.(parsed) ?? [];\n return { value: parsed, transfer };\n },\n });\n const endpoint: Endpoint = { port, scope: peerScope, transport, bridge, provider, exposures, installTopLevelExposures, closed: false, revision: 0 };\n endpointForDisconnect = endpoint;\n endpoints.add(endpoint);\n try {\n if (disconnectRequested !== undefined) closeEndpoint(endpoint, disconnectRequested);\n installTopLevelExposures();\n // Window and Worker may both publish the first snapshot. Incoming snapshots\n // are consumed only by the bridge; no hello/handshake control message exists.\n publish(endpoint);\n } catch (error) {\n closeEndpoint(endpoint, \"SharedWorker endpoint initialization failed\");\n throw error;\n }\n return endpoint;\n };\n\n const closeEndpoint = (endpoint: Endpoint, reason: string): void => { if (endpoint.closed) return; endpoint.closed = true; endpoint.scope.revoke(reason); void endpoint.scope.dispose({ reason }); endpoint.provider.dispose(); endpoint.bridge.dispose(reason); endpoint.transport.close?.(); endpoints.delete(endpoint); };\n const sendTerminalSnapshot = (port: MessagePort): void => {\n try {\n port.start();\n port.postMessage({ ...localSnapshot(), type: RUNTIME_SNAPSHOT_TYPE });\n // Give the posted terminal snapshot a turn to cross the port before\n // closing a connection made after the Worker Runtime has stopped.\n setTimeout(() => { try { port.close(); } catch { /* noop */ } }, 0);\n } catch { try { port.close(); } catch { /* noop */ } }\n };\n scope.onconnect = (event) => {\n for (const port of event.ports ?? []) {\n if (!accepting || disposed || endpoints.size >= limits.maxPeers) { sendTerminalSnapshot(port); continue; }\n try { createEndpoint(port); } catch { try { port.close(); } catch { /* noop */ } }\n }\n };\n\n try {\n const materialized = materializePluginDefinitions(options.plugins, \"shared-worker\");\n manifests = materialized.map((item) => item.manifest);\n const implementations = createRuntimeUnitImplementationRegistry(materialized.map((item) => ({ pluginId: item.manifest.id, unitId: item.unitId, setup: item.setup, capabilities: item.capabilities })));\n const { id: _id, plugins: _plugins, expose: _expose, configurePeer: _configurePeer, ...hostOptions } = options;\n host = createPluginHost({ ...hostOptions, runtime: \"shared-worker\", runtimeId: options.id, runtimeInstanceId, runtimeUnitImplementationRegistry: implementations });\n host.subscribe(() => { if (runtimeState === \"ready\" && !disposed) { revision += 1; publishAll(); } else emit(); });\n } catch (error) {\n runtimeState = \"failed\";\n const failure = new RuntimeInitializationError({ phase: \"validate\", error: message(error) });\n const failedReady = Promise.reject(failure);\n void failedReady.catch(() => undefined);\n const failedInspection = (): HostInspection => ({ runtimeId: options.id, runtimeKind: \"shared-worker\", runtimeInstanceId, version: 0, pluginCount: 0, peerCount: endpoints.size, pendingCallCount: 0, activeStreamCount: 0, plugins: [] });\n return { runtimeKind: \"shared-worker\", runtimeId: options.id, runtimeInstanceId, ready: () => failedReady, reconcile: async () => failedReady, state: localSnapshot, subscribe(listener) { listeners.add(listener); listener(localSnapshot()); return () => listeners.delete(listener); }, inspect: failedInspection, dispose: async () => ({ scopeId: `runtime:${runtimeInstanceId}`, state: \"stopped\", attempted: 0, released: 0, pending: [], errors: [], cleanupIncomplete: false }) };\n }\n\n const ready = host.registerAll(manifests).then(() => {\n // A peer may have been connected before Host startup finished. Installing\n // the same top-level projection again is idempotent, while a configurePeer\n // collision remains an explicit error.\n for (const endpoint of endpoints) endpoint.installTopLevelExposures();\n if (!disposed) { runtimeState = \"ready\"; revision += 1; publishAll(); }\n }, (error) => { if (!disposed) { runtimeState = \"failed\"; publishAll(); } throw new RuntimeInitializationError({ phase: \"startup\", error: message(error) }); });\n void ready.catch(() => undefined);\n const app: SharedWorkerApp = {\n runtimeKind: \"shared-worker\", runtimeId: options.id, runtimeInstanceId,\n ready: () => ready,\n reconcile: () => host?.reconcile() ?? Promise.resolve(),\n state: localSnapshot,\n subscribe(listener) { listeners.add(listener); listener(localSnapshot()); return () => listeners.delete(listener); },\n inspect: () => host ? { ...host.inspect(), peerCount: endpoints.size } : { runtimeId: options.id, runtimeKind: \"shared-worker\", runtimeInstanceId, version: 0, pluginCount: 0, peerCount: endpoints.size, pendingCallCount: 0, activeStreamCount: 0, plugins: [] },\n dispose(reason = \"shared worker runtime disposed\") { if (disposePromise) return disposePromise; accepting = false; disposed = true; runtimeState = \"stopping\"; publishAll(); disposePromise = (async () => { const result = host ? await host.dispose(reason) : { scopeId: `runtime:${runtimeInstanceId}`, state: \"stopped\" as const, attempted: 0, released: 0, pending: [], errors: [], cleanupIncomplete: false }; runtimeState = \"disposed\"; publishAll(); for (const endpoint of [...endpoints]) closeEndpoint(endpoint, reason); return result; })(); return disposePromise; },\n };\n return app;\n}\n\n/** 生产入口:只从真实 SharedWorkerGlobalScope 获取连接事件。 */\nexport function startSharedWorkerApp(options: StartSharedWorkerAppOptions): SharedWorkerApp {\n return startSharedWorkerAppInternal(options);\n}\n\n/** testing/advanced harness 入口;生产包的 startSharedWorkerApp 不接受 scope 注入。 */\nexport function startSharedWorkerAppForTesting(options: StartSharedWorkerAppForTestingOptions): SharedWorkerApp {\n const { globalScope, ...runtimeOptions } = options;\n return startSharedWorkerAppInternal(runtimeOptions, globalScope);\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { K as Capability, M as CapabilityDependency, N as PluginContribution, O as PluginConfig, Q as PluginContextExtension, R as RuntimeKind, e as PluginPermission, T as PluginSetup, V as PluginDefinition } from './runtimeTypes-DquUCHz-.js';
|
|
2
2
|
export { X as AppLike, Y as CapabilityBridge, Z as CapabilityClient, C as CapabilityDescriptor, _ as CapabilityKind, j as CapabilityPeer, h as CreateUpgradeGateOptions, $ as DefineLocalCapabilityOptions, a0 as DefineRpcCapabilityOptions, a1 as DefineStreamCapabilityOptions, a2 as DispatchOptions, a3 as EventHandler, a4 as FrameworkErrorCode, a5 as FrameworkErrorContext, a6 as FrameworkErrorPhase, a7 as HandlerCallContext, a8 as HandlerOptions, a9 as HandlerOrigin, aa as HostListener, ab as ItemOf, ac as LIFECYCLE_ERROR_TEXT, ad as LifecycleCleanup, ae as LifecycleCleanupIssue, af as LifecycleCleanupPhase, ag as LifecycleDisposeOptions, ah as LifecycleDisposeResult, ai as LifecycleResourceHandle, aj as LifecycleResourceSnapshot, f as LifecycleScope, L as LifecycleScopeIdentity, ak as LifecycleScopeKind, al as LifecycleScopeRevokedError, am as LifecycleScopeState, an as LocalCapability, ao as LocalServiceOf, ap as Message, aq as MessageBus, ar as MessageBusSnapshot, as as MessageHandler, at as MessageMode, au as OwnedResourceDefinition, av as PeerCapabilityDependency, aw as PeerScopeView, ax as PermissionDeniedError, g as PermissionLease, ay as PermissionLeaseBinding, az as PermissionLeaseBindingExpectation, aA as PermissionLeaseRevokedError, aB as PluginAttributes, aC as PluginContext, a as PluginGraph, aD as PluginIntentCommand, aE as PluginIntentCommandResult, aF as PluginIntentController, aG as PluginIntentCoordinator, aH as PluginIntentSnapshot, aI as PluginIntentSubmissionResult, aJ as PluginLifecycleState, P as PluginManifest, aK as PluginManifestInput, c as PluginReverseDep, aL as PluginStartupMode, aM as PluginState, aN as PluginStateKind, aO as PluginTeardown, aP as PluginUnitGraph, aQ as PluginUnitState, aR as PublishOptions, aS as RESOURCE_OWNER, aT as RESOURCE_REGISTRY, aU as RUNTIME_MESSAGE_BUS, aV as RemoteCapability, aW as RequestOf, aX as RequestOptions, aY as ResourceContext, aZ as ResourceDefinition, a_ as ResourceKey, a$ as ResourceRegistry, b0 as ResourceSnapshot, b1 as ResourceStatus, b2 as ResponseOf, b3 as RpcCallOptions, b4 as RpcCapability, b5 as RpcCapabilityBase, b6 as RpcClient, b7 as RpcHandler, b8 as RpcTransferDescriptor, b9 as RuntimeCapabilityDependency, l as RuntimeHandle, ba as RuntimeInitializationError, bb as RuntimeLimits, bc as RuntimeServiceSnapshot, bd as RuntimeSnapshot, be as RuntimeStatusListener, bf as RuntimeStatusSnapshot, bg as RuntimeUnavailableError, b as RuntimeUnitDependency, bh as RuntimeUnitDependencyInput, d as RuntimeUnitDescriptor, bi as RuntimeUnitDescriptorInput, bj as RuntimeUnitImplementationRegistry, bk as SCOPED_TASK_SCHEDULER_CAPABILITY, bl as ScopedTaskDefinition, S as ScopedTaskScheduler, bm as ScopedTaskSnapshot, i as ServiceReference, bn as SnapshotApplyResult, bo as StartupCapabilityErrorDetails, bp as StartupPluginErrorDetails, bq as StreamCapability, br as StreamCapabilityBase, bs as StreamClient, bt as StreamHandler, bu as StreamSubscribeOptions, bv as StreamSubscription, bw as StreamTransferDescriptor, bx as TransferExtractor, by as UpgradeDrainResult, U as UpgradeGate, bz as UpgradeGateRejectedError, bA as UpgradeGateState, bB as UpgradeHandshake, bC as UpgradeHandshakeResult, bD as UpgradeIoLease, bE as UpgradeMode, bF as UpgradeSession, bG as ValueParser, bH as WebLoomError, W as WindowApp, bI as assertCapability, bJ as capabilityDescriptor, bK as capabilityKey, bL as defineCapability, bM as isCapability, bN as isCapabilityDescriptor, bO as lifecycleErrorText } from './runtimeTypes-DquUCHz-.js';
|
|
3
|
-
export { k as ConnectSharedWorkerOptions, P as PeerController, d as PeerExposureOptions, c as RuntimePluginDefinition, S as SharedWorkerApp, l as SharedWorkerLike, g as StartSharedWorkerAppOptions, m as connectSharedWorker, i as createLifecycleScope, j as createResourceScope, s as startSharedWorkerApp } from './sharedWorkerHost-
|
|
4
|
-
export { C as CreateWindowAppOptions, a as createWindowApp } from './windowRuntime-
|
|
3
|
+
export { k as ConnectSharedWorkerOptions, P as PeerController, d as PeerExposureOptions, c as RuntimePluginDefinition, S as SharedWorkerApp, l as SharedWorkerLike, g as StartSharedWorkerAppOptions, m as connectSharedWorker, i as createLifecycleScope, j as createResourceScope, s as startSharedWorkerApp } from './sharedWorkerHost-KI7TIGdX.js';
|
|
4
|
+
export { C as CreateWindowAppOptions, a as createWindowApp } from './windowRuntime-BKkLPsAS.js';
|
|
5
5
|
export { c as createMessageBus } from './messageBus-CtrwkjrO.js';
|
|
6
6
|
|
|
7
7
|
/** 普通插件定义选项;插件声明只使用 typed capability 与单一启动策略。 */
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { startSharedWorkerApp } from './chunk-
|
|
2
|
-
export { connectSharedWorker } from './chunk-
|
|
3
|
-
import { capabilityDescriptor } from './chunk-
|
|
4
|
-
export { LIFECYCLE_ERROR_TEXT, LifecycleScopeRevokedError, PermissionDeniedError, PermissionLeaseRevokedError, RESOURCE_OWNER, RESOURCE_REGISTRY, RuntimeInitializationError, RuntimeUnavailableError, SCOPED_TASK_SCHEDULER_CAPABILITY, UpgradeGateRejectedError, WebLoomError, assertCapability, capabilityDescriptor, capabilityKey, createLifecycleScope, createMessageBus, createResourceScope, createWindowApp, defineCapability, isCapability, isCapabilityDescriptor, lifecycleErrorText } from './chunk-
|
|
1
|
+
export { startSharedWorkerApp } from './chunk-SX46RHDI.js';
|
|
2
|
+
export { connectSharedWorker } from './chunk-ANA6GBEI.js';
|
|
3
|
+
import { capabilityDescriptor } from './chunk-HJKPKWI7.js';
|
|
4
|
+
export { LIFECYCLE_ERROR_TEXT, LifecycleScopeRevokedError, PermissionDeniedError, PermissionLeaseRevokedError, RESOURCE_OWNER, RESOURCE_REGISTRY, RuntimeInitializationError, RuntimeUnavailableError, SCOPED_TASK_SCHEDULER_CAPABILITY, UpgradeGateRejectedError, WebLoomError, assertCapability, capabilityDescriptor, capabilityKey, createLifecycleScope, createMessageBus, createResourceScope, createWindowApp, defineCapability, isCapability, isCapabilityDescriptor, lifecycleErrorText } from './chunk-HJKPKWI7.js';
|
|
5
5
|
|
|
6
6
|
// src/contracts/messageBus.ts
|
|
7
7
|
var RUNTIME_MESSAGE_BUS = "webloom.messageBus";
|
package/dist/{messagePortServiceTransport-B0FyJr43.d.ts → messagePortServiceTransport-BYprNvQY.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { T as PluginSetup, K as Capability, bj as RuntimeUnitImplementationRegistry, aH as PluginIntentSnapshot, aF as PluginIntentController, a$ as ResourceRegistry, aZ as ResourceDefinition, bd as RuntimeSnapshot, R as RuntimeKind, aN as PluginStateKind, Y as CapabilityBridge } from './runtimeTypes-DquUCHz-.js';
|
|
2
|
-
import { R as ReceivePortLedger, a as RuntimeLimitsInput, b as RuntimeBudget } from './sharedWorkerHost-
|
|
2
|
+
import { R as ReceivePortLedger, a as RuntimeLimitsInput, b as RuntimeBudget } from './sharedWorkerHost-KI7TIGdX.js';
|
|
3
3
|
|
|
4
4
|
interface RuntimeUnitImplementation {
|
|
5
5
|
/** 产品标识。 */
|
package/dist/react.js
CHANGED
|
@@ -170,6 +170,8 @@ interface StartSharedWorkerAppOptions extends Omit<CreatePluginHostOptions, "run
|
|
|
170
170
|
interface StartSharedWorkerAppForTestingOptions extends StartSharedWorkerAppOptions {
|
|
171
171
|
/** testing 入口注入的 SharedWorkerGlobalScope 替身。 */
|
|
172
172
|
readonly globalScope: SharedWorkerScopeLike;
|
|
173
|
+
/** 仅测试用:观察每次向所有 peer 广播前构建的公共快照。 */
|
|
174
|
+
readonly snapshotObserver?: (snapshot: RuntimeStatusSnapshot) => void;
|
|
173
175
|
}
|
|
174
176
|
interface SharedWorkerApp {
|
|
175
177
|
readonly runtimeKind: "shared-worker";
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { s as CreatePluginHostOptions, x as PluginHost } from './runtimeTypes-DquUCHz-.js';
|
|
2
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-
|
|
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-
|
|
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-
|
|
3
|
+
import { z as RuntimeWireMessage, a as RuntimeTransport } from './messagePortServiceTransport-BYprNvQY.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-BYprNvQY.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-KI7TIGdX.js';
|
|
6
6
|
export { c as createMessageBus } from './messageBus-CtrwkjrO.js';
|
|
7
7
|
|
|
8
8
|
/** 可观察的 transport 发送记录。 */
|
package/dist/testing.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { startSharedWorkerAppForTesting } from './chunk-
|
|
1
|
+
export { startSharedWorkerAppForTesting } from './chunk-SX46RHDI.js';
|
|
2
2
|
export { createPluginIntentController } from './chunk-4DSINPZD.js';
|
|
3
|
-
export { connectSharedWorkerForTesting, createCapabilityBridge, createMessagePortRuntimeTransport, validateTransferables } from './chunk-
|
|
4
|
-
import { createPluginHost } from './chunk-
|
|
5
|
-
export { StartupCapabilityError, StartupPluginError, createCapabilityRegistry, createInMemoryPluginConfigStore, createLifecycleScope, createMessageBus, createPluginHost, createResourceRegistry, createResourceScope, createResourceStore, createRuntimeUnitImplementationRegistry, invokeCapabilityHandler } from './chunk-
|
|
3
|
+
export { connectSharedWorkerForTesting, createCapabilityBridge, createMessagePortRuntimeTransport, validateTransferables } from './chunk-ANA6GBEI.js';
|
|
4
|
+
import { createPluginHost } from './chunk-HJKPKWI7.js';
|
|
5
|
+
export { StartupCapabilityError, StartupPluginError, createCapabilityRegistry, createInMemoryPluginConfigStore, createLifecycleScope, createMessageBus, createPluginHost, createResourceRegistry, createResourceScope, createResourceStore, createRuntimeUnitImplementationRegistry, invokeCapabilityHandler } from './chunk-HJKPKWI7.js';
|
|
6
6
|
|
|
7
7
|
// src/testing/fakes.ts
|
|
8
8
|
function createFakeRuntimeTransport() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as CreatePluginHostOptions, x as PluginHost, W as WindowApp } from './runtimeTypes-DquUCHz-.js';
|
|
2
|
-
import { c as RuntimePluginDefinition } from './sharedWorkerHost-
|
|
2
|
+
import { c as RuntimePluginDefinition } from './sharedWorkerHost-KI7TIGdX.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,84 +1,115 @@
|
|
|
1
1
|
# WebLoom v4 验证记录
|
|
2
2
|
|
|
3
3
|
更新时间:2026-09-11(工作树验证)。本记录只写已经执行的命令和观察到的结果;
|
|
4
|
-
|
|
4
|
+
未执行的跨浏览器、产品部署和 registry-only 验收不会由本地测试推断为通过。
|
|
5
|
+
|
|
6
|
+
用户已确认 `webloom-framework@0.4.0` 已发布。本轮针对同一 v4 wire 的 patch 版本
|
|
7
|
+
`webloom-framework@0.4.1` 执行发布;发布后的 registry integrity 与消费验证将在上传后
|
|
8
|
+
补记。
|
|
5
9
|
|
|
6
10
|
## 1. WebLoom 本仓库
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
以下本地门禁均通过:
|
|
9
13
|
|
|
10
|
-
- `pnpm test:types`:TypeScript
|
|
11
|
-
capability identity。
|
|
12
|
-
|
|
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
|
-
- `
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Worker
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
26
|
-
|
|
46
|
+
真实浏览器版本:Chrome for Testing `153.0.8010.12`,Linux x64,headless。Firefox、真实
|
|
47
|
+
Safari 和 Playwright WebKit 本轮未执行,不能宣称兼容性已验收。
|
|
27
48
|
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
-
|
|
36
|
-
|
|
37
|
-
- `node scripts/
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
43
|
-
|
|
70
|
+
Demo 的验证使用当前本地 WebLoom 工作树链接;这证明源码类型和真实浏览器交互,不替代
|
|
71
|
+
registry-only frozen install。0.4.0 是上一轮已发布基线;本轮 0.4.1 的 registry-only
|
|
72
|
+
消费验证在发布后单独记录。
|
|
44
73
|
|
|
45
74
|
## 3. Keymaster
|
|
46
75
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
76
|
+
以下本地代码门禁均通过:
|
|
77
|
+
|
|
78
|
+
- `pnpm test:types`:`tsc -b`、Keymaster contract inventory gate 和临时 Git 基线回归自测
|
|
79
|
+
通过,inventory 为 75 个 identity;Coordinator response/result 负向类型 fixture 通过
|
|
80
|
+
编译保护。
|
|
81
|
+
- `pnpm test`:216 个测试文件全部通过(18 个常规批次加 2 个重型隔离批次);其中
|
|
82
|
+
Coordinator worker 113 tests、Vault service 79 tests 均通过。
|
|
83
|
+
- `pnpm build`:Vite production build 通过,3982 个 module transformed;生产产物扫描
|
|
84
|
+
通过(13 个 HTML/JS/CSS 文件)。
|
|
85
|
+
- `pnpm lint:boundaries`:storage hard-switch、plugin boundary 和 Coordinator final-I/O
|
|
86
|
+
审计均通过。
|
|
52
87
|
- `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
|
-
|
|
56
|
-
Keymaster 的 `pnpm typecheck` 在 workspace 依赖自检阶段尝试从 registry 获取
|
|
57
|
-
`webloom-framework@0.4.0` 并返回 404;因此 canonical pnpm workspace 验证仍未关闭。
|
|
58
|
-
在本地已有依赖树上直接运行 Vitest 与 `tsc -b` 只作为代码/测试证据,不能替代
|
|
59
|
-
frozen install。
|
|
60
88
|
|
|
61
|
-
|
|
62
|
-
lockfile
|
|
63
|
-
|
|
89
|
+
另外,在提交 `1edc117` 的 detached 临时 checkout 中执行
|
|
90
|
+
`pnpm install --frozen-lockfile --ignore-scripts && pnpm test:types && pnpm test`:安装
|
|
91
|
+
成功,`test:types` 通过,随后 216 个测试文件(18 个常规批次加 2 个重型隔离批次)全部
|
|
92
|
+
通过。该 fresh-install 结果也覆盖了 `@keymaster/plugin-token-bsv21` 对
|
|
93
|
+
`@noble/secp256k1` 的直接声明,以及根测试 setup 对 `@noble/secp256k1` 和
|
|
94
|
+
`@noble/hashes` 的直接声明。
|
|
64
95
|
|
|
65
|
-
|
|
96
|
+
Local/S3 真实浏览器、CORS/CAS、重启、多 tab、恢复、app-view 外部环境和公开部署仍需
|
|
97
|
+
产品环境证据;单元测试和 fresh-install 通过不等价于这些验收已经关闭。
|
|
66
98
|
|
|
67
|
-
|
|
99
|
+
## 4. 发布与 registry 边界
|
|
68
100
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
- `node scripts/check-webloom-registry-consumer.mjs` fail-closed:registry-only 临时消费
|
|
74
|
-
目录返回 npm `ETARGET`,不能安装 `webloom-framework@0.4.0`。
|
|
101
|
+
上一轮已实际完成 `webloom-framework@0.4.0` 的 registry integrity、Keymaster/Demo
|
|
102
|
+
lockfile 一致性、release-boundary 和 registry-only consumer 验证;该版本是本轮的已发布
|
|
103
|
+
基线。本轮发布 `webloom-framework@0.4.1`,发布后必须从 registry 读取真实 `dist.integrity`
|
|
104
|
+
并单独执行三仓 frozen-install 消费验证,不能用本地 tarball 或下游 lockfile 代替。
|
|
75
105
|
|
|
76
|
-
|
|
77
|
-
integrity 核对和 frozen downstream install 尚未完成”。不执行自动 npm publish,也不把
|
|
78
|
-
本地 tarball 或 workspace symlink 当作公开发布证据。
|
|
106
|
+
## 5. 尚未关闭的跨环境验收
|
|
79
107
|
|
|
80
|
-
|
|
108
|
+
- Firefox、真实 Safari、Playwright WebKit 的 module SharedWorker、双向 transfer 和 stream
|
|
109
|
+
组合尚未执行。
|
|
110
|
+
- Keymaster 的 app-view、Local/S3/CORS/CAS、重启/多 tab、恢复 ledger、不可逆 I/O 和部署
|
|
111
|
+
生产门禁没有本轮完整外部证据。
|
|
81
112
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
113
|
+
因此当前结论是:本轮四类 review 代码阻塞已完成修复,WebLoom/Demo 的本地与 Chromium
|
|
114
|
+
证据已补齐,0.4.1 的 registry 发布与三仓消费验证待本轮上传后补记;跨浏览器与 Keymaster
|
|
115
|
+
产品/部署验收仍保持明确的未验收状态。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webloom-framework",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
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 &&
|
|
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"
|