fix: overlay真正集成(CRLF换行导致正则替换全部失效) showRunOverlay/hideRunOverlay/overlayBroadcast实际调用, nodeLabel/total字段补上

This commit is contained in:
yu 2026-11-03 14:01:45 +08:00
parent 9bfa4ac107
commit 0d429e5175
2 changed files with 14 additions and 1 deletions

View File

@ -28,12 +28,22 @@ export function startRun(flow: FlowDefinition, sender: WebContents): { runId: st
const controller = new AbortController();
active.set(runId, controller);
currentRunId = runId;
showRunOverlay(getMainWindow());
const catalog = loadCatalog();
const components = new Map(catalog.components.map((item) => [item.id, item]));
const nodeLabels = new Map<string, string>();
for (const node of flow.nodes) {
nodeLabels.set(node.id, node.label || node.componentId);
}
const emit = (event: Omit<RunEvent, "runId">) => {
if (!sender.isDestroyed()) sender.send("run:event", { ...event, runId });
const enriched = { ...event, runId } as RunEvent;
if (event.type === "node.started" && event.nodeId) {
enriched.nodeLabel = nodeLabels.get(event.nodeId);
}
if (!sender.isDestroyed()) sender.send("run:event", enriched);
overlayBroadcast(enriched);
};
const log: (message: string, level?: "info" | "warn" | "error", nodeId?: string) => void = (
message,
@ -63,6 +73,7 @@ export function startRun(flow: FlowDefinition, sender: WebContents): { runId: st
} finally {
active.delete(runId);
if (currentRunId === runId) currentRunId = null;
hideRunOverlay(getMainWindow());
}
})();

View File

@ -247,6 +247,8 @@ export interface RunEvent {
evidence?: string[];
attempt?: number;
startedAt?: string;
nodeLabel?: string;
total?: number;
}