code wiki / (root) / nx_asset_ingest_real.nx

nx_asset_ingest_real.nx source

↩ module page · 76 lines · 12279 B

1// nx_asset_ingest_real.nx -- R5: POPULATE THE PRODUCTION CATALOG WITH REAL ASSETS. 2// 3// The visible-payoff ingestor: it catalogs a REAL, on-disk asset set (not fixtures) into the 4// production catalog prefix knowledge/store/asset-catalog-, so the R5 dashboard surfaces GENUINE 5// numbers. Two real asset classes are ingested, each as a unified content-addressed asset RECORD: 6// * DOC assets = the LIVE wiki pages (web_assets/*.html), machine-generated (prov_class=machine). 7// * IMAGE assets = the real generated gallery PNGs, REAL width/height from the actual IHDR. 8// 9// The read -> record -> dedup CORES live in nx_asset_ingest_lib (DRY #15) so this populator AND its 10// gate (nx_asset_ingest_real_gate) drive the SAME pipeline. This file = the slug/file list + main(). 11// IDEMPOTENT (#10): cat_ingest_cid dedups by content CID -> a re-run yields CAT_DUP for every present 12// asset and the count does not grow. ADDITIVE (#13). No hardware writes (#26). license_tier: ORIGINAL 13import "nx_syscalls.nx" 14import "nx_asset_ingest_lib.nx" 15import "nx_asset_catalog.nx" 16 17func main() -> i64 { 18 ai_w("=== ASSET INGEST REAL (R5): populate production catalog with REAL on-disk assets ===\n"); 19 ai_w(" catalog prefix="); ai_w(ai_prefix()); ai_w("\n") 20 let before: i64 = cat_count(ai_prefix()) 21 ai_w(" count BEFORE="); ai_num(before); ai_w("\n") 22 23 var new_doc: i64 = 0; var dup_doc: i64 = 0 24 var new_img: i64 = 0; var dup_img: i64 = 0 25 26 // -------- DOC assets: the live walkable wiki pages (slug, web_assets file, title, date, tags) -------- 27 var r: i64 = 0 28 r = ai_ingest_doc("start\x00" as *u8, "ai_start.html\x00" as *u8, "AI Start Here\x00" as *u8, "2026-06-16\x00" as *u8, "ecosystem,index,hub\x00" as *u8, "nx_wiki_ai_start_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 29 r = ai_ingest_doc("charter\x00" as *u8, "charter.html\x00" as *u8, "Graceful Evolution Charter\x00" as *u8, "2026-06-16\x00" as *u8, "doctrine,telos,evolution\x00" as *u8, "nx_wiki_charter_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 30 r = ai_ingest_doc("nist_stem\x00" as *u8, "nist_stem.html\x00" as *u8, "NIST STEM Capability Scorecard\x00" as *u8, "2026-06-17\x00" as *u8, "stem,education,nist\x00" as *u8, "nx_wiki_nist_stem_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 31 r = ai_ingest_doc("roadmap\x00" as *u8, "roadmap.html\x00" as *u8, "Living Roadmap\x00" as *u8, "2026-06-16\x00" as *u8, "planning,roadmap\x00" as *u8, "nx_wiki_roadmap_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 32 r = ai_ingest_doc("board\x00" as *u8, "board.html\x00" as *u8, "Live WMS Task Board\x00" as *u8, "2026-06-16\x00" as *u8, "workstreams,status,board\x00" as *u8, "nx_ws_board_html\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 33 r = ai_ingest_doc("devlog\x00" as *u8, "devlog.html\x00" as *u8, "Live Devlog\x00" as *u8, "2026-06-16\x00" as *u8, "devlog,sessions,history\x00" as *u8, "nx_wiki_devlog\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 34 r = ai_ingest_doc("econsim\x00" as *u8, "econsim_wiki.html\x00" as *u8, "EconSim\x00" as *u8, "2026-06-16\x00" as *u8, "game,econsim,simulation\x00" as *u8, "nx_econsim_wiki_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 35 r = ai_ingest_doc("products\x00" as *u8, "products.html\x00" as *u8, "Products Catalog\x00" as *u8, "2026-06-16\x00" as *u8, "catalog,products\x00" as *u8, "nx_wiki_products_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 36 r = ai_ingest_doc("genesis_genealogy\x00" as *u8, "genesis_genealogy.html\x00" as *u8, "Genesis Genealogy\x00" as *u8, "2026-06-16\x00" as *u8, "genesis,hardware,lineage\x00" as *u8, "nx_wiki_genesis_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 37 r = ai_ingest_doc("access_wall\x00" as *u8, "access_wall.html\x00" as *u8, "Access Wall\x00" as *u8, "2026-06-16\x00" as *u8, "security,zero-trust,access\x00" as *u8, "nx_wiki_access_wall_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 38 r = ai_ingest_doc("formats_uxf\x00" as *u8, "formats_uxf.html\x00" as *u8, "Unified Extensible Formats\x00" as *u8, "2026-06-16\x00" as *u8, "formats,uxf,content-addressed\x00" as *u8, "nx_wiki_formats_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 39 r = ai_ingest_doc("math_render\x00" as *u8, "math_render.html\x00" as *u8, "Math Render\x00" as *u8, "2026-06-16\x00" as *u8, "latex,mathml,math\x00" as *u8, "nx_wiki_math_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 40 r = ai_ingest_doc("media_studio\x00" as *u8, "media_studio.html\x00" as *u8, "Media Studio\x00" as *u8, "2026-06-16\x00" as *u8, "media,video,studio\x00" as *u8, "nx_wiki_media_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 41 r = ai_ingest_doc("search\x00" as *u8, "search.html\x00" as *u8, "Onsite Search\x00" as *u8, "2026-06-16\x00" as *u8, "search,bm25,index\x00" as *u8, "nx_wiki_search_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 42 r = ai_ingest_doc("substrate\x00" as *u8, "substrate.html\x00" as *u8, "Sovereign Substrate\x00" as *u8, "2026-06-16\x00" as *u8, "substrate,sovereign-stack\x00" as *u8, "nx_wiki_substrate_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 43 r = ai_ingest_doc("nishi_os\x00" as *u8, "nishi_os.html\x00" as *u8, "Nishi OS\x00" as *u8, "2026-06-16\x00" as *u8, "os,kernel,uefi\x00" as *u8, "nx_wiki_os_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 44 r = ai_ingest_doc("sovereign_email\x00" as *u8, "sovereign_email.html\x00" as *u8, "Sovereign Email\x00" as *u8, "2026-06-16\x00" as *u8, "email,smtp,protocol\x00" as *u8, "nx_wiki_email_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 45 r = ai_ingest_doc("simd_backend\x00" as *u8, "simd_backend.html\x00" as *u8, "SIMD Backend\x00" as *u8, "2026-06-16\x00" as *u8, "simd,vector,performance\x00" as *u8, "nx_wiki_simd_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 46 r = ai_ingest_doc("neural_mt\x00" as *u8, "neural_mt.html\x00" as *u8, "Neural MT\x00" as *u8, "2026-06-16\x00" as *u8, "mt,translation,neural\x00" as *u8, "nx_wiki_mt_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 47 r = ai_ingest_doc("vision_fr\x00" as *u8, "vision_fr.html\x00" as *u8, "Vision FR\x00" as *u8, "2026-06-16\x00" as *u8, "vision,facial-recognition,image\x00" as *u8, "nx_wiki_vision_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 48 r = ai_ingest_doc("voxelworld\x00" as *u8, "voxelworld.html\x00" as *u8, "Voxelworld\x00" as *u8, "2026-06-16\x00" as *u8, "game,voxel,wasm,3d\x00" as *u8, "nx_wiki_voxel_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 49 r = ai_ingest_doc("figures\x00" as *u8, "figures.html\x00" as *u8, "Figures and Charts\x00" as *u8, "2026-06-16\x00" as *u8, "figures,charts,svg,dataset\x00" as *u8, "nx_wiki_figures_page\x00" as *u8); if r == CAT_NEW() { new_doc = new_doc + 1 } else { if r == CAT_DUP() { dup_doc = dup_doc + 1 } } 50 51 // -------- IMAGE assets: real generated gallery PNGs (REAL w/h from IHDR) -------- 52 var ri: i64 = 0 53 ri = ai_ingest_image("20260612_000008_c21f8b7c_3860894667_laptop.png\x00" as *u8, "Gallery frame 000008\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 54 ri = ai_ingest_image("20260612_000030_7ce11da8_108081151_laptop.png\x00" as *u8, "Gallery frame 000030\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 55 ri = ai_ingest_image("20260612_000049_95573d30_3410048926_laptop.png\x00" as *u8, "Gallery frame 000049\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 56 ri = ai_ingest_image("20260612_000109_a67cb45f_4202568751_laptop.png\x00" as *u8, "Gallery frame 000109\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 57 ri = ai_ingest_image("20260612_000130_287bd5eb_2221482208_laptop.png\x00" as *u8, "Gallery frame 000130\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 58 ri = ai_ingest_image("20260612_000150_01e4db4b_3999093186_laptop.png\x00" as *u8, "Gallery frame 000150\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 59 ri = ai_ingest_image("20260612_000210_4ed2761a_136739329_laptop.png\x00" as *u8, "Gallery frame 000210\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 60 ri = ai_ingest_image("20260612_000230_cb793295_569217300_laptop.png\x00" as *u8, "Gallery frame 000230\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 61 ri = ai_ingest_image("20260612_000250_96655b91_3800810383_laptop.png\x00" as *u8, "Gallery frame 000250\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 62 ri = ai_ingest_image("20260612_000310_314c6ee6_1015696789_laptop.png\x00" as *u8, "Gallery frame 000310\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 63 ri = ai_ingest_image("20260612_000331_9e7362f6_652051783_laptop.png\x00" as *u8, "Gallery frame 000331\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 64 ri = ai_ingest_image("20260612_000351_b5effdb0_4023078441_laptop.png\x00" as *u8, "Gallery frame 000351\x00" as *u8, "2026-06-12\x00" as *u8, "gallery,generated,laptop\x00" as *u8); if ri == CAT_NEW() { new_img = new_img + 1 } else { if ri == CAT_DUP() { dup_img = dup_img + 1 } } 65 66 let after: i64 = cat_count(ai_prefix()) 67 ai_w("\n=== INGEST SUMMARY ===\n") 68 ai_w(" DOCS: NEW="); ai_num(new_doc); ai_w(" DUP="); ai_num(dup_doc); ai_w("\n") 69 ai_w(" IMAGES: NEW="); ai_num(new_img); ai_w(" DUP="); ai_num(dup_img); ai_w("\n") 70 ai_w(" provenance: ALL machine (docs=page-emitters, images=media-pipeline)\n") 71 ai_w(" catalog count BEFORE="); ai_num(before); ai_w(" AFTER="); ai_num(after); ai_w("\n") 72 let total_seen: i64 = new_doc + dup_doc + new_img + dup_img 73 ai_w(" assets processed="); ai_num(total_seen); ai_w("\n") 74 sys_exit(0) 75 return 0 76}