localharness 0.78.0

Agents that own themselves: one Rust crate that's both an agent SDK (streaming, tools, hooks, policies, triggers, MCP) and a wallet-owning, self-sovereign agent that runs in the browser.
Documentation
1
2
3
4
5
6
7
8
9
10
{
  "id": "272",
  "prompt": "Build a reconnect loop with exponential backoff: when the socket handle is -1 (open refused) or status() reports 3 (closed), close() the dead handle, wait out a backoff timer held in a state slot, then retry the open - doubling the backoff each attempt up to a 480-frame cap. Show the attempt count, the current backoff, a live retry countdown, and a CONNECTED / DIALING / DOWN status line.",
  "solution_rl": "fn frame(t: i32) {\n    host::display::clear(0x0d0d12);\n    if host::display::state_get(0) == 0 {\n        host::display::state_set(0, 1);\n        host::display::state_set(1, -1);\n        host::display::state_set(4, 30);\n    }\n    let mut h: i32 = host::display::state_get(1);\n    let mut s: i32 = -1;\n    if h >= 0 {\n        s = host::net::status(h);\n    }\n    if h < 0 || s == 3 {\n        if s == 3 {\n            host::net::close(h);\n            host::display::state_set(1, -1);\n            h = -1;\n        }\n        let wait: i32 = host::display::state_get(3);\n        if wait > 0 {\n            host::display::state_set(3, wait - 1);\n        } else {\n            host::display::state_set(2, host::display::state_get(2) + 1);\n            host::display::state_set(1, host::net::open(\"wss://relay.example.net/feed\"));\n            let mut back: i32 = host::display::state_get(4) * 2;\n            if back > 480 {\n                back = 480;\n            }\n            host::display::state_set(4, back);\n            host::display::state_set(3, back);\n        }\n    }\n    host::display::draw_string(120, 50, \"RECONNECTOR\", 0xffffff, 2);\n    host::display::draw_string(80, 140, \"ATTEMPTS\", 0x888888, 1);\n    host::display::draw_number(80, 160, host::display::state_get(2), 0xffffff, 3);\n    host::display::draw_string(80, 230, \"BACKOFF FRAMES\", 0x888888, 1);\n    host::display::draw_number(80, 250, host::display::state_get(4), 0xaa7700, 3);\n    host::display::draw_string(80, 320, \"RETRY IN\", 0x888888, 1);\n    let wait2: i32 = host::display::state_get(3);\n    host::display::draw_number(80, 340, wait2, 0x66ddff, 3);\n    if h >= 0 && s == 1 {\n        host::display::draw_string(80, 420, \"CONNECTED\", 0x22bb44, 2);\n    } else if h >= 0 && s == 0 {\n        host::display::draw_string(80, 420, \"DIALING\", 0xaa7700, 2);\n    } else {\n        host::display::draw_string(80, 420, \"DOWN\", 0xbb3333, 2);\n    }\n    host::display::present();\n}\n",
  "tags": [
    "net",
    "reconnect",
    "state-machine"
  ]
}