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
{
  "id": "083",
  "prompt": "Build a two-thumb range slider (MIN and MAX on one track). On the press edge grab whichever thumb is nearer to the pointer, drag it while held, and never let MIN pass MAX. Persist both values plus the grabbed-thumb id in state slots (rustlite has no globals), seed them to 20 and 80 with a one-time init latch, and draw the highlighted span between the thumbs with both numbers labeled.",
  "solution_rl": "fn frame(t: i32) {\n    let w: i32 = host::display::width();\n    let tx: i32 = 30;\n    let tw: i32 = w - 60;\n    let ty: i32 = 130;\n    if host::display::state_get(5) == 0 {\n        host::display::state_set(5, 1);\n        host::display::state_set(0, 20);\n        host::display::state_set(1, 80);\n    }\n    let mut lo: i32 = host::display::state_get(0);\n    let mut hi: i32 = host::display::state_get(1);\n    let down: i32 = host::display::pointer_down();\n    let prev: i32 = host::display::state_get(3);\n    let px: i32 = host::display::pointer_x();\n    let mut grab: i32 = host::display::state_get(2);\n    let mut rel: i32 = (px - tx) * 100 / tw;\n    if rel < 0 { rel = 0; }\n    if rel > 100 { rel = 100; }\n    if down == 1 && prev == 0 {\n        let dl: i32 = if rel > lo { rel - lo } else { lo - rel };\n        let dh: i32 = if rel > hi { rel - hi } else { hi - rel };\n        grab = if dl <= dh { 1 } else { 2 };\n        host::display::state_set(2, grab);\n    }\n    if down == 0 {\n        grab = 0;\n        host::display::state_set(2, 0);\n    }\n    if grab == 1 {\n        lo = rel;\n        if lo > hi { lo = hi; }\n        host::display::state_set(0, lo);\n    }\n    if grab == 2 {\n        hi = rel;\n        if hi < lo { hi = lo; }\n        host::display::state_set(1, hi);\n    }\n    host::display::state_set(3, down);\n    host::display::clear(0x101010);\n    host::display::fill_rect(tx, ty, tw, 4, 0x404040);\n    let lx: i32 = tx + lo * tw / 100;\n    let hx: i32 = tx + hi * tw / 100;\n    host::display::fill_rect(lx, ty, hx - lx, 4, 0x00c8ff);\n    host::display::fill_rect(lx - 5, ty - 9, 10, 22, 0xffffff);\n    host::display::fill_rect(hx - 5, ty - 9, 10, 22, 0xffffff);\n    host::display::draw_string(tx, 60, \"MIN\", 0x808080, 1);\n    host::display::draw_number(tx, 74, lo, 0xffffff, 2);\n    host::display::draw_string(tx + 90, 60, \"MAX\", 0x808080, 1);\n    host::display::draw_number(tx + 90, 74, hi, 0xffffff, 2);\n    host::display::present();\n}\n",
  "tags": [
    "ui",
    "pointer",
    "state",
    "slider"
  ]
}