private/StatusPanel.ps1

# FR-024: live activity feed during dry-run scanning and apply, printed as normal scrolling
# terminal output.
#
# ponytail: this used to be a fixed 4-line block pinned to the bottom of the console, overwritten
# in place, keeping only the 2 most-recent events on screen. Real user feedback: applying several
# actions in one category wiped each earlier "[aplicando] X" line the moment the next action
# started, even though nothing else had happened yet - if you looked away for a second you lost
# the record of what already ran, with no way to scroll back and check. Plain sequential output
# keeps the whole history on screen (and in the terminal's own scrollback) for as long as this
# screen is up, which is what was actually wanted - Show-OctaFrame already handles clearing it
# once the user moves on to a new screen, so nothing here needs to self-erase.

function Test-OctaInteractiveConsole {
    <#
        ponytail: output-redirection alone isn't enough - a PS Direct/WinRM remoting host
        (Invoke-Command -VMName, a scheduled task) reports output as NOT redirected (Write-Host
        works fine there) but has no real keyboard behind it, so a ReadKey-based menu just hangs
        forever instead of throwing. [Environment]::UserInteractive and IsInputRedirected catch
        that case: both are false in a non-interactive window station (services, remoting hosts).
    #>

    try {
        return (
            [Environment]::UserInteractive -and
            $null -ne $Host.UI.RawUI -and
            -not [Console]::IsOutputRedirected -and
            -not [Console]::IsInputRedirected
        )
    }
    catch {
        return $false
    }
}

function Initialize-OctaActivityPanel {
    <# Kept as a no-op so existing call sites (Invoke-OctaCategory) don't need to change - the
       bracketing Initialize/Complete pair no longer does anything, since Write-OctaActivity now
       just prints normally. #>

    [CmdletBinding()]
    param()
}

function Write-OctaActivity {
    [CmdletBinding()]
    param([Parameter(Mandatory)][string]$Message)
    Write-Host $Message
}

function Complete-OctaActivityPanel {
    [CmdletBinding()]
    param()
}