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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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
# SOVEREIGN NOTEBOOK UI & ANIMATION SPEC

**Frontend/UX Engineer Specification**  
**Version**: 1.0  
**Status**: DESIGN COMPLETE  
**Date**: 2026-07-27  
**Authority**: Jessica (jessi@snapkitty.com)

---

## Executive Summary

The Sovereign Notebook is a cryptographically-sealed, reactive notebook interface that bridges:
- **Cell Editing**: Code, Markdown, Math (EmojiCode, HolyC, Python, JavaScript, Ada)
- **Execution Flow**: Isomorphic transformation pipeline (M1→M2→M3→Runtime→M5→M6)
- **Receipt Ledger**: WORM-sealed execution records with Ed25519 signatures
- **Dependency Graph**: Visual data flow between cells
- **Responsive Animations**: Unicode glyphs, hash chains, cryptographic locks

**Design Philosophy**: Minimal framework, vanilla Web Components, Canvas/SVG for animation, reactive state binding. Dark mode primary with light mode support.

---

## 1. LAYOUT & PANEL ARCHITECTURE

### 1.1 Desktop Layout (1440px+)

```

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚  HEADER: Notebook Title | Run | Interrupt | Save | Export | Verify  β”‚

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚ TOOLBAR: [⚑ EmojiCode] [Python] [Ada] [Math] | πŸ” Search           β”‚

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚                                                                        β”‚

β”‚  MAIN CONTENT AREA (3 columns)                                        β”‚

β”‚                                                                        β”‚

β”‚  β”Œβ”€ LEFT SIDEBAR ────┬─ CENTER EDITOR ────────┬─ RIGHT PANEL ──────┐ β”‚

β”‚  β”‚                   β”‚                        β”‚                    β”‚ β”‚

β”‚  β”‚ β€’ Metadata        β”‚  Cell 1 [CODE]        β”‚ β€’ WORM Ledger     β”‚ β”‚

β”‚  β”‚   - Cell count    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚

β”‚  β”‚   - Depends on    β”‚  β”‚ ⚑ fn:1618     β”‚   β”‚   β”‚ Receipt ID  β”‚ β”‚ β”‚

β”‚  β”‚   - Trust level   β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   β”‚ ─────────── β”‚ β”‚ β”‚

β”‚  β”‚                   β”‚  ▢️ [Output]          β”‚   β”‚ Hash: 0xab  β”‚ β”‚ β”‚

β”‚  β”‚ β€’ Dep Graph       β”‚                       β”‚   β”‚ Sig: Ed...  β”‚ β”‚ β”‚

β”‚  β”‚   └─ Visual       β”‚  Cell 2 [MARKDOWN]   β”‚   β”‚ Time: 10:30 β”‚ β”‚ β”‚

β”‚  β”‚     grid          β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚

β”‚  β”‚                   β”‚  β”‚ # Results      β”‚   β”‚                    β”‚ β”‚

β”‚  β”‚ β€’ Trust Policies  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚ β€’ Dependency Graph β”‚ β”‚

β”‚  β”‚   - Execute as    β”‚                       β”‚   (small visual)   β”‚ β”‚

β”‚  β”‚   - Verify with   β”‚  Cell 3 [MATH]       β”‚                    β”‚ β”‚

β”‚  β”‚   - Seal with     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚ β€’ Cell Cache      β”‚ β”‚

β”‚  β”‚                   β”‚  β”‚ βˆ‘ Ξ»(x)dx      β”‚   β”‚   - Hit ratio     β”‚ β”‚

β”‚  β”‚                   β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   - Memory used   β”‚ β”‚

β”‚  β”‚                   β”‚  ▢️ [Output]          β”‚                    β”‚ β”‚

β”‚  β”‚                   β”‚                       β”‚                    β”‚ β”‚

β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚

β”‚                                                                        β”‚

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚  FOOTER: Execution time | Cell count | Status | Connected to runtimeβ”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

```

### 1.2 Mobile Layout (< 768px)

```

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ HEADER (compact)            β”‚

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚ TAB BAR: [Editor] [Ledger]  β”‚

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚                             β”‚

β”‚ MAIN CONTENT (single col)  β”‚

β”‚                             β”‚

β”‚ β€’ Cell 1 (full width)       β”‚

β”‚ β€’ Cell 2 (full width)       β”‚

β”‚                             β”‚

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚ BOTTOM SHEET: Metadata      β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

```

---

## 2. UI COMPONENTS

### 2.1 Web Component Definitions

#### `<notebook-container>`

**Purpose**: Root container for entire notebook UI  
**Attributes**:
- `notebook-id` (string): UUID of notebook
- `mode` (enum): 'edit' | 'view' | 'locked'
- `theme` (enum): 'dark' | 'light'

**State**:
```typescript

interface NotebookContainerState {

  notebookId: string;

  title: string;

  cells: Cell[];

  executionQueue: ExecutionTask[];

  receipts: ReceiptRecord[];

  dependencyGraph: CellDependency[];

  metadata: {

    createdAt: number;

    modifiedAt: number;

    author: string;

    trustLevel: 'low' | 'medium' | 'high' | 'sovereign';

  };

}

```

**Events**:
- `cell:created` β†’ new cell added
- `cell:executed` β†’ cell completed execution
- `receipt:sealed` β†’ receipt added to WORM
- `graph:updated` β†’ dependency graph changed

---

#### `<notebook-cell>` (Base Class)

**Purpose**: Editable/viewable cell with multiple types  
**Attributes**:
- `cell-id` (string): UUID
- `cell-type` (enum): 'code' | 'markdown' | 'math'
- `language` (enum): 'emoji' | 'python' | 'holyc' | 'javascript' | 'ada'
- `readonly` (boolean): read-only mode

