mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-29 07:58:47 +02:00
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>
117 lines
3.9 KiB
C#
117 lines
3.9 KiB
C#
using Aryx.AgentHost.Contracts;
|
|
using Aryx.AgentHost.Services;
|
|
using GitHub.Copilot.SDK;
|
|
|
|
namespace Aryx.AgentHost.Tests;
|
|
|
|
public sealed class CopilotUserInputCoordinatorTests
|
|
{
|
|
[Fact]
|
|
public async Task RequestUserInputAsync_RaisesUserInputEventAndCompletesAfterResolution()
|
|
{
|
|
CopilotUserInputCoordinator coordinator = new();
|
|
UserInputRequestedEventDto? observedEvent = null;
|
|
RunTurnCommandDto command = CreateUserInputCommand();
|
|
|
|
Task<UserInputResponse> pending = coordinator.RequestUserInputAsync(
|
|
command,
|
|
command.Workflow.GetAgentNodes()[0],
|
|
new UserInputRequest
|
|
{
|
|
Question = "How should I proceed?",
|
|
Choices = ["Continue", "Stop"],
|
|
AllowFreeform = true,
|
|
},
|
|
new UserInputInvocation
|
|
{
|
|
SessionId = "copilot-session-1",
|
|
},
|
|
userInputEvent =>
|
|
{
|
|
observedEvent = userInputEvent;
|
|
return Task.CompletedTask;
|
|
},
|
|
CancellationToken.None);
|
|
|
|
Assert.False(pending.IsCompleted);
|
|
Assert.NotNull(observedEvent);
|
|
Assert.Equal("user-input-requested", observedEvent!.Type);
|
|
Assert.Equal("turn-1", observedEvent.RequestId);
|
|
Assert.Equal("session-1", observedEvent.SessionId);
|
|
Assert.Equal("agent-1", observedEvent.AgentId);
|
|
Assert.Equal("Primary", observedEvent.AgentName);
|
|
Assert.Equal("How should I proceed?", observedEvent.Question);
|
|
Assert.Equal(["Continue", "Stop"], observedEvent.Choices);
|
|
Assert.True(observedEvent.AllowFreeform);
|
|
|
|
await coordinator.ResolveUserInputAsync(
|
|
new ResolveUserInputCommandDto
|
|
{
|
|
UserInputId = observedEvent.UserInputId,
|
|
Answer = "Continue",
|
|
WasFreeform = false,
|
|
},
|
|
CancellationToken.None);
|
|
|
|
UserInputResponse response = await pending;
|
|
Assert.Equal("Continue", response.Answer);
|
|
Assert.False(response.WasFreeform);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ResolveUserInputAsync_RejectsUnknownUserInputIds()
|
|
{
|
|
CopilotUserInputCoordinator coordinator = new();
|
|
|
|
InvalidOperationException error = await Assert.ThrowsAsync<InvalidOperationException>(() =>
|
|
coordinator.ResolveUserInputAsync(
|
|
new ResolveUserInputCommandDto
|
|
{
|
|
UserInputId = "user-input-missing",
|
|
Answer = "Continue",
|
|
WasFreeform = false,
|
|
},
|
|
CancellationToken.None));
|
|
|
|
Assert.Contains("is not pending", error.Message);
|
|
}
|
|
|
|
private static RunTurnCommandDto CreateUserInputCommand()
|
|
{
|
|
return new RunTurnCommandDto
|
|
{
|
|
RequestId = "turn-1",
|
|
SessionId = "session-1",
|
|
Workflow = new WorkflowDefinitionDto
|
|
{
|
|
Id = "workflow-1",
|
|
Name = "User Input 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",
|
|
},
|
|
},
|
|
};
|
|
}
|
|
}
|