Skip to content
Draft
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
1 change: 1 addition & 0 deletions OneWare.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<File Path="build/props/Base.props" />
<File Path="build/props/CommunityToolkit.Mvvm.props" />
<File Path="build/props/Devlooped.CredentialManager.props" />
<File Path="build/props/DotAcp.Client.props" />
<File Path="build/props/Dock.Avalonia.props" />
<File Path="build/props/DynamicData.props" />
<File Path="build/props/Jint.props" />
Expand Down
7 changes: 7 additions & 0 deletions build/props/DotAcp.Client.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="dotacp.client" Version="2026.5.10"/>
</ItemGroup>
</Project>

112 changes: 112 additions & 0 deletions src/OneWare.Acp/AcpModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using Microsoft.Extensions.DependencyInjection;
using OneWare.Acp.Services;
using OneWare.Essentials.Helpers;
using OneWare.Essentials.Models;
using OneWare.Essentials.PackageManager;
using OneWare.Essentials.Services;

namespace OneWare.Acp;

public class AcpModule : OneWareModuleBase
{
private const string CodexAcpVersion = "0.16.0";
private const string CodexAcpTag = "v0.16.0";
private const string BaseUrl = $"https://github.com/zed-industries/codex-acp/releases/download/{CodexAcpTag}";

public static readonly Package CodexPackage = new()
{
Category = "Binaries",
Id = "codexacp",
Type = "NativeTool",
Name = "Codex ACP",
Description = "ACP adapter for OpenAI Codex CLI, enabling Codex in ACP-compatible editors (by Zed Industries)",
License = "Apache-2.0",
IconUrl = "https://raw.githubusercontent.com/lobehub/lobe-icons/refs/heads/master/packages/static-png/dark/openai.png",
Links =
[
new PackageLink { Name = "GitHub", Url = "https://github.com/zed-industries/codex-acp" },
new PackageLink { Name = "OpenAI Codex", Url = "https://github.com/openai/codex" }
],
Versions =
[
new PackageVersion
{
Version = CodexAcpVersion,
Targets =
[
new PackageTarget
{
Target = "win-x64",
Url = $"{BaseUrl}/codex-acp-{CodexAcpVersion}-x86_64-pc-windows-msvc.zip",
AutoSetting = [new PackageAutoSetting { RelativePath = "codex-acp.exe", SettingKey = CodexChatService.CodexPathKey }]
},
new PackageTarget
{
Target = "win-arm64",
Url = $"{BaseUrl}/codex-acp-{CodexAcpVersion}-aarch64-pc-windows-msvc.zip",
AutoSetting = [new PackageAutoSetting { RelativePath = "codex-acp.exe", SettingKey = CodexChatService.CodexPathKey }]
},
new PackageTarget
{
Target = "linux-x64",
Url = $"{BaseUrl}/codex-acp-{CodexAcpVersion}-x86_64-unknown-linux-musl.tar.gz",
AutoSetting = [new PackageAutoSetting { RelativePath = "codex-acp", SettingKey = CodexChatService.CodexPathKey }]
},
new PackageTarget
{
Target = "linux-arm64",
Url = $"{BaseUrl}/codex-acp-{CodexAcpVersion}-aarch64-unknown-linux-musl.tar.gz",
AutoSetting = [new PackageAutoSetting { RelativePath = "codex-acp", SettingKey = CodexChatService.CodexPathKey }]
},
new PackageTarget
{
Target = "osx-x64",
Url = $"{BaseUrl}/codex-acp-{CodexAcpVersion}-x86_64-apple-darwin.tar.gz",
AutoSetting = [new PackageAutoSetting { RelativePath = "codex-acp", SettingKey = CodexChatService.CodexPathKey }]
},
new PackageTarget
{
Target = "osx-arm64",
Url = $"{BaseUrl}/codex-acp-{CodexAcpVersion}-aarch64-apple-darwin.tar.gz",
AutoSetting = [new PackageAutoSetting { RelativePath = "codex-acp", SettingKey = CodexChatService.CodexPathKey }]
}
]
}
]
};

public override void RegisterServices(IServiceCollection services)
{
services.AddTransient<CodexChatService>();
}

public override void Initialize(IServiceProvider serviceProvider)
{
serviceProvider.Resolve<IPackageService>().RegisterPackage(CodexPackage);

var settings = serviceProvider.Resolve<ISettingsService>();

settings.RegisterSetting(
"AI Chat", "Codex", CodexChatService.CodexPathKey,
new FilePathSetting(
"Codex ACP Path", "", null,
serviceProvider.Resolve<IPaths>().NativeToolsDirectory,
PlatformHelper.Exists,
PlatformHelper.ExeFile)
{
HoverDescription = "Path to the codex-acp binary. Install it automatically via the Package Manager."
});

settings.RegisterSetting(
"AI Chat", "Codex", CodexChatService.CodexApiKeySettingKey,
new TextBoxSetting("OpenAI API Key", "", null)
{
HoverDescription = "Your OpenAI API key (sk-...). Required to authenticate Codex with the OpenAI API."
});

var codex = serviceProvider.Resolve<CodexChatService>();
serviceProvider.Resolve<IChatManagerService>().RegisterChatService(codex);

_ = codex.CheckForUpdateAsync();
}
}
11 changes: 11 additions & 0 deletions src/OneWare.Acp/OneWare.Acp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\props\Base.props" />
<Import Project="..\..\build\props\OneWare.Module.props" />

<ItemGroup>
<ProjectReference Include="..\OneWare.Essentials\OneWare.Essentials.csproj"/>
</ItemGroup>

<Import Project="..\..\build\props\DotAcp.Client.props" />
</Project>

Loading
Loading