Skip to content

Add Machine.set_memory_broadcast() for the unicast memory-snapshot stream - #13

Merged
mullinmax merged 2 commits into
mainfrom
claude/memory-broadcast-toggle
Jul 16, 2026
Merged

Add Machine.set_memory_broadcast() for the unicast memory-snapshot stream#13
mullinmax merged 2 commits into
mainfrom
claude/memory-broadcast-toggle

Conversation

@mullinmax

@mullinmax mullinmax commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Machine.set_memory_broadcast(enabled, frequency_ms=100, ip=None) wrapper for the firmware's authenticated /api/memory/toggle-broadcast route, so clients can turn the live SRAM UDP stream (port 2040, 4-byte offset header + up to 256 data bytes per packet) on and off without reaching for Machine.call().

  • Matches the firmware's unicast behavior from vector#369: the stream goes to one target IP, never broadcast to the network. ip picks the target explicitly; when omitted, the firmware streams back to the requester — usually exactly right, since the listener typically runs where the code runs. Over USB there is no requester IP, so ip must be passed.
  • Enabling sends {"enable": true, "frequency_ms": N} (+ "ip" when given) with frequency_ms clamped to the firmware's 10–60000 ms bounds; disabling sends {"enable": false}.
  • Goes through _call_gated so a missing route on old firmware raises UnsupportedFirmwareError with the firmware version named.
  • Documented in docs/memory.md (new "Live snapshot streaming" section) and covered by the wrapper-route table plus a body/clamping/ip test.

Motivation: memory-mapper#31 needs to start the stream on machines the user selects; this gives it (and anyone else) a proper API instead of a raw route call.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xy1GfVJXuAkgZTMwUDDRTb

Wrap the firmware's authenticated /api/memory/toggle-broadcast route so
clients (like Memory Mapper) can turn the live SRAM broadcast on and off
without reaching for Machine.call(). Enabling takes a frequency_ms
clamped to the firmware's 10-60000 ms bounds; disabling sends
{"enable": false}. Documented in docs/memory.md and covered by the
wrapper-route table plus a body/clamping test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xy1GfVJXuAkgZTMwUDDRTb
@github-actions

Copy link
Copy Markdown

Coverage report

Total coverage: 100.00% (0.00% vs base 100.00%)

The firmware no longer broadcasts memory snapshots to the whole network
(vector#369); it streams to a single target IP, defaulting to the
requesting client. Add the optional ip= parameter to
set_memory_broadcast() and update the docs to describe the unicast
behavior, including the USB caveat where ip must be passed explicitly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xy1GfVJXuAkgZTMwUDDRTb
@mullinmax mullinmax changed the title Add Machine.set_memory_broadcast() for the memory-snapshot UDP stream Add Machine.set_memory_broadcast() for the unicast memory-snapshot stream Jul 16, 2026
@mullinmax
mullinmax marked this pull request as ready for review July 16, 2026 18:43
@mullinmax
mullinmax merged commit 02d7f7e into main Jul 16, 2026
9 checks passed
@mullinmax
mullinmax deleted the claude/memory-broadcast-toggle branch July 16, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants