summaryrefslogtreecommitdiff
path: root/acp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'acp.lua')
-rw-r--r--acp.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/acp.lua b/acp.lua
index 286b3ab..dc4abdb 100644
--- a/acp.lua
+++ b/acp.lua
@@ -144,8 +144,7 @@ local function install_agent(s, profile)
local made,err,code=uv.fs_mkdir(dir,448); assert(made or code=='EEXIST',err)
local st=assert(uv.fs_lstat(dir)); assert(st.type=='directory' and st.uid==uv.getuid() and st.mode & 18==0,'Unsafe agy agent directory')
end
- -- Active threads hold an exclusive lock on this Panto session ID.
- local name='panto-'..s.sid:lower()
+ local name='panto-'..s.agent_key
local servers=json.array({})
if #s.list>0 then servers[1]=relay(s) end
local data=([[---
@@ -379,7 +378,7 @@ function M.launch(s, first, resume_id)
elseif s.prompting and not s.cancelling and u.sessionUpdate=='usage_update' and count(u.used) and count(u.size) and u.size>0 and u.used<=u.size then
s.context_window={used=u.used,size=u.size}
elseif s.prompting and not s.cancelling and (u.sessionUpdate=='tool_call' or u.sessionUpdate=='tool_call_update') then
- pcall(s.observe,u) -- a cosmetic mount failure must not cancel an agy turn
+ if s.observe then pcall(s.observe,u) end -- a cosmetic mount failure must not cancel an agy turn
elseif (u.sessionUpdate=='agent_message_chunk' or u.sessionUpdate=='agent_thought_chunk') and u.content.type=='text' and s.prompting and not s.cancelling then
s.delta(u.sessionUpdate=='agent_message_chunk' and 'text' or 'thinking',u.content.text)
end
@@ -392,6 +391,9 @@ function M.launch(s, first, resume_id)
child,pid=uv.spawn(bin,{args=args,cwd=s.cwd,env=env,detached=true,stdio={stdin,stdout,nil}},function()
close(child); child=nil; if closed then cleanup() else s.fail('Antigravity exited; not replaying') end
end); if not child then local err=pid; pid=nil; error(tostring(err)) end; local buf=''
+ -- A warm upstream must not keep a finished print invocation alive.
+ -- The request timer and Panto stream pump drive outstanding work.
+ child:unref(); stdout:unref(); stdin:unref()
assert(stdout:read_start(function(e,data)
if closed then return end; if e or not data then s.fail('ACP stream closed'); return end
buf=buf..data