@synergenius/flow-weaver 0.23.0 → 0.23.3

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 CHANGED
@@ -8,461 +8,112 @@
8
8
  [![License: Flow Weaver Library License](https://img.shields.io/badge/License-Flow%20Weaver%20Library-blue?style=flat)](./LICENSE)
9
9
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-green?style=flat)](https://nodejs.org)
10
10
 
11
- **Build AI agent workflows visually. Ship them as your own code.**
11
+ **Design agent workflows in conversation. The compiled output is yours.**
12
12
 
13
- Design agent workflows in the Studio, in TypeScript, or let AI build them for you. The compiler validates everything with 20+ rule categories. The output is standalone TypeScript you deploy anywhere, zero runtime dependency on Flow Weaver.
14
-
15
- *Got an AGENTS.md or runbook? [Convert it to a typed workflow →](https://flowweaver.ai/services/md-converter)*
16
-
17
- [**flowweaver.ai**](https://flowweaver.ai) · [**Open the Studio**](https://flowweaver.ai/studio) · [**Docs**](https://flowweaver.ai/docs) · [**Discord**](https://discord.gg/6Byh3ur2bk) · [**npm**](https://www.npmjs.com/package/@synergenius/flow-weaver)
13
+ [**flowweaver.ai**](https://flowweaver.ai) · [**Studio**](https://flowweaver.ai/studio) · [**Docs**](https://flowweaver.ai/docs) · [**Discord**](https://discord.gg/6Byh3ur2bk) · [**npm**](https://www.npmjs.com/package/@synergenius/flow-weaver)
18
14
 
19
15
  ---
20
16
 
21
- ## Your AGENTS.md is a workflow waiting to happen
22
-
23
- You already wrote the steps, the branching logic, the edge cases. But it's a markdown file. It doesn't run, doesn't validate, and you can't see the full flow at a glance.
24
-
25
- **Paste this:**
26
-
27
- ```markdown
28
- # Code Review Agent
29
-
30
- ### 1. Analyze diff
31
- Send the PR diff to an LLM for security, quality, and style review.
32
-
33
- ### 2. Classify severity
34
- Critical (must fix) · Warning (should fix) · Suggestion (nice to have).
35
-
36
- ### 3. Route
37
- Critical issues → request changes. Otherwise → approve with comments.
38
- ```
39
-
40
- **Get this:**
41
-
42
- <a href="https://htmlpreview.github.io/?https://github.com/synergenius-fw/flow-weaver/blob/main/docs/images/code-review-agent.html">
43
- <picture>
44
- <source media="(prefers-color-scheme: dark)" srcset="docs/images/code-review-agent-dark.svg">
45
- <source media="(prefers-color-scheme: light)" srcset="docs/images/code-review-agent-light.svg">
46
- <img alt="Code Review Agent workflow diagram generated from AGENTS.md" src="docs/images/code-review-agent-dark.svg" width="100%">
47
- </picture>
48
- </a>
49
-
50
- <sup>Click the diagram to open the interactive version (zoom, pan, inspect nodes).</sup>
51
-
52
- The converter extracts the steps and decision points from your markdown and produces typed TypeScript plus a visual diagram. You can run it, test it, deploy it.
53
-
54
- [**Try the converter →**](https://flowweaver.ai/services/md-converter) &ensp; Works with AGENTS.md, CLAUDE.md, Cursor rules, runbooks, SOPs, and any process doc.
17
+ > **You:** Build a support agent that classifies messages and either auto-replies or escalates.
18
+
19
+ > **Weaver:** Created `support-agent.ts`. Four nodes, one workflow.
20
+ >
21
+ > ```
22
+ > Workflow: supportAgent
23
+ >
24
+ > Nodes (4):
25
+ > classify [classifyIntent] IN: message OUT: context
26
+ > route [routeAction] IN: context, execute OUT: context, onSuccess, onFailure
27
+ > reply [llmReply] IN: context OUT: reply
28
+ > esc [escalate] IN: context OUT: ticket, assignee
29
+ >
30
+ > Paths (2):
31
+ > Start -> classify -> route -> reply -> Exit
32
+ > Start -> classify -> route -> esc -> Exit
33
+ > ```
34
+
35
+ > **You:** Show me the graph.
36
+
37
+ > **Weaver:**
38
+ >
39
+ > ```
40
+ > ┌───────┐ ┌─────────────────┐ ┌──────────────┐ ┌───────────┐ ┌──────┐
41
+ > Start │━━━▶│ Classify Intent │━━━▶│ Route Action │━━━▶│ LLM Reply │━━━▶│ Exit │
42
+ > └───────┘ └─────────────────┘ └──────────────┘ └───────────┘ └──────┘
43
+ >
44
+ > Parallel: Escalate
45
+ > ```
46
+
47
+ > **You:** Compile it.
48
+
49
+ > **Weaver:** Done. Zero runtime deps. The output is a standalone TypeScript function you own.
50
+
51
+ > **You:** Validate.
52
+
53
+ > **Weaver:**
54
+ >
55
+ > ```
56
+ > ✓ 1 valid, 2 warnings in 312ms
57
+ > ```
58
+ >
59
+ > Structural, agent safety, and CI rules. All checked.
60
+
61
+ > **You:** Run it with "I need an urgent refund".
62
+
63
+ > **Weaver:**
64
+ >
65
+ > ```
66
+ > classify: → SUCCEEDED (0ms)
67
+ > route: → SUCCEEDED (0ms)
68
+ > reply: → CANCELLED
69
+ > esc: → SUCCEEDED (0ms)
70
+ > ✓ Workflow "supportAgent" completed in 2ms
71
+ >
72
+ > Result: { ticket: "ESC-1773950738529", assignee: "support-team" }
73
+ > ```
74
+
75
+ > **You:** Commit it.
76
+
77
+ > **Weaver:** Committed to `main`. It's a `.ts` file in your repo. Version-controlled like everything else.
78
+
79
+ > **You:** Now add sentiment analysis before routing.
80
+
81
+ > **Weaver:** Done. Here's what changed:
82
+ >
83
+ > ```
84
+ > [BREAKING] +1 types, ~1 types, +1 nodes, +5 conns, -2 conns
85
+ >
86
+ > + analyzeSentiment
87
+ > ~ routeAction (+inputs: sentiment)
88
+ > + sentiment (instance)
89
+ > + classify.context → sentiment.context
90
+ > + sentiment.sentiment → route.sentiment
91
+ > ```
92
+
93
+ > **You:** Where does this deploy?
94
+
95
+ > **Weaver:** Anywhere TypeScript runs. Or generate boilerplate:
96
+ >
97
+ > ```
98
+ > fw export support-agent.ts --target vercel
99
+ > fw export support-agent.ts --target lambda
100
+ > fw export support-agent.ts --target cloudflare
101
+ > fw export support-agent.ts --target inngest
102
+ > ```
55
103
 
56
104
  ---
57
105
 
58
- ## Try It
59
-
60
- **In the browser.** Open the [Cloud Studio](https://flowweaver.ai/studio), sign up, and start building. No install required.
61
-
62
- **From the terminal.**
106
+ ## Install
63
107
 
64
108
  ```bash
65
109
  npm install @synergenius/flow-weaver
66
- npx fw init my-project
67
- cd my-project
68
- npx fw run workflows/example.ts --params '{"input": "value"}'
69
- ```
70
-
71
- `fw` is the CLI command. `flow-weaver` also works as an alias.
72
-
73
- ## How It Works
74
-
75
- **Generate.** Let AI build it for you, design visually in the Studio, or write annotated TypeScript by hand. All three stay in sync.
76
-
77
- **Validate.** The compiler catches wiring errors, type mismatches, missing handlers, unreachable paths, and agent-specific mistakes before anything runs. Not at runtime, not in production.
78
-
79
- **Own.** Compiled output is plain TypeScript with zero imports from Flow Weaver. Clean git diffs, standard testing, no license obligations on the output. If Flow Weaver disappeared tomorrow, your agents would still run.
80
-
81
- ## Three Ways to Build
82
-
83
- **Studio.** A visual IDE that combines a full code editor with a graph builder. Write and refactor workflows in code or compose them on the canvas. Both representations stay synchronized: editing either one updates the other instantly.
84
-
85
- **TypeScript.** Define workflows in plain TypeScript by annotating functions with JSDoc. The compiler derives an executable workflow graph with static typing and compile-time validation. No YAML, no JSON configuration, no runtime layer. Remove the annotations and you keep a clean TypeScript file with zero dependencies.
86
-
87
- **AI Agents.** Connect Claude Code, Cursor, or OpenClaw and let agents scaffold, compile, fix validation errors, and iterate until the workflow works. Agents can also test with mock AI responses and generate diagrams for review.
88
-
89
- ## Quick Start
90
-
91
- Workflows are plain TypeScript. Annotations declare the graph structure:
92
-
93
- ```typescript
94
- // data-pipeline.ts
95
-
96
- /**
97
- * @flowWeaver nodeType
98
- * @input rawData - string
99
- * @output cleaned - string
100
- * @output wordCount - number
101
- */
102
- function processText(execute: boolean, rawData: string) {
103
- if (!execute) return { onSuccess: false, onFailure: false, cleaned: '', wordCount: 0 };
104
- const cleaned = rawData.trim().toLowerCase();
105
- return { onSuccess: true, onFailure: false, cleaned, wordCount: cleaned.split(/\s+/).length };
106
- }
107
-
108
- /**
109
- * @flowWeaver workflow
110
- * @node processor processText
111
- * @connect Start.rawData -> processor.rawData
112
- * @connect processor.cleaned -> Exit.cleaned
113
- * @connect processor.wordCount -> Exit.wordCount
114
- */
115
- export async function dataPipeline(
116
- execute: boolean,
117
- params: { rawData: string }
118
- ): Promise<{ onSuccess: boolean; onFailure: boolean; cleaned: string; wordCount: number }> {
119
- throw new Error('Not compiled');
120
- }
121
- ```
122
-
123
- ```bash
124
- npx fw compile data-pipeline.ts # generates executable code in-place
125
- npx fw run data-pipeline.ts --params '{"rawData": "Hello World"}'
110
+ npx flow-weaver init
126
111
  ```
127
112
 
128
- The compiler fills in the function body while preserving your code outside the generated markers.
129
-
130
- ## AI-Native Development with MCP
131
-
132
- Flow Weaver includes an MCP server with 48 tools for Claude Code, Cursor, OpenClaw, or any MCP-compatible agent:
133
-
134
- ```bash
135
- npx fw mcp-server # auto-registers with Claude Code
136
- ```
137
-
138
- | Capability | MCP Tools |
139
- |-----------|-----------|
140
- | **Build** | `fw_scaffold`, `fw_modify`, `fw_modify_batch`, `fw_add_node`, `fw_connect` |
141
- | **Model** | `fw_create_model`, `fw_workflow_status`, `fw_implement_node` |
142
- | **Validate** | `fw_validate` (with friendly error hints), `fw_doctor` |
143
- | **Understand** | `fw_describe` (json/text/mermaid), `fw_query` (10 query types), `fw_diff` |
144
- | **Test** | `fw_execute_workflow` (with trace), `fw_compile` |
145
- | **Visualize** | `fw_diagram` (SVG/HTML), `fw_get_state`, `fw_focus_node` |
146
- | **Deploy** | `fw_export` (Lambda, Vercel, Cloudflare, Inngest, GitHub Actions, GitLab CI — via packs), `fw_compile --target inngest` |
147
- | **Reuse** | `fw_list_patterns`, `fw_apply_pattern`, `fw_extract_pattern` |
148
- | **Extend** | `fw_market_search`, `fw_market_install` |
149
-
150
- ## Model-Driven Workflows
151
-
152
- Design first, implement later. Describe the workflow shape (nodes, ports, execution path) and the compiler generates a valid skeleton with `declare function` stubs:
153
-
154
- ```bash
155
- # Via MCP: fw_create_model with nodes, inputs/outputs, and execution path
156
- # Via CLI:
157
- npx fw status my-workflow.ts # shows stub vs implemented progress
158
- npx fw implement my-workflow.ts processData # scaffolds a node body
159
- ```
160
-
161
- The graph is valid before any node has a real implementation. Fill in node bodies incrementally, check `status` to track progress. The architect defines the shape, developers fill in the logic.
162
-
163
- ## Agent Workflow Templates
164
-
165
- Built-in templates for AI agent workflows:
166
-
167
- ```bash
168
- npx fw create workflow ai-agent my-agent.ts --provider openai --model gpt-4o
169
- npx fw create workflow ai-react react-agent.ts
170
- npx fw create workflow ai-rag rag-pipeline.ts
171
- npx fw create workflow ai-agent-durable durable-agent.ts
172
- ```
173
-
174
- **12 workflow templates:**
175
-
176
- | Template | What it builds |
177
- |----------|---------------|
178
- | `ai-agent` | Tool-calling agent with explicit loop and termination semantics |
179
- | `ai-react` | ReAct agent (Thought -> Action -> Observation) |
180
- | `ai-rag` | Retrieval-Augmented Generation pipeline |
181
- | `ai-chat` | Stateful conversational AI with memory |
182
- | `ai-agent-durable` | Durable agent pipeline with Inngest step-level retries |
183
- | `ai-pipeline-durable` | Multi-step AI pipeline with durability |
184
- | `sequential` | Linear data pipeline |
185
- | `foreach` | Iteration over collections |
186
- | `conditional` | Branching logic |
187
- | `aggregator` | Multi-source aggregation |
188
- | `webhook` | HTTP event handler |
189
- | `error-handler` | Error recovery pattern |
190
-
191
- Plus **12 node templates** for common building blocks: `llm-call`, `tool-executor`, `conversation-memory`, `prompt-template`, `json-extractor`, `human-approval`, `agent-router`, `rag-retriever`, `validator`, `transformer`, `http`, `aggregator`.
192
-
193
- ## Compile-Time Validation
194
-
195
- The validator understands AI agent patterns and enforces safety rules:
196
-
197
- ```
198
- AGENT_LLM_MISSING_ERROR_HANDLER LLM node's onFailure is unconnected, add error handling
199
- AGENT_UNGUARDED_TOOL_EXECUTOR Tool executor has no human-approval upstream, add a gate
200
- AGENT_MISSING_MEMORY_IN_LOOP Agent loop has LLM but no memory, conversations will be stateless
201
- AGENT_LLM_NO_FALLBACK LLM failure goes directly to Exit, add retry or fallback logic
202
- AGENT_TOOL_NO_OUTPUT_HANDLING Tool executor outputs are all unconnected, results are discarded
203
- ```
204
-
205
- These are not generic lint rules. The validator identifies LLM, tool-executor, human-approval, and memory nodes by port signatures, annotations, and naming patterns, then applies agent-specific checks.
206
-
207
- ## Deterministic Agent Testing
208
-
209
- Test LLM workflows without real API calls:
210
-
211
- ```typescript
212
- import { createMockLlmProvider, createRecordingProvider, loadRecording } from '@synergenius/flow-weaver/testing';
213
-
214
- // Mock: deterministic responses for CI
215
- const mock = createMockLlmProvider([
216
- { content: 'I need to search for that.', toolCalls: [{ name: 'search', args: { q: 'test' } }] },
217
- { content: 'Based on the results, the answer is 42.' },
218
- ]);
219
-
220
- // Record: capture real LLM calls, replay later
221
- const recorder = createRecordingProvider(realProvider);
222
- // ... run workflow ...
223
- saveRecording(recorder.getRecording(), 'fixtures/agent-session.json');
224
-
225
- // Replay: reproducible tests from recorded sessions
226
- const replay = loadRecording('fixtures/agent-session.json');
227
- ```
113
+ The CLI handles the rest.
228
114
 
229
- Mock human approvals, fast-forward delays, and simulate external events. Configured via `globalThis.__fw_mock_config__`.
230
-
231
- ## Scoped Ports: Agent Loops Without Graph Cycles
232
-
233
- Most workflow engines either ban loops entirely (DAG-only) or allow arbitrary cycles that are hard to reason about. Flow Weaver takes a third path: **scoped ports** express iteration while keeping the graph acyclic and statically analyzable.
234
-
235
- ```typescript
236
- /**
237
- * @flowWeaver workflow
238
- * @node agent llmCall
239
- * @node tools toolExecutor
240
- * @node memory conversationMemory
241
- * @scope agent, tools, memory // these nodes iterate together
242
- * @connect agent.toolCalls -> tools.calls
243
- * @connect tools.results -> memory.input
244
- * @connect memory.history -> agent.context
245
- */
246
- ```
247
-
248
- The scope's output ports become callback parameters, and input ports become return values. Agent reasoning loops, ForEach over collections, map/reduce patterns, and nested sub-workflows all work without introducing graph cycles.
249
-
250
- ## Deploy Anywhere
251
-
252
- Same workflow source, multiple deployment targets. Export targets are provided by marketplace packs — install the ones you need:
253
-
254
- ```bash
255
- npm install @synergenius/flow-weaver-pack-lambda @synergenius/flow-weaver-pack-vercel \
256
- @synergenius/flow-weaver-pack-cloudflare @synergenius/flow-weaver-pack-inngest \
257
- @synergenius/flow-weaver-pack-github-actions @synergenius/flow-weaver-pack-gitlab-ci
258
- ```
259
-
260
- ```bash
261
- # Plain TypeScript (default)
262
- fw compile workflow.ts
263
-
264
- # Inngest durable functions (per-node step.run, retries, cron)
265
- fw compile workflow.ts --target inngest --retries 3 --cron "0 9 * * *"
266
-
267
- # Serverless exports
268
- fw export workflow.ts --target lambda --output deploy/
269
- fw export workflow.ts --target vercel --output deploy/
270
- fw export workflow.ts --target cloudflare --output deploy/
271
-
272
- # CI/CD pipelines
273
- fw export workflow.ts --target github-actions --output .github/workflows/
274
- fw export workflow.ts --target gitlab-ci --output .
275
-
276
- # HTTP server with OpenAPI docs
277
- fw serve ./workflows --port 3000 --swagger
278
- ```
279
-
280
- Both the default TypeScript target and Inngest target parallelize independent nodes with `Promise.all()`. Inngest additionally wraps each node in `step.run()` for individual durability and generates typed Zod event schemas.
281
-
282
- ## Diagram Generation
283
-
284
- Generate SVG or interactive HTML diagrams from any workflow:
285
-
286
- ```bash
287
- fw diagram workflow.ts -o workflow.svg --theme dark
288
- fw diagram workflow.ts -o workflow.html --format html
289
- ```
290
-
291
- Customize node appearance with annotations:
292
-
293
- ```typescript
294
- /**
295
- * @flowWeaver nodeType
296
- * @color blue
297
- * @icon database
298
- */
299
- ```
300
-
301
- Named colors: `blue`, `purple`, `green`, `cyan`, `orange`, `pink`, `red`, `yellow`. Icons include `api`, `database`, `shield`, `brain`, `cloud`, `search`, `code`, and 60+ more from Material Design 3. The interactive HTML viewer supports zoom/pan, click-to-inspect nodes, and port-level hover with connection tracing.
302
-
303
- ## API
304
-
305
- ```typescript
306
- import {
307
- parseWorkflow, // Parse workflow file to AST
308
- compileWorkflow, // Parse + validate + generate in one step
309
- validateWorkflow, // Validate AST (returns errors and warnings)
310
- generateCode, // Generate code from AST
311
- generateInPlace, // Regenerate only the compiled markers in-place
312
- } from '@synergenius/flow-weaver';
313
-
314
- // Full compilation
315
- const { code, ast, errors } = await compileWorkflow('workflow.ts');
316
-
317
- // Step by step
318
- const { ast } = await parseWorkflow('workflow.ts');
319
- const { errors, warnings } = validateWorkflow(ast);
320
- const code = generateCode(ast);
321
- ```
322
-
323
- ### Package Exports
324
-
325
- | Import Path | Purpose |
326
- |-------------|---------|
327
- | `@synergenius/flow-weaver` | Parse, validate, compile, generate, AST types, builders, diff, patterns |
328
- | `@synergenius/flow-weaver/runtime` | Execution context, errors, function registry for generated code |
329
- | `@synergenius/flow-weaver/testing` | Mock LLM/approval providers, recording/replay, assertions, token tracking |
330
- | `@synergenius/flow-weaver/built-in-nodes` | delay, waitForEvent, waitForAgent, invokeWorkflow |
331
- | `@synergenius/flow-weaver/diagram` | SVG/HTML diagram layout and rendering |
332
- | `@synergenius/flow-weaver/ast` | AST types and utilities |
333
- | `@synergenius/flow-weaver/api` | Programmatic workflow manipulation API |
334
- | `@synergenius/flow-weaver/diff` | Semantic workflow diffing |
335
- | `@synergenius/flow-weaver/deployment` | Deployment base classes, registry, and CI/CD utilities |
336
- | `@synergenius/flow-weaver/marketplace` | Marketplace package utilities |
337
- | `@synergenius/flow-weaver/editor` | Editor completions and suggestions |
338
- | `@synergenius/flow-weaver/browser` | JSDoc port sync for browser environments |
339
- | `@synergenius/flow-weaver/describe` | Programmatic workflow description |
340
- | `@synergenius/flow-weaver/doc-metadata` | Documentation metadata extractors |
341
-
342
- ## CLI Reference
343
-
344
- ```bash
345
- # Core
346
- fw compile <file> # Compile to TypeScript or Inngest
347
- fw validate <file> # Validate without compiling
348
- fw run <file> # Execute a workflow
349
- fw dev <file> # Watch + compile + run
350
- fw strip <file> # Remove generated code sections
351
- fw describe <file> # Structure output (json/text/mermaid)
352
- fw diagram <file> # Generate SVG or interactive HTML diagram
353
- fw diff <f1> <f2> # Semantic workflow comparison
354
-
355
- # Model-driven
356
- fw status <file> # Show stub vs implemented progress
357
- fw implement <file> <node> # Scaffold a node body from its stub
358
-
359
- # Scaffolding
360
- fw init [directory] # Create new project
361
- fw create workflow <t> <f> # Scaffold from template
362
- fw create node <name> <f> # Scaffold node type
363
- fw templates # List available templates
364
- fw doctor # Check project compatibility
365
- fw grammar # Output annotation grammar (EBNF/railroad)
366
-
367
- # Deploy
368
- fw serve [directory] # HTTP server with Swagger UI
369
- fw export <file> # Export to Lambda/Vercel/Cloudflare/Inngest/GitHub Actions/GitLab CI (via packs)
370
- fw openapi <directory> # Generate OpenAPI spec
371
-
372
- # Patterns
373
- fw pattern list <path> # List reusable patterns
374
- fw pattern apply <p> <t> # Apply pattern to workflow
375
- fw pattern extract <src> # Extract pattern from nodes
376
-
377
- # Docs
378
- fw docs # List documentation topics
379
- fw docs read <topic> # Read a topic
380
- fw docs search <query> # Search documentation
381
-
382
- # Marketplace
383
- fw market search [query] # Search npm for packages
384
- fw market install <pkg> # Install a package
385
- fw market list # List installed packages
386
- fw market init <name> # Scaffold a marketplace package
387
- fw market pack # Validate and generate manifest
388
- fw market publish # Publish to npm
389
-
390
- # Editor / IDE
391
- fw mcp-server # Start MCP server for Claude Code
392
- fw listen # Stream editor events
393
- fw changelog # Generate changelog from git history
394
- fw migrate <glob> # Run migration transforms on workflow files
395
- fw plugin init <name> # Scaffold an external plugin
396
- ```
397
-
398
- ## Built-in Nodes
399
-
400
- | Node | Purpose |
401
- |------|---------|
402
- | `delay` | Sleep for a duration (ms, s, m, h, d). Mockable for fast testing. |
403
- | `waitForEvent` | Wait for an external event with optional field matching and timeout. Maps to Inngest `step.waitForEvent()` for zero-cost durable pauses. |
404
- | `waitForAgent` | Pause execution and wait for an external agent to provide a result. Supports multi-step human-in-the-loop and agent delegation patterns. |
405
- | `invokeWorkflow` | Invoke another workflow by ID with payload and timeout. Maps to Inngest `step.invoke()`. |
406
-
407
- ## STEP Port Architecture
408
-
409
- Every node follows a consistent contract:
410
-
411
- ```typescript
412
- function nodeName(
413
- execute: boolean, // Control: should this node run?
414
- ...inputs // Data inputs (typed)
415
- ): {
416
- onSuccess: boolean; // Success control output
417
- onFailure: boolean; // Failure control output
418
- ...outputs // Data outputs (typed)
419
- }
420
- ```
421
-
422
- Expression nodes (`@expression`) skip the control flow boilerplate. Inputs and outputs map directly to the TypeScript signature.
423
-
424
- ## Flow Weaver Cloud
425
-
426
- [flowweaver.ai](https://flowweaver.ai) is the hosted platform that adds collaboration, managed deployments, and team features on top of everything the CLI provides.
427
-
428
- What the cloud adds:
429
-
430
- - **Browser-based Studio** with real-time collaborative editing
431
- - **One-click deployment** of any workflow as an HTTP endpoint
432
- - **Execution logs** for every workflow run, with input/output history
433
- - **Visual debugger** for step-through node inspection (Pro)
434
- - **Version history** and workflow snapshots (Pro)
435
- - **AI Chat assistant** for building and debugging workflows (Pro)
436
- - **Organization workspaces** with team management (Business)
437
-
438
- Three tiers: **Free** (3 workflows, 1 deployment, 100 executions/month), **Pro** at 9 EUR/month (25 workflows, 10k executions), and **Business** at 29 EUR/month (unlimited workflows, 100k executions). See [flowweaver.ai/pricing](https://flowweaver.ai/pricing) for details.
439
-
440
- The CLI remains fully functional for local development. The cloud adds the parts that are hard to do alone: team collaboration, always-on endpoints, and operational visibility.
441
-
442
- ## Community
443
-
444
- - [Discord](https://discord.gg/6Byh3ur2bk)
445
- - [GitHub Discussions](https://github.com/synergenius-fw/flow-weaver/discussions)
446
- - [X / Twitter](https://x.com/flowweaver_ai)
447
- - [Website](https://flowweaver.ai)
448
-
449
- ## Development
450
-
451
- ```bash
452
- npm run build # Build
453
- npm run watch # Watch mode
454
- npm test # Run all tests
455
- npm run test:watch # Watch mode
456
- npm run typecheck # Type check
457
- npm run docs # Generate API docs
458
- ```
115
+ ---
459
116
 
460
117
  ## License
461
118
 
462
- Licensed under the Flow Weaver Library License. See [LICENSE](./LICENSE) for full terms.
463
-
464
- - **Free to use**: install, run, and compile workflows in any organization
465
- - **Free to host internally** for organizations with 15 or fewer people
466
- - **Commercial license required** to host internally for 16+ people (contact support@synergenius.pt)
467
- - **External hosting prohibited** without a commercial license
468
- - **Output is unrestricted**: compiled workflows, generated code, and deployment artifacts are yours
119
+ Licensed under the [Flow Weaver License](https://flowweaver.ai/license). See [LICENSE.md](./LICENSE.md).
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Device Connection — WebSocket client for connecting a local machine
3
+ * to the Flow Weaver platform as a mounted device.
4
+ *
5
+ * This is the transport layer. Packs register their own request handlers
6
+ * on top of this connection (e.g., improve status, bot management).
7
+ *
8
+ * The platform relays Studio requests to connected devices and forwards
9
+ * device events to Studio subscribers.
10
+ */
11
+ export interface DeviceInfo {
12
+ name: string;
13
+ hostname: string;
14
+ projectDir: string;
15
+ platform: string;
16
+ capabilities: string[];
17
+ /** Pack names that contributed device handlers (for auto-install on platform) */
18
+ packs?: string[];
19
+ }
20
+ export interface DeviceConnectionOptions {
21
+ platformUrl: string;
22
+ token: string;
23
+ projectDir: string;
24
+ deviceName?: string;
25
+ onConnect?: () => void;
26
+ onDisconnect?: (code: number) => void;
27
+ onEvent?: (event: DeviceEvent) => void;
28
+ logger?: (msg: string) => void;
29
+ }
30
+ export interface DeviceEvent {
31
+ type: string;
32
+ data: Record<string, unknown>;
33
+ timestamp: number;
34
+ }
35
+ type RequestHandler = (method: string, params: Record<string, unknown>) => Promise<unknown>;
36
+ export declare class DeviceConnection {
37
+ private ws;
38
+ private heartbeatInterval;
39
+ private reconnectTimeout;
40
+ private requestHandlers;
41
+ private connected;
42
+ private shouldReconnect;
43
+ private readonly options;
44
+ private readonly deviceInfo;
45
+ private readonly log;
46
+ constructor(options: DeviceConnectionOptions);
47
+ /**
48
+ * Add a capability to advertise to the platform.
49
+ */
50
+ addCapability(capability: string): void;
51
+ /**
52
+ * Set the list of packs that contributed device handlers.
53
+ * The platform uses this to auto-install packs in the user's workspace.
54
+ */
55
+ setPacks(packs: string[]): void;
56
+ /**
57
+ * Register a handler for incoming requests from the platform.
58
+ */
59
+ onRequest(method: string, handler: RequestHandler): void;
60
+ /**
61
+ * Connect to the platform. Reconnects automatically on disconnect.
62
+ */
63
+ connect(): Promise<void>;
64
+ /**
65
+ * Emit an event to the platform.
66
+ */
67
+ emit(event: DeviceEvent): void;
68
+ /**
69
+ * Disconnect from the platform. No auto-reconnect.
70
+ */
71
+ disconnect(): void;
72
+ isConnected(): boolean;
73
+ getDeviceInfo(): Readonly<DeviceInfo>;
74
+ private send;
75
+ private handleMessage;
76
+ private scheduleReconnect;
77
+ }
78
+ export {};
79
+ //# sourceMappingURL=device-connection.d.ts.map