Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AgentClient - preparation for changes in the initialization process #36

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/Cody.AgentTester/Cody.AgentTester.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@
<Project>{9ff2cc40-78e9-46c8-b2ef-30a1f1be82f2}</Project>
<Name>Cody.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="StreamJsonRpc">
<Version>2.9.85</Version>
</PackageReference>
<ProjectReference Include="..\Cody.VisualStudio\Cody.VisualStudio.csproj">
<Project>{3bb34f98-f069-4a38-bc4d-cf407d59b863}</Project>
<Name>Cody.VisualStudio</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
27 changes: 15 additions & 12 deletions src/Cody.AgentTester/Program.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
using Cody.Core.Agent;
using Cody.Core.Agent.Connector;
using Cody.Core.Agent.Protocol;
using Cody.VisualStudio.Client;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

namespace Cody.AgentTester
{
internal class Program
{
private static AgentConnector connector;
private static AgentClient client;
private static ConsoleLogger logger = new ConsoleLogger();
private static IAgentClient agentClient;
private static IAgentService agentService;

static async Task Main(string[] args)
{
// Set the env var to 3113 when running with local agent.
var portNumber = int.TryParse(Environment.GetEnvironmentVariable("CODY_VS_DEV_PORT"), out int port) ? port : (int?)null;
var devPort = Environment.GetEnvironmentVariable("CODY_VS_DEV_PORT");
var portNumber = int.TryParse(devPort, out int port) ? port : 3113;

var options = new AgentConnectorOptions
var options = new AgentClientOptions
{
NotificationsTarget = new NotificationHandlers(),
NotificationHandlers = new List<INotificationHandler> { new NotificationHandlers() },
AgentDirectory = "../../../Cody.VisualStudio/Agent",
RestartAgentOnFailure = true,
Debug = true,
Port = portNumber,
ConnectToRemoteAgent = devPort != null,
RemoteAgentPort = portNumber,
};

connector = new AgentConnector(options, logger);
client = new AgentClient(options, logger);

await connector.Connect();
client.Start();

agentClient = connector.CreateClient();
agentService = client.CreateAgentService<IAgentService>();

await Initialize();

Expand Down Expand Up @@ -76,9 +79,9 @@ private static async Task Initialize()
}
};

await agentClient.Initialize(clientInfo);
await agentService.Initialize(clientInfo);

agentClient.Initialized();
agentService.Initialized();
}


Expand Down
24 changes: 0 additions & 24 deletions src/Cody.Core/Agent/AgentClientFactory.cs

This file was deleted.

18 changes: 18 additions & 0 deletions src/Cody.Core/Agent/AgentMethodAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cody.Core.Agent
{
public class AgentMethodAttribute : Attribute
{
public AgentMethodAttribute(string name)
{
Name = name;
}

public string Name { get; private set; }
}
}
21 changes: 21 additions & 0 deletions src/Cody.Core/Agent/AgentNotificationAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cody.Core.Agent
{
public class AgentNotificationAttribute : Attribute
{
public AgentNotificationAttribute(string name, bool deserializeToSingleObject = false)
{
Name = name;
DeserializeToSingleObject = deserializeToSingleObject;
}

public string Name { get; private set; }

public bool DeserializeToSingleObject { get; private set; }
}
}
108 changes: 0 additions & 108 deletions src/Cody.Core/Agent/Connector/AgentConnector.cs

This file was deleted.

28 changes: 0 additions & 28 deletions src/Cody.Core/Agent/Connector/AgentConnectorOptions.cs

This file was deleted.

Loading
Loading