code wiki / _hdl_build / nx_site_ingest_register.nx

nx_site_ingest_register.nx source

↩ module page · 46 lines · 2730 B

1// nx_site_ingest_register.nx -- GOVERNED registration of flag-ingestible-sites + full-site auto-ingest. 2// Engineer gate = REAL re-run of /tmp/nx_site_ingest_test.sov.elf (9/9). license_tier: ORIGINAL 3import "nx_cap_register.nx" 4import "nx_syscalls.nx" 5 6const SR_IDX: i64 = 222 7const SR_LAYER: i64 = 4 // CON -- ingestion governance/orchestration 8const SR_NLAYERS: i64 = 6 9 10func sr_run_status(path: *u8) -> i64 { 11 let pid: i64 = sys_fork() 12 if pid == 0 { 13 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 14 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 15 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 16 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 17 sys_execve(path, argv, envp); sys_exit(127) 18 } 19 let st: *i64 = sys_mmap(16) as *i64 20 sys_wait4(pid, st, 0) 21 return st[0] 22} 23 24func main() -> i64 { 25 let elf: *u8 = "/tmp/nx_site_ingest_test.sov.elf" as *u8 26 let probe: i64 = sys_openat_rd(elf) 27 var present: i64 = 0 28 if probe >= 0 { present = 1; sys_close(probe) } 29 let raw: i64 = sr_run_status(elf) 30 var ran_no_signal: i64 = 0 31 if (raw % 128) == 0 { ran_no_signal = 1 } 32 var exit_ok: i64 = 0 33 if raw == 0 { exit_ok = 1 } 34 let eng: i64 = ig_engineer(present, present, ran_no_signal, exit_ok) 35 cr_w(1, "ENGINEER: site-ingest gate raw=" as *u8); cr_wn(1, raw); cr_w(1, " (0=9/9)\n" as *u8) 36 let council: i64 = ig_council(eng, 1, 1, 2) 37 let decision: i64 = ig_decision(eng, council, 1) 38 if decision != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 39 if cr_can_register(SR_LAYER, 2, SR_NLAYERS, decision) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 40 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4) 41 cr_write_entry(fd, SR_IDX, SR_LAYER, "CON SITE-INGEST -- FLAG ingestion-friendly research sites + AUTO-INGEST the full site to the local Nishi library so bot-blocking cant starve us. PERMISSION FIRST: si_robots_allows parses robots.txt Disallow rules (conservative, never ingest where disallowed); si_open_signals reads CC/arXiv/PMC/DOI/MIT/public-domain; si_ingest_verdict OK/PARTIAL/FORBIDDEN + si_flag_good_site. WHOLE-SITE: si_sitemap_url_count enumerates, fed through nx_polite_crawl (PACING is the politeness for a permitted bulk pull, NOT scarcity -- distinct from the broad multi-host crawl). LOCAL-FIRST: si_library_write mirrors each page to knowledge/library/mirror/; si_starve_proof=1 once fully mirrored (live site dark/bot-block cant starve us). 9/9 KATs incl. a real local-library write" as *u8, 2) 42 sys_close(fd) 43 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, SR_IDX); cr_w(1, " REGISTERED\n" as *u8) 44 sys_exit(0) 45 return 0 46}