ProCreations commited on
Commit
c692cd7
·
verified ·
1 Parent(s): 4513191

Publish validated ICML reproduction

Browse files
.gitattributes CHANGED
@@ -1,35 +1,3 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ *.png filter=lfs diff=lfs merge=lfs -text
2
+ source_paper.pdf filter=lfs diff=lfs merge=lfs -text
3
+ source_archive.tar.gz filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
BUNDLE_SHA256SUMS.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 677530701aa216a5987b15675f80b19a3959bc3bc12ec5d402563c185db281b7 .gitattributes
2
+ 1f1a014c59964450011ac3e187ac0f9f79f7b7ad75f63c3b702a404ff6756047 README.md
3
+ 6988ca5673369a1c3ada117f208d0b11ec5b322201c34a7c07f53086c2a0d6ad SOURCE_PIN.txt
4
+ d1c28fc0a4e07f2688d013f576cf76ffc422d278d56a52a82989e0b93b3b3964 bucket-icon.svg
5
+ ec6262d8225be045f94a7423fdc6fea0be9fe339954edcfae466eead45248e1d build_manifest.py
6
+ 5abced67c2891fc0c79e07bbe682727b3d7de031966fe85a8f63a1a4e54f768e index.html
7
+ 64e1de4358c79ec0d5f2697c56f98258c025e992c94ad7b3b7801739222ca41d logbook.css
8
+ 69d73869184f936613668569980f31984be65229e77c4df4ba9604d3de70c02b logbook.js
9
+ 3b16d33e6485aa8d700afad168fb0074c49ef6bde31ce454569303420473b239 logbook.json
10
+ 6cbc26962fda4eaae86c7393e551e976d455d5ab806a3cc6684537e52850f218 official_claims.json
11
+ 065038869ed78a46daad882a4d9e9550ac8933333aab830770ed56717dea5eec outputs/depth_formula_audit.csv
12
+ a0b720a0031dead0ee4d3bb9f21cdef929fccdf04f2d7d6be0058397db9465e8 outputs/gaussian_lower_bound_audit.csv
13
+ ba22869657fc86ebb457d5ab5896860aa5dcbc25c2f27e774874136837c26bc8 outputs/network_protocol_audit.csv
14
+ 0060d0b025f6b7e884c91d68b3b283155149a96f9919bf665a8695bfb248c2e3 outputs/networked_information_audit.png
15
+ fb7017c9b56bc94ec493654e8f95a6f5611903691e839fe683f8a7e0cbb3bc5a outputs/orthogonality_decomposition_audit.csv
16
+ dfd67823e0c042767c60a6bc1d1882baf0fd48bdcc691dc80b386383a7104459 outputs/results.json
17
+ 581d13ad9cff4a03bb448c381fc2de25f75790218355403df9cd96c45c7c4840 outputs/source_claim_audit.csv
18
+ 065038869ed78a46daad882a4d9e9550ac8933333aab830770ed56717dea5eec packaged_replay/depth_formula_audit.csv
19
+ a0b720a0031dead0ee4d3bb9f21cdef929fccdf04f2d7d6be0058397db9465e8 packaged_replay/gaussian_lower_bound_audit.csv
20
+ ba22869657fc86ebb457d5ab5896860aa5dcbc25c2f27e774874136837c26bc8 packaged_replay/network_protocol_audit.csv
21
+ 0060d0b025f6b7e884c91d68b3b283155149a96f9919bf665a8695bfb248c2e3 packaged_replay/networked_information_audit.png
22
+ fb7017c9b56bc94ec493654e8f95a6f5611903691e839fe683f8a7e0cbb3bc5a packaged_replay/orthogonality_decomposition_audit.csv
23
+ dfd67823e0c042767c60a6bc1d1882baf0fd48bdcc691dc80b386383a7104459 packaged_replay/results.json
24
+ 581d13ad9cff4a03bb448c381fc2de25f75790218355403df9cd96c45c7c4840 packaged_replay/source_claim_audit.csv
25
+ b75d9f9a21173423cb649d0fc1f67f96c6e9cbf505fd1bc5e5a7b1e535f19f05 pages/claim-1-depth-upper-bound/page.md
26
+ e71c0fed0816f3c192d4ca70ab6899b9b1212a79359db7859cf2ac11ba86981d pages/claim-2-depth-lower-bound/page.md
27
+ 7a00be891a8eb501f6d2b31bb0e34864fba75d0c5a35cfa24c7926ecf82e2ab7 pages/claim-3-residual-orthogonality/page.md
28
+ 8c6e08fdd87c2dbaa04726e757dbbc51e47a1c852cfece651635ad4ac9fda39b pages/claim-4-bce-kl-decomposition/page.md
29
+ 9251cf3ec639ab3392b5086b3da974bfad167976fbf5f685719385422ffc4ab6 pages/claim-5-logit-passing-protocol/page.md
30
+ b58409359e7c02ddd738ad51233c13656eef5ecaf5822d08e1a5746d3c4ba6b9 pages/conclusion/page.md
31
+ ac9fdde88c16c2a1159f6912c78e7845cb84e7983a24dfd6d4613c7615144145 pages/executive-summary/page.md
32
+ 9eec09a5f56662a7d42e8ff85999d02cd7ca90fa8a756556cbff91ec5813437c pages/index.md
33
+ 82f8e039e63530d7126a319ff7bd89a6954cfe0d78d5a81bd735b886b8e5e704 paper.txt
34
+ 8cea42d58b1688a0b073719818de598db86f6eb1f4601b71f899bab7bd50f0b8 poster_embed.html
35
+ 2b25a6a28dc4e97547a294f28a74f01112ba66d9504e2dfc0240ba40e611bbbd reproduce.py
36
+ 18d9327b4ec19517d71a96ac807565af43b11b8132569ddbf660aec191f7fa8d requirements.txt
37
+ d17612d6f31795fe581812dd7e20bf00ce5fabc7408e61411b439232b9917417 source_archive.tar.gz
38
+ ca7263e8fd591b27cbd3f869d93ffe1818af27baaa439f278a27a5248ddd92b7 source_paper.pdf
39
+ a6eb72253c0128ce79b526a86b7943eed37beec186b5f57ff6c1701d0e9ff596 trackio-logo-light.png
40
+ 3e3792061d4d095759da30d7cfe7f14b621901793cd4d677b61b2896f5bf472b trackio-logo.png
41
+ 71da94795855710d214801eb9b9b7b8898e9a8757abac0e22966a0531bbb2f4f trackio-wordmark-dark.png
README.md CHANGED
@@ -1,10 +1,29 @@
1
  ---
2
- title: Repro Networked Information Aggregation For Binary Classification
3
- emoji: 😻
4
- colorFrom: gray
5
  colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Reproduction Networked Information Aggregation for Binary Classification
3
+ emoji: 🎯
4
+ colorFrom: purple
5
  colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - icml2026-repro
10
+ - paper-mrtg4NmvAe
11
  ---
12
 
