-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathllms-full.txt
More file actions
4020 lines (3273 loc) · 217 KB
/
Copy pathllms-full.txt
File metadata and controls
4020 lines (3273 loc) · 217 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# AbstractFlow Full LLM Context
This file is generated from the root documentation set with `npm run docs:llms`.
## README.md
# AbstractFlow
AbstractFlow is the visual workflow editor for AbstractFramework.
It is a web package (`@abstractframework/flow`). It runs a browser editor and a small Node server that serves the built UI and proxies `/api/*` to AbstractGateway. AbstractGateway owns users, sessions, runtime routing, provider configuration, workflow storage, run execution, ledgers, artifacts, and media catalogs.
## Install
```bash
npx @abstractframework/flow --gateway-url http://127.0.0.1:8080
```
For a local checkout:
```bash
npm install
npm run dev -- --host 0.0.0.0 --port 3003
```
Open http://localhost:3003 and sign in with the Gateway user and token created by AbstractGateway.
Leave provider/model selectors on `Auto (Gateway default)` for portable
workflows. Gateway/Core capability defaults choose the actual provider/model at
run time for the current user/runtime.
Text model selectors use Gateway's Core-backed `capability_route` discovery
filters, so normal LLM pickers request `output.text` models. The Models Catalog
node can store a route such as `input.image,output.text` to discover provider
models for a specific input/output shape while the workflow runs.
LLM Call and Agent nodes include a Reasoning control backed by Core's
`thinking` option. Leave it on Auto to inherit the Gateway/runtime default, or
set/pin values such as `off`, `low`, `medium`, `high`, or `xhigh` for reasoning
models that support explicit effort controls.
LLM Call and Agent response schemas can be defined directly on the unconnected
`resp_schema` pin. The Builder tab creates ordinary JSON Schema, including
Choice fields saved as `enum` values. Connected schema inputs override the
inline default, and published workflows keep the schema in
`data.pinDefaults.resp_schema` for Gateway/Runtime execution. When a response
schema is configured, `response` remains the text output and a structured
`data` object output is shown for Break Object, Switch, and other object-aware
nodes.
Media artifact inputs can be wired from another node or uploaded directly on
the node when the artifact pin is unconnected. Uploaded browser files are stored
as Gateway artifacts. Image generation, editing, restoration/upscaling, video,
voice, music, and transcription nodes all execute through Gateway-advertised
capabilities. During `Listen Voice` waits, Flow records in the browser,
uploads the captured audio artifact, and resumes the Gateway run; Flow does not
execute local audio or transcription logic itself.
Vision media nodes now surface Gateway/Core's richer route contract directly in
authoring:
- task-scoped provider/model discovery for `text_to_image`, `image_to_image`,
`text_to_video`, and `image_to_video`
- batch generation controls with `count` and explicit ordered `seeds`
- ordered `lora_adapters` stacks for compatible image/video models
- plural media outputs such as `image_artifacts` and `video_artifacts` when a
route returns more than one artifact in one call
The editor keeps those controls in the right-side Properties drawer and only
surfaces them on nodes whose Gateway contract advertises the corresponding
support.
File and document workflows can use `Write File` for Markdown/JSON/text paths,
`Read File` for UTF-8/JSON inputs, `Read PDF` for extracting PDF text/metadata,
and `Write PDF` for rendering report content to a real PDF path through
Runtime.
The toolbar star opens the Workflow Authoring Assistant in the right drawer.
The assistant reads `docs/workflow-authoring-skill.md` plus a compact generated
node catalog, uses Gateway's default `output.text` model by starting normal
Gateway planner runs unless a model is pinned, and reads planner responses from
run ledgers. The model authors the complete workflow as one JSON document; the
editor diffs it against the draft canvas and applies only validated edits. It can
create or refine common workflows such as internet research, deep research, news
digests, and job searches; Save, Publish, and Run remain explicit user actions.
## Gateway Setup
```bash
export ABSTRACTGATEWAY_USER_AUTH=1
export ABSTRACTGATEWAY_DATA_DIR="$PWD/runtime/gateway"
abstractgateway serve --host 127.0.0.1 --port 8080
cat "$ABSTRACTGATEWAY_DATA_DIR/auth/bootstrap-admin-token"
```
Use:
- Gateway URL: `http://127.0.0.1:8080`
- User: `admin`
- Token: the `agw_...` token printed by Gateway or stored in `auth/bootstrap-admin-token`
## What Lives Here
- `src/` - React/Vite visual editor.
- `bin/cli.js` - npm CLI/static server and Gateway proxy.
- `examples/flows/` - sample VisualFlow JSON files kept for reference/import tests.
- `docs/` - external documentation for users and contributors.
AbstractFlow does not ship a Python package or local execution host. VisualFlow compilation, bundle execution, runtime state, and provider calls are handled by AbstractGateway and AbstractRuntime.
## Scripts
```bash
npm run dev
npm run build
npm run lint
npm run docs:llms
```
## Documentation
- [Getting started](docs/getting-started.md)
- [Web editor](docs/web-editor.md)
- [Architecture](docs/architecture.md)
- [API and contracts](docs/api.md)
- [VisualFlow JSON](docs/visualflow.md)
- [CLI](docs/cli.md)
- [FAQ](docs/faq.md)
## Related Projects
- AbstractFramework: https://github.com/lpalbou/AbstractFramework
- AbstractGateway: https://github.com/lpalbou/AbstractGateway
- AbstractRuntime: https://github.com/lpalbou/AbstractRuntime
- AbstractCore: https://github.com/lpalbou/AbstractCore
## Policies
- Changelog: [CHANGELOG.md](CHANGELOG.md)
- Contributing: [CONTRIBUTING.md](CONTRIBUTING.md)
- Security: [SECURITY.md](SECURITY.md)
- License: [LICENSE](LICENSE)
## docs/README.md
# AbstractFlow Documentation
AbstractFlow is the AbstractFramework visual workflow editor. It is distributed as the npm package `@abstractframework/flow`.
Normal operation:
1. AbstractGateway runs on a server or local machine.
2. AbstractFlow serves the browser editor.
3. The browser signs in with a Gateway user token.
4. Flow proxies authoring, discovery, run, ledger, and artifact calls to Gateway.
AbstractFlow does not own runtime execution or provider secrets. Gateway and Runtime do.
Flow can author runtime-facing pin defaults, including inline JSON Schema
response schemas for LLM Call and Agent nodes. Those schemas are saved in
VisualFlow JSON and enforced later by Runtime/Core after Gateway publish/start.
When a schema is active, `data` is the structured object output and `response`
stays textual for compatibility.
## File-like sources
Flow now teaches one explicit file-like vocabulary across the editor, run modal,
and authoring docs:
- `Artifact`: a saved Runtime-owned durable payload.
- `Local File` / `Local Folder`: client-device intake sources. In hosted/browser
mode, uploads become artifacts before durable execution.
- `Server File` / `Server Folder`: user-facing wording for workspace-scoped
server paths under Gateway policy. The engineering/model term remains
`Workspace File` / `Workspace Folder`.
The canvas reflects that split:
- path-based nodes such as `Read File`, `Write File`, `Read PDF`, `Write PDF`,
and `List Folder Files` consume workspace-scoped server paths;
- artifact-first nodes such as `Artifact`, `Import Server File`, `Read
Artifact`, and `Export Artifact` work with durable runtime-owned payloads.
## Pages
- [Getting started](getting-started.md)
- [Web editor](web-editor.md)
- [Workflow authoring skill](workflow-authoring-skill.md)
- [Workflow node catalog](workflow-node-catalog.md)
- [Architecture](architecture.md)
- [API and contracts](api.md)
- [VisualFlow JSON](visualflow.md)
- [CLI](cli.md)
- [FAQ](faq.md)
## Documentation Upkeep
- Keep docs written around the web package layout: `src/`, `bin/`, `examples/flows/`, `docs/`.
- Do not add Python package or local server launch instructions; those surfaces were removed from this repository.
- Regenerate the LLM context after doc changes:
```bash
npm run docs:llms
```
## docs/getting-started.md
# Getting Started
AbstractFlow is a web editor. It needs a reachable AbstractGateway because Gateway owns workflow storage, execution, auth, providers, artifacts, and user/runtime routing.
## 1. Start Gateway
```bash
export ABSTRACTGATEWAY_USER_AUTH=1
export ABSTRACTGATEWAY_DATA_DIR="$PWD/runtime/gateway"
abstractgateway serve --host 127.0.0.1 --port 8080
```
Gateway creates the default admin account on first start. Read the browser-login token:
```bash
cat "$ABSTRACTGATEWAY_DATA_DIR/auth/bootstrap-admin-token"
```
## 2. Start AbstractFlow
```bash
npx @abstractframework/flow --gateway-url http://127.0.0.1:8080
```
Open http://localhost:3003.
Sign in with:
- Gateway URL: `http://127.0.0.1:8080`
- User: `admin`
- Token: the `agw_...` token from Gateway
## 3. Author And Run
Use the canvas to create VisualFlow graphs. The editor sends VisualFlow JSON to Gateway, publishes workflows through Gateway, starts Gateway runs, and renders Gateway ledger/artifact streams.
Provider and model selectors come from Gateway discovery. Configure providers, endpoint profiles, API keys, and default models in the Gateway console.
## Local Development
```bash
git clone https://github.com/lpalbou/AbstractFlow.git
cd AbstractFlow
npm install
npm run dev
```
The Vite dev server proxies `/api/*` to the Gateway URL selected in the connection UI or configured with `ABSTRACTGATEWAY_URL` / `ABSTRACTFLOW_GATEWAY_URL`.
## Build
```bash
npm run build
npm start -- --gateway-url http://127.0.0.1:8080
```
The static server in `bin/cli.js` serves `dist/` and proxies API/SSE calls to Gateway with browser-session auth injection.
## docs/web-editor.md
# Web Editor
AbstractFlow is the browser-based VisualFlow editor.
It talks to AbstractGateway for:
- user sessions and runtime routing
- workflow CRUD and publishing
- provider/model/capability discovery
- run start, commands, ledger replay, and ledger streaming
- artifacts, media previews, and generated output downloads
## Run With A Gateway
```bash
export ABSTRACTGATEWAY_USER_AUTH=1
export ABSTRACTGATEWAY_DATA_DIR="$PWD/runtime/gateway"
abstractgateway serve --host 127.0.0.1 --port 8080
```
```bash
npx @abstractframework/flow --gateway-url http://127.0.0.1:8080
```
Open http://localhost:3003.
## Browser Auth
Each browser signs in with a Gateway user id and that user's token. Flow exchanges the token with Gateway for an opaque browser session and keeps that session in HTTP-only cookies. Raw user tokens are not retained after sign-in.
Server/operator bearer tokens such as `ABSTRACTGATEWAY_AUTH_TOKEN` are not browser sign-in tokens. Use the Gateway user token, normally the bootstrap admin token for a first local install.
Remote browser-supplied Gateway URL changes are blocked by default. A hosted Flow instance should proxy only to its configured Gateway unless the operator explicitly enables `ABSTRACTFLOW_ALLOW_REMOTE_BROWSER_GATEWAY_CONFIG=1` behind their own access control.
## Provider And Model Discovery
Flow does not store API keys or endpoint secrets. It asks Gateway for provider catalogs, endpoint profiles, model lists, capability defaults, and media route descriptors.
Configure these in the Gateway console:
- OpenAI, Anthropic, OpenRouter, Portkey, Ollama, LM Studio
- custom OpenAI-compatible endpoint profiles
- Gateway-level and user-level capability defaults
Flow nodes then select providers and models from Gateway discovery.
Leave provider/model as **Auto (Gateway default)** when a workflow should use
the Gateway/Core capability route configured for the current runtime. This is
the portable default for LLM Call, Agent, and generated media nodes. If you pin
a provider and later want to return to runtime defaults, choose **Auto (Gateway
default)** again from the provider dropdown.
The Model Residency modal shows only provider-reported resident/loaded models.
Configure capability defaults in Gateway Console or with the Gateway/Core
config CLIs; changing a default does not load or unload a model.
## Workflow Authoring Assistant
The star button on the right side of the toolbar opens a conversational
assistant in the right drawer. The drawer shares space with Properties, so users
can switch between assistant guidance and node editing while keeping the canvas
visible.
The assistant uses `docs/workflow-authoring-skill.md` plus a complete generated
node catalog from `src/types/nodes.ts` as its graph-authoring context. This
replaces generic `llms-full.txt` context for workflow construction. By default
it resolves Gateway's configured `output.text` capability route and starts a
short-lived Gateway `basic-agent` planner run through the normal
`/api/gateway/runs/start` path. Users can pin a specific assistant
provider/model from the drawer. The assistant authors the workflow as one
complete JSON document (direct document authoring): each cycle the model emits
the full graph — every node and edge — and the editor diffs that document
against the current draft, compiles the diff into validated graph mutations,
applies them, and continues until the model declares the request satisfied or
is explicitly blocked. Anything the document omits is deleted, so removals are
implicit and the assistant never asks the user to delete nodes manually. The
first cycle aims to one-shot the workflow; later cycles exist to repair
validator errors, readiness issues, and acceptance findings.
Completion is model-owned: readiness checks are a structural floor that can
demand more work, but they never stop the loop while the model returns
`continue`. When the model declares `done` with clean readiness, the editor runs
an acceptance review — a second model pass that compares the draft graph against
the original request and the model's own declared acceptance criteria. Unmet
findings are fed back into the loop as issues; if the review budget is exhausted
the remaining findings are reported with the result instead of being hidden.
The planner run receives a single prompt plus a system prompt with strict JSON
instructions. Its runtime tool list is explicitly empty: authoring edits must
come back as the workflow document JSON, not as Gateway tool calls. Prior user turns
are included inside the current prompt, assistant turns are replayed as trimmed
plan/result summaries (so pending plan items survive across turns), and applied
cycles within a turn carry one-line notes of the model's own next steps. The
visible graph remains the source of applied draft state.
Session policy: one durable Gateway session per workflow conversation. The
session id is scoped to the workflow storage key (never shared across
workflows), follows a draft when it is promoted to a saved flow, and is
rotated by Clear Chat — so gateway-side agent memory restarts together with
the visible conversation. Because the gateway agent replays session memory
into the model context, the prompt anchors a language directive at the request
site and marks replayed conversation as historical, so the active request —
not session history in another language — controls the output language.
Plan responses are parsed tolerantly: the JSON object is extracted even when the
model wraps it in markdown fences or surrounding prose. A planner response that
is still unusable (empty run output, or truncated/invalid plan JSON) does not
abort the turn: the same cycle is retried with a corrective format note (bare
JSON only, shorten free-text fields rather than the graph document), up to
three unusable responses per turn. Each retry is logged in the activity feed.
A `continue` cycle whose document matches the existing graph exactly (no
changes) does not abort the turn either: the model gets a corrective note
(emit a document that addresses the issues, declare done, or ask the user) for
up to two consecutive unchanged cycles, after which the turn ends as "needs
your input" with the model's own reply — never as a hard authoring failure. The system
prompt and skill explicitly tell the model to return `needs_user` with concrete
questions when the request is ambiguous or repair cycles stop making progress;
the user's answer in the next turn resumes with the full draft graph and
conversation context. All user-visible workflow content (flow name, labels,
prompts, replies) must match the language of the user request unless the user
asks otherwise.
While a turn runs, a live status card shows the current phase with the cycle
number in the header, an elapsed timer, and a real-time activity feed (plan
request/response sizes, per-cycle token usage read from the Gateway run-tree
ledgers with cumulative turn totals in the footer, compiled document change
counts, applied changes with labels, document issues, retries, readiness
counts, and acceptance review events). A shimmering in-flight ticker pinned at
the bottom of the feed shows what the assistant is waiting on right now — the
request purpose ("authoring the full workflow document", "repairing 2
validation issues", "acceptance review") — with a per-stage elapsed counter
that ticks every second.
Feed entries are grouped under per-cycle divider rows so iteration boundaries
are scannable at a glance. The header carries a leading chevron with a hover
state (collapse toggle) and a copy button that exports the whole activity feed
— grouped by cycle, with elapsed timestamps — to the clipboard. The card
persists after the turn ends with its final state (green dot for "Draft graph
updated", red dot for "Authoring failed" or "Interrupted by user") so the
cycle history can be reviewed post-turn. A Stop control — in the status card
and in place of Send while busy — interrupts the autonomous loop between calls
and best-effort cancels the in-flight Gateway planner run; applied edits stay
in the draft and remain undoable via Undo Turn.
Conversation actions are compact icon buttons on the input row (copy
conversation, clear conversation, undo last turn) next to the Send/Stop button;
the estimated context usage appears above the model row while a request is
typed or running. AbstractFlow does not truncate the assistant conversation,
selected docs sections, or graph summary to fit a local limit, and it does not
hardcode model context windows. The drawer conversation and draft text are
persisted locally so closing and reopening the Assistant rail does not erase
the ongoing authoring discussion. Clear resets the local assistant
conversation, rotates the workflow's durable Gateway session, and clears the
persisted status card without changing the current graph. If the Gateway run, model call, structured
response, or ledger read fails after the retry budget, the drawer reports that
failure directly.
Assistant output is treated as an untrusted edit proposal. The emitted
document is compiled by a diff against the current graph into the editor's
internal validated command set (node creation/deletion, safe dynamic pins,
pin defaults, literals, Code node bodies, labels, concat separators, and
validated connections), so every existing validator and security guard stays
the single source of truth for graph mutation. The reducer rejects unknown
node types, invalid edges, secret-looking values, Code `full_access`, and Tool
Calls nodes without an explicit `allowed_tools` allowlist. Node deletions are
allowed as part of document ownership and remain recoverable with Undo Turn;
secrets are serialized to the model as `<redacted>` and the diff never writes
that sentinel back. `pin_defaults` merge per key, node ids are stable
identities (a type change requires a new id), existing node positions are
never moved, and new nodes without explicit positions get execution-depth
auto-layout.
Compiled changes are applied per-command in dependency order (nodes first, then
configuration, then connections, with disconnects before connects). Valid
changes are kept even when others fail; the failures are reported back to the
planner as document-issue feedback for the next cycle. The validator also
performs deterministic repairs that a human author would make: connecting an
already-connected execution output is rewired through an auto-inserted (or
extended) Sequence node, and loop-back edges from a loop body to the loop's
`exec-in` are dropped with a warning because AbstractRuntime control frames
return to the loop automatically when the body chain ends. Rejection messages
list the node's real pins so a wrong handle guess can be corrected on the next
cycle, and Variable nodes are configurable through the same document fields
used elsewhere (`pin_defaults` on `name`/`value`, or `literal` with the
declaration config). Unlabeled nodes are flagged as non-blocking notes so
generated graphs stay readable.
Research-oriented readiness checks require an authored Agent system prompt,
explicit tool configuration when web tools are needed, prompt-building nodes,
sources/citations that are not `Agent.meta`, an audit trace, and final outputs.
`Agent Trace Report` is accepted only for audit output, not as a report source.
These checks apply only when the request's deliverable is researched content
(deep research, internet/web research, news, digests, job search, or "research"
coupled to a workflow/report deliverable in the same sentence); an incidental
mention of "research" — such as "discussion, research, and deepening of ideas"
— does not force the research scaffold onto an unrelated workflow.
When a request asks for Markdown/PDF artifacts, the assistant must create
an executable `Write File` node for Markdown and an executable `Write PDF` node
for PDF. `Write PDF` renders report text or Markdown-style content to real PDF
bytes in Runtime and exposes the resulting path through `On Flow End`. Generic
`Write File` and sandbox Code are not treated as PDF generation.
Tool-dependent requests use Gateway's advertised tool inventory and exact tool
names. If Gateway defaults, advertised discovery endpoints, the planner run,
strict JSON parsing, or document validation fail, the assistant reports the error
instead of synthesizing a substitute plan. Completed cycle edits remain visible in
the draft; the failed cycle is not applied, and Undo Turn restores the pre-turn
snapshot.
Each assistant turn ends with how the draft works, how to test it, and what to
expect. The assistant changes the in-memory draft only. Users still review the
graph, Save, Publish, and Run through the normal Gateway-backed controls.
## Execution View
The toolbar's execution-view toggle (node-to-node arrow icon) condenses the
canvas to the control-flow skeleton. Only nodes linked by execution edges
remain visible, along with those edges; data-only nodes (literals, concat,
parsers) and data edges are hidden. Node positions are unchanged, so the
layout matches the full view when switching back and forth.
Each condensed node reuses the full-view node header — the same header color,
uppercase title, and sheen — so a node is instantly recognizable across both
modes. A family icon and silhouette add a second cue: events (pill), control
flow such as Sequence or If/Else (sharp corners, with named branch rows in the
dark node body), user interaction (speech-bubble corner), generative AI and
generated media (rounded), tools & files, memory, subflow (double border), and
logic/state. Runtime highlights (executing/recent) still apply in this view.
The execution view is a reading mode: dropping new palette nodes is blocked
with a hint, while moving nodes and rewiring execution pins remain available.
## Structured Output Schemas
LLM Call and Agent nodes expose `resp_schema` as an optional JSON Schema input.
When that input is not connected, the node shows an inline schema editor. The
Builder tab is for object fields, required/optional fields, descriptions, and
Choice fields. Choice fields are saved as standard JSON Schema string enums.
The JSON Schema tab accepts advanced object schemas directly, including `$ref`
schemas that Runtime can resolve. Switching back to Builder preserves supported
top-level fields and Choice values.
Connected schema inputs always override the inline default. When a workflow is
published, Gateway stores and packs the VisualFlow JSON unchanged; Runtime then
applies unconnected `pinDefaults.resp_schema` values and Core enforces the
structured output schema.
For branch routing, define a Choice field such as `choice`, wire the
LLM/Agent `data` output into Break Object, expose `choice`, and connect it to a
Switch node. `response` remains available as text for display and compatibility.
The Switch panel can sync explicit cases from the discovered enum values, so the
published workflow contains stable `switchConfig.cases`.
## Media Nodes
Flow exposes media nodes only when Gateway advertises the corresponding capability:
- Generate Image
- Edit Image / Image-to-Image
- Restore / Upscale Image
- Generate Video
- Image-to-Video
- Generate Voice
- Generate Music
- Transcribe Audio
- Listen Voice
Generated outputs are Gateway artifacts. The run modal renders image/video/audio previews and keeps the artifact content link available for open/download. When Gateway returns a media child run, Flow streams the child-run ledger and renders `abstract.progress` records for image, image-edit, image-upscale, video, and image-to-video runs when available.
Unconnected artifact input pins expose a browser upload affordance directly on the node. Uploads go to Gateway and are stored as session-visible artifacts, then the node stores the canonical artifact ref as its pin default. Flow does not use server workspace paths for browser-local uploads.
`Listen Voice` waits are handled as Gateway/Runtime waits. Flow only captures audio in the browser, uploads it to Gateway as an audio artifact, and resumes the waiting run with that artifact ref; transcription and downstream execution remain Gateway/Runtime work.
For the vision routes, the Properties drawer now follows the Gateway media
contract closely:
- `Generate Image`, `Edit Image`, `Generate Video`, and `Image To Video` expose
task-filtered provider/model selectors backed by Gateway discovery.
- Compatible routes expose batch controls through `count` and ordered `seeds`.
- Compatible routes expose ordered `lora_adapters` stacks with per-adapter
scale and optional target role.
- Batched routes surface plural artifact outputs such as `image_artifacts` and
`video_artifacts` alongside the singular compatibility pins.
Flow only shows those editors when the current node contract advertises the
corresponding support. Provider/model selection remains optional; leaving them
on `Auto (Gateway default)` keeps the workflow portable across runtimes and
users.

## Files, folders, and artifacts
Flow uses one explicit source model for file-like work:
- `Artifact`: a saved Runtime-owned payload that can be reused across runs.
- `Local File`: a browser upload from this computer. For artifact-style inputs,
Flow uploads it to Gateway and stores the resulting artifact ref.
- `Local Folder`: a browser-selected folder from this computer. In hosted
Flow, each file is uploaded to Gateway and the workflow receives an ordered
multi-artifact input with preserved relative member paths.
- `Server File` / `Server Folder`: a file or folder inside the active Gateway
workspace scope. The underlying engineering contract is a canonical
`Workspace File` / `Workspace Folder` path such as `docs/report.md` or
`mount_alias/reports`.
The run modal and node defaults now expose workspace path browsing for
`Workspace File` / `Workspace Folder` pins, plus artifact-backed local intake
for one file, many files, or one or more local folders. Typical graph patterns are:
- `List Folder Files` to enumerate a workspace-scoped server folder with family
and extension filters.
- `Import Server File` to snapshot a server file into a durable artifact.
- `Read Artifact` to inspect text, JSON, or bounded binary projections from any
artifact-backed file.
- `Read Artifact` -> `content_family` / `content_type` -> `Switch` to route
image, audio, text, PDF, or other file inputs through different subgraphs.
- `Export Artifact` to write a durable artifact back into the current server
workspace.
- `ForEach` / array nodes over an `array<file>` input to analyze local files or
local-folder contents file by file. `Local Folder` in the run form is a
source for `array<file>`, so the workflow still receives files with
preserved relative member paths rather than a live folder path.
## Development
```bash
npm install
npm run dev
```
Useful environment variables:
- `ABSTRACTGATEWAY_URL` or `ABSTRACTFLOW_GATEWAY_URL`: default Gateway target for the proxy.
- `ABSTRACTFLOW_ALLOW_REMOTE_BROWSER_GATEWAY_CONFIG=1`: allow non-local browsers to change the Gateway URL.
- `ABSTRACTFLOW_TRUST_PROXY_HEADERS=1`: honor forwarded host/proto headers behind a trusted reverse proxy.
## Build And Serve
```bash
npm run build
npm start -- --host 0.0.0.0 --port 3003 --gateway-url http://127.0.0.1:8080
```
## docs/workflow-authoring-skill.md
# AbstractFlow Workflow Authoring Skill
This is the operational guide for agents that author AbstractFlow VisualFlow
graphs. It is not general product documentation. It is the procedure and domain
model an authoring agent must use to create inspectable, runnable workflows.
The authoring prompt includes two sources of truth:
1. This skill document, which explains how to think and compose workflows.
2. A complete generated node catalog from `src/types/nodes.ts` — one line per
palette template with exact node types, template variants, input/output pins
and pin types, dynamic-pin allowance, document config fields, and Gateway
capability availability. The catalog is authoritative for exact types and
pins.
Use this guide for semantics and patterns. Use the generated catalog for exact
parameters. The committed companion catalog is `docs/workflow-node-catalog.md`;
in the web assistant the same information is generated at runtime with current
Gateway capability availability.
## Document Authoring Model
You author the COMPLETE workflow as one JSON document per cycle. The editor
diffs your document against the current graph, compiles the diff into validated
mutations, applies them, and reports any problems back.
Document shape:
```json
{
"flow_name": "Deep Research",
"nodes": [
{"id": "start", "type": "on_flow_start", "outputs": [{"id": "topic", "type": "string"}]},
{"id": "research_agent", "type": "agent", "label": "Research agent",
"pin_defaults": {"system": "You are...", "max_iterations": 50}},
{"id": "end", "type": "on_flow_end", "inputs": [{"id": "report", "type": "string"}]}
],
"edges": [
"start.exec-out -> research_agent.exec-in",
"start.topic -> research_agent.prompt",
"research_agent.exec-out -> end.exec-in",
"research_agent.response -> end.report"
]
}
```
Node fields:
- `id`: stable identity. Keep existing ids unchanged so configuration and
edges survive. A node cannot change type under the same id — give the
replacement a new id and omit the old node.
- `type`: exact `nodeType` from the catalog. `template`: the palette variant
label, required when the catalog line shows `template="..."`.
- `label`: short descriptive role, in the request language ("Discussion
transcript", not "Variable"). Only On Flow Start / On Flow End may keep
defaults.
- `pin_defaults`: values for unconnected input pins. Merged per key — omitted
keys keep their current values; emit a key to change it.
- `literal`: value of literal/config nodes. For Tools Allowlist it is the
array of exact tool names; for String Template it is the template text; for
Variable nodes it is the declaration `{"name":"transcript","type":"array","default":[]}`.
- `code` / `function_name`: Code node Python body (sandbox only).
- `inputs` / `outputs`: the FULL dynamic data-pin list for dynamic-pin nodes
(see Dynamic Pins). Pins omitted from an emitted list are removed.
- `switch_cases` (Switch), `branch_count` (Sequence/Parallel), `event`
(event entry nodes), `tool` + `tool_parameters` (Tool Parameters),
`concat_separator` (Concat).
- `position`: optional; omit it and existing nodes stay where the user put
them while new nodes are auto-laid-out by execution depth.
- `agent_config` / `effect_config` / `subflow_id` appear in the serialized
current document as read-only context; do not author them — use
`pin_defaults` instead.
Edges are `"sourceNode.sourcePin -> targetNode.targetPin"` strings.
Ownership semantics:
- Emit the complete document every cycle: every node and every edge the
workflow needs.
- Anything you omit is DELETED. Nodes and edges absent from your document are
removed from the canvas. Never label a node "unused" or ask the user to
remove anything — omit it and it is gone.
- Values shown as `<redacted>` are secrets; re-emit them verbatim or omit
them. Never invent replacements.
- Re-emitting an unchanged document changes nothing and counts as a stalled
cycle.
## Authoring Loop
One-shot first, repair after:
1. Parse the user intent into workflow responsibilities: trigger, inputs,
context building, model/tool/generative actions, transforms, state, side
effects, outputs, observability.
2. Author the COMPLETE workflow document in your first response. Preserve
useful existing nodes (same ids) when the request builds on the current
draft.
3. Later cycles exist to repair: validator errors, document issues, readiness
issues, and acceptance review findings come back; fix only the reported
problems and re-emit the full corrected document.
4. Return `status: continue` while more graph work remains; the editor applies
your document and cycles again. Return `done` only when the graph visibly
implements the request — an acceptance review then compares the graph
against the request, and unmet findings come back as issues to fix.
5. On the first cycle of a new request, declare `acceptance_criteria`: 3-8
concrete, checkable statements derived from the request, such as "one LLM
Call per participant, each with a distinct model pin default".
Partial application: valid changes from your document are applied even when
others fail; failed items come back as document issues / skipped feedback.
Everything not listed was accepted and is in the current workflow document.
Repair against the current document, not against your earlier response.
Ask instead of stalling. If the request is ambiguous, requirements conflict,
or repair cycles keep failing without progress, return `status: needs_user`
with concrete questions in `reply` (in the request language). A cycle that
changes nothing and asks nothing wastes the whole turn.
A good workflow is not just a chain that "runs". It is readable: node labels
explain responsibility, data edges expose intent, and final outputs are wired
to On Flow End.
## Non-Negotiable Contract
- Match the request language. All user-visible content — flow name, node
labels, prompts, system texts, templates, replies — must be written in the
language of the user request unless the user asks otherwise.
- Use only node types and pins present in the generated catalog, plus
explicitly allowed dynamic pins.
- Do not invent tools, providers, models, pins, node types, or Gateway routes.
- Do not silently fall back to a simpler workflow.
- If a required capability is missing or a configuration is not document-
authorable, do not pretend it is done: return `failed` or `needs_user`.
- Respond with one bare JSON object only: no markdown fences, no prose around
it.
## Gateway Capability Contract
Some nodes require Gateway capabilities (tool execution, generated image/
video/voice/music, model residency, KG memory). The live catalog line carries
`cap:<capability>(available | checking | UNAVAILABLE: reason)`:
- `available`: the node can be authored.
- `checking`: capability data still loading; be conservative and say execution
depends on Gateway support.
- `UNAVAILABLE`: do not build a workflow that depends on the node unless the
user explicitly accepts a blocked workflow; otherwise return `failed` or
`needs_user` naming the missing capability.
Tool-dependent workflows must use the discovered Gateway tool inventory. Never
invent tool names.
## Dynamic Pins
Dynamic pins are the only pins you can author. All other pins are
template-owned and fixed. The document `inputs`/`outputs` lists are the full
desired pin list: pins you add appear, pins you omit are removed. Omitting the
field entirely keeps the current pins.
Dynamic input nodes (`inputs` list):
- `on_flow_end`: final outputs such as `markdown_report`, `sources`,
`audit_trace`, `pdf_path`.
- `make_object` (Build JSON): object fields such as `topic`, `instructions`.
- `string_template`: extra template variable inputs when not using `vars`.
- `concat`: additional string inputs beyond `a` and `b`.
Dynamic output nodes (`outputs` list):
- `on_flow_start`: runtime inputs such as `research_topic`, `max_sources`.
- `break_object`: extracted object-field outputs such as `markdown_report`,
`sources`. The emitted list also drives `breakConfig.selectedPaths`.
Never author execution pins; they are template-owned.
## Pin Types And Data Discipline
Use exact pin types from the catalog:
- `execution`: control flow only.
- `string`, `number`, `boolean`: scalars. `object`, `array`: JSON data.
- `json_schema`: JSON Schema objects for structured outputs.
- `tools`: tool-name allowlists for Agent/LLM/tool nodes.
- `artifact`, `artifact_image`, `artifact_audio`, `artifact_text`,
`artifact_video`: saved reusable artifact references.
- `array`: generic collections. On workflow boundaries such as `On Flow Start`
and `On Flow End`, keep the visible type as `array` and use the second
selector to choose the item type. Use `array` of `file` when a runner should
provide many local files or a local folder from this computer; a selected
local folder expands into files with relative paths preserved.
- `provider_*`, `model_*`: provider/model selectors per capability.
- `memory`, `assertion`, `assertions`: memory/KG configuration and data.
- `any`: flexible data pin.
Never connect data to execution or execution to data. Avoid `any` when a more
precise pin exists.
Connection compatibility beyond exact matches:
- `tools <-> array`; `tools -> object`.
- `assertions <-> array`; `assertions <-> object`; `assertion <-> object`.
- `json_schema <-> object`; `memory <-> object`.
- `array -> object`; `number -> string`; `boolean -> string`.
- Artifact pins connect only to compatible modalities (generic artifact
bridges typed ones). Media node `outputs`/`meta` object pins are not
artifact refs.
- File arrays connect to generic `array` workflows. Use `ForEach`,
`Array Length`, `Array Map`, `Array Filter`, or `Get Element` to analyze
multi-file and folder inputs.
- Provider pins are nominal and modality-scoped; model pins are nominal —
typed payload pins do not connect to model pins.
- `any` connects to everything except execution pins, including model and
provider pins. This is how dynamic values reach nominal pins, e.g. a ForEach
`item` from a model array into `llm_call.model`.
When a validator reports a type mismatch, change the target dynamic pin type,
wire a compatible source, or insert a transform/schema/break node. Do not
re-emit the same invalid edge.
Common rejected-edge mistakes (observed in real authoring runs — avoid them
in the FIRST emitted document):
- Scalars into object inputs: `string`/`number`/`boolean` outputs do NOT
connect to an `object` input such as `string_template.vars`. Build the
object first — `make_object` with one dynamic input per variable, then
`make_object.result -> string_template.vars` — or skip `vars` entirely by
declaring extra dynamic inputs on the `string_template` node and
referencing them as `{{name}}` in the template.
- Wiring into loop outputs: `loop` and `done` on `for`/`loop`/`while` are
execution OUTPUTS, never targets. Nested loops: `outer.loop ->
inner.exec-in` (directly or after body steps); after `inner.done` the body
chain simply ends or continues with more outer-body steps — the runtime
returns to the outer loop automatically. Never emit `inner.done ->
outer.loop` or `inner.done -> outer.done`.
- Edge grammar and identity: both endpoints must be `node_id.pin_id` and the
node ids must exist in `nodes[]`. `literal_one -> add.b` is invalid
(missing source pin); `literal_one.value -> add.b` is valid only when a
node with id `literal_one` is defined in the same document.
## Connection Cardinality
- Data inputs accept at most one incoming edge. Emitting a different source
for an occupied data input replaces the edge.
- Execution inputs allow fan-in.
- Execution outputs are one-to-one. For fan-out, insert `sequence` (ordered)
or `parallel` (concurrent) and connect each `then:<n>` output once. The
editor auto-inserts a `sequence` when an exec output is double-connected and
reports the rewiring as a warning.
- Data self-wiring is rejected.
- Multi-entry exception: when a node has 2+ incoming execution edges, a data
input may carry the base edge plus at most one route override per execution
path; connecting the data pin from a direct execution predecessor creates
the override automatically.
## Execution Model
Execution nodes must be in the execution chain; pure data/config nodes are
evaluated from data dependencies and have no exec pins (Build JSON, String
Template, JSON Schema, Tools Allowlist, Parse JSON, Break Object, Agent Trace
Report, math, string, and most transforms).
Entry and terminal:
- `on_flow_start`: standard run entry; add runtime input outputs here.
- `on_user_request`: chat entry (user `message` and `context`).
- `on_schedule`, `on_event`, `on_agent_message`: event entries.
- `on_flow_end`: terminal; add an input for every output the run exposes.
Common chains:
- Simple AI workflow: `on_flow_start.exec-out -> agent.exec-in -> on_flow_end.exec-in`.
- LLM plus tools: `on_flow_start -> llm_call -> tool_calls -> llm_call/agent -> on_flow_end`.
- File side effect: `agent.exec-out -> write_file.exec-in -> on_flow_end.exec-in`.
- Branches: `if` (boolean true/false), `switch` (string cases).
- Loops: `loop` (foreach array), `for` (numeric), `while` (boolean).
Loop body semantics (control frames):
- Connect `<loop>.loop` to the first body node and chain the body with exec
edges. When the body chain ends, the runtime returns to the loop node
automatically for the next iteration.
- NEVER wire the last body node back to the loop's `exec-in` — that resets the
iteration counter (infinite loop). The editor removes such loop-backs with a
warning.
- `done` is an execution OUTPUT that fires after the final iteration:
`<loop>.done -> <next step>.exec-in`. Never wire anything into `done`.
- For several body steps per iteration, chain them or use
`<loop>.loop -> sequence.exec-in` with `then:<n>` branches.
## Node Family Guide
The catalog gives exact pins; this section explains usage.
### Events And Timing
`on_flow_start` (default manual entry), `on_flow_end` (final boundary),
`on_user_request` (chat), `on_agent_message`, `on_schedule` (configure
`event.schedule`/`event.recurrent`), `on_event` (durable custom events),
`wait_event` (pause for event), `emit_event`, `wait_until` (delay),
`system_datetime` (pure current-time metadata for prompts/filenames/digests).
Scheduled digest pattern: `on_schedule` -> prompt builder -> Agent/LLM ->
write/report -> `on_flow_end`, with `system_datetime.iso` in prompt variables.
### LLM And Agent Nodes
`llm_call` — one model call. Classification, rewriting, extraction,
summarization, routing, synthesis. Inputs: `system`, `prompt`, `context`,
`memory`, provider/model, `tools`, generation controls, `resp_schema`.
Outputs: `response` text, structured `data` (when schema active),
`tool_calls`, `meta`, `success`. Tools exposed to `llm_call` produce tool-call
requests; a separate `tool_calls` node executes them.
`agent` — autonomous multi-step work with tools and iterative reasoning (deep
research, planning, multi-source synthesis):
- Always author a non-empty `system`: role, quality bar, citation/source
requirements, iteration strategy, final output contract.
- `prompt` carries the concrete task (usually from String Template).
- `tools` from Tools Allowlist or discovered runtime tool names.
- `max_iterations` 50 for deep iterative work unless the user asks smaller.
- `resp_schema` when downstream needs structured fields; wire `agent.data` ->
Break Object. `agent.response` is final text. `agent.scratchpad` is for
audit/trace only. `agent.meta` is execution metadata — never sources,
citations, or user-facing research data.
Structured agent report pattern: On Flow Start fields -> Build JSON ->
String Template.vars; String Template.result -> Agent.prompt; JSON Schema ->
Agent.resp_schema; Tools Allowlist -> Agent.tools; Agent.data -> Break Object
-> On Flow End; Agent.scratchpad -> Agent Trace Report -> On Flow End
audit_trace.
Choosing between `llm_call`, `agent`, and direct tool calls — decide per
step, not per workflow:
- `llm_call`: ONE model pass over inputs already in the graph (classify,
rewrite, extract, summarize, route, synthesize a provided transcript). No
external information is gathered. Cheapest and most deterministic.
- `agent`: the step must DISCOVER information or iterate (search the web,
read sources, retry, refine across multiple tool calls). One agent per
responsibility; give it tools and an authored `system`.
- `tool_parameters` -> `make_array` -> `tool_calls`: exactly one known tool
call with known arguments (deterministic fetch/write); no model needed to
decide anything.
- If the request demands fresh external knowledge (research, news, current
facts) inside a step, a bare `llm_call` CANNOT satisfy it — use an `agent`
with search/fetch tools there, or return `needs_user` if no suitable tool
exists in the inventory.
### Tools
Use the discovered Gateway tool inventory from the prompt; names must match
exactly. `recommended_for_request=true` is a relevance hint only.
Tool selection discipline (per agent, least privilege):
- Match each agent's allowlist to ITS role using the inventory's
`description`/`when_to_use`: a web-research agent gets search + fetch
tools; a file-report agent gets file-write tools; never both "just in
case". Different agents in one workflow normally get DIFFERENT allowlists.
- Leaving `agent.tools` unset gives the agent the FULL runtime tool set at
execution time. That is a deliberate broad-access choice, acceptable only
for general-purpose assistants — tool-dependent workflows must declare
explicit allowlists.
- Never invent tool names; if the capability a step needs is missing from
the inventory, say so via `needs_user` instead of substituting a
hallucinated tool.
- `tools_allowlist`: reusable tool-name list; set via `literal` array.
- `tool_parameters`: builds one tool-call object for a selected tool
(deterministic direct calls); configure via `tool` + `tool_parameters`.
- `tool_calls`: executes tool-call objects; requires
`pin_defaults.allowed_tools` in the same document node that creates it.
- `format_tool_results`: tool results -> readable text for prompts/reports.
Patterns: agentic research = Tools Allowlist -> Agent.tools. Deterministic
step = Tool Parameters -> Make Array -> Tool Calls. LLM-planned calls =
LLM Call.tool_calls -> Tool Calls.tool_calls -> Format Tool Results -> next
prompt.
### Generative Media And Capability Nodes
`generate_image`, `edit_image`, `upscale_image`, `generate_video`,
`image_to_video`, `generate_voice`, `generate_music`, `transcribe_audio`,
`listen_voice`, `model_residency`. They call Gateway capabilities and return
artifact references: typed artifact outputs plus generic `artifact_ref`,
`artifact_id`, `content_type`, `outputs`, `meta`, `success`. Prefer typed
artifact outputs for downstream media nodes; expose artifact refs/ids at