nx_mediaflow_lib.nx
buildroot/runtime/nx_mediaflow_lib.nx
about
nx_mediaflow_lib.nx -- aesthetictwin AT36 (2026-09-17): THE MEDIA WORKFLOW COMPILED TO ONE CALL. Operator: "work should
just be composable orchestrated mcp and apis and workflows and agents with a focus to 1 2 3 step optimization ... an
optimized path on repeatable work to get steps to results reduced". Judging one media file took five hand steps (make
the report directory, cut a one-row oracle, write plan rows, seed them, run the plan). This library compiles them:
it validates the slug, the kind and the paths AT THE BOUNDARY (they become a directory name, a store prefix and plan
columns, so a tab, a newline or a dot-dot would be an injected column, an injected STEP or an escaped directory),
makes the report directory, picks the media's own row out of a many-row oracle file and rewrites its path so the
referee can open it, and compiles the plan rows the estate's own executor (nx_plan_run) runs: vault classify, judge,
seed the asset plane, emit the page, verify the live page. WORKFLOWS STAY DATA: the rows land in
knowledge/store/plan-mediaflow-<slug>- and every step is an allowlisted tool under the tools-plane security model.
Consumers: nx_mediaflow (CLI), nx_mediaflow_gate (planted controls).
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_colread_lib.nx
imported by: nx_mediaflow.nxnx_mediaflow_gate.nx
structs
| none |
consts
| 16 | const MF_SITE_DIR: *u8 = "sites/nishifamily/compare/aesthetictwin/media/" |
| 17 | const MF_HREF_BASE: *u8 = "/compare/aesthetictwin/media/" |
| 18 | const MF_URL_BASE: *u8 = "https://nishifamily.com/compare/aesthetictwin/media/" |
| 19 | const MF_ASSET_PLANE_PRE: *u8 = "knowledge/store/asset-" |
| 20 | const MF_PLAN_PREFIX_PRE: *u8 = "knowledge/store/plan-mediaflow-" |
| 21 | const MF_PLAN_ID_PRE: *u8 = "mediaflow-" |
| 22 | const MF_ROOT_KNOWLEDGE: *u8 = "knowledge/" // the three places submitted media may be read from: the estate's |
| 23 | const MF_ROOT_TMP: *u8 = "/tmp/" // knowledge tree (the fetch and put doors land there), scratch, |
| 24 | const MF_ROOT_VAULT: *u8 = "/volume1/vault/" // and the vault itself |
| 25 | const MF_KIND_REAL: *u8 = "real" |
| 26 | const MF_KIND_GEN: *u8 = "gen" |
| 27 | const MF_NO_ORACLE: *u8 = "-" |
| 28 | const MF_EXT_NONE: *u8 = "bin" |
| 29 | const MF_SLUG_MAX: i64 = 64 |
| 30 | const MF_PATH_CAP: i64 = 1024 |
| 31 | const MF_PLAN_CAP: i64 = 8192 // five rows of at most five paths each: a derived ceiling, exceeded = refused |
| 32 | const MF_PLAN_STEPS: i64 = 5 |
| 33 | const MF_OF_FILE: i64 = 1 // the oracle row's file column (oracle|<file>|<sha>|...) |
| 34 | const MF_PIPE: i64 = 124 |
| 35 | const MF_TAB: i64 = 9 |
| 36 | const MF_NL: i64 = 10 |
| 37 | const MF_HASH: i64 = 35 |
| 38 | const MF_SLASH: i64 = 47 |
| 39 | const MF_DOT: i64 = 46 |
| 40 | const MF_DASH: i64 = 45 |
| 41 | const MF_UNDER: i64 = 95 |
| 42 | const MF_PRINT_LO: i64 = 33 // the first printable non-space byte: below it lie space, tab, newline, controls |
| 43 | const MF_DEL: i64 = 127 |
| 44 | const MF_LOWER_A: i64 = 97 |
| 45 | const MF_LOWER_Z: i64 = 122 |
| 46 | const MF_DIGIT_0: i64 = 48 |
| 47 | const MF_DIGIT_9: i64 = 57 |
| 48 | const MF_MODE755: i64 = 493 |
| 49 | const MF_MODE644: i64 = 420 |
| 50 | const MF_E_UNREADABLE: i64 = 0 - 1 |
functions
| 52 | func mf_cat(out: *u8, o: i64, s: *u8) -> i64 |
| 59 | func mf_starts(s: *u8, pre: *u8) -> i64 |
| 67 | func mf_streq(a: *u8, b: *u8) -> i64 |
| 78 | func mf_slug_ok(slug: *u8) -> i64 |
| 97 | func mf_path_ok(path: *u8) -> i64 |
| 114 | func mf_kind_ok(kind: *u8) -> i64 |
| 120 | func mf_basename(path: *u8) -> *u8 |
| 130 | func mf_ext(path: *u8) -> *u8 |
| 143 | func mf_outdir(slug: *u8, out: *u8) -> i64 |
| 150 | func mf_mkdirp(path: *u8) -> i64 |
| 172 | func mf_oracle_pick(oracle_path: *u8, media_path: *u8, out_path: *u8) -> i64 |
| 218 | func mf_tab(out: *u8, o: i64) -> i64 { out[o] = MF_TAB as u8; out[o + 1] = 0 as u8; return o + 1 } |
| 219 | func mf_nl(out: *u8, o: i64) -> i64 { out[o] = MF_NL as u8; out[o + 1] = 0 as u8; return o + 1 } |
| 221 | func mf_plan_id(slug: *u8, out: *u8) -> i64 { var o: i64 = mf_cat(out, 0, MF_PLAN_ID_PRE); o = mf_cat(out, o, slug); return o } |
| 223 | func mf_plan_prefix(slug: *u8, out: *u8) -> i64 |
| 230 | func mf_url(slug: *u8, out: *u8) -> i64 { var o: i64 = mf_cat(out, 0, MF_URL_BASE); o = mf_cat(out, o, slug); o = mf_cat(out, o, "/" as *u8); return o } |
| 233 | func mf_plan_rows(slug: *u8, media: *u8, outdir: *u8, oracle: *u8, kind: *u8, buf: *u8) -> i64 |