@proteus-vue/render-backend 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -0
- package/dist/basic-containers.d.ts +87 -0
- package/dist/borrow-checker.d.ts +21 -0
- package/dist/conformance-component.d.ts +32 -0
- package/dist/conformance.d.ts +18 -0
- package/dist/container-conformance.d.ts +53 -0
- package/dist/container-spi.d.ts +169 -0
- package/dist/dispatcher.d.ts +98 -0
- package/dist/flutter.d.ts +16 -0
- package/dist/headless.d.ts +12 -0
- package/dist/host-conformance.d.ts +71 -0
- package/dist/host-matrix.d.ts +74 -0
- package/dist/hot-switch.d.ts +24 -0
- package/dist/hybrid.d.ts +60 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +4291 -0
- package/dist/native.d.ts +42 -0
- package/dist/ownership-observability.d.ts +99 -0
- package/dist/ownership.d.ts +206 -0
- package/dist/page-ownership.d.ts +55 -0
- package/dist/pss.d.ts +54 -0
- package/dist/spi.d.ts +73 -0
- package/dist/stack-container.d.ts +43 -0
- package/dist/superapp-container.d.ts +47 -0
- package/dist/vue-bridge.d.ts +22 -0
- package/dist/vue-dom.d.ts +6 -0
- package/dist/web-host.d.ts +35 -0
- package/package.json +30 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# @proteus-vue/render-backend
|
|
2
|
+
|
|
3
|
+
> **G-27 可插拔渲染后端 SPI**(`docs/proteus-render-backend-1-plan/`)· M1.4 原型 + G-31 B5 conformance 基础设施
|
|
4
|
+
|
|
5
|
+
## 一句话
|
|
6
|
+
|
|
7
|
+
**后端只需实现 `ProteusRenderBackend` 接口即可接入任意渲染引擎**——nodeOps 刻意对齐 Vue(`createElement/insert/remove/patchProp/setText`),Vue Custom Renderer 即零成本后端。
|
|
8
|
+
|
|
9
|
+
## 内容
|
|
10
|
+
|
|
11
|
+
| 模块 | 说明 |
|
|
12
|
+
|------|------|
|
|
13
|
+
| `spi.ts` | `ProteusRenderBackend` 接口 + `BackendCapabilities` 能力声明 + IRNode/LayoutConstraints/NormalizedInputEvent 类型(唯一事实源,对齐 plan 02-backend-spi.md) |
|
|
14
|
+
| `conformance.ts` | `runBackendConformance(backend)` 接口完整性自检(RND002:后端必须通过)——必选方法存在 / createElement 唯一句柄 / 能力枚举合法 / 可选方法类型 |
|
|
15
|
+
| `conformance-component.ts` | **★G-31 B5 组件渲染快照基础设施**:`renderComponentSnapshot(backend, ir, readControl)` 驱动 nodeOps 渲染 C-IR → 归一化快照树 + `createControlReader` 内置后端控件 readback(对照参考表见 @proteus-vue/component-ir `conformance.ts`) |
|
|
16
|
+
| `headless.ts` | **HeadlessBackend**:内存节点树(零依赖)——SSR / 测试断言 / AI Agent 无设备回归(B3 前置 + conformance 参考实现;★B5 消费 semantic) |
|
|
17
|
+
| `vue-dom.ts` | **VueDomBackend**:DOM nodeOps(Web 端官方后端,B2)——事件归一化 onXxx → addEventListener;★B5 补全 18 语义 SEMANTIC_WEB_MAP |
|
|
18
|
+
| `native.ts` | **NativeBackend**(B4):nodeOps → 原生视图(iOS/Android/鸿蒙三平台语义映射 SEMANTIC_NATIVE_MAPS + 宿主适配器桥 + mock adapter) |
|
|
19
|
+
| `flutter.ts` | **FlutterBackend**(B5 spike):Proteus 语义 → Flutter widget 树(★B5 补 semantic 消费 SEMANTIC_FLUTTER_MAP) |
|
|
20
|
+
| `hybrid.ts` | **★G-27 B6 混合渲染**:`createHybridRenderer`(多后端统一渲染面——区域级切后端 + 节点归属委托 + 纹理共享广播)· `textureRef`(跨后端纹理引用)· `runHybridConformance`(混合器自检)· DevTools 路由 trace(semantic → 后端 决策记录) |
|
|
21
|
+
| `dispatcher.ts` | **★G-41 B1**:`createNodeOpsDispatcher`(方案 B 全局转发层——`currentBackend` 一次间接调用,热切换 = 赋值)+ `toIRNode`(原语表驱动)+ nodeOps trace(H-03 双引擎一致机器证据) |
|
|
22
|
+
| `host-conformance.ts` | **★G-41 B2**:`runHostConformance`(H-01~H-08 共 32 项跨层组合 conformance——CMP058 上线门禁) |
|
|
23
|
+
| `vue-bridge.ts` | **★G-41 B3**:真实 Vue3 `createRenderer` 接入——`createVueRendererOptions(dispatch)` / `createProteusRenderer`(标准 SFC/App 落到任意后端) |
|
|
24
|
+
| `web-host.ts` | **★G-41 B4**:`createWebHostRuntime`(Web 宿主骨架——Main + Worker + EventLoop + bindPageVisibility) |
|
|
25
|
+
| `hot-switch.ts` | **★G-41 B5**:`createBackendSwitcher`(热切换生产级三策略——rebuild 开发期 / rehydrate 保状态 / hybrid 复用 G-27 B6) |
|
|
26
|
+
| `host-matrix.ts` | **★G-41 B6 组合矩阵**:6 宿主 × 6 引擎 = 36 组合 Tier 声明(HOST_ENGINE_MATRIX)+ `runComboConformance`(组合级 7 项:注册顺序/语义指纹/渲染完整性/控件映射/热切换等价 + 引擎级 conformance)+ `runHostEngineMatrix`(Tier 1 全部验证 failed===0)+ `formatMatrixReport` |
|
|
27
|
+
| `container-spi.ts` | **★G-42 B1**:`ProteusHostContainer` 插头(页面生命周期状态机 + 五原子销毁 FIVE_ATOMIC_STEPS 校验 + 六容器画像 CONTAINER_PROFILES) |
|
|
28
|
+
| `stack-container.ts` | **★G-42 B2 + G-43 B3**:`createStackContainer`(页面栈 + 五原子销毁 + 框架代管资源池 + LRU;`StackContainerOptions.ownership` 启用后每页伴随所有权上下文)· `createResourcePool` / `createQuotaManager` |
|
|
29
|
+
| `container-conformance.ts` | **★G-42 B3**:`runContainerConformance`(C-01~C-08 38 项)+ `scanRepoForFork`(严禁 fork 机器指纹)+ `checkBizManifest` 安全网关 |
|
|
30
|
+
| `superapp-container.ts` | **★G-42 B4**:`createSuperAppContainer`(业务沙箱 + 崩溃隔离 L1-L3 + 自动重启 + 签名/白名单网关——页面栈委托 Stack + ownership pass-through) |
|
|
31
|
+
| `basic-containers.ts` | **★G-42 B6 其余 4 容器**:`createSinglePageContainer`(单页/卡片/IoT 单槽 replace)/ `createEmbeddedContainer`(宿主挂载点工厂——Tier 3)/ `createWindowContainer`(多窗口各持栈 + 聚焦代理)/ `createMiniProgramContainer`(navigateTo/redirectTo/reLaunch/switchTab tab 保活/navigateBack + 10 层治理 + L1 沙箱)——全部过 conformance(能力门控诚实 SKIP)+ G-43 B3 ownership 接入 |
|
|
32
|
+
| `ownership.ts` | **★G-43 B1**:`Owned<T>`(Move 语义)/ `Borrow` / `Weak` / `Managed` + `OwnershipGraph`(孤儿/泄漏检测)+ Drop 五阶段协议 |
|
|
33
|
+
| `borrow-checker.ts` | **★G-43 B2**:`analyzeOwnershipSource`(源码级借用检查 B-01~B-08 + PSS strict/loose/off——编译期拦截 use-after-move/double-move/借用逃逸) |
|
|
34
|
+
| `page-ownership.ts` | **★G-43 B3**:`createPageOwnership`(页面所有权上下文——G-42 五原子第 3 步 releaseResources 委托 Drop 协议:forceDrop 强制回收 + Managed 自动释放 + 配额兜底归零;`container.ownershipOf(pageId)` 登记入口) |
|
|
35
|
+
| `ownership-observability.ts` | **★G-43 B4 DevTools 所有权图数据层**:`OwnershipGraph.subscribe` mutation 事件流 → `createOwnershipHistory`(alloc/drop 时间线)/ `createOwnershipCounters`(生产采样 O(1))/ `diagnoseOwnershipIssues`(V-02 泄漏路径·V-03 长期借用·V-04 跨页强引用(strong 边)·V-05 无主资源)/ `buildOwnershipTimeline`(V-06 alloc/drop 配对)/ `formatOwnershipDiagnosis`(面板/CLI 报告契约) |
|
|
36
|
+
| `pss.ts` | **★G-43 B5 PSS 编译器支持**:`resolvePssMode`(文件头 pragma `@proteus-pss:` 三级声明)/ `analyzePss`(P1~P9 限制 + CMP071 ref(Owned) 拦截)/ `insertScopeDrops`(作用域自动 drop 插入——strict 不写 drop 也能正确释放)/ `runPss`(B 规则 + P 限制 + autoDrop 管线,strict 阻断构建) |
|
|
37
|
+
|
|
38
|
+
## 用法
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createHeadlessBackend, createVueDomBackend, runBackendConformance } from '@proteus-vue/render-backend'
|
|
42
|
+
|
|
43
|
+
const backend = createHeadlessBackend()
|
|
44
|
+
const result = runBackendConformance(backend) // { ok: true, checks: [...] } —— RND002 强制
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 组件 Conformance(G-31 B5)
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { createNativeBackend, renderComponentSnapshot, createControlReader } from '@proteus-vue/render-backend'
|
|
51
|
+
import { checkComponentSnapshot } from '@proteus-vue/component-ir' // 参考表对照
|
|
52
|
+
|
|
53
|
+
const backend = createNativeBackend(undefined, 'android')
|
|
54
|
+
const snap = renderComponentSnapshot(backend, ir, createControlReader(backend.id))
|
|
55
|
+
const result = checkComponentSnapshot(backend.id, snap) // 控件 readback == SEMANTIC_BACKEND_MAP?
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 能力协商(BackendCapabilities)
|
|
59
|
+
|
|
60
|
+
框架按后端声明的能力自动降级(对齐 G-22 CapabilityRegistry),不按 if/else 判断平台:
|
|
61
|
+
`layout`(yoga/native/none)· `glass`(L3/L2/L1/none)· `blur` · `animation` · `textureSharing`(混合渲染)· `remoteRendering`(TV/车机)· `ssr` · `input`(touch/cursor/remote/dial/voice)
|
|
62
|
+
|
|
63
|
+
## 严格规则
|
|
64
|
+
|
|
65
|
+
- **RND001**:禁止业务直调后端专有 API;走 `p-*` 或 Backend SPI
|
|
66
|
+
- **RND002**:后端必须通过 conformance test
|
|
67
|
+
- **RND003**:布局语义不得硬编码为某后端算法
|
|
68
|
+
- **RND004**:混合后端须声明纹理/事件边界
|
|
69
|
+
- **RND005**:后端不得在 IR 层外修改组件树
|
|
70
|
+
|
|
71
|
+
## 路线
|
|
72
|
+
|
|
73
|
+
B1 SPI+conformance ✅ → B2 VueDom ✅ → B3 Headless(Agent 回归)→ B4 Native(UIKit nodeOps)→ B5 Flutter(Embedder C ABI)+ **G-31 B5 conformance 快照基础设施 ✅** → B6 混合渲染 + DevTools
|
|
74
|
+
|
|
75
|
+
**G-27 B1-B6 全落地(#293-#331)**;宿主层三 plan 亦已落地:**G-41**(dispatcher/conformance/vue-bridge/web-host/hot-switch/**host-matrix**,B1-B6,#342-#359)· **G-42**(container-spi/stack-container/conformance/superapp/repo CLI + **basic-containers 四容器**,B1-B6,#347-#358;余「真实 App 验证」需生产 App)· **G-43**(ownership/borrow-checker/page-ownership/ownership-observability/pss,B1-B5,#352-#357;余 B6 跨设备转移需真机)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { PageConfig, PageHandle, ProteusHostContainer, BusinessSandbox } from './container-spi';
|
|
2
|
+
import type { StackContainer } from './stack-container';
|
|
3
|
+
import type { StackPolicy } from './container-spi';
|
|
4
|
+
import type { PageOwnership } from './page-ownership';
|
|
5
|
+
import type { OwnershipGraph } from './ownership';
|
|
6
|
+
interface SingleSlotOptions {
|
|
7
|
+
/** 所有权图接入(G-43 B3——每页伴随所有权上下文) */
|
|
8
|
+
ownership?: {
|
|
9
|
+
graph: OwnershipGraph;
|
|
10
|
+
quotaBytes?: number;
|
|
11
|
+
};
|
|
12
|
+
/** ★Embedded:宿主挂载点工厂(config → 宿主提供的挂载元素;缺省 {} 占位) */
|
|
13
|
+
getHostMountPoint?: (config: PageConfig) => unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface SinglePageContainer extends ProteusHostContainer {
|
|
16
|
+
readonly id: 'singlepage';
|
|
17
|
+
ownershipOf(pageId: string): PageOwnership | null;
|
|
18
|
+
}
|
|
19
|
+
/** ★G-42 B6:单页容器——同一时刻至多一个页面,push = 替换(销毁旧页 → 挂新页) */
|
|
20
|
+
export declare function createSinglePageContainer(opts?: SingleSlotOptions): SinglePageContainer;
|
|
21
|
+
export interface EmbeddedContainer extends ProteusHostContainer {
|
|
22
|
+
readonly id: 'embedded';
|
|
23
|
+
ownershipOf(pageId: string): PageOwnership | null;
|
|
24
|
+
}
|
|
25
|
+
/** ★G-42 B6:嵌入容器——单视图嵌入宿主页面(G-30 Tier 3),宿主经 getHostMountPoint 提供挂载点 */
|
|
26
|
+
export declare function createEmbeddedContainer(opts?: SingleSlotOptions): EmbeddedContainer;
|
|
27
|
+
export interface WindowContainerOptions {
|
|
28
|
+
policy?: StackPolicy;
|
|
29
|
+
quotaLimitBytes?: number;
|
|
30
|
+
ownership?: {
|
|
31
|
+
graph: OwnershipGraph;
|
|
32
|
+
quotaBytes?: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface WindowContainer extends ProteusHostContainer {
|
|
36
|
+
readonly id: 'window';
|
|
37
|
+
/** 创建窗口(返回该窗口的栈容器并聚焦) */
|
|
38
|
+
createWindow(windowId?: string): StackContainer;
|
|
39
|
+
/** 销毁窗口(窗口内全部页面五原子销毁) */
|
|
40
|
+
destroyWindow(windowId: string): Promise<void>;
|
|
41
|
+
/** 聚焦窗口(SPI 页面操作代理目标) */
|
|
42
|
+
focusWindow(windowId: string): void;
|
|
43
|
+
listWindows(): string[];
|
|
44
|
+
readonly focusedWindow: string | null;
|
|
45
|
+
ownershipOf(pageId: string): PageOwnership | null;
|
|
46
|
+
onWindow(event: 'window-created' | 'window-destroyed' | 'window-focused', cb: (payload: unknown) => void): void;
|
|
47
|
+
}
|
|
48
|
+
/** ★G-42 B6:多窗口容器——每窗口一个完整页面栈(委托 StackContainer),SPI 操作代理聚焦窗口 */
|
|
49
|
+
export declare function createWindowContainer(opts?: WindowContainerOptions): WindowContainer;
|
|
50
|
+
export interface MiniProgramContainerOptions {
|
|
51
|
+
policy?: Partial<StackPolicy>;
|
|
52
|
+
quotaLimitBytes?: number;
|
|
53
|
+
ownership?: {
|
|
54
|
+
graph: OwnershipGraph;
|
|
55
|
+
quotaBytes?: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface MiniProgramTabConfig {
|
|
59
|
+
readonly pageId: string;
|
|
60
|
+
readonly irId: string;
|
|
61
|
+
}
|
|
62
|
+
export interface MiniProgramSandbox extends BusinessSandbox {
|
|
63
|
+
scope: {
|
|
64
|
+
bizId: string;
|
|
65
|
+
values: Record<string, unknown>;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface MiniProgramContainer extends ProteusHostContainer {
|
|
69
|
+
readonly id: 'miniprogram';
|
|
70
|
+
/** 压栈导航(wx.navigateTo——10 层上限,超限显式拒绝) */
|
|
71
|
+
navigateTo(config: PageConfig): Promise<PageHandle>;
|
|
72
|
+
/** 替换栈顶(wx.redirectTo) */
|
|
73
|
+
redirectTo(config: PageConfig): Promise<PageHandle>;
|
|
74
|
+
/** 重启(wx.reLaunch——清栈后压新页) */
|
|
75
|
+
reLaunch(config: PageConfig): Promise<PageHandle>;
|
|
76
|
+
/** 切 tab(wx.switchTab——非 tab 页全销毁,tab 页 keep-alive 常驻) */
|
|
77
|
+
switchTab(pageId: string): Promise<PageHandle>;
|
|
78
|
+
/** 返回(wx.navigateBack) */
|
|
79
|
+
navigateBack(): Promise<PageHandle | null>;
|
|
80
|
+
/** 注册 tab 页(switchTab 前必须注册) */
|
|
81
|
+
registerTab(config: MiniProgramTabConfig): void;
|
|
82
|
+
listTabs(): string[];
|
|
83
|
+
ownershipOf(pageId: string): PageOwnership | null;
|
|
84
|
+
}
|
|
85
|
+
/** ★G-42 B6:小程序容器——页面栈导航语义(10 层上限)+ tab keep-alive + L1 沙箱(scope 隔离) */
|
|
86
|
+
export declare function createMiniProgramContainer(opts?: MiniProgramContainerOptions): MiniProgramContainer;
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type BorrowRule = 'B-01' | 'B-02' | 'B-03' | 'B-04' | 'B-05' | 'B-06' | 'B-07' | 'B-08';
|
|
2
|
+
export type BorrowSeverity = 'error' | 'warning';
|
|
3
|
+
export interface BorrowDiagnostic {
|
|
4
|
+
rule: BorrowRule;
|
|
5
|
+
severity: BorrowSeverity;
|
|
6
|
+
line: number;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BorrowAnalysisResult {
|
|
10
|
+
diagnostics: BorrowDiagnostic[];
|
|
11
|
+
/** strict + 有 error → 阻断构建 */
|
|
12
|
+
blocksBuild: boolean;
|
|
13
|
+
/** 参与分析的 Owned 变量名 */
|
|
14
|
+
ownedVars: string[];
|
|
15
|
+
}
|
|
16
|
+
export type PssMode = 'strict' | 'loose' | 'off';
|
|
17
|
+
export interface BorrowCheckerOptions {
|
|
18
|
+
mode?: PssMode;
|
|
19
|
+
}
|
|
20
|
+
/** ★G-43 B2:源码级借用检查(PSS strict/loose/off——B-01~B-08) */
|
|
21
|
+
export declare function analyzeOwnershipSource(source: string, opts?: BorrowCheckerOptions): BorrowAnalysisResult;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IRNode, NodeHandle, ProteusRenderBackend } from './spi';
|
|
2
|
+
/** 归一化渲染节点快照(IR 级:与平台无关的「语义 → 控件」描述;golden diff / Agent 断言载体) */
|
|
3
|
+
export interface RenderNodeSnapshot {
|
|
4
|
+
/** C-IR type(源码标签——p-grid/view/...) */
|
|
5
|
+
type: string;
|
|
6
|
+
/** 语义(无 semantic 时 = type,即 Layer 1 兼容层标签) */
|
|
7
|
+
semantic: string;
|
|
8
|
+
/** 后端实际渲染的控件类型(readback:tag.class / 原生视图类型 / widget 名 / headless 类型) */
|
|
9
|
+
control: string;
|
|
10
|
+
/** 透传约束属性(C-IR props) */
|
|
11
|
+
props: Record<string, unknown>;
|
|
12
|
+
text: string;
|
|
13
|
+
children: RenderNodeSnapshot[];
|
|
14
|
+
}
|
|
15
|
+
/** 从后端句柄读取控件类型(后端实现者可为自定义句柄注入自己的 reader) */
|
|
16
|
+
export type ControlReader = (handle: NodeHandle) => string;
|
|
17
|
+
/**
|
|
18
|
+
* 内置后端的默认控件 reader(句柄形状由 render-backend 拥有)
|
|
19
|
+
* - vue-dom:tagName + class(div.proteus-grid)——与 SEMANTIC_WEB_MAP 产出一致
|
|
20
|
+
* - native-*:NativeViewDescriptor.type(UICollectionView/GridLayoutManager/Grid)
|
|
21
|
+
* - flutter:FlutterWidgetDescriptor.widget(GridView/Text/...)
|
|
22
|
+
* - headless:HeadlessNode.type(box/grid/...)
|
|
23
|
+
* - 其他/未知:取句柄的 type 字段,缺省字符串化(外部后端可自行注入 reader)
|
|
24
|
+
*/
|
|
25
|
+
export declare function createControlReader(backendId: string): ControlReader;
|
|
26
|
+
/**
|
|
27
|
+
* 驱动后端 nodeOps 渲染一棵 C-IR 树,归一化为快照树
|
|
28
|
+
* (createElement + patchProp + insert——与真实渲染路径一致;setText 由文本节点单独触发,此处不涉及)
|
|
29
|
+
* ★关键:渲染的是 IRNode.semantic(Layout 0 语义),不是 tag 字符串翻译——conformance 对比的是
|
|
30
|
+
* 后端对语义的控件映射结果(layout.grid → UICollectionView/GridLayoutManager/Grid/GridView/div.proteus-grid)
|
|
31
|
+
*/
|
|
32
|
+
export declare function renderComponentSnapshot(backend: ProteusRenderBackend, ir: IRNode, readControl: ControlReader): RenderNodeSnapshot;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ProteusRenderBackend } from './spi';
|
|
2
|
+
export interface ConformanceCheck {
|
|
3
|
+
name: string;
|
|
4
|
+
pass: boolean;
|
|
5
|
+
detail?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ConformanceResult {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
checks: ConformanceCheck[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 后端接口完整性自检(RND002:后端必须通过 conformance test)
|
|
13
|
+
* - 必选方法缺失 → fail(detail 指明缺失方法)
|
|
14
|
+
* - createElement 两次调用须返回不同句柄(唯一性)
|
|
15
|
+
* - capabilities 枚举值非法 → fail
|
|
16
|
+
* - 可选方法存在时须为函数
|
|
17
|
+
*/
|
|
18
|
+
export declare function runBackendConformance(backend: ProteusRenderBackend): ConformanceResult;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ProteusHostContainer } from './container-spi';
|
|
2
|
+
/** fork 指纹(宿主仓库复制/内嵌框架源码的特征——对齐参考实现 FORK_SIGNATURES) */
|
|
3
|
+
export declare const FORK_SIGNATURES: readonly RegExp[];
|
|
4
|
+
export interface ForkHit {
|
|
5
|
+
filename: string;
|
|
6
|
+
pattern: string;
|
|
7
|
+
}
|
|
8
|
+
/** ★G-42.6:扫描宿主仓库文件内容,检出 fork 框架源码的痕迹(合规返回空数组) */
|
|
9
|
+
export declare function scanRepoForFork(fileContents: Record<string, string>): ForkHit[];
|
|
10
|
+
/** 业务清单签名/能力白名单校验(C-08-01 无签名拒绝 / C-08-02 越权能力拒绝) */
|
|
11
|
+
/** 合规清单放行 */
|
|
12
|
+
export declare function checkBizManifest(input: {
|
|
13
|
+
bizId: string;
|
|
14
|
+
signature?: string;
|
|
15
|
+
capabilities?: readonly string[];
|
|
16
|
+
}, opts: {
|
|
17
|
+
requireSignature: boolean;
|
|
18
|
+
whitelist: readonly string[];
|
|
19
|
+
}): {
|
|
20
|
+
ok: true;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
code: 'G39_SIGN' | 'G39_CAP' | 'G39_LIMIT';
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
/** ★G-42 B5 权限网关(G-28 协同):敏感能力须宿主显式授权(白名单之外的敏感集) */
|
|
27
|
+
export declare const SENSITIVE_CAPABILITIES: readonly string[];
|
|
28
|
+
export declare function checkCapabilityAuthorization(capabilities: readonly string[], opts: {
|
|
29
|
+
granted: readonly string[];
|
|
30
|
+
sensitive?: readonly string[];
|
|
31
|
+
}): {
|
|
32
|
+
ok: true;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
code: 'G39_AUTH';
|
|
36
|
+
denied: string[];
|
|
37
|
+
};
|
|
38
|
+
export interface ContainerConformanceResult {
|
|
39
|
+
id: string;
|
|
40
|
+
status: 'PASS' | 'FAIL' | 'SKIP';
|
|
41
|
+
reason?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ContainerConformanceSummary {
|
|
44
|
+
total: number;
|
|
45
|
+
pass: number;
|
|
46
|
+
fail: number;
|
|
47
|
+
skip: number;
|
|
48
|
+
results: ContainerConformanceResult[];
|
|
49
|
+
}
|
|
50
|
+
/** ★G-42 B3:跑容器 Conformance(38 项;未声明能力组 SKIP + reason——诚实原则) */
|
|
51
|
+
export declare function runContainerConformance(container: ProteusHostContainer): Promise<ContainerConformanceSummary>;
|
|
52
|
+
/** 文本报告(CLI / CI 打印) */
|
|
53
|
+
export declare function formatContainerConformance(s: ContainerConformanceSummary): string;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export interface ContainerCapabilities {
|
|
2
|
+
readonly pageStack: boolean;
|
|
3
|
+
readonly multiBusiness: boolean;
|
|
4
|
+
readonly crashIsolation: 0 | 1 | 2 | 3;
|
|
5
|
+
readonly resourceQuota: boolean;
|
|
6
|
+
readonly keepAlive: boolean;
|
|
7
|
+
readonly windowManagement: boolean;
|
|
8
|
+
readonly embedded: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** 六种预设容器的能力画像(唯一事实源——batches B6 / 主文档 §3) */
|
|
11
|
+
export declare const CONTAINER_PROFILES: Record<string, ContainerCapabilities>;
|
|
12
|
+
export type PageState = 'created' | 'mounted' | 'hidden' | 'destroyed' | 'crashed' | 'recycled';
|
|
13
|
+
/**
|
|
14
|
+
* ★页面生命周期状态机合法转换表(page-lifecycle.md §5.1):
|
|
15
|
+
* created → mounted(hide/show 往返 mounted↔hidden)→ destroyed → recycled(对象池复用)
|
|
16
|
+
* 异常路径:mounted → crashed(崩溃隔离,不影响宿主)→ destroyed
|
|
17
|
+
* 任意前置态 → destroyed(页面随时可销毁——G-42.2 原子销毁的入口)
|
|
18
|
+
*/
|
|
19
|
+
export declare const PAGE_STATE_TRANSITIONS: Readonly<Record<PageState, readonly PageState[]>>;
|
|
20
|
+
/** 状态机合法性判断(非法转换直接返回 false——B2 实现据此拒绝越界操作) */
|
|
21
|
+
export declare function canTransitionPageState(from: PageState, to: PageState): boolean;
|
|
22
|
+
export interface TimerHandle {
|
|
23
|
+
cancel(): void;
|
|
24
|
+
}
|
|
25
|
+
export type UnbindFn = () => void;
|
|
26
|
+
export interface CancellablePromise<T> extends Promise<T> {
|
|
27
|
+
cancel(): void;
|
|
28
|
+
}
|
|
29
|
+
export interface ReleaseReport {
|
|
30
|
+
readonly timersCleared: number;
|
|
31
|
+
readonly listenersUnbound: number;
|
|
32
|
+
readonly requestsAborted: number;
|
|
33
|
+
}
|
|
34
|
+
/** 最小事件目标(避免强依赖 DOM EventTarget——容器层零 DOM 假设) */
|
|
35
|
+
export interface EventTargetLike {
|
|
36
|
+
addEventListener(type: string, fn: (...args: unknown[]) => void): void;
|
|
37
|
+
removeEventListener(type: string, fn: (...args: unknown[]) => void): void;
|
|
38
|
+
}
|
|
39
|
+
export interface ResourcePool {
|
|
40
|
+
timer(fn: () => void, ms: number, opts?: {
|
|
41
|
+
once?: boolean;
|
|
42
|
+
}): TimerHandle;
|
|
43
|
+
interval(fn: () => void, ms: number): TimerHandle;
|
|
44
|
+
on(target: EventTargetLike, type: string, fn: (...args: unknown[]) => void): UnbindFn;
|
|
45
|
+
bus(topic: string, fn: (...args: unknown[]) => void): UnbindFn;
|
|
46
|
+
fetch(url: string, init?: Record<string, unknown>): CancellablePromise<unknown>;
|
|
47
|
+
subscribe(store: unknown, fn: (...args: unknown[]) => void): UnbindFn;
|
|
48
|
+
releaseAll(): ReleaseReport;
|
|
49
|
+
}
|
|
50
|
+
export type DestroyStep = 'unmount' | 'unbindEvents' | 'releaseResources' | 'destroyIR' | 'releaseQuota';
|
|
51
|
+
/** 五原子销毁步序(唯一事实源——主文档 §5.2 / container-spi §5) */
|
|
52
|
+
export declare const FIVE_ATOMIC_STEPS: readonly DestroyStep[];
|
|
53
|
+
export interface LeakItem {
|
|
54
|
+
readonly kind: 'timer' | 'listener' | 'request' | 'subscription' | 'ir' | 'quota';
|
|
55
|
+
readonly detail: string;
|
|
56
|
+
}
|
|
57
|
+
export interface DestroyReport {
|
|
58
|
+
readonly pageId: string;
|
|
59
|
+
readonly steps: readonly DestroyStep[];
|
|
60
|
+
readonly leaked: readonly LeakItem[];
|
|
61
|
+
readonly reclaimedBytes: number;
|
|
62
|
+
readonly durationMs: number;
|
|
63
|
+
}
|
|
64
|
+
/** ★G-42.2 铁律:五原子销毁校验——steps 必须恰好五步(缺失/多余/顺序错都拒绝) */
|
|
65
|
+
export declare function assertAtomicDestroy(report: DestroyReport): void;
|
|
66
|
+
/** 空销毁报告骨架(B2 实现填充——先满足五步序) */
|
|
67
|
+
export declare function createDestroyReport(pageId: string, reclaimedBytes?: number, durationMs?: number): DestroyReport;
|
|
68
|
+
export type PressureLevel = 'normal' | 'warning' | 'critical';
|
|
69
|
+
export interface QuotaHandle {
|
|
70
|
+
readonly bytes: number;
|
|
71
|
+
readonly scope: string;
|
|
72
|
+
release(): void;
|
|
73
|
+
}
|
|
74
|
+
export interface QuotaUsage {
|
|
75
|
+
readonly usedBytes: number;
|
|
76
|
+
readonly limitBytes: number;
|
|
77
|
+
readonly pageCount: number;
|
|
78
|
+
readonly sandboxCount: number;
|
|
79
|
+
}
|
|
80
|
+
export interface QuotaManager {
|
|
81
|
+
request(bytes: number): QuotaHandle | null;
|
|
82
|
+
release(handle: QuotaHandle): void;
|
|
83
|
+
readonly usage: QuotaUsage;
|
|
84
|
+
readonly pressure: PressureLevel;
|
|
85
|
+
}
|
|
86
|
+
export interface PageHandle {
|
|
87
|
+
readonly pageId: string;
|
|
88
|
+
readonly irId: string;
|
|
89
|
+
readonly state: PageState;
|
|
90
|
+
readonly mountPoint: unknown | null;
|
|
91
|
+
readonly resourcePool: ResourcePool;
|
|
92
|
+
readonly eventRegistry: EventRegistry;
|
|
93
|
+
}
|
|
94
|
+
export interface EventRegistry {
|
|
95
|
+
bind(type: string, fn: (...args: unknown[]) => void): UnbindFn;
|
|
96
|
+
unbindAll(): void;
|
|
97
|
+
readonly size: number;
|
|
98
|
+
}
|
|
99
|
+
export interface PageConfig {
|
|
100
|
+
readonly pageId?: string;
|
|
101
|
+
readonly irId: string;
|
|
102
|
+
readonly hideable?: boolean;
|
|
103
|
+
readonly keepAlive?: boolean;
|
|
104
|
+
readonly budgetBytes?: number;
|
|
105
|
+
}
|
|
106
|
+
export interface BizManifest {
|
|
107
|
+
readonly bizId: string;
|
|
108
|
+
readonly signature?: string;
|
|
109
|
+
readonly requiredCapabilities?: readonly string[];
|
|
110
|
+
}
|
|
111
|
+
export interface BusinessSandbox {
|
|
112
|
+
readonly bizId: string;
|
|
113
|
+
readonly isolatedScope: unknown;
|
|
114
|
+
readonly quotaHandle: QuotaHandle | null;
|
|
115
|
+
readonly state: 'running' | 'crashed' | 'destroyed';
|
|
116
|
+
}
|
|
117
|
+
export interface StackPolicy {
|
|
118
|
+
maxDepth: number;
|
|
119
|
+
overflowStrategy: 'destroy-oldest' | 'reject' | 'flatten';
|
|
120
|
+
keepAlive: {
|
|
121
|
+
maxCount: number;
|
|
122
|
+
memoryBudgetBytes: number;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export declare const DEFAULT_STACK_POLICY: StackPolicy;
|
|
126
|
+
export interface SuperAppPolicy extends StackPolicy {
|
|
127
|
+
sandbox: {
|
|
128
|
+
defaultMemoryBytes: number;
|
|
129
|
+
maxSandboxes: number;
|
|
130
|
+
};
|
|
131
|
+
crash: {
|
|
132
|
+
isolationLevel: 1 | 2 | 3;
|
|
133
|
+
autoRestart: boolean;
|
|
134
|
+
maxRestartCount: number;
|
|
135
|
+
};
|
|
136
|
+
security: {
|
|
137
|
+
requireSignature: boolean;
|
|
138
|
+
capabilityWhitelist: readonly string[];
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
export interface ContainerContext {
|
|
142
|
+
readonly runtime: unknown;
|
|
143
|
+
readonly backends: unknown[];
|
|
144
|
+
}
|
|
145
|
+
export type ContainerEvent = 'page-created' | 'page-destroyed' | 'overflow' | 'crash' | 'pressure' | 'sandbox-crashed';
|
|
146
|
+
/** ★G-42 核心接口:ProteusHostContainer(与 G-27/G-39/G-40 同形设计语言) */
|
|
147
|
+
export interface ProteusHostContainer {
|
|
148
|
+
readonly id: string;
|
|
149
|
+
readonly version: string;
|
|
150
|
+
readonly capabilities: ContainerCapabilities;
|
|
151
|
+
initialize(ctx: ContainerContext): Promise<void>;
|
|
152
|
+
dispose(): void;
|
|
153
|
+
createPage(config: PageConfig): PageHandle;
|
|
154
|
+
mountPage(handle: PageHandle): Promise<void>;
|
|
155
|
+
unmountPage(handle: PageHandle): Promise<void>;
|
|
156
|
+
destroyPage(handle: PageHandle): Promise<DestroyReport>;
|
|
157
|
+
push(config: PageConfig): Promise<PageHandle>;
|
|
158
|
+
pop(): Promise<PageHandle | null>;
|
|
159
|
+
getCurrent(): PageHandle | null;
|
|
160
|
+
getStackDepth(): number;
|
|
161
|
+
createSandbox(bizId: string, manifest: BizManifest): Promise<BusinessSandbox>;
|
|
162
|
+
destroySandbox(bizId: string): Promise<DestroyReport>;
|
|
163
|
+
listSandboxes(): readonly BusinessSandbox[];
|
|
164
|
+
readonly quota: QuotaManager;
|
|
165
|
+
onMemoryPressure(cb: (level: PressureLevel) => void): void;
|
|
166
|
+
on(event: ContainerEvent, handler: (payload: unknown) => void): void;
|
|
167
|
+
}
|
|
168
|
+
/** B1 验收:容器能力画像与容器类型一致(CMP065 诚实声明前置) */
|
|
169
|
+
export declare function profileOfContainer(id: string): ContainerCapabilities;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { IRNode, NodeHandle, ProteusRenderBackend } from './spi';
|
|
2
|
+
/** 未知标签(非 p-* / 未知 p-*)→ 编译期就该拦截,运行期硬拖底(G-41.2:禁止静默) */
|
|
3
|
+
export declare class DispatcherError extends Error {
|
|
4
|
+
readonly code: 'unknown.primitive';
|
|
5
|
+
readonly detail: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
constructor(code: 'unknown.primitive', detail: {
|
|
9
|
+
type: string;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** nodeOps 调用日志条目(H-03-04 机器证据:渲染驱动与引擎无关) */
|
|
13
|
+
export type NodeOpsCall = {
|
|
14
|
+
seq: number;
|
|
15
|
+
op: 'createElement';
|
|
16
|
+
type: string;
|
|
17
|
+
semantic: string;
|
|
18
|
+
} | {
|
|
19
|
+
seq: number;
|
|
20
|
+
op: 'insert';
|
|
21
|
+
child: number;
|
|
22
|
+
parent: number | null;
|
|
23
|
+
anchor: number | null;
|
|
24
|
+
} | {
|
|
25
|
+
seq: number;
|
|
26
|
+
op: 'remove';
|
|
27
|
+
child: number;
|
|
28
|
+
} | {
|
|
29
|
+
seq: number;
|
|
30
|
+
op: 'patchProp';
|
|
31
|
+
el: number;
|
|
32
|
+
key: string;
|
|
33
|
+
next: unknown;
|
|
34
|
+
} | {
|
|
35
|
+
seq: number;
|
|
36
|
+
op: 'setText';
|
|
37
|
+
el: number;
|
|
38
|
+
text: string;
|
|
39
|
+
} | {
|
|
40
|
+
seq: number;
|
|
41
|
+
op: 'createText';
|
|
42
|
+
text: string;
|
|
43
|
+
} | {
|
|
44
|
+
seq: number;
|
|
45
|
+
op: 'createComment';
|
|
46
|
+
text: string;
|
|
47
|
+
} | {
|
|
48
|
+
seq: number;
|
|
49
|
+
op: 'parentNode';
|
|
50
|
+
node: number;
|
|
51
|
+
result: number | null;
|
|
52
|
+
} | {
|
|
53
|
+
seq: number;
|
|
54
|
+
op: 'nextSibling';
|
|
55
|
+
node: number;
|
|
56
|
+
result: number | null;
|
|
57
|
+
} | {
|
|
58
|
+
seq: number;
|
|
59
|
+
op: 'switchBackend';
|
|
60
|
+
from: string;
|
|
61
|
+
to: string;
|
|
62
|
+
strategy?: HotSwitchStrategy;
|
|
63
|
+
};
|
|
64
|
+
/** Vue createRenderer(nodeOps) 兼容子集(签名对齐 vue-binding-architecture §3.2:createElement(type, props)) */
|
|
65
|
+
export interface DispatcherNodeOps {
|
|
66
|
+
createElement(type: string, props?: Record<string, unknown>): NodeHandle;
|
|
67
|
+
insert(child: NodeHandle, parent: NodeHandle, anchor?: NodeHandle): void;
|
|
68
|
+
remove(child: NodeHandle): void;
|
|
69
|
+
patchProp(el: NodeHandle, key: string, prev: unknown, next: unknown): void;
|
|
70
|
+
setText(el: NodeHandle, text: string): void;
|
|
71
|
+
createText(text: string): NodeHandle;
|
|
72
|
+
createComment(text: string): NodeHandle;
|
|
73
|
+
parentNode(node: NodeHandle): NodeHandle | null;
|
|
74
|
+
nextSibling(node: NodeHandle): NodeHandle | null;
|
|
75
|
+
}
|
|
76
|
+
/** ★G-41 B5:热切换策略(rebuild=销毁重建·开发期 / rehydrate=同一 IR 在新引擎重建·保状态 / hybrid=同页面多引擎·区域路由) */
|
|
77
|
+
export type HotSwitchStrategy = 'rebuild' | 'rehydrate' | 'hybrid';
|
|
78
|
+
/** ★G-41 方案 B 定型:全局转发层(currentBackend 一次间接调用,热切换 = 赋值) */
|
|
79
|
+
export interface ProteusNodeOpsDispatcher {
|
|
80
|
+
readonly currentBackend: ProteusRenderBackend;
|
|
81
|
+
/** 热切换(G-41 B5):换 currentBackend;strategy 决定已渲染节点处理 */
|
|
82
|
+
switchBackend(next: ProteusRenderBackend, opts?: {
|
|
83
|
+
strategy?: HotSwitchStrategy;
|
|
84
|
+
}): void;
|
|
85
|
+
readonly switchHistory: ProteusRenderBackend[];
|
|
86
|
+
/** 节点操作集(Vue createRenderer 消费;全部转发到 currentBackend) */
|
|
87
|
+
readonly nodeOps: DispatcherNodeOps;
|
|
88
|
+
/** 标签 → C-IR(G-32 原语表数据源;未知标签 throw——G-41.2 禁止静默) */
|
|
89
|
+
toIRNode(type: string, props?: Record<string, unknown>): IRNode;
|
|
90
|
+
/** 调用日志(机器证据:clear 后逐条比对两引擎一致性) */
|
|
91
|
+
readonly trace: NodeOpsCall[];
|
|
92
|
+
clearTrace(): void;
|
|
93
|
+
}
|
|
94
|
+
export declare function createNodeOpsDispatcher(initialBackend: ProteusRenderBackend): ProteusNodeOpsDispatcher;
|
|
95
|
+
/** ★H-03 机器验证助手:把 IR 树用某后端渲染(递归 createElement + insert),返回根句柄 */
|
|
96
|
+
export declare function renderIRTree(backend: ProteusRenderBackend, ir: IRNode, insertInto?: (child: NodeHandle, parent: NodeHandle) => void): NodeHandle;
|
|
97
|
+
/** ★H-03-04:递归提取 IR 树的语义序列(引擎无关的输入指纹——两引擎消费同一 IR 的机器证据) */
|
|
98
|
+
export declare function semanticSequence(ir: IRNode): string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ProteusRenderBackend } from './spi';
|
|
2
|
+
/** Flutter widget 树节点(spike 层表示——宿主 Embedder 桥把本树投递给 FlutterEngineRun) */
|
|
3
|
+
export interface FlutterWidgetDescriptor {
|
|
4
|
+
id: number;
|
|
5
|
+
/** Flutter widget 名(Container/Text/FilledButton/...) */
|
|
6
|
+
widget: string;
|
|
7
|
+
props: Record<string, unknown>;
|
|
8
|
+
children: FlutterWidgetDescriptor[];
|
|
9
|
+
parent: FlutterWidgetDescriptor | null;
|
|
10
|
+
text: string;
|
|
11
|
+
}
|
|
12
|
+
/** 语义标签 → Flutter widget(未映射标签保留原样——自定义 widget 透传) */
|
|
13
|
+
export declare function mapWidgetType(type: string): string;
|
|
14
|
+
/** 序列化为纯 widget 树(spike 断言 / Embedder 桥输入) */
|
|
15
|
+
export declare function toWidgetTree(root: FlutterWidgetDescriptor): Record<string, unknown>;
|
|
16
|
+
export declare function createFlutterBackend(): ProteusRenderBackend;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProteusRenderBackend } from './spi';
|
|
2
|
+
export interface HeadlessNode {
|
|
3
|
+
id: number;
|
|
4
|
+
type: string;
|
|
5
|
+
props: Record<string, unknown>;
|
|
6
|
+
children: HeadlessNode[];
|
|
7
|
+
parent: HeadlessNode | null;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
/** 序列化为纯对象树(测试断言 / SSR 输出 / Agent 快照) */
|
|
11
|
+
export declare function toPlainTree(root: HeadlessNode): Record<string, unknown>;
|
|
12
|
+
export declare function createHeadlessBackend(): ProteusRenderBackend;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ProteusRenderBackend } from './spi';
|
|
2
|
+
import { semanticSequence } from './dispatcher';
|
|
3
|
+
export interface HostConformanceResult {
|
|
4
|
+
id: string;
|
|
5
|
+
status: 'PASS' | 'FAIL' | 'SKIP';
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface HostConformanceSummary {
|
|
9
|
+
total: number;
|
|
10
|
+
pass: number;
|
|
11
|
+
fail: number;
|
|
12
|
+
skip: number;
|
|
13
|
+
results: HostConformanceResult[];
|
|
14
|
+
}
|
|
15
|
+
export interface HostConformanceOptions {
|
|
16
|
+
/** 宿主运行时(G-39 面;缺省 createHostRuntimeStub)——真实宿主注入自己的实现 */
|
|
17
|
+
host?: HostRuntimeLike;
|
|
18
|
+
/** 执行载体(G-40 面;缺省 JSI stub) */
|
|
19
|
+
carrier?: CarrierLike;
|
|
20
|
+
/** 引擎 A(缺省 HeadlessBackend) */
|
|
21
|
+
backendA?: ProteusRenderBackend;
|
|
22
|
+
/** 引擎 B(缺省 FlutterBackend)——H-03 双引擎一致验证需要 ≠ A */
|
|
23
|
+
backendB?: ProteusRenderBackend;
|
|
24
|
+
/** 只跑某组(如 'H-03') */
|
|
25
|
+
only?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface HostRuntimeLike {
|
|
28
|
+
id: string;
|
|
29
|
+
state: 'created' | 'running' | 'suspended' | 'destroyed';
|
|
30
|
+
threads: string[];
|
|
31
|
+
workers: Array<{
|
|
32
|
+
id: string;
|
|
33
|
+
thread: string;
|
|
34
|
+
}>;
|
|
35
|
+
queue: Array<{
|
|
36
|
+
task: () => unknown;
|
|
37
|
+
priority: number;
|
|
38
|
+
}>;
|
|
39
|
+
bootstrap(): this;
|
|
40
|
+
suspend(): void;
|
|
41
|
+
resume(): void;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
createWorker(): {
|
|
44
|
+
id: string;
|
|
45
|
+
thread: string;
|
|
46
|
+
};
|
|
47
|
+
postMessage(): boolean;
|
|
48
|
+
enqueue(task: () => unknown, priority?: number): void;
|
|
49
|
+
nextTick(fn: () => unknown): void;
|
|
50
|
+
drain(): unknown[];
|
|
51
|
+
}
|
|
52
|
+
/** 参考宿主运行时 stub(对齐 G-39 ProteusHostRuntime 最小 subset;真实宿主注入自己的实现) */
|
|
53
|
+
export declare function createHostRuntimeStub(): HostRuntimeLike;
|
|
54
|
+
export interface CarrierLike {
|
|
55
|
+
id: string;
|
|
56
|
+
boundaries: number;
|
|
57
|
+
capabilities: {
|
|
58
|
+
threadAffinity: boolean;
|
|
59
|
+
trueConcurrency: boolean;
|
|
60
|
+
realtime: {
|
|
61
|
+
capable: boolean;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
cross(): number;
|
|
65
|
+
}
|
|
66
|
+
export declare function createCarrierStub(kind: 'jsi' | 'aot'): CarrierLike;
|
|
67
|
+
/** 跑全部 32 项(H-01~H-08);可选注入真实宿主/载体/后端 */
|
|
68
|
+
export declare function runHostConformance(opts?: HostConformanceOptions): HostConformanceSummary;
|
|
69
|
+
/** 文本报告(CLI / CI 打印) */
|
|
70
|
+
export declare function formatHostConformance(s: HostConformanceSummary): string;
|
|
71
|
+
export { semanticSequence };
|