diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/fake-agy.lua | 21 | ||||
| -rw-r--r-- | tests/tui.exp | 12 |
2 files changed, 23 insertions, 10 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 diff --git a/tests/tui.exp b/tests/tui.exp index fdbad27..efa4cda 100644 --- a/tests/tui.exp +++ b/tests/tui.exp @@ -22,6 +22,7 @@ foreach {prompt answer} {hello primary-tool-ok again same-session-ok} { } send -- "late-tool"; see {late-tool}; send -- "\r"; see {timeout-handled-ok} send -- "/fixture-notice "; see {/fixture-notice }; send -- "\r"; see {workflow-notice-ok} +send -- "\033\[200~$env(HOME)/drop.png\033\[201~ image-probe"; see {\[Image-1\] image-probe}; send -- "\r"; see {image-drop-ok} send -- "\003"; expect eof; wait set flag [open "$env(HOME)/.local/share/panto-antigravity/google/usage-failure" w]; close $flag spawn -noecho $env(PANTO) resume -m antigravity:fast -r high @@ -33,9 +34,8 @@ send -- "\003"; expect eof; wait spawn -noecho $env(PANTO) resume -m antigravity:fast -r low see {antigravity:}; send -- "/tree "; see {/tree }; send -- "\r"; see {session tree} send -- "primary-tool-ok"; after 150; send -- "\r"; see {branched from} -foreach {query answer} {branch-probe branch-seed-ok warm-probe warm-after-seed-ok} { - send -- $query; see $query; send -- "\r"; see $answer -} +send -- "\033\[200~$env(HOME)/drop.png\033\[201~ branch-probe"; see {\[Image-2\] branch-probe}; send -- "\r"; see {branch-seed-ok} +send -- "warm-probe"; see {warm-probe}; send -- "\r"; see {warm-after-seed-ok} send -- "esc-probe"; see {esc-probe}; send -- "\r"; see {esc-window-open} send -- "\033"; see {\[interrupted\]} send -- "after-esc-probe"; see {after-esc-probe}; send -- "\r"; see {after-esc-ok} @@ -75,8 +75,10 @@ see {requires direct TUI input}; send -- "\003"; expect eof; wait spawn -noecho $env(PANTO) --incognito -m antigravity:fast -r low -- no-tools see {no-tools-ok} send -- "\003"; expect eof; wait -# xhigh exists before switching models, but not on gemini-test. +# xhigh exists before switching models, but not on gemini-test; PDFs are rejected before ACP launch. spawn -noecho $env(PANTO) --incognito -m antigravity:fast -r xhigh -see {antigravity:}; send -- "unsupported"; see {unsupported}; send -- "\r" +see {antigravity:}; send -- "\033\[200~$env(HOME)/drop.pdf\033\[201~"; see {\[Attachment-1\]}; send -- "\r" +see {only text and image} +send -- "unsupported"; see {unsupported}; send -- "\r" see {reasoning level xhigh} send -- "\003"; expect eof; wait |
