webloom-framework 0.4.2 → 0.4.3
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 +11 -1
- package/dist/advanced.d.ts +8 -8
- package/dist/advanced.js +4 -4
- package/dist/advanced.js.map +1 -1
- package/dist/{chunk-RRNUE457.js → chunk-UZAO6ORB.js} +110 -26
- package/dist/chunk-UZAO6ORB.js.map +1 -0
- package/dist/{chunk-XVD7ALPV.js → chunk-YIIDRFHK.js} +106 -15
- package/dist/chunk-YIIDRFHK.js.map +1 -0
- package/dist/{chunk-CKML74MG.js → chunk-ZP5QYTXX.js} +4 -4
- package/dist/chunk-ZP5QYTXX.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/{messageBus-BDtkjs6y.d.ts → messageBus-DigYfj74.d.ts} +1 -1
- package/dist/messagePortServiceTransport-B9-24RK6.d.ts +355 -0
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/{runtimeTypes-CleHMFaq.d.ts → runtimeTypes-50LVQs0h.d.ts} +7 -220
- package/dist/{sharedWorkerHost-BNMUW-8v.d.ts → sharedWorkerHost-DikS18hA.d.ts} +55 -2
- package/dist/testing.d.ts +6 -6
- package/dist/testing.js +4 -4
- package/dist/{windowRuntime-BGl_jfbK.d.ts → windowRuntime-e1Tn6SnN.d.ts} +2 -2
- package/docs/api.md +28 -1
- package/docs/proposals/webloom-v4/requirements.md +1 -1
- package/package.json +1 -1
- package/dist/chunk-CKML74MG.js.map +0 -1
- package/dist/chunk-RRNUE457.js.map +0 -1
- package/dist/chunk-XVD7ALPV.js.map +0 -1
- package/dist/messagePortServiceTransport-DyNmdgoa.d.ts +0 -150
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { ap as PluginSetup, ak as Capability, bQ as RuntimeUnitImplementationRegistry, bb as PluginIntentSnapshot, b9 as PluginIntentController, bv as ResourceRegistry, bt as ResourceDefinition, k as RuntimeEndpointBinding, bG as RuntimeEndpointState, m as RuntimeDrainResult, ab as RuntimeWireMessage, R as RuntimeKind, as as CapabilityBridge } from './runtimeTypes-CleHMFaq.js';
|
|
2
|
-
import { R as ReceivePortLedger, a as RuntimeLimitsInput, b as RuntimeBudget } from './sharedWorkerHost-BNMUW-8v.js';
|
|
3
|
-
|
|
4
|
-
interface RuntimeUnitImplementation {
|
|
5
|
-
/** 产品标识。 */
|
|
6
|
-
pluginId: string;
|
|
7
|
-
/** 稳定运行单元标识。 */
|
|
8
|
-
unitId: string;
|
|
9
|
-
/** 当前环境的可执行入口。 */
|
|
10
|
-
setup: PluginSetup;
|
|
11
|
-
/** 当前 realm 的 typed capability 定义。 */
|
|
12
|
-
capabilities?: readonly Capability[];
|
|
13
|
-
}
|
|
14
|
-
/** 创建一个拒绝重复注册、按产品和单元查找实现的运行时注册表。 */
|
|
15
|
-
declare function createRuntimeUnitImplementationRegistry(implementations?: readonly RuntimeUnitImplementation[]): RuntimeUnitImplementationRegistry & {
|
|
16
|
-
register(implementation: RuntimeUnitImplementation): void;
|
|
17
|
-
unregister(pluginId: string, unitId: string): void;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
interface CreatePluginIntentControllerOptions {
|
|
21
|
-
/** 当前控制面启动身份;Worker 重启时应传入新值。 */
|
|
22
|
-
authorityInstanceId?: string;
|
|
23
|
-
/** Worker 恢复后读取的平台意图。 */
|
|
24
|
-
initial?: Partial<PluginIntentSnapshot>;
|
|
25
|
-
/** 将候选快照原子写入平台存储;缺省表示内存控制面(测试用)。 */
|
|
26
|
-
persist?: (snapshot: PluginIntentSnapshot) => Promise<void>;
|
|
27
|
-
/** 有界去重记录数量,避免 commandId 永久增长。 */
|
|
28
|
-
maxCommandRecords?: number;
|
|
29
|
-
}
|
|
30
|
-
/** 创建单一控制面上的插件意图控制器。 */
|
|
31
|
-
declare function createPluginIntentController(options?: CreatePluginIntentControllerOptions): PluginIntentController;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 资源注册表实现
|
|
35
|
-
*
|
|
36
|
-
* 设计缘由:管理资源定义的注册和查询,支持 owner-aware 生命周期。
|
|
37
|
-
* 重复 id 抛错,disable 时可回收。
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/** 资源注册表实现 */
|
|
41
|
-
declare function createResourceRegistry(): ResourceRegistry;
|
|
42
|
-
/** Internal runtime hook; deliberately absent from ResourceRegistry's public type. */
|
|
43
|
-
declare function registerOwnedResource(registry: ResourceRegistry, ownerId: string, definition: ResourceDefinition<any, any>): void;
|
|
44
|
-
|
|
45
|
-
/** 关闭握手默认等待时间;调用方可以传入更严格的 deadline。 */
|
|
46
|
-
declare const DEFAULT_RUNTIME_DRAIN_TIMEOUT_MS = 2000;
|
|
47
|
-
/** 一个需要等待真实执行槽结束的框架参与者。 */
|
|
48
|
-
interface RuntimeDrainParticipant {
|
|
49
|
-
/** 等待该参与者自己的真实执行槽结束。 */
|
|
50
|
-
readonly drain: () => Promise<void>;
|
|
51
|
-
/** deadline 到达时报告仍未结束的真实执行槽数量。 */
|
|
52
|
-
readonly pending: () => number;
|
|
53
|
-
}
|
|
54
|
-
interface RuntimeEndpointSession {
|
|
55
|
-
/** 本端由框架生成、不可复用的 endpoint 身份。 */
|
|
56
|
-
readonly binding: RuntimeEndpointBinding;
|
|
57
|
-
/** 已由对端首条合法框架消息建立的身份;尚未建立时为空。 */
|
|
58
|
-
readonly remoteBinding?: RuntimeEndpointBinding;
|
|
59
|
-
/** active -> closing -> closed。 */
|
|
60
|
-
readonly state: RuntimeEndpointState;
|
|
61
|
-
/** 最近一次同步关闭原因;只用于本地诊断。 */
|
|
62
|
-
readonly closeReason?: string;
|
|
63
|
-
/** 本端允许的最大 drain 时间;远端只能进一步收紧,不能扩大。 */
|
|
64
|
-
readonly maxDrainTimeoutMs: number;
|
|
65
|
-
/** 精确比较并建立对端 binding;不接受后续替换。 */
|
|
66
|
-
acceptRemoteBinding(binding: unknown): boolean;
|
|
67
|
-
/** 同步停止准入、触发撤权和 abort;幂等。 */
|
|
68
|
-
beginClose(reason?: string): void;
|
|
69
|
-
/** 等待全部参与者排空,始终受 bounded deadline 限制。 */
|
|
70
|
-
drain(timeoutMs?: number): Promise<RuntimeDrainResult>;
|
|
71
|
-
/** 物理 transport 即将关闭时标记终态;幂等。 */
|
|
72
|
-
close(): void;
|
|
73
|
-
/** 注册同步关闭回调。 */
|
|
74
|
-
onBeginClose(listener: (reason: string) => void): () => void;
|
|
75
|
-
/** 注册物理关闭回调。 */
|
|
76
|
-
onClosed(listener: () => void): () => void;
|
|
77
|
-
/** 注册一个真实执行排空参与者。 */
|
|
78
|
-
registerDrainParticipant(participant: RuntimeDrainParticipant): () => void;
|
|
79
|
-
}
|
|
80
|
-
/** 判断值是否为完整的框架 endpoint binding。 */
|
|
81
|
-
declare function isRuntimeEndpointBinding(value: unknown): value is RuntimeEndpointBinding;
|
|
82
|
-
/** 只比较框架 binding,不比较任何产品领域字段。 */
|
|
83
|
-
declare function sameRuntimeEndpointBinding(left: RuntimeEndpointBinding | undefined, right: RuntimeEndpointBinding | undefined): boolean;
|
|
84
|
-
/** 为一个 Runtime endpoint 生成不可复用的连接身份。 */
|
|
85
|
-
declare function createRuntimeEndpointBinding(runtimeInstanceId: string): RuntimeEndpointBinding;
|
|
86
|
-
/** 创建一条由 Runtime/transport 共用的 endpoint session。 */
|
|
87
|
-
declare function createRuntimeEndpointSession(binding: RuntimeEndpointBinding, options?: {
|
|
88
|
-
readonly defaultDrainTimeoutMs?: number;
|
|
89
|
-
}): RuntimeEndpointSession;
|
|
90
|
-
|
|
91
|
-
interface RuntimeReceiveMetadata {
|
|
92
|
-
/** 本次 MessageEvent 实际携带的业务 MessagePort;仅 transport 本地使用。 */
|
|
93
|
-
readonly ports?: readonly MessagePort[];
|
|
94
|
-
/** 由物理 endpoint transport 创建的一次性接收资源账本。 */
|
|
95
|
-
readonly ledger?: ReceivePortLedger;
|
|
96
|
-
/** 物理 endpoint 已完成一次 codec decode。 */
|
|
97
|
-
readonly decoded?: boolean;
|
|
98
|
-
}
|
|
99
|
-
interface RuntimeTransport {
|
|
100
|
-
/** 发送已验证 v4 message;transfer 由契约 extractor 提供。 */
|
|
101
|
-
send(message: RuntimeWireMessage, transfer?: readonly Transferable[]): void;
|
|
102
|
-
/** 订阅接收 message 及本次事件的本地 transfer 元数据。 */
|
|
103
|
-
subscribe(listener: (message: RuntimeWireMessage, metadata?: RuntimeReceiveMetadata) => void): () => void;
|
|
104
|
-
/** 关闭本端传输。 */
|
|
105
|
-
close?(): void;
|
|
106
|
-
/** 物理 endpoint 对 decode/接收账本错误的统一通知。 */
|
|
107
|
-
subscribeError?(listener: (error: unknown, metadata?: RuntimeReceiveMetadata) => void): () => void;
|
|
108
|
-
}
|
|
109
|
-
interface CreateCapabilityBridgeOptions {
|
|
110
|
-
/** 底层双向 transport。 */
|
|
111
|
-
readonly transport: RuntimeTransport;
|
|
112
|
-
/** 预期的对端 Runtime 类型。 */
|
|
113
|
-
readonly remoteRuntimeKind?: RuntimeKind;
|
|
114
|
-
/** 预期的对端逻辑 Runtime id。 */
|
|
115
|
-
readonly remoteRuntimeId?: string;
|
|
116
|
-
/** 默认调用预算。 */
|
|
117
|
-
readonly defaultCallTimeoutMs?: number;
|
|
118
|
-
/** 可信 Runtime/advanced 装配提供的预算;只能收紧 v4 默认值。 */
|
|
119
|
-
readonly limits?: RuntimeLimitsInput;
|
|
120
|
-
/** 可选的 Runtime 方向共享计数器。 */
|
|
121
|
-
readonly budget?: RuntimeBudget;
|
|
122
|
-
/** 当前物理 endpoint 的框架 binding;省略时由 bridge 生成。 */
|
|
123
|
-
readonly binding?: RuntimeEndpointBinding;
|
|
124
|
-
/** 与反向 provider 共用的 endpoint session。 */
|
|
125
|
-
readonly session?: RuntimeEndpointSession;
|
|
126
|
-
/** 关闭握手默认 drain deadline。 */
|
|
127
|
-
readonly drainTimeoutMs?: number;
|
|
128
|
-
}
|
|
129
|
-
/** 创建按 peer 绑定、可撤销且支持 typed stream 的 bridge。 */
|
|
130
|
-
declare function createCapabilityBridge(options: CreateCapabilityBridgeOptions): CapabilityBridge & {
|
|
131
|
-
readonly pendingCallCount: number;
|
|
132
|
-
readonly activeStreamCount: number;
|
|
133
|
-
readonly retainedPayloadBytes: number;
|
|
134
|
-
};
|
|
135
|
-
/** 内部 typed transfer 校验 helper;不接受 call 级临时 transfer 数组。 */
|
|
136
|
-
declare function validateTransferables(value: unknown, transfer: readonly Transferable[] | undefined, limits?: RuntimeLimitsInput): readonly Transferable[];
|
|
137
|
-
|
|
138
|
-
interface MessagePortLike {
|
|
139
|
-
addEventListener(type: "message" | "messageerror", listener: (event: MessageEvent) => void): void;
|
|
140
|
-
removeEventListener(type: "message" | "messageerror", listener: (event: MessageEvent) => void): void;
|
|
141
|
-
postMessage(message: unknown, transfer?: readonly Transferable[]): void;
|
|
142
|
-
start?(): void;
|
|
143
|
-
close?(): void;
|
|
144
|
-
}
|
|
145
|
-
/** 将一个真实 MessagePort 绑定为双向 v4 transport。 */
|
|
146
|
-
declare function createMessagePortRuntimeTransport(port: MessagePortLike, options?: {
|
|
147
|
-
readonly limits?: RuntimeLimitsInput;
|
|
148
|
-
}): RuntimeTransport;
|
|
149
|
-
|
|
150
|
-
export { type CreateCapabilityBridgeOptions as C, DEFAULT_RUNTIME_DRAIN_TIMEOUT_MS as D, type MessagePortLike as M, type RuntimeTransport as R, type RuntimeEndpointSession as a, type CreatePluginIntentControllerOptions as b, type RuntimeDrainParticipant as c, type RuntimeReceiveMetadata as d, type RuntimeUnitImplementation as e, createCapabilityBridge as f, createMessagePortRuntimeTransport as g, createPluginIntentController as h, createResourceRegistry as i, createRuntimeEndpointBinding as j, createRuntimeEndpointSession as k, createRuntimeUnitImplementationRegistry as l, isRuntimeEndpointBinding as m, registerOwnedResource as r, sameRuntimeEndpointBinding as s, validateTransferables as v };
|