feat: agent JSON text-frame dispatch and msg/* handlers #3

Merged
David merged 1 commit from feat/agent-msg-dispatch into main 2026-05-05 02:23:53 +02:00
Owner

net.rs::idle_loop now wires Message::Text(t) into the dispatcher's route_json instead of just logging the byte length. JSON-shaped outbox frames (begin with {) go out as Message::Text via a new send_text helper so the server's user-session forwarder picks them up; opaque payloads keep their existing Message::Binary framing.

dispatch.rs::route_json adds an "msg" arm that defers to crate::host::msg::handle for the legacy MeshCentral SPA {action:"msg", type:<sub>} envelope.

New host/msg.rs implements handlers for the SPA's DeskTools / Information panels:

  • console: text-command shell (help, info, version, osinfo, cpuinfo, uptime/sysinfo, processes/ps, services, users, volumes/disks, netinfo/ifaces, kill )
  • ps: pid-keyed object {cmd, user}
  • services: name-keyed systemd snapshot
  • psinfo: per-pid detail for the process-details dialog
  • sysinfo: hardware/network/drives/cpu/load bundle
  • userSessions: utmp -> session-list shape (State, StationName, SessionId, Username, ...) for the Desktop session selector
  • smbios: /sys/class/dmi/id/* DMI fields for the Information panel

serialize_reply echoes nodeid/userid/username/sessionid/tag/pid/requestid back so the server-side router can deliver the reply to the originating control session.

8 unit tests cover console help / unknown-command fallback, ps / psinfo / sysinfo / userSessions / smbios reply shapes, and the unknown-msg-type drop path.

Dev-env: port bump to 4302 (matches server dev port), justfile recipe simplification, meshagent.msh template re-render.

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

net.rs::idle_loop now wires Message::Text(t) into the dispatcher's route_json instead of just logging the byte length. JSON-shaped outbox frames (begin with `{`) go out as Message::Text via a new send_text helper so the server's user-session forwarder picks them up; opaque payloads keep their existing Message::Binary framing. dispatch.rs::route_json adds an "msg" arm that defers to crate::host::msg::handle for the legacy MeshCentral SPA `{action:"msg", type:<sub>}` envelope. New host/msg.rs implements handlers for the SPA's DeskTools / Information panels: - console: text-command shell (help, info, version, osinfo, cpuinfo, uptime/sysinfo, processes/ps, services, users, volumes/disks, netinfo/ifaces, kill <pid>) - ps: pid-keyed object {cmd, user} - services: name-keyed systemd snapshot - psinfo: per-pid detail for the process-details dialog - sysinfo: hardware/network/drives/cpu/load bundle - userSessions: utmp -> session-list shape (State, StationName, SessionId, Username, ...) for the Desktop session selector - smbios: /sys/class/dmi/id/* DMI fields for the Information panel serialize_reply echoes nodeid/userid/username/sessionid/tag/pid/requestid back so the server-side router can deliver the reply to the originating control session. 8 unit tests cover console help / unknown-command fallback, ps / psinfo / sysinfo / userSessions / smbios reply shapes, and the unknown-msg-type drop path. Dev-env: port bump to 4302 (matches server dev port), justfile recipe simplification, meshagent.msh template re-render. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat: agent JSON text-frame dispatch and msg/* handlers
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 2s
b5f432cac5
net.rs::idle_loop now wires Message::Text(t) into the dispatcher's route_json instead of just logging the byte length. JSON-shaped outbox frames (begin with `{`) go out as Message::Text via a new send_text helper so the server's user-session forwarder picks them up; opaque payloads keep their existing Message::Binary framing.

dispatch.rs::route_json adds an "msg" arm that defers to crate::host::msg::handle for the legacy MeshCentral SPA `{action:"msg", type:<sub>}` envelope.

New host/msg.rs implements handlers for the SPA's DeskTools / Information panels:
- console: text-command shell (help, info, version, osinfo, cpuinfo, uptime/sysinfo, processes/ps, services, users, volumes/disks, netinfo/ifaces, kill <pid>)
- ps: pid-keyed object {cmd, user}
- services: name-keyed systemd snapshot
- psinfo: per-pid detail for the process-details dialog
- sysinfo: hardware/network/drives/cpu/load bundle
- userSessions: utmp -> session-list shape (State, StationName, SessionId, Username, ...) for the Desktop session selector
- smbios: /sys/class/dmi/id/* DMI fields for the Information panel

serialize_reply echoes nodeid/userid/username/sessionid/tag/pid/requestid back so the server-side router can deliver the reply to the originating control session.

8 unit tests cover console help / unknown-command fallback, ps / psinfo / sysinfo / userSessions / smbios reply shapes, and the unknown-msg-type drop path.

Dev-env: port bump to 4302 (matches server dev port), justfile recipe simplification, meshagent.msh template re-render.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
David merged commit 077ba259f3 into main 2026-05-05 02:23:53 +02:00
David deleted branch feat/agent-msg-dispatch 2026-05-05 02:23:53 +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-agent!3
No description provided.