**Subcomponents**:
- `<notebook-cell-editor>` β€” editable textarea with syntax highlighting
- `<notebook-cell-output>` β€” rendered output display
- `<notebook-cell-controls>` β€” run/delete/move buttons

**State**:
```typescript

interface Cell {

  id: string;

  type: 'code' | 'markdown' | 'math';

  language: Language;

  source: string;

  output: CellOutput | null;

  executionTime: number; // ms

  dependsOn: string[]; // cell IDs

  metadata: {

    createdAt: number;

    executedAt: number | null;

    executedBy: string;

    proof: ProofStatus;

  };

  sealStatus: 'pending' | 'sealed' | 'verified' | 'revoked';

}



interface CellOutput {

  type: 'text' | 'table' | 'graph' | 'math' | 'error';

  data: any;

  hash: string; // blake3

  receiptId: string | null;

}

```

---

#### `<cell-editor>`

**Purpose**: Monaco-like syntax highlighting for code cells  
**Attributes**:
- `language` (enum): programming language
- `theme` (enum): 'dark' | 'light'

**Features**:
- Syntax highlighting via Highlight.js
- Line numbers
- Code folding
- Inline error markers
- Autocomplete hints (from semantic registry)
- Undo/redo

**Keyboard Bindings**:
- `Shift+Enter` β†’ run this cell
- `Ctrl+Enter` β†’ run and select next
- `Ctrl+/` β†’ toggle comment
- `Tab` β†’ indent (4 spaces)
- `Escape` β†’ exit edit mode

---

#### `<cell-output>`

**Purpose**: Render cell execution results  
**Supported Types**:

```

TEXT OUTPUT

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ Output: 42                  β”‚

β”‚ Type: integer               β”‚

β”‚ Hash: 0xabcd...             β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜



TABLE OUTPUT

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ col1  | col2  | col3        β”‚

β”‚ ─────────────────────────   β”‚

β”‚ val1  | val2  | val3        β”‚

β”‚ val4  | val5  | val6        β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜



GRAPH OUTPUT

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚  (rendered via D3/SVG)      β”‚

β”‚  β€’ Scatter plot             β”‚

β”‚  β€’ Bar chart                β”‚

β”‚  β€’ Network graph            β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜



MATH OUTPUT

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚  βˆ‘ Ξ»(x)dx = 1618 (sealed)  β”‚

β”‚  Verified by: Lean4 βœ“      β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

```

**Renderers**:
- Text: plain or markdown-rendered
- Table: HTML table with sortable columns
- Graph: D3/Canvas visualization
- Math: MathJax/KaTeX rendering
- Error: syntax highlighted traceback

---

#### `<notebook-sidebar>`

**Purpose**: Left metadata and navigation panel  
**Sections**:

1. **Notebook Info**
   - Title (editable)
   - Cell count
   - Last modified
   - Total execution time

2. **Cell List** (scrollable)
   - Quick jump to cell
   - Execution status icon
   - Dependency count

3. **Dependency Graph** (miniature)
   - Small SVG visualization
   - Highlight current cell
   - Click to jump

4. **Trust Policies**
   - Execute as: [agent name]
   - Verify with: [verifier]
   - Seal with: [key fingerprint]

---

#### `<worm-ledger>`

**Purpose**: Right panel showing receipt chain  
**Display**:

```

WORM LEDGER VIEWER

─────────────────────────────



 Receipt #1          [β–Ό]

 β”œβ”€ ID: 0xfab1...

 β”œβ”€ Event: Cell 2 execute

 β”œβ”€ Agent: builder

 β”œβ”€ Status: βœ“ sealed

 β”œβ”€ Time: 10:30:45

 β”œβ”€ Hash: 0x7a8b...

 └─ Sig: Ed25519(0x1234...)



 Receipt #2          [β–Ό]

 β”œβ”€ ID: 0xfab2...

 β”œβ”€ Event: Cell 3 verify

 β”œβ”€ ...



 [Load More ↓]

```

**Features**:
- Expandable receipt details
- Verify signature button
- Export receipt as JSON
- Copy hash to clipboard
- Filter by status/agent

---

#### `<execution-trace>`

**Purpose**: Animation overlay showing live execution flow  
**Display**:

```

EXECUTION TRACE (Canvas overlay, semi-transparent)

─────────────────────────────────────────────────────



Cell 1 ──→ [Ξ» Ξ» Ξ»] ──→ Cell 2 ──→ [βœ“] ──→ OUTPUT

 Running     (0.2s)      Queued          Ready



Legend:

 ──→ data flow (animated arrow)

 Ξ»   unicode glyph (flowing)

 βœ“   completion marker

```

---

#### `<cryptographic-stamp>`

**Purpose**: Animated WORM seal effect  
**Visual**:

```

 πŸ” SEALED

  ╱─────╲

 β”‚ blake3 β”‚  (rotating, glowing)

  ╲─────╱

   worm↻

```

**Animation**:
- Rotating background every 2s
- Blake3 hash scrolls
- Glow effect pulses
- Ed25519 signature in tooltip

---

### 2.2 CSS Architecture

#### File Structure
```

styles/

β”œβ”€β”€ global.css              # resets, tokens, dark/light theme

β”œβ”€β”€ components/

β”‚  β”œβ”€β”€ notebook-cell.css

β”‚  β”œβ”€β”€ cell-editor.css

β”‚  β”œβ”€β”€ cell-output.css

β”‚  β”œβ”€β”€ notebook-sidebar.css

β”‚  β”œβ”€β”€ worm-ledger.css

β”‚  └── execution-trace.css

β”œβ”€β”€ animations.css          # keyframe definitions

β”œβ”€β”€ layout.css              # grid, flexbox layouts

└── theme/

   β”œβ”€β”€ dark.css

   └── light.css

```

