ScenarioSystem/ScenarioPaths.cscsharp

Documentation

Lilith (Version 3)

Version 3 Lilith agent library. Entry point: Lilith.cs with partials under Boot/, Chat/, Ollama/, and SystemPrompt/.

Build the solution or run python ../Build-v3.py from this tree.

namespace Lilith.Agent.ScenarioSystem;internal static class ScenarioPaths{    // Scenarios are individual XML files named Scenario_<Name>.xml.    // Different build modes place them in different folders, so we probe multiple candidates.    public static string GetLoadDir()    {        string? overrideRoot = Environment.GetEnvironmentVariable("GENESIS_RUNTIME_ROOT");        string? baseDir = !string.IsNullOrWhiteSpace(overrideRoot)            ? overrideRoot            : AppDomain.CurrentDomain.BaseDirectory;        if (string.IsNullOrWhiteSpace(baseDir))            baseDir = ".";        // Common layouts:        // - dev run:            <exe>/backend/load        // - prod build:         <exe>/load        // - shipped source:     <exe>/ShippedSource/Lilith/ScenarioSystem/backend/load        // - shipped source alt: <exe>/ShippedSource/load        var candidates = new[]        {            Path.Combine(baseDir, "load"),            Path.Combine(baseDir, "backend", "load"),            Path.Combine(baseDir, "ShippedSource", "Lilith", "ScenarioSystem", "backend", "load"),            Path.Combine(baseDir, "ShippedSource", "load"),        };        foreach (var dir in candidates)        {            if (Directory.Exists(dir))                return dir;        }        // Default to the most "production-like" location.        return Path.Combine(baseDir, "load");    }    public static string ScenarioFilePath(string scenarioName)    {        string safe = scenarioName.Trim();        if (!safe.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))            safe += ".xml";        if (!safe.StartsWith("Scenario_", StringComparison.OrdinalIgnoreCase))            safe = "Scenario_" + safe;        return Path.Combine(GetLoadDir(), safe);    }}