Payload/scripts/harness/harness-session-start.ps1
|
#Requires -Version 5.1 <# .SYNOPSIS Copilot sessionStart hook: inject own-slice-next.json when a turn is already open. .DESCRIPTION Windows PowerShell adapter. Writes additionalContext telling the agent the next harness-invoke command and not to call harness-turn-start. Silent when no next artifact. #> [CmdletBinding()] param( [string]$RepoRoot = '', [string]$FeatureRoot = '' ) Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' Import-Module (Join-Path $PSScriptRoot 'lib\HarnessContract.psm1') -Force if ([string]::IsNullOrWhiteSpace($RepoRoot)) { $RepoRoot = Get-HarnessRepoRoot -StartPath $PSScriptRoot } $ctx = Get-HarnessSessionStartAdditionalContext -RepoRoot $RepoRoot -FeatureRoot $FeatureRoot if ([string]::IsNullOrWhiteSpace($ctx)) { Write-Output '{}' exit 0 } $out = [pscustomobject]@{ additionalContext = $ctx } Write-Output ($out | ConvertTo-Json -Compress) exit 0 |