#### Design Tokens (CSS Variables)

```css

/* Color Palette */

--color-bg-primary: #070b1e;      /* dark navy */

--color-bg-secondary: #0f0f2e;    /* lighter navy */

--color-text-primary: #eef9ff;    /* light cyan */

--color-text-secondary: #a0a7d0;  /* muted blue */

--color-accent-cyan: #7ef9ff;     /* bright cyan */

--color-accent-magenta: #ff79dc;  /* magenta */

--color-accent-gold: #ffe98a;     /* gold */

--color-error: #ff4fd8;           /* bright magenta */

--color-success: #00d9a3;         /* teal */

--color-warning: #ffd86b;         /* orange */



/* Typography */

--font-mono: 'Fira Code', 'Courier New', monospace;

--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

--font-size-code: 14px;

--font-size-label: 12px;

--font-size-body: 16px;

--line-height-code: 1.6;



/* Spacing */

--spacing-xs: 4px;

--spacing-sm: 8px;

--spacing-md: 16px;

--spacing-lg: 24px;

--spacing-xl: 32px;



/* Borders & Shadows */

--border-radius-sm: 4px;

--border-radius-md: 8px;

--border-radius-lg: 16px;

--shadow-sm: 0 2px 4px rgba(0,0,0,0.3);

--shadow-md: 0 8px 24px rgba(0,0,0,0.5);

--shadow-glow: 0 0 20px rgba(126,249,255,0.4);



/* Transitions */

--transition-fast: 150ms ease-out;

--transition-normal: 300ms ease-out;

--transition-slow: 600ms ease-out;

```

#### Component Styles (Example: Cell Editor)

```css

notebook-cell-editor {

  display: block;

  position: relative;

  background: var(--color-bg-secondary);

  border: 1px solid var(--color-accent-cyan);

  border-radius: var(--border-radius-md);

  overflow: hidden;

}



notebook-cell-editor .editor-wrapper {

  display: grid;

  grid-template-columns: auto 1fr;

  height: 200px;

  font-family: var(--font-mono);

  font-size: var(--font-size-code);

  line-height: var(--line-height-code);

}



notebook-cell-editor .line-numbers {

  background: var(--color-bg-primary);

  border-right: 1px solid var(--color-accent-cyan);

  padding: var(--spacing-sm);

  color: var(--color-text-secondary);

  user-select: none;

}



notebook-cell-editor .line-number {

  display: block;

  height: 1.6em;

  text-align: right;

  opacity: 0.5;

}



notebook-cell-editor textarea {

  background: transparent;

  color: var(--color-text-primary);

  border: none;

  outline: none;

  padding: var(--spacing-sm);

  font-family: inherit;

  font-size: inherit;

  resize: none;

  z-index: 2;

}



notebook-cell-editor .highlights {

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  bottom: 0;

  pointer-events: none;

  z-index: 1;

  overflow: hidden;

}



notebook-cell-editor .highlight-line {

  height: 1.6em;

  padding: var(--spacing-sm);

  font-family: var(--font-mono);

  white-space: pre;

  word-break: break-all;

}



/* Syntax highlighting */

.hljs-keyword { color: var(--color-accent-magenta); }

.hljs-string { color: var(--color-success); }

.hljs-number { color: var(--color-warning); }

.hljs-function { color: var(--color-accent-cyan); }

.hljs-comment { color: var(--color-text-secondary); opacity: 0.7; }



/* Focus state */

notebook-cell-editor:focus-within {

  box-shadow: 0 0 12px var(--color-accent-cyan);

  border-color: var(--color-accent-cyan);

}

```

---

## 3. ANIMATION ENGINE

### 3.1 Animation Categories

#### A. Execution Flow Animation

**Purpose**: Visualize data flowing between cells  
**Implementation**: Canvas + requestAnimationFrame

```javascript

class ExecutionFlowAnimator {

  constructor(canvas) {

    this.canvas = canvas;

    this.ctx = canvas.getContext('2d');

    this.particles = []; // flowing glyphs

    this.arrows = [];    // connection arrows

    this.isAnimating = false;

  }



  startExecution(fromCell, toCell) {

    // Start arrow from fromCell to toCell

    // Spawn unicode glyphs flowing along path

    // Duration: execution time + 0.5s decay

  }



  completeExecution(cellId) {

    // Show checkmark at cell

    // Fade out incoming arrows

    // Seal indicator appears

  }



  animate() {

    // Update particle positions

    // Render arrows and particles

    // Handle collisions/bunching

    if (this.isAnimating) requestAnimationFrame(() => this.animate());

  }

}

```

**Visual Details**:
- Arrow color: cyan to magenta gradient
- Unicode glyphs: Ξ», Ξ©, βˆ‘, βŠ•, Ο†, ∞ (50px size, semi-transparent)
- Speed: 200px/sec
- Trail effect: 0.3s fade tail

---

#### B. Dependency Graph Animation

**Purpose**: Show data dependencies between cells  
**Implementation**: D3.js force-directed graph or custom SVG

```

 Cell1 ─────┐

            β”œβ”€β†’ Cell3 ─→ Cell5

 Cell2 ──────             ↓

            └─→ Cell4 β”€β”€β”€β”€β”˜

```

**Features**:
- Nodes: circles labeled with cell ID
- Edges: directed arrows
- Hover: highlight path to/from cell
- Click: jump to cell
- Animation: smooth force simulation

