Files
aryx/sidecar/tests/Aryx.AgentHost.Tests/CopilotMcpOAuthCoordinatorTests.cs
David KayaandCopilot 805e369b67 refactor: remove legacy patterns system, unify on workflows
Remove the entire patterns domain model, IPC channels, sidecar services,
renderer components, and tests. Sessions now bind exclusively to workflows
via workflowId. Builtin workflows replace builtin patterns.

Backend:
- Make AgentNodeConfig standalone (no longer extends PatternAgentDefinition)
- Add WorkflowOrchestrationMode and WorkflowExecutionDefinition
- Create builtin workflows (single-agent, sequential, concurrent, handoff, group-chat)
- Rewrite session model config helpers for workflow-only
- Remove pattern IPC channels, handlers, and preload bindings
- Merge createSession/createWorkflowSession into single method
- Remove sidecar PatternGraphResolver, PatternValidator, pattern DTOs
- Add workspace migration for legacy sessions (patternId -> workflowId)

Frontend:
- Delete PatternEditor, pattern-graph components, patternGraph lib
- Delete NewSessionModal (session creation uses workflows directly)
- Remove PatternsSection from SettingsPanel
- Update App.tsx, ChatPane, ActivityPanel, Sidebar, RunTimeline,
  AgentConfigFields, InlinePills, sessionActivity to use workflow types
- Delete pattern.ts domain module

78 files changed across backend and frontend.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-06 22:37:00 +02:00

85 lines
3.0 KiB
C#

using Aryx.AgentHost.Contracts;
using Aryx.AgentHost.Services;
using GitHub.Copilot.SDK;
namespace Aryx.AgentHost.Tests;
public sealed class CopilotMcpOAuthCoordinatorTests
{
[Fact]
public void BuildMcpOauthRequiredEvent_MapsSdkEventToProtocolEvent()
{
CopilotMcpOAuthCoordinator coordinator = new();
RunTurnCommandDto command = CreateCommand();
McpOauthRequiredEventDto oauthEvent = coordinator.BuildMcpOauthRequiredEvent(
command,
command.Workflow.GetAgentNodes()[0],
new McpOauthRequiredEvent
{
Data = new McpOauthRequiredData
{
RequestId = " oauth-request-1 ",
ServerName = " Example MCP ",
ServerUrl = " https://example.com/mcp ",
StaticClientConfig = new McpOauthRequiredDataStaticClientConfig
{
ClientId = " aryx-client ",
PublicClient = true,
},
},
});
Assert.Equal("mcp-oauth-required", oauthEvent.Type);
Assert.Equal("turn-1", oauthEvent.RequestId);
Assert.Equal("session-1", oauthEvent.SessionId);
Assert.Equal("oauth-request-1", oauthEvent.OauthRequestId);
Assert.Equal("agent-1", oauthEvent.AgentId);
Assert.Equal("Primary", oauthEvent.AgentName);
Assert.Equal("Example MCP", oauthEvent.ServerName);
Assert.Equal("https://example.com/mcp", oauthEvent.ServerUrl);
Assert.NotNull(oauthEvent.StaticClientConfig);
Assert.Equal("aryx-client", oauthEvent.StaticClientConfig!.ClientId);
Assert.True(oauthEvent.StaticClientConfig.PublicClient);
}
private static RunTurnCommandDto CreateCommand()
{
return new RunTurnCommandDto
{
RequestId = "turn-1",
SessionId = "session-1",
Workflow = new WorkflowDefinitionDto
{
Id = "workflow-1",
Name = "MCP OAuth Workflow",
Graph = new WorkflowGraphDto
{
Nodes =
[
new WorkflowNodeDto
{
Id = "agent-1",
Kind = "agent",
Label = "Primary",
Config = new WorkflowNodeConfigDto
{
Kind = "agent",
Id = "agent-1",
Name = "Primary",
Model = "gpt-5.4",
Instructions = "Help with the request.",
},
},
],
},
Settings = new WorkflowSettingsDto
{
OrchestrationMode = "single",
},
},
};
}
}