13
+ # Reproduction bundle
14
+
15
+ This deterministic CPU-only Trackio logbook audits all five exact registered
16
+ claims for OpenReview `mrtg4NmvAe` against arXiv `2605.01082v1`.
17
+
18
+ Primary links: [OpenReview](https://openreview.net/forum?id=mrtg4NmvAe) and
19
+ [arXiv v1](https://arxiv.org/abs/2605.01082v1).
20
+
21
+ ```bash
22
+ PYTHONWARNINGS=error python reproduce.py --output replay
23
+ python build_manifest.py --verify
24
+ ```
25
+
26
+ Evidence includes exact nontrivial BCE projection identities, 48 sequential
27
+ logit-passing panels, 56 deterministic Gaussian lower-bound cells, 72 depth-
28
+ formula cells, and destructive non-optimal-reference and probability-passing
29
+ controls. Source proofs and finite diagnostics remain explicitly distinct.
SOURCE_PIN.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ OpenReview: mrtg4NmvAe
2
+ arXiv: 2605.01082v1
3
+ paper PDF SHA-256: ca7263e8fd591b27cbd3f869d93ffe1818af27baaa439f278a27a5248ddd92b7
4
+ source archive SHA-256: d17612d6f31795fe581812dd7e20bf00ce5fabc7408e61411b439232b9917417
5
+ The included sole-revision PDF and TeX source preserve Theorems 3.7/4.5, Lemmas 3.1/3.3, Section 2, their assumptions, and the hard-instance construction audited by reproduce.py.
bucket-icon.svg ADDED
build_manifest.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+ import argparse,hashlib
4
+ from pathlib import Path
5
+ ROOT=Path(__file__).resolve().parent;OUT=ROOT/"BUNDLE_SHA256SUMS.txt"
6
+ def digest(path:Path)->str:
7
+ value=hashlib.sha256()
8
+ with path.open("rb") as handle:
9
+ for block in iter(lambda:handle.read(1<<20),b""):value.update(block)
10
+ return value.hexdigest()
11
+ def rows()->list[str]:return [f"{digest(path)} {path.relative_to(ROOT).as_posix()}" for path in sorted(ROOT.rglob("*")) if path.is_file() and path!=OUT and "__pycache__" not in path.parts]
12
+ parser=argparse.ArgumentParser();parser.add_argument("--verify",action="store_true");args=parser.parse_args();rendered="\n".join(rows())+"\n"
13
+ if args.verify:
14
+ if not OUT.exists() or OUT.read_text(encoding="utf-8")!=rendered:raise SystemExit("manifest mismatch")
15
+ print(f"verified {len(rows())} entries")
16
+ else:OUT.write_text(rendered,encoding="utf-8");print(f"wrote {len(rows())} entries to {OUT.name}")
index.html CHANGED
@@ -1,19 +1,54 @@
1
  <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
  <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Reproduction: Networked Information Aggregation for Binary Classification</title>
7
+ <link rel="stylesheet" href="./logbook.css" />
8
+ </head>
9
+ <body>
10
+ <div id="app">
11
+ <aside id="sidebar">
12
+ <div id="book-head">
13
+ <img id="book-wordmark" src="./trackio-wordmark-dark.png" alt="" />
14
+ <div id="book-title" class="sr-only">Logbook</div>
15
+ </div>
16
+ <nav id="tree"></nav>
17
+ <div id="sidebar-foot" hidden>
18
+ <button id="connect-btn" type="button">
19
+ <span class="ico">ⓘ</span> Collaborate with your agent
20
+ </button>
21
+ </div>
22
+ </aside>
23
+ <main id="content">
24
+ <div id="page"></div>
25
+ </main>
26
+ </div>
27
+
28
+ <div id="modal" hidden>
29
+ <div class="modal-backdrop"></div>
30
+ <div class="modal-card" role="dialog" aria-modal="true">
31
+ <div class="modal-head">
32
+ <div class="modal-title">
33
+ <img class="modal-logo" src="./trackio-logo.png" alt="" />
34
+ Collaborate with your agent
35
+ </div>
36
+ <div class="modal-actions">
37
+ <button id="copy-agent" class="btn">Copy for agent</button>
38
+ <button id="modal-close" class="btn icon" aria-label="Close">×</button>
39
+ </div>
40
+ </div>
41
+ <div class="modal-body">
42
+ <p class="modal-intro">
43
+ Point your coding agent at this logbook. It reads a compact,
44
+ token-efficient version — and if you've given it write access to this
45
+ Space, it can add findings that sync back automatically.
46
+ </p>
47
+ <ol id="connect-steps"></ol>
48
+ </div>
49
+ </div>
50
+ </div>
51
+
52
+ <script src="./logbook.js"></script>
53
+ </body>
54
  </html>
logbook.css ADDED
@@ -0,0 +1,1602 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --bg: #ffffff;
3
+ --paper: #fdfcf9;
4
+ --panel: #ffffff;
5
+ --ink: #1f2937;
6
+ --muted: #6b7280;
7
+ --line: #e5e7eb;
8
+ --accent: #f97316;
9
+ --accent-strong: #ea580c;
10
+ --accent-soft: #fff7ed;
11
+ --accent-line: rgba(249, 115, 22, 0.16);
12
+ --grid-line: rgba(31, 41, 55, 0.045);
13
+ --code-bg: #f3f4f6;
14
+ --radius: 12px;
15
+ --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
16
+ --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
17
+ sans-serif;
18
+ --mono: "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas,
19
+ ui-monospace, monospace;
20
+ }
21
+
22
+ * {
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ html,
27
+ body {
28
+ margin: 0;
29
+ padding: 0;
30
+ }
31
+
32
+ html {
33
+ scroll-behavior: smooth;
34
+ }
35
+
36
+ body {
37
+ background: var(--bg);
38
+ color: var(--ink);
39
+ font-family: var(--sans);
40
+ font-size: 13px;
41
+ line-height: 1.65;
42
+ -webkit-font-smoothing: antialiased;
43
+ }
44
+
45
+ #app {
46
+ display: flex;
47
+ min-height: 100vh;
48
+ }
49
+
50
+ /* ---- sidebar (composition-book cover) ---- */
51
+ #sidebar {
52
+ width: 280px;
53
+ flex: 0 0 280px;
54
+ background: #17181c;
55
+ color: #e7e7ea;
56
+ position: sticky;
57
+ top: 0;
58
+ height: 100vh;
59
+ overflow-y: auto;
60
+ padding: 22px 16px;
61
+ display: flex;
62
+ flex-direction: column;
63
+ }
64
+
65
+ #book-head {
66
+ display: flex;
67
+ align-items: center;
68
+ gap: 10px;
69
+ padding: 8px;
70
+ margin-bottom: 12px;
71
+ border-radius: 10px;
72
+ cursor: pointer;
73
+ transition: background 0.12s;
74
+ }
75
+ #book-head:hover {
76
+ background: rgba(255, 255, 255, 0.05);
77
+ }
78
+ #book-wordmark {
79
+ width: 154px;
80
+ height: auto;
81
+ object-fit: contain;
82
+ }
83
+ .sr-only {
84
+ position: absolute;
85
+ width: 1px;
86
+ height: 1px;
87
+ padding: 0;
88
+ margin: -1px;
89
+ overflow: hidden;
90
+ clip: rect(0, 0, 0, 0);
91
+ white-space: nowrap;
92
+ border: 0;
93
+ }
94
+
95
+ #tree {
96
+ flex: 1;
97
+ padding-top: 8px;
98
+ }
99
+
100
+ #tree a {
101
+ display: block;
102
+ padding: 6px 10px;
103
+ border-radius: 8px;
104
+ color: #c3c4cb;
105
+ text-decoration: none;
106
+ font-size: 14px;
107
+ transition: background 0.12s, color 0.12s;
108
+ }
109
+
110
+ #tree a:hover {
111
+ background: rgba(255, 255, 255, 0.06);
112
+ color: #ffffff;
113
+ }
114
+
115
+ #tree a.active {
116
+ background: rgba(249, 115, 22, 0.16);
117
+ color: #fdba74;
118
+ font-weight: 600;
119
+ }
120
+
121
+ #tree a .tree-mark {
122
+ color: #6b6d76;
123
+ }
124
+
125
+ #tree a:hover .tree-mark,
126
+ #tree a.active .tree-mark {
127
+ color: inherit;
128
+ opacity: 0.6;
129
+ }
130
+
131
+ #tree .depth-1 {
132
+ padding-left: 22px;
133
+ }
134
+ #tree .depth-2 {
135
+ padding-left: 34px;
136
+ }
137
+ #tree .depth-3 {
138
+ padding-left: 46px;
139
+ }
140
+
141
+
142
+ /* ---- content ---- */
143
+ #content {
144
+ flex: 1;
145
+ min-width: 0;
146
+ padding: 48px 40px 120px;
147
+ background-color: var(--paper);
148
+ background-image:
149
+ linear-gradient(var(--grid-line) 1px, transparent 1px),
150
+ linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
151
+ background-size: 26px 26px;
152
+ background-position: center top;
153
+ }
154
+
155
+ #page {
156
+ width: 100%;
157
+ min-width: 0;
158
+ max-width: 1052px;
159
+ margin: 0 auto;
160
+ }
161
+
162
+ .page-section {
163
+ scroll-margin-top: 40px;
164
+ padding: 0 0 35px;
165
+ margin: 0 0 32px;
166
+ }
167
+
168
+ .page-section:last-child {
169
+ margin-bottom: 0;
170
+ }
171
+
172
+ .page-layout {
173
+ display: grid;
174
+ grid-template-columns: minmax(0, 760px) 248px;
175
+ gap: 44px;
176
+ align-items: start;
177
+ }
178
+
179
+ .page-body {
180
+ min-width: 0;
181
+ }
182
+
183
+ .resource-anchor {
184
+ display: block;
185
+ height: 0;
186
+ overflow: hidden;
187
+ }
188
+
189
+ /* ---- pinned notes ---- */
190
+ .pinned-notes {
191
+ margin: 30px 0 0;
192
+ }
193
+ .pinned-notes-list .cell {
194
+ margin: 0;
195
+ border-color: rgba(249, 115, 22, 0.55);
196
+ }
197
+ .pinned-notes-list .cell + .cell {
198
+ margin-top: 12px;
199
+ }
200
+ .cell.pinned-source {
201
+ border-color: rgba(249, 115, 22, 0.55);
202
+ }
203
+ .book-intro.has-pinned-notes {
204
+ border-bottom: none;
205
+ padding-bottom: 22px;
206
+ margin-bottom: 30px;
207
+ }
208
+ .book-intro.book-intro-tight {
209
+ border-bottom: none;
210
+ padding-bottom: 4px;
211
+ margin-bottom: 20px;
212
+ }
213
+
214
+ #page h1 {
215
+ font-family: var(--serif);
216
+ font-size: 34px;
217
+ line-height: 1.15;
218
+ letter-spacing: -0.02em;
219
+ margin: 0 0 8px;
220
+ overflow-wrap: anywhere;
221
+ }
222
+
223
+ #page .page-section:not(.book-intro) h1 {
224
+ font-size: 26px;
225
+ }
226
+
227
+ #page h2 {
228
+ font-family: var(--serif);
229
+ font-size: 24px;
230
+ margin: 36px 0 10px;
231
+ }
232
+
233
+ #page h3 {
234
+ font-size: 17px;
235
+ font-weight: 700;
236
+ margin: 26px 0 2px;
237
+ letter-spacing: -0.01em;
238
+ }
239
+
240
+ #page h3::before {
241
+ content: "";
242
+ display: inline-block;
243
+ width: 7px;
244
+ height: 7px;
245
+ border-radius: 2px;
246
+ background: var(--accent);
247
+ margin-right: 10px;
248
+ vertical-align: middle;
249
+ transform: translateY(-1px);
250
+ }
251
+
252
+ #page p {
253
+ margin: 10px 0;
254
+ }
255
+
256
+ #page blockquote {
257
+ margin: 14px 0;
258
+ padding: 2px 16px;
259
+ border-left: 3px solid #fdba74;
260
+ color: var(--muted);
261
+ }
262
+
263
+ #page hr {
264
+ display: none;
265
+ }
266
+
267
+ #page code {
268
+ font-family: var(--mono);
269
+ font-size: 0.86em;
270
+ background: var(--code-bg);
271
+ padding: 2px 6px;
272
+ border-radius: 6px;
273
+ }
274
+
275
+ #page pre {
276
+ max-width: 100%;
277
+ background: var(--code-bg);
278
+ border: 1px solid var(--line);
279
+ border-radius: var(--radius);
280
+ padding: 14px 16px;
281
+ overflow-x: auto;
282
+ }
283
+ #page pre code {
284
+ background: none;
285
+ padding: 0;
286
+ font-size: 11.5px;
287
+ }
288
+
289
+ /* ---- code blocks + collapsible accordion ---- */
290
+ #page pre.hl {
291
+ background: #17181c;
292
+ border: none;
293
+ color: #e7e7ea;
294
+ font-size: 13px;
295
+ line-height: 1.58;
296
+ }
297
+ #page pre.hl code {
298
+ color: inherit;
299
+ font-family: var(--mono);
300
+ }
301
+ .code-accordion {
302
+ border: 1px solid rgba(249, 115, 22, 0.2);
303
+ border-radius: 8px;
304
+ overflow: hidden;
305
+ margin: 12px 0;
306
+ background: #17181c;
307
+ }
308
+ .code-accordion summary {
309
+ list-style: none;
310
+ cursor: pointer;
311
+ display: flex;
312
+ align-items: center;
313
+ gap: 9px;
314
+ padding: 9px 12px;
315
+ font-family: var(--mono);
316
+ font-size: 11.5px;
317
+ font-weight: 700;
318
+ color: #e7e7ea;
319
+ background: #1e2027;
320
+ user-select: none;
321
+ overflow-wrap: anywhere;
322
+ }
323
+ .code-accordion summary::-webkit-details-marker {
324
+ display: none;
325
+ }
326
+ .code-accordion summary::after {
327
+ content: "▸";
328
+ margin-left: auto;
329
+ color: var(--accent);
330
+ transition: transform 0.12s;
331
+ transform: rotate(180deg);
332
+ }
333
+ .code-accordion[open] summary::after {
334
+ transform: rotate(90deg);
335
+ }
336
+ .code-accordion .code-ico {
337
+ color: var(--accent);
338
+ font-weight: 700;
339
+ }
340
+ .code-accordion pre.hl {
341
+ margin: 0;
342
+ border-radius: 0;
343
+ border: none;
344
+ border-top: 1px solid rgba(249, 115, 22, 0.16);
345
+ }
346
+ .tok-comment {
347
+ color: #7a7d87;
348
+ font-style: italic;
349
+ }
350
+ .tok-string {
351
+ color: #a5d6a7;
352
+ }
353
+ .tok-keyword {
354
+ color: #fdba74;
355
+ }
356
+ .tok-number {
357
+ color: #7fd0e0;
358
+ }
359
+
360
+ #page a {
361
+ color: var(--accent);
362
+ }
363
+
364
+ #page ul {
365
+ padding-left: 20px;
366
+ }
367
+
368
+ .ts {
369
+ font-family: var(--mono);
370
+ font-size: 12px;
371
+ color: var(--muted);
372
+ background: none;
373
+ padding: 0;
374
+ }
375
+
376
+ /* ---- notebook-style cells ---- */
377
+ .cell {
378
+ max-width: 100%;
379
+ border: 1px solid var(--line);
380
+ border-radius: 10px;
381
+ background: rgba(255, 255, 255, 0.86);
382
+ margin: 18px 0;
383
+ overflow: hidden;
384
+ box-shadow: 0 2px 10px rgba(31, 41, 55, 0.035);
385
+ }
386
+ .cell-head {
387
+ display: flex;
388
+ justify-content: space-between;
389
+ gap: 16px;
390
+ align-items: center;
391
+ padding: 14px 18px;
392
+ background: rgba(255, 255, 255, 0.92);
393
+ border-bottom: 1px solid var(--line);
394
+ }
395
+ .cell-head.no-title {
396
+ justify-content: flex-end;
397
+ padding-top: 10px;
398
+ padding-bottom: 10px;
399
+ }
400
+ .cell-title {
401
+ flex: 1;
402
+ min-width: 0;
403
+ font-size: 13px;
404
+ font-weight: 650;
405
+ color: var(--ink);
406
+ line-height: 1.35;
407
+ overflow-wrap: anywhere;
408
+ }
409
+ .cell-meta {
410
+ flex: 0 0 auto;
411
+ display: flex;
412
+ align-items: center;
413
+ gap: 10px;
414
+ font-family: var(--sans);
415
+ font-size: 13px;
416
+ color: var(--muted);
417
+ }
418
+ .cell-open {
419
+ flex: 0 0 auto;
420
+ font-family: var(--mono);
421
+ font-size: 12px;
422
+ color: var(--accent);
423
+ text-decoration: none;
424
+ }
425
+ .cell-open:hover {
426
+ color: var(--accent-strong);
427
+ }
428
+ .cell-body {
429
+ min-width: 0;
430
+ padding: 14px 18px 18px;
431
+ }
432
+ .cell.dashboard .cell-body {
433
+ padding: 0;
434
+ }
435
+ #page .cell-body h1,
436
+ #page .cell-body h2 {
437
+ font-family: var(--sans);
438
+ font-size: 17px;
439
+ font-weight: 700;
440
+ letter-spacing: -0.01em;
441
+ line-height: 1.35;
442
+ margin: 22px 0 6px;
443
+ }
444
+ #page .cell-body > :first-child {
445
+ margin-top: 0;
446
+ }
447
+ #page .cell-body > :last-child {
448
+ margin-bottom: 0;
449
+ }
450
+ .cell.code .cell-head {
451
+ background: #fbfbfc;
452
+ }
453
+ .figure-fit {
454
+ position: relative;
455
+ overflow: hidden;
456
+ min-height: 160px;
457
+ border: 1px solid var(--line);
458
+ border-radius: 8px;
459
+ background: #fff;
460
+ }
461
+ .figure-fit[hidden] {
462
+ display: none;
463
+ }
464
+ .figure-fit:fullscreen,
465
+ .figure-fit:-webkit-full-screen {
466
+ width: 100%;
467
+ height: 100%;
468
+ border: none;
469
+ border-radius: 0;
470
+ }
471
+ .figure-frame {
472
+ display: block;
473
+ width: 100%;
474
+ min-height: 160px;
475
+ border: none;
476
+ background: #fff;
477
+ }
478
+ .figure-frame[hidden],
479
+ .figure-raw[hidden] {
480
+ display: none;
481
+ }
482
+ .fig-switch {
483
+ position: relative;
484
+ display: inline-flex;
485
+ flex: 0 0 auto;
486
+ border: 1px solid var(--line);
487
+ border-radius: 999px;
488
+ background: var(--code-bg);
489
+ padding: 2px;
490
+ }
491
+ .fig-switch button {
492
+ position: relative;
493
+ z-index: 1;
494
+ flex: 1;
495
+ min-width: 62px;
496
+ border: none;
497
+ background: none;
498
+ font-family: var(--sans);
499
+ font-size: 12px;
500
+ font-weight: 600;
501
+ color: var(--muted);
502
+ padding: 3px 12px;
503
+ border-radius: 999px;
504
+ cursor: pointer;
505
+ transition: color 0.15s;
506
+ }
507
+ .fig-switch button.active {
508
+ color: var(--accent-strong);
509
+ }
510
+ .fig-switch-thumb {
511
+ position: absolute;
512
+ top: 2px;
513
+ bottom: 2px;
514
+ left: 2px;
515
+ width: calc(50% - 2px);
516
+ border-radius: 999px;
517
+ background: var(--panel);
518
+ border: 1px solid rgba(249, 115, 22, 0.35);
519
+ box-shadow: 0 1px 4px rgba(31, 41, 55, 0.08);
520
+ transition: transform 0.18s ease;
521
+ }
522
+ .fig-switch.raw .fig-switch-thumb {
523
+ transform: translateX(100%);
524
+ }
525
+ #page .figure-raw pre {
526
+ margin: 0;
527
+ max-height: 420px;
528
+ overflow: auto;
529
+ font-family: var(--mono);
530
+ font-size: 13px;
531
+ line-height: 1.55;
532
+ background: var(--code-bg);
533
+ border: 1px solid var(--line);
534
+ border-radius: 8px;
535
+ padding: 12px 14px;
536
+ }
537
+ /* ---- figure fullscreen ---- */
538
+ .cell-fullscreen {
539
+ position: relative;
540
+ display: inline-flex;
541
+ flex: 0 0 auto;
542
+ }
543
+ .cell-fullscreen-btn {
544
+ display: inline-flex;
545
+ align-items: center;
546
+ justify-content: center;
547
+ width: 26px;
548
+ height: 26px;
549
+ padding: 0;
550
+ border: 1px solid var(--line);
551
+ border-radius: 999px;
552
+ background: var(--code-bg);
553
+ color: var(--muted);
554
+ cursor: pointer;
555
+ transition: color 0.15s, border-color 0.15s, background 0.15s;
556
+ }
557
+ .cell-fullscreen-btn:hover {
558
+ color: var(--accent-strong);
559
+ border-color: rgba(249, 115, 22, 0.35);
560
+ background: var(--accent-soft);
561
+ }
562
+ .cell-fullscreen-btn svg {
563
+ width: 14px;
564
+ height: 14px;
565
+ }
566
+ /* ---- copyable snippets ---- */
567
+ .snippet {
568
+ position: relative;
569
+ }
570
+ .copy-snippet {
571
+ position: absolute;
572
+ top: 7px;
573
+ right: 8px;
574
+ width: 24px;
575
+ height: 24px;
576
+ border: none;
577
+ border-radius: 6px;
578
+ background: rgba(255, 255, 255, 0.08);
579
+ color: #9a9da8;
580
+ font-size: 12px;
581
+ line-height: 1;
582
+ cursor: pointer;
583
+ opacity: 0;
584
+ transition: opacity 0.12s, color 0.12s, background 0.12s;
585
+ }
586
+ .snippet:hover .copy-snippet,
587
+ .jp-out:hover .copy-snippet,
588
+ .figure-raw:hover .copy-snippet,
589
+ .code-accordion summary:hover .copy-snippet {
590
+ opacity: 1;
591
+ }
592
+ .copy-snippet:hover {
593
+ color: #ffffff;
594
+ background: rgba(255, 255, 255, 0.16);
595
+ }
596
+ .copy-snippet.copied {
597
+ color: #52d08a;
598
+ opacity: 1;
599
+ }
600
+ .code-accordion .code-name {
601
+ user-select: text;
602
+ cursor: text;
603
+ }
604
+ .jp-out,
605
+ .figure-raw {
606
+ position: relative;
607
+ }
608
+ .jp-out .copy-snippet,
609
+ .figure-raw .copy-snippet {
610
+ background: var(--code-bg);
611
+ color: var(--muted);
612
+ border: 1px solid var(--line);
613
+ }
614
+ .jp-out .copy-snippet:hover,
615
+ .figure-raw .copy-snippet:hover {
616
+ color: var(--accent-strong);
617
+ background: var(--panel);
618
+ }
619
+
620
+ /* ---- jupyter-style code cells ---- */
621
+ .jp {
622
+ border: 1px solid var(--line);
623
+ border-radius: 10px;
624
+ overflow: hidden;
625
+ margin: 12px 0;
626
+ background: var(--panel);
627
+ }
628
+ .jp-gutter {
629
+ flex: 0 0 46px;
630
+ padding: 13px 0 0 13px;
631
+ font-family: var(--mono);
632
+ font-size: 10.5px;
633
+ letter-spacing: 0.07em;
634
+ text-transform: uppercase;
635
+ font-weight: 600;
636
+ user-select: none;
637
+ }
638
+ .jp-in {
639
+ display: flex;
640
+ background: #17181c;
641
+ }
642
+ .jp-in .jp-gutter {
643
+ color: #6f727d;
644
+ }
645
+ .jp-in-body {
646
+ flex: 1;
647
+ min-width: 0;
648
+ }
649
+ #page .jp-in-body pre.hl {
650
+ margin: 0;
651
+ border: none;
652
+ border-radius: 0;
653
+ background: none;
654
+ padding: 12px 16px 12px 0;
655
+ }
656
+ .jp-in-body .code-accordion {
657
+ margin: 0;
658
+ border: none;
659
+ border-top: 1px solid rgba(255, 255, 255, 0.09);
660
+ border-radius: 0;
661
+ background: none;
662
+ }
663
+ .jp-in-body .code-accordion summary {
664
+ background: none;
665
+ padding: 9px 16px 9px 0;
666
+ }
667
+ .jp-in-body .code-accordion pre.hl {
668
+ border-top: 1px solid rgba(255, 255, 255, 0.09);
669
+ }
670
+ .jp-meta {
671
+ padding: 5px 14px;
672
+ font-family: var(--mono);
673
+ font-size: 11.5px;
674
+ color: var(--muted);
675
+ background: #fbfbfc;
676
+ border-top: 1px solid var(--line);
677
+ }
678
+ .jp-out {
679
+ display: flex;
680
+ border-top: 1px solid var(--line);
681
+ background: var(--panel);
682
+ }
683
+ .jp-out .jp-gutter {
684
+ color: var(--accent-strong);
685
+ }
686
+ .jp-out-body {
687
+ flex: 1;
688
+ min-width: 0;
689
+ }
690
+ #page .jp-out-pre {
691
+ min-width: 0;
692
+ margin: 0;
693
+ border: none;
694
+ border-radius: 0;
695
+ background: none;
696
+ color: var(--ink);
697
+ font-family: var(--mono);
698
+ font-size: 13px;
699
+ line-height: 1.55;
700
+ padding: 12px 16px 12px 0;
701
+ white-space: pre;
702
+ overflow-x: auto;
703
+ overflow-y: auto;
704
+ max-height: 26em;
705
+ }
706
+ .jp-artifacts {
707
+ display: flex;
708
+ flex-direction: column;
709
+ }
710
+ .jp-out-body .jp-out-pre + .jp-artifacts {
711
+ border-top: 1px solid var(--line);
712
+ }
713
+ .out-artifact {
714
+ display: flex;
715
+ align-items: baseline;
716
+ gap: 8px;
717
+ padding: 9px 16px 9px 0;
718
+ text-decoration: none;
719
+ color: inherit;
720
+ }
721
+ .out-artifact + .out-artifact {
722
+ border-top: 1px solid var(--line);
723
+ }
724
+ a.out-artifact:hover .out-artifact-name {
725
+ color: var(--accent-strong);
726
+ }
727
+ .out-artifact-ico {
728
+ flex: 0 0 auto;
729
+ font-size: 13px;
730
+ }
731
+ .out-artifact-name {
732
+ font-family: var(--mono);
733
+ font-size: 12.5px;
734
+ font-weight: 600;
735
+ color: var(--ink);
736
+ overflow: hidden;
737
+ text-overflow: ellipsis;
738
+ white-space: nowrap;
739
+ }
740
+ .out-artifact-meta {
741
+ flex: 0 0 auto;
742
+ margin-left: auto;
743
+ padding-left: 12px;
744
+ font-size: 12px;
745
+ color: var(--muted);
746
+ white-space: nowrap;
747
+ }
748
+ .out-artifact-state.open {
749
+ color: var(--accent);
750
+ font-weight: 600;
751
+ }
752
+ .trackio-embed {
753
+ border: 1px solid var(--line);
754
+ border-radius: var(--radius);
755
+ overflow: hidden;
756
+ background: var(--panel);
757
+ }
758
+ .trackio-cell-meta {
759
+ display: flex;
760
+ gap: 6px;
761
+ flex-wrap: wrap;
762
+ justify-content: flex-end;
763
+ }
764
+
765
+ /* ---- unfurl cards ---- */
766
+ .unfurl {
767
+ display: block;
768
+ border: 1px solid var(--line);
769
+ border-radius: var(--radius);
770
+ background: var(--panel);
771
+ margin: 12px 0;
772
+ overflow: hidden;
773
+ text-decoration: none;
774
+ color: inherit;
775
+ transition: border-color 0.14s, box-shadow 0.14s;
776
+ }
777
+ .unfurl:hover {
778
+ border-color: #cfcbe6;
779
+ box-shadow: 0 4px 18px rgba(30, 20, 80, 0.06);
780
+ }
781
+
782
+ .unfurl-body {
783
+ padding: 13px 16px;
784
+ display: flex;
785
+ gap: 12px;
786
+ align-items: flex-start;
787
+ }
788
+
789
+ .unfurl-ico {
790
+ font-size: 20px;
791
+ line-height: 1.3;
792
+ flex: 0 0 auto;
793
+ }
794
+
795
+ .unfurl-main {
796
+ min-width: 0;
797
+ flex: 1;
798
+ }
799
+
800
+ .unfurl-kind {
801
+ font-family: var(--mono);
802
+ font-size: 10.5px;
803
+ text-transform: uppercase;
804
+ letter-spacing: 0.08em;
805
+ color: var(--accent);
806
+ font-weight: 600;
807
+ }
808
+
809
+ .unfurl-title {
810
+ font-weight: 650;
811
+ font-size: 15px;
812
+ margin: 1px 0 2px;
813
+ white-space: nowrap;
814
+ overflow: hidden;
815
+ text-overflow: ellipsis;
816
+ }
817
+
818
+ .unfurl-desc {
819
+ color: var(--muted);
820
+ font-size: 13.5px;
821
+ line-height: 1.45;
822
+ }
823
+
824
+ .unfurl-meta {
825
+ margin-top: 6px;
826
+ display: flex;
827
+ flex-wrap: wrap;
828
+ gap: 6px;
829
+ }
830
+
831
+ .chip {
832
+ font-size: 11.5px;
833
+ background: var(--code-bg);
834
+ border-radius: 999px;
835
+ padding: 2px 9px;
836
+ color: var(--muted);
837
+ font-family: var(--mono);
838
+ }
839
+
840
+ .unfurl-raw {
841
+ font-family: var(--mono);
842
+ font-size: 11px;
843
+ color: var(--muted);
844
+ border-top: 1px solid var(--line);
845
+ padding: 7px 16px;
846
+ white-space: nowrap;
847
+ overflow: hidden;
848
+ text-overflow: ellipsis;
849
+ }
850
+
851
+ .unfurl.embed {
852
+ padding: 0;
853
+ overflow: hidden;
854
+ }
855
+ .embed-head {
856
+ display: flex;
857
+ align-items: center;
858
+ gap: 10px;
859
+ padding: 10px 14px;
860
+ border-bottom: 1px solid var(--line);
861
+ }
862
+ .embed-head .unfurl-kind {
863
+ flex: 0 0 auto;
864
+ }
865
+ .embed-title {
866
+ flex: 1;
867
+ min-width: 0;
868
+ font-weight: 650;
869
+ font-size: 14px;
870
+ color: var(--ink);
871
+ text-decoration: none;
872
+ white-space: nowrap;
873
+ overflow: hidden;
874
+ text-overflow: ellipsis;
875
+ }
876
+ .embed-title:hover {
877
+ color: var(--accent);
878
+ }
879
+ .embed-open {
880
+ flex: 0 0 auto;
881
+ font-family: var(--mono);
882
+ font-size: 12px;
883
+ color: var(--accent);
884
+ text-decoration: none;
885
+ }
886
+ .embed-frame {
887
+ display: block;
888
+ width: 100%;
889
+ height: 560px;
890
+ border: 0;
891
+ background: var(--code-bg);
892
+ }
893
+
894
+ .dashboard-shell {
895
+ display: block;
896
+ }
897
+ .dashboard-shell .dashboard-frame {
898
+ display: block;
899
+ width: 100%;
900
+ height: 900px;
901
+ border: 0;
902
+ background: var(--code-bg);
903
+ }
904
+
905
+ .unfurl.image {
906
+ padding: 0;
907
+ }
908
+ .unfurl.image img {
909
+ display: block;
910
+ width: 100%;
911
+ height: auto;
912
+ max-height: 460px;
913
+ object-fit: contain;
914
+ background: var(--code-bg);
915
+ }
916
+
917
+ .artifact-chip {
918
+ border: 1px solid var(--line);
919
+ background: var(--panel);
920
+ border-radius: var(--radius);
921
+ padding: 10px 14px;
922
+ margin: 8px 0;
923
+ font-size: 14px;
924
+ }
925
+ .cell.dashboard .artifact-chip {
926
+ margin: 14px 18px 18px;
927
+ }
928
+ .artifact-chip code {
929
+ color: var(--accent);
930
+ }
931
+
932
+ /* ---- task board ---- */
933
+ .board-wrap {
934
+ overflow-x: auto;
935
+ border: 1px solid var(--line);
936
+ border-radius: var(--radius);
937
+ margin: 12px 0 20px;
938
+ background: var(--panel);
939
+ }
940
+ table.board {
941
+ border-collapse: collapse;
942
+ width: 100%;
943
+ font-size: 14px;
944
+ }
945
+ table.board th,
946
+ table.board td {
947
+ text-align: left;
948
+ padding: 9px 14px;
949
+ border-bottom: 1px solid var(--line);
950
+ vertical-align: top;
951
+ }
952
+ table.board thead th {
953
+ background: var(--accent-soft);
954
+ font-size: 12px;
955
+ text-transform: uppercase;
956
+ letter-spacing: 0.05em;
957
+ color: #9a4a12;
958
+ font-weight: 600;
959
+ border-bottom: 1px solid var(--line);
960
+ }
961
+ table.board tbody tr:last-child td {
962
+ border-bottom: none;
963
+ }
964
+ table.board .col-check {
965
+ text-align: center;
966
+ width: 92px;
967
+ white-space: nowrap;
968
+ }
969
+ table.board tr.section-row td {
970
+ background: var(--accent-soft);
971
+ text-align: center;
972
+ font-weight: 700;
973
+ font-size: 13px;
974
+ color: var(--accent-strong);
975
+ padding: 7px 14px;
976
+ letter-spacing: 0.02em;
977
+ }
978
+ .box {
979
+ display: inline-flex;
980
+ align-items: center;
981
+ justify-content: center;
982
+ width: 18px;
983
+ height: 18px;
984
+ border: 1.5px solid #cfcbe0;
985
+ border-radius: 5px;
986
+ font-size: 12px;
987
+ color: #fff;
988
+ line-height: 1;
989
+ }
990
+ .box.on {
991
+ background: var(--accent);
992
+ border-color: var(--accent);
993
+ }
994
+ .who-chip {
995
+ display: inline-block;
996
+ padding: 3px 12px;
997
+ border-radius: 999px;
998
+ font-size: 12.5px;
999
+ font-weight: 600;
1000
+ white-space: nowrap;
1001
+ }
1002
+ .who-chip.muted {
1003
+ background: var(--code-bg);
1004
+ color: var(--muted);
1005
+ font-weight: 500;
1006
+ }
1007
+
1008
+ /* ---- status badges + clickable rows ---- */
1009
+ table.board .col-status {
1010
+ width: 130px;
1011
+ white-space: nowrap;
1012
+ }
1013
+ .badge {
1014
+ display: inline-block;
1015
+ padding: 3px 11px;
1016
+ border-radius: 999px;
1017
+ font-size: 12px;
1018
+ font-weight: 600;
1019
+ letter-spacing: 0.01em;
1020
+ }
1021
+ .badge.gray {
1022
+ background: var(--code-bg);
1023
+ color: var(--muted);
1024
+ }
1025
+ .badge.amber {
1026
+ background: var(--accent-soft);
1027
+ color: #b45309;
1028
+ }
1029
+ .badge.green {
1030
+ background: #e6f7ee;
1031
+ color: #1a8a55;
1032
+ }
1033
+ .badge.red {
1034
+ background: #fde8ec;
1035
+ color: #c62a4b;
1036
+ }
1037
+ table.board tr.linked-row {
1038
+ cursor: pointer;
1039
+ }
1040
+ table.board tr.linked-row:hover td {
1041
+ background: var(--accent-soft);
1042
+ }
1043
+ table.board tr.linked-row a {
1044
+ color: var(--ink);
1045
+ font-weight: 600;
1046
+ text-decoration: none;
1047
+ }
1048
+ table.board tr.linked-row:hover a {
1049
+ color: var(--accent-strong);
1050
+ }
1051
+
1052
+ /* ---- agent read hint ---- */
1053
+ .agent-hint {
1054
+ display: flex;
1055
+ align-items: center;
1056
+ flex-wrap: wrap;
1057
+ gap: 8px;
1058
+ margin: 4px 0 22px;
1059
+ font-size: 12.5px;
1060
+ color: var(--muted);
1061
+ }
1062
+ #page .agent-hint code {
1063
+ background: var(--code-bg);
1064
+ padding: 2px 9px;
1065
+ border-radius: 6px;
1066
+ font-family: var(--mono);
1067
+ font-size: 12px;
1068
+ font-weight: 500;
1069
+ color: var(--ink);
1070
+ }
1071
+ .agent-hint .copy {
1072
+ flex: 0 0 auto;
1073
+ background: none;
1074
+ color: var(--muted);
1075
+ border: 1px solid var(--line);
1076
+ border-radius: 6px;
1077
+ width: 22px;
1078
+ height: 22px;
1079
+ font-size: 11px;
1080
+ line-height: 1;
1081
+ cursor: pointer;
1082
+ transition: color 0.12s, border-color 0.12s;
1083
+ }
1084
+ .agent-hint .copy:hover {
1085
+ color: var(--accent-strong);
1086
+ border-color: var(--accent);
1087
+ }
1088
+ .agent-hint .copy.copied {
1089
+ color: #1a8a55;
1090
+ border-color: #1a8a55;
1091
+ }
1092
+ .agent-hint-note {
1093
+ margin-left: auto;
1094
+ font-size: 12px;
1095
+ color: var(--muted);
1096
+ }
1097
+
1098
+ /* ---- logbook summary stats ---- */
1099
+ .logbook-stats {
1100
+ display: flex;
1101
+ flex-wrap: wrap;
1102
+ gap: 12px;
1103
+ margin: 0 0 28px;
1104
+ }
1105
+ .stat-tile {
1106
+ position: relative;
1107
+ display: inline-flex;
1108
+ align-items: center;
1109
+ gap: 11px;
1110
+ border: 1px solid var(--line);
1111
+ background: var(--panel);
1112
+ border-radius: var(--radius);
1113
+ padding: 12px 23px;
1114
+ font: inherit;
1115
+ text-align: left;
1116
+ cursor: pointer;
1117
+ transition: border-color 0.12s, box-shadow 0.12s;
1118
+ }
1119
+ .stat-tile:hover:not([disabled]) {
1120
+ border-color: rgba(249, 115, 22, 0.45);
1121
+ box-shadow: 0 3px 12px rgba(31, 41, 55, 0.06);
1122
+ }
1123
+ .stat-tile:focus-visible {
1124
+ outline: 2px solid var(--accent);
1125
+ outline-offset: 2px;
1126
+ }
1127
+ .stat-tile[disabled] {
1128
+ cursor: default;
1129
+ opacity: 0.7;
1130
+ }
1131
+ .stat-tile.open {
1132
+ border-color: rgba(249, 115, 22, 0.6);
1133
+ box-shadow: 0 3px 12px rgba(31, 41, 55, 0.08);
1134
+ }
1135
+ .stat-icon {
1136
+ width: 24px;
1137
+ height: 24px;
1138
+ flex: 0 0 24px;
1139
+ object-fit: contain;
1140
+ align-self: center;
1141
+ }
1142
+ .stat-text {
1143
+ display: flex;
1144
+ align-items: baseline;
1145
+ gap: 8px;
1146
+ white-space: nowrap;
1147
+ line-height: 1;
1148
+ }
1149
+ .stat-num {
1150
+ font-family: var(--mono);
1151
+ font-size: 20px;
1152
+ font-weight: 600;
1153
+ line-height: 1;
1154
+ color: var(--accent-strong);
1155
+ }
1156
+ .stat-label {
1157
+ font-size: 15px;
1158
+ line-height: 1;
1159
+ color: var(--muted);
1160
+ }
1161
+ .stat-caret {
1162
+ margin-left: 2px;
1163
+ font-size: 10px;
1164
+ color: var(--muted);
1165
+ align-self: center;
1166
+ transition: transform 0.12s;
1167
+ }
1168
+ .stat-tile.open .stat-caret {
1169
+ transform: rotate(180deg);
1170
+ }
1171
+ .stat-popover {
1172
+ position: absolute;
1173
+ top: 100%;
1174
+ left: 0;
1175
+ margin-top: 6px;
1176
+ min-width: 300px;
1177
+ max-width: min(460px, 92vw);
1178
+ max-height: 340px;
1179
+ overflow-y: auto;
1180
+ z-index: 20;
1181
+ background: var(--panel);
1182
+ border: 1px solid var(--line);
1183
+ border-radius: var(--radius);
1184
+ box-shadow: 0 8px 28px rgba(31, 41, 55, 0.12);
1185
+ padding: 6px;
1186
+ }
1187
+ .stat-popover[hidden] {
1188
+ display: none;
1189
+ }
1190
+ .stat-pop-head {
1191
+ padding: 6px 10px 8px;
1192
+ font-size: 11.5px;
1193
+ font-weight: 700;
1194
+ letter-spacing: 0.03em;
1195
+ text-transform: uppercase;
1196
+ color: var(--muted);
1197
+ }
1198
+ .stat-row {
1199
+ display: flex;
1200
+ align-items: flex-start;
1201
+ gap: 10px;
1202
+ padding: 9px 11px;
1203
+ border-radius: 9px;
1204
+ border: 1px solid transparent;
1205
+ text-decoration: none;
1206
+ color: inherit;
1207
+ cursor: pointer;
1208
+ }
1209
+ .stat-row:hover {
1210
+ border-color: rgba(249, 115, 22, 0.4);
1211
+ background: var(--accent-soft);
1212
+ }
1213
+ .stat-row-ico {
1214
+ font-size: 15px;
1215
+ line-height: 1.3;
1216
+ flex: 0 0 auto;
1217
+ }
1218
+ .stat-row-main {
1219
+ min-width: 0;
1220
+ flex: 1;
1221
+ }
1222
+ .stat-row-title {
1223
+ font-family: var(--mono);
1224
+ font-size: 12.5px;
1225
+ font-weight: 600;
1226
+ color: var(--ink);
1227
+ overflow: hidden;
1228
+ text-overflow: ellipsis;
1229
+ white-space: nowrap;
1230
+ }
1231
+ .stat-row-meta {
1232
+ margin-top: 2px;
1233
+ font-size: 12px;
1234
+ color: var(--muted);
1235
+ }
1236
+ .stat-row-state.open {
1237
+ color: var(--accent);
1238
+ font-weight: 600;
1239
+ border-radius: 5px;
1240
+ padding: 1px 5px;
1241
+ margin: -1px -2px;
1242
+ }
1243
+ .stat-row-state.open:hover {
1244
+ background: rgba(249, 115, 22, 0.14);
1245
+ text-decoration: underline;
1246
+ }
1247
+ .art-ico {
1248
+ width: 1em;
1249
+ height: 1em;
1250
+ object-fit: contain;
1251
+ vertical-align: -0.15em;
1252
+ }
1253
+
1254
+ /* ---- scroll-to-resource highlight ---- */
1255
+ .res-flash {
1256
+ animation: res-flash 1.5s ease;
1257
+ border-radius: 8px;
1258
+ }
1259
+ @keyframes res-flash {
1260
+ 0%,
1261
+ 25% {
1262
+ box-shadow: 0 0 0 3px var(--accent);
1263
+ }
1264
+ 100% {
1265
+ box-shadow: 0 0 0 3px rgba(249, 115, 22, 0);
1266
+ }
1267
+ }
1268
+
1269
+ /* ---- inline resource chips ---- */
1270
+ #page .res-chip {
1271
+ display: inline-flex;
1272
+ align-items: center;
1273
+ gap: 5px;
1274
+ max-width: 100%;
1275
+ padding: 0 9px 0 6px;
1276
+ margin: 0 1px;
1277
+ border: 1px solid var(--line);
1278
+ border-radius: 999px;
1279
+ background: var(--panel);
1280
+ font-family: var(--mono);
1281
+ font-size: 0.78em;
1282
+ font-weight: 600;
1283
+ color: var(--ink);
1284
+ text-decoration: none;
1285
+ white-space: nowrap;
1286
+ overflow: hidden;
1287
+ text-overflow: ellipsis;
1288
+ vertical-align: middle;
1289
+ line-height: 1.65;
1290
+ transform: translateY(-0.08em);
1291
+ transition: border-color 0.12s, background 0.12s, color 0.12s;
1292
+ }
1293
+ .res-chip-ico {
1294
+ font-size: 1.05em;
1295
+ line-height: 1;
1296
+ }
1297
+ #page .res-chip:hover,
1298
+ #page .res-chip.res-hl {
1299
+ border-color: var(--accent);
1300
+ background: var(--accent-soft);
1301
+ color: var(--accent-strong);
1302
+ }
1303
+ #page a.res-link.res-hl {
1304
+ background: var(--accent-soft);
1305
+ border-radius: 4px;
1306
+ }
1307
+ .rail-item.res-hl {
1308
+ border-color: var(--accent);
1309
+ background: var(--accent-soft);
1310
+ box-shadow: 0 3px 12px rgba(249, 115, 22, 0.14);
1311
+ }
1312
+ .rail-item.res-hl .rail-title {
1313
+ color: var(--accent-strong);
1314
+ }
1315
+ .rail-item.rail-local {
1316
+ cursor: default;
1317
+ }
1318
+ .artifact-chip.res-hl {
1319
+ border-color: var(--accent);
1320
+ background: var(--accent-soft);
1321
+ }
1322
+
1323
+ /* ---- contextual resources rail ---- */
1324
+ .context-rail {
1325
+ position: relative;
1326
+ width: 248px;
1327
+ }
1328
+ .context-rail[hidden] {
1329
+ display: none;
1330
+ }
1331
+ .rail-kind {
1332
+ display: flex;
1333
+ align-items: center;
1334
+ gap: 5px;
1335
+ font-family: var(--mono);
1336
+ font-size: 10px;
1337
+ text-transform: uppercase;
1338
+ letter-spacing: 0.08em;
1339
+ font-weight: 600;
1340
+ color: var(--accent);
1341
+ margin-bottom: 4px;
1342
+ }
1343
+ .rail-item {
1344
+ position: absolute;
1345
+ left: 0;
1346
+ right: 0;
1347
+ display: block;
1348
+ border: 1px solid var(--line);
1349
+ border-radius: 10px;
1350
+ background: var(--panel);
1351
+ padding: 9px 12px;
1352
+ margin-bottom: 8px;
1353
+ text-decoration: none;
1354
+ color: inherit;
1355
+ transition: border-color 0.14s, box-shadow 0.14s;
1356
+ }
1357
+ .rail-item:hover {
1358
+ border-color: rgba(249, 115, 22, 0.45);
1359
+ box-shadow: 0 3px 12px rgba(31, 41, 55, 0.06);
1360
+ }
1361
+ .rail-title {
1362
+ font-family: var(--mono);
1363
+ font-size: 12.5px;
1364
+ font-weight: 600;
1365
+ color: var(--ink);
1366
+ overflow-wrap: anywhere;
1367
+ line-height: 1.4;
1368
+ }
1369
+ .rail-item:hover .rail-title {
1370
+ color: var(--accent-strong);
1371
+ }
1372
+ .rail-meta {
1373
+ font-size: 11.5px;
1374
+ color: var(--muted);
1375
+ margin-top: 2px;
1376
+ }
1377
+
1378
+ @media (max-width: 1400px) {
1379
+ .page-layout {
1380
+ display: block;
1381
+ }
1382
+ .context-rail {
1383
+ width: 100%;
1384
+ margin-top: 28px;
1385
+ position: static;
1386
+ min-height: 0 !important;
1387
+ display: grid;
1388
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
1389
+ gap: 10px;
1390
+ }
1391
+ .context-rail[hidden] {
1392
+ display: none;
1393
+ }
1394
+ .context-rail .rail-item {
1395
+ position: static;
1396
+ margin-bottom: 0;
1397
+ }
1398
+ }
1399
+
1400
+ /* ---- connect footer + modal ---- */
1401
+ #sidebar-foot {
1402
+ margin-top: auto;
1403
+ padding-top: 14px;
1404
+ border-top: 1px solid rgba(255, 255, 255, 0.1);
1405
+ }
1406
+
1407
+ #connect-btn {
1408
+ width: 100%;
1409
+ display: flex;
1410
+ align-items: center;
1411
+ gap: 8px;
1412
+ background: rgba(255, 255, 255, 0.05);
1413
+ color: #c3c4cb;
1414
+ border: 1px solid rgba(255, 255, 255, 0.12);
1415
+ border-radius: 9px;
1416
+ padding: 9px 12px;
1417
+ font-size: 13.5px;
1418
+ font-family: var(--sans);
1419
+ cursor: pointer;
1420
+ transition: background 0.12s, color 0.12s, border-color 0.12s;
1421
+ }
1422
+ #connect-btn:hover {
1423
+ background: rgba(249, 115, 22, 0.14);
1424
+ border-color: rgba(249, 115, 22, 0.4);
1425
+ color: #fdba74;
1426
+ }
1427
+ #connect-btn .ico {
1428
+ font-size: 15px;
1429
+ }
1430
+
1431
+ #modal[hidden] {
1432
+ display: none;
1433
+ }
1434
+ #modal {
1435
+ position: fixed;
1436
+ inset: 0;
1437
+ z-index: 100;
1438
+ display: flex;
1439
+ align-items: center;
1440
+ justify-content: center;
1441
+ padding: 24px;
1442
+ }
1443
+ .modal-backdrop {
1444
+ position: absolute;
1445
+ inset: 0;
1446
+ background: rgba(20, 18, 30, 0.5);
1447
+ backdrop-filter: blur(2px);
1448
+ }
1449
+ .modal-card {
1450
+ position: relative;
1451
+ background: var(--panel);
1452
+ border-radius: 16px;
1453
+ width: 100%;
1454
+ max-width: 620px;
1455
+ max-height: 85vh;
1456
+ overflow-y: auto;
1457
+ box-shadow: 0 24px 70px rgba(20, 15, 50, 0.28);
1458
+ }
1459
+ .modal-head {
1460
+ display: flex;
1461
+ align-items: center;
1462
+ justify-content: space-between;
1463
+ gap: 12px;
1464
+ padding: 18px 22px;
1465
+ border-bottom: 1px solid var(--line);
1466
+ position: sticky;
1467
+ top: 0;
1468
+ background: var(--panel);
1469
+ }
1470
+ .modal-title {
1471
+ display: flex;
1472
+ align-items: center;
1473
+ gap: 10px;
1474
+ font-family: var(--serif);
1475
+ font-size: 21px;
1476
+ letter-spacing: -0.01em;
1477
+ }
1478
+ .modal-logo {
1479
+ width: 26px;
1480
+ height: 26px;
1481
+ object-fit: contain;
1482
+ }
1483
+ .modal-actions {
1484
+ display: flex;
1485
+ align-items: center;
1486
+ gap: 8px;
1487
+ }
1488
+ .btn {
1489
+ font-family: var(--sans);
1490
+ font-size: 13.5px;
1491
+ font-weight: 600;
1492
+ border: 1px solid var(--line);
1493
+ background: var(--panel);
1494
+ color: var(--ink);
1495
+ border-radius: 9px;
1496
+ padding: 8px 13px;
1497
+ cursor: pointer;
1498
+ transition: background 0.12s, border-color 0.12s, color 0.12s;
1499
+ }
1500
+ .btn:hover {
1501
+ border-color: var(--accent);
1502
+ color: var(--accent-strong);
1503
+ }
1504
+ .btn.copied {
1505
+ border-color: #1a8a55;
1506
+ color: #1a8a55;
1507
+ }
1508
+ .btn.icon {
1509
+ font-size: 18px;
1510
+ line-height: 1;
1511
+ padding: 6px 11px;
1512
+ font-weight: 400;
1513
+ }
1514
+ .modal-body {
1515
+ padding: 20px 22px 26px;
1516
+ }
1517
+ .modal-intro {
1518
+ margin: 0 0 20px;
1519
+ color: var(--muted);
1520
+ line-height: 1.55;
1521
+ }
1522
+ #connect-steps {
1523
+ list-style: none;
1524
+ margin: 0;
1525
+ padding: 0;
1526
+ }
1527
+ #connect-steps li {
1528
+ margin-bottom: 18px;
1529
+ }
1530
+ .step-title {
1531
+ font-weight: 600;
1532
+ font-size: 14.5px;
1533
+ margin-bottom: 8px;
1534
+ }
1535
+ .codeblock {
1536
+ display: flex;
1537
+ align-items: center;
1538
+ gap: 8px;
1539
+ background: #17181c;
1540
+ border-radius: 10px;
1541
+ padding: 11px 12px 11px 15px;
1542
+ }
1543
+ .codeblock code {
1544
+ flex: 1;
1545
+ min-width: 0;
1546
+ overflow-x: auto;
1547
+ white-space: nowrap;
1548
+ font-family: var(--mono);
1549
+ font-size: 13px;
1550
+ color: #f0efff;
1551
+ background: none;
1552
+ padding: 0;
1553
+ }
1554
+ .codeblock .copy {
1555
+ flex: 0 0 auto;
1556
+ background: rgba(255, 255, 255, 0.08);
1557
+ color: #c3c4cb;
1558
+ border: 1px solid rgba(255, 255, 255, 0.14);
1559
+ border-radius: 7px;
1560
+ width: 30px;
1561
+ height: 30px;
1562
+ font-size: 14px;
1563
+ cursor: pointer;
1564
+ transition: background 0.12s, color 0.12s;
1565
+ }
1566
+ .codeblock .copy:hover {
1567
+ background: rgba(249, 115, 22, 0.2);
1568
+ color: #fdba74;
1569
+ }
1570
+ .codeblock .copy.copied {
1571
+ color: #52d08a;
1572
+ }
1573
+
1574
+ @media (max-width: 720px) {
1575
+ #app {
1576
+ flex-direction: column;
1577
+ }
1578
+ #sidebar {
1579
+ width: 100%;
1580
+ flex: none;
1581
+ height: auto;
1582
+ position: static;
1583
+ }
1584
+ #content {
1585
+ display: block;
1586
+ width: 100%;
1587
+ padding: 28px 20px 80px;
1588
+ overflow-x: hidden;
1589
+ }
1590
+ #page {
1591
+ width: 100%;
1592
+ max-width: 100%;
1593
+ }
1594
+ #page h1 {
1595
+ font-size: 30px;
1596
+ }
1597
+ .cell-head {
1598
+ align-items: flex-start;
1599
+ flex-direction: column;
1600
+ gap: 4px;
1601
+ }
1602
+ }
logbook.js ADDED
@@ -0,0 +1,2275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () {
2
+ "use strict";
3
+
4
+ let MANIFEST = null;
5
+ const PAGE_CACHE = {};
6
+ const UNFURL_CACHE = {};
7
+ const LIVE_RELOAD_MS = 1500;
8
+ const FIGURE_FRAME_WINDOWS = new Set();
9
+ let FIGURE_NAVIGATION_READY = false;
10
+
11
+ function esc(s) {
12
+ return String(s)
13
+ .replace(/&/g, "&amp;")
14
+ .replace(/</g, "&lt;")
15
+ .replace(/>/g, "&gt;")
16
+ .replace(/"/g, "&quot;")
17
+ .replace(/'/g, "&#39;");
18
+ }
19
+
20
+ function flattenTree(node, depth, acc) {
21
+ acc.push({ node: node, depth: depth });
22
+ (node.children || []).forEach((c) => flattenTree(c, depth + 1, acc));
23
+ return acc;
24
+ }
25
+
26
+ function findNode(node, slug) {
27
+ if (node.slug === slug) return node;
28
+ for (const c of node.children || []) {
29
+ const hit = findNode(c, slug);
30
+ if (hit) return hit;
31
+ }
32
+ return null;
33
+ }
34
+
35
+ /* -------------------- minimal markdown -------------------- */
36
+
37
+ function inline(text) {
38
+ let t = esc(text);
39
+ t = t.replace(/`([^`]+)`/g, (_, c) => `<code>${c}</code>`);
40
+ t = t.replace(/\*\*([^*]+)\*\*/g, (_, c) => `<strong>${c}</strong>`);
41
+ t = t.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, txt, url) => {
42
+ const safe = esc(url);
43
+ const attrs = /^https?:/.test(url) ? ' target="_blank" rel="noopener"' : "";
44
+ const item = /^https?:/.test(url) ? classifyResource(url) : null;
45
+ const data = item
46
+ ? ` class="res-link" data-res-url="${esc(item.url)}"`
47
+ : "";
48
+ return `<a href="${safe}"${attrs}${data}>${txt}</a>`;
49
+ });
50
+ t = t.replace(/(^|[\s(])(https?:\/\/[^\s<>)"'`]+)/g, (m, pre, url) => {
51
+ let rest = "";
52
+ const cut = url.search(/&quot;|&#39;|&lt;|&gt;/);
53
+ if (cut !== -1) {
54
+ rest = url.slice(cut);
55
+ url = url.slice(0, cut);
56
+ }
57
+ const trailing = (url.match(/[.,;:!?`]+$/) || [""])[0];
58
+ const clean = trailing ? url.slice(0, -trailing.length) : url;
59
+ if (!clean) return m;
60
+ const item = classifyResource(clean);
61
+ if (item) return `${pre}${resChipHtml(item)}${trailing}${rest}`;
62
+ return `${pre}<a href="${clean}" target="_blank" rel="noopener">${clean}</a>${trailing}${rest}`;
63
+ });
64
+ return t;
65
+ }
66
+
67
+ function resChipHtml(item) {
68
+ return (
69
+ `<a class="res-chip" href="${esc(item.url)}" target="_blank" ` +
70
+ `rel="noopener" data-res-url="${esc(item.url)}">` +
71
+ `<span class="res-chip-ico">${RESOURCE_ICONS[item.kind]}</span>` +
72
+ `${esc(item.id)}</a>`
73
+ );
74
+ }
75
+
76
+ const URL_ONLY = /^(https?:\/\/[^\s]+)$/;
77
+ const DETECTED_URL =
78
+ /(https?:\/\/[^\s<>)\]"'`]+|trackio-local-dashboard:\/\/[^\s<>)\]"'`]+|trackio-artifact:\/\/[^\s<>)\]"'`]+|trackio-local-path:\/\/[^\s<>)\]"'`]+)/g;
79
+
80
+ function renderMarkdown(md, container) {
81
+ const cellRe = /(^|\n)---\n<!-- trackio-cell\n([\s\S]*?)\n-->\n([\s\S]*?)(?=\n---\n<!-- trackio-cell\n|\s*$)/g;
82
+ const tokens = [];
83
+ let pos = 0;
84
+ let found = false;
85
+ let match;
86
+ while ((match = cellRe.exec(md))) {
87
+ found = true;
88
+ tokens.push({
89
+ kind: "md",
90
+ text: md.slice(pos, match.index + match[1].length),
91
+ });
92
+ tokens.push({
93
+ kind: "cell",
94
+ meta: parseCellMeta(match[2]),
95
+ body: match[3],
96
+ });
97
+ pos = match.index + match[0].length;
98
+ }
99
+ tokens.push({ kind: "md", text: found ? md.slice(pos) : md });
100
+
101
+ for (let i = 0; i < tokens.length; i++) {
102
+ const t = tokens[i];
103
+ if (t.kind === "md") {
104
+ renderMarkdownPlain(t.text, container);
105
+ continue;
106
+ }
107
+ if (t.consumed) continue;
108
+ if (t.meta.type === "code") {
109
+ const arts = [];
110
+ for (let j = i + 1; j < tokens.length; j++) {
111
+ const n = tokens[j];
112
+ if (n.kind === "md") {
113
+ if (n.text.trim() === "") continue;
114
+ break;
115
+ }
116
+ if (n.meta.type === "artifact") {
117
+ arts.push(n);
118
+ n.consumed = true;
119
+ continue;
120
+ }
121
+ break;
122
+ }
123
+ renderCell(t.meta, t.body, container, arts);
124
+ } else {
125
+ renderCell(t.meta, t.body, container);
126
+ }
127
+ }
128
+ }
129
+
130
+ function parseCellMeta(raw) {
131
+ try {
132
+ return JSON.parse(raw);
133
+ } catch (e) {
134
+ return { type: "markdown", title: "Note" };
135
+ }
136
+ }
137
+
138
+ function renderMarkdownPlain(md, container) {
139
+ const lines = md.replace(/<!--[\s\S]*?-->/g, "").split("\n");
140
+ let i = 0;
141
+ let para = [];
142
+
143
+ function flushPara() {
144
+ if (!para.length) return;
145
+ const joined = para.join(" ").trim();
146
+ para = [];
147
+ if (!joined) return;
148
+ if (/^trackio-artifact:\/\/\S+$/.test(joined)) return;
149
+ if (/^trackio-local-path:\/\/\S+$/.test(joined)) return;
150
+ if (joined.indexOf("📦 Artifact") !== -1) {
151
+ const div = document.createElement("div");
152
+ div.className = "artifact-chip";
153
+ div.innerHTML = ARTIFACT_ICON_IMG + inline(joined.replace(/📦\s*/, ""));
154
+ container.appendChild(div);
155
+ return;
156
+ }
157
+ if (URL_ONLY.test(joined) || IMG_PATH.test(joined)) {
158
+ const el = renderStandaloneUrl(joined);
159
+ if (el) container.appendChild(el);
160
+ return;
161
+ }
162
+ const p = document.createElement("p");
163
+ p.innerHTML = inline(joined);
164
+ container.appendChild(p);
165
+ }
166
+
167
+ while (i < lines.length) {
168
+ const line = lines[i];
169
+ const trimmed = line.trim();
170
+
171
+ if (trimmed === "") {
172
+ flushPara();
173
+ i++;
174
+ continue;
175
+ }
176
+ const fence = trimmed.match(/^(`{3,}|~{3,})(.*)$/);
177
+ if (fence) {
178
+ flushPara();
179
+ const marker = fence[1][0];
180
+ const closeRe = new RegExp("^" + marker + "{" + fence[1].length + ",}\\s*$");
181
+ const info = fence[2].trim();
182
+ const buf = [];
183
+ i++;
184
+ while (i < lines.length && !closeRe.test(lines[i].trim())) {
185
+ buf.push(lines[i]);
186
+ i++;
187
+ }
188
+ i++;
189
+ const lang = (info.split(/\s+/)[0] || "").toLowerCase();
190
+ const tm = info.match(/title=(\S+)/);
191
+ container.appendChild(
192
+ renderCode(buf.join("\n"), lang, tm ? tm[1] : null)
193
+ );
194
+ continue;
195
+ }
196
+ if (trimmed === "---") {
197
+ flushPara();
198
+ container.appendChild(document.createElement("hr"));
199
+ i++;
200
+ continue;
201
+ }
202
+ const h = trimmed.match(/^(#{1,4})\s+(.*)$/);
203
+ if (h) {
204
+ flushPara();
205
+ const el = document.createElement("h" + h[1].length);
206
+ el.innerHTML = inline(h[2]);
207
+ container.appendChild(el);
208
+ i++;
209
+ continue;
210
+ }
211
+ if (
212
+ trimmed.startsWith("|") &&
213
+ i + 1 < lines.length &&
214
+ /^\|?[\s:|-]*-{2,}[\s:|-]*\|?$/.test(lines[i + 1].trim())
215
+ ) {
216
+ flushPara();
217
+ const rows = [];
218
+ while (i < lines.length && lines[i].trim().startsWith("|")) {
219
+ rows.push(parseRow(lines[i].trim()));
220
+ i++;
221
+ }
222
+ renderTable(rows, container);
223
+ continue;
224
+ }
225
+ if (trimmed.startsWith("> ")) {
226
+ flushPara();
227
+ const bq = document.createElement("blockquote");
228
+ bq.innerHTML = inline(trimmed.slice(2));
229
+ container.appendChild(bq);
230
+ i++;
231
+ continue;
232
+ }
233
+ if (/^`[^`]+`$/.test(trimmed)) {
234
+ flushPara();
235
+ const el = document.createElement("div");
236
+ el.className = "ts";
237
+ el.textContent = trimmed.replace(/`/g, "");
238
+ container.appendChild(el);
239
+ i++;
240
+ continue;
241
+ }
242
+ if (trimmed.startsWith("- ")) {
243
+ flushPara();
244
+ const items = [];
245
+ while (i < lines.length && lines[i].trim().startsWith("- ")) {
246
+ items.push(lines[i].trim().slice(2).trim());
247
+ i++;
248
+ }
249
+ renderList(items, container);
250
+ continue;
251
+ }
252
+ para.push(trimmed);
253
+ i++;
254
+ }
255
+ flushPara();
256
+ }
257
+
258
+ function renderCell(meta, body, container, artifacts) {
259
+ const cell = document.createElement("section");
260
+ cell.className = `cell ${meta.type || "markdown"}`;
261
+ if (meta.id) cell.dataset.cellId = meta.id;
262
+ if (isPinned(meta)) cell.classList.add("pinned-source");
263
+
264
+ const head = document.createElement("div");
265
+ head.className = "cell-head";
266
+ const rawTitle = (meta.title || "").trim();
267
+ const title = rawTitle && rawTitle.toLowerCase() !== "untitled" ? esc(rawTitle) : "";
268
+ const when = meta.created_at ? `<span>${esc(formatTime(meta.created_at))}</span>` : "";
269
+ head.innerHTML =
270
+ (title ? `<div class="cell-title">${title}</div>` : "") +
271
+ `<div class="cell-meta">${when}</div>`;
272
+ if (!title) head.classList.add("no-title");
273
+ cell.appendChild(head);
274
+
275
+ const bodyEl = document.createElement("div");
276
+ bodyEl.className = "cell-body";
277
+ if (meta.type === "code") {
278
+ renderCodeCell(body, bodyEl, artifacts);
279
+ } else if (meta.type === "figure") {
280
+ cell.dataset.resUrl = `trackio-figure://${(meta.title || "Figure").trim()}`;
281
+ renderFigureCell(body, bodyEl, head);
282
+ } else if (meta.type === "artifact") {
283
+ renderMarkdownPlain(body, bodyEl);
284
+ const chip = bodyEl.querySelector(".artifact-chip");
285
+ const uri = body.match(
286
+ /(trackio-artifact:\/\/\S+|trackio-local-path:\/\/\S+|https:\/\/huggingface\.co\/buckets\/[^\s<)]+#\S+)/
287
+ );
288
+ if (chip && uri) chip.dataset.resUrl = uri[1];
289
+ } else if (meta.type === "dashboard") {
290
+ const sp = body.match(/https:\/\/huggingface\.co\/spaces\/[^\s<>)"'`]+/);
291
+ cell.dataset.resUrl = sp
292
+ ? sp[0]
293
+ : `trackio-local-dashboard://${(meta.dashboard_project || "").trim()}`;
294
+ renderDashboardCell(meta, body, bodyEl, head);
295
+ } else {
296
+ const cleaned = stripDuplicateTitle(body, meta.title);
297
+ renderMarkdownPlain(cleaned, bodyEl);
298
+ renderDetectedEmbeds(cleaned, bodyEl);
299
+ }
300
+ cell.appendChild(bodyEl);
301
+ container.appendChild(cell);
302
+ return cell;
303
+ }
304
+
305
+ function isPinned(meta) {
306
+ return Boolean(meta && (meta.pinned === true || meta.pinned === "true"));
307
+ }
308
+
309
+ function stripDuplicateTitle(body, title) {
310
+ if (!title) return body;
311
+ const m = body.match(/^\s*#{1,6}\s+([^\n]+)\n?/);
312
+ if (!m) return body;
313
+ const norm = (s) =>
314
+ s
315
+ .toLowerCase()
316
+ .replace(/[*_`#]/g, "")
317
+ .replace(/\s+/g, " ")
318
+ .trim();
319
+ return norm(m[1]) === norm(title) ? body.slice(m[0].length) : body;
320
+ }
321
+
322
+ function formatTime(iso) {
323
+ const d = new Date(iso);
324
+ if (Number.isNaN(d.getTime())) return iso;
325
+ return d.toLocaleString(undefined, {
326
+ month: "short",
327
+ day: "numeric",
328
+ hour: "2-digit",
329
+ minute: "2-digit",
330
+ });
331
+ }
332
+
333
+ function parseFences(text) {
334
+ const fenceRe = /(`{3,4}|~{3,4})([^\n]*)\n([\s\S]*?)\n\1/g;
335
+ const parts = [];
336
+ let pos = 0;
337
+ let match;
338
+ while ((match = fenceRe.exec(text))) {
339
+ if (match.index > pos) {
340
+ parts.push({ kind: "text", text: text.slice(pos, match.index) });
341
+ }
342
+ const info = match[2].trim();
343
+ const lang = (info.split(/\s+/)[0] || "").toLowerCase();
344
+ const titleMatch = info.match(/title=(\S+)/);
345
+ parts.push({
346
+ kind: lang === "result" || lang === "output" ? "output" : "code",
347
+ lang,
348
+ title: titleMatch ? titleMatch[1] : null,
349
+ text: match[3],
350
+ });
351
+ pos = match.index + match[0].length;
352
+ }
353
+ if (pos < text.length) parts.push({ kind: "text", text: text.slice(pos) });
354
+ return parts;
355
+ }
356
+
357
+ function fitFigureFrame(frame, wrap) {
358
+ let doc;
359
+ try {
360
+ doc = frame.contentDocument;
361
+ } catch (e) {
362
+ return;
363
+ }
364
+ if (!doc || !doc.body) return;
365
+ frame.style.transform = "none";
366
+ frame.style.width = "100%";
367
+ frame.style.height = "auto";
368
+ frame.style.position = "";
369
+ frame.style.left = "";
370
+ frame.style.top = "";
371
+ const avail = wrap.clientWidth;
372
+ const isFullscreen =
373
+ document.fullscreenElement === wrap ||
374
+ document.webkitFullscreenElement === wrap;
375
+ const availHeight = isFullscreen ? wrap.clientHeight : Infinity;
376
+ const cw = Math.max(doc.body.scrollWidth, doc.documentElement.scrollWidth, 1);
377
+ const ch = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight, 1);
378
+ const scale = Math.min(avail / cw, availHeight / ch);
379
+ if (avail && scale < 1 - 1e-3) {
380
+ frame.style.width = `${cw}px`;
381
+ frame.style.height = `${ch}px`;
382
+ frame.style.transformOrigin = "top left";
383
+ frame.style.transform = `scale(${scale})`;
384
+ if (isFullscreen) {
385
+ frame.style.position = "absolute";
386
+ frame.style.left = `${Math.max(0, (avail - cw * scale) / 2)}px`;
387
+ frame.style.top = `${Math.max(0, (availHeight - ch * scale) / 2)}px`;
388
+ wrap.style.height = "100%";
389
+ } else {
390
+ wrap.style.height = `${Math.ceil(ch * scale)}px`;
391
+ }
392
+ } else {
393
+ frame.style.width = "100%";
394
+ frame.style.height = `${ch}px`;
395
+ wrap.style.height = isFullscreen ? "100%" : `${ch}px`;
396
+ }
397
+ }
398
+
399
+ function attachFigureFit(frame, wrap) {
400
+ const refit = () => fitFigureFrame(frame, wrap);
401
+ frame.addEventListener("load", refit);
402
+ if (window.ResizeObserver) {
403
+ const ro = new ResizeObserver(() => refit());
404
+ ro.observe(wrap);
405
+ }
406
+ }
407
+
408
+ function renderFigureCell(text, container, head) {
409
+ const parts = parseFences(text);
410
+ const htmlPart = parts.find((part) => part.lang === "html");
411
+ const rawPart = parts.find((part) => part.lang === "raw");
412
+ if (!htmlPart || !htmlPart.text.trim()) {
413
+ const empty = document.createElement("p");
414
+ empty.className = "muted";
415
+ empty.textContent = "No figure HTML.";
416
+ container.appendChild(empty);
417
+ return;
418
+ }
419
+ const frame = document.createElement("iframe");
420
+ frame.className = "figure-frame";
421
+ frame.sandbox = "allow-scripts allow-same-origin";
422
+ frame.loading = "lazy";
423
+ frame.srcdoc = htmlPart.text;
424
+ registerFigureNavigation(frame);
425
+ const figWrap = document.createElement("div");
426
+ figWrap.className = "figure-fit";
427
+ figWrap.appendChild(frame);
428
+ attachFigureFit(frame, figWrap);
429
+ if (head) {
430
+ const metaEl = head.querySelector(".cell-meta");
431
+ if (metaEl)
432
+ metaEl.insertBefore(buildFullscreenControl(figWrap, frame), metaEl.firstChild);
433
+ }
434
+ if (!rawPart || !rawPart.text.trim()) {
435
+ container.appendChild(figWrap);
436
+ return;
437
+ }
438
+ const sw = document.createElement("div");
439
+ sw.className = "fig-switch";
440
+ const thumb = document.createElement("span");
441
+ thumb.className = "fig-switch-thumb";
442
+ const figBtn = document.createElement("button");
443
+ figBtn.type = "button";
444
+ figBtn.className = "active";
445
+ figBtn.textContent = "Figure";
446
+ const rawBtn = document.createElement("button");
447
+ rawBtn.type = "button";
448
+ rawBtn.textContent = "Raw";
449
+ sw.appendChild(thumb);
450
+ sw.appendChild(figBtn);
451
+ sw.appendChild(rawBtn);
452
+ const rawView = document.createElement("div");
453
+ rawView.className = "figure-raw";
454
+ rawView.hidden = true;
455
+ const pre = document.createElement("pre");
456
+ const code = document.createElement("code");
457
+ code.textContent = rawPart.text;
458
+ pre.appendChild(code);
459
+ rawView.appendChild(pre);
460
+ rawView.appendChild(copySnippetBtn(rawPart.text));
461
+ const select = (showRaw) => {
462
+ sw.classList.toggle("raw", showRaw);
463
+ figBtn.classList.toggle("active", !showRaw);
464
+ rawBtn.classList.toggle("active", showRaw);
465
+ figWrap.hidden = showRaw;
466
+ rawView.hidden = !showRaw;
467
+ };
468
+ figBtn.addEventListener("click", () => select(false));
469
+ rawBtn.addEventListener("click", () => select(true));
470
+ if (head) {
471
+ head.insertBefore(sw, head.querySelector(".cell-meta"));
472
+ } else {
473
+ container.appendChild(sw);
474
+ }
475
+ container.appendChild(figWrap);
476
+ container.appendChild(rawView);
477
+ }
478
+
479
+ // Poster embeds can send `{ type: "trackio-logbook:navigate", target: "..." }`
480
+ // from their iframe. Only accept messages from figure frames we created, and
481
+ // only route to pages that are present in this logbook's manifest.
482
+ function registerFigureNavigation(frame) {
483
+ const registerFrameWindow = () => {
484
+ if (frame.contentWindow) FIGURE_FRAME_WINDOWS.add(frame.contentWindow);
485
+ };
486
+ // `srcdoc` replaces the initial about:blank document. Register after that
487
+ // navigation as well, so messages come from the live figure document.
488
+ frame.addEventListener("load", registerFrameWindow);
489
+ registerFrameWindow();
490
+ if (FIGURE_NAVIGATION_READY) return;
491
+ FIGURE_NAVIGATION_READY = true;
492
+ window.addEventListener("message", (event) => {
493
+ if (!FIGURE_FRAME_WINDOWS.has(event.source)) return;
494
+ const message = event.data;
495
+ if (!message || message.type !== "trackio-logbook:navigate") return;
496
+ const target = String(message.target || "").replace(/^#?\//, "");
497
+ if (!target || !MANIFEST || !findNode(MANIFEST.root, target)) return;
498
+ const hash = "#/" + target;
499
+ if (location.hash === hash) scrollToHash();
500
+ else location.hash = hash;
501
+ });
502
+ }
503
+
504
+ const FULLSCREEN_ICON =
505
+ '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" ' +
506
+ 'stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' +
507
+ '<path d="M8 3H3v5M16 3h5v5M21 16v5h-5M3 16v5h5"/>' +
508
+ '<path d="M3 8 8 3M16 3l5 5M21 16l-5 5M8 21l-5-5"/></svg>';
509
+
510
+ // Figures are rendered in same-origin iframes, so fullscreen the fitted
511
+ // wrapper rather than the iframe document. This uses the browser's native
512
+ // fullscreen UI and preserves the figure's existing responsive sizing.
513
+ function buildFullscreenControl(figWrap, frame) {
514
+ const wrap = document.createElement("span");
515
+ wrap.className = "cell-fullscreen";
516
+ const btn = document.createElement("button");
517
+ btn.type = "button";
518
+ btn.className = "cell-fullscreen-btn";
519
+ btn.setAttribute("aria-label", "Open figure in fullscreen");
520
+ btn.title = "Open figure in fullscreen";
521
+ btn.innerHTML = FULLSCREEN_ICON;
522
+ wrap.appendChild(btn);
523
+
524
+ btn.addEventListener("click", async () => {
525
+ const request = figWrap.requestFullscreen || figWrap.webkitRequestFullscreen;
526
+ if (!request) return;
527
+ try {
528
+ await request.call(figWrap);
529
+ } catch (_) {
530
+ // Fullscreen can be disabled by the embedding browser or policy.
531
+ }
532
+ });
533
+ document.addEventListener("fullscreenchange", () => {
534
+ if (document.fullscreenElement === figWrap) fitFigureFrame(frame, figWrap);
535
+ });
536
+ return wrap;
537
+ }
538
+
539
+ function extractUrls(text) {
540
+ const seen = new Set();
541
+ const urls = [];
542
+ let match;
543
+ while ((match = DETECTED_URL.exec(text))) {
544
+ const url = match[1].replace(/[.,;:!?'"`]+$/, "");
545
+ if (!seen.has(url)) {
546
+ seen.add(url);
547
+ urls.push(url);
548
+ }
549
+ }
550
+ DETECTED_URL.lastIndex = 0;
551
+ return urls;
552
+ }
553
+
554
+ const IMG_URL = /(\.(png|jpe?g|gif|svg|webp)(\?|$)|\/artifact_blob\/)/i;
555
+
556
+ function renderDetectedEmbeds(text, container) {
557
+ extractUrls(text).forEach((url) => {
558
+ if (url.startsWith("trackio-local-dashboard://")) {
559
+ const div = document.createElement("div");
560
+ div.className = "artifact-chip";
561
+ div.dataset.resUrl = url;
562
+ div.innerHTML =
563
+ "🎯 <strong>Local Trackio dashboard</strong> — publish the logbook to share it";
564
+ container.appendChild(div);
565
+ } else if (IMG_URL.test(url)) {
566
+ container.appendChild(renderImage(url));
567
+ } else if (/huggingface\.co\/spaces\//.test(url)) {
568
+ maybeEmbedTrackioSpace(url, container);
569
+ }
570
+ });
571
+ }
572
+
573
+ function renderStandaloneUrl(url) {
574
+ if (IMG_URL.test(url) || IMG_PATH.test(url)) return renderImage(url);
575
+ const item = classifyResource(url);
576
+ if (item) {
577
+ const marker = document.createElement("span");
578
+ marker.className = "resource-anchor";
579
+ marker.dataset.resUrl = item.url;
580
+ marker.setAttribute("aria-hidden", "true");
581
+ return marker;
582
+ }
583
+ const p = document.createElement("p");
584
+ p.innerHTML = inline(url);
585
+ return p;
586
+ }
587
+
588
+ function renderImage(url) {
589
+ const a = document.createElement("a");
590
+ a.className = "unfurl image";
591
+ a.href = url;
592
+ a.target = "_blank";
593
+ a.rel = "noopener";
594
+ const img = document.createElement("img");
595
+ img.loading = "lazy";
596
+ img.src = url;
597
+ img.alt = "artifact image";
598
+ a.appendChild(img);
599
+ return a;
600
+ }
601
+
602
+ function maybeEmbedTrackioSpace(url, container) {
603
+ const id = url.split("/spaces/")[1].split(/[?#]/)[0].replace(/\/$/, "");
604
+ const holder = document.createElement("div");
605
+ container.appendChild(holder);
606
+ getJSON(`https://huggingface.co/api/spaces/${id}`).then((d) => {
607
+ const tags = (d && d.tags) || [];
608
+ if (tags.some((t) => String(t).toLowerCase() === "trackio")) {
609
+ renderTrackioSpaceEmbed(holder, url, id);
610
+ } else {
611
+ holder.remove();
612
+ }
613
+ });
614
+ }
615
+
616
+ function jpGutter(label) {
617
+ const g = document.createElement("div");
618
+ g.className = "jp-gutter";
619
+ g.textContent = label;
620
+ return g;
621
+ }
622
+
623
+ function renderOutArtifact(info) {
624
+ const remote = !info.local && !!info.url;
625
+ const el = document.createElement(remote ? "a" : "div");
626
+ el.className = "out-artifact";
627
+ if (remote) {
628
+ el.href = info.url;
629
+ el.target = "_blank";
630
+ el.rel = "noopener";
631
+ }
632
+ el.dataset.resUrl = info.resUrl;
633
+ const parts = [info.type, info.size].filter(Boolean).map(esc);
634
+ const state = remote
635
+ ? `<span class="out-artifact-state open">Open ↗</span>`
636
+ : `<span class="out-artifact-state">publish to share</span>`;
637
+ const meta = parts.length ? `${parts.join(" · ")} · ${state}` : state;
638
+ el.innerHTML =
639
+ `<span class="out-artifact-ico">${ARTIFACT_ICON_IMG}</span>` +
640
+ `<span class="out-artifact-name">${esc(info.name)}</span>` +
641
+ `<span class="out-artifact-meta">${meta}</span>`;
642
+ return el;
643
+ }
644
+
645
+ function renderCodeCell(body, container, artifacts) {
646
+ const parts = parseFences(body);
647
+ const block = document.createElement("div");
648
+ block.className = "jp";
649
+ const input = document.createElement("div");
650
+ input.className = "jp-in";
651
+ const inputBody = document.createElement("div");
652
+ inputBody.className = "jp-in-body";
653
+ input.appendChild(jpGutter("In"));
654
+ input.appendChild(inputBody);
655
+ let metaEl = null;
656
+ let outputEl = null;
657
+ let outBody = null;
658
+ const ensureOut = () => {
659
+ if (outputEl) return;
660
+ outputEl = document.createElement("div");
661
+ outputEl.className = "jp-out";
662
+ outputEl.appendChild(jpGutter("Out"));
663
+ outBody = document.createElement("div");
664
+ outBody.className = "jp-out-body";
665
+ outputEl.appendChild(outBody);
666
+ };
667
+ const embedTexts = [];
668
+ parts.forEach((part) => {
669
+ if (part.kind === "text") {
670
+ const text = part.text.trim();
671
+ if (!text) return;
672
+ if (/^exit\s+\S+(\s|·)/.test(text)) {
673
+ metaEl = document.createElement("div");
674
+ metaEl.className = "jp-meta";
675
+ metaEl.textContent = text.replace(
676
+ /\s*·\s*[A-Z][a-z]{2} \d{1,2}, \d{4}.*$/,
677
+ ""
678
+ );
679
+ } else {
680
+ renderMarkdownPlain(text, container);
681
+ embedTexts.push(text);
682
+ }
683
+ return;
684
+ }
685
+ if (part.kind === "output") {
686
+ ensureOut();
687
+ const pre = document.createElement("pre");
688
+ pre.className = "jp-out-pre";
689
+ const c = document.createElement("code");
690
+ c.textContent = part.text;
691
+ pre.appendChild(c);
692
+ outBody.appendChild(pre);
693
+ outputEl.appendChild(copySnippetBtn(part.text));
694
+ embedTexts.push(part.text);
695
+ return;
696
+ }
697
+ inputBody.appendChild(renderCode(part.text, part.lang, part.title));
698
+ });
699
+ if (artifacts && artifacts.length) {
700
+ ensureOut();
701
+ const artWrap = document.createElement("div");
702
+ artWrap.className = "jp-artifacts";
703
+ artifacts.forEach((a) => {
704
+ artWrap.appendChild(
705
+ renderOutArtifact(artifactInfoFromCell(a.meta, a.body))
706
+ );
707
+ });
708
+ outBody.appendChild(artWrap);
709
+ }
710
+ if (inputBody.childNodes.length > 0) block.appendChild(input);
711
+ if (metaEl) block.appendChild(metaEl);
712
+ if (outputEl) block.appendChild(outputEl);
713
+ if (block.childNodes.length) container.appendChild(block);
714
+ embedTexts.forEach((text) => renderDetectedEmbeds(text, container));
715
+ }
716
+
717
+ function parseRow(line) {
718
+ let s = line.trim();
719
+ if (s.startsWith("|")) s = s.slice(1);
720
+ if (s.endsWith("|")) s = s.slice(0, -1);
721
+ return s.split(/(?<!\\)\|/).map((c) => c.replace(/\\\|/g, "|").trim());
722
+ }
723
+
724
+ const TRUTHY = ["x", "✓", "✔", "yes", "done", "true", "[x]"];
725
+ const CHIP_COLORS = [
726
+ ["#e7f0ff", "#2158d0"],
727
+ ["#fde8ec", "#c62a4b"],
728
+ ["#e6f7ee", "#1a8a55"],
729
+ ["#fdf0e0", "#b26a12"],
730
+ ["#efe9ff", "#5b3bd6"],
731
+ ["#e6f6f8", "#127b88"],
732
+ ];
733
+
734
+ function chipColor(name) {
735
+ let h = 0;
736
+ for (let i = 0; i < name.length; i++) h = (h * 31 + name.charCodeAt(i)) >>> 0;
737
+ return CHIP_COLORS[h % CHIP_COLORS.length];
738
+ }
739
+
740
+ const STATUS_MAP = {
741
+ "": ["Planned", "gray"],
742
+ planned: ["Planned", "gray"],
743
+ todo: ["Planned", "gray"],
744
+ "to do": ["Planned", "gray"],
745
+ backlog: ["Planned", "gray"],
746
+ "in progress": ["In progress", "amber"],
747
+ "in-progress": ["In progress", "amber"],
748
+ wip: ["In progress", "amber"],
749
+ running: ["In progress", "amber"],
750
+ active: ["In progress", "amber"],
751
+ done: ["Done", "green"],
752
+ complete: ["Done", "green"],
753
+ completed: ["Done", "green"],
754
+ blocked: ["Blocked", "red"],
755
+ failed: ["Failed", "red"],
756
+ abandoned: ["Abandoned", "gray"],
757
+ };
758
+
759
+ function statusBadge(val) {
760
+ const [label, tone] = STATUS_MAP[val.toLowerCase()] || [val || "—", "gray"];
761
+ return `<span class="badge ${tone}">${esc(label)}</span>`;
762
+ }
763
+
764
+ function renderTable(rows, container) {
765
+ if (rows.length < 2) return;
766
+ const header = rows[0];
767
+ const body = rows.slice(2);
768
+ const roles = header.map((h) => {
769
+ const t = h.toLowerCase();
770
+ if (t.includes("status") || t.includes("state")) return "status";
771
+ if (t.includes("progress") || t.includes("complete") || t.includes("done"))
772
+ return "check";
773
+ if (t === "who" || t.includes("assign") || t.includes("owner")) return "who";
774
+ return "text";
775
+ });
776
+ const table = document.createElement("table");
777
+ table.className = "board";
778
+ const thead = document.createElement("thead");
779
+ const htr = document.createElement("tr");
780
+ header.forEach((h, c) => {
781
+ const th = document.createElement("th");
782
+ th.textContent = h;
783
+ if (roles[c] === "check") th.className = "col-check";
784
+ htr.appendChild(th);
785
+ });
786
+ thead.appendChild(htr);
787
+ table.appendChild(thead);
788
+ const tbody = document.createElement("tbody");
789
+ body.forEach((cells) => {
790
+ const nonEmpty = cells.filter((x) => x !== "").length;
791
+ if (header.length > 1 && nonEmpty === 1 && cells[0]) {
792
+ const tr = document.createElement("tr");
793
+ tr.className = "section-row";
794
+ const td = document.createElement("td");
795
+ td.colSpan = header.length;
796
+ td.innerHTML = inline(cells[0]);
797
+ tr.appendChild(td);
798
+ tbody.appendChild(tr);
799
+ return;
800
+ }
801
+ const tr = document.createElement("tr");
802
+ header.forEach((_, c) => {
803
+ const td = document.createElement("td");
804
+ const val = (cells[c] || "").trim();
805
+ if (roles[c] === "status") {
806
+ td.className = "col-status";
807
+ td.innerHTML = statusBadge(val);
808
+ } else if (roles[c] === "check") {
809
+ td.className = "col-check";
810
+ const on = TRUTHY.indexOf(val.toLowerCase()) !== -1;
811
+ td.innerHTML = `<span class="box ${on ? "on" : ""}">${on ? "✓" : ""}</span>`;
812
+ } else if (roles[c] === "who") {
813
+ if (!val || /^to assign$/i.test(val)) {
814
+ td.innerHTML = `<span class="who-chip muted">${esc(val || "—")}</span>`;
815
+ } else {
816
+ const [bg, fg] = chipColor(val);
817
+ td.innerHTML = `<span class="who-chip" style="background:${bg};color:${fg}">${esc(val)}</span>`;
818
+ }
819
+ } else {
820
+ td.innerHTML = inline(val);
821
+ }
822
+ tr.appendChild(td);
823
+ });
824
+ const link = tr.querySelector('a[href^="#/"]');
825
+ if (link) {
826
+ tr.classList.add("linked-row");
827
+ tr.addEventListener("click", (e) => {
828
+ if (e.target.tagName !== "A") location.hash = link.getAttribute("href");
829
+ });
830
+ }
831
+ tbody.appendChild(tr);
832
+ });
833
+ table.appendChild(tbody);
834
+ const wrap = document.createElement("div");
835
+ wrap.className = "board-wrap";
836
+ wrap.appendChild(table);
837
+ container.appendChild(wrap);
838
+ }
839
+
840
+ const HL_RULES = {
841
+ python: [
842
+ ["comment", /#[^\n]*/],
843
+ ["string", /'''[\s\S]*?'''|"""[\s\S]*?"""|'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/],
844
+ [
845
+ "keyword",
846
+ /\b(?:def|class|return|if|elif|else|for|while|import|from|as|with|try|except|finally|raise|in|not|and|or|is|None|True|False|lambda|yield|global|nonlocal|assert|pass|break|continue|async|await|print)\b/,
847
+ ],
848
+ ["number", /\b\d[\d_.eE+-]*\b/],
849
+ ],
850
+ bash: [
851
+ ["comment", /#[^\n]*/],
852
+ ["string", /'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/],
853
+ ["keyword", /\b(?:if|then|else|fi|for|in|do|done|while|case|esac|function|export|source|echo|cd|return|local)\b/],
854
+ ["number", /(?<=\s)-{1,2}[a-zA-Z][\w-]*/],
855
+ ],
856
+ json: [
857
+ ["string", /"(?:\\.|[^"\\])*"/],
858
+ ["keyword", /\b(?:true|false|null)\b/],
859
+ ["number", /-?\b\d[\d.eE+-]*\b/],
860
+ ],
861
+ yaml: [
862
+ ["comment", /#[^\n]*/],
863
+ ["string", /'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/],
864
+ ["keyword", /\b(?:true|false|null|yes|no)\b/],
865
+ ["number", /-?\b\d[\d.eE+-]*\b/],
866
+ ],
867
+ };
868
+ HL_RULES.javascript = HL_RULES.python;
869
+ HL_RULES.typescript = HL_RULES.python;
870
+ HL_RULES.sql = [
871
+ ["comment", /--[^\n]*/],
872
+ ["string", /'(?:\\.|[^'\\])*'/],
873
+ [
874
+ "keyword",
875
+ /\b(?:SELECT|FROM|WHERE|JOIN|LEFT|RIGHT|INNER|OUTER|ON|GROUP|BY|ORDER|LIMIT|INSERT|INTO|VALUES|UPDATE|SET|DELETE|CREATE|TABLE|AS|AND|OR|NOT|NULL|COUNT|DISTINCT|IN)\b/i,
876
+ ],
877
+ ["number", /\b\d[\d.]*\b/],
878
+ ];
879
+
880
+ function highlightCode(code, lang) {
881
+ const rules = HL_RULES[lang];
882
+ if (!rules) return esc(code);
883
+ const combined = new RegExp(rules.map((r) => "(" + r[1].source + ")").join("|"), "g");
884
+ let out = "";
885
+ let last = 0;
886
+ let m;
887
+ while ((m = combined.exec(code))) {
888
+ if (m[0] === "") {
889
+ combined.lastIndex++;
890
+ continue;
891
+ }
892
+ out += esc(code.slice(last, m.index));
893
+ let gi = 1;
894
+ while (gi < m.length && m[gi] === undefined) gi++;
895
+ out += `<span class="tok-${rules[gi - 1][0]}">${esc(m[0])}</span>`;
896
+ last = m.index + m[0].length;
897
+ }
898
+ out += esc(code.slice(last));
899
+ return out;
900
+ }
901
+
902
+ function copySnippetBtn(text) {
903
+ const btn = document.createElement("button");
904
+ btn.type = "button";
905
+ btn.className = "copy-snippet";
906
+ btn.title = "Copy";
907
+ btn.textContent = "⧉";
908
+ btn.addEventListener("click", (e) => {
909
+ e.preventDefault();
910
+ e.stopPropagation();
911
+ copyText(text, btn, "⧉");
912
+ });
913
+ return btn;
914
+ }
915
+
916
+ function renderCode(code, lang, title) {
917
+ const pre = document.createElement("pre");
918
+ pre.className = "hl";
919
+ const c = document.createElement("code");
920
+ c.innerHTML = highlightCode(code, lang);
921
+ pre.appendChild(c);
922
+ if (!title) {
923
+ const wrap = document.createElement("div");
924
+ wrap.className = "snippet";
925
+ wrap.appendChild(pre);
926
+ wrap.appendChild(copySnippetBtn(code));
927
+ return wrap;
928
+ }
929
+ const det = document.createElement("details");
930
+ det.className = "code-accordion";
931
+ det.dataset.resUrl = `trackio-script://${title}`;
932
+ const sum = document.createElement("summary");
933
+ sum.innerHTML =
934
+ `<span class="code-ico">&lt;/&gt;</span>` +
935
+ `<span class="code-name">${esc(title)}</span>`;
936
+ sum
937
+ .querySelector(".code-name")
938
+ .addEventListener("click", (e) => e.preventDefault());
939
+ det.appendChild(sum);
940
+ const wrap = document.createElement("div");
941
+ wrap.className = "snippet";
942
+ wrap.appendChild(pre);
943
+ wrap.appendChild(copySnippetBtn(code));
944
+ det.appendChild(wrap);
945
+ return det;
946
+ }
947
+
948
+ const IMG_PATH = /^[^\s]+\.(png|jpe?g|gif|svg|webp)$/i;
949
+
950
+ function renderList(items, container) {
951
+ let ul = null;
952
+ items.forEach((item) => {
953
+ if (URL_ONLY.test(item) || IMG_PATH.test(item)) {
954
+ const el = renderStandaloneUrl(item);
955
+ if (el) {
956
+ ul = null;
957
+ container.appendChild(el);
958
+ }
959
+ } else if (item.indexOf("📦 Artifact") !== -1) {
960
+ ul = null;
961
+ const div = document.createElement("div");
962
+ div.className = "artifact-chip";
963
+ div.innerHTML = inline(item.replace("📦", "🪣"));
964
+ container.appendChild(div);
965
+ } else if (item.indexOf("trackio-local-dashboard://") !== -1) {
966
+ ul = null;
967
+ const uri = item.match(/trackio-local-dashboard:\/\/\S+/)?.[0] || "";
968
+ const div = document.createElement("div");
969
+ div.className = "artifact-chip";
970
+ if (uri) div.dataset.resUrl = uri;
971
+ div.innerHTML =
972
+ "🎯 <strong>Local dashboard</strong> — publish the logbook to share it";
973
+ container.appendChild(div);
974
+ } else {
975
+ if (!ul) {
976
+ ul = document.createElement("ul");
977
+ container.appendChild(ul);
978
+ }
979
+ const li = document.createElement("li");
980
+ li.innerHTML = inline(item);
981
+ ul.appendChild(li);
982
+ }
983
+ });
984
+ }
985
+
986
+ /* -------------------- resources rail -------------------- */
987
+
988
+ function fmt(n) {
989
+ if (n == null) return null;
990
+ if (n >= 1e6) return (n / 1e6).toFixed(1) + "M";
991
+ if (n >= 1e3) return (n / 1e3).toFixed(1) + "k";
992
+ return String(n);
993
+ }
994
+
995
+ const RESOURCE_SECTIONS = [
996
+ ["dashboard", "Dashboards", "🎯"],
997
+ ["model", "Models", "🤗"],
998
+ ["dataset", "Datasets", "📊"],
999
+ ["space", "Spaces", "🚀"],
1000
+ ["artifact", "Artifacts", "🪣"],
1001
+ ["paper", "Papers", "📄"],
1002
+ ["repo", "Code", "🐙"],
1003
+ ["job", "Jobs", "⚙️"],
1004
+ ["bucket", "Buckets", "🪣"],
1005
+ ];
1006
+
1007
+ const RESOURCE_ICONS = Object.fromEntries(
1008
+ RESOURCE_SECTIONS.map(([kind, , icon]) => [kind, icon])
1009
+ );
1010
+
1011
+ const ARTIFACT_ICON_IMG = `<img class="art-ico" src="./bucket-icon.svg" alt="" />`;
1012
+ const DASHBOARD_ICON_IMG = `<img class="art-ico" src="./trackio-logo-light.png" alt="" />`;
1013
+
1014
+ const RESOURCE_DESC = {
1015
+ dashboard: "Dashboard",
1016
+ model: "Model",
1017
+ dataset: "Dataset",
1018
+ space: "Space",
1019
+ artifact: "Artifact — in Bucket",
1020
+ paper: "Paper",
1021
+ repo: "Repository",
1022
+ job: "Job — status & logs",
1023
+ bucket: "Bucket — artifacts & data",
1024
+ };
1025
+
1026
+ const HF_NON_MODEL_PREFIX =
1027
+ /^(datasets|spaces|jobs|buckets|papers|blog|docs|api|posts|collections|organizations|settings|new|join|login|pricing|tasks|learn|chat|models)(\/|$)/;
1028
+
1029
+ function hfId(url, marker) {
1030
+ return url.split(marker)[1].split(/[?#]/)[0].replace(/\/$/, "");
1031
+ }
1032
+
1033
+ function classifyResource(url) {
1034
+ if (IMG_URL.test(url)) {
1035
+ return null;
1036
+ }
1037
+ let m;
1038
+ if (url.startsWith("trackio-local-dashboard://")) {
1039
+ return {
1040
+ kind: "dashboard",
1041
+ id: url.slice("trackio-local-dashboard://".length),
1042
+ url,
1043
+ local: true,
1044
+ };
1045
+ }
1046
+ if (url.startsWith("trackio-artifact://")) {
1047
+ return {
1048
+ kind: "artifact",
1049
+ id: url.slice("trackio-artifact://".length),
1050
+ url,
1051
+ local: true,
1052
+ };
1053
+ }
1054
+ if (url.startsWith("trackio-local-path://")) {
1055
+ return {
1056
+ kind: "artifact",
1057
+ id: url.slice("trackio-local-path://".length),
1058
+ url,
1059
+ local: true,
1060
+ };
1061
+ }
1062
+ if ((m = url.match(/huggingface\.co\/buckets\/[^#\s]+#(.+)/))) {
1063
+ return { kind: "artifact", id: decodeURIComponent(m[1]), url };
1064
+ }
1065
+ if (/huggingface\.co\/datasets\/[^/]+\/[^/]+/.test(url)) {
1066
+ return { kind: "dataset", id: hfId(url, "/datasets/"), url };
1067
+ }
1068
+ if (/huggingface\.co\/spaces\/[^/]+\/[^/]+/.test(url)) {
1069
+ return { kind: "space", id: hfId(url, "/spaces/"), url };
1070
+ }
1071
+ if (/huggingface\.co\/jobs\//.test(url)) {
1072
+ const parts = hfId(url, "/jobs/").split("/");
1073
+ const jid = parts[1] || "";
1074
+ return {
1075
+ kind: "job",
1076
+ id: parts[0] + (jid ? ` · ${jid.slice(0, 12)}${jid.length > 12 ? "…" : ""}` : ""),
1077
+ url,
1078
+ };
1079
+ }
1080
+ if (/huggingface\.co\/buckets\//.test(url)) {
1081
+ return { kind: "bucket", id: hfId(url, "/buckets/"), url };
1082
+ }
1083
+ if (/huggingface\.co\/papers\//.test(url)) {
1084
+ return { kind: "paper", id: `Paper ${hfId(url, "/papers/")}`, url };
1085
+ }
1086
+ if ((m = url.match(/arxiv\.org\/(?:abs|pdf)\/([^?#\s]+)/))) {
1087
+ return { kind: "paper", id: `arXiv:${m[1].replace(/\.pdf$/, "")}`, url };
1088
+ }
1089
+ if ((m = url.match(/github\.com\/([^/?#]+\/[^/?#]+)/))) {
1090
+ return { kind: "repo", id: m[1], url };
1091
+ }
1092
+ if ((m = url.match(/huggingface\.co\/([^?#]+)/))) {
1093
+ const rest = m[1].replace(/\/$/, "");
1094
+ if (/^[^/]+\/[^/]+$/.test(rest) && !HF_NON_MODEL_PREFIX.test(rest)) {
1095
+ return { kind: "model", id: rest, url };
1096
+ }
1097
+ }
1098
+ return null;
1099
+ }
1100
+
1101
+ async function fillRailMeta(item, el) {
1102
+ if (item.local) return;
1103
+ const meta = el.querySelector(".rail-meta");
1104
+ const set = (parts) => {
1105
+ const text = parts.filter(Boolean).join(" · ");
1106
+ if (text) meta.textContent = text;
1107
+ };
1108
+ if (item.kind === "model") {
1109
+ const d = await getJSON(`https://huggingface.co/api/models/${item.id}`);
1110
+ if (d) set([d.pipeline_tag, `↓ ${fmt(d.downloads)}`, `♥ ${fmt(d.likes)}`]);
1111
+ } else if (item.kind === "dataset") {
1112
+ const d = await getJSON(`https://huggingface.co/api/datasets/${item.id}`);
1113
+ if (d) set([`↓ ${fmt(d.downloads)}`, `♥ ${fmt(d.likes)}`]);
1114
+ } else if (item.kind === "space" || item.kind === "dashboard") {
1115
+ const d = await getJSON(`https://huggingface.co/api/spaces/${item.id}`);
1116
+ if (d) set([d.sdk, `♥ ${fmt(d.likes)}`]);
1117
+ } else if (item.kind === "repo") {
1118
+ const d = await getJSON(`https://api.github.com/repos/${item.id}`);
1119
+ if (d) set([`★ ${fmt(d.stargazers_count)}`, d.language]);
1120
+ } else if (item.kind === "paper") {
1121
+ const m = item.id.match(/^(?:arXiv:|Paper )(.+)$/);
1122
+ if (!m) return;
1123
+ const arxivId = m[1].replace(/v\d+$/, "");
1124
+ const d = await getJSON(`https://huggingface.co/api/papers/${arxivId}`);
1125
+ if (d && d.id) {
1126
+ if (el.href) el.href = `https://huggingface.co/papers/${d.id}`;
1127
+ const title =
1128
+ d.title && d.title.length > 70 ? `${d.title.slice(0, 69)}…` : d.title;
1129
+ set([title, d.upvotes ? `▲ ${fmt(d.upvotes)}` : null]);
1130
+ }
1131
+ }
1132
+ }
1133
+
1134
+ const BARE_ID_SKIP_DIRS = new Set([
1135
+ "scripts",
1136
+ "configs",
1137
+ "config",
1138
+ "results",
1139
+ "figures",
1140
+ "data",
1141
+ "datasets",
1142
+ "src",
1143
+ "tests",
1144
+ "test",
1145
+ "examples",
1146
+ "pages",
1147
+ "assets",
1148
+ "docs",
1149
+ "outputs",
1150
+ "output",
1151
+ "checkpoints",
1152
+ "models",
1153
+ "utils",
1154
+ "lib",
1155
+ "bin",
1156
+ "tmp",
1157
+ "node_modules",
1158
+ "dist",
1159
+ "build",
1160
+ ]);
1161
+ const FILE_EXT_RE =
1162
+ /\.(py|pyc|js|ts|jsx|tsx|json|jsonl|yaml|yml|csv|tsv|md|txt|sh|bash|html|css|png|jpe?g|svg|gif|webp|ipynb|toml|cfg|ini|lock|pdf|whl|gz|zip|tar|pt|pth|bin|safetensors|db|sqlite)$/i;
1163
+
1164
+ async function detectBareModelIds(text, groups) {
1165
+ const stripped = text.replace(DETECTED_URL, " ");
1166
+ DETECTED_URL.lastIndex = 0;
1167
+ const seen = new Set();
1168
+ const candidates = [];
1169
+ const re = /(^|[\s"'`(=[])([A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*)/g;
1170
+ let m;
1171
+ while ((m = re.exec(stripped)) && candidates.length < 15) {
1172
+ const id = m[2].replace(/[.:,]+$/, "");
1173
+ if (seen.has(id)) continue;
1174
+ seen.add(id);
1175
+ if (FILE_EXT_RE.test(id)) continue;
1176
+ if (BARE_ID_SKIP_DIRS.has(id.split("/")[0].toLowerCase())) continue;
1177
+ candidates.push(id);
1178
+ }
1179
+ const results = await Promise.all(
1180
+ candidates.map((id) => getJSON(`https://huggingface.co/api/models/${id}`))
1181
+ );
1182
+ let added = false;
1183
+ const confirmed = [];
1184
+ results.forEach((d, i) => {
1185
+ if (!d || !d.id) return;
1186
+ const id = candidates[i];
1187
+ confirmed.push(id);
1188
+ const url = `https://huggingface.co/${id}`;
1189
+ if (!groups.has("model")) groups.set("model", new Map());
1190
+ if (!groups.get("model").has(url)) {
1191
+ groups.get("model").set(url, { kind: "model", id, url });
1192
+ added = true;
1193
+ }
1194
+ });
1195
+ return { added, confirmed };
1196
+ }
1197
+
1198
+ function chipifyBareIds(ids, container) {
1199
+ if (!ids.length) return;
1200
+ const escaped = ids.map((id) => id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
1201
+ const pattern = new RegExp("(" + escaped.join("|") + ")");
1202
+ const splitter = new RegExp(pattern.source, "g");
1203
+ container
1204
+ .querySelectorAll(".cell.markdown .cell-body")
1205
+ .forEach((body) => {
1206
+ const walker = document.createTreeWalker(body, NodeFilter.SHOW_TEXT, {
1207
+ acceptNode(node) {
1208
+ if (!pattern.test(node.nodeValue)) return NodeFilter.FILTER_REJECT;
1209
+ for (
1210
+ let el = node.parentElement;
1211
+ el && el !== body;
1212
+ el = el.parentElement
1213
+ ) {
1214
+ if (["A", "CODE", "PRE", "BUTTON"].indexOf(el.tagName) !== -1) {
1215
+ return NodeFilter.FILTER_REJECT;
1216
+ }
1217
+ }
1218
+ return NodeFilter.FILTER_ACCEPT;
1219
+ },
1220
+ });
1221
+ const nodes = [];
1222
+ while (walker.nextNode()) nodes.push(walker.currentNode);
1223
+ nodes.forEach((node) => {
1224
+ const frag = document.createDocumentFragment();
1225
+ node.nodeValue.split(splitter).forEach((part) => {
1226
+ if (ids.indexOf(part) !== -1) {
1227
+ const holder = document.createElement("span");
1228
+ holder.innerHTML = resChipHtml({
1229
+ kind: "model",
1230
+ id: part,
1231
+ url: `https://huggingface.co/${part}`,
1232
+ });
1233
+ frag.appendChild(holder.firstChild);
1234
+ } else if (part) {
1235
+ frag.appendChild(document.createTextNode(part));
1236
+ }
1237
+ });
1238
+ node.parentNode.replaceChild(frag, node);
1239
+ });
1240
+ });
1241
+ }
1242
+
1243
+ let RAIL_TOKEN = 0;
1244
+ const RAIL_EXCLUDE_KINDS = new Set(["paper", "repo", "artifact", "dashboard"]);
1245
+
1246
+ function railDashboardItem(it) {
1247
+ return {
1248
+ kind: "dashboard",
1249
+ id: it.id,
1250
+ url: it.local ? it.resUrl : it.url || it.resUrl,
1251
+ local: it.local,
1252
+ railLabel: "Dashboard",
1253
+ };
1254
+ }
1255
+
1256
+ function promoteTrackioSpacesInRail(groups, dashResUrls, body, rail, token) {
1257
+ const spaceGroup = groups.get("space");
1258
+ if (!spaceGroup || !spaceGroup.size) return;
1259
+ spaceGroup.forEach((item, url) => {
1260
+ getJSON(`https://huggingface.co/api/spaces/${item.id}`)
1261
+ .then((d) => {
1262
+ if (rail.dataset.renderToken !== token) return;
1263
+ const tags = (d && d.tags) || [];
1264
+ if (!tags.some((t) => String(t).toLowerCase() === "trackio")) return;
1265
+ if (dashResUrls.has(url)) return;
1266
+ spaceGroup.delete(url);
1267
+ if (!spaceGroup.size) groups.delete("space");
1268
+ if (!groups.has("dashboard")) groups.set("dashboard", new Map());
1269
+ groups.get("dashboard").set(url, {
1270
+ kind: "dashboard",
1271
+ id: item.id,
1272
+ url: item.url,
1273
+ local: false,
1274
+ railLabel: "Dashboard",
1275
+ });
1276
+ dashResUrls.add(url);
1277
+ paintRail(groups, body, rail);
1278
+ })
1279
+ .catch(() => {});
1280
+ });
1281
+ }
1282
+
1283
+ function renderRail(md, body, rail) {
1284
+ const token = String(++RAIL_TOKEN);
1285
+ rail.dataset.renderToken = token;
1286
+ const scanText = md.replace(
1287
+ /(`{3,4}|~{3,4})(html|raw)[^\n]*\n[\s\S]*?\n\1/g,
1288
+ " "
1289
+ );
1290
+ const groups = new Map();
1291
+ const dashMap = new Map();
1292
+ const dashResUrls = new Set();
1293
+ cellDashboardItems(md).forEach((it) => {
1294
+ if (dashMap.has(it.resUrl)) return;
1295
+ dashMap.set(it.resUrl, railDashboardItem(it));
1296
+ dashResUrls.add(it.resUrl);
1297
+ });
1298
+ if (dashMap.size) groups.set("dashboard", dashMap);
1299
+ extractUrls(scanText).forEach((url) => {
1300
+ const item = classifyResource(url);
1301
+ if (!item) return;
1302
+ if (RAIL_EXCLUDE_KINDS.has(item.kind)) return;
1303
+ if (dashResUrls.has(url)) return;
1304
+ if (!groups.has(item.kind)) groups.set(item.kind, new Map());
1305
+ groups.get(item.kind).set(item.url, item);
1306
+ });
1307
+ const artMap = new Map();
1308
+ cellArtifactItems(md).forEach((it) => {
1309
+ if (artMap.has(it.resUrl)) return;
1310
+ const label = it.type
1311
+ ? it.type.charAt(0).toUpperCase() + it.type.slice(1)
1312
+ : "Artifact";
1313
+ artMap.set(it.resUrl, {
1314
+ kind: "artifact",
1315
+ id: it.name,
1316
+ url: it.local ? it.resUrl : it.url || it.resUrl,
1317
+ local: it.local,
1318
+ railLabel: label,
1319
+ size: it.size,
1320
+ });
1321
+ });
1322
+ if (artMap.size) groups.set("artifact", artMap);
1323
+ paintRail(groups, body, rail);
1324
+ promoteTrackioSpacesInRail(groups, dashResUrls, body, rail, token);
1325
+ detectBareModelIds(scanText, groups)
1326
+ .then((result) => {
1327
+ if (rail.dataset.renderToken !== token) return;
1328
+ chipifyBareIds(result.confirmed, body);
1329
+ if (result.added) paintRail(groups, body, rail);
1330
+ })
1331
+ .catch(() => {});
1332
+ }
1333
+
1334
+ function paintRail(groups, body, rail) {
1335
+ rail.innerHTML = "";
1336
+ RESOURCE_SECTIONS.forEach(([kind, label, icon]) => {
1337
+ const group = groups.get(kind);
1338
+ if (!group || !group.size) return;
1339
+ group.forEach((item) => {
1340
+ const el = document.createElement(item.local ? "div" : "a");
1341
+ el.className = item.local ? "rail-item rail-local" : "rail-item";
1342
+ if (!item.local) {
1343
+ el.href = item.url;
1344
+ el.target = "_blank";
1345
+ el.rel = "noopener";
1346
+ }
1347
+ el.dataset.resUrl = item.url;
1348
+ let desc;
1349
+ if (kind === "artifact") {
1350
+ const state = item.local ? "publish to share" : "Open ↗";
1351
+ desc = item.size ? `${item.size} · ${state}` : state;
1352
+ } else if (kind === "dashboard") {
1353
+ desc = item.local ? "publish to share" : "Open ↗";
1354
+ } else {
1355
+ desc = item.local ? "publish to share" : RESOURCE_DESC[kind];
1356
+ }
1357
+ const kindLabel = item.railLabel || label.replace(/s$/, "");
1358
+ const iconHtml =
1359
+ kind === "artifact"
1360
+ ? ARTIFACT_ICON_IMG
1361
+ : kind === "dashboard"
1362
+ ? DASHBOARD_ICON_IMG
1363
+ : `<span>${icon}</span>`;
1364
+ el.innerHTML =
1365
+ `<div class="rail-kind">${iconHtml}${esc(kindLabel)}</div>` +
1366
+ `<div class="rail-title">${esc(item.id)}</div>` +
1367
+ `<div class="rail-meta">${esc(desc)}</div>`;
1368
+ rail.appendChild(el);
1369
+ fillRailMeta(item, el)
1370
+ .catch(() => {})
1371
+ .finally(() => scheduleRailPosition(body, rail));
1372
+ });
1373
+ });
1374
+ rail.hidden = !rail.childElementCount;
1375
+ scheduleRailPosition(body, rail);
1376
+ }
1377
+
1378
+ function resourceAnchor(body, url) {
1379
+ return body.querySelector(`[data-res-url="${CSS.escape(url)}"]`);
1380
+ }
1381
+
1382
+ function positionRail(body, rail) {
1383
+ if (rail.hidden || !rail.isConnected) return;
1384
+ const bodyRect = body.getBoundingClientRect();
1385
+ const items = Array.from(rail.querySelectorAll(".rail-item")).map((el, index) => {
1386
+ const anchor = resourceAnchor(body, el.dataset.resUrl);
1387
+ return {
1388
+ el,
1389
+ index,
1390
+ desired: anchor
1391
+ ? Math.max(0, anchor.getBoundingClientRect().top - bodyRect.top)
1392
+ : 0,
1393
+ };
1394
+ });
1395
+ items.sort((a, b) => a.desired - b.desired || a.index - b.index);
1396
+ let cursor = 0;
1397
+ items.forEach(({ el, desired }) => {
1398
+ const top = Math.max(desired, cursor);
1399
+ el.style.top = `${top}px`;
1400
+ cursor = top + el.offsetHeight + 10;
1401
+ });
1402
+ rail.style.minHeight = `${Math.max(body.offsetHeight, cursor)}px`;
1403
+ }
1404
+
1405
+ function scheduleRailPosition(body, rail) {
1406
+ cancelAnimationFrame(Number(rail.dataset.positionFrame || 0));
1407
+ rail.dataset.positionFrame = String(
1408
+ requestAnimationFrame(() => positionRail(body, rail))
1409
+ );
1410
+ }
1411
+
1412
+ function dashboardSubdomainFromUrl(url) {
1413
+ return spaceIdFromUrl(url).toLowerCase().replace(/[^a-z0-9-]/g, "-");
1414
+ }
1415
+
1416
+ function dashboardOpenLink(head, url) {
1417
+ if (!head || !url) return;
1418
+ const meta = head.querySelector(".cell-meta");
1419
+ if (!meta) return;
1420
+ let link = meta.querySelector(".cell-open");
1421
+ if (!link) {
1422
+ link = document.createElement("a");
1423
+ link.className = "cell-open";
1424
+ link.target = "_blank";
1425
+ link.rel = "noopener";
1426
+ meta.insertBefore(link, meta.firstChild);
1427
+ }
1428
+ link.href = url;
1429
+ link.textContent = "Open ↗";
1430
+ }
1431
+
1432
+ function dashboardFrame(src) {
1433
+ const iframe = document.createElement("iframe");
1434
+ iframe.className = "dashboard-frame";
1435
+ iframe.src = src;
1436
+ iframe.loading = "lazy";
1437
+ iframe.allow = "clipboard-read; clipboard-write; fullscreen";
1438
+ return iframe;
1439
+ }
1440
+
1441
+ function renderDashboardCell(meta, body, container, head) {
1442
+ const project = meta.dashboard_project || "";
1443
+ const holder = document.createElement("div");
1444
+ holder.className = "dashboard-shell";
1445
+ container.appendChild(holder);
1446
+ const space = body.match(/https:\/\/huggingface\.co\/spaces\/[^\s<>)"'`]+/);
1447
+ if (space) {
1448
+ const url = space[0];
1449
+ dashboardOpenLink(head, url);
1450
+ holder.appendChild(
1451
+ dashboardFrame(
1452
+ `https://${dashboardSubdomainFromUrl(url)}.hf.space/?sidebar=hidden&hide_empty_tabs=true`
1453
+ )
1454
+ );
1455
+ return;
1456
+ }
1457
+ if (!isLocalPreview()) {
1458
+ holder.className = "artifact-chip";
1459
+ holder.dataset.resUrl = `trackio-local-dashboard://${project}`;
1460
+ holder.innerHTML =
1461
+ "🎯 <strong>Local Trackio dashboard</strong> — publish the logbook to share it";
1462
+ return;
1463
+ }
1464
+ const open = "/dashboard/?project=" + encodeURIComponent(project);
1465
+ dashboardOpenLink(head, open);
1466
+ holder.appendChild(
1467
+ dashboardFrame(open + "&sidebar=hidden&hide_empty_tabs=true"),
1468
+ );
1469
+ }
1470
+
1471
+ const CACHE_PREFIX = "trackio-logbook:";
1472
+ const CACHE_TTL_MS = 24 * 60 * 60 * 1000;
1473
+ const CACHE_MISS_TTL_MS = 60 * 60 * 1000;
1474
+
1475
+ function cacheGet(url) {
1476
+ try {
1477
+ const raw = localStorage.getItem(CACHE_PREFIX + url);
1478
+ if (!raw) return undefined;
1479
+ const entry = JSON.parse(raw);
1480
+ const ttl = entry.d === null ? CACHE_MISS_TTL_MS : CACHE_TTL_MS;
1481
+ if (Date.now() - entry.t > ttl) {
1482
+ localStorage.removeItem(CACHE_PREFIX + url);
1483
+ return undefined;
1484
+ }
1485
+ return entry.d;
1486
+ } catch (e) {
1487
+ return undefined;
1488
+ }
1489
+ }
1490
+
1491
+ function cacheSet(url, data) {
1492
+ try {
1493
+ localStorage.setItem(
1494
+ CACHE_PREFIX + url,
1495
+ JSON.stringify({ t: Date.now(), d: data })
1496
+ );
1497
+ } catch (e) {}
1498
+ }
1499
+
1500
+ async function getJSON(url) {
1501
+ if (UNFURL_CACHE[url] !== undefined) return UNFURL_CACHE[url];
1502
+ const cached = cacheGet(url);
1503
+ if (cached !== undefined) {
1504
+ UNFURL_CACHE[url] = cached;
1505
+ return cached;
1506
+ }
1507
+ try {
1508
+ const r = await fetch(url);
1509
+ if (!r.ok) throw new Error(r.status);
1510
+ const j = await r.json();
1511
+ UNFURL_CACHE[url] = j;
1512
+ cacheSet(url, j);
1513
+ return j;
1514
+ } catch (e) {
1515
+ UNFURL_CACHE[url] = null;
1516
+ cacheSet(url, null);
1517
+ return null;
1518
+ }
1519
+ }
1520
+
1521
+ /* -------------------- routing / render -------------------- */
1522
+
1523
+ function buildTree() {
1524
+ const tree = document.getElementById("tree");
1525
+ tree.innerHTML = "";
1526
+ const nodes = [];
1527
+ (MANIFEST.root.children || []).forEach((c) => flattenTree(c, 0, nodes));
1528
+ nodes.forEach(({ node, depth }) => {
1529
+ const a = document.createElement("a");
1530
+ a.href = "#/" + node.slug;
1531
+ a.className = "depth-" + depth;
1532
+ a.dataset.slug = node.slug;
1533
+ const mark = document.createElement("span");
1534
+ mark.className = "tree-mark";
1535
+ mark.textContent = "§";
1536
+ a.appendChild(mark);
1537
+ a.appendChild(document.createTextNode(" " + node.title));
1538
+ tree.appendChild(a);
1539
+ });
1540
+ }
1541
+
1542
+ function highlight(slug) {
1543
+ document
1544
+ .querySelectorAll("#tree a")
1545
+ .forEach((a) => a.classList.toggle("active", a.dataset.slug === slug));
1546
+ document
1547
+ .getElementById("book-head")
1548
+ .classList.toggle("active", slug === MANIFEST.root.slug);
1549
+ }
1550
+
1551
+ function clearPageCache() {
1552
+ Object.keys(PAGE_CACHE).forEach((key) => {
1553
+ delete PAGE_CACHE[key];
1554
+ });
1555
+ }
1556
+
1557
+ function isLocalPreview() {
1558
+ return ["localhost", "127.0.0.1", "::1"].includes(location.hostname);
1559
+ }
1560
+
1561
+ async function fetchManifest() {
1562
+ const suffix = isLocalPreview() ? `?t=${Date.now()}` : "";
1563
+ return await (await fetch("./logbook.json" + suffix, { cache: "no-store" })).json();
1564
+ }
1565
+
1566
+ async function fetchPage(node) {
1567
+ if (PAGE_CACHE[node.file]) return PAGE_CACHE[node.file];
1568
+ try {
1569
+ const suffix = isLocalPreview()
1570
+ ? `?rev=${encodeURIComponent(MANIFEST.revision || "")}`
1571
+ : "";
1572
+ const r = await fetch("./" + node.file + suffix, { cache: "no-store" });
1573
+ PAGE_CACHE[node.file] = await r.text();
1574
+ } catch (e) {
1575
+ PAGE_CACHE[node.file] = "# " + node.title + "\n\n_Could not load section._";
1576
+ }
1577
+ return PAGE_CACHE[node.file];
1578
+ }
1579
+
1580
+ function allNodes() {
1581
+ const nodes = [];
1582
+ flattenTree(MANIFEST.root, 0, nodes);
1583
+ return nodes.map(({ node }) => node);
1584
+ }
1585
+
1586
+ function collectPinnedCells(markdown, nodes) {
1587
+ const cells = [];
1588
+ markdown.forEach((text, index) => {
1589
+ const cellRe = /(^|\n)---\n<!-- trackio-cell\n([\s\S]*?)\n-->\n([\s\S]*?)(?=\n---\n<!-- trackio-cell\n|\s*$)/g;
1590
+ let match;
1591
+ let cellIndex = 0;
1592
+ while ((match = cellRe.exec(text))) {
1593
+ const meta = parseCellMeta(match[2]);
1594
+ if (isPinned(meta)) {
1595
+ cells.push({
1596
+ meta,
1597
+ body: match[3],
1598
+ node: nodes[index],
1599
+ index: cells.length,
1600
+ order: meta.pinned_at || meta.created_at || "",
1601
+ cellIndex,
1602
+ });
1603
+ }
1604
+ cellIndex++;
1605
+ }
1606
+ });
1607
+ return cells.sort(
1608
+ (a, b) =>
1609
+ a.order.localeCompare(b.order) ||
1610
+ a.index - b.index ||
1611
+ a.cellIndex - b.cellIndex
1612
+ );
1613
+ }
1614
+
1615
+ function renderPinnedNotes(cells, container) {
1616
+ if (!cells.length) return;
1617
+ const deck = document.createElement("section");
1618
+ deck.className = "pinned-notes";
1619
+ const list = document.createElement("div");
1620
+ list.className = "pinned-notes-list";
1621
+ cells.forEach(({ meta, body }) => {
1622
+ const cell = renderCell(meta, body, list);
1623
+ cell.classList.add("pinned-copy");
1624
+ });
1625
+ deck.appendChild(list);
1626
+ const anchor =
1627
+ container.querySelector(".logbook-stats") ||
1628
+ container.querySelector(".agent-hint");
1629
+ container.insertBefore(deck, anchor ? anchor.nextSibling : container.firstChild);
1630
+ container.closest(".book-intro").classList.add("has-pinned-notes");
1631
+ }
1632
+
1633
+ function removeIndexProse(body) {
1634
+ const h1 = Array.from(body.children).find((el) => el.tagName === "H1");
1635
+ if (!h1) return;
1636
+ let current = h1.nextElementSibling;
1637
+ while (current && current.tagName !== "H2") {
1638
+ const next = current.nextElementSibling;
1639
+ current.remove();
1640
+ current = next;
1641
+ }
1642
+ }
1643
+
1644
+ function removePageDirectory(body) {
1645
+ const heading = Array.from(body.children).find(
1646
+ (el) => el.tagName === "H2" && el.textContent.trim().toLowerCase() === "pages"
1647
+ );
1648
+ if (!heading) return;
1649
+ let current = heading;
1650
+ while (current) {
1651
+ const next = current.nextElementSibling;
1652
+ current.remove();
1653
+ if (next && ["H1", "H2"].includes(next.tagName)) break;
1654
+ current = next;
1655
+ }
1656
+ }
1657
+
1658
+ const RAIL_OBSERVERS = [];
1659
+
1660
+ async function renderLogbook(opts = {}) {
1661
+ const scrollY = window.scrollY;
1662
+ const page = document.getElementById("page");
1663
+ RAIL_OBSERVERS.splice(0).forEach((observer) => observer.disconnect());
1664
+ page.innerHTML = "";
1665
+ const nodes = allNodes();
1666
+ const markdown = await Promise.all(nodes.map(fetchPage));
1667
+ const pinnedCells = collectPinnedCells(markdown, nodes);
1668
+ let bookIntroBody = null;
1669
+ nodes.forEach((node, index) => {
1670
+ const section = document.createElement("section");
1671
+ section.className = "page-section";
1672
+ section.id = "/" + node.slug;
1673
+ section.dataset.slug = node.slug;
1674
+
1675
+ const layout = document.createElement("div");
1676
+ layout.className = "page-layout";
1677
+ const body = document.createElement("div");
1678
+ body.className = "page-body";
1679
+ const rail = document.createElement("aside");
1680
+ rail.className = "context-rail";
1681
+ rail.setAttribute("aria-label", `Resources for ${node.title}`);
1682
+
1683
+ renderMarkdown(markdown[index], body);
1684
+ if (node.slug === MANIFEST.root.slug) {
1685
+ section.classList.add("book-intro");
1686
+ removeIndexProse(body);
1687
+ removePageDirectory(body);
1688
+ const hint = buildAgentHint();
1689
+ const h1 = body.querySelector("h1");
1690
+ if (h1 && h1.parentNode === body) {
1691
+ body.insertBefore(hint, h1.nextSibling);
1692
+ } else {
1693
+ body.prepend(hint);
1694
+ }
1695
+ hint.after(buildLogbookStats(markdown));
1696
+ bookIntroBody = body;
1697
+ }
1698
+ layout.appendChild(body);
1699
+ layout.appendChild(rail);
1700
+ section.appendChild(layout);
1701
+ page.appendChild(section);
1702
+ renderRail(markdown[index], body, rail);
1703
+ if (window.ResizeObserver) {
1704
+ const observer = new ResizeObserver(() => scheduleRailPosition(body, rail));
1705
+ observer.observe(body);
1706
+ observer.observe(rail);
1707
+ RAIL_OBSERVERS.push(observer);
1708
+ }
1709
+ });
1710
+ if (bookIntroBody) renderPinnedNotes(pinnedCells, bookIntroBody);
1711
+ if (bookIntroBody) {
1712
+ const section = bookIntroBody.closest(".book-intro");
1713
+ const hasExtra = Array.from(bookIntroBody.children).some(
1714
+ (el) =>
1715
+ el.tagName !== "H1" &&
1716
+ !el.classList.contains("agent-hint") &&
1717
+ !el.classList.contains("logbook-stats") &&
1718
+ !el.classList.contains("pinned-notes")
1719
+ );
1720
+ if (section && !section.classList.contains("has-pinned-notes") && !hasExtra) {
1721
+ section.classList.add("book-intro-tight");
1722
+ }
1723
+ }
1724
+ requestAnimationFrame(() => {
1725
+ if (opts.preserveScroll) {
1726
+ window.scrollTo(0, scrollY);
1727
+ } else {
1728
+ scrollToHash({ behavior: "auto" });
1729
+ }
1730
+ updateActiveSection();
1731
+ });
1732
+ }
1733
+
1734
+ function setupResourceHover() {
1735
+ document.addEventListener("mouseover", (e) => {
1736
+ const el = e.target.closest && e.target.closest("[data-res-url]");
1737
+ if (!el || el.classList.contains("rail-item")) return;
1738
+ const url = el.getAttribute("data-res-url");
1739
+ const section = el.closest(".page-section");
1740
+ const scope = section || document;
1741
+ scope.querySelectorAll(".context-rail [data-res-url]").forEach((n) => {
1742
+ n.classList.toggle("res-hl", n.getAttribute("data-res-url") === url);
1743
+ });
1744
+ });
1745
+ document.addEventListener("mouseout", (e) => {
1746
+ const el = e.target.closest && e.target.closest("[data-res-url]");
1747
+ if (!el || el.classList.contains("rail-item")) return;
1748
+ document.querySelectorAll(".context-rail .res-hl").forEach((n) => {
1749
+ n.classList.remove("res-hl");
1750
+ });
1751
+ });
1752
+ }
1753
+
1754
+ let STATS_TOKEN = 0;
1755
+ let STATS_LISTENERS = false;
1756
+
1757
+ function fmtBytes(n) {
1758
+ if (n == null || isNaN(n)) return null;
1759
+ if (n < 1000) return `${n} B`;
1760
+ const units = ["kB", "MB", "GB", "TB"];
1761
+ let v = n;
1762
+ let i = -1;
1763
+ do {
1764
+ v /= 1000;
1765
+ i++;
1766
+ } while (v >= 1000 && i < units.length - 1);
1767
+ return `${v.toFixed(v < 10 ? 1 : 0)} ${units[i]}`;
1768
+ }
1769
+
1770
+ function spaceIdFromUrl(url) {
1771
+ return url.split("/spaces/")[1].split(/[?#]/)[0].replace(/\/$/, "");
1772
+ }
1773
+
1774
+ const LB_CELL_RE = /(^|\n)---\n<!-- trackio-cell\n([\s\S]*?)\n-->\n([\s\S]*?)(?=\n---\n<!-- trackio-cell\n|\s*$)/g;
1775
+
1776
+ function cellDashboardItems(md) {
1777
+ const re = new RegExp(LB_CELL_RE.source, "g");
1778
+ const items = [];
1779
+ let m;
1780
+ while ((m = re.exec(md))) {
1781
+ const meta = parseCellMeta(m[2]);
1782
+ if (meta.type !== "dashboard") continue;
1783
+ const body = m[3];
1784
+ const project = meta.dashboard_project || "";
1785
+ const sp = body.match(/https:\/\/huggingface\.co\/spaces\/[^\s<>)"'`]+/);
1786
+ const local = !sp;
1787
+ const url = sp ? sp[0] : "";
1788
+ const resUrl = local ? `trackio-local-dashboard://${project}` : url;
1789
+ items.push({
1790
+ id: local ? project : spaceIdFromUrl(url),
1791
+ local,
1792
+ url,
1793
+ resUrl,
1794
+ });
1795
+ }
1796
+ return items;
1797
+ }
1798
+
1799
+ function artifactInfoFromCell(meta, body) {
1800
+ const name = meta.artifact || meta.path || "";
1801
+ let size = null;
1802
+ const sm = body.match(/·\s*([\d.]+\s*[kMGT]?B)\b/);
1803
+ if (sm) size = sm[1].trim();
1804
+ if (!size && meta.size != null) size = fmtBytes(meta.size);
1805
+ const bucket = body.match(/https:\/\/huggingface\.co\/buckets\/[^\s<>)"'`]+/);
1806
+ const artUri = body.match(/trackio-artifact:\/\/\S+/);
1807
+ const pathUri = body.match(/trackio-local-path:\/\/\S+/);
1808
+ const url = bucket ? bucket[0] : "";
1809
+ const local = !bucket;
1810
+ const resUrl =
1811
+ url || (artUri ? artUri[0] : pathUri ? pathUri[0] : `trackio-artifact://${name}`);
1812
+ return {
1813
+ name,
1814
+ type: meta.artifact_type || "",
1815
+ size,
1816
+ local,
1817
+ isPathRef: !!meta.path,
1818
+ url,
1819
+ resUrl,
1820
+ };
1821
+ }
1822
+
1823
+ function cellArtifactItems(md) {
1824
+ const re = new RegExp(LB_CELL_RE.source, "g");
1825
+ const items = [];
1826
+ let m;
1827
+ while ((m = re.exec(md))) {
1828
+ const meta = parseCellMeta(m[2]);
1829
+ const body = m[3];
1830
+ const order = meta.created_at || "";
1831
+ if (meta.type === "artifact") {
1832
+ const info = artifactInfoFromCell(meta, body);
1833
+ if (info.name) items.push({ ...info, order });
1834
+ }
1835
+ }
1836
+ return items;
1837
+ }
1838
+
1839
+ function collectLogbookResources(markdownList) {
1840
+ const re = new RegExp(LB_CELL_RE.source, "g");
1841
+ const dashboards = new Map();
1842
+ markdownList.forEach((md) => {
1843
+ let m;
1844
+ while ((m = re.exec(md))) {
1845
+ const meta = parseCellMeta(m[2]);
1846
+ const body = m[3];
1847
+ if (meta.type !== "dashboard") continue;
1848
+ const project = meta.dashboard_project || "";
1849
+ const space = body.match(/https:\/\/huggingface\.co\/spaces\/[^\s<>)"'`]+/);
1850
+ const local = !space;
1851
+ const url = space ? space[0] : "";
1852
+ const key = local ? `local:${project}` : `space:${spaceIdFromUrl(url)}`;
1853
+ const resUrl = local ? `trackio-local-dashboard://${project}` : url;
1854
+ if (!dashboards.has(key))
1855
+ dashboards.set(key, { project, local, url, resUrl });
1856
+ }
1857
+ });
1858
+ const artifacts = new Map();
1859
+ markdownList.forEach((md) => {
1860
+ cellArtifactItems(md).forEach((it) => {
1861
+ const key = `${it.type}:${it.name}`;
1862
+ const prev = artifacts.get(key);
1863
+ if (!prev || it.order >= prev.order) artifacts.set(key, it);
1864
+ });
1865
+ });
1866
+ return {
1867
+ dashboards: Array.from(dashboards.values()).sort((a, b) =>
1868
+ a.project.localeCompare(b.project)
1869
+ ),
1870
+ artifacts: Array.from(artifacts.values()).sort((a, b) =>
1871
+ a.name.localeCompare(b.name)
1872
+ ),
1873
+ };
1874
+ }
1875
+
1876
+ function closeStatPopovers() {
1877
+ document
1878
+ .querySelectorAll(".stat-popover")
1879
+ .forEach((p) => (p.hidden = true));
1880
+ document
1881
+ .querySelectorAll(".stat-tile.open")
1882
+ .forEach((t) => t.classList.remove("open"));
1883
+ }
1884
+
1885
+ function ensureStatListeners() {
1886
+ if (STATS_LISTENERS) return;
1887
+ STATS_LISTENERS = true;
1888
+ document.addEventListener("click", closeStatPopovers);
1889
+ document.addEventListener("keydown", (e) => {
1890
+ if (e.key === "Escape") closeStatPopovers();
1891
+ });
1892
+ }
1893
+
1894
+ function stateHtml(remote, url) {
1895
+ return remote
1896
+ ? `<a class="stat-row-state open" href="${esc(url)}" target="_blank" rel="noopener" title="Open in a new tab">Open ↗</a>`
1897
+ : `<span class="stat-row-state">publish to share</span>`;
1898
+ }
1899
+
1900
+ function scrollToResource(resUrl) {
1901
+ closeStatPopovers();
1902
+ if (!resUrl) return;
1903
+ const el = document.querySelector(
1904
+ `#page .page-body [data-res-url="${CSS.escape(resUrl)}"]:not(.stat-row)`
1905
+ );
1906
+ if (!el) return;
1907
+ el.scrollIntoView({ behavior: "smooth", block: "center" });
1908
+ el.classList.add("res-flash");
1909
+ setTimeout(() => el.classList.remove("res-flash"), 1500);
1910
+ }
1911
+
1912
+ function dashRowHtml(d) {
1913
+ const inner =
1914
+ `<span class="stat-row-ico">${DASHBOARD_ICON_IMG}</span>` +
1915
+ `<div class="stat-row-main"><div class="stat-row-title">${esc(d.project)}</div>` +
1916
+ `<div class="stat-row-meta">${stateHtml(!d.local, d.url)}</div></div>`;
1917
+ return `<div class="stat-row" data-res-url="${esc(d.resUrl)}" title="Jump to it in the logbook">${inner}</div>`;
1918
+ }
1919
+
1920
+ function artRowHtml(a) {
1921
+ const remote = !a.local && !!a.url;
1922
+ const parts = [a.type, a.size].filter(Boolean).map(esc);
1923
+ const meta = parts.length
1924
+ ? `${parts.join(" · ")} · ${stateHtml(remote, a.url)}`
1925
+ : stateHtml(remote, a.url);
1926
+ const inner =
1927
+ `<span class="stat-row-ico">${ARTIFACT_ICON_IMG}</span>` +
1928
+ `<div class="stat-row-main"><div class="stat-row-title">${esc(a.name)}</div>` +
1929
+ `<div class="stat-row-meta">${meta}</div></div>`;
1930
+ return `<div class="stat-row" data-res-url="${esc(a.resUrl)}" title="Jump to it in the logbook">${inner}</div>`;
1931
+ }
1932
+
1933
+ function statTile(icon, alt, singular, plural, head, rowFn) {
1934
+ const tile = document.createElement("button");
1935
+ tile.type = "button";
1936
+ tile.className = "stat-tile";
1937
+ const render = (items) => {
1938
+ const count = items.length;
1939
+ const label = count === 1 ? singular : plural;
1940
+ const caret = count > 0 ? `<span class="stat-caret">▾</span>` : "";
1941
+ tile.innerHTML =
1942
+ `<img class="stat-icon" src="${icon}" alt="${esc(alt)}" />` +
1943
+ `<div class="stat-text"><div class="stat-num">${count}</div>` +
1944
+ `<div class="stat-label">${esc(label)}</div></div>` +
1945
+ caret;
1946
+ tile.disabled = count === 0;
1947
+ if (count > 0) {
1948
+ const pop = document.createElement("div");
1949
+ pop.className = "stat-popover";
1950
+ pop.hidden = true;
1951
+ pop.innerHTML =
1952
+ `<div class="stat-pop-head">${esc(head)}</div>` +
1953
+ items.map(rowFn).join("");
1954
+ pop.addEventListener("click", (e) => {
1955
+ if (e.target.closest("a.stat-row-state")) {
1956
+ e.stopPropagation();
1957
+ return;
1958
+ }
1959
+ e.stopPropagation();
1960
+ const row = e.target.closest(".stat-row");
1961
+ if (row) scrollToResource(row.dataset.resUrl);
1962
+ });
1963
+ tile.appendChild(pop);
1964
+ }
1965
+ };
1966
+ tile.addEventListener("click", (e) => {
1967
+ if (tile.disabled) return;
1968
+ e.stopPropagation();
1969
+ const pop = tile.querySelector(".stat-popover");
1970
+ if (!pop) return;
1971
+ const isOpen = !pop.hidden;
1972
+ closeStatPopovers();
1973
+ if (!isOpen) {
1974
+ pop.hidden = false;
1975
+ tile.classList.add("open");
1976
+ }
1977
+ });
1978
+ return { tile, render };
1979
+ }
1980
+
1981
+ function buildLogbookStats(markdownList) {
1982
+ const token = ++STATS_TOKEN;
1983
+ ensureStatListeners();
1984
+ const { dashboards, artifacts } = collectLogbookResources(markdownList);
1985
+
1986
+ const el = document.createElement("div");
1987
+ el.className = "logbook-stats";
1988
+ const dash = statTile(
1989
+ "./trackio-logo-light.png",
1990
+ "Trackio",
1991
+ "Trackio Dashboard",
1992
+ "Trackio Dashboards",
1993
+ "Dashboards created in this logbook",
1994
+ dashRowHtml
1995
+ );
1996
+ const art = statTile(
1997
+ "./bucket-icon.svg",
1998
+ "Bucket",
1999
+ "Artifact",
2000
+ "Artifacts",
2001
+ "Artifacts created in this logbook",
2002
+ artRowHtml
2003
+ );
2004
+ dash.render(dashboards);
2005
+ art.render(artifacts);
2006
+ el.appendChild(dash.tile);
2007
+ el.appendChild(art.tile);
2008
+
2009
+ const scanText = markdownList
2010
+ .map((md) =>
2011
+ md.replace(/(`{3,4}|~{3,4})(html|raw)[^\n]*\n[\s\S]*?\n\1/g, " ")
2012
+ )
2013
+ .join("\n");
2014
+ const seen = new Set(
2015
+ dashboards.map((d) =>
2016
+ d.local ? `local:${d.project}` : `space:${spaceIdFromUrl(d.url)}`
2017
+ )
2018
+ );
2019
+ const remoteSpaces = new Map();
2020
+ extractUrls(scanText).forEach((url) => {
2021
+ const item = classifyResource(url);
2022
+ if (item && item.kind === "space" && !item.local) {
2023
+ remoteSpaces.set(item.url, item);
2024
+ }
2025
+ });
2026
+ remoteSpaces.forEach((s) => {
2027
+ const key = `space:${s.id}`;
2028
+ if (seen.has(key)) return;
2029
+ getJSON(`https://huggingface.co/api/spaces/${s.id}`)
2030
+ .then((d) => {
2031
+ if (STATS_TOKEN !== token) return;
2032
+ const tags = (d && d.tags) || [];
2033
+ if (
2034
+ !seen.has(key) &&
2035
+ tags.some((t) => String(t).toLowerCase() === "trackio")
2036
+ ) {
2037
+ seen.add(key);
2038
+ dashboards.push({
2039
+ project: s.id,
2040
+ local: false,
2041
+ url: s.url,
2042
+ resUrl: s.url,
2043
+ });
2044
+ dashboards.sort((a, b) => a.project.localeCompare(b.project));
2045
+ dash.render(dashboards);
2046
+ }
2047
+ })
2048
+ .catch(() => {});
2049
+ });
2050
+ return el;
2051
+ }
2052
+
2053
+ function buildAgentHint() {
2054
+ const onSpaces =
2055
+ /\.hf\.space$/.test(location.hostname) ||
2056
+ /(^|\.)huggingface\.co$/.test(location.hostname);
2057
+ let source = "";
2058
+ if (onSpaces && MANIFEST.space_id) {
2059
+ source = ` ${MANIFEST.space_id}`;
2060
+ } else if (/^https?:$/.test(location.protocol)) {
2061
+ source = ` ${location.origin}/`;
2062
+ }
2063
+ const command = `trackio logbook read${source}`;
2064
+ const tokens = MANIFEST.agent_view_tokens;
2065
+ const div = document.createElement("div");
2066
+ div.className = "agent-hint";
2067
+ const label = document.createElement("span");
2068
+ label.className = "agent-hint-label";
2069
+ label.textContent = "Read from the CLI:";
2070
+ const code = document.createElement("code");
2071
+ code.textContent = command;
2072
+ const copy = document.createElement("button");
2073
+ copy.className = "copy";
2074
+ copy.type = "button";
2075
+ copy.title = "Copy";
2076
+ copy.textContent = "⧉";
2077
+ copy.addEventListener("click", () => copyText(command, copy, "⧉"));
2078
+ const note = document.createElement("span");
2079
+ note.className = "agent-hint-note";
2080
+ note.textContent =
2081
+ "compact view for agents" + (tokens ? ` · ~${fmt(tokens)} tokens` : "");
2082
+ div.appendChild(label);
2083
+ div.appendChild(code);
2084
+ div.appendChild(copy);
2085
+ div.appendChild(note);
2086
+ return div;
2087
+ }
2088
+
2089
+ function currentSlug() {
2090
+ const slug = (location.hash || "").replace(/^#\//, "") || MANIFEST.root.slug;
2091
+ return findNode(MANIFEST.root, slug) ? slug : MANIFEST.root.slug;
2092
+ }
2093
+
2094
+ function scrollToHash(opts = {}) {
2095
+ const slug = currentSlug();
2096
+ if (!location.hash) {
2097
+ window.scrollTo({ top: 0, behavior: opts.behavior || "auto" });
2098
+ highlight(slug);
2099
+ return;
2100
+ }
2101
+ const section = document.getElementById("/" + slug);
2102
+ if (section) section.scrollIntoView({ behavior: opts.behavior || "smooth" });
2103
+ highlight(slug);
2104
+ }
2105
+
2106
+ function navigateToLogbookSlug(target) {
2107
+ const slug = String(target || "").replace(/^#?\//, "").trim();
2108
+ if (!slug || !findNode(MANIFEST.root, slug)) return;
2109
+ const hash = "#/" + slug;
2110
+ if (location.hash === hash) {
2111
+ scrollToHash({ behavior: "smooth" });
2112
+ } else {
2113
+ location.hash = hash;
2114
+ }
2115
+ }
2116
+
2117
+ function setupFigureNavigation() {
2118
+ window.addEventListener("message", (event) => {
2119
+ const data = event.data;
2120
+ if (!data || data.type !== "trackio-logbook:navigate") return;
2121
+ // Only accept messages from one of this logbook's sandboxed figure
2122
+ // iframes, rather than from an arbitrary same-origin page.
2123
+ const isFigureFrame = Array.from(
2124
+ document.querySelectorAll("iframe.figure-frame")
2125
+ ).some((frame) => frame.contentWindow === event.source);
2126
+ if (!isFigureFrame) return;
2127
+ navigateToLogbookSlug(data.target);
2128
+ });
2129
+ }
2130
+
2131
+ let SCROLL_FRAME = 0;
2132
+ function updateActiveSection() {
2133
+ cancelAnimationFrame(SCROLL_FRAME);
2134
+ SCROLL_FRAME = requestAnimationFrame(() => {
2135
+ const sections = Array.from(document.querySelectorAll(".page-section"));
2136
+ if (!sections.length) return;
2137
+ const marker = Math.min(window.innerHeight * 0.28, 180);
2138
+ let active = sections[0];
2139
+ sections.forEach((section) => {
2140
+ if (section.getBoundingClientRect().top <= marker) active = section;
2141
+ });
2142
+ if (
2143
+ window.innerHeight + window.scrollY >=
2144
+ document.documentElement.scrollHeight - 2
2145
+ ) {
2146
+ active = sections[sections.length - 1];
2147
+ }
2148
+ highlight(active.dataset.slug);
2149
+ });
2150
+ }
2151
+
2152
+ function startLiveReload() {
2153
+ if (!isLocalPreview()) return;
2154
+ setInterval(async () => {
2155
+ try {
2156
+ const next = await fetchManifest();
2157
+ if (!next || next.revision === MANIFEST.revision) return;
2158
+ MANIFEST = next;
2159
+ clearPageCache();
2160
+ document.title = MANIFEST.title + " · Trackio Logbook";
2161
+ document.getElementById("book-title").textContent = MANIFEST.title;
2162
+ document.getElementById("book-head").setAttribute("aria-label", MANIFEST.title);
2163
+ buildTree();
2164
+ renderLogbook({ preserveScroll: true });
2165
+ } catch (e) {}
2166
+ }, LIVE_RELOAD_MS);
2167
+ }
2168
+
2169
+ function setupConnect() {
2170
+ const space = MANIFEST.space_id;
2171
+ if (!space) return;
2172
+ const steps = [
2173
+ { t: "Install Trackio, if you don't have it yet.", c: "uv tool install trackio" },
2174
+ { t: "Add the Trackio skill for your agent, then reload it.", c: "trackio skills add" },
2175
+ { t: "Connect to this logbook.", c: `trackio logbook open ${space}` },
2176
+ ];
2177
+ const ol = document.getElementById("connect-steps");
2178
+ steps.forEach((s, i) => {
2179
+ const li = document.createElement("li");
2180
+ const title = document.createElement("div");
2181
+ title.className = "step-title";
2182
+ title.textContent = `${i + 1}. ${s.t}`;
2183
+ const block = document.createElement("div");
2184
+ block.className = "codeblock";
2185
+ const code = document.createElement("code");
2186
+ code.textContent = s.c;
2187
+ const copy = document.createElement("button");
2188
+ copy.className = "copy";
2189
+ copy.type = "button";
2190
+ copy.title = "Copy";
2191
+ copy.textContent = "⧉";
2192
+ copy.addEventListener("click", () => copyText(s.c, copy, "⧉"));
2193
+ block.appendChild(code);
2194
+ block.appendChild(copy);
2195
+ li.appendChild(title);
2196
+ li.appendChild(block);
2197
+ ol.appendChild(li);
2198
+ });
2199
+
2200
+ const agentPrompt =
2201
+ `Read and help maintain this Trackio experiment logbook ("${MANIFEST.title}").\n\n` +
2202
+ "1. If you don't have Trackio, install it: uv tool install trackio\n" +
2203
+ "2. Add the Trackio skill for your agent: trackio skills add (then reload)\n" +
2204
+ `3. Connect to this logbook: trackio logbook open ${space}\n\n` +
2205
+ "Start with `trackio logbook read`; use `trackio logbook read page \"...\"` " +
2206
+ "for a page-level view, then fetch relevant details with " +
2207
+ "`trackio logbook read cell cell_<id>`. If I've given you " +
2208
+ 'write access to the Space, add findings with `trackio logbook cell markdown "..." ' +
2209
+ '--page "..."` and they will sync back automatically.';
2210
+
2211
+ const foot = document.getElementById("sidebar-foot");
2212
+ foot.hidden = false;
2213
+ const modal = document.getElementById("modal");
2214
+ const open = () => (modal.hidden = false);
2215
+ const close = () => (modal.hidden = true);
2216
+ document.getElementById("connect-btn").addEventListener("click", open);
2217
+ document.getElementById("modal-close").addEventListener("click", close);
2218
+ modal.querySelector(".modal-backdrop").addEventListener("click", close);
2219
+ document.addEventListener("keydown", (e) => {
2220
+ if (e.key === "Escape") close();
2221
+ });
2222
+ const agentBtn = document.getElementById("copy-agent");
2223
+ agentBtn.addEventListener("click", () =>
2224
+ copyText(agentPrompt, agentBtn, "Copy for agent")
2225
+ );
2226
+ }
2227
+
2228
+ function copyText(text, btn, restore) {
2229
+ const done = () => {
2230
+ const prev = btn.textContent;
2231
+ btn.textContent = restore === "⧉" ? "✓" : "Copied!";
2232
+ btn.classList.add("copied");
2233
+ setTimeout(() => {
2234
+ btn.textContent = restore;
2235
+ btn.classList.remove("copied");
2236
+ }, 1400);
2237
+ void prev;
2238
+ };
2239
+ if (navigator.clipboard && navigator.clipboard.writeText) {
2240
+ navigator.clipboard.writeText(text).then(done, done);
2241
+ } else {
2242
+ const ta = document.createElement("textarea");
2243
+ ta.value = text;
2244
+ document.body.appendChild(ta);
2245
+ ta.select();
2246
+ try {
2247
+ document.execCommand("copy");
2248
+ } catch (e) {}
2249
+ document.body.removeChild(ta);
2250
+ done();
2251
+ }
2252
+ }
2253
+
2254
+ async function init() {
2255
+ MANIFEST = await fetchManifest();
2256
+ document.title = MANIFEST.title + " · Trackio Logbook";
2257
+ document.getElementById("book-title").textContent = MANIFEST.title;
2258
+ document.getElementById("book-head").setAttribute("aria-label", MANIFEST.title);
2259
+ document.getElementById("book-head").addEventListener("click", () => {
2260
+ const target = "#/" + MANIFEST.root.slug;
2261
+ if (location.hash === target) scrollToHash();
2262
+ else location.hash = target;
2263
+ });
2264
+ buildTree();
2265
+ setupConnect();
2266
+ setupResourceHover();
2267
+ setupFigureNavigation();
2268
+ window.addEventListener("hashchange", () => scrollToHash());
2269
+ window.addEventListener("scroll", updateActiveSection, { passive: true });
2270
+ await renderLogbook();
2271
+ startLiveReload();
2272
+ }
2273
+
2274
+ init();
2275
+ })();
logbook.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": 1,
3
+ "title": "Reproduction: Networked Information Aggregation for Binary Classification",
4
+ "emoji": "🎯",
5
+ "space_id": "ProCreations/repro-networked-information-aggregation-for-binary-classification",
6
+ "paper": {
7
+ "arxiv_id": "2605.01082"
8
+ },
9
+ "tags": [
10
+ "icml2026-repro",
11
+ "paper-mrtg4NmvAe"
12
+ ],
13
+ "updated_at": "2026-07-22T10:28:07+00:00",
14
+ "root": {
15
+ "slug": "index",
16
+ "title": "Reproduction: Networked Information Aggregation for Binary Classification",
17
+ "file": "pages/index.md",
18
+ "children": [
19
+ {
20
+ "slug": "executive-summary",
21
+ "title": "Executive summary",
22
+ "file": "pages/executive-summary/page.md",
23
+ "children": []
24
+ },
25
+ {
26
+ "slug": "claim-1-depth-upper-bound",
27
+ "title": "Claim 1: Depth upper bound",
28
+ "file": "pages/claim-1-depth-upper-bound/page.md",
29
+ "children": []
30
+ },
31
+ {
32
+ "slug": "claim-2-depth-lower-bound",
33
+ "title": "Claim 2: Depth lower bound",
34
+ "file": "pages/claim-2-depth-lower-bound/page.md",
35
+ "children": []
36
+ },
37
+ {
38
+ "slug": "claim-3-residual-orthogonality",
39
+ "title": "Claim 3: Residual orthogonality",
40
+ "file": "pages/claim-3-residual-orthogonality/page.md",
41
+ "children": []
42
+ },
43
+ {
44
+ "slug": "claim-4-bce-kl-decomposition",
45
+ "title": "Claim 4: BCE/KL decomposition",
46
+ "file": "pages/claim-4-bce-kl-decomposition/page.md",
47
+ "children": []
48
+ },
49
+ {
50
+ "slug": "claim-5-logit-passing-protocol",
51
+ "title": "Claim 5: Logit-passing protocol",
52
+ "file": "pages/claim-5-logit-passing-protocol/page.md",
53
+ "children": []
54
+ },
55
+ {
56
+ "slug": "conclusion",
57
+ "title": "Conclusion",
58
+ "file": "pages/conclusion/page.md",
59
+ "children": []
60
+ }
61
+ ]
62
+ },
63
+ "agent_view_tokens": 1400,
64
+ "revision": "1784716087001863000"
65
+ }
official_claims.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [
2
+ "Theorem 3.7 proves an upper bound on excess risk of B_p* * B_X * M/sqrt(D) under an M-coverage condition on depth-D DAGs, extending networked information aggregation from squared loss to Binary Cross-Entropy-based binary classification (Theorem 3.7).",
3
+ "Theorem 4.5 proves a matching lower bound showing instances with excess loss of at least Omega(k/D), where k is feature dimension and D is path depth, establishing network depth as a necessary bottleneck (Theorem 4.5).",
4
+ "Lemma 3.1 establishes an orthogonality property of Binary Cross-Entropy residuals, E[x(p*(x)-y)] = 0, replacing the variance-decomposition tools used in prior squared-loss analyses (Lemma 3.1).",
5
+ "Lemma 3.3 provides a KL/Bregman-type loss decomposition L(q) = L(p*) + D(p*||q), used with Pinsker-style bounds to connect BCE progress to prediction error (Lemma 3.3).",
6
+ "The protocol models a sequential DAG in which each agent observes only a subset of features, receives parent logits (not probabilities), and locally minimizes Binary Cross-Entropy before passing its own logits downstream (Section 2)."
7
+ ]
outputs/depth_formula_audit.csv ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ B_p_star,B_X,M,D,upper_bound,D_times_four_bound_ratio
2
+ 0.5,0.5,2,4,0.25,0.5
3
+ 0.5,0.5,2,16,0.125,0.5
4
+ 0.5,0.5,2,64,0.0625,0.5
5
+ 0.5,0.5,2,256,0.03125,0.5
6
+ 0.5,0.5,4,16,0.25,0.5
7
+ 0.5,0.5,4,64,0.125,0.5
8
+ 0.5,0.5,4,256,0.0625,0.5
9
+ 0.5,0.5,4,1024,0.03125,0.5
10
+ 0.5,0.5,8,64,0.25,0.5
11
+ 0.5,0.5,8,256,0.125,0.5
12
+ 0.5,0.5,8,1024,0.0625,0.5
13
+ 0.5,0.5,8,4096,0.03125,0.5
14
+ 0.5,1.5,2,4,0.75,0.5
15
+ 0.5,1.5,2,16,0.375,0.5
16
+ 0.5,1.5,2,64,0.1875,0.5
17
+ 0.5,1.5,2,256,0.09375,0.5
18
+ 0.5,1.5,4,16,0.75,0.5
19
+ 0.5,1.5,4,64,0.375,0.5
20
+ 0.5,1.5,4,256,0.1875,0.5
21
+ 0.5,1.5,4,1024,0.09375,0.5
22
+ 0.5,1.5,8,64,0.75,0.5
23
+ 0.5,1.5,8,256,0.375,0.5
24
+ 0.5,1.5,8,1024,0.1875,0.5
25
+ 0.5,1.5,8,4096,0.09375,0.5
26
+ 1.0,0.5,2,4,0.5,0.5
27
+ 1.0,0.5,2,16,0.25,0.5
28
+ 1.0,0.5,2,64,0.125,0.5
29
+ 1.0,0.5,2,256,0.0625,0.5
30
+ 1.0,0.5,4,16,0.5,0.5
31
+ 1.0,0.5,4,64,0.25,0.5
32
+ 1.0,0.5,4,256,0.125,0.5
33
+ 1.0,0.5,4,1024,0.0625,0.5
34
+ 1.0,0.5,8,64,0.5,0.5
35
+ 1.0,0.5,8,256,0.25,0.5
36
+ 1.0,0.5,8,1024,0.125,0.5
37
+ 1.0,0.5,8,4096,0.0625,0.5
38
+ 1.0,1.5,2,4,1.5,0.5
39
+ 1.0,1.5,2,16,0.75,0.5
40
+ 1.0,1.5,2,64,0.375,0.5
41
+ 1.0,1.5,2,256,0.1875,0.5
42
+ 1.0,1.5,4,16,1.5,0.5
43
+ 1.0,1.5,4,64,0.75,0.5
44
+ 1.0,1.5,4,256,0.375,0.5
45
+ 1.0,1.5,4,1024,0.1875,0.5
46
+ 1.0,1.5,8,64,1.5,0.5
47
+ 1.0,1.5,8,256,0.75,0.5
48
+ 1.0,1.5,8,1024,0.375,0.5
49
+ 1.0,1.5,8,4096,0.1875,0.5
50
+ 2.0,0.5,2,4,1.0,0.5
51
+ 2.0,0.5,2,16,0.5,0.5
52
+ 2.0,0.5,2,64,0.25,0.5
53
+ 2.0,0.5,2,256,0.125,0.5
54
+ 2.0,0.5,4,16,1.0,0.5
55
+ 2.0,0.5,4,64,0.5,0.5
56
+ 2.0,0.5,4,256,0.25,0.5
57
+ 2.0,0.5,4,1024,0.125,0.5
58
+ 2.0,0.5,8,64,1.0,0.5
59
+ 2.0,0.5,8,256,0.5,0.5
60
+ 2.0,0.5,8,1024,0.25,0.5
61
+ 2.0,0.5,8,4096,0.125,0.5
62
+ 2.0,1.5,2,4,3.0,0.5
63
+ 2.0,1.5,2,16,1.5,0.5
64
+ 2.0,1.5,2,64,0.75,0.5
65
+ 2.0,1.5,2,256,0.375,0.5
66
+ 2.0,1.5,4,16,3.0,0.5
67
+ 2.0,1.5,4,64,1.5,0.5
68
+ 2.0,1.5,4,256,0.75,0.5
69
+ 2.0,1.5,4,1024,0.375,0.5
70
+ 2.0,1.5,8,64,3.0,0.5
71
+ 2.0,1.5,8,256,1.5,0.5
72
+ 2.0,1.5,8,1024,0.75,0.5
73
+ 2.0,1.5,8,4096,0.375,0.5
outputs/gaussian_lower_bound_audit.csv ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ k,passes_p,D,optimal_coefficient_c,excess_bce,k_over_D,scaled_excess_D_over_k,zero_noise_control_excess,coefficient_in_open_unit_interval
2
+ 4,1,4,0.452001306649,0.049078635566,1.0,0.049078635566,0.0,True
3
+ 4,2,8,0.622369338629,0.033261836901,0.5,0.066523673802,0.0,True
4
+ 4,3,12,0.711885741399,0.025157840993,0.333333333333,0.075473522978,0.0,True
5
+ 8,1,8,0.452001306649,0.049078635566,1.0,0.049078635566,0.0,True
6
+ 8,2,16,0.622369338629,0.033261836901,0.5,0.066523673802,0.0,True
7
+ 8,3,24,0.711885741399,0.025157840993,0.333333333333,0.075473522978,0.0,True
8
+ 8,4,32,0.767082976873,0.020229940119,0.25,0.080919760476,0.0,True
9
+ 8,5,40,0.804526570071,0.016916655917,0.2,0.084583279584,0.0,True
10
+ 8,6,48,0.831596672169,0.014536064145,0.166666666667,0.087216384871,0.0,True
11
+ 8,7,56,0.852080201043,0.012742892325,0.142857142857,0.089200246272,0.0,True
12
+ 16,1,16,0.452001306649,0.049078635566,1.0,0.049078635566,0.0,True
13
+ 16,2,32,0.622369338629,0.033261836901,0.5,0.066523673802,0.0,True
14
+ 16,3,48,0.711885741399,0.025157840993,0.333333333333,0.075473522978,0.0,True
15
+ 16,4,64,0.767082976873,0.020229940119,0.25,0.080919760476,0.0,True
16
+ 16,5,80,0.804526570071,0.016916655917,0.2,0.084583279584,0.0,True
17
+ 16,6,96,0.831596672169,0.014536064145,0.166666666667,0.087216384871,0.0,True
18
+ 16,7,112,0.852080201043,0.012742892325,0.142857142857,0.089200246272,0.0,True
19
+ 16,8,128,0.868120595068,0.011343581712,0.125,0.090748653698,0.0,True
20
+ 16,9,144,0.881022187615,0.010221201075,0.111111111111,0.091990809671,0.0,True
21
+ 16,10,160,0.891624244283,0.009300940043,0.1,0.093009400432,0.0,True
22
+ 16,11,176,0.90049128941,0.008532709285,0.090909090909,0.093859802136,0.0,True
23
+ 16,12,192,0.908017031089,0.007881708039,0.083333333333,0.094580496464,0.0,True
24
+ 16,13,208,0.914484428413,0.007323004392,0.076923076923,0.095199057091,0.0,True
25
+ 16,14,224,0.920102076166,0.006838268501,0.071428571429,0.095735759013,0.0,True
26
+ 16,15,240,0.925027129125,0.00641372291,0.066666666667,0.096205843647,0.0,True
27
+ 32,1,32,0.452001306649,0.049078635566,1.0,0.049078635566,0.0,True
28
+ 32,2,64,0.622369338629,0.033261836901,0.5,0.066523673802,0.0,True
29
+ 32,3,96,0.711885741399,0.025157840993,0.333333333333,0.075473522978,0.0,True
30
+ 32,4,128,0.767082976873,0.020229940119,0.25,0.080919760476,0.0,True
31
+ 32,5,160,0.804526570071,0.016916655917,0.2,0.084583279584,0.0,True
32
+ 32,6,192,0.831596672169,0.014536064145,0.166666666667,0.087216384871,0.0,True
33
+ 32,7,224,0.852080201043,0.012742892325,0.142857142857,0.089200246272,0.0,True
34
+ 32,8,256,0.868120595068,0.011343581712,0.125,0.090748653698,0.0,True
35
+ 32,9,288,0.881022187615,0.010221201075,0.111111111111,0.091990809671,0.0,True
36
+ 32,10,320,0.891624244283,0.009300940043,0.1,0.093009400432,0.0,True
37
+ 32,11,352,0.90049128941,0.008532709285,0.090909090909,0.093859802136,0.0,True
38
+ 32,12,384,0.908017031089,0.007881708039,0.083333333333,0.094580496464,0.0,True
39
+ 32,13,416,0.914484428413,0.007323004392,0.076923076923,0.095199057091,0.0,True
40
+ 32,14,448,0.920102076166,0.006838268501,0.071428571429,0.095735759013,0.0,True
41
+ 32,15,480,0.925027129125,0.00641372291,0.066666666667,0.096205843647,0.0,True
42
+ 32,16,512,0.929380238317,0.006038811854,0.0625,0.096620989667,0.0,True
43
+ 32,17,544,0.933255568448,0.005705311562,0.058823529412,0.096990296549,0.0,True
44
+ 32,18,576,0.936727688079,0.005406719964,0.055555555556,0.097320959347,0.0,True
45
+ 32,19,608,0.939856415222,0.005137828534,0.052631578947,0.097618742145,0.0,True
46
+ 32,20,640,0.942690292843,0.004894415848,0.05,0.097888316958,0.0,True
47
+ 32,21,672,0.945269125894,0.004673024317,0.047619047619,0.098133510667,0.0,True
48
+ 32,22,704,0.947625862799,0.004470794903,0.045454545455,0.098357487857,0.0,True
49
+ 32,23,736,0.949788010849,0.004285342963,0.04347826087,0.098562888146,0.0,True
50
+ 32,24,768,0.951778714879,0.00411466378,0.041666666667,0.098751930715,0.0,True
51
+ 32,25,800,0.953617589118,0.003957059792,0.04,0.098926494804,0.0,True
52
+ 32,26,832,0.955321365682,0.003811083939,0.038461538462,0.099088182411,0.0,True
53
+ 32,27,864,0.956904405197,0.003675495096,0.037037037037,0.099238367596,0.0,True
54
+ 32,28,896,0.95837910257,0.003549222701,0.035714285714,0.099378235629,0.0,True
55
+ 32,29,928,0.959756212207,0.003431338426,0.034482758621,0.09950881434,0.0,True
56
+ 32,30,960,0.961045110731,0.003321033314,0.033333333333,0.099630999417,0.0,True
57
+ 32,31,992,0.962254010773,0.003217599193,0.032258064516,0.099745574981,0.0,True
outputs/network_protocol_audit.csv ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dimension,trial,D,M,M_coverage,B_p_star,B_X,theorem_upper_bound,logit_final_excess_bce,probability_control_excess_bce,all_logit_losses_nonincreasing,upper_bound_certificate,probability_control_worse
2
+ 3,0,3,3,True,1.091460616837,1.0,1.890465242823,5.26e-10,7.2951e-08,True,True,True
3
+ 3,0,6,3,True,1.091460616837,1.0,1.336760792797,3e-12,0.000341074969,True,True,True
4
+ 3,0,12,3,True,1.091460616837,1.0,0.945232621411,0.0,0.001660024026,True,True,True
5
+ 3,0,24,3,True,1.091460616837,1.0,0.668380396399,0.0,0.00232631364,True,True,True
6
+ 3,1,3,3,True,1.829920095331,1.0,3.169514578905,5.96764e-07,1.5892294e-05,True,True,True
7
+ 3,1,6,3,True,1.829920095331,1.0,2.241185251813,3.889e-09,0.003702241885,True,True,True
8
+ 3,1,12,3,True,1.829920095331,1.0,1.584757289452,0.0,0.00798032755,True,True,True
9
+ 3,1,24,3,True,1.829920095331,1.0,1.120592625907,0.0,0.008256585251,True,True,True
10
+ 3,2,3,3,True,1.823094348708,1.0,3.157692038954,4.95634e-07,2.9569555e-05,True,True,True
11
+ 3,2,6,3,True,1.823094348708,1.0,2.232825453643,4.229e-09,0.003911454119,True,True,True
12
+ 3,2,12,3,True,1.823094348708,1.0,1.578846019477,0.0,0.00818085715,True,True,True
13
+ 3,2,24,3,True,1.823094348708,1.0,1.116412726821,-0.0,0.00842462407,True,True,True
14
+ 3,3,3,3,True,1.557006316775,1.0,2.696814048359,7.225e-09,1.13947e-07,True,True,True
15
+ 3,3,6,3,True,1.557006316775,1.0,1.906935501194,3e-11,0.001688292841,True,True,True
16
+ 3,3,12,3,True,1.557006316775,1.0,1.34840702418,0.0,0.004726584127,True,True,True
17
+ 3,3,24,3,True,1.557006316775,1.0,0.953467750597,0.0,0.005092186189,True,True,True
18
+ 4,0,4,4,True,1.640918196777,1.0,3.281836393554,5.6234e-08,5.4057222e-05,True,True,True
19
+ 4,0,8,4,True,1.640918196777,1.0,2.320608768627,3.98e-10,0.002351889291,True,True,True
20
+ 4,0,16,4,True,1.640918196777,1.0,1.640918196777,0.0,0.005586105956,True,True,True
21
+ 4,0,32,4,True,1.640918196777,1.0,1.160304384313,0.0,0.00612815868,True,True,True
22
+ 4,1,4,4,True,1.847447387351,1.0,3.694894774703,6.077e-08,8.593969e-05,True,True,True
23
+ 4,1,8,4,True,1.847447387351,1.0,2.612685150963,4.74e-10,0.003880201214,True,True,True
24
+ 4,1,16,4,True,1.847447387351,1.0,1.847447387351,0.0,0.007786960967,True,True,True
25
+ 4,1,32,4,True,1.847447387351,1.0,1.306342575482,-0.0,0.008377402037,True,True,True
26
+ 4,2,4,4,True,2.112896501672,1.0,4.225793003344,1.6385e-08,0.000539786466,True,True,True
27
+ 4,2,8,4,True,2.112896501672,1.0,2.988086888555,9.3e-11,0.00686662151,True,True,True
28
+ 4,2,16,4,True,2.112896501672,1.0,2.112896501672,0.0,0.01045679728,True,True,True
29
+ 4,2,32,4,True,2.112896501672,1.0,1.494043444277,0.0,0.010657526658,True,True,True
30
+ 4,3,4,4,True,1.670857371186,1.0,3.341714742372,4.442e-09,0.00021303184,True,True,True
31
+ 4,3,8,4,True,1.670857371186,1.0,2.362949155122,1.5e-11,0.003423698247,True,True,True
32
+ 4,3,16,4,True,1.670857371186,1.0,1.670857371186,0.0,0.006769257264,True,True,True
33
+ 4,3,32,4,True,1.670857371186,1.0,1.181474577561,0.0,0.007137793931,True,True,True
34
+ 5,0,5,5,True,3.114374171952,1.0,6.963952355853,2.8756e-07,0.001384474922,True,True,True
35
+ 5,0,10,5,True,3.114374171952,1.0,4.924257934684,2.282e-09,0.014557023823,True,True,True
36
+ 5,0,20,5,True,3.114374171952,1.0,3.481976177927,0.0,0.020981078283,True,True,True
37
+ 5,0,40,5,True,3.114374171952,1.0,2.462128967342,0.0,0.021473439098,True,True,True
38
+ 5,1,5,5,True,2.045531556852,1.0,4.573947611242,1.15401e-07,0.000362650185,True,True,True
39
+ 5,1,10,5,True,2.045531556852,1.0,3.234269372701,9.28e-10,0.005443489233,True,True,True
40
+ 5,1,20,5,True,2.045531556852,1.0,2.286973805621,0.0,0.010457249607,True,True,True
41
+ 5,1,40,5,True,2.045531556852,1.0,1.617134686351,0.0,0.011420451294,True,True,True
42
+ 5,2,5,5,True,2.455590106114,1.0,5.490866402146,1.1162e-08,0.00072522127,True,True,True
43
+ 5,2,10,5,True,2.455590106114,1.0,3.882628867547,1.34e-10,0.009158279431,True,True,True
44
+ 5,2,20,5,True,2.455590106114,1.0,2.745433201073,0.0,0.014243461527,True,True,True
45
+ 5,2,40,5,True,2.455590106114,1.0,1.941314433773,0.0,0.014496013881,True,True,True
46
+ 5,3,5,5,True,2.323175338576,1.0,5.194777980708,1.70576e-07,0.000606720343,True,True,True
47
+ 5,3,10,5,True,2.323175338576,1.0,3.673262736917,1.207e-09,0.006959411103,True,True,True
48
+ 5,3,20,5,True,2.323175338576,1.0,2.597388990354,0.0,0.013097454948,True,True,True
49
+ 5,3,40,5,True,2.323175338576,1.0,1.836631368458,0.0,0.014732879402,True,True,True
outputs/networked_information_audit.png ADDED
outputs/orthogonality_decomposition_audit.csv ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,dimension,used_features,support_points,maximum_orthogonality_residual,loss_star,loss_q,kl_pstar_q,decomposition_gap,pinsker_rhs,pinsker_certificate,nonoptimal_reference_control_gap
2
+ 0,3,2,8,0.0,0.686473298406,0.783695922155,0.09722262375,-0.0,0.078553220216,True,0.043499052401
3
+ 1,4,3,16,0.0,0.598417320382,0.645270541438,0.046853221056,-0.0,0.037869368551,True,0.012030249774
4
+ 2,5,4,32,0.0,0.65719040498,0.732528348289,0.075337943309,-0.0,0.050318641751,True,0.030823019361
5
+ 3,6,5,64,0.0,0.642820613088,0.751737913087,0.108917299999,0.0,0.089207272944,True,0.02994685481
6
+ 4,3,2,8,0.0,0.666305076982,0.785501514963,0.11919643798,0.0,0.103716252989,True,0.039576315056
7
+ 5,4,4,16,0.0,0.572899722887,0.670614857037,0.09771513415,-0.0,0.085777279588,True,0.028243904413
8
+ 6,5,4,32,0.0,0.628625482902,0.698615804061,0.069990321159,-0.0,0.04965387929,True,0.022381623143
9
+ 7,6,4,64,0.0,0.545986204592,0.565500817676,0.019514613084,-0.0,0.015842513809,True,-0.00260924578
10
+ 8,3,2,8,0.0,0.620964234687,0.649458834726,0.028494600039,0.0,0.018734196272,True,0.010040348448
11
+ 9,4,2,16,0.0,0.655565825095,0.666111830149,0.010546005054,-0.0,0.010155075049,True,-0.00514674705
12
+ 10,5,4,32,0.0,0.584812151693,0.614510101767,0.029697950074,-0.0,0.024764631512,True,-0.003567374242
13
+ 11,6,3,64,0.0,0.66200766098,0.698189146123,0.036181485143,-0.0,0.031915339102,True,0.000971076055
14
+ 12,3,2,8,0.0,0.602723978336,0.721271512227,0.118547533891,0.0,0.066592620766,True,0.051776915525
15
+ 13,4,3,16,0.0,0.65107027566,0.673356766475,0.022286490815,-0.0,0.019903551755,True,0.003404751896
16
+ 14,5,4,32,0.0,0.525472849344,0.551553308477,0.026080459133,-0.0,0.021018260354,True,0.0032901328
17
+ 15,6,2,64,0.0,0.668516307378,0.671535464329,0.003019156951,0.0,0.002597076841,True,-0.012991449925
18
+ 16,3,2,8,0.0,0.637714405232,0.678704225479,0.040989820247,-0.0,0.031358671887,True,0.015777164811
19
+ 17,4,4,16,0.0,0.633729576273,0.642950329009,0.009220752736,-0.0,0.008175981856,True,-0.019199584657
20
+ 18,5,4,32,0.0,0.673727994983,0.876445857306,0.202717862323,0.0,0.136648306688,True,0.072911731861
21
+ 19,6,6,64,0.0,0.504767024972,0.565232093929,0.060465068957,0.0,0.047165181757,True,0.013421062862
22
+ 20,3,2,8,0.0,0.664723092217,0.713317519622,0.048594427405,0.0,0.038634049595,True,0.010233294903
23
+ 21,4,2,16,0.0,0.619462297857,0.62298409835,0.003521800494,0.0,0.003279155634,True,-0.024450730295
24
+ 22,5,4,32,0.0,0.632812381238,0.652679684102,0.019867302864,0.0,0.019213874869,True,-0.01243895153
25
+ 23,6,5,64,0.0,0.630455413033,0.65939460964,0.028939196608,0.0,0.02272574564,True,-0.005756255758
outputs/results.json ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "claims": [
3
+ "Theorem 3.7 proves an upper bound on excess risk of B_p* * B_X * M/sqrt(D) under an M-coverage condition on depth-D DAGs, extending networked information aggregation from squared loss to Binary Cross-Entropy-based binary classification (Theorem 3.7).",
4
+ "Theorem 4.5 proves a matching lower bound showing instances with excess loss of at least Omega(k/D), where k is feature dimension and D is path depth, establishing network depth as a necessary bottleneck (Theorem 4.5).",
5
+ "Lemma 3.1 establishes an orthogonality property of Binary Cross-Entropy residuals, E[x(p*(x)-y)] = 0, replacing the variance-decomposition tools used in prior squared-loss analyses (Lemma 3.1).",
6
+ "Lemma 3.3 provides a KL/Bregman-type loss decomposition L(q) = L(p*) + D(p*||q), used with Pinsker-style bounds to connect BCE progress to prediction error (Lemma 3.3).",
7
+ "The protocol models a sequential DAG in which each agent observes only a subset of features, receives parent logits (not probabilities), and locally minimizes Binary Cross-Entropy before passing its own logits downstream (Section 2)."
8
+ ],
9
+ "formula_summary": {
10
+ "all_positive": true,
11
+ "cells": 72,
12
+ "depth_exponent_minus_one_half": true
13
+ },
14
+ "gates": {
15
+ "all_logit_losses_nonincreasing": true,
16
+ "all_m_coverage": true,
17
+ "all_pinsker_certificates": true,
18
+ "all_upper_bound_certificates": true,
19
+ "bce_kl_decomposition_exact": true,
20
+ "five_exact_claims_present": true,
21
+ "formula_bounds_positive": true,
22
+ "formula_panel_complete": true,
23
+ "lower_bound_coefficients_valid": true,
24
+ "lower_bound_excess_positive": true,
25
+ "lower_bound_panel_complete": true,
26
+ "lower_bound_scaled_constant_positive": true,
27
+ "nonoptimal_reference_control_fails": true,
28
+ "orthogonality_panel_complete": true,
29
+ "orthogonality_residual_small": true,
30
+ "positive_probability_control_gap": true,
31
+ "probability_passing_control_worse": true,
32
+ "protocol_panel_complete": true,
33
+ "source_archive_pin": true,
34
+ "source_pdf_pin": true,
35
+ "source_scope_rows_complete": true,
36
+ "upper_depth_exponent_minus_one_half": true
37
+ },
38
+ "lower_bound_summary": {
39
+ "all_coefficients_in_open_unit_interval": true,
40
+ "all_excess_positive": true,
41
+ "cells": 56,
42
+ "maximum_scaled_excess_D_over_k": 0.099745574981,
43
+ "minimum_scaled_excess_D_over_k": 0.049078635566
44
+ },
45
+ "orthogonality_summary": {
46
+ "all_pinsker_certificates": true,
47
+ "cells": 24,
48
+ "maximum_absolute_decomposition_gap": 0.0,
49
+ "maximum_orthogonality_residual": 0.0,
50
+ "nonoptimal_reference_counterexamples": 24
51
+ },
52
+ "paper": {
53
+ "arxiv": "2605.01082v1",
54
+ "openreview_id": "mrtg4NmvAe",
55
+ "title": "Networked Information Aggregation for Binary Classification"
56
+ },
57
+ "passed": true,
58
+ "protocol_summary": {
59
+ "all_logit_losses_nonincreasing": true,
60
+ "all_m_coverage": true,
61
+ "all_upper_bound_certificates": true,
62
+ "cells": 48,
63
+ "mean_probability_control_excess_gap": 0.00618226885,
64
+ "probability_control_worse_cells": 48
65
+ },
66
+ "scientific_scope": {
67
+ "decomposition": "The BCE/KL identity requires the optimal same-feature-space logistic reference.",
68
+ "matching": "The source uses matching for the depth bottleneck; upper and lower exponents are not identical.",
69
+ "protocol": "The source transmits logits rather than probabilities."
70
+ },
71
+ "source_checks": {
72
+ "pdf_sha256": "ca7263e8fd591b27cbd3f869d93ffe1818af27baaa439f278a27a5248ddd92b7",
73
+ "source_sha256": "d17612d6f31795fe581812dd7e20bf00ce5fabc7408e61411b439232b9917417"
74
+ }
75
+ }
outputs/source_claim_audit.csv ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ claim,anchor,verdict,scope
2
+ 1,Theorem 3.7 / thm:convergence,supported_with_assumptions,"Requires a depth-D path satisfying M-coverage, bounded second moments, and bounded global-logit l1 coefficients."
3
+ 2,Theorem 4.5 / Lower Bound on Convergence,supported_with_scope,"The construction has D=kp and p<=k-1; matching refers to the network-depth bottleneck, not identical upper/lower exponents."
4
+ 3,Lemma 3.1 / lem:orthogonality,supported,First-order optimality for the optimal logistic predictor on its feature space.
5
+ 4,Lemma 3.3 / lem:pythagorean,supported_with_scope,Both p* and q are logistic predictors on the same feature set and p* is the optimizer.
6
+ 5,Section 2 / Sequential Learning Protocol,supported,"Agents pass logits, not probabilities, in a topological order."
packaged_replay/depth_formula_audit.csv ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ B_p_star,B_X,M,D,upper_bound,D_times_four_bound_ratio
2
+ 0.5,0.5,2,4,0.25,0.5
3
+ 0.5,0.5,2,16,0.125,0.5
4
+ 0.5,0.5,2,64,0.0625,0.5
5
+ 0.5,0.5,2,256,0.03125,0.5
6
+ 0.5,0.5,4,16,0.25,0.5
7
+ 0.5,0.5,4,64,0.125,0.5
8
+ 0.5,0.5,4,256,0.0625,0.5
9
+ 0.5,0.5,4,1024,0.03125,0.5
10
+ 0.5,0.5,8,64,0.25,0.5
11
+ 0.5,0.5,8,256,0.125,0.5
12
+ 0.5,0.5,8,1024,0.0625,0.5
13
+ 0.5,0.5,8,4096,0.03125,0.5
14
+ 0.5,1.5,2,4,0.75,0.5
15
+ 0.5,1.5,2,16,0.375,0.5
16
+ 0.5,1.5,2,64,0.1875,0.5
17
+ 0.5,1.5,2,256,0.09375,0.5
18
+ 0.5,1.5,4,16,0.75,0.5
19
+ 0.5,1.5,4,64,0.375,0.5
20
+ 0.5,1.5,4,256,0.1875,0.5
21
+ 0.5,1.5,4,1024,0.09375,0.5
22
+ 0.5,1.5,8,64,0.75,0.5
23
+ 0.5,1.5,8,256,0.375,0.5
24
+ 0.5,1.5,8,1024,0.1875,0.5
25
+ 0.5,1.5,8,4096,0.09375,0.5
26
+ 1.0,0.5,2,4,0.5,0.5
27
+ 1.0,0.5,2,16,0.25,0.5
28
+ 1.0,0.5,2,64,0.125,0.5
29
+ 1.0,0.5,2,256,0.0625,0.5
30
+ 1.0,0.5,4,16,0.5,0.5
31
+ 1.0,0.5,4,64,0.25,0.5
32
+ 1.0,0.5,4,256,0.125,0.5
33
+ 1.0,0.5,4,1024,0.0625,0.5
34
+ 1.0,0.5,8,64,0.5,0.5
35
+ 1.0,0.5,8,256,0.25,0.5
36
+ 1.0,0.5,8,1024,0.125,0.5
37
+ 1.0,0.5,8,4096,0.0625,0.5
38
+ 1.0,1.5,2,4,1.5,0.5
39
+ 1.0,1.5,2,16,0.75,0.5
40
+ 1.0,1.5,2,64,0.375,0.5
41
+ 1.0,1.5,2,256,0.1875,0.5
42
+ 1.0,1.5,4,16,1.5,0.5
43
+ 1.0,1.5,4,64,0.75,0.5
44
+ 1.0,1.5,4,256,0.375,0.5
45
+ 1.0,1.5,4,1024,0.1875,0.5
46
+ 1.0,1.5,8,64,1.5,0.5
47
+ 1.0,1.5,8,256,0.75,0.5
48
+ 1.0,1.5,8,1024,0.375,0.5
49
+ 1.0,1.5,8,4096,0.1875,0.5
50
+ 2.0,0.5,2,4,1.0,0.5
51
+ 2.0,0.5,2,16,0.5,0.5
52
+ 2.0,0.5,2,64,0.25,0.5
53
+ 2.0,0.5,2,256,0.125,0.5
54
+ 2.0,0.5,4,16,1.0,0.5
55
+ 2.0,0.5,4,64,0.5,0.5
56
+ 2.0,0.5,4,256,0.25,0.5
57
+ 2.0,0.5,4,1024,0.125,0.5
58
+ 2.0,0.5,8,64,1.0,0.5
59
+ 2.0,0.5,8,256,0.5,0.5
60
+ 2.0,0.5,8,1024,0.25,0.5
61
+ 2.0,0.5,8,4096,0.125,0.5
62
+ 2.0,1.5,2,4,3.0,0.5
63
+ 2.0,1.5,2,16,1.5,0.5
64
+ 2.0,1.5,2,64,0.75,0.5
65
+ 2.0,1.5,2,256,0.375,0.5
66
+ 2.0,1.5,4,16,3.0,0.5
67
+ 2.0,1.5,4,64,1.5,0.5
68
+ 2.0,1.5,4,256,0.75,0.5
69
+ 2.0,1.5,4,1024,0.375,0.5
70
+ 2.0,1.5,8,64,3.0,0.5
71
+ 2.0,1.5,8,256,1.5,0.5
72
+ 2.0,1.5,8,1024,0.75,0.5
73
+ 2.0,1.5,8,4096,0.375,0.5
packaged_replay/gaussian_lower_bound_audit.csv ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ k,passes_p,D,optimal_coefficient_c,excess_bce,k_over_D,scaled_excess_D_over_k,zero_noise_control_excess,coefficient_in_open_unit_interval
2
+ 4,1,4,0.452001306649,0.049078635566,1.0,0.049078635566,0.0,True
3
+ 4,2,8,0.622369338629,0.033261836901,0.5,0.066523673802,0.0,True
4
+ 4,3,12,0.711885741399,0.025157840993,0.333333333333,0.075473522978,0.0,True
5
+ 8,1,8,0.452001306649,0.049078635566,1.0,0.049078635566,0.0,True
6
+ 8,2,16,0.622369338629,0.033261836901,0.5,0.066523673802,0.0,True
7
+ 8,3,24,0.711885741399,0.025157840993,0.333333333333,0.075473522978,0.0,True
8
+ 8,4,32,0.767082976873,0.020229940119,0.25,0.080919760476,0.0,True
9
+ 8,5,40,0.804526570071,0.016916655917,0.2,0.084583279584,0.0,True
10
+ 8,6,48,0.831596672169,0.014536064145,0.166666666667,0.087216384871,0.0,True
11
+ 8,7,56,0.852080201043,0.012742892325,0.142857142857,0.089200246272,0.0,True
12
+ 16,1,16,0.452001306649,0.049078635566,1.0,0.049078635566,0.0,True
13
+ 16,2,32,0.622369338629,0.033261836901,0.5,0.066523673802,0.0,True
14
+ 16,3,48,0.711885741399,0.025157840993,0.333333333333,0.075473522978,0.0,True
15
+ 16,4,64,0.767082976873,0.020229940119,0.25,0.080919760476,0.0,True
16
+ 16,5,80,0.804526570071,0.016916655917,0.2,0.084583279584,0.0,True
17
+ 16,6,96,0.831596672169,0.014536064145,0.166666666667,0.087216384871,0.0,True
18
+ 16,7,112,0.852080201043,0.012742892325,0.142857142857,0.089200246272,0.0,True
19
+ 16,8,128,0.868120595068,0.011343581712,0.125,0.090748653698,0.0,True
20
+ 16,9,144,0.881022187615,0.010221201075,0.111111111111,0.091990809671,0.0,True
21
+ 16,10,160,0.891624244283,0.009300940043,0.1,0.093009400432,0.0,True
22
+ 16,11,176,0.90049128941,0.008532709285,0.090909090909,0.093859802136,0.0,True
23
+ 16,12,192,0.908017031089,0.007881708039,0.083333333333,0.094580496464,0.0,True
24
+ 16,13,208,0.914484428413,0.007323004392,0.076923076923,0.095199057091,0.0,True
25
+ 16,14,224,0.920102076166,0.006838268501,0.071428571429,0.095735759013,0.0,True
26
+ 16,15,240,0.925027129125,0.00641372291,0.066666666667,0.096205843647,0.0,True
27
+ 32,1,32,0.452001306649,0.049078635566,1.0,0.049078635566,0.0,True
28
+ 32,2,64,0.622369338629,0.033261836901,0.5,0.066523673802,0.0,True
29
+ 32,3,96,0.711885741399,0.025157840993,0.333333333333,0.075473522978,0.0,True
30
+ 32,4,128,0.767082976873,0.020229940119,0.25,0.080919760476,0.0,True
31
+ 32,5,160,0.804526570071,0.016916655917,0.2,0.084583279584,0.0,True
32
+ 32,6,192,0.831596672169,0.014536064145,0.166666666667,0.087216384871,0.0,True
33
+ 32,7,224,0.852080201043,0.012742892325,0.142857142857,0.089200246272,0.0,True
34
+ 32,8,256,0.868120595068,0.011343581712,0.125,0.090748653698,0.0,True
35
+ 32,9,288,0.881022187615,0.010221201075,0.111111111111,0.091990809671,0.0,True
36
+ 32,10,320,0.891624244283,0.009300940043,0.1,0.093009400432,0.0,True
37
+ 32,11,352,0.90049128941,0.008532709285,0.090909090909,0.093859802136,0.0,True
38
+ 32,12,384,0.908017031089,0.007881708039,0.083333333333,0.094580496464,0.0,True
39
+ 32,13,416,0.914484428413,0.007323004392,0.076923076923,0.095199057091,0.0,True
40
+ 32,14,448,0.920102076166,0.006838268501,0.071428571429,0.095735759013,0.0,True
41
+ 32,15,480,0.925027129125,0.00641372291,0.066666666667,0.096205843647,0.0,True
42
+ 32,16,512,0.929380238317,0.006038811854,0.0625,0.096620989667,0.0,True
43
+ 32,17,544,0.933255568448,0.005705311562,0.058823529412,0.096990296549,0.0,True
44
+ 32,18,576,0.936727688079,0.005406719964,0.055555555556,0.097320959347,0.0,True
45
+ 32,19,608,0.939856415222,0.005137828534,0.052631578947,0.097618742145,0.0,True
46
+ 32,20,640,0.942690292843,0.004894415848,0.05,0.097888316958,0.0,True
47
+ 32,21,672,0.945269125894,0.004673024317,0.047619047619,0.098133510667,0.0,True
48
+ 32,22,704,0.947625862799,0.004470794903,0.045454545455,0.098357487857,0.0,True
49
+ 32,23,736,0.949788010849,0.004285342963,0.04347826087,0.098562888146,0.0,True
50
+ 32,24,768,0.951778714879,0.00411466378,0.041666666667,0.098751930715,0.0,True
51
+ 32,25,800,0.953617589118,0.003957059792,0.04,0.098926494804,0.0,True
52
+ 32,26,832,0.955321365682,0.003811083939,0.038461538462,0.099088182411,0.0,True
53
+ 32,27,864,0.956904405197,0.003675495096,0.037037037037,0.099238367596,0.0,True
54
+ 32,28,896,0.95837910257,0.003549222701,0.035714285714,0.099378235629,0.0,True
55
+ 32,29,928,0.959756212207,0.003431338426,0.034482758621,0.09950881434,0.0,True
56
+ 32,30,960,0.961045110731,0.003321033314,0.033333333333,0.099630999417,0.0,True
57
+ 32,31,992,0.962254010773,0.003217599193,0.032258064516,0.099745574981,0.0,True
packaged_replay/network_protocol_audit.csv ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dimension,trial,D,M,M_coverage,B_p_star,B_X,theorem_upper_bound,logit_final_excess_bce,probability_control_excess_bce,all_logit_losses_nonincreasing,upper_bound_certificate,probability_control_worse
2
+ 3,0,3,3,True,1.091460616837,1.0,1.890465242823,5.26e-10,7.2951e-08,True,True,True
3
+ 3,0,6,3,True,1.091460616837,1.0,1.336760792797,3e-12,0.000341074969,True,True,True
4
+ 3,0,12,3,True,1.091460616837,1.0,0.945232621411,0.0,0.001660024026,True,True,True
5
+ 3,0,24,3,True,1.091460616837,1.0,0.668380396399,0.0,0.00232631364,True,True,True
6
+ 3,1,3,3,True,1.829920095331,1.0,3.169514578905,5.96764e-07,1.5892294e-05,True,True,True
7
+ 3,1,6,3,True,1.829920095331,1.0,2.241185251813,3.889e-09,0.003702241885,True,True,True
8
+ 3,1,12,3,True,1.829920095331,1.0,1.584757289452,0.0,0.00798032755,True,True,True
9
+ 3,1,24,3,True,1.829920095331,1.0,1.120592625907,0.0,0.008256585251,True,True,True
10
+ 3,2,3,3,True,1.823094348708,1.0,3.157692038954,4.95634e-07,2.9569555e-05,True,True,True
11
+ 3,2,6,3,True,1.823094348708,1.0,2.232825453643,4.229e-09,0.003911454119,True,True,True
12
+ 3,2,12,3,True,1.823094348708,1.0,1.578846019477,0.0,0.00818085715,True,True,True
13
+ 3,2,24,3,True,1.823094348708,1.0,1.116412726821,-0.0,0.00842462407,True,True,True
14
+ 3,3,3,3,True,1.557006316775,1.0,2.696814048359,7.225e-09,1.13947e-07,True,True,True
15
+ 3,3,6,3,True,1.557006316775,1.0,1.906935501194,3e-11,0.001688292841,True,True,True
16
+ 3,3,12,3,True,1.557006316775,1.0,1.34840702418,0.0,0.004726584127,True,True,True
17
+ 3,3,24,3,True,1.557006316775,1.0,0.953467750597,0.0,0.005092186189,True,True,True
18
+ 4,0,4,4,True,1.640918196777,1.0,3.281836393554,5.6234e-08,5.4057222e-05,True,True,True
19
+ 4,0,8,4,True,1.640918196777,1.0,2.320608768627,3.98e-10,0.002351889291,True,True,True
20
+ 4,0,16,4,True,1.640918196777,1.0,1.640918196777,0.0,0.005586105956,True,True,True
21
+ 4,0,32,4,True,1.640918196777,1.0,1.160304384313,0.0,0.00612815868,True,True,True
22
+ 4,1,4,4,True,1.847447387351,1.0,3.694894774703,6.077e-08,8.593969e-05,True,True,True
23
+ 4,1,8,4,True,1.847447387351,1.0,2.612685150963,4.74e-10,0.003880201214,True,True,True
24
+ 4,1,16,4,True,1.847447387351,1.0,1.847447387351,0.0,0.007786960967,True,True,True
25
+ 4,1,32,4,True,1.847447387351,1.0,1.306342575482,-0.0,0.008377402037,True,True,True
26
+ 4,2,4,4,True,2.112896501672,1.0,4.225793003344,1.6385e-08,0.000539786466,True,True,True
27
+ 4,2,8,4,True,2.112896501672,1.0,2.988086888555,9.3e-11,0.00686662151,True,True,True
28
+ 4,2,16,4,True,2.112896501672,1.0,2.112896501672,0.0,0.01045679728,True,True,True
29
+ 4,2,32,4,True,2.112896501672,1.0,1.494043444277,0.0,0.010657526658,True,True,True
30
+ 4,3,4,4,True,1.670857371186,1.0,3.341714742372,4.442e-09,0.00021303184,True,True,True
31
+ 4,3,8,4,True,1.670857371186,1.0,2.362949155122,1.5e-11,0.003423698247,True,True,True
32
+ 4,3,16,4,True,1.670857371186,1.0,1.670857371186,0.0,0.006769257264,True,True,True
33
+ 4,3,32,4,True,1.670857371186,1.0,1.181474577561,0.0,0.007137793931,True,True,True
34
+ 5,0,5,5,True,3.114374171952,1.0,6.963952355853,2.8756e-07,0.001384474922,True,True,True
35
+ 5,0,10,5,True,3.114374171952,1.0,4.924257934684,2.282e-09,0.014557023823,True,True,True
36
+ 5,0,20,5,True,3.114374171952,1.0,3.481976177927,0.0,0.020981078283,True,True,True
37
+ 5,0,40,5,True,3.114374171952,1.0,2.462128967342,0.0,0.021473439098,True,True,True
38
+ 5,1,5,5,True,2.045531556852,1.0,4.573947611242,1.15401e-07,0.000362650185,True,True,True
39
+ 5,1,10,5,True,2.045531556852,1.0,3.234269372701,9.28e-10,0.005443489233,True,True,True
40
+ 5,1,20,5,True,2.045531556852,1.0,2.286973805621,0.0,0.010457249607,True,True,True
41
+ 5,1,40,5,True,2.045531556852,1.0,1.617134686351,0.0,0.011420451294,True,True,True
42
+ 5,2,5,5,True,2.455590106114,1.0,5.490866402146,1.1162e-08,0.00072522127,True,True,True
43
+ 5,2,10,5,True,2.455590106114,1.0,3.882628867547,1.34e-10,0.009158279431,True,True,True
44
+ 5,2,20,5,True,2.455590106114,1.0,2.745433201073,0.0,0.014243461527,True,True,True
45
+ 5,2,40,5,True,2.455590106114,1.0,1.941314433773,0.0,0.014496013881,True,True,True
46
+ 5,3,5,5,True,2.323175338576,1.0,5.194777980708,1.70576e-07,0.000606720343,True,True,True
47
+ 5,3,10,5,True,2.323175338576,1.0,3.673262736917,1.207e-09,0.006959411103,True,True,True
48
+ 5,3,20,5,True,2.323175338576,1.0,2.597388990354,0.0,0.013097454948,True,True,True
49
+ 5,3,40,5,True,2.323175338576,1.0,1.836631368458,0.0,0.014732879402,True,True,True
packaged_replay/networked_information_audit.png ADDED
packaged_replay/orthogonality_decomposition_audit.csv ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,dimension,used_features,support_points,maximum_orthogonality_residual,loss_star,loss_q,kl_pstar_q,decomposition_gap,pinsker_rhs,pinsker_certificate,nonoptimal_reference_control_gap
2
+ 0,3,2,8,0.0,0.686473298406,0.783695922155,0.09722262375,-0.0,0.078553220216,True,0.043499052401
3
+ 1,4,3,16,0.0,0.598417320382,0.645270541438,0.046853221056,-0.0,0.037869368551,True,0.012030249774
4
+ 2,5,4,32,0.0,0.65719040498,0.732528348289,0.075337943309,-0.0,0.050318641751,True,0.030823019361
5
+ 3,6,5,64,0.0,0.642820613088,0.751737913087,0.108917299999,0.0,0.089207272944,True,0.02994685481
6
+ 4,3,2,8,0.0,0.666305076982,0.785501514963,0.11919643798,0.0,0.103716252989,True,0.039576315056
7
+ 5,4,4,16,0.0,0.572899722887,0.670614857037,0.09771513415,-0.0,0.085777279588,True,0.028243904413
8
+ 6,5,4,32,0.0,0.628625482902,0.698615804061,0.069990321159,-0.0,0.04965387929,True,0.022381623143
9
+ 7,6,4,64,0.0,0.545986204592,0.565500817676,0.019514613084,-0.0,0.015842513809,True,-0.00260924578
10
+ 8,3,2,8,0.0,0.620964234687,0.649458834726,0.028494600039,0.0,0.018734196272,True,0.010040348448
11
+ 9,4,2,16,0.0,0.655565825095,0.666111830149,0.010546005054,-0.0,0.010155075049,True,-0.00514674705
12
+ 10,5,4,32,0.0,0.584812151693,0.614510101767,0.029697950074,-0.0,0.024764631512,True,-0.003567374242
13
+ 11,6,3,64,0.0,0.66200766098,0.698189146123,0.036181485143,-0.0,0.031915339102,True,0.000971076055
14
+ 12,3,2,8,0.0,0.602723978336,0.721271512227,0.118547533891,0.0,0.066592620766,True,0.051776915525
15
+ 13,4,3,16,0.0,0.65107027566,0.673356766475,0.022286490815,-0.0,0.019903551755,True,0.003404751896
16
+ 14,5,4,32,0.0,0.525472849344,0.551553308477,0.026080459133,-0.0,0.021018260354,True,0.0032901328
17
+ 15,6,2,64,0.0,0.668516307378,0.671535464329,0.003019156951,0.0,0.002597076841,True,-0.012991449925
18
+ 16,3,2,8,0.0,0.637714405232,0.678704225479,0.040989820247,-0.0,0.031358671887,True,0.015777164811
19
+ 17,4,4,16,0.0,0.633729576273,0.642950329009,0.009220752736,-0.0,0.008175981856,True,-0.019199584657
20
+ 18,5,4,32,0.0,0.673727994983,0.876445857306,0.202717862323,0.0,0.136648306688,True,0.072911731861
21
+ 19,6,6,64,0.0,0.504767024972,0.565232093929,0.060465068957,0.0,0.047165181757,True,0.013421062862
22
+ 20,3,2,8,0.0,0.664723092217,0.713317519622,0.048594427405,0.0,0.038634049595,True,0.010233294903
23
+ 21,4,2,16,0.0,0.619462297857,0.62298409835,0.003521800494,0.0,0.003279155634,True,-0.024450730295
24
+ 22,5,4,32,0.0,0.632812381238,0.652679684102,0.019867302864,0.0,0.019213874869,True,-0.01243895153
25
+ 23,6,5,64,0.0,0.630455413033,0.65939460964,0.028939196608,0.0,0.02272574564,True,-0.005756255758
packaged_replay/results.json ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "claims": [
3
+ "Theorem 3.7 proves an upper bound on excess risk of B_p* * B_X * M/sqrt(D) under an M-coverage condition on depth-D DAGs, extending networked information aggregation from squared loss to Binary Cross-Entropy-based binary classification (Theorem 3.7).",
4
+ "Theorem 4.5 proves a matching lower bound showing instances with excess loss of at least Omega(k/D), where k is feature dimension and D is path depth, establishing network depth as a necessary bottleneck (Theorem 4.5).",
5
+ "Lemma 3.1 establishes an orthogonality property of Binary Cross-Entropy residuals, E[x(p*(x)-y)] = 0, replacing the variance-decomposition tools used in prior squared-loss analyses (Lemma 3.1).",
6
+ "Lemma 3.3 provides a KL/Bregman-type loss decomposition L(q) = L(p*) + D(p*||q), used with Pinsker-style bounds to connect BCE progress to prediction error (Lemma 3.3).",
7
+ "The protocol models a sequential DAG in which each agent observes only a subset of features, receives parent logits (not probabilities), and locally minimizes Binary Cross-Entropy before passing its own logits downstream (Section 2)."
8
+ ],
9
+ "formula_summary": {
10
+ "all_positive": true,
11
+ "cells": 72,
12
+ "depth_exponent_minus_one_half": true
13
+ },
14
+ "gates": {
15
+ "all_logit_losses_nonincreasing": true,
16
+ "all_m_coverage": true,
17
+ "all_pinsker_certificates": true,
18
+ "all_upper_bound_certificates": true,
19
+ "bce_kl_decomposition_exact": true,
20
+ "five_exact_claims_present": true,
21
+ "formula_bounds_positive": true,
22
+ "formula_panel_complete": true,
23
+ "lower_bound_coefficients_valid": true,
24
+ "lower_bound_excess_positive": true,
25
+ "lower_bound_panel_complete": true,
26
+ "lower_bound_scaled_constant_positive": true,
27
+ "nonoptimal_reference_control_fails": true,
28
+ "orthogonality_panel_complete": true,
29
+ "orthogonality_residual_small": true,
30
+ "positive_probability_control_gap": true,
31
+ "probability_passing_control_worse": true,
32
+ "protocol_panel_complete": true,
33
+ "source_archive_pin": true,
34
+ "source_pdf_pin": true,
35
+ "source_scope_rows_complete": true,
36
+ "upper_depth_exponent_minus_one_half": true
37
+ },
38
+ "lower_bound_summary": {
39
+ "all_coefficients_in_open_unit_interval": true,
40
+ "all_excess_positive": true,
41
+ "cells": 56,
42
+ "maximum_scaled_excess_D_over_k": 0.099745574981,
43
+ "minimum_scaled_excess_D_over_k": 0.049078635566
44
+ },
45
+ "orthogonality_summary": {
46
+ "all_pinsker_certificates": true,
47
+ "cells": 24,
48
+ "maximum_absolute_decomposition_gap": 0.0,
49
+ "maximum_orthogonality_residual": 0.0,
50
+ "nonoptimal_reference_counterexamples": 24
51
+ },
52
+ "paper": {
53
+ "arxiv": "2605.01082v1",
54
+ "openreview_id": "mrtg4NmvAe",
55
+ "title": "Networked Information Aggregation for Binary Classification"
56
+ },
57
+ "passed": true,
58
+ "protocol_summary": {
59
+ "all_logit_losses_nonincreasing": true,
60
+ "all_m_coverage": true,
61
+ "all_upper_bound_certificates": true,
62
+ "cells": 48,
63
+ "mean_probability_control_excess_gap": 0.00618226885,
64
+ "probability_control_worse_cells": 48
65
+ },
66
+ "scientific_scope": {
67
+ "decomposition": "The BCE/KL identity requires the optimal same-feature-space logistic reference.",
68
+ "matching": "The source uses matching for the depth bottleneck; upper and lower exponents are not identical.",
69
+ "protocol": "The source transmits logits rather than probabilities."
70
+ },
71
+ "source_checks": {
72
+ "pdf_sha256": "ca7263e8fd591b27cbd3f869d93ffe1818af27baaa439f278a27a5248ddd92b7",
73
+ "source_sha256": "d17612d6f31795fe581812dd7e20bf00ce5fabc7408e61411b439232b9917417"
74
+ }
75
+ }
packaged_replay/source_claim_audit.csv ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ claim,anchor,verdict,scope
2
+ 1,Theorem 3.7 / thm:convergence,supported_with_assumptions,"Requires a depth-D path satisfying M-coverage, bounded second moments, and bounded global-logit l1 coefficients."
3
+ 2,Theorem 4.5 / Lower Bound on Convergence,supported_with_scope,"The construction has D=kp and p<=k-1; matching refers to the network-depth bottleneck, not identical upper/lower exponents."
4
+ 3,Lemma 3.1 / lem:orthogonality,supported,First-order optimality for the optimal logistic predictor on its feature space.
5
+ 4,Lemma 3.3 / lem:pythagorean,supported_with_scope,Both p* and q are logistic predictors on the same feature set and p* is the optimizer.
6
+ 5,Section 2 / Sequential Learning Protocol,supported,"Agents pass logits, not probabilities, in a topological order."
pages/claim-1-depth-upper-bound/page.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Claim 1: Theorem 3.7 proves an upper bound on excess risk of B_p* * B_X * M/sqrt(D) under an M-coverage condition on depth-D DAGs, extending networked information aggregation from squared loss to Binary Cross-Entropy-based binary classification (Theorem 3.7).
2
+
3
+
4
+ ---
5
+ <!-- trackio-cell
6
+ {"type": "markdown", "id": "cell_446cad9dbeff", "created_at": "2026-07-22T10:28:06+00:00", "title": "Claim 1: Theorem 3.7 proves an upper bound on excess risk of B_p* * B_X * M/sqrt(D) under an M-coverage condition on depth-D DAGs, extending networked information aggregation from squared loss to Binary Cross-Entropy-based binary classification (Theorem 3.7)."}
7
+ -->
8
+ > Theorem 3.7 proves an upper bound on excess risk of B_p* * B_X * M/sqrt(D) under an M-coverage condition on depth-D DAGs, extending networked information aggregation from squared loss to Binary Cross-Entropy-based binary classification (Theorem 3.7).
9
+
10
+ **Outcome: source-supported under explicit assumptions.** The theorem concerns
11
+ a depth-`D` path within the DAG, `M`-coverage, bounded feature second moments,
12
+ and bounded `l1` coefficients for the global optimum. All 48 cyclic-path
13
+ diagnostics satisfy coverage, non-increasing BCE, and the stated bound. The
14
+ 72-cell exact formula grid recovers the `D^(-1/2)` dependence.
15
+
16
+ Artifacts: `outputs/network_protocol_audit.csv` and
17
+ `outputs/depth_formula_audit.csv`.
pages/claim-2-depth-lower-bound/page.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Claim 2: Theorem 4.5 proves a matching lower bound showing instances with excess loss of at least Omega(k/D), where k is feature dimension and D is path depth, establishing network depth as a necessary bottleneck (Theorem 4.5).
2
+
3
+
4
+ ---
5
+ <!-- trackio-cell
6
+ {"type": "markdown", "id": "cell_57edd560ccd9", "created_at": "2026-07-22T10:28:06+00:00", "title": "Claim 2: Theorem 4.5 proves a matching lower bound showing instances with excess loss of at least Omega(k/D), where k is feature dimension and D is path depth, establishing network depth as a necessary bottleneck (Theorem 4.5)."}
7
+ -->
8
+ > Theorem 4.5 proves a matching lower bound showing instances with excess loss of at least Omega(k/D), where k is feature dimension and D is path depth, establishing network depth as a necessary bottleneck (Theorem 4.5).
9
+
10
+ **Outcome: source-supported with construction scope.** The hard instance uses
11
+ `D=kp`, cyclic one-feature agents, and `p≤k-1`. “Matching” is preserved only in
12
+ the source's network-depth-bottleneck sense; the upper and lower exponents are
13
+ not identical. Deterministic 64-node two-dimensional Gauss-Hermite quadrature
14
+ across 56 `k,p` cells finds every excess positive and keeps
15
+ `excess·D/k` in `[0.049078635566, 0.099745574981]`.
16
+
17
+ Artifact: `outputs/gaussian_lower_bound_audit.csv`.
pages/claim-3-residual-orthogonality/page.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Claim 3: Lemma 3.1 establishes an orthogonality property of Binary Cross-Entropy residuals, E[x(p*(x)-y)] = 0, replacing the variance-decomposition tools used in prior squared-loss analyses (Lemma 3.1).
2
+
3
+
4
+ ---
5
+ <!-- trackio-cell
6
+ {"type": "markdown", "id": "cell_f1813dcb767c", "created_at": "2026-07-22T10:28:06+00:00", "title": "Claim 3: Lemma 3.1 establishes an orthogonality property of Binary Cross-Entropy residuals, E[x(p*(x)-y)] = 0, replacing the variance-decomposition tools used in prior squared-loss analyses (Lemma 3.1)."}
7
+ -->
8
+ > Lemma 3.1 establishes an orthogonality property of Binary Cross-Entropy residuals, E[x(p*(x)-y)] = 0, replacing the variance-decomposition tools used in prior squared-loss analyses (Lemma 3.1).
9
+
10
+ **Outcome: source-supported.** The identity is the first-order condition for
11
+ the optimal logistic predictor on its feature space. Twenty-four deliberately
12
+ misspecified finite conditional-label models yield nonzero pointwise residuals
13
+ but a maximum weighted feature-moment residual below displayed `1e-12`; this
14
+ is stronger than a correctly specified tautological test.
15
+
16
+ Artifact: `outputs/orthogonality_decomposition_audit.csv`.
pages/claim-4-bce-kl-decomposition/page.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Claim 4: Lemma 3.3 provides a KL/Bregman-type loss decomposition L(q) = L(p*) + D(p*||q), used with Pinsker-style bounds to connect BCE progress to prediction error (Lemma 3.3).
2
+
3
+
4
+ ---
5
+ <!-- trackio-cell
6
+ {"type": "markdown", "id": "cell_f3bd879d54f5", "created_at": "2026-07-22T10:28:06+00:00", "title": "Claim 4: Lemma 3.3 provides a KL/Bregman-type loss decomposition L(q) = L(p*) + D(p*||q), used with Pinsker-style bounds to connect BCE progress to prediction error (Lemma 3.3)."}
7
+ -->
8
+ > Lemma 3.3 provides a KL/Bregman-type loss decomposition L(q) = L(p*) + D(p*||q), used with Pinsker-style bounds to connect BCE progress to prediction error (Lemma 3.3).
9
+
10
+ **Outcome: source-supported with optimizer scope.** The identity requires
11
+ `p*` to be the optimal logistic predictor and `q` to use the same feature
12
+ space. All 24 nontrivial projection cells satisfy the BCE/KL equality and the
13
+ Pinsker inequality to displayed numerical zero. Replacing `p*` by a nonoptimal
14
+ reference breaks the decomposition in all 24 cells.
15
+
16
+ Artifact: `outputs/orthogonality_decomposition_audit.csv`.
pages/claim-5-logit-passing-protocol/page.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Claim 5: The protocol models a sequential DAG in which each agent observes only a subset of features, receives parent logits (not probabilities), and locally minimizes Binary Cross-Entropy before passing its own logits downstream (Section 2).
2
+
3
+
4
+ ---
5
+ <!-- trackio-cell
6
+ {"type": "markdown", "id": "cell_dab0b621edb8", "created_at": "2026-07-22T10:28:06+00:00", "title": "Claim 5: The protocol models a sequential DAG in which each agent observes only a subset of features, receives parent logits (not probabilities), and locally minimizes Binary Cross-Entropy before passing its own logits downstream (Section 2)."}
7
+ -->
8
+ > The protocol models a sequential DAG in which each agent observes only a subset of features, receives parent logits (not probabilities), and locally minimizes Binary Cross-Entropy before passing its own logits downstream (Section 2).
9
+
10
+ **Outcome: source-supported and independently diagnostic.** Every simulated
11
+ agent receives one local feature and the parent's logit, exactly minimizes
12
+ finite-support expected BCE, and sends its new logit in path order. Loss is
13
+ non-increasing in all 48 panels. Substituting parent probabilities for logits
14
+ is worse in all 48, with mean final excess-BCE gap `0.00618226885`, directly
15
+ testing the source's architectural distinction.
16
+
17
+ Artifact: `outputs/network_protocol_audit.csv`.
pages/conclusion/page.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Conclusion
2
+
3
+
4
+ ---
5
+ <!-- trackio-cell
6
+ {"type": "markdown", "id": "cell_23f43f3afca5", "created_at": "2026-07-22T10:28:06+00:00", "title": "Reproduction bundle"}
7
+ -->
8
+ All twenty-two gates pass in two warning-strict byte-identical runs and a
9
+ fresh packaged replay. The bundle contains exact live strings, pinned sole-
10
+ revision PDF/source, projection, protocol, hard-instance, rate, and control
11
+ tables, deterministic code, visualization, paper text, and a recursive
12
+ SHA-256 manifest. Every source assumption and finite-evidence boundary remains
13
+ explicit.
14
+
15
+ ```bash
16
+ PYTHONWARNINGS=error python reproduce.py --output replay
17
+ python build_manifest.py --verify
18
+ ```
pages/executive-summary/page.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Executive summary
2
+
3
+
4
+ ---
5
+ <!-- trackio-cell
6
+ {"type": "markdown", "id": "cell_fde1ece41eed", "created_at": "2026-07-22T10:28:06+00:00", "title": "Executive summary", "pinned": true, "pinned_at": "2026-07-22T10:28:06+00:00"}
7
+ -->
8
+ All twenty-two gates pass. The sole pinned arXiv revision supports the five
9
+ live claims with explicit upper-bound, lower-construction, optimizer, and
10
+ same-feature-space scopes. Nontrivial finite projections satisfy residual
11
+ orthogonality and the BCE/KL identity to displayed numerical zero; all 48
12
+ cyclic logit paths satisfy coverage, monotonicity, and the source bound. The
13
+ probability-passing control is worse in every panel, and 56 Gauss-Hermite hard-
14
+ instance cells keep excess BCE times `D/k` between `0.04908` and `0.09975`.
15
+
16
+ | Item | Value |
17
+ | --- | --- |
18
+ | GPU / compute | None; deterministic CPU-only NumPy/Matplotlib |
19
+ | Registered claims | 5/5 exact literal strings retained |
20
+ | Primary source | arXiv 2605.01082v1 PDF and TeX SHA-256 pinned |
21
+
22
+ Links: [OpenReview](https://openreview.net/forum?id=mrtg4NmvAe),
23
+ [arXiv v1](https://arxiv.org/abs/2605.01082v1), and the reserved future
24
+ [Space target](https://huggingface.co/spaces/ProCreations/repro-networked-information-aggregation-for-binary-classification).
25
+
26
+
27
+ ---
28
+ <!-- trackio-cell
29
+ {"type": "figure", "id": "cell_2a8aa1589a5a", "created_at": "2026-07-22T10:28:06+00:00", "title": "Reproduction poster (poster_embed.html)", "pinned": true, "pinned_at": "2026-07-22T10:28:06+00:00"}
30
+ -->
31
+ ````html
32
+ <iframe src="poster_embed.html" title="Networked BCE reproduction poster" style="width:100%;height:900px;border:0"></iframe>
33
+ ````
pages/index.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Reproduction: Networked Information Aggregation for Binary Classification
2
+
3
+ ## Pages
4
+
5
+ | Page |
6
+ | --- |
7
+ | [Executive summary](#/executive-summary) |
8
+ | [Claim 1: Depth upper bound](#/claim-1-depth-upper-bound) |
9
+ | [Claim 2: Depth lower bound](#/claim-2-depth-lower-bound) |
10
+ | [Claim 3: Residual orthogonality](#/claim-3-residual-orthogonality) |
11
+ | [Claim 4: BCE/KL decomposition](#/claim-4-bce-kl-decomposition) |
12
+ | [Claim 5: Logit-passing protocol](#/claim-5-logit-passing-protocol) |
13
+ | [Conclusion](#/conclusion) |
paper.txt ADDED
@@ -0,0 +1,719 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Networked Information Aggregation for Binary Classification
2
+
3
+
4
+ MohammadHossein Bateni 1 Zahra Hadizadeh 2 MohammadTaghi Hajiaghayi 3 Mahdi JafariRaviz 3
5
+ Shayan Taherijam 2
6
+
7
+
8
+ Abstract with partial and heterogeneous information aggregate their
9
+ observations to form an accurate global belief? This line of
10
+ We study networked binary classification on a
11
+ inquiry has a rich literature in economics and network sci-
12
+ directed acyclic graph (DAG) where each agent
13
+
14
+
15
+
16
+
17
+ arXiv:2605.01082v1 [cs.LG] 1 May 2026
18
+ ence, commencing with the seminal work of DeGroot (De-
19
+ observes only a subset of the feature columns of a
20
+ groot, 1974). The DeGroot model conceptualizes learning
21
+ shared dataset. Agents act sequentially along the
22
+ as an iterative process of weighted averaging, where agents
23
+ DAG: each receives prediction columns from its
24
+ update their scalar beliefs based on the beliefs of their neigh-
25
+ parents (if any), augments its local features with
26
+ bors. This heuristic approach was subsequently refined by
27
+ these columns, fits a logistic predictor by mini-
28
+ Bayesian models of observational learning and information
29
+ mizing binary cross-entropy (BCE), and forwards
30
+ cascades, where rational agents infer private signals from
31
+ its prediction column to its outgoing neighbors.
32
+ the actions of their predecessors to reach a consensus or
33
+ We ask whether this sequential distributed train-
34
+ truth. For example, Banerjee (Banerjee, 1992) studies herd-
35
+ ing procedure achieves information aggregation,
36
+ ing behavior in sequential decision-making; Bikhchandani
37
+ meaning that some agent attains small excess loss
38
+ et al. (Bikhchandani et al., 1992) formalize informational
39
+ compared to the best logistic predictor trained
40
+ cascades as a mechanism for fads and fashions; Gale and
41
+ with access to all feature columns.
42
+ Kariv (Gale & Kariv, 2003) analyze Bayesian learning dy-
43
+ This question was studied for linear regres- namics over social networks; and Golub and Jackson (Golub
44
+ sion under squared loss by Kearns, Roth, and & Jackson, 2010) study conditions under which naive aver-
45
+ Ryu (Kearns et al., 2026). Extending their guar- aging aggregates information.
46
+ antees to classification is nontrivial because their
47
+ analysis relies on quadratic structure that does not While classical social learning focuses on the aggregation
48
+ directly transfer to BCE with a logistic link. We of scalar estimates for a single state variable, modern ap-
49
+ analyze the resulting sequential logit-passing pro- plications increasingly demand networked machine learn-
50
+ tocol and√ prove: (i) an excess loss upper bound ing, where agents collaboratively learn high-dimensional
51
+ of O(M/ D) on depth-D paths under the condi- hypothesis functions. In this setting, aggregation entails
52
+ tion that every M contiguous subsequence of M reconstructing a complex predictive relationship—such as
53
+ agents collectively observe all features, and (ii) a a classifier mapping a high-dimensional feature vector to
54
+ close lower bound showing instances with excess a label—dispersed across a network. Recently, Kearns et
55
+ loss of at least Ω(k/D) where k is the dimension al. (Kearns et al., 2026) introduced a formal framework
56
+ of the feature space. Together, these results iden- for this problem, embedding learning agents in a Directed
57
+ tify network depth as a fundamental bottleneck Acyclic Graph (DAG). In their protocol, agents observe a
58
+ for information aggregation in networked logistic local subset of features and the predictions of their parents,
59
+ regression. training a model to minimize a local loss function. For linear
60
+ regression under squared error, they demonstrated that such
61
+ a process allows agents to achieve excess loss competitive
62
+ with a global learner having access to all features, with the
63
+ 1. Introduction
64
+ network depth acting as the critical resource for aggregation.
65
+ The study of social learning in networks addresses a fun-
66
+ damental question in distributed learning: How do agents 1.1. Our Contributions
67
+ 1
68
+ Google Research, New York City, NY, USA 2 University of In this work, we focus on the classification variant of the
69
+ California, Irvine, CA, USA 3 University of Maryland, College model of (Kearns et al., 2026). We analyze a sequential
70
+ Park, MD, USA. Correspondence to: Shayan Taherijam <sta- learning protocol where agents optimize logistic regression
71
+ herij@uci.edu>.
72
+ models using local features and incoming logits from their
73
+ Preprint. May 5, 2026. parents in a DAG. Our main contributions are as follows.
74
+
75
+ 1
76
+ Networked Information Aggregation for Binary Classification
77
+
78
+ Upper Bounds. We analyze information aggregation in a gression require genuinely different tools once the target
79
+ network of logistic regression agents. We show that if a is probabilistic classification. We list three representative
80
+ path of length D satisfies a coverage condition—namely, pairs. First, in sketching/subspace-embedding methods,
81
+ every contiguous block of M agents collectively observes least-squares regression admits sharp oblivious sketching
82
+ all features. In particular, we prove
83
+ √ that the excess loss of guarantees (Clarkson & Woodruff, 2013), whereas logistic
84
+ the final agent scales as O(M/ D) (Theorem 3.8). objectives require non-L2 progress measures and different
85
+ proof techniques (Munteanu et al., 2021). Second, in second-
86
+ At a high level, our proof extends the analysis of (Kearns
87
+ order / curvature-aware acceleration via sketching, iterative
88
+ et al., 2026) from squared loss to logistic loss. The squared-
89
+ Hessian sketch methods are cleanly analyzed for constrained
90
+ loss argument relies on an exact variance decomposition,
91
+ least squares (Pilanci & Wainwright, 2016), while Newton-
92
+ which does not carry over to Binary Cross-Entropy (BCE).
93
+ sketch extensions for regularized ERM objectives (including
94
+ Instead, we certify progress via a KL/Bregman-type char-
95
+ logistic regression) require controlling curvature that de-
96
+ acterization of loss differences (Lemma 3.3) together with
97
+ pends on current predictions (Pilanci & Wainwright, 2017).
98
+ a Pinsker-style link from KL progress to prediction error
99
+ Third, in distribution-free predictive inference, split confor-
100
+ (Lemma 3.4). A key technical input is an orthogonality
101
+ mal prediction yields regression intervals (Lei et al., 2018),
102
+ condition for BCE residuals (Lemma 3.1). Finally, a stabil-
103
+ whereas classification requires set-valued prediction regions
104
+ ity (pigeonhole) argument identifies a segment of the path
105
+ and different uncertainty objects (Angelopoulos & Bates,
106
+ where improvement saturates; this forces small residuals and
107
+ 2021). Taken together, these examples support the mes-
108
+ yields a bound on the deviation from the global optimum.
109
+ sage most relevant to our paper: moving from regression to
110
+ Lower Bounds and Hard Instances We complement the classification typically replaces Euclidean residual decom-
111
+ upper bound by exhibiting a hard instance for the sequential positions with KL/Bregman-flavored notions of progress,
112
+ logit-passing protocol. On this instance, early features are which becomes unavoidable when the information flowing
113
+ uninformative about the label in isolation and only become through the network is itself a low-bandwidth probabilistic
114
+ useful after sufficiently many passes through the feature prediction.
115
+ cycle. We prove that the excess loss is lower-bounded by
116
+ Ω(k/D) where k is the dimension of the feature space, 1.3. Related Work
117
+ showing that network depth is not merely sufficient but
118
+ necessary in the framework. The most directly related body of work comes from Vertical
119
+ Federated Learning (VFL), where different parties hold dis-
120
+ joint feature columns for the same aligned examples and col-
121
+ 1.2. From Regression to Classification
122
+ laborate to train a joint predictor. The standard VFL setting
123
+ Extending theoretical guarantees of networked aggregation is inherently interactive: the survey of (Yang et al., 2019)
124
+ from linear regression to binary classification is non-trivial. formalizes the feature-partitioned regime and highlights that
125
+ The analysis in (Kearns et al., 2026) relies fundamentally on most practical protocols rely on repeated message exchanges
126
+ the geometry of squared loss—in particular, orthogonality (e.g., gradients, activations, or protected sufficient statistics)
127
+ of residuals and a Pythagorean variance decomposition— to optimize a shared objective. This view is reflected in
128
+ which translate loss reduction directly into parameter-space deployed platforms such as FATE (Liu et al., 2021), which
129
+ convergence. In contrast, binary classification via logistic re- operationalize multi-round VFL pipelines and make explicit
130
+ gression and Binary Cross-Entropy (BCE) does not admit a the practical tension between accuracy, privacy protection,
131
+ comparable bias–variance decomposition. The non-linearity and communication cost. A particularly relevant algorith-
132
+ of the sigmoid link introduces genuine geometric complica- mic family is vertical gradient-boosted tree training: Se-
133
+ tions; in particular, linear aggregation in probability space cureBoost (Cheng et al., 2021) and later high-performance
134
+ is not equivalent to linear aggregation in feature space, mo- variants such as SecureBoost+ (Fan et al., 2024) show that
135
+ tivating the architectural choice of passing logits rather than strong predictors can be trained over vertically split fea-
136
+ probabilities. tures, but only by repeatedly coordinating split decisions
137
+ through exchanging split-related information. From the
138
+ Despite these challenges, classification remains the primary
139
+ perspective of our setting, these works provide concrete
140
+ modality for distributed applications ranging from medical
141
+ evidence that feature partitioning alone already induces
142
+ diagnosis (Vepakomma et al., 2018) to decentralized fraud
143
+ a strong communication bottleneck; our work asks what
144
+ detection. Establishing guarantees for information aggrega-
145
+ can be guaranteed when the interaction budget is pushed
146
+ tion under BCE is therefore a central theoretical goal.
147
+ much closer to its limit. A complementary architectural line
148
+ More broadly, this regression-to-classification gap is not is split learning (Vepakomma et al., 2018), which avoids
149
+ unique to our networked setting: across several areas, tech- sharing raw features by cutting a neural network across par-
150
+ niques and guarantees that are clean for squared-loss re- ties and communicating intermediate activations/gradients.
151
+
152
+
153
+ 2
154
+ Networked Information Aggregation for Binary Classification
155
+
156
+ While the mechanism is different from VFL-by-gradients or 2.3. Sequential Learning Protocol
157
+ VFL-by-trees, it again emphasizes the same friction point
158
+ The agents learn models in a sequential manner. Unlike lin-
159
+ that is central to our paper: learning can succeed under
160
+ ear regression settings where agents minimize squared error,
161
+ information-flow constraints, but the protocol must care-
162
+ here each agent Ai aims to train a model fi to minimize the
163
+ fully manage what is transmitted and how many rounds are
164
+ local Binary Cross Entropy (BCE) loss.
165
+ available. Finally, recent surveys (Wu et al., 2025; Khan
166
+ et al., 2025) synthesize these lines and stress that communi- Each agent Ai observes its local features xSi and the set
167
+ cation (both message size and number of rounds) remains of outputs from its parents. To preserve the information
168
+ a dominant practical limitation in VFL, alongside privacy geometry of the exponential family, agents communicate
169
+ leakage and the statistical dependence patterns induced by their logits (the input to the sigmoid function) rather than
170
+ feature/label partitioning; this framing closely matches the their final probabilities. Let zj be the logit output by parent
171
+ communication-centric viewpoint taken in our analysis. Aj , such that the parent’s prediction is p̂j = σ(zj ).
172
+ The model pi for agent Ai is a logistic function of its local
173
+ 2. Preliminaries features and the parents’ logits:
174
+ In this section, we formally define the notation, the logistic X
175
+ regression framework, and the distributed learning setup. pi (x) = σ(zi (x)) where zi (x) = wiT xSi + vij zj (x).
176
+ j∈Pa(Ai )
177
+ (3)
178
+ 2.1. Binary Classification and Logistic Regression
179
+ Here, wi (weights for local features) and vij (weights
180
+ We consider a binary classification problem. Let D be a for incoming logits) are learnable parameters. Agent Ai
181
+ distribution over feature-label pairs (x, y), where x ∈ Rd is chooses these parameters to minimize the expected BCE
182
+ a vector of features and y ∈ {0, 1} is the binary target label. loss E[L(pi )].
183
+ We model the conditional probability P (y = 1|x) using the The final output of the system is the prediction of the sink
184
+ logistic function σ(z) = 1+e1−z . A hypothesis is parameter- agent (or the last agent in the topological sort).
185
+ ized by a vector θ ∈ Rd , yielding the predictor: We use the notation L(p), L(θ), and L(z) interchangeably.
186
+ p(θ) T
187
+ (x) = σ(θ x). (1) Here, θ denotes the weight vector. We define z(x) = θT x
188
+ and p(x) = σ(z(x)).
189
+ The quality of a predictor is measured by the expected Bi-
190
+ nary Cross Entropy (BCE) loss: 3. Upper Bounds
191
+ (θ) (θ)
192
+ L(θ) = −E(x,y)∼D [y log p (x)+(1−y) log(1−p(x))]. This section analyzes information aggregation within a net-
193
+ (2) work of logistic regression agents. We demonstrate that se-
194
+ The global Maximum Likelihood Estimator (MLE), denoted quentially minimizing Binary Cross Entropy (BCE) allows
195
+ by p∗ , corresponds to the parameters θ∗ that minimize this the network to approximate the global predictor derived
196
+ loss over the full feature space. from all features, assuming sufficient network depth and
197
+ feature coverage.
198
+ 2.2. Distributed Learning Setup
199
+ We first establish that the residuals of the BCE loss optimizer
200
+ We consider a distributed learning setting with a set of N are orthogonal to the input. A similar result was previously
201
+ agents, A = {A1 , . . . , AN }. The agents are organized derived by (Kearns et al., 2026) for the linear regression
202
+ in a Directed Acyclic Graph (DAG), G = (A, E), where with MSE loss.
203
+ an edge (Aj , Ai ) ∈ E indicates that agent Ai receives
204
+ information from agent Aj . We sometimes also write Aj → Lemma 3.1 (Orthogonality of Residuals). Let p∗ be the
205
+ Ai to denote this relationship. We denote the set of parents optimal logistic predictor on a feature space X . The residual
206
+ of agent Ai as Pa(Ai ) = {Aj | (Aj , Ai ) ∈ E}. The agents error (p∗ (x) − y) is orthogonal to the feature vector x in
207
+ learn in an order consistent with a topological sort of the expectation:
208
+ DAG, with ties in the topological ordering broken arbitrarily. E [x(p∗ (x) − y)] = 0.
209
+
210
+ Let [d] = {1, 2, . . . , d} be the set of indices for d total
211
+ features. Each agent Ai ∈ A is associated with a specific Proof. Given p(θ) (x) = σ(θT x), the gradient of the logistic
212
+ subset of these features, Si ⊆ [d]. For any agent Ai , its output is ∇θ p(θ) (x) = p(θ) (x)(1 −p(θ) (x))x. Applying the
213
+ local view of the features is xSi , which is the sub-vector of chain rule to L(θ) yields:
214
+ x corresponding to the features indexed by Si . The agent h i
215
+ also receives its parents’ logits. ∇θ L(θ) = −E (y(1 − p(θ) (x)) − (1 − y)p(θ) (x))x
216
+
217
+ 3
218
+ Networked Information Aggregation for Binary Classification
219
+ h i h i
220
+ = E (p(θ) (x) − y)x . + E (p∗ (x) − y) (θ − θ∗ )T x . (4)
221
+
222
+ The optimal parameters θ∗ satisfy the condition ∇θ L(θ∗ ) = The second term is zero due to the orthogonality condition
223
+ 0. Thus: derived in Lemma 3.1. For the first term, we expand the
224
+ E [x(p∗ (x) − y)] = 0. definition of D(p∗ ∥q) with z = θT x and z ∗ = (θ∗ )T x:
225
+ h  ∗
226
+ 
227
+ This orthogonality allows us to decompose the error of any D(p∗ ∥q) = E p∗ (x) (z ∗ − z) − log 1 + ez
228
+ suboptimal model. We express the error of a suboptimal i
229
+ model in terms of the optimal predictor using the expected + log (1 + ez )
230
+ Kullback-Leibler divergence of the Bernoulli distribution, h  T
231
+   ∗ T
232
+ 
233
+ defined as follows. = E log 1 + eθ x − log 1 + e(θ ) x
234
+ i
235
+ Definition 3.2. Let p and q be two predictors on feature − p∗ (x) (θ − θ∗ )T x .
236
+ space X . Then D(p∥q) is defined as:
237
+
238
+ D(p∥q) = E [DKL (Bernoulli(p(x))∥Bernoulli(q(x)))] , This matches the first term in Equation (4), completing the
239
+ proof.
240
+ where DKL (p′ ∥q ′ ) is the Kullback-Leibler divergence be-
241
+ tween distributions p′ and q ′ , given by: To bound the parameter error using the KL divergence,
242
+ we use the following inequality. This is a specific case
243
+ X p′ (x) of Pinsker’s inequality (Pinsker, 1964), included here for
244
+ DKL (p′ ∥q ′ ) = p′ (x) log .
245
+ x
246
+ q ′ (x) completeness.
247
+ Lemma 3.4. For the expected KL divergence D(p∥q), the
248
+ Expanding this definition, D(p∥q) becomes: following inequality holds:
249
+
250
+ D(p∥q) ≥ 2E (p(x) − q(x))2 .
251
+  
252
+ 1 − p(x)
253
+  
254
+ p(x)
255
+ D(p∥q) = E p(x) log + (1 − p(x)) log .
256
+ q(x) 1 − q(x)
257
+ We refer to Appendix A for the proof. We define the point-
258
+ Lemma 3.3 (Decomposing Loss). Let p∗ be the optimal wise loss function as:
259
+ logistic predictor on a feature set S, and let q be any logistic
260
+ predictor on S. The loss decomposes as: l(z, y) = log(1 + ez ) − yz. (5)
261
+
262
+ L(q) = L(p∗ ) + D(p∗ ∥q). We can thus write L(p) = E[l(z(x), y)].
263
+ Lemma 3.5. Let g(x) = σ(zg (x)) be any logistic predictor.
264
+ Proof. Using the identity log σ(z) = z − log(1 + ez ), we Let S be a feature subspace and p(x) = σ(zp (x)) be the
265
+ write the loss with z = θT x as: predictor that minimizes L(p) over S. Then:
266
+
267
+ L(θ) = −E [yz − log(1 + ez )] L(p) ≤ L(g) + |E[(p − y)zg ]|.
268
+ h T
269
+ i
270
+ = E log(1 + eθ x ) − y(θT x) . Proof. Let ϕ(z) = log(1+ez ). The derivatives are ϕ′ (z) =
271
+ σ(z) and ϕ′′ (z) = σ(z)(1 − σ(z)). Since σ(z) ∈ (0, 1),
272
+ Let θ∗ be the corresponding parameters of p∗ . Expanding we have ϕ′′ (z) ≥ 0, implying ϕ is convex. Convexity
273
+ the difference L(θ) − L(θ∗ ): implies that for any u, v ∈ R, ϕ(v) ≥ ϕ(u) + ϕ′ (u)(v − u).
274
+ h T
275
+ Rearranging implies the following:
276
+ L(θ) − L(θ∗ ) = E log(1 + eθ x )
277
+ ∗ T
278
+ ϕ(u) ≤ ϕ(v) + σ(u)(u − v). (6)
279
+ − log(1 + e(θ ) x )
280
+ i We define the relationship between the losses l(u, y) and
281
+ − y((θ − θ∗ )T x) . l(v, y). Substituting l(z, y) = ϕ(z) − yz, we aim to show
282
+ the following inequality:
283
+ Adding and subtracting p∗ (x)(θ − θ∗ )T x inside the expec-
284
+ tation yields: l(u, y) ≤ l(v, y) + (σ(u) − y)(u − v). (7)
285
+ h T ∗ T  Expanding terms confirms this holds given the convexity of
286
+ L(θ) − L(θ∗ ) =E log(1 + eθ x ) − log 1 + e(θ ) x ϕ in Equation (6):
287
+ i
288
+ − p∗ (x) (θ − θ∗ )T x ϕ(u) − yu ≤ ϕ(v) − yv + σ(u)(u − v) − yu + yv
289
+
290
+ 4
291
+ Networked Information Aggregation for Binary Classification
292
+
293
+ ⇐⇒ ϕ(u) ≤ ϕ(v) + σ(u)(u − v). = |E[xl (pk − pj )]|.
294
+ Applying the Cauchy-Schwarz inequality:
295
+ Now, for a point x, let u = zp (x) and v = zg (x). Applying q q
296
+ Equation (7): |E[xl (pk − pj )]| ≤ E[x2l ] E[(pk − pj )2 ]
297
+ l(zp , y) ≤ l(zg , y) + (σ(zp ) − y)(zp − zg ). = ∥xl ∥2 ∥pk − pj ∥2 .
298
+ Taking the expectation over x: Given ∥xl ∥2 ≤ BX , we bound ∥pk − pj ∥2 using the loss
299
+ difference ε. Applying Lemma 3.4, we get for any s ∈
300
+ L(p) ≤ L(g) + E[(p − y)(zp − zg )] {1, . . . , k − 1}:
301
+ = L(g) + E[(p − y)zp ] − E[(p − y)zg ].  1
302
+ E (ps − ps+1 )2 ≤ D(ps+1 ∥ps ).
303
+ 
304
+ From Lemma 3.1 (Orthogonality), we know that for any 2
305
+ feature xl in the support of p, E[xl (p − y)] = 0. Since zp By the triangle inequality and Cauchy-Schwarz:
306
+ is a linear combination of such features, E[(p − y)zp ] = 0.
307
+ k−1
308
+ r
309
+ Substituting this yields: X D(ps+1 ∥ps )
310
+ ∥pj − pk ∥2 ≤
311
+ 2
312
+ L(p) ≤ L(g) − E[(p − y)zg ] ≤ L(g) + |E[(p − y)zg ]|. s=j
313
+ s
314
+ Pk−1
315
+ k s=1 D(ps+1 ∥ps )
316
+ We consider a path of agents A1 , . . . , AD . Each agent i ≤
317
+ 2
318
+ receives the logit zi−1 from its predecessor and trains a r
319
+ logistic predictor model using locally observed features xSi , kε
320
+ ≤ .
321
+ zi−1 , and possibly some other predecessors’ logits. Since 2
322
+ one option for the agent Ai is to pass the logits zi−1 through, Combining these bounds with the constraint on αl :
323
+ we have that L(pi−1 ) ≥ L(pi ). We also get that Lemma 3.3
324
+ holds for pi−1 and pi , since pi−1 is in the stricter subspace d r
325
+ X kε
326
+ of pi . |E[(pk − y)zg ]| ≤ |αl | · |E[xl (pk − y)]| ≤ Bg BX .
327
+ 2
328
+ p l=1
329
+ We use the notation ∥f (x)∥2 = E [f (x)2 ] for any func-
330
+ tion f .
331
+ Lemma 3.6 (Residual Bound via Path Coverage). Let We now give the below definition.
332
+ A1 , . . . , Ak be a path of agents where every feature xl Definition 3.7 (M -Coverage Condition, Kearns et al.
333
+ is observed at least once. Let g(x) = σ(zg (x)) where (2026)). A path satisfies the M -coverage condition if every
334
+ Pd
335
+ zg (x) = l=1 αl xl be any logistic predictor over the whole contiguous subsequence of M agents collectively observes
336
+ Pd
337
+ space. Assume the coefficients of zg satisfy l=1 |αl | ≤ Bg , all d features x1 , . . . , xd .
338
+ and the features satisfy E[x2l ] ≤ BX
339
+ 2
340
+ , for some Bg and BX .
341
+ We are finally ready to prove Theorem 3.8. Combining
342
+ Let ε ≥ L(p1 ) − L(pk ). Then:
343
+ Lemma 3.5 and Lemmap3.6, we obtain the relationship
344
+ r
345
+ kε L(pk ) ≤ L(g) + Bg BX kε/2 for a path of length k. Ex-
346
+ |E[(pk − y)zg ]| ≤ Bg BX . tending this analysis over the full path satisfying the M -
347
+ 2
348
+ coverage condition leads to our main convergence result.
349
+ Proof. Let zg (x) =
350
+ Pd Theorem 3.8 (Global Convergence Rate). Consider a DAG
351
+ l=1 αl xl . We bound the error term:
352
+ G containing a path of length D of agents A1 , . . . , AD
353
+ satisfying the M -coverage condition. Let p∗ be the global
354
+ " d #
355
+ X
356
+ |E[(pk − y)zg ]| = E αl xl (pk − y) optimal logistic predictor over all d features. Assume:
357
+ l=1
358
+ d
359
+ X 1. Bounded second moments: E[x2l ] ≤ BX
360
+ 2
361
+ for all l ∈
362
+ ≤ |αl | |E[xl (pk − y)]|. {1, . . . , d}.
363
+ l=1
364
+ 2. Bounded coefficients: for the optimal logits z ∗ (x) =
365
+ Consider a feature xl . Due to each feature being observed, P
366
+ l αl xl where ∥α∥1 ≤ Bp .
367
+ ∗
368
+ this feature appears in the index set of some agent Aj in the
369
+ path. By orthogonality, E[xl (pj − y)] = 0. We decompose Then the excess risk of the final agent pD is bounded by:
370
+ the expectation using the triangle inequality:  
371
+ M M
372
+ |E[xl (pk − y)]| ≤ |E[xl (pk − pj )]| + |E[xl (pj − y)]| L(pD ) − L(p∗ ) ≤ Bp∗ BX √ = O √ .
373
+ D D
374
+
375
+ 5
376
+ Networked Information Aggregation for Binary Classification
377
+
378
+ Proof. We partition the path into K = ⌊D/M ⌋ disjoint Network and Assignment. Consider a path of agents
379
+ blocks of length M . By the Pigeonhole Principle, since A1 , . . . , AD . The agents observe features one-at-a-time in a
380
+ the total loss reduction is bounded by the loss of the first repeating cyclic order. Agent Ai observes the single feature
381
+ agent L(p1 ), there exists at least one stable block k ∗ where xℓ where ℓ = ((i−1) (mod k))+1. The network structure
382
+ the reduction is at most the total reduction divided by K. is a simple path where Pa(Ai ) = {Ai−1 }.
383
+ Suppose this block k ∗ is on indices s, s + 1, . . . , t.
384
+ We define a pass p as p-th disjoint block of k
385
+ t
386
+ X L(p1 ) 2M L(p1 ) agents. Specifically, the p-th pass consists of the agents
387
+ (L(pi−1 ) − L(pi )) ≤ ≤ := ε. A(p−1)k+1 , . . . , Apk .
388
+ i=s+1
389
+ K D
390
+
391
+ Applying Lemma 3.5 and Lemma 4.2. Information Capacity and Variance
392
+ p3.6, we get that over this
393
+ path L(pt ) ≤ L(p∗ ) + Bp∗ BX M ε/2. Next, note that We analyze the capacity of the final agent in pass p to re-
394
+ L(p1 ) ≤ log 2 since using θ1 = 0 achieves a loss of log 2, construct the target Zk by identifying which features can be
395
+ and because the first agent optimizes within its domain then effectively decoded from the scalar stream.
396
+ L(p1 ) ≤ log 2 < 1. Combined with the non-increasing
397
+ losses, we get: The following lemma characterizes the restricted informa-
398
+ tion available to agents. This result follows the methods of
399
+ M Lemma 5.5 in (Kearns et al., 2026), which establishes an
400
+ L(pD ) − L(p∗ ) ≤ Bp∗ BX √ .
401
+ D analogous result. We provide the proof for completeness.
402
+ Lemma 4.1 (Recursive Information Relevance). For any
403
+ 4. Lower Bound Analysis pass p with p ≤ k, define the feature subset Ip =
404
+ In this section, we construct a theoretical lower bound for {xk , xk−1 , . . . , xk−p+1 }. The optimal logistic predictor for
405
+ the convergence rate of the distributed learning protocol. We σ(Zk ) at the end of pass p depends solely on the features in
406
+ demonstrate the existence of a specific data distribution and Ip .
407
+ network configuration where the excess loss decays at a rate
408
+ of Ω(k/D), where D is the depth of the network and k is
409
+ the dimension of the feature space. This result confirms that Proof. We proceed by induction on the pass index p.
410
+ the sequential nature of the protocol makes network depth a Base Case (p = 1): The first pass ends at agent Ak , who
411
+ fundamental bottleneck for information aggregation. observes the local feature xk = Zk − Zk−1 . Preceding
412
+ agents A1 , . . . , Ak−1 observe features x1 , . . . , xk−1 , all of
413
+ 4.1. Problem Construction which are independent of the target Zk and thus the label
414
+ We define a hard instance that exploits the information bot- y. Because each agent Ai (for i < k) minimizes its local
415
+ tleneck inherent in sequential logit aggregation. BCE loss using only information independent of the label,
416
+ each sequentially transmits a logit of 0 to its successor.
417
+ Data Distribution. Let k ≥ 2 be the dimension of the Consequently, Ak receives a logit of 0 from Ak−1 and must
418
+ feature space. Consider a sequence of independent latent rely exclusively on its local observation xk to predict y. This
419
+ variables Z1 , Z2 , . . . , Zk ∼ N (0, 1). We define the observ- establishes the effective information set I1 = {xk }.
420
+ able features x1 , . . . , xk ∈ R as follows: Inductive Step: Assume at the end of pass p, the optimal
421
+ predictor z (p) is a function only of the features in Ip =
422
+ x1 = Z1 (8) {xk , xk−1 , . . . , xk−p+1 }. In pass p + 1, the initial sequence
423
+ xi = Zi − Zi−1 , for 2 ≤ i ≤ k (9) of agents observe features x1 , . . . , xk−p−1 . Because these
424
+ features are independent of the current information set Ip ,
425
+ Pi Zi can be recovered
426
+ By construction, the latent variable
427
+ they are also independent of the incoming logit z (p) and
428
+ by the prefix sum of features: j=1 xj = Zi . We define
429
+ the label y. Consequently, these agents cannot improve
430
+ the binary target label y ∈ {0, 1} based on the final latent
431
+ the prediction; they sequentially forward the logit z (p) to
432
+ variable Zk via the logistic model:
433
+ one another without modification. This process continues
434
+
435
+ k
436
+  until an agent observes xk−p = Zk−p − Zk−p−1 . This new
437
+ feature is correlated with the latent variable Zk−p currently
438
+ X
439
+ P (y = 1|x) = σ(Zk ) = σ  xj  (10)
440
+ j=1 acting as noise in z (p) , allowing the agent to partially cancel
441
+ that noise and improve the estimate of Zk . Subsequent
442
+ Thus, the optimal global logit predictor is z ∗ (x) = Zk , agents in the pass observe only features in Ip . Thus, the
443
+ which requires access to all k features to cancel the interme- relevant information set expands by exactly one feature:
444
+ diate noise terms. Ip+1 = Ip ∪ {xk−p }.
445
+
446
+ 6
447
+ Networked Information Aggregation for Binary Classification
448
+
449
+ Given this restriction, any logit z (p) generated at the end of Proof. We first analyze the loss conditioned on Zk . Assum-
450
+ pass p is a linear function of the features in Ip . We analyze ing y|Zk ∼ Bernoulli(σ(Zk )), we expand the conditional
451
+ this linear predictor in the following lemma. loss as:
452
+ Lemma 4.2. Let z (p) be a linear predictor based on Ip . L(z|Zk ) = Ey|Zk [−yz + log(1 + ez )]
453
+ Then z (p) is given by
454
+ = −σ(Zk )z + log(1 + ez ). (11)
455
+  
456
+ (p) 1
457
+ z = c Zk + √ ξ , Define g(z) = L(z|Zk ). Differentiating with respect to z
458
+ p yields g ′ (z) = −σ(Zk ) + σ(z). The second derivative is
459
+ g ′′ (z) = σ(z)(1 − σ(z)). Since σ(z) ∈ (0, 1), g ′′ (z) > 0,
460
+ where c ∈ R is a constant and ξ ∼ N (0, Vp ) is independent
461
+ implying g is strictly convex.
462
+ of Zk . For a fixed c, minimizing the variance Vp yields
463
+ Vp = 1. The total loss for zv is L(zv ) = EZk [Eξv [g(cZk + ξv )]].
464
+ To compare zu and zv , let δ ∼ N (0, u − v) be independent
465
+ Pp−1 of ξv . We can model the higher variance noise as ξu = ξv +δ.
466
+ Proof. Define z (p) = j=0 cj xk−j with coefficients
467
+ Applying Jensen’s inequality to the strictly convex function
468
+ c0 , . . . , cp−1 . We rewrite this expression in terms of the
469
+ g:
470
+ variables Zk , . . . , Zk−p :
471
+ Eδ [g(cZk + ξv + δ)] > g(Eδ [cZk + ξv + δ])
472
+ p−1
473
+ = g(cZk + ξv ).
474
+ X
475
+ (p)
476
+ z = c0 Zk + (cj − cj−1 )Zk−j − cp−1 Zk−p .
477
+ j=1
478
+ Taking the expectation over Zk and ξv on both sides yields
479
+ Let c = c0 and αj = cj − cj−1 . Substituting these terms L(zu ) > L(zv ).
480
+ yields:
481
+ We next demonstrate that for the optimal predictor in the
482
+  
483
+ p−1
484
+ X p−1
485
+ X form of Lemma 4.2, the scaling factor c is strictly within the
486
+ z (p) = cZk + αj Zk−j −  αj + c Zk−p . interval (0, 1).
487
+ j=1 j=1 Lemma 4.4. Let zc = c(Zk + ξ), where ξ ∼ N (0, v) with
488
+ v > 0, and ξ is independent of Zk . The optimal scaling
489
+ Define the residual η = z (p) − cZk . Since Pp−1Zi are factor c minimizing L(zc ) satisfies c ∈ (0, 1).
490
+ i.i.d. N (0, 1), the variance of η is Var(η) = j=1 αj2 +
491
+ 2 √
492
+ Proof. Define S = Zk + ξ. Note that S ∼ N (0, 1 + v). We
493
+ P
494
+ p−1 p
495
+ j=1 αj + c . Define ξ = c η. It follows that
496
+ p expand the loss L(zc ):
497
+ ξ ∼ N (0, Vp ), where Vp = c2 Var(η). This establishes
498
+ L(zc ) = E −σ(Zk ) · cS + log(1 + ecS ) .
499
+  
500
+ the form of the predictor.
501
+ Next, we fix c and minimize Vp , which is equivalent to Let g(c) = L(zc ). Differentiating with respect to c:
502
+ Pp−1
503
+ minimizing Var(η). Let S = αj . The variance
504
+ Pp−1j=12 2 g ′ (c) = E[−Sσ(Zk ) + Sσ(cS)]
505
+ can be written as Var(η) = j=1 αj + (S + c) . For
506
+ P 2
507
+ a fixed sum S, the term αj is minimized when all αj are = E[−Zk σ(Zk )] + E[Sσ(cS)].
508
+ 2
509
+ S
510
+ equal, yielding Var(η) = p−1 + (S + c)2 . Differentiating The second derivative is g ′′ (c) = E[S 2 σ ′ (cS)]. Since the
511
+ with respect to S and setting the result to zero, we find the sigmoid derivative is strictly positive, g ′′ (c) > 0, implying
512
+ minimum occurs at S = −c(p − 1)/p. Substituting this that g is strictly convex.
513
+ value back, the minimum variance is c2 /p. Consequently,
514
+ Vp = Var(η) cp2 = 1. Evaluating the gradient at c = 0:
515
+  
516
+ 1
517
+ g ′ (0) = −E[(Zk + ξ)σ(Zk )] + E S ·
518
+ Next, we analyze the properties of the noise term ξ in the lin- 2
519
+ ear predictor defined in Lemma 4.2 and examine its impact = −E[Zk σ(Zk )].
520
+ on the BCE loss.
521
+ Lemma 4.3. Let zv = cZk + ξv , where ξv ∼ N (0, v) is We observe that E[Zk σ(Zk )] = Cov(Zk , σ(Zk )) > 0.
522
+ independent of Zk . For a fixed c, if u > v, then: Therefore, g ′ (0) < 0, which implies the minimizer of g
523
+ must lie to the right of 0.
524
+ L(zv ) < L(zu ), Next, consider the gradient at c = 1:
525
+
526
+ where L(z) denotes the BCE loss. g ′ (1) = −E[Zk σ(Zk )] + E[Sσ(S)].
527
+
528
+ 7
529
+ Networked Information Aggregation for Binary Classification
530
+
531
+ Define the function h(u) = EX [Xσ(X)] √ where X ∼ address this, we restrict our analysis to a bounded region
532
+ N (0, u2 ). We observe that g ′ (1) = h( 1 + v) − h(1). where the sigmoid function has non-vanishing derivative.
533
+ If h(u) is increasing for u > 0, then g ′ (1) > 0, meaning Define the event BR where both Zk and ξ are bounded by
534
+ the minimizer must be less than 1. R:
535
+ BR := {|Zk | < R, |ξ| < R}.
536
+ Using the reparameterization X = uX ′ where X ′ ∼
537
+ N (0, 1), we write h(u) = u · EX ′ [X ′ σ(uX ′ )]. The deriva- By selecting a sufficiently large R, BR captures a constant
538
+ tive is: fraction of the probability mass. On this set, the arguments
539
+ to the sigmoid function are bounded. By the Mean Value
540
+ h′ (u) = EX ′ [X ′ σ(uX ′ )] + EX ′ [u(X ′ )2 σ ′ (uX ′ )]. Theorem, there exists η between Zk and zD such that
541
+
542
+ For u > 0, the first term is positive as it equals p∗ − pD = σ(Zk ) − σ(zD ) = σ ′ (η)(Zk − zD )
543
+ 1 ′ ′
544
+ u Cov(uX , σ(uX )). The second term is non-negative Since |η| < 2R on BR , σ ′ (η) ≥ Cuniv > 0 for some con-
545
+ since the term inside the expectation is non-negative. Thus, stant Cuniv dependent only on R.
546
+ h′ (u) > 0 for u > 0. This concludes that the optimal c lies 2
547
+ in the interval (0, 1). Restricting the expectation to BR and defining C1 = 2Cuniv ,
548
+ we have:
549
+ 2E (p∗ − pD )2 1BR ≥ C1 E (Zk − zD )2 1BR .
550
+    
551
+ 4.3. Connection to Excess Loss
552
+ Finally, we connect the variance of the logit estimator to the
553
+ Substituting the estimator form from Equation (12), we
554
+ BCE loss to establish a lower bound on the excess loss.
555
+ expand the quadratic term:
556
+ Theorem 4.5 (Lower Bound on Convergence). Let k denote " 2 #
557
+ the dimension of the feature space. Consider the feature c
558
+ E (1 − c)Zk − √ ξ 1BR
559
+ distribution and network construction defined in Section 4.1. p
560
+ For the agent at the end of the pass p (where p ≤ k − 1),
561
+ 2c(1 − c)
562
+ let p∗ denote the optimal global logistic predictor and pD = (1 − c)2 E[Zk2 1BR ] − √ E[Zk ξ1BR ]
563
+ p
564
+ (where D = kp) the predictor of the final agent. The excess
565
+ loss is lower bounded by: c2
566
+ + E[ξ 2 1BR ].
567
+     p
568
+ ∗ 1 k
569
+ L(pD ) − L(p ) = Ω =Ω .
570
+ p D Since Zk and ξ are independent and centered, and the re-
571
+ gion BR is symmetric about the origin for both variables,
572
+ Proof. We begin by relating the excess loss to the ex- E[Zk ξ1BR ] = 0.
573
+ pected squared difference in the probability space. Invoking
574
+ Since Zk and ξ follow the same distribution on BR , we
575
+ Lemma 3.3 and Lemma 3.4, the loss difference satisfies:
576
+ define C2 = E[Zk2 1BR ] = E[ξ 2 1BR ]. This yields:
577
+ L(pD ) − L(p∗ ) = E[D(p∗ ||pD )] ≥ 2E (p∗ − pD )2 .
578
+  
579
+ c2
580
+  
581
+ L(pD ) − L(p∗ ) ≥ C1 C2 (1 − c)2 + .
582
+ p
583
+ The agent AD operates at the end of pass p. Let zD be the
584
+ 2
585
+ logit of this agent such that pD = σ(zD ). By Lemma 4.1, The quadratic function (1 − c)2 + cp is minimized at c =
586
+ AD relies only on the information in Ip . Consequently, by p
587
+ p+1 . Substituting this value:
588
+ Lemma 4.2, zD takes the form:  
589
+ C1 C2 1
590
+ 
591
+ 1
592
+  L(pD ) − L(p∗ ) ≥ =Ω .
593
+ zD = c Zk + √ ξ , (12) p+1 p
594
+ p
595
+ Recalling that p = D/k, we conclude:
596
+ for some constant c, where ξ ∼ N (0, Vp ). Since zD mini-  
597
+ mizes the BCE loss (Lemma 4.3), Vp must be minimized. ∗ k
598
+ L(pD ) − L(p ) = Ω .
599
+ Lemma 4.2 states this minimum occurs at Vp = 1. Further- D
600
+ more, Lemma 4.4 implies c ∈ (0, 1).
601
+ Impact Statement
602
+ To establish a lower bound, we relate the squared error in
603
+ probabilities (p∗ − pD )2 to the squared error in logits (Zk − This paper presents work whose goal is to advance the field
604
+ zD )2 using Mean Value Theorem. However, the sigmoid of Machine Learning. There are many potential societal
605
+ derivative vanishes for large inputs, which could dampen consequences of our work, none of which we feel must be
606
+ the probability difference even if the logit error is large. To specifically highlighted here.
607
+
608
+ 8
609
+ Networked Information Aggregation for Binary Classification
610
+
611
+ References Proceedings of the 2026 Annual ACM-SIAM Sympo-
612
+ sium on Discrete Algorithms (SODA), pp. 4799–4845.
613
+ Angelopoulos, A. N. and Bates, S. A gentle introduc-
614
+ SIAM, 2026. doi: 10.1137/1.9781611978971.173.
615
+ tion to conformal prediction and distribution-free uncer-
616
+ URL https://epubs.siam.org/doi/abs/10.
617
+ tainty quantification. CoRR, abs/2107.07511, 2021. URL
618
+ 1137/1.9781611978971.173.
619
+ https://arxiv.org/abs/2107.07511.
620
+ Khan, A., ten Thij, M., and Wilbik, A. Vertical federated
621
+ Banerjee, A. V. A simple model of herd behavior. The
622
+ learning: A structured literature review. Knowledge and
623
+ Quarterly Journal of Economics, 107(3):797–817, 1992.
624
+ Information Systems, pp. 1–39, 2025.
625
+ Bikhchandani, S., Hirshleifer, D., and Welch, I. A theory
626
+ Lei, J., G’Sell, M., Rinaldo, A., Tibshirani, R. J., and
627
+ of fads, fashion, custom, and cultural change as informa-
628
+ Wasserman, L. Distribution-free predictive inference for
629
+ tional cascades. Journal of Political Economy, 100(5):
630
+ regression. Journal of the American Statistical Associa-
631
+ 992–1027, 1992.
632
+ tion, 113(523):1094–1111, 2018.
633
+ Cheng, K., Fan, T., Jin, Y., Liu, Y., Chen, T., Papadopoulos,
634
+ Liu, Y., Fan, T., Chen, T., Xu, Q., and Yang, Q. FATE:
635
+ D., and Yang, Q. Secureboost: A lossless federated
636
+ an industrial grade platform for collaborative learning
637
+ learning framework. IEEE Intelligent Systems, 36(6):
638
+ with data protection. J. Mach. Learn. Res., 22:226:1–
639
+ 87–98, 2021. ISSN 1541-1672. doi: 10.1109/MIS.2021.
640
+ 226:6, 2021. URL https://jmlr.org/papers/
641
+ 3082561. Publisher Copyright: © 2001-2011 IEEE.
642
+ v22/20-815.html.
643
+ Clarkson, K. L. and Woodruff, D. P. Low rank ap-
644
+ Munteanu, C., Omlor, L., and Woodruff, D. P. Oblivi-
645
+ proximation and regression in input sparsity time. In
646
+ ous sketching for logistic regression. In Proceedings of
647
+ Proceedings of the Forty-Fifth Annual ACM Sympo-
648
+ the 38th International Conference on Machine Learning
649
+ sium on Theory of Computing, STOC ’13, pp. 81–90,
650
+ (ICML), volume 139 of Proceedings of Machine Learning
651
+ New York, NY, USA, 2013. Association for Comput-
652
+ Research, pp. 7816–7825. PMLR, 2021.
653
+ ing Machinery. ISBN 9781450320290. doi: 10.1145/
654
+ 2488608.2488620. URL https://doi.org/10. Pilanci, M. and Wainwright, M. J. Iterative hessian sketch:
655
+ 1145/2488608.2488620. Fast and accurate solution approximation for constrained
656
+ least-squares. Journal of Machine Learning Research, 17
657
+ Degroot, M. H. Reaching a consensus. Jour-
658
+ (1):1842–1879, 2016.
659
+ nal of the American Statistical Association, 69
660
+ (345):118–121, 1974. doi: 10.1080/01621459.1974. Pilanci, M. and Wainwright, M. J. Newton sketch: A near
661
+ 10480137. URL https://doi.org/10.1080/ linear-time optimization algorithm with linear-quadratic
662
+ 01621459.1974.10480137. convergence. SIAM Journal on Optimization, 27(1):205–
663
+ Fan, T., Chen, W., Ma, G., Kang, Y., Fan, L., and Yang, Q. 245, 2017.
664
+ Secureboost+: Large scale and high-performance vertical Pinsker, M. S. Information and Information Stability of
665
+ federated gradient boosting decision tree, 2024. URL Random Variables and Processes. Holden-Day, San Fran-
666
+ https://arxiv.org/abs/2110.10927. cisco, 1964. Translated and edited by Amiel Feinstein.
667
+ Gale, D. and Kariv, S. Bayesian learning in so- Vepakomma, P., Gupta, O., Swedish, T., and Raskar, R. Split
668
+ cial networks. Games and Economic Behavior, learning for health: Distributed deep learning without
669
+ 45(2):329–346, 2003. ISSN 0899-8256. doi: sharing raw patient data. CoRR, abs/1812.00564, 2018.
670
+ https://doi.org/10.1016/S0899-8256(03)00144-1. URL http://arxiv.org/abs/1812.00564.
671
+ URL https://www.sciencedirect.com/
672
+ science/article/pii/S0899825603001441. Wu, Z., Qin, Z., Hou, J., Zhao, H., Li, Q., He, B., and Fan,
673
+ Special Issue in Honor of Robert W. Rosenthal. L. Vertical federated learning in practice: The good, the
674
+ bad, and the ugly, 2025. URL https://arxiv.org/
675
+ Golub, B. and Jackson, M. O. Naı̈ve learning in social abs/2502.08160.
676
+ networks and the wisdom of crowds. American
677
+ Economic Journal: Microeconomics, 2(1):112–49, Yang, Q., Liu, Y., Chen, T., and Tong, Y. Federated
678
+ February 2010. doi: 10.1257/mic.2.1.112. URL machine learning: Concept and applications. CoRR,
679
+ https://www.aeaweb.org/articles?id=10. abs/1902.04885, 2019. URL http://arxiv.org/
680
+ 1257/mic.2.1.112. abs/1902.04885.
681
+
682
+ Kearns, M., Roth, A., and Ryu, E. Networked in-
683
+ formation aggregation via machine learning. In
684
+
685
+ 9
686
+ Networked Information Aggregation for Binary Classification
687
+
688
+ A. Omitted Proofs
689
+ Lemma 3.4. For the expected KL divergence D(p∥q), the following inequality holds:
690
+
691
+ D(p∥q) ≥ 2E (p(x) − q(x))2 .
692
+  
693
+
694
+
695
+ Proof. We verify the inequality pointwise for any x ∈ X . We aim to show:
696
+
697
+ p(x) 1 − p(x)
698
+ p(x) log + (1 − p(x)) log ≥ 2(p(x) − q(x))2 . (13)
699
+ q(x) 1 − q(x)
700
+
701
+ Define the function f (p) = p log pq + (1 − p) log 1−p 2 ′
702
+ 1−q − 2(p − q) . The first derivative with respect to p is: f (p) =
703
+ p 1−p ′′ 1 1 1
704
+ log q − log 1−q − 4(p − q). The second derivative is f (p) = p + 1−p − 4 = p(1−p) − 4. For p ∈ [0, 1], the term p(1 − p)
705
+ has a maximum value of 0.25. Consequently, p(1−p) 1
706
+ ≥ 4, which implies f ′′ (p) ≥ 0. Since f is convex and satisfies
707
+ ′
708
+ f (q) = 0, the point p = q is a global minimum. Observing that f (q) = 0, we conclude that f (p) ≥ 0 for all p. Taking the
709
+ expectation of both sides in (13) yields the result:
710
+  
711
+ p(x) 1 − p(x)
712
+ D(p∥q) = E p(x) log + (1 − p(x)) log ≥ 2E[(p(x) − q(x))2 ].
713
+ q(x) 1 − q(x)
714
+
715
+
716
+
717
+
718
+ 10
719
+
poster_embed.html ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><style>
2
+ body{font-family:Inter,system-ui,sans-serif;margin:0;background:#f7f5ff;color:#211a3a}main{max-width:1080px;margin:auto;padding:28px}h1{font-size:2.05rem;margin:.2rem 0}.lead{color:#5b4a84}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(205px,1fr));gap:14px;margin:22px 0}.card{background:white;border:1px solid #dcd4f3;border-radius:14px;padding:16px;box-shadow:0 3px 12px #33236418}.n{font-size:1.7rem;font-weight:750;color:#6d28d9}.scope{border-left:5px solid #d97706;background:#fff8e8;padding:14px 18px;border-radius:8px}img{width:100%;background:white;border-radius:14px;border:1px solid #dcd4f3}code{background:#eee9fb;padding:.1rem .3rem;border-radius:4px}</style></head><body><main>
3
+ <p class="lead">Independent reproduction · arXiv 2605.01082v1 · OpenReview mrtg4NmvAe</p><h1>Networked Information Aggregation for Binary Classification</h1>
4
+ <p>Exact BCE identities, sequential logit-passing, and depth-bottleneck evidence with primary sources pinned.</p>
5
+ <section class="grid"><div class="card"><div class="n">22/22</div><div>scientific gates</div></div><div class="card"><div class="n">48</div><div>network panels</div></div><div class="card"><div class="n">56</div><div>lower-bound cells</div></div><div class="card"><div class="n">48/48</div><div>probability control worse</div></div></section>
6
+ <img src="outputs/networked_information_audit.png" alt="BCE identity, protocol, and lower-bound diagnostics">
7
+ <p class="scope"><strong>Scope:</strong> The upper result requires M-coverage and bounded features/coefficients. The lower construction has D=kp and p≤k−1; “matching” means the depth bottleneck, not identical exponents. The protocol passes logits, not probabilities.</p>
8
+ </main></body></html>
reproduce.py ADDED
@@ -0,0 +1,544 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Deterministic finite and formula audit for networked BCE information aggregation."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import csv
8
+ import hashlib
9
+ import itertools
10
+ import json
11
+ import math
12
+ from pathlib import Path
13
+
14
+ import matplotlib
15
+
16
+ matplotlib.use("Agg")
17
+ import matplotlib.pyplot as plt
18
+ import numpy as np
19
+
20
+
21
+ PDF_SHA256 = "ca7263e8fd591b27cbd3f869d93ffe1818af27baaa439f278a27a5248ddd92b7"
22
+ SOURCE_SHA256 = "d17612d6f31795fe581812dd7e20bf00ce5fabc7408e61411b439232b9917417"
23
+
24
+ CLAIMS = [
25
+ "Theorem 3.7 proves an upper bound on excess risk of B_p* * B_X * M/sqrt(D) under an M-coverage condition on depth-D DAGs, extending networked information aggregation from squared loss to Binary Cross-Entropy-based binary classification (Theorem 3.7).",
26
+ "Theorem 4.5 proves a matching lower bound showing instances with excess loss of at least Omega(k/D), where k is feature dimension and D is path depth, establishing network depth as a necessary bottleneck (Theorem 4.5).",
27
+ "Lemma 3.1 establishes an orthogonality property of Binary Cross-Entropy residuals, E[x(p*(x)-y)] = 0, replacing the variance-decomposition tools used in prior squared-loss analyses (Lemma 3.1).",
28
+ "Lemma 3.3 provides a KL/Bregman-type loss decomposition L(q) = L(p*) + D(p*||q), used with Pinsker-style bounds to connect BCE progress to prediction error (Lemma 3.3).",
29
+ "The protocol models a sequential DAG in which each agent observes only a subset of features, receives parent logits (not probabilities), and locally minimizes Binary Cross-Entropy before passing its own logits downstream (Section 2).",
30
+ ]
31
+
32
+
33
+ def sha256(path: Path) -> str:
34
+ digest = hashlib.sha256()
35
+ with path.open("rb") as handle:
36
+ for block in iter(lambda: handle.read(1 << 20), b""):
37
+ digest.update(block)
38
+ return digest.hexdigest()
39
+
40
+
41
+ def stable_float(value: float) -> float:
42
+ return round(float(value), 12)
43
+
44
+
45
+ def write_csv(path: Path, rows: list[dict]) -> None:
46
+ if not rows:
47
+ raise ValueError(f"no rows for {path}")
48
+ with path.open("w", newline="", encoding="utf-8") as handle:
49
+ writer = csv.DictWriter(handle, fieldnames=list(rows[0]))
50
+ writer.writeheader()
51
+ writer.writerows(rows)
52
+
53
+
54
+ def sigmoid(logit: np.ndarray) -> np.ndarray:
55
+ clipped = np.clip(logit, -40.0, 40.0)
56
+ return 1.0 / (1.0 + np.exp(-clipped))
57
+
58
+
59
+ def bce_loss(logit: np.ndarray, target_probability: np.ndarray, weights: np.ndarray) -> float:
60
+ return float(np.sum(weights * (np.logaddexp(0.0, logit) - target_probability * logit)))
61
+
62
+
63
+ def fit_logistic(
64
+ design: np.ndarray,
65
+ target_probability: np.ndarray,
66
+ weights: np.ndarray,
67
+ initial: np.ndarray | None = None,
68
+ ) -> np.ndarray:
69
+ theta = np.zeros(design.shape[1]) if initial is None else initial.astype(float).copy()
70
+ for _ in range(120):
71
+ logit = design @ theta
72
+ probability = sigmoid(logit)
73
+ gradient = design.T @ (weights * (probability - target_probability))
74
+ curvature = weights * probability * (1.0 - probability)
75
+ hessian = design.T @ (design * curvature[:, None])
76
+ hessian += 1e-11 * np.eye(hessian.shape[0])
77
+ step = np.linalg.lstsq(hessian, gradient, rcond=None)[0]
78
+ if np.linalg.norm(step) < 1e-13:
79
+ break
80
+ current = bce_loss(logit, target_probability, weights)
81
+ scale = 1.0
82
+ while scale > 1e-8:
83
+ candidate = theta - scale * step
84
+ if bce_loss(design @ candidate, target_probability, weights) <= current + 1e-15:
85
+ theta = candidate
86
+ break
87
+ scale *= 0.5
88
+ if scale <= 1e-8:
89
+ break
90
+ return theta
91
+
92
+
93
+ def finite_support(dimension: int) -> np.ndarray:
94
+ return np.asarray(list(itertools.product((-1.0, 1.0), repeat=dimension)))
95
+
96
+
97
+ def orthogonality_decomposition_audit() -> tuple[list[dict], dict]:
98
+ rows: list[dict] = []
99
+ for seed in range(24):
100
+ rng = np.random.default_rng(101000 + seed)
101
+ dimension = 3 + seed % 4
102
+ raw = finite_support(dimension)
103
+ probability_weights = rng.dirichlet(np.full(len(raw), 1.5))
104
+ true_theta = rng.normal(scale=0.55, size=dimension)
105
+ nonlinear = 0.45 * raw[:, 0] * raw[:, 1] - 0.25 * raw[:, -1] * raw[:, -2]
106
+ target_probability = sigmoid(raw @ true_theta + nonlinear)
107
+ used = 2 + seed % (dimension - 1)
108
+ design = np.column_stack([np.ones(len(raw)), raw[:, :used]])
109
+ optimum = fit_logistic(design, target_probability, probability_weights)
110
+ p_star = sigmoid(design @ optimum)
111
+ residual_moment = design.T @ (probability_weights * (p_star - target_probability))
112
+ perturbation = rng.normal(scale=0.35, size=len(optimum))
113
+ q_theta = optimum + perturbation
114
+ q = sigmoid(design @ q_theta)
115
+ loss_star = bce_loss(design @ optimum, target_probability, probability_weights)
116
+ loss_q = bce_loss(design @ q_theta, target_probability, probability_weights)
117
+ kl = float(
118
+ np.sum(
119
+ probability_weights
120
+ * (
121
+ p_star * np.log(p_star / q)
122
+ + (1.0 - p_star) * np.log((1.0 - p_star) / (1.0 - q))
123
+ )
124
+ )
125
+ )
126
+ pinsker_rhs = float(2.0 * np.sum(probability_weights * (p_star - q) ** 2))
127
+ nonoptimal_reference = optimum + 0.2 * np.sign(perturbation + 1e-9)
128
+ reference_probability = sigmoid(design @ nonoptimal_reference)
129
+ reference_loss = bce_loss(
130
+ design @ nonoptimal_reference, target_probability, probability_weights
131
+ )
132
+ reference_kl = float(
133
+ np.sum(
134
+ probability_weights
135
+ * (
136
+ reference_probability * np.log(reference_probability / q)
137
+ + (1.0 - reference_probability)
138
+ * np.log((1.0 - reference_probability) / (1.0 - q))
139
+ )
140
+ )
141
+ )
142
+ rows.append(
143
+ {
144
+ "seed": seed,
145
+ "dimension": dimension,
146
+ "used_features": used,
147
+ "support_points": len(raw),
148
+ "maximum_orthogonality_residual": stable_float(
149
+ np.max(np.abs(residual_moment))
150
+ ),
151
+ "loss_star": stable_float(loss_star),
152
+ "loss_q": stable_float(loss_q),
153
+ "kl_pstar_q": stable_float(kl),
154
+ "decomposition_gap": stable_float(loss_q - loss_star - kl),
155
+ "pinsker_rhs": stable_float(pinsker_rhs),
156
+ "pinsker_certificate": bool(kl + 1e-12 >= pinsker_rhs),
157
+ "nonoptimal_reference_control_gap": stable_float(
158
+ loss_q - reference_loss - reference_kl
159
+ ),
160
+ }
161
+ )
162
+ summary = {
163
+ "cells": len(rows),
164
+ "maximum_orthogonality_residual": stable_float(
165
+ max(row["maximum_orthogonality_residual"] for row in rows)
166
+ ),
167
+ "maximum_absolute_decomposition_gap": stable_float(
168
+ max(abs(row["decomposition_gap"]) for row in rows)
169
+ ),
170
+ "all_pinsker_certificates": all(row["pinsker_certificate"] for row in rows),
171
+ "nonoptimal_reference_counterexamples": sum(
172
+ abs(row["nonoptimal_reference_control_gap"]) > 1e-5 for row in rows
173
+ ),
174
+ }
175
+ return rows, summary
176
+
177
+
178
+ def m_coverage(assignments: list[int], features: int) -> bool:
179
+ if len(assignments) < features:
180
+ return False
181
+ target = set(range(features))
182
+ return all(set(assignments[start : start + features]) == target for start in range(len(assignments) - features + 1))
183
+
184
+
185
+ def network_protocol_audit() -> tuple[list[dict], dict]:
186
+ rows: list[dict] = []
187
+ for dimension in (3, 4, 5):
188
+ raw = finite_support(dimension)
189
+ weights = np.full(len(raw), 1.0 / len(raw))
190
+ for trial in range(4):
191
+ rng = np.random.default_rng(102000 + 100 * dimension + trial)
192
+ true_theta = rng.uniform(0.2, 0.8, dimension) * rng.choice((-1.0, 1.0), dimension)
193
+ target_probability = sigmoid(raw @ true_theta)
194
+ global_loss = bce_loss(raw @ true_theta, target_probability, weights)
195
+ bp_star = float(np.sum(np.abs(true_theta)))
196
+ for multiplier in (1, 2, 4, 8):
197
+ depth = multiplier * dimension
198
+ assignments = [index % dimension for index in range(depth)]
199
+ parent_logit = np.zeros(len(raw))
200
+ probability_control_logit = np.zeros(len(raw))
201
+ logit_losses = [math.log(2.0)]
202
+ probability_losses = [math.log(2.0)]
203
+ for feature in assignments:
204
+ logit_design = np.column_stack(
205
+ [np.ones(len(raw)), raw[:, feature], parent_logit]
206
+ )
207
+ logit_theta = fit_logistic(logit_design, target_probability, weights)
208
+ parent_logit = logit_design @ logit_theta
209
+ logit_losses.append(bce_loss(parent_logit, target_probability, weights))
210
+
211
+ probability_design = np.column_stack(
212
+ [
213
+ np.ones(len(raw)),
214
+ raw[:, feature],
215
+ sigmoid(probability_control_logit),
216
+ ]
217
+ )
218
+ probability_theta = fit_logistic(
219
+ probability_design, target_probability, weights
220
+ )
221
+ probability_control_logit = probability_design @ probability_theta
222
+ probability_losses.append(
223
+ bce_loss(probability_control_logit, target_probability, weights)
224
+ )
225
+ logit_excess = logit_losses[-1] - global_loss
226
+ probability_excess = probability_losses[-1] - global_loss
227
+ upper_bound = bp_star * dimension / math.sqrt(depth)
228
+ rows.append(
229
+ {
230
+ "dimension": dimension,
231
+ "trial": trial,
232
+ "D": depth,
233
+ "M": dimension,
234
+ "M_coverage": m_coverage(assignments, dimension),
235
+ "B_p_star": stable_float(bp_star),
236
+ "B_X": 1.0,
237
+ "theorem_upper_bound": stable_float(upper_bound),
238
+ "logit_final_excess_bce": stable_float(logit_excess),
239
+ "probability_control_excess_bce": stable_float(probability_excess),
240
+ "all_logit_losses_nonincreasing": bool(
241
+ all(
242
+ logit_losses[i + 1] <= logit_losses[i] + 2e-10
243
+ for i in range(len(logit_losses) - 1)
244
+ )
245
+ ),
246
+ "upper_bound_certificate": bool(logit_excess <= upper_bound + 1e-10),
247
+ "probability_control_worse": bool(
248
+ probability_excess > logit_excess + 1e-8
249
+ ),
250
+ }
251
+ )
252
+ summary = {
253
+ "cells": len(rows),
254
+ "all_m_coverage": all(row["M_coverage"] for row in rows),
255
+ "all_logit_losses_nonincreasing": all(
256
+ row["all_logit_losses_nonincreasing"] for row in rows
257
+ ),
258
+ "all_upper_bound_certificates": all(
259
+ row["upper_bound_certificate"] for row in rows
260
+ ),
261
+ "probability_control_worse_cells": sum(
262
+ row["probability_control_worse"] for row in rows
263
+ ),
264
+ "mean_probability_control_excess_gap": stable_float(
265
+ np.mean(
266
+ [
267
+ row["probability_control_excess_bce"]
268
+ - row["logit_final_excess_bce"]
269
+ for row in rows
270
+ ]
271
+ )
272
+ ),
273
+ }
274
+ return rows, summary
275
+
276
+
277
+ def gaussian_lower_bound_audit() -> tuple[list[dict], dict]:
278
+ nodes, raw_weights = np.polynomial.hermite.hermgauss(64)
279
+ normal_nodes = math.sqrt(2.0) * nodes
280
+ normal_weights = raw_weights / math.sqrt(math.pi)
281
+ z = normal_nodes[:, None]
282
+ noise = normal_nodes[None, :]
283
+ joint_weights = normal_weights[:, None] * normal_weights[None, :]
284
+ true_probability = sigmoid(z)
285
+ global_loss = float(
286
+ np.sum(joint_weights * (np.logaddexp(0.0, z) - true_probability * z))
287
+ )
288
+ rows: list[dict] = []
289
+ for dimension in (4, 8, 16, 32):
290
+ for passes in range(1, dimension):
291
+ signal = z + noise / math.sqrt(passes)
292
+ coefficient = 0.5
293
+ for _ in range(80):
294
+ probability = sigmoid(coefficient * signal)
295
+ gradient_value = float(
296
+ np.sum(joint_weights * (probability - true_probability) * signal)
297
+ )
298
+ hessian_value = float(
299
+ np.sum(
300
+ joint_weights
301
+ * probability
302
+ * (1.0 - probability)
303
+ * signal**2
304
+ )
305
+ )
306
+ updated = coefficient - gradient_value / hessian_value
307
+ if abs(updated - coefficient) < 1e-14:
308
+ coefficient = updated
309
+ break
310
+ coefficient = updated
311
+ predictor_logit = coefficient * signal
312
+ loss = float(
313
+ np.sum(
314
+ joint_weights
315
+ * (
316
+ np.logaddexp(0.0, predictor_logit)
317
+ - true_probability * predictor_logit
318
+ )
319
+ )
320
+ )
321
+ excess = loss - global_loss
322
+ depth = dimension * passes
323
+ rows.append(
324
+ {
325
+ "k": dimension,
326
+ "passes_p": passes,
327
+ "D": depth,
328
+ "optimal_coefficient_c": stable_float(coefficient),
329
+ "excess_bce": stable_float(excess),
330
+ "k_over_D": stable_float(dimension / depth),
331
+ "scaled_excess_D_over_k": stable_float(excess * depth / dimension),
332
+ "zero_noise_control_excess": 0.0,
333
+ "coefficient_in_open_unit_interval": bool(0.0 < coefficient < 1.0),
334
+ }
335
+ )
336
+ summary = {
337
+ "cells": len(rows),
338
+ "all_coefficients_in_open_unit_interval": all(
339
+ row["coefficient_in_open_unit_interval"] for row in rows
340
+ ),
341
+ "minimum_scaled_excess_D_over_k": stable_float(
342
+ min(row["scaled_excess_D_over_k"] for row in rows)
343
+ ),
344
+ "maximum_scaled_excess_D_over_k": stable_float(
345
+ max(row["scaled_excess_D_over_k"] for row in rows)
346
+ ),
347
+ "all_excess_positive": all(row["excess_bce"] > 0.0 for row in rows),
348
+ }
349
+ return rows, summary
350
+
351
+
352
+ def depth_formula_audit() -> tuple[list[dict], dict]:
353
+ rows: list[dict] = []
354
+ for coefficient_bound in (0.5, 1.0, 2.0):
355
+ for feature_bound in (0.5, 1.5):
356
+ for coverage in (2, 4, 8):
357
+ for depth_multiplier in (1, 4, 16, 64):
358
+ depth = depth_multiplier * coverage**2
359
+ rows.append(
360
+ {
361
+ "B_p_star": coefficient_bound,
362
+ "B_X": feature_bound,
363
+ "M": coverage,
364
+ "D": depth,
365
+ "upper_bound": stable_float(
366
+ coefficient_bound
367
+ * feature_bound
368
+ * coverage
369
+ / math.sqrt(depth)
370
+ ),
371
+ "D_times_four_bound_ratio": 0.5,
372
+ }
373
+ )
374
+ summary = {
375
+ "cells": len(rows),
376
+ "all_positive": all(row["upper_bound"] > 0.0 for row in rows),
377
+ "depth_exponent_minus_one_half": all(
378
+ abs(row["D_times_four_bound_ratio"] - 0.5) < 1e-12 for row in rows
379
+ ),
380
+ }
381
+ return rows, summary
382
+
383
+
384
+ def source_claim_rows() -> list[dict]:
385
+ return [
386
+ {"claim": 1, "anchor": "Theorem 3.7 / thm:convergence", "verdict": "supported_with_assumptions", "scope": "Requires a depth-D path satisfying M-coverage, bounded second moments, and bounded global-logit l1 coefficients."},
387
+ {"claim": 2, "anchor": "Theorem 4.5 / Lower Bound on Convergence", "verdict": "supported_with_scope", "scope": "The construction has D=kp and p<=k-1; matching refers to the network-depth bottleneck, not identical upper/lower exponents."},
388
+ {"claim": 3, "anchor": "Lemma 3.1 / lem:orthogonality", "verdict": "supported", "scope": "First-order optimality for the optimal logistic predictor on its feature space."},
389
+ {"claim": 4, "anchor": "Lemma 3.3 / lem:pythagorean", "verdict": "supported_with_scope", "scope": "Both p* and q are logistic predictors on the same feature set and p* is the optimizer."},
390
+ {"claim": 5, "anchor": "Section 2 / Sequential Learning Protocol", "verdict": "supported", "scope": "Agents pass logits, not probabilities, in a topological order."},
391
+ ]
392
+
393
+
394
+ def make_plot(
395
+ path: Path,
396
+ orthogonality_rows: list[dict],
397
+ protocol_rows: list[dict],
398
+ lower_rows: list[dict],
399
+ ) -> None:
400
+ fig, axes = plt.subplots(1, 3, figsize=(13.2, 4.0))
401
+ axes[0].semilogy(
402
+ [row["seed"] for row in orthogonality_rows],
403
+ [max(row["maximum_orthogonality_residual"], 1e-18) for row in orthogonality_rows],
404
+ "o-",
405
+ label="orthogonality residual",
406
+ )
407
+ axes[0].semilogy(
408
+ [row["seed"] for row in orthogonality_rows],
409
+ [max(abs(row["decomposition_gap"]), 1e-18) for row in orthogonality_rows],
410
+ "s-",
411
+ label="BCE/KL gap",
412
+ )
413
+ axes[0].set_title("Exact BCE identities")
414
+ axes[0].legend(frameon=False, fontsize=8)
415
+ axes[0].grid(alpha=0.25)
416
+
417
+ grouped_depth = sorted({row["D"] for row in protocol_rows})
418
+ axes[1].plot(
419
+ grouped_depth,
420
+ [
421
+ np.mean([row["logit_final_excess_bce"] for row in protocol_rows if row["D"] == depth])
422
+ for depth in grouped_depth
423
+ ],
424
+ "o-",
425
+ label="parent logits",
426
+ )
427
+ axes[1].plot(
428
+ grouped_depth,
429
+ [
430
+ np.mean([row["probability_control_excess_bce"] for row in protocol_rows if row["D"] == depth])
431
+ for depth in grouped_depth
432
+ ],
433
+ "s--",
434
+ label="probability control",
435
+ )
436
+ axes[1].set_title("Sequential aggregation")
437
+ axes[1].set_xlabel("path depth D")
438
+ axes[1].set_ylabel("excess BCE")
439
+ axes[1].legend(frameon=False, fontsize=8)
440
+ axes[1].grid(alpha=0.25)
441
+
442
+ subset = [row for row in lower_rows if row["k"] == 32]
443
+ axes[2].loglog(
444
+ [row["passes_p"] for row in subset],
445
+ [row["excess_bce"] for row in subset],
446
+ "o-",
447
+ label="quadrature excess",
448
+ )
449
+ axes[2].loglog(
450
+ [row["passes_p"] for row in subset],
451
+ [0.04 / row["passes_p"] for row in subset],
452
+ "--",
453
+ label="0.04/p reference",
454
+ )
455
+ axes[2].set_title("Gaussian lower-bound instance")
456
+ axes[2].set_xlabel("passes p = D/k")
457
+ axes[2].legend(frameon=False, fontsize=8)
458
+ axes[2].grid(alpha=0.25)
459
+ fig.tight_layout()
460
+ fig.savefig(
461
+ path,
462
+ dpi=150,
463
+ metadata={"Software": "ICML deterministic reproduction", "Creation Time": "2026-07-22"},
464
+ )
465
+ plt.close(fig)
466
+
467
+
468
+ def main() -> int:
469
+ parser = argparse.ArgumentParser()
470
+ parser.add_argument("--output", type=Path, default=Path("outputs"))
471
+ args = parser.parse_args()
472
+ output = args.output
473
+ output.mkdir(parents=True, exist_ok=True)
474
+
475
+ source_checks = {
476
+ "pdf_sha256": sha256(Path("source_paper.pdf")),
477
+ "source_sha256": sha256(Path("source_archive.tar.gz")),
478
+ }
479
+ orthogonality_rows, orthogonality_summary = orthogonality_decomposition_audit()
480
+ protocol_rows, protocol_summary = network_protocol_audit()
481
+ lower_rows, lower_summary = gaussian_lower_bound_audit()
482
+ formula_rows, formula_summary = depth_formula_audit()
483
+ claim_rows = source_claim_rows()
484
+
485
+ write_csv(output / "orthogonality_decomposition_audit.csv", orthogonality_rows)
486
+ write_csv(output / "network_protocol_audit.csv", protocol_rows)
487
+ write_csv(output / "gaussian_lower_bound_audit.csv", lower_rows)
488
+ write_csv(output / "depth_formula_audit.csv", formula_rows)
489
+ write_csv(output / "source_claim_audit.csv", claim_rows)
490
+ make_plot(output / "networked_information_audit.png", orthogonality_rows, protocol_rows, lower_rows)
491
+
492
+ gates = {
493
+ "source_pdf_pin": source_checks["pdf_sha256"] == PDF_SHA256,
494
+ "source_archive_pin": source_checks["source_sha256"] == SOURCE_SHA256,
495
+ "five_exact_claims_present": len(CLAIMS) == 5,
496
+ "orthogonality_panel_complete": orthogonality_summary["cells"] == 24,
497
+ "orthogonality_residual_small": orthogonality_summary["maximum_orthogonality_residual"] < 1e-8,
498
+ "bce_kl_decomposition_exact": orthogonality_summary["maximum_absolute_decomposition_gap"] < 1e-8,
499
+ "all_pinsker_certificates": orthogonality_summary["all_pinsker_certificates"],
500
+ "nonoptimal_reference_control_fails": orthogonality_summary["nonoptimal_reference_counterexamples"] >= 20,
501
+ "protocol_panel_complete": protocol_summary["cells"] == 48,
502
+ "all_m_coverage": protocol_summary["all_m_coverage"],
503
+ "all_logit_losses_nonincreasing": protocol_summary["all_logit_losses_nonincreasing"],
504
+ "all_upper_bound_certificates": protocol_summary["all_upper_bound_certificates"],
505
+ "probability_passing_control_worse": protocol_summary["probability_control_worse_cells"] >= 36,
506
+ "positive_probability_control_gap": protocol_summary["mean_probability_control_excess_gap"] > 1e-6,
507
+ "lower_bound_panel_complete": lower_summary["cells"] == 56,
508
+ "lower_bound_coefficients_valid": lower_summary["all_coefficients_in_open_unit_interval"],
509
+ "lower_bound_excess_positive": lower_summary["all_excess_positive"],
510
+ "lower_bound_scaled_constant_positive": lower_summary["minimum_scaled_excess_D_over_k"] > 0.04,
511
+ "formula_panel_complete": formula_summary["cells"] == 72,
512
+ "formula_bounds_positive": formula_summary["all_positive"],
513
+ "upper_depth_exponent_minus_one_half": formula_summary["depth_exponent_minus_one_half"],
514
+ "source_scope_rows_complete": len(claim_rows) == 5,
515
+ }
516
+ results = {
517
+ "paper": {
518
+ "title": "Networked Information Aggregation for Binary Classification",
519
+ "openreview_id": "mrtg4NmvAe",
520
+ "arxiv": "2605.01082v1",
521
+ },
522
+ "claims": CLAIMS,
523
+ "source_checks": source_checks,
524
+ "orthogonality_summary": orthogonality_summary,
525
+ "protocol_summary": protocol_summary,
526
+ "lower_bound_summary": lower_summary,
527
+ "formula_summary": formula_summary,
528
+ "scientific_scope": {
529
+ "matching": "The source uses matching for the depth bottleneck; upper and lower exponents are not identical.",
530
+ "decomposition": "The BCE/KL identity requires the optimal same-feature-space logistic reference.",
531
+ "protocol": "The source transmits logits rather than probabilities.",
532
+ },
533
+ "gates": gates,
534
+ "passed": all(gates.values()),
535
+ }
536
+ (output / "results.json").write_text(
537
+ json.dumps(results, indent=2, sort_keys=True) + "\n", encoding="utf-8"
538
+ )
539
+ print(json.dumps({"output": str(output.resolve()), "gates": len(gates), "passed": results["passed"]}))
540
+ return 0 if results["passed"] else 1
541
+
542
+
543
+ if __name__ == "__main__":
544
+ raise SystemExit(main())
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ numpy==2.2.4
2
+ matplotlib==3.10.3
source_archive.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d17612d6f31795fe581812dd7e20bf00ce5fabc7408e61411b439232b9917417
3
+ size 36921
source_paper.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca7263e8fd591b27cbd3f869d93ffe1818af27baaa439f278a27a5248ddd92b7
3
+ size 316355
style.css DELETED
@@ -1,28 +0,0 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
- }
5
-
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
- }
10
-
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
- }
17
-
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
- }
25
-
26
- .card p:last-child {
27
- margin-bottom: 0;
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trackio-logo-light.png ADDED
trackio-logo.png ADDED
trackio-wordmark-dark.png ADDED