feat: wire server side of agent JSON text-frame protocol #3
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/agent-comms-protocol"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
agent.rs::dispatch_text now parses agent text frames and forwards to user sessions instead of just logging. Routes targeted (
useridfield set by user_session on outbound msg) or fans out by mesh visibility (any user holding alinksentry 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-3614order). 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