feat(conductor): Implement configurable paths and mark track 'Conductor Path Configuration' as complete
This commit is contained in:
@@ -23,8 +23,7 @@ import threading
|
||||
from typing import Any, Optional, TextIO
|
||||
from pathlib import Path
|
||||
|
||||
_LOG_DIR: Path = Path("./logs/sessions")
|
||||
_SCRIPTS_DIR: Path = Path("./scripts/generated")
|
||||
from src import paths
|
||||
|
||||
_ts: str = "" # session timestamp string e.g. "20260301_142233"
|
||||
_session_id: str = "" # YYYYMMDD_HHMMSS[_Label]
|
||||
@@ -55,9 +54,9 @@ def open_session(label: Optional[str] = None) -> None:
|
||||
safe_label = "".join(c if c.isalnum() or c in ("-", "_") else "_" for c in label)
|
||||
_session_id += f"_{safe_label}"
|
||||
|
||||
_session_dir = _LOG_DIR / _session_id
|
||||
_session_dir = paths.get_logs_dir() / _session_id
|
||||
_session_dir.mkdir(parents=True, exist_ok=True)
|
||||
_SCRIPTS_DIR.mkdir(parents=True, exist_ok=True)
|
||||
paths.get_scripts_dir().mkdir(parents=True, exist_ok=True)
|
||||
|
||||
_seq = 0
|
||||
_comms_fh = open(_session_dir / "comms.log", "w", encoding="utf-8", buffering=1)
|
||||
@@ -73,7 +72,7 @@ def open_session(label: Optional[str] = None) -> None:
|
||||
try:
|
||||
from src.log_registry import LogRegistry
|
||||
|
||||
registry = LogRegistry(str(_LOG_DIR / "log_registry.toml"))
|
||||
registry = LogRegistry(str(paths.get_logs_dir() / "log_registry.toml"))
|
||||
registry.register_session(_session_id, str(_session_dir), datetime.datetime.now())
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not register session in LogRegistry: {e}")
|
||||
@@ -82,7 +81,7 @@ def open_session(label: Optional[str] = None) -> None:
|
||||
|
||||
def close_session() -> None:
|
||||
"""Flush and close all log files. Called on clean exit."""
|
||||
global _comms_fh, _tool_fh, _api_fh, _cli_fh, _session_id, _LOG_DIR
|
||||
global _comms_fh, _tool_fh, _api_fh, _cli_fh, _session_id
|
||||
if _comms_fh is None:
|
||||
return
|
||||
|
||||
@@ -102,7 +101,7 @@ def close_session() -> None:
|
||||
try:
|
||||
from src.log_registry import LogRegistry
|
||||
|
||||
registry = LogRegistry(str(_LOG_DIR / "log_registry.toml"))
|
||||
registry = LogRegistry(str(paths.get_logs_dir() / "log_registry.toml"))
|
||||
registry.update_auto_whitelist_status(_session_id)
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not update auto-whitelist on close: {e}")
|
||||
@@ -145,7 +144,7 @@ def log_tool_call(script: str, result: str, script_path: Optional[str]) -> Optio
|
||||
|
||||
ts_entry = datetime.datetime.now().strftime("%H:%M:%S")
|
||||
ps1_name = f"{_ts}_{seq:04d}.ps1"
|
||||
ps1_path: Optional[Path] = _SCRIPTS_DIR / ps1_name
|
||||
ps1_path: Optional[Path] = paths.get_scripts_dir() / ps1_name
|
||||
|
||||
try:
|
||||
if ps1_path:
|
||||
|
||||
Reference in New Issue
Block a user