**Code Example**:
```javascript

class DependencyGraphVisualizer {

  constructor(svgElement) {

    this.svg = d3.select(svgElement);

    this.nodes = [];

    this.links = [];

    this.simulation = null;

  }



  update(cells, dependencies) {

    // Convert cells and dependencies to nodes/links

    // Run force simulation

    // Bind data and render

    // Add hover/click handlers

  }



  highlightPath(cellId) {

    // Dim non-related nodes

    // Highlight nodes on dependency path

    // Animate edges along path

  }

}

```

---

#### C. Receipt Chain Animation

**Purpose**: Visualize hash chain and sealing  
**Implementation**: SVG + Canvas for effects

```

Hash1 ──→ [blake3] ──→ Hash2 ──→ [blake3] ──→ Hash3

  ↓                      ↓                      ↓

[Ed25519]            [Ed25519]             [Ed25519]

  ↓                      ↓                      ↓

Sig1                  Sig2                  Sig3 [SEALED βœ“]

```

**Animation Sequence**:
1. New receipt appears (fade in)
2. Hash scrolls left-to-right (1.5s)
3. Blake3 badge spins (rotation 360Β°)
4. Ed25519 signature glows (pulse effect)
5. Sealed checkmark animates (scale up)

**Code Structure**:
```javascript

class ReceiptChainAnimator {

  constructor(containerElement) {

    this.container = containerElement;

    this.receipts = []; // Array of ReceiptRecord

  }



  addReceipt(receipt) {

    // Create receipt element

    // Animate fade-in + scale

    // Animate hash scroll

    // Animate signature glow

    // Add to receipts array

  }



  animateHash(hashElement, hashValue) {

    // Scroll hash characters left-to-right

    // Duration: 1.5s

    // Monospace font, cyan color

  }



  animateSignature(sigElement) {

    // Glow pulse effect

    // Duration: 2s, repeat

    // Color: gold to magenta

  }

}

```

---

#### D. Unicode Glyph Animation

**Purpose**: Flowing mathematical symbols through cells  
**Implementation**: Canvas particles

```javascript

class UnicodeGlyphAnimator {

  constructor(canvas) {

    this.canvas = canvas;

    this.ctx = canvas.getContext('2d');

    this.glyphs = ['Ξ»', 'Ξ©', 'βˆ‘', 'βŠ•', 'Ο†', '∞', '↔', '⇄', '∷', 'βŠ—'];

  }



  spawnGlyph(startCell, endCell, duration) {

    // Create glyph particle

    // Interpolate position from start to end over duration

    // Fade in/out at edges

    // Rotate glyph during flight

  }



  render() {

    // Clear canvas

    // For each active glyph:

    //   - Compute position

    //   - Rotate based on velocity

    //   - Draw with alpha

    //   - Remove if expired

  }

}

```

**Glyph Semantics**:
- Ξ»: lambda (function)
- Ξ©: omega (loop)
- βˆ‘: summation
- βŠ•: XOR operation
- Ο†: golden ratio
- ∞: infinity
- ↔: bidirectional
- ⇄: reversible

---

#### E. Cryptographic Seal Animation

**Purpose**: Rotating WORM seal effect on sealed cells  
**Implementation**: Canvas 2D transforms

```javascript

class CryptoSealAnimator {

  constructor(canvas, receiptId) {

    this.canvas = canvas;

    this.receiptId = receiptId;

    this.rotation = 0;

  }



  animate() {

    this.ctx.save();

    

    // Draw rotating circle

    this.ctx.translate(centerX, centerY);

    this.ctx.rotate(this.rotation);

    this.ctx.strokeStyle = 'rgba(255,233,138,0.8)';

    this.ctx.lineWidth = 3;

    this.ctx.beginPath();

    this.ctx.arc(0, 0, 30, 0, Math.PI * 2);

    this.ctx.stroke();

    

    // Draw scrolling hash

    this.ctx.rotate(-this.rotation);

    this.ctx.font = '12px monospace';

    this.ctx.fillStyle = 'rgba(255,233,138,0.6)';

    this.ctx.textAlign = 'center';

    this.ctx.fillText(this.receiptId.slice(0, 8) + '...', 0, -45);

    

    // Draw glow effect

    this.ctx.shadowColor = 'rgba(255,233,138,0.4)';

    this.ctx.shadowBlur = 20;

    this.ctx.arc(0, 0, 35, 0, Math.PI * 2);

    this.ctx.stroke();

    

    this.ctx.restore();

    

    this.rotation += 0.05; // ~2s per rotation

    requestAnimationFrame(() => this.animate());

  }

}

```

**Visual Appearance**:
- Rotating gold circle
- Blake3 hash scrolls around perimeter
- Inner glow pulses
- Semi-transparent overlay on cell

---

### 3.2 Keyframe Definitions (CSS)

```css

@keyframes fadeInScale {

  from {

    opacity: 0;

    transform: scale(0.95);

  }

  to {

    opacity: 1;

    transform: scale(1);

  }

}



@keyframes glowPulse {

  0%, 100% {

    box-shadow: 0 0 10px var(--color-accent-cyan);

  }

  50% {

    box-shadow: 0 0 30px var(--color-accent-magenta);

  }

}



@keyframes scrollHash {

  from {

    transform: translateX(-100%);

  }

  to {

    transform: translateX(100%);

  }

}



@keyframes rotateSeal {

  from {

    transform: rotate(0deg);

  }

  to {

    transform: rotate(360deg);

  }

}



@keyframes flowingGlyph {

  0% {

    opacity: 0;

    transform: translate(0, 0);

  }

  10% {

    opacity: 1;

  }

  90% {

    opacity: 1;

  }

  100% {

    opacity: 0;

    transform: translate(var(--distance), 0);

  }

}



@keyframes highlightBorder {

  0%, 100% {

    border-color: var(--color-accent-cyan);

  }

  50% {

    border-color: var(--color-accent-magenta);

  }

}

```

