crewbus 11.4.0 → 11.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +2 -2
- package/bin/lib/web.js +1903 -1705
- package/docs/APPROVALS.md +11 -0
- package/documentation.html +4 -3
- package/index.html +3 -3
- package/package.json +1 -1
package/bin/lib/web.js
CHANGED
|
@@ -418,1711 +418,1909 @@ export async function handleApiApprove(d, body) {
|
|
|
418
418
|
// (a meta-refresh page would wipe the identity form). Kill posts JSON to
|
|
419
419
|
// /api/kill with the stored from+token. Embedded JS avoids backticks and
|
|
420
420
|
// ${} so the outer template literal needs no escaping.
|
|
421
|
-
export function renderBoardHtml(boardPath) {
|
|
422
|
-
const e = escapeHtml;
|
|
423
|
-
return `<!DOCTYPE html>
|
|
424
|
-
<html lang="en"
|
|
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
|
-
<div id="
|
|
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
|
-
<div
|
|
919
|
-
|
|
920
|
-
<div
|
|
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
|
-
var
|
|
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
|
-
var
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
var
|
|
1340
|
-
if(!
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
var
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
html+='</
|
|
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
|
-
var j
|
|
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
|
-
var
|
|
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
|
-
|
|
1511
|
-
|
|
1512
|
-
var
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
function
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
if(
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
function
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
{
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
{
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
}
|
|
1652
|
-
function
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
var
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
var
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
var
|
|
1734
|
-
if(
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
html+='</
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
var
|
|
1773
|
-
|
|
1774
|
-
var
|
|
1775
|
-
var
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
(
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
document.
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
});
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1924
|
-
var
|
|
1925
|
-
if(
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
var
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
}
|
|
2029
|
-
var
|
|
2030
|
-
if(
|
|
2031
|
-
|
|
2032
|
-
if(
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
}
|
|
2075
|
-
});
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
}
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
421
|
+
export function renderBoardHtml(boardPath) {
|
|
422
|
+
const e = escapeHtml;
|
|
423
|
+
return `<!DOCTYPE html>
|
|
424
|
+
<html lang="en">
|
|
425
|
+
<head>
|
|
426
|
+
<meta charset="utf-8">
|
|
427
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
428
|
+
<title>crewbus — ${e(boardPath)}</title>
|
|
429
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
430
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
431
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
432
|
+
<style>
|
|
433
|
+
:root {
|
|
434
|
+
--bg: #0d1117;
|
|
435
|
+
--sidebar-bg: #090d13;
|
|
436
|
+
--panel: #161b22;
|
|
437
|
+
--panel-elevated: #1b2129;
|
|
438
|
+
--panel-hover: #212833;
|
|
439
|
+
--panel-active: #28313e;
|
|
440
|
+
--ink: #e6edf3;
|
|
441
|
+
--dim: #8b949e;
|
|
442
|
+
--dim-light: #6e7681;
|
|
443
|
+
--acc: #238636;
|
|
444
|
+
--acc-hover: #2ea043;
|
|
445
|
+
--acc-subtle: rgba(46, 160, 67, 0.14);
|
|
446
|
+
--acc-ink: #ffffff;
|
|
447
|
+
--ok: #2ea043;
|
|
448
|
+
--warn: #d29922;
|
|
449
|
+
--warn-bg: rgba(210, 153, 34, 0.1);
|
|
450
|
+
--danger: #f85149;
|
|
451
|
+
--danger-bg: rgba(248, 81, 73, 0.1);
|
|
452
|
+
--line: rgba(255, 255, 255, 0.08);
|
|
453
|
+
--line-light: rgba(255, 255, 255, 0.14);
|
|
454
|
+
--code: #090d13;
|
|
455
|
+
--code-ink: #e6edf3;
|
|
456
|
+
--code-dim: #7d8590;
|
|
457
|
+
--sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
458
|
+
--mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
459
|
+
--radius-sm: 4px;
|
|
460
|
+
--radius-md: 6px;
|
|
461
|
+
--radius-lg: 8px;
|
|
462
|
+
--scroll: rgba(255, 255, 255, 0.14);
|
|
463
|
+
--scroll-hi: rgba(255, 255, 255, 0.28);
|
|
464
|
+
}
|
|
465
|
+
:root[data-theme="light"] {
|
|
466
|
+
--bg: #f6f8fa;
|
|
467
|
+
--sidebar-bg: #ffffff;
|
|
468
|
+
--panel: #ffffff;
|
|
469
|
+
--panel-elevated: #f6f8fa;
|
|
470
|
+
--panel-hover: #f3f4f6;
|
|
471
|
+
--panel-active: #e5e7eb;
|
|
472
|
+
--ink: #1f2328;
|
|
473
|
+
--dim: #656d76;
|
|
474
|
+
--dim-light: #8c959f;
|
|
475
|
+
--acc: #1a7f37;
|
|
476
|
+
--acc-hover: #146c2e;
|
|
477
|
+
--acc-subtle: rgba(26, 127, 55, 0.1);
|
|
478
|
+
--acc-ink: #ffffff;
|
|
479
|
+
--ok: #1a7f37;
|
|
480
|
+
--warn: #9a6700;
|
|
481
|
+
--warn-bg: rgba(154, 103, 0, 0.08);
|
|
482
|
+
--danger: #cf222e;
|
|
483
|
+
--danger-bg: rgba(207, 34, 46, 0.08);
|
|
484
|
+
--line: #d0d7de;
|
|
485
|
+
--line-light: #afb8c1;
|
|
486
|
+
--code: #f6f8fa;
|
|
487
|
+
--code-ink: #1f2328;
|
|
488
|
+
--code-dim: #656d76;
|
|
489
|
+
--scroll: rgba(0, 0, 0, 0.16);
|
|
490
|
+
--scroll-hi: rgba(0, 0, 0, 0.32);
|
|
491
|
+
}
|
|
492
|
+
@media (prefers-color-scheme: light) {
|
|
493
|
+
:root:not([data-theme="dark"]) {
|
|
494
|
+
--bg: #f6f8fa;
|
|
495
|
+
--sidebar-bg: #ffffff;
|
|
496
|
+
--panel: #ffffff;
|
|
497
|
+
--panel-elevated: #f6f8fa;
|
|
498
|
+
--panel-hover: #f3f4f6;
|
|
499
|
+
--panel-active: #e5e7eb;
|
|
500
|
+
--ink: #1f2328;
|
|
501
|
+
--dim: #656d76;
|
|
502
|
+
--dim-light: #8c959f;
|
|
503
|
+
--acc: #1a7f37;
|
|
504
|
+
--acc-hover: #146c2e;
|
|
505
|
+
--acc-subtle: rgba(26, 127, 55, 0.1);
|
|
506
|
+
--acc-ink: #ffffff;
|
|
507
|
+
--ok: #1a7f37;
|
|
508
|
+
--warn: #9a6700;
|
|
509
|
+
--warn-bg: rgba(154, 103, 0, 0.08);
|
|
510
|
+
--danger: #cf222e;
|
|
511
|
+
--danger-bg: rgba(207, 34, 46, 0.08);
|
|
512
|
+
--line: #d0d7de;
|
|
513
|
+
--line-light: #afb8c1;
|
|
514
|
+
--code: #f6f8fa;
|
|
515
|
+
--code-ink: #1f2328;
|
|
516
|
+
--code-dim: #656d76;
|
|
517
|
+
--scroll: rgba(0, 0, 0, 0.16);
|
|
518
|
+
--scroll-hi: rgba(0, 0, 0, 0.32);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
* { box-sizing: border-box; }
|
|
522
|
+
body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 13px/1.5 var(--sans); overflow: hidden; height: 100vh; -webkit-font-smoothing: antialiased; }
|
|
523
|
+
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
|
|
524
|
+
::-webkit-scrollbar { width: 6px; height: 6px; }
|
|
525
|
+
::-webkit-scrollbar-track { background: transparent; }
|
|
526
|
+
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 99px; }
|
|
527
|
+
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hi); }
|
|
528
|
+
|
|
529
|
+
#app-shell { display: flex; height: 100vh; width: 100vw; overflow: hidden; }
|
|
530
|
+
|
|
531
|
+
/* 1. Left Sidebar */
|
|
532
|
+
#app-sidebar {
|
|
533
|
+
width: 260px; min-width: 260px; background: var(--sidebar-bg);
|
|
534
|
+
border-right: 1px solid var(--line); display: flex; flex-direction: column;
|
|
535
|
+
height: 100vh; z-index: 20; user-select: none;
|
|
536
|
+
}
|
|
537
|
+
.sidebar-project { padding: 12px; border-bottom: 1px solid var(--line); position: relative; }
|
|
538
|
+
.project-card {
|
|
539
|
+
display: flex; align-items: center; gap: 8px; padding: 7px 10px;
|
|
540
|
+
background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
|
|
541
|
+
cursor: pointer; transition: background .12s ease, border-color .12s ease;
|
|
542
|
+
}
|
|
543
|
+
.project-card:hover { border-color: var(--line-light); background: var(--panel-hover); }
|
|
544
|
+
.project-icon { display: flex; align-items: center; justify-content: center; color: var(--dim); flex-shrink: 0; }
|
|
545
|
+
.project-info { min-width: 0; flex: 1; }
|
|
546
|
+
.project-title { font-weight: 600; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
547
|
+
.project-path { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); }
|
|
548
|
+
.project-arrow { color: var(--dim); display: flex; align-items: center; }
|
|
549
|
+
|
|
550
|
+
#project-popover {
|
|
551
|
+
position: absolute; top: calc(100% + 4px); left: 12px; right: 12px;
|
|
552
|
+
background: var(--panel); border: 1px solid var(--line-light); border-radius: var(--radius-sm);
|
|
553
|
+
box-shadow: 0 12px 28px rgba(0,0,0,0.4); padding: 12px; z-index: 100; display: none;
|
|
554
|
+
}
|
|
555
|
+
#project-popover.open { display: block; }
|
|
556
|
+
.pop-label { font-size: 10px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
|
|
557
|
+
.pop-path { font-family: var(--mono); font-size: 11px; background: var(--code); padding: 5px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); word-break: break-all; margin-bottom: 8px; color: var(--code-ink); }
|
|
558
|
+
.pop-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 4px; }
|
|
559
|
+
|
|
560
|
+
.sidebar-action-wrap { padding: 10px 12px 6px; }
|
|
561
|
+
.btn-new-task {
|
|
562
|
+
width: 100%; display: flex; align-items: center; justify-content: space-between;
|
|
563
|
+
background: var(--panel-elevated); color: var(--ink);
|
|
564
|
+
font-weight: 500; font-size: 12.5px; border: 1px solid var(--line); border-radius: var(--radius-sm);
|
|
565
|
+
padding: 7px 10px; cursor: pointer; transition: background .12s ease, border-color .12s ease;
|
|
566
|
+
}
|
|
567
|
+
.btn-new-task:hover { background: var(--panel-hover); border-color: var(--line-light); }
|
|
568
|
+
.btn-new-task kbd { font-size: 10px; background: var(--panel); border: 1px solid var(--line); padding: 1px 4px; border-radius: 3px; font-family: var(--mono); color: var(--dim); }
|
|
569
|
+
|
|
570
|
+
.sidebar-heading { font-size: 10.5px; font-weight: 600; color: var(--dim-light); text-transform: uppercase; letter-spacing: 0.7px; padding: 12px 14px 4px; }
|
|
571
|
+
.sidebar-thread-list { padding: 0 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
|
|
572
|
+
.thread-row {
|
|
573
|
+
display: flex; flex-direction: column; gap: 2px; padding: 7px 10px; border-radius: var(--radius-sm);
|
|
574
|
+
cursor: pointer; transition: background .12s ease; border: 1px solid transparent;
|
|
575
|
+
}
|
|
576
|
+
.thread-row:hover { background: var(--panel-hover); }
|
|
577
|
+
.thread-row.active { background: var(--panel-active); border-color: var(--line); }
|
|
578
|
+
.thread-row-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
|
|
579
|
+
.thread-title { font-weight: 500; font-size: 12.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
|
|
580
|
+
.thread-time { font-size: 10.5px; color: var(--dim); flex-shrink: 0; }
|
|
581
|
+
.thread-meta { font-size: 11px; color: var(--dim); display: flex; align-items: center; gap: 6px; }
|
|
582
|
+
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); display: inline-block; }
|
|
583
|
+
.status-dot.active { background: var(--ok); }
|
|
584
|
+
.status-dot.waiting { background: var(--warn); }
|
|
585
|
+
|
|
586
|
+
/* Left Navigation Tabs */
|
|
587
|
+
#approot-nav { padding: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
|
|
588
|
+
#approot-nav button {
|
|
589
|
+
display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
|
|
590
|
+
background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
|
|
591
|
+
color: var(--dim); padding: 6px 9px; font-size: 12px; cursor: pointer; transition: background .12s ease, color .12s ease;
|
|
592
|
+
}
|
|
593
|
+
#approot-nav button:hover { background: var(--panel-hover); color: var(--ink); }
|
|
594
|
+
#approot-nav button.active { background: var(--panel); border-color: var(--line); color: var(--ink); font-weight: 500; }
|
|
595
|
+
#approot-nav button .nav-ic { color: var(--dim); flex-shrink: 0; }
|
|
596
|
+
#approot-nav button.active .nav-ic { color: var(--acc); }
|
|
597
|
+
|
|
598
|
+
.sidebar-footer { padding: 9px 12px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--dim); }
|
|
599
|
+
.identity-badge { display: flex; align-items: center; gap: 6px; cursor: pointer; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
600
|
+
|
|
601
|
+
/* 2. Main Stage */
|
|
602
|
+
#app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: var(--bg); }
|
|
603
|
+
#approot-topbar {
|
|
604
|
+
height: 48px; min-height: 48px; background: var(--panel);
|
|
605
|
+
border-bottom: 1px solid var(--line); display: flex; align-items: center;
|
|
606
|
+
justify-content: space-between; padding: 0 16px; gap: 14px; z-index: 10;
|
|
607
|
+
}
|
|
608
|
+
.topbar-left { display: flex; align-items: center; gap: 10px; font-size: 13px; }
|
|
609
|
+
.thread-header-title { font-weight: 600; color: var(--ink); font-size: 13.5px; }
|
|
610
|
+
.thread-header-badge { font-size: 11px; padding: 2px 7px; border-radius: 3px; background: var(--panel-elevated); border: 1px solid var(--line); color: var(--dim); }
|
|
611
|
+
|
|
612
|
+
.palette-btn {
|
|
613
|
+
display: flex; align-items: center; gap: 8px; background: var(--bg);
|
|
614
|
+
border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 5px 12px;
|
|
615
|
+
color: var(--dim); font-size: 12px; cursor: pointer; transition: border-color .12s ease, background .12s ease;
|
|
616
|
+
max-width: 280px; width: 100%;
|
|
617
|
+
}
|
|
618
|
+
.palette-btn:hover { border-color: var(--line-light); color: var(--ink); background: var(--panel-hover); }
|
|
619
|
+
.palette-btn kbd { margin-left: auto; font-size: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; color: var(--dim); font-family: var(--mono); }
|
|
620
|
+
|
|
621
|
+
.topbar-right { display: flex; align-items: center; gap: 8px; }
|
|
622
|
+
.conn-indicator { display: flex; align-items: center; gap: 6px; font-size: 11px; }
|
|
623
|
+
#conn-dot { font-size: 12px; color: var(--dim); }
|
|
624
|
+
#conn-dot svg { display: block; }
|
|
625
|
+
|
|
626
|
+
/* View Container */
|
|
627
|
+
#view-container { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
|
|
628
|
+
.approot-hidden { display: none !important; }
|
|
629
|
+
|
|
630
|
+
/* The Dedicated Chat / Session Stage */
|
|
631
|
+
#chat-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
|
|
632
|
+
#brief-thread {
|
|
633
|
+
flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/* Chat Message Cards */
|
|
637
|
+
.chat-msg {
|
|
638
|
+
display: flex; flex-direction: column; gap: 6px; max-width: 860px; width: 100%; margin: 0 auto;
|
|
639
|
+
}
|
|
640
|
+
.chat-msg-header {
|
|
641
|
+
display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--dim);
|
|
642
|
+
}
|
|
643
|
+
.chat-msg-author { font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 5px; }
|
|
644
|
+
.chat-msg-card {
|
|
645
|
+
background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
|
|
646
|
+
padding: 14px 16px; box-shadow: none; font-size: 13px; line-height: 1.6;
|
|
647
|
+
}
|
|
648
|
+
.chat-msg-user .chat-msg-card {
|
|
649
|
+
background: var(--panel-elevated); border-color: var(--line-light);
|
|
650
|
+
}
|
|
651
|
+
.chat-msg-tags { display: flex; gap: 6px; margin-top: 10px; }
|
|
652
|
+
.chat-tag { font-size: 11px; padding: 2px 7px; border-radius: 3px; background: var(--bg); border: 1px solid var(--line); color: var(--dim); font-family: var(--mono); }
|
|
653
|
+
|
|
654
|
+
/* Inline Approval Card */
|
|
655
|
+
.chat-approval-card {
|
|
656
|
+
background: var(--warn-bg); border: 1px solid rgba(210, 153, 34, 0.35);
|
|
657
|
+
border-radius: var(--radius-sm); padding: 14px 16px; margin: 4px 0;
|
|
658
|
+
}
|
|
659
|
+
.chat-approval-head {
|
|
660
|
+
display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
|
|
661
|
+
}
|
|
662
|
+
.chat-approval-title { font-weight: 600; color: var(--warn); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
|
|
663
|
+
.chat-approval-cmd {
|
|
664
|
+
font-family: var(--mono); font-size: 12px; background: var(--code);
|
|
665
|
+
padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
|
|
666
|
+
color: var(--code-ink); margin: 8px 0; word-break: break-all;
|
|
667
|
+
}
|
|
668
|
+
.chat-approval-actions {
|
|
669
|
+
display: flex; align-items: center; gap: 8px; margin-top: 10px;
|
|
670
|
+
}
|
|
671
|
+
.chat-approval-actions input { flex: 1; font-size: 12px; }
|
|
672
|
+
|
|
673
|
+
/* Welcome / Empty Stage */
|
|
674
|
+
.chat-empty-stage {
|
|
675
|
+
max-width: 640px; margin: 40px auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px;
|
|
676
|
+
}
|
|
677
|
+
.chat-empty-title { font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.3px; }
|
|
678
|
+
.chat-empty-subtitle { font-size: 13.5px; color: var(--dim); line-height: 1.5; max-width: 480px; }
|
|
679
|
+
.chat-suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 10px; text-align: left; }
|
|
680
|
+
.suggestion-card {
|
|
681
|
+
background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
|
|
682
|
+
padding: 10px 12px; cursor: pointer; transition: all .12s ease;
|
|
683
|
+
}
|
|
684
|
+
.suggestion-card:hover { border-color: var(--line-light); background: var(--panel-hover); }
|
|
685
|
+
.suggestion-card b { font-size: 12.5px; color: var(--ink); display: block; margin-bottom: 3px; }
|
|
686
|
+
.suggestion-card span { font-size: 11.5px; color: var(--dim); }
|
|
687
|
+
|
|
688
|
+
/* Bottom Sticky Composer */
|
|
689
|
+
#chat-composer-wrap {
|
|
690
|
+
padding: 12px 24px 18px; background: var(--bg); border-top: 1px solid var(--line); z-index: 15;
|
|
691
|
+
}
|
|
692
|
+
.composer-box {
|
|
693
|
+
max-width: 860px; margin: 0 auto; background: var(--panel);
|
|
694
|
+
border: 1px solid var(--line-light); border-radius: var(--radius-sm);
|
|
695
|
+
padding: 10px 14px 10px; display: flex; flex-direction: column; gap: 8px;
|
|
696
|
+
}
|
|
697
|
+
.composer-box:focus-within { border-color: var(--dim); }
|
|
698
|
+
#launch-brief {
|
|
699
|
+
width: 100%; box-sizing: border-box; background: transparent;
|
|
700
|
+
border: none; outline: none; padding: 4px 0 6px; font-size: 13.5px;
|
|
701
|
+
line-height: 1.55; resize: vertical; min-height: 60px; max-height: 240px; color: var(--ink);
|
|
702
|
+
font-family: inherit;
|
|
703
|
+
}
|
|
704
|
+
.composer-toolbar {
|
|
705
|
+
display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
|
|
706
|
+
padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px;
|
|
707
|
+
}
|
|
708
|
+
.composer-toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
709
|
+
.composer-toolbar-right { display: flex; align-items: center; gap: 8px; }
|
|
710
|
+
|
|
711
|
+
/* Harness Pills */
|
|
712
|
+
.harness-pills { display: flex; gap: 5px; flex-wrap: wrap; }
|
|
713
|
+
.harness-card {
|
|
714
|
+
padding: 4px 9px; font-size: 11.5px; background: var(--panel-elevated);
|
|
715
|
+
border: 1px solid var(--line); border-radius: var(--radius-sm);
|
|
716
|
+
cursor: pointer; transition: all .12s ease; user-select: none; color: var(--dim);
|
|
717
|
+
}
|
|
718
|
+
.harness-card:hover { border-color: var(--line-light); color: var(--ink); }
|
|
719
|
+
.harness-card.sel { border-color: var(--acc); background: var(--acc-subtle); color: var(--ink); font-weight: 500; }
|
|
720
|
+
.harness-card.missing { opacity: .5; }
|
|
721
|
+
|
|
722
|
+
.stepper-wrap {
|
|
723
|
+
display: inline-flex; align-items: center; border: 1px solid var(--line);
|
|
724
|
+
border-radius: var(--radius-sm); overflow: hidden; background: var(--panel-elevated);
|
|
725
|
+
}
|
|
726
|
+
.stepper-wrap button { border: none; border-radius: 0; padding: 3px 7px; background: transparent; font-weight: bold; cursor: pointer; }
|
|
727
|
+
.stepper-wrap input { border: none; text-align: center; background: transparent; padding: 3px 0; font-weight: 600; width: 28px; font-size: 11.5px; color: var(--ink); }
|
|
728
|
+
|
|
729
|
+
#launch-permission-seg { display: inline-flex; gap: 1px; background: var(--panel-elevated); padding: 2px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
|
|
730
|
+
#launch-permission-seg button { border: none; background: transparent; padding: 2px 7px; font-size: 11px; border-radius: 2px; color: var(--dim); cursor: pointer; }
|
|
731
|
+
#launch-permission-seg button.sel { background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-weight: 500; }
|
|
732
|
+
|
|
733
|
+
.btn-launch {
|
|
734
|
+
background: var(--acc) !important; color: #ffffff !important;
|
|
735
|
+
font-weight: 500 !important; border: 1px solid var(--acc) !important;
|
|
736
|
+
padding: 6px 16px !important; font-size: 12.5px !important; border-radius: var(--radius-sm) !important;
|
|
737
|
+
cursor: pointer !important; transition: background .12s ease, border-color .12s ease !important;
|
|
738
|
+
}
|
|
739
|
+
.btn-launch:hover { background: var(--acc-hover) !important; border-color: var(--acc-hover) !important; }
|
|
740
|
+
|
|
741
|
+
/* Standard Section Views (Crews, Fleet, Channels, etc.) */
|
|
742
|
+
.standard-view { flex: 1; overflow-y: auto; padding: 20px 28px 80px; }
|
|
743
|
+
h1 { font-size: 18px; font-weight: 600; margin: 0 0 14px; color: var(--ink); letter-spacing: -0.2px; }
|
|
744
|
+
h2 { font-size: 14px; font-weight: 600; margin: 20px 0 10px; color: var(--ink); display: flex; align-items: center; justify-content: space-between; }
|
|
745
|
+
.dim { color: var(--dim); font-size: 12px; }
|
|
746
|
+
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
|
|
747
|
+
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: none; }
|
|
748
|
+
.card b { font-size: 18px; font-weight: 600; color: var(--ink); display: block; margin-top: 4px; font-family: var(--mono); }
|
|
749
|
+
|
|
750
|
+
table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 10px 0 20px; font-size: 12.5px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; box-shadow: none; }
|
|
751
|
+
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
|
|
752
|
+
th { background: var(--panel-elevated); color: var(--dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
|
|
753
|
+
tr:last-child td { border-bottom: none; }
|
|
754
|
+
tr.worker-row { cursor: pointer; transition: background .12s ease; }
|
|
755
|
+
tr.worker-row:hover td { background: var(--panel-hover); }
|
|
756
|
+
|
|
757
|
+
input, textarea, select {
|
|
758
|
+
background: var(--panel); border: 1px solid var(--line); color: var(--ink);
|
|
759
|
+
border-radius: var(--radius-sm); padding: 6px 10px; font-size: 12.5px;
|
|
760
|
+
font-family: inherit; transition: border-color .12s ease;
|
|
761
|
+
}
|
|
762
|
+
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--line-light); box-shadow: none; }
|
|
763
|
+
button {
|
|
764
|
+
background: var(--panel); border: 1px solid var(--line); color: var(--ink);
|
|
765
|
+
border-radius: var(--radius-sm); padding: 5px 12px; font-size: 12px;
|
|
766
|
+
cursor: pointer; transition: background .12s ease, border-color .12s ease; font-family: inherit; font-weight: 500;
|
|
767
|
+
}
|
|
768
|
+
button:hover { border-color: var(--line-light); background: var(--panel-hover); color: var(--ink); }
|
|
769
|
+
button.btn-primary { background: var(--acc); color: var(--acc-ink); border: 1px solid var(--acc); font-weight: 500; }
|
|
770
|
+
button.btn-primary:hover { background: var(--acc-hover); border-color: var(--acc-hover); }
|
|
771
|
+
button.danger { border: 1px solid rgba(248, 81, 73, 0.3); color: var(--danger); background: transparent; }
|
|
772
|
+
button.danger:hover { border-color: var(--danger); background: var(--danger-bg); }
|
|
773
|
+
button:disabled { opacity: .45; cursor: default; }
|
|
774
|
+
|
|
775
|
+
.log {
|
|
776
|
+
font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap;
|
|
777
|
+
background: var(--code); padding: 12px 14px; border-radius: var(--radius-sm);
|
|
778
|
+
border: 1px solid var(--line); color: var(--code-ink); max-height: 280px; overflow-y: auto; line-height: 1.6;
|
|
779
|
+
}
|
|
780
|
+
#launch-out:empty, #launch-diff:empty { display: none; }
|
|
781
|
+
|
|
782
|
+
/* Right Inspector */
|
|
783
|
+
#app-inspector {
|
|
784
|
+
width: 340px; min-width: 340px; background: var(--sidebar-bg);
|
|
785
|
+
border-left: 1px solid var(--line); display: flex; flex-direction: column;
|
|
786
|
+
height: 100vh; overflow-y: auto; padding: 16px; z-index: 10;
|
|
787
|
+
}
|
|
788
|
+
#app-inspector.hidden { display: none; }
|
|
789
|
+
#inspector { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; box-shadow: none; }
|
|
790
|
+
|
|
791
|
+
/* Command Palette Modal */
|
|
792
|
+
#palette { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 100; display: none; padding: 15vh 20px 20px; }
|
|
793
|
+
#palette.open { display: block; }
|
|
794
|
+
#palette-box { max-width: 560px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line-light); border-radius: var(--radius-sm); box-shadow: 0 16px 36px rgba(0,0,0,0.5); padding: 12px; }
|
|
795
|
+
#palette-input { width: 100%; box-sizing: border-box; background: var(--panel-elevated); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; padding: 9px 12px; color: var(--ink); margin-bottom: 8px; }
|
|
796
|
+
#palette-list { max-height: 45vh; overflow-y: auto; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 2px; }
|
|
797
|
+
#palette-list div { padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12.5px; color: var(--dim); display: flex; align-items: center; justify-content: space-between; }
|
|
798
|
+
#palette-list div.sel { background: var(--panel-active); color: var(--ink); font-weight: 500; }
|
|
799
|
+
.palette-hint { font-size: 11px; color: var(--dim); text-align: center; padding-top: 6px; border-top: 1px solid var(--line); }
|
|
800
|
+
|
|
801
|
+
/* Undo Toast */
|
|
802
|
+
#undo-toast {
|
|
803
|
+
position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
|
|
804
|
+
background: var(--panel); border: 1px solid var(--line-light); border-radius: var(--radius-sm);
|
|
805
|
+
box-shadow: 0 8px 24px rgba(0,0,0,0.4); padding: 10px 16px; z-index: 90; display: none; align-items: center; gap: 12px; font-size: 12px;
|
|
806
|
+
}
|
|
807
|
+
#undo-toast.show { display: flex; }
|
|
808
|
+
#result { margin-top: 1em; white-space: pre-wrap; font-family: var(--mono); font-size: 11px; color: var(--dim); }
|
|
809
|
+
details.tech-details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
|
|
810
|
+
details.tech-details summary { cursor: pointer; font-weight: 500; user-select: none; }
|
|
811
|
+
.routes-badge { font-size: 11px; font-family: var(--mono); color: var(--dim); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px 8px; }
|
|
812
|
+
.badge-count { background: var(--warn); color: #000; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 9px; margin-left: auto; }
|
|
813
|
+
</style>
|
|
814
|
+
</head>
|
|
815
|
+
<body>
|
|
816
|
+
<div id="app-shell">
|
|
817
|
+
<!-- 1. LEFT SIDEBAR -->
|
|
818
|
+
<aside id="app-sidebar">
|
|
819
|
+
<div class="sidebar-project">
|
|
820
|
+
<div class="project-card" id="project-trigger" title="${e(boardPath)}">
|
|
821
|
+
<span class="project-icon"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg></span>
|
|
822
|
+
<div class="project-info">
|
|
823
|
+
<div class="project-title">${e(path.basename(boardPath) || "Workspace")}</div>
|
|
824
|
+
<div class="project-path" id="topbar-board" title="${e(boardPath)}">${e(boardPath)}</div>
|
|
825
|
+
</div>
|
|
826
|
+
<span class="project-arrow"><svg class="btn-ic" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg></span>
|
|
827
|
+
</div>
|
|
828
|
+
<div id="project-popover">
|
|
829
|
+
<div class="pop-label">Target Codebase (Working Directory)</div>
|
|
830
|
+
<div class="pop-path" id="pop-cwd-path" title="Where workers execute commands and edit code">(default: board parent)</div>
|
|
831
|
+
<button type="button" class="pop-btn" id="open-folder-btn"><svg class="btn-ic" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg> Set Codebase Folder…</button>
|
|
832
|
+
<div class="pop-label" style="margin-top:10px">Workspace Board (Bus DB)</div>
|
|
833
|
+
<div class="pop-path" id="pop-board-path">${e(boardPath)}</div>
|
|
834
|
+
<button type="button" id="copy-board-btn" class="pop-btn"><svg class="btn-ic" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg> Copy Board Path</button>
|
|
835
|
+
<button type="button" class="pop-btn" id="switch-board-btn" title="Use another folder's board"><svg class="btn-ic" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="16 3 21 3 21 8"/><line x1="4" y1="20" x2="21" y2="3"/><polyline points="21 16 21 21 16 21"/><line x1="15" y1="15" x2="21" y2="21"/></svg> Switch Board…</button>
|
|
836
|
+
<button type="button" class="pop-btn" id="reset-board-btn">Use Default Board</button>
|
|
837
|
+
</div>
|
|
838
|
+
</div>
|
|
839
|
+
|
|
840
|
+
<!-- New Thread / Task Button -->
|
|
841
|
+
<div class="sidebar-action-wrap">
|
|
842
|
+
<button type="button" class="btn-new-task" id="btn-new-thread" onclick="startNewThread()">
|
|
843
|
+
<span>+ New Mission</span>
|
|
844
|
+
<kbd>Ctrl+N</kbd>
|
|
845
|
+
</button>
|
|
846
|
+
</div>
|
|
847
|
+
|
|
848
|
+
<!-- Active & Past Threads Stream -->
|
|
849
|
+
<div class="sidebar-heading">Threads & Runs</div>
|
|
850
|
+
<div id="sidebar-thread-list" class="sidebar-thread-list">
|
|
851
|
+
<div class="dim" style="padding:10px 8px;font-size:12px">no missions yet</div>
|
|
852
|
+
</div>
|
|
853
|
+
|
|
854
|
+
<!-- Workspace Navigation Tabs -->
|
|
855
|
+
<div class="sidebar-heading" style="margin-top:auto">Navigation</div>
|
|
856
|
+
<nav id="approot-nav">
|
|
857
|
+
<button data-nav="sec-boards" class="active"><span class="nav-ic"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg></span>Boards</button>
|
|
858
|
+
<button data-nav="sec-approvals"><span class="nav-ic"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg></span>Approvals<span id="sidebar-approvals-badge" class="badge-count" style="display:none">0</span></button>
|
|
859
|
+
<button data-nav="sec-crews"><span class="nav-ic"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/></svg></span>Crews</button>
|
|
860
|
+
<button data-nav="sec-fleet"><span class="nav-ic"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/></svg></span>Fleet</button>
|
|
861
|
+
<button data-nav="sec-channels"><span class="nav-ic"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 11a9 9 0 0 1 9 9"/><path d="M4 4a16 16 0 0 1 16 16"/></svg></span>Channels</button>
|
|
862
|
+
<button data-nav="sec-triage" style="display:none">Triage</button>
|
|
863
|
+
<button data-nav="sec-results" style="display:none">Results</button>
|
|
864
|
+
<button data-nav="sec-audit" style="display:none">Audit</button>
|
|
865
|
+
<button data-nav="sec-settings" style="display:none">Settings</button>
|
|
866
|
+
</nav>
|
|
867
|
+
|
|
868
|
+
<!-- Sidebar Footer -->
|
|
869
|
+
<div class="sidebar-footer">
|
|
870
|
+
<div class="identity-badge" onclick="approotNavTo('sec-settings')">
|
|
871
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
|
|
872
|
+
<span id="who-display">orchestrator</span>
|
|
873
|
+
</div>
|
|
874
|
+
<button type="button" onclick="window.open('/pair','_blank')" title="Pair Mobile App (QR)"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"/><line x1="12" y1="18" x2="12.01" y2="18"/></svg></button>
|
|
875
|
+
</div>
|
|
876
|
+
</aside>
|
|
877
|
+
|
|
878
|
+
<!-- 2. MAIN WORKSPACE STAGE -->
|
|
879
|
+
<main id="app-main">
|
|
880
|
+
<!-- Topbar -->
|
|
881
|
+
<header id="approot-topbar">
|
|
882
|
+
<div class="topbar-left">
|
|
883
|
+
<div class="thread-header-title" id="active-thread-title">Mission Control</div>
|
|
884
|
+
<div class="thread-header-badge" id="active-thread-status">Ready</div>
|
|
885
|
+
<select id="topbar-harness" onchange="document.getElementById('launch-harness').value=this.value;selectSingleHarness(this.value);" style="font-size:11.5px;padding:3px 6px">
|
|
886
|
+
<option value="claude">Claude</option>
|
|
887
|
+
<option value="codex">Codex</option>
|
|
888
|
+
<option value="opencode">OpenCode</option>
|
|
889
|
+
<option value="antigravity">Antigravity</option>
|
|
890
|
+
<option value="cursor">Cursor</option>
|
|
891
|
+
<option value="grok">Grok</option>
|
|
892
|
+
<option value="qwen">Qwen</option>
|
|
893
|
+
</select>
|
|
894
|
+
</div>
|
|
895
|
+
|
|
896
|
+
<button type="button" class="palette-btn" onclick="openPalette()">
|
|
897
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
|
|
898
|
+
<span>Search actions & workers…</span>
|
|
899
|
+
<kbd>Ctrl+K</kbd>
|
|
900
|
+
</button>
|
|
901
|
+
|
|
902
|
+
<div class="topbar-right">
|
|
903
|
+
<div class="conn-indicator">
|
|
904
|
+
<span id="conn-dot"><svg width="8" height="8" viewBox="0 0 8 8"><circle cx="4" cy="4" r="4" fill="#2ea043"/></svg></span>
|
|
905
|
+
<span id="poll-age" class="dim">live</span>
|
|
906
|
+
</div>
|
|
907
|
+
<button type="button" onclick="window.open('/pair','_blank')" title="Mobile Pairing"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"/><line x1="12" y1="18" x2="12.01" y2="18"/></svg></button>
|
|
908
|
+
<button type="button" onclick="crewbusThemeToggle()" title="Toggle Dark/Light Mode"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg></button>
|
|
909
|
+
<button type="button" onclick="toggleInspector()" title="Toggle Inspector"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><line x1="15" y1="3" x2="15" y2="21"/></svg></button>
|
|
910
|
+
</div>
|
|
911
|
+
</header>
|
|
912
|
+
|
|
913
|
+
<!-- View Stage -->
|
|
914
|
+
<div id="view-container">
|
|
915
|
+
|
|
916
|
+
<!-- SECTION: BOARDS (Primary Chat Threads & Execution Stage!) -->
|
|
917
|
+
<section id="sec-boards" data-section="Boards" style="flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden">
|
|
918
|
+
<div id="chat-stage">
|
|
919
|
+
<!-- The Living Conversation / Thread Stream -->
|
|
920
|
+
<div id="brief-thread">
|
|
921
|
+
<div class="chat-empty-stage">
|
|
922
|
+
<svg width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="var(--dim)" stroke-width="1.7"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
|
|
923
|
+
<div class="chat-empty-title">What should your crew work on?</div>
|
|
924
|
+
<div class="chat-empty-subtitle">Launch a coordinated crew of AI coding agents. Track their progress, inspect changes, and approve sensitive operations directly in this stream.</div>
|
|
925
|
+
<div class="chat-suggestions">
|
|
926
|
+
<div class="suggestion-card" data-suggestion="Run test suite and fix failing tests">
|
|
927
|
+
<b>Run test suite & fix bugs</b>
|
|
928
|
+
<span>Run tests, detect regressions, and patch code</span>
|
|
929
|
+
</div>
|
|
930
|
+
<div class="suggestion-card" data-suggestion="Refactor module to clean architecture">
|
|
931
|
+
<b>Refactor code</b>
|
|
932
|
+
<span>Improve performance and readability</span>
|
|
933
|
+
</div>
|
|
934
|
+
</div>
|
|
935
|
+
</div>
|
|
936
|
+
</div>
|
|
937
|
+
|
|
938
|
+
<!-- Bottom Sticky Composer -->
|
|
939
|
+
<div id="chat-composer-wrap">
|
|
940
|
+
<div class="composer-box">
|
|
941
|
+
<div style="font-size:11px;font-weight:600;color:var(--dim);text-transform:uppercase;letter-spacing:0.5px">Launch Mission</div>
|
|
942
|
+
<textarea id="launch-brief" maxlength="8000" placeholder="Give instructions to the crew or message active thread… (Ctrl+Enter to launch)"></textarea>
|
|
943
|
+
<div id="launch-diff"></div>
|
|
944
|
+
<div id="launch-out" class="log" style="display:none"></div>
|
|
945
|
+
|
|
946
|
+
<div class="composer-toolbar">
|
|
947
|
+
<div class="composer-toolbar-left">
|
|
948
|
+
<!-- Harness Chips Container -->
|
|
949
|
+
<div id="harness-cards" class="harness-pills" title="Click harnesses to toggle multi-harness crew"></div>
|
|
950
|
+
|
|
951
|
+
<!-- Model Selector & Custom Model Input -->
|
|
952
|
+
<div style="display:inline-flex;align-items:center;gap:4px">
|
|
953
|
+
<select id="launch-model" title="Model catalog for selected harness(es)" style="font-size:11.5px;padding:3px 6px">
|
|
954
|
+
<option value="">Default model</option>
|
|
955
|
+
</select>
|
|
956
|
+
<input id="launch-model-custom" type="text" placeholder="Custom model ID…" style="display:none;font-size:11.5px;padding:3px 8px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--panel-elevated);color:var(--ink);width:170px" title="Enter custom model identifier">
|
|
957
|
+
</div>
|
|
958
|
+
|
|
959
|
+
<!-- Worker Count Stepper -->
|
|
960
|
+
<div class="stepper-wrap" title="Number of parallel workers">
|
|
961
|
+
<button type="button" id="launch-count-minus">-</button>
|
|
962
|
+
<input id="launch-count" type="number" min="1" max="20" value="1">
|
|
963
|
+
<button type="button" id="launch-count-plus">+</button>
|
|
964
|
+
</div>
|
|
965
|
+
|
|
966
|
+
<!-- Permission Mode Toggle -->
|
|
967
|
+
<div id="launch-permission-seg" title="Permission Mode">
|
|
968
|
+
<button type="button" data-perm="supervised" class="sel" title="Supervised: interactive approval for commands and edits">supervised</button>
|
|
969
|
+
<button type="button" data-perm="autoEdits" title="AutoEdits: auto-accept code edits, prompt for terminal commands">autoEdits</button>
|
|
970
|
+
<button type="button" data-perm="auto" title="Auto: unattended execution for non-destructive actions">auto</button>
|
|
971
|
+
<button type="button" data-perm="full" title="Full: fully unattended mode with danger confirmations bypassed">full</button>
|
|
972
|
+
</div>
|
|
973
|
+
</div>
|
|
974
|
+
|
|
975
|
+
<div class="composer-toolbar-right">
|
|
976
|
+
<span id="launch-brief-count" class="dim" style="font-family:var(--mono);font-size:10.5px">0/8000</span>
|
|
977
|
+
<button id="launch-preview" type="button" style="display:none">Preview plan</button>
|
|
978
|
+
<button id="launch-go" class="btn-launch" type="button">Launch Agents</button>
|
|
979
|
+
</div>
|
|
980
|
+
</div>
|
|
981
|
+
|
|
982
|
+
<!-- Hidden Form Fields to satisfy contract -->
|
|
983
|
+
<div style="display:none">
|
|
984
|
+
<span id="routes-line"></span>
|
|
985
|
+
<select id="launch-harness"><option value="claude">claude</option></select>
|
|
986
|
+
<input id="launch-to" value="">
|
|
987
|
+
<select id="launch-permission"><option value="supervised">supervised</option><option value="autoEdits">autoEdits</option><option value="auto">auto</option><option value="full">full</option></select>
|
|
988
|
+
<input id="launch-from" value="">
|
|
989
|
+
<input id="launch-token" type="password" value="">
|
|
990
|
+
<input id="launch-cwd" value="">
|
|
991
|
+
<button id="launch-cwd-browse" type="button"></button>
|
|
992
|
+
<input id="launch-dry" type="checkbox" checked>
|
|
993
|
+
<div id="harnesses"></div>
|
|
994
|
+
</div>
|
|
995
|
+
</div>
|
|
996
|
+
</div>
|
|
997
|
+
</div>
|
|
998
|
+
</section>
|
|
999
|
+
|
|
1000
|
+
<!-- SECTION: APPROVALS (Human-in-the-loop Approvals Queue) -->
|
|
1001
|
+
<section id="sec-approvals" data-section="Approvals" class="standard-view approot-hidden">
|
|
1002
|
+
<h1>Pending Approvals</h1>
|
|
1003
|
+
<p class="dim">When workers are blocked on sensitive operations, approve or deny their requests here or directly in the chat thread.</p>
|
|
1004
|
+
<table>
|
|
1005
|
+
<thead><tr><th>Request ID</th><th>Worker</th><th>Action / Command</th><th>Instructions / Reason</th><th>Actions</th></tr></thead>
|
|
1006
|
+
<tbody id="approvals"></tbody>
|
|
1007
|
+
</table>
|
|
1008
|
+
</section>
|
|
1009
|
+
|
|
1010
|
+
<!-- SECTION: CREWS (Workers Roster & Controls) -->
|
|
1011
|
+
<section id="sec-crews" data-section="Crews" class="standard-view approot-hidden">
|
|
1012
|
+
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px">
|
|
1013
|
+
<h1>Active Crew Workers</h1>
|
|
1014
|
+
<div style="display:flex;gap:8px">
|
|
1015
|
+
<button id="killall" class="danger">Kill All Active Workers</button>
|
|
1016
|
+
<button id="ackall">Acknowledge All Replies</button>
|
|
1017
|
+
</div>
|
|
1018
|
+
</div>
|
|
1019
|
+
<table>
|
|
1020
|
+
<thead>
|
|
1021
|
+
<tr>
|
|
1022
|
+
<th>Worker</th>
|
|
1023
|
+
<th>Status</th>
|
|
1024
|
+
<th>PID</th>
|
|
1025
|
+
<th>Driver</th>
|
|
1026
|
+
<th>brief / groups</th>
|
|
1027
|
+
<th>Reply</th>
|
|
1028
|
+
<th>Actions</th>
|
|
1029
|
+
</tr>
|
|
1030
|
+
</thead>
|
|
1031
|
+
<tbody id="crews"></tbody>
|
|
1032
|
+
</table>
|
|
1033
|
+
<h2 style="margin-top:24px">Agent Fleet Presence</h2>
|
|
1034
|
+
<table>
|
|
1035
|
+
<thead><tr><th>Agent</th><th>Role</th><th>Status</th><th>Last Seen</th><th>Unacked</th></tr></thead>
|
|
1036
|
+
<tbody id="agents"></tbody>
|
|
1037
|
+
</table>
|
|
1038
|
+
</section>
|
|
1039
|
+
|
|
1040
|
+
<!-- SECTION: FLEET (Relays & Multi-Node Sync) -->
|
|
1041
|
+
<section id="sec-fleet" data-section="Fleet" class="standard-view approot-hidden">
|
|
1042
|
+
<h1>Relay Fleet (Multi-Node Sync)</h1>
|
|
1043
|
+
<table>
|
|
1044
|
+
<thead><tr><th>Relay</th><th>Role</th><th>Weight</th><th>Workers</th><th>Lag</th><th>Last Sync</th></tr></thead>
|
|
1045
|
+
<tbody id="fleet"></tbody>
|
|
1046
|
+
</table>
|
|
1047
|
+
<h2 style="margin-top:24px">Sync Peers</h2>
|
|
1048
|
+
<table><thead><tr><th>Peer</th><th>Last Sync</th></tr></thead><tbody id="peers"></tbody></table>
|
|
1049
|
+
</section>
|
|
1050
|
+
|
|
1051
|
+
<!-- SECTION: CHANNELS (Broadcasts & Group Logs) -->
|
|
1052
|
+
<section id="sec-channels" data-section="Channels" class="standard-view approot-hidden">
|
|
1053
|
+
<h1>Channels & Broadcasts</h1>
|
|
1054
|
+
<div style="margin-bottom:14px;display:flex;gap:8px">
|
|
1055
|
+
<input id="chan-name" placeholder="Channel name (e.g. general, findings)" style="width:220px">
|
|
1056
|
+
<input id="chan-body" placeholder="Broadcast message…" style="flex:1">
|
|
1057
|
+
<button id="chan-post" class="btn-primary">Post to Channel</button>
|
|
1058
|
+
</div>
|
|
1059
|
+
<div id="channels"></div>
|
|
1060
|
+
<h2 style="margin-top:24px">Broadcast History</h2>
|
|
1061
|
+
<table>
|
|
1062
|
+
<thead><tr><th>ID</th><th>From</th><th>To</th><th>Subject</th><th>Body</th></tr></thead>
|
|
1063
|
+
<tbody id="bcast"></tbody>
|
|
1064
|
+
</table>
|
|
1065
|
+
</section>
|
|
1066
|
+
|
|
1067
|
+
<!-- SECTION: TRIAGE (Inbox Queue & Filters) -->
|
|
1068
|
+
<section id="sec-triage" data-section="Triage" class="standard-view approot-hidden">
|
|
1069
|
+
<h1>Inbox & Message Triage</h1>
|
|
1070
|
+
<table>
|
|
1071
|
+
<thead><tr><th>ID</th><th>From</th><th>Message</th><th>Actions</th></tr></thead>
|
|
1072
|
+
<tbody id="triage"></tbody>
|
|
1073
|
+
</table>
|
|
1074
|
+
<h2 style="margin-top:24px">Recent Message Feed</h2>
|
|
1075
|
+
<div style="display:flex;gap:10px;margin-bottom:10px">
|
|
1076
|
+
<input id="feed-q" placeholder="Filter messages…" style="flex:1">
|
|
1077
|
+
<select id="feed-type"><option value="">All</option><option value="checkpoint">Checkpoints</option><option value="final">Finals</option></select>
|
|
1078
|
+
</div>
|
|
1079
|
+
<table>
|
|
1080
|
+
<thead><tr><th>ID</th><th>From → To</th><th>Summary</th></tr></thead>
|
|
1081
|
+
<tbody id="recent"></tbody>
|
|
1082
|
+
</table>
|
|
1083
|
+
</section>
|
|
1084
|
+
|
|
1085
|
+
<!-- SECTION: RESULTS (Outcomes & Diffs) -->
|
|
1086
|
+
<section id="sec-results" data-section="Results" class="standard-view approot-hidden">
|
|
1087
|
+
<h1>Verified Results & Competitive Races</h1>
|
|
1088
|
+
<table>
|
|
1089
|
+
<thead><tr><th>Group</th><th>Telemetry</th><th>Verified Result</th><th>Running</th><th>Actions</th></tr></thead>
|
|
1090
|
+
<tbody id="results"></tbody>
|
|
1091
|
+
</table>
|
|
1092
|
+
</section>
|
|
1093
|
+
|
|
1094
|
+
<!-- SECTION: AUDIT (Tamper-Evident Chain & Holds) -->
|
|
1095
|
+
<section id="sec-audit" data-section="Audit" class="standard-view approot-hidden">
|
|
1096
|
+
<h1>Tamper-Evident Audit Log</h1>
|
|
1097
|
+
<div id="auditver" class="dim" style="margin-bottom:12px;font-family:var(--mono);font-size:12px"></div>
|
|
1098
|
+
<table>
|
|
1099
|
+
<thead><tr><th>Seq</th><th>At</th><th>Actor</th><th>Event</th><th>Target</th><th>Result</th></tr></thead>
|
|
1100
|
+
<tbody id="audit"></tbody>
|
|
1101
|
+
</table>
|
|
1102
|
+
<h2 style="margin-top:24px">Legal Hold Status</h2>
|
|
1103
|
+
<div id="holds-body" class="card dim" style="margin-top:8px">no active legal hold</div>
|
|
1104
|
+
<h2 style="margin-top:24px">Board Quotas & Retention</h2>
|
|
1105
|
+
<div id="quotas-body" class="card dim" style="margin-top:8px">quotas loaded</div>
|
|
1106
|
+
</section>
|
|
1107
|
+
|
|
1108
|
+
<!-- SECTION: SETTINGS (Pairing, Auth, CLI) -->
|
|
1109
|
+
<section id="sec-settings" data-section="Settings" class="standard-view approot-hidden">
|
|
1110
|
+
<h1>Settings & Companion Pairing</h1>
|
|
1111
|
+
<div class="card" style="margin-bottom:14px">
|
|
1112
|
+
<b>Mobile Companion Pairing</b>
|
|
1113
|
+
<p class="dim">Pair your mobile client with this board using a secure, single-use QR exchange.</p>
|
|
1114
|
+
<button id="pair-qrcode-btn" class="btn-primary" onclick="window.open('/pair', '_blank')">Open Mobile Pairing Screen (QR)…</button>
|
|
1115
|
+
</div>
|
|
1116
|
+
<div class="card" style="margin-bottom:14px">
|
|
1117
|
+
<b>Tab Identity & Auth</b>
|
|
1118
|
+
<p class="dim">Configure credentials for this browser session.</p>
|
|
1119
|
+
<div style="display:flex;gap:8px;margin-top:8px">
|
|
1120
|
+
<input id="who" placeholder="Agent Name (e.g. orchestrator)">
|
|
1121
|
+
<input id="tok" type="password" placeholder="Token abt-…">
|
|
1122
|
+
<button id="save" class="btn-primary">Save Creds</button>
|
|
1123
|
+
</div>
|
|
1124
|
+
</div>
|
|
1125
|
+
<div class="card" style="margin-bottom:14px">
|
|
1126
|
+
<b>Holds & Quotas</b>
|
|
1127
|
+
<div style="display:flex;gap:12px;margin-top:10px;flex-wrap:wrap">
|
|
1128
|
+
<div class="card" id="holds-card" style="flex:1;min-width:240px"><b>Hold</b><div id="holds-body" class="dim">loading…</div></div>
|
|
1129
|
+
<div class="card" id="quotas-card" style="flex:1;min-width:240px"><b>Quotas</b><div id="quotas-body" class="dim">loading…</div></div>
|
|
1130
|
+
</div>
|
|
1131
|
+
</div>
|
|
1132
|
+
<div class="card">
|
|
1133
|
+
<b>Workspace Stats</b>
|
|
1134
|
+
<div class="cards" style="margin-top:10px">
|
|
1135
|
+
<div class="card"><div class="dim">Agents</div><b id="c-agents">0</b></div>
|
|
1136
|
+
<div class="card"><div class="dim">Active</div><b id="c-active">0</b></div>
|
|
1137
|
+
<div class="card"><div class="dim">Workers</div><b id="c-workers">0</b></div>
|
|
1138
|
+
<div class="card"><div class="dim">Unacked</div><b id="c-unacked">0</b></div>
|
|
1139
|
+
<div class="card"><div class="dim">Broadcasts</div><b id="c-bcast">0</b></div>
|
|
1140
|
+
<div class="card"><div class="dim">Groups</div><b id="c-groups">0</b></div>
|
|
1141
|
+
<div class="card"><div class="dim">Peers</div><b id="c-peers">0</b></div>
|
|
1142
|
+
</div>
|
|
1143
|
+
<table style="margin-top:14px"><thead><tr><th>Group</th><th>Members</th></tr></thead><tbody id="groups"></tbody></table>
|
|
1144
|
+
</div>
|
|
1145
|
+
<div id="result"></div>
|
|
1146
|
+
</section>
|
|
1147
|
+
|
|
1148
|
+
<!-- SECTION: BRIEFS (Table container required by panel test) -->
|
|
1149
|
+
<section id="sec-briefs" data-section="Briefs" class="approot-hidden">
|
|
1150
|
+
<table><thead><tr><th>Brief</th><th>Workers</th><th>Checkpoints</th><th>Finals</th><th>Acked</th><th>Last</th></tr></thead><tbody id="briefs"></tbody></table>
|
|
1151
|
+
</section>
|
|
1152
|
+
|
|
1153
|
+
</div>
|
|
1154
|
+
</main>
|
|
1155
|
+
|
|
1156
|
+
<!-- 3. RIGHT INSPECTOR DRAWER -->
|
|
1157
|
+
<aside id="app-inspector" class="hidden">
|
|
1158
|
+
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:12px">
|
|
1159
|
+
<div style="font-weight:600;font-size:13px;color:var(--ink)">Worker Inspector</div>
|
|
1160
|
+
<button type="button" onclick="toggleInspector()" style="padding:2px 6px">✕</button>
|
|
1161
|
+
</div>
|
|
1162
|
+
<div id="inspector">
|
|
1163
|
+
<div id="inspector-body"><span class="dim">Click a worker to inspect process details, memory, and live telemetry.</span></div>
|
|
1164
|
+
</div>
|
|
1165
|
+
</aside>
|
|
1166
|
+
</div>
|
|
1167
|
+
|
|
1168
|
+
<!-- Command Palette Modal -->
|
|
1169
|
+
<div id="palette">
|
|
1170
|
+
<div id="palette-box">
|
|
1171
|
+
<input id="palette-input" placeholder="Type a command or jump to section…">
|
|
1172
|
+
<div id="palette-list"></div>
|
|
1173
|
+
<div class="palette-hint">Use ↑ ↓ to navigate · Enter to select · Esc to close</div>
|
|
1174
|
+
</div>
|
|
1175
|
+
</div>
|
|
1176
|
+
|
|
1177
|
+
<!-- Undo Toast -->
|
|
1178
|
+
<div id="undo-toast">
|
|
1179
|
+
<span id="undo-msg">Action performed</span>
|
|
1180
|
+
<button id="undo-btn" class="danger">Undo</button>
|
|
1181
|
+
</div>
|
|
1182
|
+
|
|
1183
|
+
<script>
|
|
1184
|
+
var boardPath = "${boardPath}";
|
|
1185
|
+
var activeBatch = null;
|
|
1186
|
+
|
|
1187
|
+
function esc(s){return String(s===undefined||s===null?'':s).replace(/[&<>"']/g,function(c){return {'&':'&','<':'<','>':'>','"':'"',"'":'''}[c];});}
|
|
1188
|
+
function short(s,n){s=String(s||'');return s.length<=n?s:s.slice(0,n-1)+'…';}
|
|
1189
|
+
|
|
1190
|
+
function crewbusThemeInit(){
|
|
1191
|
+
try{
|
|
1192
|
+
var t=localStorage.getItem('crewbus-theme')||localStorage.getItem('crewbus-desktop-theme');
|
|
1193
|
+
if(t==='light'||t==='dark') document.documentElement.setAttribute('data-theme',t);
|
|
1194
|
+
}catch(_){}
|
|
1195
|
+
}
|
|
1196
|
+
function crewbusThemeToggle(){
|
|
1197
|
+
try{
|
|
1198
|
+
var cur=document.documentElement.getAttribute('data-theme');
|
|
1199
|
+
if(!cur){
|
|
1200
|
+
var prefersDark=window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
1201
|
+
cur=prefersDark?'dark':'light';
|
|
1202
|
+
}
|
|
1203
|
+
var next=cur==='dark'?'light':'dark';
|
|
1204
|
+
document.documentElement.setAttribute('data-theme',next);
|
|
1205
|
+
localStorage.setItem('crewbus-theme',next);
|
|
1206
|
+
localStorage.setItem('crewbus-desktop-theme',next);
|
|
1207
|
+
}catch(_){}
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
function approotNavTo(targetId){
|
|
1211
|
+
var sections=['sec-boards','sec-crews','sec-fleet','sec-channels','sec-triage','sec-approvals','sec-results','sec-audit','sec-settings','sec-briefs'];
|
|
1212
|
+
sections.forEach(function(id){
|
|
1213
|
+
var el=document.getElementById(id);
|
|
1214
|
+
if(el){
|
|
1215
|
+
if(id===targetId) el.classList.remove('approot-hidden');
|
|
1216
|
+
else el.classList.add('approot-hidden');
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
var btns=document.querySelectorAll('#approot-nav button');
|
|
1220
|
+
Array.prototype.forEach.call(btns,function(b){
|
|
1221
|
+
if(b.getAttribute('data-nav')===targetId) b.classList.add('active');
|
|
1222
|
+
else b.classList.remove('active');
|
|
1223
|
+
});
|
|
1224
|
+
if(targetId==='sec-boards'){
|
|
1225
|
+
document.getElementById('active-thread-title').textContent = activeBatch ? 'Mission '+short(activeBatch,14) : 'Mission Control';
|
|
1226
|
+
} else {
|
|
1227
|
+
var b=document.querySelector('#approot-nav button[data-nav="'+targetId+'"]');
|
|
1228
|
+
document.getElementById('active-thread-title').textContent = b ? b.textContent.trim() : 'Workspace';
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
Array.prototype.forEach.call(document.querySelectorAll('#approot-nav button'),function(btn){
|
|
1233
|
+
btn.onclick=function(){
|
|
1234
|
+
var nav=btn.getAttribute('data-nav');
|
|
1235
|
+
if(nav) approotNavTo(nav);
|
|
1236
|
+
};
|
|
1237
|
+
});
|
|
1238
|
+
|
|
1239
|
+
function toggleInspector(){
|
|
1240
|
+
var insp=document.getElementById('app-inspector');
|
|
1241
|
+
if(insp) insp.classList.toggle('hidden');
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
function showInspector(name){
|
|
1245
|
+
var insp=document.getElementById('app-inspector');
|
|
1246
|
+
if(insp) insp.classList.remove('hidden');
|
|
1247
|
+
var b=document.getElementById('inspector-body');
|
|
1248
|
+
if(!b)return;
|
|
1249
|
+
var w=(window.__workers||[]).find(function(x){return x.name===name;})||{name:name,alive:false};
|
|
1250
|
+
var tail=(w.tail||[]).map(function(l){return '<div class="log-line">'+esc(l)+'</div>';}).join('')||'<div class="dim">no output recorded</div>';
|
|
1251
|
+
var statusStr=w.alive?'<span style="color:var(--ok)">● Active</span>':'<span style="color:var(--dim)">○ Exited</span>';
|
|
1252
|
+
b.innerHTML=[
|
|
1253
|
+
'<div style="margin-bottom:10px"><b>'+esc(w.name)+'</b> '+statusStr+'</div>',
|
|
1254
|
+
'<div class="dim" style="font-size:11px;margin-bottom:6px">PID: '+(w.pid||'—')+' · Driver: '+esc(w.driver||w.spawnedHarness||'—')+'</div>',
|
|
1255
|
+
(w.batch?'<div class="dim" style="font-size:11px;margin-bottom:8px">Batch: '+esc(w.batch)+'</div>':''),
|
|
1256
|
+
'<div style="display:flex;gap:6px;margin-bottom:12px">',
|
|
1257
|
+
(w.alive?'<button class="danger" data-kill="'+esc(w.name)+'">Kill Worker</button>':''),
|
|
1258
|
+
(w.reply?'<button data-ack="'+esc(w.reply.id)+'">Ack Reply</button>':''),
|
|
1259
|
+
'</div>',
|
|
1260
|
+
'<div class="dim" style="font-size:11px;margin-bottom:4px">Live Process Log:</div>',
|
|
1261
|
+
'<div class="log" style="max-height:300px">'+tail+'</div>',
|
|
1262
|
+
'<div class="dim" style="margin-top:12px;font-size:10.5px">CLI respawn command:</div>',
|
|
1263
|
+
'<div class="log" style="padding:6px;font-size:10.5px">crewbus respawn --to '+esc(w.name)+'</div>'
|
|
1264
|
+
].join('');
|
|
1265
|
+
var k=b.querySelector('[data-kill]');
|
|
1266
|
+
if(k) k.onclick=function(){kill([w.name]);};
|
|
1267
|
+
var a=b.querySelector('[data-ack]');
|
|
1268
|
+
if(a) a.onclick=function(){ackOne(w.reply.id);};
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
function showUndoToast(msg, onUndo){
|
|
1272
|
+
var toast=document.getElementById('undo-toast');
|
|
1273
|
+
if(!toast)return;
|
|
1274
|
+
document.getElementById('undo-msg').textContent=msg;
|
|
1275
|
+
toast.classList.add('show');
|
|
1276
|
+
var btn=document.getElementById('undo-btn');
|
|
1277
|
+
btn.onclick=function(){
|
|
1278
|
+
toast.classList.remove('show');
|
|
1279
|
+
if(onUndo) onUndo();
|
|
1280
|
+
};
|
|
1281
|
+
setTimeout(function(){ toast.classList.remove('show'); }, 6000);
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
function startNewThread(){
|
|
1285
|
+
activeBatch=null;
|
|
1286
|
+
approotNavTo('sec-boards');
|
|
1287
|
+
document.getElementById('active-thread-title').textContent='New Mission';
|
|
1288
|
+
document.getElementById('active-thread-status').textContent='Draft';
|
|
1289
|
+
var rows=document.querySelectorAll('#sidebar-thread-list .thread-row');
|
|
1290
|
+
Array.prototype.forEach.call(rows,function(r){ r.classList.remove('active'); });
|
|
1291
|
+
var box=document.getElementById('brief-thread');
|
|
1292
|
+
if(box){
|
|
1293
|
+
box.innerHTML=[
|
|
1294
|
+
'<div class="chat-empty-stage">',
|
|
1295
|
+
'<svg width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="var(--dim)" stroke-width="1.7"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>',
|
|
1296
|
+
'<div class="chat-empty-title">What should your crew build?</div>',
|
|
1297
|
+
'<div class="chat-empty-subtitle">Type your prompt below to launch agents. They will report progress and ask for permissions right inside this conversation stream.</div>',
|
|
1298
|
+
'<div class="chat-suggestions">',
|
|
1299
|
+
'<div class="suggestion-card" data-suggestion="Run test suite and fix failing tests">',
|
|
1300
|
+
'<b>Run test suite & fix bugs</b>',
|
|
1301
|
+
'<span>Run tests, detect regressions, and patch code</span>',
|
|
1302
|
+
'</div>',
|
|
1303
|
+
'<div class="suggestion-card" data-suggestion="Refactor module to clean architecture">',
|
|
1304
|
+
'<b>Refactor code</b>',
|
|
1305
|
+
'<span>Improve performance and readability</span>',
|
|
1306
|
+
'</div>',
|
|
1307
|
+
'</div>',
|
|
1308
|
+
'</div>'
|
|
1309
|
+
].join('');
|
|
1310
|
+
}
|
|
1311
|
+
var inp=document.getElementById('launch-brief');
|
|
1312
|
+
if(inp){ inp.value=''; inp.focus(); }
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
function applySuggestion(text){
|
|
1316
|
+
var inp=document.getElementById('launch-brief');
|
|
1317
|
+
if(inp){
|
|
1318
|
+
inp.value=text;
|
|
1319
|
+
inp.dispatchEvent(new Event('input'));
|
|
1320
|
+
inp.focus();
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
document.addEventListener('click', function(e){
|
|
1325
|
+
var el=e.target && e.target.closest ? e.target.closest('[data-suggestion]') : null;
|
|
1326
|
+
if(el){ var s=el.getAttribute('data-suggestion'); if(s) applySuggestion(s); }
|
|
1327
|
+
});
|
|
1328
|
+
|
|
1329
|
+
async function showBrief(batch){
|
|
1330
|
+
activeBatch=batch;
|
|
1331
|
+
approotNavTo('sec-boards');
|
|
1332
|
+
document.getElementById('active-thread-title').textContent='Mission '+short(batch,16);
|
|
1333
|
+
var rows=document.querySelectorAll('#sidebar-thread-list .thread-row');
|
|
1334
|
+
Array.prototype.forEach.call(rows,function(r){
|
|
1335
|
+
if(r.getAttribute('data-batch')===batch) r.classList.add('active');
|
|
1336
|
+
else r.classList.remove('active');
|
|
1337
|
+
});
|
|
1338
|
+
|
|
1339
|
+
var box=document.getElementById('brief-thread');
|
|
1340
|
+
if(!box)return;
|
|
1341
|
+
box.innerHTML='<div class="dim" style="padding:20px;text-align:center">Loading mission transcript for '+esc(batch)+'…</div>';
|
|
1342
|
+
|
|
1343
|
+
try{
|
|
1344
|
+
var r=await fetch('/api/gather?batch='+encodeURIComponent(batch),{cache:'no-store'});
|
|
1345
|
+
var g=await r.json();
|
|
1346
|
+
if(!r.ok){ box.innerHTML='<div class="dim" style="padding:20px">gather failed: '+esc(g.error||r.status)+'</div>'; return; }
|
|
1347
|
+
|
|
1348
|
+
var approvals=[];
|
|
1349
|
+
try{
|
|
1350
|
+
var apR=await fetch('/api/board',{cache:'no-store'});
|
|
1351
|
+
var apS=await apR.json();
|
|
1352
|
+
approvals=apS.approvals||[];
|
|
1353
|
+
}catch(_){}
|
|
1354
|
+
|
|
1355
|
+
var html='<div style="max-width:860px;margin:0 auto;width:100%;display:flex;flex-direction:column;gap:14px">';
|
|
1356
|
+
html+='<div class="dim" style="font-size:11.5px;padding-bottom:10px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between"><span>Batch: '+esc(batch)+'</span><span>'+g.briefs+' briefs · '+g.replies+' replies · ~'+(g.telemetry&&g.telemetry.tokensEst?g.telemetry.tokensEst:0)+' tokens</span></div>';
|
|
1357
|
+
|
|
1358
|
+
var items=g.items||[];
|
|
1359
|
+
for(var i=0;i<items.length;i++){
|
|
1360
|
+
var m=items[i];
|
|
1361
|
+
var isUser=!m.replyTo;
|
|
1362
|
+
var isCkpt=m.checkpoint===true;
|
|
1363
|
+
var toStr=Array.isArray(m.to)?m.to.join(','):String(m.to||'');
|
|
1364
|
+
|
|
1365
|
+
if(isUser){
|
|
1366
|
+
html+='<div class="chat-msg chat-msg-user">';
|
|
1367
|
+
html+=' <div class="chat-msg-header"><span class="chat-msg-author">'+esc(m.from)+'</span><span>'+esc(ago(m.at))+'</span></div>';
|
|
1368
|
+
html+=' <div class="chat-msg-card"><b>'+(m.subject?esc(m.subject):'Mission Brief')+'</b><div style="margin-top:6px;white-space:pre-wrap">'+esc(m.body)+'</div>';
|
|
1369
|
+
html+=' <div class="chat-msg-tags"><span class="chat-tag">→ '+esc(toStr)+'</span><span class="chat-tag">batch '+esc(short(batch,8))+'</span></div>';
|
|
1370
|
+
html+=' </div>';
|
|
1371
|
+
html+='</div>';
|
|
1372
|
+
} else {
|
|
1373
|
+
html+='<div class="chat-msg">';
|
|
1374
|
+
html+=' <div class="chat-msg-header"><span class="chat-msg-author">'+esc(m.from)+'</span><span class="dim">'+(isCkpt?'Checkpoint':'Final Report')+' · '+esc(ago(m.at))+'</span></div>';
|
|
1375
|
+
html+=' <div class="chat-msg-card">';
|
|
1376
|
+
if(m.subject) html+='<div style="font-weight:600;margin-bottom:6px">'+esc(m.subject)+'</div>';
|
|
1377
|
+
html+=' <div style="white-space:pre-wrap">'+esc(m.body)+'</div>';
|
|
1378
|
+
if(m.artifact) html+='<div style="margin-top:8px" class="dim">Artifact: <code>'+esc(m.artifact)+'</code></div>';
|
|
1379
|
+
html+=' </div>';
|
|
1380
|
+
html+='</div>';
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
// Inline Approvals in the Chat Stream
|
|
1385
|
+
var pendingForWorkers=approvals.filter(function(ap){
|
|
1386
|
+
return items.some(function(it){ return it.from===ap.from || it.to===ap.from; });
|
|
1387
|
+
});
|
|
1388
|
+
if(pendingForWorkers.length===0 && approvals.length>0 && items.length===0){
|
|
1389
|
+
pendingForWorkers=approvals;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
for(var j=0;j<pendingForWorkers.length;j++){
|
|
1393
|
+
var ap=pendingForWorkers[j];
|
|
1394
|
+
html+='<div class="chat-approval-card" data-approval-id="'+esc(ap.id)+'">';
|
|
1395
|
+
html+=' <div class="chat-approval-head"><span class="chat-approval-title">Permission Request</span><span class="dim">'+esc(ago(ap.at))+'</span></div>';
|
|
1396
|
+
html+=' <div><b>'+esc(ap.from)+'</b> requires your approval to proceed:</div>';
|
|
1397
|
+
html+=' <div class="chat-approval-cmd">'+esc(ap.subject.replace(/^approval:[ ]*/,''))+'</div>';
|
|
1398
|
+
if(ap.body) html+='<div class="dim" style="font-size:11.5px;margin-bottom:8px">'+esc(ap.body)+'</div>';
|
|
1399
|
+
html+=' <div class="chat-approval-actions">';
|
|
1400
|
+
html+=' <input data-reason="'+esc(ap.id)+'" maxlength="500" placeholder="Optional instructions or feedback…">';
|
|
1401
|
+
html+=' <button data-approve="'+esc(ap.id)+'" class="btn-primary">Approve</button>';
|
|
1402
|
+
html+=' <button data-deny="'+esc(ap.id)+'" class="danger">Decline</button>';
|
|
1403
|
+
html+=' </div>';
|
|
1404
|
+
html+='</div>';
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
html+='</div>';
|
|
1408
|
+
box.innerHTML=html;
|
|
1409
|
+
|
|
1410
|
+
// Delegate inline approvals
|
|
1411
|
+
Array.prototype.forEach.call(box.querySelectorAll('[data-approve]'),function(btn){
|
|
1412
|
+
btn.onclick=function(ev){ ev.stopPropagation(); decide(btn.getAttribute('data-approve'),'approved'); };
|
|
1413
|
+
});
|
|
1414
|
+
Array.prototype.forEach.call(box.querySelectorAll('[data-deny]'),function(btn){
|
|
1415
|
+
btn.onclick=function(ev){ ev.stopPropagation(); decide(btn.getAttribute('data-deny'),'denied'); };
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
box.scrollTop=box.scrollHeight;
|
|
1419
|
+
}catch(e){
|
|
1420
|
+
box.innerHTML='<div class="dim" style="padding:20px">gather error: '+esc(e.message)+'</div>';
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
// Global Poll & Update Engine
|
|
1425
|
+
async function refresh(){
|
|
1426
|
+
try{
|
|
1427
|
+
var r=await fetch('/api/board',{cache:'no-store'});
|
|
1428
|
+
var s=await r.json();
|
|
1429
|
+
window.__lastBoardPoll=Date.now();
|
|
1430
|
+
updatePollAge();
|
|
1431
|
+
window.__workers=s.workers||[];
|
|
1432
|
+
|
|
1433
|
+
var active=s.agents.filter(function(a){return a.active;}).length;
|
|
1434
|
+
var unacked=s.agents.reduce(function(n,a){return n+a.unacked;},0);
|
|
1435
|
+
|
|
1436
|
+
var setTxt=function(id,val){var el=document.getElementById(id);if(el)el.textContent=val;};
|
|
1437
|
+
setTxt('c-agents', s.agents.length);
|
|
1438
|
+
setTxt('c-active', active);
|
|
1439
|
+
setTxt('c-workers', s.workers.length);
|
|
1440
|
+
setTxt('c-unacked', unacked);
|
|
1441
|
+
setTxt('c-bcast', s.broadcasts.length);
|
|
1442
|
+
setTxt('c-groups', (s.groups||[]).length);
|
|
1443
|
+
setTxt('c-peers', (s.peers||[]).length);
|
|
1444
|
+
|
|
1445
|
+
// 1. Sidebar Threads Stream
|
|
1446
|
+
var threadListEl=document.getElementById('sidebar-thread-list');
|
|
1447
|
+
if(threadListEl){
|
|
1448
|
+
var briefs=s.briefs||[];
|
|
1449
|
+
if(briefs.length===0){
|
|
1450
|
+
threadListEl.innerHTML='<div class="dim" style="padding:10px 8px;font-size:12px">no missions yet</div>';
|
|
1451
|
+
} else {
|
|
1452
|
+
threadListEl.innerHTML=briefs.map(function(b){
|
|
1453
|
+
var isCur=activeBatch===b.batch;
|
|
1454
|
+
var hasRunning=s.workers.some(function(w){ return w.batch===b.batch && w.alive; });
|
|
1455
|
+
var dotClass=hasRunning?'status-dot active':'status-dot';
|
|
1456
|
+
var title=b.subject ? b.subject.replace(/^brief:[ ]*/,'') : 'Mission '+short(b.batch,10);
|
|
1457
|
+
return [
|
|
1458
|
+
'<div class="thread-row '+(isCur?'active':'')+'" data-batch="'+esc(b.batch)+'">',
|
|
1459
|
+
'<div class="thread-row-top">',
|
|
1460
|
+
'<div class="thread-title">'+esc(title)+'</div>',
|
|
1461
|
+
'<span class="thread-time">'+esc(ago(b.lastAt))+'</span>',
|
|
1462
|
+
'</div>',
|
|
1463
|
+
'<div class="thread-meta">',
|
|
1464
|
+
'<span class="'+dotClass+'"></span>',
|
|
1465
|
+
'<span>'+b.workers.length+' worker'+(b.workers.length===1?'':'s')+' · '+b.checkpointCount+' ckpts</span>',
|
|
1466
|
+
'</div>',
|
|
1467
|
+
'</div>'
|
|
1468
|
+
].join('');
|
|
1469
|
+
}).join('');
|
|
1470
|
+
|
|
1471
|
+
Array.prototype.forEach.call(threadListEl.querySelectorAll('.thread-row'),function(r){
|
|
1472
|
+
r.onclick=function(){ showBrief(r.getAttribute('data-batch')); };
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
// 2. Briefs Table (Contract for panel test)
|
|
1478
|
+
var brEl=document.getElementById('briefs');
|
|
1479
|
+
if(brEl){
|
|
1480
|
+
brEl.innerHTML=(s.briefs||[]).map(function(b){
|
|
1481
|
+
var ws=(b.workers||[]).join(',');
|
|
1482
|
+
return '<tr data-batch="'+esc(b.batch)+'" style="cursor:pointer"><td><b>'+esc(b.subject||short(b.batch,12))+'</b></td><td>'+esc(ws)+'</td><td>'+b.checkpointCount+'</td><td>'+b.finalCount+'</td><td>'+b.ackedFinals+'/'+b.finalCount+'</td><td>'+esc(ago(b.lastAt))+'</td></tr>';
|
|
1483
|
+
}).join('')||'<tr><td colspan="6" class="dim">no briefs yet</td></tr>';
|
|
1484
|
+
Array.prototype.forEach.call(document.querySelectorAll('#briefs [data-batch]'),function(r){
|
|
1485
|
+
r.onclick=function(){ showBrief(r.getAttribute('data-batch')); };
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
// 3. Crews Table
|
|
1490
|
+
var crEl=document.getElementById('crews');
|
|
1491
|
+
if(crEl){
|
|
1492
|
+
crEl.innerHTML=s.workers.map(function(w){
|
|
1493
|
+
var pidStr=w.pid===null||w.pid===undefined?'—':String(w.pid);
|
|
1494
|
+
var drv=w.driver||w.spawnedHarness||'—';
|
|
1495
|
+
var rep=w.reply?(esc(w.reply.id)+(w.acked?' ✓':'')):'—';
|
|
1496
|
+
var kBtn=(w.known&&w.alive===true)?('<button class="danger" data-kill="'+esc(w.name)+'">kill</button>'):'';
|
|
1497
|
+
var bInfo=w.batch?('batch '+esc(short(w.batch,8))):'—';
|
|
1498
|
+
return '<tr class="worker-row" data-worker="'+esc(w.name)+'"><td><b>'+esc(w.name)+'</b></td><td>'+esc(stateOf(w))+'</td><td>'+esc(pidStr)+'</td><td>'+esc(drv)+'</td><td>'+bInfo+'</td><td>'+rep+'</td><td>'+kBtn+'</td></tr>';
|
|
1499
|
+
}).join('')||'<tr><td colspan="7" class="dim">no spawned workers yet</td></tr>';
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
// 4. Agents Table
|
|
1503
|
+
var agEl=document.getElementById('agents');
|
|
1504
|
+
if(agEl){
|
|
1505
|
+
agEl.innerHTML=s.agents.map(function(a){
|
|
1506
|
+
var dot=a.active?'<span style="color:var(--ok)">●</span>':'<span style="color:var(--dim)">○</span>';
|
|
1507
|
+
return '<tr><td>'+dot+' <b>'+esc(a.name)+'</b></td><td>'+esc(a.role||'worker')+'</td><td>'+(a.active?'active':'idle')+'</td><td>'+esc(ago(a.lastSeen))+'</td><td>'+a.unacked+'</td></tr>';
|
|
1508
|
+
}).join('')||'<tr><td colspan="5" class="dim">no agents yet</td></tr>';
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
// 5. Approvals Table & Badge
|
|
1512
|
+
var apEl=document.getElementById('approvals');
|
|
1513
|
+
var apBadge=document.getElementById('sidebar-approvals-badge');
|
|
1514
|
+
var apList=s.approvals||[];
|
|
1515
|
+
if(apBadge){
|
|
1516
|
+
if(apList.length>0){ apBadge.style.display='inline-block'; apBadge.textContent=apList.length; }
|
|
1517
|
+
else { apBadge.style.display='none'; }
|
|
1518
|
+
}
|
|
1519
|
+
if(apEl){
|
|
1520
|
+
apEl.innerHTML=apList.map(function(a){
|
|
1521
|
+
return '<tr><td>'+esc(a.id)+'</td><td><b>'+esc(a.from)+'</b></td><td>'+esc(a.subject)+'<br><span class="dim">'+esc(short(a.body,120))+'</span></td><td><input data-reason="'+esc(a.id)+'" maxlength="500" placeholder="optional instructions…"></td><td><button class="btn-primary" data-approve="'+esc(a.id)+'">Approve</button> <button class="danger" data-deny="'+esc(a.id)+'">Deny</button></td></tr>';
|
|
1522
|
+
}).join('')||'<tr><td colspan="5" class="dim">no pending approvals</td></tr>';
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
// 6. Fleet Table
|
|
1526
|
+
try{
|
|
1527
|
+
var fr=await fetch('/api/fleet',{cache:'no-store'});
|
|
1528
|
+
var fl=await fr.json();
|
|
1529
|
+
var flEl=document.getElementById('fleet');
|
|
1530
|
+
if(flEl){
|
|
1531
|
+
flEl.innerHTML=(fl.relays||[]).map(function(p){
|
|
1532
|
+
var live=p.live;
|
|
1533
|
+
return '<tr><td><b>'+esc(p.peer)+'</b></td><td>'+esc(live?live.role:'—')+'</td><td>'+esc(live&&live.weight!==null&&live.weight!==undefined?String(live.weight):'—')+'</td><td>'+esc(live&&live.workers!==null&&live.workers!==undefined?String(live.workers):'—')+'</td><td>'+esc(live&&live.lagMs!==null&&live.lagMs!==undefined?String(live.lagMs)+'ms':'—')+'</td><td>'+esc(p.lastOk)+'</td></tr>';
|
|
1534
|
+
}).join('')||'<tr><td colspan="6" class="dim">no peers synced yet</td></tr>';
|
|
1535
|
+
}
|
|
1536
|
+
}catch(_){}
|
|
1537
|
+
|
|
1538
|
+
// 7. Channels Feed & Broadcasts
|
|
1539
|
+
try{
|
|
1540
|
+
var cr=await fetch('/api/channels',{cache:'no-store'});
|
|
1541
|
+
var ch=await cr.json();
|
|
1542
|
+
var chEl=document.getElementById('channels');
|
|
1543
|
+
if(chEl){
|
|
1544
|
+
chEl.innerHTML=(ch.channels||[]).map(function(c){
|
|
1545
|
+
var heads=(c.latest||[]).map(function(p){
|
|
1546
|
+
return '<div class="log" style="margin:4px 0"><b>'+esc(p.id)+'</b> ['+esc(p.from)+'] '+(p.subject?'<b>'+esc(p.subject)+'</b> ':'')+esc(p.head)+'</div>';
|
|
1547
|
+
}).join('')||'<div class="dim">no posts</div>';
|
|
1548
|
+
return '<div class="card" style="margin:.5em 0"><b>'+esc(c.name)+'</b> <span class="dim">'+c.posts+' posts</span>'+heads+'</div>';
|
|
1549
|
+
}).join('')||'<div class="dim">no channels yet</div>';
|
|
1550
|
+
}
|
|
1551
|
+
}catch(_){}
|
|
1552
|
+
|
|
1553
|
+
var bcEl=document.getElementById('bcast');
|
|
1554
|
+
if(bcEl){
|
|
1555
|
+
bcEl.innerHTML=s.broadcasts.map(function(b){
|
|
1556
|
+
var to=Array.isArray(b.to)?b.to.join(','):String(b.to||'');
|
|
1557
|
+
return '<tr><td>'+esc(b.id)+'</td><td>'+esc(b.from)+'</td><td>'+esc(short(to,80))+'</td><td>'+esc(b.subject||'')+'</td><td>'+esc(short(b.body,140))+'</td></tr>';
|
|
1558
|
+
}).join('')||'<tr><td colspan="5" class="dim">no broadcasts</td></tr>';
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
// 8. Triage & Recent Feed
|
|
1562
|
+
try{
|
|
1563
|
+
var c=creds();
|
|
1564
|
+
var trEl=document.getElementById('triage');
|
|
1565
|
+
if(c.from){
|
|
1566
|
+
var tr=await fetch('/api/inbox?agent='+encodeURIComponent(c.from)+'&unacked=1&limit=50',{cache:'no-store'});
|
|
1567
|
+
var tj=await tr.json();
|
|
1568
|
+
if(trEl){
|
|
1569
|
+
trEl.innerHTML=(tj.items||[]).map(function(m){
|
|
1570
|
+
return '<tr><td>'+esc(m.id)+'</td><td>'+esc(m.from)+'</td><td>'+(m.subject?'<b>'+esc(m.subject)+'</b><br>':'')+esc(m.head)+'</td><td><button data-ack="'+esc(m.id)+'">ack</button></td></tr>';
|
|
1571
|
+
}).join('')||'<tr><td colspan="4" class="dim">inbox zero for '+esc(c.from)+'</td></tr>';
|
|
1572
|
+
}
|
|
1573
|
+
}else{
|
|
1574
|
+
if(trEl) trEl.innerHTML='<tr><td colspan="4" class="dim">set identity in Settings to triage</td></tr>';
|
|
1575
|
+
}
|
|
1576
|
+
}catch(_){}
|
|
1577
|
+
|
|
1578
|
+
window.__recent=s.recent||[];
|
|
1579
|
+
window.__ackedBy=s.ackedBy||{};
|
|
1580
|
+
renderRecent();
|
|
1581
|
+
|
|
1582
|
+
// 9. Results Table
|
|
1583
|
+
try{
|
|
1584
|
+
var rr=await fetch('/api/results',{cache:'no-store'});
|
|
1585
|
+
var rs=await rr.json();
|
|
1586
|
+
var rsEl=document.getElementById('results');
|
|
1587
|
+
if(rsEl){
|
|
1588
|
+
rsEl.innerHTML=(rs.groups||[]).map(function(g){
|
|
1589
|
+
var res=g.result?('<b>'+esc(g.result.artifact||'(no artifact)')+'</b><div class="dim">by '+esc(g.result.by||'?')+' @ '+esc(g.result.at||'?')+'</div>'):'<span class="dim">no verified result</span>';
|
|
1590
|
+
var run=(g.running||[]).map(function(m){return esc(m);}).join(', ')||'<span class="dim">none</span>';
|
|
1591
|
+
var btns=(g.losers||[]).map(function(m){return '<button class="danger" data-kill="'+esc(m)+'">kill '+esc(m)+'</button>';}).join(' ');
|
|
1592
|
+
var tele=g.messages+' msgs · '+g.replies+' replies · ~'+g.tokensEst+' tok · '+g.verifiedCount+' verified';
|
|
1593
|
+
return '<tr><td><b>'+esc(g.group)+'</b> ('+g.members+')</td><td>'+esc(tele)+'</td><td>'+res+'</td><td>'+run+'</td><td>'+btns+'</td></tr>';
|
|
1594
|
+
}).join('')||'<tr><td colspan="5" class="dim">no groups yet</td></tr>';
|
|
1595
|
+
}
|
|
1596
|
+
}catch(_){}
|
|
1597
|
+
|
|
1598
|
+
// 10. Audit Chain
|
|
1599
|
+
try{
|
|
1600
|
+
var ar=await fetch('/api/audit',{cache:'no-store'});
|
|
1601
|
+
var au=await ar.json();
|
|
1602
|
+
var v=au.verify||{};
|
|
1603
|
+
var avEl=document.getElementById('auditver');
|
|
1604
|
+
if(avEl)avEl.textContent=v.ok?('chain OK: '+v.count+' records'):('CHAIN BROKEN at seq '+v.firstBrokenSeq+' ('+(v.reason||'?')+')');
|
|
1605
|
+
var rows=(au.audit||[]).concat(au.chain||[]).sort(function(a,b){return (a.seq||0)-(b.seq||0);}).slice(-15);
|
|
1606
|
+
var auEl=document.getElementById('audit');
|
|
1607
|
+
if(auEl){
|
|
1608
|
+
auEl.innerHTML=rows.map(function(r){
|
|
1609
|
+
return '<tr><td>'+esc(String(r.seq===undefined||r.seq===null?'':r.seq))+'</td><td>'+esc(r.at||'')+'</td><td>'+esc(r.actor||'')+'</td><td>'+esc(r.type||'')+'</td><td>'+esc(short(r.target||'',40))+'</td><td>'+esc(r.result||'')+'</td></tr>';
|
|
1610
|
+
}).join('')||'<tr><td colspan="6" class="dim">no audit records yet</td></tr>';
|
|
1611
|
+
}
|
|
1612
|
+
}catch(_){}
|
|
1613
|
+
|
|
1614
|
+
// 11. Holds & Quotas
|
|
1615
|
+
try{
|
|
1616
|
+
var hr=await fetch('/api/holds',{cache:'no-store'});
|
|
1617
|
+
var hj=await hr.json();
|
|
1618
|
+
var h=(hj&&hj.hold)||null;
|
|
1619
|
+
var hb='';
|
|
1620
|
+
if(h&&h.active===true){
|
|
1621
|
+
var hw=h.placedBy||'unknown';
|
|
1622
|
+
var hn=h.placedAt||'unknown time';
|
|
1623
|
+
var hy=h.reason?(': '+h.reason):'';
|
|
1624
|
+
var hbd=(hj&&hj.board)||'';
|
|
1625
|
+
hb='<b>ACTIVE</b> — placed by '+esc(hw)+' at '+esc(hn)+(h.reason?': '+esc(h.reason):'');
|
|
1626
|
+
hb+='<div class="dim">'+esc('prune REFUSED — legal hold ACTIVE (placed by '+hw+' at '+hn+hy+') [board '+hbd+'] — lift with: hold lift --from <admin>')+'</div>';
|
|
1627
|
+
}else{
|
|
1628
|
+
hb='<span class="dim">no active legal hold</span>';
|
|
1629
|
+
}
|
|
1630
|
+
var hbEl=document.getElementById('holds-body');
|
|
1631
|
+
if(hbEl)hbEl.innerHTML=hb;
|
|
1632
|
+
}catch(_){}
|
|
1633
|
+
try{
|
|
1634
|
+
var qr=await fetch('/api/quotas',{cache:'no-store'});
|
|
1635
|
+
var qj=await qr.json();
|
|
1636
|
+
var q=(qj&&qj.quotas)||{};
|
|
1637
|
+
var agN=(s.agents||[]).length;
|
|
1638
|
+
var qb='<div>maxBytes: '+esc(q.maxBytes===undefined||q.maxBytes===null?'unlimited':humanBytes(q.maxBytes))+'</div>';
|
|
1639
|
+
var agOver=(q.maxAgents!==undefined&&q.maxAgents!==null&&agN>q.maxAgents)?' <b>OVER QUOTA</b>':'';
|
|
1640
|
+
qb+='<div>maxAgents: '+esc(q.maxAgents===undefined||q.maxAgents===null?'unlimited':q.maxAgents)+' <span class="dim">('+agN+' agents)</span>'+agOver+'</div>';
|
|
1641
|
+
if(q.maxChannels!==undefined&&q.maxChannels!==null){
|
|
1642
|
+
qb+='<div>maxChannels: '+esc(q.maxChannels)+'</div>';
|
|
1643
|
+
}
|
|
1644
|
+
if(q.tenant){qb+='<div>tenant: '+esc(q.tenant)+'</div>';}
|
|
1645
|
+
var qbEl=document.getElementById('quotas-body');
|
|
1646
|
+
if(qbEl)qbEl.innerHTML=qb;
|
|
1647
|
+
}catch(_){}
|
|
1648
|
+
|
|
1649
|
+
// Delegation
|
|
1650
|
+
Array.prototype.forEach.call(document.querySelectorAll('[data-kill]'),function(b){b.onclick=function(ev){ev.stopPropagation();kill([b.getAttribute('data-kill')]);};});
|
|
1651
|
+
Array.prototype.forEach.call(document.querySelectorAll('[data-ack]'),function(b){b.onclick=function(ev){ev.stopPropagation();ackOne(b.getAttribute('data-ack'));};});
|
|
1652
|
+
Array.prototype.forEach.call(document.querySelectorAll('[data-approve]'),function(b){b.onclick=function(ev){ev.stopPropagation();decide(b.getAttribute('data-approve'),'approved');};});
|
|
1653
|
+
Array.prototype.forEach.call(document.querySelectorAll('[data-deny]'),function(b){b.onclick=function(ev){ev.stopPropagation();decide(b.getAttribute('data-deny'),'denied');};});
|
|
1654
|
+
Array.prototype.forEach.call(document.querySelectorAll('[data-worker]'),function(r){r.onclick=function(){showInspector(r.getAttribute('data-worker'));};});
|
|
1655
|
+
}catch(e){}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
function stateOf(w){
|
|
1659
|
+
if(!w.known) return 'untracked';
|
|
1660
|
+
if(w.alive) return 'running';
|
|
1661
|
+
if(w.exitCode===0) return 'done';
|
|
1662
|
+
if(w.exitCode!==null&&w.exitCode!==undefined) return 'exit '+w.exitCode;
|
|
1663
|
+
return 'exited';
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
function humanBytes(n){
|
|
1667
|
+
if(typeof n!=='number'||!(n>=0)) return 'unlimited';
|
|
1668
|
+
if(n<1024) return n+' B';
|
|
1669
|
+
var u=['B','KB','MB','GB','TB'];
|
|
1670
|
+
var v=n;
|
|
1671
|
+
var i=0;
|
|
1672
|
+
while(v>=1024&&i<u.length-1){v/=1024;i++;}
|
|
1673
|
+
var r=Math.round(v*10)/10;
|
|
1674
|
+
return r+' '+u[i]+' ('+n+' bytes)';
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
function renderRecent(){
|
|
1678
|
+
var tbody=document.getElementById('recent');
|
|
1679
|
+
if(!tbody)return;
|
|
1680
|
+
var q=(document.getElementById('feed-q')?document.getElementById('feed-q').value:'').trim().toLowerCase();
|
|
1681
|
+
var type=document.getElementById('feed-type')?document.getElementById('feed-type').value:'';
|
|
1682
|
+
var list=(window.__recent||[]).filter(function(m){
|
|
1683
|
+
if(type==='checkpoint'&&!m.checkpoint) return false;
|
|
1684
|
+
if(type==='final'&&m.checkpoint) return false;
|
|
1685
|
+
if(q){
|
|
1686
|
+
var hay=(m.from+' '+(Array.isArray(m.to)?m.to.join(' '):m.to)+' '+(m.subject||'')+' '+(m.body||'')).toLowerCase();
|
|
1687
|
+
if(hay.indexOf(q)===-1) return false;
|
|
1688
|
+
}
|
|
1689
|
+
return true;
|
|
1690
|
+
});
|
|
1691
|
+
tbody.innerHTML=list.slice(0,30).map(function(m){
|
|
1692
|
+
var to=Array.isArray(m.to)?m.to.join(','):String(m.to||'');
|
|
1693
|
+
var acks=(window.__ackedBy[m.id]||[]).map(function(x){return '✓'+esc(x);}).join(' ');
|
|
1694
|
+
return '<tr><td>'+esc(m.id)+'</td><td>'+esc(m.from)+' → '+esc(short(to,40))+'</td><td>'+(m.subject?'<b>'+esc(m.subject)+'</b><br>':'')+esc(short(m.body,200))+'<div class="dim">'+(m.replyTo?('re: '+esc(m.replyTo)+' '):'')+(m.batch?('batch '+esc(m.batch)+' '):'')+acks+'</div></td></tr>';
|
|
1695
|
+
}).join('')||'<tr><td colspan="3" class="dim">no messages matching filter</td></tr>';
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
var fq=document.getElementById('feed-q'); if(fq) fq.oninput=renderRecent;
|
|
1699
|
+
var ft=document.getElementById('feed-type'); if(ft) ft.onchange=renderRecent;
|
|
1700
|
+
|
|
1701
|
+
// Harness & Model Metadata
|
|
1702
|
+
var __launchMetaCache={};
|
|
1703
|
+
function fetchLaunchMetaCached(key,url){
|
|
1704
|
+
var entry=__launchMetaCache[key];
|
|
1705
|
+
if(entry&&Date.now()-entry.at<60000) return Promise.resolve(entry.data);
|
|
1706
|
+
return fetch(url).then(function(r){return r.json();}).then(function(j){
|
|
1707
|
+
__launchMetaCache[key]={data:j,at:Date.now()};
|
|
1708
|
+
return j;
|
|
1709
|
+
}).catch(function(){ return entry?entry.data:null; });
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
window.__selectedHarnesses = ['claude'];
|
|
1713
|
+
|
|
1714
|
+
function updateCustomModelInputVisibility(){
|
|
1715
|
+
var sel=document.getElementById('launch-model');
|
|
1716
|
+
var customInp=document.getElementById('launch-model-custom');
|
|
1717
|
+
if(!sel||!customInp)return;
|
|
1718
|
+
if(sel.value==='__custom__'){
|
|
1719
|
+
customInp.style.display='inline-block';
|
|
1720
|
+
customInp.focus();
|
|
1721
|
+
}else{
|
|
1722
|
+
customInp.style.display='none';
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
function syncModelOptions(selectedHarness){
|
|
1727
|
+
var sel=document.getElementById('launch-model');
|
|
1728
|
+
if(!sel)return;
|
|
1729
|
+
var curVal=sel.value;
|
|
1730
|
+
var catalog=window.__modelCatalog||{};
|
|
1731
|
+
var harnesses=selectedHarness?[selectedHarness]:(window.__selectedHarnesses||['claude']);
|
|
1732
|
+
|
|
1733
|
+
var html='';
|
|
1734
|
+
if(harnesses.length===1){
|
|
1735
|
+
var h=harnesses[0];
|
|
1736
|
+
var models=catalog[h]||[];
|
|
1737
|
+
html+='<option value="">Default '+esc(h)+' model</option>';
|
|
1738
|
+
for(var i=0;i<models.length;i++){
|
|
1739
|
+
var m=models[i];
|
|
1740
|
+
var isSel=(m.id===curVal)?' selected':'';
|
|
1741
|
+
html+='<option value="'+esc(m.id)+'"'+isSel+'>'+esc(m.label||m.id)+'</option>';
|
|
1742
|
+
}
|
|
1743
|
+
}else{
|
|
1744
|
+
html+='<option value="">Default models (per harness)</option>';
|
|
1745
|
+
for(var j=0;j<harnesses.length;j++){
|
|
1746
|
+
var hj=harnesses[j];
|
|
1747
|
+
var hModels=catalog[hj]||[];
|
|
1748
|
+
if(hModels.length>0){
|
|
1749
|
+
html+='<optgroup label="'+esc(hj.toUpperCase())+' Models">';
|
|
1750
|
+
for(var k=0;k<hModels.length;k++){
|
|
1751
|
+
var mk=hModels[k];
|
|
1752
|
+
var isSelK=(mk.id===curVal)?' selected':'';
|
|
1753
|
+
html+='<option value="'+esc(mk.id)+'"'+isSelK+'>'+esc(mk.label||mk.id)+'</option>';
|
|
1754
|
+
}
|
|
1755
|
+
html+='</optgroup>';
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
html+='<option value="__custom__"'+(curVal==='__custom__'?' selected':'')+'>Custom model…</option>';
|
|
1760
|
+
sel.innerHTML=html;
|
|
1761
|
+
updateCustomModelInputVisibility();
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
var launchModelSel=document.getElementById('launch-model');
|
|
1765
|
+
if(launchModelSel){
|
|
1766
|
+
launchModelSel.onchange=updateCustomModelInputVisibility;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
function renderHarnessCards(){
|
|
1770
|
+
var container=document.getElementById('harness-cards');
|
|
1771
|
+
if(!container)return;
|
|
1772
|
+
var detected=window.__harnesses||[];
|
|
1773
|
+
var selected=window.__selectedHarnesses||['claude'];
|
|
1774
|
+
var list=['claude','codex','opencode','cursor','antigravity','grok','qwen'];
|
|
1775
|
+
var counts={};
|
|
1776
|
+
(window.__workers||[]).forEach(function(w){
|
|
1777
|
+
if(w.alive&&w.driver) counts[w.driver]=(counts[w.driver]||0)+1;
|
|
1778
|
+
});
|
|
1779
|
+
|
|
1780
|
+
container.innerHTML=list.map(function(d){
|
|
1781
|
+
var det=detected.find(function(x){return x.driver===d;});
|
|
1782
|
+
var isSel=selected.indexOf(d)!==-1;
|
|
1783
|
+
var cls='harness-card'+(isSel?' sel':'')+((det&&!det.detected)?' missing':'');
|
|
1784
|
+
var check=isSel?' <span style="font-size:10px;opacity:0.8">✓</span>':'';
|
|
1785
|
+
var badge=counts[d]?' <div class="dim" style="display:inline-block;font-size:10px;margin-left:3px">'+counts[d]+' running</div>':'';
|
|
1786
|
+
return '<div class="'+cls+'" data-harness="'+esc(d)+'" title="'+(isSel?'Click to deselect (at least 1 must remain)':'Click to select harness for crew')+'">'+esc(d)+check+badge+'</div>';
|
|
1787
|
+
}).join('');
|
|
1788
|
+
|
|
1789
|
+
Array.prototype.forEach.call(container.querySelectorAll('.harness-card'),function(c){
|
|
1790
|
+
c.onclick=function(){
|
|
1791
|
+
var h=c.getAttribute('data-harness');
|
|
1792
|
+
var selList=(window.__selectedHarnesses||['claude']).slice();
|
|
1793
|
+
var idx=selList.indexOf(h);
|
|
1794
|
+
if(idx!==-1){
|
|
1795
|
+
if(selList.length>1){
|
|
1796
|
+
selList.splice(idx,1);
|
|
1797
|
+
}
|
|
1798
|
+
}else{
|
|
1799
|
+
selList.push(h);
|
|
1800
|
+
var countEl=document.getElementById('launch-count');
|
|
1801
|
+
if(countEl&&(parseInt(countEl.value,10)||1)<selList.length){
|
|
1802
|
+
countEl.value=selList.length;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
window.__selectedHarnesses=selList;
|
|
1806
|
+
var sel=document.getElementById('launch-harness');
|
|
1807
|
+
if(sel) sel.value=selList.join(',');
|
|
1808
|
+
var topH=document.getElementById('topbar-harness');
|
|
1809
|
+
if(topH&&selList.length===1) topH.value=selList[0];
|
|
1810
|
+
renderHarnessCards();
|
|
1811
|
+
syncModelOptions();
|
|
1812
|
+
};
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
function selectSingleHarness(h){
|
|
1817
|
+
window.__selectedHarnesses=[h];
|
|
1818
|
+
var sel=document.getElementById('launch-harness');
|
|
1819
|
+
if(sel) sel.value=h;
|
|
1820
|
+
renderHarnessCards();
|
|
1821
|
+
syncModelOptions(h);
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
// live-refreshes only the table, never the <select> so user in-progress picks are untouched
|
|
1825
|
+
function refreshLaunchMeta(){
|
|
1826
|
+
fetchLaunchMetaCached('harnesses','/api/harnesses').then(function(h){
|
|
1827
|
+
if(h){
|
|
1828
|
+
window.__harnesses=h;
|
|
1829
|
+
var sel=document.getElementById('launch-harness');
|
|
1830
|
+
var oldVal=sel.value;
|
|
1831
|
+
var drivers=h.map(function(x){return x.driver;});
|
|
1832
|
+
sel.innerHTML=drivers.map(function(d){return '<option value="'+esc(d)+'">'+esc(d)+'</option>';}).join('');
|
|
1833
|
+
if(drivers.indexOf(oldVal)!==-1) sel.value=oldVal;
|
|
1834
|
+
renderHarnessCards();
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
1837
|
+
fetchLaunchMetaCached('routes','/api/routes').then(function(r){
|
|
1838
|
+
if(r&&r.routes){
|
|
1839
|
+
var rl=document.getElementById('routes-line');
|
|
1840
|
+
if(rl) rl.textContent=r.routes.join(' · ');
|
|
1841
|
+
}
|
|
1842
|
+
});
|
|
1843
|
+
fetchLaunchMetaCached('models','/api/models').then(function(m){
|
|
1844
|
+
var catalog=(m&&m.models)?m.models:(m||{});
|
|
1845
|
+
window.__modelCatalog=catalog;
|
|
1846
|
+
syncModelOptions();
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
function loadLaunchMeta(){ refreshLaunchMeta(); }
|
|
1851
|
+
|
|
1852
|
+
// Brief Counter & Stepper
|
|
1853
|
+
var briefInp=document.getElementById('launch-brief');
|
|
1854
|
+
if(briefInp){
|
|
1855
|
+
briefInp.addEventListener('input',function(){
|
|
1856
|
+
var len=this.value.length;
|
|
1857
|
+
var el=document.getElementById('launch-brief-count');
|
|
1858
|
+
if(el) el.textContent=len+'/8000';
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
var btnMinus=document.getElementById('launch-count-minus');
|
|
1863
|
+
var btnPlus=document.getElementById('launch-count-plus');
|
|
1864
|
+
var countInp=document.getElementById('launch-count');
|
|
1865
|
+
if(btnMinus&&countInp){
|
|
1866
|
+
btnMinus.onclick=function(){
|
|
1867
|
+
var v=Math.max(1,(parseInt(countInp.value,10)||1)-1);
|
|
1868
|
+
countInp.value=v;
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
if(btnPlus&&countInp){
|
|
1872
|
+
btnPlus.onclick=function(){
|
|
1873
|
+
var v=Math.min(20,(parseInt(countInp.value,10)||1)+1);
|
|
1874
|
+
countInp.value=v;
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
// Permission Segmented
|
|
1879
|
+
var permSeg=document.getElementById('launch-permission-seg');
|
|
1880
|
+
if(permSeg){
|
|
1881
|
+
Array.prototype.forEach.call(permSeg.querySelectorAll('button'),function(btn){
|
|
1882
|
+
btn.onclick=function(){
|
|
1883
|
+
Array.prototype.forEach.call(permSeg.querySelectorAll('button'),function(b){b.classList.remove('sel');});
|
|
1884
|
+
btn.classList.add('sel');
|
|
1885
|
+
var p=btn.getAttribute('data-perm');
|
|
1886
|
+
var inp=document.getElementById('launch-permission');
|
|
1887
|
+
if(inp) inp.value=p;
|
|
1888
|
+
};
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
function renderLaunchDiff(diff){
|
|
1893
|
+
var el=document.getElementById('launch-diff');
|
|
1894
|
+
if(!el)return;
|
|
1895
|
+
if(!diff||!diff.changes||diff.changes.length===0){ el.innerHTML=''; el.style.display='none'; return; }
|
|
1896
|
+
el.style.display='block';
|
|
1897
|
+
el.innerHTML='<div class="dim" style="font-size:11px;margin-bottom:4px">Dry-run preview diff:</div><div class="log">'+esc(diff.changes.join(String.fromCharCode(10)))+'</div>';
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
function say(msg,isErr){
|
|
1901
|
+
var res=document.getElementById('result');
|
|
1902
|
+
if(res){
|
|
1903
|
+
res.textContent=msg;
|
|
1904
|
+
res.style.color=isErr?'var(--danger)':'var(--ok)';
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
function creds(){
|
|
1909
|
+
try{
|
|
1910
|
+
return {
|
|
1911
|
+
from: document.getElementById('who')?document.getElementById('who').value.trim():localStorage.getItem('crewbus_who')||'',
|
|
1912
|
+
token: document.getElementById('tok')?document.getElementById('tok').value.trim():localStorage.getItem('crewbus_tok')||''
|
|
1913
|
+
};
|
|
1914
|
+
}catch(_){ return {from:'',token:''}; }
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
async function kill(names){
|
|
1918
|
+
var c=creds();
|
|
1919
|
+
var r=await fetch('/api/kill',{
|
|
1920
|
+
method:'POST',
|
|
1921
|
+
headers:{'content-type':'application/json'},
|
|
1922
|
+
body:JSON.stringify({from:c.from||'orchestrator',token:c.token||undefined,workers:names})
|
|
1923
|
+
});
|
|
1924
|
+
var j=await r.json();
|
|
1925
|
+
if(!r.ok){ say('kill failed: '+(j.error||r.status),true); return; }
|
|
1926
|
+
showUndoToast('Terminated '+names.join(', '));
|
|
1927
|
+
refresh();
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
async function ackOne(id){
|
|
1931
|
+
var c=creds();
|
|
1932
|
+
var r=await fetch('/api/ack',{
|
|
1933
|
+
method:'POST',
|
|
1934
|
+
headers:{'content-type':'application/json'},
|
|
1935
|
+
body:JSON.stringify({from:c.from||'orchestrator',token:c.token||undefined,id:id})
|
|
1936
|
+
});
|
|
1937
|
+
var j=await r.json();
|
|
1938
|
+
if(!r.ok) say('ack failed: '+(j.error||r.status),true);
|
|
1939
|
+
refresh();
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
async function decide(id, decision, reason){
|
|
1943
|
+
var c=creds();
|
|
1944
|
+
var reasonInp=document.querySelector('[data-reason="'+id+'"]');
|
|
1945
|
+
var actualReason=reason||(reasonInp?reasonInp.value.trim():'')||undefined;
|
|
1946
|
+
try{
|
|
1947
|
+
var r=await fetch('/api/approve',{
|
|
1948
|
+
method:'POST',
|
|
1949
|
+
headers:{'content-type':'application/json'},
|
|
1950
|
+
body:JSON.stringify({from:c.from||'orchestrator',token:c.token||undefined,id:id,decision:decision,reason:actualReason})
|
|
1951
|
+
});
|
|
1952
|
+
var j=await r.json();
|
|
1953
|
+
if(!r.ok){ say('approval decision failed: '+(j.error||r.status),true); return; }
|
|
1954
|
+
var card=document.querySelector('[data-approval-id="'+id+'"]');
|
|
1955
|
+
if(card){
|
|
1956
|
+
card.innerHTML='<div style="font-weight:600;color:'+(decision==='approved'?'var(--ok)':'var(--danger)')+'">'+(decision==='approved'?'✓ Approved':'✗ Declined')+'</div>';
|
|
1957
|
+
}
|
|
1958
|
+
refresh();
|
|
1959
|
+
}catch(e){ say('approval error: '+e.message,true); }
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
var btnKillAll=document.getElementById('killall');
|
|
1963
|
+
if(btnKillAll){
|
|
1964
|
+
btnKillAll.onclick=function(){
|
|
1965
|
+
var alive=(window.__workers||[]).filter(function(w){return w.alive;}).map(function(w){return w.name;});
|
|
1966
|
+
if(!alive.length){say('no active workers to kill');return;}
|
|
1967
|
+
if(confirm('kill '+alive.length+' active workers?')) kill(alive);
|
|
1968
|
+
};
|
|
1969
|
+
}
|
|
1970
|
+
var btnAckAll=document.getElementById('ackall');
|
|
1971
|
+
if(btnAckAll){
|
|
1972
|
+
btnAckAll.onclick=function(){
|
|
1973
|
+
var c=creds();
|
|
1974
|
+
fetch('/api/ack',{
|
|
1975
|
+
method:'POST',
|
|
1976
|
+
headers:{'content-type':'application/json'},
|
|
1977
|
+
body:JSON.stringify({from:c.from||'orchestrator',token:c.token||undefined,all:true})
|
|
1978
|
+
}).then(function(r){return r.json();}).then(function(j){say('acked all');refresh();});
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
// Launch Logic
|
|
1983
|
+
async function doLaunch(dryRun){
|
|
1984
|
+
var brief=(document.getElementById('launch-brief')?document.getElementById('launch-brief').value:'').trim();
|
|
1985
|
+
if(!brief){ say('enter instructions / brief before launching',true); return; }
|
|
1986
|
+
var harnesses=(window.__selectedHarnesses&&window.__selectedHarnesses.length>0)
|
|
1987
|
+
? window.__selectedHarnesses
|
|
1988
|
+
: [document.getElementById('launch-harness')?document.getElementById('launch-harness').value:'claude'];
|
|
1989
|
+
var harnessStr=harnesses.join(',');
|
|
1990
|
+
var count=parseInt(document.getElementById('launch-count')?document.getElementById('launch-count').value:'1',10)||1;
|
|
1991
|
+
var permission=document.getElementById('launch-permission')?document.getElementById('launch-permission').value:'supervised';
|
|
1992
|
+
var model=document.getElementById('launch-model')?document.getElementById('launch-model').value:'';
|
|
1993
|
+
if(model==='__custom__'){
|
|
1994
|
+
var customInp=document.getElementById('launch-model-custom');
|
|
1995
|
+
model=customInp?customInp.value.trim():'';
|
|
1996
|
+
}
|
|
1997
|
+
var cwd=(document.getElementById('launch-cwd')?document.getElementById('launch-cwd').value.trim():'')||undefined;
|
|
1998
|
+
var c=creds();
|
|
1999
|
+
|
|
2000
|
+
var payload={
|
|
2001
|
+
from: c.from||'orchestrator',
|
|
2002
|
+
token: c.token||undefined,
|
|
2003
|
+
harness: harnessStr,
|
|
2004
|
+
harnesses: harnesses,
|
|
2005
|
+
count: count,
|
|
2006
|
+
body: brief,
|
|
2007
|
+
permission: permission,
|
|
2008
|
+
dryRun: dryRun,
|
|
2009
|
+
cwd: cwd
|
|
2010
|
+
};
|
|
2011
|
+
if(model) payload.model=model;
|
|
2012
|
+
if(permission==='full'){
|
|
2013
|
+
if(!confirm('DANGER: permission "full" runs workers in completely unattended mode with all confirmations bypassed. Proceed?')) return;
|
|
2014
|
+
payload.iUnderstandDanger=true;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
var harnLabel=harnesses.join(', ');
|
|
2018
|
+
if(!dryRun && !confirm('live boot '+count+' worker(s) ('+harnLabel+')?')) return;
|
|
2019
|
+
|
|
2020
|
+
var outEl=document.getElementById('launch-out');
|
|
2021
|
+
if(outEl) outEl.style.display='none';
|
|
2022
|
+
|
|
2023
|
+
try{
|
|
2024
|
+
var r=await fetch('/api/launch',{
|
|
2025
|
+
method:'POST',
|
|
2026
|
+
headers:{'content-type':'application/json'},
|
|
2027
|
+
body:JSON.stringify(payload)
|
|
2028
|
+
});
|
|
2029
|
+
var j=await r.json();
|
|
2030
|
+
if(!r.ok){ say('launch failed ('+r.status+'): '+(j.error||'unknown error'),true); return; }
|
|
2031
|
+
|
|
2032
|
+
if(dryRun){
|
|
2033
|
+
if(outEl){
|
|
2034
|
+
outEl.style.display='block';
|
|
2035
|
+
outEl.textContent='[dry-run] plan valid — booted nothing.'+String.fromCharCode(10,10)+'Commands:'+String.fromCharCode(10)+(j.commands||[]).join(String.fromCharCode(10));
|
|
2036
|
+
}
|
|
2037
|
+
renderLaunchDiff({changes: j.commands||[]});
|
|
2038
|
+
} else {
|
|
2039
|
+
say('launched crew: '+(j.crewId||'ok'));
|
|
2040
|
+
if(document.getElementById('launch-brief')) document.getElementById('launch-brief').value='';
|
|
2041
|
+
if(j.batch) showBrief(j.batch);
|
|
2042
|
+
refresh();
|
|
2043
|
+
}
|
|
2044
|
+
}catch(e){ say('launch network error: '+e.message,true); }
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
var btnLaunchGo=document.getElementById('launch-go');
|
|
2048
|
+
if(btnLaunchGo){
|
|
2049
|
+
btnLaunchGo.onclick=function(){
|
|
2050
|
+
doLaunch(false);
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
var btnLaunchPrev=document.getElementById('launch-preview');
|
|
2054
|
+
if(btnLaunchPrev){
|
|
2055
|
+
btnLaunchPrev.onclick=function(){ doLaunch(true); };
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
document.addEventListener('keydown',function(e){
|
|
2059
|
+
if((e.ctrlKey||e.metaKey)&&e.key==='k'){
|
|
2060
|
+
e.preventDefault();
|
|
2061
|
+
openPalette();
|
|
2062
|
+
}
|
|
2063
|
+
if((e.ctrlKey||e.metaKey)&&e.key==='n'){
|
|
2064
|
+
e.preventDefault();
|
|
2065
|
+
startNewThread();
|
|
2066
|
+
}
|
|
2067
|
+
if((e.ctrlKey||e.metaKey)&&e.key==='Enter'){
|
|
2068
|
+
var brief=document.getElementById('launch-brief');
|
|
2069
|
+
if(brief&&document.activeElement===brief){
|
|
2070
|
+
e.preventDefault();
|
|
2071
|
+
var go=document.getElementById('launch-go');
|
|
2072
|
+
if(go) go.click();
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
});
|
|
2076
|
+
|
|
2077
|
+
// Command Palette
|
|
2078
|
+
function openPalette(){
|
|
2079
|
+
var p=document.getElementById('palette');
|
|
2080
|
+
if(p){ p.classList.add('open'); var inp=document.getElementById('palette-input'); if(inp){inp.value=''; inp.focus(); renderPaletteItems('');} }
|
|
2081
|
+
}
|
|
2082
|
+
function closePalette(){ var p=document.getElementById('palette'); if(p) p.classList.remove('open'); }
|
|
2083
|
+
var palInput=document.getElementById('palette-input');
|
|
2084
|
+
if(palInput){
|
|
2085
|
+
palInput.oninput=function(){ renderPaletteItems(this.value.toLowerCase().trim()); };
|
|
2086
|
+
palInput.onkeydown=function(e){
|
|
2087
|
+
if(e.key==='Escape') closePalette();
|
|
2088
|
+
};
|
|
2089
|
+
}
|
|
2090
|
+
var palWrap=document.getElementById('palette');
|
|
2091
|
+
if(palWrap){
|
|
2092
|
+
palWrap.onclick=function(e){ if(e.target===palWrap) closePalette(); };
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
function renderPaletteItems(q){
|
|
2096
|
+
var list=document.getElementById('palette-list');
|
|
2097
|
+
if(!list)return;
|
|
2098
|
+
var items=[
|
|
2099
|
+
{label:'New Mission Thread',action:function(){startNewThread();}},
|
|
2100
|
+
{label:'Set Codebase Folder…',action:function(){promptOrSelectProjectFolder();}},
|
|
2101
|
+
{label:'View Active Crews',action:function(){approotNavTo('sec-crews');}},
|
|
2102
|
+
{label:'View Approvals Queue',action:function(){approotNavTo('sec-approvals');}},
|
|
2103
|
+
{label:'View Fleet Sync',action:function(){approotNavTo('sec-fleet');}},
|
|
2104
|
+
{label:'View Broadcast Channels',action:function(){approotNavTo('sec-channels');}},
|
|
2105
|
+
{label:'Pair Mobile Device (QR)',action:function(){window.open('/pair','_blank');}},
|
|
2106
|
+
{label:'Toggle Dark / Light Mode',action:function(){crewbusThemeToggle();}},
|
|
2107
|
+
{label:'Kill All Running Workers',action:function(){btnKillAll.click();}}
|
|
2108
|
+
];
|
|
2109
|
+
(window.__workers||[]).forEach(function(w){
|
|
2110
|
+
items.push({label:'Inspect worker: '+w.name,action:function(){showInspector(w.name);}});
|
|
2111
|
+
});
|
|
2112
|
+
var filtered=items.filter(function(it){return !q||it.label.toLowerCase().indexOf(q)!==-1;});
|
|
2113
|
+
list.innerHTML=filtered.map(function(it,idx){
|
|
2114
|
+
return '<div class="'+(idx===0?'sel':'')+'" data-idx="'+idx+'">'+esc(it.label)+'</div>';
|
|
2115
|
+
}).join('');
|
|
2116
|
+
Array.prototype.forEach.call(list.querySelectorAll('div'),function(el){
|
|
2117
|
+
el.onclick=function(){
|
|
2118
|
+
var idx=parseInt(el.getAttribute('data-idx'),10);
|
|
2119
|
+
closePalette();
|
|
2120
|
+
if(filtered[idx]&&filtered[idx].action) filtered[idx].action();
|
|
2121
|
+
};
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
// Popover
|
|
2126
|
+
var projTrig=document.getElementById('project-trigger');
|
|
2127
|
+
if(projTrig){
|
|
2128
|
+
projTrig.onclick=function(ev){
|
|
2129
|
+
ev.stopPropagation();
|
|
2130
|
+
var p=document.getElementById('project-popover');
|
|
2131
|
+
if(p) p.classList.toggle('open');
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
document.addEventListener('click',function(e){
|
|
2135
|
+
var pop=document.getElementById('project-popover');
|
|
2136
|
+
if(pop&&!pop.contains(e.target)&&e.target!==projTrig) pop.classList.remove('open');
|
|
2137
|
+
});
|
|
2138
|
+
|
|
2139
|
+
var btnCopyBoard=document.getElementById('copy-board-btn');
|
|
2140
|
+
if(btnCopyBoard){
|
|
2141
|
+
btnCopyBoard.onclick=function(){
|
|
2142
|
+
try{ navigator.clipboard.writeText(boardPath); say('copied board path: '+boardPath); }catch(_){}
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
// Codebase Directory (Working Directory) Management
|
|
2147
|
+
function applyTargetCwd(pathStr, notify){
|
|
2148
|
+
pathStr=String(pathStr||'').trim();
|
|
2149
|
+
var cwdEl=document.getElementById('launch-cwd');
|
|
2150
|
+
if(cwdEl&&cwdEl.value!==pathStr) cwdEl.value=pathStr;
|
|
2151
|
+
var popCwd=document.getElementById('pop-cwd-path');
|
|
2152
|
+
if(popCwd) popCwd.textContent=pathStr||'(default: board parent)';
|
|
2153
|
+
var topbarBoard=document.getElementById('topbar-board');
|
|
2154
|
+
if(topbarBoard&&pathStr){
|
|
2155
|
+
topbarBoard.title='Codebase: '+pathStr;
|
|
2156
|
+
}
|
|
2157
|
+
if(pathStr){
|
|
2158
|
+
try{ localStorage.setItem('crewbus_last_cwd',pathStr); }catch(_){}
|
|
2159
|
+
try{
|
|
2160
|
+
fetch('/api/workspace',{
|
|
2161
|
+
method:'POST',
|
|
2162
|
+
headers:{'content-type':'application/json'},
|
|
2163
|
+
body:JSON.stringify({cwd:pathStr})
|
|
2164
|
+
}).catch(function(){});
|
|
2165
|
+
}catch(_){}
|
|
2166
|
+
if(notify) say('Target codebase set to: '+pathStr);
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
async function promptOrSelectProjectFolder(){
|
|
2171
|
+
var cur=(document.getElementById('launch-cwd')?document.getElementById('launch-cwd').value.trim():'')||localStorage.getItem('crewbus_last_cwd')||'';
|
|
2172
|
+
try{
|
|
2173
|
+
var dialog=window.__TAURI__&&window.__TAURI__.dialog;
|
|
2174
|
+
if(dialog&&typeof dialog.open==='function'){
|
|
2175
|
+
var selected=await dialog.open({directory:true,multiple:false,title:'Select Target Codebase Folder'});
|
|
2176
|
+
if(selected&&typeof selected==='string'){
|
|
2177
|
+
applyTargetCwd(selected.trim(),true);
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
}catch(_){}
|
|
2182
|
+
|
|
2183
|
+
if(typeof window.showDirectoryPicker==='function'){
|
|
2184
|
+
try{
|
|
2185
|
+
var dirHandle=await window.showDirectoryPicker();
|
|
2186
|
+
if(dirHandle&&dirHandle.name){
|
|
2187
|
+
var suggested=(cur&&cur.endsWith(dirHandle.name))?cur:dirHandle.name;
|
|
2188
|
+
var p=prompt('Confirm absolute directory path for "'+dirHandle.name+'" (where workers execute commands and edit code):',suggested);
|
|
2189
|
+
if(p&&p.trim()){
|
|
2190
|
+
applyTargetCwd(p.trim(),true);
|
|
2191
|
+
}else if(dirHandle.name){
|
|
2192
|
+
applyTargetCwd(dirHandle.name,true);
|
|
2193
|
+
}
|
|
2194
|
+
return;
|
|
2195
|
+
}
|
|
2196
|
+
}catch(err){
|
|
2197
|
+
if(err&&(err.name==='AbortError'||err.code===20)) return;
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
var manual=prompt('Enter target codebase directory path (where workers execute commands and edit code):',cur);
|
|
2202
|
+
if(manual&&manual.trim()){
|
|
2203
|
+
applyTargetCwd(manual.trim(),true);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
var openFolderBtn=document.getElementById('open-folder-btn');
|
|
2208
|
+
if(openFolderBtn) openFolderBtn.onclick=promptOrSelectProjectFolder;
|
|
2209
|
+
var lcBrowse=document.getElementById('launch-cwd-browse');
|
|
2210
|
+
if(lcBrowse) lcBrowse.onclick=promptOrSelectProjectFolder;
|
|
2211
|
+
var lcInp=document.getElementById('launch-cwd');
|
|
2212
|
+
if(lcInp){
|
|
2213
|
+
lcInp.oninput=function(){ applyTargetCwd(this.value,false); };
|
|
2214
|
+
try{
|
|
2215
|
+
var lastCwd=localStorage.getItem('crewbus_last_cwd');
|
|
2216
|
+
if(lastCwd) applyTargetCwd(lastCwd,false);
|
|
2217
|
+
}catch(_){}
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
var swBtn=document.getElementById('switch-board-btn');
|
|
2221
|
+
if(swBtn){
|
|
2222
|
+
swBtn.onclick=function(){
|
|
2223
|
+
var folder=prompt('Switch board: enter project folder or board directory path:','');
|
|
2224
|
+
if(!folder||!folder.trim()) return;
|
|
2225
|
+
try{
|
|
2226
|
+
var invoke=window.__TAURI__&&window.__TAURI__.core&&window.__TAURI__.core.invoke;
|
|
2227
|
+
if(typeof invoke==='function'){
|
|
2228
|
+
invoke('switch_board',{boardPath:folder.trim()}).then(function(){location.reload();});
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
}catch(_){}
|
|
2232
|
+
say('Board switching requires desktop app. CLI: crewbus serve --board '+folder.trim()+'/.crewbus');
|
|
2233
|
+
};
|
|
2234
|
+
}
|
|
2235
|
+
var rsBtn=document.getElementById('reset-board-btn');
|
|
2236
|
+
if(rsBtn){
|
|
2237
|
+
rsBtn.onclick=function(){
|
|
2238
|
+
try{
|
|
2239
|
+
var invoke=window.__TAURI__&&window.__TAURI__.core&&window.__TAURI__.core.invoke;
|
|
2240
|
+
if(typeof invoke==='function'){
|
|
2241
|
+
invoke('board_status').then(function(st){
|
|
2242
|
+
if(st&&st.defaultBoard) invoke('switch_board',{boardPath:st.defaultBoard}).then(function(){location.reload();});
|
|
2243
|
+
});
|
|
2244
|
+
return;
|
|
2245
|
+
}
|
|
2246
|
+
}catch(_){}
|
|
2247
|
+
say('Reset requires desktop app.');
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
try{
|
|
2252
|
+
fetch('/api/workspace').then(function(r){return r.ok?r.json():null;}).then(function(j){
|
|
2253
|
+
if(!j||!j.cwd)return;
|
|
2254
|
+
var cur=(document.getElementById('launch-cwd')?document.getElementById('launch-cwd').value.trim():'');
|
|
2255
|
+
try{
|
|
2256
|
+
var lsCwd=localStorage.getItem('crewbus_last_cwd')||'';
|
|
2257
|
+
if(lsCwd&&lsCwd!==j.cwd&&(!cur||cur===lsCwd)){
|
|
2258
|
+
fetch('/api/workspace',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({cwd:lsCwd})}).catch(function(){});
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2261
|
+
}catch(_){}
|
|
2262
|
+
if(!cur) applyTargetCwd(j.cwd,false);
|
|
2263
|
+
}).catch(function(){});
|
|
2264
|
+
}catch(_){}
|
|
2265
|
+
|
|
2266
|
+
// Data Age indicator
|
|
2267
|
+
function agoMs(ms){var s=Math.max(0,Math.floor(ms/1000));if(s<60)return s+'s';var m=Math.floor(s/60);if(m<60)return m+'m';return Math.floor(m/60)+'h';}
|
|
2268
|
+
function ago(iso){try{var t=Date.parse(iso);if(isNaN(t))return '?';return agoMs(Date.now()-t)+' ago';}catch(e){return '?';}}
|
|
2269
|
+
function updatePollAge(){
|
|
2270
|
+
var el=document.getElementById('poll-age');
|
|
2271
|
+
if(!el)return;
|
|
2272
|
+
if(!window.__lastBoardPoll){el.textContent='connecting…';return;}
|
|
2273
|
+
var age=Date.now()-window.__lastBoardPoll;
|
|
2274
|
+
var s=Math.max(0,Math.floor(age/1000));
|
|
2275
|
+
el.textContent=s+'s ago';
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
crewbusThemeInit();
|
|
2279
|
+
loadLaunchMeta();
|
|
2280
|
+
refresh();
|
|
2281
|
+
setInterval(refresh,5000);
|
|
2282
|
+
setInterval(updatePollAge,1000);
|
|
2283
|
+
</script>
|
|
2284
|
+
</body>
|
|
2285
|
+
</html>`;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
export const readKillBody = (req) =>
|
|
2289
|
+
new Promise((resolve) => {
|
|
2290
|
+
const chunks = [];
|
|
2291
|
+
let size = 0;
|
|
2292
|
+
req.on("data", (c) => {
|
|
2293
|
+
size += c.length;
|
|
2294
|
+
if (size <= 65536) chunks.push(c);
|
|
2295
|
+
});
|
|
2296
|
+
req.on("end", () => {
|
|
2297
|
+
if (size > 65536) return resolve({ error: [413, "body too large (max 64KB)"] });
|
|
2298
|
+
let body = null;
|
|
2299
|
+
try {
|
|
2300
|
+
body = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
2301
|
+
} catch {
|
|
2302
|
+
return resolve({ error: [400, "invalid JSON body"] });
|
|
2303
|
+
}
|
|
2304
|
+
resolve({ body });
|
|
2305
|
+
});
|
|
2306
|
+
req.on("error", () => resolve({ error: [400, "unreadable body"] }));
|
|
2307
|
+
});
|
|
2308
|
+
|
|
2309
|
+
// Shared web dashboard API routes for both `crewbus web` and `crewbus serve`
|
|
2310
|
+
// (embedded Tauri webview). Returns true if the route was handled, false otherwise.
|
|
2311
|
+
|
|
2312
|
+
let _qrSrc = null;
|
|
2313
|
+
function getQrSrc() {
|
|
2314
|
+
if (_qrSrc === null) {
|
|
2315
|
+
try {
|
|
2316
|
+
_qrSrc = fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), "qrcode.js"), "utf8");
|
|
2317
|
+
} catch {
|
|
2318
|
+
_qrSrc = "";
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
return _qrSrc;
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2126
2324
|
export function renderPairHtml(root) {
|
|
2127
2325
|
const qrCodeSrc = getQrSrc();
|
|
2128
2326
|
return `<!DOCTYPE html>
|