param( [Parameter(Mandatory = $true)] [string]$RunPath ) Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" if (-not (Test-Path -LiteralPath $RunPath)) { throw "Run path not found: $RunPath" } $manifestPath = Join-Path $RunPath "manifest.json" if (-not (Test-Path -LiteralPath $manifestPath)) { throw "manifest.json not found: $manifestPath" } $manifest = (Get-Content -LiteralPath $manifestPath -Raw) | ConvertFrom-Json $roles = @($manifest.roles) $totalCount = $roles.Count $doneCount = @($roles | Where-Object { $_.status -eq "done" }).Count $blockedCount = @($roles | Where-Object { $_.status -eq "blocked" -or $_.status -eq "rejected" }).Count $inProgressCount = @($roles | Where-Object { $_.status -eq "in_progress" }).Count $completion = 0 if ($totalCount -gt 0) { $completion = [math]::Round(($doneCount / $totalCount) * 100, 2) } $dashboardRows = foreach ($role in $roles) { [pscustomobject]@{ RoleId = $role.id Role = $role.name Type = $role.type Status = $role.status Rule = $role.rule Report = $role.reportPath } } Write-Host "" Write-Host "=== Multi-Agent Dashboard ===" Write-Host "Run ID: $($manifest.runId)" Write-Host "Task: $($manifest.task)" Write-Host "Project: $($manifest.project)" Write-Host "Created At: $($manifest.createdAt)" Write-Host "Updated At: $($manifest.updatedAt)" Write-Host "" Write-Host "Progress: $doneCount/$totalCount ($completion%)" Write-Host "In Progress: $inProgressCount | Blocked/Rejected: $blockedCount" Write-Host "" $dashboardRows | Format-Table -AutoSize $reviewOrder = @($manifest.reviewOrder) $missingReviewRoles = @() foreach ($reviewRoleId in $reviewOrder) { $reviewRole = $roles | Where-Object { $_.id -eq $reviewRoleId } | Select-Object -First 1 if (-not $reviewRole -or $reviewRole.status -ne "done") { $missingReviewRoles += $reviewRoleId } } Write-Host "" if ($blockedCount -gt 0) { Write-Host "State: blocked items exist, resolve blocked/rejected roles first." } elseif ($doneCount -lt $totalCount) { Write-Host "State: running, not fully completed yet." } else { Write-Host "State: all roles completed, ready for final summary." } if ($missingReviewRoles.Count -gt 0) { Write-Host "Review Gate: pending review roles -> $($missingReviewRoles -join ', ')" } else { Write-Host "Review Gate: rule/security/performance reviews are complete." }