Skip to content

adding PSU agent functionality (POC)#1840

Open
Lars Lervik (llervikdevo) wants to merge 1 commit into
masterfrom
psu-devoagent-poc
Open

adding PSU agent functionality (POC)#1840
Lars Lervik (llervikdevo) wants to merge 1 commit into
masterfrom
psu-devoagent-poc

Conversation

@llervikdevo

Copy link
Copy Markdown

POC: Adding ability to Devolutions Agent to connect to PSU over GRPC and start child processes to run PSRP requests from PSU.

@github-actions

Copy link
Copy Markdown

Let maintainers know that an action is required on their side

  • Add the label release-required Please cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module) when you request a maintainer to cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module)

  • Add the label release-blocker Follow-up is required before cutting a new release if a follow-up is required before cutting a new release

  • Add the label publish-required Please publish libraries (`Devolutions.Gateway.Utils`, OpenAPI clients, etc) when you request a maintainer to publish libraries (Devolutions.Gateway.Utils, OpenAPI clients, etc.)

  • Add the label publish-blocker Follow-up is required before publishing libraries if a follow-up is required before publishing libraries

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a POC “PSU gRPC agent” capability to Devolutions Agent: the agent can connect to a PSU gRPC endpoint, register itself/capabilities, and execute PSU-requested work by spawning child processes and streaming stdin/stdout over the gRPC stream.

Changes:

  • Introduces a new psu_grpc_agent task that maintains a gRPC connection to PSU with reconnect/backoff and handles server commands.
  • Implements child-process spawning plus stream multiplexing to forward stdin → process and stdout/stderr → PSU.
  • Adds configuration schema + build-time proto generation + container helpers (Dockerfile/entrypoint + run script).

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
devolutions-agent/src/service.rs Registers the new PSU gRPC agent task when enabled in config.
devolutions-agent/src/psu_grpc_agent/mod.rs Implements the gRPC agent task, registration message, connection loop, and message handling.
devolutions-agent/src/psu_grpc_agent/process.rs Adds process spawning and stream pumping logic between PSU and child processes.
devolutions-agent/src/main.rs Marks new proto/gRPC-related crates as used in the binary crate.
devolutions-agent/src/lib.rs Exposes the new psu_grpc_agent module from the agent library.
devolutions-agent/src/config.rs Adds PsuGrpcAgent configuration DTO + default + deserialization test.
devolutions-agent/proto/psu_agent.proto Defines the POC gRPC protocol (AgentControl bidi stream + messages).
devolutions-agent/Cargo.toml Adds tonic/prost dependencies and build-deps for proto compilation.
devolutions-agent/build.rs Generates Rust code from the PSU agent proto using tonic-build and vendored protoc.
devolutions-agent/Dockerfile.psu-grpc-poc Adds a POC image to build/run the agent alongside PowerShell.
devolutions-agent/docker/psu-grpc-entrypoint.sh Writes a minimal agent config from env vars and starts the agent in the container.
devolutions-agent/Run-PsuGrpcAgentContainer.ps1 Convenience script to build/run the POC container with env configuration.
Cargo.lock Pulls in new dependency graph for tonic/prost/tooling.
.dockerignore Ignores node_modules and .vs in Docker build context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +71 to +75
let server_url = conf
.server_url
.as_ref()
.context("PsuGrpcAgent is enabled but ServerUrl is not configured")?
.to_string();
Comment on lines +42 to +48
if let Some(sender) = sender {
let end_of_stream = stream_data.end_of_stream;
let stream_id = stream_data.stream_id.clone();
if sender.send(stream_data).await.is_ok() && end_of_stream {
self.close_stream(&stream_id).await;
}
}
Comment on lines +195 to +205
let _ = outgoing_tx
.send(agent_message(
&agent_id,
&connection_id,
AgentPayload::StreamClosed(stream_closed(
request.stream_id.clone(),
"child process completed".to_owned(),
false,
)),
))
.await;
Comment on lines +5 to +6
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true \
GIT_SSL_NO_VERIFY=true
Comment on lines +351 to +357
if selector.eq_ignore_ascii_case("pwsh")
|| selector.eq_ignore_ascii_case("pwsh-preview")
|| selector.eq_ignore_ascii_case("pwsh-lts")
|| selector.starts_with("pwsh-")
{
return selector.into();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants