code wiki / (root) / nx_arc.nx

nx_arc.nx

buildroot/runtime/nx_arc.nx

12812 B324 linesdepth 2pulls 2 transitivereach 5 importersview sourcekind librarytopic arc
docsdependenciesstructsconstsfunctions

about

nx_arc.nx -- canonical arc + arc-stage substrate. Arcs are the "events" of the day-as-a-movie metaphor (per cardinal feedback-arc-and-moment-are-king-cinematographer-pattern). Each arc is a sequence of stages; each stage has pools of allowed locations, outfits, poses, expressions, and camera angles from which moments are drawn. nx_moment_resolve.nx (next brick) consumes Arc + ArcStage and emits a fully-populated *DirectorsNote (from nx_directors_note.nx). === Flat-array layout pattern (per nx_canon_proportions) ============ To keep struct shapes fixed-size and avoid variable-length field pointers (which trip the substrate's <=8-arg codegen lesson), this primitive uses TWO flat i64 buffers attached to Arc: arc.stages : flat array, NX_ARC_STAGE_FIELDS i64 per stage arc.pools : flat array of pool ID values; stages reference their pools via (offset, len) indices into this buffer This is the same shape nx_canon_proportions uses for its 30-entry canon table (5 i64 per entry, accessed via nx_canon_get). === Composition ===================================================== nx_directors_note.nx -- ArcSource sealed-enum is re-exported here so the same value can flow into a DirectorsNote.source_tag nx_tier.nx -- nx_int alias nx_string_ops.nx -- (when caller wants to attach string names) genealogy_id: propp_morphology + campbell_monomyth + lindenmayer_systems + syd_field_three_act_structure lineage_id: nx_arc_v1

dependencies 2 imports · 5 importers

nx_syscalls.nx nx_tier.nx nx_arc.nx nx_arc_test.nx nx_director_pipeline.nx nx_director_pipeline_test.nx nx_moment_resolve.nx nx_moment_resolve_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_arc_test.nxnx_director_pipeline.nxnx_director_pipeline_test.nxnx_moment_resolve.nxnx_moment_resolve_test.nx

structs

134struct Arc

consts

51const NX_AS_AUTHORED: nx_int = 0 // hand-curated arc in DB
52const NX_AS_DYNAMIC: nx_int = 1 // LLM-generated from chat
53const NX_AS_GENERATED: nx_int = 2 // story-engine pre-generated
54const NX_AS_COMPANION: nx_int = 3 // companion authored her own arc
55const NX_AS_N_SOURCES: nx_int = 4
68const NX_AW_UNAWARE: nx_int = 0 // doesn't know she's seen
69const NX_AW_PEEKING: nx_int = 1 // hint of awareness
70const NX_AW_AWARE: nx_int = 2 // knows but acting natural
71const NX_AW_EYE_CONTACT: nx_int = 3 // looking at camera/viewer
72const NX_AW_DIRECT_ENGAGEMENT: nx_int = 4 // actively addressing
73const NX_AW_N_LEVELS: nx_int = 5
88const NX_ET_NEUTRAL: nx_int = 0
89const NX_ET_TENDER: nx_int = 1
90const NX_ET_PLAYFUL: nx_int = 2
91const NX_ET_INTENSE: nx_int = 3
92const NX_ET_LONGING: nx_int = 4
93const NX_ET_TRIUMPHANT: nx_int = 5
94const NX_ET_REVERENT: nx_int = 6
95const NX_ET_DOMESTIC: nx_int = 7 // mundane chores, cooking, etc.
96const NX_ET_ANTICIPATORY: nx_int = 8
97const NX_ET_AFTERGLOW: nx_int = 9
98const NX_ET_N_TONES: nx_int = 10
111const NX_AST_F_STAGE_NUMBER: nx_int = 0
112const NX_AST_F_AWARENESS: nx_int = 1
113const NX_AST_F_EMOTIONAL_TONE: nx_int = 2
114const NX_AST_F_MIN_AROUSAL_Q10: nx_int = 3
115const NX_AST_F_MAX_AROUSAL_Q10: nx_int = 4
116const NX_AST_F_IMAGES_BEFORE_ADVANCE: nx_int = 5
117const NX_AST_F_LOCATION_POOL_OFF: nx_int = 6 // offset into arc.pools
118const NX_AST_F_LOCATION_POOL_LEN: nx_int = 7
119const NX_AST_F_OUTFIT_POOL_OFF: nx_int = 8
120const NX_AST_F_OUTFIT_POOL_LEN: nx_int = 9
121const NX_AST_F_POSE_POOL_OFF: nx_int = 10
122const NX_AST_F_POSE_POOL_LEN: nx_int = 11
123const NX_AST_F_EXPRESSION_POOL_OFF: nx_int = 12
124const NX_AST_F_EXPRESSION_POOL_LEN: nx_int = 13
125const NX_AST_F_CAMERA_POOL_OFF: nx_int = 14
126const NX_AST_F_CAMERA_POOL_LEN: nx_int = 15
127const NX_ARC_STAGE_FIELDS: nx_int = 16
144const NX_ARC_BYTES: nx_int = 56 // 7 fields * 8
248const NX_ARC_POOL_LOCATION: nx_int = 0
249const NX_ARC_POOL_OUTFIT: nx_int = 1
250const NX_ARC_POOL_POSE: nx_int = 2
251const NX_ARC_POOL_EXPRESSION: nx_int = 3
252const NX_ARC_POOL_CAMERA: nx_int = 4
253const NX_ARC_POOL_N_KINDS: nx_int = 5

functions

57func nx_as_source_is_valid(s: nx_int) -> nx_int
called by 1: main
75func nx_aw_level_is_valid(a: nx_int) -> nx_int
called by 1: main
100func nx_et_tone_is_valid(t: nx_int) -> nx_int
called by 1: main
151func nx_arc_alloc(arc_id: nx_int, n_stages: nx_int,
called by 3: mainmainmain calls 1: sys_mmap
192func nx_arc_stage_get(arc: *Arc, stage_idx: nx_int, field: nx_int) -> nx_int
200func nx_arc_stage_set(arc: *Arc, stage_idx: nx_int, field: nx_int, value: nx_int) -> nx_int
215func nx_arc_pool_get(arc: *Arc, idx: nx_int) -> nx_int
called by 2: main_pool_pick
221func nx_arc_pool_set(arc: *Arc, idx: nx_int, value: nx_int) -> nx_int
called by 3: mainmainmain
230func nx_arc_stage_set_basic(arc: *Arc, stage_idx: nx_int,
called by 3: mainmainmain calls 1: nx_arc_stage_set
255func nx_arc_pool_kind_is_valid(k: nx_int) -> nx_int
261func nx_arc_stage_set_pool(arc: *Arc, stage_idx: nx_int,
296func nx_arc_stage_get_pool(arc: *Arc, stage_idx: nx_int, pool_kind: nx_int,