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 / native-training / sweep.om

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