@fbp/examples 0.2.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 ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Dan Lynch <pyramation@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @fbp/examples
2
+
3
+ The example flow graphs the platform ships: the catalog the Flows panel offers
4
+ under **Examples**, and the same objects a suite loads when it wants a known
5
+ graph rather than a fixture file it has to keep in step by hand.
6
+
7
+ ```ts
8
+ import { exampleFlows, getExampleFlow } from '@fbp/examples';
9
+
10
+ getExampleFlow('math-pipeline').graph; // → Graph
11
+ ```
12
+
13
+ Each entry carries what it needs to run:
14
+
15
+ | id | runtime | needs |
16
+ |---|---|---|
17
+ | `hello-string` | `local` | nothing — inline nodes only |
18
+ | `math-pipeline` | `local` | nothing — inline nodes only |
19
+ | `agentic-embed` | `server` | `embedding:generate_embedding` |
20
+ | `agentic-kit` | `server` | `agent:chat`, `embedding:generate_embedding` |
21
+ | `email-send` | `server` | `email:send` |
22
+
23
+ `runtime: 'local'` means every node is an inline node, so the editor's
24
+ **Preview Locally** evaluates the whole graph in the browser; those two are the
25
+ examples the tests evaluate and assert an exact value for. A `server` example
26
+ addresses registered cloud functions and only runs through **Run on Server**.
27
+
28
+ The agentic examples address functions in [`functions/`](../../functions):
29
+ `embedding:generate_embedding` and `agent:chat`, both of which reach a provider
30
+ through the runtime's metered `ctx.agent`. Run them on a platform those feature
31
+ images are registered on — and on the Kubernetes lane, one brought up with the
32
+ agentic pair, which is opt-in:
33
+
34
+ ```bash
35
+ fun up --with agentic # the metered gateway + a local Ollama
36
+ ```
37
+
38
+ Without it a function pod has no gateway to reach (compute-service's in-process
39
+ one binds localhost inside the worker pod), and both agentic examples fail with
40
+ `agent context not available`.
@@ -0,0 +1,117 @@
1
+ /**
2
+ * A review loop as a graph: code → review → branch → fix → re-review → merge.
3
+ *
4
+ * This is the graph the flow nodes exist for. `agent:code_task` makes the
5
+ * change, `agent:chat` reviews the run's own summary, and `flow:branch` decides
6
+ * what happens next by a declared predicate — approved goes straight to the
7
+ * output, anything else goes to a second coding run that continues the *same*
8
+ * `agent_run` (its `run_id` is an edge), followed by a second review.
9
+ *
10
+ * `flow:merge` is what makes the two arms one graph again. A branch emits only
11
+ * the port it took, so the arm not taken never completes and every edge out of
12
+ * it is unsatisfiable forever; the merge node declares both of its inputs
13
+ * optional, which is the graph saying "run me on whichever arm arrives". The
14
+ * result is a diamond rather than two graphs: one output port, and `source`
15
+ * recording which path produced it — `a` when the first review approved, `b`
16
+ * when it took a fix and a re-review to get there.
17
+ *
18
+ * The predicate is `contains 'approved'` rather than an exact match because the
19
+ * value being judged is a sentence from a model; asking for equality against
20
+ * prose is how a loop like this silently always takes the same arm.
21
+ */
22
+ export const agentReviewLoop = {
23
+ id: 'agent-review-loop',
24
+ name: 'Agent review loop (code → review → fix → re-review)',
25
+ description: 'Let an agent make a change, review it, and only fix and re-review when the review asked for changes.',
26
+ runtime: 'server',
27
+ requiresFunctions: ['agent:chat', 'agent:code_task'],
28
+ graph: {
29
+ name: 'agent-review-loop',
30
+ nodes: [
31
+ {
32
+ name: 'graphInput1',
33
+ type: 'graphInput',
34
+ meta: { x: 80, y: 240 },
35
+ props: [{ name: 'portName', type: 'string', value: 'request' }],
36
+ },
37
+ {
38
+ name: 'string1',
39
+ type: 'const:string',
40
+ meta: { x: 80, y: 360 },
41
+ props: [{ name: 'value', type: 'string', value: 'constructive-io/constructive-db' }],
42
+ },
43
+ {
44
+ name: 'string2',
45
+ type: 'const:string',
46
+ meta: { x: 80, y: 60 },
47
+ props: [
48
+ {
49
+ name: 'value',
50
+ type: 'string',
51
+ value: 'You are reviewing a coding agent\'s account of a change it just made. Answer with one word — "approved" if the change is sound and complete, "changes_requested" if it is not — then one paragraph saying why, and what to change.',
52
+ },
53
+ ],
54
+ },
55
+ { name: 'code1', type: 'agent:code_task', meta: { x: 470, y: 280 } },
56
+ { name: 'review1', type: 'agent:chat', meta: { x: 860, y: 140 } },
57
+ {
58
+ name: 'branch1',
59
+ type: 'flow:branch',
60
+ meta: { x: 1220, y: 140 },
61
+ props: [
62
+ { name: 'operator', type: 'string', value: 'contains' },
63
+ { name: 'expected', type: 'string', value: 'approved' },
64
+ ],
65
+ },
66
+ {
67
+ name: 'template1',
68
+ type: 'string:template',
69
+ meta: { x: 1220, y: 420 },
70
+ props: [
71
+ {
72
+ name: 'template',
73
+ type: 'string',
74
+ value: 'The review asked for changes. Address this feedback in the same run:\n\n{{review}}',
75
+ },
76
+ ],
77
+ },
78
+ { name: 'fix1', type: 'agent:code_task', meta: { x: 1560, y: 420 } },
79
+ { name: 'review2', type: 'agent:chat', meta: { x: 1900, y: 420 } },
80
+ { name: 'merge1', type: 'flow:merge', meta: { x: 2240, y: 260 } },
81
+ { name: 'object1', type: 'json:object', meta: { x: 2560, y: 260 } },
82
+ {
83
+ name: 'graphOutput1',
84
+ type: 'graphOutput',
85
+ meta: { x: 2880, y: 260 },
86
+ props: [{ name: 'portName', type: 'string', value: 'result' }],
87
+ },
88
+ ],
89
+ edges: [
90
+ { src: { node: 'graphInput1', port: 'value' }, dst: { node: 'code1', port: 'prompt' } },
91
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'code1', port: 'repo' } },
92
+ // The review judges the run's own account of what it did.
93
+ { src: { node: 'string2', port: 'value' }, dst: { node: 'review1', port: 'system' } },
94
+ { src: { node: 'code1', port: 'summary' }, dst: { node: 'review1', port: 'prompt' } },
95
+ { src: { node: 'review1', port: 'content' }, dst: { node: 'branch1', port: 'value' } },
96
+ // Approved: the review text is the result, and the fix arm never runs.
97
+ { src: { node: 'branch1', port: 'true' }, dst: { node: 'merge1', port: 'a' } },
98
+ // Changes requested: the review text becomes the next run's prompt, and
99
+ // `run_id` continues the same session rather than starting a new one.
100
+ { src: { node: 'branch1', port: 'false' }, dst: { node: 'template1', port: 'review' } },
101
+ { src: { node: 'template1', port: 'value' }, dst: { node: 'fix1', port: 'prompt' } },
102
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'fix1', port: 'repo' } },
103
+ { src: { node: 'code1', port: 'run_id' }, dst: { node: 'fix1', port: 'run_id' } },
104
+ { src: { node: 'string2', port: 'value' }, dst: { node: 'review2', port: 'system' } },
105
+ { src: { node: 'fix1', port: 'summary' }, dst: { node: 'review2', port: 'prompt' } },
106
+ { src: { node: 'review2', port: 'content' }, dst: { node: 'merge1', port: 'b' } },
107
+ // One output either way, and `source` says which arm produced it.
108
+ { src: { node: 'merge1', port: 'value' }, dst: { node: 'object1', port: 'review' } },
109
+ { src: { node: 'merge1', port: 'source' }, dst: { node: 'object1', port: 'arm' } },
110
+ { src: { node: 'code1', port: 'pull_request_url' }, dst: { node: 'object1', port: 'pullRequest' } },
111
+ { src: { node: 'code1', port: 'branch' }, dst: { node: 'object1', port: 'branch' } },
112
+ { src: { node: 'object1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
113
+ ],
114
+ inputs: [{ name: 'request', type: 'string' }],
115
+ outputs: [{ name: 'result', type: 'json' }],
116
+ },
117
+ };
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Embeddings only, on the one model the suites already run locally
3
+ * (`nomic-embed-text` on Ollama). It reports the vector's width rather than the
4
+ * vector, so a run has a small deterministic assertion — 768 dimensions — that
5
+ * says the whole path worked: worker → knative → runtime `ctx.agent` → agentic
6
+ * server → local provider.
7
+ *
8
+ * The node is the embedding feature's own function, published by
9
+ * constructive-functions — the platform provides `ctx.agent`, features provide
10
+ * the nodes that call it.
11
+ */
12
+ export const agenticEmbed = {
13
+ id: 'agentic-embed',
14
+ name: 'Agentic embed (nomic-embed-text)',
15
+ description: 'Embed a passage locally and report the vector width — the CI-safe agentic flow.',
16
+ runtime: 'server',
17
+ requiresFunctions: ['embedding:generate_embedding'],
18
+ graph: {
19
+ name: 'agentic-embed',
20
+ nodes: [
21
+ {
22
+ name: 'string1',
23
+ type: 'const:string',
24
+ meta: { x: 80, y: 140 },
25
+ props: [
26
+ {
27
+ name: 'value',
28
+ type: 'string',
29
+ value: 'A flow graph is a set of nodes wired port to port.',
30
+ },
31
+ ],
32
+ },
33
+ {
34
+ name: 'string2',
35
+ type: 'const:string',
36
+ meta: { x: 80, y: 320 },
37
+ props: [{ name: 'value', type: 'string', value: 'nomic-embed-text' }],
38
+ },
39
+ { name: 'embed1', type: 'embedding:generate_embedding', meta: { x: 460, y: 200 } },
40
+ { name: 'object1', type: 'json:object', meta: { x: 820, y: 200 } },
41
+ {
42
+ name: 'graphOutput1',
43
+ type: 'graphOutput',
44
+ meta: { x: 1140, y: 200 },
45
+ props: [{ name: 'portName', type: 'string', value: 'result' }],
46
+ },
47
+ ],
48
+ edges: [
49
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'embed1', port: 'text' } },
50
+ { src: { node: 'string2', port: 'value' }, dst: { node: 'embed1', port: 'model' } },
51
+ { src: { node: 'embed1', port: 'dimensions' }, dst: { node: 'object1', port: 'dimensions' } },
52
+ { src: { node: 'embed1', port: 'model' }, dst: { node: 'object1', port: 'model' } },
53
+ { src: { node: 'object1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
54
+ ],
55
+ outputs: [{ name: 'result', type: 'json' }],
56
+ },
57
+ };
@@ -0,0 +1,94 @@
1
+ /**
2
+ * The agentic-kit round trip as a graph: one piece of text fans out to an
3
+ * embedding call and a chat call, and both results land in a single JSON object
4
+ * so one output node carries the whole answer.
5
+ *
6
+ * Both nodes reach the agentic server through the runtime's `ctx.agent`, so what
7
+ * this really exercises is the identity-carrying path from the worker to the
8
+ * gateway to the local provider — with `nomic-embed-text` on Ollama as the
9
+ * embedding model that is already proven in CI.
10
+ *
11
+ * Both nodes are features' own functions, published by constructive-functions:
12
+ * the platform provides `ctx.agent`, features provide the nodes that call it.
13
+ *
14
+ * Both models are named explicitly rather than left to the gateway's default,
15
+ * because that default is an embedding model (`DEFAULT_MODEL` in
16
+ * `compute/docker-compose.yml`) and would refuse the chat call. The chat model
17
+ * is the small one the local stack pulls, so this graph runs where CI runs.
18
+ */
19
+ export const agenticKit = {
20
+ id: 'agentic-kit',
21
+ name: 'Agentic kit (embed + chat)',
22
+ description: 'Embed a passage and ask a model about it, merging both into one output.',
23
+ runtime: 'server',
24
+ requiresFunctions: ['agent:chat', 'embedding:generate_embedding'],
25
+ graph: {
26
+ name: 'agentic-kit',
27
+ nodes: [
28
+ {
29
+ name: 'string1',
30
+ type: 'const:string',
31
+ meta: { x: 80, y: 120 },
32
+ props: [
33
+ {
34
+ name: 'value',
35
+ type: 'string',
36
+ value: 'Constructive turns database metadata into provisioned schemas, row level security policies and typed SDKs.',
37
+ },
38
+ ],
39
+ },
40
+ {
41
+ name: 'string2',
42
+ type: 'const:string',
43
+ meta: { x: 80, y: 300 },
44
+ props: [{ name: 'value', type: 'string', value: 'nomic-embed-text' }],
45
+ },
46
+ {
47
+ name: 'string3',
48
+ type: 'const:string',
49
+ meta: { x: 80, y: 440 },
50
+ props: [
51
+ {
52
+ name: 'value',
53
+ type: 'string',
54
+ value: 'Answer in one short sentence.',
55
+ },
56
+ ],
57
+ },
58
+ {
59
+ name: 'string4',
60
+ type: 'const:string',
61
+ meta: { x: 80, y: 560 },
62
+ props: [{ name: 'value', type: 'string', value: 'qwen2.5:0.5b' }],
63
+ },
64
+ { name: 'embed1', type: 'embedding:generate_embedding', meta: { x: 460, y: 140 } },
65
+ { name: 'chat1', type: 'agent:chat', meta: { x: 460, y: 420 } },
66
+ {
67
+ name: 'select1',
68
+ type: 'json:select',
69
+ meta: { x: 800, y: 60 },
70
+ props: [{ name: 'path', type: 'string', value: '0' }],
71
+ },
72
+ { name: 'object1', type: 'json:object', meta: { x: 1100, y: 300 } },
73
+ {
74
+ name: 'graphOutput1',
75
+ type: 'graphOutput',
76
+ meta: { x: 1420, y: 300 },
77
+ props: [{ name: 'portName', type: 'string', value: 'result' }],
78
+ },
79
+ ],
80
+ edges: [
81
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'embed1', port: 'text' } },
82
+ { src: { node: 'string2', port: 'value' }, dst: { node: 'embed1', port: 'model' } },
83
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'chat1', port: 'prompt' } },
84
+ { src: { node: 'string3', port: 'value' }, dst: { node: 'chat1', port: 'system' } },
85
+ { src: { node: 'string4', port: 'value' }, dst: { node: 'chat1', port: 'model' } },
86
+ { src: { node: 'embed1', port: 'embedding' }, dst: { node: 'select1', port: 'obj' } },
87
+ { src: { node: 'select1', port: 'value' }, dst: { node: 'object1', port: 'firstDimension' } },
88
+ { src: { node: 'embed1', port: 'dimensions' }, dst: { node: 'object1', port: 'dimensions' } },
89
+ { src: { node: 'chat1', port: 'content' }, dst: { node: 'object1', port: 'answer' } },
90
+ { src: { node: 'object1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
91
+ ],
92
+ outputs: [{ name: 'result', type: 'json' }],
93
+ },
94
+ };
@@ -0,0 +1,80 @@
1
+ /**
2
+ * A coding agent as one node.
3
+ *
4
+ * `agent:chat` plans first — it turns the graph's one input into the instruction
5
+ * the coding run is given — and `agent:code_task` is the resource node that does
6
+ * the work: it clones the repository, runs the agent inside the clone with the
7
+ * thread as its UI, then commits, pushes and opens a pull request. The plan step
8
+ * is optional in the sense that the coding node accepts the raw request just as
9
+ * well; it is here because it is what makes the graph legible — the prompt the
10
+ * agent was actually given is a value on an edge, not something buried in a Job.
11
+ *
12
+ * The resource node is long-running: the worker creates a Kubernetes Job and the
13
+ * graph waits for the node gateway to be settled, so the run may pause for a
14
+ * human approval in the thread without the execution timing out.
15
+ */
16
+ export const codingAgent = {
17
+ id: 'coding-agent',
18
+ name: 'Coding agent (plan → code_task)',
19
+ description: 'Plan a change, then let the coding agent clone the repo, make it, and open a pull request.',
20
+ runtime: 'server',
21
+ requiresFunctions: ['agent:chat', 'agent:code_task'],
22
+ graph: {
23
+ name: 'coding-agent',
24
+ nodes: [
25
+ {
26
+ name: 'graphInput1',
27
+ type: 'graphInput',
28
+ meta: { x: 80, y: 200 },
29
+ props: [{ name: 'portName', type: 'string', value: 'request' }],
30
+ },
31
+ {
32
+ name: 'string1',
33
+ type: 'const:string',
34
+ meta: { x: 80, y: 60 },
35
+ props: [
36
+ {
37
+ name: 'value',
38
+ type: 'string',
39
+ value: 'Restate the request as a single instruction for a coding agent working in a git clone. One paragraph, no preamble.',
40
+ },
41
+ ],
42
+ },
43
+ {
44
+ name: 'string2',
45
+ type: 'const:string',
46
+ meta: { x: 80, y: 360 },
47
+ props: [{ name: 'value', type: 'string', value: 'constructive-io/constructive-db' }],
48
+ },
49
+ {
50
+ name: 'string3',
51
+ type: 'const:string',
52
+ meta: { x: 80, y: 460 },
53
+ props: [{ name: 'value', type: 'string', value: 'main' }],
54
+ },
55
+ { name: 'plan1', type: 'agent:chat', meta: { x: 470, y: 120 } },
56
+ { name: 'code1', type: 'agent:code_task', meta: { x: 860, y: 280 } },
57
+ { name: 'object1', type: 'json:object', meta: { x: 1240, y: 280 } },
58
+ {
59
+ name: 'graphOutput1',
60
+ type: 'graphOutput',
61
+ meta: { x: 1560, y: 280 },
62
+ props: [{ name: 'portName', type: 'string', value: 'result' }],
63
+ },
64
+ ],
65
+ edges: [
66
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'plan1', port: 'system' } },
67
+ { src: { node: 'graphInput1', port: 'value' }, dst: { node: 'plan1', port: 'prompt' } },
68
+ { src: { node: 'plan1', port: 'content' }, dst: { node: 'code1', port: 'prompt' } },
69
+ { src: { node: 'string2', port: 'value' }, dst: { node: 'code1', port: 'repo' } },
70
+ { src: { node: 'string3', port: 'value' }, dst: { node: 'code1', port: 'base_branch' } },
71
+ { src: { node: 'code1', port: 'pull_request_url' }, dst: { node: 'object1', port: 'pullRequest' } },
72
+ { src: { node: 'code1', port: 'branch' }, dst: { node: 'object1', port: 'branch' } },
73
+ { src: { node: 'code1', port: 'summary' }, dst: { node: 'object1', port: 'summary' } },
74
+ { src: { node: 'code1', port: 'thread_id' }, dst: { node: 'object1', port: 'thread' } },
75
+ { src: { node: 'object1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
76
+ ],
77
+ inputs: [{ name: 'request', type: 'string' }],
78
+ outputs: [{ name: 'result', type: 'json' }],
79
+ },
80
+ };
@@ -0,0 +1,70 @@
1
+ /**
2
+ * A resumable coding session as one node.
3
+ *
4
+ * The sibling of `coding-agent`, kept beside it rather than replacing it: both
5
+ * dispatch `agent:code_task`, and what differs is the harness the node asks for.
6
+ * That graph leaves it to the deployment's default; this one names `pi`, where the
7
+ * `agent_run` row is the session and the Job is one attached compute lifetime —
8
+ * the working tree comes back from git and the transcript from the append-only run
9
+ * log, so the same run can be picked up again by a later execution.
10
+ *
11
+ * `park` is what makes that visible from the graph: with it set, the node finishes
12
+ * by leaving the run `idle` — branch and commit recorded, no compute attached —
13
+ * and the next dispatch of the same run continues the session instead of starting
14
+ * a new one. The graph asks for no repository, because a database has one named
15
+ * after its id the way it has its own storage bucket.
16
+ */
17
+ export const codingSession = {
18
+ id: 'coding-session',
19
+ name: 'Coding session (resumable run)',
20
+ description: 'Run a durable coding session in a disposable Job: git carries the workspace, the run log carries the transcript.',
21
+ runtime: 'server',
22
+ requiresFunctions: ['agent:code_task'],
23
+ graph: {
24
+ name: 'coding-session',
25
+ nodes: [
26
+ {
27
+ name: 'graphInput1',
28
+ type: 'graphInput',
29
+ meta: { x: 80, y: 200 },
30
+ props: [{ name: 'portName', type: 'string', value: 'request' }],
31
+ },
32
+ {
33
+ name: 'boolean1',
34
+ type: 'const:boolean',
35
+ meta: { x: 80, y: 340 },
36
+ props: [{ name: 'value', type: 'boolean', value: true }],
37
+ },
38
+ // The harness is a value on an edge for the same reason the prompt is: which
39
+ // kernel ran the session is legible from the graph rather than buried in a
40
+ // Job's environment.
41
+ {
42
+ name: 'string1',
43
+ type: 'const:string',
44
+ meta: { x: 80, y: 480 },
45
+ props: [{ name: 'value', type: 'string', value: 'pi' }],
46
+ },
47
+ { name: 'session1', type: 'agent:code_task', meta: { x: 470, y: 240 } },
48
+ { name: 'object1', type: 'json:object', meta: { x: 880, y: 240 } },
49
+ {
50
+ name: 'graphOutput1',
51
+ type: 'graphOutput',
52
+ meta: { x: 1200, y: 240 },
53
+ props: [{ name: 'portName', type: 'string', value: 'result' }],
54
+ },
55
+ ],
56
+ edges: [
57
+ { src: { node: 'graphInput1', port: 'value' }, dst: { node: 'session1', port: 'prompt' } },
58
+ { src: { node: 'boolean1', port: 'value' }, dst: { node: 'session1', port: 'park' } },
59
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'session1', port: 'harness' } },
60
+ { src: { node: 'session1', port: 'run_id' }, dst: { node: 'object1', port: 'run' } },
61
+ { src: { node: 'session1', port: 'branch' }, dst: { node: 'object1', port: 'branch' } },
62
+ { src: { node: 'session1', port: 'commit' }, dst: { node: 'object1', port: 'commit' } },
63
+ { src: { node: 'session1', port: 'resumed' }, dst: { node: 'object1', port: 'resumed' } },
64
+ { src: { node: 'session1', port: 'summary' }, dst: { node: 'object1', port: 'summary' } },
65
+ { src: { node: 'object1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
66
+ ],
67
+ inputs: [{ name: 'request', type: 'string' }],
68
+ outputs: [{ name: 'result', type: 'json' }],
69
+ },
70
+ };
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Two `email:send` calls — one at the top level, one inside a subnet whose
3
+ * inputs are wired from the outer constants. The subnet, the boundary nodes and
4
+ * the result edge back out of it make this the graph that exercises the editor's
5
+ * nesting and the worker's subnet expansion, which is why the platform-UI e2e
6
+ * suite runs this shape against Mailpit.
7
+ *
8
+ * Addresses are placeholders: point them at a mailbox you can read before
9
+ * running it on a server.
10
+ */
11
+ export const emailSend = {
12
+ id: 'email-send',
13
+ name: 'Email send (with subnet)',
14
+ description: 'Two email:send nodes, one nested in a subnet — needs the email feature registered.',
15
+ runtime: 'server',
16
+ requiresFunctions: ['email:send'],
17
+ graph: {
18
+ name: 'email-send',
19
+ nodes: [
20
+ { name: 'send-email1', type: 'email:send', meta: { x: 689, y: 572 } },
21
+ {
22
+ name: 'string1',
23
+ type: 'const:string',
24
+ meta: { x: 106, y: 282 },
25
+ props: [{ name: 'value', type: 'string', value: 'recipient@example.com' }],
26
+ },
27
+ {
28
+ name: 'string2',
29
+ type: 'const:string',
30
+ meta: { x: 108, y: 392 },
31
+ props: [{ name: 'value', type: 'string', value: 'top-level send' }],
32
+ },
33
+ {
34
+ name: 'string3',
35
+ type: 'const:string',
36
+ meta: { x: 100, y: 483 },
37
+ props: [{ name: 'value', type: 'string', value: '<h1>Sent from a flow</h1>' }],
38
+ },
39
+ {
40
+ name: 'string4',
41
+ type: 'const:string',
42
+ meta: { x: 97, y: 570 },
43
+ props: [{ name: 'value', type: 'string', value: 'Sent from a flow' }],
44
+ },
45
+ {
46
+ name: 'string5',
47
+ type: 'const:string',
48
+ meta: { x: 104, y: 669 },
49
+ props: [{ name: 'value', type: 'string', value: 'sender@example.com' }],
50
+ },
51
+ {
52
+ name: 'string6',
53
+ type: 'const:string',
54
+ meta: { x: 113, y: 775 },
55
+ props: [{ name: 'value', type: 'string', value: 'noreply@example.com' }],
56
+ },
57
+ { name: 'graphOutput1', type: 'graphOutput', meta: { x: 1377, y: 126 } },
58
+ {
59
+ name: 'subnet1',
60
+ type: 'subnet',
61
+ meta: { x: 1054, y: 274 },
62
+ props: [],
63
+ inputs: [
64
+ { name: 'input1', type: 'any' },
65
+ { name: 'input2', type: 'any' },
66
+ { name: 'input3', type: 'any' },
67
+ { name: 'mine', type: 'any' },
68
+ ],
69
+ outputs: [
70
+ { name: 'graphOutput1', type: 'any' },
71
+ { name: 'output1', type: 'any' },
72
+ ],
73
+ nodes: [
74
+ {
75
+ name: 'input_1',
76
+ type: 'graphInput',
77
+ meta: { x: 30, y: 21 },
78
+ props: [{ name: 'portName', type: 'string', value: 'input1' }],
79
+ },
80
+ {
81
+ name: 'input_2',
82
+ type: 'graphInput',
83
+ meta: { x: 22, y: 221 },
84
+ props: [{ name: 'portName', type: 'string', value: 'input2' }],
85
+ },
86
+ {
87
+ name: 'input_3',
88
+ type: 'graphInput',
89
+ meta: { x: 59, y: 340 },
90
+ props: [{ name: 'portName', type: 'string', value: 'input3' }],
91
+ },
92
+ {
93
+ name: 'string7',
94
+ type: 'const:string',
95
+ meta: { x: 335, y: 103 },
96
+ props: [{ name: 'value', type: 'string', value: 'subnet send' }],
97
+ },
98
+ { name: 'send-email2', type: 'email:send', meta: { x: 650, y: 50 } },
99
+ {
100
+ name: 'output_1',
101
+ type: 'graphOutput',
102
+ meta: { x: 950, y: 50 },
103
+ props: [{ name: 'portName', type: 'string', value: 'output1' }],
104
+ },
105
+ {
106
+ name: 'graphInput1',
107
+ type: 'graphInput',
108
+ meta: { x: 47, y: 468 },
109
+ props: [{ name: 'portName', type: 'string', value: 'mine' }],
110
+ },
111
+ { name: 'graphOutput1', type: 'graphOutput', meta: { x: 586, y: 517 } },
112
+ ],
113
+ edges: [
114
+ { src: { node: 'string7', port: 'value' }, dst: { node: 'send-email2', port: 'subject' } },
115
+ { src: { node: 'string7', port: 'value' }, dst: { node: 'send-email2', port: 'html' } },
116
+ { src: { node: 'input_1', port: 'value' }, dst: { node: 'send-email2', port: 'to' } },
117
+ { src: { node: 'input_2', port: 'value' }, dst: { node: 'send-email2', port: 'from' } },
118
+ { src: { node: 'input_3', port: 'value' }, dst: { node: 'send-email2', port: 'replyTo' } },
119
+ { src: { node: 'send-email2', port: 'result' }, dst: { node: 'output_1', port: 'value' } },
120
+ { src: { node: 'graphInput1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
121
+ ],
122
+ },
123
+ ],
124
+ edges: [
125
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'send-email1', port: 'to' } },
126
+ { src: { node: 'string2', port: 'value' }, dst: { node: 'send-email1', port: 'subject' } },
127
+ { src: { node: 'string3', port: 'value' }, dst: { node: 'send-email1', port: 'html' } },
128
+ { src: { node: 'string4', port: 'value' }, dst: { node: 'send-email1', port: 'text' } },
129
+ { src: { node: 'string5', port: 'value' }, dst: { node: 'send-email1', port: 'from' } },
130
+ { src: { node: 'string6', port: 'value' }, dst: { node: 'send-email1', port: 'replyTo' } },
131
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'subnet1', port: 'input1' } },
132
+ { src: { node: 'string5', port: 'value' }, dst: { node: 'subnet1', port: 'input2' } },
133
+ { src: { node: 'string6', port: 'value' }, dst: { node: 'subnet1', port: 'input3' } },
134
+ { src: { node: 'send-email1', port: 'result' }, dst: { node: 'subnet1', port: 'mine' } },
135
+ { src: { node: 'subnet1', port: 'output1' }, dst: { node: 'graphOutput1', port: 'value' } },
136
+ ],
137
+ props: [],
138
+ inputs: [],
139
+ outputs: [{ name: 'graphOutput1', type: 'any' }],
140
+ },
141
+ };