@oomol-lab/open-flow 0.1.0-beta.56 → 0.1.0-beta.58

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.
Files changed (36) hide show
  1. package/dist/browser/{createResourceDialog-Btjes3wD.js → createResourceDialog-C23SBjYd.js} +2 -2
  2. package/dist/browser/flow-authoring-node.d.ts +6 -2
  3. package/dist/browser/flow-authoring.js +44 -12
  4. package/dist/browser/flow-change-schema.d.ts +266 -0
  5. package/dist/browser/flow-change.d.ts +5 -0
  6. package/dist/browser/flow-change.js +33 -2
  7. package/dist/browser/{flowChanges-BxutPLYO.js → flowChanges-fBiAeTzR.js} +954 -487
  8. package/dist/browser/{flowWorkspace-Dg4mqfa6.js → flowWorkspace-MqcEfg7T.js} +3 -3
  9. package/dist/browser/{icons-p2A9zs8t.js → icons-6oQ8Q9Wm.js} +4298 -4252
  10. package/dist/browser/preview.js +354 -36
  11. package/dist/browser/workbench.js +21 -10
  12. package/dist/browser/{workbenchSelect-LRp_Xjeq.js → workbenchSelect-DpLbIr29.js} +1 -1
  13. package/dist/common/authoring.d.ts +207 -0
  14. package/dist/common/authoringSchema.d.ts +1293 -0
  15. package/dist/common/control-api-conformance.js +975 -505
  16. package/dist/common/control-api-errors.d.ts +2 -1
  17. package/dist/common/control-api.d.ts +81 -0
  18. package/dist/common/control-api.js +973 -586
  19. package/dist/common/control-requests.d.ts +128 -0
  20. package/dist/common/control-requests.js +3122 -346
  21. package/dist/common/decision.js +12 -2
  22. package/dist/common/flow-encoding.js +12 -2
  23. package/dist/common/flow-semantics.d.ts +9 -0
  24. package/dist/common/flow-semantics.js +28 -3
  25. package/dist/common/integration-trigger.js +12 -2
  26. package/dist/common/lib-DrKav3HG.js +11403 -0
  27. package/dist/common/mcp.d.ts +120 -11
  28. package/dist/common/mcp.js +423 -51
  29. package/dist/common/openapi.js +12 -2
  30. package/dist/common/poll-trigger.js +12 -2
  31. package/dist/common/scheduler.js +12 -2
  32. package/dist/common/webhook-trigger.js +12 -2
  33. package/package.json +7 -1
  34. package/skills/open-flow/SKILL.md +32 -0
  35. package/skills/open-flow/references/flow-authoring.md +356 -0
  36. package/skills/open-flow/references/flow-n8n-conversion.md +196 -0