---

## 4. STATE MANAGEMENT

### 4.1 Reactive State Architecture

**Pattern**: Simple event emitter + reactive getters

```typescript

class NotebookStore {

  private cells: Map<string, Cell> = new Map();

  private receipts: ReceiptRecord[] = [];

  private listeners: Map<string, Set<Callback>> = new Map();

  

  // Observable properties (via Proxy)

  public state: {

    cells: Cell[];

    receipts: ReceiptRecord[];

    executionQueue: ExecutionTask[];

    selectedCellId: string | null;

  };



  subscribe(event: string, callback: Callback) {

    if (!this.listeners.has(event)) {

      this.listeners.set(event, new Set());

    }

    this.listeners.get(event)!.add(callback);

    return () => this.listeners.get(event)!.delete(callback);

  }



  emit(event: string, data?: any) {

    this.listeners.get(event)?.forEach(cb => cb(data));

  }



  // Mutations

  addCell(cell: Cell) {

    this.cells.set(cell.id, cell);

    this.emit('cell:created', cell);

  }



  updateCellOutput(cellId: string, output: CellOutput) {

    const cell = this.cells.get(cellId);

    if (cell) {

      cell.output = output;

      this.emit('cell:updated', { cellId, output });

    }

  }



  addReceipt(receipt: ReceiptRecord) {

    this.receipts.push(receipt);

    this.emit('receipt:sealed', receipt);

  }



  // Queries

  getCellDependencies(cellId: string): string[] {

    const cell = this.cells.get(cellId);

    return cell?.dependsOn || [];

  }



  getDependencyGraph(): CellDependency[] {

    return Array.from(this.cells.values()).flatMap(cell =>

      cell.dependsOn.map(depId => ({ from: depId, to: cell.id }))

    );

  }



  getExecutionOrder(): string[] {

    // Topological sort of dependency graph

    const visited = new Set<string>();

    const order: string[] = [];



    const visit = (id: string) => {

      if (visited.has(id)) return;

      visited.add(id);

      const cell = this.cells.get(id);

      cell?.dependsOn.forEach(depId => visit(depId));

      order.push(id);

    };



    this.cells.forEach((_, id) => visit(id));

    return order;

  }

}



// Global singleton

export const notebook = new NotebookStore();

```

### 4.2 Component State Binding

**Pattern**: Web Components with reactive properties

```typescript

class NotebookCell extends HTMLElement {

  private _state: Cell = null;

  private unsubscribe: (() => void)[] = [];



  connectedCallback() {

    // Subscribe to cell updates

    this.unsubscribe.push(

      notebook.subscribe('cell:updated', (data) => {

        if (data.cellId === this._state.id) {

          this.render();

        }

      })

    );



    // Initial render

    this.render();

  }



  disconnectedCallback() {

    // Clean up subscriptions

    this.unsubscribe.forEach(fn => fn());

  }



  set state(cell: Cell) {

    this._state = cell;

    this.render();

  }



  get state(): Cell {

    return this._state;

  }



  private render() {

    // Update DOM based on state

    this.innerHTML = `

      <div class="cell">

        <div class="cell-header">

          ${this._state.type === 'code' ? '⚑' : 'πŸ“'} ${this._state.id}

        </div>

        <div class="cell-editor">

          ${this._state.source}

        </div>

        ${this._state.output ? `

          <div class="cell-output">

            ${this.renderOutput(this._state.output)}

          </div>

        ` : ''}

      </div>

    `;

  }



  private renderOutput(output: CellOutput): string {

    switch (output.type) {

      case 'text': return `<pre>${escapeHtml(output.data)}</pre>`;

      case 'table': return this.renderTable(output.data);

      case 'math': return `<div class="math">${output.data}</div>`;

      case 'error': return `<div class="error">${escapeHtml(output.data)}</div>`;

      default: return '';

    }

  }

}



customElements.define('notebook-cell', NotebookCell);

```

---

## 5. INTEGRATION POINTS

### 5.1 Runtime Communication

**Channel**: WebSocket or HTTP POST

```typescript

interface ExecutionRequest {

  cellId: string;

  source: string;

  language: Language;

  dependencies: string[];

  executorAgent: 'builder' | 'oracle' | 'sentinel';

}



interface ExecutionResponse {

  cellId: string;

  status: 'running' | 'success' | 'error' | 'timeout';

  output: CellOutput;

  executionTime: number;

  receiptId: string;

  wormHash: string;

}



class RuntimeBridge {

  async executeCell(req: ExecutionRequest): Promise<ExecutionResponse> {

    const response = await fetch('/api/execute', {

      method: 'POST',

      headers: { 'Content-Type': 'application/json' },

      body: JSON.stringify(req),

    });



    const data = await response.json() as ExecutionResponse;

    

    // Update notebook state

    notebook.updateCellOutput(req.cellId, data.output);

    notebook.addReceipt({

      id: data.receiptId,

      eventId: req.cellId,

      hash: data.wormHash,

      timestamp: Date.now(),

    });



    return data;

  }



  async verifyReceipt(receiptId: string): Promise<boolean> {

    const response = await fetch(`/api/verify/${receiptId}`);

    return response.ok;

  }

}



export const runtime = new RuntimeBridge();

```

### 5.2 Animation Event Hooks

```typescript

// Listen to execution events and trigger animations

notebook.subscribe('cell:executing', (cellId) => {

  executionAnimator.startCell(cellId);

});



notebook.subscribe('cell:updated', ({ cellId, output }) => {

  executionAnimator.completeCell(cellId);

  

  // Update dependent cells' incoming arrows

  const deps = notebook.getDependencyGraph();

  deps.filter(d => d.from === cellId).forEach(d => {

    executionAnimator.startArrow(cellId, d.to);

  });

});



notebook.subscribe('receipt:sealed', (receipt) => {

  receiptAnimator.addReceipt(receipt);

});

```

