feat: wire server side of agent JSON text-frame protocol #3

Merged
David merged 1 commit from feat/agent-comms-protocol into main 2026-05-05 01:49:21 +02:00
Owner

agent.rs::dispatch_text now parses agent text frames and forwards to user sessions instead of just logging. Routes targeted (userid field set by user_session on outbound msg) or fans out by mesh visibility (any user holding a links entry on the agent's mesh, plus full site-admins). FORWARDED_AGENT_ACTIONS allow-list covers msg, sysinfo, ps, services, psinfo, terminal_, file_get_, file_put_, ws, tcp*, kvm_*, oobupdate, and the structured route_json reply actions (osinfo, processlist, networkinterfaces, etc).

agent_handshake.rs tolerates AgentCommitDate (cmd 30) and HostInfo (cmd 31) before the agent's AuthRequest (legacy agentcore.c:3604-3614 order). Buffered values surface on AuthenticatedAgent and agent.rs replays them into AgentRegistry post-auth. ServerId stays tolerated as before; AuthConfirm intentionally NOT tolerated pre-auth (would skip the server-auth signature step).

user_session.rs::ControlIn::Msg accepts optional pid/sessionid/tag/requestid pass-through fields. msg_to_agent forwards any present field to the agent so its serialize_reply can echo them back, restoring per-dialog correlation (psinfo needs pid; the others let the SPA route replies to the right control session).

Tests: 4 new dispatch_text cases (userid-targeted, mesh fan-out, allow-list filter, non-JSON drop), 1 new handshake case (pre_auth_agent_commit_date_and_host_info_are_buffered), updated msg_to_agent test to use MsgExtras::default(). All 323 meshcentral-web tests pass.

End-to-end verified via Chrome SPA: console/help, sysinfo, ps, psinfo round-trip server <-> connected agent.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

agent.rs::dispatch_text now parses agent text frames and forwards to user sessions instead of just logging. Routes targeted (`userid` field set by user_session on outbound msg) or fans out by mesh visibility (any user holding a `links` entry on the agent's mesh, plus full site-admins). FORWARDED_AGENT_ACTIONS allow-list covers msg, sysinfo, ps, services, psinfo, terminal_*, file_get_*, file_put_*, ws*, tcp*, kvm_*, oobupdate, and the structured route_json reply actions (osinfo, processlist, networkinterfaces, etc). agent_handshake.rs tolerates AgentCommitDate (cmd 30) and HostInfo (cmd 31) before the agent's AuthRequest (legacy `agentcore.c:3604-3614` order). Buffered values surface on AuthenticatedAgent and agent.rs replays them into AgentRegistry post-auth. ServerId stays tolerated as before; AuthConfirm intentionally NOT tolerated pre-auth (would skip the server-auth signature step). user_session.rs::ControlIn::Msg accepts optional pid/sessionid/tag/requestid pass-through fields. msg_to_agent forwards any present field to the agent so its serialize_reply can echo them back, restoring per-dialog correlation (psinfo needs pid; the others let the SPA route replies to the right control session). Tests: 4 new dispatch_text cases (userid-targeted, mesh fan-out, allow-list filter, non-JSON drop), 1 new handshake case (pre_auth_agent_commit_date_and_host_info_are_buffered), updated msg_to_agent test to use MsgExtras::default(). All 323 meshcentral-web tests pass. End-to-end verified via Chrome SPA: console/help, sysinfo, ps, psinfo round-trip server <-> connected agent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat: wire server side of agent JSON text-frame protocol
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
410905a7cf
agent.rs::dispatch_text now parses agent text frames and forwards to user sessions instead of just logging. Routes targeted (`userid` field set by user_session on outbound msg) or fans out by mesh visibility (any user holding a `links` entry on the agent's mesh, plus full site-admins). FORWARDED_AGENT_ACTIONS allow-list covers msg, sysinfo, ps, services, psinfo, terminal_*, file_get_*, file_put_*, ws*, tcp*, kvm_*, oobupdate, and the structured route_json reply actions (osinfo, processlist, networkinterfaces, etc).

agent_handshake.rs tolerates AgentCommitDate (cmd 30) and HostInfo (cmd 31) before the agent's AuthRequest (legacy `agentcore.c:3604-3614` order). Buffered values surface on AuthenticatedAgent and agent.rs replays them into AgentRegistry post-auth. ServerId stays tolerated as before; AuthConfirm intentionally NOT tolerated pre-auth (would skip the server-auth signature step).

user_session.rs::ControlIn::Msg accepts optional pid/sessionid/tag/requestid pass-through fields. msg_to_agent forwards any present field to the agent so its serialize_reply can echo them back, restoring per-dialog correlation (psinfo needs pid; the others let the SPA route replies to the right control session).

Tests: 4 new dispatch_text cases (userid-targeted, mesh fan-out, allow-list filter, non-JSON drop), 1 new handshake case (pre_auth_agent_commit_date_and_host_info_are_buffered), updated msg_to_agent test to use MsgExtras::default(). All 323 meshcentral-web tests pass.

End-to-end verified via Chrome SPA: console/help, sysinfo, ps, psinfo round-trip server <-> connected agent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
David merged commit 65f24fee97 into main 2026-05-05 01:49:21 +02:00
David deleted branch feat/agent-comms-protocol 2026-05-05 01:49:21 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-server!3
No description provided.