code wiki / _hdl_build / nx_hf_tree_parse.nx
nx_hf_tree_parse.nx
buildroot/runtime/_hdl_build/nx_hf_tree_parse.nx
about
nx_hf_tree_parse.nx -- LIB: parse the HuggingFace repo tree JSON (from /api/models/<repo>/tree/main?recursive=1,
after chunked_decode) into the per-file facts a VERIFIED mirror needs: path, size, and the LFS sha256 (lfs.oid).
A .safetensors weight shard entry looks like:
{"type":"file","oid":"<gitsha>","size":N,"path":"model-00001-of-00002.safetensors",
"lfs":{"oid":"<sha256-64hex>","size":N,"pointerSize":135}}
The lfs.oid IS the sha256 the mirror-orchestrator verifies each downloaded shard against (fail-closed). Pure
parsing (no crypto/TLS) -> nx_syscalls only; targeted field extraction over the structured HF shape (a full JSON
parser is overkill for this fixed schema). No 'break' (nx) -> flag-driven. license_tier: ORIGINAL
dependencies 1 imports · 4 importers
imports: nx_syscalls.nx
imported by: nx_apertus_tree_parse.nxnx_hf_enumerate_probe.nxnx_hf_tree_parse_gate.nxnx_weights_pull_gate.nx
structs
| none |
consts
| none |
functions
| 11 | func hft_is_hex(c: i64) -> i64 { if c>=48 { if c<=57 {return 1} } if c>=97 { if c<=102 {return 1} } if c>=65 { if c<=70 {return 1} } return 0 } called by 1: hft_copy_hex |
| 14 | func hft_find(json: *u8, n: i64, from: i64, needle: *u8) -> i64 |
| 28 | func hft_count(json: *u8, n: i64, needle: *u8) -> i64 |
| 41 | func hft_copy_hex(json: *u8, pos: i64, n: i64, out: *u8) -> i64 |
| 48 | func hft_copy_until(json: *u8, pos: i64, n: i64, term: i64, out: *u8) -> i64 called by 1: hft_path |
| 55 | func hft_parse_uint(json: *u8, pos: i64, n: i64) -> i64 called by 1: hft_num_field |
| 62 | func hft_num_field(json: *u8, n: i64, from: i64, marker: *u8) -> i64 |
| 70 | func hft_path(json: *u8, n: i64, from: i64, out: *u8) -> i64 |
| 80 | func hft_lfs_oid(json: *u8, n: i64, from: i64, out: *u8) -> i64 |