interplane.Get Omega
Read in your language

omega-tool-model

First-party Omega tool-use model source, serving harnesses, and verification records

Brought by drakestapleton

branch main Branches Tags History

omega-tool-model / deployment / conversation / server.om

3426 lines · 78037 bytes Raw Blame History
1text z0 "fn calc x int to int\n"
2text z1 "s = x\nfor i ulong "
3text z2 "\ns = "
4text z3 "add"
5text z4 "plus"
6text z5 " s int "
7text z6 "\nend\nret s\nend\n"
8text z7 "ret "
9text z8 "mul"
10text z9 "sub"
11text z10 "times"
12text z11 " x int "
13text z12 "\nend\n"
14text z13 "fn main to int\nret calc int "
15text z14 "Could not read the practice file."
16text z15 "Refused unsupported source."
17text z16 "Could not prepare the test."
18text z17 "The compiler did not complete."
19text z18 "Compilation failed."
20text z19 "The test did not complete."
21text z20 "{\"type\":\"test\",\"input\":"
22text z21 ",\"expected\":"
23text z22 ",\"actual\":"
24text z23 "}"
25text z24 "The browser disconnected."
26text z25 "Test failed: calc("
27text z26 ") expected "
28text z27 ", got "
29text z28 "."
30text z29 "Tests passed."
31text z30 "tool"
32text z31 "path"
33text z32 "old"
34text z33 "new"
35text z34 "replace_text"
36text z35 "Task: Fix the error in this file and confirm its goal.\nFile: "
37text z36 "\nGoal: "
38text z37 "\nState: "
39text z38 "unread"
40text z39 "read"
41text z40 "failed"
42text z41 "edited"
43text z42 "checked"
44text z43 "missing"
45text z44 "Source:\n"
46text z45 "Tool result: "
47text z46 "Answer:\n"
48text z47 "read_file"
49text z48 "File not found."
50text z49 "Read succeeded."
51text z50 "observation"
52text z51 "omega_check"
53text z52 "Edit saved."
54text z53 "source"
55text z54 "original"
56text z55 "The model could not complete this request."
57text z56 "action"
58text z57 "The model completed the job and all four checks passed."
59text z58 "The model claimed success before verification. No success was recorded."
60text z59 "The model correctly reported the missing practice file."
61text z60 "The model incorrectly reported a missing file."
62text z61 "The model returned an unsupported action. The run stopped."
63text z62 "The model requested the wrong file. The run stopped."
64text z63 "The requested action was refused or could not finish."
65text z64 "The model reached the seven-step limit without finishing."
66text z65 "This practice area accepts only the small arithmetic program shapes shown in the examples. Keep the same main input."
67text z66 "jobs/item76666.om"
68text z67 "calc starts with x and adds 4 exactly 3 times in a for loop. main calls calc with 70."
69text z68 "jobs/item96171.om"
70text z69 "calc starts with x and adds 3 exactly 3 times in a for loop. main calls calc with 74."
71text z70 "jobs/item96294.om"
72text z71 "calc returns x plus 5. main calls calc with 73."
73text z72 "jobs/item82028.om"
74text z73 "calc returns x times 1. main calls calc with 72."
75text z74 "jobs/item82342.om"
76text z75 "calc starts with x and adds 1 exactly 6 times in a for loop. main calls calc with 72."
77text z76 "jobs/item85188.om"
78text z77 "calc starts with x and adds 2 exactly 4 times in a for loop. main calls calc with 70."
79text z78 "jobs/item83423.om"
80text z79 "calc starts with x and adds 5 exactly 3 times in a for loop. main calls calc with 71."
81text z80 "jobs/item80896.om"
82text z81 "jobs/item99846.om"
83text z82 "calc returns x plus 1. main calls calc with 70."
84text z83 "jobs/item86548.om"
85text z84 "calc returns x plus 1. main calls calc with 72."
86text z85 "jobs/item73182.om"
87text z86 "calc returns x times 1. main calls calc with 71."
88text z87 "jobs/item87470.om"
89text z88 "calc returns x times 1. main calls calc with 74."
90text z89 "jobs/item74558.om"
91text z90 "calc returns x times 1. main calls calc with 73."
92text z91 "{\"type\":\""
93text z92 "\",\"text\":"
94text z93 "{\"type\":\"done\",\"passed\":"
95text z94 "true"
96text z95 "false"
97text z96 ",\"message\":\""
98text z97 "\",\"source\":"
99note Private local protocol. No model-generated bytes are executed.
100global naddr uchar 110
101global nbuf uchar 8192
102global nfd int 1
103global nerr ulong 1
104text nsock "$HOME/.local/share/omega-tool-model/run/model.sock"
105text nlock "$HOME/.local/share/omega-tool-model/run/model.lock"
106
107fn naddress to void
108put naddr 0 1
109for i ulong len nsock
110put naddr add i 2 get nsock i
111end
112end
113
114fn nreceive off ulong n ulong timeout long to bool
115p = ulong 0
116deadline = add monons timeout
117while lt p n bound 8192
118left = sub deadline monons
119if le left 0
120ret false
121end
122r = waitio get nfd 0 1 left
123if le r 0
124ret false
125end
126r = recv get nfd 0 nbuf add off p sub n p 64
127if eq r neg long 11
128continue
129end
130if le r 0
131ret false
132end
133p = add p ulong r
134end
135ret true
136end
137
138fn nsend off ulong n ulong to bool
139p = ulong 0
140deadline = add monons long 2000000000
141while lt p n bound 8192
142left = sub deadline monons
143if le left 0
144ret false
145end
146r = waitio get nfd 0 4 left
147if le r 0
148ret false
149end
150r = send get nfd 0 nbuf add off p sub n p 64
151if eq r neg long 11
152continue
153end
154if le r 0
155ret false
156end
157p = add p ulong r
158end
159ret true
160end
161
162fn nlength to ulong
163ret add ulong get nbuf 0 mul ulong get nbuf 1 256
164end
165
166fn nheader n ulong to void
167put nbuf 0 uchar and n 255
168put nbuf 1 uchar and shr n 8 255
169end
170
171fn nstatus code ulong to void
172if eq code 0
173nheader 0
174r = nsend 0 2
175else
176nheader 65535
177put nbuf 2 uchar code
178r = nsend 0 3
179end
180end
181
182note Private, bounded HTTP adapter. No generated text is executed or interpreted as HTML.
183global hreq uchar 40960
184global hbuf uchar 65536
185global haddr uchar 16
186global hopt uchar 4
187global hstat uchar 4
188global hfd int 1
189global hcount ulong 1
190global hend ulong 1
191global hsize ulong 1
192global hseen ulong 1
193global hguard ulong 1
194global hhost ulong 1
195global hroute ulong 1
196text hex "0123456789abcdef"
197
198fn hsend n ulong to bool
199p = ulong 0
200deadline = add monons long 3000000000
201while lt p n bound 65536
202left = sub deadline monons
203if le left 0
204ret false
205end
206r = waitio get hfd 0 4 left
207if le r 0
208ret false
209end
210r = send get hfd 0 hbuf p sub n p 64
211if eq r neg long 11
212continue
213end
214if le r 0
215ret false
216end
217p = add p ulong r
218end
219ret true
220end
221
222fn hfind start ulong total ulong to bool
223while lt add start 3 total bound 8192
224if and eq get hreq start 13 eq get hreq add start 1 10
225if and eq get hreq add start 2 13 eq get hreq add start 3 10
226put hend 0 add start 4
227ret true
228end
229end
230start = add start 1
231end
232ret false
233end
234
235fn hread to bool
236put hcount 0 0
237put hend 0 0
238deadline = add monons long 5000000000
239for step ulong 8192
240n = get hcount 0
241if ge n 8192
242ret false
243end
244left = sub deadline monons
245if le left 0
246ret false
247end
248if le waitio get hfd 0 1 left 0
249ret false
250end
251r = recv get hfd 0 hreq n sub 8192 n 64
252if eq r neg long 11
253continue
254end
255if le r 0
256ret false
257end
258total = add n ulong r
259put hcount 0 total
260start = ulong 0
261if gt n 3
262start = sub n 3
263end
264if hfind start total
265ret true
266end
267end
268ret false
269end
270
271fn hline a ulong b ulong to bool
272if eq a b
273ret true
274end
275if iscl a b
276if ne get hseen 0 0
277ret false
278end
279put hseen 0 1
280p = add a 15
281while lt p b bound 8192
282if not or eq get hreq p 32 eq get hreq p 9
283break
284end
285p = add p 1
286end
287if eq p b
288ret false
289end
290v = ulong 0
291while lt p b bound 8192
292c = get hreq p
293if or lt c 48 gt c 57
294ret false
295end
296v = add mul v 10 ulong sub c 48
297if gt v 24000
298ret false
299end
300p = add p 1
301end
302put hsize 0 v
303ret true
304end
305if iste a b
306ret false
307end
308if isguard a b
309put hguard 0 add get hguard 0 1
310end
311if ishost a b
312if not goodhost a b
313ret false
314end
315put hhost 0 add get hhost 0 1
316end
317ret true
318end
319
320fn hparse to bool
321put hsize 0 0
322put hseen 0 0
323put hguard 0 0
324put hhost 0 0
325put hroute 0 0
326n = get hend 0
327a = ulong 0
328first = true
329for i ulong sub n 1
330c = get hreq i
331if and eq c 13 eq get hreq add i 1 10
332if first
333if isroot a i
334put hroute 0 1
335end
336if isgen a i
337put hroute 0 2
338end
339if isrepair a i
340put hroute 0 3
341end
342if ischat a i
343put hroute 0 4
344end
345first = false
346else
347if not hline a i
348ret false
349end
350end
351a = add i 2
352else
353if not first
354if and ge c 65 le c 90
355put hreq i add c 32
356end
357end
358end
359end
360ret eq get hhost 0 1
361end
362
363fn hbody to bool
364n = get hsize 0
365off = get hend 0
366total = add off n
367if or eq n 0 gt n 4000
368ret false
369end
370if gt get hcount 0 total
371ret false
372end
373deadline = add monons long 5000000000
374while lt get hcount 0 total bound 4000
375p = get hcount 0
376left = sub deadline monons
377if le left 0
378ret false
379end
380if le waitio get hfd 0 1 left 0
381ret false
382end
383r = recv get hfd 0 hreq p sub total p 64
384if eq r neg long 11
385continue
386end
387if le r 0
388ret false
389end
390put hcount 0 add p ulong r
391end
392nheader n
393for i ulong n
394c = get hreq add off i
395if eq c 0
396ret false
397end
398put nbuf add i 2 c
399end
400ret true
401end
402
403fn hchunk n ulong to bool
404for i ulong 4
405shift = mul sub 3 i 4
406put hbuf i get hex and shr n shift 15
407end
408put hbuf 4 13
409put hbuf 5 10
410for i ulong n
411put hbuf add i 6 get nbuf i
412end
413put hbuf add n 6 13
414put hbuf add n 7 10
415ret hsend add n 8
416end
417
418fn hstream to void
419started = false
420for frame ulong 1024
421if not nreceive 0 2 30000000000
422if not started
423r = respond502
424end
425ret
426end
427n = nlength
428if eq n 65535
429if not started
430if nreceive 0 1 2000000000
431if eq get nbuf 0 3
432r = respond422
433else
434r = respond502
435end
436else
437r = respond502
438end
439end
440ret
441end
442if gt n 4096
443if not started
444r = respond502
445end
446ret
447end
448if not started
449if not streamhead
450ret
451end
452started = true
453end
454if eq n 0
455r = streamend
456ret
457end
458if not nreceive 0 n 2000000000
459ret
460end
461if not hchunk n
462ret
463end
464end
465end
466
467fn hmodel to void
468naddress
469fd = socknew 1 524289 0
470if lt fd 0
471r = respond503
472ret
473end
474if ne connect int fd naddr 0 add len nsock 3 0
475closed = fclose int fd
476r = respond503
477ret
478end
479put nfd 0 int fd
480if nsend 0 add get hsize 0 2
481hstream
482else
483r = respond502
484end
485closed = fclose int fd
486end
487
488fn hserve to void
489if not hread
490r = respond400
491ret
492end
493if not hparse
494r = respond400
495ret
496end
497route = get hroute 0
498if eq route 4
499if or ne get hguard 0 1 ne get hseen 0 1
500r = respond400
501ret
502end
503cchat
504ret
505end
506if eq route 1
507if ne get hsize 0 0
508r = respond400
509ret
510end
511r = respondpage
512ret
513end
514if or eq route 2 eq route 3
515if or ne get hguard 0 1 ne get hseen 0 1
516r = respond400
517ret
518end
519if not hbody
520r = respond400
521ret
522end
523if eq route 3
524wrepair
525else
526hmodel
527end
528else
529r = respond404
530end
531end
532
533fn main to int
534put haddr 0 2
535put haddr 2 70
536put haddr 3 253
537put haddr 4 127
538put haddr 7 1
539put hopt 0 1
540fd = socknew 2 524289 0
541if lt fd 0
542ret 70
543end
544r = sockopt int fd 1 2 hopt 0 4
545if ne bind int fd haddr 0 16 0
546ret 71
547end
548if ne listen int fd 16 0
549ret 72
550end
551active = ulong 0
552for request ulong 1000000
553for reap ulong 16
554done = waitpid -1 hstat 0 4 1
555if le done 0
556break
557end
558if gt active 0
559active = sub active 1
560end
561end
562if ge active 16
563r = sleepns 10000000
564continue
565end
566if le waitio int fd 1 1000000000 0
567continue
568end
569client = accept int fd 524288
570if lt client 0
571continue
572end
573pid = fork
574if eq pid 0
575r = fclose int fd
576put hfd 0 int client
577r = sockopt int client 6 1 hopt 0 4
578hserve
579r = fclose int client
580ret 0
581end
582r = fclose int client
583if gt pid 0
584active = add active 1
585end
586end
587ret 0
588end
589
590note Model-driven tools for one bounded arithmetic practice file. Paths from the model never become OS paths.
591global wsrc uchar 1024
592global wslen ulong 1
593global wobs uchar 1024
594global wolen ulong 1
595global wans uchar 4096
596global walen ulong 1
597global wpath uchar 128
598global wplen ulong 1
599global wgoal uchar 256
600global wglen ulong 1
601global wbuf uchar 8192
602global wlen ulong 1
603global wjob ulong 5
604global wstate ulong 1
605global wvalid ulong 1
606global wcall ulong 1
607global wclen ulong 1
608global wtmp uchar 1024
609global wtlen ulong 1
610global wargv uchar 1024
611global wstat uchar 4
612global wdir uchar 256
613global wdlen ulong 1
614global wout uchar 4096
615global wused ulong 1
616global wfld uchar 512
617global wflen ulong 4
618global wpos ulong 1
619global wtok uchar 128
620global wtkn ulong 1
621text wprog "program.om"
622text wtest "test.om"
623text wexe "test.bin"
624text werr "check.err"
625text wrout "run.out"
626text wbase "$HOME/.local/share/omega-tool-model/practice/"
627text wcomp "$HOME/.local/share/omega-tool-model/round40-conversation/omc"
628text wexec "./test.bin"
629
630fn wb c uchar to void
631if ge get wlen 0 8192
632exit 90
633end
634put wbuf get wlen 0 c
635put wlen 0 add get wlen 0 1
636end
637fn wn n ulong to void
638if ge n 10
639wn div n 10
640end
641wb uchar add rem n 10 48
642end
643fn wz to void
644put wlen 0 0
645end
646fn wbyte mode ulong i ulong to uchar
647if eq mode 1
648ret get wsrc i
649end
650if eq mode 2
651ret get wobs i
652end
653if eq mode 3
654ret get wans i
655end
656if eq mode 4
657ret get wpath i
658end
659if eq mode 5
660ret get wgoal i
661end
662ret get wfld add mul sub mode 6 128 i
663end
664fn wlength mode ulong to ulong
665if eq mode 1
666ret get wslen 0
667end
668if eq mode 2
669ret get wolen 0
670end
671if eq mode 3
672ret get walen 0
673end
674if eq mode 4
675ret get wplen 0
676end
677if eq mode 5
678ret get wglen 0
679end
680ret get wflen sub mode 6
681end
682fn wa mode ulong to void
683for i ulong wlength mode
684wb wbyte mode i
685end
686end
687fn wj mode ulong to void
688wb 34
689for i ulong wlength mode
690c = wbyte mode i
691if or eq c 34 eq c 92
692wb 92
693wb c
694else
695if eq c 10
696wb 92
697wb 110
698else
699if eq c 13
700wb 92
701wb 114
702else
703if eq c 9
704wb 92
705wb 116
706else
707if lt c 32
708wb 63
709else
710wb c
711end
712end
713end
714end
715end
716end
717wb 34
718end
719fn wobsbuf to void
720if gt get wlen 0 1024
721exit 90
722end
723put wolen 0 get wlen 0
724for i ulong get wlen 0
725put wobs i get wbuf i
726end
727end
728fn wemit to bool
729wb 10
730n = get wlen 0
731for i ulong n
732put nbuf i get wbuf i
733end
734ret hchunk n
735end
736fn wsmall at ulong to ulong
737if ge at get wslen 0
738ret 10000
739end
740c = get wsrc at
741if or lt c 49 gt c 54
742ret 10000
743end
744ret add at 1
745end
746fn wgrammar to bool
747put wcall 0 0
748put wclen 0 0
749p = wconsumec0 0
750if wmc1 p
751p = wconsumec2 p
752p = wsmall p
753p = wconsumec3 p
754if wmc4 p
755p = add p 3
756else
757p = wconsumec5 p
758end
759p = wconsumec6 p
760p = wsmall p
761p = wconsumec7 p
762else
763if eq get wjob 0 2
764ret false
765end
766p = wconsumec8 p
767if or wmc4 p or wmc9 p wmc10 p
768p = add p 3
769else
770if wmc11 p
771p = add p 4
772else
773p = wconsumec12 p
774end
775end
776p = wconsumec13 p
777p = wsmall p
778p = wconsumec14 p
779end
780p = wconsumec15 p
781if ge p get wslen 0
782ret false
783end
784put wcall 0 p
785v = ulong 0
786start = p
787while lt p get wslen 0 bound 1024
788c = get wsrc p
789if or lt c 48 gt c 57
790break
791end
792v = add mul v 10 ulong sub c 48
793if gt v 99
794ret false
795end
796p = add p 1
797end
798if or eq p start gt sub p start 2
799ret false
800end
801put wclen 0 sub p start
802if ne v get wjob 1
803ret false
804end
805p = wconsumec14 p
806ret eq p get wslen 0
807end
808
809fn wsave to bool
810fd = fopen wprog 0 len wprog 524865 384
811if lt fd 0
812ret false
813end
814n = write int fd wsrc 0 get wslen 0
815r = fclose int fd
816ret and eq n long get wslen 0 eq r 0
817end
818fn wload to bool
819fd = fopen wprog 0 len wprog 524288 0
820if lt fd 0
821ret false
822end
823n = read int fd wsrc 0 1024
824r = fclose int fd
825if or le n 0 gt n 600
826ret false
827end
828put wslen 0 ulong n
829ret eq r 0
830end
831fn wmkdir to bool
832wz
833wtc16
834wn ulong getpid
835wb 45
836wn ulong monons
837n = get wlen 0
838for i ulong n
839put wdir i get wbuf i
840end
841put wdlen 0 n
842if ne makedir wdir 0 n 448 0
843ret false
844end
845ret eq chdir wdir 0 n 0
846end
847fn wclean to void
848r = unlink wprog 0 len wprog
849r = unlink wtest 0 len wtest
850r = unlink wexe 0 len wexe
851r = unlink werr 0 len werr
852r = unlink wrout 0 len wrout
853r = chdir wbase 0 len wbase
854r = rmdir wdir 0 get wdlen 0
855end
856fn wwait pid int timeout long to long
857deadline = add monons timeout
858for poll ulong 10000
859r = waitpid pid wstat 0 4 1
860if eq r long pid
861if ne get wstat 0 0
862ret -2
863end
864ret long get wstat 1
865end
866if lt r 0
867ret -3
868end
869if ge monons deadline
870r = killpid pid 9
871r = waitpid pid wstat 0 4 0
872ret -1
873end
874r = sleepns 1000000
875end
876r = killpid pid 9
877r = waitpid pid wstat 0 4 0
878ret -1
879end
880fn wlaunch mode ulong ifd int ofd int efd int to long
881wz
882if eq mode 0
883wtc17
884else
885wtc18
886end
887n = get wlen 0
888put wargv 0 1
889put wargv 1 0
890put wargv 2 uchar and n 255
891put wargv 3 uchar shr n 8
892for i ulong n
893put wargv add i 4 get wbuf i
894end
895pid = fork
896if lt pid 0
897ret -3
898end
899if eq pid 0
900if ne dupfd ifd 0 0 0
901exit 98
902end
903if ne dupfd ofd 1 0 1
904exit 98
905end
906if ne dupfd efd 2 0 2
907exit 98
908end
909r = execprog wargv 0 add n 4
910exit 98
911end
912ret wwait int pid 2000000000
913end
914fn wcompile to long
915inf = fopen wtest 0 len wtest 524288 0
916outf = fopen wexe 0 len wexe 524865 384
917errf = fopen werr 0 len werr 524865 384
918if or lt inf 0 or lt outf 0 lt errf 0
919r = fclose int inf
920r = fclose int outf
921r = fclose int errf
922ret -3
923end
924rc = wlaunch 0 int inf int outf int errf
925r = fclose int inf
926r = fclose int outf
927r = fclose int errf
928ret rc
929end
930fn wrun to long
931inf = fopen wtest 0 len wtest 524288 0
932outf = fopen wrout 0 len wrout 524865 384
933errf = fopen werr 0 len werr 524865 384
934if or lt inf 0 or lt outf 0 lt errf 0
935r = fclose int inf
936r = fclose int outf
937r = fclose int errf
938ret -3
939end
940if ne chmod wexe 0 len wexe 448 0
941r = fclose int inf
942r = fclose int outf
943r = fclose int errf
944ret -3
945end
946rc = wlaunch 1 int inf int outf int errf
947r = fclose int inf
948r = fclose int outf
949r = fclose int errf
950ret rc
951end
952fn wtestsrc x ulong to bool
953wz
954for i ulong get wcall 0
955wb get wsrc i
956end
957wn x
958p = add get wcall 0 get wclen 0
959while lt p get wslen 0 bound 1024
960wb get wsrc p
961p = add p 1
962end
963fd = fopen wtest 0 len wtest 524865 384
964if lt fd 0
965ret false
966end
967n = write int fd wbuf 0 get wlen 0
968r = fclose int fd
969ret and eq n long get wlen 0 eq r 0
970end
971fn wexpected x ulong to ulong
972if eq get wjob 0 0
973ret add x get wjob 2
974end
975if eq get wjob 0 1
976ret mul x get wjob 2
977end
978ret add x mul get wjob 2 get wjob 3
979end
980fn wcheck to bool
981if not wload
982woc19
983ret false
984end
985if not wgrammar
986woc20
987ret false
988end
989for test ulong 4
990x = get wjob 1
991if eq test 1
992x = 0
993end
994if eq test 2
995x = 3
996end
997if eq test 3
998x = 7
999end
1000if not wtestsrc x
1001woc21
1002ret false
1003end
1004rc = wcompile
1005if ne rc 0
1006if lt rc 0
1007woc22
1008ret false
1009end
1010fd = fopen werr 0 len werr 524288 0
1011n = read int fd wobs 0 1024
1012r = fclose int fd
1013if le n 0
1014woc23
1015else
1016put wolen 0 ulong n
1017while gt get wolen 0 0 bound 1024
1018p = sub get wolen 0 1
1019if ne get wobs p 10
1020break
1021end
1022put wolen 0 p
1023end
1024end
1025ret false
1026end
1027actual = wrun
1028if lt actual 0
1029woc24
1030ret false
1031end
1032want = wexpected x
1033wz
1034wtc25
1035wn x
1036wtc26
1037wn want
1038wtc27
1039wn ulong actual
1040wtc28
1041if not wemit
1042woc29
1043ret false
1044end
1045if ne ulong actual want
1046wz
1047wtc30
1048wn x
1049wtc31
1050wn want
1051wtc32
1052wn ulong actual
1053wtc33
1054wobsbuf
1055ret false
1056end
1057end
1058woc34
1059ret true
1060end
1061
1062note Strict JSON object with exactly tool/path, or tool/path/old/new, all bounded strings.
1063fn wspace to void
1064while lt get wpos 0 get walen 0 bound 4096
1065c = get wans get wpos 0
1066if not or or eq c 32 eq c 10 or eq c 13 eq c 9
1067ret
1068end
1069put wpos 0 add get wpos 0 1
1070end
1071end
1072fn wpunc c uchar to bool
1073wspace
1074p = get wpos 0
1075if ge p get walen 0
1076ret false
1077end
1078if ne get wans p c
1079ret false
1080end
1081put wpos 0 add p 1
1082ret true
1083end
1084fn wstring to bool
1085put wtkn 0 0
1086if not wpunc 34
1087ret false
1088end
1089while lt get wpos 0 get walen 0 bound 4096
1090p = get wpos 0
1091c = get wans p
1092put wpos 0 add p 1
1093if eq c 34
1094ret true
1095end
1096if lt c 32
1097ret false
1098end
1099if eq c 92
1100p = get wpos 0
1101if ge p get walen 0
1102ret false
1103end
1104c = get wans p
1105put wpos 0 add p 1
1106if eq c 110
1107c = 10
1108else
1109if eq c 114
1110c = 13
1111else
1112if eq c 116
1113c = 9
1114else
1115if not or eq c 34 or eq c 92 eq c 47
1116ret false
1117end
1118end
1119end
1120end
1121end
1122if ge get wtkn 0 127
1123ret false
1124end
1125put wtok get wtkn 0 c
1126put wtkn 0 add get wtkn 0 1
1127end
1128ret false
1129end
1130fn wjson to bool
1131put wpos 0 0
1132for i ulong 4
1133put wflen i 0
1134end
1135if not wpunc 123
1136ret false
1137end
1138mask = ulong 0
1139for field ulong 4
1140if not wstring
1141ret false
1142end
1143slot = ulong 4
1144if wtokenc35
1145slot = 0
1146end
1147if wtokenc36
1148slot = 1
1149end
1150if wtokenc37
1151slot = 2
1152end
1153if wtokenc38
1154slot = 3
1155end
1156if eq slot 4
1157ret false
1158end
1159bit = shl ulong 1 slot
1160if ne and mask bit 0
1161ret false
1162end
1163mask = or mask bit
1164if not wpunc 58
1165ret false
1166end
1167if not wstring
1168ret false
1169end
1170put wflen slot get wtkn 0
1171for i ulong get wtkn 0
1172put wfld add mul slot 128 i get wtok i
1173end
1174wspace
1175p = get wpos 0
1176if ge p get walen 0
1177ret false
1178end
1179if eq get wans p 125
1180put wpos 0 add p 1
1181wspace
1182if ne get wpos 0 get walen 0
1183ret false
1184end
1185if wfieldc39 0
1186ret eq mask 15
1187end
1188ret eq mask 3
1189end
1190if not wpunc 44
1191ret false
1192end
1193end
1194ret false
1195end
1196fn wmatchold at ulong to bool
1197n = get wflen 2
1198if gt add at n get wslen 0
1199ret false
1200end
1201for i ulong n
1202if ne get wsrc add at i get wfld add 256 i
1203ret false
1204end
1205end
1206ret true
1207end
1208fn wpatch to bool
1209oldn = get wflen 2
1210newn = get wflen 3
1211if or eq oldn 0 or gt oldn 40 gt newn 40
1212ret false
1213end
1214count = ulong 0
1215found = ulong 0
1216for i ulong get wslen 0
1217if wmatchold i
1218count = add count 1
1219found = i
1220end
1221end
1222if ne count 1
1223ret false
1224end
1225newsize = add sub get wslen 0 oldn newn
1226if gt newsize 600
1227ret false
1228end
1229put wtlen 0 get wslen 0
1230for i ulong get wslen 0
1231put wtmp i get wsrc i
1232end
1233p = found
1234for i ulong newn
1235put wsrc p get wfld add 384 i
1236p = add p 1
1237end
1238tail = add found oldn
1239while lt tail get wtlen 0 bound 1024
1240put wsrc p get wtmp tail
1241p = add p 1
1242tail = add tail 1
1243end
1244put wslen 0 newsize
1245if not wgrammar
1246put wslen 0 get wtlen 0
1247for i ulong get wtlen 0
1248put wsrc i get wtmp i
1249end
1250ret false
1251end
1252ret wsave
1253end
1254
1255fn wprompt to void
1256wz
1257wtc40
1258wa 4
1259wtc41
1260wa 5
1261wtc42
1262s = get wstate 0
1263if eq s 0
1264wtc43
1265end
1266if eq s 1
1267wtc44
1268end
1269if eq s 2
1270wtc45
1271end
1272if eq s 3
1273wtc46
1274end
1275if eq s 4
1276wtc47
1277end
1278if eq s 5
1279wtc48
1280end
1281wb 10
1282if and ne s 0 ne s 5
1283wtc49
1284wa 1
1285end
1286if ne s 0
1287wtc50
1288wa 2
1289wb 10
1290end
1291wtc51
1292end
1293fn wresponse to bool
1294put walen 0 0
1295for frame ulong 1024
1296if not nreceive 0 2 30000000000
1297ret false
1298end
1299n = nlength
1300if eq n 0
1301ret true
1302end
1303if or eq n 65535 gt n 4096
1304ret false
1305end
1306if gt add get walen 0 n 4096
1307ret false
1308end
1309if not nreceive 0 n 2000000000
1310ret false
1311end
1312for i ulong n
1313put wans add get walen 0 i get nbuf i
1314end
1315put walen 0 add get walen 0 n
1316end
1317ret false
1318end
1319fn wask to bool
1320wprompt
1321n = get wlen 0
1322if gt n 4000
1323ret false
1324end
1325nheader n
1326for i ulong n
1327put nbuf add i 2 get wbuf i
1328end
1329naddress
1330fd = socknew 1 524289 0
1331if lt fd 0
1332ret false
1333end
1334if ne connect int fd naddr 0 add len nsock 3 0
1335r = fclose int fd
1336ret false
1337end
1338put nfd 0 int fd
1339ok = false
1340if nsend 0 add n 2
1341ok = wresponse
1342end
1343r = fclose int fd
1344ret ok
1345end
1346fn wrightpath to bool
1347if ne get wflen 1 get wplen 0
1348ret false
1349end
1350for i ulong get wplen 0
1351if ne get wfld add 128 i get wpath i
1352ret false
1353end
1354end
1355ret true
1356end
1357fn waction to bool
1358s = get wstate 0
1359if and wfieldc52 0 eq s 0
1360if eq get wjob 4 1
1361put wslen 0 0
1362put wstate 0 5
1363woc53
1364else
1365if not wload
1366ret false
1367end
1368put wstate 0 1
1369woc54
1370end
1371ret weventc55 2
1372end
1373if and wfieldc56 0 or eq s 1 eq s 3
1374put wvalid 0 0
1375if wcheck
1376put wstate 0 4
1377put wvalid 0 1
1378else
1379put wstate 0 2
1380end
1381ret weventc55 2
1382end
1383if and wfieldc39 0 eq s 2
1384if not wpatch
1385ret false
1386end
1387put wstate 0 3
1388put wvalid 0 0
1389woc57
1390if not weventc58 1
1391ret false
1392end
1393ret weventc55 2
1394end
1395ret false
1396end
1397fn wloop to void
1398put wstate 0 0
1399put wvalid 0 0
1400if not weventc59 1
1401ret
1402end
1403for turn ulong 7
1404if not wask
1405wfinishc60 false
1406ret
1407end
1408if not weventc61 3
1409ret
1410end
1411if wanswerc62
1412if and eq get wstate 0 4 eq get wvalid 0 1
1413wfinishc63 true
1414else
1415wfinishc64 false
1416end
1417ret
1418end
1419if wanswerc65
1420if eq get wstate 0 5
1421wfinishc66 false
1422else
1423wfinishc67 false
1424end
1425ret
1426end
1427if not wjson
1428wfinishc68 false
1429ret
1430end
1431if not wrightpath
1432wfinishc69 false
1433ret
1434end
1435if not waction
1436wfinishc70 false
1437ret
1438end
1439end
1440wfinishc71 false
1441end
1442fn wrepair to void
1443n = get hsize 0
1444off = get hend 0
1445if lt n 2
1446r = respond400
1447ret
1448end
1449id = get hreq off
1450if or lt id 65 gt id 77
1451r = respond400
1452ret
1453end
1454if ne get hreq add off 1 10
1455r = respond400
1456ret
1457end
1458wjobload ulong sub id 65
1459if gt sub n 2 600
1460r = respond400
1461ret
1462end
1463put wslen 0 sub n 2
1464for i ulong get wslen 0
1465put wsrc i get hreq add add off 2 i
1466end
1467if eq get wjob 4 1
1468put wslen 0 0
1469else
1470if not wgrammar
1471if streamhead
1472wfinishc72 false
1473end
1474ret
1475end
1476end
1477if not wmkdir
1478r = respond503
1479ret
1480end
1481if ne get wjob 4 1
1482if not wsave
1483wclean
1484r = respond503
1485ret
1486end
1487end
1488if streamhead
1489wloop
1490end
1491wclean
1492end
1493
1494note Bounded chat-only bridge to the separately approved local Qwen companion.
1495note No URLs, files, tool permissions or generation settings are taken from model text.
1496global cbuf uchar 131072
1497global clen ulong 1
1498global caddr uchar 16
1499global cfd int 1
1500global cp ulong 1
1501global cend ulong 1
1502global ccount ulong 1
1503global csent ulong 1
1504text 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."
1505text cpre "{\"model\":\"omega-chat-companion\",\"stream\":true,\"cache_prompt\":true,\"max_tokens\":1024,\"temperature\":0.6,\"top_p\":0.8,\"messages\":[{\"role\":\"system\",\"content\":\""
1506text cuser ",{\"role\":\"user\",\"content\":\""
1507text cassist ",{\"role\":\"assistant\",\"content\":\""
1508text creq "POST /v1/chat/completions HTTP/1.1\nHost: 127.0.0.1:18178\nContent-Type: application/json\nConnection: close\nContent-Length: "
1509text 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."
1510text 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."
1511
1512fn cb c uchar to void
1513if ge get clen 0 131072
1514exit 90
1515end
1516put cbuf get clen 0 c
1517put clen 0 add get clen 0 1
1518end
1519fn cjson c uchar to void
1520if or eq c 34 eq c 92
1521cb 92
1522cb c
1523ret
1524end
1525if eq c 10
1526cb 92
1527cb 110
1528ret
1529end
1530if eq c 13
1531cb 92
1532cb 114
1533ret
1534end
1535if eq c 9
1536cb 92
1537cb 116
1538ret
1539end
1540cb c
1541end
1542fn cbody to bool
1543n = get hsize 0
1544off = get hend 0
1545if or eq n 0 gt n 24000
1546ret false
1547end
1548total = add off n
1549if gt get hcount 0 total
1550ret false
1551end
1552deadline = add monons long 5000000000
1553while lt get hcount 0 total bound 24000
1554p = get hcount 0
1555left = sub deadline monons
1556if le left 0
1557ret false
1558end
1559if le waitio get hfd 0 1 left 0
1560ret false
1561end
1562r = recv get hfd 0 hreq p sub total p 64
1563if eq r neg long 11
1564continue
1565end
1566if le r 0
1567ret false
1568end
1569put hcount 0 add p ulong r
1570end
1571put cp 0 off
1572put cend 0 total
1573ret true
1574end
1575fn cmessage to bool
1576p = get cp 0
1577endp = get cend 0
1578if ge p endp
1579ret false
1580end
1581want = uchar 85
1582if eq rem get ccount 0 2 1
1583want = 65
1584end
1585if ne get hreq p want
1586ret false
1587end
1588p = add p 1
1589n = ulong 0
1590digits = ulong 0
1591while lt p endp bound 8
1592c = get hreq p
1593if eq c 10
1594break
1595end
1596if or lt c 48 gt c 57
1597ret false
1598end
1599digits = add digits 1
1600n = add mul n 10 ulong sub c 48
1601if or gt n 8000 gt digits 4
1602ret false
1603end
1604p = add p 1
1605end
1606if or eq digits 0 eq n 0
1607ret false
1608end
1609if ge p endp
1610ret false
1611end
1612if ne get hreq p 10
1613ret false
1614end
1615p = add p 1
1616if gt add p n endp
1617ret false
1618end
1619if eq want 85
1620for i ulong len cuser
1621cb get cuser i
1622end
1623else
1624for i ulong len cassist
1625cb get cassist i
1626end
1627end
1628if not ccontent p n
1629ret false
1630end
1631cb 34
1632cb 125
1633put cp 0 add p n
1634put ccount 0 add get ccount 0 1
1635ret true
1636end
1637fn ccontent p ulong n ulong to bool
1638for i ulong n
1639c = get hreq add p i
1640if lt c 32
1641if not or eq c 10 or eq c 13 eq c 9
1642ret false
1643end
1644end
1645cjson c
1646end
1647ret true
1648end
1649fn cbuild to bool
1650put clen 0 0
1651put ccount 0 0
1652for i ulong len cpre
1653cb get cpre i
1654end
1655for i ulong len csys
1656cjson get csys i
1657end
1658cb 34
1659cb 125
1660while lt get cp 0 get cend 0 bound 63
1661if not cmessage
1662ret false
1663end
1664if ge get ccount 0 63
1665if lt get cp 0 get cend 0
1666ret false
1667end
1668end
1669end
1670if eq rem get ccount 0 2 0
1671ret false
1672end
1673cb 93
1674cb 125
1675ret true
1676end
1677fn cnumber n ulong to void
1678if ge n 10
1679cnumber div n 10
1680end
1681put hbuf get wused 0 uchar add rem n 10 48
1682put wused 0 add get wused 0 1
1683end
1684fn cheader to bool
1685put wused 0 0
1686for i ulong len creq
1687c = get creq i
1688if eq c 10
1689put hbuf get wused 0 13
1690put wused 0 add get wused 0 1
1691end
1692put hbuf get wused 0 c
1693put wused 0 add get wused 0 1
1694end
1695cnumber get clen 0
1696put hbuf get wused 0 13
1697put hbuf add get wused 0 1 10
1698put hbuf add get wused 0 2 13
1699put hbuf add get wused 0 3 10
1700old = get hfd 0
1701put hfd 0 get cfd 0
1702ok = hsend add get wused 0 4
1703put hfd 0 old
1704ret ok
1705end
1706fn csend to bool
1707p = ulong 0
1708deadline = add monons long 5000000000
1709while lt p get clen 0 bound 131072
1710left = sub deadline monons
1711if le left 0
1712ret false
1713end
1714if le waitio get cfd 0 4 left 0
1715ret false
1716end
1717r = send get cfd 0 cbuf p sub get clen 0 p 64
1718if eq r neg long 11
1719continue
1720end
1721if le r 0
1722ret false
1723end
1724p = add p ulong r
1725end
1726ret true
1727end
1728fn cunavailable to void
1729p = ulong 0
1730for i ulong len cunavail
1731c = get cunavail i
1732if eq c 10
1733put hbuf p 13
1734p = add p 1
1735end
1736put hbuf p c
1737p = add p 1
1738end
1739r = hsend p
1740end
1741fn cinvalid to void
1742p = ulong 0
1743for i ulong len cbad
1744c = get cbad i
1745if eq c 10
1746put hbuf p 13
1747p = add p 1
1748end
1749put hbuf p c
1750p = add p 1
1751end
1752r = hsend p
1753end
1754fn cproxy to void
1755deadline = add monons long 120000000000
1756put csent 0 0
1757for chunk ulong 65536
1758left = sub deadline monons
1759if le left 0
1760break
1761end
1762if le waitio get cfd 0 1 left 0
1763break
1764end
1765n = recv get cfd 0 hbuf 0 65536 64
1766if eq n neg long 11
1767continue
1768end
1769if le n 0
1770break
1771end
1772put csent 0 1
1773if not hsend ulong n
1774ret
1775end
1776end
1777if eq get csent 0 0
1778cunavailable
1779end
1780end
1781fn cchat to void
1782if not cbody
1783cinvalid
1784ret
1785end
1786if not cbuild
1787cinvalid
1788ret
1789end
1790put caddr 0 2
1791put caddr 2 71
1792put caddr 3 2
1793put caddr 4 127
1794put caddr 7 1
1795fd = socknew 2 524289 0
1796if lt fd 0
1797cunavailable
1798ret
1799end
1800if ne connect int fd caddr 0 16 0
1801r = fclose int fd
1802cunavailable
1803ret
1804end
1805put cfd 0 int fd
1806if cheader
1807if csend
1808cproxy
1809else
1810cunavailable
1811end
1812else
1813cunavailable
1814end
1815r = fclose int fd
1816end
1817
1818fn wjobload id ulong to void
1819if eq id 0
1820put wjob 0 2
1821put wjob 1 70
1822put wjob 2 4
1823put wjob 3 3
1824put wjob 4 0
1825wz
1826wtc73
1827put wplen 0 get wlen 0
1828for i ulong get wlen 0
1829put wpath i get wbuf i
1830end
1831wz
1832wtc74
1833put wglen 0 get wlen 0
1834for i ulong get wlen 0
1835put wgoal i get wbuf i
1836end
1837ret
1838end
1839if eq id 1
1840put wjob 0 2
1841put wjob 1 74
1842put wjob 2 3
1843put wjob 3 3
1844put wjob 4 0
1845wz
1846wtc75
1847put wplen 0 get wlen 0
1848for i ulong get wlen 0
1849put wpath i get wbuf i
1850end
1851wz
1852wtc76
1853put wglen 0 get wlen 0
1854for i ulong get wlen 0
1855put wgoal i get wbuf i
1856end
1857ret
1858end
1859if eq id 2
1860put wjob 0 0
1861put wjob 1 73
1862put wjob 2 5
1863put wjob 3 0
1864put wjob 4 0
1865wz
1866wtc77
1867put wplen 0 get wlen 0
1868for i ulong get wlen 0
1869put wpath i get wbuf i
1870end
1871wz
1872wtc78
1873put wglen 0 get wlen 0
1874for i ulong get wlen 0
1875put wgoal i get wbuf i
1876end
1877ret
1878end
1879if eq id 3
1880put wjob 0 1
1881put wjob 1 72
1882put wjob 2 1
1883put wjob 3 0
1884put wjob 4 0
1885wz
1886wtc79
1887put wplen 0 get wlen 0
1888for i ulong get wlen 0
1889put wpath i get wbuf i
1890end
1891wz
1892wtc80
1893put wglen 0 get wlen 0
1894for i ulong get wlen 0
1895put wgoal i get wbuf i
1896end
1897ret
1898end
1899if eq id 4
1900put wjob 0 2
1901put wjob 1 72
1902put wjob 2 1
1903put wjob 3 6
1904put wjob 4 0
1905wz
1906wtc81
1907put wplen 0 get wlen 0
1908for i ulong get wlen 0
1909put wpath i get wbuf i
1910end
1911wz
1912wtc82
1913put wglen 0 get wlen 0
1914for i ulong get wlen 0
1915put wgoal i get wbuf i
1916end
1917ret
1918end
1919if eq id 5
1920put wjob 0 2
1921put wjob 1 70
1922put wjob 2 2
1923put wjob 3 4
1924put wjob 4 0
1925wz
1926wtc83
1927put wplen 0 get wlen 0
1928for i ulong get wlen 0
1929put wpath i get wbuf i
1930end
1931wz
1932wtc84
1933put wglen 0 get wlen 0
1934for i ulong get wlen 0
1935put wgoal i get wbuf i
1936end
1937ret
1938end
1939if eq id 6
1940put wjob 0 2
1941put wjob 1 71
1942put wjob 2 5
1943put wjob 3 3
1944put wjob 4 1
1945wz
1946wtc85
1947put wplen 0 get wlen 0
1948for i ulong get wlen 0
1949put wpath i get wbuf i
1950end
1951wz
1952wtc86
1953put wglen 0 get wlen 0
1954for i ulong get wlen 0
1955put wgoal i get wbuf i
1956end
1957ret
1958end
1959if eq id 7
1960put wjob 0 0
1961put wjob 1 73
1962put wjob 2 5
1963put wjob 3 0
1964put wjob 4 0
1965wz
1966wtc87
1967put wplen 0 get wlen 0
1968for i ulong get wlen 0
1969put wpath i get wbuf i
1970end
1971wz
1972wtc78
1973put wglen 0 get wlen 0
1974for i ulong get wlen 0
1975put wgoal i get wbuf i
1976end
1977ret
1978end
1979if eq id 8
1980put wjob 0 0
1981put wjob 1 70
1982put wjob 2 1
1983put wjob 3 0
1984put wjob 4 0
1985wz
1986wtc88
1987put wplen 0 get wlen 0
1988for i ulong get wlen 0
1989put wpath i get wbuf i
1990end
1991wz
1992wtc89
1993put wglen 0 get wlen 0
1994for i ulong get wlen 0
1995put wgoal i get wbuf i
1996end
1997ret
1998end
1999if eq id 9
2000put wjob 0 0
2001put wjob 1 72
2002put wjob 2 1
2003put wjob 3 0
2004put wjob 4 1
2005wz
2006wtc90
2007put wplen 0 get wlen 0
2008for i ulong get wlen 0
2009put wpath i get wbuf i
2010end
2011wz
2012wtc91
2013put wglen 0 get wlen 0
2014for i ulong get wlen 0
2015put wgoal i get wbuf i
2016end
2017ret
2018end
2019if eq id 10
2020put wjob 0 1
2021put wjob 1 71
2022put wjob 2 1
2023put wjob 3 0
2024put wjob 4 0
2025wz
2026wtc92
2027put wplen 0 get wlen 0
2028for i ulong get wlen 0
2029put wpath i get wbuf i
2030end
2031wz
2032wtc93
2033put wglen 0 get wlen 0
2034for i ulong get wlen 0
2035put wgoal i get wbuf i
2036end
2037ret
2038end
2039if eq id 11
2040put wjob 0 1
2041put wjob 1 74
2042put wjob 2 1
2043put wjob 3 0
2044put wjob 4 0
2045wz
2046wtc94
2047put wplen 0 get wlen 0
2048for i ulong get wlen 0
2049put wpath i get wbuf i
2050end
2051wz
2052wtc95
2053put wglen 0 get wlen 0
2054for i ulong get wlen 0
2055put wgoal i get wbuf i
2056end
2057ret
2058end
2059if eq id 12
2060put wjob 0 1
2061put wjob 1 73
2062put wjob 2 1
2063put wjob 3 0
2064put wjob 4 1
2065wz
2066wtc96
2067put wplen 0 get wlen 0
2068for i ulong get wlen 0
2069put wpath i get wbuf i
2070end
2071wz
2072wtc97
2073put wglen 0 get wlen 0
2074for i ulong get wlen 0
2075put wgoal i get wbuf i
2076end
2077ret
2078end
2079end
2080text t0 "HTTP/1.1 200 OK\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-TfPDKEdH43G3j57ZcZC2ieOmo8o2Gy7bqjfKzj32P7g='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/html; charset=utf-8\nContent-Length: 25807\n\n"
2081text page "<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>Omega · Conversation and tools</title>\n<style>\n:root{color-scheme:dark;font:16px/1.55 system-ui,sans-serif;color:#e7edef;background:#101719}*{box-sizing:border-box}body{margin:0}main{max-width:860px;margin:auto;padding:44px 24px}header{display:flex;justify-content:space-between;gap:20px;align-items:center}.mark{letter-spacing:.2em;color:#b8ddc9;font-weight:700;font-size:13px}.badge{border:1px solid #3e5850;border-radius:30px;padding:5px 13px;font-size:13px;color:#b8ddc9}h1{font-size:clamp(30px,6vw,45px);line-height:1.15;margin:34px 0 14px;font-weight:600;letter-spacing:-.035em}p{color:#aab9bc;margin:0 0 22px}.panel{background:#172124;border:1px solid #304044;border-radius:16px;padding:24px;margin-top:24px}label{display:block;font-weight:600;margin-bottom:9px}select,textarea,button{font:inherit}select{background:#101719;color:#e7edef;border:1px solid #4a6268;border-radius:8px;padding:8px 12px;margin-bottom:20px}textarea{width:100%;min-height:150px;resize:vertical;background:#101719;color:#eef5f4;border:1px solid #4a6268;border-radius:10px;padding:15px}textarea:focus,select:focus,button:focus-visible{outline:2px solid #a4dbbc;outline-offset:3px}.hint{font-size:13px;margin-top:8px}.actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:18px}button{cursor:pointer;border:0;border-radius:9px;padding:10px 17px;font-weight:600;background:#b8ddc9;color:#14231a}button:disabled{opacity:.5;cursor:wait}.secondary{background:transparent;color:#c0d5dc;border:1px solid #486169;font-size:13px;padding:7px 12px}.examples{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.output-title{display:flex;justify-content:space-between;align-items:center;gap:12px}h2{font-size:17px;margin:0}pre{white-space:pre-wrap;overflow-wrap:anywhere;min-height:70px;line-height:1.6;font-size:14px;margin:18px 0 0;color:#d0eadc}#status{font-size:14px;color:#b8cccf}#status.error{color:#ffb5a9}footer{margin-top:24px;font-size:13px;color:#9aafb4}button:hover{filter:brightness(1.08)}@media(max-width:500px){main{padding:26px 16px}.panel{padding:18px}}\n.chatpanel{padding:0;overflow:hidden}.chatbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;padding:18px;border-bottom:1px solid #304044}.chatbar select{margin:0;flex:1;min-width:140px;max-width:100%}.chatlog{height:440px;overflow-y:auto;padding:20px;overscroll-behavior:contain}.message{margin:0 0 22px;max-width:100%;overflow-wrap:anywhere}.message.user{background:#22332f;border-radius:12px;padding:14px 16px;margin-left:10%}.message.assistant{padding:4px 8px}.speaker{font-size:12px;font-weight:700;letter-spacing:.04em;color:#adcabc;margin-bottom:8px}.message-text{white-space:pre-wrap;font-size:16px;line-height:1.65}.composer{padding:18px;border-top:1px solid #304044}.composer textarea{min-height:95px}.emptychat{padding-top:100px;text-align:center}.chatnote{font-size:12px;color:#9aafb4;padding:0 18px 14px;margin:0}#chatstatus{font-size:13px;overflow-wrap:anywhere}#chatmemory{margin:10px 0 0;font-size:12px}details.practice>summary{cursor:pointer;font-size:19px;font-weight:600;padding:22px 0 0}details.practice[open]>summary{margin-bottom:10px}@media(max-width:500px){.chatlog{height:400px;padding:14px}.chatbar{padding:13px}.composer{padding:13px}.message-text{font-size:15px}.message.user{margin-left:5%}}\n</style></head><body><main>\n<header><span class=\"mark\">OMEGA</span><span class=\"badge\">Local chat + Omega tools</span></header>\n<h1>Let’s talk.</h1>\n<p>Talk things through with your local Qwen companion. Your trained Omega model is still here for practice jobs.</p>\n<section class=\"panel chatpanel\" aria-label=\"Conversation with Qwen companion\"><div class=\"chatbar\"><label for=\"chats\" style=\"margin:0\">Conversation</label><select id=\"chats\" aria-label=\"Saved conversations\"></select><button id=\"newchat\" type=\"button\" class=\"secondary\">New chat</button><button id=\"exportchat\" type=\"button\" class=\"secondary\">Export chat</button></div><div id=\"chatlog\" class=\"chatlog\" role=\"log\" aria-label=\"Conversation messages\"></div>\n<form id=\"chatform\" class=\"composer\"><label for=\"chatinput\">Message your companion</label><textarea id=\"chatinput\" placeholder=\"Tell me what’s on your mind…\" rows=\"3\" maxlength=\"8000\"></textarea><div class=\"actions\"><button id=\"sendchat\" type=\"submit\">Send</button><button id=\"stopchat\" class=\"secondary\" type=\"button\" hidden>Stop</button><span id=\"chatstatus\" role=\"status\" aria-live=\"polite\">Ready.</span></div><p id=\"chatmemory\"></p><div class=\"examples\"><button type=\"button\" class=\"secondary\" data-chat-example=\"Explain how you and my trained Omega model work together.\">About this setup</button><button type=\"button\" class=\"secondary\" data-chat-example=\"I have an idea I want to think through. Can you help me work through it?\">Think through an idea</button></div></form><p id=\"chatnote\" class=\"chatnote\">Qwen3-30B-A3B-Instruct-2507 answers this chat. Conversations are saved in this browser and processed on your Spark. Your past chat archives have not been imported.</p></section>\n<details class=\"practice\"><summary>Use your trained Omega model</summary>\n<section class=\"panel\" aria-labelledby=\"practice-title\"><div class=\"output-title\"><h2 id=\"practice-title\">Practice with tools</h2><span class=\"badge\">Real compiler checks</span></div>\n<p class=\"hint\">Choose a job. The model will work on a temporary copy and show each step.</p>\n<label for=\"job\">Practice job</label><select id=\"job\"></select>\n<p id=\"goal\"></p><label for=\"source\">Starting code</label><textarea id=\"source\" maxlength=\"600\" spellcheck=\"false\" style=\"min-height:220px;font-family:monospace;font-size:14px\"></textarea>\n<p class=\"hint\">You can change the numbers or try an arithmetic spelling mistake. Keep the same program shape and starting input. Larger programs are not supported here yet.</p>\n<div class=\"actions\"><button id=\"repair\" type=\"button\">Run the job</button><button id=\"resetjob\" class=\"secondary\" type=\"button\">Reset example</button><button id=\"canceljob\" class=\"secondary\" type=\"button\" hidden>Stop</button></div>\n<p id=\"jobstatus\" role=\"status\" aria-live=\"polite\" style=\"margin:16px 0 0\">Choose a job and press Run.</p>\n<ol id=\"steps\" style=\"padding-left:22px\"></ol>\n<div id=\"jobresult\" hidden><h2>Current code</h2><pre id=\"fixed\"></pre><div class=\"actions\"><button id=\"downloadcode\" class=\"secondary\" type=\"button\">Download code</button><button id=\"downloadreport\" class=\"secondary\" type=\"button\">Save run report</button></div></div>\n</section>\n<h2 style=\"margin-top:32px\">Ask for a single response</h2>\n<form id=\"ask\" class=\"panel\"><label for=\"mode\">What would you like to try?</label>\n<select id=\"mode\"><option value=\"task\">An Omega task</option><option value=\"raw\">Continue text / exact prompt</option></select>\n<label for=\"prompt\">Your request</label><textarea id=\"prompt\" maxlength=\"4000\" required placeholder=\"Write Omega that returns the larger of 24 and 27.\"></textarea>\n<p class=\"hint\">Keep it short. Each request starts fresh, without previous messages.</p>\n<div class=\"examples\"><button type=\"button\" class=\"secondary\" data-example=\"larger\">Compare two numbers</button><button type=\"button\" class=\"secondary\" data-example=\"tool\">Try a tool response</button></div>\n<div class=\"actions\"><button id=\"run\" type=\"submit\">Ask the model</button><button id=\"stop\" class=\"secondary\" type=\"button\" hidden>Stop</button><span id=\"status\" role=\"status\" aria-live=\"polite\">Ready when you are.</span></div></form>\n<section class=\"panel\" aria-label=\"Model response\"><div class=\"output-title\"><h2>Model response</h2><button type=\"button\" id=\"copy\" class=\"secondary\" disabled>Copy</button></div><pre id=\"output\" tabindex=\"0\">Its response will appear here.</pre></section>\n</details><footer>This small model is trained for specific Omega tasks, not general conversation. Practice jobs can change only their temporary exercise file. A single response is displayed without running its tool requests. Download code or a report to keep a result. Chat can discuss work but cannot execute the practice tools itself.</footer>\n</main><script>\nconst $=id=>document.getElementById(id);\nlet controller=null;\nconst examples={larger:{mode:'task',text:'Write Omega that returns the larger of 24 and 27.'},tool:{mode:'raw',text:'Task: Fix the error in this file and confirm its goal.\\nFile: jobs/item76666.om\\nGoal: calc starts with x and adds 4 exactly 3 times in a for loop. main calls calc with 70.\\nState: unread\\nAnswer:\\n'}};\ndocument.querySelectorAll('[data-example]').forEach(b=>b.addEventListener('click',()=>{const e=examples[b.dataset.example];$('mode').value=e.mode;$('prompt').value=e.text;$('prompt').focus();}));\nfunction status(text,error=false){$('status').textContent=text;$('status').className=error?'error':'';}\n$('stop').addEventListener('click',()=>controller?.abort());\n$('ask').addEventListener('submit',async e=>{\n e.preventDefault();if(controller)return;\n const input=$('prompt').value;if(!input.trim())return;\n const prompt=$('mode').value==='task'?'Task: '+input.trim()+'\\nAnswer:\\n':input;\n if(new TextEncoder().encode(prompt).length>4000){status('Please shorten your request.',true);return;}\n controller=new AbortController();const started=performance.now();let timer=setTimeout(()=>controller?.abort(),45000);\n $('run').disabled=true;$('stop').hidden=false;$('copy').disabled=true;$('output').textContent='';status('Waiting for the model…');\n try{\n const response=await fetch('/generate',{method:'POST',headers:{'Content-Type':'text/plain;charset=UTF-8','X-Omega-UI':'1'},body:prompt,signal:controller.signal});\n if(!response.ok)throw new Error((await response.text()).trim()||'The request could not be completed.');\n const reader=response.body.getReader(),decoder=new TextDecoder();let first=true;\n while(true){const {value,done}=await reader.read();if(done)break;$('output').textContent+=decoder.decode(value,{stream:true});if(first){status('Receiving the response…');first=false;}}\n $('output').textContent+=decoder.decode();status('Finished in '+Math.round(performance.now()-started)+' ms.');\n if(!$('output').textContent)$('output').textContent='The model finished without any text. Try one of the examples.';\n }catch(error){status(error.name==='AbortError'?'Stopped. Any response shown may be incomplete.':error.message,true);}\n finally{clearTimeout(timer);controller=null;$('run').disabled=false;$('stop').hidden=true;$('copy').disabled=!$('output').textContent;}\n});\n$('copy').addEventListener('click',async()=>{\n const text=$('output').textContent;\n try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(text);}else{const area=document.createElement('textarea');area.value=text;area.style.position='fixed';area.style.opacity='0';document.body.appendChild(area);area.select();const ok=document.execCommand('copy');area.remove();if(!ok)throw new Error('copy');}status('Response copied.');}catch{status('Select the response text to copy it.',true);}\n});\n\nconst practiceJobs=[{\"id\":\"A\",\"label\":\"Loop: wrong repeat count\",\"goal\":\"Start with 70. Add 4 exactly 3 times.\",\"source\":\"fn calc x int to int\\ns = x\\nfor i ulong 2\\ns = add s int 4\\nend\\nret s\\nend\\nfn main to int\\nret calc int 70\\nend\\n\",\"missing\":false},{\"id\":\"B\",\"label\":\"Loop: wrong addition\",\"goal\":\"Start with 74. Add 3 exactly 3 times.\",\"source\":\"fn calc x int to int\\ns = x\\nfor i ulong 3\\ns = add s int 6\\nend\\nret s\\nend\\nfn main to int\\nret calc int 74\\nend\\n\",\"missing\":false},{\"id\":\"C\",\"label\":\"Addition: wrong number\",\"goal\":\"Add 5 to 73.\",\"source\":\"fn calc x int to int\\nret add x int 6\\nend\\nfn main to int\\nret calc int 73\\nend\\n\",\"missing\":false},{\"id\":\"D\",\"label\":\"Multiplication: wrong number\",\"goal\":\"Multiply 72 by 1.\",\"source\":\"fn calc x int to int\\nret mul x int 3\\nend\\nfn main to int\\nret calc int 72\\nend\\n\",\"missing\":false},{\"id\":\"E\",\"label\":\"Loop: spelling error\",\"goal\":\"Start with 72. Add 1 exactly 6 times.\",\"source\":\"fn calc x int to int\\ns = x\\nfor i ulong 6\\ns = plus s int 1\\nend\\nret s\\nend\\nfn main to int\\nret calc int 72\\nend\\n\",\"missing\":false},{\"id\":\"F\",\"label\":\"Loop: already correct\",\"goal\":\"Start with 70. Add 2 exactly 4 times.\",\"source\":\"fn calc x int to int\\ns = x\\nfor i ulong 4\\ns = add s int 2\\nend\\nret s\\nend\\nfn main to int\\nret calc int 70\\nend\\n\",\"missing\":false},{\"id\":\"G\",\"label\":\"Loop: missing file\",\"goal\":\"Start with 71. Add 5 exactly 3 times.\",\"source\":\"\",\"missing\":true},{\"id\":\"H\",\"label\":\"Addition: spelling error\",\"goal\":\"Add 5 to 73.\",\"source\":\"fn calc x int to int\\nret plus x int 5\\nend\\nfn main to int\\nret calc int 73\\nend\\n\",\"missing\":false},{\"id\":\"I\",\"label\":\"Addition: already correct\",\"goal\":\"Add 1 to 70.\",\"source\":\"fn calc x int to int\\nret add x int 1\\nend\\nfn main to int\\nret calc int 70\\nend\\n\",\"missing\":false},{\"id\":\"J\",\"label\":\"Addition: missing file\",\"goal\":\"Add 1 to 72.\",\"source\":\"\",\"missing\":true},{\"id\":\"K\",\"label\":\"Multiplication: spelling error\",\"goal\":\"Multiply 71 by 1.\",\"source\":\"fn calc x int to int\\nret times x int 1\\nend\\nfn main to int\\nret calc int 71\\nend\\n\",\"missing\":false},{\"id\":\"L\",\"label\":\"Multiplication: already correct\",\"goal\":\"Multiply 74 by 1.\",\"source\":\"fn calc x int to int\\nret mul x int 1\\nend\\nfn main to int\\nret calc int 74\\nend\\n\",\"missing\":false},{\"id\":\"M\",\"label\":\"Multiplication: missing file\",\"goal\":\"Multiply 73 by 1.\",\"source\":\"\",\"missing\":true}];\nlet jobController=null,runReport=null,finishedSource='';\npracticeJobs.forEach((j,i)=>{const option=document.createElement('option');option.value=i;option.textContent=j.label;$('job').appendChild(option);});\nfunction loadJob(){if(jobController)return;const j=practiceJobs[+$('job').value];$('goal').textContent=j.goal+ (j.missing?' The practice file is deliberately missing.':'');$('source').value=j.source;$('source').disabled=j.missing;$('jobresult').hidden=true;$('steps').replaceChildren();$('jobstatus').textContent='Choose a job and press Run.';}\n$('job').addEventListener('change',loadJob);$('resetjob').addEventListener('click',loadJob);loadJob();\n$('canceljob').addEventListener('click',()=>jobController?.abort());\nfunction jobStep(text){const li=document.createElement('li');li.textContent=text;li.style.marginBottom='8px';$('steps').appendChild(li);}\nfunction receiveEvent(event){\n runReport.events.push(event);\n if(event.type==='action'){\n try{const action=JSON.parse(event.text);if(action.tool==='read_file')jobStep('Model asks to read the practice file.');else if(action.tool==='omega_check')jobStep('Model asks to compile and test the program.');else if(action.tool==='replace_text')jobStep('Model proposes replacing “'+action.old+'” with “'+action.new+'”.');else jobStep('Model requested an unsupported action.');}\n catch{jobStep('Model says: '+event.text);}\n }else if(event.type==='observation'){jobStep(event.text);}\n else if(event.type==='test'){jobStep('Check with input '+event.input+': expected '+event.expected+', got '+event.actual+'. '+(event.expected===event.actual?'Passed.':'Failed.'));}\n else if(event.type==='source'){finishedSource=event.text;$('fixed').textContent=event.text;$('jobresult').hidden=false;}\n else if(event.type==='done'){\n runReport.result=event;finishedSource=event.source;$('fixed').textContent=event.source||'No practice file was created.';$('jobresult').hidden=false;$('downloadcode').disabled=!event.source;\n $('jobstatus').textContent=event.message;$('jobstatus').style.color=event.passed?'#b8ddc9':'#ffd5a2';\n }\n}\n$('repair').addEventListener('click',async()=>{\n if(jobController)return;\n const j=practiceJobs[+$('job').value];let source=$('source').value.replace(/\\r\\n?/g,'\\n');if(source&&!source.endsWith('\\n'))source+='\\n';\n if(new TextEncoder().encode(source).length>600){$('jobstatus').textContent='Please shorten the program to 600 bytes or less.';return;}\n jobController=new AbortController();const timer=setTimeout(()=>jobController?.abort(),90000);\n runReport={model:'Omega round40',job:j.label,goal:j.goal,startedAt:new Date().toISOString(),original:source,events:[]};finishedSource='';\n $('steps').replaceChildren();$('jobresult').hidden=true;$('jobstatus').textContent='The model is starting the job…';$('jobstatus').style.color='';\n $('repair').disabled=true;$('resetjob').disabled=true;$('job').disabled=true;$('source').disabled=true;$('canceljob').hidden=false;\n try{\n const response=await fetch('/repair',{method:'POST',headers:{'Content-Type':'text/plain;charset=UTF-8','X-Omega-UI':'1'},body:j.id+'\\n'+source,signal:jobController.signal});\n if(!response.ok)throw new Error((await response.text()).trim()||'The job could not start.');\n const reader=response.body.getReader(),decoder=new TextDecoder();let pending='';\n while(true){const {value,done}=await reader.read();if(done){pending+=decoder.decode();break;}pending+=decoder.decode(value,{stream:true});let newline;while((newline=pending.indexOf('\\n'))>=0){const line=pending.slice(0,newline);pending=pending.slice(newline+1);if(line)receiveEvent(JSON.parse(line));}}\n if(pending.trim())throw new Error('The job ended with an incomplete report.');\n if(!runReport.result)throw new Error('The job stopped before a verified result arrived.');\n }catch(error){runReport.error=error.name==='AbortError'?'Stopped. Any work shown may be incomplete.':error.message;$('jobstatus').textContent=runReport.error;$('jobstatus').style.color='#ffb5a9';$('jobresult').hidden=false;$('fixed').textContent=finishedSource||source||'No source available.';$('downloadcode').disabled=!finishedSource;}\n finally{clearTimeout(timer);jobController=null;$('repair').disabled=false;$('resetjob').disabled=false;$('job').disabled=false;$('source').disabled=j.missing;$('canceljob').hidden=true;}\n});\nfunction download(name,text,type){const url=URL.createObjectURL(new Blob([text],{type}));const a=document.createElement('a');a.href=url;a.download=name;document.body.appendChild(a);a.click();a.remove();setTimeout(()=>URL.revokeObjectURL(url),1000);}\n$('downloadcode').addEventListener('click',()=>download('practice-result.om',finishedSource,'text/plain'));\n$('downloadreport').addEventListener('click',()=>{if(runReport)download('omega-run-report.json',JSON.stringify(runReport,null,2)+'\\n','application/json');});\n\nconst chatKey='omega-conversations-v1',encoder=new TextEncoder();\nlet chatStore={active:'',chats:[]},chatAbort=null;\ntry{const saved=JSON.parse(localStorage.getItem(chatKey)||'null');if(saved&&Array.isArray(saved.chats)&&saved.chats.every(c=>typeof c.id==='string'&&Array.isArray(c.messages)&&c.messages.every(m=>['user','assistant'].includes(m.role)&&typeof m.content==='string')))chatStore=saved;}catch{}\nfunction saveChats(){try{localStorage.setItem(chatKey,JSON.stringify(chatStore));}catch{$('chatnote').textContent='Browser storage is unavailable or full. Export this conversation to keep it.';}}\nfunction activeChat(){return chatStore.chats.find(c=>c.id===chatStore.active);}\nfunction createChat(){const c={id:Date.now().toString(36)+'-'+Math.random().toString(36).slice(2),title:'New conversation',messages:[],draft:'',createdAt:new Date().toISOString()};chatStore.chats.push(c);chatStore.active=c.id;saveChats();renderChat();}\nfunction bubble(role,text,partial=false){const article=document.createElement('article');article.className='message '+role;const label=document.createElement('div');label.className='speaker';label.textContent=role==='user'?'You':(partial?'Qwen companion · interrupted':'Qwen companion');const body=document.createElement('div');body.className='message-text';body.textContent=text;article.append(label,body);$('chatlog').appendChild(article);return body;}\nfunction renderChat(){const c=activeChat();if(!c)return;$('chats').replaceChildren();for(const x of [...chatStore.chats].reverse()){const option=document.createElement('option');option.value=x.id;option.textContent=x.title;$('chats').appendChild(option);}$('chats').value=c.id;$('chatlog').replaceChildren();for(const m of c.messages)bubble(m.role,m.content);if(!c.messages.length){const hint=document.createElement('p');hint.className='emptychat';hint.textContent='Start anywhere. Ask a question, share an idea, or tell me what you are working on.';$('chatlog').appendChild(hint);}$('chatinput').value=c.draft||'';$('chatstatus').textContent='Ready.';$('chatmemory').textContent='Previous messages in this conversation are included in your next reply.';$('chatlog').scrollTop=$('chatlog').scrollHeight;}\n$('newchat').addEventListener('click',()=>{if(!chatAbort){createChat();$('chatinput').focus();}});\n$('chats').addEventListener('change',()=>{if(chatAbort)return;const old=activeChat();if(old)old.draft=$('chatinput').value;chatStore.active=$('chats').value;saveChats();renderChat();});\n$('chatinput').addEventListener('input',()=>{const c=activeChat();if(c){c.draft=$('chatinput').value;saveChats();}});\n$('chatinput').addEventListener('keydown',e=>{if(e.key==='Enter'&&!e.shiftKey&&!e.isComposing){e.preventDefault();$('chatform').requestSubmit();}});\n$('stopchat').addEventListener('click',()=>chatAbort?.abort());\n$('exportchat').addEventListener('click',()=>{const c=activeChat();if(c)download('omega-conversation.json',JSON.stringify({model:'Qwen3-30B-A3B-Instruct-2507',...c},null,2)+'\\n','application/json');});\ndocument.querySelectorAll('[data-chat-example]').forEach(b=>b.addEventListener('click',()=>{if(chatAbort)return;$('chatinput').value=b.dataset.chatExample;activeChat().draft=$('chatinput').value;saveChats();$('chatinput').focus();}));\nfunction frameChat(messages){let text='';for(const m of messages){const bytes=encoder.encode(m.content).length;text+=(m.role==='user'?'U':'A')+bytes+'\\n'+m.content;}return encoder.encode(text);}\n$('chatform').addEventListener('submit',async e=>{\n e.preventDefault();if(chatAbort)return;\n const content=$('chatinput').value.trim();if(!content)return;\n if(encoder.encode(content).length>8000){$('chatstatus').textContent='Please shorten this message to 8,000 bytes or less.';return;}\n const c=activeChat(),user={role:'user',content};let context=[...c.messages,user],wire=frameChat(context),removed=0;\n while((context.length>63||wire.length>24000)&&context.length>1){context=context.slice(2);removed+=2;wire=frameChat(context);}\n if(wire.length>24000){$('chatstatus').textContent='This message is too long. Please shorten it.';return;}\n $('chatmemory').textContent=removed?'Using the most recent '+context.length+' messages. Earlier messages remain saved here, outside active memory.':'Using this conversation’s previous messages.';\n chatAbort=new AbortController();const timer=setTimeout(()=>chatAbort?.abort(),125000);let answer='',complete=false,finishReason='';\n c.draft=content;saveChats();if(!c.messages.length)$('chatlog').replaceChildren();bubble('user',content);const output=bubble('assistant','');\n $('chatlog').scrollTop=$('chatlog').scrollHeight;\n $('sendchat').disabled=true;$('newchat').disabled=true;$('chats').disabled=true;$('chatinput').disabled=true;$('stopchat').hidden=false;$('chatstatus').textContent='Thinking…';\n function acceptSSE(block){\n const data=block.split('\\n').filter(l=>l.startsWith('data:')).map(l=>l.slice(5).trimStart()).join('\\n');if(!data)return;\n if(data.trim()==='[DONE]'){complete=true;return;}\n const event=JSON.parse(data);if(event.error)throw new Error(event.error.message||'The model reported an error.');\n const choice=event.choices?.[0];if(choice?.delta?.content){answer+=choice.delta.content;output.textContent=answer;$('chatstatus').textContent='Replying…';if($('chatlog').scrollHeight-$('chatlog').scrollTop-$('chatlog').clientHeight<180)$('chatlog').scrollTop=$('chatlog').scrollHeight;}\n if(choice?.finish_reason)finishReason=choice.finish_reason;\n }\n try{\n const response=await fetch('/chat',{method:'POST',headers:{'X-Omega-UI':'1','Content-Type':'text/plain;charset=UTF-8'},body:wire,signal:chatAbort.signal});\n if(!response.ok){const text=await response.text();let message=text;try{message=JSON.parse(text).error?.message||text;}catch{}throw new Error(message.slice(0,500));}\n const reader=response.body.getReader(),decoder=new TextDecoder();let pending='';\n while(true){const {value,done}=await reader.read();if(done){pending+=decoder.decode();break;}pending+=decoder.decode(value,{stream:true});pending=pending.replace(/\\r\\n/g,'\\n');let boundary;while((boundary=pending.indexOf('\\n\\n'))>=0){acceptSSE(pending.slice(0,boundary));pending=pending.slice(boundary+2);}}\n if(pending.trim())acceptSSE(pending);\n if(!complete||!answer.trim())throw new Error('The reply ended before it was complete. Your message is ready to retry.');\n c.messages.push(user,{role:'assistant',content:answer});c.draft='';delete c.lastAttempt;if(c.title==='New conversation')c.title=content.slice(0,50);c.updatedAt=new Date().toISOString();saveChats();$('chatinput').value='';\n $('chatstatus').textContent=finishReason==='length'?'Reply reached its length limit. Ask “continue” for more.':'Ready for your next message.';\n const option=[...$('chats').options].find(o=>o.value===c.id);if(option)option.textContent=c.title;\n }catch(error){const message=error.name==='AbortError'?'Stopped. Your message is ready to retry; the partial reply was not added to conversation memory.':error.message;$('chatstatus').textContent=message;output.parentElement.querySelector('.speaker').textContent='Qwen companion · incomplete';if(!answer)output.textContent=message;c.lastAttempt={user:content,partial:answer,error:message,at:new Date().toISOString()};saveChats();}\n finally{clearTimeout(timer);chatAbort=null;$('sendchat').disabled=false;$('newchat').disabled=false;$('chats').disabled=false;$('chatinput').disabled=false;$('stopchat').hidden=true;$('chatinput').focus();}\n});\nif(!activeChat())createChat();else renderChat();\n\n</script></body></html>\n"
2082fn respondpage to bool
2083p = ulong 0
2084for i ulong len t0
2085c = get t0 i
2086if eq c 10
2087put hbuf p 13
2088p = add p 1
2089end
2090put hbuf p c
2091p = add p 1
2092end
2093for i ulong len page
2094put hbuf p get page i
2095p = add p 1
2096end
2097ret hsend p
2098end
2099text t1 "HTTP/1.1 400 Bad Request\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-TfPDKEdH43G3j57ZcZC2ieOmo8o2Gy7bqjfKzj32P7g='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 55\n\nPlease send a short, nonempty request using this page.\n"
2100fn respond400 to bool
2101p = ulong 0
2102for i ulong len t1
2103c = get t1 i
2104if eq c 10
2105put hbuf p 13
2106p = add p 1
2107end
2108put hbuf p c
2109p = add p 1
2110end
2111put hbuf sub p 2 10
2112p = sub p 1
2113ret hsend p
2114end
2115text t2 "HTTP/1.1 404 Not Found\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-TfPDKEdH43G3j57ZcZC2ieOmo8o2Gy7bqjfKzj32P7g='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 16\n\nPage not found.\n"
2116fn respond404 to bool
2117p = ulong 0
2118for i ulong len t2
2119c = get t2 i
2120if eq c 10
2121put hbuf p 13
2122p = add p 1
2123end
2124put hbuf p c
2125p = add p 1
2126end
2127put hbuf sub p 2 10
2128p = sub p 1
2129ret hsend p
2130end
2131text t3 "HTTP/1.1 422 Unprocessable Content\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-TfPDKEdH43G3j57ZcZC2ieOmo8o2Gy7bqjfKzj32P7g='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 73\n\nThis request is too long for the model. Please shorten it and try again.\n"
2132fn respond422 to bool
2133p = ulong 0
2134for i ulong len t3
2135c = get t3 i
2136if eq c 10
2137put hbuf p 13
2138p = add p 1
2139end
2140put hbuf p c
2141p = add p 1
2142end
2143put hbuf sub p 2 10
2144p = sub p 1
2145ret hsend p
2146end
2147text t4 "HTTP/1.1 502 Bad Gateway\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-TfPDKEdH43G3j57ZcZC2ieOmo8o2Gy7bqjfKzj32P7g='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 54\n\nThe model response was interrupted. Please try again.\n"
2148fn respond502 to bool
2149p = ulong 0
2150for i ulong len t4
2151c = get t4 i
2152if eq c 10
2153put hbuf p 13
2154p = add p 1
2155end
2156put hbuf p c
2157p = add p 1
2158end
2159put hbuf sub p 2 10
2160p = sub p 1
2161ret hsend p
2162end
2163text t5 "HTTP/1.1 503 Service Unavailable\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-TfPDKEdH43G3j57ZcZC2ieOmo8o2Gy7bqjfKzj32P7g='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 60\n\nThe model service is unavailable. Please try again shortly.\n"
2164fn respond503 to bool
2165p = ulong 0
2166for i ulong len t5
2167c = get t5 i
2168if eq c 10
2169put hbuf p 13
2170p = add p 1
2171end
2172put hbuf p c
2173p = add p 1
2174end
2175put hbuf sub p 2 10
2176p = sub p 1
2177ret hsend p
2178end
2179text t6 "HTTP/1.1 200 OK\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-TfPDKEdH43G3j57ZcZC2ieOmo8o2Gy7bqjfKzj32P7g='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nTransfer-Encoding: chunked\nX-Accel-Buffering: no\n\n"
2180fn streamhead to bool
2181p = ulong 0
2182for i ulong len t6
2183c = get t6 i
2184if eq c 10
2185put hbuf p 13
2186p = add p 1
2187end
2188put hbuf p c
2189p = add p 1
2190end
2191ret hsend p
2192end
2193text t7 "0\n\n"
2194fn streamend to bool
2195p = ulong 0
2196for i ulong len t7
2197c = get t7 i
2198if eq c 10
2199put hbuf p 13
2200p = add p 1
2201end
2202put hbuf p c
2203p = add p 1
2204end
2205ret hsend p
2206end
2207text m0 "GET / HTTP/1.1"
2208fn isroot a ulong b ulong to bool
2209if ne sub b a len m0
2210ret false
2211end
2212for i ulong len m0
2213if ne get hreq add a i get m0 i
2214ret false
2215end
2216end
2217ret true
2218end
2219text m1 "POST /generate HTTP/1.1"
2220fn isgen a ulong b ulong to bool
2221if ne sub b a len m1
2222ret false
2223end
2224for i ulong len m1
2225if ne get hreq add a i get m1 i
2226ret false
2227end
2228end
2229ret true
2230end
2231text m2 "POST /repair HTTP/1.1"
2232fn isrepair a ulong b ulong to bool
2233if ne sub b a len m2
2234ret false
2235end
2236for i ulong len m2
2237if ne get hreq add a i get m2 i
2238ret false
2239end
2240end
2241ret true
2242end
2243text m3 "POST /chat HTTP/1.1"
2244fn ischat a ulong b ulong to bool
2245if ne sub b a len m3
2246ret false
2247end
2248for i ulong len m3
2249if ne get hreq add a i get m3 i
2250ret false
2251end
2252end
2253ret true
2254end
2255text m4 "content-length:"
2256fn iscl a ulong b ulong to bool
2257if lt sub b a len m4
2258ret false
2259end
2260for i ulong len m4
2261if ne get hreq add a i get m4 i
2262ret false
2263end
2264end
2265ret true
2266end
2267text m5 "transfer-encoding:"
2268fn iste a ulong b ulong to bool
2269if lt sub b a len m5
2270ret false
2271end
2272for i ulong len m5
2273if ne get hreq add a i get m5 i
2274ret false
2275end
2276end
2277ret true
2278end
2279text m6 "x-omega-ui: 1"
2280fn isguard a ulong b ulong to bool
2281if ne sub b a len m6
2282ret false
2283end
2284for i ulong len m6
2285if ne get hreq add a i get m6 i
2286ret false
2287end
2288end
2289ret true
2290end
2291text m7 "host:"
2292fn ishost a ulong b ulong to bool
2293if lt sub b a len m7
2294ret false
2295end
2296for i ulong len m7
2297if ne get hreq add a i get m7 i
2298ret false
2299end
2300end
2301ret true
2302end
2303text m8 "host: 127.0.0.1:18173"
2304fn host0 a ulong b ulong to bool
2305if ne sub b a len m8
2306ret false
2307end
2308for i ulong len m8
2309if ne get hreq add a i get m8 i
2310ret false
2311end
2312end
2313ret true
2314end
2315text m9 "host: localhost:18173"
2316fn host1 a ulong b ulong to bool
2317if ne sub b a len m9
2318ret false
2319end
2320for i ulong len m9
2321if ne get hreq add a i get m9 i
2322ret false
2323end
2324end
2325ret true
2326end
2327text m10 "host: 127.0.0.1:18174"
2328fn host2 a ulong b ulong to bool
2329if ne sub b a len m10
2330ret false
2331end
2332for i ulong len m10
2333if ne get hreq add a i get m10 i
2334ret false
2335end
2336end
2337ret true
2338end
2339text m11 "host: localhost:18174"
2340fn host3 a ulong b ulong to bool
2341if ne sub b a len m11
2342ret false
2343end
2344for i ulong len m11
2345if ne get hreq add a i get m11 i
2346ret false
2347end
2348end
2349ret true
2350end
2351fn goodhost a ulong b ulong to bool
2352ret or or host0 a b host1 a b or host2 a b host3 a b
2353end
2354fn wconsumec0 at ulong to ulong
2355if not wmc98 at
2356ret 10000
2357end
2358ret add at len z0
2359end
2360
2361fn wmc1 at ulong to bool
2362if gt add at len z1 get wslen 0
2363ret false
2364end
2365for i ulong len z1
2366if ne get wsrc add at i get z1 i
2367ret false
2368end
2369end
2370ret true
2371end
2372
2373fn wconsumec2 at ulong to ulong
2374if not wmc1 at
2375ret 10000
2376end
2377ret add at len z1
2378end
2379
2380fn wconsumec3 at ulong to ulong
2381if not wmc99 at
2382ret 10000
2383end
2384ret add at len z2
2385end
2386
2387fn wmc4 at ulong to bool
2388if gt add at len z3 get wslen 0
2389ret false
2390end
2391for i ulong len z3
2392if ne get wsrc add at i get z3 i
2393ret false
2394end
2395end
2396ret true
2397end
2398
2399fn wconsumec5 at ulong to ulong
2400if not wmc11 at
2401ret 10000
2402end
2403ret add at len z4
2404end
2405
2406fn wconsumec6 at ulong to ulong
2407if not wmc100 at
2408ret 10000
2409end
2410ret add at len z5
2411end
2412
2413fn wconsumec7 at ulong to ulong
2414if not wmc101 at
2415ret 10000
2416end
2417ret add at len z6
2418end
2419
2420fn wconsumec8 at ulong to ulong
2421if not wmc102 at
2422ret 10000
2423end
2424ret add at len z7
2425end
2426
2427fn wmc9 at ulong to bool
2428if gt add at len z8 get wslen 0
2429ret false
2430end
2431for i ulong len z8
2432if ne get wsrc add at i get z8 i
2433ret false
2434end
2435end
2436ret true
2437end
2438
2439fn wmc10 at ulong to bool
2440if gt add at len z9 get wslen 0
2441ret false
2442end
2443for i ulong len z9
2444if ne get wsrc add at i get z9 i
2445ret false
2446end
2447end
2448ret true
2449end
2450
2451fn wmc11 at ulong to bool
2452if gt add at len z4 get wslen 0
2453ret false
2454end
2455for i ulong len z4
2456if ne get wsrc add at i get z4 i
2457ret false
2458end
2459end
2460ret true
2461end
2462
2463fn wconsumec12 at ulong to ulong
2464if not wmc103 at
2465ret 10000
2466end
2467ret add at len z10
2468end
2469
2470fn wconsumec13 at ulong to ulong
2471if not wmc104 at
2472ret 10000
2473end
2474ret add at len z11
2475end
2476
2477fn wconsumec14 at ulong to ulong
2478if not wmc105 at
2479ret 10000
2480end
2481ret add at len z12
2482end
2483
2484fn wconsumec15 at ulong to ulong
2485if not wmc106 at
2486ret 10000
2487end
2488ret add at len z13
2489end
2490
2491fn wtc16 to void
2492for i ulong len wbase
2493wb get wbase i
2494end
2495end
2496
2497fn wtc17 to void
2498for i ulong len wcomp
2499wb get wcomp i
2500end
2501end
2502
2503fn wtc18 to void
2504for i ulong len wexec
2505wb get wexec i
2506end
2507end
2508
2509fn woc19 to void
2510put wolen 0 len z14
2511for i ulong len z14
2512put wobs i get z14 i
2513end
2514end
2515
2516fn woc20 to void
2517put wolen 0 len z15
2518for i ulong len z15
2519put wobs i get z15 i
2520end
2521end
2522
2523fn woc21 to void
2524put wolen 0 len z16
2525for i ulong len z16
2526put wobs i get z16 i
2527end
2528end
2529
2530fn woc22 to void
2531put wolen 0 len z17
2532for i ulong len z17
2533put wobs i get z17 i
2534end
2535end
2536
2537fn woc23 to void
2538put wolen 0 len z18
2539for i ulong len z18
2540put wobs i get z18 i
2541end
2542end
2543
2544fn woc24 to void
2545put wolen 0 len z19
2546for i ulong len z19
2547put wobs i get z19 i
2548end
2549end
2550
2551fn wtc25 to void
2552for i ulong len z20
2553wb get z20 i
2554end
2555end
2556
2557fn wtc26 to void
2558for i ulong len z21
2559wb get z21 i
2560end
2561end
2562
2563fn wtc27 to void
2564for i ulong len z22
2565wb get z22 i
2566end
2567end
2568
2569fn wtc28 to void
2570for i ulong len z23
2571wb get z23 i
2572end
2573end
2574
2575fn woc29 to void
2576put wolen 0 len z24
2577for i ulong len z24
2578put wobs i get z24 i
2579end
2580end
2581
2582fn wtc30 to void
2583for i ulong len z25
2584wb get z25 i
2585end
2586end
2587
2588fn wtc31 to void
2589for i ulong len z26
2590wb get z26 i
2591end
2592end
2593
2594fn wtc32 to void
2595for i ulong len z27
2596wb get z27 i
2597end
2598end
2599
2600fn wtc33 to void
2601for i ulong len z28
2602wb get z28 i
2603end
2604end
2605
2606fn woc34 to void
2607put wolen 0 len z29
2608for i ulong len z29
2609put wobs i get z29 i
2610end
2611end
2612
2613fn wtokenc35 to bool
2614if ne get wtkn 0 len z30
2615ret false
2616end
2617for i ulong len z30
2618if ne get wtok i get z30 i
2619ret false
2620end
2621end
2622ret true
2623end
2624
2625fn wtokenc36 to bool
2626if ne get wtkn 0 len z31
2627ret false
2628end
2629for i ulong len z31
2630if ne get wtok i get z31 i
2631ret false
2632end
2633end
2634ret true
2635end
2636
2637fn wtokenc37 to bool
2638if ne get wtkn 0 len z32
2639ret false
2640end
2641for i ulong len z32
2642if ne get wtok i get z32 i
2643ret false
2644end
2645end
2646ret true
2647end
2648
2649fn wtokenc38 to bool
2650if ne get wtkn 0 len z33
2651ret false
2652end
2653for i ulong len z33
2654if ne get wtok i get z33 i
2655ret false
2656end
2657end
2658ret true
2659end
2660
2661fn wfieldc39 slot ulong to bool
2662if ne get wflen slot len z34
2663ret false
2664end
2665for i ulong len z34
2666if ne get wfld add mul slot 128 i get z34 i
2667ret false
2668end
2669end
2670ret true
2671end
2672
2673fn wtc40 to void
2674for i ulong len z35
2675wb get z35 i
2676end
2677end
2678
2679fn wtc41 to void
2680for i ulong len z36
2681wb get z36 i
2682end
2683end
2684
2685fn wtc42 to void
2686for i ulong len z37
2687wb get z37 i
2688end
2689end
2690
2691fn wtc43 to void
2692for i ulong len z38
2693wb get z38 i
2694end
2695end
2696
2697fn wtc44 to void
2698for i ulong len z39
2699wb get z39 i
2700end
2701end
2702
2703fn wtc45 to void
2704for i ulong len z40
2705wb get z40 i
2706end
2707end
2708
2709fn wtc46 to void
2710for i ulong len z41
2711wb get z41 i
2712end
2713end
2714
2715fn wtc47 to void
2716for i ulong len z42
2717wb get z42 i
2718end
2719end
2720
2721fn wtc48 to void
2722for i ulong len z43
2723wb get z43 i
2724end
2725end
2726
2727fn wtc49 to void
2728for i ulong len z44
2729wb get z44 i
2730end
2731end
2732
2733fn wtc50 to void
2734for i ulong len z45
2735wb get z45 i
2736end
2737end
2738
2739fn wtc51 to void
2740for i ulong len z46
2741wb get z46 i
2742end
2743end
2744
2745fn wfieldc52 slot ulong to bool
2746if ne get wflen slot len z47
2747ret false
2748end
2749for i ulong len z47
2750if ne get wfld add mul slot 128 i get z47 i
2751ret false
2752end
2753end
2754ret true
2755end
2756
2757fn woc53 to void
2758put wolen 0 len z48
2759for i ulong len z48
2760put wobs i get z48 i
2761end
2762end
2763
2764fn woc54 to void
2765put wolen 0 len z49
2766for i ulong len z49
2767put wobs i get z49 i
2768end
2769end
2770
2771fn weventc55 mode ulong to bool
2772wz
2773wtc107
2774wtc108
2775wtc109
2776wj mode
2777wtc28
2778ret wemit
2779end
2780
2781fn wfieldc56 slot ulong to bool
2782if ne get wflen slot len z51
2783ret false
2784end
2785for i ulong len z51
2786if ne get wfld add mul slot 128 i get z51 i
2787ret false
2788end
2789end
2790ret true
2791end
2792
2793fn woc57 to void
2794put wolen 0 len z52
2795for i ulong len z52
2796put wobs i get z52 i
2797end
2798end
2799
2800fn weventc58 mode ulong to bool
2801wz
2802wtc107
2803wtc110
2804wtc109
2805wj mode
2806wtc28
2807ret wemit
2808end
2809
2810fn weventc59 mode ulong to bool
2811wz
2812wtc107
2813wtc111
2814wtc109
2815wj mode
2816wtc28
2817ret wemit
2818end
2819
2820fn wfinishc60 ok bool to void
2821wz
2822wtc112
2823if ok
2824wtc113
2825else
2826wtc114
2827end
2828wtc115
2829wtc116
2830wtc117
2831wj 1
2832wtc28
2833r = wemit
2834r = streamend
2835end
2836
2837note Match exact, host-free line grammar before the compiler is invoked.
2838
2839fn weventc61 mode ulong to bool
2840wz
2841wtc107
2842wtc118
2843wtc109
2844wj mode
2845wtc28
2846ret wemit
2847end
2848
2849fn wanswerc62 to bool
2850if ne get walen 0 len z29
2851ret false
2852end
2853for i ulong len z29
2854if ne get wans i get z29 i
2855ret false
2856end
2857end
2858ret true
2859end
2860
2861fn wfinishc63 ok bool to void
2862wz
2863wtc112
2864if ok
2865wtc113
2866else
2867wtc114
2868end
2869wtc115
2870wtc119
2871wtc117
2872wj 1
2873wtc28
2874r = wemit
2875r = streamend
2876end
2877
2878note Match exact, host-free line grammar before the compiler is invoked.
2879
2880fn wfinishc64 ok bool to void
2881wz
2882wtc112
2883if ok
2884wtc113
2885else
2886wtc114
2887end
2888wtc115
2889wtc120
2890wtc117
2891wj 1
2892wtc28
2893r = wemit
2894r = streamend
2895end
2896
2897note Match exact, host-free line grammar before the compiler is invoked.
2898
2899fn wanswerc65 to bool
2900if ne get walen 0 len z48
2901ret false
2902end
2903for i ulong len z48
2904if ne get wans i get z48 i
2905ret false
2906end
2907end
2908ret true
2909end
2910
2911fn wfinishc66 ok bool to void
2912wz
2913wtc112
2914if ok
2915wtc113
2916else
2917wtc114
2918end
2919wtc115
2920wtc121
2921wtc117
2922wj 1
2923wtc28
2924r = wemit
2925r = streamend
2926end
2927
2928note Match exact, host-free line grammar before the compiler is invoked.
2929
2930fn wfinishc67 ok bool to void
2931wz
2932wtc112
2933if ok
2934wtc113
2935else
2936wtc114
2937end
2938wtc115
2939wtc122
2940wtc117
2941wj 1
2942wtc28
2943r = wemit
2944r = streamend
2945end
2946
2947note Match exact, host-free line grammar before the compiler is invoked.
2948
2949fn wfinishc68 ok bool to void
2950wz
2951wtc112
2952if ok
2953wtc113
2954else
2955wtc114
2956end
2957wtc115
2958wtc123
2959wtc117
2960wj 1
2961wtc28
2962r = wemit
2963r = streamend
2964end
2965
2966note Match exact, host-free line grammar before the compiler is invoked.
2967
2968fn wfinishc69 ok bool to void
2969wz
2970wtc112
2971if ok
2972wtc113
2973else
2974wtc114
2975end
2976wtc115
2977wtc124
2978wtc117
2979wj 1
2980wtc28
2981r = wemit
2982r = streamend
2983end
2984
2985note Match exact, host-free line grammar before the compiler is invoked.
2986
2987fn wfinishc70 ok bool to void
2988wz
2989wtc112
2990if ok
2991wtc113
2992else
2993wtc114
2994end
2995wtc115
2996wtc125
2997wtc117
2998wj 1
2999wtc28
3000r = wemit
3001r = streamend
3002end
3003
3004note Match exact, host-free line grammar before the compiler is invoked.
3005
3006fn wfinishc71 ok bool to void
3007wz
3008wtc112
3009if ok
3010wtc113
3011else
3012wtc114
3013end
3014wtc115
3015wtc126
3016wtc117
3017wj 1
3018wtc28
3019r = wemit
3020r = streamend
3021end
3022
3023note Match exact, host-free line grammar before the compiler is invoked.
3024
3025fn wfinishc72 ok bool to void
3026wz
3027wtc112
3028if ok
3029wtc113
3030else
3031wtc114
3032end
3033wtc115
3034wtc127
3035wtc117
3036wj 1
3037wtc28
3038r = wemit
3039r = streamend
3040end
3041
3042note Match exact, host-free line grammar before the compiler is invoked.
3043
3044fn wtc73 to void
3045for i ulong len z66
3046wb get z66 i
3047end
3048end
3049
3050fn wtc74 to void
3051for i ulong len z67
3052wb get z67 i
3053end
3054end
3055
3056fn wtc75 to void
3057for i ulong len z68
3058wb get z68 i
3059end
3060end
3061
3062fn wtc76 to void
3063for i ulong len z69
3064wb get z69 i
3065end
3066end
3067
3068fn wtc77 to void
3069for i ulong len z70
3070wb get z70 i
3071end
3072end
3073
3074fn wtc78 to void
3075for i ulong len z71
3076wb get z71 i
3077end
3078end
3079
3080fn wtc79 to void
3081for i ulong len z72
3082wb get z72 i
3083end
3084end
3085
3086fn wtc80 to void
3087for i ulong len z73
3088wb get z73 i
3089end
3090end
3091
3092fn wtc81 to void
3093for i ulong len z74
3094wb get z74 i
3095end
3096end
3097
3098fn wtc82 to void
3099for i ulong len z75
3100wb get z75 i
3101end
3102end
3103
3104fn wtc83 to void
3105for i ulong len z76
3106wb get z76 i
3107end
3108end
3109
3110fn wtc84 to void
3111for i ulong len z77
3112wb get z77 i
3113end
3114end
3115
3116fn wtc85 to void
3117for i ulong len z78
3118wb get z78 i
3119end
3120end
3121
3122fn wtc86 to void
3123for i ulong len z79
3124wb get z79 i
3125end
3126end
3127
3128fn wtc87 to void
3129for i ulong len z80
3130wb get z80 i
3131end
3132end
3133
3134fn wtc88 to void
3135for i ulong len z81
3136wb get z81 i
3137end
3138end
3139
3140fn wtc89 to void
3141for i ulong len z82
3142wb get z82 i
3143end
3144end
3145
3146fn wtc90 to void
3147for i ulong len z83
3148wb get z83 i
3149end
3150end
3151
3152fn wtc91 to void
3153for i ulong len z84
3154wb get z84 i
3155end
3156end
3157
3158fn wtc92 to void
3159for i ulong len z85
3160wb get z85 i
3161end
3162end
3163
3164fn wtc93 to void
3165for i ulong len z86
3166wb get z86 i
3167end
3168end
3169
3170fn wtc94 to void
3171for i ulong len z87
3172wb get z87 i
3173end
3174end
3175
3176fn wtc95 to void
3177for i ulong len z88
3178wb get z88 i
3179end
3180end
3181
3182fn wtc96 to void
3183for i ulong len z89
3184wb get z89 i
3185end
3186end
3187
3188fn wtc97 to void
3189for i ulong len z90
3190wb get z90 i
3191end
3192end
3193
3194fn wmc98 at ulong to bool
3195if gt add at len z0 get wslen 0
3196ret false
3197end
3198for i ulong len z0
3199if ne get wsrc add at i get z0 i
3200ret false
3201end
3202end
3203ret true
3204end
3205
3206fn wmc99 at ulong to bool
3207if gt add at len z2 get wslen 0
3208ret false
3209end
3210for i ulong len z2
3211if ne get wsrc add at i get z2 i
3212ret false
3213end
3214end
3215ret true
3216end
3217
3218fn wmc100 at ulong to bool
3219if gt add at len z5 get wslen 0
3220ret false
3221end
3222for i ulong len z5
3223if ne get wsrc add at i get z5 i
3224ret false
3225end
3226end
3227ret true
3228end
3229
3230fn wmc101 at ulong to bool
3231if gt add at len z6 get wslen 0
3232ret false
3233end
3234for i ulong len z6
3235if ne get wsrc add at i get z6 i
3236ret false
3237end
3238end
3239ret true
3240end
3241
3242fn wmc102 at ulong to bool
3243if gt add at len z7 get wslen 0
3244ret false
3245end
3246for i ulong len z7
3247if ne get wsrc add at i get z7 i
3248ret false
3249end
3250end
3251ret true
3252end
3253
3254fn wmc103 at ulong to bool
3255if gt add at len z10 get wslen 0
3256ret false
3257end
3258for i ulong len z10
3259if ne get wsrc add at i get z10 i
3260ret false
3261end
3262end
3263ret true
3264end
3265
3266fn wmc104 at ulong to bool
3267if gt add at len z11 get wslen 0
3268ret false
3269end
3270for i ulong len z11
3271if ne get wsrc add at i get z11 i
3272ret false
3273end
3274end
3275ret true
3276end
3277
3278fn wmc105 at ulong to bool
3279if gt add at len z12 get wslen 0
3280ret false
3281end
3282for i ulong len z12
3283if ne get wsrc add at i get z12 i
3284ret false
3285end
3286end
3287ret true
3288end
3289
3290fn wmc106 at ulong to bool
3291if gt add at len z13 get wslen 0
3292ret false
3293end
3294for i ulong len z13
3295if ne get wsrc add at i get z13 i
3296ret false
3297end
3298end
3299ret true
3300end
3301
3302fn wtc107 to void
3303for i ulong len z91
3304wb get z91 i
3305end
3306end
3307
3308fn wtc108 to void
3309for i ulong len z50
3310wb get z50 i
3311end
3312end
3313
3314fn wtc109 to void
3315for i ulong len z92
3316wb get z92 i
3317end
3318end
3319
3320fn wtc110 to void
3321for i ulong len z53
3322wb get z53 i
3323end
3324end
3325
3326fn wtc111 to void
3327for i ulong len z54
3328wb get z54 i
3329end
3330end
3331
3332fn wtc112 to void
3333for i ulong len z93
3334wb get z93 i
3335end
3336end
3337
3338fn wtc113 to void
3339for i ulong len z94
3340wb get z94 i
3341end
3342end
3343
3344fn wtc114 to void
3345for i ulong len z95
3346wb get z95 i
3347end
3348end
3349
3350fn wtc115 to void
3351for i ulong len z96
3352wb get z96 i
3353end
3354end
3355
3356fn wtc116 to void
3357for i ulong len z55
3358wb get z55 i
3359end
3360end
3361
3362fn wtc117 to void
3363for i ulong len z97
3364wb get z97 i
3365end
3366end
3367
3368fn wtc118 to void
3369for i ulong len z56
3370wb get z56 i
3371end
3372end
3373
3374fn wtc119 to void
3375for i ulong len z57
3376wb get z57 i
3377end
3378end
3379
3380fn wtc120 to void
3381for i ulong len z58
3382wb get z58 i
3383end
3384end
3385
3386fn wtc121 to void
3387for i ulong len z59
3388wb get z59 i
3389end
3390end
3391
3392fn wtc122 to void
3393for i ulong len z60
3394wb get z60 i
3395end
3396end
3397
3398fn wtc123 to void
3399for i ulong len z61
3400wb get z61 i
3401end
3402end
3403
3404fn wtc124 to void
3405for i ulong len z62
3406wb get z62 i
3407end
3408end
3409
3410fn wtc125 to void
3411for i ulong len z63
3412wb get z63 i
3413end
3414end
3415
3416fn wtc126 to void
3417for i ulong len z64
3418wb get z64 i
3419end
3420end
3421
3422fn wtc127 to void
3423for i ulong len z65
3424wb get z65 i
3425end
3426end