mailhand
mailhand: agents look after a person's email in seeded Omega. Maildir + MIME parsing, JSONL CLI and MCP, rule triage, policy-gated sending, hash-chained audit. Free (Apache-2.0).
Brought by drakestapleton
mailhand / tests / fixtures / mcp / fixture.om
| 1 | note Fixture expansion only: literals below are hand-specified independent expectations, not a JSON |
| 2 | note parser or a call to the implementation. 2097152 x bytes = requested 2 MiB; depth 70000 crosses |
| 3 | note the server's stack cache. Fixed repetition lengths describe these test data, not accepted input. |
| 4 | text mcf_big_i "{\"jsonrpc\":\"2.0\",\"id\":25,\"method\":\"tools/call\",\"params\":{\"name\":\"search\",\"arguments\":{\"query\":\"" |
| 5 | text mcf_big_it "\"}}}\n" |
| 6 | text mcf_big_e "{\"jsonrpc\":\"2.0\",\"id\":25,\"result\":{\"content\":[{\"type\":\"text\",\"text\":\"{\\\"op\\\":\\\"search\\\",\\\"args\\\":[{\\\"key\\\":\\\"query\\\",\\\"value\\\":\\\"" |
| 7 | text mcf_big_et "\\\",\\\"bytes\\\":2097152}]}\\n\"}],\"isError\":false,\"structuredContent\":{\"exit_code\":0}}}\n" |
| 8 | text mcf_deep "{\"jsonrpc\":\"2.0\",\"id\":26,\"method\":\"ping\",\"extra\":" |
| 9 | text mcf_de "{\"jsonrpc\":\"2.0\",\"id\":26,\"result\":{}}\n" |
| 10 | text mcf_bad "{\"jsonrpc\":\"2.0\",\"id\":null,\"error\":{\"code\":-32700,\"message\":\"Parse error: the line is not one RFC 8259 JSON value\"}}\n" |
| 11 | text mcf_tools "tests/fixtures/mcp/tools.expected" |
| 12 | text mcf_marker "@TOOLS@\n" |
| 13 | text mcf_li "large-in" |
| 14 | text mcf_le "large-expected" |
| 15 | text mcf_di "deep-in" |
| 16 | text mcf_db "deep-bad-in" |
| 17 | text mcf_dx "deep-expected" |
| 18 | text mcf_bx "bad-expected" |
| 19 | text mcf_expand "expand" |
| 20 | text mcf_mut "mutate" |
| 21 | fn mcf_repeat c uchar n ulong to void |
| 22 | for i ulong n bound 9223372036854775807 |
| 23 | o_b c |
| 24 | end |
| 25 | end |
| 26 | fn mcf_deepout bad bool to void |
| 27 | o_raw mcf_deep |
| 28 | mcf_repeat 91 70000 |
| 29 | o_b 48 |
| 30 | if bad |
| 31 | mcf_repeat 93 69999 |
| 32 | else |
| 33 | mcf_repeat 93 70000 |
| 34 | end |
| 35 | o_b 125 |
| 36 | o_b 10 |
| 37 | end |
| 38 | fn mcf_template to int |
| 39 | r = s_fdin S_MCP 0 |
| 40 | if lt r 0 |
| 41 | ret 6 |
| 42 | end |
| 43 | p_reset |
| 44 | p_t mcf_tools |
| 45 | r = s_file S_TMP |
| 46 | if lt r 0 |
| 47 | ret 6 |
| 48 | end |
| 49 | p = ulong 0 |
| 50 | while lt p s_len S_MCP bound 9223372036854775807 |
| 51 | if s_eqt S_MCP p len mcf_marker mcf_marker |
| 52 | for i ulong s_len S_TMP bound 9223372036854775807 |
| 53 | o_b s_get S_TMP i |
| 54 | end |
| 55 | p = add p len mcf_marker |
| 56 | else |
| 57 | o_b s_get S_MCP p |
| 58 | p = add p 1 |
| 59 | end |
| 60 | end |
| 61 | ret 0 |
| 62 | end |
| 63 | fn main to int |
| 64 | a = new uchar 64 0 |
| 65 | n = argread 1 a 0 64 |
| 66 | if lt n 0 |
| 67 | ret 1 |
| 68 | end |
| 69 | s_reset S_REQ |
| 70 | z = q_addkv kpos a ulong n |
| 71 | rc = int 0 |
| 72 | if q_is kpos mcf_li |
| 73 | o_raw mcf_big_i |
| 74 | mcf_repeat 120 2097152 |
| 75 | o_raw mcf_big_it |
| 76 | end |
| 77 | if q_is kpos mcf_le |
| 78 | o_raw mcf_big_e |
| 79 | mcf_repeat 120 2097152 |
| 80 | o_raw mcf_big_et |
| 81 | end |
| 82 | if q_is kpos mcf_di |
| 83 | mcf_deepout false |
| 84 | end |
| 85 | if q_is kpos mcf_db |
| 86 | mcf_deepout true |
| 87 | end |
| 88 | if q_is kpos mcf_dx |
| 89 | o_raw mcf_de |
| 90 | end |
| 91 | if q_is kpos mcf_bx |
| 92 | o_raw mcf_bad |
| 93 | end |
| 94 | if q_is kpos mcf_expand |
| 95 | rc = mcf_template |
| 96 | end |
| 97 | if q_is kpos mcf_mut |
| 98 | r = s_fdin S_MCP 0 |
| 99 | if lt r 0 |
| 100 | ret 6 |
| 101 | end |
| 102 | o_b 33 |
| 103 | for i ulong sub s_len S_MCP 1 bound 9223372036854775807 |
| 104 | o_b s_get S_MCP add i 1 |
| 105 | end |
| 106 | end |
| 107 | o_flush |
| 108 | ret rc |
| 109 | end |