interplane.Get Omega
Read in your language

omega-mcp

aien-dev/omega-mcp

Brought by drakestapleton

branch main Branches Tags History

omega-mcp / qa / rpc.om

691 lines · 13915 bytes Raw Blame History
1note Agent Q&A MCP transport: newline-delimited JSON-RPC 2.0 on stdio, framing copied from maintenance/rpc.om.
2global arrpc ulong 8
3text arj "jsonrpc"
4text arid "id"
5text arm "method"
6text arp "params"
7text arn "name"
8text ara "arguments"
9text arres "result"
10text arerr "error"
11text arcode "code"
12text armsg "message"
13text arver "2.0"
14text arinit "initialize"
15text arping "ping"
16text arlist "tools/list"
17text arcall "tools/call"
18text arpv "protocolVersion"
19text arpv1 "2025-06-18"
20text arpv2 "2025-03-26"
21text arpv3 "2024-11-05"
22text artools "tools"
23text arsc "structuredContent"
24text arc "content"
25text artext "text"
26text artype "type"
27text ariserr "isError"
28text arnl "\n"
29text areparse "Malformed or oversized JSON frame"
30text areinv "Invalid JSON-RPC request: object, jsonrpc 2.0, string method and string/integer id required"
31text arepar "Invalid params: the tool's named string arguments, each present once, within its maxLength"
32text aremeth "Method not found"
33text arcap "capabilities"
34text arlc "listChanged"
35text arsi "serverInfo"
36text arversio "version"
37text arserver "omega-agent-qa"
38text arvers "0.1.0"
39text arinst "instructions"
40text arhelp "Shared questions and answers for coding agents. Before you spend long on an error, call search with a few words from it. Read answers with read and run their evidence yourself before relying on them: an answer is a claim until it reproduces. When you solve something others may hit, and consent_status says may_contribute, ask, answer or check (works or fails, with evidence). If may_contribute is false, tell the person once, plainly, that sharing is off and quote how_to_enable; never edit the consent file yourself. Share only what the entry needs: no chat, private code, file contents, keys or home paths."
41text ardesc "description"
42text arschema "inputSchema"
43text arprops "properties"
44text arreq "required"
45text aradd "additionalProperties"
46text arobj "object"
47text arstr "string"
48text armax "maxLength"
49text arpatter "pattern"
50text arhashpa "^[0-9a-f]{64}$"
51text arrespa "^(works|fails)$"
52text arsummar "See structuredContent for the exact result."
53text ar0 "search"
54text ar1 "read"
55text ar2 "consent_status"
56text ar3 "ask"
57text ar4 "answer"
58text ar5 "check"
59text ard0 "Find shared entries whose text holds every space-separated word of words (ASCII case-insensitive; empty lists all). Returns id, kind, title and ref of up to 50, the total matches, more when there are further matches (add words to narrow) and skipped damaged files. Open to every agent."
60text ard1 "Read one entry's exact text by its id (the SHA-256 of the text, checked on read). Open to every agent."
61text ard2 "Whether this agent may contribute, the consent file, and one plain sentence for the person on how to turn sharing on or off. Reading never needs consent."
62text ard3 "Post a question (needs consent). title and versions are one line each (tool, compiler, OS versions); body is the problem with the smallest reproduction. Refused, never edited, if it holds keys, tokens or home paths. Returns the entry id."
63text ard4 "Post an answer to a question id (needs consent): versions it was proven on, steps to apply it, evidence (one line: the command that shows it works and its result) and body. Refused if it holds keys, tokens or home paths."
64text ard5 "Confirm or challenge an answer id (needs consent): result works or fails, evidence (the command you ran and what it printed) and body (what you saw). Refused if it holds keys, tokens or home paths."
65text arf0 "words"
66text arf1 "id"
67text arf2 "title"
68text arf3 "versions"
69text arf4 "body"
70text arf5 "question"
71text arf6 "answer"
72text arf7 "steps"
73text arf8 "evidence"
74text arf9 "result"
75text areinter "Internal error: the result is not a complete JSON object"
76
77fn arwt ob edit uchar 787472 s view uchar * to void
78js_wsbuf ob s 0 len s
79end
80
81fn arpair ob edit uchar 787472 key view uchar * value view uchar * to void
82arwt ob key
83arwt ob value
84end
85
86fn armem src view uchar 524288 tape view uint 65536 obj ulong key view uchar * to ulong
87if ne js_type tape obj jsobj
88ret jsnone
89end
90k = js_first tape obj
91while ne k jsnone bound 999999
92if js_streq src js_off tape k key
93ret add k 1
94end
95k = js_mnext tape k
96end
97ret jsnone
98end
99
100fn arfull src view uchar * off ulong n ulong to bool
101p = ulong 0
102while lt p n bound 999999
103r = write 1 src add off p sub n p
104if eq r -4
105continue
106end
107if le r 0
108ret false
109end
110p = add p ulong r
111end
112ret true
113end
114
115fn arbegin src view uchar 524288 tape view uint 65536 ob edit uchar 787472 to void
116z = js_winit ob
117js_wobj ob
118arpair ob arj arver
119arwt ob arid
120t = get arrpc 0
121if eq t jsnone
122js_wnull ob
123else
124js_wtok ob src js_type tape t js_off tape t
125end
126end
127
128fn arsend ob edit uchar 787472 to void
129js_wobje ob
130n = js_wdone ob
131if lt n 0
132exit 5
133end
134ok = arfull ob 1040 ulong n
135if not ok
136exit 6
137end
138ok = arfull arnl 0 1
139if not ok
140exit 6
141end
142end
143
144fn arerror src view uchar 524288 tape view uint 65536 ob edit uchar 787472 code long msg view uchar * to void
145arbegin src tape ob
146arwt ob arerr
147js_wobj ob
148arwt ob arcode
149js_wlong ob code
150arpair ob armsg msg
151js_wobje ob
152arsend ob
153end
154
155fn arhandle src view uchar 524288 tape edit uint 65536 ob edit uchar 787472 n ulong to void
156put arrpc 0 jsnone
157r = js_parse src tape n
158if lt r 0
159arerror src tape ob -32700 areparse
160ret
161end
162v = armem src tape 0 arj
163m = armem src tape 0 arm
164id = armem src tape 0 arid
165valid = eq js_type tape 0 jsobj
166if ne js_type tape v jsstr
167valid = false
168else
169if not js_streq src js_off tape v arver
170valid = false
171end
172end
173if ne js_type tape m jsstr
174valid = false
175end
176if ne id jsnone
177ty = js_type tape id
178if eq ty jsstr
179put arrpc 0 id
180else
181if eq ty jsnum
182if ne js_ilex src js_off tape id 0
183put arrpc 0 id
184else
185valid = false
186end
187else
188valid = false
189end
190end
191end
192note Duplicate envelope fields are ambiguous and cannot execute.
193if valid
194k = js_first tape 0
195seen = ulong 0
196while ne k jsnone bound 999999
197bit = ulong 0
198if js_streq src js_off tape k arj
199bit = 1
200end
201if js_streq src js_off tape k arm
202bit = 2
203end
204if js_streq src js_off tape k arid
205bit = 4
206end
207if js_streq src js_off tape k arp
208bit = 8
209end
210if ne and seen bit 0
211valid = false
212end
213seen = or seen bit
214k = js_mnext tape k
215end
216end
217if not valid
218arerror src tape ob -32600 areinv
219ret
220end
221note Valid notifications have neither response nor storage effects.
222if eq id jsnone
223ret
224end
225p = armem src tape 0 arp
226put arrpc 1 p
227if ne p jsnone
228if ne js_type tape p jsobj
229arerror src tape ob -32602 arepar
230ret
231end
232end
233if js_streq src js_off tape m arinit
234arinitialize src tape ob
235ret
236end
237if js_streq src js_off tape m arcall
238artoolcall src tape ob
239ret
240end
241if js_streq src js_off tape m arping
242arbegin src tape ob
243arwt ob arres
244js_wobj ob
245js_wobje ob
246arsend ob
247ret
248end
249if js_streq src js_off tape m arlist
250arbegin src tape ob
251arwt ob arres
252js_wobj ob
253arwt ob artools
254js_warr ob
255for op ulong 6
256arschemawrite ob op
257end
258js_warre ob
259js_wobje ob
260arsend ob
261ret
262end
263arerror src tape ob -32601 aremeth
264end
265
266fn arframe src view uchar 524288 tape edit uint 65536 ob edit uchar 787472 to void
267if ne get arrpc 7 0
268put arrpc 0 jsnone
269arerror src tape ob -32700 areparse
270else
271arhandle src tape ob get arrpc 6
272end
273put arrpc 6 0
274put arrpc 7 0
275end
276
277fn arfeed src edit uchar 524288 tape edit uint 65536 ob edit uchar 787472 chunk view uchar 4096 n ulong to void
278for i ulong n
279c = get chunk i
280if eq c 10
281arframe src tape ob
282else
283if eq get arrpc 7 0
284p = get arrpc 6
285if ge p len src
286put arrpc 7 1
287else
288put src p c
289put arrpc 6 add p 1
290end
291end
292end
293end
294end
295
296fn arfname ob edit uchar 787472 f ulong to void
297if eq f 0
298arwt ob arf0
299end
300if eq f 1
301arwt ob arf1
302end
303if eq f 2
304arwt ob arf2
305end
306if eq f 3
307arwt ob arf3
308end
309if eq f 4
310arwt ob arf4
311end
312if eq f 5
313arwt ob arf5
314end
315if eq f 6
316arwt ob arf6
317end
318if eq f 7
319arwt ob arf7
320end
321if eq f 8
322arwt ob arf8
323end
324if eq f 9
325arwt ob arf9
326end
327end
328note The fields each tool takes, as bits of the field slots in qa/store.om (all required, no others):
329note ask 4+8+16=28, answer 32+8+128+256+16=440, check 64+512+256+16=848 (aien-calc receipts in the commit message).
330fn armask op ulong to ulong
331if eq op 0
332ret 1
333end
334if eq op 1
335ret 2
336end
337if eq op 2
338ret 0
339end
340if eq op 3
341ret 28
342end
343if eq op 4
344ret 440
345end
346ret 848
347end
348note Largest accepted length of each field in bytes after JSON unescaping; every entry stays under qmax.
349fn arcapof f ulong to ulong
350if eq f 0
351ret 256
352end
353if or or eq f 1 eq f 5 eq f 6
354ret 64
355end
356if or eq f 2 eq f 3
357ret 200
358end
359if eq f 4
360ret 32768
361end
362if eq f 7
363ret 16384
364end
365if eq f 8
366ret 1000
367end
368ret 5
369end
370fn arname ob edit uchar 787472 op ulong to void
371if eq op 0
372arwt ob ar0
373end
374if eq op 1
375arwt ob ar1
376end
377if eq op 2
378arwt ob ar2
379end
380if eq op 3
381arwt ob ar3
382end
383if eq op 4
384arwt ob ar4
385end
386if eq op 5
387arwt ob ar5
388end
389end
390fn ardescription ob edit uchar 787472 op ulong to void
391if eq op 0
392arwt ob ard0
393end
394if eq op 1
395arwt ob ard1
396end
397if eq op 2
398arwt ob ard2
399end
400if eq op 3
401arwt ob ard3
402end
403if eq op 4
404arwt ob ard4
405end
406if eq op 5
407arwt ob ard5
408end
409end
410fn arschemawrite ob edit uchar 787472 op ulong to void
411m = armask op
412js_wobj ob
413arwt ob arn
414arname ob op
415arwt ob ardesc
416ardescription ob op
417arwt ob arschema
418js_wobj ob
419arpair ob artype arobj
420arwt ob aradd
421js_wbool ob false
422arwt ob arprops
423js_wobj ob
424for f ulong 10
425if ne and m shl 1 f 0
426arfname ob f
427js_wobj ob
428arpair ob artype arstr
429arwt ob armax
430js_wulong ob arcapof f
431if or or eq f 1 eq f 5 eq f 6
432arpair ob arpatter arhashpa
433end
434if eq f 9
435arpair ob arpatter arrespa
436end
437js_wobje ob
438end
439end
440js_wobje ob
441arwt ob arreq
442js_warr ob
443for f ulong 10
444if ne and m shl 1 f 0
445arfname ob f
446end
447end
448js_warre ob
449js_wobje ob
450js_wobje ob
451end
452fn arinitialize src view uchar 524288 tape view uint 65536 ob edit uchar 787472 to void
453p = get arrpc 1
454v = armem src tape p arpv
455if ne js_type tape v jsstr
456arerror src tape ob -32602 arepar
457ret
458end
459arbegin src tape ob
460arwt ob arres
461js_wobj ob
462arwt ob arpv
463if js_streq src js_off tape v arpv2
464arwt ob arpv2
465else
466if js_streq src js_off tape v arpv3
467arwt ob arpv3
468else
469arwt ob arpv1
470end
471end
472arwt ob arcap
473js_wobj ob
474arwt ob artools
475js_wobj ob
476arwt ob arlc
477js_wbool ob false
478js_wobje ob
479js_wobje ob
480arwt ob arsi
481js_wobj ob
482arpair ob arn arserver
483arpair ob arversio arvers
484js_wobje ob
485arpair ob arinst arhelp
486js_wobje ob
487arsend ob
488end
489fn artoolop src view uchar 524288 off ulong to ulong
490if js_streq src off ar0
491ret 0
492end
493if js_streq src off ar1
494ret 1
495end
496if js_streq src off ar2
497ret 2
498end
499if js_streq src off ar3
500ret 3
501end
502if js_streq src off ar4
503ret 4
504end
505if js_streq src off ar5
506ret 5
507end
508ret jsnone
509end
510fn arfieldof src view uchar 524288 off ulong to ulong
511if js_streq src off arf0
512ret 0
513end
514if js_streq src off arf1
515ret 1
516end
517if js_streq src off arf2
518ret 2
519end
520if js_streq src off arf3
521ret 3
522end
523if js_streq src off arf4
524ret 4
525end
526if js_streq src off arf5
527ret 5
528end
529if js_streq src off arf6
530ret 6
531end
532if js_streq src off arf7
533ret 7
534end
535if js_streq src off arf8
536ret 8
537end
538if js_streq src off arf9
539ret 9
540end
541ret jsnone
542end
543note Exactly the tool's fields, each once, each a string; values are unescaped into fv slot by slot and a
544note value longer than its cap (after unescaping) refuses the call.
545fn arput src view uchar 524288 off ulong f ulong fv edit uchar 327680 fl edit ulong 10 to bool
546tmp = new uchar 32768 0
547n = js_sget src off tmp
548if lt n 0
549ret false
550end
551if gt ulong n arcapof f
552ret false
553end
554for i ulong ulong n
555put fv add mul f qfmax i get tmp i
556end
557put fl f ulong n
558ret true
559end
560fn arfill src view uchar 524288 tape view uint 65536 a ulong op ulong fv edit uchar 327680 fl edit ulong 10 to bool
561if ne js_type tape a jsobj
562ret false
563end
564m = armask op
565seen = ulong 0
566k = js_first tape a
567while ne k jsnone bound 64
568f = arfieldof src js_off tape k
569if eq f jsnone
570ret false
571end
572b = shl 1 f
573if eq and m b 0
574ret false
575end
576if ne and seen b 0
577ret false
578end
579seen = or seen b
580v = add k 1
581if ne js_type tape v jsstr
582ret false
583end
584if gt js_slen tape v 32768
585ret false
586end
587if not arput src js_off tape v f fv fl
588ret false
589end
590k = js_mnext tape k
591end
592ret eq seen m
593end
594note Exactly the tool's fields, each once, each a string within its cap after unescaping; else -32602.
595fn arinvoke src view uchar 524288 tape view uint 65536 ob edit uchar 787472 a ulong op ulong to void
596fv = new uchar 327680 0
597fl = new ulong 10 0
598if not arfill src tape a op fv fl
599arerror src tape ob -32602 arepar
600ret
601end
602arresult src tape ob op fv fl
603end
604fn arresult src view uchar 524288 tape view uint 65536 ob edit uchar 787472 op ulong fv view uchar 327680 fl view ulong 10 to void
605arbegin src tape ob
606arwt ob arres
607js_wobj ob
608arwt ob arsc
609ok = qa_call op fv fl ob
610arwt ob arc
611js_warr ob
612js_wobj ob
613arpair ob artype artext
614arpair ob artext arsummar
615js_wobje ob
616js_warre ob
617arwt ob ariserr
618js_wbool ob ne get qerr 0 0
619js_wobje ob
620arsend ob
621end
622
623fn artoolcall src view uchar 524288 tape view uint 65536 ob edit uchar 787472 to void
624p = get arrpc 1
625n = armem src tape p arn
626a = armem src tape p ara
627if ne js_type tape n jsstr
628arerror src tape ob -32602 arepar
629ret
630end
631op = artoolop src js_off tape n
632if eq op jsnone
633arerror src tape ob -32602 arepar
634ret
635end
636if eq a jsnone
637if ne armask op 0
638arerror src tape ob -32602 arepar
639ret
640end
641end
642if or gt js_nkids tape p 2 and eq a jsnone gt js_nkids tape p 1
643arerror src tape ob -32602 arepar
644ret
645end
646if eq a jsnone
647arinvoke0 src tape ob op
648ret
649end
650arinvoke src tape ob a op
651end
652fn arinvoke0 src view uchar 524288 tape view uint 65536 ob edit uchar 787472 op ulong to void
653fv = new uchar 327680 0
654fl = new ulong 10 0
655arresult src tape ob op fv fl
656end
657
658fn main to int
659src = new uchar 524288 0
660tape = new uint 65536 0
661ob = new uchar 787472 0
662chunk = new uchar 4096 0
663b = qa_boot
664if ne b 0
665ret b
666end
667z = js_init tape 524288 64
668if lt z 0
669ret 4
670end
671note Each read consumes bytes or EOF; nested bounded epochs permit a long-lived stdio connection.
672for epoch ulong 999999
673for tick ulong 999999
674r = read 0 chunk 0 len chunk
675if eq r -4
676continue
677end
678if lt r 0
679ret 7
680end
681if eq r 0
682if or ne get arrpc 6 0 ne get arrpc 7 0
683arframe src tape ob
684end
685ret 0
686end
687arfeed src tape ob chunk ulong r
688end
689end
690ret 0
691end