-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Feature description
Users may desire to interact directly with resources. E.g. Aspire dashboard might want to have a terminal emulator that one could attach to a container-based-, or process-based resource and interact directly with it. Or an MCP server with stdio interface might be part of Aspire workload and one would need to access its stdio streams to use it.
Design outline and constraints
- Both Executable and Container resource get a flag that enables "attaching to stdio" (stdin + stdout + stderr). When this flag is present, we capture and memorize standard file descriptors for a given resource as it is started.
Consider if we could enable attaching to
stdiofor all Executables and Containers - Executable and Container API objects get a
stdiosubresource. When that subresource is queried, we create and return paths to 3 Unix domain sockets that are attached to relevant resource file descriptors. We also start a proxy that will push data between these sockets and resource file descriptors.These paths could also be simply status properties of Executable and Container objects.
- Standard output and standard error streams are captured and stored in (raw) temporary files from the moment a resource (with
AttachToStdio == true) is started. They are also forwarded to the log writer so the existing log streams continue to work forAttachToStdio == trueresources. - When a new client connects to stdout or stderr socket, the existing content is replayed to it.
- If more than one client connects to stdin socket, bad things might happen 😄
Additional notes
Related to https://github.com/microsoft/usvc/issues/241
@sebastienros has created a proof-of-concept https://github.com/microsoft/usvc-apiserver/tree/sebros/stdin The details are different from the design outline above, but it illustrates the potential.