summaryrefslogtreecommitdiff
path: root/src/Agent.App
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-08-11 21:53:57 +0900
committertanaka takashi <isazaka@gmail.com>2026-08-11 21:53:57 +0900
commit7c9794f8d4d05074b96bb525d19db4ee1f6b3e95 (patch)
treecb8961ee170d9f6874513e8b1a99b06855bb0707 /src/Agent.App
parent6c3458a5ec37a5b69957ad17c84de58984698f25 (diff)
Complete runtime diagnostics and verification coverage
Diffstat (limited to 'src/Agent.App')
-rw-r--r--src/Agent.App/Agent.App.csproj3
-rw-r--r--src/Agent.App/Program.cs28
2 files changed, 29 insertions, 2 deletions
diff --git a/src/Agent.App/Agent.App.csproj b/src/Agent.App/Agent.App.csproj
index 4059624..17b7bc9 100644
--- a/src/Agent.App/Agent.App.csproj
+++ b/src/Agent.App/Agent.App.csproj
@@ -11,6 +11,9 @@
<ProjectReference Include="..\Agent.Windows\Agent.Windows.csproj" />
</ItemGroup>
<ItemGroup>
+ <InternalsVisibleTo Include="Agent.Core.Tests" />
+ </ItemGroup>
+ <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="YamlDotNet" />
</ItemGroup>
diff --git a/src/Agent.App/Program.cs b/src/Agent.App/Program.cs
index 6f3485f..3d2d2db 100644
--- a/src/Agent.App/Program.cs
+++ b/src/Agent.App/Program.cs
@@ -110,7 +110,7 @@ internal static class Program
}
catch (Exception ex) when (ex is CommandLineException or ConfigurationException or LocaleException or IOException or UnauthorizedAccessException)
{
- Console.Error.WriteLine($"agent-mcp: {ex.Message}");
+ Console.Error.WriteLine($"agent-mcp: {FormatStartupError(args, ex)}");
return 2;
}
catch (Exception ex) when (ex is not (OutOfMemoryException or StackOverflowException or AccessViolationException))
@@ -120,6 +120,30 @@ internal static class Program
}
}
+ internal static string FormatStartupError(string[] args, Exception error)
+ {
+ string language = "en";
+ for (int i = 0; i + 1 < args.Length; i++)
+ if (args[i] == "--lang") language = args[i + 1];
+ try
+ {
+ string directory = Path.Combine(AppContext.BaseDirectory, "config", "locales");
+ LocaleCatalog locale = LocaleCatalog.Load(directory, language, "en");
+ string key = error switch
+ {
+ CommandLineException => "cli.invalid",
+ ConfigurationException => "config.invalid",
+ LocaleException => "locale.invalid",
+ _ => "app.io_error"
+ };
+ return locale.Format(key, new Dictionary<string, object?> { ["message"] = error.Message });
+ }
+ catch
+ {
+ return error.Message;
+ }
+ }
+
private static InternalToolDispatcher CreateToolDispatcher(AgentConfiguration configuration, string baseDirectory, string logDirectory, SessionStore? sessionStore = null)
{
string stateDirectory = Path.Combine(baseDirectory, "state");
@@ -155,7 +179,7 @@ internal static class Program
}
}
- private static AgentRuntimeSettings CreateRuntimeSettings(AgentConfiguration configuration, string userPrompt, string language,
+ internal static AgentRuntimeSettings CreateRuntimeSettings(AgentConfiguration configuration, string userPrompt, string language,
IReadOnlyList<Agent.Core.Skills.AgentSkill> skills, LocaleCatalog locale) => new(
userPrompt,
language,