|
|
@@ -22,11 +22,23 @@ from script_build_host.domain.task_contracts import (
|
|
|
PhaseTwoLimits,
|
|
|
)
|
|
|
|
|
|
+PROJECT_ROOT = Path(__file__).resolve().parents[3]
|
|
|
+_PROJECT_PATH_FIELDS = (
|
|
|
+ "agent_data_root",
|
|
|
+ "persona_root",
|
|
|
+ "section_pattern_root",
|
|
|
+ "decode_index_root",
|
|
|
+ "decode_raw_root",
|
|
|
+ "knowledge_root",
|
|
|
+ "prompt_fallback_root",
|
|
|
+)
|
|
|
+
|
|
|
|
|
|
class ScriptBuildSettings(BaseSettings):
|
|
|
model_config = SettingsConfigDict(
|
|
|
env_prefix="SCRIPT_BUILD_",
|
|
|
- env_file=".env",
|
|
|
+ env_file=PROJECT_ROOT / ".env",
|
|
|
+ env_file_encoding="utf-8",
|
|
|
extra="ignore",
|
|
|
case_sensitive=False,
|
|
|
populate_by_name=True,
|
|
|
@@ -122,6 +134,16 @@ class ScriptBuildSettings(BaseSettings):
|
|
|
)
|
|
|
phase_two_max_repairs_per_trace: int = Field(default=1, ge=1, le=1)
|
|
|
|
|
|
+ @model_validator(mode="after")
|
|
|
+ def resolve_project_paths(self) -> Self:
|
|
|
+ """Resolve portable resource paths from the Script Build project root."""
|
|
|
+
|
|
|
+ for field_name in _PROJECT_PATH_FIELDS:
|
|
|
+ value = getattr(self, field_name)
|
|
|
+ if value is not None and not value.is_absolute():
|
|
|
+ setattr(self, field_name, (PROJECT_ROOT / value).resolve())
|
|
|
+ return self
|
|
|
+
|
|
|
@model_validator(mode="after")
|
|
|
def validate_database_separation(self) -> Self:
|
|
|
read_url = make_url(self.read_database_url.get_secret_value())
|