diff options
| author | t <t@tjp.lol> | 2026-12-04 15:30:05 -0700 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-12-04 15:31:08 -0700 |
| commit | 48b14add01cb106217832e036e3569e494f1d65c (patch) | |
| tree | be561d29fa32d393c8d91d1e01eedfab9d5ffc86 /acp.lua | |
| parent | 835b962682c13a16696dd3f4fe1428dbab9141b5 (diff) | |
Panto expands a pasted image into a multi-block user message (text,
[Image-N] path text, base64 media). The adapter only accepted a single
text block, so any image drop failed with 'No matching Antigravity
tool handoff or text prompt'.
Translate text and image/* media blocks into ACP ContentBlocks for new
turns, warm follow-ups, boundary steering and transcript reseeds, gated
on the agent's advertised promptCapabilities.image. Image data rides
outside agy's ~191 KB user-text cap, so only text bytes count toward
message_bytes; reseeds prefix the leading text block and reserve room
for the path context block. Non-image attachments (PDFs) are refused
before launch because agy's ACP inlineMedia accepts image/* only.
The offline check now drops a real PNG via bracketed paste across a
warm turn, /tree reseed and cold resume, and asserts PDF rejection.
Diffstat (limited to 'acp.lua')
| -rw-r--r-- | acp.lua | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -222,10 +222,13 @@ function M.launch(s, first, resume_id) local function step(co,...) local ok,err=coroutine.resume(co,...); if not ok then s.fail(tostring(err)) end end - local deadline, idle, request_id, primary_reply + local deadline, idle, request_id, primary_reply, image_capable local steering,steer_usage,last_steer={},nil,nil + local function check_prompt(parts) + for _,v in ipairs(parts) do assert(v.type~='image' or image_capable,'ACP image prompts unavailable') end + end s.steer=function(parts) - assert(s.prompting and waiting,'No active ACP prompt to steer') + assert(s.prompting and waiting,'No active ACP prompt to steer'); check_prompt(parts) serial=serial+1; steering[serial]=true send({id=serial,method='session/prompt',params={sessionId=s.session,prompt=parts}}) end @@ -280,7 +283,8 @@ function M.launch(s, first, resume_id) return (config(opts,s.selector) or {}).currentValue==s.wire and (not s.thought or (thought(opts) or {}).currentValue==s.thought) end - local function turn(text) + local function turn(parts) + check_prompt(parts) local wire = assert(s.resolve(s.effort)) configuring=true s.selector,s.wire=selectors[wire],wire @@ -292,7 +296,7 @@ function M.launch(s, first, resume_id) assert(confirmed(),'Configured model or reasoning level changed'); configuring=false s.prompting=true if s.refresh then pcall(s.refresh) end - local r=call('session/prompt',{sessionId=s.session,prompt={{type='text',text=text}}}) + local r=call('session/prompt',{sessionId=s.session,prompt=parts}) if s.cancelling then assert(r.stopReason=='cancelled' or r.stopReason=='end_turn' or r.stopReason=='max_tokens', 'Turn stopped: '..tostring(r.stopReason)) @@ -305,10 +309,11 @@ function M.launch(s, first, resume_id) local usage=add_usage(M.usage(r.usage),steer_usage) s.prompting=false; s.complete(last_steer and last_steer.reason or reason,usage); steer_usage,last_steer=nil,nil end - s.submit=function(text) step(coroutine.create(turn),text) end + s.submit=function(parts) step(coroutine.create(turn),parts) end local function setup() local init=call('initialize',{protocolVersion=1,clientInfo={name='panto-antigravity',version='1'},clientCapabilities={}}) assert(init.protocolVersion==1,'ACP v1 required'); local caps=init.agentCapabilities or {} + image_capable=((caps.promptCapabilities or {}).image)==true local personal=false; for _,a in ipairs(init.authMethods or {}) do if a.id=='oauth-personal' then personal=true end end assert(personal,'Native personal sign-in unavailable'); call('authenticate',{methodId='oauth-personal'}) local params={cwd=s.cwd,mcpServers=json.array({}),_meta={disableBuiltInTools=true}} |
