Skip to content

agent CLI: accept tcp:// / rfc2217:// / socket:// (route via platform factory)#87

Merged
widgetii merged 1 commit into
masterfrom
agent-cli-platform-transport
May 11, 2026
Merged

agent CLI: accept tcp:// / rfc2217:// / socket:// (route via platform factory)#87
widgetii merged 1 commit into
masterfrom
agent-cli-platform-transport

Conversation

@widgetii
Copy link
Copy Markdown
Member

Summary

The six defib agent ... commands hardcoded SerialTransport.create(port), so -p tcp://<host>:<port> errored with "No such file or directory: 'tcp://...'", even though the underlying COBS protocol works fine over SocketTransport (now that #86 fixed the multi-packet recv-loss).

Drop-in switch to create_transport(normalize_port_name(port)) — the same factory burn / install / restore already use. Help strings on every command updated to mention the supported URL schemes globally.

Affected: agent upload, agent flash, agent info, agent read, agent write, agent scan.

Verification on rack pod at 10.216.128.69

$ defib agent info -p tcp://10.216.128.69:9000
  JEDEC ID:    ef4018
  Flash size:  16384 KB
  RAM base:    0x40000000
  Sector size: 64 KB
  Agent ver:   2
  Capabilities: flash_stream, sector_bitmap, page_skip, set_baud, reboot,
                selfupdate, scan
$ defib agent read -p tcp://10.216.128.69:9000 -a 0x14050000 -s 256 -o uimage_dump.bin
  256/256 (100%)
  256 bytes in 0.0s
  CRC32: OK
$ xxd uimage_dump.bin | head -2
  00000000: 2705 1956 e28a ab68 ...  '..V...hj...
  00000020: 4c69 6e75 782d 342e ...  Linux-4.9.37-hi3516ev300
$ defib agent scan -p tcp://10.216.128.69:9000
  Scanned: 256/256  (29.6 s)
  Good:          256
  Flash is healthy!

The scan command in particular is a stress test of the multi-packet bridge path — every sector returns its own RSP_SCAN packet plus the final RSP_ACK. Streams cleanly thanks to #86's leftover-buffer fix.

Test plan

  • uv run pytest tests/ -x -v --ignore=tests/fuzz — 457 passed / 2 skipped
  • uv run ruff check src/defib/cli/app.py
  • uv run mypy src/defib/cli/app.py --ignore-missing-imports
  • Regression: confirm the same 6 commands still work against a local /dev/ttyUSB* (they go through the same create_transport factory, so should be unchanged).

🤖 Generated with Claude Code

… factory)

The six `defib agent ...` commands hardcoded `SerialTransport.create(port)`,
so `-p tcp://<host>:<port>` returned "No such file or directory: 'tcp:...'"
even though the underlying agent protocol works fine over `SocketTransport`
(now that PR #86 fixed the multi-packet recv-loss on async transports).

Drop-in switch to `create_transport(normalize_port_name(port))` — the same
factory the burn / install / restore commands already use. Help strings
updated to mention the supported URL schemes globally.

Affected: `agent upload`, `agent flash`, `agent info`, `agent read`,
`agent write`, `agent scan`.

Verified end-to-end against rack pod at 10.216.128.69:

    defib agent info  -p tcp://10.216.128.69:9000
      JEDEC ID: ef4018, Flash: 16384 KB, caps: flash_stream, sector_bitmap,
      page_skip, set_baud, reboot, selfupdate, scan

    defib agent read  -p tcp://10.216.128.69:9000 -a 0x14050000 -s 256
      256/256 bytes, CRC32 OK on device — uImage header visible

    defib agent scan  -p tcp://10.216.128.69:9000
      256/256 sectors scanned in 29.6 s — "Flash is healthy!"

Suite: 457 passed / 2 skipped; ruff + mypy clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 004c09d into master May 11, 2026
13 checks passed
@widgetii widgetii deleted the agent-cli-platform-transport branch May 11, 2026 18:54
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.

1 participant