refactor: improve sidecar backend structure

Refactor sidecar command dispatch, approval handling, transcript projection, stream merging, and tooling helpers while preserving behavior and expanding backend regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-25 20:11:59 +01:00
co-authored by Copilot
parent 4f202274db
commit 1bd0fcba3e
10 changed files with 825 additions and 510 deletions
@@ -757,6 +757,8 @@ public sealed class CopilotWorkflowRunnerTests
["tool-call-url"] = "web_fetch",
["tool-call-shell"] = "shell",
["tool-call-read"] = "view",
["tool-call-write"] = "write_file",
["tool-call-memory"] = "store_memory",
};
Assert.True(
@@ -802,6 +804,34 @@ public sealed class CopilotWorkflowRunnerTests
toolNamesByCallId,
out string? readToolName));
Assert.Equal("view", readToolName);
Assert.True(
CopilotApprovalCoordinator.TryGetApprovalToolName(
new PermissionRequestWrite
{
Kind = "write",
ToolCallId = "tool-call-write",
Intention = "Update a file",
FileName = "README.md",
Diff = "@@ -1 +1 @@",
},
toolNamesByCallId,
out string? writeToolName));
Assert.Equal("write_file", writeToolName);
Assert.True(
CopilotApprovalCoordinator.TryGetApprovalToolName(
new PermissionRequestMemory
{
Kind = "memory",
ToolCallId = "tool-call-memory",
Subject = "repo conventions",
Fact = "Use Bun for script execution.",
Citations = "package.json",
},
toolNamesByCallId,
out string? memoryToolName));
Assert.Equal("store_memory", memoryToolName);
}
[Fact]