@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.
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.codingAgent = void 0;
4
+ /**
5
+ * A coding agent as one node.
6
+ *
7
+ * `agent:chat` plans first — it turns the graph's one input into the instruction
8
+ * the coding run is given — and `agent:code_task` is the resource node that does
9
+ * the work: it clones the repository, runs the agent inside the clone with the
10
+ * thread as its UI, then commits, pushes and opens a pull request. The plan step
11
+ * is optional in the sense that the coding node accepts the raw request just as
12
+ * well; it is here because it is what makes the graph legible — the prompt the
13
+ * agent was actually given is a value on an edge, not something buried in a Job.
14
+ *
15
+ * The resource node is long-running: the worker creates a Kubernetes Job and the
16
+ * graph waits for the node gateway to be settled, so the run may pause for a
17
+ * human approval in the thread without the execution timing out.
18
+ */
19
+ exports.codingAgent = {
20
+ id: 'coding-agent',
21
+ name: 'Coding agent (plan → code_task)',
22
+ description: 'Plan a change, then let the coding agent clone the repo, make it, and open a pull request.',
23
+ runtime: 'server',
24
+ requiresFunctions: ['agent:chat', 'agent:code_task'],
25
+ graph: {
26
+ name: 'coding-agent',
27
+ nodes: [
28
+ {
29
+ name: 'graphInput1',
30
+ type: 'graphInput',
31
+ meta: { x: 80, y: 200 },
32
+ props: [{ name: 'portName', type: 'string', value: 'request' }],
33
+ },
34
+ {
35
+ name: 'string1',
36
+ type: 'const:string',
37
+ meta: { x: 80, y: 60 },
38
+ props: [
39
+ {
40
+ name: 'value',
41
+ type: 'string',
42
+ value: 'Restate the request as a single instruction for a coding agent working in a git clone. One paragraph, no preamble.',
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ name: 'string2',
48
+ type: 'const:string',
49
+ meta: { x: 80, y: 360 },
50
+ props: [{ name: 'value', type: 'string', value: 'constructive-io/constructive-db' }],
51
+ },
52
+ {
53
+ name: 'string3',
54
+ type: 'const:string',
55
+ meta: { x: 80, y: 460 },
56
+ props: [{ name: 'value', type: 'string', value: 'main' }],
57
+ },
58
+ { name: 'plan1', type: 'agent:chat', meta: { x: 470, y: 120 } },
59
+ { name: 'code1', type: 'agent:code_task', meta: { x: 860, y: 280 } },
60
+ { name: 'object1', type: 'json:object', meta: { x: 1240, y: 280 } },
61
+ {
62
+ name: 'graphOutput1',
63
+ type: 'graphOutput',
64
+ meta: { x: 1560, y: 280 },
65
+ props: [{ name: 'portName', type: 'string', value: 'result' }],
66
+ },
67
+ ],
68
+ edges: [
69
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'plan1', port: 'system' } },
70
+ { src: { node: 'graphInput1', port: 'value' }, dst: { node: 'plan1', port: 'prompt' } },
71
+ { src: { node: 'plan1', port: 'content' }, dst: { node: 'code1', port: 'prompt' } },
72
+ { src: { node: 'string2', port: 'value' }, dst: { node: 'code1', port: 'repo' } },
73
+ { src: { node: 'string3', port: 'value' }, dst: { node: 'code1', port: 'base_branch' } },
74
+ { src: { node: 'code1', port: 'pull_request_url' }, dst: { node: 'object1', port: 'pullRequest' } },
75
+ { src: { node: 'code1', port: 'branch' }, dst: { node: 'object1', port: 'branch' } },
76
+ { src: { node: 'code1', port: 'summary' }, dst: { node: 'object1', port: 'summary' } },
77
+ { src: { node: 'code1', port: 'thread_id' }, dst: { node: 'object1', port: 'thread' } },
78
+ { src: { node: 'object1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
79
+ ],
80
+ inputs: [{ name: 'request', type: 'string' }],
81
+ outputs: [{ name: 'result', type: 'json' }],
82
+ },
83
+ };
@@ -0,0 +1,18 @@
1
+ import type { ExampleFlow } from '../types';
2
+ /**
3
+ * A resumable coding session as one node.
4
+ *
5
+ * The sibling of `coding-agent`, kept beside it rather than replacing it: both
6
+ * dispatch `agent:code_task`, and what differs is the harness the node asks for.
7
+ * That graph leaves it to the deployment's default; this one names `pi`, where the
8
+ * `agent_run` row is the session and the Job is one attached compute lifetime —
9
+ * the working tree comes back from git and the transcript from the append-only run
10
+ * log, so the same run can be picked up again by a later execution.
11
+ *
12
+ * `park` is what makes that visible from the graph: with it set, the node finishes
13
+ * by leaving the run `idle` — branch and commit recorded, no compute attached —
14
+ * and the next dispatch of the same run continues the session instead of starting
15
+ * a new one. The graph asks for no repository, because a database has one named
16
+ * after its id the way it has its own storage bucket.
17
+ */
18
+ export declare const codingSession: ExampleFlow;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.codingSession = void 0;
4
+ /**
5
+ * A resumable coding session as one node.
6
+ *
7
+ * The sibling of `coding-agent`, kept beside it rather than replacing it: both
8
+ * dispatch `agent:code_task`, and what differs is the harness the node asks for.
9
+ * That graph leaves it to the deployment's default; this one names `pi`, where the
10
+ * `agent_run` row is the session and the Job is one attached compute lifetime —
11
+ * the working tree comes back from git and the transcript from the append-only run
12
+ * log, so the same run can be picked up again by a later execution.
13
+ *
14
+ * `park` is what makes that visible from the graph: with it set, the node finishes
15
+ * by leaving the run `idle` — branch and commit recorded, no compute attached —
16
+ * and the next dispatch of the same run continues the session instead of starting
17
+ * a new one. The graph asks for no repository, because a database has one named
18
+ * after its id the way it has its own storage bucket.
19
+ */
20
+ exports.codingSession = {
21
+ id: 'coding-session',
22
+ name: 'Coding session (resumable run)',
23
+ description: 'Run a durable coding session in a disposable Job: git carries the workspace, the run log carries the transcript.',
24
+ runtime: 'server',
25
+ requiresFunctions: ['agent:code_task'],
26
+ graph: {
27
+ name: 'coding-session',
28
+ nodes: [
29
+ {
30
+ name: 'graphInput1',
31
+ type: 'graphInput',
32
+ meta: { x: 80, y: 200 },
33
+ props: [{ name: 'portName', type: 'string', value: 'request' }],
34
+ },
35
+ {
36
+ name: 'boolean1',
37
+ type: 'const:boolean',
38
+ meta: { x: 80, y: 340 },
39
+ props: [{ name: 'value', type: 'boolean', value: true }],
40
+ },
41
+ // The harness is a value on an edge for the same reason the prompt is: which
42
+ // kernel ran the session is legible from the graph rather than buried in a
43
+ // Job's environment.
44
+ {
45
+ name: 'string1',
46
+ type: 'const:string',
47
+ meta: { x: 80, y: 480 },
48
+ props: [{ name: 'value', type: 'string', value: 'pi' }],
49
+ },
50
+ { name: 'session1', type: 'agent:code_task', meta: { x: 470, y: 240 } },
51
+ { name: 'object1', type: 'json:object', meta: { x: 880, y: 240 } },
52
+ {
53
+ name: 'graphOutput1',
54
+ type: 'graphOutput',
55
+ meta: { x: 1200, y: 240 },
56
+ props: [{ name: 'portName', type: 'string', value: 'result' }],
57
+ },
58
+ ],
59
+ edges: [
60
+ { src: { node: 'graphInput1', port: 'value' }, dst: { node: 'session1', port: 'prompt' } },
61
+ { src: { node: 'boolean1', port: 'value' }, dst: { node: 'session1', port: 'park' } },
62
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'session1', port: 'harness' } },
63
+ { src: { node: 'session1', port: 'run_id' }, dst: { node: 'object1', port: 'run' } },
64
+ { src: { node: 'session1', port: 'branch' }, dst: { node: 'object1', port: 'branch' } },
65
+ { src: { node: 'session1', port: 'commit' }, dst: { node: 'object1', port: 'commit' } },
66
+ { src: { node: 'session1', port: 'resumed' }, dst: { node: 'object1', port: 'resumed' } },
67
+ { src: { node: 'session1', port: 'summary' }, dst: { node: 'object1', port: 'summary' } },
68
+ { src: { node: 'object1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
69
+ ],
70
+ inputs: [{ name: 'request', type: 'string' }],
71
+ outputs: [{ name: 'result', type: 'json' }],
72
+ },
73
+ };
@@ -0,0 +1,12 @@
1
+ import type { ExampleFlow } from '../types';
2
+ /**
3
+ * Two `email:send` calls — one at the top level, one inside a subnet whose
4
+ * inputs are wired from the outer constants. The subnet, the boundary nodes and
5
+ * the result edge back out of it make this the graph that exercises the editor's
6
+ * nesting and the worker's subnet expansion, which is why the platform-UI e2e
7
+ * suite runs this shape against Mailpit.
8
+ *
9
+ * Addresses are placeholders: point them at a mailbox you can read before
10
+ * running it on a server.
11
+ */
12
+ export declare const emailSend: ExampleFlow;
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emailSend = void 0;
4
+ /**
5
+ * Two `email:send` calls — one at the top level, one inside a subnet whose
6
+ * inputs are wired from the outer constants. The subnet, the boundary nodes and
7
+ * the result edge back out of it make this the graph that exercises the editor's
8
+ * nesting and the worker's subnet expansion, which is why the platform-UI e2e
9
+ * suite runs this shape against Mailpit.
10
+ *
11
+ * Addresses are placeholders: point them at a mailbox you can read before
12
+ * running it on a server.
13
+ */
14
+ exports.emailSend = {
15
+ id: 'email-send',
16
+ name: 'Email send (with subnet)',
17
+ description: 'Two email:send nodes, one nested in a subnet — needs the email feature registered.',
18
+ runtime: 'server',
19
+ requiresFunctions: ['email:send'],
20
+ graph: {
21
+ name: 'email-send',
22
+ nodes: [
23
+ { name: 'send-email1', type: 'email:send', meta: { x: 689, y: 572 } },
24
+ {
25
+ name: 'string1',
26
+ type: 'const:string',
27
+ meta: { x: 106, y: 282 },
28
+ props: [{ name: 'value', type: 'string', value: 'recipient@example.com' }],
29
+ },
30
+ {
31
+ name: 'string2',
32
+ type: 'const:string',
33
+ meta: { x: 108, y: 392 },
34
+ props: [{ name: 'value', type: 'string', value: 'top-level send' }],
35
+ },
36
+ {
37
+ name: 'string3',
38
+ type: 'const:string',
39
+ meta: { x: 100, y: 483 },
40
+ props: [{ name: 'value', type: 'string', value: '<h1>Sent from a flow</h1>' }],
41
+ },
42
+ {
43
+ name: 'string4',
44
+ type: 'const:string',
45
+ meta: { x: 97, y: 570 },
46
+ props: [{ name: 'value', type: 'string', value: 'Sent from a flow' }],
47
+ },
48
+ {
49
+ name: 'string5',
50
+ type: 'const:string',
51
+ meta: { x: 104, y: 669 },
52
+ props: [{ name: 'value', type: 'string', value: 'sender@example.com' }],
53
+ },
54
+ {
55
+ name: 'string6',
56
+ type: 'const:string',
57
+ meta: { x: 113, y: 775 },
58
+ props: [{ name: 'value', type: 'string', value: 'noreply@example.com' }],
59
+ },
60
+ { name: 'graphOutput1', type: 'graphOutput', meta: { x: 1377, y: 126 } },
61
+ {
62
+ name: 'subnet1',
63
+ type: 'subnet',
64
+ meta: { x: 1054, y: 274 },
65
+ props: [],
66
+ inputs: [
67
+ { name: 'input1', type: 'any' },
68
+ { name: 'input2', type: 'any' },
69
+ { name: 'input3', type: 'any' },
70
+ { name: 'mine', type: 'any' },
71
+ ],
72
+ outputs: [
73
+ { name: 'graphOutput1', type: 'any' },
74
+ { name: 'output1', type: 'any' },
75
+ ],
76
+ nodes: [
77
+ {
78
+ name: 'input_1',
79
+ type: 'graphInput',
80
+ meta: { x: 30, y: 21 },
81
+ props: [{ name: 'portName', type: 'string', value: 'input1' }],
82
+ },
83
+ {
84
+ name: 'input_2',
85
+ type: 'graphInput',
86
+ meta: { x: 22, y: 221 },
87
+ props: [{ name: 'portName', type: 'string', value: 'input2' }],
88
+ },
89
+ {
90
+ name: 'input_3',
91
+ type: 'graphInput',
92
+ meta: { x: 59, y: 340 },
93
+ props: [{ name: 'portName', type: 'string', value: 'input3' }],
94
+ },
95
+ {
96
+ name: 'string7',
97
+ type: 'const:string',
98
+ meta: { x: 335, y: 103 },
99
+ props: [{ name: 'value', type: 'string', value: 'subnet send' }],
100
+ },
101
+ { name: 'send-email2', type: 'email:send', meta: { x: 650, y: 50 } },
102
+ {
103
+ name: 'output_1',
104
+ type: 'graphOutput',
105
+ meta: { x: 950, y: 50 },
106
+ props: [{ name: 'portName', type: 'string', value: 'output1' }],
107
+ },
108
+ {
109
+ name: 'graphInput1',
110
+ type: 'graphInput',
111
+ meta: { x: 47, y: 468 },
112
+ props: [{ name: 'portName', type: 'string', value: 'mine' }],
113
+ },
114
+ { name: 'graphOutput1', type: 'graphOutput', meta: { x: 586, y: 517 } },
115
+ ],
116
+ edges: [
117
+ { src: { node: 'string7', port: 'value' }, dst: { node: 'send-email2', port: 'subject' } },
118
+ { src: { node: 'string7', port: 'value' }, dst: { node: 'send-email2', port: 'html' } },
119
+ { src: { node: 'input_1', port: 'value' }, dst: { node: 'send-email2', port: 'to' } },
120
+ { src: { node: 'input_2', port: 'value' }, dst: { node: 'send-email2', port: 'from' } },
121
+ { src: { node: 'input_3', port: 'value' }, dst: { node: 'send-email2', port: 'replyTo' } },
122
+ { src: { node: 'send-email2', port: 'result' }, dst: { node: 'output_1', port: 'value' } },
123
+ { src: { node: 'graphInput1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
124
+ ],
125
+ },
126
+ ],
127
+ edges: [
128
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'send-email1', port: 'to' } },
129
+ { src: { node: 'string2', port: 'value' }, dst: { node: 'send-email1', port: 'subject' } },
130
+ { src: { node: 'string3', port: 'value' }, dst: { node: 'send-email1', port: 'html' } },
131
+ { src: { node: 'string4', port: 'value' }, dst: { node: 'send-email1', port: 'text' } },
132
+ { src: { node: 'string5', port: 'value' }, dst: { node: 'send-email1', port: 'from' } },
133
+ { src: { node: 'string6', port: 'value' }, dst: { node: 'send-email1', port: 'replyTo' } },
134
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'subnet1', port: 'input1' } },
135
+ { src: { node: 'string5', port: 'value' }, dst: { node: 'subnet1', port: 'input2' } },
136
+ { src: { node: 'string6', port: 'value' }, dst: { node: 'subnet1', port: 'input3' } },
137
+ { src: { node: 'send-email1', port: 'result' }, dst: { node: 'subnet1', port: 'mine' } },
138
+ { src: { node: 'subnet1', port: 'output1' }, dst: { node: 'graphOutput1', port: 'value' } },
139
+ ],
140
+ props: [],
141
+ inputs: [],
142
+ outputs: [{ name: 'graphOutput1', type: 'any' }],
143
+ },
144
+ };
@@ -0,0 +1,22 @@
1
+ import type { ExampleFlow } from '../types';
2
+ /**
3
+ * Fan-out as a graph: a list of checks → the failures → one keyed shard each.
4
+ *
5
+ * `flow:filter` narrows the collection by the same declared predicate a branch
6
+ * uses, applied to a field of each row (`conclusion eq failure`), and
7
+ * `flow:for_each` turns what survived into an ordered plan — one
8
+ * `{ index, total, item, key }` descriptor per failure, keyed by the check's
9
+ * name so a re-run addresses the same shard rather than a position in a list
10
+ * that may have moved.
11
+ *
12
+ * The point of the wiring is which node does *not* run: `flow:filter` emits
13
+ * `items` only when something survived and `empty` only when nothing did, so on
14
+ * an all-green batch the fan-out arm never becomes runnable and the graph
15
+ * reconverges through `flow:merge` on the `empty` arm instead. A graph that
16
+ * emitted an empty collection would have run the whole downstream arm to
17
+ * discover there was nothing in it.
18
+ *
19
+ * Every node here is inline, so the editor's local preview runs the whole thing
20
+ * with no platform.
21
+ */
22
+ export declare const failedCheckFanout: ExampleFlow;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.failedCheckFanout = void 0;
4
+ /**
5
+ * Fan-out as a graph: a list of checks → the failures → one keyed shard each.
6
+ *
7
+ * `flow:filter` narrows the collection by the same declared predicate a branch
8
+ * uses, applied to a field of each row (`conclusion eq failure`), and
9
+ * `flow:for_each` turns what survived into an ordered plan — one
10
+ * `{ index, total, item, key }` descriptor per failure, keyed by the check's
11
+ * name so a re-run addresses the same shard rather than a position in a list
12
+ * that may have moved.
13
+ *
14
+ * The point of the wiring is which node does *not* run: `flow:filter` emits
15
+ * `items` only when something survived and `empty` only when nothing did, so on
16
+ * an all-green batch the fan-out arm never becomes runnable and the graph
17
+ * reconverges through `flow:merge` on the `empty` arm instead. A graph that
18
+ * emitted an empty collection would have run the whole downstream arm to
19
+ * discover there was nothing in it.
20
+ *
21
+ * Every node here is inline, so the editor's local preview runs the whole thing
22
+ * with no platform.
23
+ */
24
+ exports.failedCheckFanout = {
25
+ id: 'failed-check-fanout',
26
+ name: 'Fan out over failed checks (filter → for_each)',
27
+ description: 'Narrow a batch of checks to the failures and plan one keyed shard each — and take the empty path when every check passed.',
28
+ runtime: 'local',
29
+ requiresFunctions: [],
30
+ graph: {
31
+ name: 'failed-check-fanout',
32
+ nodes: [
33
+ {
34
+ name: 'graphInput1',
35
+ type: 'graphInput',
36
+ meta: { x: 80, y: 200 },
37
+ props: [{ name: 'portName', type: 'string', value: 'checks' }],
38
+ },
39
+ {
40
+ name: 'filter1',
41
+ type: 'flow:filter',
42
+ meta: { x: 440, y: 200 },
43
+ props: [
44
+ { name: 'path', type: 'string', value: 'conclusion' },
45
+ { name: 'operator', type: 'string', value: 'eq' },
46
+ { name: 'expected', type: 'string', value: 'failure' },
47
+ ],
48
+ },
49
+ {
50
+ name: 'foreach1',
51
+ type: 'flow:for_each',
52
+ meta: { x: 800, y: 100 },
53
+ props: [{ name: 'key', type: 'string', value: 'name' }],
54
+ },
55
+ { name: 'merge1', type: 'flow:merge', meta: { x: 1160, y: 220 } },
56
+ { name: 'object1', type: 'json:object', meta: { x: 1500, y: 220 } },
57
+ {
58
+ name: 'graphOutput1',
59
+ type: 'graphOutput',
60
+ meta: { x: 1840, y: 220 },
61
+ props: [{ name: 'portName', type: 'string', value: 'plan' }],
62
+ },
63
+ ],
64
+ edges: [
65
+ { src: { node: 'graphInput1', port: 'value' }, dst: { node: 'filter1', port: 'items' } },
66
+ // Something failed: plan a shard per failure, and that plan is the result.
67
+ { src: { node: 'filter1', port: 'items' }, dst: { node: 'foreach1', port: 'items' } },
68
+ { src: { node: 'foreach1', port: 'shards' }, dst: { node: 'merge1', port: 'a' } },
69
+ // Everything passed: the fan-out arm never runs, and `empty` carries the graph.
70
+ { src: { node: 'filter1', port: 'empty' }, dst: { node: 'merge1', port: 'b' } },
71
+ // One output either way, with the counts alongside it.
72
+ { src: { node: 'merge1', port: 'value' }, dst: { node: 'object1', port: 'shards' } },
73
+ { src: { node: 'merge1', port: 'source' }, dst: { node: 'object1', port: 'arm' } },
74
+ { src: { node: 'filter1', port: 'kept_count' }, dst: { node: 'object1', port: 'failed' } },
75
+ { src: { node: 'filter1', port: 'dropped_count' }, dst: { node: 'object1', port: 'passed' } },
76
+ { src: { node: 'object1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
77
+ ],
78
+ inputs: [{ name: 'checks', type: 'json' }],
79
+ outputs: [{ name: 'plan', type: 'json' }],
80
+ },
81
+ };
@@ -0,0 +1,10 @@
1
+ import type { ExampleFlow } from '../types';
2
+ /**
3
+ * The smallest graph that produces a value: two constants into a template,
4
+ * the template into the graph's output. Every node is inline, so it evaluates
5
+ * in the browser — the example to reach for when checking that the editor,
6
+ * the evaluator and the output selector are wired to each other at all.
7
+ */
8
+ export declare const helloString: ExampleFlow;
9
+ /** What `graphOutput1.value` holds once the graph is evaluated. */
10
+ export declare const helloStringExpectedOutput = "hello Constructive, welcome to flows";
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.helloStringExpectedOutput = exports.helloString = void 0;
4
+ /**
5
+ * The smallest graph that produces a value: two constants into a template,
6
+ * the template into the graph's output. Every node is inline, so it evaluates
7
+ * in the browser — the example to reach for when checking that the editor,
8
+ * the evaluator and the output selector are wired to each other at all.
9
+ */
10
+ exports.helloString = {
11
+ id: 'hello-string',
12
+ name: 'Hello (string template)',
13
+ description: 'Two constants into a string template — runs entirely in the local preview.',
14
+ runtime: 'local',
15
+ requiresFunctions: [],
16
+ graph: {
17
+ name: 'hello-string',
18
+ nodes: [
19
+ {
20
+ name: 'string1',
21
+ type: 'const:string',
22
+ meta: { x: 80, y: 120 },
23
+ props: [{ name: 'value', type: 'string', value: 'Constructive' }],
24
+ },
25
+ {
26
+ name: 'string2',
27
+ type: 'const:string',
28
+ meta: { x: 80, y: 260 },
29
+ props: [{ name: 'value', type: 'string', value: 'flows' }],
30
+ },
31
+ {
32
+ name: 'template1',
33
+ type: 'string:template',
34
+ meta: { x: 400, y: 180 },
35
+ props: [{ name: 'template', type: 'string', value: 'hello {{who}}, welcome to {{what}}' }],
36
+ },
37
+ {
38
+ name: 'graphOutput1',
39
+ type: 'graphOutput',
40
+ meta: { x: 720, y: 180 },
41
+ props: [{ name: 'portName', type: 'string', value: 'greeting' }],
42
+ },
43
+ ],
44
+ edges: [
45
+ { src: { node: 'string1', port: 'value' }, dst: { node: 'template1', port: 'who' } },
46
+ { src: { node: 'string2', port: 'value' }, dst: { node: 'template1', port: 'what' } },
47
+ { src: { node: 'template1', port: 'value' }, dst: { node: 'graphOutput1', port: 'value' } },
48
+ ],
49
+ outputs: [{ name: 'greeting', type: 'string' }],
50
+ },
51
+ };
52
+ /** What `graphOutput1.value` holds once the graph is evaluated. */
53
+ exports.helloStringExpectedOutput = 'hello Constructive, welcome to flows';
@@ -0,0 +1,9 @@
1
+ import type { ExampleFlow } from '../types';
2
+ /**
3
+ * (2 + 3) * 4 — a two-stage inline pipeline. Small enough to assert on
4
+ * exactly, so it is the graph a suite uses to prove that loading an example
5
+ * and evaluating it end to end produces the one right number.
6
+ */
7
+ export declare const mathPipeline: ExampleFlow;
8
+ /** What `graphOutput1.value` holds once the graph is evaluated. */
9
+ export declare const mathPipelineExpectedOutput = 20;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mathPipelineExpectedOutput = exports.mathPipeline = void 0;
4
+ /**
5
+ * (2 + 3) * 4 — a two-stage inline pipeline. Small enough to assert on
6
+ * exactly, so it is the graph a suite uses to prove that loading an example
7
+ * and evaluating it end to end produces the one right number.
8
+ */
9
+ exports.mathPipeline = {
10
+ id: 'math-pipeline',
11
+ name: 'Math pipeline (2 + 3) × 4',
12
+ description: 'Add then multiply with inline math nodes — runs entirely in the local preview.',
13
+ runtime: 'local',
14
+ requiresFunctions: [],
15
+ graph: {
16
+ name: 'math-pipeline',
17
+ nodes: [
18
+ {
19
+ name: 'number1',
20
+ type: 'const:number',
21
+ meta: { x: 80, y: 100 },
22
+ props: [{ name: 'value', type: 'number', value: 2 }],
23
+ },
24
+ {
25
+ name: 'number2',
26
+ type: 'const:number',
27
+ meta: { x: 80, y: 240 },
28
+ props: [{ name: 'value', type: 'number', value: 3 }],
29
+ },
30
+ {
31
+ name: 'number3',
32
+ type: 'const:number',
33
+ meta: { x: 80, y: 380 },
34
+ props: [{ name: 'value', type: 'number', value: 4 }],
35
+ },
36
+ { name: 'add1', type: 'math:add', meta: { x: 400, y: 160 } },
37
+ { name: 'multiply1', type: 'math:multiply', meta: { x: 700, y: 260 } },
38
+ {
39
+ name: 'graphOutput1',
40
+ type: 'graphOutput',
41
+ meta: { x: 1000, y: 260 },
42
+ props: [{ name: 'portName', type: 'string', value: 'total' }],
43
+ },
44
+ ],
45
+ edges: [
46
+ { src: { node: 'number1', port: 'value' }, dst: { node: 'add1', port: 'a' } },
47
+ { src: { node: 'number2', port: 'value' }, dst: { node: 'add1', port: 'b' } },
48
+ { src: { node: 'add1', port: 'sum' }, dst: { node: 'multiply1', port: 'a' } },
49
+ { src: { node: 'number3', port: 'value' }, dst: { node: 'multiply1', port: 'b' } },
50
+ { src: { node: 'multiply1', port: 'product' }, dst: { node: 'graphOutput1', port: 'value' } },
51
+ ],
52
+ outputs: [{ name: 'total', type: 'number' }],
53
+ },
54
+ };
55
+ /** What `graphOutput1.value` holds once the graph is evaluated. */
56
+ exports.mathPipelineExpectedOutput = 20;
package/index.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type { ExampleFlow } from './types';
2
+ export { agentReviewLoop } from './graphs/agent-review-loop';
3
+ export { agenticEmbed } from './graphs/agentic-embed';
4
+ export { agenticKit } from './graphs/agentic-kit';
5
+ export { codingAgent } from './graphs/coding-agent';
6
+ export { codingSession } from './graphs/coding-session';
7
+ export { emailSend } from './graphs/email-send';
8
+ export { failedCheckFanout } from './graphs/failed-check-fanout';
9
+ export { helloString, helloStringExpectedOutput } from './graphs/hello-string';
10
+ export { mathPipeline, mathPipelineExpectedOutput } from './graphs/math-pipeline';
11
+ export type { ExampleFlow, ExampleRuntime } from './types';
12
+ /**
13
+ * Every example flow, in the order the Flows panel offers them: the two that
14
+ * run with no platform first, then the ones that address registered functions.
15
+ */
16
+ export declare const exampleFlows: ExampleFlow[];
17
+ /** The example with this id, or undefined. */
18
+ export declare const findExampleFlow: (id: string) => ExampleFlow | undefined;
19
+ /**
20
+ * The example with this id. Throws when it does not exist: a caller naming an
21
+ * example by id has a graph in mind, and silently handing back an empty one
22
+ * turns a typo into a green run over nothing.
23
+ */
24
+ export declare const getExampleFlow: (id: string) => ExampleFlow;