code wiki / (root) / nx_scene_index.nx

nx_scene_index.nx

buildroot/runtime/nx_scene_index.nx

9264 B242 linesdepth 6pulls 8 transitivereach 6 importersview sourcekind librarytopic scene
docsdependenciesstructsconstsfunctions

about

nx_scene_index.nx -- companion-queryable surface over discovered anchors. Top of the ingestion stack. Turns each ArcAnchor (an abstract "(role + role) recurs in this corpus") into a concrete SceneCandidate the companion's autonomous-trigger layer can query and surface as a surprise scene. Each SceneCandidate carries: - anchor_kind (e.g. NX_ANCHOR_OUTFIT_LOCATION) - registry slot ids for the two terms - the BEST-FIT representative beat (the one that most strongly instances this anchor in the corpus) - the byte span (start, end) within the source media so the companion can quote / re-render the scene verbatim - first / last sighting beat ids (recency for ranking) - sighting count (frequency for ranking) - stage (STAGE1 SUPERVISED today; STAGE3 once user pins) Per cardinals: feedback-self-surfacing-intelligence-staged-autonomy: SceneCandidates default STAGE1 SUPERVISED -- the companion PROPOSES to the user before surfacing. STAGE2 PROMPTED at anchor count >= NX_ARC_ANCHOR_PROMOTE_N. STAGE3 once user explicitly pins. feedback-launching-content-must-be-one-command-easy: SceneIndex is the substrate primitive a single one-command surfacer (nx_companion_surprise.nx, future) wires through. nx_safety_envelope: intended_use: "Companion-side queryable index of scene candidates derived from discovered ArcAnchors + source-beat back-references." sil_target: SIL2 asil_target: QM dal_target: DAL C iec_62304_class: NONE evidence: [no_floating_point, bounded_loops_per_jpl_rule_2, anchor_to_candidate_one_to_one, source_span_preserved_for_audit]

dependencies 6 imports · 6 importers

nx_syscalls.nx nx_storybeat.nx nx_storydb.nx nx_media_pool.nx nx_term_registry.nx nx_arc_anchor.nx nx_scene_index.nx nx_caption_emit.nx nx_caption_emit_test.nx nx_content_guard.nx nx_content_guard_test.nx nx_ingest_cli.nx nx_scene_index_test.nx

imports: nx_syscalls.nxnx_storybeat.nxnx_storydb.nxnx_media_pool.nxnx_term_registry.nxnx_arc_anchor.nx

imported by: nx_caption_emit.nxnx_caption_emit_test.nxnx_content_guard.nxnx_content_guard_test.nxnx_ingest_cli.nxnx_scene_index_test.nx

structs

60struct SceneCandidate
83struct SceneIndex

consts

75const NX_SCENE_CAND_BYTES: i64 = 96
77const NX_SCENE_FLAG_USER_PINNED: i64 = 1
81const NX_SCENE_INDEX_DEFAULT_CAP: i64 = 256
89const NX_SCENE_INDEX_BYTES: i64 = 24

functions

93func nx_scene_index_alloc_sized(cap: i64) -> *SceneIndex
called by 1: nx_scene_index_alloc calls 1: sys_mmap
104func nx_scene_index_alloc() -> *SceneIndex
108func nx_scene_candidate_at(s: *SceneIndex, i: i64) -> *SceneCandidate
120func nx_scene_index_match_beat(db: *StoryDb,
155func nx_scene_index_build(idx: *SceneIndex, db: *StoryDb,
206func nx_scene_index_first_of_kind(idx: *SceneIndex, kind: i64) -> i64
called by 2: mainmain calls 1: nx_scene_candidate_at
222func nx_scene_index_source_span(idx: *SceneIndex, cand_id: i64,
called by 1: main calls 1: nx_scene_candidate_at
235func nx_scene_index_pin(idx: *SceneIndex, cand_id: i64) -> i64
called by 1: main calls 1: nx_scene_candidate_at