summaryrefslogtreecommitdiff
path: root/tests/fake-agy.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fake-agy.lua')
-rw-r--r--tests/fake-agy.lua21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/fake-agy.lua b/tests/fake-agy.lua
index 3f1643a..1774dec 100644
--- a/tests/fake-agy.lua
+++ b/tests/fake-agy.lua
@@ -19,6 +19,12 @@ local function request(method)
local q = read(); assert(q.method == method, 'expected ' .. method); return q
end
local function reply(q, result) send({id=q.id, result=result or {}}) end
+local png_b64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aX1kAAAAASUVORK5CYII='
+local function assert_image(parts)
+ assert(#parts == 3 and parts[1].type == 'text'
+ and parts[2].type == 'text' and parts[2].text:find('^%[Image%-%d+%] .*/drop%.png$')
+ and parts[3].type == 'image' and parts[3].mimeType == 'image/png' and parts[3].data == png_b64, 'bad image prompt parts')
+end
local function prompt(text)
local q = request('session/prompt')
assert(#q.params.prompt == 1 and q.params.prompt[1].type == 'text' and q.params.prompt[1].text == text)
@@ -100,7 +106,7 @@ end
local q = request('initialize')
reply(q, {protocolVersion=1, authMethods={{id='oauth-personal'}}, agentCapabilities={
- sessionCapabilities={resume={}}, _meta={antigravity={systemPrompt={append=true}}},
+ promptCapabilities={image=true}, sessionCapabilities={resume={}}, _meta={antigravity={systemPrompt={append=true}}},
}})
q = request('authenticate'); assert(json.encode(q.params) == '{"methodId":"oauth-personal"}'); reply(q)
q = read()
@@ -151,8 +157,8 @@ elseif resumed then local resumed_prompt=prompt('resume'); check_relay(); finish
assert(not resumed)
-- Oversized history: the older part rides the system prompt append; the
-- newest part and the request stay in one user message under the agy cap.
- q=request('session/prompt'); assert(#q.params.prompt==1)
- local user=q.params.prompt[1].text; assert(#user<=160000,'user message over the agy cap')
+ q=request('session/prompt')
+ local user=q.params.prompt[1].text
local head=setup._meta.antigravity.systemPrompt.append:match('^Short answers%.\n\nSelected Panto conversation history, earlier part%. [^\n]+\n\n(.*)\n\nEnd of the earlier part of the selected Panto conversation history%.$')
local tail,request_text=user:match('^Selected Panto conversation history[^\n]*:\n\n(.*)(\n\nCurrent user request:\n[^\n]+)$')
assert(tail and (head~=nil)==(user:find('continued from the record',1,true)~=nil),'record and user message disagree')
@@ -164,7 +170,8 @@ elseif resumed then local resumed_prompt=prompt('resume'); check_relay(); finish
if current~='boundary workflow notice' then
assert(text:find('[Assistant]: primary-tool-ok',1,true)); assert(head and #head>0 and head:sub(-2)=='\n\n' and tail:sub(1,1)=='[','expected the oversized transcript to overflow into the system prompt at an entry boundary')
end
- if current=='branch-probe' then
+ if current=='[Image-2] branch-probe' then
+ assert_image(q.params.prompt); assert(#user+1+#q.params.prompt[2].text<=160000,'user message over the agy cap')
finish(q,'branch-seed-ok'); finish(prompt('warm-probe'),'warm-after-seed-ok')
local esc=prompt('esc-probe')
send({method='session/update',params={sessionId='test-session',update={
@@ -175,9 +182,11 @@ elseif resumed then local resumed_prompt=prompt('resume'); check_relay(); finish
finish(prompt('after-esc-probe'),'after-esc-ok')
reply(prompt('cancel-probe'),{stopReason='cancelled'})
elseif current=='boundary workflow notice' then
+ assert(#q.params.prompt==1 and #user<=160000,'user message over the agy cap')
assert(text:find('[User]: boundary steer',1,true) and text:find('[Tool result',1,true)); finish(q,'proceed-recovered-ok')
else
- assert(current=='cold-probe' and text:find('[Assistant]: warm-after-seed-ok',1,true)
+ assert(#q.params.prompt==1 and #user<=160000,'user message over the agy cap')
+ assert(current=='cold-probe' and text:find('[image/png media]',1,true) and text:find('[Assistant]: warm-after-seed-ok',1,true)
and text:find('[User]: esc-probe',1,true) and not text:find('esc-window-open',1,true)
and text:find('[Assistant]: after-esc-ok',1,true)); finish(q,'cold-resume-ok')
end
@@ -195,5 +204,7 @@ else
finish(prompt('again'), 'same-session-ok')
local verify=check_relay(prompt('late-tool'))
q=prompt('[subagents] Workflow fixture completed. Output below: marker'); verify(); finish(q, 'workflow-notice-ok')
+ q=request('session/prompt'); assert(q.params.prompt[1].text=='[Image-1] image-probe'); assert_image(q.params.prompt)
+ finish(q, 'image-drop-ok')
end
for _ in io.lines() do end -- keep the session alive until Panto closes stdin