![]() |
VOOZH | about |
dotnet add package HagiCode.Libs.Providers --version 0.3.0
NuGet\Install-Package HagiCode.Libs.Providers -Version 0.3.0
<PackageReference Include="HagiCode.Libs.Providers" Version="0.3.0" />
<PackageVersion Include="HagiCode.Libs.Providers" Version="0.3.0" />Directory.Packages.props
<PackageReference Include="HagiCode.Libs.Providers" />Project file
paket add HagiCode.Libs.Providers --version 0.3.0
#r "nuget: HagiCode.Libs.Providers, 0.3.0"
#:package HagiCode.Libs.Providers@0.3.0
#addin nuget:?package=HagiCode.Libs.Providers&version=0.3.0Install as a Cake Addin
#tool nuget:?package=HagiCode.Libs.Providers&version=0.3.0Install as a Cake Tool
HagiCode.Libs.Providers builds on HagiCode.Libs.Core and adds reusable provider abstractions plus built-in integrations for Claude Code, Copilot, Codex, DeepAgents, CodeBuddy, Gemini, Hermes, Kimi, Kiro, OpenCode, Pi, QoderCLI, and Reasonix.
ICliProvider and ICliProvider<TOptions> contracts for provider-oriented integrationsAddHagiCodeLibs() for dependency injection registrationICliExecutionFacade for provider-side probes or adaptersCliProviderPoolCoordinator, Hermes pool defaults, and ACP/runtime reuse backendsdotnet add package HagiCode.Libs.Providers
If your application uses dependency injection, also reference Microsoft.Extensions.DependencyInjection.
using HagiCode.Libs.Core.Execution;
using HagiCode.Libs.Providers;
using HagiCode.Libs.Providers.Codebuddy;
using HagiCode.Libs.Providers.Copilot;
using HagiCode.Libs.Providers.Codex;
using HagiCode.Libs.Providers.DeepAgents;
using HagiCode.Libs.Providers.Gemini;
using HagiCode.Libs.Providers.Hermes;
using HagiCode.Libs.Providers.Kimi;
using HagiCode.Libs.Providers.Kiro;
using HagiCode.Libs.Providers.OpenCode;
using HagiCode.Libs.Providers.Pi;
using HagiCode.Libs.Providers.Reasonix;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddHagiCodeLibs();
await using var serviceProvider = services.BuildServiceProvider();
var executionFacade = serviceProvider.GetRequiredService<ICliExecutionFacade>();
var codebuddy = serviceProvider.GetRequiredService<ICliProvider<CodebuddyOptions>>();
var copilot = serviceProvider.GetRequiredService<ICliProvider<CopilotOptions>>();
var codex = serviceProvider.GetRequiredService<ICodexProvider>();
var deepAgents = serviceProvider.GetRequiredService<ICliProvider<DeepAgentsOptions>>();
var gemini = serviceProvider.GetRequiredService<ICliProvider<GeminiOptions>>();
var hermes = serviceProvider.GetRequiredService<ICliProvider<HermesOptions>>();
var kimi = serviceProvider.GetRequiredService<ICliProvider<KimiOptions>>();
var kiro = serviceProvider.GetRequiredService<ICliProvider<KiroOptions>>();
var openCode = serviceProvider.GetRequiredService<ICliProvider<OpenCodeOptions>>();
var pi = serviceProvider.GetRequiredService<ICliProvider<PiOptions>>();
var reasonix = serviceProvider.GetRequiredService<ICliProvider<ReasonixOptions>>();
The same DI graph also exposes the shared pool services for Hermes diagnostics or explicit cleanup:
using HagiCode.Libs.Providers.Pooling;
var poolCoordinator = serviceProvider.GetRequiredService<CliProviderPoolCoordinator>();
var poolDefaults = serviceProvider.GetRequiredService<CliProviderPoolConfigurationRegistry>();
Claude Code、CodeBuddy、Hermes 现在与 hagicode-core 的对应 provider 薄适配层共享同一套 libs-backed 实现。重点是:
Claude Code 继续保留 raw stream / resume 语义,但 ClaudeCodeProvider 现在固定按次启动并回收本地 CLI 进程,不再做 warm transport reuseCodeBuddy 的 tool update 归一化与 permission-mode 映射统一落在 CodebuddyProviderHermes 的 ACP session reuse、fallback 文本聚合与 lifecycle 诊断统一落在 HermesProviderHagiCode.Libs.Providers 只负责单次执行并保留 provider-native 会话上下文;如果上层需要重试,必须在 provider 调用边界之外显式编排ProviderRegistry 的规范名称与兼容别名也已统一:
claude-code → claude, claudecode, anthropic-claudecodebuddy → codebuddy-clihermes → hermes-clipi → pi-cliusing HagiCode.Libs.Providers.Copilot;
using HagiCode.Libs.Providers.Codex;
using HagiCode.Libs.Providers.Codebuddy;
using HagiCode.Libs.Providers.DeepAgents;
using HagiCode.Libs.Providers.Hermes;
using HagiCode.Libs.Providers.Kimi;
using HagiCode.Libs.Providers.Kiro;
using HagiCode.Libs.Providers.Pi;
using HagiCode.Libs.Providers.Reasonix;
var codebuddyOptions = new CodebuddyOptions
{
WorkingDirectory = "/path/to/repo",
SessionId = "codebuddy-session-123",
ModeId = "plan",
Model = "glm-4.7"
};
await foreach (var message in codebuddy.ExecuteAsync(codebuddyOptions, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}
var hermesOptions = new HermesOptions
{
WorkingDirectory = "/path/to/repo",
SessionId = "hermes-session-123",
ModeId = "bypassPermissions",
Model = "hermes/default",
Arguments = ["acp"]
};
await foreach (var message in hermes.ExecuteAsync(hermesOptions, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}
var copilotOptions = new CopilotOptions
{
WorkingDirectory = "/path/to/repo",
Model = "claude-sonnet-4.5",
SessionId = "copilot-session-123",
Permissions = new CopilotPermissionOptions
{
AllowAllTools = true,
AllowedPaths = ["/path/to/repo"]
},
AdditionalArgs = ["--config-dir", "/path/to/.copilot"]
};
await foreach (var message in copilot.ExecuteAsync(copilotOptions, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}
// Copilot tool-call turns always terminate with either a "result" or "error"
// message so upstream Orleans/session UIs can leave the running state deterministically.
// Reuse a persisted provider-native Copilot conversation on the next call.
var resumedOptions = copilotOptions with { SessionId = "copilot-session-123" };
// Without SessionId, Copilot requests stay anonymous; WorkingDirectory and permission
// flags only shape the compatibility fingerprint and do not preserve prior runtime state on their own.
var codexOptions = new CodexSessionOptions
{
ThreadOptions = new ThreadOptions
{
WorkingDirectory = "/path/to/repo",
Model = "gpt-5-codex",
SandboxMode = SandboxMode.WorkspaceWrite,
ApprovalPolicy = ApprovalMode.Never,
AdditionalDirectories = ["/path/to/repo"],
SkipGitRepoCheck = true,
}
};
await using var codexSession = await codex.CreateSessionAsync(codexOptions);
var codexResult = await codexSession.Thread.RunAsync("Reply with exactly the word 'pong'");
Console.WriteLine(codexResult.FinalResponse);
var deepAgentsOptions = new DeepAgentsOptions
{
Model = "glm-5.1",
WorkspaceRoot = "/path/to/repo",
ModeId = "bypassPermissions",
AgentName = "coding-assistant",
AgentDescription = "Repo-aware DeepAgents ACP runner",
SkillsDirectories = ["/path/to/skills"],
ExtraArguments = ["--debug"]
};
await foreach (var message in deepAgents.ExecuteAsync(deepAgentsOptions, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}
// ModeId is the authoritative ACP session-mode contract for DeepAgents.
// Compatibility flags such as --auto-approve may still be forwarded, but cross-call
// resume depends on provider-native session/load support.
// Reuse the same Codex thread id to continue a previous conversation by setting
// CodexSessionOptions.ThreadId before calling CreateSessionAsync.
var kimiOptions = new KimiOptions
{
WorkingDirectory = "/path/to/repo",
Model = "kimi-k2.5",
AuthenticationMethod = "token",
AuthenticationToken = "<token>",
ExtraArguments = ["--profile", "smoke"]
};
await foreach (var message in kimi.ExecuteAsync(kimiOptions, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}
var kiroOptions = new KiroOptions
{
WorkingDirectory = "/path/to/repo",
Model = "kiro-default",
AuthenticationMethod = "token",
AuthenticationToken = "<token>",
ExtraArguments = ["--profile", "smoke"]
};
await foreach (var message in kiro.ExecuteAsync(kiroOptions, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}
var piOptions = new PiOptions
{
WorkingDirectory = "/path/to/repo",
Provider = "omniroute",
Model = "glm/glm-4.7",
DisableAllTools = true,
NoSession = true,
EnvironmentVariables = new Dictionary<string, string?>
{
["PI_OFFLINE"] = "1"
}
};
await foreach (var message in pi.ExecuteAsync(piOptions, "Plan a two-day Chongqing trip in three short bullet points."))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}
var reasonixOptions = new ReasonixOptions
{
WorkingDirectory = "/path/to/repo",
Model = "deepseek-flash",
SessionId = "reasonix-session-123"
};
await foreach (var message in reasonix.ExecuteAsync(reasonixOptions, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}
The Codex integration vendors source from ManagedCode.CodexSharpSDK under Codex/Vendored/.
The upstream MIT license is preserved in source control at Codex/Vendored/LICENSE.ManagedCode.CodexSharpSDK.txt and is included in the NuGet package under vendor/codex/.
Hermes is the only built-in provider that still exposes PoolSettings:
var hermesPoolOptions = new HermesOptions
{
SessionId = "demo-session",
WorkingDirectory = "/path/to/repo",
PoolSettings = new CliPoolSettings
{
Enabled = true,
IdleTimeout = TimeSpan.FromMinutes(10),
MaxActiveSessions = 50,
KeepAnonymousSessions = false
}
};
Practical boundaries:
Hermes pools live ACP sessions.Hermes includes ModeId in its reuse fingerprint and re-applies it after session/new or warm reuse.HermesOptions.PoolSettings.Enabled = false falls back to the one-shot path without changing message semantics.SessionId remains a provider-native continuity hint only where that backend supports it.CliProcessManager directly because they need open stdio sessions.gemini is the canonical built-in provider name; ProviderRegistry and the dedicated console also accept gemini-cli as an alias.deepagents is the canonical built-in provider name, and the managed runtime boots ACP through deepagents --acp.kimi is the canonical built-in provider name; ProviderRegistry and the dedicated console also accept kimi-cli as an alias.kiro-cli is the canonical built-in provider name across the shared provider registry and the dedicated console.pi is the canonical built-in provider name; ProviderRegistry also accepts pi-cli as a compatibility alias and the built-in provider runs Pi through --mode json --print one-shot execution.reasonix is the canonical built-in provider name. Reasonix 1.x ACP now only accepts the startup-time -model selector; working directory and session resume flow through ACP session/new / session/load, while permissions, MCP plugins, proxying, and similar policy are expected to live in reasonix.toml instead of CLI bootstrap flags.kiro-cli executables. Generic kiro launchers are not accepted for implicit discovery, explicit ExecutablePath, or readiness checks.CliInstallRegistry now treats DeepAgents as local-only validation metadata because the managed runtime expects a deepagents executable (or uvx --from deepagents-cli deepagents --acp) rather than the legacy deepagents-acp npm package.| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.3.1-dev.90.1 | 0 | 6/19/2026 |
| 0.3.0 | 52 | 6/8/2026 |
| 0.2.6-dev.88.1 | 47 | 6/7/2026 |
| 0.2.6-dev.87.1 | 46 | 6/7/2026 |
| 0.2.6-dev.86.1 | 46 | 6/7/2026 |
| 0.2.6-dev.85.1 | 46 | 6/7/2026 |
| 0.2.6-dev.84.1 | 52 | 6/7/2026 |
| 0.2.6-dev.83.1 | 49 | 6/6/2026 |
| 0.2.6-dev.82.1 | 50 | 6/6/2026 |
| 0.2.6-dev.81.1 | 44 | 6/4/2026 |
| 0.2.6-dev.80.1 | 46 | 6/2/2026 |
| 0.2.6-dev.79.1 | 57 | 6/1/2026 |
| 0.2.6-dev.78.1 | 52 | 6/1/2026 |
| 0.2.6-dev.77.1 | 54 | 5/28/2026 |
| 0.2.6-dev.76.1 | 52 | 5/26/2026 |
| 0.2.5 | 105 | 5/26/2026 |
| 0.2.5-dev.74.1 | 53 | 5/21/2026 |
| 0.2.5-dev.72.1 | 54 | 5/18/2026 |
| 0.2.4 | 96 | 5/5/2026 |
| 0.2.4-dev.70.1 | 56 | 5/2/2026 |