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/evidence/allen-omega-L694/L746/independent-review/logs/scoped.diff # 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 / evidence / allen-omega-L694 / L746 / independent-review / logs / scoped.diff` 420 lines ยท 15481 bytes Raw Blame History 1 diff --git a/native/omega/allen/README.md b/native/omega/allen/README.md 2 index `dfaa4d1`..`3328043` 100644 3 --- a/native/omega/allen/README.md 4 +++ b/native/omega/allen/README.md 5 @@ -13,17 +13,17 @@ Run from this checkout on Linux AArch64, with the brief's immutable compiler: 6 ```sh 7 quiet-build native/omega/allen/gate.sh target/allen-omega-L694/fresh-output 8 ``` 9 10 The output directory must be fresh. `build-one.sh` hashes the compiler before 11 **every invocation**, rejects empty/wrong-machine/nonstatic ELF and marks only 12 qualified output executable. The gate builds all modules together for every test, 13 executes handwritten Omega test programs, compares a byte-exact independent memory 14 -fixture and rejects eleven compiled behavioral mutants. The build uses POSIX shell, 15 +fixture and rejects thirteen compiled behavioral mutants. The build uses POSIX shell, 16 Git (source reconstruction), GNU file/text utilities, readelf, dd, xxd and 17 sha256sum as external development tools. Existing Rust courier `--split` was used 18 once as a fixture oracle, never as an Omega runtime dependency. 19 20 ## Modules and API boundary 21 22 * `runtime.om`: one outstanding job, chat/code/follow-up, immediate code ack, 23 ID exhaustion refusal, stale answer rejection, cancel/reset,20s slow-once and 24 @@ -64,16 +64,35 @@ once as a fixture oracle, never as an Omega runtime dependency. 25 SHA256(header0:32 || payload) is **unkeyed integrity**, never authorization or 26 rollback freshness. Those independent proofs remain absent in this legacy format. 27 `loadbeg` resets load state, `loadcopy(slot)` considers each valid copy once. 28 `txbegin -> txwrite -> txflush -> txread` publishes store generation only after 29 exact readback. Provider reads back into Unit and writes Enc to Tx's target. 30 `nbegin -> nwrite -> nflush -> nread` verifies note writes before parent saves; 31 provider must update the parent's note count only after nread succeeds. No disk 32 syscall/driver is bound. Crash tests use explicit fixed simulated disk buffers. 33 +* `context.om`: restores a512-slot catalog from already committed note records 34 + and appends bounded memory context to actual application JOBs. After loading 35 + canonical Mem through the memory codec, call `ctxbegin`; for each declared slot, 36 + place its4096-byte record in Unit and call `ctxtake(index)` exactly once, in any 37 + order. Return0 means refused/no visit,1 valid retained,2 damaged visit retained 38 + as gone. Deleted/damaged notes never enter model context. The catalog becomes 39 + ready only after every declared slot was visited. Cx contains declared count, 40 + visited count, readiness, damaged count and loading flag. Loading is refused 41 + during a live conversation or note/parent write transaction. The provider must 42 + keep the chosen Mem generation stable and restart catalog loading after any 43 + memory reload; this is not an incremental concurrent store interface. 44 + `ctxmeta(limit)` stages byte-exact legacy self/name/starts/fact and newest-live- 45 + note metadata into Meta/Mx without touching Unit, Enc or outgoing bytes. 46 + `ctxappend` appends all or none within the4096-byte JOB cap, preserving outgoing 47 + bytes/length/error on refusal. `appask` validates context before reading its 48 + variable-layout identity fields, includes the newest six live notes, and refuses 49 + incomplete catalogs/oversized context before conversation or wire IDs advance. 50 + SHA validation is still unkeyed integrity, not authentication. No physical disk 51 + loader/writer, note search index or concurrent mutation/commit provider is bound. 52 * `view.om`: legacy code row wrapping, continuation numbering and saturated scroll, 53 bounded4096 rows. The full code remains held when the row index reaches capacity. 54 * `scene.om`: mood/say/eight thing kinds, placement/emphasis/arrival/direction, 55 typed field bounds, four things/six fields/2048-byte input/12 lines. 56 * `scene-input.om`: `scdecode` consumes In/Inlen through bounded scene cleanup, 57 restores the exact caller input and length, and fills the same Sc/Things/Stext 58 output as the strict `scene` parser. Input and normalized output each have a 59 2048-byte cap. NUL or normalization overflow refuses the whole scene and clears 60 @@ -109,17 +128,18 @@ CODE assembly and SAY/WAIT handling. This is an executed native core entry path, 61 not a bound socket/device loop. The older development `main.om` stdio entry 62 remains separate; it does not exercise this datagram binding. 63 64 1. `appinit(run,now)` initializes one boot session using a nonzero unique run ID 65 and actual monotonic milliseconds supplied by the future qualified provider. 66 Reinitialization is refused rather than reusing job IDs. 67 2. Put a prompt into In/Inlen, then `appask(now)`. It validates admission before 68 adding a transcript entry, builds the real JOB text and queues it. Code requests 69 - expose the existing acknowledgement immediately. Busy, outstanding-send, 70 + expose the existing acknowledgement immediately. Restored facts and up to six 71 + newest live notes are included in the queued job. Busy, outstanding-send, 72 pending-receipt, invalid-prompt and ID-exhaustion cases refuse admission. 73 3. `apppoll(now,link)` advances silence/slow deadlines and returns whether one 74 datagram is offered in Outb/Outlen. Send those exact bytes and call 75 `appsent(now,success)` with the real whole-datagram outcome. Do not call core 76 serializers yourself while a send is pending. 77 4. Copy a received datagram into In/Inlen and call `appreceive(now)`. Its boolean 78 reports **transport acceptance**, not acceptance of the inner reply. A[2] 79 distinguishes visible text1, queued code recovery2, code give-up3, refused 80 @@ -145,17 +165,17 @@ Overflow refuses whole prompts/answers/scene fields instead of silent truncation 81 Reply capacity159, prompt capacity159, code32768, job4096, note127. Conflicting 82 CODE duplicates and differing language headers are refused rather than overwriting. 83 Numeric overflow, backward timestamps, request ID wrap and v4 sky pad are refused. 84 Job instructions and record bytes retain legacy structure; envelope metadata is 85 never added to Store v1 superblocks. No identity migration fields are rewritten. 86 87 Remaining portable work: remaining scene aliases/missing-colon repairs, field 88 ellipsis, timer interpretation, transcript-to-notes restore, 89 -full notes indexing/retrieval, full memory metadata job append, transport binding, 90 +full notes indexing/retrieval, catalog update/store integration, transport binding, 91 full sky/catalogue/font/animated-network/canvas visual parity, integration and 92 broader malformed-input coverage. Partial modules are not whole compatibility. 93 94 Required target gates: qualified seeded x86 EFI target (FR9), privileged/MMIO and 95 interrupt/native device access(FR8), durable I/O(FR1), bounded networking(FR16), 96 keyboard/framebuffer/disk/NIC providers, iMac QEMU boot/chat/keyboard/bootdisk, 97 then signed physical trial. No C bridge can satisfy these. L408 owns compiler 98 work; L690 owns Hermes JSON/WebSocket/admission. Neither tree was modified. 99 diff --git a/native/omega/allen/application.om b/native/omega/allen/application.om 100 index `3b79e6a`..`734efee` 100644 101 --- a/native/omega/allen/application.om 102 +++ b/native/omega/allen/application.om 103 @@ -51,19 +51,26 @@ ret false 104 end 105 kind = classify 106 if or lt kind 1 gt kind 3 107 ret false 108 end 109 if and eq kind 3 eq get R 6 0 110 ret false 111 end 112 +note Validate restored context before jobbuild reads its variable-layout names. 113 +if not ctxmeta 6 114 +ret false 115 +end 116 if not jobbuild kind add get R 0 1 117 ret false 118 end 119 +if not ctxappend 120 +ret false 121 +end 122 n = get Inlen 0 123 size = get Outlen 0 124 for i ulong n 125 put Askin i get In i 126 end 127 for i ulong size 128 put Appjob i get Outb i 129 end 130 diff --git a/native/omega/allen/context.om b/native/omega/allen/context.om 131 new file mode 100644 132 index `0000000`..`401d418` 133 --- /dev/null 134 +++ b/native/omega/allen/context.om 135 @@ -0,0 +1,237 @@ 136 +note Restored note catalog and bounded model-job context. No storage provider. 137 +note Cx declared count,visited count,ready,damaged,loading. Damaged notes stay gone. 138 +global Cx ulong 5 139 +global Ctxtext uchar 65536 140 +global Ctxlen ulong 512 141 +global Ctxgone uchar 512 142 +global Ctxseen uchar 512 143 +global Ctxstart ulong 512 144 +global Meta uchar 4096 145 +global Mx ulong 2 146 +global Mdigits uchar 20 147 +text Mtself "\tself=" 148 +text Mtname "\tname=" 149 +text Mtstart "\tstarts=" 150 +text Mtfact "\tfact " 151 +text Mtis " is " 152 +text Mtare " are " 153 +text Mtnote "\tnote " 154 +fn ctxidle to bool 155 +if ne get R 1 0 156 +ret false 157 +end 158 +ret and eq get Tx 0 0 eq get Nt 0 0 159 +end 160 +fn ctxbegin to bool 161 +if not ctxidle 162 +ret false 163 +end 164 +n = mem32 36 165 +if gt n 512 166 +ret false 167 +end 168 +for i ulong 512 169 +put Ctxlen i 0 170 +put Ctxgone i 1 171 +put Ctxseen i 0 172 +put Ctxstart i 0 173 +end 174 +put Cx 0 n 175 +put Cx 1 0 176 +put Cx 2 0 177 +put Cx 3 0 178 +put Cx 4 1 179 +if eq n 0 180 +put Cx 2 1 181 +put Cx 4 0 182 +end 183 +ret true 184 +end 185 +note Returns0 refused without visit,1 valid record retained,2 damaged visit retained. 186 +fn ctxtake index ulong to ulong 187 +if not ctxidle 188 +ret 0 189 +end 190 +if or eq get Cx 4 0 ge index get Cx 0 191 +ret 0 192 +end 193 +if ne get Ctxseen index 0 194 +ret 0 195 +end 196 +status = ulong 2 197 +if notedec index 198 +n = get Ns 0 199 +for i ulong n 200 +put Ctxtext add mul index 128 i get Note i 201 +end 202 +put Ctxlen index n 203 +put Ctxgone index uchar get Ns 3 204 +put Ctxstart index get Ns 2 205 +status = 1 206 +else 207 +put Cx 3 add get Cx 3 1 208 +end 209 +put Ctxseen index 1 210 +put Cx 1 add get Cx 1 1 211 +if eq get Cx 1 get Cx 0 212 +put Cx 2 1 213 +put Cx 4 0 214 +end 215 +ret status 216 +end 217 +fn mtemit c uchar to void 218 +if ne get Mx 1 0 219 +ret 220 +end 221 +n = get Mx 0 222 +if ge n 4096 223 +put Mx 1 1 224 +ret 225 +end 226 +put Meta n c 227 +put Mx 0 add n 1 228 +end 229 +fn mtnum v ulong to void 230 +n = ulong 0 231 +while gt v 9 232 +put Mdigits n uchar rem v 10 233 +v = div v 10 234 +n = add n 1 235 +end 236 +put Mdigits n uchar v 237 +n = add n 1 238 +for i ulong n 239 +mtemit add uchar 48 get Mdigits sub sub n 1 i 240 +end 241 +end 242 +note Memory fields are length-bounded; require a terminator and printable bytes. 243 +fn mtfield off ulong cap ulong to bool 244 +for i ulong cap 245 +c = get Mem add off i 246 +if eq c 0 247 +if eq i 0 248 +put Mx 1 1 249 +ret false 250 +end 251 +ret true 252 +end 253 +if or lt c 32 gt c 126 254 +put Mx 1 1 255 +ret false 256 +end 257 +mtemit c 258 +end 259 +put Mx 1 1 260 +ret false 261 +end 262 +fn mtfacts count ulong to bool 263 +for k ulong count 264 +off = add 40 mul k 113 265 +for i ulong len Mtfact 266 +mtemit get Mtfact i 267 +end 268 +if not mtfield off 48 269 +ret false 270 +end 271 +are = get Mem add off 112 272 +if gt are 1 273 +put Mx 1 1 274 +ret false 275 +end 276 +if eq are 1 277 +for i ulong len Mtare 278 +mtemit get Mtare i 279 +end 280 +else 281 +for i ulong len Mtis 282 +mtemit get Mtis i 283 +end 284 +end 285 +if not mtfield add off 48 64 286 +ret false 287 +end 288 +end 289 +ret eq get Mx 1 0 290 +end 291 +fn mtnotes count ulong limit ulong to void 292 +given = ulong 0 293 +for k ulong count 294 +index = sub sub count 1 k 295 +if and eq get Ctxgone index 0 lt given limit 296 +for i ulong len Mtnote 297 +mtemit get Mtnote i 298 +end 299 +for i ulong get Ctxlen index 300 +mtemit get Ctxtext add mul index 128 i 301 +end 302 +given = add given 1 303 +end 304 +end 305 +end 306 +fn ctxmeta limit ulong to bool 307 +put Mx 0 0 308 +put Mx 1 1 309 +facts = mem32 32 310 +notes = mem32 36 311 +if or gt facts 32 gt notes 512 312 +ret false 313 +end 314 +if gt limit 512 315 +ret false 316 +end 317 +if gt notes 0 318 +if or eq get Cx 2 0 ne get Cx 0 notes 319 +ret false 320 +end 321 +end 322 +put Mx 1 0 323 +for i ulong len Mtself 324 +mtemit get Mtself i 325 +end 326 +off = add 40 mul facts 113 327 +if eq get Mem off 0 328 +for i ulong len Allen 329 +mtemit get Allen i 330 +end 331 +else 332 +if not mtfield off 24 333 +ret false 334 +end 335 +end 336 +if ne get Mem 8 0 337 +for i ulong len Mtname 338 +mtemit get Mtname i 339 +end 340 +if not mtfield 8 24 341 +ret false 342 +end 343 +end 344 +for i ulong len Mtstart 345 +mtemit get Mtstart i 346 +end 347 +mtnum mem32 0 348 +if not mtfacts facts 349 +ret false 350 +end 351 +mtnotes notes limit 352 +ret eq get Mx 1 0 353 +end 354 +note Publish all metadata or none; preserve outgoing bytes/length/error on refusal. 355 +fn ctxappend to bool 356 +if or ne get Mx 1 0 ne get Err 0 0 357 +ret false 358 +end 359 +n = get Outlen 0 360 +size = get Mx 0 361 +if or gt n 4096 gt size 4096 362 +ret false 363 +end 364 +if gt add n size 4096 365 +ret false 366 +end 367 +for i ulong size 368 +put Outb add n i get Meta i 369 +end 370 +put Outlen 0 add n size 371 +ret true 372 +end 373 diff --git a/native/omega/allen/gate.sh b/native/omega/allen/gate.sh 374 index `d4171d2`..`326cb1c` 100755 375 --- a/native/omega/allen/gate.sh 376 +++ b/native/omega/allen/gate.sh 377 @@ -6,18 +6,18 @@ cd "$root" 378 out=$1 379 mkdir -p "$out" 380 [ -z "$(ls -A "$out")" ] || { echo 'gate requires fresh output directory' >&2; exit 73; } 381 core="$out/core.om" 382 cat native/omega/allen/base.om native/omega/allen/vendor/sha256-core.om \ 383 native/omega/allen/runtime.om native/omega/allen/code.om \ 384 native/omega/allen/courier.om native/omega/allen/scheduler.om native/omega/allen/memory.om \ 385 native/omega/allen/intent.om native/omega/allen/reply.om \ 386 - native/omega/allen/view.om native/omega/allen/scene.om native/omega/allen/paint.om native/omega/allen/application.om native/omega/allen/scene-input.om > "$core" 387 -for name in runtime code courier scheduler application memory intent reply view scene scene-input paint edges fixture golden render; do 388 + native/omega/allen/view.om native/omega/allen/scene.om native/omega/allen/paint.om native/omega/allen/application.om native/omega/allen/scene-input.om native/omega/allen/context.om > "$core" 389 +for name in runtime code courier scheduler application memory context intent reply view scene scene-input paint edges fixture golden render; do 390 cat "$core" > "$out/$name.om" 391 case "$name" in golden|render) ;; *) cat native/omega/allen/tests/check.om >> "$out/$name.om" ;; esac 392 cat "native/omega/allen/tests/$name.om" >> "$out/$name.om" 393 native/omega/allen/build-one.sh "$out/$name.om" "$out/$name" 394 case "$name" in 395 fixture) 396 "$out/$name" < evidence/allen-omega-L694/short.wire > "$out/short.log" 397 "$out/$name" < evidence/allen-omega-L694/long.wire > "$out/long.log" 398 @@ -66,17 +66,21 @@ cat native/omega/allen/tests/check.om native/omega/allen/tests/scheduler.om >> " 399 sed 's/put Outb i get Appwire i/put Outb i get Outb i/' "$core" > "$out/pendingwire-mutant.om" 400 cat native/omega/allen/tests/check.om native/omega/allen/tests/application.om >> "$out/pendingwire-mutant.om" 401 sed 's/if or le get R 2 1 ne get C 0 get R 0/if false/' "$core" > "$out/appcode-mutant.om" 402 cat native/omega/allen/tests/check.om native/omega/allen/tests/application.om >> "$out/appcode-mutant.om" 403 sed 's/if hide/if false/' "$core" > "$out/thinking-mutant.om" 404 cat native/omega/allen/tests/check.om native/omega/allen/tests/scene-input.om >> "$out/thinking-mutant.om" 405 sed 's/if lt get Nm 8 12/if true/' "$core" > "$out/scenecap-mutant.om" 406 cat native/omega/allen/tests/check.om native/omega/allen/tests/scene-input.om >> "$out/scenecap-mutant.om" 407 -for name in stale crc hash readback session keepalive ackstop pendingwire appcode thinking scenecap; do 408 +sed 's/if and eq get Ctxgone index 0 lt given limit/if lt given limit/' "$core" > "$out/contextnote-mutant.om" 409 +cat native/omega/allen/tests/check.om native/omega/allen/tests/context.om >> "$out/contextnote-mutant.om" 410 +sed 's/if not ctxappend/if false/' "$core" > "$out/contextjob-mutant.om" 411 +cat native/omega/allen/tests/check.om native/omega/allen/tests/context.om >> "$out/contextjob-mutant.om" 412 +for name in stale crc hash readback session keepalive ackstop pendingwire appcode thinking scenecap contextnote contextjob; do 413 native/omega/allen/build-one.sh "$out/$name-mutant.om" "$out/$name-mutant" 414 set +e 415 "$out/$name-mutant" > "$out/$name-mutant.log" 416 rc=$? 417 set -e 418 if [ "$rc" -le 0 ] || [ "$rc" -ge 100 ]; then echo "mutant did not fail behaviorally: $name exit=$rc" >&2; exit 1; fi 419 printf '%s mutant compile=0 rejected-exit=%s\n' "$name" "$rc" 420 done