code wiki / (root) / nx_mediaflow_lib.nx

nx_mediaflow_lib.nx

buildroot/runtime/nx_mediaflow_lib.nx

12918 B270 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_colread_lib.nx nx_mediaflow_lib.nx nx_mediaflow.nx nx_mediaflow_gate.nx

imports: nx_syscalls.nxnx_colread_lib.nx

imported by: nx_mediaflow.nxnx_mediaflow_gate.nx

structs

none

consts

16const MF_SITE_DIR: *u8 = "sites/nishifamily/compare/aesthetictwin/media/"
17const MF_HREF_BASE: *u8 = "/compare/aesthetictwin/media/"
18const MF_URL_BASE: *u8 = "https://nishifamily.com/compare/aesthetictwin/media/"
19const MF_ASSET_PLANE_PRE: *u8 = "knowledge/store/asset-"
20const MF_PLAN_PREFIX_PRE: *u8 = "knowledge/store/plan-mediaflow-"
21const MF_PLAN_ID_PRE: *u8 = "mediaflow-"
22const MF_ROOT_KNOWLEDGE: *u8 = "knowledge/" // the three places submitted media may be read from: the estate's
23const MF_ROOT_TMP: *u8 = "/tmp/" // knowledge tree (the fetch and put doors land there), scratch,
24const MF_ROOT_VAULT: *u8 = "/volume1/vault/" // and the vault itself
25const MF_KIND_REAL: *u8 = "real"
26const MF_KIND_GEN: *u8 = "gen"
27const MF_NO_ORACLE: *u8 = "-"
28const MF_EXT_NONE: *u8 = "bin"
29const MF_SLUG_MAX: i64 = 64
30const MF_PATH_CAP: i64 = 1024
31const MF_PLAN_CAP: i64 = 8192 // five rows of at most five paths each: a derived ceiling, exceeded = refused
32const MF_PLAN_STEPS: i64 = 5
33const MF_OF_FILE: i64 = 1 // the oracle row's file column (oracle|<file>|<sha>|...)
34const MF_PIPE: i64 = 124
35const MF_TAB: i64 = 9
36const MF_NL: i64 = 10
37const MF_HASH: i64 = 35
38const MF_SLASH: i64 = 47
39const MF_DOT: i64 = 46
40const MF_DASH: i64 = 45
41const MF_UNDER: i64 = 95
42const MF_PRINT_LO: i64 = 33 // the first printable non-space byte: below it lie space, tab, newline, controls
43const MF_DEL: i64 = 127
44const MF_LOWER_A: i64 = 97
45const MF_LOWER_Z: i64 = 122
46const MF_DIGIT_0: i64 = 48
47const MF_DIGIT_9: i64 = 57
48const MF_MODE755: i64 = 493
49const MF_MODE644: i64 = 420
50const MF_E_UNREADABLE: i64 = 0 - 1

functions

52func mf_cat(out: *u8, o: i64, s: *u8) -> i64
59func mf_starts(s: *u8, pre: *u8) -> i64
67func mf_streq(a: *u8, b: *u8) -> i64
78func mf_slug_ok(slug: *u8) -> i64
97func mf_path_ok(path: *u8) -> i64
114func mf_kind_ok(kind: *u8) -> i64
120func mf_basename(path: *u8) -> *u8
130func mf_ext(path: *u8) -> *u8
143func mf_outdir(slug: *u8, out: *u8) -> i64
150func mf_mkdirp(path: *u8) -> i64
172func mf_oracle_pick(oracle_path: *u8, media_path: *u8, out_path: *u8) -> i64
218func mf_tab(out: *u8, o: i64) -> i64 { out[o] = MF_TAB as u8; out[o + 1] = 0 as u8; return o + 1 }
219func mf_nl(out: *u8, o: i64) -> i64 { out[o] = MF_NL as u8; out[o + 1] = 0 as u8; return o + 1 }
221func 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 }
223func mf_plan_prefix(slug: *u8, out: *u8) -> i64
230func 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 }
233func mf_plan_rows(slug: *u8, media: *u8, outdir: *u8, oracle: *u8, kind: *u8, buf: *u8) -> i64