@synergenius/flow-weaver 0.2.1 → 0.3.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/README.md +260 -200
- package/dist/cli/commands/docs.d.ts +11 -0
- package/dist/cli/commands/docs.js +77 -0
- package/dist/cli/flow-weaver.mjs +1077 -543
- package/dist/cli/index.js +51 -0
- package/dist/diagram/geometry.d.ts +9 -4
- package/dist/diagram/geometry.js +219 -30
- package/dist/diagram/renderer.js +137 -116
- package/dist/docs/index.d.ts +54 -0
- package/dist/docs/index.js +256 -0
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/tools-docs.d.ts +3 -0
- package/dist/mcp/tools-docs.js +62 -0
- package/dist/mcp/tools-editor.js +3 -1
- package/dist/mcp/tools-query.js +3 -1
- package/dist/mcp/workflow-executor.js +4 -2
- package/package.json +10 -4
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { listTopics, readTopic, searchDocs } from '../docs/index.js';
|
|
3
|
+
import { makeToolResult, makeErrorResult } from './response-utils.js';
|
|
4
|
+
export function registerDocsTools(mcp) {
|
|
5
|
+
mcp.tool('fw_docs', 'Browse Flow Weaver documentation and reference guides. Use action="list" to see topics, action="read" to read a topic, action="search" to search across all docs.', {
|
|
6
|
+
action: z.enum(['list', 'read', 'search']).describe('What to do: list topics, read a topic, or search'),
|
|
7
|
+
topic: z.string().optional().describe('Topic slug to read (for action="read")'),
|
|
8
|
+
query: z.string().optional().describe('Search query (for action="search")'),
|
|
9
|
+
compact: z.boolean().optional().describe('Return compact LLM-friendly version (default: false)'),
|
|
10
|
+
}, async (args) => {
|
|
11
|
+
try {
|
|
12
|
+
switch (args.action) {
|
|
13
|
+
case 'list': {
|
|
14
|
+
const topics = listTopics();
|
|
15
|
+
return makeToolResult({
|
|
16
|
+
topics: topics.map((t) => ({
|
|
17
|
+
slug: t.slug,
|
|
18
|
+
name: t.name,
|
|
19
|
+
description: t.description,
|
|
20
|
+
keywords: t.keywords,
|
|
21
|
+
})),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
case 'read': {
|
|
25
|
+
if (!args.topic) {
|
|
26
|
+
return makeErrorResult('MISSING_PARAM', 'The "topic" parameter is required for action="read"');
|
|
27
|
+
}
|
|
28
|
+
const doc = readTopic(args.topic, args.compact ?? false);
|
|
29
|
+
if (!doc) {
|
|
30
|
+
const available = listTopics().map((t) => t.slug);
|
|
31
|
+
return makeErrorResult('TOPIC_NOT_FOUND', `Unknown topic "${args.topic}". Available topics: ${available.join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
return makeToolResult({
|
|
34
|
+
name: doc.name,
|
|
35
|
+
description: doc.description,
|
|
36
|
+
content: doc.content,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
case 'search': {
|
|
40
|
+
if (!args.query) {
|
|
41
|
+
return makeErrorResult('MISSING_PARAM', 'The "query" parameter is required for action="search"');
|
|
42
|
+
}
|
|
43
|
+
const results = searchDocs(args.query);
|
|
44
|
+
return makeToolResult({
|
|
45
|
+
query: args.query,
|
|
46
|
+
results: results.slice(0, 20).map((r) => ({
|
|
47
|
+
topic: r.topic,
|
|
48
|
+
slug: r.slug,
|
|
49
|
+
heading: r.heading,
|
|
50
|
+
excerpt: r.excerpt,
|
|
51
|
+
relevance: r.relevance,
|
|
52
|
+
})),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
return makeErrorResult('DOCS_ERROR', `fw_docs failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=tools-docs.js.map
|
package/dist/mcp/tools-editor.js
CHANGED
|
@@ -114,7 +114,9 @@ export function registerEditorTools(mcp, connection, buffer) {
|
|
|
114
114
|
const result = await connection.sendCommand(args.action, {});
|
|
115
115
|
return makeToolResult(unwrapAckResult(result));
|
|
116
116
|
});
|
|
117
|
-
mcp.tool('fw_execute_workflow', 'Run the current workflow with optional parameters and return the result.'
|
|
117
|
+
mcp.tool('fw_execute_workflow', 'Run the current workflow with optional parameters and return the result. ' +
|
|
118
|
+
'Includes per-node execution trace by default (STATUS_CHANGED, VARIABLE_SET events) — ' +
|
|
119
|
+
'use includeTrace: false to disable.', {
|
|
118
120
|
filePath: z
|
|
119
121
|
.string()
|
|
120
122
|
.optional()
|
package/dist/mcp/tools-query.js
CHANGED
|
@@ -128,7 +128,9 @@ export function registerQueryTools(mcp) {
|
|
|
128
128
|
return makeErrorResult('VALIDATE_ERROR', `fw_validate failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
|
-
mcp.tool('fw_compile', 'Compile a workflow to executable code.
|
|
131
|
+
mcp.tool('fw_compile', 'Compile a workflow to executable code. Only regenerates code inside @flow-weaver-runtime ' +
|
|
132
|
+
'and @flow-weaver-body marker sections — user code outside markers is preserved. ' +
|
|
133
|
+
'Set production: true to strip debug instrumentation. Use target=inngest for per-node step.run() durability.', {
|
|
132
134
|
filePath: z.string().describe('Path to the workflow file'),
|
|
133
135
|
write: z.boolean().optional().describe('Whether to write the output file (default: true)'),
|
|
134
136
|
production: z
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as path from 'path';
|
|
6
6
|
import * as fs from 'fs';
|
|
7
7
|
import * as os from 'os';
|
|
8
|
+
import { pathToFileURL } from 'url';
|
|
8
9
|
import ts from 'typescript';
|
|
9
10
|
import { compileWorkflow } from '../api/index.js';
|
|
10
11
|
import { getAvailableWorkflows } from '../api/workflow-file-operations.js';
|
|
@@ -81,8 +82,9 @@ export async function executeWorkflowFromFile(filePath, params, options) {
|
|
|
81
82
|
if (options?.mocks) {
|
|
82
83
|
globalThis.__fw_mocks__ = options.mocks;
|
|
83
84
|
}
|
|
84
|
-
// Dynamic import
|
|
85
|
-
|
|
85
|
+
// Dynamic import using file:// URL for cross-platform compatibility
|
|
86
|
+
// (Windows paths like C:\... break with bare import() — "Received protocol 'c:'")
|
|
87
|
+
const mod = await import(pathToFileURL(tmpFile).href);
|
|
86
88
|
// Find the target exported function
|
|
87
89
|
const exportedFn = findExportedFunction(mod, options?.workflowName);
|
|
88
90
|
if (!exportedFn) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synergenius/flow-weaver",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"postbuild": "npx tsx scripts/postbuild.ts && npm run generate:docs",
|
|
48
48
|
"generate:docs": "tsx scripts/generate-docs.ts",
|
|
49
49
|
"generate:docs:check": "tsx scripts/generate-docs.ts --check",
|
|
50
|
+
"release": "tsx scripts/release.ts",
|
|
50
51
|
"build:cli": "npx tsx scripts/build-cli.ts",
|
|
51
52
|
"watch": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental",
|
|
52
53
|
"test": "vitest run",
|
|
@@ -64,9 +65,14 @@
|
|
|
64
65
|
"keywords": [
|
|
65
66
|
"flow-weaver",
|
|
66
67
|
"workflow",
|
|
68
|
+
"ai-agent",
|
|
69
|
+
"llm",
|
|
70
|
+
"mcp",
|
|
71
|
+
"deterministic",
|
|
67
72
|
"typescript",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
73
|
+
"compiler",
|
|
74
|
+
"inngest",
|
|
75
|
+
"serverless"
|
|
70
76
|
],
|
|
71
77
|
"author": "Ricardo José Horta Morais",
|
|
72
78
|
"license": "SEE LICENSE IN LICENSE",
|