omega-tool-model
First-party Omega tool-use model source, serving harnesses, and verification records
Brought by drakestapleton
omega-tool-model / native-tool / cycle.om
| 1 | note Native round40 read-file demonstration. The model output is data. Exactly one fixture is authorized. |
| 2 | text creq "{\"tool\":\"read_file\",\"path\":\"jobs/item76666.om\"}" |
| 3 | text cnext "{\"tool\":\"omega_check\",\"path\":\"jobs/item76666.om\"}" |
| 4 | note AArch64 Linux open flags: O_NOFOLLOW (32768) plus O_NONBLOCK (2048). |
| 5 | text cfile "fixture.om" |
| 6 | text cpre "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: read\nSource:\n" |
| 7 | text cend "Tool result: Read succeeded.\nAnswer:\n" |
| 8 | global cbuf uchar 1801 |
| 9 | fn cinfer to void |
| 10 | put og 9 0 |
| 11 | ocpush 0 |
| 12 | n = obprompt 3 |
| 13 | if ge n get og 1 |
| 14 | exit 3 |
| 15 | end |
| 16 | for i ulong n |
| 17 | ocpush get obtk i |
| 18 | end |
| 19 | put oon 0 0 |
| 20 | for j ulong 160 |
| 21 | t = gsnext |
| 22 | if eq t 0 |
| 23 | ret |
| 24 | end |
| 25 | if ge add get oon 0 obtlen t OMOUT |
| 26 | exit 4 |
| 27 | end |
| 28 | obtput t |
| 29 | ocpush t |
| 30 | end |
| 31 | exit 4 |
| 32 | end |
| 33 | fn ccycle to int |
| 34 | for i ulong len example |
| 35 | put iprom i get example i |
| 36 | end |
| 37 | put icount 0 len example |
| 38 | cinfer |
| 39 | if ne get oon 0 len creq |
| 40 | ret 5 |
| 41 | end |
| 42 | for i ulong len creq |
| 43 | if ne get creq i get oout i |
| 44 | ret 5 |
| 45 | end |
| 46 | end |
| 47 | oputc 10 |
| 48 | oflush |
| 49 | fd = fopen cfile 0 len cfile 34816 0 |
| 50 | if lt fd 0 |
| 51 | ret 6 |
| 52 | end |
| 53 | n = ulong 0 |
| 54 | while lt n len cbuf bound 1802 |
| 55 | r = read int fd cbuf n sub len cbuf n |
| 56 | if lt r 0 |
| 57 | cl = fclose int fd |
| 58 | ret 6 |
| 59 | end |
| 60 | if eq r 0 |
| 61 | break |
| 62 | end |
| 63 | n = add n ulong r |
| 64 | end |
| 65 | cl = fclose int fd |
| 66 | if or eq n 0 ge n len cbuf |
| 67 | ret 6 |
| 68 | end |
| 69 | for i ulong len cpre |
| 70 | put iprom i get cpre i |
| 71 | end |
| 72 | for i ulong n |
| 73 | v = get cbuf i |
| 74 | if eq v 0 |
| 75 | ret 6 |
| 76 | end |
| 77 | put iprom add len cpre i v |
| 78 | end |
| 79 | pos = add len cpre n |
| 80 | if ne get cbuf sub n 1 10 |
| 81 | put iprom pos 10 |
| 82 | pos = add pos 1 |
| 83 | end |
| 84 | for i ulong len cend |
| 85 | put iprom add pos i get cend i |
| 86 | end |
| 87 | put icount 0 add pos len cend |
| 88 | cinfer |
| 89 | if ne get oon 0 len cnext |
| 90 | ret 7 |
| 91 | end |
| 92 | for i ulong len cnext |
| 93 | if ne get cnext i get oout i |
| 94 | ret 7 |
| 95 | end |
| 96 | end |
| 97 | oputc 10 |
| 98 | oflush |
| 99 | ret 0 |
| 100 | end |
| 101 | fn main to int |
| 102 | if ne argcnt 1 |
| 103 | ret 2 |
| 104 | end |
| 105 | ockload 1 |
| 106 | put og 6 1 |
| 107 | obload 4 get og 0 |
| 108 | ggopen |
| 109 | ggupw |
| 110 | rc = ccycle |
| 111 | r = nvstop |
| 112 | ret rc |
| 113 | end |