阶段1-rpa-core建包: engine+31个纯Node能力迁入packages/rpa-core, 领域类型单一源化, createEngine工厂收拢模块级状态

- engine/(registry/types/runtime/expression)物理迁入包, 解耦shared/types(域类型归包, 宿主type-only re-export)
- 31个纯Node能力+27个测试迁入包; 宿主留守Electron/浏览器/AI依赖能力, index.ts经@rpa/core/capabilities拉起
- 新增createEngine()/defaultEngine: excel缓存/Excel句柄/db连接/FTP客户端/OCR实例/拟真设置挂引擎实例
- remaining-core子流程依赖改为host-bridge注入, 包内不再import宿主flows
- 宿主main/index.ts启动时注入子流程源; electron-vite/vitest/tsconfig配@rpa/core源码别名
- 验证: typecheck绿, 快照909个id diff为零, 332测试过(2个桌面冒烟因会话无交互SetForegroundWindow被拒, 环境阻塞)
This commit is contained in:
yu authored and trae-solo-agent committed 2026-11-04 12:36:03 +08:00
1 parent 4139400dbd
commit caa8e19332
111 files changed
+581 -337

No files matched your search

@@ -0,0 +1,22 @@
import type { FlowDefinition } from "../types";
/**
* 宿主桥(HostBridge 候选,阶段 2 正式化接口)。
*
* 包内个别能力需要宿主数据(目前仅子流程仓库),通过显式 setter 注入,
* 包本身不得 import 宿主模块。宿主启动时调用 setSubflowSource()。
*/
export interface SubflowSource {
listFlows(): Promise<Array<{ id: string; name: string }>>;
getFlow(id: string): Promise<FlowDefinition>;
}
let subflowSource: SubflowSource | undefined;
export function setSubflowSource(source: SubflowSource): void {
subflowSource = source;
}
export function getSubflowSource(): SubflowSource | undefined {
return subflowSource;
}