Introduce TUI server mode so ask_user can be intercepted without replacing entire TUI
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza en dotnet/src/Types.cs y Client.cs, especialmente en StartCliServerAsync, el bucle de descubrimiento de puertos y el bucle de captura de stderr. Confirma el indicador de CLI, el enrutamiento TCP para userInput.request y el comportamiento del puerto con el equipo de CLI antes de cambiar el SDK. Se considera completado cuando TuiServerMode está validado, inicia el modo previsto, conserva la salida del terminal y tiene pruebas para el manejo de su opción.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
According to copilot analysis, there's a --ui-server switch in the sources of the SDK that could be used to preserve the full copilot TUI while intercepting events via TCP.
Unknowns to raise with the CLI team
-
CLI flag name — SDK source comments say --ui-server; copilot --help shows --acp. Which flag actually starts "TUI+server" mode? Are they the same thing?
-
ask_user routing — This is the key question. When the CLI is in TUI+server mode AND an SDK client is connected via TCP, does the CLI:
a. Route
userInput.requestto the SDK client (over TCP), letting the SDK handler intercept it? ← what you need
b. Handleask_userin the TUI itself and not send userInput.request to the SDK at all?If it's currently (b), a small CLI-side change would be needed: when an SDK client is connected and has registered a userInput.request handler, prefer routing to the client.
-
Port announcement — When running without --headless, does the CLI still write "Listening on port N" to stdout (now the terminal)? That's fine to leave in — users won't mind seeing
it once on startup — but the SDK approach above bypasses it entirely by requiring an explicit port.
Proposal: Add TuiServerMode to CopilotClientOptions. Launches the CLI with its full terminal UX intact (streaming, colors, tool indicators, etc.) while the SDK connects via TCP to intercept only specific callbacks — specifically OnUserInputRequest — replacing the CLI's own prompt with a custom UX (e.g. a native popup). All stdout/stderr flow through to the user's terminal unchanged.
The SDK diff is ~30 lines. The only thing that may require CLI cooperation is whether userInput.request is already routed to TCP clients in TUI+server mode.
SDK changes needed (dotnet/src/)
- Types.cs — new option on CopilotClientOptions
/// <summary>
/// When true, launches the CLI in TUI+server mode (--ui-server) instead of
/// headless mode. The CLI renders its own terminal UX while the SDK connects
/// via TCP to intercept callbacks such as <see cref="SessionConfig.OnUserInputRequest"/>.
/// Requires <see cref="Port"/> to be set (stdout is not available for port discovery).
/// Mutually exclusive with <see cref="UseStdio"/>.
/// </summary>
public bool TuiServerMode { get; set; }
- Client.cs — StartCliServerAsync, args
- args.AddRange(["--headless", "--no-auto-update", "--log-level", options.LogLevel]);
+ if (options.TuiServerMode)
+ args.Add("--ui-server"); // ← CLI flag name TBD (see unknowns)
+ else
+ args.Add("--headless");
+ args.AddRange(["--no-auto-update", "--log-level", options.LogLevel]);
- Client.cs — StartCliServerAsync, ProcessStartInfo
var startInfo = new ProcessStartInfo
{
...
- RedirectStandardInput = options.UseStdio,
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- CreateNoWindow = true,
+ RedirectStandardInput = options.UseStdio && !options.TuiServerMode,
+ RedirectStandardOutput = !options.TuiServerMode,
+ RedirectStandardError = !options.TuiServerMode,
+ CreateNoWindow = !options.TuiServerMode,
};
- Client.cs — StartCliServerAsync, port discovery
- var detectedLocalhostTcpPort = (int?)null;
- if (!options.UseStdio)
- {
- // reads port announcement from stdout...
- }
+ var detectedLocalhostTcpPort = options.TuiServerMode
+ ? options.Port // must be pre-configured; stdout is the user's terminal
+ : await DetectPortFromStdoutAsync(options, cliProcess, cancellationToken);
(extract the existing port-reading loop into DetectPortFromStdoutAsync)
- Client.cs — validation in constructor
+ if (options.TuiServerMode && options.UseStdio)
+ throw new ArgumentException("TuiServerMode is mutually exclusive with UseStdio");
+ if (options.TuiServerMode && options.Port <= 0)
+ throw new ArgumentException("TuiServerMode requires Port to be set explicitly");
The stderr capture loop (lines ~1247–1265) is also skipped when TuiServerMode — otherwise it would try to read from an unredirected stream.
- Lenguaje dominante
- Java
- Estrellas
- 10.5k
- Forks
- 1.5k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 111
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de github/copilot-sdk
-
agentic-workflows
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
github/copilot-sdk#2782 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
github/copilot-sdk#2781 ·
Los mantenedores suelen responder en 1 día
-
agentic-workflows
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
github/copilot-sdk#2779 ·
Los mantenedores suelen responder en 1 día
-
agentic-workflows
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
github/copilot-sdk#2760 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
github/copilot-sdk#2759 ·
Los mantenedores suelen responder en 1 día
Todos los issues de github/copilot-sdk
Issues similares
-
ScyllaDB Manual: 3 broken linksAbiertolink-check link-check:manual
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
open-telemetry/opentelemetry-java#8870 ·
Los mantenedores suelen responder en 1 día
-
P2 testing
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
enhancement javascript
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
area/core kind/bug status/triage team/core-shared
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día