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-mv/blob/main/protocol/synapse/claims/src/90_main.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / protocol / synapse / claims / src / 90_main.om` 296 lines ยท 4972 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Argument parsing, home / path resolution, dispatch. 3 note av layout: [0, 65536) argument bytes, [65536, 131072) scratch (environment entries, cwd, readlnk). 4 5 text eahome "AIEN_COORD_HOME=" 6 text ehome "HOME=" 7 text sdefh "/.local/state/aien-coord" 8 text sled "/claims.jsonl" 9 text slk "/claims.lock" 10 text skd "/keys" 11 text skey "/keys/ledger.key" 12 text spub "/keys/ledger.pub" 13 text ssig "/synapse-claims-sig" 14 text sself "/proc/self/exe" 15 text mnohome "no home: pass --home or set AIEN_COORD_HOME or HOME" 16 text mopt "unknown option" 17 text mval "option needs a value" 18 text mnow "invalid --now (YYYY-MM-DDTHH:MM:SSZ)" 19 text mpath "path too long" 20 text margs "arguments too long" 21 text mcmd "unknown command" 22 text mextra "unexpected argument" 23 text mself "cannot locate synapse-claims-sig; pass --sig-bin" 24 25 note ======== gpth path builder (append at gx xlp) ======== 26 27 fn pa_b c uchar to void 28 p = get gx xlp 29 if ge p 16384 30 die 64 mpath 31 end 32 put gpth p c 33 put gx xlp add p 1 34 end 35 36 fn pa_t t view uchar * to void 37 for i ulong len t 38 pa_b get t i 39 end 40 end 41 42 fn pa_s s edit uchar * o ulong n ulong to void 43 for i ulong n 44 pa_b get s add o i 45 end 46 end 47 48 note pa_mk: path = home ++ t; offset into slot, length into slot + 1 49 fn pa_mk t view uchar * slot ulong to void 50 st = get gx xlp 51 for i ulong get gx xhomel 52 pa_b get gpth add get gx xhome i 53 end 54 pa_t t 55 put gx slot st 56 put gx add slot 1 sub get gx xlp st 57 end 58 59 note env_pre: av[65536..) starts with t 60 fn env_pre av edit uchar * t view uchar * to bool 61 for j ulong len t 62 if ne get av add 65536 j get t j 63 ret false 64 end 65 end 66 ret true 67 end 68 69 note env_find: environment entry starting with prefix t, copied to av[65536..); length or tbad 70 fn env_find av edit uchar * t view uchar * to ulong 71 for i ulong ulong envcnt 72 n = envread i av 65536 65536 73 if ge n 0 74 k = ulong n 75 if ge k len t 76 if env_pre av t 77 ret k 78 end 79 end 80 end 81 end 82 ret tbad 83 end 84 85 note set_home: --home, else $AIEN_COORD_HOME, else $HOME/.local/state/aien-coord 86 fn set_home av edit uchar * to void 87 put gx xhome get gx xlp 88 if op_has ohome 89 o = get gop ohome 90 n = get gop add ohome 1 91 if eq n 0 92 die 64 mnohome 93 end 94 pa_s av o n 95 put gx xhomel n 96 ret 97 end 98 k = env_find av eahome 99 if and ne k tbad gt k len eahome 100 pa_s av add 65536 len eahome sub k len eahome 101 put gx xhomel sub k len eahome 102 ret 103 end 104 h = env_find av ehome 105 if or eq h tbad le h len ehome 106 die 64 mnohome 107 end 108 pa_s av add 65536 len ehome sub h len ehome 109 pa_t sdefh 110 put gx xhomel sub get gx xlp get gx xhome 111 end 112 113 note set_sig: --sig-bin (made absolute against cwd) or