feat: add ask_user support to sidecar

Implement the Copilot SDK user input round-trip in the backend:
- add user-input-requested and resolve-user-input protocol DTOs
- add a CopilotUserInputCoordinator that mirrors approval flow with
  pending TaskCompletionSource state and explicit resolution
- wire SessionConfig.OnUserInputRequest through CopilotAgentBundle
  and CopilotWorkflowRunner
- extend SidecarProtocolHost to emit user input events, accept
  resolve-user-input commands, and filter ask_user from runtime
  approval tools
- add regression tests for the new coordinator and protocol flow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-26 17:34:49 +01:00
co-authored by Copilot
parent 4c01d8b1a7
commit 2ae4bd01b4
8 changed files with 482 additions and 8 deletions
@@ -177,6 +177,13 @@ public sealed class ResolveApprovalCommandDto : SidecarCommandEnvelope
public string Decision { get; init; } = string.Empty;
}
public sealed class ResolveUserInputCommandDto : SidecarCommandEnvelope
{
public string UserInputId { get; init; } = string.Empty;
public string Answer { get; init; } = string.Empty;
public bool WasFreeform { get; init; }
}
public sealed class RunTurnToolingConfigDto
{
public IReadOnlyList<RunTurnMcpServerConfigDto> McpServers { get; init; } = [];
@@ -290,6 +297,17 @@ public sealed class ApprovalRequestedEventDto : SidecarEventDto
public PermissionDetailDto? PermissionDetail { get; init; }
}
public sealed class UserInputRequestedEventDto : SidecarEventDto
{
public string SessionId { get; init; } = string.Empty;
public string UserInputId { get; init; } = string.Empty;
public string? AgentId { get; init; }
public string? AgentName { get; init; }
public string Question { get; init; } = string.Empty;
public IReadOnlyList<string>? Choices { get; init; }
public bool? AllowFreeform { get; init; }
}
public sealed class CommandErrorEventDto : SidecarEventDto
{
public string Message { get; init; } = string.Empty;