feat(*): 添加 ConfigRoot 运行时配置目录隔离

* 新增 ControllerClientCompatOptions.ConfigRoot 及解析方法
* 兼容层默认从运行目录 Config 加载模型、轨迹和配置
* 移除隐式父工作区根目录推断,旧路径仅在显式配置时生效
* Host 项目编译时将 Config 目录复制到输出目录
* 请求响应日志中间件忽略 /api/status/snapshot 高频轮询
* 补充 ConfigRoot 和日志过滤相关单元测试
This commit is contained in:
2026-04-29 18:27:03 +08:00
parent c38faddbf0
commit a6579f1e5b
16 changed files with 451 additions and 143 deletions

View File

@@ -11,7 +11,36 @@ public sealed class ControllerClientCompatOptions
public string ServerVersion { get; set; } = "flyshot-replacement-controller-client-compat/0.1.0";
/// <summary>
/// 获取或设置父工作区根目录;为空时由运行时自动推断
/// 获取或设置运行配置根目录;为空时默认使用程序基目录下的 Config
/// </summary>
public string? ConfigRoot { get; set; }
/// <summary>
/// 获取或设置旧父工作区根目录;仅用于测试或旧样本显式兼容。
/// </summary>
public string? WorkspaceRoot { get; set; }
/// <summary>
/// 解析运行配置根目录,确保运行时默认不再依赖源码仓库位置。
/// </summary>
/// <returns>运行配置根目录的绝对路径。</returns>
public string ResolveConfigRoot()
{
var root = string.IsNullOrWhiteSpace(ConfigRoot)
? Path.Combine(AppContext.BaseDirectory, "Config")
: ConfigRoot;
return Path.GetFullPath(root);
}
/// <summary>
/// 解析显式配置的旧父工作区根目录;未配置时返回 null。
/// </summary>
/// <returns>旧父工作区根目录的绝对路径,或 null。</returns>
public string? ResolveLegacyWorkspaceRoot()
{
return string.IsNullOrWhiteSpace(WorkspaceRoot)
? null
: Path.GetFullPath(WorkspaceRoot);
}
}