code wiki / _hdl_build / nx_extract_heal.nx
nx_extract_heal.nx
buildroot/runtime/_hdl_build/nx_extract_heal.nx
about
nx_extract_heal.nx -- SELF-HEALING, ADAPTIVE media-URL recognition. The insight: make pattern recognition
DATA-DRIVEN (a pattern TABLE, not hardcoded logic), so the system can LEARN a new pattern from a failure
and ADAPT -- instead of a human editing code every time a site changes. Flow: classify via the table; on a
MISS for a URL a critic/adversary confirms IS media, LOG it + LEARN (add a pattern derived from the URL, e.g.
its CDN host) so the next URL from that source is caught. This is how "auto-heal + adapt" beats yt-dlp's
break-then-hand-patch cycle. Seeds with the same knowledge as nx_media_signal's xt_classify (now as DATA).
dependencies 2 imports · 7 importers
imports: nx_syscalls.nxnx_media_signal.nx
imported by: nx_extract_heal_gate.nxnx_extract_persist_gate.nxnx_media_adapt_gate.nxnx_media_extract.nxnx_media_nuxt_manifest_gate.nxnx_media_sniff_daemon.nxnx_sniff_faillog_gate.nx
structs
| none |
consts
| 9 | const XSIG_MAGIC_4096: i64 = 4096 |
| 10 | const XSIG_MAGIC_4095: i64 = 4095 |
| 11 | const XSIG_MAGIC_1048576: i64 = 1048576 |
| 13 | const XSIG_EXT: i64 = 1 |
| 14 | const XSIG_PATH: i64 = 2 |
| 15 | const XSIG_HOST: i64 = 3 |
| 16 | const XH_STRIDE: i64 = 5 // per-pattern: [sigtype, pat_ptr, patlen, kind, conf] |
| 17 | const XH_MAXPAT: i64 = 1024 |
functions
| 19 | func xh_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: xh_addc |
| 20 | func xh_new() -> *i64 { let t: *i64 = sys_mmap(8 * (1 + XH_MAXPAT * XH_STRIDE)) as *i64; t[0] = 0; return t } |
| 21 | func xh_add(t: *i64, sigtype: i64, pat: *u8, patlen: i64, kind: i64, conf: i64) -> i64 called by 1: xh_addc |
| 28 | func xh_addc(t: *i64, sigtype: i64, pat: *u8, kind: i64, conf: i64) -> i64 { return xh_add(t, sigtype, pat, xh_slen(pat), kind, conf) } |
| 30 | func xh_seed(t: *i64) -> i64 |
| 46 | func xh_best(t: *i64, list: *u8, listlen: i64, out: *u8, cap: i64, kind: *i64) -> i64 |
| 79 | func xh_classify(t: *i64, url: *u8, ul: i64, out_kind: *i64) -> i64 |
| 98 | func xh_host(url: *u8, ul: i64, out: *u8, cap: i64) -> i64 calls 1: xt_find |
| 112 | func xh_has_host(t: *i64, host: *u8, hl: i64) -> i64 |
| 124 | func xh_learn(t: *i64, url: *u8, ul: i64, known_kind: i64) -> i64 |
| 133 | func xh_log(logbuf: *u8, off: i64, cap: i64, url: *u8, ul: i64, reason: *u8) -> i64 |
| 145 | func xh_flush(path: *u8, logbuf: *u8, loglen: i64) -> i64 |
| 152 | func xh_putn(dst: *u8, off: i64, v: i64) -> i64 { var m: i64=v; if m==0 { dst[off]=48 as u8; return off+1 } let t: *u8=sys_mmap(24); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } var j: i64=0; while j<k { dst[off]=t[k-1-j]; off=off+1; j=j+1 } return off } |
| 154 | func xh_pint(buf: *u8, ip: *i64) -> i64 |
| 172 | func xh_save(t: *i64, path: *u8) -> i64 |
| 193 | func xh_load(t: *i64, path: *u8) -> i64 |