omega-tool-model
First-party Omega tool-use model source, serving harnesses, and verification records
Brought by drakestapleton
omega-tool-model / native-training / sweep.om
| 1 | note Two unseen real fixture reads. Count the first request, the isolated result reply and the complete cycle separately. |
| 2 | text qhead "Task: Read the note and report its value.\nFile: " |
| 3 | text q1 "notes/item97233.txt" |
| 4 | text q2 "notes/item97984.txt" |
| 5 | text ask "\nState: unread\nAnswer:\n" |
| 6 | text result "\nState: read\nTool result: value = " |
| 7 | text answer "\nAnswer:\n" |
| 8 | text req1 "{\"tool\":\"read_file\",\"path\":\"notes/item97233.txt\"}" |
| 9 | text req2 "{\"tool\":\"read_file\",\"path\":\"notes/item97984.txt\"}" |
| 10 | text denied "\nState: denied\nTool result: Permission denied.\nAnswer:\n" |
| 11 | text noauth "Permission denied." |
| 12 | text missing "\nState: missing\nTool result: File not found.\nAnswer:\n" |
| 13 | text nofile "File not found." |
| 14 | global qdata uchar 3 |
| 15 | fn qlen t ulong to ulong |
| 16 | if eq t 0 |
| 17 | ret len qhead |
| 18 | end |
| 19 | if eq t 1 |
| 20 | ret len q1 |
| 21 | end |
| 22 | if eq t 2 |
| 23 | ret len q2 |
| 24 | end |
| 25 | if eq t 3 |
| 26 | ret len ask |
| 27 | end |
| 28 | if eq t 4 |
| 29 | ret len result |
| 30 | end |
| 31 | if eq t 5 |
| 32 | ret len answer |
| 33 | end |
| 34 | if eq t 6 |
| 35 | ret len req1 |
| 36 | end |
| 37 | if eq t 7 |
| 38 | ret len req2 |
| 39 | end |
| 40 | if eq t 8 |
| 41 | ret len denied |
| 42 | end |
| 43 | if eq t 9 |
| 44 | ret len noauth |
| 45 | end |
| 46 | if eq t 10 |
| 47 | ret len missing |
| 48 | end |
| 49 | if eq t 11 |
| 50 | ret len nofile |
| 51 | end |
| 52 | if eq t 12 |
| 53 | ret len qdata |
| 54 | end |
| 55 | exit 77 |
| 56 | end |
| 57 | global sid ulong 1 |
| 58 | global spath uchar 19 |
| 59 | text mark1 "notes/item" |
| 60 | text mark2 "{\"tool\":\"read_file\",\"path\":\"notes/item" |
| 61 | fn sdig i ulong to uchar |
| 62 | v = get sid 0 |
| 63 | for j ulong sub 4 i |
| 64 | v = div v 10 |
| 65 | end |
| 66 | ret uchar add 48 rem v 10 |
| 67 | end |
| 68 | fn qbyte t ulong i ulong to uchar |
| 69 | if eq t 0 |
| 70 | ret get qhead i |
| 71 | end |
| 72 | if eq t 1 |
| 73 | if and ge i len mark1 lt i add len mark1 5 |
| 74 | ret sdig sub i len mark1 |
| 75 | end |
| 76 | ret get q1 i |
| 77 | end |
| 78 | if eq t 2 |
| 79 | ret get q2 i |
| 80 | end |
| 81 | if eq t 3 |
| 82 | ret get ask i |
| 83 | end |
| 84 | if eq t 4 |
| 85 | ret get result i |
| 86 | end |
| 87 | if eq t 5 |
| 88 | ret get answer i |
| 89 | end |
| 90 | if eq t 6 |
| 91 | if and ge i len mark2 lt i add len mark2 5 |
| 92 | ret sdig sub i len mark2 |
| 93 | end |
| 94 | ret get req1 i |
| 95 | end |
| 96 | if eq t 7 |
| 97 | ret get req2 i |
| 98 | end |
| 99 | if eq t 8 |
| 100 | ret get denied i |
| 101 | end |
| 102 | if eq t 9 |
| 103 | ret get noauth i |
| 104 | end |
| 105 | if eq t 10 |
| 106 | ret get missing i |
| 107 | end |
| 108 | if eq t 11 |
| 109 | ret get nofile i |
| 110 | end |
| 111 | if eq t 12 |
| 112 | ret get qdata i |
| 113 | end |
| 114 | exit 77 |
| 115 | end |
| 116 | fn qadd s ulong to void |
| 117 | n = get icount 0 |
| 118 | for i ulong qlen s |
| 119 | put iprom add n i qbyte s i |
| 120 | end |
| 121 | put icount 0 add n qlen s |
| 122 | end |
| 123 | fn qmake p ulong to void |
| 124 | put icount 0 0 |
| 125 | qadd 0 |
| 126 | qadd p |
| 127 | end |
| 128 | fn qinfer to void |
| 129 | put og 9 0 |
| 130 | ocpush 0 |
| 131 | n = obprompt 3 |
| 132 | for i ulong n |
| 133 | ocpush get obtk i |
| 134 | end |
| 135 | put oon 0 0 |
| 136 | for j ulong 64 |
| 137 | c = gsnext |
| 138 | if eq c 0 |
| 139 | ret |
| 140 | end |
| 141 | obtput c |
| 142 | ocpush c |
| 143 | end |
| 144 | end |
| 145 | fn qeq s ulong to bool |
| 146 | if ne get oon 0 qlen s |
| 147 | ret false |
| 148 | end |
| 149 | for i ulong qlen s |
| 150 | if ne get oout i qbyte s i |
| 151 | ret false |
| 152 | end |
| 153 | end |
| 154 | ret true |
| 155 | end |
| 156 | fn qcase p ulong want ulong to void |
| 157 | qmake p |
| 158 | qadd 3 |
| 159 | qinfer |
| 160 | asked = qeq want |
| 161 | if not asked |
| 162 | put oon 0 0 |
| 163 | oputc 82 |
| 164 | oputc 32 |
| 165 | oputc 48 |
| 166 | oputc 32 |
| 167 | oputc 48 |
| 168 | oputc 10 |
| 169 | oflush |
| 170 | ret |
| 171 | end |
| 172 | fd = long 0 |
| 173 | if eq p 1 |
| 174 | fd = fopen spath 0 len spath 34816 0 |
| 175 | else |
| 176 | fd = fopen q2 0 len q2 0 0 |
| 177 | end |
| 178 | if lt fd 0 |
| 179 | exit 71 |
| 180 | end |
| 181 | r = read int fd qdata 0 len qdata |
| 182 | cl = fclose int fd |
| 183 | if ne r 3 |
| 184 | exit 72 |
| 185 | end |
| 186 | qmake p |
| 187 | qadd 4 |
| 188 | qadd 12 |
| 189 | qadd 5 |
| 190 | qinfer |
| 191 | got = qeq 12 |
| 192 | put oon 0 0 |
| 193 | oputc 82 |
| 194 | oputc 32 |
| 195 | if asked |
| 196 | oputc 49 |
| 197 | else |
| 198 | oputc 48 |
| 199 | end |
| 200 | oputc 32 |
| 201 | if got |
| 202 | oputc 49 |
| 203 | else |
| 204 | oputc 48 |
| 205 | end |
| 206 | oputc 10 |
| 207 | oflush |
| 208 | end |
| 209 | fn qstate st ulong expected ulong to void |
| 210 | qmake 1 |
| 211 | qadd st |
| 212 | qinfer |
| 213 | ok = qeq expected |
| 214 | put oon 0 0 |
| 215 | oputc 83 |
| 216 | oputc 32 |
| 217 | if ok |
| 218 | oputc 49 |
| 219 | else |
| 220 | oputc 48 |
| 221 | end |
| 222 | oputc 10 |
| 223 | oflush |
| 224 | end |
| 225 | global cbufx uchar 1 |
| 226 | fn main to int |
| 227 | make = eq argcnt 2 |
| 228 | if make |
| 229 | r = argread 1 cbufx 0 1 |
| 230 | if or ne r 1 ne get cbufx 0 43 |
| 231 | ret 2 |
| 232 | end |
| 233 | else |
| 234 | if ne argcnt 1 |
| 235 | ret 2 |
| 236 | end |
| 237 | ockload 1 |
| 238 | put og 6 1 |
| 239 | obload 4 get og 0 |
| 240 | ggopen |
| 241 | ggupw |
| 242 | end |
| 243 | for i ulong 24 |
| 244 | put sid 0 add 80000 rem mul i 7213 19001 |
| 245 | for j ulong len spath |
| 246 | put spath j qbyte 1 j |
| 247 | end |
| 248 | if make |
| 249 | fd = fopen spath 0 len spath 193 384 |
| 250 | if lt fd 0 |
| 251 | ret 80 |
| 252 | end |
| 253 | v = add 100 rem add mul i 373 167 900 |
| 254 | put qdata 0 uchar add 48 div v 100 |
| 255 | put qdata 1 uchar add 48 rem div v 10 10 |
| 256 | put qdata 2 uchar add 48 rem v 10 |
| 257 | n = write int fd qdata 0 3 |
| 258 | cl = fclose int fd |
| 259 | if ne n 3 |
| 260 | ret 81 |
| 261 | end |
| 262 | else |
| 263 | qcase 1 6 |
| 264 | end |
| 265 | end |
| 266 | if not make |
| 267 | r = nvstop |
| 268 | end |
| 269 | ret 0 |
| 270 | end |