HagiCode.Libs.Core
0.5.1-dev.149.1
See the version list below for details.
dotnet add package HagiCode.Libs.Core --version 0.5.1-dev.149.1
NuGet\Install-Package HagiCode.Libs.Core -Version 0.5.1-dev.149.1
<PackageReference Include="HagiCode.Libs.Core" Version="0.5.1-dev.149.1" />
<PackageVersion Include="HagiCode.Libs.Core" Version="0.5.1-dev.149.1" />
<PackageReference Include="HagiCode.Libs.Core" />
paket add HagiCode.Libs.Core --version 0.5.1-dev.149.1
#r "nuget: HagiCode.Libs.Core, 0.5.1-dev.149.1"
#:package HagiCode.Libs.Core@0.5.1-dev.149.1
#addin nuget:?package=HagiCode.Libs.Core&version=0.5.1-dev.149.1&prerelease
#tool nuget:?package=HagiCode.Libs.Core&version=0.5.1-dev.149.1&prerelease
HagiCode.Libs.Core
HagiCode.Libs.Core provides the low-level building blocks behind HagiCode CLI integrations. Use it when you need to discover installed executables, resolve the runtime environment for spawned tools, manage CLI processes, talk to ACP-compatible transports, or launch external commands through the new shared execution facade.
What is included
- CLI executable discovery for local tools and custom paths, with structured results, version verification, and install-route attribution
- Runtime environment resolution, including the macOS shell-aware fallback
- Process management helpers for launching and monitoring CLI subprocesses
- A shared CLI execution facade with buffered and streaming result envelopes
- Transport, ACP session primitives, and shared ACP pool contracts for higher-level integrations
Install
dotnet add package HagiCode.Libs.Core
Minimal usage
Resolve an executable path and the effective environment before launching a CLI:
using HagiCode.Libs.Core.Discovery;
using HagiCode.Libs.Core.Environment;
var executableResolver = new CliExecutableResolver();
var executablePath = executableResolver.ResolveFirstAvailablePath(["codex", "codex.exe"]);
var environmentResolver = new RuntimeEnvironmentResolver(new ProcessShellCommandRunner());
var environment = await environmentResolver.ResolveAsync();
Console.WriteLine(executablePath ?? "Codex CLI not found.");
Console.WriteLine(environment.TryGetValue("PATH", out var path) ? path : "PATH is unavailable.");
Set HAGICODE_AGENT_CLI_PATH to a platform-separated directory list when you need HagiCode to search custom Agent CLI install locations before falling back to PATH.
Execute a command through the shared execution facade without constructing ProcessStartContext directly:
using HagiCode.Libs.Core.Environment;
using HagiCode.Libs.Core.Execution;
using HagiCode.Libs.Core.Process;
var facade = new CliExecutionFacade(
new CliProcessManager(),
new RuntimeEnvironmentResolver(new ProcessShellCommandRunner()));
var result = await facade.ExecuteAsync(new CliExecutionRequest
{
ExecutablePath = "dotnet",
Arguments = ["--info"],
Timeout = TimeSpan.FromSeconds(10)
});
Console.WriteLine(result.Status);
Console.WriteLine(result.StandardOutput);
For long-running or interactive commands, call ExecuteStreamingAsync() to receive stdout and stderr events followed by a terminal CliExecutionResult envelope.
Redirected stdin, stdout, and stderr default to UTF-8 unless the caller explicitly overrides CliExecutionRequest.InputEncoding or OutputEncoding. This is the shared contract used by providers such as Codex so Windows prompt delivery keeps non-ASCII input valid without provider-local code-page workarounds.
Structured discovery
CliDiscoveryService returns one typed result per provider: the resolved path, how it was found (Source), a best-effort install kind, the verified version, and any shadowed installs. It starts the CLI only to read its version, and only when VerifyVersion is true (the default). Set VerifyVersion to false to resolve the path without starting anything.
using HagiCode.Libs.Core.Discovery;
using HagiCode.Libs.Core.Process;
var service = new CliDiscoveryService(new CliExecutableResolver(), new CliProcessManager());
var descriptor = CliInstallRegistry.Descriptors.Single(d => d.ProviderName == "ClaudeCode");
var result = await service.DiscoverAsync(descriptor);
Console.WriteLine(result.IsFound ? $"{result.ResolvedPath} {result.Version}" : "Claude Code not found.");
The discovery guide covers the resolution order, install-kind attribution, and the mapping from the backend's discovery symbols.
Adoption boundaries
- Use
CliExecutionFacadewhen you want typed requests, policy evaluation, normalized diagnostics, and structured success/failure/timeout handling. - Use
CliProcessManagerdirectly when you need a long-lived stdio transport such as ACP or provider-specific session protocols. - Use the ACP pool contracts (
CliPoolSettings,CliAcpPoolRequest,PooledAcpSessionEntry, andCliAcpSessionPool) when provider code needs warm session reuse, idle eviction, or deterministic fault cleanup. CliAcpSessionPool.GetDiagnosticsSnapshot()exposes read-only global and provider-scoped hit/miss/evict/fault counters, live entry counts, and the most recent eviction/fault reasons; the pool also emits structured logs plusSystem.Diagnostics.Metricscounters for warm reuse, misses, evictions, and faults.- The embedded lifecycle improvements intentionally stay behind HagiCode namespaces; callers should continue passing structured argument tokens instead of raw shell strings.
| 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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Options (>= 10.0.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on HagiCode.Libs.Core:
| Package | Downloads |
|---|---|
|
HagiCode.Libs.Providers
Provider abstractions and built-in HagiCode CLI integrations for Claude Code, Copilot, Codex, DeepAgents, CodeBuddy, Gemini, Hermes, Kimi, Kiro, OpenCode, Pi, QoderCLI, and Reasonix. |
|
|
HagiCode.Libs.Git
Provider-agnostic git wrapper for HagiCode hosts: repository inspection, status, staging, commit, push, pull, rebase, clone and repository scanning through the git CLI, returning typed results with stable failure codes. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.5.1-dev.150.1 | 0 | 10/19/2026 |
| 0.5.1-dev.149.1 | 31 | 10/19/2026 |
| 0.5.1-dev.148.1 | 36 | 10/18/2026 |
| 0.5.1-dev.147.1 | 37 | 10/18/2026 |
| 0.5.1-dev.146.1 | 38 | 10/18/2026 |
| 0.5.1-dev.145.1 | 34 | 10/18/2026 |
| 0.5.1-dev.144.1 | 42 | 10/17/2026 |
| 0.5.1-dev.143.1 | 39 | 10/17/2026 |
| 0.5.1-dev.142.1 | 43 | 10/17/2026 |
| 0.5.1-dev.141.1 | 39 | 10/17/2026 |
| 0.5.1-dev.140.1 | 42 | 10/17/2026 |
| 0.5.1-dev.139.1 | 43 | 10/16/2026 |
| 0.4.1-dev.137.1 | 43 | 10/16/2026 |
| 0.4.1-dev.136.1 | 42 | 10/16/2026 |
| 0.4.1-dev.135.1 | 37 | 10/16/2026 |
| 0.4.1-dev.134.1 | 41 | 10/16/2026 |
| 0.4.1-dev.133.1 | 36 | 10/16/2026 |
| 0.4.1-dev.132.1 | 41 | 10/16/2026 |
| 0.4.1-dev.131.1 | 45 | 10/16/2026 |
| 0.4.0 | 78 | 10/14/2026 |