mirror of
https://github.com/davidkaya/aryx.git
synced 2026-11-29 12:02:39 +01: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>
82 lines
3.2 KiB
C#
82 lines
3.2 KiB
C#
using System.Collections.Concurrent;
|
|
using Aryx.AgentHost.Contracts;
|
|
using GitHub.Copilot.SDK;
|
|
|
|
namespace Aryx.AgentHost.Services;
|
|
|
|
internal sealed class CopilotExitPlanModeCoordinator
|
|
{
|
|
private readonly ConcurrentDictionary<string, ExitPlanModeRequestedEventDto> _pendingExitPlanRequests =
|
|
new(StringComparer.Ordinal);
|
|
|
|
public ExitPlanModeRequestedEventDto RecordExitPlanModeRequest(
|
|
RunTurnCommandDto command,
|
|
WorkflowNodeDto agent,
|
|
ExitPlanModeRequestedEvent request)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(command);
|
|
ArgumentNullException.ThrowIfNull(agent);
|
|
ArgumentNullException.ThrowIfNull(request);
|
|
|
|
ExitPlanModeRequestedEventDto exitPlanEvent = BuildExitPlanModeRequestedEvent(command, agent, request);
|
|
_pendingExitPlanRequests[command.RequestId] = exitPlanEvent;
|
|
return exitPlanEvent;
|
|
}
|
|
|
|
public ExitPlanModeRequestedEventDto? ConsumePendingRequest(string turnRequestId)
|
|
{
|
|
ArgumentException.ThrowIfNullOrWhiteSpace(turnRequestId);
|
|
return _pendingExitPlanRequests.TryRemove(turnRequestId, out ExitPlanModeRequestedEventDto? pending)
|
|
? pending
|
|
: null;
|
|
}
|
|
|
|
internal static ExitPlanModeRequestedEventDto BuildExitPlanModeRequestedEvent(
|
|
RunTurnCommandDto command,
|
|
WorkflowNodeDto agent,
|
|
ExitPlanModeRequestedEvent request)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(command);
|
|
ArgumentNullException.ThrowIfNull(agent);
|
|
ArgumentNullException.ThrowIfNull(request);
|
|
|
|
ExitPlanModeRequestedData requestData = request.Data
|
|
?? throw new InvalidOperationException("Exit plan mode request data is required.");
|
|
|
|
string exitPlanId = NormalizeOptionalString(requestData.RequestId)
|
|
?? throw new InvalidOperationException("Exit plan mode request ID is required.");
|
|
string? normalizedAgentId = NormalizeOptionalString(agent.GetAgentId());
|
|
string? normalizedAgentName = NormalizeOptionalString(agent.GetAgentName()) ?? normalizedAgentId;
|
|
|
|
return new ExitPlanModeRequestedEventDto
|
|
{
|
|
Type = "exit-plan-mode-requested",
|
|
RequestId = command.RequestId,
|
|
SessionId = command.SessionId,
|
|
ExitPlanId = exitPlanId,
|
|
AgentId = normalizedAgentId,
|
|
AgentName = normalizedAgentName,
|
|
Summary = NormalizeOptionalString(requestData.Summary) ?? string.Empty,
|
|
PlanContent = NormalizeOptionalString(requestData.PlanContent) ?? string.Empty,
|
|
Actions = NormalizeOptionalStringList(requestData.Actions ?? []),
|
|
RecommendedAction = NormalizeOptionalString(requestData.RecommendedAction),
|
|
};
|
|
}
|
|
|
|
private static string? NormalizeOptionalString(string? value)
|
|
{
|
|
return string.IsNullOrWhiteSpace(value) ? null : value.Trim();
|
|
}
|
|
|
|
private static IReadOnlyList<string>? NormalizeOptionalStringList(IEnumerable<string?> values)
|
|
{
|
|
List<string> normalized = values
|
|
.Select(NormalizeOptionalString)
|
|
.Where(static value => value is not null)
|
|
.Cast<string>()
|
|
.ToList();
|
|
|
|
return normalized.Count > 0 ? normalized : null;
|
|
}
|
|
}
|