Private/AI/Invoke-TechAgent.PromptAndLogging.ps1
|
function Resolve-TTAgentExecutionMode { [CmdletBinding()] param( [string]$ModeFromParam, $ConfigObject, [bool]$ParamWasBound ) if ($ParamWasBound -and -not [string]::IsNullOrWhiteSpace($ModeFromParam)) { $normalizedMode = $ModeFromParam.Trim().ToLowerInvariant() if ($normalizedMode -eq 'chat') { Write-Warning "`nInvoke-TechAgent: Execution mode 'chat' is deprecated and maps to 'analyze'." return 'analyze' } return $normalizedMode } $configMode = $null if ($null -ne $ConfigObject) { $modeProperty = $ConfigObject.PSObject.Properties['executionMode'] if ($null -ne $modeProperty -and -not [string]::IsNullOrWhiteSpace([string]$modeProperty.Value)) { $configMode = [string]$modeProperty.Value } } if ([string]::IsNullOrWhiteSpace($configMode)) { return 'execute' } switch ($configMode.Trim().ToLowerInvariant()) { 'execute' { return 'execute' } 'plan' { return 'plan' } 'analyze' { return 'analyze' } 'chat' { Write-Warning "`nInvoke-TechAgent: Config executionMode 'chat' is deprecated and maps to 'analyze'." return 'analyze' } default { return 'execute' } } } function Resolve-TTAgentOutputContract { [CmdletBinding()] param( [string]$ContractFromParam, $ConfigObject, [bool]$ParamWasBound ) if ($ParamWasBound -and -not [string]::IsNullOrWhiteSpace($ContractFromParam)) { return $ContractFromParam.Trim().ToLowerInvariant() } $configContract = $null if ($null -ne $ConfigObject) { $contractProperty = $ConfigObject.PSObject.Properties['outputContract'] if ($null -ne $contractProperty -and -not [string]::IsNullOrWhiteSpace([string]$contractProperty.Value)) { $configContract = [string]$contractProperty.Value } } if ([string]::IsNullOrWhiteSpace($configContract)) { return 'markdown' } switch ($configContract.Trim().ToLowerInvariant()) { 'plain-text' { return 'plain-text' } 'json' { return 'json' } default { return 'markdown' } } } function Remove-TTAgentDuplicateMarkdownHeadings { [CmdletBinding()] param( [string]$Markdown, [int]$WindowLines = 40 ) if ([string]::IsNullOrWhiteSpace($Markdown)) { return $Markdown } if ($WindowLines -lt 1) { $WindowLines = 1 } $normalized = ($Markdown -replace "`r`n", "`n") -replace "`r", "`n" $lines = $normalized.Split("`n") $headingPattern = '^\s*(#{1,6})\s+(.+?)\s*$' $lastSeenByHeading = [System.Collections.Generic.Dictionary[string, int]]::new([System.StringComparer]::OrdinalIgnoreCase) $keptLines = [System.Collections.Generic.List[string]]::new() for ($i = 0; $i -lt $lines.Count; $i++) { $line = [string]$lines[$i] $match = [regex]::Match($line, $headingPattern) if (-not $match.Success) { $keptLines.Add($line) continue } $level = $match.Groups[1].Value.Length $headingText = $match.Groups[2].Value.Trim() if ([string]::IsNullOrWhiteSpace($headingText)) { $keptLines.Add($line) continue } $key = ('{0}|{1}' -f $level, $headingText) [int]$lastSeenLine = 0 if ($lastSeenByHeading.TryGetValue($key, [ref]$lastSeenLine)) { if (($i - $lastSeenLine) -le $WindowLines) { $lastSeenByHeading[$key] = $i continue } } $lastSeenByHeading[$key] = $i $keptLines.Add($line) } return ($keptLines -join "`n").TrimEnd() } function Remove-TTAgentAdjacentDuplicateLines { [CmdletBinding()] param( [string]$Text, [int]$MinimumLineLength = 24 ) if ([string]::IsNullOrWhiteSpace($Text)) { return $Text } if ($MinimumLineLength -lt 1) { $MinimumLineLength = 1 } $normalized = ($Text -replace "`r`n", "`n") -replace "`r", "`n" $lines = $normalized.Split("`n") $keptLines = [System.Collections.Generic.List[string]]::new() $previousComparable = $null foreach ($line in $lines) { $comparable = [string]$line if ($null -ne $comparable) { $comparable = $comparable.Trim() } $isDuplicate = $false if (-not [string]::IsNullOrWhiteSpace($comparable) -and $comparable.Length -ge $MinimumLineLength -and -not [string]::IsNullOrWhiteSpace($previousComparable)) { $isDuplicate = [string]::Equals($comparable, $previousComparable, [System.StringComparison]::Ordinal) } if (-not $isDuplicate) { $keptLines.Add([string]$line) } if ([string]::IsNullOrWhiteSpace($comparable)) { $previousComparable = $null } else { $previousComparable = $comparable } } return ($keptLines -join "`n").TrimEnd() } function Resolve-TTAgentQualityProfile { [CmdletBinding()] param( [string]$ProfileFromParam, $ConfigObject, [bool]$ParamWasBound ) if ($ParamWasBound -and -not [string]::IsNullOrWhiteSpace($ProfileFromParam)) { return $ProfileFromParam.Trim().ToLowerInvariant() } $configProfile = $null if ($null -ne $ConfigObject) { $profileProperty = $ConfigObject.PSObject.Properties['qualityProfile'] if ($null -ne $profileProperty -and -not [string]::IsNullOrWhiteSpace([string]$profileProperty.Value)) { $configProfile = [string]$profileProperty.Value } } if ([string]::IsNullOrWhiteSpace($configProfile)) { return 'balanced' } switch ($configProfile.Trim().ToLowerInvariant()) { 'precise' { return 'precise' } 'creative' { return 'creative' } default { return 'balanced' } } } function Invoke-TTAgentPromptPreflight { [CmdletBinding()] param( [string]$PromptText, [string]$Mode ) $score = 0 $warnings = [System.Collections.Generic.List[string]]::new() $critical = [System.Collections.Generic.List[string]]::new() if ([string]::IsNullOrWhiteSpace($PromptText)) { $critical.Add('Prompt is empty.') return [ordered]@{ Score = 0; Warnings = @($warnings); Critical = @($critical) } } $normalizedPrompt = $PromptText.Trim() $hasTaskVerb = [regex]::IsMatch( $normalizedPrompt, '(?i)\b(create|write|update|edit|modify|fix|analy[sz]e|review|refactor|investigate|research|summari[sz]e|plan|implement|find|fetch|get|retrieve|collect|report|check|show|tell|lookup|look\s+up|print|disable|enable|reset|remove|delete|provision|deprovision|offboard)\b') if ($hasTaskVerb) { $score += 20 } else { $warnings.Add('Missing clear task verb (for example: update, analyze, fix, plan).') } $hasMutationVerb = [regex]::IsMatch( $normalizedPrompt, '(?i)\b(create|write|update|edit|modify|fix|disable|enable|reset|remove|delete|provision|deprovision|offboard|install|uninstall|rename|move|copy|save|upload|download|patch|apply)\b') $hasPathOrSystemTarget = [regex]::IsMatch( $normalizedPrompt, '(?i)([A-Za-z]:\\[^\r\n]+|\b(file|function|class|module|script|command|service|endpoint|api|workflow|active\s*directory|ad\b|account|user|computer|group|ou|organizational\s+unit|exchange\s*online|entra|azure\s*ad)\b)') $hasWebTarget = [regex]::IsMatch( $normalizedPrompt, '(?i)(https?://\S+|\b(url|uri|website|web\s*site|webpage|site|domain|host|weather\.gov)\b)') $hasReadOnlyResearchIntent = [regex]::IsMatch( $normalizedPrompt, '(?i)\b(research|lookup|look\s+up|search|find|fetch|get|retrieve|check|review|inspect|summari[sz]e|report|show|tell|collect)\b') $hasReadOnlyResearchTarget = [regex]::IsMatch( $normalizedPrompt, '(?i)\b(official|schedule|roster|player|team|standing|game|event|news|forecast|weather|report|status|service|document|site|website|webpage|conference|calendar|season)\b') $isWeatherIntent = [regex]::IsMatch( $normalizedPrompt, '(?i)\b(weather|forecast|temperature|precipitation|wind|noaa)\b') $hasWeatherLocationTarget = [regex]::IsMatch( $normalizedPrompt, '(?i)((?<!\d)\d{5}(?:-\d{4})?(?!\d)|\b[A-Za-z][A-Za-z\-''\.\s]+,\s*[A-Za-z][A-Za-z\-''\.\s]+\b)') $hasWeatherLocationPhrase = [regex]::IsMatch( $normalizedPrompt, '(?i)\b(?:for|in|at|near)\s+[A-Za-z][A-Za-z0-9''.,/-]*(?:\s+[A-Za-z0-9''.,/-]+){0,6}(?=\s+(?:from|on|using|with|and|return|output|show|summari[sz]e|today|tomorrow|next|this|tonight|weekend)\b|[.?!]|$)') $hasReadOnlyResearchTargetPhrase = $hasReadOnlyResearchIntent -and $hasReadOnlyResearchTarget -and -not $hasMutationVerb $hasConcreteTarget = $hasPathOrSystemTarget -or $hasWebTarget -or $hasReadOnlyResearchTargetPhrase -or ($isWeatherIntent -and ($hasWeatherLocationTarget -or $hasWeatherLocationPhrase)) if ($hasConcreteTarget) { $score += 20 } else { $warnings.Add('Missing concrete target (file, function, module, system, URL, website, or path).') } $hasExpectedOutcome = [regex]::IsMatch( $normalizedPrompt, '(?i)\b(expected|outcome|output|result|return|produce|final|success\b|done\b|summary|print|display|console|markdown|output\s+to\s+console)') if ($hasExpectedOutcome) { $score += 20 } else { $warnings.Add('Missing expected outcome details (what successful output should look like).') } $hasConstraints = [regex]::IsMatch( $normalizedPrompt, '(?i)\b(must|should|do not|don''t|avoid|constraint|format|style|security|strict|exact path|preserve|no edits|markdown|plain[ -]?text|json|yaml|csv|console|terminal|brief|concise|detailed)\b') if ($hasConstraints) { $score += 20 } else { $warnings.Add('Missing explicit constraints or preferences (style, safety, formatting, scope).') } if ($normalizedPrompt.Length -ge 80) { $score += 20 } else { $warnings.Add('Prompt is short; add context (environment, errors, affected behavior).') } if ($normalizedPrompt.Length -lt 25) { $critical.Add('Prompt is too short for reliable execution.') } if ($Mode -eq 'execute' -and -not $hasConcreteTarget) { $critical.Add('Execution mode requires a concrete target to avoid ambiguous changes.') } if ($Mode -eq 'execute' -and -not $hasExpectedOutcome) { $critical.Add('Execution mode requires expected outcome details.') } return [ordered]@{ Score = $score Warnings = @($warnings) Critical = @($critical) } } function New-TTAgentAutoPromptHint { [CmdletBinding()] param( [string]$PromptText, [string]$Mode, [string]$OutputContract, [int]$WarningCount, [int]$CriticalCount ) if ([string]::IsNullOrWhiteSpace($PromptText)) { return $null } if ($WarningCount -le 0 -and $CriticalCount -le 0) { return $null } $normalized = $PromptText.Trim() $taskVerbMatch = [regex]::Match( $normalized, '(?i)\b(create|write|update|edit|modify|fix|analy[sz]e|review|refactor|investigate|summari[sz]e|plan|implement|find|fetch|get|retrieve|collect|report)\b') $taskVerb = if ($taskVerbMatch.Success) { $taskVerbMatch.Value } elseif ([regex]::IsMatch($normalized, '(?i)\b(weather|forecast)\b')) { 'fetch' } else { 'analyze' } $urlMatch = [regex]::Match($normalized, '(?i)https?://\S+') $pathMatch = [regex]::Match($normalized, '(?i)[A-Za-z]:\\[^\s"''`\r\n]+') $locationMatch = [regex]::Match( $normalized, '(?i)\b(?:for|in|at|near)\s+(?<location>[A-Za-z][A-Za-z0-9''.,/-]*(?:\s+[A-Za-z0-9''.,/-]+){0,6})(?=\s+(?:from|on|using|with|and|return|output|show|summarize|today|tomorrow|next)\b|$)' ) $targetHint = if ($urlMatch.Success) { "the data from $($urlMatch.Value)" } elseif ($pathMatch.Success) { "the file at $($pathMatch.Value)" } elseif ($locationMatch.Success) { $locationName = $locationMatch.Groups['location'].Value.Trim().TrimEnd(',', '.') "the weather forecast for $locationName using the official NOAA API (api.weather.gov)" } elseif ([regex]::IsMatch($normalized, '(?i)\bweather\b')) { 'the weather forecast for the specified location using the official NOAA API (api.weather.gov)' } else { 'the specific file, service, module, or URL' } $sourceHint = if ($urlMatch.Success) { "Use $($urlMatch.Value) as the primary source." } elseif ([regex]::IsMatch($normalized, '(?i)\b(website|web\s*site|webpage|url|uri|domain|host|web)\b')) { 'Use the specified website or URL as the primary source.' } else { 'Use only the minimum required tools and keep the scope bounded.' } $contractHint = switch ($OutputContract) { 'json' { 'Return valid JSON object or array text only.' } 'plain-text' { 'Return plain text only (no markdown).' } default { 'Return the final answer in markdown.' } } $modeConstraint = if ($Mode -eq 'execute') { 'Constraints: execute only bounded steps and avoid unrelated changes.' } else { "Constraints: respect mode '$Mode'." } return ( '{0} {1}. {2} {3} {4}' -f $taskVerb, $targetHint, $sourceHint, $contractHint, $modeConstraint ) } function Test-TTAgentPostflightGoal { [CmdletBinding()] param( [string]$PromptText, [string]$ResponseText, [int]$PreflightScore ) if ([string]::IsNullOrWhiteSpace($PromptText)) { return @{ Achieved = $false; Reason = 'Prompt was empty.' } } if ([string]::IsNullOrWhiteSpace($ResponseText)) { return @{ Achieved = $false; Reason = 'No response text was produced.' } } $promptLower = $PromptText.Trim().ToLowerInvariant() $responseLower = $ResponseText.Trim().ToLowerInvariant() $hasCompletionSignal = ( [regex]::IsMatch($responseLower, '(?im)^\s*##\s*result\b') -or [regex]::IsMatch($responseLower, '(?im)^\s*(created|updated|wrote)\s+file\s*:') -or [regex]::IsMatch($responseLower, '(?is)```(?:powershell|pwsh)?\s*.+?```') -or $responseLower.Contains('script contents') -or $responseLower.Contains('successfully') ) $hasUncertaintySignal = [regex]::IsMatch( $responseLower, '(?i)(\bi need more (?:detail|information)\b|\bclarification needed\b|\bnot enough information\b|\bi (?:am|''m) unable to\b|\bi could not\b|\bi cannot\b|\bi can''t\b|\bplease provide\b|\brequire (?:more|additional) (?:details|information)\b)' ) if ($hasUncertaintySignal -and -not $hasCompletionSignal) { return @{ Achieved = $false; Reason = 'The response requested more clarification or reported inability to complete the task.' } } if ($PreflightScore -lt 60 -and $ResponseText.Trim().Length -lt 80) { return @{ Achieved = $false; Reason = 'The response was too short to clearly satisfy the prompt.' } } if ($promptLower.Contains('weather') -or $promptLower.Contains('forecast')) { $weatherTerms = @('weather', 'forecast', 'temperature', 'humidity', 'wind', 'rain', 'conditions', 'precipitation') $hasWeatherResponseSignal = $false foreach ($term in $weatherTerms) { if ($responseLower.Contains($term)) { $hasWeatherResponseSignal = $true break } } if (-not $hasWeatherResponseSignal) { return @{ Achieved = $false; Reason = 'The response did not include weather or forecast information.' } } } $isPowerShellScriptPrompt = ( ($promptLower.Contains('powershell') -or $promptLower.Contains('.ps1')) -and $promptLower.Contains('script') ) if ($isPowerShellScriptPrompt) { $responseFenceCount = [regex]::Matches($ResponseText, '```').Count if (($responseFenceCount % 2) -ne 0) { return @{ Achieved = $false; Reason = 'The response appears to contain an unclosed markdown code fence.' } } $codeBlockMatch = [regex]::Match($ResponseText, '(?is)```(?:powershell|pwsh)?\s*(?<code>.*?)```') $candidateCode = if ($codeBlockMatch.Success) { $codeBlockMatch.Groups['code'].Value } else { $ResponseText } if (($promptLower.Contains('stand alone') -or $promptLower.Contains('standalone') -or $promptLower.Contains('no external helper')) -and $candidateCode -match '(?im)^\s*write-comment\b') { return @{ Achieved = $false; Reason = 'The script references external helper commands (Write-Comment), which violates standalone/no-helper intent.' } } if ($promptLower.Contains('syntactically correct')) { $openBraceCount = [regex]::Matches($candidateCode, '\{').Count $closeBraceCount = [regex]::Matches($candidateCode, '\}').Count if ($openBraceCount -ne $closeBraceCount) { return @{ Achieved = $false; Reason = 'The script output appears structurally incomplete (mismatched braces).' } } $openParenCount = [regex]::Matches($candidateCode, '\(').Count $closeParenCount = [regex]::Matches($candidateCode, '\)').Count if ($openParenCount -ne $closeParenCount) { return @{ Achieved = $false; Reason = 'The script output appears structurally incomplete (mismatched parentheses).' } } } } return @{ Achieved = $true; Reason = '' } } function Expand-TTAgentOptionZipFollowUpPrompt { [CmdletBinding()] param( [string]$PromptText, [string]$Mode ) if ([string]::IsNullOrWhiteSpace($PromptText)) { return $PromptText } if ($Mode -ne 'execute') { return $PromptText } $trimmed = $PromptText.Trim() $zipOnlyMatch = [regex]::Match( $trimmed, '(?i)^(?:option\s*)?b\s*[:\-]?\s*(?<zip>\d{5}(?:-\d{4})?)\s*$' ) if (-not $zipOnlyMatch.Success) { return $PromptText } $zip = $zipOnlyMatch.Groups['zip'].Value return ( "Continue the pending weather forecast task using alternate location ZIP code $zip. " + "Call GET-NOAA-FORECAST with zipCode='$zip' and include Friday through Sunday night periods. " + 'Return the final answer in markdown. Constraints: execute only bounded steps and avoid unrelated changes.' ) } function Resolve-TTAgentExpectedOutputPath { [CmdletBinding()] param( [string]$PromptText ) $trimDetectedPath = { param([string]$CandidatePath) if ([string]::IsNullOrWhiteSpace($CandidatePath)) { return $null } $trimmed = $CandidatePath.Trim().TrimEnd('.', ',', ';', ':', ')', ']', '}') if ([string]::IsNullOrWhiteSpace($trimmed)) { return $null } return $trimmed } $normalizeWildcardDirectoryPath = { param([string]$CandidatePath) if ([string]::IsNullOrWhiteSpace($CandidatePath)) { return $null } $match = [regex]::Match( $CandidatePath, '(?is)^(?<dir>[A-Za-z]:\\.*?)(?:\\|/)?\*(?:\\|/)?(?<name>[^\\/:*?<>|]+?\.[A-Za-z0-9]{1,16})$') if (-not $match.Success) { return $null } $targetDirectory = $match.Groups['dir'].Value.Trim().TrimEnd('\', '/') $fileName = $match.Groups['name'].Value.Trim().Trim('"', "'", '`') if ([string]::IsNullOrWhiteSpace($targetDirectory) -or [string]::IsNullOrWhiteSpace($fileName)) { return $null } return (Join-Path -Path $targetDirectory.TrimEnd('\', '/') -ChildPath $fileName) } $tryNormalizeDirectoryAndNamedFileInstruction = { param([string]$CandidatePath) if ([string]::IsNullOrWhiteSpace($CandidatePath)) { return $null } $match = [regex]::Match( $CandidatePath, '(?is)^(?<dir>[A-Za-z]:\\[^\r\n]*?)\s+and\s+(?:name\s+(?:it|the\s+file|the\s+script\s+file|script\s+file)|call\s+(?:it|the\s+file|the\s+script\s+file|script\s+file)|file\s+should\s+be\s+named|named)\s+["'']?(?<name>[^\s"''`\\/:*?<>|]+?\.[A-Za-z0-9]{1,16})\b') if (-not $match.Success) { return $null } $targetDirectory = $match.Groups['dir'].Value.Trim().TrimEnd('.', ',', ';', ':', ')', ']', '}') $fileName = $match.Groups['name'].Value.Trim().Trim('"', "'").TrimEnd('.', ',', ';', ':', ')', ']', '}') if ([string]::IsNullOrWhiteSpace($targetDirectory) -or [string]::IsNullOrWhiteSpace($fileName)) { return $null } $normalizedDirectory = $targetDirectory.TrimEnd('\', '/') if ([string]::IsNullOrWhiteSpace($normalizedDirectory)) { return $null } return (Join-Path -Path $normalizedDirectory -ChildPath $fileName) } $promptIndicatesWriteIntent = { param([string]$Text) if ([string]::IsNullOrWhiteSpace($Text)) { return $false } return [regex]::IsMatch( $Text, '(?is)\b(write|rewrite|update|edit|modify|insert|create)\b|\buse\s+write(?:-|=|\s*)file\b|\bwrite(?:-|=|\s*)file\b') } if ([string]::IsNullOrWhiteSpace($PromptText)) { return $null } # Prefer deterministic directory-plus-name parsing so sentence prose cannot be # swallowed into the directory token before a later filename extension. $directoryAndNamedFileMatch = [regex]::Match( $PromptText, '(?is)\b(?:output|save|write)\s+(?:the\s+)?(?:script|file|output)\s+to\s+(?<dir>[A-Za-z]:\\[^\r\n.?!]*?)(?:\.|\s+and\s+)(?:\s*)?(?:name\s+(?:the\s+)?(?:script|file)|the\s+(?:script|file)\s+is\s+named|named)\s+["''`]*(?<name>[^\s"''`\\/:*?<>|]+?\.[A-Za-z0-9]{1,16})\b' ) if ($directoryAndNamedFileMatch.Success) { $directory = $directoryAndNamedFileMatch.Groups['dir'].Value.Trim().TrimEnd('.', ',', ';', ':', ')', ']', '}') $directory = $directory.TrimEnd('*') $name = $directoryAndNamedFileMatch.Groups['name'].Value.Trim().Trim('"', "'", '`').TrimEnd('.', ',', ';', ':', ')', ']', '}') if (-not [string]::IsNullOrWhiteSpace($directory) -and -not [string]::IsNullOrWhiteSpace($name)) { return (Join-Path -Path $directory.TrimEnd('\', '/') -ChildPath $name) } } $directPathMatches = [regex]::Matches( $PromptText, '(?i)(?<path>[A-Za-z]:\\[^\s"''`\r\n]*?\.help\.txt)\b') if ($directPathMatches.Count -gt 0) { $directPath = & $trimDetectedPath -CandidatePath $directPathMatches[$directPathMatches.Count - 1].Groups['path'].Value if (-not [string]::IsNullOrWhiteSpace($directPath)) { return $directPath } } if (& $promptIndicatesWriteIntent -Text $PromptText) { $genericPathMatches = [regex]::Matches( $PromptText, '(?i)(?<path>[A-Za-z]:\\[^"''`\r\n]*?\.[A-Za-z0-9]{1,16})(?=\s|$|[)\],;:.!?])') if ($genericPathMatches.Count -gt 0) { for ($i = $genericPathMatches.Count - 1; $i -ge 0; $i--) { $candidate = & $trimDetectedPath -CandidatePath $genericPathMatches[$i].Groups['path'].Value if ([string]::IsNullOrWhiteSpace($candidate)) { continue } $normalizedNamedPath = & $tryNormalizeDirectoryAndNamedFileInstruction -CandidatePath $candidate if (-not [string]::IsNullOrWhiteSpace($normalizedNamedPath)) { return $normalizedNamedPath } $normalizedWildcardPath = & $normalizeWildcardDirectoryPath -CandidatePath $candidate if (-not [string]::IsNullOrWhiteSpace($normalizedWildcardPath)) { return $normalizedWildcardPath } if ($candidate.EndsWith('\\', [System.StringComparison]::Ordinal)) { continue } return $candidate } } } $fileNameMatch = [regex]::Match( $PromptText, '(?is)\b(?:name\s+(?:it|the\s+file|the\s+script\s+file|script\s+file)|file\s+should\s+be\s+named|named)\s+["'']?(?<name>[^\s"''`\\/:*?<>|]+?\.[A-Za-z0-9]{1,16})\b') if (-not $fileNameMatch.Success) { return $null } $fileName = $fileNameMatch.Groups['name'].Value.Trim() if ([string]::IsNullOrWhiteSpace($fileName)) { return $null } $pathMatches = [regex]::Matches($PromptText, '(?i)[A-Za-z]:\\[^\s"''`\r\n]+') if ($pathMatches.Count -eq 0) { return $null } $candidateDirs = @() foreach ($match in $pathMatches) { $candidatePath = [string]$match.Value if ([string]::IsNullOrWhiteSpace($candidatePath)) { continue } $candidatePath = $candidatePath.Trim().TrimEnd('.', ',', ';') if ($candidatePath -match '(?i)\.[A-Za-z0-9]{1,5}$') { continue } $candidatePath = $candidatePath.TrimEnd('\', '/') if ($candidatePath.EndsWith('*', [System.StringComparison]::Ordinal)) { $candidatePath = $candidatePath.TrimEnd('*') } $candidateDirs += $candidatePath.TrimEnd('\', '/') } if ($candidateDirs.Count -eq 0) { return $null } $targetDirectory = $candidateDirs | Where-Object { $_ -match '(?i)\\en-US$' } | Select-Object -Last 1 if ([string]::IsNullOrWhiteSpace($targetDirectory)) { $targetDirectory = $candidateDirs | Select-Object -Last 1 } if ([string]::IsNullOrWhiteSpace($targetDirectory)) { return $null } return (Join-Path -Path $targetDirectory.TrimEnd('\', '/') -ChildPath $fileName) } function Test-TTAgentExpectedOutputFile { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$Path ) $trimmedPath = $Path.Trim() if ([string]::IsNullOrWhiteSpace($trimmedPath)) { return [pscustomobject]@{ Path = $Path IsValid = $false Error = 'Expected output path is empty.' } } if (-not (Test-Path -LiteralPath $trimmedPath -PathType Leaf)) { return [pscustomobject]@{ Path = $trimmedPath IsValid = $false Error = 'Expected output file does not exist.' } } $extension = [System.IO.Path]::GetExtension($trimmedPath) $psExtensions = @('.ps1', '.psm1', '.psd1', '.ps1xml', '.pssc', '.psrc') if ($psExtensions -notcontains $extension.ToLowerInvariant()) { return [pscustomobject]@{ Path = $trimmedPath IsValid = $true Error = $null } } try { $tokens = $null $errors = $null [System.Management.Automation.Language.Parser]::ParseFile( $trimmedPath, [ref]$tokens, [ref]$errors ) | Out-Null if ($null -ne $errors -and $errors.Count -gt 0) { $messages = @($errors | ForEach-Object { $_.Message }) $combinedMessage = ($messages | Select-Object -Unique) -join '; ' return [pscustomobject]@{ Path = $trimmedPath IsValid = $false Error = $combinedMessage } } return [pscustomobject]@{ Path = $trimmedPath IsValid = $true Error = $null } } catch { return [pscustomobject]@{ Path = $trimmedPath IsValid = $false Error = $_.Exception.Message } } } function Resolve-TTAgentRecoveredOutputMessage { [CmdletBinding()] param( [string]$KnownFailureMessage, [string]$ExpectedOutputPath ) if ([string]::IsNullOrWhiteSpace($KnownFailureMessage)) { return $null } $message = $KnownFailureMessage.Trim() $invalidJsonEnvelopeMatch = [regex]::Match( $message, '(?is)^\s*Agent returned invalid JSON twice\.\s*Last response:\s*(?<json>\{.*\})\s*$') if ($invalidJsonEnvelopeMatch.Success) { $jsonCandidate = $invalidJsonEnvelopeMatch.Groups['json'].Value if (-not [string]::IsNullOrWhiteSpace($jsonCandidate)) { try { $decision = $jsonCandidate | ConvertFrom-Json -ErrorAction Stop $finalAnswer = [string]$decision.finalAnswer if (-not [string]::IsNullOrWhiteSpace($finalAnswer)) { return $finalAnswer.Trim() } } catch { # Keep fallback behavior when the envelope cannot be parsed. } } } if (-not [string]::IsNullOrWhiteSpace($ExpectedOutputPath)) { return ( "## Run Recovered`n`n" + "- Output file created successfully at $ExpectedOutputPath.`n" + "- The planner emitted recovery diagnostics during execution; see the Recovery section in the markdown log for details." ) } return $null } function Convert-TTAgentToolTrace { [CmdletBinding()] param( [string[]]$ToolNames ) $normalizedTools = @() foreach ($toolName in @($ToolNames)) { if ($null -eq $toolName) { continue } $value = [string]$toolName if ([string]::IsNullOrWhiteSpace($value)) { continue } $trimmed = $value.Trim() if ([string]::IsNullOrWhiteSpace($trimmed)) { continue } $normalizedTools += $trimmed } if ($normalizedTools.Count -eq 0) { return @('No tool calls recorded.') } $formatted = [System.Collections.Generic.List[string]]::new() foreach ($tool in $normalizedTools) { $toolName = [string]$tool if ($toolName -match '^(?:mcp\.|MCP\.)') { $formatted.Add(('{0} [MCP]' -f $toolName)) continue } switch ($toolName.ToUpperInvariant()) { 'SEARCH-WEB' { $formatted.Add('SEARCH-WEB [Built-in web tool]'); continue } 'FETCH-URL' { $formatted.Add('FETCH-URL [Built-in fetch tool]'); continue } 'READ-FILE' { $formatted.Add('READ-FILE [Built-in file/system tool]'); continue } 'WRITE-FILE' { $formatted.Add('WRITE-FILE [Built-in file/system tool]'); continue } 'APPEND-FILE' { $formatted.Add('APPEND-FILE [Built-in file/system tool]'); continue } 'REPLACE-IN-FILE' { $formatted.Add('REPLACE-IN-FILE [Built-in file/system tool]'); continue } 'RUN-SHELL' { $formatted.Add('RUN-SHELL [Built-in shell tool]'); continue } default { if ($toolName -match '(?i)(?:^|\.)tavily\b|(?:^|\.)search\b') { $formatted.Add(('{0} [MCP]' -f $toolName)) } else { $formatted.Add(('{0} [Unknown tool source]' -f $toolName)) } } } } return @($formatted) } function Write-TTAgentMarkdownLog { [CmdletBinding()] param( [string]$Path, [string]$Status, [string]$PromptText, [string]$ModelName, [int]$IterationLimit, [string]$SignedFilePolicyValue, [string]$AutoRetryOnRecursionMode, [string]$ExecutionMode, [string]$OutputContract, [string]$QualityProfile, [string]$PromptSource, [int]$PreflightScore, [string[]]$PreflightWarnings, [string[]]$PreflightCritical, [string]$PromptPreflightSummary, [string]$ReasoningEffortSettings, [string]$RuntimeAssemblyPath, [string]$AdaptiveLimitsPreflight, [string]$ExpectedOutputPath, [string]$StdOut, [string]$StdErr, [string]$ErrorText, [string]$RecoveryReason, [bool]$PostflightAchieved, [string]$PostflightReason, [string[]]$ToolTrace, [int]$ResponseLength, [bool]$KnownFailureDetected, [bool]$ExpectedOutputExists, [bool]$RagUsed, [string]$RagStatus, [string]$RagModelEffective, [string]$RagModelSource, [bool]$RagEnabledConfigured, [bool]$RagAttempted, [string]$RagProviderType, [string]$RagExecutionMode, [bool]$RagEnvironmentContextIncluded, [string]$RagEnvironmentContextProfile, [int]$RagSourcesScanned, [int]$RagCandidatesScored, [int]$RagCandidatesSelected, [int]$RagCandidatesPacked, [int]$RagContextCharacters, [string]$RagModelConfigured, [string]$RagStatusReason, [int]$ExitCode, [string]$TranscriptFile, [DateTime]$StartedUtc, [DateTime]$CompletedUtc ) if ([string]::IsNullOrWhiteSpace($Path)) { return } $dir = Split-Path -Parent $Path if (-not [string]::IsNullOrWhiteSpace($dir)) { $null = New-Item -ItemType Directory -Path $dir -Force } $renderedOutput = if ([string]::IsNullOrWhiteSpace($StdOut)) { '(none)' } else { $StdOut.TrimEnd() } $rawError = if ([string]::IsNullOrWhiteSpace($StdErr)) { '(none)' } else { $StdErr.TrimEnd() } $rawException = if ([string]::IsNullOrWhiteSpace($ErrorText)) { '(none)' } else { $ErrorText.TrimEnd() } $rawRecoveryReason = if ([string]::IsNullOrWhiteSpace($RecoveryReason)) { '(none)' } else { $RecoveryReason.TrimEnd() } $rawPostflightReason = if ([string]::IsNullOrWhiteSpace($PostflightReason)) { '(none)' } else { $PostflightReason.TrimEnd() } $toolTraceText = if ($null -ne $ToolTrace -and $ToolTrace.Count -gt 0) { ($ToolTrace | ForEach-Object { $_.TrimEnd() } | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }) -join [Environment]::NewLine } else { '(none)' } $preflightWarnings = @($PreflightWarnings) $preflightCritical = @($PreflightCritical) $preflightWarningsText = if ($preflightWarnings.Count -gt 0) { ($preflightWarnings -join [Environment]::NewLine) } else { '(none)' } $preflightCriticalText = if ($preflightCritical.Count -gt 0) { ($preflightCritical -join [Environment]::NewLine) } else { '(none)' } $expectedOutputPathText = if ([string]::IsNullOrWhiteSpace($ExpectedOutputPath)) { '(none)' } else { $ExpectedOutputPath } $adaptiveLimitsPreflightText = if ([string]::IsNullOrWhiteSpace($AdaptiveLimitsPreflight)) { '(none)' } else { $AdaptiveLimitsPreflight.TrimEnd() } $promptPreflightSummaryText = if ([string]::IsNullOrWhiteSpace($PromptPreflightSummary)) { '(none)' } else { $PromptPreflightSummary.TrimEnd() } $reasoningEffortSettingsText = if ([string]::IsNullOrWhiteSpace($ReasoningEffortSettings)) { '(none)' } else { $ReasoningEffortSettings.TrimEnd() } $runtimeAssemblyPathText = if ([string]::IsNullOrWhiteSpace($RuntimeAssemblyPath)) { '(none)' } else { $RuntimeAssemblyPath.TrimEnd() } $postflightStatus = if ($PostflightAchieved) { 'Achieved' } else { 'NotAchieved' } $expectedOutputExistsText = if ([string]::IsNullOrWhiteSpace($ExpectedOutputPath)) { '(n/a)' } else { [string]$ExpectedOutputExists } $ragStatusText = if ([string]::IsNullOrWhiteSpace($RagStatus)) { 'Unknown' } else { $RagStatus.TrimEnd() } $ragModelEffectiveText = if ([string]::IsNullOrWhiteSpace($RagModelEffective)) { '(none)' } else { $RagModelEffective.TrimEnd() } $ragModelSourceText = if ([string]::IsNullOrWhiteSpace($RagModelSource)) { 'none' } else { $RagModelSource.TrimEnd() } $ragProviderTypeText = if ([string]::IsNullOrWhiteSpace($RagProviderType)) { '(unknown)' } else { $RagProviderType.TrimEnd() } $ragExecutionModeText = if ([string]::IsNullOrWhiteSpace($RagExecutionMode)) { 'unknown' } else { $RagExecutionMode.TrimEnd() } $ragEnvironmentContextProfileText = if ([string]::IsNullOrWhiteSpace($RagEnvironmentContextProfile)) { 'standard' } else { $RagEnvironmentContextProfile.TrimEnd() } $ragModelConfiguredText = if ([string]::IsNullOrWhiteSpace($RagModelConfigured)) { '(none)' } else { $RagModelConfigured.TrimEnd() } $ragStatusReasonText = if ([string]::IsNullOrWhiteSpace($RagStatusReason)) { '(none)' } else { $RagStatusReason.TrimEnd() } $lines = @( '# Tech Agent Run' '' ('- Status: {0}' -f $Status) ('- StartedUtc: {0}' -f $StartedUtc.ToString('o')) ('- CompletedUtc: {0}' -f $CompletedUtc.ToString('o')) ('- Model: {0}' -f $(if ([string]::IsNullOrWhiteSpace($ModelName)) { '(default)' } else { $ModelName })) ('- MaxIterations: {0}' -f $IterationLimit) ('- SignedFilePolicy: {0}' -f $(if ([string]::IsNullOrWhiteSpace($SignedFilePolicyValue)) { '(default)' } else { $SignedFilePolicyValue })) ('- AutoRetryOnRecursion: {0}' -f $AutoRetryOnRecursionMode) ('- ExitCode: {0}' -f $ExitCode) ('- TranscriptPath: {0}' -f $(if ([string]::IsNullOrWhiteSpace($TranscriptFile)) { '(none)' } else { $TranscriptFile })) '' '## Prompt' '' '```text' $PromptText '```' '' '## Preflight' '' '~~~~text' ('Mode: {0}' -f $ExecutionMode) ('OutputContract: {0}' -f $OutputContract) ('QualityProfile: {0}' -f $QualityProfile) ('PromptSource: {0}' -f $PromptSource) ('Score: {0}/100' -f $PreflightScore) ('PromptPreflightSummary: {0}' -f $promptPreflightSummaryText) ('ReasoningEffortSettings: {0}' -f $reasoningEffortSettingsText) ('RuntimeAssemblyPath: {0}' -f $runtimeAssemblyPathText) ('WarningsCount: {0}' -f $preflightWarnings.Count) 'Warnings:' $preflightWarningsText ('CriticalCount: {0}' -f $preflightCritical.Count) 'Critical:' $preflightCriticalText 'AdaptiveLimits:' $adaptiveLimitsPreflightText ('ExpectedOutputPath: {0}' -f $expectedOutputPathText) '~~~~' '' '## Output' '' $renderedOutput '' '## Error Output' '' '~~~~text' $rawError '~~~~' '' '## Exception' '' '~~~~text' $rawException '~~~~' '' '## Postflight' '' '~~~~text' ('Status: {0}' -f $postflightStatus) ('ResponseLengthChars: {0}' -f $ResponseLength) ('KnownFailurePrefixDetected: {0}' -f $KnownFailureDetected) ('ExpectedOutputExists: {0}' -f $expectedOutputExistsText) ('RagUsed: {0}' -f $RagUsed) ('RagStatus: {0}' -f $ragStatusText) ('RagModelEffective: {0}' -f $ragModelEffectiveText) ('RagModelSource: {0}' -f $ragModelSourceText) ('RagEnabledConfigured: {0}' -f $RagEnabledConfigured) ('RagAttempted: {0}' -f $RagAttempted) ('RagProviderType: {0}' -f $ragProviderTypeText) ('RagExecutionMode: {0}' -f $ragExecutionModeText) ('RagEnvironmentContextIncluded: {0}' -f $RagEnvironmentContextIncluded) ('RagEnvironmentContextProfile: {0}' -f $ragEnvironmentContextProfileText) ('RagSourcesScanned: {0}' -f $RagSourcesScanned) ('RagCandidatesScored: {0}' -f $RagCandidatesScored) ('RagCandidatesSelected: {0}' -f $RagCandidatesSelected) ('RagCandidatesPacked: {0}' -f $RagCandidatesPacked) ('RagContextCharacters: {0}' -f $RagContextCharacters) ('RagModelConfigured: {0}' -f $ragModelConfiguredText) ('RagStatusReason: {0}' -f $ragStatusReasonText) 'ToolTrace:' $toolTraceText 'Reason:' $rawPostflightReason '~~~~' '' '## Recovery' '' '~~~~text' $rawRecoveryReason '~~~~' ) Set-Content -Path $Path -Value ($lines -join [Environment]::NewLine) -Encoding utf8BOM } # SIG # Begin signature block # MIImyAYJKoZIhvcNAQcCoIImuTCCJrUCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDQ9rWIjg5nDSKh # MsM7J2OflP4Tg0gHUfbjc/zTjbmpy6CCIFgwggWNMIIEdaADAgECAhAOmxiO+dAt # 5+/bUOIIQBhaMA0GCSqGSIb3DQEBDAUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK # EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV # BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0yMjA4MDEwMDAwMDBa # Fw0zMTExMDkyMzU5NTlaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2Vy # dCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNVBAMTGERpZ2lD # ZXJ0IFRydXN0ZWQgUm9vdCBHNDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC # ggIBAL/mkHNo3rvkXUo8MCIwaTPswqclLskhPfKK2FnC4SmnPVirdprNrnsbhA3E # MB/zG6Q4FutWxpdtHauyefLKEdLkX9YFP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