Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/src/visor/visor_world.h # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / src / visor / visor_world.h` 111 lines ยท 5968 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* 18 * visor_world.h -- Omega Visor V1, lane 6: a read-only view of the resident World. 19 * 20 * VISOR VIEW != RUNTIME OWNERSHIP. 21 * A VisorWorldView is a bounded, value-only copy taken for display. It holds no 22 * pointer into the runtime, no lock, no capability and no authority. Holding a 23 * view grants nothing; changing a view changes nothing. The runtime (RxWorld, 24 * its capability root, its generation store) stays the only owner of state. 25 * The visor never calls a runtime mutator: no rx_world_create/retire/ 26 * add_reaction/publish_external/bind_capability, no rx_capadmin_*, no 27 * rx_gen_propose/mutate_object/promote, no rx_resident_* mutators. 28 * 29 * Build split (the V1 `omega` binary is physics-free and does NOT link the 30 * runtime): 31 * visor_world.c types + formatters + visor_world_unattached(). No rx_* 32 * symbol, no runtime header. Linked into build/omega. 33 * rx/visor_world_rx.c visor_world_snapshot(), the only code that touches 34 * RxWorld. Built only by mk/visor-world.mk (test target), 35 * never by the src/visor/ wildcard. 36 * This header forward-declares struct RxWorld so it never pulls in pthread.h 37 * or runtime headers. 38 * 39 * Where each field comes from (visor_world_snapshot): 40 * (a) public rx_* read calls: digest (rx_world_digest), publication_tail 41 * (rx_world_publication_tail), per-object cross-check (rx_world_read). 42 * (b) ONE acquisition of the same world mutex rx_world_read takes, copying 43 * only public RxWorld scalars: objects[i].{live,id,generation,persist, 44 * placed}, n_reactions, in_flight. Nothing else (subscriptions, ready 45 * queues, deferred wakes, crumbs, coherent image) is touched. 46 * (c) nothing: generation, published_results, staged_effects stay 0 and 47 * gap_note says why. state_name is a fixed label, not a runtime state. 48 * digest and publication_tail are separate lock acquisitions from (b); they 49 * are coherent with the object list only when the World is quiescent. 50 * 51 * Extension points (later views attach to this same snapshot family; each is 52 * a separate value-only view struct + snapshot + text/json formatter under the 53 * same rules: bounded, deterministic, fail closed, gap_note instead of guess): 54 * - VisorJSpaceView J-Space, over rx_jspace.h -> visor_jspace_snapshot() 55 * - VisorCortexView Cortex projection, over rx_cortex.h / rx_projection.h 56 * -> visor_cortex_snapshot() 57 * - VisorGenerationView active generation / staged candidate, over an 58 * RxGenStore (rx_gen_active, rx_gen_read_blob); fills 59 * VisorWorldView.generation and staged_effects. 60 * - VisorContractView published typed results, over rx_contract.h RcGate; 61 * fills VisorWorldView.published_results. 62 */ 63 #ifndef OMEGA_VISOR_WORLD_H 64 #define OMEGA_VISOR_WORLD_H 65 66 #include 67 #include 68 #include 69 70 #define VISOR_WORLD_MAX_OBJECTS 32 71 72 struct RxWorld; 73 74 typedef struct { 75 uint64_t generation; /* active generation; 0 = not observable here */ 76 const char *state_name; /* static label; never a pointer into the runtime */ 77 size_t resident_object_count; /* true live-object total (may exceed object_count) */ 78 size_t active_work; /* reactions READY + RUNNING + PUBLISHING */ 79 size_t reaction_count; /* registered reactions */ 80 size_t published_results; /* 0 = not observable here (see gap_note) */ 81 size_t staged_effects; /* 0 = not observable here (see gap_note) */ 82 bool staged_effects_visible; /* false: the runtime grants no view of staged effects */ 83 uint64_t publication_tail; /* next publication-ring sequence */ 84 char digest[72]; /* "sha256:<64 hex>" world digest, "" if none */ 85 bool attached; /* false: no resident World in this session */ 86 char gap_note[256]; /* what the runtime cannot show coherently */ 87 struct { 88 char id[72]; /* "rx:@" */ 89 const char *kind; /* persistence class, static string */ 90 const char *state; /* "live" | "live,placed", static string */ 91 } objects[VISOR_WORLD_MAX_OBJECTS]; 92 size_t object_count; 93 } VisorWorldView; 94 95 /* attached=false; gap_note says the V1 binary does not link the runtime. */ 96 void visor_world_unattached(VisorWorldView *out); 97 98 /* Defined in src/visor/rx/visor_world_rx.c (runtime-linked builds only). 99 * Returns 0 on success. Returns -1 and leaves *out unattached (fail closed) 100 * when w or out is NULL. Never waits for quiescence; never mutates w. */ 101 int visor_world_snapshot(const struct RxWorld *w, VisorWorldView *out); 102 103 /* Deterministic renderings. Return bytes written (excluding NUL), or -1 on a 104 * NULL argument or when the output would not fit (out is then "" if n > 0). */ 105 int visor_world_format_text(const VisorWorldView *v, char *out, size_t n); 106 int visor_world_format_json(const VisorWorldView *v, char *out, size_t n); 107 108 /* Append a clause to gap_note, separated by "; ", truncating safely. */ 109 void visor_world_gap_append(VisorWorldView *v, const char *note); 110 111 #endif /* OMEGA_VISOR_WORLD_H */