@apmantza/greedysearch-pi 2.1.3 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -1
- package/README.md +52 -175
- package/bin/search.mjs +2 -0
- package/docs/analysis.md +233 -0
- package/docs/banner.svg +86 -0
- package/docs/development.md +63 -0
- package/docs/inspiration2.md +190 -0
- package/docs/releases.md +88 -0
- package/docs/research.md +82 -0
- package/docs/runtime.md +65 -0
- package/docs/source-fetching.md +33 -0
- package/docs/stealthbrowsermcp.md +807 -0
- package/docs/usage.md +69 -0
- package/extractors/chatgpt.mjs +127 -23
- package/extractors/common.mjs +116 -28
- package/extractors/gemini.mjs +63 -38
- package/package.json +13 -7
- package/scripts/backfill-github-releases.mjs +139 -0
- package/scripts/changelog-extract.mjs +48 -0
- package/scripts/changelog-release.mjs +65 -0
- package/scripts/check-lockfile.mjs +45 -0
- package/scripts/lib/changelog.mjs +168 -0
- package/scripts/lint.mjs +62 -0
- package/scripts/run-tests.ps1 +179 -0
- package/scripts/stealth-check.mjs +663 -0
- package/src/fetcher.mjs +9 -5
- package/src/search/constants.mjs +1 -1
- package/src/search/research.mjs +57 -11
- package/src/search/simple-research.mjs +4 -1
- package/test.mjs +16 -3
- package/skills/greedy-search/skill.md +0 -20
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[string]$Model = "cline/openai/gpt-oss-120b:free",
|
|
3
|
+
[string]$FallbackModel = "cline/nvidia/nemotron-3-nano-30b-a3b:free",
|
|
4
|
+
[ValidateSet("smoke", "quick", "all", "flags", "edge", "parallel")]
|
|
5
|
+
[string]$Mode = "smoke"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
$ErrorActionPreference = "Continue"
|
|
9
|
+
$PSNativeCommandUseErrorActionPreference = $false
|
|
10
|
+
|
|
11
|
+
$repoRoot = Split-Path -Parent $PSScriptRoot
|
|
12
|
+
$resultsDir = Join-Path $repoRoot "results"
|
|
13
|
+
$runId = Get-Date -Format "yyyyMMdd-HHmmss"
|
|
14
|
+
$runDir = Join-Path $resultsDir $runId
|
|
15
|
+
|
|
16
|
+
New-Item -ItemType Directory -Force -Path $runDir | Out-Null
|
|
17
|
+
|
|
18
|
+
$prompt = @"
|
|
19
|
+
Run the GreedySearch test suite now by executing: bash test.sh $Mode
|
|
20
|
+
Wait for it to finish, then report:
|
|
21
|
+
- Total passed, failed, warnings, skipped counts (from the summary line)
|
|
22
|
+
- List every FAILED test by name
|
|
23
|
+
- List every WARNING by name
|
|
24
|
+
- Overall result: PASS or FAIL
|
|
25
|
+
Reply with a JSON object: { "passed": N, "failed": N, "warnings": N, "skipped": N, "failures": [...], "warningsList": [...], "result": "PASS"|"FAIL", "durationSec": N }
|
|
26
|
+
"@
|
|
27
|
+
|
|
28
|
+
function Invoke-PiRun {
|
|
29
|
+
param([string]$Model, [string]$Suffix)
|
|
30
|
+
|
|
31
|
+
$stdoutPath = Join-Path $runDir ("greedysearch-$Suffix-{0}.jsonl" -f ($Model -replace "[^a-zA-Z0-9._-]", "_"))
|
|
32
|
+
$stderrPath = Join-Path $runDir ("greedysearch-$Suffix-{0}.stderr.log" -f ($Model -replace "[^a-zA-Z0-9._-]", "_"))
|
|
33
|
+
|
|
34
|
+
Push-Location $repoRoot
|
|
35
|
+
try {
|
|
36
|
+
$sw = [System.Diagnostics.Stopwatch]::StartNew()
|
|
37
|
+
& pi -p --no-session --mode json --thinking off --model $Model $prompt 1> $stdoutPath 2> $stderrPath
|
|
38
|
+
$exitCode = $LASTEXITCODE
|
|
39
|
+
$sw.Stop()
|
|
40
|
+
} finally {
|
|
41
|
+
Pop-Location
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return @{
|
|
45
|
+
ExitCode = $exitCode
|
|
46
|
+
DurationSec = [math]::Round($sw.Elapsed.TotalSeconds, 2)
|
|
47
|
+
StdoutPath = $stdoutPath
|
|
48
|
+
StderrPath = $stderrPath
|
|
49
|
+
Model = $Model
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function Parse-JsonEvents {
|
|
54
|
+
param([string]$Path)
|
|
55
|
+
|
|
56
|
+
$assistantText = ""
|
|
57
|
+
|
|
58
|
+
foreach ($line in Get-Content -Path $Path) {
|
|
59
|
+
$obj = $null
|
|
60
|
+
try { $obj = $line | ConvertFrom-Json -ErrorAction Stop } catch { continue }
|
|
61
|
+
|
|
62
|
+
if ($obj.type -eq "message_end" -and $obj.message -and $obj.message.role -eq "assistant") {
|
|
63
|
+
foreach ($content in $obj.message.content) {
|
|
64
|
+
if ($content.type -eq "text" -and $content.text) {
|
|
65
|
+
$assistantText += [string]$content.text
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# Extract the JSON block Pi returns
|
|
72
|
+
$jsonMatch = [regex]::Match($assistantText, '\{[\s\S]*\}')
|
|
73
|
+
$parsed = $null
|
|
74
|
+
if ($jsonMatch.Success) {
|
|
75
|
+
try { $parsed = $jsonMatch.Value | ConvertFrom-Json -ErrorAction Stop } catch {}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return @{
|
|
79
|
+
AssistantText = $assistantText
|
|
80
|
+
Parsed = $parsed
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
# Run with primary model, fall back if non-zero exit
|
|
85
|
+
Write-Output "Running GreedySearch tests (mode: $Mode) via pi ..."
|
|
86
|
+
Write-Output "Model: $Model"
|
|
87
|
+
|
|
88
|
+
$result = Invoke-PiRun -Model $Model -Suffix "primary"
|
|
89
|
+
|
|
90
|
+
if ($result.ExitCode -ne 0) {
|
|
91
|
+
Write-Output "Primary model failed (exit $($result.ExitCode)), retrying with fallback ..."
|
|
92
|
+
$result = Invoke-PiRun -Model $FallbackModel -Suffix "fallback"
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$parsed = Parse-JsonEvents -Path $result.StdoutPath
|
|
96
|
+
$summary = $parsed.Parsed
|
|
97
|
+
|
|
98
|
+
$stderr = ""
|
|
99
|
+
if (Test-Path $result.StderrPath) {
|
|
100
|
+
$stderr = (Get-Content -Path $result.StderrPath -Raw)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
# Build report
|
|
104
|
+
$mdLines = @()
|
|
105
|
+
$mdLines += "# GreedySearch Test Run"
|
|
106
|
+
$mdLines += ""
|
|
107
|
+
$mdLines += ("Run ID : {0}" -f $runId)
|
|
108
|
+
$mdLines += ("Mode : {0}" -f $Mode)
|
|
109
|
+
$mdLines += ("Model : {0}" -f $result.Model)
|
|
110
|
+
$mdLines += ("Pi exit: {0}" -f $result.ExitCode)
|
|
111
|
+
$mdLines += ("Pi time: {0}s" -f $result.DurationSec)
|
|
112
|
+
$mdLines += ""
|
|
113
|
+
|
|
114
|
+
if ($summary) {
|
|
115
|
+
$mdLines += "## Results"
|
|
116
|
+
$mdLines += ""
|
|
117
|
+
$mdLines += ("| Passed | Failed | Warnings | Skipped | Overall |")
|
|
118
|
+
$mdLines += ("|--------|--------|----------|---------|---------|")
|
|
119
|
+
$mdLines += ("| {0} | {1} | {2} | {3} | **{4}** |" -f $summary.passed, $summary.failed, $summary.warnings, $summary.skipped, $summary.result)
|
|
120
|
+
$mdLines += ""
|
|
121
|
+
|
|
122
|
+
if ($summary.failures -and $summary.failures.Count -gt 0) {
|
|
123
|
+
$mdLines += "### Failures"
|
|
124
|
+
foreach ($f in $summary.failures) { $mdLines += ("- $f") }
|
|
125
|
+
$mdLines += ""
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if ($summary.warningsList -and $summary.warningsList.Count -gt 0) {
|
|
129
|
+
$mdLines += "### Warnings"
|
|
130
|
+
foreach ($w in $summary.warningsList) { $mdLines += ("- $w") }
|
|
131
|
+
$mdLines += ""
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
$mdLines += "## Raw Pi Output"
|
|
135
|
+
$mdLines += ""
|
|
136
|
+
$mdLines += $parsed.AssistantText
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
$mdPath = Join-Path $runDir "summary.md"
|
|
140
|
+
$csvPath = Join-Path $runDir "summary.csv"
|
|
141
|
+
|
|
142
|
+
Set-Content -Path $mdPath -Value ($mdLines -join [Environment]::NewLine)
|
|
143
|
+
|
|
144
|
+
# CSV row
|
|
145
|
+
[pscustomobject]@{
|
|
146
|
+
RunId = $runId
|
|
147
|
+
Mode = $Mode
|
|
148
|
+
Model = $result.Model
|
|
149
|
+
ExitCode = $result.ExitCode
|
|
150
|
+
DurationSec = $result.DurationSec
|
|
151
|
+
Passed = if ($summary) { $summary.passed } else { "?" }
|
|
152
|
+
Failed = if ($summary) { $summary.failed } else { "?" }
|
|
153
|
+
Warnings = if ($summary) { $summary.warnings } else { "?" }
|
|
154
|
+
Skipped = if ($summary) { $summary.skipped } else { "?" }
|
|
155
|
+
Result = if ($summary) { $summary.result } else { "?" }
|
|
156
|
+
Has429 = [bool]($stderr -match "429")
|
|
157
|
+
} | Export-Csv -NoTypeInformation -Path $csvPath
|
|
158
|
+
|
|
159
|
+
# Print summary to console
|
|
160
|
+
Write-Output ""
|
|
161
|
+
if ($summary) {
|
|
162
|
+
Write-Output ("Result : {0}" -f $summary.result)
|
|
163
|
+
Write-Output ("Passed : {0}" -f $summary.passed)
|
|
164
|
+
Write-Output ("Failed : {0}" -f $summary.failed)
|
|
165
|
+
Write-Output ("Warnings: {0}" -f $summary.warnings)
|
|
166
|
+
Write-Output ("Skipped : {0}" -f $summary.skipped)
|
|
167
|
+
if ($summary.failures -and $summary.failures.Count -gt 0) {
|
|
168
|
+
Write-Output ""
|
|
169
|
+
Write-Output "Failures:"
|
|
170
|
+
foreach ($f in $summary.failures) { Write-Output (" - $f") }
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
Write-Output "Could not parse structured output from pi. Check raw output:"
|
|
174
|
+
Write-Output $parsed.AssistantText
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
Write-Output ""
|
|
178
|
+
Write-Output ("Results dir: {0}" -f $runDir)
|
|
179
|
+
Write-Output ("Report : {0}" -f $mdPath)
|