summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fake-agy.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/fake-agy.lua b/tests/fake-agy.lua
index 904f3bf..3f1643a 100644
--- a/tests/fake-agy.lua
+++ b/tests/fake-agy.lua
@@ -58,7 +58,7 @@ local function load_catalog(server)
assert(rpc(1, 'initialize').result.serverInfo.name == 'pantograph')
local tools = rpc(2, 'tools/list').result.tools
local schemas={}; for _,t in ipairs(tools) do assert(t._meta['antigravity/alwaysLoad']==true); schemas[t.name]=t.inputSchema end
- assert(schemas.std__read and schemas.std__edit and schemas.fixture__echo.properties.rows.items.required[1]=='value')
+ assert(schemas.std__read and schemas.std__edit and schemas.result_part and schemas.fixture__echo.properties.rows.items.required[1]=='value')
return function(late_prompt)
if late_prompt then
write(7,'tools/call',{name='fixture__echo',arguments={rows={{value=43}}}})
@@ -78,10 +78,22 @@ local function load_catalog(server)
local r = rpc(4, 'tools/call', {name='std__read', arguments={path=uv.cwd() .. '/.panto/SYSTEM.md'}}).result
assert(r.isError == false and r.content[1].text:find('Short answers', 1, true))
-- Push later transcript reseeds past one agy message (acp.message_bytes).
+ -- Each result is over agy's MCP result cap, so it arrives in parts.
for i=1,4 do
- local f=rpc(20+i,'tools/call',{name='std__read',arguments={path=uv.cwd()..'/.panto/history-filler.txt'}}).result
- assert(f.isError==false and #f.content[1].text>40000)
+ local f=rpc(i*20,'tools/call',{name='std__read',arguments={path=uv.cwd()..'/.panto/history-filler.txt'}}).result
+ assert(f.isError==false and #f.content==1 and #f.content[1].text<=10000,'large result over the agy cap')
+ local text,parts,n=f.content[1].text:match('^(.*)\n\n%[pantograph: this is part 1 of (%d+) of result (%d+) ')
+ assert(parts,'large result not sent in parts')
+ for part=2,tonumber(parts) do
+ local more=rpc(i*20+part,'tools/call',{name='result_part',arguments={result=tonumber(n),part=part}}).result
+ assert(more.isError==false and #more.content[1].text<=10000)
+ text=text..assert(more.content[1].text:match('^%[pantograph: part '..part..' of '..parts..' of result '..n..'%]\n(.*)$'))
+ end
+ local last=0; for line in text:gmatch('filler line (%d%d%d%d) abcdefghij') do assert(tonumber(line)==last+1,'parts lost or reordered text'); last=last+1 end
+ assert(#text>40000 and last>1400)
end
+ assert(rpc(10,'tools/call',{name='result_part',arguments={result=999,part=2}}).result.isError==true)
+ assert(rpc(11,'tools/call',{name='result_part',arguments={result='1',part=2}}).error.code==-32602)
-- Keep the peer connected for subsequent turns.
end
end