---

## 6. INTERACTION PATTERNS

### 6.1 Keyboard Shortcuts

| Shortcut | Action |
|----------|--------|
| `Shift+Enter` | Run current cell |
| `Ctrl+Enter` | Run and advance |
| `Ctrl+S` | Save notebook |
| `Ctrl+Z` / `Ctrl+Shift+Z` | Undo / Redo |
| `Ctrl+/` | Toggle comment |
| `Ctrl+H` | Open find/replace |
| `Ctrl+L` | Focus ledger |
| `Escape` | Exit edit mode |
| `Cmd+Click` | Multi-select cells |
| `Alt+Up/Down` | Move cell |

### 6.2 Mouse Gestures

- **Drag cell**: Reorder in notebook
- **Hover receipt**: Show full hash in tooltip
- **Right-click cell**: Context menu (delete/clone/move/seal)
- **Hover edge in graph**: Highlight dependency path
- **Click node in graph**: Jump to cell

### 6.3 Touch Gestures (Mobile)

- **Tap cell**: Enter edit mode
- **Swipe left**: Reveal delete/options
- **Pinch**: Zoom dependency graph
- **Long-press**: Context menu

---

## 7. DARK MODE & LIGHT MODE

### 7.1 Theme Variables

**Dark Theme** (default):
```css

[data-theme="dark"] {

  --color-bg-primary: #070b1e;

  --color-bg-secondary: #0f0f2e;

  --color-text-primary: #eef9ff;

  --color-accent-cyan: #7ef9ff;

}

```

**Light Theme**:
```css

[data-theme="light"] {

  --color-bg-primary: #f8f9fa;

  --color-bg-secondary: #ffffff;

  --color-text-primary: #1a1a2e;

  --color-accent-cyan: #0066cc;

}

```

### 7.2 Theme Switching

```typescript

class ThemeManager {

  static set(theme: 'dark' | 'light') {

    document.documentElement.setAttribute('data-theme', theme);

    localStorage.setItem('theme', theme);

    

    // Notify all listeners

    window.dispatchEvent(new CustomEvent('theme-changed', { detail: theme }));

  }



  static get(): 'dark' | 'light' {

    return localStorage.getItem('theme') as any || 'dark';

  }



  static auto() {

    const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;

    this.set(isDark ? 'dark' : 'light');

  }

}

```

---

## 8. PERFORMANCE OPTIMIZATION

### 8.1 Virtualization

For notebooks with 100+ cells:
- Only render visible cells in viewport
- Use `IntersectionObserver` to detect visibility
- Keep execution trace canvas at fixed size

```typescript

class VirtualNotebook {

  constructor(container: HTMLElement) {

    this.container = container;

    this.visibleRange = { start: 0, end: 10 };

    this.cellHeight = 200;

    

    this.observer = new IntersectionObserver(

      (entries) => this.updateVisibleRange(entries),

      { rootMargin: '200px' }

    );

  }



  render(cells: Cell[]) {

    const startIdx = Math.max(0, Math.floor(this.container.scrollTop / this.cellHeight) - 2);

    const endIdx = Math.min(cells.length, startIdx + 12);

    

    this.container.innerHTML = cells

      .slice(startIdx, endIdx)

      .map(cell => `<notebook-cell cell-id="${cell.id}"></notebook-cell>`)

      .join('');

  }

}

```

### 8.2 Canvas Optimization

- Use `OffscreenCanvas` for animations
- Render only changed regions
- Batch DOM updates

```javascript

class OptimizedAnimationEngine {

  constructor() {

    this.offscreen = new OffscreenCanvas(1440, 900);

    this.ctx = this.offscreen.getContext('2d');

    this.mainCanvas = document.querySelector('canvas');

  }



  render() {

    // Clear only changed regions

    this.ctx.clearRect(0, 0, 1440, 900);

    

    // Render to offscreen

    this.drawParticles();

    this.drawArrows();

    

    // Transfer to main canvas

    const bitmap = this.offscreen.convertToImageBitmap();

    const ctxMain = this.mainCanvas.getContext('2d');

    ctxMain.drawImage(bitmap, 0, 0);

  }

}

```

---

## 9. ACCESSIBILITY

### 9.1 WCAG 2.1 AA Compliance

- **Semantic HTML**: Use proper heading hierarchy
- **Color Contrast**: All text β‰₯ 4.5:1 WCAG AA ratio
- **Keyboard Navigation**: All interactive elements keyboard-accessible
- **Screen Reader Support**: ARIA labels on animations, aria-live regions for status

### 9.2 ARIA Annotations

```html

<notebook-cell role="region" aria-label="Code cell 1" aria-live="polite">

  <div class="cell-header" aria-label="Cell 1: Execute status">

    ⚑ Cell 1

  </div>

  <cell-editor aria-label="Code editor"></cell-editor>

  <button aria-label="Run cell 1" aria-controls="cell-1-output">β–Ά Run</button>

  <cell-output id="cell-1-output" aria-live="assertive" aria-atomic="true"></cell-output>

</notebook-cell>

```

---

## 10. TESTING STRATEGY

### 10.1 Unit Tests (Vitest)

