feat(agent): add raw control sender - #789
GregHolmes wants to merge 1 commit into
Conversation
|
dg-coreylweathers
left a comment
There was a problem hiding this comment.
Verdict: approve with nits.
What this PR does
Adds public send_raw(message: Dict | str) on the sync and async Voice Agent socket clients so protocol-transparent bridges can forward any control frame without calling the private _send() (issue #785). Dicts are JSON-serialized; strings are sent byte-for-byte.
What I checked
- Does it send unchanged? Yes:
_senddoesjson.dumpsfor dicts and passes strings straight towebsocket.send; the four new tests capture exactly that, including that44100.0is not converted to an int. - Is the patch protected from regen? Yes:
agent/v1/socket_client.pywas already frozen; the PR adds the ledger bullet. - Gates in Docker: mypy clean, ruff clean on changed files, pytest 1038 passed.
Should-fix
send_rawappears only in the socket client, its tests,.fernignore, andAGENTS.md. Add asend_raw(message)line to the agent.v1 section ofreference.mdand a one-line mention in a voice-agent example or the skill file, otherwise bridge authors keep using_send().- State the number contract in the docstring: "Values are sent as given; whole-number floats are not converted to integers, so pass ints where the API expects them." That is what the tests pin and how it differs from the typed senders.
Nits: the Union[Dict, str] annotation is narrower than _send accepts (bytes also work), fine as the public contract. Needs a rebase: AGENTS.md/.fernignore conflict with main now, and after #797 lands agent/v1/socket_client.py is regenerated, so re-apply the two methods there.
Summary
send_raw()methods for protocol-transparent Agent control-frame bridges.Closes #785
Validation