Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mcp/blob/main/maintenance/rpc.om # omega-mcp aien-dev/omega-mcp Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mcp / maintenance / rpc.om` 633 lines ยท 13169 bytes Raw Blame History 1 note Maintenance MCP transport; storage is deliberately independent of compiler sandbox/server units. 2 note arrpc: id, params, op, file token, body token, token token, frame length, oversize. 3 global arrpc ulong 8 4 text arj "jsonrpc" 5 text arid "id" 6 text arm "method" 7 text arp "params" 8 text arn "name" 9 text ara "arguments" 10 text arf "file" 11 text arc "content" 12 text arh "expected_sha256" 13 text art "proposal_id" 14 text arres "result" 15 text arerr "error" 16 text arcode "code" 17 text armsg "message" 18 text arver "2.0" 19 text arinit "initialize" 20 text arping "ping" 21 text arlist "tools/list" 22 text arcall "tools/call" 23 text arpv "protocolVersion" 24 text arpv1 "2025-06-18" 25 text arpv2 "2025-03-26" 26 text arpv3 "2024-11-05" 27 text artools "tools" 28 text arsc "structuredContent" 29 text artext "text" 30 text artype "type" 31 text ariserr "isError" 32 text arnl "\n" 33 text areparse "Malformed or oversized JSON frame" 34 text areinv "Invalid JSON-RPC request: object, jsonrpc 2.0, string method and string/integer id required" 35 text arepar "Invalid params: strict named arguments required; document content limit is 65536 UTF-8 bytes" 36 text aremeth "Method not found" 37 text arcap "capabilities" 38 text arlc "listChanged" 39 text arsi "serverInfo" 40 text arversio "version" 41 text arserver "omega-agent-maintenance" 42 text arvers "0.1.0" 43 text arinst "instructions" 44 text arhelp "Host-only saved-file maintenance, not active OMP runtime reload. Default read-only. Protected /srv/aien-keep store is always read-only. Validation checks syntax/structure only, not models, credentials, policy effectiveness or runtime compatibility. Proposals and rollback tokens are connection-scoped; retain the exact before-content preview for durable recovery." 45 text ardesc "description" 46 text arschema "inputSchema" 47 text arprops "properties" 48 text arreq "required" 49 text aradd "additionalProperties" 50 text arobj "object" 51 text arstr "string" 52 text armax "maxLength" 53 text armin "minLength" 54 text arpatter "pattern" 55 text arhashpa "^[0-9a-f]{64}$" 56 text arinv "inventory" 57 text arread "read_file" 58 text arval "validate" 59 text arprop "propose" 60 text arapply "apply" 61 text arroll "rollback" 62 text ard0 "Inventory supported saved agent files and per-file status, canonical root and read-only/writable mode. Does not report active runtime state." 63 text ard1 "Read exact saved UTF-8 file bytes, byte size and SHA-256. Logical IDs only: RULES.md, WATCHDOG.yml, config.yml, agents/.md." 64 text ard2 "Validate syntax/structure only: JSON object for config/WATCHDOG, JSON-object markdown frontmatter for agent definitions; no semantic/runtime guarantee. Legacy YAML remains readable but is not validated here." 65 text ard3 "Prepare one immutable connection-scoped proposal against an exact SHA-256, with full before/after preview and apply_allowed. No file write. Replaces the previous proposal; maximum document payload 65536 bytes." 66 text ard4 "Apply the exact connection-scoped proposal once, requiring --allow-write and unchanged before hash. Protected store always refuses. Atomic saved-file update, not runtime reload." 67 text ard5 "Restore the before bytes of the applied connection-scoped proposal once, only if current bytes still match after hash. Requires --allow-write; protected store refuses. Token/recovery state does not persist across disconnect." 68 text arsummar "See structuredContent for the exact result, full document preview, and connection-scoped recovery details." 69 text areinter "Internal error: storage result is not a complete JSON object" 70 71 fn arwt ob edit uchar 787472 s view uchar * to void 72 js_wsbuf ob s 0 len s 73 end 74 fn arpair ob edit uchar 787472 key view uchar * value view uchar * to void 75 arwt ob key 76 arwt ob value 77 end 78 fn armem src view uchar 524288 tape view uint 65536 obj ulong key view uchar * to ulong 79 if ne js_type tape obj jsobj 80 ret jsnone 81 end 82 k = js_first tape obj 83 while ne k jsnone bound 999999 84 if js_streq src js_off tape k key 85 ret add k 1 86 end 87 k = js_mnext tape k 88 end 89 ret jsnone 90 end 91 fn arfull src view uchar * off ulong n ulong to bool 92 p = ulong 0 93 while lt p n bound 999999 94 r = write 1 src add off p sub n p 95 if eq r -4 96 continue 97 end 98 if le r 0 99 ret false 100 end 101 p = add p ulong r 102 end 103 ret true 104 end 105 fn arbegin src view uchar 524288 tape view uint 65536 ob edit uchar 787472 to void 106 z = js_winit ob 107 js_wobj ob 108 arpair ob arj arver 109 arwt ob arid 110 t = get arrpc 0 111 if eq t jsnone 112 js_wnull ob 113 else 114 js_wtok ob src js_type tape t js_off tape t 115 end 116 end 117 fn arsend ob edit uchar 787472 to void 118 js_wobje ob 119 n = js_wdone ob 120 if lt n 0 121 exit 5 122 end 123 ok = arfull ob 1040 ulong n 124 if not ok 125 exit 6 126 end 127 ok = arfull arnl 0 1 128 if not ok 129 exit 6 130 end 131 end 132 fn arerror src view uchar 524288 tape view uint 65536 ob edit uchar 787472 code long msg view uchar * to void 133 arbegin src tape ob 134 arwt ob arerr 135 js_wobj ob 136 arwt ob arcode 137 js_wlong ob code 138 arpair ob armsg msg 139 js_wobje ob 140 arsend ob 141 end 142 fn arname ob edit uchar 787472 op ulong to void 143 if eq op 0 144 arwt ob arinv 145 end 146 if eq op 1 147 arwt ob arread 148 end 149 if eq op 2 150 arwt ob arval 151 end 152 if eq op 3 153 arwt ob arprop 154 end 155 if eq op 4 156 arwt ob arapply 157 end 158 if eq op 5 159 arwt ob arroll 160 end 161 end 162 fn ardescription ob edit uchar 787472 op ulong to void 163 if eq op 0 164 arwt ob ard0 165 end 166 if eq op 1 167 arwt ob ard1 168 end 169 if eq op 2 170 arwt ob ard2 171 end 172 if eq op 3 173 arwt ob ard3 174 end 175 if eq op 4 176 arwt ob ard4 177 end 178 if eq op 5 179 arwt ob ard5 180 end 181 end 182 fn arfield ob edit uchar 787472 key view uchar * cap ulong to void 183 arwt ob key 184 js_wobj ob 185 arpair ob artype arstr 186 arwt ob armax 187 js_wulong ob cap 188 if ne cap 65536 189 arwt ob armin 190 js_wulong ob 1 191 end 192 if eq cap 64 193 arpair ob arpatter arhashpa 194 end 195 js_wobje ob 196 end 197 fn arschemawrite ob edit uchar 787472 op ulong to void 198 js_wobj ob 199 arwt ob arn 200 arname ob op 201 arwt ob ardesc 202 ardescription ob op 203 arwt ob arschema 204 js_wobj ob 205 arpair ob artype arobj 206 arwt ob aradd 207 js_wbool ob false 208 arwt ob arprops 209 js_wobj ob 210 if and ge op 1 le op 3 211 arfield ob arf 127 212 end 213 if or eq op 2 eq op 3 214 arfield ob arc 65536 215 end 216 if eq op 3 217 arfield ob arh 64 218 end 219 if ge op 4 220 arfield ob art 128 221 end 222 js_wobje ob 223 arwt ob arreq 224 js_warr ob 225 if and ge op 1 le op 3 226 arwt ob arf 227 end 228 if or eq op 2 eq op 3 229 arwt ob arc 230 end 231 if eq op 3 232 arwt ob arh 233 end 234 if ge op 4 235 arwt ob art 236 end 237 js_warre ob 238 js_wobje ob 239 js_wobje ob 240 end 241 fn arinitialize src view uchar 524288 tape view uint 65536 ob edit uchar 787472 to void 242 p = get arrpc 1 243 v = armem src tape p arpv 244 if ne js_type tape v jsstr 245 arerror src tape ob -32602 arepar 246 ret 247 end 248 arbegin src tape ob 249 arwt ob arres 250 js_wobj ob 251 arwt ob arpv 252 if js_streq src js_off tape v arpv2 253 arwt ob arpv2 254 else 255 if js_streq src js_off tape v arpv3 256 arwt ob arpv3 257 else 258 arwt ob arpv1 259 end 260 end 261 arwt ob arcap 262 js_wobj ob 263 arwt ob artools 264 js_wobj ob 265 arwt ob arlc 266 js_wbool ob false 267 js_wobje ob 268 js_wobje ob 269 arwt ob arsi 270 js_wobj ob 271 arpair ob arn arserver 272 arpair ob arversio arvers 273 js_wobje ob 274 arpair ob arinst arhelp 275 js_wobje ob 276 arsend ob 277 end 278 fn artoolop src view uchar 524288 off ulong to ulong 279 if js_streq src off arinv 280 ret 0 281 end 282 if js_streq src off arread 283 ret 1 284 end 285 if js_streq src off arval 286 ret 2 287 end 288 if js_streq src off arprop 289 ret 3 290 end 291 if js_streq src off arapply 292 ret 4 293 end 294 if js_streq src off arroll 295 ret 5 296 end 297 ret jsnone 298 end 299 note Exact field count plus required unique known fields refuses extras and duplicate keys. 300 fn arargs src view uchar 524288 tape view uint 65536 a ulong op ulong to bool 301 if ne js_type tape a jsobj 302 ret false 303 end 304 want = ulong 0 305 if eq op 1 306 want = 1 307 end 308 if eq op 2 309 want = 2 310 end 311 if eq op 3 312 want = 3 313 end 314 if ge op 4 315 want = 1 316 end 317 if ne js_nkids tape a want 318 ret false 319 end 320 f = armem src tape a arf 321 b = armem src tape a arc 322 t = jsnone 323 if eq op 3 324 t = armem src tape a arh 325 end 326 if ge op 4 327 t = armem src tape a art 328 end 329 if and ge op 1 le op 3 330 if ne js_type tape f jsstr 331 ret false 332 end 333 if or eq js_slen tape f 0 gt js_slen tape f 127 334 ret false 335 end 336 end 337 if or eq op 2 eq op 3 338 if ne js_type tape b jsstr 339 ret false 340 end 341 if gt js_slen tape b 65536 342 ret false 343 end 344 end 345 if ge op 3 346 if ne js_type tape t jsstr 347 ret false 348 end 349 if or eq js_slen tape t 0 gt js_slen tape t 128 350 ret false 351 end 352 end 353 put arrpc 3 f 354 put arrpc 4 b 355 put arrpc 5 t 356 ret true 357 end 358 fn ardcopy ob edit uchar 787472 domain view uchar 787472 dt view uint 65536 n ulong to void 359 for t ulong ulong get dt jshnt 360 ty = js_type dt t 361 off = js_off dt t 362 js_wtok ob part domain 1040 n ty off 363 end 364 end 365 366 note Storage owns a separate complete-object writer and may reset it on refusal. 367 note Parse only after am_call returns; encoding failures must never rerun a mutation. 368 fn ardomain src view uchar 524288 tape view uint 65536 ob edit uchar 787472 domain edit uchar 787472 dt edit uint 65536 to void 369 n = js_wdone domain 370 if le n 0 371 arerror src tape ob -32603 areinter 372 ret 373 end 374 z = js_init dt 786432 64 375 if lt z 0 376 arerror src tape ob -32603 areinter 377 ret 378 end 379 r = js_parse part domain 1040 ulong n dt ulong n 380 if lt r 0 381 arerror src tape ob -32603 areinter 382 ret 383 end 384 if ne js_type dt 0 jsobj 385 arerror src tape ob -32603 areinter 386 ret 387 end 388 arbegin src tape ob 389 arwt ob arres 390 js_wobj ob 391 arwt ob arsc 392 ardcopy ob domain dt ulong n 393 arwt ob arc 394 js_warr ob 395 js_wobj ob 396 arpair ob artype artext 397 arpair ob artext arsummar 398 js_wobje ob 399 js_warre ob 400 arwt ob ariserr 401 js_wbool ob ne get amerror 0 0 402 js_wobje ob 403 arsend ob 404 end 405 fn arinvoke src view uchar 524288 tape view uint 65536 ob edit uchar 787472 to void 406 file = new uchar 128 0 407 body = new uchar 65536 0 408 token = new uchar 128 0 409 domain = new uchar 787472 0 410 dt = new uint 65536 0 411 nf = long 0 412 nb = long 0 413 nt = long 0 414 if ne get arrpc 3 jsnone 415 nf = js_sget src js_off tape get arrpc 3 file 416 end 417 if ne get arrpc 4 jsnone 418 nb = js_sget src js_off tape get arrpc 4 body 419 end 420 if ne get arrpc 5 jsnone 421 nt = js_sget src js_off tape get arrpc 5 token 422 end 423 if or lt nf 0 or lt nb 0 lt nt 0 424 arerror src tape ob -32602 arepar 425 ret 426 end 427 put amreq 0 ulong nf 428 put amreq 1 ulong nb 429 put amreq 2 ulong nt 430 z = js_winit domain 431 if lt z 0 432 arerror src tape ob -32603 areinter 433 ret 434 end 435 am_call get arrpc 2 file body token domain 436 ardomain src tape ob domain dt 437 end 438 fn artoolcall src view uchar 524288 tape view uint 65536 ob edit uchar 787472 to void 439 p = get arrpc 1 440 if ne js_nkids tape p 2 441 arerror src tape ob -32602 arepar 442 ret 443 end 444 n = armem src tape p arn 445 a = armem src tape p ara 446 if ne js_type tape n jsstr 447 arerror src tape ob -32602 arepar 448 ret 449 end 450 op = artoolop src js_off tape n 451 if eq op jsnone 452 arerror src tape ob -32602 arepar 453 ret 454 end 455 if not arargs src tape a op 456 arerror src tape ob -32602 arepar 457 ret 458 end 459 put arrpc 2 op 460 arinvoke src tape ob 461 end 462 fn arhandle src view uchar 524288 tape edit uint 65536 ob edit uchar 787472 n ulong to void 463 put arrpc 0 jsnone 464 r = js_parse src tape n 465 if lt r 0 466 arerror src tape ob -32700 areparse 467 ret 468 end 469 v = armem src tape 0 arj 470 m = armem src tape 0 arm 471 id = armem src tape 0 arid 472 valid = eq js_type tape 0 jsobj 473 if ne js_type tape v jsstr 474 valid = false 475 else 476 if not js_streq src js_off tape v arver 477 valid = false 478 end 479 end 480 if ne js_type tape m jsstr 481 valid = false 482 end 483 if ne id jsnone 484 ty = js_type tape id 485 if eq ty jsstr 486 put arrpc 0 id 487 else 488 if eq ty jsnum 489 if ne js_ilex src js_off tape id 0 490 put arrpc 0 id 491 else 492 valid = false 493 end 494 else 495 valid = false 496 end 497 end 498 end 499 note Duplicate envelope fields are ambiguous and cannot execute. 500 if valid 501 k = js_first tape 0 502 seen = ulong 0 503 while ne k jsnone bound 999999 504 bit = ulong 0 505 if js_streq src js_off tape k arj 506 bit = 1 507 end 508 if js_streq src js_off tape k arm 509 bit = 2 510 end 511 if js_streq src js_off tape k arid 512 bit = 4 513 end 514 if js_streq src js_off tape k arp 515 bit = 8 516 end 517 if ne and seen bit 0 518 valid = false 519 end 520 seen = or seen bit 521 k = js_mnext tape k 522 end 523 end 524 if not valid 525 arerror src tape ob -32600 areinv 526 ret 527 end 528 note Valid notifications have neither response nor storage effects. 529 if eq id jsnone 530 ret 531 end 532 p = armem src tape 0 arp 533 put arrpc 1 p 534 if ne p jsnone 535 if ne js_type tape p jsobj 536 arerror src tape ob -32602 arepar 537 ret 538 end 539 end 540 if js_streq src js_off tape m arinit 541 arinitialize src tape ob 542 ret 543 end 544 if js_streq src js_off tape m arcall 545 artoolcall src tape ob 546 ret 547 end 548 if js_streq src js_off tape m arping 549 arbegin src tape ob 550 arwt ob arres 551 js_wobj ob 552 js_wobje ob 553 arsend ob 554 ret 555 end 556 if js_streq src js_off tape m arlist 557 arbegin src tape ob 558 arwt ob arres 559 js_wobj ob 560 arwt ob artools 561 js_warr ob 562 for op ulong 6 563 arschemawrite ob op 564 end 565 js_warre ob 566 js_wobje ob 567 arsend ob 568 ret 569 end 570 arerror src tape ob -32601 aremeth 571 end 572 fn arframe src view uchar 524288 tape edit uint 65536 ob edit uchar 787472 to void 573 if ne get arrpc 7 0 574 put arrpc 0 jsnone 575 arerror src tape ob -32700 areparse 576 else 577 arhandle src tape ob get arrpc 6 578 end 579 put arrpc 6 0 580 put arrpc 7 0 581 end 582 fn arfeed src edit uchar 524288 tape edit uint 65536 ob edit uchar 787472 chunk view uchar 4096 n ulong to void 583 for i ulong n 584 c = get chunk i 585 if eq c 10 586 arframe src tape ob 587 else 588 if eq get arrpc 7 0 589 p = get arrpc 6 590 if ge p len src 591 put arrpc 7 1 592 else 593 put src p c 594 put arrpc 6 add p 1 595 end 596 end 597 end 598 end 599 end 600 fn main to int 601 src = new uchar 524288 0 602 tape = new uint 65536 0 603 ob = new uchar 787472 0 604 chunk = new uchar 4096 0 605 b = am_boot 606 if ne b 0 607 ret b 608 end 609 z = js_init tape 524288 64 610 if lt z 0 611 ret 4 612 end 613 note Each read consumes bytes or EOF; nested bounded epochs permit a long-lived stdio connection. 614 for epoch ulong 999999 615 for tick ulong 999999 616 r = read 0 chunk 0 len chunk 617 if eq r -4 618 continue 619 end 620 if lt r 0 621 ret 7 622 end 623 if eq r 0 624 if or ne get arrpc 6 0 ne get arrpc 7 0 625 arframe src tape ob 626 end 627 ret 0 628 end 629 arfeed src tape ob chunk ulong r 630 end 631 end 632 ret 0 633 end