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
11
12
{
  "id": "109",
  "prompt": "A checkbox list (ALPHA / BRAVO / CHARLIE / DELTA) with a SELECT ALL master box above it. Item states live as a 4-bit mask in one state slot; an edge-detected click on a row XORs that row bit. The master is tri-state: full inner square when all 4 are checked, a thin dash when only some are, empty when none - clicking it checks everything unless everything is already checked, in which case it clears. Show the checked count OF 4.",
  "solution_rl": "fn frame(t: i32) {\n    let down: i32 = host::display::pointer_down();\n    let prev: i32 = host::display::state_get(1);\n    let px: i32 = host::display::pointer_x();\n    let py: i32 = host::display::pointer_y();\n    let mut mask: i32 = host::display::state_get(0);\n    let mut cnt: i32 = 0;\n    let mut i: i32 = 0;\n    while i < 4 {\n        if ((mask >> i) & 1) == 1 { cnt = cnt + 1; }\n        i = i + 1;\n    }\n    if down == 1 && prev == 0 && px >= 40 && px < 260 {\n        if py >= 40 && py < 66 {\n            if cnt == 4 { mask = 0; } else { mask = 15; }\n        }\n        let mut k: i32 = 0;\n        while k < 4 {\n            let y: i32 = 90 + k * 36;\n            if py >= y && py < y + 26 { mask = mask ^ (1 << k); }\n            k = k + 1;\n        }\n        host::display::state_set(0, mask);\n    }\n    host::display::state_set(1, down);\n    cnt = 0;\n    i = 0;\n    while i < 4 {\n        if ((mask >> i) & 1) == 1 { cnt = cnt + 1; }\n        i = i + 1;\n    }\n    host::display::clear(0x101014);\n    host::display::fill_rect(40, 40, 22, 22, 0x404040);\n    host::display::fill_rect(43, 43, 16, 16, 0x101014);\n    if cnt == 4 { host::display::fill_rect(46, 46, 10, 10, 0x00ff88); }\n    if cnt > 0 && cnt < 4 { host::display::fill_rect(45, 49, 12, 4, 0x808080); }\n    host::display::draw_string(74, 46, \"SELECT ALL\", 0xffffff, 1);\n    i = 0;\n    while i < 4 {\n        let y: i32 = 90 + i * 36;\n        host::display::fill_rect(40, y, 22, 22, 0x404040);\n        host::display::fill_rect(43, y + 3, 16, 16, 0x101014);\n        if ((mask >> i) & 1) == 1 {\n            host::display::fill_rect(46, y + 6, 10, 10, 0x00ff88);\n        }\n        i = i + 1;\n    }\n    host::display::draw_string(74, 96, \"ALPHA\", 0xffffff, 1);\n    host::display::draw_string(74, 132, \"BRAVO\", 0xffffff, 1);\n    host::display::draw_string(74, 168, \"CHARLIE\", 0xffffff, 1);\n    host::display::draw_string(74, 204, \"DELTA\", 0xffffff, 1);\n    host::display::draw_number(40, 250, cnt, 0xffffff, 2);\n    host::display::draw_string(70, 250, \"OF 4\", 0x808080, 2);\n    host::display::present();\n}\n",
  "tags": [
    "ui",
    "pointer",
    "state",
    "bitmask",
    "checkbox"
  ]
}