omega-tool-model
First-party Omega tool-use model source, serving harnesses, and verification records
Brought by drakestapleton
omega-tool-model / deployment / conversation / chat.om
| 1 | note Bounded chat-only bridge to the separately approved local Qwen companion. |
| 2 | note No URLs, files, tool permissions or generation settings are taken from model text. |
| 3 | global cbuf uchar 131072 |
| 4 | global clen ulong 1 |
| 5 | global caddr uchar 16 |
| 6 | global cfd int 1 |
| 7 | global cp ulong 1 |
| 8 | global cend ulong 1 |
| 9 | global ccount ulong 1 |
| 10 | global csent ulong 1 |
| 11 | text csys "You are a helpful conversational assistant running locally on Drake's Spark, powered by Qwen3-30B-A3B-Instruct-2507. You are a separate companion to his custom-trained Omega round40 model, not that small model and not ChatGPT. Speak in clear, natural, plain English. Drake is an engineer learning programming, so explain necessary technical terms and avoid jargon dumps. Follow the conversation, use facts the user provides, and accept corrections. Ask a short clarifying question when a request is unclear. Do not invent facts, memories, credentials, tool actions, measurements, or claims of success. You can discuss many subjects, but cannot browse, access past chat archives, modify weights or run tools from this chat. The separate Practice with tools section on this page uses Drake's round40 model to read, repair and test small temporary Omega arithmetic files. Those tools are not connected to you. When asked for current information, say when you cannot verify it. Omega code uses prefix operations and structured fn/ret/end, for example: fn main to int, ret add int 2 int 3, end, with one statement per line. Be honest when you do not know the correct Omega syntax. Conversation messages supplied here are your available personal context. Keep replies concise unless more detail is requested." |
| 12 | text cpre "{\"model\":\"omega-chat-companion\",\"stream\":true,\"cache_prompt\":true,\"max_tokens\":1024,\"temperature\":0.6,\"top_p\":0.8,\"messages\":[{\"role\":\"system\",\"content\":\"" |
| 13 | text cuser ",{\"role\":\"user\",\"content\":\"" |
| 14 | text cassist ",{\"role\":\"assistant\",\"content\":\"" |
| 15 | text creq "POST /v1/chat/completions HTTP/1.1\nHost: 127.0.0.1:18178\nContent-Type: application/json\nConnection: close\nContent-Length: " |
| 16 | text cunavail "HTTP/1.1 503 Service Unavailable\nConnection: close\nContent-Type: text/plain; charset=utf-8\nCache-Control: no-store\n\nThe conversational model is unavailable. Your message has been kept; try again shortly." |
| 17 | text cbad "HTTP/1.1 400 Bad Request\nConnection: close\nContent-Type: text/plain; charset=utf-8\nCache-Control: no-store\n\nThis conversation is too large or malformed. Start a new chat or shorten the message." |
| 18 | |
| 19 | fn cb c uchar to void |
| 20 | if ge get clen 0 131072 |
| 21 | exit 90 |
| 22 | end |
| 23 | put cbuf get clen 0 c |
| 24 | put clen 0 add get clen 0 1 |
| 25 | end |
| 26 | fn cjson c uchar to void |
| 27 | if or eq c 34 eq c 92 |
| 28 | cb 92 |
| 29 | cb c |
| 30 | ret |
| 31 | end |
| 32 | if eq c 10 |
| 33 | cb 92 |
| 34 | cb 110 |
| 35 | ret |
| 36 | end |
| 37 | if eq c 13 |
| 38 | cb 92 |
| 39 | cb 114 |
| 40 | ret |
| 41 | end |
| 42 | if eq c 9 |
| 43 | cb 92 |
| 44 | cb 116 |
| 45 | ret |
| 46 | end |
| 47 | cb c |
| 48 | end |
| 49 | fn cbody to bool |
| 50 | n = get hsize 0 |
| 51 | off = get hend 0 |
| 52 | if or eq n 0 gt n 24000 |
| 53 | ret false |
| 54 | end |
| 55 | total = add off n |
| 56 | if gt get hcount 0 total |
| 57 | ret false |
| 58 | end |
| 59 | deadline = add monons long 5000000000 |
| 60 | while lt get hcount 0 total bound 24000 |
| 61 | p = get hcount 0 |
| 62 | left = sub deadline monons |
| 63 | if le left 0 |
| 64 | ret false |
| 65 | end |
| 66 | if le waitio get hfd 0 1 left 0 |
| 67 | ret false |
| 68 | end |
| 69 | r = recv get hfd 0 hreq p sub total p 64 |
| 70 | if eq r neg long 11 |
| 71 | continue |
| 72 | end |
| 73 | if le r 0 |
| 74 | ret false |
| 75 | end |
| 76 | put hcount 0 add p ulong r |
| 77 | end |
| 78 | put cp 0 off |
| 79 | put cend 0 total |
| 80 | ret true |
| 81 | end |
| 82 | fn cmessage to bool |
| 83 | p = get cp 0 |
| 84 | endp = get cend 0 |
| 85 | if ge p endp |
| 86 | ret false |
| 87 | end |
| 88 | want = uchar 85 |
| 89 | if eq rem get ccount 0 2 1 |
| 90 | want = 65 |
| 91 | end |
| 92 | if ne get hreq p want |
| 93 | ret false |
| 94 | end |
| 95 | p = add p 1 |
| 96 | n = ulong 0 |
| 97 | digits = ulong 0 |
| 98 | while lt p endp bound 8 |
| 99 | c = get hreq p |
| 100 | if eq c 10 |
| 101 | break |
| 102 | end |
| 103 | if or lt c 48 gt c 57 |
| 104 | ret false |
| 105 | end |
| 106 | digits = add digits 1 |
| 107 | n = add mul n 10 ulong sub c 48 |
| 108 | if or gt n 8000 gt digits 4 |
| 109 | ret false |
| 110 | end |
| 111 | p = add p 1 |
| 112 | end |
| 113 | if or eq digits 0 eq n 0 |
| 114 | ret false |
| 115 | end |
| 116 | if ge p endp |
| 117 | ret false |
| 118 | end |
| 119 | if ne get hreq p 10 |
| 120 | ret false |
| 121 | end |
| 122 | p = add p 1 |
| 123 | if gt add p n endp |
| 124 | ret false |
| 125 | end |
| 126 | if eq want 85 |
| 127 | for i ulong len cuser |
| 128 | cb get cuser i |
| 129 | end |
| 130 | else |
| 131 | for i ulong len cassist |
| 132 | cb get cassist i |
| 133 | end |
| 134 | end |
| 135 | if not ccontent p n |
| 136 | ret false |
| 137 | end |
| 138 | cb 34 |
| 139 | cb 125 |
| 140 | put cp 0 add p n |
| 141 | put ccount 0 add get ccount 0 1 |
| 142 | ret true |
| 143 | end |
| 144 | fn ccontent p ulong n ulong to bool |
| 145 | for i ulong n |
| 146 | c = get hreq add p i |
| 147 | if lt c 32 |
| 148 | if not or eq c 10 or eq c 13 eq c 9 |
| 149 | ret false |
| 150 | end |
| 151 | end |
| 152 | cjson c |
| 153 | end |
| 154 | ret true |
| 155 | end |
| 156 | fn cbuild to bool |
| 157 | put clen 0 0 |
| 158 | put ccount 0 0 |
| 159 | for i ulong len cpre |
| 160 | cb get cpre i |
| 161 | end |
| 162 | for i ulong len csys |
| 163 | cjson get csys i |
| 164 | end |
| 165 | cb 34 |
| 166 | cb 125 |
| 167 | while lt get cp 0 get cend 0 bound 63 |
| 168 | if not cmessage |
| 169 | ret false |
| 170 | end |
| 171 | if ge get ccount 0 63 |
| 172 | if lt get cp 0 get cend 0 |
| 173 | ret false |
| 174 | end |
| 175 | end |
| 176 | end |
| 177 | if eq rem get ccount 0 2 0 |
| 178 | ret false |
| 179 | end |
| 180 | cb 93 |
| 181 | cb 125 |
| 182 | ret true |
| 183 | end |
| 184 | fn cnumber n ulong to void |
| 185 | if ge n 10 |
| 186 | cnumber div n 10 |
| 187 | end |
| 188 | put hbuf get wused 0 uchar add rem n 10 48 |
| 189 | put wused 0 add get wused 0 1 |
| 190 | end |
| 191 | fn cheader to bool |
| 192 | put wused 0 0 |
| 193 | for i ulong len creq |
| 194 | c = get creq i |
| 195 | if eq c 10 |
| 196 | put hbuf get wused 0 13 |
| 197 | put wused 0 add get wused 0 1 |
| 198 | end |
| 199 | put hbuf get wused 0 c |
| 200 | put wused 0 add get wused 0 1 |
| 201 | end |
| 202 | cnumber get clen 0 |
| 203 | put hbuf get wused 0 13 |
| 204 | put hbuf add get wused 0 1 10 |
| 205 | put hbuf add get wused 0 2 13 |
| 206 | put hbuf add get wused 0 3 10 |
| 207 | old = get hfd 0 |
| 208 | put hfd 0 get cfd 0 |
| 209 | ok = hsend add get wused 0 4 |
| 210 | put hfd 0 old |
| 211 | ret ok |
| 212 | end |
| 213 | fn csend to bool |
| 214 | p = ulong 0 |
| 215 | deadline = add monons long 5000000000 |
| 216 | while lt p get clen 0 bound 131072 |
| 217 | left = sub deadline monons |
| 218 | if le left 0 |
| 219 | ret false |
| 220 | end |
| 221 | if le waitio get cfd 0 4 left 0 |
| 222 | ret false |
| 223 | end |
| 224 | r = send get cfd 0 cbuf p sub get clen 0 p 64 |
| 225 | if eq r neg long 11 |
| 226 | continue |
| 227 | end |
| 228 | if le r 0 |
| 229 | ret false |
| 230 | end |
| 231 | p = add p ulong r |
| 232 | end |
| 233 | ret true |
| 234 | end |
| 235 | fn cunavailable to void |
| 236 | p = ulong 0 |
| 237 | for i ulong len cunavail |
| 238 | c = get cunavail i |
| 239 | if eq c 10 |
| 240 | put hbuf p 13 |
| 241 | p = add p 1 |
| 242 | end |
| 243 | put hbuf p c |
| 244 | p = add p 1 |
| 245 | end |
| 246 | r = hsend p |
| 247 | end |
| 248 | fn cinvalid to void |
| 249 | p = ulong 0 |
| 250 | for i ulong len cbad |
| 251 | c = get cbad i |
| 252 | if eq c 10 |
| 253 | put hbuf p 13 |
| 254 | p = add p 1 |
| 255 | end |
| 256 | put hbuf p c |
| 257 | p = add p 1 |
| 258 | end |
| 259 | r = hsend p |
| 260 | end |
| 261 | fn cproxy to void |
| 262 | deadline = add monons long 120000000000 |
| 263 | put csent 0 0 |
| 264 | for chunk ulong 65536 |
| 265 | left = sub deadline monons |
| 266 | if le left 0 |
| 267 | break |
| 268 | end |
| 269 | if le waitio get cfd 0 1 left 0 |
| 270 | break |
| 271 | end |
| 272 | n = recv get cfd 0 hbuf 0 65536 64 |
| 273 | if eq n neg long 11 |
| 274 | continue |
| 275 | end |
| 276 | if le n 0 |
| 277 | break |
| 278 | end |
| 279 | put csent 0 1 |
| 280 | if not hsend ulong n |
| 281 | ret |
| 282 | end |
| 283 | end |
| 284 | if eq get csent 0 0 |
| 285 | cunavailable |
| 286 | end |
| 287 | end |
| 288 | fn cchat to void |
| 289 | if not cbody |
| 290 | cinvalid |
| 291 | ret |
| 292 | end |
| 293 | if not cbuild |
| 294 | cinvalid |
| 295 | ret |
| 296 | end |
| 297 | put caddr 0 2 |
| 298 | put caddr 2 71 |
| 299 | put caddr 3 2 |
| 300 | put caddr 4 127 |
| 301 | put caddr 7 1 |
| 302 | fd = socknew 2 524289 0 |
| 303 | if lt fd 0 |
| 304 | cunavailable |
| 305 | ret |
| 306 | end |
| 307 | if ne connect int fd caddr 0 16 0 |
| 308 | r = fclose int fd |
| 309 | cunavailable |
| 310 | ret |
| 311 | end |
| 312 | put cfd 0 int fd |
| 313 | if cheader |
| 314 | if csend |
| 315 | cproxy |
| 316 | else |
| 317 | cunavailable |
| 318 | end |
| 319 | else |
| 320 | cunavailable |
| 321 | end |
| 322 | r = fclose int fd |
| 323 | end |