@@ -0,0 +1,196 @@
1
+ # Convert n8n behavior into Open Flow
2
+
3
+ An n8n export describes a workflow's behavior and its n8n-specific machinery.
4
+ Use the behavior to design an Open Flow graph with current node contracts.
5
+ Equivalent results may need a different number of nodes or a different graph.
6
+ [Flow authoring](flow-authoring.md) covers `<!-- agentic:var flowCommand -->`,
7
+ atomic edits, input bindings and execution.
8
+
9
+ The requested outcome can be a feasibility assessment, a complete conversion,
10
+ or a useful partial Draft. Unresolved behavior limits what can be claimed as
11
+ converted; it does not prevent saving an agreed partial result. Running,
12
+ publishing and enabling remain separate actions within the user's authorization.
13
+
14
+ ## Choose a representation
15
+
16
+ | Source behavior | Open Flow building blocks | What determines a good fit |
17
+ | --------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------ |
18
+ | Scheduled, webhook or provider event | Cron, Webhook, Poll or Integration Trigger | Schedule/timezone, event payload, delivery and response behavior. |
19
+ | Provider read or write | Connector | Exact operation, input/output shape, account and number of calls. |
20
+ | Field shaping, filtering, aggregation or join | Code with named input/output fields | Explicit collection representation, ordering, keys and empty-input behavior. |
21
+ | IF or Switch | Condition and named execution branches | Predicate, first/all matches, fallback route and data sent onward. |
22
+ | Prompt plus model and output parser | LLM with template, inputs and `resultSchema` | Supported model, result shape and any parser repair behavior. |
23
+ | Agent with tools or memory | Agent where its current contract fits | Tool permissions, state lifetime and how context is supplied. |
24
+ | HTTP request | OpenAPI where an actual operation contract fits | Method, parameters, auth, response format and error behavior. |
25
+ | Human response or durable pause | Wait or Approval | Who resumes it, payload, timing, notification and external response lifecycle. |
26
+ | Workflow failure handling | Error Trigger where its scope fits | Which failures trigger it and what failure data it receives. |
27
+
28
+ Use `schema TYPE` and provider discovery for the actual deployment. A node's
29
+ name alone does not establish equivalence. Provider operations can differ even
30
+ when both products use the same service name. Model, parser, tool, memory and
31
+ retrieval nodes connected by specialized AI edges often form one semantic unit;
32
+ those edges do not translate directly into execution edges.
33
+
34
+ ## Records, collections and item identity
35
+
36
+ n8n passes arrays of items and many nodes process each item automatically.
37
+ Open Flow Code receives one named input record; a collection is an explicit
38
+ array field in that record. Passing an array to a Connector does not imply one
39
+ call per element. This distinction matters most for external writes. See
40
+ [n8n data structure](https://docs.n8n.io/build/work-with-data/understand-n8ns-data-structure.md).
41
+
42
+ For example, a source step that filters paid orders and sums their amounts can
43
+ be represented by a Code node with an `orders` input and `count` and `total`
44
+ outputs. Assuming numeric amounts, its code can be:
45
+
46
+ ```javascript
47
+ export default ({ orders }) => {
48
+ const paid = orders.filter((order) => order.status === 'paid')
49
+ return {
50
+ count: paid.length,
51
+ total: paid.reduce((sum, order) => sum + order.amount, 0),
52
+ }
53
+ }
54
+ ```
55
+
56
+ Declare those business outputs in `config.outputs` and bind the input to the
57
+ actual upstream collection. Empty input produces zero count and total. If the
58
+ source accepts null or string amounts, preserve that behavior explicitly. If
59
+ its next step sends one message per order, this aggregation would change the
60
+ behavior; preserve the individual calls or discuss a batch-message redesign.
61
+
62
+ n8n also links output items to their originating items. An expression such as
63
+ `$('Customer').item.json.email` depends on that lineage, whereas `.first()`
64
+ explicitly chooses a position. Neither implies an arbitrary first available
65
+ customer. An Open Flow representation can use a single record when the relation
66
+ is one-to-one, or an explicit keyed join when working with collections. Missing
67
+ and duplicate keys need the source's intended behavior. See
68
+ [n8n item linking](https://docs.n8n.io/build/work-with-data/reference-data/link-data-items.md).
69
+
70
+ ### Expression examples
71
+
72
+ | n8n intent | Possible Open Flow expression |
73
+ | -------------------------------------- | ------------------------------------------------------------------------------------------------------ |
74
+ | Read `orderId` from the current item | Bind a named `order` input; Code reads `order.orderId`, or select an upstream output's `field`. |
75
+ | Read all records from an earlier step | Bind its explicit array output and process the array. |
76
+ | Read a linked customer for each order | Pass the linked record explicitly, or join collections on the real customer key. |
77
+ | Interpolate an order in a model prompt | Bind `order` to Agent/LLM and use `{{order}}`. |
78
+ | Read a file or attachment | Use the selected Trigger/Connector's file or artifact contract; there is no implicit n8n binary store. |
79
+ | Read environment or execution metadata | Use an equivalent supported binding, or an explicit business input when appropriate. |
80
+
81
+ n8n helpers such as `$input`, `$json` and `$node` are not Open Flow JavaScript
82
+ globals. Rewrite their meaning using named inputs. Execution-time clocks, timezones
83
+ and persisted state may also affect the result; an ordinary JavaScript value is
84
+ only equivalent when those lifetimes agree.
85
+
86
+ ## Branches control execution separately from data
87
+
88
+ Consider “if an order total exceeds 100, notify operations; otherwise archive it.”
89
+ The Open Flow Condition reads the total, selects a named branch, and execution
90
+ edges reach the notification or archive node. Both destinations bind their
91
+ payload from the original order output.
92
+
93
+ The [condition example](flow-authoring.md#put-an-existing-operation-behind-a-condition)
94
+ shows inserting such a gate without altering the destination's input bindings.
95
+ A data reference to an upstream node does not restrict when a side effect runs.
96
+
97
+ Preserve the meaning of source branch indexes: inspect what each output of the
98
+ specific node represents. For multi-case routing, `match: "first"` and
99
+ `match: "all"` support different behavior; `otherwise` is the unmatched route.
100
+ For item-by-item IF routing, partitioning a collection may be necessary before
101
+ choosing execution branches. One condition over an array is not automatically
102
+ one condition per item.
103
+
104
+ Merge behavior also depends on join mode, keys, ordering, duplicates and absent
105
+ inputs. Code can implement a bounded, explicit join. A generic connection
106
+ between two predecessors does not reproduce every Merge mode.
107
+
108
+ ## Provider access and credentials
109
+
110
+ ```bash
111
+ <!-- agentic:var flowCommand --> connector search "<provider and operation>" --flow FLOW_ID --json
112
+ <!-- agentic:var flowCommand --> schema --flow FLOW_ID --input '{"action":"ACTION_ID"}' --json
113
+ <!-- agentic:var flowCommand --> connector connections SERVICE --flow FLOW_ID --json
114
+ <!-- agentic:var flowCommand --> trigger search "<provider and event>" --json
115
+ ```
116
+
117
+ Select real Action IDs, Trigger keys and Connections from discovery. An n8n
118
+ credential ID is not an Open Flow Connection ID. Exports can also contain secrets
119
+ inside URLs, headers, expressions or Code; keep those out of Drafts and reports.
120
+ Use supported credential bindings for the selected operation. A missing account
121
+ can leave a Draft incomplete without implying that the action itself is absent.
122
+
123
+ For HTTP Request conversion, `schema openapi` describes source URL, operation
124
+ selection and supported authentication. Check the actual operation's response,
125
+ non-success status, redirect, binary and retry requirements against that contract.
126
+ An invented API specification does not establish support for an unknown operation.
127
+
128
+ A provider event may expose an ID where the source expected a full record. A
129
+ Connector read can supply the missing data if it preserves the desired behavior.
130
+ Likewise, a polling Trigger may own state or deduplication that a schedule plus
131
+ list action would need to reproduce explicitly.
132
+
133
+ ## Models and stateful interactions
134
+
135
+ A standard prompt/model/parser cluster can often become one LLM node. The
136
+ [structured result example](flow-authoring.md#request-structured-model-output)
137
+ shows a message template, a bound input and a result schema. Business rules that
138
+ depend on particular fields may also need validation before a side effect.
139
+ A result schema alone does not reproduce an arbitrary parser's retry or repair
140
+ policy.
141
+
142
+ Agent tools, memory, retrievers and vector stores affect both available actions
143
+ and state lifetime. Inspect them as part of the source behavior. A successful
144
+ single prompt response does not establish equivalence with a stateful conversation.
145
+
146
+ Wait and Approval suspend a Run with a durable Wait ID. `runs resolve` continues
147
+ that Run. Match the source's resume payload, timing and external interaction
148
+ before calling it equivalent. Forms, conversational memory, delayed responses and
149
+ webhook response lifecycles may require capabilities beyond a simple pause;
150
+ a polling loop inside Code does not provide those lifecycles.
151
+
152
+ ## Failures and execution settings
153
+
154
+ Source execution settings can change the number of processed items, output on
155
+ empty results, retries and failure routes. Account for settings such as
156
+ `executeOnce`, `alwaysOutputData`, `retryOnFail`, `onError` and legacy
157
+ `continueOnFail` when present. Their effective behavior depends on the source
158
+ node and n8n version; use its implementation or a representative execution when
159
+ the export is insufficient evidence.
160
+
161
+ The observable questions are whether a failed operation is retried, whether a
162
+ retry repeats a side effect, which output receives failure data, and whether the
163
+ workflow ultimately fails or continues. Handling a returned error item and
164
+ handling a thrown exception can be different paths. Preserve both when relevant;
165
+ do not infer their payload or route from the setting's label.
166
+
167
+ Open Flow Error Triggers observe automatic Run failures of published upstream
168
+ Flows. They expose `workflow`, `execution` and `error`; they do not implement a
169
+ node's continue-on-error route or catch manual Run failures. Node-level recovery
170
+ needs a separately supported design.
171
+
172
+ ## Describe gaps and verify the requested result
173
+
174
+ Useful distinctions for a conversion report are:
175
+
176
+ - **Converted:** current contracts express the required behavior.
177
+ - **Needs configuration:** the design fits but needs an account or business value.
178
+ - **Missing provider capability:** the required event or operation is absent
179
+ from the available catalog. Describe its inputs, outputs and affected behavior.
180
+ - **Behavioral mismatch:** execution, state, lineage or response semantics need
181
+ a redesign or cannot currently be preserved. More catalog searching will not
182
+ resolve an execution-model mismatch.
183
+
184
+ Discovery effort should follow the uncertainty. A close search result warrants
185
+ contract inspection; a broad catalog query can help resolve ambiguous terminology.
186
+ There is no prescribed query count or requirement to produce a full inventory
187
+ before a useful local edit. When a gap would change the promised result, explain
188
+ it and align on the reduced scope or redesign before implementing that choice.
189
+
190
+ A saved, valid graph establishes structural correctness. Behavioral comparison
191
+ needs representative inputs and observable results: empty and multiple items,
192
+ branch boundaries, duplicate join keys, failures and external call counts as
193
+ relevant. Test execution stays within the user's authorization. Reports should
194
+ distinguish what was mapped, saved, checked and actually run, identify remaining
195
+ gaps, and link the resulting Flow/Revision when one was created. Annotations and
196
+ disabled nodes need mention only when their omission or behavior matters.