code wiki / (root) / nx_card_import_gate.nx

nx_card_import_gate.nx

buildroot/runtime/nx_card_import_gate.nx

13381 B181 linesdepth 5pulls 8 transitivereach 0 importersview sourcekind gate/prooftopic card
docsdependenciesstructsconstsfunctions

about

nx_card_import_gate.nx -- the REFEREE for companionchat CC2 (ccm_card_import in nx_card_compile.nx): a Tavern V2 PNG card (base64 JSON in a tEXt chunk keyed chara) imports to the card SSOT with every field MAPPED or REFUSED BY NAME, the age gate stays fail-closed (no age = refuse, under 18 = refuse, a card-declared age beats the argument), the compiled persona carries the card's own prose and NONE of the native defaults, and export round-trips the V2 source byte-stable. END-TO-END: forks the PROMOTED nx_card_compile.elf (what the operator runs), fixtures built at run time under /tmp/<gate>/ with nx_png_chunks' writer and base64.nx -- no checked-in binary fixture. license_tier: ORIGINAL expect_exit: 0

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_png_chunks.nx base64.nx nx_card_import_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nxnx_png_chunks.nxbase64.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_head gv_puts sys_write gv_ctr sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mkdir sys_unlinkat sys_mmap ↻ cg_build_png png_put_sig sys_mmap ↻ png_put_chunk cg_len b64_encode b64_enc_char cg_len ↻ cg_write sys_openat_wr sys_write ↻ sys_close gv_check gv_puts ↻ png_chunk_count png_is png_be32

structs

none

consts

13const CG_ELF: *u8 = "/volume1/homes/elderwesto/nishihost/nx_card_compile.elf" as *u8
14const CG_DIR: *u8 = "/tmp/nx_card_import_gate" as *u8
15const CG_PNG: *u8 = "/tmp/nx_card_import_gate/mira.png" as *u8
16const CG_PNG_MINOR: *u8 = "/tmp/nx_card_import_gate/minor.png" as *u8
17const CG_PNG_COMMENT: *u8 = "/tmp/nx_card_import_gate/comment.png" as *u8
18const CG_PNG_CUT: *u8 = "/tmp/nx_card_import_gate/cut.png" as *u8
19const CG_NOT_PNG: *u8 = "/tmp/nx_card_import_gate/notes.txt" as *u8
20const CG_SSOT: *u8 = "/tmp/nx_card_import_gate/elara_card.json" as *u8
21const CG_V2: *u8 = "/tmp/nx_card_import_gate/elara_card.v2.json" as *u8
22const CG_PERSONA: *u8 = "/tmp/nx_card_import_gate/elara_persona.txt" as *u8
23const CG_SSOT_BAK: *u8 = "/tmp/nx_card_import_gate/elara_card.json.bak-preimport" as *u8
24const CG_PERSONA_BAK: *u8 = "/tmp/nx_card_import_gate/elara_persona.txt.bak-precard" as *u8
25const CG_EXPORT: *u8 = "/tmp/nx_card_import_gate/exported.json" as *u8
26const CG_MODE_DIR: i64 = 511
27const CG_MODE_FILE: i64 = 420
28const CG_BUF: i64 = 65536
29const CG_OUT: i64 = 65536
30const CG_TMO_MS: i64 = 10000
31const CG_ARGV_CAP: i64 = 8
32const CG_I64: i64 = 8
33const CG_CUT_TAIL: i64 = 40
34const CG_EXIT_REFUSED: i64 = 3
35const CG_IHDR_LEN: i64 = 13
36const CG_JSON: *u8 = "{\"spec\":\"chara_card_v2\",\"spec_version\":\"2.0\",\"data\":{\"name\":\"Mira Vale\",\"description\":\"A marine biologist who lives in a lighthouse and talks to the tide.\",\"personality\":\"curious, dry-witted, gentle\",\"scenario\":\"You meet her on the pier at dusk.\",\"first_mes\":\"Oh -- you came.\",\"mes_example\":\"\",\"creator_notes\":\"fixture card\",\"system_prompt\":\"\",\"post_history_instructions\":\"\",\"alternate_greetings\":[],\"tags\":[\"scientist\",\"lighthouse\"],\"creator\":\"fixture\",\"character_version\":\"1.0\",\"extensions\":{},\"character_book\":{\"name\":\"pier lore\",\"entries\":[]}}}" as *u8
37const CG_JSON_MINOR: *u8 = "{\"spec\":\"chara_card_v2\",\"spec_version\":\"2.0\",\"data\":{\"name\":\"Too Young\",\"age\":17,\"description\":\"a fixture that must be refused\",\"personality\":\"n/a\",\"scenario\":\"n/a\",\"first_mes\":\"\",\"mes_example\":\"\",\"tags\":[]}}" as *u8
38const CG_COMMENT_TEXT: *u8 = "Comment" as *u8
39const CG_COMMENT_BODY: *u8 = "hello" as *u8

functions

41func cg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
42func cg_find(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: cg_len
56func cg_write(path: *u8, body: *u8, n: i64) -> i64
64func cg_read(path: *u8, bp: *i64) -> i64
called by 2: cg_absentmain calls 2: sys_mmapsys_read_file
72func cg_absent(path: *u8) -> i64 { let bp: *i64 = sys_mmap(16) as *i64; if cg_read(path, bp) == 0 { return 1 } return 0 }
called by 1: main calls 2: sys_mmapcg_read
74func cg_build_png(buf: *u8, keyword: *u8, payload: *u8, plen: i64, b64: i64) -> i64
94func cg_run(a1: *u8, a2: *u8, a3: *u8, a4: *u8, nargs: i64, out: *u8, olen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture_to
112func main() -> i64