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/aienux/blob/main/native/omega/allen/README.md
# aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
Sign in to star 0 stars 0 watching
About Files History Releases Proposed changes Issues For developers
branch `main` Branches Tags History
`aienux / native / omega / allen / README.md`
297 lines ยท 19406 bytes Raw Blame History Rendered
1 # Allen in seeded Omega (L694, WIP)
2
3 This directory contains handwritten seeded Omega implementations of Allen's
4 transport-independent state, protocol, memory codecs, scene state, code layout
5 and paint primitives. It compiles directly to static native Linux AArch64 ELF.
6 It has no foreign implementation, interpreter, C translator, launcher or fallback.
7
8 It is **not the complete iMac Allen replacement**. The old production C/Rust
9 paths remain live. No service, machine, physical disk or boot path was changed.
10
11 Build on Linux AArch64 from the pinned public compiler source. These are
12 component build instructions, not a released interactive alpha. The compiler is
13 omega-mv commit `b8bd1d03` on the local branch `fix/imac-net-L974-snp` (L974; a
14 compiler change that needs its own review, not yet published), stacked on
15 `81ab1900`, which the tag `allen-omc-pin-`81ab1900`` holds (the
16 `feat/x86efi-file-word` head of #981, stacked on #980 register slots and #977 site
17 tables; #980 is not merged, so neither commit is on omega-mv main):
18 look-paint.om needs its `const` and `bitcast`, the firmware unit its larger
19 trap/exit-site tables, look-install.om its `efi 11` file word, efi-main.om the
20 `efi 8` that leaves an adapter refused only for its link initialized (so the
21 next attempt sees the link) and reports each scan through `efi 0`, and the x86 back
22 end's live-slot calls and register-resident slots make the firmware's per-pixel
23 code run. From this repository root, with the branch fetched from its bundle
24 (`imac-net-L974-omc.bundle` on the Spark under
25 `~/handoffs/imac-boot-repair-`20261107`/net/`) until it is published:
26
27 ```sh
28 git clone https://github.com/aien-dev/omega-mv.git build/allen-toolchain
29 git -C build/allen-toolchain fetch PATH/imac-net-L974-omc.bundle fix/imac-net-L974-snp
30 git -C build/allen-toolchain checkout --detach `b8bd1d03`
31 sha256sum build/allen-toolchain/seed/out/omc # expect `2eeab5147deb8320`...
32 ```
33
34 The committed `seed/out/omc` on that branch is the pinned compiler; its
35 self-rebuild (`sh seed/omega-from-seed.sh` in a disposable clone) reproduces
36 the same bytes. Self-rebuild equality does not establish diverse compiler
37 ancestry; that qualification is a separate claim. The expected SHA-256 is
38 ``2eeab5147deb8320cb1bc7f86a5f3de534955ff89f76be2832155348706e0164``; pass the
39 executable as `OMEGA_COMPILER` (on the Spark: `~/work/imac-net-L974-omc/seed/out/omc`).
40
41 The firmware image for the iMac is one unit of every module in the order
42 `build-fw.sh` lists (platform, base, sha256, font, the look, surface, GitHub,
43 HTTP, net, TLS, session, repository screen, runtime, courier, memory, intent,
44 reply, context, application, chat, install, stopwatch, show, efi-main, demo):
45
46 ```sh
47 OMEGA_COMPILER=... sh native/omega/allen/build-fw.sh target/BOOTX64.EFI
48 ```
49
50 The typed line `stats` makes Allen say the stopwatch's last line (look-stat.om),
51 network first: `STAT net=N e=E h=H l=L c=C p=P m=MAC s=...` gives the network
52 flag, the last efi 8 / efi 0 error code, the SNP handle count, the
53 LocateHandleBuffer status low byte, the number of scans, one probe step per
54 handle (0 not reached, 1 no Mode, 2 MAC size, 3 IfType, 4 Start, 5 Initialize,
55 6 GetStatus, 7 state, 8 no link and kept initialized, 9 filter mask,
56 a ReceiveFilters, b not opened, e chosen without link detection, f chosen with
57 a link) and the chosen MAC.
58 `install allen on this computer` copies the image to the internal EFI System
59 Partition (look-install.om); nothing is written at boot.
60
61 Run the complete component gate:
62
63 ```sh
64 sh native/omega/allen/gate.sh target/allen-omega-L694/fresh-output
65 ```
66
67 On the shared Spark, prefix bootstrap and gate commands with `quiet-build`.
68 For a compiler reconstructed elsewhere, set `OMEGA_COMPILER` to its executable
69 path. The same fixed digest is mandatory; this setting does not permit an
70 unqualified compiler. Paths containing spaces are supported. Build-orchestration
71 checks are available through `sh native/omega/allen/test-build.sh COMPILER FRESH_OUTPUT`.
72
73 The output directory must be fresh. `build-one.sh` hashes the compiler before
74 **every invocation**, rejects empty/wrong-machine/nonstatic ELF and marks only
75 qualified output executable. Failed compilation leaves no published executable;
76 existing outputs, including dangling links, are never replaced.
77 The gate builds all modules together for every test,
78 executes handwritten Omega test programs, compares a byte-exact independent memory
79 fixture and rejects compiled behavioral mutants. The build uses POSIX shell,
80 Git (source reconstruction), GNU file/text utilities, readelf, dd, xxd and
81 sha256sum as external development tools. Existing Rust courier `--split` was used
82 once as a fixture oracle, never as an Omega runtime dependency.
83
84 ## Modules and API boundary
85
86 * `runtime.om`: one outstanding job, chat/code/follow-up, immediate code ack,
87 ID exhaustion refusal, stale answer rejection, cancel/reset,20s slow-once and
88 30s silence timeout. Injected monotonic milliseconds, no clock syscall.
89 32 transcript lines of159 bytes, evict oldest whole line, restoration entry.
90 * `intent.om`: legacy intent word tables and JOB composition, preserving Allen
91 and restored self/person names. No new canned ordinary answer table.
92 * `code.om`: CODE headers/escapes,128-byte pieces/32768-byte code,256 pieces,
93 IEEE CRC32,800 lines, reorder/loss/duplicate handling; display only when whole.
94 * `reply.om`: SAY multipart/WAIT folding,159-byte answer capacity, one AGAIN
95 retry for missing/bad code before giving up. Model text is always external input.
96 * `courier.om`: byte-compatible ALLEN-COURIER datagrams, session binding,
97 JOB reassembly4096 bytes, ordered LINE queue8x319 bytes and duplicate receipt.
98 This is protocol core, not a socket, Ethernet driver or cryptographic peer check.
99 * `scheduler.om`: serialized client lifecycle over that protocol. `qstart(run,now)`
100 requires a nonzero caller-supplied boot/session ID. `qsubmit(now)` snapshots
101 In/Inlen (1..4096 bytes), maps CR/LF to spaces, increments the bounded wire ID,
102 and queues 1000-byte JOB parts. A new submission is refused while the previous
103 job is unacknowledged or a send result is outstanding. Once acknowledged, a new
104 submission explicitly abandons the previous reply queue; the runtime must still
105 enforce its one-outstanding-conversation rule. `qcancel` discards pending sends,
106 received lines and job state, retaining session ID/clock/keepalive state.
107 `qnext(now,link)` publishes one datagram in Outb/Outlen, prioritizing pending GOT,
108 then HELLO, then JOB. Consume those bytes before any other serializer. Call
109 `qsent(now,success)` for each offered datagram, using actual whole-datagram send
110 success, not an assumption; failed sends remain due. `qincoming(now)` consumes
111 In/Inlen and returns refused0/accepted1/duplicate2. Drain accepted lines with
112 `qtake`. GOT is only scheduled after a line is retained or recognized as a
113 duplicate; queue-full and out-of-order input get no receipt. One pending GOT
114 slot provides backpressure rather than silently losing acknowledgments.
115 HELLO uses2s before readiness/after expiry and10s while ready; HI remains ready
116 for strictly less than30s. Whole JOB sets retry after2s until ACK or LINE.
117 All mutating timed entries refuse backward clocks. `qready(now)` is read-only.
118 The provider owns a genuine monotonic millisecond clock, link state and actual
119 datagram transport. No clock/socket, Ethernet or iMac attachment is claimed.
120 * `memory.om`:4096-byte AIENALM1 v2/v3/v4 and AIENNOT1 codecs. `Mem` is canonical
121 decoded payload, `Unit` is input/staging, `Enc` is committed encoder output.
122 SHA256(header0:32 || payload) is **unkeyed integrity**, never authorization or
123 rollback freshness. Those independent proofs remain absent in this legacy format.
124 `loadbeg` resets load state, `loadcopy(slot)` considers each valid copy once.
125 `txbegin -> txwrite -> txflush -> txread` publishes store generation only after
126 exact readback. Provider reads back into Unit and writes Enc to Tx's target.
127 `nbegin -> nwrite -> nflush -> nread` verifies note writes before parent saves;
128 provider must update the parent's note count only after nread succeeds. No disk
129 syscall/driver is bound. Crash tests use explicit fixed simulated disk buffers.
130 * `context.om`: restores a512-slot catalog from already committed note records
131 and appends bounded memory context to actual application JOBs. After loading
132 canonical Mem through the memory codec, call `ctxbegin`; for each declared slot,
133 place its4096-byte record in Unit and call `ctxtake(index)` exactly once, in any
134 order. Return0 means refused/no visit,1 valid retained,2 damaged visit retained
135 as gone. Deleted/damaged notes never enter model context. The catalog becomes
136 ready only after every declared slot was visited. Cx contains declared count,
137 visited count, readiness, damaged count and loading flag. Loading is refused
138 during a live conversation or note/parent write transaction. The provider must
139 keep the chosen Mem generation stable and restart catalog loading after any
140 memory reload; this is not an incremental concurrent store interface.
141 `ctxmeta(limit)` stages byte-exact legacy self/name/starts/fact and newest-live-
142 note metadata into Meta/Mx without touching Unit, Enc or outgoing bytes.
143 `ctxappend` appends all or none within the4096-byte JOB cap, preserving outgoing
144 bytes/length/error on refusal. `appask` validates context before reading its
145 variable-layout identity fields, includes the newest six live notes, and refuses
146 incomplete catalogs/oversized context before conversation or wire IDs advance.
147 SHA validation is still unkeyed integrity, not authentication. No physical disk
148 loader/writer, note search index or concurrent mutation/commit provider is bound.
149 * `view.om`: legacy code row wrapping, continuation numbering and saturated scroll,
150 bounded4096 rows. The full code remains held when the row index reaches capacity.
151 * `scene.om`: mood/say/eight thing kinds, placement/emphasis/arrival/direction,
152 typed field bounds, four things/six fields/2048-byte input/12 lines.
153 * `scene-input.om`: `scdecode` consumes In/Inlen through bounded scene cleanup,
154 restores the exact caller input and length, and fills the same Sc/Things/Stext
155 output as the strict `scene` parser. Input and normalized output each have a
156 2048-byte cap. NUL or normalization overflow refuses the whole scene and clears
157 published scene metadata. ASCII tabs/spaces collapse; CR, other control bytes
158 and non-ASCII bytes are dropped, matching the legacy ASCII display boundary.
159 Case-insensitive exact ``/`` tags hide their entire lines and all
160 enclosed lines; an unclosed thought block hides the remainder. Lines beginning
161 with triple backticks are discarded, not the enclosed scene. Supported markdown
162 prefixes and keyword emphasis are stripped. Known kind/placement/mood words are
163 case-folded without changing displayed field text. The first twelve retained
164 canonical lines are eligible, including for mood-only and fallback decisions.
165 If no recognized scene exists, the first short unrecognized line becomes the
166 answer (159-byte cap); rejected known structured commands do not become prose.
167 This fallback is deliberately stricter than legacy truncation/ellipsis.
168 Nm[0..8] reports thinking, normalized bytes, tidying count, hidden lines,
169 scratch-line bytes, eligible mood seen, invalid/overflow, fallback bytes and
170 retained canonical-line count. Like other modules, calls must be serialized.
171 This scene API is not yet connected to the application reply/display provider.
172 * `paint.om`: legacy integer color operations and soft-light pixel evaluation.
173 Executed192x128 halo/heart component pose, colors from `ck_mind_draw`. This is
174 not the full Allen sky/network animation, font, canvas item renderer or UI.
175
176 Fixed global pools model the platform boundary because seeded Omega globals
177 cannot be passed as array parameters. Functions are serialized, not reentrant.
178 Caller-owned metadata is trusted only where stated; lengths and external wire
179 values are validated at entry. Kernel/platform ABI and object ownership wrappers
180 must be specified when a qualified native provider exists.
181
182 ## Bound conversation/provider API
183
184 `application.om` connects the runtime, intent/job builder, courier scheduler,
185 CODE assembly and SAY/WAIT handling. This is an executed native core entry path,
186 not a bound socket/device loop. The older development `main.om` stdio entry
187 remains separate; it does not exercise this datagram binding.
188
189 1. `appinit(run,now)` initializes one boot session using a nonzero unique run ID
190 and actual monotonic milliseconds supplied by the future qualified provider.
191 Reinitialization is refused rather than reusing job IDs.
192 2. Put a prompt into In/Inlen, then `appask(now)`. It validates admission before
193 adding a transcript entry, builds the real JOB text and queues it. Code requests
194 expose the existing acknowledgement immediately. Restored facts and up to six
195 newest live notes are included in the queued job. Busy, outstanding-send,
196 pending-receipt, invalid-prompt and ID-exhaustion cases refuse admission.
197 3. `apppoll(now,link)` advances silence/slow deadlines and returns whether one
198 datagram is offered in Outb/Outlen. Send those exact bytes and call
199 `appsent(now,success)` with the real whole-datagram outcome. Do not call core
200 serializers yourself while a send is pending.
201 4. Copy a received datagram into In/Inlen and call `appreceive(now)`. Its boolean
202 reports **transport acceptance**, not acceptance of the inner reply. A[2]
203 distinguishes visible text1, queued code recovery2, code give-up3, refused
204 payload4, slow notice5 and silence timeout6; zero means no UI event. Consume
205 events after each successful call; later successful calls may replace them.
206 Answer/R[8], Code and transcript remain the actual retained content.
207 5. `appcancel` cancels both layers; `appreset` additionally clears runtime session
208 display/history state, without resetting conversation or wire counters.
209
210 A missing-code response queues AGAIN with the original conversation ID. The
211 triggering LINE is acknowledged first, then AGAIN uses a **new wire sequence**.
212 Consequently the two counters can differ; subsequent valid responses still bind
213 correctly. Incoming reply parsing preserves any outstanding outgoing datagram.
214 Old CODE cannot populate or change a code buffer during a newer chat request.
215 WAIT updates the silence deadline without fabricating an answer. Silence timeout
216 cancels courier retries as well as the conversation. Calls remain serialized;
217 fixed global arrays are not thread-safe. Provider must not mix direct core queue
218 operations with this application API.
219
220 ## Runnable bound provider entry
221
222 `provider-core.om` and `provider.om` expose the actual bound application through
223 versioned length-framed stdin/stdout. See [PROVIDER.md](PROVIDER.md) for the exact
224 40-byte header, operations and status/event/body format. The gate produces the
225 static native executable at `