@executioncontrolprotocol/app 0.0.0-stage → 0.51.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/LICENSE +202 -0
- package/README.md +64 -2
- package/dist/graph/dirty-buffer.d.ts +7 -0
- package/dist/graph/dirty-buffer.d.ts.map +1 -0
- package/dist/graph/dirty-buffer.js +9 -0
- package/dist/graph/dirty-buffer.js.map +1 -0
- package/dist/graph/extract-data-edges.d.ts +24 -0
- package/dist/graph/extract-data-edges.d.ts.map +1 -0
- package/dist/graph/extract-data-edges.js +139 -0
- package/dist/graph/extract-data-edges.js.map +1 -0
- package/dist/graph/index.d.ts +12 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +11 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/io-from-schema.d.ts +36 -0
- package/dist/graph/io-from-schema.d.ts.map +1 -0
- package/dist/graph/io-from-schema.js +140 -0
- package/dist/graph/io-from-schema.js.map +1 -0
- package/dist/graph/layout.d.ts +7 -0
- package/dist/graph/layout.d.ts.map +1 -0
- package/dist/graph/layout.js +66 -0
- package/dist/graph/layout.js.map +1 -0
- package/dist/graph/map-run-events.d.ts +8 -0
- package/dist/graph/map-run-events.d.ts.map +1 -0
- package/dist/graph/map-run-events.js +31 -0
- package/dist/graph/map-run-events.js.map +1 -0
- package/dist/graph/patch-source.d.ts +13 -0
- package/dist/graph/patch-source.d.ts.map +1 -0
- package/dist/graph/patch-source.js +24 -0
- package/dist/graph/patch-source.js.map +1 -0
- package/dist/graph/ports-from-zod.d.ts +35 -0
- package/dist/graph/ports-from-zod.d.ts.map +1 -0
- package/dist/graph/ports-from-zod.js +203 -0
- package/dist/graph/ports-from-zod.js.map +1 -0
- package/dist/graph/progress.d.ts +23 -0
- package/dist/graph/progress.d.ts.map +1 -0
- package/dist/graph/progress.js +27 -0
- package/dist/graph/progress.js.map +1 -0
- package/dist/graph/types.d.ts +152 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +2 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/graph/value-schema-hint.d.ts +36 -0
- package/dist/graph/value-schema-hint.d.ts.map +1 -0
- package/dist/graph/value-schema-hint.js +205 -0
- package/dist/graph/value-schema-hint.js.map +1 -0
- package/dist/graph/workflow-to-reactflow.d.ts +11 -0
- package/dist/graph/workflow-to-reactflow.d.ts.map +1 -0
- package/dist/graph/workflow-to-reactflow.js +224 -0
- package/dist/graph/workflow-to-reactflow.js.map +1 -0
- package/dist/host/adapter.d.ts +76 -0
- package/dist/host/adapter.d.ts.map +1 -0
- package/dist/host/adapter.js +2 -0
- package/dist/host/adapter.js.map +1 -0
- package/dist/host/config-source.d.ts +11 -0
- package/dist/host/config-source.d.ts.map +1 -0
- package/dist/host/config-source.js +19 -0
- package/dist/host/config-source.js.map +1 -0
- package/dist/host/constants.d.ts +21 -0
- package/dist/host/constants.d.ts.map +1 -0
- package/dist/host/constants.js +21 -0
- package/dist/host/constants.js.map +1 -0
- package/dist/host/local-client.d.ts +36 -0
- package/dist/host/local-client.d.ts.map +1 -0
- package/dist/host/local-client.js +138 -0
- package/dist/host/local-client.js.map +1 -0
- package/dist/host/protocol.d.ts +98 -0
- package/dist/host/protocol.d.ts.map +1 -0
- package/dist/host/protocol.js +2 -0
- package/dist/host/protocol.js.map +1 -0
- package/dist/host/round-trip.d.ts +19 -0
- package/dist/host/round-trip.d.ts.map +1 -0
- package/dist/host/round-trip.js +37 -0
- package/dist/host/round-trip.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/web/assets/index-BZiUJZIM.js +150 -0
- package/dist/web/assets/index-BaWYUR_k.css +2 -0
- package/dist/web/index.html +17 -0
- package/package.json +57 -3
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { isFileValueSchemaHint, valueSchemaFromEqlLabel, valueSchemaFromJsonSchemaProp, } from "./value-schema-hint.js";
|
|
2
|
+
/** Synthetic React Flow node id for `workflow.accepts`. @category App */
|
|
3
|
+
export const WORKFLOW_ACCEPTS_NODE_ID = "ecp:accepts";
|
|
4
|
+
/** Synthetic React Flow node id for `workflow.returns`. @category App */
|
|
5
|
+
export const WORKFLOW_RETURNS_NODE_ID = "ecp:returns";
|
|
6
|
+
function isJsonSchemaObject(schema) {
|
|
7
|
+
return schema !== null && typeof schema === "object" && !Array.isArray(schema);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* List object-schema properties for workflow `accepts` / `returns`.
|
|
11
|
+
* @category App
|
|
12
|
+
*/
|
|
13
|
+
export function jsonSchemaObjectProperties(schema) {
|
|
14
|
+
if (!schema)
|
|
15
|
+
return [];
|
|
16
|
+
const props = schema.properties;
|
|
17
|
+
if (!isJsonSchemaObject(props))
|
|
18
|
+
return [];
|
|
19
|
+
const required = new Set(Array.isArray(schema.required)
|
|
20
|
+
? schema.required.filter((k) => typeof k === "string")
|
|
21
|
+
: []);
|
|
22
|
+
const out = [];
|
|
23
|
+
for (const [name, prop] of Object.entries(props)) {
|
|
24
|
+
out.push({
|
|
25
|
+
name,
|
|
26
|
+
schema: isJsonSchemaObject(prop) ? prop : {},
|
|
27
|
+
required: required.has(name),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
function typeLabelFromSchema(schema, required) {
|
|
33
|
+
if (isFileValueSchemaHint(schema)) {
|
|
34
|
+
return required ? "file!" : "file";
|
|
35
|
+
}
|
|
36
|
+
const t = schema.type;
|
|
37
|
+
const base = typeof t === "string" ? t : "unknown";
|
|
38
|
+
return required ? `${base}!` : base;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Ports from a JSON Schema object (`accepts` / `returns` properties).
|
|
42
|
+
* @category App
|
|
43
|
+
*/
|
|
44
|
+
export function portsFromJsonSchemaObject(schema) {
|
|
45
|
+
return jsonSchemaObjectProperties(schema).map((field) => {
|
|
46
|
+
const typeLabel = typeLabelFromSchema(field.schema, field.required);
|
|
47
|
+
const port = {
|
|
48
|
+
id: field.name,
|
|
49
|
+
name: field.name,
|
|
50
|
+
typeLabel,
|
|
51
|
+
required: field.required,
|
|
52
|
+
valueSchema: valueSchemaFromJsonSchemaProp(field.schema) ?? valueSchemaFromEqlLabel(typeLabel),
|
|
53
|
+
};
|
|
54
|
+
return port;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Project workflow `accepts` as an output-only Inputs node (always present).
|
|
59
|
+
* @category App
|
|
60
|
+
*/
|
|
61
|
+
export function acceptsReactFlowNode(manifest) {
|
|
62
|
+
const outputs = portsFromJsonSchemaObject(manifest.workflow.accepts);
|
|
63
|
+
const data = {
|
|
64
|
+
label: "Inputs",
|
|
65
|
+
kind: "accepts",
|
|
66
|
+
inputs: [],
|
|
67
|
+
outputs,
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
id: WORKFLOW_ACCEPTS_NODE_ID,
|
|
71
|
+
type: "ecp-io",
|
|
72
|
+
position: { x: 0, y: 0 },
|
|
73
|
+
data,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function isStepNode(node) {
|
|
77
|
+
return !node.type || node.type === "step";
|
|
78
|
+
}
|
|
79
|
+
function collectCommitKeys(nodes, into) {
|
|
80
|
+
for (const node of nodes) {
|
|
81
|
+
if (isStepNode(node)) {
|
|
82
|
+
if (node.as)
|
|
83
|
+
into.add(node.as);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (node.type === "parallel") {
|
|
87
|
+
for (const branch of node.branches)
|
|
88
|
+
collectCommitKeys(branch, into);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (node.type === "branch") {
|
|
92
|
+
for (const arm of node.branches)
|
|
93
|
+
collectCommitKeys(arm.steps, into);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
collectCommitKeys(node.steps, into);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* State keys that can source a `returns` port (step `.as` or `accepts` properties).
|
|
101
|
+
* @category App
|
|
102
|
+
*/
|
|
103
|
+
export function returnsSourceKeys(manifest) {
|
|
104
|
+
const keys = new Set(jsonSchemaObjectProperties(manifest.workflow.accepts).map((field) => field.name));
|
|
105
|
+
collectCommitKeys(manifest.steps, keys);
|
|
106
|
+
return keys;
|
|
107
|
+
}
|
|
108
|
+
function annotateReturnsPorts(manifest, ports) {
|
|
109
|
+
const sources = returnsSourceKeys(manifest);
|
|
110
|
+
for (const port of ports) {
|
|
111
|
+
const asKey = port.id.includes(".") ? port.id.slice(0, port.id.indexOf(".")) : port.id;
|
|
112
|
+
if (!sources.has(asKey))
|
|
113
|
+
continue;
|
|
114
|
+
port.binding = "ref";
|
|
115
|
+
port.refPath = port.id;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Project workflow `returns` as an input-only Outputs node when it has properties.
|
|
120
|
+
* @category App
|
|
121
|
+
*/
|
|
122
|
+
export function returnsReactFlowNode(manifest) {
|
|
123
|
+
const inputs = portsFromJsonSchemaObject(manifest.workflow.returns);
|
|
124
|
+
if (inputs.length === 0)
|
|
125
|
+
return undefined;
|
|
126
|
+
annotateReturnsPorts(manifest, inputs);
|
|
127
|
+
const data = {
|
|
128
|
+
label: "Outputs",
|
|
129
|
+
kind: "returns",
|
|
130
|
+
inputs,
|
|
131
|
+
outputs: [],
|
|
132
|
+
};
|
|
133
|
+
return {
|
|
134
|
+
id: WORKFLOW_RETURNS_NODE_ID,
|
|
135
|
+
type: "ecp-io",
|
|
136
|
+
position: { x: 0, y: 0 },
|
|
137
|
+
data,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=io-from-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io-from-schema.js","sourceRoot":"","sources":["../../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;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactFlowDocument, ReactFlowEncodeOptions } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Assign dagre layout positions to nodes (mutates a copy).
|
|
4
|
+
* @category App
|
|
5
|
+
*/
|
|
6
|
+
export declare function layoutReactFlowDocument(doc: ReactFlowDocument, options?: ReactFlowEncodeOptions): ReactFlowDocument;
|
|
7
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/graph/layout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EAIvB,MAAM,YAAY,CAAA;AAqBnB;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,iBAAiB,EACtB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,iBAAiB,CAkDnB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import dagre from "@dagrejs/dagre";
|
|
2
|
+
const DEFAULT_NODE_WIDTH = 260;
|
|
3
|
+
const DEFAULT_NODE_HEIGHT = 160;
|
|
4
|
+
const PORT_ROW_ESTIMATE = 18;
|
|
5
|
+
const HEADER_ESTIMATE = 72;
|
|
6
|
+
function estimateNodeHeight(node, fallback) {
|
|
7
|
+
if (node.type === "ecp-step") {
|
|
8
|
+
const data = node.data;
|
|
9
|
+
const portRows = Math.max(data.inputs.length, 1) + Math.max(data.outputs.length, 1);
|
|
10
|
+
return Math.max(fallback, HEADER_ESTIMATE + portRows * PORT_ROW_ESTIMATE);
|
|
11
|
+
}
|
|
12
|
+
if (node.type === "ecp-io") {
|
|
13
|
+
const data = node.data;
|
|
14
|
+
const portRows = Math.max(data.inputs.length + data.outputs.length, 1);
|
|
15
|
+
return Math.max(fallback, HEADER_ESTIMATE + portRows * PORT_ROW_ESTIMATE);
|
|
16
|
+
}
|
|
17
|
+
return fallback;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Assign dagre layout positions to nodes (mutates a copy).
|
|
21
|
+
* @category App
|
|
22
|
+
*/
|
|
23
|
+
export function layoutReactFlowDocument(doc, options) {
|
|
24
|
+
const direction = options?.direction ?? "LR";
|
|
25
|
+
const nodeWidth = options?.nodeWidth ?? DEFAULT_NODE_WIDTH;
|
|
26
|
+
const nodeHeight = options?.nodeHeight ?? DEFAULT_NODE_HEIGHT;
|
|
27
|
+
const g = new dagre.graphlib.Graph();
|
|
28
|
+
g.setDefaultEdgeLabel(() => ({}));
|
|
29
|
+
g.setGraph({
|
|
30
|
+
rankdir: direction,
|
|
31
|
+
nodesep: 56,
|
|
32
|
+
ranksep: 96,
|
|
33
|
+
marginx: 24,
|
|
34
|
+
marginy: 24,
|
|
35
|
+
});
|
|
36
|
+
const byId = new Map(doc.nodes.map((n) => [n.id, n]));
|
|
37
|
+
const heights = new Map(doc.nodes.map((node) => [node.id, estimateNodeHeight(node, nodeHeight)]));
|
|
38
|
+
for (const node of doc.nodes) {
|
|
39
|
+
g.setNode(node.id, { width: nodeWidth, height: heights.get(node.id) ?? nodeHeight });
|
|
40
|
+
}
|
|
41
|
+
for (const edge of doc.edges) {
|
|
42
|
+
if (byId.has(edge.source) && byId.has(edge.target)) {
|
|
43
|
+
g.setEdge(edge.source, edge.target);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
dagre.layout(g);
|
|
47
|
+
const nodes = doc.nodes.map((node) => {
|
|
48
|
+
const laid = g.node(node.id);
|
|
49
|
+
const height = heights.get(node.id) ?? nodeHeight;
|
|
50
|
+
if (!laid)
|
|
51
|
+
return { ...node, position: { ...node.position } };
|
|
52
|
+
return {
|
|
53
|
+
...node,
|
|
54
|
+
position: {
|
|
55
|
+
x: laid.x - nodeWidth / 2,
|
|
56
|
+
y: laid.y - height / 2,
|
|
57
|
+
},
|
|
58
|
+
style: {
|
|
59
|
+
...node.style,
|
|
60
|
+
width: nodeWidth,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
return { nodes, edges: doc.edges.map((e) => ({ ...e })) };
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/graph/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAA;AASlC,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAC9B,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC/B,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAC5B,MAAM,eAAe,GAAG,EAAE,CAAA;AAE1B,SAAS,kBAAkB,CAAC,IAAmB,EAAE,QAAgB;IAC/D,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAyB,CAAA;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QACnF,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,QAAQ,GAAG,iBAAiB,CAAC,CAAA;IAC3E,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAuB,CAAA;QACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QACtE,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,QAAQ,GAAG,iBAAiB,CAAC,CAAA;IAC3E,CAAC;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@executioncontrolprotocol/core/types";
|
|
2
|
+
import type { ReactFlowRunProgress } from "./progress.js";
|
|
3
|
+
/**
|
|
4
|
+
* Map a public `ecp run --events` record onto the React Flow progress bus.
|
|
5
|
+
* @category App
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyPublicRunEvent(bus: ReactFlowRunProgress, event: PublicRunEvent): void;
|
|
8
|
+
//# sourceMappingURL=map-run-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-run-events.d.ts","sourceRoot":"","sources":["../../src/graph/map-run-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEzD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,oBAAoB,EACzB,KAAK,EAAE,cAAc,GACpB,IAAI,CA0BN"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map a public `ecp run --events` record onto the React Flow progress bus.
|
|
3
|
+
* @category App
|
|
4
|
+
*/
|
|
5
|
+
export function applyPublicRunEvent(bus, event) {
|
|
6
|
+
if (event.type === "run.start") {
|
|
7
|
+
bus.emitReset({ runId: event.runId });
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (event.type === "step.start" && event.stepId) {
|
|
11
|
+
bus.emitStepStatus(event.stepId, "running");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (event.type === "step.end" && event.stepId) {
|
|
15
|
+
bus.emitStepStatus(event.stepId, event.status === "failed" ? "failed" : "completed");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (event.type === "step.error" && event.stepId) {
|
|
19
|
+
bus.emitStepStatus(event.stepId, "failed", event.error?.message);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (event.type === "run.end") {
|
|
23
|
+
const outcome = event.status === "failed"
|
|
24
|
+
? "failed"
|
|
25
|
+
: event.status === "cancelled"
|
|
26
|
+
? "cancelled"
|
|
27
|
+
: "completed";
|
|
28
|
+
bus.emitDone({ runId: event.runId, outcome });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=map-run-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-run-events.js","sourceRoot":"","sources":["../../src/graph/map-run-events.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,GAAyB,EACzB,KAAqB;IAErB,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC/B,GAAG,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;QACrC,OAAM;IACR,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAChD,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;QAC3C,OAAM;IACR,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAC9C,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAA;QACpF,OAAM;IACR,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAChD,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAChE,OAAM;IACR,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,OAAO,GACX,KAAK,CAAC,MAAM,KAAK,QAAQ;YACvB,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,WAAW;gBAC5B,CAAC,CAAC,WAAW;gBACb,CAAC,CAAC,WAAW,CAAA;QACnB,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EcpPatchInput, InputValue, WorkflowManifest } from "@executioncontrolprotocol/core/types";
|
|
2
|
+
/**
|
|
3
|
+
* Apply a patch to a workflow manifest and render Fluent source for saving back to disk.
|
|
4
|
+
* Graph edits go through core `applyPatch`, then `renderWorkflowToFluent`.
|
|
5
|
+
* @category App
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderPatchedManifest(manifest: WorkflowManifest, input: EcpPatchInput): string;
|
|
8
|
+
/**
|
|
9
|
+
* Apply a step-input patch and render Fluent source for saving back to disk.
|
|
10
|
+
* @category App
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderPatchedStepInput(manifest: WorkflowManifest, stepId: string, input: Record<string, InputValue>): string;
|
|
13
|
+
//# sourceMappingURL=patch-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-source.d.ts","sourceRoot":"","sources":["../../src/graph/patch-source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAEvG;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,aAAa,GACnB,MAAM,CAQR;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAChC,MAAM,CAIR"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { applyPatch, renderWorkflowToFluent } from "@executioncontrolprotocol/core";
|
|
2
|
+
/**
|
|
3
|
+
* Apply a patch to a workflow manifest and render Fluent source for saving back to disk.
|
|
4
|
+
* Graph edits go through core `applyPatch`, then `renderWorkflowToFluent`.
|
|
5
|
+
* @category App
|
|
6
|
+
*/
|
|
7
|
+
export function renderPatchedManifest(manifest, input) {
|
|
8
|
+
const patched = applyPatch(manifest, input);
|
|
9
|
+
if (!patched.success || !patched.result) {
|
|
10
|
+
const message = patched.diagnostics.map((item) => item.message).join("; ") || "Patch failed";
|
|
11
|
+
throw new Error(message);
|
|
12
|
+
}
|
|
13
|
+
return renderWorkflowToFluent(patched.result);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Apply a step-input patch and render Fluent source for saving back to disk.
|
|
17
|
+
* @category App
|
|
18
|
+
*/
|
|
19
|
+
export function renderPatchedStepInput(manifest, stepId, input) {
|
|
20
|
+
return renderPatchedManifest(manifest, {
|
|
21
|
+
[`steps[${stepId}].input`]: input,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=patch-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-source.js","sourceRoot":"","sources":["../../src/graph/patch-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAGnF;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAA0B,EAC1B,KAAoB;IAEpB,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAC3C,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACxC,MAAM,OAAO,GACX,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,cAAc,CAAA;QAC9E,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAA0B,EAC1B,MAAc,EACd,KAAiC;IAEjC,OAAO,qBAAqB,CAAC,QAAQ,EAAE;QACrC,CAAC,SAAS,MAAM,SAAS,CAAC,EAAE,KAAK;KAClC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Registry } from "@executioncontrolprotocol/core";
|
|
2
|
+
import type { StepNode } from "@executioncontrolprotocol/core/types";
|
|
3
|
+
import type { CapabilityIoSchemas, ReactFlowPort } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Compact string form of a literal input value (for previews / editors).
|
|
6
|
+
* @category App
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatLiteralValue(value: unknown): string;
|
|
9
|
+
/**
|
|
10
|
+
* Truncate a literal for port row display.
|
|
11
|
+
* @category App
|
|
12
|
+
*/
|
|
13
|
+
export declare function truncateLiteralPreview(full: string, max?: number): string;
|
|
14
|
+
/**
|
|
15
|
+
* Ensure an output port exists for a data-edge source handle.
|
|
16
|
+
* @category App
|
|
17
|
+
*/
|
|
18
|
+
export declare function ensureOutputPort(outputs: ReactFlowPort[], handleId: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Project a Zod type or JSON Schema object to a JSON Schema record.
|
|
21
|
+
* @category App
|
|
22
|
+
*/
|
|
23
|
+
export declare function toJsonObjectSchema(schema: unknown): Record<string, unknown> | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Build input/output ports from capability Zod schemas, with input-key fallback
|
|
26
|
+
* and literal / `$ref` binding metadata from `step.input`.
|
|
27
|
+
* When `registry` has no capability, {@link CapabilityIoSchemas} from `describe()`
|
|
28
|
+
* supplies the same JSON Schema ports.
|
|
29
|
+
* @category App
|
|
30
|
+
*/
|
|
31
|
+
export declare function portsForStep(step: StepNode, registry: Registry | undefined, schemas?: CapabilityIoSchemas): {
|
|
32
|
+
inputs: ReactFlowPort[];
|
|
33
|
+
outputs: ReactFlowPort[];
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=ports-from-zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports-from-zod.d.ts","sourceRoot":"","sources":["../../src/graph/ports-from-zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAO9D,OAAO,KAAK,EAAc,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AAEhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AA+DpE;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CASzD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAsB,GAAG,MAAM,CAGtF;AAqCD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOjF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAOvF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,OAAO,CAAC,EAAE,mBAAmB,GAC5B;IAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAA;CAAE,CAoEvD"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { flattenJsonSchemaProperties, isZodType, jsonSchemaFromZod, jsonSchemaObjectProperties, } from "@executioncontrolprotocol/core";
|
|
2
|
+
import { parseStateRef } from "./extract-data-edges.js";
|
|
3
|
+
import { isFileValueSchemaHint, valueSchemaFromEqlLabel, valueSchemasFromCapabilitySchema, } from "./value-schema-hint.js";
|
|
4
|
+
const LITERAL_PREVIEW_MAX = 56;
|
|
5
|
+
/** Whole-document output handle (`ref("as")` with no field path). */
|
|
6
|
+
const OUTPUT_HANDLE_ID = "output";
|
|
7
|
+
function typeLabelFromHint(schema, required) {
|
|
8
|
+
if (schema && isFileValueSchemaHint(schema)) {
|
|
9
|
+
return required ? "file!" : "file";
|
|
10
|
+
}
|
|
11
|
+
const t = schema?.type;
|
|
12
|
+
const base = typeof t === "string" ? t : "unknown";
|
|
13
|
+
return required ? `${base}!` : base;
|
|
14
|
+
}
|
|
15
|
+
function attachValueSchema(port, schemas, typeLabel) {
|
|
16
|
+
const fromCap = schemas.get(port.name);
|
|
17
|
+
if (fromCap) {
|
|
18
|
+
port.valueSchema = fromCap;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const fromLabel = valueSchemaFromEqlLabel(typeLabel);
|
|
22
|
+
if (fromLabel)
|
|
23
|
+
port.valueSchema = fromLabel;
|
|
24
|
+
}
|
|
25
|
+
function isRefValue(value) {
|
|
26
|
+
return (typeof value === "object" &&
|
|
27
|
+
value !== null &&
|
|
28
|
+
"$ref" in value &&
|
|
29
|
+
typeof value.$ref === "string");
|
|
30
|
+
}
|
|
31
|
+
function isStateValue(value) {
|
|
32
|
+
return (typeof value === "object" &&
|
|
33
|
+
value !== null &&
|
|
34
|
+
"$state" in value &&
|
|
35
|
+
typeof value.$state === "string");
|
|
36
|
+
}
|
|
37
|
+
function refPathFromInputValue(value) {
|
|
38
|
+
if (isRefValue(value))
|
|
39
|
+
return value.$ref;
|
|
40
|
+
if (isStateValue(value))
|
|
41
|
+
return value.$state;
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Compact string form of a literal input value (for previews / editors).
|
|
46
|
+
* @category App
|
|
47
|
+
*/
|
|
48
|
+
export function formatLiteralValue(value) {
|
|
49
|
+
if (typeof value === "string")
|
|
50
|
+
return value;
|
|
51
|
+
if (value === null)
|
|
52
|
+
return "null";
|
|
53
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
54
|
+
return String(value);
|
|
55
|
+
try {
|
|
56
|
+
return JSON.stringify(value);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return String(value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Truncate a literal for port row display.
|
|
64
|
+
* @category App
|
|
65
|
+
*/
|
|
66
|
+
export function truncateLiteralPreview(full, max = LITERAL_PREVIEW_MAX) {
|
|
67
|
+
if (full.length <= max)
|
|
68
|
+
return full;
|
|
69
|
+
return `${full.slice(0, Math.max(0, max - 1))}…`;
|
|
70
|
+
}
|
|
71
|
+
function applyInputBindings(inputs, step) {
|
|
72
|
+
if (!step.input)
|
|
73
|
+
return;
|
|
74
|
+
const byName = new Map(inputs.map((p) => [p.name, p]));
|
|
75
|
+
for (const [name, value] of Object.entries(step.input)) {
|
|
76
|
+
let port = byName.get(name);
|
|
77
|
+
if (!port) {
|
|
78
|
+
port = { id: name, name, typeLabel: "unknown", required: false };
|
|
79
|
+
inputs.push(port);
|
|
80
|
+
byName.set(name, port);
|
|
81
|
+
}
|
|
82
|
+
if (isRefValue(value) || isStateValue(value)) {
|
|
83
|
+
const rawRef = refPathFromInputValue(value);
|
|
84
|
+
if (!rawRef)
|
|
85
|
+
continue;
|
|
86
|
+
const parsed = parseStateRef(rawRef);
|
|
87
|
+
port.binding = "ref";
|
|
88
|
+
port.refPath = parsed
|
|
89
|
+
? parsed.fieldPath
|
|
90
|
+
? `${parsed.asKey}.${parsed.fieldPath}`
|
|
91
|
+
: parsed.asKey
|
|
92
|
+
: rawRef.replace(/^state\./, "");
|
|
93
|
+
delete port.valuePreview;
|
|
94
|
+
delete port.valueTitle;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const full = formatLiteralValue(value);
|
|
98
|
+
port.binding = "literal";
|
|
99
|
+
port.valueTitle = full;
|
|
100
|
+
port.valuePreview = truncateLiteralPreview(full);
|
|
101
|
+
delete port.refPath;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Ensure an output port exists for a data-edge source handle.
|
|
106
|
+
* @category App
|
|
107
|
+
*/
|
|
108
|
+
export function ensureOutputPort(outputs, handleId) {
|
|
109
|
+
if (outputs.some((p) => p.id === handleId))
|
|
110
|
+
return;
|
|
111
|
+
outputs.push({
|
|
112
|
+
id: handleId,
|
|
113
|
+
name: handleId,
|
|
114
|
+
typeLabel: "unknown",
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Project a Zod type or JSON Schema object to a JSON Schema record.
|
|
119
|
+
* @category App
|
|
120
|
+
*/
|
|
121
|
+
export function toJsonObjectSchema(schema) {
|
|
122
|
+
if (schema === undefined || schema === null)
|
|
123
|
+
return undefined;
|
|
124
|
+
if (isZodType(schema))
|
|
125
|
+
return jsonSchemaFromZod(schema);
|
|
126
|
+
if (typeof schema === "object" && !Array.isArray(schema)) {
|
|
127
|
+
return schema;
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Build input/output ports from capability Zod schemas, with input-key fallback
|
|
133
|
+
* and literal / `$ref` binding metadata from `step.input`.
|
|
134
|
+
* When `registry` has no capability, {@link CapabilityIoSchemas} from `describe()`
|
|
135
|
+
* supplies the same JSON Schema ports.
|
|
136
|
+
* @category App
|
|
137
|
+
*/
|
|
138
|
+
export function portsForStep(step, registry, schemas) {
|
|
139
|
+
const cap = registry?.getCapability(String(step.uses));
|
|
140
|
+
const inputSource = cap?.inputSchema ?? schemas?.inputSchema;
|
|
141
|
+
const outputSource = cap?.outputSchema ?? schemas?.outputSchema;
|
|
142
|
+
const inputJson = toJsonObjectSchema(inputSource);
|
|
143
|
+
const outputJson = toJsonObjectSchema(outputSource);
|
|
144
|
+
const inputFields = jsonSchemaObjectProperties(inputJson);
|
|
145
|
+
const outputFields = flattenJsonSchemaProperties(outputJson);
|
|
146
|
+
const inputSchemas = valueSchemasFromCapabilitySchema(inputSource);
|
|
147
|
+
const inputs = [];
|
|
148
|
+
const seenInputs = new Set();
|
|
149
|
+
for (const field of inputFields) {
|
|
150
|
+
seenInputs.add(field.name);
|
|
151
|
+
const typeLabel = typeLabelFromHint(field.schema, field.required);
|
|
152
|
+
const port = {
|
|
153
|
+
id: field.name,
|
|
154
|
+
name: field.name,
|
|
155
|
+
typeLabel,
|
|
156
|
+
required: field.required,
|
|
157
|
+
};
|
|
158
|
+
attachValueSchema(port, inputSchemas, typeLabel);
|
|
159
|
+
inputs.push(port);
|
|
160
|
+
}
|
|
161
|
+
if (step.input) {
|
|
162
|
+
for (const name of Object.keys(step.input)) {
|
|
163
|
+
if (seenInputs.has(name))
|
|
164
|
+
continue;
|
|
165
|
+
const port = {
|
|
166
|
+
id: name,
|
|
167
|
+
name,
|
|
168
|
+
typeLabel: "unknown",
|
|
169
|
+
required: false,
|
|
170
|
+
};
|
|
171
|
+
attachValueSchema(port, inputSchemas, "unknown");
|
|
172
|
+
inputs.push(port);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
applyInputBindings(inputs, step);
|
|
176
|
+
const outputs = [];
|
|
177
|
+
const seenOutputs = new Set();
|
|
178
|
+
if (!outputFields.some((field) => field.name === OUTPUT_HANDLE_ID)) {
|
|
179
|
+
const whole = {
|
|
180
|
+
id: OUTPUT_HANDLE_ID,
|
|
181
|
+
name: OUTPUT_HANDLE_ID,
|
|
182
|
+
typeLabel: "object",
|
|
183
|
+
valueSchema: { type: "object" },
|
|
184
|
+
};
|
|
185
|
+
outputs.push(whole);
|
|
186
|
+
seenOutputs.add(OUTPUT_HANDLE_ID);
|
|
187
|
+
}
|
|
188
|
+
for (const field of outputFields) {
|
|
189
|
+
if (seenOutputs.has(field.name))
|
|
190
|
+
continue;
|
|
191
|
+
seenOutputs.add(field.name);
|
|
192
|
+
const typeLabel = typeLabelFromHint(field.schema, field.required);
|
|
193
|
+
const port = {
|
|
194
|
+
id: field.name,
|
|
195
|
+
name: field.name,
|
|
196
|
+
typeLabel,
|
|
197
|
+
valueSchema: field.schema,
|
|
198
|
+
};
|
|
199
|
+
outputs.push(port);
|
|
200
|
+
}
|
|
201
|
+
return { inputs, outputs };
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=ports-from-zod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports-from-zod.js","sourceRoot":"","sources":["../../src/graph/ports-from-zod.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,SAAS,EACT,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,gCAAgC,GAEjC,MAAM,wBAAwB,CAAA;AAE/B,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAE9B,qEAAqE;AACrE,MAAM,gBAAgB,GAAG,QAAQ,CAAA;AAEjC,SAAS,iBAAiB,CACxB,MAA2C,EAC3C,QAAiB;IAEjB,IAAI,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,OAAO,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAA;IACpC,CAAC;IACD,MAAM,CAAC,GAAG,MAAM,EAAE,IAAI,CAAA;IACtB,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CA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AC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnB,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IACnC,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;QACjC,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,SAAQ;QACzC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC3B,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;QACjE,MAAM,IAAI,GAAkB;YAC1B,EAAE,EAAE,KAAK,CAAC,IAAI;YACd,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS;YACT,WAAW,EAAE,KAAK,CAAC,MAAM;SAC1B,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactFlowRunLifecycleDetail, ReactFlowStepStatus } from "./types.js";
|
|
2
|
+
/** Progress event names. @category App */
|
|
3
|
+
export type ReactFlowProgressEventName = "run:reset" | "step:status" | "run:done";
|
|
4
|
+
/**
|
|
5
|
+
* Browser-safe progress bus for React Flow run visualization.
|
|
6
|
+
* Listeners receive CustomEvent with typed detail.
|
|
7
|
+
* @category App
|
|
8
|
+
*/
|
|
9
|
+
export declare class ReactFlowRunProgress extends EventTarget {
|
|
10
|
+
/** Emit run reset (all steps pending). */
|
|
11
|
+
emitReset(detail?: ReactFlowRunLifecycleDetail): void;
|
|
12
|
+
/** Emit a step status change. */
|
|
13
|
+
emitStepStatus(stepId: string, status: ReactFlowStepStatus, message?: string): void;
|
|
14
|
+
/** Emit run completion. */
|
|
15
|
+
emitDone(detail?: ReactFlowRunLifecycleDetail): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Shared progress bus. The format-reactflow extension used 9 lifecycle hooks
|
|
19
|
+
* that forwarded onto this bus (plus these 3 emit helpers).
|
|
20
|
+
* @category App
|
|
21
|
+
*/
|
|
22
|
+
export declare const reactFlowRunProgress: ReactFlowRunProgress;
|
|
23
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/graph/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EAEpB,MAAM,YAAY,CAAA;AAEnB,0CAA0C;AAC1C,MAAM,MAAM,0BAA0B,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,CAAA;AAEjF;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;IACnD,0CAA0C;IAC1C,SAAS,CAAC,MAAM,GAAE,2BAAgC,GAAG,IAAI;IAIzD,iCAAiC;IACjC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAKnF,2BAA2B;IAC3B,QAAQ,CAAC,MAAM,GAAE,2BAAgC,GAAG,IAAI;CAGzD;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,sBAA6B,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe progress bus for React Flow run visualization.
|
|
3
|
+
* Listeners receive CustomEvent with typed detail.
|
|
4
|
+
* @category App
|
|
5
|
+
*/
|
|
6
|
+
export class ReactFlowRunProgress extends EventTarget {
|
|
7
|
+
/** Emit run reset (all steps pending). */
|
|
8
|
+
emitReset(detail = {}) {
|
|
9
|
+
this.dispatchEvent(new CustomEvent("run:reset", { detail }));
|
|
10
|
+
}
|
|
11
|
+
/** Emit a step status change. */
|
|
12
|
+
emitStepStatus(stepId, status, message) {
|
|
13
|
+
const detail = { stepId, status, ...(message ? { message } : {}) };
|
|
14
|
+
this.dispatchEvent(new CustomEvent("step:status", { detail }));
|
|
15
|
+
}
|
|
16
|
+
/** Emit run completion. */
|
|
17
|
+
emitDone(detail = {}) {
|
|
18
|
+
this.dispatchEvent(new CustomEvent("run:done", { detail }));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Shared progress bus. The format-reactflow extension used 9 lifecycle hooks
|
|
23
|
+
* that forwarded onto this bus (plus these 3 emit helpers).
|
|
24
|
+
* @category App
|
|
25
|
+
*/
|
|
26
|
+
export const reactFlowRunProgress = new ReactFlowRunProgress();
|
|
27
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/graph/progress.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IACnD,0CAA0C;IAC1C,SAAS,CAAC,SAAsC,EAAE;QAChD,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,iCAAiC;IACjC,cAAc,CAAC,MAAc,EAAE,MAA2B,EAAE,OAAgB;QAC1E,MAAM,MAAM,GAA8B,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;QAC7F,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IAChE,CAAC;IAED,2BAA2B;IAC3B,QAAQ,CAAC,SAAsC,EAAE;QAC/C,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IAC7D,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,EAAE,CAAA"}
|