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": "299",
  "prompt": "A piggy-bank app: EARN +5 and SPEND -3 buttons where spending below zero is refused with a warning flash, the balance in big digits, and a bar-chart history of the last 16 balances kept in a 16-slot ring buffer with a head index - every completed transaction writes the NEW balance into the ring. Seed the balance to 50 and prefill the whole ring once behind an init latch so the chart starts flat instead of empty.",
  "solution_rl": "fn frame(t: i32) {\n    host::display::clear(0x0e0f13);\n    if host::display::state_get(4) == 0 {\n        host::display::state_set(4, 1);\n        host::display::state_set(1, 50);\n        let mut i: i32 = 0;\n        while i < 16 {\n            host::display::state_set(20 + i, 50);\n            i = i + 1;\n        }\n    }\n    let bal: 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\n    host::display::draw_string(60, 40, \"PIGGY BANK\", 0xffffff, 2);\n    host::display::draw_number(60, 80, bal, 0x66ddff, 6);\n\n    let head: i32 = host::display::state_get(3);\n    let mut j: i32 = 0;\n    while j < 16 {\n        let v: i32 = host::display::state_get(20 + (head + j) % 16);\n        let mut bh: i32 = v;\n        if bh > 110 {\n            bh = 110;\n        }\n        host::display::fill_rect(60 + j * 25, 280 - bh, 18, bh + 2, 0x3388cc);\n        j = j + 1;\n    }\n    host::display::draw_string(60, 292, \"LAST 16 BALANCES\", 0x556677, 1);\n\n    host::display::fill_rect(60, 330, 160, 70, 0x1a5c2a);\n    host::display::draw_string(94, 352, \"EARN +5\", 0xccffdd, 2);\n    host::display::fill_rect(292, 330, 160, 70, 0x5c1a1a);\n    host::display::draw_string(316, 352, \"SPEND -3\", 0xffcccc, 2);\n\n    let flash: i32 = host::display::state_get(2);\n    if flash > 0 {\n        host::display::draw_string(292, 420, \"NOT ENOUGH SAVED\", 0xbb3333, 1);\n        host::display::state_set(2, flash - 1);\n    }\n\n    if down == 1 && prev == 0 {\n        let px: i32 = host::display::pointer_x();\n        let py: i32 = host::display::pointer_y();\n        if py >= 330 && py < 400 {\n            let mut newbal: i32 = -1;\n            if px >= 60 && px < 220 {\n                newbal = bal + 5;\n            }\n            if px >= 292 && px < 452 {\n                if bal >= 3 {\n                    newbal = bal - 3;\n                } else {\n                    host::display::state_set(2, 30);\n                }\n            }\n            if newbal >= 0 {\n                host::display::state_set(1, newbal);\n                host::display::state_set(20 + head, newbal);\n                host::display::state_set(3, (head + 1) % 16);\n            }\n        }\n    }\n    host::display::present();\n}\n",
  "tags": [
    "app",
    "ring-buffer",
    "chart"
  ]
}