feat(engine): 补交 engine.execute 实现(A1 漏加文件)
This commit is contained in:
1 parent
7fa1c4038c
commit
1f804971f4
3 files changed
+24
-3
No files matched your search
@@ -2,7 +2,9 @@ import type { Client } from "basic-ftp";
|
|||||||
import type { Workbook as ExcelJSWorkbook } from "exceljs";
|
import type { Workbook as ExcelJSWorkbook } from "exceljs";
|
||||||
import { WindowsDriver } from "../driver/windows/windows-driver";
|
import { WindowsDriver } from "../driver/windows/windows-driver";
|
||||||
import type { AutomationDriver } from "../driver/types";
|
import type { AutomationDriver } from "../driver/types";
|
||||||
import { RuntimeError } from "./types";
|
import type { CatalogComponent, FlowNode } from "../types";
|
||||||
|
import { getHandler } from "./registry";
|
||||||
|
import { RuntimeError, type RunContext } from "./types";
|
||||||
|
|
||||||
/** 人为拟真操作的开关与随机参数(desktop 能力的进程级设置)。 */
|
/** 人为拟真操作的开关与随机参数(desktop 能力的进程级设置)。 */
|
||||||
export interface ManualOperationSettings {
|
export interface ManualOperationSettings {
|
||||||
@@ -63,6 +65,25 @@ export class RpaEngine {
|
|||||||
setDriver(driver: AutomationDriver): void {
|
setDriver(driver: AutomationDriver): void {
|
||||||
this._driver = driver;
|
this._driver = driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单能力直接调用(ADR-R1 语义真实化):CLI/宿主脚本不再裸摸全局 getHandler,
|
||||||
|
* 而是经引擎入口调用。注意 handler 仍解析自进程注册表(ADR-R1 短期形态)。
|
||||||
|
*/
|
||||||
|
async execute(
|
||||||
|
componentId: string,
|
||||||
|
args: Record<string, unknown>,
|
||||||
|
ctx: RunContext,
|
||||||
|
node?: FlowNode,
|
||||||
|
component?: CatalogComponent
|
||||||
|
): Promise<unknown> {
|
||||||
|
const handler = getHandler(componentId);
|
||||||
|
if (!handler) {
|
||||||
|
throw new RuntimeError("capability_not_implemented", `能力 ${componentId} 未注册`, { componentId });
|
||||||
|
}
|
||||||
|
const resolvedNode: FlowNode = node ?? { id: "direct", componentId, position: { x: 0, y: 0 }, values: {}, options: {} };
|
||||||
|
return handler(ctx, resolvedNode, args, component as CatalogComponent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EngineOptions {
|
export interface EngineOptions {
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ export async function runFlow(
|
|||||||
const summary = issues.filter((issue) => issue.severity === "error").map((item) => item.message).join(";");
|
const summary = issues.filter((issue) => issue.severity === "error").map((item) => item.message).join(";");
|
||||||
throw new RuntimeError("validation_error", `流程图校验未通过:${summary}`, {
|
throw new RuntimeError("validation_error", `流程图校验未通过:${summary}`, {
|
||||||
recommendation: "修复流程图结构后再运行",
|
recommendation: "修复流程图结构后再运行",
|
||||||
issues: JSON.stringify(issues.filter((issue) => issue.severity === "error"))
|
detail: JSON.stringify(issues.filter((issue) => issue.severity === "error"))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await executeTopLevelGraph(flow, ctx, states);
|
await executeTopLevelGraph(flow, ctx, states);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"generatedAt": "2026-11-06T02:47:41.920Z",
|
"generatedAt": "2026-11-06T03:06:19.728Z",
|
||||||
"count": 909,
|
"count": 909,
|
||||||
"ids": [
|
"ids": [
|
||||||
"App_GetPid",
|
"App_GetPid",
|
||||||
|
|||||||
Reference in new issue
Block a user