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/apps/hop/Omega/tests/mutant/mut.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 / apps / hop / Omega / tests / mutant / mut.om` 485 lines ยท 7795 bytes Raw Blame History 1 note hopfact: Hop factory command-center core, native ABI v1 (OM-1). Contract: Omega/README.md. 2 note One call validates a bounded snapshot (256 ulong words in), categorizes every row, orders the 3 note attention view and derives totals (256 ulong words out). Any malformed input fails closed as 4 note verdict 1 INVALID with a reason and the first faulting word; nothing is guessed or defaulted. 5 note Unknown states, rows the host could not decode and unrecognized groups are never IDLE or CLEAR. 6 7 note code: reason r at input word i, packed as r*256+i (never 0 for r >= 1) 8 fn code r ulong i ulong to ulong 9 ret add mul r 256 i 10 end 11 12 fn bitset m ulong b ulong to bool 13 ret ne and m shl ulong 1 b 0 14 end 15 16 note highest state code each kind defines (0 is always "unknown") 17 fn maxst k ulong to ulong 18 if eq k 1 19 ret 5 20 end 21 if eq k 13 22 ret 7 23 end 24 if eq k 14 25 ret 5 26 end 27 ret 1 28 end 29 30 note largest count each kind accepts: quota permille 1000, agent idle seconds 4e9, others 1e6 31 fn capof k ulong to ulong 32 if eq k 12 33 ret 1000 34 end 35 if eq k 11 36 ret `4000000000` 37 end 38 ret `1000000` 39 end 40 41 note source bit a kind's rows come from: floor stream 0, usage 1, settings 2, chat 3 42 fn needbit k ulong to ulong 43 if le k 11 44 ret 0 45 end 46 if eq k 15 47 ret 0 48 end 49 if eq k 12 50 ret 1 51 end 52 if eq k 13 53 ret 2 54 end 55 ret 3 56 end 57 58 note station status: 1 idle 2 waiting 3 queued 4 running 5 bottleneck 59 fn catstn s ulong to ulong 60 if eq s 5 61 ret 5 62 end 63 if ge s 3 64 ret 8 65 end 66 if eq s 2 67 ret 9 68 end 69 ret 12 70 end 71 72 note review/merge groups 2..10 and 15; an empty group is idle 73 fn catgrp k ulong c ulong to ulong 74 if eq c 0 75 ret 12 76 end 77 if eq k 15 78 ret 5 79 end 80 if eq k 2 81 ret 8 82 end 83 if eq k 3 84 ret 4 85 end 86 if eq k 5 87 ret 6 88 end 89 if eq k 6 90 ret 7 91 end 92 if eq k 10 93 ret 10 94 end 95 if ge k 8 96 ret 11 97 end 98 ret 2 99 end 100 101 note account: 1 OK 2 MISSING 3 EXPIRED 4 RELOGIN 5 BLOCKED 6 RUNNING 7 SAVED 102 fn catacc s ulong to ulong 103 if le s 4 104 if ge s 2 105 ret 3 106 end 107 end 108 if eq s 5 109 ret 4 110 end 111 ret 12 112 end 113 114 note chat item: 1 thinking 2 sending 3 ask 4 delivered 5 error 115 fn catchat s ulong to ulong 116 if le s 2 117 ret 8 118 end 119 if eq s 3 120 ret 2 121 end 122 if eq s 5 123 ret 5 124 end 125 ret 12 126 end 127 128 note category 1 UNKNOWN 2 DECISION 3 ACCESS 4 QUOTA 5 TRIAGE 6 READY 7 OWNER 8 WORK 9 BACKLOG 129 note 10 OTHER 11 NEUTRAL 12 IDLE; called only on rows that passed chkrow 130 fn catof k ulong s ulong c ulong v ulong to ulong 131 if eq v 0 132 ret 1 133 end 134 if eq s 0 135 ret 12 136 end 137 if eq k 1 138 ret catstn s 139 end 140 if le k 10 141 ret catgrp k c 142 end 143 if eq k 15 144 ret catgrp k c 145 end 146 if eq k 11 147 if lt c 90 148 ret 8 149 end 150 ret 12 151 end 152 if eq k 12 153 if lt c 100 154 ret 4 155 end 156 ret 12 157 end 158 if eq k 13 159 ret catacc s 160 end 161 ret catchat s 162 end 163 164 note one row: id, kind, state, count, valid at words 8+5r .. 12+5r 165 fn chkrow inp view ulong 256 r ulong msk ulong to ulong 166 b = add 8 mul r 5 167 k = get inp add b 1 168 if eq k 0 169 ret code 6 add b 1 170 end 171 if gt k 15 172 ret code 6 add b 1 173 end 174 if gt get inp b 65535 175 ret code 15 b 176 end 177 if gt get inp add b 2 maxst k 178 ret code 14 add b 2 179 end 180 if gt get inp add b 3 capof k 181 ret code 5 add b 3 182 end 183 if gt get inp add b 4 1 184 ret code 7 add b 4 185 end 186 if not bitset msk needbit k 187 ret code 9 add b 1 188 end 189 ret 0 190 end 191 192 fn dupid inp view ulong 256 n ulong to ulong 193 for r ulong n 194 a = get inp add 8 mul r 5 195 for q ulong r 196 if eq a get inp add 8 mul q 5 197 ret code 8 add 8 mul r 5 198 end 199 end 200 end 201 ret 0 202 end 203 204 fn chkhead inp view ulong 256 to ulong 205 for i ulong 256 206 if gt get inp i `9223372036854775807` 207 ret code 4 i 208 end 209 end 210 if ne get inp 0 `1213157446` 211 ret code 1 0 212 end 213 if ne get inp 1 1 214 ret code 2 1 215 end 216 if gt get inp 2 48 217 ret code 3 2 218 end 219 if gt get inp 5 3 220 ret code 11 5 221 end 222 if gt get inp 6 15 223 ret code 12 6 224 end 225 if ne get inp 7 0 226 ret code 13 7 227 end 228 n = get inp 2 229 p = add 8 mul n 5 230 while lt p 256 bound 256 231 if ne get inp p 0 232 ret code 10 p 233 end 234 p = add p 1 235 end 236 msk = get inp 6 237 for r ulong n 238 e = chkrow inp r msk 239 if ne e 0 240 ret e 241 end 242 end 243 ret dupid inp n 244 end 245 246 fn zero res edit ulong 256 to void 247 for i ulong 256 248 put res i 0 249 end 250 end 251 252 fn invalid res edit ulong 256 e ulong to ulong 253 zero res 254 put res 0 `1213157446` 255 put res 1 1 256 put res 2 1 257 put res 3 div e 256 258 put res 4 rem e 256 259 ret 1 260 end 261 262 note snapshot-level reason: 20 health failed, 21 link unknown, 22 stream unavailable, 23 generated 263 note absent, 24 older than 60000 ms, 25 generated over 30000 ms ahead, 26 floor stream missing; 264 note 0 when the snapshot is current (coverage of station and group kinds is checked by cover) 265 fn snapr inp view ulong 256 to ulong 266 l = get inp 5 267 if eq l 2 268 ret 20 269 end 270 if eq l 0 271 ret 21 272 end 273 if eq l 3 274 ret 22 275 end 276 gen = get inp 4 277 now = get inp 3 278 if eq gen 0 279 ret 23 280 end 281 if gt gen add now 30000 282 ret 25 283 end 284 if gt now gen 285 if gt sub now gen 60000 286 ret 24 287 end 288 end 289 if not bitset get inp 6 0 290 ret 26 291 end 292 ret 0 293 end 294 295 fn agems inp view ulong 256 to ulong 296 gen = get inp 4 297 now = get inp 3 298 if eq gen 0 299 ret `18446744073709551615` 300 end 301 if gt gen now 302 if gt sub gen now 30000 303 ret `18446744073709551615` 304 end 305 ret 0 306 end 307 ret sub now gen 308 end 309 310 note per-row categories at 96+r and per-category counts at 8+c 311 fn classify inp view ulong 256 res edit ulong 256 n ulong to void 312 for r ulong n 313 b = add 8 mul r 5 314 c = catof get inp add b 1 get inp add b 2 get inp add b 3 get inp add b 4 315 put res add 96 r c 316 put res add 8 c add get res add 8 c 1 317 end 318 end 319 320 note kind presence mask at 7, per-kind count sums at 24+k (absent kind: -1) 321 fn tally inp view ulong 256 res edit ulong 256 n ulong to void 322 m = ulong 0 323 for r ulong n 324 b = add 8 mul r 5 325 k = get inp add b 1 326 m = or m shl ulong 1 k 327 put res add 24 k add get res add 24 k get inp add b 3 328 end 329 put res 7 m 330 for k ulong 16 331 if gt k 0 332 if not bitset m k 333 put res add 24 k `18446744073709551615` 334 end 335 end 336 end 337 end 338 339 note agents working (idle under 90 s) and total at 40, 41 (-1 when no agent rows were sent); 340 note minimum quota permille at 42 (-1 when none) 341 fn derive inp view ulong 256 res edit ulong 256 n ulong to void 342 w = ulong 0 343 t = ulong 0 344 mq = ulong `18446744073709551615` 345 for r ulong n 346 b = add 8 mul r 5 347 k = get inp add b 1 348 c = get inp add b 3 349 if eq k 11 350 t = add t 1 351 if lt c 90 352 w = add w 1 353 end 354 end 355 if eq k 12 356 if lt c mq 357 mq = c 358 end 359 end 360 end 361 if gt t 0 362 put res 40 w 363 put res 41 t 364 else 365 put res 40 `18446744073709551615` 366 put res 41 `18446744073709551615` 367 end 368 put res 42 mq 369 end 370 371 note attention order at 48+i: row ids by category ascending, then input order 372 fn order inp view ulong 256 res edit ulong 256 n ulong to void 373 p = ulong 48 374 for c ulong 13 375 for r ulong n 376 if eq get res add 96 r c 377 put res p get inp add 8 mul r 5 378 p = add p 1 379 end 380 end 381 end 382 end 383 384 note attention rows: categories 1..7 and 10 385 fn attn res view ulong 256 to ulong 386 a = get res 18 387 for c ulong 8 388 if gt c 0 389 a = add a get res add 8 c 390 end 391 end 392 ret a 393 end 394 395 fn firstat res view ulong 256 to ulong 396 for c ulong 11 397 if gt c 0 398 if le c 7 399 if gt get res add 8 c 0 400 ret c 401 end 402 end 403 end 404 end 405 ret 10 406 end 407 408 note first kind the floor must report but did not: station 1, review 2..4, merge 5..7; 0 = covered 409 fn cover m ulong to ulong 410 for k ulong 8 411 if gt k 0 412 if not bitset m k 413 ret k 414 end 415 end 416 end 417 ret 0 418 end 419 420 fn verdof r ulong to ulong 421 if eq r 20 422 ret 2 423 end 424 if le r 22 425 ret 3 426 end 427 if le r 25 428 ret 4 429 end 430 ret 5 431 end 432 433 note entry. Word 45 is read-freshness admission: 1 only when the snapshot is valid, the link is up, 434 note generated is current and the floor stream is present (group coverage not required). It never 435 note authorizes an action; the host still needs a live selection, explicit confirmation and the server. 436 fn hopfact inp view ulong 256 res edit ulong 256 to ulong 437 e = chkhead inp 438 if ne e 0 439 ret invalid res e 440 end 441 zero res 442 n = get inp 2 443 put res 0 `1213157446` 444 put res 1 1 445 put res 5 n 446 put res 6 agems inp 447 classify inp res n 448 tally inp res n 449 derive inp res n 450 order inp res n 451 a = attn res 452 put res 43 a 453 r = snapr inp 454 if eq r 0 455 put res 45 1 456 k = cover get res 7 457 if ne k 0 458 put res 4 k 459 r = ulong 31 460 if le k 4 461 r = ulong 30 462 end 463 if eq k 1 464 r = ulong 29 465 end 466 end 467 end 468 v = ulong 8 469 if ne r 0 470 v = verdof r 471 else 472 if gt a 0 473 v = ulong 6 474 r = add 40 firstat res 475 else 476 if gt add get res 16 get res 17 0 477 v = ulong 7 478 r = ulong 60 479 end 480 end 481 end 482 put res 2 v 483 put res 3 r 484 ret v 485 end