```typescript

// test/components/notebook-cell.test.ts

import { describe, it, expect } from 'vitest';

import { NotebookCell } from '../../src/components/notebook-cell';



describe('NotebookCell', () => {

  it('renders cell with code content', () => {

    const cell = document.createElement('notebook-cell');

    cell.state = {

      id: 'test-1',

      type: 'code',

      language: 'python',

      source: 'print("hello")',

      output: null,

      dependsOn: [],

      metadata: { createdAt: Date.now() },

    };

    

    expect(cell.innerHTML).toContain('print("hello")');

  });



  it('displays output when available', () => {

    const cell = document.createElement('notebook-cell');

    cell.state = {

      id: 'test-2',

      type: 'code',

      output: { type: 'text', data: 'hello' },

      // ... other props

    };

    

    expect(cell.innerHTML).toContain('hello');

  });

});

```

### 10.2 Integration Tests

```typescript

// test/integration/execution-flow.test.ts

import { notebook, runtime } from '../../src';



describe('Execution Flow', () => {

  it('executes cell and updates receipt ledger', async () => {

    const cell: Cell = {

      id: 'int-test-1',

      type: 'code',

      language: 'python',

      source: 'x = 42',

      output: null,

      dependsOn: [],

      metadata: { createdAt: Date.now() },

    };



    notebook.addCell(cell);

    const response = await runtime.executeCell({

      cellId: 'int-test-1',

      source: 'x = 42',

      language: 'python',

      dependencies: [],

      executorAgent: 'builder',

    });



    expect(response.status).toBe('success');

    expect(notebook.state.receipts.length).toBe(1);

  });

});

```

---

## 11. COMPONENT HIERARCHY

```

notebook-container

β”œβ”€β”€ notebook-header

β”‚   β”œβ”€β”€ notebook-title (editable)

β”‚   β”œβ”€β”€ execution-controls (run/interrupt/save)

β”‚   β”œβ”€β”€ export-menu

β”‚   └── theme-switcher

β”œβ”€β”€ notebook-toolbar

β”‚   β”œβ”€β”€ language-selector

β”‚   β”œβ”€β”€ cell-add-button

β”‚   └── search-bar

β”œβ”€β”€ notebook-layout (3-column grid)

β”‚   β”œβ”€β”€ notebook-sidebar

β”‚   β”‚   β”œβ”€β”€ notebook-info

β”‚   β”‚   β”œβ”€β”€ cell-list (virtualized)

β”‚   β”‚   β”œβ”€β”€ dependency-graph-mini

β”‚   β”‚   └── trust-policies

β”‚   β”œβ”€β”€ notebook-editor-area

β”‚   β”‚   β”œβ”€β”€ execution-trace-overlay (canvas)

β”‚   β”‚   └── notebook-cells (virtualized list)

β”‚   β”‚       β”œβ”€β”€ notebook-cell (repeated)

β”‚   β”‚       β”‚   β”œβ”€β”€ cell-header

β”‚   β”‚       β”‚   β”œβ”€β”€ cell-editor

β”‚   β”‚       β”‚   β”œβ”€β”€ cell-controls

β”‚   β”‚       β”‚   └── cell-output

β”‚   β”‚       └── cell-separator

β”‚   └── worm-ledger

β”‚       β”œβ”€β”€ ledger-header

β”‚       β”œβ”€β”€ receipt-list (scrollable)

β”‚       β”‚   β”œβ”€β”€ receipt-item (repeated)

β”‚       β”‚   β”‚   β”œβ”€β”€ receipt-header

β”‚       β”‚   β”‚   β”œβ”€β”€ receipt-details (collapsible)

β”‚       β”‚   β”‚   └── receipt-actions

β”‚       β”‚   └── load-more-button

β”‚       └── ledger-filter

β”œβ”€β”€ dependency-graph-viewer (modal, full-screen)

β”‚   β”œβ”€β”€ graph-canvas

β”‚   β”œβ”€β”€ graph-legend

β”‚   └── graph-controls

└── notebook-footer

    β”œβ”€β”€ execution-stats

    β”œβ”€β”€ cell-count

    β”œβ”€β”€ runtime-status

    └── connection-indicator

```

---

## 12. DEVELOPMENT ROADMAP

### Phase 1: Foundation (Week 1-2)
- [ ] Web Component definitions (base classes)
- [ ] CSS architecture and design tokens
- [ ] Dark/light theme support
- [ ] Responsive layout (desktop + mobile)

### Phase 2: Core Components (Week 3-4)
- [ ] Cell editor with syntax highlighting
- [ ] Cell output display (text, table, error)
- [ ] Sidebar with metadata browser
- [ ] WORM ledger viewer

### Phase 3: Animation Engine (Week 5-6)
- [ ] Execution flow animation (Canvas)
- [ ] Dependency graph visualization (D3)
- [ ] Receipt chain animation
- [ ] Unicode glyph particles

### Phase 4: State & Integration (Week 7-8)
- [ ] Reactive state management
- [ ] Runtime communication bridge
- [ ] Keyboard/mouse interactions
- [ ] Error handling and recovery

### Phase 5: Polish & Testing (Week 9-10)
- [ ] Performance optimization (virtualization)
- [ ] Accessibility audit (WCAG 2.1 AA)
- [ ] Unit tests (80%+ coverage)
- [ ] Integration tests
- [ ] End-to-end tests

### Phase 6: Deployment (Week 11-12)
- [ ] Production build and optimization
- [ ] Performance monitoring
- [ ] Browser compatibility testing
- [ ] Documentation and examples

---

## 13. FILE STRUCTURE

