diff options
| author | tanaka takashi <isazaka@gmail.com> | 2026-08-09 21:08:20 +0900 |
|---|---|---|
| committer | tanaka takashi <isazaka@gmail.com> | 2026-08-09 21:08:20 +0900 |
| commit | b07b41cd435991cd254957af79055080c85b346e (patch) | |
| tree | 27720d3ce14e4d0b84670a55ac26a2f877ce3a20 /tests/Agent.Core.Tests/ConfigurationTests.cs | |
| parent | 2fefd29e86c3b926d0cf4a362251d3f119688612 (diff) | |
feat: AI Agent Sandbox MCP Server v1を実装
Specifications、Design、ImplementationPlanの優先順位を整理し、単一Task実行モデル、typed option優先、設定可能なresource上限、local Ollamaを必須とするRelease Gateを文書化。
.NET 10/C# 14の5 production project、3 test project、E2E Clientを構築。typed YAML、en/ja locale、fixed/user prompt、stdioおよびloopback限定Streamable HTTP、agent_run/agent_status、Session、Ollama text/tool/Vision、TaskGraphとtoken accountingを実装。
Windows sandboxとしてfixed AppContainer、canonical/reparse検査、能力別ACL、path+SHA-256 executable approval、child-process restriction、Job Object、task journal、atomic file transaction、crash recoveryを実装。WFPのIPv4/IPv6 default denyとexact allow、dynamic session、temporary loopback exemption、管理者/BFE診断を追加。
Security/Recovery test、MCP/Ollama integration test、stdio/HTTP Operational E2E、Release Bundle生成・checksum・manifest・fresh extraction検査を追加。Requirement TraceabilityとPhase 0〜11の進捗、初回セットアップ可能なREADMEを整備。
Debug/Release/publish/objをrepository rootのbuild/へ集約し、旧project-local bin/objへの依存を除去。artifacts/とbuild/をGit管理外に設定し、clean checkoutでもsolution buildからE2E Clientまで生成可能にした。
Diffstat (limited to 'tests/Agent.Core.Tests/ConfigurationTests.cs')
| -rw-r--r-- | tests/Agent.Core.Tests/ConfigurationTests.cs | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/Agent.Core.Tests/ConfigurationTests.cs b/tests/Agent.Core.Tests/ConfigurationTests.cs new file mode 100644 index 0000000..7ef4afb --- /dev/null +++ b/tests/Agent.Core.Tests/ConfigurationTests.cs @@ -0,0 +1,66 @@ +using Agent.App.Cli; +using Agent.App.Configuration; + +namespace Agent.Core.Tests; + +public sealed class ConfigurationTests +{ + [Fact] + public void ValidYamlLoadsTypedConfiguration() + { + using var directory = new TestDirectory(); + string config = CreateValidConfiguration(directory); + AgentConfiguration result = ConfigurationLoader.Load(config); + Assert.Equal(1, result.SchemaVersion); + Assert.Equal("model", result.Ollama.Model); + Assert.Equal("deny", result.Sandbox.Network.Mode); + } + + [Fact] + public void UnknownYamlPropertyIsFatal() + { + using var directory = new TestDirectory(); + string config = CreateValidConfiguration(directory); + System.IO.File.AppendAllText(config, "unknown_root: true\n"); + Assert.Throws<ConfigurationException>(() => ConfigurationLoader.Load(config)); + } + + [Fact] + public void InvalidSchemaIsFatal() + { + using var directory = new TestDirectory(); + string config = CreateValidConfiguration(directory); + System.IO.File.WriteAllText(config, System.IO.File.ReadAllText(config).Replace("schema_version: 1", "schema_version: 2", StringComparison.Ordinal)); + Assert.Throws<ConfigurationException>(() => ConfigurationLoader.Load(config)); + } + + [Fact] + public void CommandLineLanguageOverrideIsCaptured() + { + CommandLine result = CommandLine.Parse(["serve", "--lang", "ja", "--transport", "http"]); + Assert.Equal("ja", result.Language); + Assert.Equal("http", result.Transport); + } + + private static string CreateValidConfiguration(TestDirectory directory) + { + directory.File("prompts/user-system.md", string.Empty); + Directory.CreateDirectory(System.IO.Path.Combine(directory.Path, "config/locales")); + Directory.CreateDirectory(System.IO.Path.Combine(directory.Path, "skills")); + return directory.File("agent.yaml", """ + schema_version: 1 + application: + language: en + agent: + user_system_prompt: prompts/user-system.md + ollama: + endpoint: http://127.0.0.1:11434 + model: model + localization: + directory: config/locales + fallback: en + skills: + directory: skills + """); + } +} |
