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/aienux/allen/local-model.om # 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 / aienux / allen / local-model.om` 278 lines ยท 4589 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note Opt-in local-model application for Aienux's Omega firmware environment. 3 note Links the existing Allen base/runtime and aien-train's unchanged model/checkpoint/tokenizer. 4 note Firmware Boot Services stay active. This is not a standalone-kernel or bare-metal M2 claim. 5 note No network, Linux syscalls, shell, external inference provider or checkpoint writes. 6 note Serial console protocol: LM1 ID TOKENS TEMPMILLI SEED HEX_PROMPT CR. 7 note ID/SEED u32; TOKENS 1..128; TEMPMILLI 0..2000; prompt 1..159 printable ASCII bytes. 8 note Output: LMREADY; LMSTART ID; LMDATA ID HEX_BYTES; LMDONE ID; LMERR ID CODE. 9 note A request uses Allen's start/answer conversation lifecycle. Its history stores a bounded 10 note printable preview; raw generated bytes are sent unchanged in the LMDATA frames. 11 text Lmck "\\ASTRA.CK" 12 text Lmbpe "\\BPE.BIN" 13 text Lmboot "AIENUX OMEGA LOCAL MODEL: firmware hosted, no Linux" 14 text Lmready "LMREADY" 15 text Lmstart "LMSTART " 16 text Lmdata "LMDATA " 17 text Lmdone "LMDONE " 18 text Lmerror "LMERR " 19 global Lmstate ulong 8 20 note state: input length, overflow, request ID, tokens, temperature, seed, preview length, reserved. 21 global Lmline uchar 512 22 global Lmkey uchar 8 23 global Lmprev uchar 160 24 25 fn lmput which ulong to void 26 if eq which 0 27 for i ulong len Lmboot 28 emitb get Lmboot i 29 end 30 end 31 if eq which 1 32 for i ulong len Lmready 33 emitb get Lmready i 34 end 35 end 36 if eq which 2 37 for i ulong len Lmstart 38 emitb get Lmstart i 39 end 40 end 41 if eq which 3 42 for i ulong len Lmdata 43 emitb get Lmdata i 44 end 45 end 46 if eq which 4 47 for i ulong len Lmdone 48 emitb get Lmdone i 49 end 50 end 51 if eq which 5 52 for i ulong len Lmerror 53 emitb get Lmerror i 54 end 55 end 56 end 57 58 fn lmsend to void 59 emitb 10 60 if ne get Err 0 0 61 exit 71 62 end 63 r = efi 13 0 Outb 0 get Outlen 0 64 if ne r get Outlen 0 65 exit 70 66 end 67 end 68 69 fn lmfail code ulong to void 70 outreset 71 lmput 5 72 emitn get Lmstate 2 73 emitb 32 74 emitn code 75 lmsend 76 end 77 78 fn lmhex c uchar to ulong 79 if and ge c 48 le c 57 80 ret sub ulong c 48 81 end 82 if and ge c 97 le c 102 83 ret add sub ulong c 97 10 84 end 85 ret 256 86 end 87 88 note Platform output hook: flush every complete decoded token, with no terminal escape injection. 89 fn oflush to void 90 n = get oon 0 91 if eq n 0 92 ret 93 end 94 outreset 95 lmput 3 96 emitn get Lmstate 2 97 emitb 32 98 for i ulong n 99 c = get oout i 100 emitb get Digits ulong shr c 4 101 emitb get Digits ulong and c 15 102 p = get Lmstate 6 103 if lt p 159 104 shown = c 105 if or lt shown 32 gt shown 126 106 shown = 32 107 end 108 put Lmprev p shown 109 put Lmstate 6 add p 1 110 end 111 end 112 lmsend 113 put oon 0 0 114 end 115 116 fn lmrequest to void 117 put Lmstate 2 0 118 if ne get Lmstate 1 0 119 lmfail 1 120 ret 121 end 122 n = get Lmstate 0 123 for i ulong n 124 put In i get Lmline i 125 end 126 put Inlen 0 n 127 put P 0 0 128 put P 2 0 129 expect 76 130 expect 77 131 expect 49 132 expect 32 133 number 134 put Lmstate 2 get P 1 135 expect 32 136 number 137 put Lmstate 3 get P 1 138 expect 32 139 number 140 put Lmstate 4 get P 1 141 expect 32 142 number 143 put Lmstate 5 get P 1 144 expect 32 145 if ne get P 2 0 146 lmfail 2 147 ret 148 end 149 if eq get Lmstate 2 0 150 lmfail 3 151 ret 152 end 153 if eq get Lmstate 3 0 154 lmfail 3 155 ret 156 end 157 if gt get Lmstate 3 128 158 lmfail 3 159 ret 160 end 161 if gt get Lmstate 4 2000 162 lmfail 3 163 ret 164 end 165 pos = get P 0 166 size = sub n pos 167 if or or eq size 0 gt size 318 ne rem size 2 0 168 lmfail 4 169 ret 170 end 171 count = div size 2 172 for i ulong count 173 a = lmhex get Lmline add pos mul i 2 174 b = lmhex get Lmline add add pos mul i 2 1 175 if or eq a 256 eq b 256 176 lmfail 5 177 ret 178 end 179 c = uchar add mul a 16 b 180 if or lt c 32 gt c 126 181 lmfail 6 182 ret 183 end 184 put ojob add 1024 i c 185 put In i c 186 end 187 put Inlen 0 count 188 if not start 1 oms 189 lmfail 7 190 ret 191 end 192 put otl 6 count 193 put Lmstate 6 0 194 outreset 195 lmput 2 196 emitn get Lmstate 2 197 lmsend 198 osampleloaded get Lmstate 5 get Lmstate 3 get Lmstate 4 199 count = get Lmstate 6 200 if eq count 0 201 cancel 202 else 203 for i ulong count 204 put In i get Lmprev i 205 end 206 put Inlen 0 count 207 if not answer get R 0 oms 208 cancel 209 lmfail 8 210 ret 211 end 212 end 213 outreset 214 lmput 4 215 emitn get Lmstate 2 216 lmsend 217 end 218 219 fn main to int 220 outreset 221 lmput 0 222 lmsend 223 put otc 0 8 224 put otb 2 0 225 put otl 2 len Lmck 226 for i ulong len Lmck 227 put ojob i get Lmck i 228 end 229 put otb 7 32 230 put otl 7 len Lmbpe 231 for i ulong len Lmbpe 232 put ojob add 32 i get Lmbpe i 233 end 234 put otb 6 1024 235 pl = oargp 2 236 sz = efi 12 oefa 0 0 oarg 0 pl 237 if oeerr sz 238 outreset 239 lmput 5 240 emitn 0 241 emitb 32 242 emitn sz 243 lmsend 244 ret 70 245 end 246 oeclose 247 ockload 2 248 obload 7 get og 0 249 outreset 250 lmput 1 251 lmsend 252 for session ulong `1000000` 253 for beat ulong `1000000` 254 st = efi 1 0 Lmkey 0 4 255 if ne st 0 256 st = efi 2 1000 Lmkey 0 0 257 else 258 ch = or ulong get Lmkey 2 shl ulong get Lmkey 3 8 259 if eq ch 13 260 lmrequest 261 put Lmstate 0 0 262 put Lmstate 1 0 263 else 264 if and ge ch 32 le ch 126 265 n = get Lmstate 0 266 if lt n len Lmline 267 put Lmline n uchar ch 268 put Lmstate 0 add n 1 269 else 270 put Lmstate 1 1 271 end 272 end 273 end 274 end 275 end 276 end 277 ret 0 278 end