HagiCode.Libs.Providers
0.2.4-dev.61.1
See the version list below for details.
dotnet add package HagiCode.Libs.Providers --version 0.2.4-dev.61.1
NuGet\Install-Package HagiCode.Libs.Providers -Version 0.2.4-dev.61.1
<PackageReference Include="HagiCode.Libs.Providers" Version="0.2.4-dev.61.1" />
<PackageVersion Include="HagiCode.Libs.Providers" Version="0.2.4-dev.61.1" />
<PackageReference Include="HagiCode.Libs.Providers" />
paket add HagiCode.Libs.Providers --version 0.2.4-dev.61.1
#r "nuget: HagiCode.Libs.Providers, 0.2.4-dev.61.1"
#:package HagiCode.Libs.Providers@0.2.4-dev.61.1
#addin nuget:?package=HagiCode.Libs.Providers&version=0.2.4-dev.61.1&prerelease
#tool nuget:?package=HagiCode.Libs.Providers&version=0.2.4-dev.61.1&prerelease
HagiCode.Libs.Providers
HagiCode.Libs.Providers builds on HagiCode.Libs.Core and adds reusable provider abstractions plus built-in integrations for Claude Code, Copilot, Codex, DeepAgents, CodeBuddy, Hermes, Kimi, Kiro, and QoderCLI.
What is included
- The
ICliProviderandICliProvider<TOptions>contracts for provider-oriented integrations - Built-in provider implementations for the supported HagiCode CLI backends
AddHagiCodeLibs()for dependency injection registration- A provider registry for resolving providers by name or alias
- Registration of the shared
ICliExecutionFacadefor provider-side probes or adapters - Registration of the shared
CliProviderPoolCoordinator, provider-scoped pool defaults, and ACP/runtime reuse backends - Single-attempt provider primitives that preserve native thread or session context for upstream retry orchestration
Install
dotnet add package HagiCode.Libs.Providers
If your application uses dependency injection, also reference Microsoft.Extensions.DependencyInjection.
Dependency injection entry point
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.Hermes;
using HagiCode.Libs.Providers.Kimi;
using HagiCode.Libs.Providers.Kiro;
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<ICliProvider<CodexOptions>>();
var deepAgents = serviceProvider.GetRequiredService<ICliProvider<DeepAgentsOptions>>();
var hermes = serviceProvider.GetRequiredService<ICliProvider<HermesOptions>>();
var kimi = serviceProvider.GetRequiredService<ICliProvider<KimiOptions>>();
var kiro = serviceProvider.GetRequiredService<ICliProvider<KiroOptions>>();
The same DI graph also exposes the shared pool services when advanced callers need diagnostics or explicit cleanup:
using HagiCode.Libs.Providers.Pooling;
var poolCoordinator = serviceProvider.GetRequiredService<CliProviderPoolCoordinator>();
var poolDefaults = serviceProvider.GetRequiredService<CliProviderPoolConfigurationRegistry>();
Shared adapter parity
Claude Code、CodeBuddy、Hermes 现在与 hagicode-core 的对应 provider 薄适配层共享同一套 libs-backed 实现。重点是:
Claude Code继续保留 raw stream / resume 语义,但真实执行与 warm transport reuse 统一落在ClaudeCodeProviderCodeBuddy的 ACP session reuse、tool update 归一化与 permission-mode 映射统一落在CodebuddyProviderHermes的 ACP session reuse、fallback 文本聚合与 lifecycle 诊断统一落在HermesProvider- 自动重试调度属于
hagicode-core的 backend wrapper;HagiCode.Libs.Providers只负责单次执行并保留可恢复上下文
ProviderRegistry 的规范名称与兼容别名也已统一:
claude-code→claude,claudecode,anthropic-claudecodebuddy→codebuddy-clihermes→hermes-cli
Provider usage
using 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;
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}");
}
// 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 will not hit the shared pool alone.
var options = new CodexOptions
{
WorkingDirectory = "/path/to/repo",
Model = "gpt-5-codex",
SandboxMode = "workspace-write",
ApprovalPolicy = "never",
LogicalSessionKey = "session-123|/path/to/repo|codex|gpt-5-codex",
AddDirectories = ["/path/to/repo"],
SkipGitRepositoryCheck = true,
};
await foreach (var message in codex.ExecuteAsync(options, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}
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 pooled
// sessions re-apply ModeId before every prompt and a faulted entry is evicted so
// later requests can cold-start a fresh session.
// Reuse the same logical Codex session key to keep thread continuity on later calls.
// The logical key stays stable, while the compatibility fingerprint decides whether
// the existing warm runtime can be resumed or must be rebuilt under that same key.
// If LogicalSessionKey and ThreadId are both absent, the request remains anonymous
// even when WorkingDirectory matches a previous call.
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}");
}
Pool controls
Every built-in provider option record now exposes PoolSettings:
var qoderOptions = new QoderCliOptions
{
SessionId = "demo-session",
WorkingDirectory = "/path/to/repo",
PoolSettings = new CliPoolSettings
{
Enabled = true,
IdleTimeout = TimeSpan.FromMinutes(10),
MaxActiveSessions = 50,
KeepAnonymousSessions = false
}
};
Practical boundaries:
CodeBuddy,Gemini,Hermes,Kimi,Kiro, andQoderCLIpool live ACP sessions.DeepAgentspools live ACP sessions, treatsDeepAgentsOptions.ModeIdas the authoritative typed session-mode signal, re-applies it before prompt execution, and evicts faulted entries so later acquires can cold-start a fresh session.Claude Codepools warm stdio transports keyed by stable session identity plus a compatibility fingerprint built from the effective startup shape.Codexkeeps logical session identity stable, but rebuilds pooled entries when the compatibility fingerprint changes before reusing a previous thread binding.Copilotonly treats explicitSessionIdas the logical reuse key; permissions and runtime flags stay in the compatibility fingerprint so config changes cold-start a replacement runtime under the same session identity.CodeBuddyandHermesnow includeModeIdin their reuse fingerprint and re-apply it aftersession/newor warm reuse.- Pooling can be disabled per provider call, which falls back to the original one-shot behavior without changing message semantics.
- Idle eviction is lazy and deterministic; if a lease faults, the coordinator disposes that entry immediately rather than returning it to the warm set.
Adoption boundaries
- Interactive provider transports still use
CliProcessManagerdirectly because they need open stdio sessions. - The new execution facade is intended for provider-facing adapters, diagnostics, and one-shot probes such as version checks.
- Provider callers should continue passing structured option models; the new facade is additive and does not replace provider-specific option records.
geminiis the canonical built-in provider name;ProviderRegistryand the dedicated console also acceptgemini-clias an alias.deepagentsis the canonical built-in provider name, and the managed runtime boots ACP throughdeepagents --acp.kimiis the canonical built-in provider name;ProviderRegistryand the dedicated console also acceptkimi-clias an alias.kirois the canonical built-in provider name;ProviderRegistryand the dedicated console also acceptkiro-clias an alias.CliInstallRegistrynow treats DeepAgents as local-only validation metadata because the managed runtime expects adeepagentsexecutable (oruvx --from deepagents-cli deepagents --acp) rather than the legacydeepagents-acpnpm package.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- GitHub.Copilot.SDK (>= 0.1.32)
- HagiCode.Libs.Core (>= 0.2.4-dev.61.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Options (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.5-dev.74.1 | 32 | 5/21/2026 |
| 0.2.5-dev.72.1 | 46 | 5/18/2026 |
| 0.2.4 | 86 | 5/5/2026 |
| 0.2.4-dev.70.1 | 53 | 5/2/2026 |
| 0.2.4-dev.69.1 | 53 | 5/1/2026 |
| 0.2.4-dev.68.1 | 45 | 4/30/2026 |
| 0.2.4-dev.67.1 | 58 | 4/30/2026 |
| 0.2.4-dev.65.1 | 59 | 4/29/2026 |
| 0.2.4-dev.64.1 | 57 | 4/26/2026 |
| 0.2.4-dev.63.1 | 50 | 4/23/2026 |
| 0.2.4-dev.62.1 | 67 | 4/21/2026 |
| 0.2.4-dev.61.1 | 62 | 4/20/2026 |
| 0.2.4-dev.60.1 | 56 | 4/19/2026 |
| 0.2.4-dev.59.1 | 51 | 4/19/2026 |
| 0.2.3 | 99 | 4/18/2026 |
| 0.2.3-dev.57.1 | 52 | 4/17/2026 |
| 0.2.3-dev.56.1 | 57 | 4/16/2026 |
| 0.2.3-dev.55.1 | 50 | 4/15/2026 |
| 0.2.3-dev.54.1 | 58 | 4/15/2026 |
| 0.2.3-dev.53.1 | 66 | 4/14/2026 |