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
omega-mv / tools / pi-drive-27b / pi_drive.om
| 1 | note pi_drive.om -- pure seeded Omega (OM-2) client running on Raspberry Pi (AArch64) |
| 2 | note to drive Qwen3.8-27B-FP8 on DGX Spark GB10 GPU over WireGuard (100.64.0.2:18099). |
| 3 | note Build natively on Pi (AArch64 Linux) with zero C / Python / curl: |
| 4 | note { printf 'om2\n'; cat seed/net/http.om tools/pi-drive-27b/pi_drive.om; } | ./seed/out/omc > pi_drive |
| 5 | note Usage on Pi: |
| 6 | note ./pi_drive (sends built-in Omega codegen prompt) |
| 7 | note ./pi_drive < request.json (sends custom /v1/chat/completions JSON body) |
| 8 | |
| 9 | const PDIP ulong 2130706433 |
| 10 | const PDPORT ulong 18099 |
| 11 | const PDTMO long 600000000000 |
| 12 | const PDMAXREQ ulong 524288 |
| 13 | const PDMAXRSP ulong 65536 |
| 14 | |
| 15 | text pdget "GET" |
| 16 | text pdpost "POST" |
| 17 | text pdhost "Host" |
| 18 | text pdhostv "127.0.0.1:18099" |
| 19 | text pdctype "Content-Type" |
| 20 | text pdjson "application/json" |
| 21 | text pdphealth "/health" |
| 22 | text pdpchat "/v1/chat/completions" |
| 23 | text pdnl "\n" |
| 24 | text pddflt "{\"model\":\"qwen3.8-27b-fp8\",\"max_tokens\":128,\"temperature\":0,\"messages\":[{\"role\":\"user\",\"content\":\"Write a 6-line pure Omega (OM-1) function fn sq x ulong to ulong that returns x*x, with no markdown.\"}]}" |
| 25 | |
| 26 | fn pddial cs edit ulong 320 io edit uchar 65536 to long |
| 27 | a = new uchar 16 0 |
| 28 | r = haddr4 a uint PDIP PDPORT |
| 29 | if lt r 0 |
| 30 | ret r |
| 31 | end |
| 32 | fd = hdial a PDTMO |
| 33 | if lt fd 0 |
| 34 | ret fd |
| 35 | end |
| 36 | r = hinit cs io int fd 0 |
| 37 | if lt r 0 |
| 38 | c = fclose int fd |
| 39 | ret r |
| 40 | end |
| 41 | hsettmo cs PDTMO PDTMO |
| 42 | hsetbdl cs PDTMO |
| 43 | ret 0 |
| 44 | end |
| 45 | |
| 46 | fn pdreadin buf edit uchar 524288 to ulong |
| 47 | n = ulong 0 |
| 48 | done = ulong 0 |
| 49 | while and lt n PDMAXREQ eq done 0 bound 524288 |
| 50 | r = read 0 buf n sub PDMAXREQ n |
| 51 | if le r 0 |
| 52 | done = 1 |
| 53 | else |
| 54 | n = add n ulong r |
| 55 | end |
| 56 | end |
| 57 | ret n |
| 58 | end |
| 59 | |
| 60 | fn pdwriteall fd int buf view uchar * n ulong to long |
| 61 | off = ulong 0 |
| 62 | while lt off n bound 65536 |
| 63 | r = write fd buf off sub n off |
| 64 | if le r 0 |
| 65 | ret -1 |
| 66 | end |
| 67 | off = add off ulong r |
| 68 | end |
| 69 | ret 0 |
| 70 | end |
| 71 | |
| 72 | fn pdhealth to long |
| 73 | cs = new ulong 320 0 |
| 74 | io = new uchar 65536 0 |
| 75 | rsp = new uchar 4096 0 |
| 76 | r = pddial cs io |
| 77 | if lt r 0 |
| 78 | ret r |
| 79 | end |
| 80 | r = hreqst cs io pdget |
| 81 | r = hfe r hreqtg cs io pdphealth |
| 82 | r = hfe r hhname cs io pdhost |
| 83 | r = hfe r hhval cs io pdhostv |
| 84 | r = hfe r hhend cs io 0 0 |
| 85 | r = hfe r hwfin cs io |
| 86 | if lt r 0 |
| 87 | c = hclose cs |
| 88 | ret r |
| 89 | end |
| 90 | st = hrsprd cs io |
| 91 | if ne st 200 |
| 92 | c = hclose cs |
| 93 | if lt st 0 |
| 94 | ret st |
| 95 | end |
| 96 | ret sub 0 st |
| 97 | end |
| 98 | put cs 10 4096 |
| 99 | n = hbodyall cs io rsp |
| 100 | c = hclose cs |
| 101 | if lt n 0 |
| 102 | ret n |
| 103 | end |
| 104 | w = pdwriteall 2 rsp ulong n |
| 105 | w = write 2 pdnl 0 len pdnl |
| 106 | ret 0 |
| 107 | end |
| 108 | |
| 109 | fn pdchat req view uchar * rlen ulong to long |
| 110 | cs = new ulong 320 0 |
| 111 | io = new uchar 65536 0 |
| 112 | rsp = new uchar 65536 0 |
| 113 | r = pddial cs io |
| 114 | if lt r 0 |
| 115 | ret r |
| 116 | end |
| 117 | r = hreqst cs io pdpost |
| 118 | r = hfe r hreqtg cs io pdpchat |
| 119 | r = hfe r hhname cs io pdhost |
| 120 | r = hfe r hhval cs io pdhostv |
| 121 | r = hfe r hhname cs io pdctype |
| 122 | r = hfe r hhval cs io pdjson |
| 123 | r = hfe r hhend cs io 0 rlen |
| 124 | i = ulong 0 |
| 125 | while and ge r 0 lt i rlen bound 524288 |
| 126 | r = hputb cs io get req i |
| 127 | i = add i 1 |
| 128 | end |
| 129 | r = hfe r hwfin cs io |
| 130 | if lt r 0 |
| 131 | c = hclose cs |
| 132 | ret r |
| 133 | end |
| 134 | st = hrsprd cs io |
| 135 | if ne st 200 |
| 136 | c = hclose cs |
| 137 | if lt st 0 |
| 138 | ret st |
| 139 | end |
| 140 | ret sub 0 st |
| 141 | end |
| 142 | put cs 10 PDMAXRSP |
| 143 | n = hbodyall cs io rsp |
| 144 | c = hclose cs |
| 145 | if lt n 0 |
| 146 | ret n |
| 147 | end |
| 148 | w = pdwriteall 1 rsp ulong n |
| 149 | w = write 1 pdnl 0 len pdnl |
| 150 | ret 0 |
| 151 | end |
| 152 | |
| 153 | fn main to long |
| 154 | r = pdhealth |
| 155 | if lt r 0 |
| 156 | ret 1 |
| 157 | end |
| 158 | req = new uchar 524288 0 |
| 159 | n = pdreadin req |
| 160 | if eq n 0 |
| 161 | i = ulong 0 |
| 162 | while lt i len pddflt bound 4096 |
| 163 | put req i get pddflt i |
| 164 | i = add i 1 |
| 165 | end |
| 166 | n = len pddflt |
| 167 | end |
| 168 | r = pdchat req n |
| 169 | if lt r 0 |
| 170 | ret 2 |
| 171 | end |
| 172 | ret 0 |
| 173 | end |