-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_agent_capabilities.ps1
More file actions
95 lines (83 loc) · 2.67 KB
/
verify_agent_capabilities.ps1
File metadata and controls
95 lines (83 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# verify_agent_capabilities.ps1
$AgentUrl = "http://localhost:4001"
$ProjectId = "proj_splitline"
$TestFile = "src/test_agent_write.txt"
$TestContent = "Splitline Agent Write Verification " + (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
Write-Host "Verifying Splitline Agent Capabilities..." -ForegroundColor Cyan
# 1. Test Writing
Write-Host "[1/3] Testing Write Capability..." -NoNewline
try {
$body = @{
projectId = $ProjectId
operations = @(
@{
op = "create"
path = $TestFile
content = $TestContent
}
)
} | ConvertTo-Json -Depth 4
$response = Invoke-RestMethod -Uri "$AgentUrl/tools/apply_patch" -Method Post -ContentType "application/json" -Body $body -ErrorAction Stop
if ($response.applied -eq 1) {
Write-Host " PASS" -ForegroundColor Green
}
else {
Write-Host " FAIL" -ForegroundColor Red
Write-Host "Response: $($response | ConvertTo-Json)" -ForegroundColor Yellow
exit
}
}
catch {
Write-Host " ERROR" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
exit
}
# 2. Test Reading
Write-Host "[2/3] Testing Read Capability..." -NoNewline
try {
$body = @{
projectId = $ProjectId
path = $TestFile
} | ConvertTo-Json
$response = Invoke-RestMethod -Uri "$AgentUrl/tools/read_file" -Method Post -ContentType "application/json" -Body $body -ErrorAction Stop
if ($response.content -eq $TestContent) {
Write-Host " PASS" -ForegroundColor Green
}
else {
Write-Host " FAIL (Mismatch)" -ForegroundColor Red
exit
}
}
catch {
Write-Host " ERROR" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
exit
}
# 3. Test Deleting
Write-Host "[3/3] Testing Delete Capability..." -NoNewline
try {
$body = @{
projectId = $ProjectId
operations = @(
@{
op = "delete"
path = $TestFile
}
)
} | ConvertTo-Json -Depth 4
$response = Invoke-RestMethod -Uri "$AgentUrl/tools/apply_patch" -Method Post -ContentType "application/json" -Body $body -ErrorAction Stop
if ($response.applied -eq 1) {
Write-Host " PASS" -ForegroundColor Green
}
else {
Write-Host " FAIL" -ForegroundColor Red
Write-Host "Response: $($response | ConvertTo-Json)" -ForegroundColor Yellow
exit
}
}
catch {
Write-Host " ERROR" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
exit
}
Write-Host "SUCCESS: Agent is fully capable of Read/Write/Delete operations." -ForegroundColor Green