```

frontend/

β”œβ”€β”€ index.html                      # Entry point

β”œβ”€β”€ styles/

β”‚   β”œβ”€β”€ global.css

β”‚   β”œβ”€β”€ variables.css              # Design tokens

β”‚   β”œβ”€β”€ animations.css

β”‚   β”œβ”€β”€ layout.css

β”‚   β”œβ”€β”€ theme/

β”‚   β”‚   β”œβ”€β”€ dark.css

β”‚   β”‚   └── light.css

β”‚   └── components/

β”‚       β”œβ”€β”€ notebook-cell.css

β”‚       β”œβ”€β”€ cell-editor.css

β”‚       β”œβ”€β”€ cell-output.css

β”‚       β”œβ”€β”€ notebook-sidebar.css

β”‚       β”œβ”€β”€ worm-ledger.css

β”‚       └── execution-trace.css

β”œβ”€β”€ src/

β”‚   β”œβ”€β”€ index.ts                   # App entry

β”‚   β”œβ”€β”€ store/

β”‚   β”‚   β”œβ”€β”€ notebook.store.ts      # Reactive state

β”‚   β”‚   └── theme.store.ts

β”‚   β”œβ”€β”€ components/

β”‚   β”‚   β”œβ”€β”€ notebook-container.ts

β”‚   β”‚   β”œβ”€β”€ notebook-cell.ts

β”‚   β”‚   β”œβ”€β”€ cell-editor.ts

β”‚   β”‚   β”œβ”€β”€ cell-output.ts

β”‚   β”‚   β”œβ”€β”€ notebook-sidebar.ts

β”‚   β”‚   β”œβ”€β”€ worm-ledger.ts

β”‚   β”‚   └── notebook-header.ts

β”‚   β”œβ”€β”€ animation/

β”‚   β”‚   β”œβ”€β”€ execution-flow.ts

β”‚   β”‚   β”œβ”€β”€ dependency-graph.ts

β”‚   β”‚   β”œβ”€β”€ receipt-chain.ts

β”‚   β”‚   β”œβ”€β”€ unicode-glyphs.ts

β”‚   β”‚   └── crypto-seal.ts

β”‚   β”œβ”€β”€ services/

β”‚   β”‚   β”œβ”€β”€ runtime-bridge.ts      # API client

β”‚   β”‚   β”œβ”€β”€ theme-manager.ts

β”‚   β”‚   └── keyboard-handler.ts

β”‚   β”œβ”€β”€ types/

β”‚   β”‚   β”œβ”€β”€ cell.ts

β”‚   β”‚   β”œβ”€β”€ receipt.ts

β”‚   β”‚   └── execution.ts

β”‚   └── utils/

β”‚       β”œβ”€β”€ dom-utils.ts

β”‚       β”œβ”€β”€ animation-utils.ts

β”‚       └── format-utils.ts

β”œβ”€β”€ test/

β”‚   β”œβ”€β”€ components/

β”‚   β”‚   └── notebook-cell.test.ts

β”‚   β”œβ”€β”€ animation/

β”‚   β”‚   └── execution-flow.test.ts

β”‚   β”œβ”€β”€ integration/

β”‚   β”‚   └── execution-flow.test.ts

β”‚   └── e2e/

β”‚       └── notebook.spec.ts

β”œβ”€β”€ vitest.config.ts

β”œβ”€β”€ tsconfig.json

β”œβ”€β”€ package.json

└── README.md

```

---

## 14. KEY DESIGN DECISIONS

| Decision | Rationale |
|----------|-----------|
| **Web Components** (not React/Vue) | Lightweight, framework-agnostic, WASM-ready |
| **Canvas animations** | Better performance than DOM for particle systems |
| **CSS Variables for theming** | Dynamic theme switching without JS overhead |
| **D3 for graphs** | Mature, battle-tested force-directed layout |
| **Event emitter pattern** | Simple, explicit, easy to debug |
| **Virtualization for large notebooks** | Handle 1000+ cells efficiently |
| **Dark mode primary** | Sovereign aesthetic, reduced eye strain |
| **WCAG 2.1 AA from start** | Accessibility is not an afterthought |
| **TypeScript throughout** | Type safety, better IDE support, self-documenting |
| **Monospace Unicode symbols** | Aesthetic + semantic meaning for glyphs |

---

## 15. SUCCESS METRICS

- **Performance**: Animation frame rate β‰₯ 60fps (Cell 6 animation engine)
- **Responsiveness**: Cell execution trace appears within 100ms
- **Accessibility**: 100% keyboard navigable, 0 WCAG AA violations
- **Code Quality**: β‰₯80% test coverage, <10 code smells
- **User Experience**: Task completion time ≀ 5 minutes for common workflows

---

## APPENDIX A: SVG Animation Examples

See: `/WORM.svg` and `rowm_worm_morphing_notebook.svg` for reference animations

### WORM.svg Features:
- Rotating dashed border frame
- Animated Unicode streams (bidirectional)
- Particle glyph markers
- Notebook container with grid background
- Sealed cryptographic stamp
- Matrix-like aesthetic

---

## APPENDIX B: Integration with Isomorphic Shift Layer

The UI bridges the notebook to the formal isomorphic shift system:

```

User Input (EmojiCode cell)

         ↓

    M1: SurfaceInstruction β†’ CanonicalInstruction [UI renders this]

         ↓

    M2: CanonicalInstruction β†’ LogicTerm [UI queries from store]

         ↓

    M3: AuthorizedLogicDecision β†’ RuntimeCommand [Animation triggers]

         ↓

   EXECUTION [Receipt LED indicator shows "running"]

         ↓

    M5: ExecutionEvent β†’ LogicEventFact [Animation completes]

         ↓

    M6: ExecutionEvent β†’ ReceiptRecord [WORM ledger updates]

         ↓

User sees: Output + Receipt + Seal animation

```

The UI is **purely presentational** β€” all authority/verification/sealing happens in the backend Prolog + Rust layer.

---

**Document Finalized**: 2026-07-27 14:30 UTC  
**Next Review**: After Phase 1 completion