pidsmaker 4.0.0__py3-none-any.whl
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.
Potentially problematic release.
This version of pidsmaker might be problematic. Click here for more details.
- pidsmaker/__init__.py +22 -0
- pidsmaker/cli.py +32 -0
- pidsmaker/config/__init__.py +2 -0
- pidsmaker/config/config.py +2100 -0
- pidsmaker/config/pipeline.py +1768 -0
- pidsmaker/config/schemas.py +1032 -0
- pidsmaker/datasets.py +222 -0
- pidsmaker/debug_tests.py +30 -0
- pidsmaker/decoders/__init__.py +5 -0
- pidsmaker/decoders/custom_edge_mlp_decoder.py +17 -0
- pidsmaker/decoders/custom_mlp_decoder.py +10 -0
- pidsmaker/decoders/edge_linear_decoder.py +16 -0
- pidsmaker/decoders/inner_product_decoder.py +18 -0
- pidsmaker/decoders/nodlink_decoder.py +56 -0
- pidsmaker/detection/__init__.py +0 -0
- pidsmaker/detection/evaluation_methods/__init__.py +9 -0
- pidsmaker/detection/evaluation_methods/edge_evaluation.py +259 -0
- pidsmaker/detection/evaluation_methods/evaluation_utils.py +1730 -0
- pidsmaker/detection/evaluation_methods/host_two_stage_evaluation.py +115 -0
- pidsmaker/detection/evaluation_methods/node_evaluation.py +463 -0
- pidsmaker/detection/evaluation_methods/node_tw_evaluation.py +196 -0
- pidsmaker/detection/evaluation_methods/plot.py +192 -0
- pidsmaker/detection/evaluation_methods/queue_evaluation.py +451 -0
- pidsmaker/detection/evaluation_methods/tw_evaluation.py +95 -0
- pidsmaker/detection/flash_detection.py +162 -0
- pidsmaker/detection/magic_knn.py +190 -0
- pidsmaker/detection/node_scoring.py +52 -0
- pidsmaker/detection/threatrace_detection.py +65 -0
- pidsmaker/detection/training_methods/__init__.py +1 -0
- pidsmaker/detection/training_methods/inference_loop.py +293 -0
- pidsmaker/detection/training_methods/ocrapt_early_stop.py +165 -0
- pidsmaker/detection/training_methods/threatrace_training.py +169 -0
- pidsmaker/detection/training_methods/training_loop.py +377 -0
- pidsmaker/encoders/__init__.py +22 -0
- pidsmaker/encoders/argus_encoder.py +69 -0
- pidsmaker/encoders/custom_mlp.py +75 -0
- pidsmaker/encoders/custom_mlp_encoder.py +10 -0
- pidsmaker/encoders/egraphsage_encoder.py +56 -0
- pidsmaker/encoders/gat.py +67 -0
- pidsmaker/encoders/gcn.py +27 -0
- pidsmaker/encoders/gin.py +48 -0
- pidsmaker/encoders/glstm.py +298 -0
- pidsmaker/encoders/graph_attention.py +63 -0
- pidsmaker/encoders/gru.py +29 -0
- pidsmaker/encoders/hetero/__init__.py +4 -0
- pidsmaker/encoders/hetero/ancestor_encoder.py +98 -0
- pidsmaker/encoders/hetero/entity_encoder.py +33 -0
- pidsmaker/encoders/hetero/event_encoder.py +81 -0
- pidsmaker/encoders/hetero/hetero_graph_transformer.py +40 -0
- pidsmaker/encoders/lares_encoder.py +68 -0
- pidsmaker/encoders/linear_encoder.py +16 -0
- pidsmaker/encoders/magic_encoder.py +161 -0
- pidsmaker/encoders/rcaid_encoder.py +81 -0
- pidsmaker/encoders/rgcn.py +75 -0
- pidsmaker/encoders/sage.py +51 -0
- pidsmaker/encoders/shadewatcher_encoder.py +149 -0
- pidsmaker/encoders/sum_aggregation.py +20 -0
- pidsmaker/encoders/temporal_wrappers.py +80 -0
- pidsmaker/encoders/textrcnn.py +82 -0
- pidsmaker/encoders/tgn_encoder.py +193 -0
- pidsmaker/experiments/tuning.py +102 -0
- pidsmaker/experiments/uncertainty.py +261 -0
- pidsmaker/factory.py +1456 -0
- pidsmaker/featurization/__init__.py +0 -0
- pidsmaker/featurization/feat_inference_methods/__init__.py +7 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_HFH.py +31 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_TRW.py +67 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_alacarte.py +16 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_doc2vec.py +54 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_fasttext.py +38 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_flash.py +70 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_graph2vec.py +85 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_ocrapt_features.py +95 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_pretrained.py +1729 -0
- pidsmaker/featurization/feat_inference_methods/feat_inference_word2vec.py +56 -0
- pidsmaker/featurization/featurization_methods/__init__.py +0 -0
- pidsmaker/featurization/featurization_methods/build_trw.py +67 -0
- pidsmaker/featurization/featurization_methods/featurization_alacarte.py +748 -0
- pidsmaker/featurization/featurization_methods/featurization_doc2vec.py +99 -0
- pidsmaker/featurization/featurization_methods/featurization_fasttext.py +75 -0
- pidsmaker/featurization/featurization_methods/featurization_flash.py +203 -0
- pidsmaker/featurization/featurization_methods/featurization_graph2vec.py +243 -0
- pidsmaker/featurization/featurization_methods/featurization_trw.py +115 -0
- pidsmaker/featurization/featurization_methods/featurization_word2vec.py +87 -0
- pidsmaker/featurization/featurization_utils.py +275 -0
- pidsmaker/featurization/utils/build_random_walks.py +68 -0
- pidsmaker/featurization/utils/trw.py +203 -0
- pidsmaker/hetero.py +81 -0
- pidsmaker/losses.py +170 -0
- pidsmaker/main.py +377 -0
- pidsmaker/mimicry.py +284 -0
- pidsmaker/model.py +382 -0
- pidsmaker/objectives/__init__.py +16 -0
- pidsmaker/objectives/autoencode_edge_emb.py +43 -0
- pidsmaker/objectives/deep_graph_infomax.py +94 -0
- pidsmaker/objectives/detect_few_shot.py +21 -0
- pidsmaker/objectives/one_class.py +75 -0
- pidsmaker/objectives/predict_edge_contrastive.py +165 -0
- pidsmaker/objectives/predict_edge_supervised.py +77 -0
- pidsmaker/objectives/predict_edge_type.py +28 -0
- pidsmaker/objectives/predict_masked_struct.py +49 -0
- pidsmaker/objectives/predict_node_type.py +36 -0
- pidsmaker/objectives/predict_process_tag.py +169 -0
- pidsmaker/objectives/predict_snapshot_embedding.py +97 -0
- pidsmaker/objectives/reconstruct_edge_emb.py +16 -0
- pidsmaker/objectives/reconstruct_masked_feat.py +51 -0
- pidsmaker/objectives/reconstruct_node_emb.py +13 -0
- pidsmaker/objectives/reconstruct_node_feat.py +13 -0
- pidsmaker/objectives/validation_wrapper.py +55 -0
- pidsmaker/preprocessing/__init__.py +0 -0
- pidsmaker/preprocessing/build_graph_methods/__init__.py +1 -0
- pidsmaker/preprocessing/build_graph_methods/build_default_graphs.py +830 -0
- pidsmaker/preprocessing/build_graph_methods/build_magic_graphs.py +220 -0
- pidsmaker/preprocessing/cleaning.py +258 -0
- pidsmaker/preprocessing/transformation_methods/__init__.py +2 -0
- pidsmaker/preprocessing/transformation_methods/attack_generation/synthetic_attack_naive.py +194 -0
- pidsmaker/preprocessing/transformation_methods/transformation_dag.py +28 -0
- pidsmaker/preprocessing/transformation_methods/transformation_merge_edges.py +136 -0
- pidsmaker/preprocessing/transformation_methods/transformation_rcaid_pseudo_graph.py +510 -0
- pidsmaker/preprocessing/transformation_methods/transformation_undirected.py +24 -0
- pidsmaker/preprocessing/transformation_methods/transformation_utils.py +36 -0
- pidsmaker/pretrained/__init__.py +5 -0
- pidsmaker/pretrained/data/__init__.py +4 -0
- pidsmaker/pretrained/data/behavior_signatures.py +548 -0
- pidsmaker/pretrained/data/canonical_tokens.py +1035 -0
- pidsmaker/pretrained/data/edge_filter.py +381 -0
- pidsmaker/pretrained/data/entity_classes.py +476 -0
- pidsmaker/pretrained/data/sampler.py +926 -0
- pidsmaker/pretrained/data/tokenizer_bpe.py +1659 -0
- pidsmaker/pretrained/detect.py +1432 -0
- pidsmaker/pretrained/embedding_generator.py +252 -0
- pidsmaker/pretrained/finetune.py +1437 -0
- pidsmaker/pretrained/models/__init__.py +20 -0
- pidsmaker/pretrained/models/behavior.py +348 -0
- pidsmaker/pretrained/models/bert.py +286 -0
- pidsmaker/pretrained/models/deepwalk.py +128 -0
- pidsmaker/pretrained/models/dgi.py +120 -0
- pidsmaker/pretrained/models/gae.py +114 -0
- pidsmaker/pretrained/models/gnn_distill.py +475 -0
- pidsmaker/pretrained/models/graphmae.py +373 -0
- pidsmaker/pretrained/models/hf_pretrained.py +213 -0
- pidsmaker/pretrained/models/llama.py +110 -0
- pidsmaker/pretrained/models/modernbert.py +567 -0
- pidsmaker/pretrained/models/roberta.py +147 -0
- pidsmaker/pretrained/models/rope_utils.py +99 -0
- pidsmaker/pretrained/models/ropebert.py +322 -0
- pidsmaker/pretrained/models/spider.py +204 -0
- pidsmaker/pretrained/models/tgn.py +770 -0
- pidsmaker/pretrained/pretrain/__init__.py +3 -0
- pidsmaker/pretrained/pretrain/pretrain_behavior_cluster.py +513 -0
- pidsmaker/pretrained/pretrain/pretrain_common.py +585 -0
- pidsmaker/pretrained/pretrain/pretrain_deepwalk.py +31 -0
- pidsmaker/pretrained/pretrain/pretrain_dgi.py +143 -0
- pidsmaker/pretrained/pretrain/pretrain_gae.py +143 -0
- pidsmaker/pretrained/pretrain/pretrain_gnn_distill.py +438 -0
- pidsmaker/pretrained/pretrain/pretrain_graphmae.py +151 -0
- pidsmaker/pretrained/pretrain/pretrain_hf.py +169 -0
- pidsmaker/pretrained/pretrain/pretrain_main.py +276 -0
- pidsmaker/pretrained/pretrain/pretrain_mlm.py +491 -0
- pidsmaker/pretrained/pretrain/pretrain_spider.py +502 -0
- pidsmaker/pretrained/training_utils.py +157 -0
- pidsmaker/process_reapr_gt.py +101 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-CADETS/node_Nginx_Backdoor_06.csv +8 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-CADETS/node_Nginx_Backdoor_11.csv +4 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-CADETS/node_Nginx_Backdoor_12.csv +43 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-CADETS/node_Nginx_Backdoor_13.csv +24 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-CLEARSCOPE/node_clearscope_e3_firefox_0411.csv +41 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-CLEARSCOPE/node_clearscope_e3_firefox_0412.csv +0 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-FIVEDIRECTIONS/node_fivedirections_e3_browser_0412.csv +1 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-FIVEDIRECTIONS/node_fivedirections_e3_excel_0409.csv +63 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-FIVEDIRECTIONS/node_fivedirections_e3_firefox_0411.csv +56 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-THEIA/node_Browser_Extension_Drakon_Dropper.csv +61 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-THEIA/node_Firefox_Backdoor_Drakon_In_Memory.csv +58 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-TRACE/node_trace_e3_firefox_0410.csv +11 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-TRACE/node_trace_e3_phishing_executable_0413.csv +11 -0
- pidsmaker/resources/Ground_Truth/orthrus/E3-TRACE/node_trace_e3_pine_0413.csv +14 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-CADETS/node_Nginx_Drakon_APT.csv +19 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-CADETS/node_Nginx_Drakon_APT_17.csv +107 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_appstarter_0515.csv +26 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_firefox_0517.csv +1 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_lockwatch_0517.csv +17 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-CLEARSCOPE/node_clearscope_e5_tester_0517.csv +8 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_bits_0515.csv +54 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_copykatz_0509.csv +87 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_dns_0517.csv +11 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-FIVEDIRECTIONS/node_fivedirections_e5_drakon_0517.csv +6 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-THEIA/node_THEIA_1_Firefox_Drakon_APT_BinFmt_Elevate_Inject.csv +70 -0
- pidsmaker/resources/Ground_Truth/orthrus/E5-TRACE/node_Trace_Firefox_Drakon.csv +71 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m1.csv +1 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m2.csv +1 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m3.csv +1 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m4.csv +5 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m5.csv +23 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_m6.csv +18 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_s1.csv +1 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_s2.csv +1 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_s3.csv +16 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_edr/atlasv2_edr_s4.csv +22 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m1.csv +126 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m2.csv +105 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m3.csv +94 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m4.csv +139 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m5.csv +228 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_m6.csv +131 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_s1.csv +118 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_s2.csv +89 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_s3.csv +133 -0
- pidsmaker/resources/Ground_Truth/orthrus/atlasv2_h1/node_h1_s4.csv +135 -0
- pidsmaker/resources/Ground_Truth/orthrus/carbanakv2_edr/carbanakv2_edr.csv +2453 -0
- pidsmaker/resources/Ground_Truth/orthrus/h051/node_h051_0925.csv +114 -0
- pidsmaker/resources/Ground_Truth/orthrus/h201/node_h201_0923.csv +2905 -0
- pidsmaker/resources/Ground_Truth/orthrus/h501/node_h501_0924.csv +749 -0
- pidsmaker/resources/Ground_Truth/orthrus/readme.md +98 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-CADETS/node_Nginx_Backdoor_06.csv +3 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-CADETS/node_Nginx_Backdoor_12.csv +655 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-CADETS/node_Nginx_Backdoor_13.csv +770 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-FIVEDIRECTIONS/node_fivedirections_e3_excel_0409.csv +0 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-FIVEDIRECTIONS/node_fivedirections_e3_firefox_0411.csv +18 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-THEIA/node_Browser_Extension_Drakon_Dropper.csv +42 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-THEIA/node_Firefox_Backdoor_Drakon_In_Memory.csv +81 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-TRACE/node_trace_e3_firefox_0410.csv +37 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-TRACE/node_trace_e3_phishing_executable_0413.csv +9 -0
- pidsmaker/resources/Ground_Truth/reapr/E3-TRACE/node_trace_e3_pine_0413.csv +40 -0
- pidsmaker/resources/Ground_Truth/threatrace/E3-CADETS/ground_truth.txt +12858 -0
- pidsmaker/resources/Ground_Truth/threatrace/E3-FIVEDIRECTIONS/ground_truth.txt +18420 -0
- pidsmaker/resources/Ground_Truth/threatrace/E3-THEIA/ground_truth.txt +25363 -0
- pidsmaker/resources/Ground_Truth/threatrace/E3-TRACE/ground_truth.txt +68265 -0
- pidsmaker/resources/Ground_Truth/threatrace/README.md +123 -0
- pidsmaker/resources/config/anomal_e.yml +25 -0
- pidsmaker/resources/config/argus.yml +56 -0
- pidsmaker/resources/config/attack_edges/cadets_e3.yml +435 -0
- pidsmaker/resources/config/attack_edges/cadets_e5.yml +407 -0
- pidsmaker/resources/config/attack_edges/theia_e3.yml +382 -0
- pidsmaker/resources/config/attack_edges/theia_e5.yml +387 -0
- pidsmaker/resources/config/attack_edges/trace_e3.yml +415 -0
- pidsmaker/resources/config/attack_edges/trace_e5.yml +417 -0
- pidsmaker/resources/config/default.yml +315 -0
- pidsmaker/resources/config/egraphsage.yml +95 -0
- pidsmaker/resources/config/euler.yml +104 -0
- pidsmaker/resources/config/eval/eval_set_clustering.json +3170 -0
- pidsmaker/resources/config/experiments/tuning/components/tuning_featurization_methods.yml +29 -0
- pidsmaker/resources/config/experiments/tuning/systems/clearscope_e5/tuning_orthrus.yml +14 -0
- pidsmaker/resources/config/experiments/tuning/systems/default/tuning_default_baselines.yml +13 -0
- pidsmaker/resources/config/experiments/tuning/systems/default/tuning_orthrus_fixed.yml +16 -0
- pidsmaker/resources/config/experiments/uncertainty/none.yml +5 -0
- pidsmaker/resources/config/experiments/uncertainty/run_n_times.yml +12 -0
- pidsmaker/resources/config/experiments/uncertainty/run_n_times_hyperparameters.yml +12 -0
- pidsmaker/resources/config/experiments/uncertainty/uncertainty.yml +22 -0
- pidsmaker/resources/config/flash.yml +79 -0
- pidsmaker/resources/config/jbeil.yml +65 -0
- pidsmaker/resources/config/kairos.yml +121 -0
- pidsmaker/resources/config/lares.yml +115 -0
- pidsmaker/resources/config/magic.yml +86 -0
- pidsmaker/resources/config/nodlink.yml +79 -0
- pidsmaker/resources/config/ocrapt.yml +91 -0
- pidsmaker/resources/config/orthrus.yml +120 -0
- pidsmaker/resources/config/orthrus_fixed.yml +17 -0
- pidsmaker/resources/config/orthrus_non_snooped.yml +17 -0
- pidsmaker/resources/config/pretrained/README.md +101 -0
- pidsmaker/resources/config/pretrained/cybergfm/cybergfm.yml +49 -0
- pidsmaker/resources/config/pretrained/pretrained.yml +190 -0
- pidsmaker/resources/config/pretrained/pretrained_flash.yml +9 -0
- pidsmaker/resources/config/pretrained/pretrained_kairos.yml +12 -0
- pidsmaker/resources/config/pretrained/pretrained_magic.yml +1 -0
- pidsmaker/resources/config/pretrained/pretrained_nodlink.yml +1 -0
- pidsmaker/resources/config/pretrained/pretrained_orthrus.yml +1 -0
- pidsmaker/resources/config/pretrained/pretrained_supervised.yml +13 -0
- pidsmaker/resources/config/pretrained/pretrained_threatrace.yml +8 -0
- pidsmaker/resources/config/pretrained/pretrained_velox.yml +14 -0
- pidsmaker/resources/config/prographer.yml +136 -0
- pidsmaker/resources/config/rcaid.yml +88 -0
- pidsmaker/resources/config/shadewatcher.yml +146 -0
- pidsmaker/resources/config/tests.yml +10 -0
- pidsmaker/resources/config/threatrace.yml +73 -0
- pidsmaker/resources/config/tuned_baselines/optc_net/tuned_argus.yml +4 -0
- pidsmaker/resources/config/tuned_baselines/optc_net/tuned_lares.yml +13 -0
- pidsmaker/resources/config/velox.yml +10 -0
- pidsmaker/resources/config/viz_config.yml +10 -0
- pidsmaker/tasks/__init__.py +10 -0
- pidsmaker/tasks/batching.py +49 -0
- pidsmaker/tasks/construction.py +31 -0
- pidsmaker/tasks/evaluation.py +232 -0
- pidsmaker/tasks/feat_inference.py +413 -0
- pidsmaker/tasks/featurization.py +43 -0
- pidsmaker/tasks/training.py +19 -0
- pidsmaker/tasks/transformation.py +308 -0
- pidsmaker/tasks/triage.py +143 -0
- pidsmaker/tgn.py +635 -0
- pidsmaker/tokenization/__init__.py +112 -0
- pidsmaker/tokenization/base.py +58 -0
- pidsmaker/tokenization/bpe_tokenizer.py +83 -0
- pidsmaker/tokenization/hf_tokenizer.py +61 -0
- pidsmaker/tokenization/hierarchical_tokenizer.py +44 -0
- pidsmaker/tokenization/label_tokenizer.py +24 -0
- pidsmaker/tokenization/nltk_tokenizer.py +84 -0
- pidsmaker/tokenization/substitution.py +295 -0
- pidsmaker/triage/__init__.py +0 -0
- pidsmaker/triage/tracing_methods/__init__.py +1 -0
- pidsmaker/triage/tracing_methods/depimpact.py +213 -0
- pidsmaker/triage/tracing_methods/depimpact_utils.py +537 -0
- pidsmaker/triage/tracing_methods/ocrapt_subgraph.py +267 -0
- pidsmaker/utils/__init__.py +0 -0
- pidsmaker/utils/cache_utils.py +256 -0
- pidsmaker/utils/data_utils.py +1742 -0
- pidsmaker/utils/database.py +204 -0
- pidsmaker/utils/dataset_utils.py +413 -0
- pidsmaker/utils/dataset_writer.py +1057 -0
- pidsmaker/utils/graph_store.py +634 -0
- pidsmaker/utils/labelling.py +447 -0
- pidsmaker/utils/loss_files.py +193 -0
- pidsmaker/utils/process_tags.py +44 -0
- pidsmaker/utils/utils.py +730 -0
- pidsmaker/vizgen/__init__.py +1 -0
- pidsmaker/vizgen/dimensionality_reduction.py +249 -0
- pidsmaker/vizgen/embed_exporter.py +467 -0
- pidsmaker/vizgen/exporter.py +493 -0
- pidsmaker/vizgen/html_builder.py +936 -0
- pidsmaker/vizgen/web/__init__.py +1 -0
- pidsmaker/vizgen/web/export.py +62 -0
- pidsmaker/vizgen/web/static/css/app.css +250 -0
- pidsmaker/vizgen/web/static/index.html +182 -0
- pidsmaker/vizgen/web/static/js/app.js +627 -0
- pidsmaker/vizgen/web/static/js/campaign.js +123 -0
- pidsmaker/vizgen/web/static/js/data.js +119 -0
- pidsmaker/vizgen/web/static/js/dialogs.js +240 -0
- pidsmaker/vizgen/web/static/js/jobs.js +75 -0
- pidsmaker/vizgen/web/static/js/scene.js +651 -0
- pidsmaker/vizgen/web/static/js/ui.js +370 -0
- pidsmaker/vizgen/web/static/vendor/OrbitControls.js +1045 -0
- pidsmaker/vizgen/web/static/vendor/d3.v4.min.js +2 -0
- pidsmaker/vizgen/web/static/vendor/three.min.js +6 -0
- pidsmaker/vizgen/web/viz_server.py +2176 -0
- pidsmaker-4.0.0.dist-info/METADATA +596 -0
- pidsmaker-4.0.0.dist-info/RECORD +338 -0
- pidsmaker-4.0.0.dist-info/WHEEL +5 -0
- pidsmaker-4.0.0.dist-info/entry_points.txt +2 -0
- pidsmaker-4.0.0.dist-info/licenses/LICENSE +201 -0
- pidsmaker-4.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
/* app.js — application state, render-state composition, interactions */
|
|
2
|
+
const App = (() => {
|
|
3
|
+
const S = {
|
|
4
|
+
run: null, dec: null, attackPairs: null,
|
|
5
|
+
n: 0, baseColor: null, baseSize: null,
|
|
6
|
+
displayColor: null, displaySize: null, visible: null,
|
|
7
|
+
idToIdx: null, maxScore: 1,
|
|
8
|
+
selectedId: null, selectedIdxs: [],
|
|
9
|
+
searchRows: null, csvRows: null, // server-side filter results (buffer-row sets)
|
|
10
|
+
playTimer: null,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const $ = (id) => document.getElementById(id);
|
|
14
|
+
// Max nodes kept resident. A run bigger than this loads its first LOD_CAP nodes
|
|
15
|
+
// (the exporter's natural order); the cap is the browser/GPU limit, not the
|
|
16
|
+
// server. Buffer streams in LOD_CHUNK-sized steps that each render on arrival.
|
|
17
|
+
const LOD_CAP = 25000000; // load the whole run (covers 20M+); browser/GPU is the real limit
|
|
18
|
+
// Bumped on every loadRun so a superseded load (user switched runs, or the
|
|
19
|
+
// page navigated) bails quietly instead of popping a "Failed to load" alert
|
|
20
|
+
// when its now-orphaned fetch is aborted.
|
|
21
|
+
let loadToken = 0;
|
|
22
|
+
let selToken = 0; // bumped per selection so a stale on-demand meta fetch is dropped
|
|
23
|
+
let searchToken = 0; // bumped per search so a stale server-search result is dropped
|
|
24
|
+
const PLASMA = ['#0d0887', '#6a00a8', '#b12a90', '#e16462', '#fca636', '#f0f921']
|
|
25
|
+
.map((h) => [parseInt(h.slice(1, 3), 16) / 255, parseInt(h.slice(3, 5), 16) / 255, parseInt(h.slice(5, 7), 16) / 255]);
|
|
26
|
+
|
|
27
|
+
function plasma(t) {
|
|
28
|
+
t = Math.max(0, Math.min(1, t)) * (PLASMA.length - 1);
|
|
29
|
+
const i = Math.floor(t), f = t - i, a = PLASMA[i], b = PLASMA[Math.min(i + 1, PLASMA.length - 1)];
|
|
30
|
+
return [a[0] + (b[0] - a[0]) * f, a[1] + (b[1] - a[1]) * f, a[2] + (b[2] - a[2]) * f];
|
|
31
|
+
}
|
|
32
|
+
// Benign alphas run a bit higher than the old translucent look: with depthWrite
|
|
33
|
+
// on you see ~one disc layer (nearer points occlude farther) instead of many
|
|
34
|
+
// summed, so each point needs more opacity to keep clusters reading bright.
|
|
35
|
+
const BENIGN = { 0: [0.8, 0.5, 1.0, 0.55], 1: [0.3, 1.0, 0.7, 0.52], 2: [0.5, 0.8, 1.0, 0.6], 3: [0.5, 0.5, 0.5, 0.18] };
|
|
36
|
+
const DET_RED = [1.0, 0.2, 0.2, 0.9], UNDET_ORANGE = [1.0, 0.6, 0.2, 0.9];
|
|
37
|
+
function nodeRgba(label, det, type) {
|
|
38
|
+
if (label === 0) return BENIGN[type] || BENIGN[3];
|
|
39
|
+
return det === 2 ? UNDET_ORANGE : DET_RED;
|
|
40
|
+
}
|
|
41
|
+
// type_enum → readable name (matches viz_server _type_enum: 0 proc,1 file,2 net,3 other)
|
|
42
|
+
const TYPE_NAMES = ['process', 'file', 'netflow', 'other'];
|
|
43
|
+
function hsv2rgb(h, s, v) {
|
|
44
|
+
const i = Math.floor(h * 6), f = h * 6 - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s);
|
|
45
|
+
switch (i % 6) {
|
|
46
|
+
case 0: return [v, t, p]; case 1: return [q, v, p]; case 2: return [p, v, t];
|
|
47
|
+
case 3: return [p, q, v]; case 4: return [t, p, v]; default: return [v, p, q];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ---- flags accessors ----
|
|
52
|
+
// 0 id, 1 label, 2 det, 3 type. id is a u32 column; label/det/type are bit-packed
|
|
53
|
+
// into one byte per node (label<<0 | det<<1 | type<<3).
|
|
54
|
+
const flag = (i, k) => {
|
|
55
|
+
if (k === 0) return S.dec.ids[i];
|
|
56
|
+
const m = S.dec.meta[i];
|
|
57
|
+
return k === 1 ? (m & 1) : k === 2 ? ((m >> 1) & 3) : ((m >> 3) & 3);
|
|
58
|
+
};
|
|
59
|
+
const attr = (i, k) => S.dec.attrs[i * 5 + k]; // 0 tw,1 start,2 end,3 score,4 size
|
|
60
|
+
|
|
61
|
+
// First streaming step is small for a fast first paint; the step then doubles
|
|
62
|
+
// up to LOD_CHUNK_MAX so a big run needs far fewer round trips over the tunnel
|
|
63
|
+
// (20M ≈ 12 chunks instead of 80). The eased progress bar hides the step sizes.
|
|
64
|
+
const LOD_CHUNK = 250000; // first (smallest) streaming step
|
|
65
|
+
const LOD_CHUNK_MAX = 3000000; // cap on the growing step
|
|
66
|
+
|
|
67
|
+
function setTotalLabel(loaded, n) {
|
|
68
|
+
$('lbl_total').textContent = (loaded < n)
|
|
69
|
+
? `Showing ${loaded.toLocaleString()} of ${n.toLocaleString()} (sample)`
|
|
70
|
+
: 'Total Nodes: ' + n;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ---- smooth loader progress engine ----------------------------------------
|
|
74
|
+
// One rAF loop eases the displayed fill (and the count) toward a moving
|
|
75
|
+
// "ceiling" every frame, so the bar and the "N / total" number climb
|
|
76
|
+
// continuously in real time instead of snapping in 500K jumps.
|
|
77
|
+
// determinate (run streaming): loaderProgress() raises the ceiling to the
|
|
78
|
+
// real fraction as each chunk arrives; the fill keeps sliding toward it,
|
|
79
|
+
// and the shown count = round(fill * cap) so it ticks up smoothly.
|
|
80
|
+
// creep (single dialog fetch — See Edges / Causal, no measurable progress):
|
|
81
|
+
// the ceiling drifts toward ~90% on its own so the bar always advances.
|
|
82
|
+
const _pg = { raf: 0, cur: 0, ceil: 0, creep: false, cap: 0, total: 0 };
|
|
83
|
+
function _pgTick() {
|
|
84
|
+
if (_pg.creep) _pg.ceil = Math.min(0.9, _pg.ceil + (0.9 - _pg.ceil) * 0.035);
|
|
85
|
+
_pg.cur += (_pg.ceil - _pg.cur) * 0.14;
|
|
86
|
+
const f = Math.min(1, _pg.cur), pct = Math.round(f * 100);
|
|
87
|
+
$('load_fill').style.transform = 'scaleX(' + f.toFixed(4) + ')';
|
|
88
|
+
if (_pg.cap) {
|
|
89
|
+
const shown = Math.min(_pg.cap, Math.round(f * _pg.cap));
|
|
90
|
+
$('load_pct').textContent = `${shown.toLocaleString()} / ${_pg.cap.toLocaleString()}`
|
|
91
|
+
+ (_pg.cap < _pg.total ? ` (sample of ${_pg.total.toLocaleString()})` : '') + ` · ${pct}%`;
|
|
92
|
+
} else {
|
|
93
|
+
$('load_pct').textContent = `${pct}%`;
|
|
94
|
+
}
|
|
95
|
+
const settled = !_pg.creep && _pg.ceil >= 1 && _pg.cur > 0.999;
|
|
96
|
+
_pg.raf = settled ? 0 : requestAnimationFrame(_pgTick);
|
|
97
|
+
}
|
|
98
|
+
function _pgKick() { if (!_pg.raf) _pg.raf = requestAnimationFrame(_pgTick); }
|
|
99
|
+
function _pgBegin(creep) { _pg.cur = 0; _pg.ceil = creep ? 0.06 : 0; _pg.creep = !!creep; _pg.cap = 0; _pg.total = 0; _pgKick(); }
|
|
100
|
+
function _pgStop() { if (_pg.raf) cancelAnimationFrame(_pg.raf); _pg.raf = 0; }
|
|
101
|
+
// raise the ceiling to the real fraction; the fill + count slide toward it
|
|
102
|
+
function loaderProgress(loaded, cap, total) {
|
|
103
|
+
_pg.creep = false; _pg.cap = cap; _pg.total = total;
|
|
104
|
+
_pg.ceil = Math.min(1, Math.max(_pg.ceil, cap ? loaded / cap : 0));
|
|
105
|
+
_pgKick();
|
|
106
|
+
}
|
|
107
|
+
// hold at 100% just long enough for the fill + count to visibly complete
|
|
108
|
+
function loaderFinish() { _pg.creep = false; _pg.ceil = 1; _pgKick(); return new Promise((r) => setTimeout(r, 260)); }
|
|
109
|
+
|
|
110
|
+
// #loading = message + bar + %. `bar`: true → determinate (real count);
|
|
111
|
+
// 'creep' → auto-advancing bar for single fetches; falsy → message only.
|
|
112
|
+
function loaderShow(on, msg, bar) {
|
|
113
|
+
$('loading').style.display = on ? 'flex' : 'none';
|
|
114
|
+
if (msg) $('load_msg').textContent = msg;
|
|
115
|
+
const showBar = on && !!bar;
|
|
116
|
+
$('load_bar').style.display = showBar ? '' : 'none';
|
|
117
|
+
$('load_fill').style.display = showBar ? '' : 'none';
|
|
118
|
+
$('load_pct').style.display = showBar ? '' : 'none';
|
|
119
|
+
if (showBar) { $('load_fill').style.transform = 'scaleX(0)'; _pgBegin(bar !== true); }
|
|
120
|
+
else _pgStop();
|
|
121
|
+
}
|
|
122
|
+
const nextFrame = () => new Promise((r) => requestAnimationFrame(r));
|
|
123
|
+
// dialog fetches (See Edges, Extract Causal): a continuously-advancing bar + %
|
|
124
|
+
function showLoading(on, msg) { loaderShow(on, msg, 'creep'); }
|
|
125
|
+
|
|
126
|
+
function populateRunUI(run) {
|
|
127
|
+
$('hops').max = run.hops - 1; $('hops').value = run.hops - 1;
|
|
128
|
+
$('lbl_hops').textContent = `Hops (${run.hops - 1}):`;
|
|
129
|
+
$('row_hops').style.display = run.hops > 1 ? '' : 'none';
|
|
130
|
+
$('slider_tw').max = (run.max_tw || 0) * 100;
|
|
131
|
+
$('slider_tw').value = -100; $('lbl_tw').textContent = 'All';
|
|
132
|
+
UI.populateEpochs(run);
|
|
133
|
+
UI.fillStats(run); UI.fillDetection(run.detection_cost);
|
|
134
|
+
$('txt_config').textContent = run.run_config || '# No run_config.yml found for this run.';
|
|
135
|
+
$('lbl_model').textContent = 'Model: ' + run.model;
|
|
136
|
+
// the embedding-space picker only makes sense when both spaces were exported
|
|
137
|
+
$('emb_wrap').classList.toggle('hidden', !(run.word2vec_file && run.encoder_file));
|
|
138
|
+
// any file that is not the featurization projection is an encoder projection
|
|
139
|
+
// (a bare encoder file, or one of its per-epoch files)
|
|
140
|
+
$('cmb_emb').value = run.file === run.word2vec_file ? 'feat' : 'enc';
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// TIER 1 app state for a streamed core chunk: just colour (from label/det/type
|
|
144
|
+
// in the meta byte) and size (by label). Kept deliberately cheap so the cloud
|
|
145
|
+
// paints fast. The id→instances map is built in tier 2 — it is only needed by
|
|
146
|
+
// the temporal/attack overlays, and at 20M it is the single most expensive
|
|
147
|
+
// structure to build, so it must not gate the first paint. (String metadata is
|
|
148
|
+
// fetched per node on demand; it is never bulk-loaded.)
|
|
149
|
+
function appendCoreState(off, len) {
|
|
150
|
+
for (let i = 0; i < len; i++) {
|
|
151
|
+
const g = off + i;
|
|
152
|
+
S.baseColor.set(nodeRgba(flag(g, 1), flag(g, 2), flag(g, 3)), g * 4);
|
|
153
|
+
S.baseSize[g] = flag(g, 1) !== 0 ? 5.0 : 3.0; // malicious bigger; matches attrs[4]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// TIER 2 app state for a streamed aux chunk: the max anomaly score (heatmap
|
|
158
|
+
// normalisation) and the id→instances map (temporal trajectories / attack
|
|
159
|
+
// overlay). tw start/end are handled in the scene.
|
|
160
|
+
//
|
|
161
|
+
// This is the heaviest background step — millions of Map insertions + array
|
|
162
|
+
// pushes, which used to run as one synchronous stint per (growing, up to 3M-row)
|
|
163
|
+
// chunk and froze the UI for a beat right after the cloud appeared. It now runs
|
|
164
|
+
// in small time-budgeted slices: process rows until ~AUX_BUDGET_MS have elapsed
|
|
165
|
+
// this frame, then yield so the renderer paints, then resume. The main thread
|
|
166
|
+
// stays at ~60fps throughout — the work is spread across frames, not blocked in
|
|
167
|
+
// one lump. A superseded load (newer token) bails mid-way.
|
|
168
|
+
const AUX_BUDGET_MS = 8; // main-thread work per frame before yielding
|
|
169
|
+
const AUX_CLOCK_STEP = 8192; // rows between wall-clock checks (checking every row is itself costly)
|
|
170
|
+
async function appendAuxState(off, len, token) {
|
|
171
|
+
let i = 0;
|
|
172
|
+
while (i < len) {
|
|
173
|
+
const t0 = performance.now();
|
|
174
|
+
do {
|
|
175
|
+
const end = Math.min(i + AUX_CLOCK_STEP, len);
|
|
176
|
+
for (; i < end; i++) {
|
|
177
|
+
const g = off + i;
|
|
178
|
+
const sc = attr(g, 3);
|
|
179
|
+
if (sc > S.maxScore) S.maxScore = sc;
|
|
180
|
+
const id = flag(g, 0);
|
|
181
|
+
let arr = S.idToIdx.get(id);
|
|
182
|
+
if (!arr) { arr = []; S.idToIdx.set(id, arr); }
|
|
183
|
+
arr.push(g);
|
|
184
|
+
}
|
|
185
|
+
} while (i < len && performance.now() - t0 < AUX_BUDGET_MS);
|
|
186
|
+
if (token !== loadToken) return;
|
|
187
|
+
await nextFrame();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Render just the newly-streamed rows [off, off+len): base colours/sizes + the
|
|
192
|
+
// label/search/CSV visibility, uploaded as one slice. Overlays (heatmap/FP) and
|
|
193
|
+
// selection are applied once by the full refresh() at the end of the load — so
|
|
194
|
+
// streaming is O(total), not a full-cloud recompute per chunk (O(n²)).
|
|
195
|
+
function renderChunk(off, len) {
|
|
196
|
+
S.displayColor.set(S.baseColor.subarray(off * 4, (off + len) * 4), off * 4);
|
|
197
|
+
S.displaySize.set(S.baseSize.subarray(off, off + len), off);
|
|
198
|
+
const fb = $('chk_benign').checked, fd = $('chk_det').checked, fu = $('chk_undet').checked;
|
|
199
|
+
const sr = S.searchRows, cr = S.csvRows; // buffer-row sets (or null)
|
|
200
|
+
for (let i = off; i < off + len; i++) {
|
|
201
|
+
const lbl = flag(i, 1), det = flag(i, 2);
|
|
202
|
+
let show = (lbl === 0 && fb) || (lbl !== 0 && (det === 0 || det === 1) && fd) || (lbl !== 0 && det === 2 && fu);
|
|
203
|
+
if (show && (sr || cr)) show = (!sr || sr.has(i)) && (!cr || cr.has(i));
|
|
204
|
+
S.visible[i] = show ? 1 : 0;
|
|
205
|
+
}
|
|
206
|
+
Scene.updateDisplayRange(off, len, S.displayColor, S.displaySize, S.visible);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function loadRun(file) {
|
|
210
|
+
const token = ++loadToken;
|
|
211
|
+
loaderShow(true, 'Loading run…', true);
|
|
212
|
+
try {
|
|
213
|
+
const run = await Data.getRun(file);
|
|
214
|
+
if (token !== loadToken) return;
|
|
215
|
+
const cap = Math.min(run.n, LOD_CAP);
|
|
216
|
+
|
|
217
|
+
// allocate accumulators sized to cap; the scene accumulator is shared as S.dec.
|
|
218
|
+
S.run = run; S.attackPairs = null; S.n = 0; S.maxScore = 1e-9;
|
|
219
|
+
S.selectedId = null; S.selectedIdxs = [];
|
|
220
|
+
S.searchRows = null; S.csvRows = null; // server-side filter results (buffer-row sets)
|
|
221
|
+
S.auxReady = false; // tier-2 (time/score) attrs not loaded yet
|
|
222
|
+
S.baseColor = new Float32Array(cap * 4); S.baseSize = new Float32Array(cap);
|
|
223
|
+
S.displayColor = new Float32Array(cap * 4); S.displaySize = new Float32Array(cap);
|
|
224
|
+
S.visible = new Float32Array(cap);
|
|
225
|
+
S.idToIdx = new Map();
|
|
226
|
+
Scene.beginLoad(cap, run.hops, true);
|
|
227
|
+
S.dec = Scene.decoded;
|
|
228
|
+
populateRunUI(run);
|
|
229
|
+
clearSelection();
|
|
230
|
+
|
|
231
|
+
// TIER 1 — stream positions + colours in chunks; the cloud renders as it
|
|
232
|
+
// arrives. Chunk size GROWS (small first chunk → fast first paint; then
|
|
233
|
+
// bigger chunks → far fewer round trips over the tunnel for a big run).
|
|
234
|
+
for (let off = 0, step = LOD_CHUNK; off < cap; off += step, step = Math.min(step * 2, LOD_CHUNK_MAX)) {
|
|
235
|
+
const len = Math.min(step, cap - off);
|
|
236
|
+
// aim the bar/count at this chunk's end BEFORE fetching, so the fill and
|
|
237
|
+
// the "N / total" number climb continuously while the chunk downloads.
|
|
238
|
+
loaderProgress(off + len, cap, run.n);
|
|
239
|
+
const dec = await Data.getBufferCore(run, off, len);
|
|
240
|
+
if (token !== loadToken) return; // superseded by a newer load
|
|
241
|
+
Scene.appendCore(dec, off);
|
|
242
|
+
appendCoreState(off, len);
|
|
243
|
+
S.n = off + len;
|
|
244
|
+
renderChunk(off, len); // upload only this slice (not a full O(n) refresh)
|
|
245
|
+
await nextFrame(); // let the browser paint the new chunk
|
|
246
|
+
}
|
|
247
|
+
await loaderFinish(); // let the fill + count visibly reach 100%
|
|
248
|
+
loaderShow(false);
|
|
249
|
+
setTotalLabel(cap, run.n);
|
|
250
|
+
Scene.refreshBounds(); // one full-cloud bbox pass now that everything is in
|
|
251
|
+
refresh(); // one full render pass
|
|
252
|
+
try { localStorage.setItem('pids_last_run', file); } catch (e) { }
|
|
253
|
+
// TIER 2 — the cloud is up; pull the time/score attrs in the background so
|
|
254
|
+
// the slider, playback, heatmap, FP and attack-graph overlays light up.
|
|
255
|
+
loadAux(run, cap, token);
|
|
256
|
+
} catch (e) {
|
|
257
|
+
if (token === loadToken) { alert('Failed to load run: ' + e.message); loaderShow(false); }
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// TIER 2 background stream: the time/score attrs. Runs after the cloud is on
|
|
262
|
+
// screen; a superseded load (newer token) bails, and a failure just leaves the
|
|
263
|
+
// temporal/overlay features unavailable (the cloud stays fully usable).
|
|
264
|
+
async function loadAux(run, cap, token) {
|
|
265
|
+
// Fixed, moderate chunk (not the growing tier-1 step): keeps each decode /
|
|
266
|
+
// scene-scatter stint well under a frame, and pipelines the NEXT chunk's fetch
|
|
267
|
+
// so the network round-trip overlaps the current chunk's main-thread apply
|
|
268
|
+
// (fetch and CPU run in parallel) instead of stalling between chunks.
|
|
269
|
+
const AUX_CHUNK = 500000;
|
|
270
|
+
const fetchAt = (o) => (o < cap ? Data.getBufferAux(run, o, Math.min(AUX_CHUNK, cap - o)).catch(() => null) : null);
|
|
271
|
+
let pending = fetchAt(0);
|
|
272
|
+
for (let off = 0; off < cap; off += AUX_CHUNK) {
|
|
273
|
+
const len = Math.min(AUX_CHUNK, cap - off);
|
|
274
|
+
const dec = await pending;
|
|
275
|
+
if (token !== loadToken) return;
|
|
276
|
+
if (!dec) return; // fetch failed → leave overlays unavailable
|
|
277
|
+
pending = fetchAt(off + len); // kick the next fetch off NOW (overlaps the apply below)
|
|
278
|
+
Scene.appendAux(dec, off);
|
|
279
|
+
await appendAuxState(off, len, token); // time-sliced; yields each frame
|
|
280
|
+
}
|
|
281
|
+
if (token !== loadToken) return;
|
|
282
|
+
S.auxReady = true;
|
|
283
|
+
refresh(); // apply whatever temporal/overlay state is set, now that attrs exist
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// ---- visibility (filters + search + csv) ----
|
|
287
|
+
// Fill `out[0..S.n)` with the label/detection + search/CSV visibility. Search and
|
|
288
|
+
// CSV are resolved server-side into buffer-ROW sets (row == buffer index), so
|
|
289
|
+
// filtering is a direct index membership test — no ids needed. `hideSelected`
|
|
290
|
+
// also hides the selected instances (they are drawn by the highlight layer);
|
|
291
|
+
// picking passes false so it can still hit them.
|
|
292
|
+
// Snapshot the active filter checkboxes/row-sets once, so the per-point
|
|
293
|
+
// predicate below can be reused both for the full O(n) pass and for the tiny
|
|
294
|
+
// incremental update on selection (a few indices) without re-reading the DOM.
|
|
295
|
+
function visFilters() {
|
|
296
|
+
return {
|
|
297
|
+
fb: $('chk_benign').checked, fd: $('chk_det').checked, fu: $('chk_undet').checked,
|
|
298
|
+
sr: S.searchRows, cr: S.csvRows,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function visOne(i, f) {
|
|
302
|
+
const lbl = flag(i, 1), det = flag(i, 2);
|
|
303
|
+
let show = (lbl === 0 && f.fb) || (lbl !== 0 && (det === 0 || det === 1) && f.fd) || (lbl !== 0 && det === 2 && f.fu);
|
|
304
|
+
if (show && (f.sr || f.cr)) show = (!f.sr || f.sr.has(i)) && (!f.cr || f.cr.has(i));
|
|
305
|
+
return show ? 1 : 0;
|
|
306
|
+
}
|
|
307
|
+
function computeVisibleInto(out, hideSelected) {
|
|
308
|
+
const f = visFilters();
|
|
309
|
+
for (let i = 0; i < S.n; i++) out[i] = visOne(i, f);
|
|
310
|
+
if (hideSelected && S.selectedIdxs.length) for (const i of S.selectedIdxs) out[i] = 0;
|
|
311
|
+
}
|
|
312
|
+
function computeVisible() { computeVisibleInto(S.visible, true); }
|
|
313
|
+
|
|
314
|
+
// Invariant kept by both refresh() and refreshSelection(): S.visible holds the
|
|
315
|
+
// filter visibility with the currently selected instances forced hidden (they
|
|
316
|
+
// are drawn by the highlight layer instead). On a selection change we only need
|
|
317
|
+
// to restore the previously hidden instances and hide the new ones — a handful
|
|
318
|
+
// of writes plus one aVisible upload, versus a full recompute + full 4·n colour
|
|
319
|
+
// re-upload. Colours/sizes never depend on selection, so they are left alone.
|
|
320
|
+
function refreshSelection(prevIdxs) {
|
|
321
|
+
if (!S.run || !S.visible) return;
|
|
322
|
+
const f = visFilters();
|
|
323
|
+
const touched = [];
|
|
324
|
+
if (prevIdxs) for (const i of prevIdxs) { S.visible[i] = visOne(i, f); touched.push(i); }
|
|
325
|
+
for (const i of S.selectedIdxs) { S.visible[i] = 0; touched.push(i); }
|
|
326
|
+
Scene.updateVisibleAt(S.visible, touched); // upload only the rows that changed
|
|
327
|
+
Scene.setTime((S.auxReady && $('chk_temporal').checked) ? tval() : -1);
|
|
328
|
+
Scene.setDim(S.selectedIdxs.length > 0);
|
|
329
|
+
if (S.selectedIdxs.length) {
|
|
330
|
+
const hp = [];
|
|
331
|
+
for (const i of S.selectedIdxs) { const p = Scene.nodePos(i); hp.push(p[0], p[1], p[2]); }
|
|
332
|
+
Scene.setHighlight(hp);
|
|
333
|
+
} else Scene.setHighlight(null);
|
|
334
|
+
computeTrajectory();
|
|
335
|
+
computeAttack();
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// ---- display color/size (overlays) ----
|
|
339
|
+
function computeDisplay() {
|
|
340
|
+
S.displayColor.set(S.baseColor);
|
|
341
|
+
S.displaySize.set(S.baseSize);
|
|
342
|
+
const dc = S.run.detection_cost;
|
|
343
|
+
// heatmap / false-positive overlays read the per-node score (tier-2 attrs);
|
|
344
|
+
// until those load, only the base colours are shown.
|
|
345
|
+
if (!S.auxReady) return;
|
|
346
|
+
const fpCamp = $('chk_fp_campaign').checked, fpRec = $('chk_fp_recall').checked;
|
|
347
|
+
const heat = $('chk_heat').checked;
|
|
348
|
+
|
|
349
|
+
if ((fpCamp || fpRec) && dc) {
|
|
350
|
+
const thr = fpRec ? dc.thresh_full_recall : dc.thresh_full_campaign;
|
|
351
|
+
if (thr !== null && thr !== undefined) {
|
|
352
|
+
let fpCount = 0;
|
|
353
|
+
for (let i = 0; i < S.n; i++) if (flag(i, 1) === 0 && attr(i, 3) >= thr) fpCount++;
|
|
354
|
+
const fpAlpha = fpCount > 1000 ? 0.3 : 0.8, fpSize = fpCount > 1000 ? 4.0 : 7.0;
|
|
355
|
+
for (let i = 0; i < S.n; i++) {
|
|
356
|
+
const lbl = flag(i, 1), pos = attr(i, 3) >= thr, o = i * 4;
|
|
357
|
+
let col, sz;
|
|
358
|
+
if (lbl === 0 && !pos) { col = [0.2, 0.2, 0.2, 0.1]; sz = 2.0; }
|
|
359
|
+
else if (lbl !== 0 && !pos) { col = [1.0, 0.2, 0.2, 0.1]; sz = 2.0; }
|
|
360
|
+
else if (lbl !== 0 && pos) { col = [1.0, 0.2, 0.2, 0.4]; sz = 5.0; }
|
|
361
|
+
else { col = [1.0, 0.7, 0.0, fpAlpha]; sz = fpSize; }
|
|
362
|
+
S.displayColor[o] = col[0]; S.displayColor[o + 1] = col[1];
|
|
363
|
+
S.displayColor[o + 2] = col[2]; S.displayColor[o + 3] = col[3];
|
|
364
|
+
S.displaySize[i] = sz;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
} else if (heat) {
|
|
368
|
+
for (let i = 0; i < S.n; i++) {
|
|
369
|
+
if (flag(i, 1) !== 0) continue; // benign only
|
|
370
|
+
const c = plasma(attr(i, 3) / S.maxScore), o = i * 4;
|
|
371
|
+
S.displayColor[o] = c[0]; S.displayColor[o + 1] = c[1]; S.displayColor[o + 2] = c[2];
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// 2D flatten dims benign
|
|
375
|
+
if (!$('chk_temporal').checked) {
|
|
376
|
+
for (let i = 0; i < S.n; i++) if (flag(i, 1) === 0) S.displayColor[i * 4 + 3] *= 0.55;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// ---- trajectory + attack edges (time-aware) ----
|
|
381
|
+
function tval() {
|
|
382
|
+
const v = +$('slider_tw').value;
|
|
383
|
+
return v < 0 ? -1 : v / 100;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function computeTrajectory() {
|
|
387
|
+
// trajectories order instances by time window (tier-2 attr)
|
|
388
|
+
if (!S.auxReady || !$('chk_traj').checked || S.selectedId === null || S.selectedIdxs.length < 2) {
|
|
389
|
+
Scene.setTrajectory(null); return;
|
|
390
|
+
}
|
|
391
|
+
const t = tval();
|
|
392
|
+
const seq = S.selectedIdxs.map((i) => ({ tw: attr(i, 0), i })).sort((a, b) => a.tw - b.tw);
|
|
393
|
+
const pts = [], cols = [];
|
|
394
|
+
const n = seq.length;
|
|
395
|
+
for (let k = 0; k < n; k++) {
|
|
396
|
+
if (t >= 0 && seq[k].tw > t) break;
|
|
397
|
+
const p = Scene.nodePos(seq[k].i);
|
|
398
|
+
const ratio = k / Math.max(n - 1, 1);
|
|
399
|
+
const c = hsv2rgb(0.65 - ratio * 0.65, 1, 1);
|
|
400
|
+
const op = 0.2 + 0.8 * Math.pow(ratio, 3);
|
|
401
|
+
pts.push(p[0], p[1], p[2]); cols.push(c[0], c[1], c[2], op);
|
|
402
|
+
}
|
|
403
|
+
Scene.setTrajectory(pts, cols);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async function computeAttack() {
|
|
407
|
+
// attack edges are activated by node time windows (tier-2 attr)
|
|
408
|
+
if (!S.auxReady || !$('chk_attack').checked) { Scene.setAttackEdges(null); return; }
|
|
409
|
+
const pairs = await ensureAttackPairs();
|
|
410
|
+
if (!pairs) return;
|
|
411
|
+
const t = tval(), tAct = t < 0 ? Infinity : t;
|
|
412
|
+
const pts = [], cols = [];
|
|
413
|
+
for (const [u, v] of pairs) {
|
|
414
|
+
const iu = pickInstance(u, tAct), iv = pickInstance(v, tAct);
|
|
415
|
+
if (iu < 0 || iv < 0) continue;
|
|
416
|
+
const uf = firstTw(u), vf = firstTw(v), activation = Math.max(uf, vf);
|
|
417
|
+
let col;
|
|
418
|
+
if (tAct < activation) col = [1.0, 0.8, 0.0, 0.30];
|
|
419
|
+
else if (tAct < activation + 4.0) col = [0.93, 0.26, 0.26, 0.85];
|
|
420
|
+
else col = [0.93, 0.26, 0.26, 0.65];
|
|
421
|
+
const pu = Scene.nodePos(iu), pv = Scene.nodePos(iv);
|
|
422
|
+
pts.push(pu[0], pu[1], pu[2], pv[0], pv[1], pv[2]);
|
|
423
|
+
cols.push(...col, ...col);
|
|
424
|
+
}
|
|
425
|
+
Scene.setAttackEdges(pts, cols);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function firstTw(id) {
|
|
429
|
+
const idxs = S.idToIdx.get(id); if (!idxs) return Infinity;
|
|
430
|
+
let m = Infinity; for (const i of idxs) m = Math.min(m, attr(i, 0)); return m;
|
|
431
|
+
}
|
|
432
|
+
function pickInstance(id, t) {
|
|
433
|
+
const idxs = S.idToIdx.get(id); if (!idxs) return -1;
|
|
434
|
+
let best = -1, bestTw = -Infinity;
|
|
435
|
+
for (const i of idxs) {
|
|
436
|
+
const tw = attr(i, 0);
|
|
437
|
+
if ((t === Infinity || tw <= t) && tw >= bestTw) { bestTw = tw; best = i; }
|
|
438
|
+
}
|
|
439
|
+
return best >= 0 ? best : idxs[idxs.length - 1];
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
async function ensureAttackPairs() {
|
|
443
|
+
if (S.attackPairs) return S.attackPairs;
|
|
444
|
+
if (!S.run.has_adj) return null;
|
|
445
|
+
showLoading(true, 'Loading attack edges…');
|
|
446
|
+
try { S.attackPairs = (await Data.getAttackPairs(S.run.file)).pairs; }
|
|
447
|
+
catch (e) { S.attackPairs = null; }
|
|
448
|
+
finally { showLoading(false); }
|
|
449
|
+
return S.attackPairs;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// ---- master refresh (apply_visual_state) ----
|
|
453
|
+
function refresh() {
|
|
454
|
+
if (!S.run) return;
|
|
455
|
+
computeVisible();
|
|
456
|
+
computeDisplay();
|
|
457
|
+
Scene.updateDisplay(S.displayColor, S.displaySize, S.visible);
|
|
458
|
+
// temporal filtering needs the tier-2 tw attrs; until they load, show all time
|
|
459
|
+
Scene.setTime((S.auxReady && $('chk_temporal').checked) ? tval() : -1);
|
|
460
|
+
Scene.setDim(S.selectedIdxs.length > 0);
|
|
461
|
+
// highlight selected instances
|
|
462
|
+
if (S.selectedIdxs.length) {
|
|
463
|
+
const hp = [];
|
|
464
|
+
for (const i of S.selectedIdxs) { const p = Scene.nodePos(i); hp.push(p[0], p[1], p[2]); }
|
|
465
|
+
Scene.setHighlight(hp);
|
|
466
|
+
} else Scene.setHighlight(null);
|
|
467
|
+
computeTrajectory();
|
|
468
|
+
computeAttack();
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// ---- selection / inspector ----
|
|
472
|
+
// Selecting a node fetches ONLY that node's (and its 20 KNN neighbours') string
|
|
473
|
+
// metadata on demand, an O(1) server-side row lookup (MetaStore.node_at), so
|
|
474
|
+
// it is instant even at 20M nodes and no bulk metadata is ever downloaded.
|
|
475
|
+
function selectNode(idx) {
|
|
476
|
+
// Selection is keyed on the clicked buffer index (works before ids load). The
|
|
477
|
+
// node id + metadata come from /api/node?idxs=…; once we know the id (and if
|
|
478
|
+
// the id→instances map is ready) we expand to all its time-window instances.
|
|
479
|
+
const prev = S.selectedIdxs;
|
|
480
|
+
S.selectedIdxs = [idx];
|
|
481
|
+
S.selectedId = null;
|
|
482
|
+
const k = knn(idx);
|
|
483
|
+
const tok = ++selToken;
|
|
484
|
+
refreshSelection(prev); // highlight the clicked instance immediately
|
|
485
|
+
UI.showInspector(idx, k, null); // buffer-only fields now; strings fill in below
|
|
486
|
+
Data.getNode(S.run.file, [idx, ...k.nbIdxs]).then(({ rows }) => {
|
|
487
|
+
if (tok !== selToken) return; // selection changed while fetching
|
|
488
|
+
const self = rows[idx];
|
|
489
|
+
const prevSel = S.selectedIdxs;
|
|
490
|
+
if (self) {
|
|
491
|
+
S.selectedId = self.id;
|
|
492
|
+
S.selectedIdxs = (S.auxReady && S.idToIdx.get(self.id)) || [idx];
|
|
493
|
+
}
|
|
494
|
+
const prefixes = {};
|
|
495
|
+
for (const j of k.nbIdxs) {
|
|
496
|
+
const p = ((rows[j] && rows[j].path) || '').slice(0, 50);
|
|
497
|
+
prefixes[p] = (prefixes[p] || 0) + 1;
|
|
498
|
+
}
|
|
499
|
+
const topPre = Object.entries(prefixes).sort((a, b) => b[1] - a[1]).slice(0, 3);
|
|
500
|
+
UI.showInspector(idx, Object.assign({}, k, { topPre }), self || null);
|
|
501
|
+
refreshSelection(prevSel); // re-highlight now the id + instances are known
|
|
502
|
+
}).catch(() => { /* buffer-only inspector already shown */ });
|
|
503
|
+
}
|
|
504
|
+
function clearSelection() {
|
|
505
|
+
S.selectedId = null; S.selectedIdxs = [];
|
|
506
|
+
$('info_lbl').textContent = 'Click a point to inspect...';
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
function knn(idx, K = 20) {
|
|
510
|
+
// Nearest neighbours come from Scene's spatial grid (O(1)-ish) instead of an
|
|
511
|
+
// O(n) scan of every point — that scan was the main per-click freeze at scale.
|
|
512
|
+
const nbIdxs = Scene.knnIndices(idx, K);
|
|
513
|
+
// Aggregate the neighbourhood from the BUFFER only (label/det/type-enum/score);
|
|
514
|
+
// node types come from the type-enum, no metadata needed. nbIdxs is returned so
|
|
515
|
+
// the caller can fetch just these neighbours' paths on demand for "top paths".
|
|
516
|
+
let nb = 0, nd = 0, nu = 0; const types = {}; const scores = [];
|
|
517
|
+
for (const i of nbIdxs) {
|
|
518
|
+
const lbl = flag(i, 1), det = flag(i, 2);
|
|
519
|
+
if (lbl === 0) nb++; else if (det === 2) nu++; else nd++;
|
|
520
|
+
const tp = TYPE_NAMES[flag(i, 3)] || 'other';
|
|
521
|
+
types[tp] = (types[tp] || 0) + 1;
|
|
522
|
+
scores.push(attr(i, 3));
|
|
523
|
+
}
|
|
524
|
+
scores.sort((a, b) => a - b);
|
|
525
|
+
const med = scores.length ? scores[Math.floor(scores.length / 2)] : 0;
|
|
526
|
+
const purity = Math.max(nb, nd, nu) / Math.max(nbIdxs.length, 1);
|
|
527
|
+
const gap = attr(idx, 3) - med;
|
|
528
|
+
return { nb, nd, nu, types, purity, gap, K: nbIdxs.length, nbIdxs };
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// ---- playback ----
|
|
532
|
+
function togglePlay() {
|
|
533
|
+
if (!S.auxReady) return; // temporal data (tier-2) still loading
|
|
534
|
+
if (S.playTimer) { stopPlay(); return; }
|
|
535
|
+
const max = +$('slider_tw').max;
|
|
536
|
+
if (+$('slider_tw').value >= max) $('slider_tw').value = -100;
|
|
537
|
+
$('btn_play').textContent = '|| Pause';
|
|
538
|
+
S.playTimer = setInterval(playTick, 100);
|
|
539
|
+
}
|
|
540
|
+
function stopPlay() { clearInterval(S.playTimer); S.playTimer = null; $('btn_play').textContent = '▶ Play'; }
|
|
541
|
+
function playTick() {
|
|
542
|
+
const sl = $('slider_tw'), max = +sl.max;
|
|
543
|
+
const mult = parseInt($('combo_speed').value);
|
|
544
|
+
let v = +sl.value + 10 * mult;
|
|
545
|
+
if (v >= max) { v = max; stopPlay(); }
|
|
546
|
+
sl.value = v; onTwChange();
|
|
547
|
+
}
|
|
548
|
+
function onTwChange() {
|
|
549
|
+
const v = +$('slider_tw').value;
|
|
550
|
+
$('lbl_tw').textContent = v < 0 ? 'All' : (v / 100).toFixed(1);
|
|
551
|
+
refresh();
|
|
552
|
+
}
|
|
553
|
+
function resetTime() { stopPlay(); $('slider_tw').value = -100; onTwChange(); }
|
|
554
|
+
|
|
555
|
+
// ---- epoch / embedding swap ----
|
|
556
|
+
// space is 'feat' (featurization) or 'enc' (GNN encoder). Resolved by file
|
|
557
|
+
// identity, not by matching the literal "word2vec" in the name.
|
|
558
|
+
async function selectEmbedding(space) {
|
|
559
|
+
const cur = S.run.file;
|
|
560
|
+
const target = space === 'feat' ? S.run.word2vec_file : S.run.encoder_file;
|
|
561
|
+
if (target && target !== cur) await loadRun(target);
|
|
562
|
+
}
|
|
563
|
+
async function selectEpoch(file) { if (file) await loadRun(file); }
|
|
564
|
+
|
|
565
|
+
// ---- search / CSV filter (resolved server-side into buffer-row sets) ----
|
|
566
|
+
async function applySearch() {
|
|
567
|
+
if (!S.run) return;
|
|
568
|
+
const q = $('search_box').value.trim();
|
|
569
|
+
const tok = ++searchToken;
|
|
570
|
+
if (!q) { S.searchRows = null; refresh(); return; }
|
|
571
|
+
try {
|
|
572
|
+
const { rows } = await Data.getSearch(S.run.file, q);
|
|
573
|
+
if (tok !== searchToken) return; // superseded by newer keystrokes
|
|
574
|
+
S.searchRows = new Set(rows);
|
|
575
|
+
} catch (e) { S.searchRows = null; }
|
|
576
|
+
refresh();
|
|
577
|
+
}
|
|
578
|
+
async function applyCsv(terms) {
|
|
579
|
+
if (!S.run) return;
|
|
580
|
+
if (!terms || !terms.length) { S.csvRows = null; refresh(); return; }
|
|
581
|
+
try {
|
|
582
|
+
const { rows } = await Data.getFilter(S.run.file, terms);
|
|
583
|
+
S.csvRows = new Set(rows);
|
|
584
|
+
} catch (e) { S.csvRows = null; }
|
|
585
|
+
refresh();
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
return {
|
|
589
|
+
S, $, loadRun, refresh, selectNode, clearSelection, showLoading,
|
|
590
|
+
togglePlay, stopPlay, onTwChange, resetTime, selectEmbedding, selectEpoch,
|
|
591
|
+
flag, attr, applySearch, applyCsv, computeVisibleInto, TYPE_NAMES,
|
|
592
|
+
};
|
|
593
|
+
})();
|
|
594
|
+
|
|
595
|
+
// Expose the modules for the console / automated tests (harmless in prod).
|
|
596
|
+
Object.assign(window, { App, Data, Scene, UI, Dialogs, Campaign, Jobs });
|
|
597
|
+
|
|
598
|
+
// ---- bootstrap ----
|
|
599
|
+
window.addEventListener('DOMContentLoaded', async () => {
|
|
600
|
+
Scene.init(document.getElementById('glcanvas'));
|
|
601
|
+
UI.init();
|
|
602
|
+
|
|
603
|
+
// Any modal closes on backdrop click or Escape (not just its Close button).
|
|
604
|
+
// Every modal is a `.modal-bg` backdrop wrapping a `.modal`; clicking the
|
|
605
|
+
// backdrop itself (target === .modal-bg) or hitting Escape clears the mount.
|
|
606
|
+
const mount = document.getElementById('modal_mount');
|
|
607
|
+
mount.addEventListener('mousedown', (e) => {
|
|
608
|
+
if (e.target.classList.contains('modal-bg')) mount.innerHTML = '';
|
|
609
|
+
});
|
|
610
|
+
document.addEventListener('keydown', (e) => {
|
|
611
|
+
if (e.key === 'Escape' && mount.firstChild) mount.innerHTML = '';
|
|
612
|
+
});
|
|
613
|
+
try {
|
|
614
|
+
const data = await Data.getRuns();
|
|
615
|
+
// 1) reopen the last run viewed (if it still exists in artifacts)
|
|
616
|
+
let last = null;
|
|
617
|
+
try { last = localStorage.getItem('pids_last_run'); } catch (e) { }
|
|
618
|
+
if (last && data.runs.some((r) => r.default_file === last)) {
|
|
619
|
+
App.loadRun(last);
|
|
620
|
+
} else {
|
|
621
|
+
// 2) else the newest run that has viz data; else open the browser
|
|
622
|
+
const ready = data.runs.find((r) => r.default_file);
|
|
623
|
+
if (ready) App.loadRun(ready.default_file);
|
|
624
|
+
else UI.openBrowser();
|
|
625
|
+
}
|
|
626
|
+
} catch (e) { UI.openBrowser(); }
|
|
627
|
+
});
|