nx_fetch.nx
buildroot/runtime/nx_fetch.nx
about
nx_fetch.nx -- THE sovereign manifest-driven research fetcher. MERGES the N copy-pasted one-time
nx_*_research_fetch organs into ONE data-driven tool (rule 11 data-driven + rule 15 DRY): new research is a
MANIFEST ROW, never a new organ. Reads a TSV manifest (each line: url<TAB>name), and for each row:
1. ensures the raw archive knowledge/fetched/<name>.raw (fetch over sovereign TLS-1.3 if absent; idempotent),
2. strips it to clean plain text -> knowledge/library/<name>.txt (the dir the librarian nx_library_harvest_v2
walks for .txt) so it BANKS into the durable index, queryable via nx_search_cli.
Plaintext strip is purpose-fit for the index (drop tags, suppress <script>/<style>, collapse whitespace) --
NOT the browser's nx_html_to_text (which emits GUI link-markers wrong for a corpus). 100% sovereign.
usage: nx_fetch <manifest.tsv> expect_exit: 0 license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 14 | const K_MAGIC_4096: i64 = 4096 |
| 15 | const K_MAGIC_4194304: i64 = 4194304 |
| 16 | const K_MAGIC_8388608: i64 = 8388608 |
| 17 | const K_MAGIC_1024: i64 = 1024 |
functions
| 19 | func puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 20 | func putn(v: i64) -> i64 |
| 30 | func have_file(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 31 | func scat(dst: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[o + i] = s[i]; i = i + 1 } return o + i } called by 1: bpath |
| 32 | func bpath(dst: *u8, dir: *u8, name: *u8, suf: *u8) -> i64 |
| 35 | func save_file(path: *u8, buf: *u8, n: i64) -> i64 |
| 44 | func tag_eq_ci(src: *u8, off: i64, n: i64, lit: *u8, litlen: i64) -> i64 |
| 57 | func tag_is(src: *u8, off: i64, n: i64, lit: *u8, litlen: i64) -> i64 |
| 74 | func is_block_tag(src: *u8, off: i64, n: i64) -> i64 |
| 103 | func strip_html(src: *u8, n: i64, out: *u8, cap: i64) -> i64 |
| 155 | func fetch_to_lib(url: *u8, name: *u8, store: *TrustStore, out: *u8, cap: i64) -> i64 |
| 179 | func main(argc: i64, argv: *i64) -> i64 |