HagiCode.Libs.Core
0.2.5-dev.74.1
dotnet add package HagiCode.Libs.Core --version 0.2.5-dev.74.1
NuGet\Install-Package HagiCode.Libs.Core -Version 0.2.5-dev.74.1
<PackageReference Include="HagiCode.Libs.Core" Version="0.2.5-dev.74.1" />
<PackageVersion Include="HagiCode.Libs.Core" Version="0.2.5-dev.74.1" />
<PackageReference Include="HagiCode.Libs.Core" />
paket add HagiCode.Libs.Core --version 0.2.5-dev.74.1
#r "nuget: HagiCode.Libs.Core, 0.2.5-dev.74.1"
#:package HagiCode.Libs.Core@0.2.5-dev.74.1
#addin nuget:?package=HagiCode.Libs.Core&version=0.2.5-dev.74.1&prerelease
#tool nuget:?package=HagiCode.Libs.Core&version=0.2.5-dev.74.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
- 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.
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.Logging.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Options (>= 10.0.2)
NuGet packages (1)
Showing the top 1 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, and QoderCLI. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.5-dev.74.1 | 38 | 5/21/2026 |
| 0.2.5-dev.72.1 | 59 | 5/18/2026 |
| 0.2.4 | 100 | 5/5/2026 |
| 0.2.4-dev.70.1 | 50 | 5/2/2026 |
| 0.2.4-dev.69.1 | 48 | 5/1/2026 |
| 0.2.4-dev.68.1 | 53 | 4/30/2026 |
| 0.2.4-dev.67.1 | 50 | 4/30/2026 |
| 0.2.4-dev.65.1 | 58 | 4/29/2026 |
| 0.2.4-dev.64.1 | 52 | 4/26/2026 |
| 0.2.4-dev.63.1 | 51 | 4/23/2026 |
| 0.2.4-dev.62.1 | 72 | 4/21/2026 |
| 0.2.4-dev.61.1 | 58 | 4/20/2026 |
| 0.2.4-dev.60.1 | 54 | 4/19/2026 |
| 0.2.4-dev.59.1 | 57 | 4/19/2026 |
| 0.2.3 | 100 | 4/18/2026 |
| 0.2.3-dev.57.1 | 57 | 4/17/2026 |
| 0.2.3-dev.56.1 | 53 | 4/16/2026 |
| 0.2.3-dev.55.1 | 49 | 4/15/2026 |
| 0.2.3-dev.54.1 | 51 | 4/15/2026 |
| 0.2.3-dev.53.1 | 61 | 4/14/2026 |