feat: unify runtime logging (rotating files, log root, scripts, desktop)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-14 10:11:51 +08:00
parent 86d4bad107
commit 1490bd5f24
25 changed files with 541 additions and 53 deletions

View file

@ -0,0 +1,23 @@
# Shared: resolve the same directory as Python ``assistant_runtime_log_dir()`` / ``AIA_RUNTIME_LOG_DIR``.
function Get-OclawRuntimeLogDir {
param(
[Parameter(Mandatory = $true)][string]$RepoRoot
)
$venvPython = Join-Path $RepoRoot ".venv\Scripts\python.exe"
$pythonExe = if (Test-Path $venvPython) { $venvPython } else { "python" }
$savedPyPath = $env:PYTHONPATH
$env:PYTHONPATH = $RepoRoot
$dir = $null
try {
$dir = (& $pythonExe -c "from runtime.operations.runtime import assistant_runtime_log_dir; print(str(assistant_runtime_log_dir()))" 2>$null | Select-Object -Last 1).Trim()
} catch { }
if ($null -ne $savedPyPath) {
$env:PYTHONPATH = $savedPyPath
} else {
Remove-Item Env:PYTHONPATH -ErrorAction SilentlyContinue
}
if (-not $dir) {
$dir = Join-Path $RepoRoot "data\logs"
}
return $dir
}