summaryrefslogtreecommitdiff
path: root/check.lua
diff options
context:
space:
mode:
Diffstat (limited to 'check.lua')
-rw-r--r--check.lua37
1 files changed, 26 insertions, 11 deletions
diff --git a/check.lua b/check.lua
index 97e22ad..b8abfdd 100644
--- a/check.lua
+++ b/check.lua
@@ -21,6 +21,10 @@ local function run(bin, args, opts, timeout)
end
local home = assert(uv.fs_mkdtemp('/private/tmp/panto-agy-XXXXXX'))
local function check()
+ local usage=dofile(root..'/acp.lua').usage
+ local u={inputTokens=155,outputTokens=41,thoughtTokens=8,cachedReadTokens=55,cachedWriteTokens=10,totalTokens=196}
+ local v=usage(u); assert(v.input==90 and v.output==41 and v.cache_read==55 and v.cache_write==10 and v.reasoning==8)
+ u.totalTokens=261; assert(usage(u).input==155); u.totalTokens=99; assert(not usage(u) and not usage({}) and not usage(nil))
local catalog=dofile(root..'/catalog.lua').catalog
local req={tools={{name='std.read',description='Read',input_schema_json='{"type":"object"}'},
{name='fixture.echo',description='Echo',input_schema_json='{"type":"object"}'}}}
@@ -40,7 +44,7 @@ local function check()
protocol="antigravity-acp"
save_session=true
]])
- write(cfg .. '/models.toml', '[antigravity.fast]\nmodel="gemini-test"\n')
+ write(cfg .. '/models.toml', '[antigravity.fast]\nmodel="gemini-test"\ninput=10.0\noutput=10.0\ncache_read=1.0\ncache_write=10.0\n')
write(cfg .. '/SYSTEM.md', 'Short answers.')
local exe = home .. '/agy'
assert(uv.fs_symlink(panto, home .. '/panto')) -- short, space-free shebang path
@@ -51,13 +55,23 @@ local uv = require('luv'); local spawn = uv.spawn
uv.spawn = function(bin, opts, cb)
if bin == '/usr/bin/codesign' and opts.args[4] == os.getenv('HOME') .. '/agy' then
bin, opts = '/usr/bin/true', {args={}}
- elseif bin == '/usr/bin/osascript' then bin, opts = '/usr/bin/false', {args={}} end
+ end
return spawn(bin, opts, cb)
end
return {name='test.signature', activate=function()
- require('panto').ext.register_tool{name='fixture.echo',description='Return a nested value.',
+ local ext=require('panto').ext
+ ext.on('render_thinking_complete',function(e)
+ if e.text=='fixture-visible-thinking' then local f=assert(io.open(os.getenv('HOME')..'/thinking-rendered','w')); f:close() end
+ end)
+ ext.register_command{name='fixture-notice',description='Queue a workflow completion',handler=function()
+ ext.agent:submit('[subagents] Workflow fixture completed. Output below: marker')
+ end}
+ ext.register_tool{name='fixture.echo',description='Return a nested value.',
schema={type='object',properties={rows={type='array',minItems=1,items={type='object',properties={value={type='integer'}},required={'value'}}}},required={'rows'}},
- handler=function(input) return tostring(input.rows[1].value) end}
+ handler=function(input)
+ if not uv.fs_stat(os.getenv('HOME')..'/.local/share/panto-antigravity/google/usage-failure') then ext.agent:submit('boundary workflow notice') end
+ return tostring(input.rows[1].value)
+ end}
end}
]])
local env = {'HOME=' .. home, 'QUOTA_LOG=' .. home .. '/screen', 'TMPDIR=' .. home,
@@ -79,16 +93,17 @@ end}
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)
- -- Fake agy also runs `panto lua`, but under the isolated Google HOME. Reuse
- -- the staged rocks there so the interpreter never needs a first-run install.
- assert(run('/bin/mkdir', {'-p', '-m', '700', google}) == 0)
- assert(run('/bin/mkdir', {'-p', google .. '/.local/share/panto'}) == 0)
- assert(uv.fs_symlink(data .. '/rocks', google .. '/.local/share/panto/rocks'))
- assert(sandbox({'/usr/bin/expect', root .. '/tests/tui.exp'}, 45000) == 0, 'TUI check failed')
+ 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')
+ local agents = assert(uv.fs_scandir(google .. '/config/agents')); assert(not uv.fs_scandir_next(agents), 'Generated agent left in private profile')
local screen = read(home .. '/screen'):gsub('\27%[[0-9;?]*[A-Za-z]', '')
+ assert(screen:find('1.3k/1M ctx',1,true),'expected ACP context occupancy, not summed turn inputs')
+ assert(screen:find('3.4k tok',1,true),'expected primary and steering usage counted exactly once')
+ assert(screen:find('agy native: manage_task [completed]',1,true) and not screen:find('agy native: mcp_pantograph_',1,true),'native activity missing or MCP call duplicated')
assert(screen:find('27%%%s+━'), 'expected 27% used and a filled bar in the rendered footer')
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, follow-up and saved resume')
+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')