code wiki / _hdl_build / nx_hf_tree_parse.nx

nx_hf_tree_parse.nx

buildroot/runtime/_hdl_build/nx_hf_tree_parse.nx

4133 B87 linesdepth 2pulls 2 transitivereach 4 importersview sourcekind librarytopic hf
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_hf_tree_parse.nx nx_apertus_tree_parse.nx nx_hf_enumerate_probe.nx nx_hf_tree_parse_gate.nx nx_weights_pull_gate.nx

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

11func 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
14func hft_find(json: *u8, n: i64, from: i64, needle: *u8) -> i64
28func hft_count(json: *u8, n: i64, needle: *u8) -> i64
called by 2: mainmain
41func hft_copy_hex(json: *u8, pos: i64, n: i64, out: *u8) -> i64
called by 1: hft_lfs_oid calls 1: hft_is_hex
48func hft_copy_until(json: *u8, pos: i64, n: i64, term: i64, out: *u8) -> i64
called by 1: hft_path
55func hft_parse_uint(json: *u8, pos: i64, n: i64) -> i64
called by 1: hft_num_field
62func hft_num_field(json: *u8, n: i64, from: i64, marker: *u8) -> i64
called by 2: mainmain calls 2: hft_findhft_parse_uint
70func hft_path(json: *u8, n: i64, from: i64, out: *u8) -> i64
called by 2: mainmain calls 2: hft_findhft_copy_until
80func hft_lfs_oid(json: *u8, n: i64, from: i64, out: *u8) -> i64
called by 3: mainmainmain calls 2: hft_findhft_copy_hex