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": "277",
  "prompt": "A fetch that refuses to give up: try the GET up to 5 times. Phase machine in a state slot: FIRE issues a fresh get() and bumps the attempt counter, IN FLIGHT polls ready(), any failure (get returning -1 or ready going negative) parks in a 180-frame retry wait with a draining bar, and success shows GOT IT plus the status code. After the fifth failure it stays GAVE UP. Locals die every frame - the whole machine lives in state slots.",
  "solution_rl": "fn frame(t: i32) {\n    host::display::clear(0x0d0f12);\n    let mut phase: i32 = host::display::state_get(0);\n    if phase == 0 {\n        if host::display::state_get(2) >= 5 {\n            host::display::state_set(0, 4);\n        } else {\n            host::display::state_set(2, host::display::state_get(2) + 1);\n            let h: i32 = host::http::get(\"https://example.com/\", 20);\n            host::display::state_set(1, h);\n            if h < 0 {\n                host::display::state_set(0, 3);\n                host::display::state_set(3, 180);\n            } else {\n                host::display::state_set(0, 1);\n            }\n        }\n        phase = host::display::state_get(0);\n    }\n    if phase == 1 {\n        let h2: i32 = host::display::state_get(1);\n        let r: i32 = host::http::ready(h2);\n        if r == 1 {\n            host::display::state_set(0, 2);\n        } else if r < 0 {\n            host::display::state_set(0, 3);\n            host::display::state_set(3, 180);\n        }\n        phase = host::display::state_get(0);\n    }\n    if phase == 3 {\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(0, 0);\n        }\n    }\n    host::display::draw_string(120, 50, \"STUBBORN FETCH\", 0xffffff, 2);\n    host::display::draw_string(120, 100, \"ATTEMPT\", 0x888888, 1);\n    host::display::draw_number(190, 98, host::display::state_get(2), 0xffffff, 1);\n    host::display::draw_string(214, 100, \"OF 5\", 0x888888, 1);\n    if phase == 1 {\n        host::display::draw_string(120, 200, \"IN FLIGHT\", 0xaa7700, 2);\n    } else if phase == 2 {\n        let h3: i32 = host::display::state_get(1);\n        host::display::draw_string(120, 200, \"GOT IT\", 0x22bb44, 3);\n        host::display::draw_string(120, 260, \"STATUS\", 0x888888, 1);\n        host::display::draw_number(180, 258, host::http::status(h3), 0x66ddff, 1);\n    } else if phase == 3 {\n        host::display::draw_string(120, 200, \"FAILED - RETRYING\", 0xbb5533, 2);\n        let wait2: i32 = host::display::state_get(3);\n        host::display::fill_rect(120, 250, wait2, 10, 0xaa7700);\n    } else if phase == 4 {\n        host::display::draw_string(120, 200, \"GAVE UP\", 0xbb2222, 3);\n        host::display::draw_string(120, 260, \"5 ATTEMPTS BURNED\", 0x777777, 1);\n    }\n    host::display::present();\n}\n",
  "tags": [
    "http",
    "retry",
    "state-machine"
  ]
}