@bysages/workflow 0.4.4 → 0.6.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/dist/index.d.mts +1 -11
- package/dist/index.mjs +4 -8
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Graph } from "@antv/x6";
|
|
2
2
|
import { LayoutOptions } from "elkjs/lib/elk.bundled.js";
|
|
3
|
-
//#region src/types.d.ts
|
|
4
3
|
/** The engine-independent facts of a workflow graph. The canvas adapter
|
|
5
4
|
* reads them; the execution backend writes states back through the
|
|
6
5
|
* store. Nothing here knows about SVG, DOM, or any rendering engine.
|
|
@@ -52,8 +51,6 @@ export interface WorkflowGraph {
|
|
|
52
51
|
nodes: readonly WorkflowNode[];
|
|
53
52
|
edges: readonly WorkflowEdge[];
|
|
54
53
|
}
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/store.d.ts
|
|
57
54
|
/** A record of one graph change. It is both the listener payload and the
|
|
58
55
|
* command protocol: replaying changes is how an executor (or a future
|
|
59
56
|
* undo stack) drives the graph from the outside. */
|
|
@@ -124,8 +121,6 @@ export interface WorkflowStore {
|
|
|
124
121
|
* ids are silent no-ops, redundant writes don't re-emit) so event loops
|
|
125
122
|
* between the canvas and the store die on their own. */
|
|
126
123
|
export declare function createWorkflowStore(graph?: WorkflowGraph): WorkflowStore;
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region src/serialize.d.ts
|
|
129
124
|
/** The wire format's contract version. Bump it whenever the graph shape
|
|
130
125
|
* breaks what older readers expect, and teach deserialize to migrate. */
|
|
131
126
|
export declare const WORKFLOW_GRAPH_VERSION = 1;
|
|
@@ -142,8 +137,6 @@ export declare const deserializeWorkflowGraph: (serialized: {
|
|
|
142
137
|
version: number;
|
|
143
138
|
graph: WorkflowGraph;
|
|
144
139
|
}) => WorkflowGraph;
|
|
145
|
-
//#endregion
|
|
146
|
-
//#region src/mindmap.d.ts
|
|
147
140
|
/** A section''s payload — a ```json fence placed under its heading rides
|
|
148
141
|
* along parsed into data, so the outline carries both the tree and the
|
|
149
142
|
* machine-readable facts of each branch. */
|
|
@@ -165,8 +158,6 @@ export declare function outlineToGraph(markdown: string): WorkflowGraph;
|
|
|
165
158
|
* its section. Extra parents (a node several edges reach) are ignored —
|
|
166
159
|
* the first edge wins, so the fold stays a tree. */
|
|
167
160
|
export declare function graphToOutline(graph: WorkflowGraph): string;
|
|
168
|
-
//#endregion
|
|
169
|
-
//#region src/x6-canvas.d.ts
|
|
170
161
|
/** How the layered engine should sweep the graph. Left out, the
|
|
171
162
|
* direction is read off the graph: edges drawn between side handles
|
|
172
163
|
* vote horizontal, edges between the top/bottom handles vote
|
|
@@ -231,5 +222,4 @@ export interface WorkflowCanvas {
|
|
|
231
222
|
* or the host app — are replayed onto the canvas. Every store operation
|
|
232
223
|
* is idempotent, which is what lets those two event streams cross
|
|
233
224
|
* without loops. */
|
|
234
|
-
export declare function createWorkflowCanvas(container: HTMLElement, source: WorkflowGraph | WorkflowStore, options?: WorkflowCanvasOptions): WorkflowCanvas;
|
|
235
|
-
//#endregion
|
|
225
|
+
export declare function createWorkflowCanvas(container: HTMLElement, source: WorkflowGraph | WorkflowStore, options?: WorkflowCanvasOptions): WorkflowCanvas;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseMarkdown } from "@tanstack/markdown";
|
|
2
2
|
import { Graph, History, Keyboard, MiniMap, Selection, Shape } from "@antv/x6";
|
|
3
3
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
4
|
-
|
|
4
|
+
// src/store.ts
|
|
5
5
|
/** The single writer of the graph. Every operation is idempotent (unknown
|
|
6
6
|
* ids are silent no-ops, redundant writes don't re-emit) so event loops
|
|
7
7
|
* between the canvas and the store die on their own. */
|
|
@@ -142,8 +142,7 @@ function createWorkflowStore(graph) {
|
|
|
142
142
|
};
|
|
143
143
|
return store;
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
//#region src/serialize.ts
|
|
145
|
+
// src/serialize.ts
|
|
147
146
|
/** The wire format's contract version. Bump it whenever the graph shape
|
|
148
147
|
* breaks what older readers expect, and teach deserialize to migrate. */
|
|
149
148
|
const WORKFLOW_GRAPH_VERSION = 1;
|
|
@@ -158,8 +157,7 @@ const deserializeWorkflowGraph = (serialized) => {
|
|
|
158
157
|
if (serialized.version !== 1) throw new Error(`Unsupported workflow graph version ${serialized.version} (expected 1)`);
|
|
159
158
|
return serialized.graph;
|
|
160
159
|
};
|
|
161
|
-
|
|
162
|
-
//#region src/mindmap.ts
|
|
160
|
+
// src/mindmap.ts
|
|
163
161
|
const inlineText = (nodes) => nodes.map((node) => {
|
|
164
162
|
if (node.type === "text" || node.type === "inlineCode") return node.value;
|
|
165
163
|
if (node.type === "break") return " ";
|
|
@@ -295,8 +293,7 @@ function graphToOutline(graph) {
|
|
|
295
293
|
for (const node of graph.nodes) if (!parentOf.has(node.id)) walk(node.id, 0);
|
|
296
294
|
return lines.join("\n").replace(/\n{3,}/g, "\n\n").trim() + "\n";
|
|
297
295
|
}
|
|
298
|
-
|
|
299
|
-
//#region src/x6-canvas.ts
|
|
296
|
+
// src/x6-canvas.ts
|
|
300
297
|
const NODE_WIDTH = 256;
|
|
301
298
|
const NODE_HEIGHT = 88;
|
|
302
299
|
const HANDLE = 12;
|
|
@@ -717,5 +714,4 @@ function createWorkflowCanvas(container, source, options = {}) {
|
|
|
717
714
|
live.set(container, canvas);
|
|
718
715
|
return canvas;
|
|
719
716
|
}
|
|
720
|
-
//#endregion
|
|
721
717
|
export { WORKFLOW_GRAPH_VERSION, createWorkflowCanvas, createWorkflowStore, deserializeWorkflowGraph, graphToOutline, outlineToGraph, serializeWorkflowGraph };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bysages/workflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "AI-ready workflow graphs for By Sages Elements — a headless graph protocol dressed in the paper-and-ink system, rendered by a swappable canvas engine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@antv/x6": "3.1.8",
|
|
42
42
|
"@tanstack/markdown": "1.0.0",
|
|
43
|
-
"elkjs": "0.12.
|
|
44
|
-
"@bysages/core": "0.
|
|
43
|
+
"elkjs": "0.12.1",
|
|
44
|
+
"@bysages/core": "0.6.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "19.3.0",
|
|
48
48
|
"@types/react-dom": "19.3.0",
|
|
49
|
-
"react": "19.3.
|
|
50
|
-
"react-dom": "19.3.
|
|
51
|
-
"vue": "3.5.
|
|
52
|
-
"@bysages/react": "0.
|
|
53
|
-
"@bysages/vue": "0.
|
|
49
|
+
"react": "19.3.1",
|
|
50
|
+
"react-dom": "19.3.1",
|
|
51
|
+
"vue": "3.5.44",
|
|
52
|
+
"@bysages/react": "0.6.0",
|
|
53
|
+
"@bysages/vue": "0.6.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"dev": "basis build --stub",
|