阶段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

+24
View File
@@ -0,0 +1,24 @@
import type { CapabilityHandler } from "./types";
const handlers = new Map<string, CapabilityHandler>();
export function register(ids: string | string[], handler: CapabilityHandler): void {
const list = Array.isArray(ids) ? ids : [ids];
for (const id of list) handlers.set(id, handler);
}
export function getHandler(id: string): CapabilityHandler | undefined {
return handlers.get(id);
}
export function hasCapability(id: string): boolean {
return handlers.has(id);
}
export function capabilityIds(): string[] {
return [...handlers.keys()];
}
export function capabilityCount(): number {
return handlers.size;
}