nx_card_import_gate.nx
buildroot/runtime/nx_card_import_gate.nx
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
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
structs
| none |
consts
| 13 | const CG_ELF: *u8 = "/volume1/homes/elderwesto/nishihost/nx_card_compile.elf" as *u8 |
| 14 | const CG_DIR: *u8 = "/tmp/nx_card_import_gate" as *u8 |
| 15 | const CG_PNG: *u8 = "/tmp/nx_card_import_gate/mira.png" as *u8 |
| 16 | const CG_PNG_MINOR: *u8 = "/tmp/nx_card_import_gate/minor.png" as *u8 |
| 17 | const CG_PNG_COMMENT: *u8 = "/tmp/nx_card_import_gate/comment.png" as *u8 |
| 18 | const CG_PNG_CUT: *u8 = "/tmp/nx_card_import_gate/cut.png" as *u8 |
| 19 | const CG_NOT_PNG: *u8 = "/tmp/nx_card_import_gate/notes.txt" as *u8 |
| 20 | const CG_SSOT: *u8 = "/tmp/nx_card_import_gate/elara_card.json" as *u8 |
| 21 | const CG_V2: *u8 = "/tmp/nx_card_import_gate/elara_card.v2.json" as *u8 |
| 22 | const CG_PERSONA: *u8 = "/tmp/nx_card_import_gate/elara_persona.txt" as *u8 |
| 23 | const CG_SSOT_BAK: *u8 = "/tmp/nx_card_import_gate/elara_card.json.bak-preimport" as *u8 |
| 24 | const CG_PERSONA_BAK: *u8 = "/tmp/nx_card_import_gate/elara_persona.txt.bak-precard" as *u8 |
| 25 | const CG_EXPORT: *u8 = "/tmp/nx_card_import_gate/exported.json" as *u8 |
| 26 | const CG_MODE_DIR: i64 = 511 |
| 27 | const CG_MODE_FILE: i64 = 420 |
| 28 | const CG_BUF: i64 = 65536 |
| 29 | const CG_OUT: i64 = 65536 |
| 30 | const CG_TMO_MS: i64 = 10000 |
| 31 | const CG_ARGV_CAP: i64 = 8 |
| 32 | const CG_I64: i64 = 8 |
| 33 | const CG_CUT_TAIL: i64 = 40 |
| 34 | const CG_EXIT_REFUSED: i64 = 3 |
| 35 | const CG_IHDR_LEN: i64 = 13 |
| 36 | const 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 |
| 37 | const 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 |
| 38 | const CG_COMMENT_TEXT: *u8 = "Comment" as *u8 |
| 39 | const CG_COMMENT_BODY: *u8 = "hello" as *u8 |
functions
| 41 | func cg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 42 | func cg_find(buf: *u8, n: i64, needle: *u8) -> i64 |
| 56 | func cg_write(path: *u8, body: *u8, n: i64) -> i64 |
| 64 | func cg_read(path: *u8, bp: *i64) -> i64 |
| 72 | func cg_absent(path: *u8) -> i64 { let bp: *i64 = sys_mmap(16) as *i64; if cg_read(path, bp) == 0 { return 1 } return 0 } |
| 74 | func cg_build_png(buf: *u8, keyword: *u8, payload: *u8, plen: i64, b64: i64) -> i64 |
| 94 | func cg_run(a1: *u8, a2: *u8, a3: *u8, a4: *u8, nargs: i64, out: *u8, olen: *i64) -> i64 |
| 112 | func main() -> i64 |