nx_refintake_lib.nx
buildroot/runtime/nx_refintake_lib.nx
about
nx_refintake_lib.nx -- REFERENCE INTAKE AS AN ESTATE CAPABILITY (aesthetictwin AT22 rp_reference_intake, 2026-09-16).
Operator: "build the collection into the nishi estate and let it do this via its capabilities" and, the same day, "build all
of these fetch capabilities in the nishi estate". A declared subject (knowledge/refintake.conf, DATA) yields mirrored pages,
discovered media links (patterns in knowledge/refintake.hosts, DATA: babepedia, Bing image search, Wikimedia Commons), mirrored
media with a licence state beside every byte, an image-magic verdict on every mirror (a bot-challenge stub can never be journaled
as a picture), and a per-subject journal. This lib is the decision core; nx_refintake is the CLI (pages, discover, mirror,
verify, and the all workflow) and nx_refintake_gate proves it on fixtures, never on the production conf and never on the network.
STANDING RULE (operator, repeated): references are usable through BETA -- fitting, testing, proposals -- and only the
production publish is gated on the licence row. licence: REVIEW beta-usable | SHIP_OK licensed | REFUSED never.
The intake measures on DECLARED MORPHOLOGY AXES only. A tag whose axis is not declared is refused BY NAME; the
intake carries no ethnic, racial or religious label of any person, because those are not measurable axes.
Composes: nx_research_fetch (mirror + PROVENANCE line), nx_tool_run (fork and capture). No hw writes (Rule 26).
license_tier: ORIGINAL
dependencies 2 imports · 3 importers
imports: nx_syscalls.nxnx_tool_run.nx
imported by: nx_refintake.nxnx_refintake_gate.nxnx_twincard_lib.nx
structs
| none |
consts
| 17 | const RI_CONF: *u8 = "knowledge/refintake.conf" |
| 18 | const RI_HOSTS: *u8 = "knowledge/refintake.hosts" |
| 19 | const RI_DIR: *u8 = "knowledge/refintake" |
| 20 | const RI_FETCHED: *u8 = "knowledge/fetched/" |
| 21 | const RI_FETCHER_OFFC: *u8 = "_offc/nx_research_fetch.elf" |
| 22 | const RI_FETCHER_HERE: *u8 = "./nx_research_fetch.elf" |
| 23 | const RI_FETCHER_UP: *u8 = "../nx_research_fetch.elf" |
| 24 | const RI_AXES: *u8 = " malar_projection bizyg_bigon midface_height canthal_tilt palpebral_fissure vthird_upper vthird_mid vthird_lower facial_index intercanthal nasal_index lip_ratio mandibular_angle whr bust_waist frame hair_length hair_curl hair_colour skin_undertone skin_tan age_at_photo " |
| 25 | const RI_HTTPS_PREFIX: *u8 = "https:" |
| 26 | const RI_NL: i64 = 10 |
| 27 | const RI_SP: i64 = 32 |
| 28 | const RI_QUOTE: i64 = 34 |
| 29 | const RI_AMP: i64 = 38 |
| 30 | const RI_PIPE: i64 = 124 |
| 31 | const RI_PCT: i64 = 37 |
| 32 | const RI_DASH: i64 = 45 |
| 33 | const RI_DOT: i64 = 46 |
| 34 | const RI_SLASH: i64 = 47 |
| 35 | const RI_LT: i64 = 60 |
| 36 | const RI_DIGIT0: i64 = 48 |
| 37 | const RI_DIGIT9: i64 = 57 |
| 38 | const RI_UNDERSCORE: i64 = 95 |
| 39 | const RI_LC_G: i64 = 103 |
| 40 | const RI_LC_N: i64 = 110 |
| 41 | const RI_LC_P: i64 = 112 |
| 42 | const RI_MODE644: i64 = 420 |
| 43 | const RI_MODE755: i64 = 493 |
| 44 | const RI_PATHB: i64 = 1024 |
| 45 | const RI_ROWB: i64 = 4096 |
| 46 | const RI_NUMB: i64 = 24 |
| 47 | const RI_CAPB: i64 = 262144 |
| 48 | const RI_I64: i64 = 8 |
| 49 | const RI_ARGV_N: i64 = 4 |
| 50 | const RI_SHA_HEX: i64 = 64 |
| 51 | const RI_PROV_PREFIX_LEN: i64 = 11 |
| 52 | const RI_HREF_LEN: i64 = 6 |
| 53 | const RI_MAGIC_N: i64 = 16 |
| 54 | const RI_OK: i64 = 0 |
| 55 | const RI_E_CONF: i64 = 0 - 3 |
| 56 | const RI_E_NOSUBJECT: i64 = 0 - 4 |
| 57 | const RI_E_REFUSED: i64 = 0 - 5 |
| 58 | const RI_E_AXIS: i64 = 0 - 6 |
| 59 | const RI_E_FETCH: i64 = 0 - 7 |
| 60 | const RI_E_NOPROV: i64 = 0 - 8 |
| 61 | const RI_STDOUT: i64 = 1 |
| 62 | const RI_F_SLUG: i64 = 1 |
| 63 | const RI_SUBJ_LIC: i64 = 3 |
| 64 | const RI_SRC_KIND: i64 = 2 |
| 65 | const RI_SRC_URL: i64 = 3 |
| 66 | const RI_SRC_MIRROR: i64 = 4 |
| 67 | const RI_SRC_DATE: i64 = 5 |
| 68 | const RI_TAG_AXIS: i64 = 2 |
| 69 | const RI_PROV_SHA: i64 = 4 |
| 70 | const RI_PROV_BYTES: i64 = 5 |
| 72 | const RI_F_HOST_PREFIX: i64 = 2 |
| 73 | const RI_F_HOST_NEEDLE: i64 = 3 |
| 74 | const RI_F_HOST_SKIP: i64 = 4 |
| 75 | const RI_F_HOST_TERM: i64 = 5 |
| 76 | const RI_F_HOST_BASE: i64 = 6 |
| 78 | const RI_IMG_UNREADABLE: i64 = 0 |
| 79 | const RI_IMG_JPEG: i64 = 1 |
| 80 | const RI_IMG_PNG: i64 = 2 |
| 81 | const RI_IMG_GIF: i64 = 3 |
| 82 | const RI_IMG_WEBP: i64 = 4 |
| 83 | const RI_IMG_HTML: i64 = 5 |
| 84 | const RI_IMG_OTHER: i64 = 6 |
| 85 | const RI_IMG_MP4: i64 = 7 |
| 86 | const RI_IMG_N: i64 = 8 |
| 88 | const RI_J_URL: i64 = 3 |
| 89 | const RI_J_PATH: i64 = 4 |
| 90 | const RI_J_STATUS: i64 = 8 |
| 590 | const RI_KVS_PREFIX: *u8 = "function/0/" |
| 591 | const RI_KVS_URL_KEY: *u8 = "video_url: '" |
| 592 | const RI_KVS_CODE_KEY: *u8 = "license_code: '" |
| 593 | const RI_KVS_HASH_LEN: i64 = 32 |
| 594 | const RI_KVS_OFFSETS: i64 = 4 |
| 595 | const RI_KVS_MOD: i64 = 10 |
| 596 | const RI_KVS_QUAD: i64 = 4 |
| 597 | const RI_KVS_APOS: i64 = 39 |
| 598 | const RI_KVS_COLON: i64 = 58 |
| 599 | const RI_KVS_MAXDIGITS: i64 = 18 |
| 600 | const RI_KVS_HASH_SLASHES: i64 = 3 |
| 601 | const RI_KVS_TOKEN_CAP: i64 = 96 |
| 602 | const RI_KVS_E_CODE: i64 = 0 - 1 |
| 603 | const RI_KVS_E_URL: i64 = 0 - 2 |
functions
| 92 | func ri_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 93 | func ri_streq(a: *u8, b: *u8) -> i64 |
| 99 | func ri_cat(d: *u8, o: i64, s: *u8) -> i64 |
| 106 | func ri_catn(d: *u8, o: i64, v: i64) -> i64 |
| 119 | func ri_puts(s: *u8) -> i64 { return sys_write(RI_STDOUT, s, ri_slen(s)) } called by 11: rc_usagerc_pagesrc_discoverrc_mirror_urlrc_mirrorrc_verify+5 calls 2: sys_writeri_slen |
| 120 | func ri_putn(v: i64) -> i64 { let b: *u8 = sys_mmap(RI_NUMB); ri_catn(b, 0, v); return ri_puts(b) } called by 8: rc_pagesrc_discoverrc_mirror_urlrc_mirrorrc_verifyrc_videos+2 calls 3: sys_mmapri_catnri_puts |
| 121 | func ri_atoi(s: *u8) -> i64 |
| 134 | func ri_line_end(buf: *u8, n: i64, i: i64) -> i64 |
| 139 | func ri_starts(buf: *u8, n: i64, i: i64, lit: *u8) -> i64 |
| 149 | func ri_prefix(s: *u8, lit: *u8) -> i64 |
| 158 | func ri_field(buf: *u8, i: i64, e: i64, idx: i64, out: *u8, cap: i64) -> i64 |
| 180 | func ri_load(path: *u8, lenp: *i64) -> *u8 called by 15: mainpm_card_writerc_load_journalrc_discoverrc_mirrorrc_videos+9 calls 1: sys_read_file |
| 186 | func ri_subject_licence(buf: *u8, n: i64, slug: *u8, lic: *u8) -> i64 |
| 204 | func ri_count_rows(buf: *u8, n: i64, kindword: *u8, slug: *u8, srckind: *u8) -> i64 |
| 225 | func ri_source_at(buf: *u8, n: i64, slug: *u8, idx: i64, kind: *u8, url: *u8, mirror: *u8, date: *u8) -> i64 called by 5: rc_pagesrc_discoverrc_mirrorrc_videosmain calls 5: sys_mmapri_line_endri_startsri_fieldri_streq |
| 249 | func ri_axis_declared(axis: *u8) -> i64 |
| 269 | func ri_tags_check(buf: *u8, n: i64, bad: *u8) -> i64 |
| 288 | func ri_has_line(buf: *u8, n: i64, s: *u8) -> i64 |
| 304 | func ri_contains(buf: *u8, n: i64, s: *u8) -> i64 |
| 318 | func ri_pattern(out: *u8, tail: *u8) -> i64 |
| 328 | func ri_discover_pat(page: *u8, n: i64, needle: *u8, skip: i64, term: *u8, base: *u8, out: *u8, cap: i64, outlen: *i64) -> i64 |
| 390 | func ri_discover(page: *u8, n: i64, host: *u8, out: *u8, cap: i64, outlen: *i64) -> i64 |
| 403 | func ri_host_at(hosts: *u8, hn: i64, url: *u8, idx: i64, needle: *u8, skipp: *i64, term: *u8, base: *u8) -> i64 |
| 429 | func ri_image_class(path: *u8) -> i64 called by 4: rc_presentrc_mirror_urlrc_verifyrc_videos calls 4: sys_openat_rdsys_mmapsys_readsys_close |
| 449 | func ri_class_word(c: i64) -> *u8 |
| 459 | func ri_is_video(c: i64) -> i64 called by 1: rc_videos |
| 463 | func ri_is_image(c: i64) -> i64 |
| 472 | func ri_prov_parse(rcpt: *u8, n: i64, sha: *u8) -> i64 |
| 490 | func ri_fetcher(out: *u8) -> i64 |
| 501 | func ri_mirror_one(url: *u8, mirror: *u8, sha: *u8, bytesp: *i64) -> i64 |
| 518 | func ri_journal_path(slug: *u8, out: *u8) -> i64 |
| 525 | func ri_sources_path(slug: *u8, out: *u8) -> i64 |
| 533 | func ri_journal(slug: *u8, url: *u8, mirror: *u8, sha: *u8, bytes: i64, lic: *u8, status: *u8) -> i64 called by 3: rc_pagesrc_mirror_urlrc_videos calls 9: sys_mkdirsys_mmapri_journal_pathri_catri_catnsys_now_realtime_sec+3 |
| 563 | func ri_mirror_name(slug: *u8, k: i64, url: *u8, out: *u8) -> i64 |
| 577 | func ri_mirror_allowed(buf: *u8, n: i64, slug: *u8) -> i64 |
| 606 | func ri_kvs_license_token(code: *u8, out: *i64, cap: i64) -> i64 |
| 650 | func ri_kvs_real_url(vurl: *u8, code: *u8, out: *u8) -> i64 |
| 708 | func ri_kvs_value(page: *u8, n: i64, key: *u8, out: *u8, cap: i64) -> i64 |
| 734 | func ri_kvs_extract(page: *u8, n: i64, vurl: *u8, code: *u8) -> i64 |