code wiki / _hdl_build / nx_manga_exceed_census.nx
nx_manga_exceed_census.nx source
↩ module page · 119 lines · 13069 B
1// nx_manga_exceed_census.nx -- HONEST measured benchmark: where does the NISHI native MANGA DOWNLOAD + TRANSLATE
2// stack stand vs the best tooling (gallery-dl / mangadex-downloader / HakuNeko / Mihon / manga-image-translator =
3// the Python mm bar), grounded on the July-2026 corpus banked by nx_manga_research_fetch (knowledge/fetched/
4// mga_*.raw)? Operator 2026-07-02/03: "build it all from the hardware rung up ... s-class-exceed what we have ...
5// nishi researcher and census to beat other manga downloading tooling" + "[translate] native ... use the current
6// as a benchmark to far exceed." Verdict per axis COMPUTED by xcd_verdict(us,bar) -- NEVER asserted; AHEAD liar-
7// killed; sovereignty tagged [FLOOR]. Scale 2=full 1=partial 0=absent. Mirrors nx_reader_exceed_census.
8// This census is the R0 that makes every downloader/translator rung a MEASURED flip, not a claim.
9// license_tier: ORIGINAL expect_exit: 0
10import "nx_cms_exceed.nx" // XCD_* + xcd_verdict + xcd_referee_ok + xcd_vname + sys_* (transitive)
11
12func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
13func sn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 }
14func have(path: *u8) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0 { return 0 } sys_close(fd); return 1 }
15
16// tot: [0]=BEHIND [1]=PARITY [2]=AHEAD [3]=INVALID [4]=AHEAD-FLOOR [5]=AHEAD-CAPABILITY [6]=UNGROUNDED
17func row(dom: *u8, cap: *u8, our_c: i64, inc_c: i64, n: i64, ev: *u8, ground: *u8, floor: i64, tot: *i64) -> i64 {
18 let v: i64 = xcd_verdict(our_c, inc_c)
19 let ok: i64 = xcd_referee_ok(v, our_c, n)
20 let g: i64 = have(ground)
21 sw(" [" as *u8); sw(dom); sw("] " as *u8); sw(cap); sw(" -> " as *u8); sw(xcd_vname(v))
22 sw(" (us " as *u8); sn(our_c); sw("/" as *u8); sn(n); sw(" bar " as *u8); sn(inc_c); sw(") " as *u8); sw(ev)
23 if floor==1 { sw(" [FLOOR: sovereignty, NOT the acquisition/translation-quality gap]" as *u8) }
24 if ok==0 { sw(" <== INVALID: AHEAD without meeting all criteria (LIAR-KILL)" as *u8); tot[3]=tot[3]+1 }
25 if g==0 { sw(" [UNGROUNDED: bar not banked -- run nx_manga_research_fetch]" as *u8); tot[6]=tot[6]+1 }
26 sw("\n" as *u8)
27 if v==XCD_BEHIND { tot[0]=tot[0]+1 }
28 if v==XCD_PARITY { tot[1]=tot[1]+1 }
29 if v==XCD_AHEAD { tot[2]=tot[2]+1; if floor==1 { tot[4]=tot[4]+1 } else { tot[5]=tot[5]+1 } }
30 return 0
31}
32
33func main() -> i64 {
34 let tot: *i64 = sys_mmap(128) as *i64
35 var z: i64=0; while z<7 { tot[z]=0; z=z+1 }
36 let GDL: *u8 = "knowledge/fetched/mga_a_gallerydl.raw" as *u8
37 let MDX: *u8 = "knowledge/fetched/mga_a_mangadexdl.raw" as *u8
38 let MIH: *u8 = "knowledge/fetched/mga_a_mihon.raw" as *u8
39 let ARIA: *u8 = "knowledge/fetched/mga_a_aria2.raw" as *u8
40 let MAPI: *u8 = "knowledge/fetched/mga_b_mangadex_api.raw" as *u8
41 let REF: *u8 = "knowledge/fetched/mga_b_referer.raw" as *u8
42 let CIN: *u8 = "knowledge/fetched/mga_c_comicinfo.raw" as *u8
43 let CBZ: *u8 = "knowledge/fetched/mga_c_cbz.raw" as *u8
44 let OPD: *u8 = "knowledge/fetched/mga_c_opds.raw" as *u8
45 let MIT: *u8 = "knowledge/fetched/mga_d_manga_translator.raw" as *u8
46 let MOCR: *u8 = "knowledge/fetched/mga_d_mangaocr.raw" as *u8
47 let MOK: *u8 = "knowledge/fetched/mga_d_mokuro.raw" as *u8
48 let INP: *u8 = "knowledge/fetched/mga_d_inpainting.raw" as *u8
49 let NMT: *u8 = "knowledge/fetched/mga_d_nmt.raw" as *u8
50 let ROB: *u8 = "knowledge/fetched/mga_e_robots.raw" as *u8
51 let RL: *u8 = "knowledge/fetched/mga_e_ratelimit.raw" as *u8
52 let CAS: *u8 = "knowledge/fetched/mga_e_cas.raw" as *u8
53
54 sw("=== nx_manga_exceed_census -- NISHI native manga DOWNLOAD+TRANSLATE vs the best tooling (July 2026, corpus banked) ===\n" as *u8)
55 sw("cohort: gallery-dl . mangadex-downloader . HakuNeko/FMD2 . Mihon . aria2 . manga-image-translator (the Python mm bar) . Mokuro/manga-ocr\n" as *u8)
56 sw("verdict = xcd_verdict(us,bar) COMPUTED; AHEAD liar-killed; [FLOOR]=sovereign win. Scale 2=full 1=partial 0=absent. This is R0 -- most rows START behind (nothing built yet); each build rung FLIPS a row.\n" as *u8)
57
58 sw("\n-- A. SOVEREIGN FLOOR (real, by-construction; the moat the capability is built ON) --\n" as *u8)
59 row("FLR" as *u8, "zero-dependency acquisition: own TLS-1.3 + CA + HTML/img extract (no python/curl/gallery-dl/node)" as *u8, 2,0,2, "[ev: nx_https_fetch_follow + nx_html_extract_imgs live; cohort = python/node stacks]" as *u8, GDL, 1, tot)
60 row("FLR" as *u8, "downloads land in a PRIVATE per-user area (family privacy) -- no tool does per-user isolation" as *u8, 2,0,2, "[ev: nx_reader_library rl_may_access gate 6/6; gallery-dl/HakuNeko dump to a shared FS]" as *u8, GDL, 1, tot)
61
62 sw("\n-- B. DOWNLOAD (the acquisition axes -- R2 build target; START behind, flip as built) --\n" as *u8)
63 row("URL" as *u8, "generic chapter/gallery URL -> pages (MULTI-STRATEGY: img/lazy-data-*/srcset/JS-JSON page arrays)" as *u8, 2,2,2, "[ev: nx_img_harvest gate 5/5 (lazy+srcset+escaped-JSON, resolved+deduped+junk-filtered) wired into nx_manga_get; MEASURED 11 vs 5 pages on the same URL = the lazy-load fix; bar gallery-dl generic ~matches, has more per-site quirk breadth (R2b)]" as *u8, GDL, 0, tot)
64 row("INT" as *u8, "download INTEGRITY: every page a valid FULL file (magic+format-trailer+size+HTTP-200); never blank/truncated/false" as *u8, 2,1,2, "[ev: mg_img_complete gate + LIVE: 11/11 landed pages header+trailer verified; a truncated/blank/error-HTML body is REJECTED not saved; gallery-dl writes the received bytes, no completeness proof]" as *u8, GDL, 0, tot)
65 row("API" as *u8, "structured source APIs (nhentai gallery-PAGE parse + MangaDex at-home -> exact ordered page list + auto-title)" as *u8, 1,2,2, "{nx_manga_sites gate 8/8: nhentai PAGE-based (v1 API dead->403; parse thumbnails->full-res, LIVE 59 pages + title extracted correct) + MangaDex at-home + na_html_title auto-grab; BUT nhentai IMAGE CDN rejects our TLS ClientHello (Cloudflare anti-bot fingerprint; NX_FF_HANDSHAKE, before cert -- browsers pass, our sovereign hello dropped) -> nhentai images need TLS-impersonation/challenge-browser = R2f. MangaDex CDN + generic sites (wikimedia proven) fetch fine.}" as *u8, MAPI, 0, tot)
66 row("TTL" as *u8, "auto-grab the TITLE from the page (og:title/<title>, entity-decoded) so the operator just reads" as *u8, 2,1,2, "[ev: na_html_title gate + LIVE: extracted the full real title from the nhentai page; downloader auto-titles the book, no typing; gallery-dl needs a metadata config, we do it by default]" as *u8, MAPI, 0, tot)
67 row("BAT" as *u8, "batch: whole-series / multi-chapter queue + resume" as *u8, 0,2,2, "{bar: HakuNeko/FMD2/gallery-dl; us: none = R2c (reuse the torrent daemon's queue pattern)}" as *u8, MDX, 0, tot)
68 row("PAR" as *u8, "parallel + polite (rate-limit, referer, concurrency cap)" as *u8, 0,2,2, "{bar: aria2/gallery-dl; us: fork-per-image proven elsewhere, needs the politeness layer = R2d}" as *u8, ARIA, 0, tot)
69 row("MET" as *u8, "metadata: ComicInfo.xml + title/author/tags into the library index" as *u8, 0,2,2, "{bar: gallery-dl/Mihon ComicInfo; us: none = R2e}" as *u8, CIN, 0, tot)
70
71 sw("\n-- C. STORAGE DISCIPLINE (the operator's 'no images left' pain -- R3; our EXCEED angle) --\n" as *u8)
72 row("PAK" as *u8, "pack pages into ONE content-addressed .nmz + DELETE loose images (no sprawl)" as *u8, 0,1,2, "{bar: CBZ zip (a bag of files); us: .nmz CAS container EXISTS (SC49) but no auto-pack+clean = R3; packing+dedup EXCEEDS a plain CBZ}" as *u8, CBZ, 0, tot)
73 row("DUP" as *u8, "content-hash dedup (never store the same page/chapter twice)" as *u8, 0,1,1, "{bar: gallery-dl archive/skip; us: nx_canon_cid exists, not wired = R3}" as *u8, CAS, 0, tot)
74
75 sw("\n-- D. TRANSLATE (native, hardware-up; the Python mm = the BENCHMARK to FAR exceed) --\n" as *u8)
76 row("DET" as *u8, "text-region detection (speech-bubble / caption boxes)" as *u8, 0,2,2, "{bar: comic-text-detector; us: nx_reader_panels detects PANELS (not text yet) -> extend to text = R4a}" as *u8, MIT, 0, tot)
77 row("OCR" as *u8, "OCR the detected text (JP/CN/KR vertical + furigana)" as *u8, 0,2,2, "{bar: manga-ocr/Mokuro; us: sovereign OCR ladder (scanning stack) exists to compose = R4b}" as *u8, MOCR, 0, tot)
78 row("MT" as *u8, "machine-translate the OCR'd text (JP->EN etc)" as *u8, 0,2,2, "{bar: manga-image-translator NMT; us: sovereign neural-MT arc exists = R4c}" as *u8, NMT, 0, tot)
79 row("INP" as *u8, "inpaint the original text out of the bubble (clean plate)" as *u8, 0,2,2, "{bar: manga-image-translator inpainting; us: none = R4d}" as *u8, INP, 0, tot)
80 row("RND" as *u8, "render translated text back into the bubble (fit + stroke)" as *u8, 0,2,2, "{bar: manga2eng renderer; us: none = R4e}" as *u8, MIT, 0, tot)
81 row("OVL" as *u8, "★ SELECTABLE TEXT OVERLAY (Mokuro-style: keep the art, overlay translation on tap) = the EXCEED path" as *u8, 0,1,2, "{bar: Mokuro HTML overlay; us: our zoom viewer + panel rects are the IDEAL substrate -> overlay beats destructive re-render = R4-exceed}" as *u8, MOK, 0, tot)
82
83 sw("\n-- E. INTEROP / DELIVERY (already ours from the reader arc) --\n" as *u8)
84 row("RD" as *u8, "downloaded manga reads in the guided tiled-zoom viewer immediately" as *u8, 2,1,2, "[ev: nx_cbx_pages -> reader/<slug> -> /library/zoom LIVE; cohort downloaders have NO reader]" as *u8, MIH, 0, tot)
85 row("MOB" as *u8, "add + read on phone/laptop over the authed web edge" as *u8, 2,2,2, "[ev: nishifamily.com/library behind THE WALL, live; ~ Mihon(app)/Kavita(server)]" as *u8, MIH, 0, tot)
86
87 sw("\n=== SUMMARY ===\n" as *u8)
88 sw("AHEAD = " as *u8); sn(tot[2]); sw(" capability=" as *u8); sn(tot[5]); sw(" FLOOR=" as *u8); sn(tot[4]); sw("\n" as *u8)
89 sw("PARITY = " as *u8); sn(tot[1]); sw("\n" as *u8)
90 sw("BEHIND = " as *u8); sn(tot[0]); sw(" (the DOWNLOAD + TRANSLATE build ladder R2..R4)\n" as *u8)
91 sw("INVALID (liar-killed) = " as *u8); sn(tot[3]); sw(" UNGROUNDED = " as *u8); sn(tot[6]); sw("\n" as *u8)
92 let cells: i64 = tot[0]+tot[1]+tot[2]
93 sw("TOTAL GRADED CELLS = " as *u8); sn(cells); sw("\n" as *u8)
94
95 sw("\n-- NEG-CONTROL (must be CAUGHT) -- fabricated 'downloader already AHEAD on generic-URL acquisition' (us 0/1) -> " as *u8)
96 let neg_ok: i64 = xcd_referee_ok(XCD_AHEAD, 0, 1)
97 var neg_caught: i64 = 0
98 if neg_ok==0 { sw("REJECTED (liar-kill fired)\n" as *u8); neg_caught=1 } else { sw("ACCEPTED (BROKEN)\n" as *u8) }
99
100 sw("\n=== BUILD LADDER (hardware-rung-up; each rung FLIPS a measured row; re-run this census to prove each flip) ===\n" as *u8)
101 sw(" R2a URL->pages orchestrator (nx_manga_get): own-TLS GET -> nx_html_extract_imgs -> fork-fetch each -> nx_cbx_pages -> rl_add_personal(ukey). Flips URL. [FIRST -- gets real content into the reader]\n" as *u8)
102 sw(" R2b MangaDex API adapter (at-home page list + data-saver + referer). Flips API.\n" as *u8)
103 sw(" R2c batch queue + resume (reuse the torrent daemon's queue/keeper). Flips BAT.\n" as *u8)
104 sw(" R2d politeness (per-host rate-limit + referer header + concurrency cap). Flips PAR.\n" as *u8)
105 sw(" R2e ComicInfo.xml emit + index metadata. Flips MET.\n" as *u8)
106 sw(" R3 .nmz pack + delete loose images + nx_canon_cid dedup. Flips PAK+DUP (the storage-sprawl fix).\n" as *u8)
107 sw(" R4 TRANSLATE (native, measured vs manga-image-translator): a text-detect (extend nx_reader_panels) -> b OCR (scanning-stack) -> c NMT (neural-MT arc) -> d inpaint -> e render; ★ OVERLAY-FIRST (Mokuro-style selectable overlay on the zoom viewer) = ship readable translation SOONER + non-destructive = the exceed over destructive re-render.\n" as *u8)
108
109 sw("\n=== VERDICT ===\n" as *u8)
110 var green: i64 = 1
111 if tot[3] != 0 { green = 0 }
112 if neg_caught != 1 { green = 0 }
113 if green==1 {
114 sw("GREEN -- census honest: 0 fabricated exceeds, liar-kill armed, corpus-grounded. TRUTH: today we're AHEAD only on the SOVEREIGN FLOOR (" as *u8); sn(tot[4]); sw(") + delivery (downloaded manga reads in our live zoom viewer, which the cohort downloaders lack); BEHIND on " as *u8); sn(tot[0]); sw(" acquisition+translation axes = the R2..R4 build ladder. This R0 baseline makes every rung a measured flip.\n" as *u8)
115 return 0
116 }
117 sw("RED -- liar-kill integrity failed\n" as *u8)
118 return 1
119}