summaryrefslogtreecommitdiff
path: root/check.lua
diff options
context:
space:
mode:
Diffstat (limited to 'check.lua')
-rw-r--r--check.lua35
1 files changed, 27 insertions, 8 deletions
diff --git a/check.lua b/check.lua
index eac0f55..51194da 100644
--- a/check.lua
+++ b/check.lua
@@ -21,6 +21,7 @@ local function run(bin, args, opts, timeout)
end
local home = assert(uv.fs_mkdtemp('/private/tmp/panto-agy-XXXXXX'))
local function check()
+ dofile(root..'/tests/lifecycle.lua')
local acp_mod=dofile(root..'/acp.lua'); local usage=acp_mod.usage
local function cut(text,room)
local head,tail=acp_mod.history_split(text,room)
@@ -41,7 +42,7 @@ local function check()
local req={tools={{name='std.read',description='Read',input_schema_json='{"type":"object"}'},
{name='fixture.echo',description='Echo',input_schema_json='{"type":"object"}'}}}
local _,none=catalog(req,{}); assert(#none==0)
- local by,one=catalog(req,{'std.read'}); assert(#one==1 and by.std__read and not by.fixture__echo)
+ local by,one=catalog(req,{'not.offered','std.read'}); assert(#one==1 and one[1].name=='std__read' and by.std__read and not by.fixture__echo)
local configure=dofile(root..'/extensions/antigravity-acp.lua').configure
assert(not pcall(configure,{providers={antigravity={protocol='antigravity-acp',save_session=true}}}))
local cfg, data = home .. '/.panto', home .. '/.local/share/panto'
@@ -111,13 +112,31 @@ end}
for _, a in ipairs(args) do cmd[#cmd+1] = a end
return run('/usr/bin/sandbox-exec', cmd, {cwd=home, env=env, stdio=stdio}, timeout)
end
- local log = home .. '/headless.stderr'
- local fd = assert(uv.fs_open(log, 'w', 384))
- local code = sandbox({panto, '--incognito', '-p', '-m', 'antigravity:fast', '--', 'hello'}, 10000, {nil, 1, fd})
- uv.fs_close(fd)
local google = home .. '/.local/share/panto-antigravity/google'
- local stderr = read(log)
- assert(code ~= 0 and stderr:find('ProviderProtocolFailed', 1, true) and not uv.fs_stat(google), stderr)
+ local function print_check(mode, args, input, diagnostic)
+ write(home..'/fixture-mode', mode); write(home..'/stdin', input or '')
+ local inf=assert(uv.fs_open(home..'/stdin','r',384))
+ local out=assert(uv.fs_open(home..'/stdout','w',384))
+ local err=assert(uv.fs_open(home..'/stderr','w',384))
+ local cmd={panto, '--incognito', '-p', '-m', 'antigravity:fast', '-r', diagnostic and 'xhigh' or 'low'}
+ for _,a in ipairs(args) do cmd[#cmd+1]=a end
+ local code=sandbox(cmd, 15000, {inf,out,err})
+ uv.fs_close(inf); uv.fs_close(out); uv.fs_close(err)
+ local stdout,stderr=read(home..'/stdout'),read(home..'/stderr')
+ if diagnostic then
+ assert(code~=0 and stderr:find('reasoning level xhigh',1,true) and not stderr:find('error: turn failed: ProviderProtocolFailed',1,true), stderr)
+ assert(not stdout:find('reasoning level xhigh',1,true) and not stdout:find('headless-',1,true), stdout)
+ else
+ assert(code==0 and stdout:find('headless-'..mode..'-ok',1,true), stdout..'\n'..stderr)
+ end
+ end
+ print_check('argv-probe', {'--','argv-probe'}, 'ignored stdin')
+ print_check('stdin-probe', {}, 'stdin-probe')
+ write(cfg..'/PROMPT.md','rig-probe')
+ print_check('rig-probe', {'--rig',cfg}, '')
+ assert(uv.fs_unlink(cfg..'/PROMPT.md'))
+ print_check('diagnostic', {'--','diagnostic'}, '', true)
+ assert(uv.fs_unlink(home..'/fixture-mode'))
local tui=sandbox({'/usr/bin/expect', root .. '/tests/tui.exp'}, 65000)
if tui~=0 then error('TUI check failed: '..read(home..'/screen'):gsub('\27%[[0-9;?]*[A-Za-z]', ''):sub(-3500)) end
assert(uv.fs_stat(home..'/thinking-rendered'),'ACP thought did not reach the native thinking component')
@@ -132,4 +151,4 @@ end
local ok, err = xpcall(check, debug.traceback)
assert(run('/bin/rm', {'-rf', home}) == 0)
assert(ok, err)
-print('PASS: headless denial, native TUI, quota meter, model alias, primary MCP tool, permissions, native resume, /tree transcript seed, warm follow-up and cold resume')
+print('PASS: headless argv/stdin/rig and provider diagnostic, native TUI, quota meter, model alias, primary MCP tool, permissions, native resume, /tree transcript seed, warm follow-up and cold resume')