Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
969 lines (912 loc) · 52.2 KB
/
Copy pathindex.html
File metadata and controls
969 lines (912 loc) · 52.2 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>dotFactory — a language for describing workflows</title>
<meta name="description" content="dotFactory is a small language for agentic workflows: typed data flowing through triggers, steps and sinks. A spec, not a runtime.">
<meta property="og:title" content="dotFactory — describe the workflow, not the implementation">
<meta property="og:description" content="A small language for automations with and without AI agents: typed data flowing through triggers, steps and sinks. A spec, not a runtime.">
<meta property="og:type" content="website">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='4' cy='12' r='3' fill='%233b82f6'/%3E%3Ccircle cx='12' cy='12' r='3' fill='%2364748b'/%3E%3Ccircle cx='20' cy='12' r='3' fill='%2316a34a'/%3E%3C/svg%3E">
<style>
:root {
--ink: #111827;
--muted: #5b6472;
--faint: #8b95a5;
--line: #e6e8ec;
--soft: #f7f8fa;
--card: #ffffff;
--accent: #0b5fff;
--trigger: #3b82f6;
--step: #64748b;
--sink: #16a34a;
--loop: #f59e0b;
--port: #8b5cf6;
--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
--sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
--maxw: 74rem;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
margin: 0;
font: 16px/1.6 var(--sans);
color: var(--ink);
background: var(--card);
-webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 .5rem; }
h3 { font-size: 1.02rem; margin: 0 0 .35rem; }
p { margin: 0 0 1rem; }
code { font-family: var(--mono); font-size: .88em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }
.narrow { max-width: 46rem; }
.lede { font-size: 1.1rem; color: var(--muted); }
.kicker {
font-size: .72rem; font-weight: 700; letter-spacing: .14em;
text-transform: uppercase; color: var(--faint); margin: 0 0 .8rem;
}
section { padding: 4.5rem 0; border-top: 1px solid var(--line); scroll-margin-top: 4.25rem; }
section:first-of-type { border-top: 0; }
/* ---------- nav ---------- */
header.nav {
position: sticky; top: 0; z-index: 20;
backdrop-filter: saturate(1.4) blur(8px);
background: rgba(255,255,255,.86);
border-bottom: 1px solid var(--line);
}
.nav-inner {
max-width: var(--maxw); margin: 0 auto; padding: .7rem 1.5rem;
display: flex; align-items: center; gap: 1.4rem;
}
.brand { font-weight: 750; letter-spacing: -.02em; display: flex; align-items: center; gap: .5rem; }
.brand svg { display: block; }
.nav-links { margin-left: auto; display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .9rem; }
.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
/* ---------- hero ---------- */
.hero { padding: 4.5rem 0 3rem; }
.hero h1 {
font-size: clamp(2.1rem, 5.5vw, 3.6rem);
margin: 0 0 1rem; max-width: 20ch;
}
.hero .lede { max-width: 44rem; font-size: clamp(1.05rem,2vw,1.25rem); }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.6rem 0 1.9rem; }
.chip {
font-family: var(--mono); font-size: .78rem; color: var(--muted);
background: var(--soft); border: 1px solid var(--line);
padding: .22rem .6rem; border-radius: 999px;
}
.btns { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn {
display: inline-flex; align-items: center; gap: .5rem;
padding: .62rem 1.05rem; border-radius: 9px; font-weight: 600; font-size: .92rem;
border: 1px solid var(--line); color: var(--ink); background: var(--card);
}
.btn:hover { text-decoration: none; border-color: #cbd0d8; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #000; }
.note { font-size: .85rem; color: var(--faint); margin-top: 1.2rem; }
/* ---------- generic flow pills ---------- */
.flow { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.pill {
display: inline-flex; align-items: center; gap: .45rem;
border: 1px solid var(--line); border-radius: 9px;
padding: .5rem .8rem; font-size: .86rem; font-weight: 600; background: #fff;
white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--step); }
.pill.trigger { border-color: color-mix(in srgb, var(--trigger) 40%, var(--line)); }
.pill.trigger .dot { background: var(--trigger); }
.pill.step .dot { background: var(--step); }
.pill.sink { border-color: color-mix(in srgb, var(--sink) 40%, var(--line)); }
.pill.sink .dot { background: var(--sink); }
.pill.port { border-color: color-mix(in srgb, var(--port) 40%, var(--line)); }
.pill.port .dot { background: var(--port); }
.pill.muted { color: var(--muted); font-weight: 500; }
.arrow { color: var(--faint); font-weight: 700; }
.arrow.back { color: var(--loop); }
/* ---------- hero preview ---------- */
.preview {
margin-top: 2.6rem; border: 1px solid var(--line); border-radius: 14px;
background: linear-gradient(180deg,#fdfdff,#f7f8fa); padding: 1.5rem 1.4rem;
}
.preview .flow { justify-content: flex-start; }
.preview .caption { font-size: .8rem; color: var(--faint); margin-top: 1rem; font-family: var(--mono); }
/* ---------- two column ---------- */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem; }
.panel { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 1.3rem 1.4rem; }
.panel h3 { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.panel ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.panel li { margin: .3rem 0; }
.strike { color: var(--faint); }
.strike code { text-decoration: line-through; }
blockquote {
margin: 2.4rem 0 0; padding: 0 0 0 1.1rem; border-left: 3px solid var(--ink);
font-size: 1.25rem; line-height: 1.45; letter-spacing: -.01em; max-width: 40rem;
}
/* ---------- vocab ---------- */
.vocab { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 2rem; }
.vcard { border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.1rem 1.2rem; background: #fff; min-width: 0; }
.vcard .top { display: flex; align-items: center; gap: .55rem; margin-bottom: .55rem; }
.glyph {
width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
flex: none; font-family: var(--mono); font-size: .8rem; font-weight: 700; color: #fff;
}
.vcard h3 { margin: 0; font-size: .98rem; }
.vcard p { font-size: .87rem; color: var(--muted); margin: .4rem 0 .7rem; }
.vcard pre { margin: 0; max-width: 100%; }
/* ---------- feature strip ---------- */
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 2rem; }
.fcard { border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem 1.3rem 1.3rem; background: #fff; min-width: 0; }
.fcard .head { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; }
.fcard h3 { margin: 0; font-size: 1rem; }
.fcard .ver { margin-left: auto; font-family: var(--mono); font-size: .7rem; color: var(--faint); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .45rem; }
.fcard p { font-size: .86rem; color: var(--muted); margin: .35rem 0 .8rem; }
.fcard pre { margin: 0; max-width: 100%; }
.fcard .more { display: inline-block; margin-top: .7rem; font-family: var(--mono); font-size: .76rem; color: var(--accent); }
.validated { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: .76rem; color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 999px; padding: .18rem .55rem; margin-left: .6rem; vertical-align: middle; }
.validated::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #16a34a; }
.g-type { background: var(--step); }
.g-trigger { background: var(--trigger); }
.g-step { background: #475569; }
.g-runner { background: #0f766e; }
.g-bind { background: #2563eb; }
.g-loop { background: var(--loop); }
.g-sink { background: var(--sink); }
.g-port { background: var(--port); }
pre {
background: #0f1420; color: #e6edf3; border-radius: 10px;
padding: .85rem 1rem; overflow-x: auto; font-family: var(--mono);
font-size: .8rem; line-height: 1.55; margin: 0;
}
pre .kw { color: #ff9e64; }
pre .ty { color: #7ee787; }
pre .st { color: #a5d6ff; }
pre .cm { color: #7d8590; }
pre .fn { color: #d2a8ff; }
pre .dim { color: #7d8590; }
/* ---------- anatomy / walkthrough ---------- */
.stages { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.8rem 0 1.3rem; }
.stage-btn {
font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
border: 1px solid var(--line); background: #fff; color: var(--muted);
padding: .4rem .8rem; border-radius: 999px;
}
.stage-btn:hover { color: var(--ink); }
.stage-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.anatomy { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.5rem; align-items: start; }
.codebox {
border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #0f1420;
}
.codebox .bar {
display: flex; align-items: center; gap: .45rem; padding: .5rem .8rem;
background: #161c2b; border-bottom: 1px solid #232b3d;
font-family: var(--mono); font-size: .74rem; color: #8b95a5;
}
.codebox .bar i { width: 9px; height: 9px; border-radius: 50%; background: #2d3548; }
.codebox .code { padding: .7rem 0; overflow-x: auto; max-height: 32rem; overflow-y: auto; scrollbar-width: thin; }
.cl {
font-family: var(--mono); font-size: .79rem; line-height: 1.5;
padding: .08rem 1rem .08rem 1rem; white-space: pre; color: #d7dde7;
border-left: 2px solid transparent; transition: background .15s, border-color .15s;
}
.cl .ln { display: inline-block; width: 1.6rem; color: #4a5568; user-select: none; }
.cl[data-stage] { cursor: pointer; }
.cl.on { background: rgba(11,95,255,.16); border-left-color: var(--accent); }
.cl.hover { background: rgba(255,255,255,.05); }
.cl .kw { color: #ff9e64; }
.cl .ty { color: #7ee787; }
.cl .st { color: #a5d6ff; }
.cl .cm { color: #7d8590; }
.cl .fn { color: #d2a8ff; }
.cl .key { color: #79c0ff; }
.explain { border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem 1.3rem; background: #fff; position: sticky; top: 4.5rem; }
.explain .tag { font-family: var(--mono); font-size: .72rem; color: var(--accent); font-weight: 700; letter-spacing: .06em; }
.explain h3 { margin: .45rem 0 .5rem; font-size: 1.2rem; }
.explain p { font-size: .92rem; color: var(--muted); margin: 0; }
.explain .hint { margin-top: 1rem; font-size: .78rem; color: var(--faint); }
/* ---------- run animation ---------- */
.runner { border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem; margin-top: 2rem; background: linear-gradient(180deg,#fdfdff,#f8f9fb); }
.diagram { display: flex; flex-direction: column; gap: 1.6rem; }
.lane { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.node {
position: relative; border: 1px solid var(--line); background: #fff; border-radius: 10px;
padding: .55rem .85rem; font-size: .85rem; font-weight: 650; min-width: 74px; text-align: center;
transition: box-shadow .25s, border-color .25s, transform .25s, background .25s;
}
.node small { display: block; font-weight: 500; font-size: .68rem; color: var(--faint); font-family: var(--mono); }
.node.n-trigger { border-color: color-mix(in srgb, var(--trigger) 45%, var(--line)); }
.node.n-sink { border-color: color-mix(in srgb, var(--sink) 45%, var(--line)); }
.node.n-port { border-color: color-mix(in srgb, var(--port) 45%, var(--line)); }
.node.hot { box-shadow: 0 0 0 3px rgba(11,95,255,.25); border-color: var(--accent); transform: translateY(-1px); }
.node.done { background: #f0fdf4; border-color: #86efac; }
.node.sinklit { background: #ecfdf5; border-color: var(--sink); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.cap { border-style: dashed; }
.wire { flex: 1; min-width: 26px; height: 2px; background: repeating-linear-gradient(90deg,#cfd6e0 0 6px,transparent 6px 11px); position: relative; border-radius: 2px; transition: background .2s; }
.wire::after { content: ""; position: absolute; right: -1px; top: -3px; border: 4px solid transparent; border-left-color: #cfd6e0; transition: border-color .2s; }
.wire.hot { background: linear-gradient(90deg, var(--accent), #7aa7ff); }
.wire.hot::after { border-left-color: #7aa7ff; }
.wire.back { background: repeating-linear-gradient(90deg, color-mix(in srgb,var(--loop) 60%, #fff) 0 6px, transparent 6px 11px); }
.wire.back::after { border-left-color: var(--loop); }
.wire.back.hot { background: linear-gradient(90deg, var(--loop), #fcd34d); }
.wire.back.hot::after { border-left-color: #fcd34d; }
.feedback { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; font-size: .76rem; margin-left: 2rem; }
.feedback .fb-node { font-weight: 650; color: var(--ink); font-size: .8rem; }
.feedback .fb-line {
color: var(--loop); font-family: var(--mono); font-size: .78rem; letter-spacing: .04em;
border-bottom: 2px dashed color-mix(in srgb, var(--loop) 55%, #fff);
padding-bottom: 3px; transition: color .2s, border-color .2s;
}
.feedback .fb-line.hot { color: #b45309; border-bottom-color: #b45309; }
.feedback .fb-note { color: var(--faint); font-family: var(--mono); font-size: .74rem; }
.caps { display: flex; gap: .6rem; flex-wrap: wrap; font-size: .76rem; color: var(--muted); font-family: var(--mono); }
.console { margin-top: 1.3rem; background: #0f1420; border-radius: 10px; padding: .8rem 1rem; font-family: var(--mono); font-size: .78rem; color: #cbd5e1; min-height: 8.5rem; }
.console .row { opacity: .25; transition: opacity .2s, color .2s; }
.console .row.show { opacity: 1; }
.console .row.ok { color: #7ee787; }
.console .row.warn { color: #fcd34d; }
.console .row .t { color: #4a5568; }
.run-controls { display: flex; gap: .6rem; align-items: center; margin-top: 1.2rem; flex-wrap: wrap; }
.run-controls .status { font-size: .82rem; color: var(--muted); font-family: var(--mono); }
.counter { font-family: var(--mono); font-size: .78rem; color: var(--faint); }
.counter b { color: var(--sink); }
/* ---------- host / portability ---------- */
.hosts { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.4rem; align-items: center; margin-top: 2rem; }
.hostbox { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem; }
.hostbox ul { list-style: none; margin: 0; padding: 0; }
.hostbox li { padding: .45rem 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.hostbox li:last-child { border-bottom: 0; }
.mockfile { font-family: var(--mono); font-size: .8rem; background: #0f1420; color: #e6edf3; border-radius: 12px; padding: 1rem 1.1rem; }
.mockfile .badge { color: #7d8590; }
/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); padding: 3rem 0 4rem; background: var(--soft); }
footer .grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
footer h3 { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
footer ul { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
footer li { margin: .35rem 0; }
footer .fine { margin-top: 2.5rem; font-size: .8rem; color: var(--faint); }
@media (max-width: 860px) {
.cols, .anatomy, .hosts, .vocab, .features, footer .grid { grid-template-columns: minmax(0, 1fr); }
.vocab { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.explain { position: static; }
section { padding: 3rem 0; }
}
@media (max-width: 560px) {
.vocab, .features { grid-template-columns: minmax(0, 1fr); }
.nav-links { gap: .8rem; font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) {
html { scroll-behavior: auto; }
* { transition: none !important; }
}
</style>
</head>
<body>
<header class="nav">
<div class="nav-inner">
<a class="brand" href="#top">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<circle cx="4" cy="12" r="2.4" fill="#3b82f6"/>
<circle cx="12" cy="12" r="2.4" fill="#64748b"/>
<circle cx="20" cy="12" r="2.4" fill="#16a34a"/>
<path d="M6.4 12h3.2M14.4 12h3.2" stroke="#cbd0d8" stroke-width="1.6"/>
</svg>
dotFactory
</a>
<nav class="nav-links">
<a href="#why">Why</a>
<a href="#shape">The shape</a>
<a href="#anatomy">Anatomy</a>
<a href="#beyond">Beyond</a>
<a href="#run">See it run</a>
<a href="#host">Hosts</a>
<a href="https://github.com/RedBeardLab/dotFactory">GitHub</a>
</nav>
</div>
</header>
<main id="top">
<!-- ================= HERO ================= -->
<section class="hero">
<div class="wrap">
<p class="kicker">A spec, not a runtime</p>
<h1>Describe the workflow.<br>Not the implementation.</h1>
<p class="lede">
dotFactory is a small language for automations with and without AI agents.
You write the <em>dataflow</em> — typed values moving through triggers,
steps and sinks — and leave the object models, async runtimes and
dependency-injection frameworks behind.
</p>
<div class="chips">
<span class="chip">typed dataflow</span>
<span class="chip">triggers</span>
<span class="chip">steps</span>
<span class="chip">sinks</span>
<span class="chip">loops</span>
<span class="chip">maps</span>
<span class="chip">lists</span>
<span class="chip">options</span>
<span class="chip">config</span>
</div>
<div class="btns">
<a class="btn primary" href="#run">▶ See it run</a>
<a class="btn" href="#anatomy">Read the code</a>
<a class="btn" href="https://github.com/RedBeardLab/dotFactory/blob/main/dotFactory.md">The spec</a>
</div>
<p class="note">No runtime to install. No platform to sign up for. The walkthrough is a real file; the feature excerpts come from factories that validate.</p>
<div class="preview">
<div class="flow">
<span class="pill trigger"><span class="dot"></span>github · issue opened</span>
<span class="arrow">→</span>
<span class="pill step"><span class="dot"></span>draft ⇄ review</span>
<span class="arrow">→</span>
<span class="pill sink"><span class="dot"></span>github · comment</span>
<span class="arrow back" title="feedback">⟲</span>
<span class="pill muted">a reviewed reply</span>
</div>
<p class="caption">an issue in · a reviewed reply out · a retry loop in between</p>
</div>
</div>
</section>
<!-- ================= WHY ================= -->
<section id="why">
<div class="wrap">
<p class="kicker">The problem</p>
<h2>You are thinking in dataflow. You are writing everything else.</h2>
<p class="lede narrow" style="margin-bottom:2.2rem">
A trigger feeds a step, the step calls an agent, the output feeds another
step, maybe a retry, then a sink. That picture is simple. But the moment
you open an editor, the language makes you manage machinery that has
nothing to do with it.
</p>
<div class="cols">
<div class="panel">
<h3>What you actually mean</h3>
<ul>
<li>The trigger fires on a GitHub issue.</li>
<li>The step drafts a reply.</li>
<li>The reviewer approves or sends it back.</li>
<li>The sink pings the team on Slack.</li>
</ul>
</div>
<div class="panel strike">
<h3>What the language asks about</h3>
<ul>
<li><code>class</code> hierarchies & metaclasses</li>
<li>interface satisfaction & goroutine lifecycle</li>
<li>ownership, borrowing, lifetimes</li>
<li>the event loop, the DI wiring, the framework</li>
</ul>
</div>
</div>
<blockquote>
When the language fits the domain, the code becomes a direct
translation of intent. Everything else follows from that.
</blockquote>
</div>
</section>
<!-- ================= THE SHAPE / VOCAB ================= -->
<section id="shape">
<div class="wrap">
<p class="kicker">The core vocabulary</p>
<h2>Eight concepts. No spare parts.</h2>
<p class="lede narrow">
Every idea earns its place by being needed to describe how work flows
through a graph. This is the core of the language; the rest is data,
built-ins and host adapters.
</p>
<div class="vocab">
<div class="vcard">
<div class="top"><span class="glyph g-type">T</span><h3>Type</h3></div>
<p>Structural records, lists and maps. Fields and shapes — no classes, inheritance, or constructors.</p>
<pre><span class="kw">type</span> Issue = { number: <span class="ty">int</span> }</pre>
</div>
<div class="vcard">
<div class="top"><span class="glyph g-trigger">▶</span><h3>Trigger</h3></div>
<p>Admits one seed value and holds it constant for the whole run. The host supplies the kind.</p>
<pre><span class="kw">trigger</span> issue_opened:
kind: <span class="st">github</span>
<span class="kw">config</span>: { path: <span class="st">"/api/github/webhook"</span>, target: { one: { repo: <span class="st">"acme/widgets"</span> } } }</pre>
</div>
<div class="vcard">
<div class="top"><span class="glyph g-step">▸</span><h3>Step</h3></div>
<p>Where work happens. Invokes a unit and binds its typed outputs.</p>
<pre><span class="kw">step</span> draft:
runner: agent</pre>
</div>
<div class="vcard">
<div class="top"><span class="glyph g-runner">⚙</span><h3>Runner</h3></div>
<p>How a step runs: a shell command, a container, or an agent behind a typed interface.</p>
<pre><span class="kw">runner</span> agent:
kind: <span class="st">opencode</span>
in: <span class="kw">open</span>
out: <span class="kw">open</span></pre>
</div>
<div class="vcard">
<div class="top"><span class="glyph g-bind">↦</span><h3>Binding</h3></div>
<p>Named edges that move values between ports. The bindings <em>are</em> the program.</p>
<pre>in: { issue: in.issue }</pre>
</div>
<div class="vcard">
<div class="top"><span class="glyph g-loop">⟲</span><h3>Loop</h3></div>
<p>A <code>prev</code> (loop-carried) binding re-fires a step with feedback — a retry, not control flow.</p>
<pre><span class="kw">prev</span> feedback: review.result</pre>
</div>
<div class="vcard">
<div class="top"><span class="glyph g-sink">■</span><h3>Sink</h3></div>
<p>An effect. Inside a loop it fires each pass; downstream it fires once.</p>
<pre><span class="kw">sink</span> result:
kind: <span class="st">file</span>
<span class="kw">config</span>: { path: <span class="st">"out/result.json"</span> }</pre>
</div>
<div class="vcard">
<div class="top"><span class="glyph g-port">⇥</span><h3>External port</h3></div>
<p>A bridge to the outside, implemented by the host. Secrets are opaque — redacted everywhere.</p>
<pre><span class="kw">external port</span> credential
(key: <span class="ty">text</span>) -> <span class="ty">secret</span></pre>
</div>
</div>
</div>
</section>
<!-- ================= ANATOMY ================= -->
<section id="anatomy">
<div class="wrap">
<p class="kicker">Anatomy of a factory</p>
<h2>One real file, read top to bottom.</h2>
<p class="lede narrow">
A GitHub issue arrives, an agent drafts a reply, and a reviewer approves
it or sends it back. The loop retries while the reply is not ready, and
the result is posted back to the issue. <strong>Pick a part</strong> to
see what it does.
<span class="validated">validated · v1.35</span>
</p>
<p class="note" style="margin-top:-.2rem">
The real file:
<a href="https://github.com/RedBeardLab/dotFactory/blob/main/examples/reply.fct">examples/reply.fct</a>.
It passes <code>fct validate</code> and <code>fct sinks</code>.
</p>
<div class="stages" id="stages">
<button class="stage-btn" data-stage="types">Types</button>
<button class="stage-btn" data-stage="port">Ports</button>
<button class="stage-btn" data-stage="runner">Runner</button>
<button class="stage-btn" data-stage="trigger">Trigger</button>
<button class="stage-btn" data-stage="loop">Loop</button>
<button class="stage-btn" data-stage="steps">Retry steps</button>
<button class="stage-btn" data-stage="sinks">Sinks</button>
</div>
<div class="anatomy">
<div class="codebox">
<div class="bar"><i></i><i></i><i></i><span style="margin-left:.5rem">reply.fct</span><span style="margin-left:auto;color:#8b95a5;font-size:.72rem">scroll ↕</span><a href="https://github.com/RedBeardLab/dotFactory/blob/main/examples/reply.fct" style="color:#8b95a5;font-size:.72rem;margin-left:.8rem">source ↗</a></div>
<div class="code" id="code" tabindex="0" aria-label="reply.fct source, scroll to read">
<div class="cl" data-stage="types"><span class="ln"> 1</span><span class="kw">import</span> <span class="st">"types"</span> <span class="kw">as</span> gh</div>
<div class="cl"><span class="ln"> 2</span></div>
<div class="cl" data-stage="port"><span class="ln"> 3</span><span class="kw">external</span> <span class="kw">port</span> <span class="fn">credential</span>(key: <span class="ty">text</span>) -> <span class="ty">secret</span></div>
<div class="cl" data-stage="port"><span class="ln"> 4</span><span class="kw">external</span> <span class="kw">port</span> <span class="fn">github_token</span>(repo: <span class="ty">text</span>) -> <span class="ty">secret</span></div>
<div class="cl"><span class="ln"> 5</span></div>
<div class="cl" data-stage="types"><span class="ln"> 6</span><span class="kw">type</span> AgentCall = { token: <span class="ty">secret</span>, prompt: <span class="ty">text</span> }</div>
<div class="cl"><span class="ln"> 7</span></div>
<div class="cl" data-stage="runner"><span class="ln"> 8</span><span class="kw">runner</span> agent:</div>
<div class="cl" data-stage="runner"><span class="ln"> 9</span> <span class="kw">kind</span>: <span class="st">opencode</span></div>
<div class="cl" data-stage="runner"><span class="ln">10</span> <span class="kw">in</span>: AgentCall</div>
<div class="cl" data-stage="runner"><span class="ln">11</span> <span class="kw">out</span>: <span class="kw">open</span></div>
<div class="cl"><span class="ln">12</span></div>
<div class="cl" data-stage="trigger"><span class="ln">13</span><span class="kw">trigger</span> issue_opened:</div>
<div class="cl" data-stage="trigger"><span class="ln">14</span> <span class="kw">kind</span>: <span class="st">github</span></div>
<div class="cl" data-stage="trigger"><span class="ln">15</span> <span class="kw">config</span>: <span class="ty">gh::GithubConfig</span> = {</div>
<div class="cl" data-stage="trigger"><span class="ln">16</span> path: <span class="st">"/api/github/webhook"</span></div>
<div class="cl" data-stage="trigger"><span class="ln">17</span> target: { one: { repo: <span class="st">"acme/widgets"</span> } }</div>
<div class="cl" data-stage="trigger"><span class="ln">18</span> event: <span class="st">issues</span></div>
<div class="cl" data-stage="trigger"><span class="ln">19</span> }</div>
<div class="cl" data-stage="trigger"><span class="ln">20</span> <span class="kw">out</span>:</div>
<div class="cl" data-stage="trigger"><span class="ln">21</span> issue: <span class="ty">gh::Issue</span></div>
<div class="cl" data-stage="trigger"><span class="ln">22</span> repository: <span class="ty">gh::Repository</span></div>
<div class="cl" data-stage="trigger"><span class="ln">23</span> action: <span class="ty">gh::GithubIssueAction</span></div>
<div class="cl" data-stage="trigger"><span class="ln">24</span> sender: <span class="ty">text</span></div>
<div class="cl"><span class="ln">25</span></div>
<div class="cl" data-stage="loop"><span class="ln">26</span><span class="kw">loop</span> reply:</div>
<div class="cl" data-stage="loop"><span class="ln">27</span> <span class="kw">in</span>: { issue: <span class="ty">gh::Issue</span> }</div>
<div class="cl" data-stage="loop"><span class="ln">28</span> <span class="kw">out</span>: { body: <span class="ty">text</span> = review.body }</div>
<div class="cl"><span class="ln">29</span></div>
<div class="cl" data-stage="steps loop"><span class="ln">30</span> <span class="kw">step</span> draft:</div>
<div class="cl" data-stage="steps runner"><span class="ln">31</span> <span class="kw">runner</span>: agent</div>
<div class="cl" data-stage="steps"><span class="ln">32</span> <span class="kw">in</span>:</div>
<div class="cl" data-stage="steps port"><span class="ln">33</span> token: <span class="fn">credential</span>(key: <span class="st">"opencode"</span>)</div>
<div class="cl" data-stage="steps"><span class="ln">34</span> prompt: <span class="st">"Draft a reply. Return only the reply text."</span></div>
<div class="cl" data-stage="steps"><span class="ln">35</span> title: in.issue.title</div>
<div class="cl" data-stage="steps"><span class="ln">36</span> body: in.issue.body</div>
<div class="cl" data-stage="steps loop"><span class="ln">37</span> <span class="kw">prev</span> feedback: review.body <span class="kw">if</span> <span class="kw">not</span> review.approved <span class="kw">and</span> draft.attempt < 3</div>
<div class="cl" data-stage="steps"><span class="ln">38</span> <span class="kw">out</span>: { body: <span class="ty">text</span> }</div>
<div class="cl"><span class="ln">39</span></div>
<div class="cl" data-stage="steps loop"><span class="ln">40</span> <span class="kw">step</span> review:</div>
<div class="cl" data-stage="steps runner"><span class="ln">41</span> <span class="kw">runner</span>: agent</div>
<div class="cl" data-stage="steps"><span class="ln">42</span> <span class="kw">in</span>:</div>
<div class="cl" data-stage="steps port"><span class="ln">43</span> token: <span class="fn">credential</span>(key: <span class="st">"opencode"</span>)</div>
<div class="cl" data-stage="steps"><span class="ln">44</span> prompt: <span class="st">"Review the draft. Return ready and the final text."</span></div>
<div class="cl" data-stage="steps"><span class="ln">45</span> text: draft.body</div>
<div class="cl" data-stage="steps"><span class="ln">46</span> <span class="kw">out</span>: { approved: <span class="ty">bool</span>, body: <span class="ty">text</span> }</div>
<div class="cl"><span class="ln">47</span></div>
<div class="cl" data-stage="sinks loop"><span class="ln">48</span> <span class="kw">sink</span> progress:</div>
<div class="cl" data-stage="sinks loop"><span class="ln">49</span> <span class="kw">kind</span>: <span class="st">file</span></div>
<div class="cl" data-stage="sinks loop"><span class="ln">50</span> <span class="kw">config</span>: { path: <span class="st">"out/reply-progress.json"</span> }</div>
<div class="cl" data-stage="sinks loop"><span class="ln">51</span> <span class="kw">in</span>: { attempt: draft.attempt, body: draft.body }</div>
<div class="cl"><span class="ln">52</span></div>
<div class="cl" data-stage="loop"><span class="ln">53</span><span class="kw">step</span> post:</div>
<div class="cl" data-stage="loop"><span class="ln">54</span> <span class="kw">use</span>: reply</div>
<div class="cl" data-stage="loop trigger"><span class="ln">55</span> <span class="kw">in</span>: { issue: issue_opened.issue }</div>
<div class="cl"><span class="ln">56</span></div>
<div class="cl" data-stage="sinks"><span class="ln">57</span><span class="kw">sink</span> comment:</div>
<div class="cl" data-stage="sinks"><span class="ln">58</span> <span class="kw">kind</span>: <span class="st">github_issue</span></div>
<div class="cl" data-stage="sinks"><span class="ln">59</span> <span class="kw">config</span>: { action: <span class="st">"comment"</span> }</div>
<div class="cl" data-stage="sinks"><span class="ln">60</span> <span class="kw">in</span>:</div>
<div class="cl" data-stage="sinks port"><span class="ln">61</span> token: <span class="fn">github_token</span>(repo: issue_opened.repository.name)</div>
<div class="cl" data-stage="sinks trigger"><span class="ln">62</span> repo: issue_opened.repository.name</div>
<div class="cl" data-stage="sinks trigger"><span class="ln">63</span> number: issue_opened.issue.number</div>
<div class="cl" data-stage="sinks loop"><span class="ln">64</span> body: post.body</div>
</div>
</div>
<aside class="explain" id="explain">
<!-- filled by JS -->
</aside>
</div>
</div>
</section>
<!-- ================= BEYOND ================= -->
<section id="beyond">
<div class="wrap">
<p class="kicker">Beyond the loop</p>
<h2>Small language. Sharp edges.</h2>
<p class="lede narrow">
The retry is the execution model. These are the everyday features that
keep the factory small: collections without loops, open-keyed data,
absence that cannot be confused with null, and configuration that lives
with the deployment.
</p>
<div class="features">
<article class="fcard">
<div class="head"><span class="glyph g-type">≡</span><h3>Lists and callbacks</h3><span class="ver">v1.28 · v1.34</span></div>
<p>Project, filter and accumulate with pure built-ins. A callback is an expression, not a function value.</p>
<pre>labels: [<span class="ty">text</span>] = <span class="fn">list::map</span>(
in.issue.labels, l -> l.name
)</pre>
<a class="more" href="https://github.com/RedBeardLab/dotFactory/blob/main/dotFactory.md#81-list-built-ins">the spec: lists ↗</a>
</article>
<article class="fcard">
<div class="head"><span class="glyph g-bind">#</span><h3>Maps</h3><span class="ver">v1.29</span></div>
<p>Text keys, one value type, structural conformance. A missing path is absence; <code>map::*</code> is total.</p>
<pre><span class="kw">type</span> Labels = <span class="ty">map</span>(<span class="ty">text</span>, <span class="ty">text</span>)
team: <span class="ty">text</span> = labels.team
owner: <span class="ty">text</span>? = <span class="fn">map::at</span>(labels, <span class="st">"owner"</span>)</pre>
<a class="more" href="https://github.com/RedBeardLab/dotFactory/blob/main/dotFactory.md#82-maps">the spec: maps ↗</a>
</article>
<article class="fcard">
<div class="head"><span class="glyph g-loop">?</span><h3>Options and absence</h3><span class="ver">v1.33</span></div>
<p><code>T?</code> is <code>some(T) | none</code>; absence is a probe, never a value. Branch with <code>is some</code> / <code>is none</code>.</p>
<pre><span class="kw">type</span> Issue = { milestone: <span class="ty">text</span>? }
sink save:
<span class="kw">when</span>: start.issue.milestone <span class="kw">is</span> some
<span class="kw">in</span>: { text: <span class="fn">opt::value</span>(start.issue.milestone) }</pre>
<a class="more" href="https://github.com/RedBeardLab/dotFactory/blob/main/dotFactory.md#41-none-and-absence">the spec: options ↗</a>
</article>
<article class="fcard">
<div class="head"><span class="glyph g-port">⚙</span><h3>Configuration</h3><span class="ver">v1.35</span></div>
<p>A deployment value, not source: factory → user → organization, then a wider tier. Text, readable, editable.</p>
<pre>model: <span class="ty">text</span> = <span class="fn">config</span>(
key: <span class="st">"agent.model"</span>,
default: <span class="st">"opencode-go/deepseek-v4.1-flash"</span>
)</pre>
<a class="more" href="https://github.com/RedBeardLab/dotFactory/blob/main/dotFactory.md#44-deployment-configuration">the spec: config ↗</a>
</article>
</div>
<p class="note">
Short excerpts from the validated factories; the anatomy above is the
complete file.
</p>
</div>
</section>
<!-- ================= RUN ================= -->
<section id="run">
<div class="wrap">
<p class="kicker">The execution model</p>
<h2>A run is a round of firings until nothing can fire.</h2>
<p class="lede narrow">
Press play. The trigger admits a GitHub issue, the loop runs <code>draft →
review</code>, the reviewer sends the draft back once, then approves.
The <code>progress</code> sink fires <strong>inside</strong> the loop —
once per pass — while <code>comment</code> waits downstream and posts
<strong>once</strong>.
</p>
<div class="runner">
<div class="diagram">
<div class="lane">
<span class="caps">uses</span>
<span class="node n-port cap" data-node="port">credential <small>port → secret</small></span>
<span class="node cap" data-node="runner">agent <small>opencode</small></span>
</div>
<div class="lane">
<span class="node n-trigger" data-node="issue">issue <small>trigger · github</small></span>
<span class="wire" id="w-issue-draft"></span>
<span class="node" data-node="draft">draft <small>step</small></span>
<span class="wire" id="w-draft-review"></span>
<span class="node" data-node="review">review <small>step</small></span>
<span class="wire" id="w-review-comment"></span>
<span class="node n-sink" data-node="comment">comment <small>sink · github_issue</small></span>
</div>
<div class="feedback">
<span class="fb-node">draft</span>
<span class="fb-line" id="w-feedback">⟵ prev feedback ⟵</span>
<span class="fb-node">review</span>
<span class="fb-note">re-fires while not approved & under 3 attempts</span>
</div>
<div class="lane">
<span class="caps">in loop</span>
<span class="node n-sink" data-node="progress">progress <small>sink · each pass</small></span>
<span class="counter" id="progress-count">attempts recorded: <b>0</b></span>
</div>
</div>
<div class="run-controls">
<button class="btn primary" id="play">▶ Run the factory</button>
<button class="btn" id="reset">Reset</button>
<span class="status" id="run-status">ready</span>
</div>
<div class="console" id="console"></div>
</div>
<p class="note">
A simulated animation of <code>reply.fct</code>. The code and adapters
are real; the run is illustrative.
</p>
</div>
</section>
<!-- ================= HOSTS ================= -->
<section id="host">
<div class="wrap">
<p class="kicker">Why a spec</p>
<h2>Write the factory once. Host it anywhere.</h2>
<p class="lede narrow">
The factory describes <em>what should happen</em>. The host supplies
<em>how</em>: which trigger kinds exist, which runner backends run, where
sinks write, how ports resolve. Those are adapter concerns — so they can
compete without locking in your workflows.
</p>
<div class="hosts">
<div class="mockfile">
<span class="badge"># portable, self-describing</span><br>
<span class="kw">trigger</span> issue_opened: <span class="badge">kind: github · event: issues</span><br>
<span class="kw">loop</span> reply: <span class="badge">draft ⇄ review</span><br>
<span class="kw">sink</span> comment: <span class="badge">kind: github_issue</span>
</div>
<div style="text-align:center;color:var(--faint);font-size:1.4rem">↔</div>
<div class="hostbox">
<ul>
<li><strong>Local</strong> — the reference host: containers & OpenCode</li>
<li><strong>Cloudflare</strong> — workers as steps, R2 as a sink (adapter)</li>
<li><strong>AWS / GCP</strong> — Lambda/Batch steps, SQS triggers (adapter)</li>
<li><strong>Your own</strong> — register the kinds your domain needs</li>
</ul>
</div>
</div>
<p class="note">
The spec defines the concepts; implementations follow. Tooling — validators,
diagrammers, editors — can be built against the interface, independently of any one host.
</p>
</div>
</section>
</main>
<footer>
<div class="wrap grid">
<div>
<a class="brand" href="#top" style="font-size:1.05rem">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<circle cx="4" cy="12" r="2.4" fill="#3b82f6"/>
<circle cx="12" cy="12" r="2.4" fill="#64748b"/>
<circle cx="20" cy="12" r="2.4" fill="#16a34a"/>
<path d="M6.4 12h3.2M14.4 12h3.2" stroke="#cbd0d8" stroke-width="1.6"/>
</svg>
dotFactory
</a>
<p style="font-size:.88rem;color:var(--muted);margin-top:.7rem;max-width:32rem">
A small, focused language for describing workflows — without the baggage
of a general-purpose language. The spec is the deliverable.
</p>
</div>
<div>
<h3>Read</h3>
<ul>
<li><a href="https://github.com/RedBeardLab/dotFactory/blob/main/dotFactory.md">Specification</a></li>
<li><a href="#anatomy">Walkthrough: an issue reply loop</a></li>
<li><a href="https://slowtechred.substack.com/p/dotfactory">The article</a></li>
</ul>
</div>
<div>
<h3>Elsewhere</h3>
<ul>
<li><a href="https://github.com/RedBeardLab/dotFactory">github.com/RedBeardLab/dotFactory</a></li>
<li><a href="https://github.com/RedBeardLab/dotFactory/blob/main/index.html">This page's source</a></li>
</ul>
</div>
</div>
<div class="wrap fine">
dotFactory is a draft proposal · the spec is evolving · this page is a static, self-contained explainer
</div>
</footer>
<script>
(function () {
"use strict";
/* ---------------- anatomy walkthrough ---------------- */
var STAGES = {
types: {
tag: "import \"types\" as gh · type AgentCall = { … }",
title: "Types travel with the factory",
body: "<code>gh::Issue</code> and <code>gh::Repository</code> come from the shared <code>types.fct</code> module — one import, no copy-paste. <code>AgentCall</code> is a plain structural record; there are no classes, constructors or inheritance."
},
port: {
tag: "external port credential(key) · github_token(repo)",
title: "External ports bridge to the outside",
body: "<code>credential</code> reads the model token from the Run's tenant scopes. <code>github_token</code> mints a short-lived App installation token, scoped to one repository. Both return <code>secret</code>: the value is redacted everywhere it is observed, and you can pass it but never print or compute on it."
},
runner: {
tag: "runner agent: in: AgentCall · out: open",
title: "A runner is where the work happens",
body: "The factory declares the kind and the typed interface; the host supplies the mechanism. <code>in: AgentCall</code> is the minimum a step must provide. <code>out: open</code> fixes no shape, so each step declares the structured result it wants and the agent returns it."
},
trigger: {
tag: "trigger issue_opened: kind: github · event: issues",
title: "A trigger admits a seed and holds it constant",
body: "This one fires when a GitHub issue is opened. The event is explicit — the default is a pull request. The host hands the Run the full <code>gh::Issue</code>, its repository, the action and the sender; the trigger's <code>out</code> ports are bindable for the rest of the Run."
},
loop: {
tag: "loop reply: … step post: use: reply",
title: "A composite owns a private scope",
body: "<code>reply</code> declares <code>in</code>/<code>out</code> ports, and everything else about how it works stays inside. Outside, <code>post</code> invokes it once and sees only the final <code>body</code>. The <code>prev</code> edge is what makes it a <code>loop</code>."
},
steps: {
tag: "prev feedback: review.body if not review.approved",
title: "A retry that follows the work",
body: "<code>draft</code> and <code>review</code> both pass the model token, because the runner's interface requires it. The <code>prev</code> binding is loop-carried: on the first pass it is inactive; afterwards <code>draft</code> re-fires with the reviewer's text — but only while the review is not approved and under the attempt budget of 3."
},
sinks: {
tag: "sink progress: … sink comment:",
title: "Sinks fire per scope",
body: "<code>progress</code> sits <em>inside</em> the loop's scope, so it writes on every pass — the retry is observable from outside. <code>comment</code> sits downstream, so it fires once, through the real <code>github_issue</code> sink; the installation token is minted at the call. Same language, two different firing rules."
}
};
var codeEl = document.getElementById("code");
var explain = document.getElementById("explain");
var buttons = Array.prototype.slice.call(document.querySelectorAll(".stage-btn"));
var lines = Array.prototype.slice.call(codeEl.querySelectorAll(".cl"));
function select(name, reveal) {
if (!STAGES[name]) { return; }
buttons.forEach(function (b) { b.classList.toggle("active", b.dataset.stage === name); });
var first = null;
lines.forEach(function (el) {
var stages = (el.dataset.stage || "").split(/\s+/);
var on = stages.indexOf(name) !== -1;
el.classList.toggle("on", on);
if (on && !first) { first = el; }
});
if (reveal && first) {
var box = codeEl.getBoundingClientRect();
var line = first.getBoundingClientRect();
if (line.top < box.top || line.bottom > box.bottom) {
codeEl.scrollTop += line.top - box.top - 16;
}
}
var s = STAGES[name];
explain.innerHTML =
'<span class="tag">' + s.tag + "</span>" +
"<h3>" + s.title + "</h3>" +
"<p>" + s.body + "</p>" +
'<p class="hint">Click any highlighted line to explain it.</p>';
}
buttons.forEach(function (b) {
b.addEventListener("click", function () { select(b.dataset.stage, true); });
});
// clicking a code line selects its first stage
lines.forEach(function (el) {
var stage = (el.dataset.stage || "").split(/\s+/)[0];
if (stage) {
el.addEventListener("click", function () { select(stage); });
el.addEventListener("mouseenter", function () { el.classList.add("hover"); });
el.addEventListener("mouseleave", function () { el.classList.remove("hover"); });
}
});
select("types", false);
/* ---------------- run animation ---------------- */
var consoleEl = document.getElementById("console");
var statusEl = document.getElementById("run-status");
var countEl = document.getElementById("progress-count");
var playBtn = document.getElementById("play");
var FRAMES = [
{ nodes: ["issue"], wires: [], log: "issue #42 opened → admitted by `issue_opened`", cls: "" },
{ nodes: ["draft"], wires: ["w-issue-draft"], log: "pass 1 · `draft` calls the agent → a reply", cls: "" },
{ nodes: ["review"], wires: ["w-draft-review"], log: "pass 1 · `review` → not approved", cls: "warn", delay: 900 },
{ nodes: [], wires: ["w-feedback"], log: "not approved → `prev feedback` re-fires `draft`", cls: "warn", delay: 950 },
{ nodes: ["progress"], wires: [], log: "`out/reply-progress.json` ← attempt 1 (inner sink · fires each pass)", cls: "ok", progress: 1 },
{ nodes: ["draft"], wires: ["w-issue-draft"], log: "pass 2 · `draft` revises with the review", cls: "" },
{ nodes: ["review"], wires: ["w-draft-review"], log: "pass 2 · `review` → approved ✓", cls: "ok", delay: 900 },
{ nodes: ["progress"], wires: [], log: "`out/reply-progress.json` ← attempt 2", cls: "ok", progress: 2 },
{ nodes: ["comment"], wires: ["w-review-comment"], log: "loop settles → `post` fires once", cls: "" },
{ nodes: ["comment"], wires: [], log: "GitHub ← `comment` posts on issue #42", cls: "ok", delay: 700 },
{ nodes: [], wires: [], log: "run complete", cls: "ok", delay: 500, end: true }
];
var timers = [];
var playing = false;
function clearTimers() {
timers.forEach(clearTimeout);
timers = [];
}
function resetRun() {
clearTimers();
playing = false;
playBtn.disabled = false;
statusEl.textContent = "ready";
document.querySelectorAll(".node").forEach(function (n) {
n.classList.remove("hot", "sinklit", "done");
});
document.querySelectorAll(".wire").forEach(function (w) { w.classList.remove("hot"); });
consoleEl.innerHTML = "";
FRAMES.forEach(function (f, i) {
var row = document.createElement("div");
row.className = "row";
row.id = "log-" + i;
row.innerHTML = '<span class="t">' + pad(i) + "</span>" + f.log;
consoleEl.appendChild(row);
});
countEl.innerHTML = "attempts recorded: <b>0</b>";
}
function pad(n) { return ("0" + n).slice(-2) + " "; }
function play() {
resetRun();
playing = true;
playBtn.disabled = true;
statusEl.textContent = "running…";
var t = 0;
FRAMES.forEach(function (f, i) {
t += f.delay || 620;
timers.push(setTimeout(function () { applyFrame(f, i); }, t));
});
}
function applyFrame(f, i) {
document.querySelectorAll(".node").forEach(function (n) { n.classList.remove("hot"); });
document.querySelectorAll(".wire").forEach(function (w) { w.classList.remove("hot"); });
f.nodes.forEach(function (id) {
var el = document.querySelector('.node[data-node="' + id + '"]');
if (el) { el.classList.add("hot"); }
});
f.wires.forEach(function (id) {
var el = document.getElementById(id);
if (el) { el.classList.add("hot"); }
});
if (f.progress !== undefined) {
var p = document.querySelector('.node[data-node="progress"]');
if (p) { p.classList.add("sinklit"); }
countEl.innerHTML = "attempts recorded: <b>" + f.progress + "</b>";
}
if (f.nodes.indexOf("comment") !== -1) {
var r = document.querySelector('.node[data-node="comment"]');
if (r) { r.classList.add("sinklit"); }
}
var row = document.getElementById("log-" + i);
if (row) {
row.classList.add("show");
if (f.cls) { row.classList.add(f.cls); }
}
if (f.end) {
playing = false;
playBtn.disabled = false;
statusEl.textContent = "done ✓";
}
}
playBtn.addEventListener("click", play);
document.getElementById("reset").addEventListener("click", function () {
resetRun();
});
resetRun();
})();
</script>
</body>
</html>