nx_scene_index.nx
buildroot/runtime/nx_scene_index.nx
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
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
| 60 | struct SceneCandidate |
| 83 | struct SceneIndex |
consts
| 75 | const NX_SCENE_CAND_BYTES: i64 = 96 |
| 77 | const NX_SCENE_FLAG_USER_PINNED: i64 = 1 |
| 81 | const NX_SCENE_INDEX_DEFAULT_CAP: i64 = 256 |
| 89 | const NX_SCENE_INDEX_BYTES: i64 = 24 |
functions
| 93 | func nx_scene_index_alloc_sized(cap: i64) -> *SceneIndex |
| 104 | func nx_scene_index_alloc() -> *SceneIndex |
| 108 | func nx_scene_candidate_at(s: *SceneIndex, i: i64) -> *SceneCandidate |
| 120 | func nx_scene_index_match_beat(db: *StoryDb, |
| 155 | func nx_scene_index_build(idx: *SceneIndex, db: *StoryDb, called by 4: mainbuild_indexmainmain calls 3: nx_scene_index_match_beatnx_storydb_beat_atnx_scene_candidate_at |
| 206 | func nx_scene_index_first_of_kind(idx: *SceneIndex, kind: i64) -> i64 |
| 222 | func nx_scene_index_source_span(idx: *SceneIndex, cand_id: i64, |
| 235 | func nx_scene_index_pin(idx: *SceneIndex, cand_id: i64) -> i64 |