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": "297",
  "prompt": "A two-tab unit converter: C TO F and KM TO MI tabs that each remember THEIR OWN input value in a separate state slot, minus/plus stepper buttons clamped to 0..999, and the converted result huge underneath - Fahrenheit is C*9/5+32 in integer math, and since rustlite has no floats label the distance output MILES X 1000 and compute KM*621. Highlight the active tab; edge-detect all the taps.",
  "solution_rl": "fn frame(t: i32) {\n    host::display::clear(0x0e1013);\n    if host::display::state_get(4) == 0 {\n        host::display::state_set(4, 1);\n        host::display::state_set(2, 20);\n        host::display::state_set(3, 10);\n    }\n    let tab: i32 = host::display::state_get(1);\n    let down: i32 = host::display::pointer_down();\n    let prev: i32 = host::display::state_get(0);\n    host::display::state_set(0, down);\n    let mut click: i32 = 0;\n    if down == 1 && prev == 0 {\n        click = 1;\n    }\n    let px: i32 = host::display::pointer_x();\n    let py: i32 = host::display::pointer_y();\n\n    let mut ca: i32 = 0x1a1e26;\n    let mut cb: i32 = 0x1a1e26;\n    if tab == 0 {\n        ca = 0x2c3442;\n    } else {\n        cb = 0x2c3442;\n    }\n    host::display::fill_rect(40, 40, 200, 50, ca);\n    host::display::draw_string(76, 56, \"C TO F\", 0xffffff, 2);\n    host::display::fill_rect(272, 40, 200, 50, cb);\n    host::display::draw_string(296, 56, \"KM TO MI\", 0xffffff, 2);\n\n    let mut val: i32 = host::display::state_get(2 + tab);\n    host::display::fill_rect(60, 160, 70, 60, 0x232833);\n    host::display::draw_char(84, 178, 45, 0xffffff, 3);\n    host::display::fill_rect(382, 160, 70, 60, 0x232833);\n    host::display::draw_char(406, 178, 43, 0xffffff, 3);\n    host::display::draw_number(210, 172, val, 0xffffff, 5);\n\n    if click == 1 {\n        if py >= 40 && py < 90 {\n            if px >= 40 && px < 240 {\n                host::display::state_set(1, 0);\n            } else if px >= 272 && px < 472 {\n                host::display::state_set(1, 1);\n            }\n        }\n        if py >= 160 && py < 220 {\n            if px >= 60 && px < 130 && val > 0 {\n                val = val - 1;\n                host::display::state_set(2 + tab, val);\n            }\n            if px >= 382 && px < 452 && val < 999 {\n                val = val + 1;\n                host::display::state_set(2 + tab, val);\n            }\n        }\n    }\n\n    host::display::fill_rect(40, 280, 432, 2, 0x2a3038);\n    if tab == 0 {\n        host::display::draw_string(60, 310, \"CELSIUS\", 0x556677, 1);\n        host::display::draw_string(60, 360, \"FAHRENHEIT\", 0x8899aa, 1);\n        host::display::draw_number(210, 340, val * 9 / 5 + 32, 0x66ddff, 6);\n    } else {\n        host::display::draw_string(60, 310, \"KILOMETERS\", 0x556677, 1);\n        host::display::draw_string(60, 360, \"MILES X 1000\", 0x8899aa, 1);\n        host::display::draw_number(210, 340, val * 621, 0x66ddff, 6);\n    }\n    host::display::present();\n}\n",
  "tags": [
    "app",
    "converter",
    "tabs"
  ]
}