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": "240",
  "prompt": "A three-body ballet: three colored bodies all attract each other with a toy linear force (each velocity gains (other - self)/512 per partner per frame - honest caveat: real 1/r^2 gravity needs sqrt, which rustlite lacks). Read all positions into local arrays first so every body sees the same snapshot, update velocities then positions, bounce softly off the walls, and connect the trio with dim lines so the shifting triangle is visible. Give the starting velocities a zero sum so the ensemble never drifts away.",
  "solution_rl": "fn frame(t: i32) {\n    let w: i32 = host::display::width();\n    let h: i32 = host::display::height();\n    let cx: i32 = w / 2;\n    let cy: i32 = h / 2;\n    if host::display::state_get(0) == 0 {\n        host::display::state_set(0, 1);\n        host::display::state_set(8, (cx - 120) * 16);\n        host::display::state_set(9, (cy - 60) * 16);\n        host::display::state_set(10, 30);\n        host::display::state_set(11, 10);\n        host::display::state_set(12, (cx + 130) * 16);\n        host::display::state_set(13, (cy - 40) * 16);\n        host::display::state_set(14, -20);\n        host::display::state_set(15, 25);\n        host::display::state_set(16, (cx - 10) * 16);\n        host::display::state_set(17, (cy + 110) * 16);\n        host::display::state_set(18, -10);\n        host::display::state_set(19, -35);\n    }\n    let mut x = [0; 3];\n    let mut y = [0; 3];\n    let mut vx = [0; 3];\n    let mut vy = [0; 3];\n    let mut i: i32 = 0;\n    while i < 3 {\n        x[i] = host::display::state_get(8 + i * 4);\n        y[i] = host::display::state_get(9 + i * 4);\n        vx[i] = host::display::state_get(10 + i * 4);\n        vy[i] = host::display::state_get(11 + i * 4);\n        i = i + 1;\n    }\n    i = 0;\n    while i < 3 {\n        let mut j: i32 = 0;\n        while j < 3 {\n            if j != i {\n                vx[i] = vx[i] + (x[j] - x[i]) / 512;\n                vy[i] = vy[i] + (y[j] - y[i]) / 512;\n            }\n            j = j + 1;\n        }\n        i = i + 1;\n    }\n    i = 0;\n    while i < 3 {\n        x[i] = x[i] + vx[i];\n        y[i] = y[i] + vy[i];\n        if x[i] < 128 { x[i] = 128; vx[i] = -vx[i]; }\n        if x[i] > (w - 8) * 16 { x[i] = (w - 8) * 16; vx[i] = -vx[i]; }\n        if y[i] < 128 { y[i] = 128; vy[i] = -vy[i]; }\n        if y[i] > (h - 8) * 16 { y[i] = (h - 8) * 16; vy[i] = -vy[i]; }\n        host::display::state_set(8 + i * 4, x[i]);\n        host::display::state_set(9 + i * 4, y[i]);\n        host::display::state_set(10 + i * 4, vx[i]);\n        host::display::state_set(11 + i * 4, vy[i]);\n        i = i + 1;\n    }\n    host::display::clear(0x060608);\n    host::display::draw_line(x[0] / 16, y[0] / 16, x[1] / 16, y[1] / 16, 0x283038);\n    host::display::draw_line(x[1] / 16, y[1] / 16, x[2] / 16, y[2] / 16, 0x283038);\n    host::display::draw_line(x[2] / 16, y[2] / 16, x[0] / 16, y[0] / 16, 0x283038);\n    let pal: [i32; 3] = [0xff7060, 0x70ff90, 0x70a0ff];\n    i = 0;\n    while i < 3 {\n        host::display::fill_rect(x[i] / 16 - 6, y[i] / 16 - 6, 12, 12, pal[i]);\n        i = i + 1;\n    }\n    host::display::present();\n}\n",
  "tags": [
    "simulation",
    "n-body",
    "state",
    "arrays"
  ]
}