diff options
| author | t <t@tjp.lol> | 2026-11-27 08:46:14 -0700 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-11-30 08:34:38 -0700 |
| commit | 47039f21a170e29875a2676f7a2eb5a779144b74 (patch) | |
| tree | 495ffa7dab8de455a8d2ebfafd45dfcce5da52b7 | |
Add Antigravity ACP provider for Panto
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | LICENSE | 18 | ||||
| -rw-r--r-- | README.md | 28 | ||||
| -rw-r--r-- | _quota_selfcheck.lua | 96 | ||||
| -rw-r--r-- | _usage_footer.lua | 177 | ||||
| -rw-r--r-- | acp.lua | 271 | ||||
| -rw-r--r-- | catalog.lua | 46 | ||||
| -rw-r--r-- | check.lua | 94 | ||||
| -rw-r--r-- | docs/findings.md | 18 | ||||
| -rw-r--r-- | extensions/antigravity-acp.lua | 176 | ||||
| -rw-r--r-- | mise.toml | 10 | ||||
| -rw-r--r-- | quota.lua | 163 | ||||
| -rw-r--r-- | tests/fake-agy.lua | 111 | ||||
| -rw-r--r-- | tests/tui.exp | 46 |
14 files changed, 1255 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ @@ -0,0 +1,18 @@ +MIT License + +Copyright (c) 2026 Travis Parker + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7775e7a --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# panto-antigravity +Use `panto -m antigravity:gemini-4-neon -r high` for human-driven Gemini chat in the normal Panto thread. Requires macOS, Google's signed `agy`, and a Panto build with `request.tui_submission`. No API keys, companion client or rig required. + +```toml +[extensions] +paths = ["/absolute/path/to/panto-antigravity/extensions"] +[providers.antigravity] +protocol = "antigravity-acp" +# tools = ["std.read"] # optional allowlist; [] exports none +``` +In `models.toml`, use one entry per family, with the levels shown by `agy models` for your account: + +```toml +[antigravity.gemini-4-neon] +reasoning_levels = ["low", "medium", "high", "xhigh"] +``` + +`-r high` or Ctrl+R requests `high` for the next turn. On `agy` 1.5.19 the provider selects the ACP model first, then checks that model’s `thought_level` choices and confirms the requested level before prompting. Without an explicit level it leaves the ACP setting alone. Pickers that advertise suffixed model IDs still use those variants (exact configured ID, otherwise `medium` when no level is requested). Panto currently shows the protocol-wide levels in Ctrl+R, so a narrower family can reject an unavailable level; the provider never silently substitutes one. The same configuration works in a rig. For a locally built rock (`luarocks --lua-version 5.4 --tree <Panto rock tree> make`), use `rocks = ["panto-antigravity"]` instead of `paths`. Nothing is published or installed globally by the checks. + +**Usage footer:** One shared row across aliases alongside Claude, Codex, Copilot and OpenCode Go. It shows **percent used**, a five-cell bar and reset countdown per reported bucket (73% remaining → `27% ━────`). No account request on startup. An authenticated direct turn refreshes through the CLI’s fixed read-only `/usage` command, at most once a minute. The extension reads only the signed CLI’s stdout: it never calls Google quota endpoints or reads account tokens. [Google’s `/usage` command](https://antigravity.google/docs/cli/commands/usage/) may itself refresh from Google’s backend. Malformed or failed reads show unavailable; expired/reset readings aren't shown as current. No token-count estimates or raw CLI messages. `usage_footer = false` opts a provider out. The footer validates the `/usage` output, not the CLI version. + +**Setup & diagnostics:** `/antigravity-status` shows local connection state; `/antigravity-models` lists advertised families; for split ACP settings, levels are shown only for the selected model. Neither contacts Google. The isolated profile is `~/.local/share/panto-antigravity/google`. For native login once that directory exists: `profile="$HOME/.local/share/panto-antigravity/google"; HOME="$profile" agy acp --gemini-dir "$profile" --login`. When upgrading from the prototype, update your extension path, protocol and model selection, then start a new thread. No credentials or old checkpoints are migrated automatically. + +**Tools:** By default the `pantograph` MCP server exports the active Panto tools, including extension tools. They run with Panto's permissions, not agy's shell sandbox. Use a trusted rig; if it contains tools you don't want Neon to run, narrow `tools` or disable those extensions in the rig. Full input schemas are listed, including nested arrays and objects; an unsupported schema constraint rejects the call rather than disabling the catalog. On `session/new` and `session/resume`, the adapter requests `_meta.disableBuiltInTools = true` (recognized by agy 1.5.19). Before launching ACP with tools, the extension creates `antigravity-cli/settings.json` in its isolated profile if absent, allowing `mcp(pantograph/*)` so exported tools don't prompt by default. Existing settings are never overwritten. To restore prompts, replace that allow rule with an `ask` rule for the same server. Other servers and native tools receive no grant. After restarting Panto, start a **fresh thread**, ask Neon to read `README.md`, and check for the Panto read card. `/antigravity-status` distinguishes configured tools from an actual MCP list request and counts accepted MCP calls. + +**Boundaries:** Direct idle text submissions only: no startup prompts, print/proxy calls, child agents, compaction, queued input or automatic retries. Enter identifies a TUI path, not proof of personhood; don't automate this route. Keep the profile free of delegation hooks/servers and exclude delegation tools from the rig or use an explicit allowlist on this personal route. The relay supports text/image results. Unexpected ACP permission requests still show a macOS allow-once/deny dialog. Turns share one warm ACP process. Optional `save_session = true` resumes a completed matching checkpoint (writes local state even under `--incognito`); no transcript replay. Force-kill can leave a stale socket or lock: confirm the owner is gone before removing it. + +**Offline release check:** `PANTO=/path/to/provenance-aware/panto mise run check` exercises source and installed-rock loading, renders the real footer with a fake CLI, and checks tool execution, resume, and headless rejection. No installed `agy` or Google account is used. See [evidence and compatibility](docs/findings.md). diff --git a/_quota_selfcheck.lua b/_quota_selfcheck.lua new file mode 100644 index 0000000..4d76bd4 --- /dev/null +++ b/_quota_selfcheck.lua @@ -0,0 +1,96 @@ +-- Run with lua _quota_selfcheck.lua. No installed CLI, account data or network. +local uv = require('luv') +local quota, footer = dofile('quota.lua'), dofile('_usage_footer.lua') +local wall = 2000000000 +os.time = function() return wall end +local reset = os.date('!%Y-%m-%dT%H:%M:%SZ', wall + 60) +local sample = 'Gemini\tPro\t72%\t' .. reset .. '\n' + .. 'Gemini\tFlash\t100%\t\nOther\tLimited\t0%\t\n' + .. 'Credits\tCount only\t150\t' .. reset .. '\nGemini\tOff\tdisabled\t\n' +local function parse(s) return quota.parse(s, footer.reset_time) end +local limits = assert(parse('Gemini Models\tWeekly Limit Remaining\t73%\t\nGemini Models\tFive Hour Limit Remaining\t100%\t\n')) +assert(limits[1].label == 'Gemini Models / Weekly Limit Used' and limits[1].used_percent == 27) +assert(limits[2].label == 'Gemini Models / Five Hour Limit Used' and limits[2].used_percent == 0) +local rows = assert(parse(sample)) +assert(#rows == 4 and rows[1].label == 'Gemini / Pro' and rows[1].used_percent == 28) +assert(rows[1].resets_at == wall + 60 and rows[2].used_percent == 0 and rows[3].used_percent == 100) +assert(rows[4].used_percent == nil and rows[4].resets_at == wall + 60) +assert(#assert(parse('')) == 0 and #assert(parse('Gemini\tOff\tdisabled\t\n')) == 0) +for _, bad in ipairs({ + 'Gemini\tPro\t101%\t\n', 'Gemini\tPro\t072%\t\n', 'Gemini\tPro\t0.72\t\n', 'Gemini\tPro\tused 72%\t\n', + 'Gemini\tPro\t72%\t2030-02-30T12:00:00Z\n', 'Gemini\tPro\t72%\t2030-02-26 12:00 PST\n', + 'Gemini\tPro\t72%\t', '\27[31mGemini\tPro\t72%\t\n', sample .. sample, + 'account login required\n' .. sample, 'Gemini\tPro\t7%\t\t\n', string.rep('x', 32769), +}) do assert(parse(bad) == nil) end + +local hooks, ext = {}, {} +function ext.on(event, handler) + hooks[event] = hooks[event] or {} + table.insert(hooks[event], handler) +end +local probes, spawns, cancelled, verified = 0, 0, 0, nil +local acp = { probe = function(run) + probes, verified = probes + 1, run + return function() cancelled = cancelled + 1 end +end } +local profile, env = '/fake-profile', {'HOME=/fake-profile'} +local spawn, hrtime, output, exit_status = uv.spawn, uv.hrtime, sample, 0 +local advance = 0 +uv.hrtime = function() return hrtime() + advance end +uv.spawn = function(bin, opts, callback) + assert(bin == '/fake-agy' and opts.cwd == profile and opts.env == env and opts.detached) + assert(table.concat(opts.args, '|') == '--gemini_dir|/fake-profile|--sandbox|-p|/usage') + assert(opts.stdio[1] == nil and opts.stdio[2] and opts.stdio[3] == nil) + spawns = spawns + 1 + opts.cwd = '/' + opts.args = {'-c', 'test ! -t 0 && test ! -t 1 || exit 9; if (: </dev/tty) 2>/dev/null; then exit 9; fi; printf "%s" "$1"; exit "$2"', 'fake-agy', output, tostring(exit_status)} + return spawn('/bin/sh', opts, callback) +end + +local refresh = quota.activate(ext, footer, acp) +assert(quota.activate(ext, footer, acp) == refresh and #hooks.render_footer == 1) +refresh() -- no footer attached: no headless launch +assert(probes == 0) +local component +hooks.render_footer[1]({ + get_component = function() return {render = function() return {'native footer'} end} end, + set_component = function(_, c) component = c; return {invalidate = function() end} end, +}) +local function rendered() + return table.concat(component:render(132), '\n'):gsub('\27%[[%d;]*m', '') +end +footer.publish(ext, 'peer', 'peer usage footer') +assert(rendered():find('antigravity usage: awaiting first turn',1,true) and rendered():find('peer usage footer',1,true) and probes == 0) +refresh(); refresh(); assert(probes == 1 and spawns == 0) +verified('/fake-agy', profile, env); refresh(); uv.run(); refresh() +assert(probes == 1 and spawns == 1) +local line = rendered() +assert(line:find('antigravity usage: Gemini / Pro 28%', 1, true) and line:find('Count only ?%', 1, true)) +assert(line:find('reset in 1m', 1, true) and line:find('peer usage footer', 1, true)) +assert(select(2, line:gsub('antigravity usage:', '')) == 1) +wall = wall + 60 +line = rendered() +assert(line:find('stale', 1, true) and not line:find('Pro', 1, true) and line:find('Flash 0%', 1, true)) +wall = wall + 240 +assert(rendered():find('antigravity usage: stale', 1, true)) +assert(not rendered():find('Flash', 1, true)) + +local function retry(body, code) + output, exit_status, advance = body, code, advance + 61 * 10^9 + refresh(); verified('/fake-agy', profile, env); uv.run() +end +retry('Gemini\tOther\t72%\t\n' .. 'unexpected stderr-like text\n', 0) +assert(rendered():find('antigravity usage: unavailable', 1, true) and not rendered():find('unexpected', 1, true)) +retry(sample, 1) +assert(rendered():find('antigravity usage: unavailable', 1, true) and not rendered():find('Flash', 1, true)) +retry(string.rep('x', 32769), 0) +assert(rendered():find('antigravity usage: unavailable', 1, true)) +retry('', 0) +assert(rendered():find('antigravity usage: unknown', 1, true)) +advance = advance + 61 * 10^9 +refresh(); assert(probes == 6 and spawns == 5) +for _, end_session in ipairs(hooks.session_end) do end_session() end +verified('/fake-agy', profile, env); refresh(); uv.run() +assert(cancelled == 1 and spawns == 5 and not uv.loop_alive()) +assert(rendered() == 'native footer\npeer usage footer') +print('PASS: exact /usage TSV, fake CLI gate and coalescing, stale/errors and shared footer') diff --git a/_usage_footer.lua b/_usage_footer.lua new file mode 100644 index 0000000..2c27e8b --- /dev/null +++ b/_usage_footer.lua @@ -0,0 +1,177 @@ +-- Identical private copies share one footer hook, without a companion rock. +-- Each published section renders on its own row. +local M = {} +-- v3 sections include the whole row, unlike v2 which added a prefix in the hook. +local slot = "panto.subscription_usage.v3" + +local function text(value) + return tostring(value):gsub("[%c]", " "):sub(1, 100) +end + +local function reset_time(value) + if type(value) == "number" then + if value == value and value >= 0 and value <= 253402300799 then return value end + return nil + end + if type(value) ~= "string" then return nil end + local y, m, d, h, n, tail = value:match("^(%d%d%d%d)%-(%d%d)%-(%d%d)[Tt ](%d%d):(%d%d)(.*)$") + if not y then return nil end + local s, zone = tail:match("^:(%d%d)(.*)$") + if s then zone = zone:gsub("^%.%d+", "") else s, zone = "0", tail end + y, m, d, h, n, s = tonumber(y), tonumber(m), tonumber(d), tonumber(h), tonumber(n), tonumber(s) + local leap = y % 4 == 0 and (y % 100 ~= 0 or y % 400 == 0) + local days = { 31, leap and 29 or 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } + if y < 1 or m < 1 or m > 12 or d < 1 or d > days[m] or h > 23 or n > 59 or s > 59 then return nil end + local offset = 0 + if zone ~= "Z" and zone ~= "z" then + local sign, oh, om = zone:match("^([+-])(%d%d):(%d%d)$") + if not sign or tonumber(oh) > 23 or tonumber(om) > 59 then return nil end + offset = (tonumber(oh) * 60 + tonumber(om)) * 60 * (sign == "+" and 1 or -1) + end + -- Gregorian civil date to Unix days; independent of local timezone/DST. + y = y - (m <= 2 and 1 or 0) + local era = math.floor(y / 400) + local year = y - era * 400 + local day = math.floor((153 * (m + (m > 2 and -3 or 9)) + 2) / 5) + d - 1 + local unix_days = era * 146097 + year * 365 + math.floor(year / 4) - math.floor(year / 100) + day - 719468 + return unix_days * 86400 + h * 3600 + n * 60 + s - offset +end + +local function countdown(reset, now) + if not reset then return "reset unknown" end + local seconds = reset - now + if seconds <= 0 then return "reset due" end + if seconds < 60 then return "reset in <1m" end + local minutes = math.floor(seconds / 60) + local parts = {} + for _, unit in ipairs({ {1440, "d"}, {60, "h"}, {1, "m"} }) do + local amount = math.floor(minutes / unit[1]) + if amount > 0 then parts[#parts + 1] = amount .. unit[2] end + minutes = minutes % unit[1] + end + return "reset in " .. table.concat(parts, " ") +end + +M.text, M.reset_time, M.countdown = text, reset_time, countdown + +-- Build one subscription's complete section text as a renderer. The renderer +-- is re-evaluated each frame so countdowns and theme colors stay live without +-- refetching. opts.status appends a status word. Invalid windows are dropped here. +function M.section(ext, label, windows, opts) + opts = type(opts) == "table" and opts or { status = opts } + label = text(label):gsub("^%S+", string.lower) + local provider = (label:match("^(.-) %(") or label):lower() + local status = opts.status and text(opts.status) or nil + local snapshot = {} + for _, window in ipairs(windows or {}) do + local percent = window.used_percent + local valid = type(percent) == "number" and percent == percent and percent >= 0 and percent < math.huge + local at = reset_time(window.resets_at) + if valid or (percent == nil and at ~= nil) then + snapshot[#snapshot + 1] = { + label = text(window.label or "quota"), used_percent = valid and percent or nil, resets_at = at, + } + end + end + return function(now) + local style = type(ext.style) == "function" and ext.style() or {} + local base, reset = style.dim or style.footer or "\27[2m", style.reset or "\27[0m" + local blue = style.syntax_function or "\27[36m" + local accent = "\27[1m" .. blue + -- Use the same severity colors as the native footer context meter. + local green = style.tool_success or "\27[32m" + local yellow = style.compaction_header or "\27[33m" + local red = style.tool_error or "\27[31m" + local label_color = ({ + claude = yellow, codex = style.canvas_fg or "\27[97m", + ["opencode go"] = style.thinking_header or "\27[35m", + })[provider] or blue + local function paint(color, value) return reset .. color .. value .. reset .. base end + local parts = {} + for _, window in ipairs(snapshot) do + local percent = window.used_percent + local color = percent and (percent <= 33 and green or percent <= 66 and yellow or red) or base + local value = percent and string.format("%.1f%%", percent):gsub("%.0%%", "%%") or "?%" + local meter = "" + if percent then + -- Match the native context meter's glyphs, rounding and minimum nonzero fill. + local filled = math.floor(math.min(percent, 100) / 20 + 0.5) + if percent > 0 then filled = math.max(1, filled) end + local fill = filled > 0 and paint(color, string.rep("━", filled)) or "" + meter = fill .. string.rep("─", 5 - filled) .. " " + end + parts[#parts + 1] = paint(accent, window.label) .. " " .. paint(color, value) .. " " + .. meter .. countdown(window.resets_at, now) + end + local detail = table.concat(parts, ", ") + if status then + detail = detail == "" and status or (detail .. " · " .. status) + end + return detail ~= "" and (paint("\27[1m" .. label_color, label) .. " usage: " .. detail .. reset) or nil + end +end + +local function start_clock(state) + if state.timer then return end + local ok, uv = pcall(require, "luv") + if not ok or type(uv.new_timer) ~= "function" then return end + state.timer = uv.new_timer() + state.timer:start(60000, 60000, function() + if not state.closed and state.handle then state.handle:invalidate() end + end) + state.timer:unref() +end + +-- Install during activate(), before render_footer; sections may arrive later. +function M.install(ext) + if type(ext.on) ~= "function" then return nil end + local state = package.loaded[slot] + if not state then + state = { sections = {} } + package.loaded[slot] = state + ext.on("render_footer", function(event) + local inner = event:get_component() + state.handle = event:set_component({ + render = function(_, width) + local lines = inner:render(width) + local now, keys = os.time(), {} + for key in pairs(state.sections) do keys[#keys + 1] = key end + table.sort(keys) + for _, key in ipairs(keys) do + local section = state.sections[key] + local line = type(section) == "function" and section(now) or section + if type(line) == "string" and line ~= "" then + lines[#lines + 1] = line + end + end + return lines + end, + }) + end) + ext.on("session_end", function() + state.closed = true + if state.timer then state.timer:stop(); state.timer:close(); state.timer = nil end + end) + end + return state +end + +-- Publish a section renderer (or plain string). +-- Each account has a stable key and its own row. +-- Also accepts (ext, key, label, windows, status, opts) for direct callers. +function M.publish(ext, key, section, windows, status, opts) + local state = M.install(ext) + if not state or state.closed then return false end + if windows ~= nil or status ~= nil or opts ~= nil then + local section_opts = type(opts) == "table" and opts or {} + if status ~= nil then section_opts.status = status end + section = M.section(ext, section, windows, section_opts) + end + if type(section) ~= "function" and type(section) ~= "string" then return false end + state.sections[key] = section + start_clock(state) + if state.handle then state.handle:invalidate() end + return true +end + +return M @@ -0,0 +1,271 @@ +-- One outstanding ACP request. Incoming updates and client requests are serviced +-- while session/prompt is pending (including while Panto executes an MCP tool). +local uv, json = require('luv'), require('panto').ext.json +local M = {} +local levels = {'low', 'medium', 'high', 'xhigh'} +M.effort_levels = {} +for i, level in ipairs(levels) do M.effort_levels[i] = {label=level, detail='Request '..level..' reasoning'} end + +-- Preserve unsuffixed and legacy pinned IDs when no effort was requested. +local function wire_for(selectors, model, effort, split) + if selectors[model] and (not effort or split) then return model end + effort = effort or 'medium' + for _, level in ipairs(levels) do + if level == effort then + if selectors[model] and model:sub(-#level-1) == '-'..level then return model end + local wire = model..'-'..level + if selectors[wire] then return wire end + end + end + -- A different model can expose thought_level only after it is selected. + if selectors[model] then return model end + return nil, 'No advertised Gemini model for '..model..' at '..effort..'; see /antigravity-models' +end + +local function choices(option) + local values = {} + for _,g in ipairs(option and option.options or {}) do + for _,v in ipairs(g.options or {g}) do + if type(v.value)=='string' then values[v.value]=v.name or '' end + end + end + return values +end +local function config(opts, id) + for _,o in ipairs(opts or {}) do if o.id==id then return o end end +end +local function thought(opts) + for _,o in ipairs(opts or {}) do if o.id=='thought_level' or o.category=='thought_level' then return o end end +end +local function families(selectors, current, thought_levels) + local groups = {} + for wire in pairs(selectors) do + local base, suffix = wire:match('^(.+)%-([^-]+)$') + local family = wire + for _, level in ipairs(levels) do if suffix == level then family = base; break end end + groups[family] = true + end + local names = {} + for family in pairs(groups) do + local available = {} + for _, level in ipairs(levels) do + if selectors[family..'-'..level] or (family==current and thought_levels[level]) then available[#available+1] = level end + end + names[#names+1] = family .. (#available > 0 and ' ('..table.concat(available, ', ')..')' or '') + end + table.sort(names); return names +end +local function close(h) if h and not h:is_closing() then h:close() end end +local function private_profile() + local dir=assert(uv.fs_realpath(assert(os.getenv('HOME')))) + local home=assert(uv.fs_stat(dir)); assert(home.type=='directory' and home.uid==uv.getuid() and home.mode & 18==0,'HOME must be owned and not group/world writable') + for _,part in ipairs({'.local','share','panto-antigravity','google'}) do + dir=dir..'/'..part + local st=uv.fs_lstat(dir) + if not st then assert(uv.fs_mkdir(dir,448)); st=assert(uv.fs_lstat(dir)) end + assert(st.type=='directory' and st.uid==uv.getuid() and st.mode & 18==0,'Google profile path must be owned and not group/world writable') + end + local st=assert(uv.fs_lstat(dir)); assert(st.mode & 63==0 and uv.fs_access(dir,'W') and uv.fs_access(dir,'X'),'Google profile must be private and writable') + return dir +end +-- Supply an agy default only in our private profile. Publish a complete file +-- without replacing settings a user (or another Panto process) already created. +local function seed_tool_permissions(profile) + local dir=profile..'/antigravity-cli' + 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 settings directory') + local path=dir..'/settings.json' + if uv.fs_lstat(path) then return end + local fd,tmp=uv.fs_mkstemp(dir..'/.settings-XXXXXX'); assert(fd,tmp) + local data='{"permissions":{"allow":["mcp(pantograph/*)"]}}\n' + local n,why=uv.fs_write(fd,data,0); local closed,close_err=uv.fs_close(fd) + if n==#data and closed then + made,err,code=uv.fs_link(tmp,path) + else made,err,code=nil,why or close_err or 'Incomplete agy settings write',nil end + assert(uv.fs_unlink(tmp)); assert(made or code=='EEXIST',err) +end +local function executable() + assert(uv.os_uname().sysname=='Darwin','Google signature verification requires macOS') + for dir in (os.getenv('PATH') or ''):gmatch('[^:]+') do + if dir:sub(1,1)=='/' and uv.fs_access(dir..'/agy','X') then return assert(uv.fs_realpath(dir..'/agy')) end + end + error('agy is not on PATH') +end +-- The chat transport and the fixed read-only usage query share this trust boundary. +-- Neither inherits API keys or a user's default CLI profile. +local function verified(run, on_error) + local finished, checker, watchdog = false, nil, uv.new_timer() + local function cancel() + if finished then return end + finished=true; close(watchdog) + if checker then checker:kill('sigkill') end + end + local ok,err=pcall(function() + local bin,profile=executable(),private_profile() + local env={'HOME='..profile} + for _,k in ipairs({'USER','PATH','TMPDIR','LANG'}) do + if os.getenv(k) then env[#env+1]=k..'='..os.getenv(k) end + end + watchdog:start(15000,0,function() cancel(); on_error('Google CLI signature check timed out') end) + checker=assert(uv.spawn('/usr/bin/codesign',{args={'--verify','--strict','-R=anchor apple generic and certificate leaf[subject.OU] = "EQHXZ8M8AV" and identifier "cli"',bin}},function(code,sig) + close(checker); checker=nil; if finished then return end + finished=true; close(watchdog) + if code~=0 or sig~=0 then on_error('Google CLI signature verification failed'); return end + local ran,why=pcall(run,bin,profile,env); if not ran then on_error(tostring(why)) end + end)) + end) + if not ok then cancel(); on_error(tostring(err)) end + return cancel +end +M.probe = verified +local dialog=[[on run argv +set choice to display dialog (item 1 of argv) with title "Panto: Antigravity permission" buttons {"Deny", "Allow once"} default button "Deny" cancel button "Deny" giving up after 60 +if (gave up of choice) or (button returned of choice) is not "Allow once" then error number -128 +end run]] +function M.launch(s, first, resume_id) + local cancel_check + local child, pid, approval, stdin, stdout, waiting, timer, serial=nil,nil,nil,nil,nil,nil,uv.new_timer(),0 + local closed=false + local function cleanup() + if pid then uv.kill(-pid,9); pid=nil end + close(stdin); close(stdout); close(timer) + end + local function send(msg) + msg.jsonrpc='2.0'; assert(stdin:write(json.encode(msg)..'\n',function(e) if e and not closed then s.fail('ACP write failed') end end)) + end + s.shutdown=function() + if closed then return end; closed=true + local cancel=child and s.pending and s.session + if cancel then pcall(send,{method='session/cancel',params={sessionId=s.session}}) end + if cancel_check then cancel_check() end + if approval and not approval:is_closing() then approval:kill('sigkill') end + close(stdout) + if cancel then timer:stop(); timer:start(500,0,cleanup) else cleanup() end + end + local function step(co,...) + local ok,err=coroutine.resume(co,...); if not ok then s.fail(tostring(err)) end + end + local deadline, idle + local function activity() if waiting then deadline=uv.now()+idle end end + local function call(method,params) + assert(not waiting,'Overlapping ACP requests'); serial=serial+1; waiting=coroutine.running() + idle=(method=='session/prompt' or method=='authenticate') and 600000 or 60000 + activity(); timer:start(1000,1000,function() + if s.call then activity() elseif uv.now()>=deadline then s.fail('ACP timeout: '..method) end + end) + send({id=serial,method=method,params=params}); return coroutine.yield() + end + local selectors, opts, configuring = {}, {}, false + local function advertised() + local model=config(opts,s.selector) + s.offered(families(selectors, model and model.currentValue, choices(thought(opts)))) + end + local function level_for(wire, effort) + if not effort then return end + local o=thought(opts) + if not o and wire:sub(-#effort-1)=='-'..effort then return end -- legacy variant + if o and choices(o)[effort] then return o end + return nil, 'No advertised reasoning level '..effort..' for '..wire..'; see /antigravity-models' + end + s.resolve = function(effort) + local wire,err=wire_for(selectors,s.model,effort,thought(opts)) + if not wire then return nil,err end + if wire==s.wire then + local _,why=level_for(wire,effort); if why then return nil,why end + end + return wire + end + local function set_option(id,value) + opts=assert(call('session/set_config_option',{sessionId=s.session,configId=id,value=value}).configOptions) + assert((config(opts,id) or {}).currentValue==value,'ACP did not confirm '..id..'='..value) + end + local function confirmed() + 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 wire = assert(s.resolve(s.effort)) + configuring=true + s.selector,s.wire=selectors[wire],wire + if (config(opts,s.selector) or {}).currentValue~=wire then set_option(s.selector,wire) end + advertised() -- thought_level choices apply only to the now-selected model + local o,err=level_for(wire,s.effort); assert(not err,err) + s.thought=o and s.effort + if o and o.currentValue~=s.thought then set_option(o.id,s.thought) end + 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 reason=({end_turn='end_turn',max_tokens='max_tokens'})[r.stopReason] + assert(reason,'Turn stopped: '..tostring(r.stopReason)); s.prompting=false; s.complete(reason) + end + s.submit=function(text) step(coroutine.create(turn),text) 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 {} + 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}} + if #s.list>0 then params.mcpServers[1]={name='pantograph',command='/usr/bin/nc',args={'-U',s.dir..'/mcp'},env=json.array({})} end + local session + if resume_id then + assert((caps.sessionCapabilities or {}).resume,'ACP resume unavailable'); params.sessionId=resume_id + session=call('session/resume',params); assert(not session.sessionId or session.sessionId==resume_id,'Wrong resumed session'); s.session=resume_id + else + if s.instructions~='' then + assert(((((caps._meta or {}).antigravity or {}).systemPrompt or {}).append)==true,'Rig instruction append unavailable') + params._meta.antigravity={systemPrompt={append=s.instructions}} + end + session=call('session/new',params); assert(type(session.sessionId)=='string' and #session.sessionId>0,'Missing session ID'); s.session=session.sessionId + end + opts=session.configOptions or {} + for _,o in ipairs(opts) do + if o.category=='model' or o.id=='model' then + s.selector=o.id + for value,name in pairs(choices(o)) do + if (value:lower():match('^gemini%-') or name:lower():match('^gemini')) and + #value<=128 and not value:find('[^%w/_.:%-]') then selectors[value]=o.id end + end + end + end + advertised() + turn(first) + end + local function receive(q) + assert(q.jsonrpc=='2.0','Invalid ACP envelope') + if not q.method then + assert(waiting and q.id==serial,'Unexpected ACP reply'); assert(not q.error,(q.error or {}).message or 'ACP error') + local co=waiting; waiting=nil; timer:stop(); step(co,assert(q.result)); return + end + local p=q.params or {}; local ours=s.session and p.sessionId==s.session + if q.method=='session/update' and ours then + local u=p.update + if u.sessionUpdate=='config_option_update' and s.wire and not configuring then + opts=u.configOptions or {}; assert(confirmed(),'Configured model or reasoning level changed'); advertised() + elseif u.sessionUpdate=='agent_message_chunk' and u.content.type=='text' and s.prompting then s.delta(u.content.text) end + elseif q.method=='session/request_permission' and q.id~=nil then + local option; for _,o in ipairs(p.options or {}) do if o.kind=='allow_once' then option=o.optionId; break end end + local at=s.turn + local function answer(allow) if not closed then send({id=q.id,result={outcome=allow and s.prompting and s.turn==at and {outcome='selected',optionId=option} or {outcome='cancelled'}}}) end end + local detail=json.encode(p.toolCall or {}); if not p.toolCall or not ours or not s.prompting or not option or approval or #detail>4096 then answer(false); return end + approval=uv.spawn('/usr/bin/osascript',{args={'-e',dialog,'--',detail}},function(code,sig) close(approval); approval=nil; answer(code==0 and sig==0) end) + if not approval then answer(false) end + elseif q.id~=nil then send({id=q.id,error={code=-32601,message='Unsupported client method'}}) end + end + cancel_check=verified(function(bin,profile,env) + if #s.list>0 then seed_tool_permissions(profile) end + stdin,stdout=uv.new_pipe(false),uv.new_pipe(false) + child,pid=uv.spawn(bin,{args={'acp','--gemini-dir',profile,'--sandbox','--disable-telemetry'},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='' + 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 + while not closed do local n=buf:find('\n',1,true); if (n or #buf)>4<<20 then s.fail('Oversized ACP frame'); return end + if not n then return end; local line=buf:sub(1,n-1); buf=buf:sub(n+1) + local parsed,why=pcall(function() receive(json.decode(line)); activity() end); if not parsed then s.fail(tostring(why)); return end + end + end)); step(coroutine.create(setup)) + end,s.fail) +end +return M diff --git a/catalog.lua b/catalog.lua new file mode 100644 index 0000000..ef10bdf --- /dev/null +++ b/catalog.lua @@ -0,0 +1,46 @@ +local json = require('panto').ext.json +local M = {} +function M.catalog(req, names) + local all, by, list = {}, {}, json.array({}) + for _,t in ipairs(req.tools) do all[t.name]=t end + if names==nil then + names={}; for name in pairs(all) do names[#names+1]=name end; table.sort(names) + end + for i,name in ipairs(names) do + local t=assert(all[name], 'Tool not in active rig: '..name); local s=json.decode(t.input_schema_json) + assert(s.type=='object','Expected MCP object input schema for '..name) + local wire=name:gsub('%.','__'); assert(wire:match('^[%w_-]+$') and #wire<=128 and not by[wire], 'Invalid or colliding MCP tool name: '..name) + by[wire]={name=name,schema=s}; list[i]={name=wire,description=t.description,inputSchema=s} + end + return by,list +end + +-- Advertise the exact extension schema. Reject unsupported assertions on use, +-- rather than dropping constraints or preventing unrelated tools from loading. +local known={type=true,properties=true,required=true,additionalProperties=true,items=true,minItems=true,maxItems=true, + enum=true,minimum=true,maximum=true,description=true,title=true,default=true,examples=true,['$schema']=true} +local array_mt=getmetatable(json.array({})) +local function matches(s,v) + if type(s)=='boolean' then return s end + for k in pairs(s) do if not known[k] then return false,'Unsupported schema keyword: '..k end end + local kind=type(v) + if kind=='table' then kind=getmetatable(v)==array_mt and 'array' or 'object' elseif v==json.null then kind='null' end + if s.type and s.type~=kind and not (s.type=='integer' and kind=='number' and v%1==0) then return false end + if s.enum then + local found=false; for _,x in ipairs(s.enum) do if json.encode(x)==json.encode(v) then found=true; break end end + if not found then return false end + end + if kind=='object' then + for _,k in ipairs(s.required or {}) do if v[k]==nil then return false end end + for k,x in pairs(v) do + local sub=(s.properties or {})[k]; if sub==nil then sub=s.additionalProperties end + if sub~=nil then local ok,why=matches(sub,x); if not ok then return false,why end end + end + elseif kind=='array' then + if s.minItems and #v<s.minItems or s.maxItems and #v>s.maxItems then return false end + if s.items~=nil then for _,x in ipairs(v) do local ok,why=matches(s.items,x); if not ok then return false,why end end end + elseif kind=='number' and (s.minimum and v<s.minimum or s.maximum and v>s.maximum) then return false end + return true +end +M.arguments=matches +return M diff --git a/check.lua b/check.lua new file mode 100644 index 0000000..97e22ad --- /dev/null +++ b/check.lua @@ -0,0 +1,94 @@ +-- macOS: run with `panto lua check.lua`. Use the same Panto binary for the TUI and fake agy. +local uv, json = require('luv'), require('panto').ext.json +local panto = assert(uv.fs_realpath(uv.exepath())) +local root = assert(uv.fs_realpath(arg[0])):match('^(.*)/') +local function write(path, data) + local f = assert(io.open(path, 'wb')); assert(f:write(data)); assert(f:close()) +end +local function read(path) + local f = assert(io.open(path, 'rb')); local data = assert(f:read('a')); f:close(); return data +end +local function run(bin, args, opts, timeout) + opts = opts or {}; opts.args = args; opts.stdio = opts.stdio or {0, 1, 2} + local proc, timer, code, signal, expired + proc = assert(uv.spawn(bin, opts, function(c, s) + code, signal = c, s; proc:close(); if timer then timer:close() end + end)) + if timeout then + timer = assert(uv.new_timer()); timer:start(timeout, 0, function() expired = true; proc:kill('sigkill') end) + end + uv.run(); assert(not expired and signal == 0, bin .. ' timed out or was killed'); return code +end +local home = assert(uv.fs_mkdtemp('/private/tmp/panto-agy-XXXXXX')) +local function check() + 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"}'}}} + 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 cfg, data = home .. '/.panto', home .. '/.local/share/panto' + assert(run('/bin/mkdir', {'-p', cfg .. '/extensions', data}) == 0) + assert(run('/bin/cp', {'-cR', assert(os.getenv('HOME')) .. '/.local/share/panto/rocks', data .. '/rocks'}) == 0) + local source = 'paths=[' .. json.encode(root .. '/extensions') .. ']' + if os.getenv('PANTO_CHECK_ROCK') == '1' then + assert(run('luarocks', {'--lua-version','5.4','--tree',data .. '/rocks/lua-5.4.7','make','--deps-mode=none','panto-antigravity-scm-1.rockspec'}, {cwd=root}) == 0) + source = 'rocks=["panto-antigravity"]' + end + write(cfg .. '/config.toml', '[extensions]\n' .. source .. [[ + +[providers.antigravity] +protocol="antigravity-acp" +save_session=true +]]) + write(cfg .. '/models.toml', '[antigravity.fast]\nmodel="gemini-test"\n') + write(cfg .. '/SYSTEM.md', 'Short answers.') + local exe = home .. '/agy' + assert(uv.fs_symlink(panto, home .. '/panto')) -- short, space-free shebang path + write(exe, '#!' .. home .. '/panto lua\n' .. read(root .. '/tests/fake-agy.lua')) + assert(uv.fs_chmod(exe, 448)) + write(cfg .. '/extensions/signature.lua', [[ +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 + 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.', + 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} +end} +]]) + local env = {'HOME=' .. home, 'QUOTA_LOG=' .. home .. '/screen', 'TMPDIR=' .. home, + 'TERM=xterm-256color', 'PATH=' .. home .. ':/usr/bin:/bin', 'PANTO=' .. panto} + local profile = [[(version 1)(allow default) +(deny network-outbound (remote ip "*:*"))(deny network-bind (local ip "*:*")) +(deny process-exec)(allow process-exec (literal (param "PANTO")) (literal (param "FAKE")) +(literal "/usr/bin/true") (literal "/usr/bin/false") (literal "/usr/bin/nc") +(literal "/usr/bin/expect") (literal "/bin/stty"))]] + local function sandbox(args, timeout, stdio) + local cmd = {'-D', 'PANTO=' .. panto, '-D', 'FAKE=' .. exe, '-p', profile} + 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) + -- 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 screen = read(home .. '/screen'):gsub('\27%[[0-9;?]*[A-Za-z]', '') + 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') diff --git a/docs/findings.md b/docs/findings.md new file mode 100644 index 0000000..c1ee609 --- /dev/null +++ b/docs/findings.md @@ -0,0 +1,18 @@ +# Antigravity provider evidence + +## Subscription meter (offline) + +The bundled `agy` changelog for 1.1.11 documents `-p "/usage"` as a read-only print command that spends no model turn. Static inspection of **1.5.18** (`printmode.quotaRows`, `bucketRemaining`, `bucketReset`, `headless.writeRows`) established the piped record: group, bucket, **remaining**, UTC reset. A raw count has no denominator and cannot yield a percentage. This is an allowance reading, not ACP context occupancy or an estimate from token counts. The signed CLI also returned four-column TSV with `--gemini_dir <private profile> --sandbox -p /usage` in 1.5.19. Print mode rejects the ACP flags `--gemini-dir` and `--disable-telemetry`. The footer checks the exit status and records directly, without asking for a version. + +## Native tool switch (agy 1.5.19) + +An unauthenticated ACP probe in a temporary profile sent `_meta.disableBuiltInTools` with both `session/new` and `session/resume`. Both methods rejected a string with `-32602` (expected bool at `_meta.disableBuiltInTools`); `true` passed decoding and reached `Authentication required`. A string at the top level or under `_meta.antigravity` was ignored. This verifies the wire field, not the tool inventory of a signed-in Neon turn. `check.lua` tests both outbound envelopes and actual MCP listing/dispatch through the Panto TUI with a fake peer. For the live check use the read-card and `/antigravity-status` procedure in the README. + +## Subscription spike (November 2026) + +- The operator reported a successful human-driven marker conversation and follow-up. The first answer depended on a fresh Panto Lua result; the second turn stayed in the ACP session. No live transcript, model ID, tier or credentials were recorded. This established the integration pattern, not general rig compatibility or Google approval. +- Offline, signed `agy 1.5.18` advertised ACP v1, native `oauth-personal`, prompt append, and session resume. A fully network-blocked `session/new` stopped at the CLI’s own loopback listener; that was not an authentication result. Saved-session behavior, model-change handling and cancellation were exercised with a fake ACP peer, not a live account. +- ACP owns the conversation, model selection, permissions and follow-up inference. MCP carries tool calls; ACP tool updates must never execute them a second time. Use the account’s advertised Gemini choices, no transcript replay, proxying, autonomous delegation, account rotation or billing fallback. +- A command cannot dispatch tools directly on the borrowed primary agent. Copying tool declarations to an owned child retained the original handler closure but changed its session identity. Waiting in `run_foreground` blocked the primary loop. A local-only Panto protocol instead emitted native tool events on the primary thread; the MCP relay could restart without moving the handler. Interrupting the host removed its private endpoint. +- Additional MCP tools do not imply exclusive dispatch. Neither suppression of native tools nor isolation from other configured servers was established. Do not expose delegation tools on the personal route. +- Reference: [Google ACP editor guide](https://antigravity.google/docs/ide/extensions/acp), [Terms §6](https://antigravity.google/terms), [T3/Zed clarification](https://discuss.ai.google.dev/t/197131/3), [disputed narrower interpretation](https://discuss.ai.google.dev/t/202970/5), [delegation guidance](https://discuss.ai.google.dev/t/203835/7), [pinned T3 adapter](https://github.com/pingdotgg/t3code/blob/6f2e02c1e10a4e4b1d9eb41d55e49ac4b606344b/apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts#L165-L169). T3’s precedent is an additive instruction and a per-session MCP descriptor, not a replacement system prompt. diff --git a/extensions/antigravity-acp.lua b/extensions/antigravity-acp.lua new file mode 100644 index 0000000..98ab958 --- /dev/null +++ b/extensions/antigravity-acp.lua @@ -0,0 +1,176 @@ +-- The native provider owns the ACP subprocess and renders into Panto's existing turn. +local p, uv = require('panto'), require('luv') +local ext, json = p.ext, p.ext.json +-- A checkout has one discoverable file in extensions/. LuaRocks puts helpers +-- in its package namespace; don't resolve generic names from another extension. +local root=debug.getinfo(1,'S').source:match('^@(.*/)extensions/[^/]+$') +local function companion(name) + if root then return dofile(root..name..'.lua') end + return require('panto-antigravity.'..name) +end +local catalog,acp=companion('catalog'),companion('acp') +local active +local function stop() + local s=active; if not s then return end; active=nil + if s.shutdown then s.shutdown() end + if s.peer and not s.peer:is_closing() then s.peer:close() end + s.server:close(); uv.fs_unlink(s.dir..'/mcp'); uv.fs_rmdir(s.dir) + if s.lock then uv.fs_rmdir(s.lock) end + if s.notify then s.notify() end +end +local function release(id) if active and active.sid==id then stop() end end +local function send(c,msg) msg.jsonrpc='2.0'; c:write(json.encode(msg)..'\n') end +local function rpc(s,c,q) + if type(q)~='table' or q.jsonrpc~='2.0' or type(q.method)~='string' then error('Invalid MCP request') end + if q.method=='notifications/cancelled' and s.call and q.params and q.params.requestId==s.call.id then s.fail('MCP call cancelled'); return end + if q.id==nil then return end + assert(type(q.id)=='string' or math.type(q.id)=='integer','Invalid MCP request ID') + local function fail(code,msg) send(c,{id=q.id,error={code=code,message=msg}}) end + local result + if q.method=='initialize' then result={protocolVersion='2025-06-18',capabilities={tools={}},serverInfo={name='pantograph',version='0.1'}} + elseif q.method=='ping' then result={} + elseif q.method=='tools/list' then s.listed=true; result={tools=s.list} + elseif q.method=='tools/call' then + local args=q.params or {}; local tool=s.by[args.name]; local v=args.arguments + if v==nil then v={} end + if not tool then return fail(-32602,'Tool unavailable') end + local ok,why=catalog.arguments(tool.schema,v); if not ok then return fail(-32602,why or 'Tool arguments rejected') end + if not s.prompting then return fail(-32000,'No human turn pending') end + if s.call then return fail(-32000,'Another Panto tool call is pending') end + s.seq=s.seq+1; s.call={id=q.id,tag=s.dir:match('[^/]+$')..'-'..s.seq,name=tool.name,input=json.encode(v)}; s.notify(); return + else return fail(-32601,'Unsupported method') end + send(c,{id=q.id,result=result}) +end +local function start(req,by,list,signature,save) + local dir=assert(uv.fs_mkdtemp('/tmp/panto-antigravity-XXXXXX')) + local s={sid=req.context,dir=dir,server=uv.new_pipe(false),by=by,list=list,seq=0,notify=req.notify}; active=s + s.fail=function(msg) if active==s then s.error=tostring(msg):gsub('[%c]',' '):sub(1,512); stop() end end + s.model,s.instructions,s.cwd,s.signature,s.save=req.model,req.system_prompt or '',assert(uv.cwd()),signature,save + if save then + assert(s.sid:match('^[%x-]+$'),'Invalid Panto session ID') + local lock='/tmp/panto-antigravity-lock-'..uv.getuid()..'-'..s.sid + assert(uv.fs_mkdir(lock,448),'Saved thread locked: '..lock); s.lock=lock + end + s.key='antigravity_acp.checkpoint.'..s.sid + assert(s.server:bind(dir..'/mcp')); assert(s.server:listen(1,function(err) + if err or active~=s then return end + local c=uv.new_pipe(false); if not s.server:accept(c) or s.peer then c:close(); return end + s.peer=c; local buf=''; c:read_start(function(e,chunk) + if active~=s or s.peer~=c or c:is_closing() then return end + if e or not chunk then if s.call then s.fail('MCP disconnected during tool call') else s.peer=nil; c:close() end; return end + buf=buf..chunk + while active==s do + local at=buf:find('\n',1,true); if (at or #buf)>1048576 then s.fail('Oversized MCP request'); return end + if not at then return end + local line=buf:sub(1,at-1); buf=buf:sub(at+1) + if not pcall(function() rpc(s,c,json.decode(line)) end) then s.fail('Malformed MCP request'); return end + end + end) + end)) + return s +end +local function digest(text,h) + h=h or 0xcbf29ce484222325; for i=1,#text do h=(h ~ text:byte(i))*0x100000001b3 end; return h +end +local function history(msgs,n) + local h; for i=1,n do h=digest(json.encode({msgs[i].role,msgs[i].blocks}),h) end; return ('%016x'):format(h or 0) +end +local function terminal(message) return {next=function() return {type='error',kind='terminal',message=message} end} end +local function validate(cfg) + for _,key in ipairs({'save_session','usage_footer'}) do + assert(cfg[key]==nil or type(cfg[key])=='boolean',key..' must be a boolean') + end + if cfg.tools~=nil then + assert(type(cfg.tools)=='table','tools must be a list of Panto tool names') + for i,name in pairs(cfg.tools) do assert(math.type(i)=='integer' and i>=1 and i<=#cfg.tools and type(name)=='string' and name~='', 'Invalid tools list') end + end +end +return {name='protocol.antigravity-acp',configure=function(config) + for _,cfg in pairs(config.providers or {}) do if cfg.protocol=='antigravity-acp' then validate(cfg) end end +end,activate=function() + local ready,refresh,offers=false,nil,nil + for _,cfg in pairs(ext.config.providers or {}) do + if cfg.protocol=='antigravity-acp' and cfg.usage_footer~=false then + refresh=companion('quota').activate(ext,companion('_usage_footer'),acp); break + end + end + ext.register_command{name='antigravity-status',description='Show local Antigravity connection status (no account request).',handler=function() + if not active or not active.session then return 'Antigravity: no connected ACP session. Submit text to start; sign-in is managed by the Google CLI.' end + local model=(active.wire or active.model)..(active.thought and ' ('..active.thought..')' or '') + return ('Antigravity: %s · %s · %d Panto tools · MCP %s · %d calls'):format(model,active.pending and 'turn pending' or 'ready',#active.list,active.listed and 'listed' or 'not listed',active.seq) + end} + ext.register_command{name='antigravity-models',description='List Gemini families and reasoning levels from the last ACP setup (no account request).',handler=function() + if not offers then return 'No model list yet. Submit a turn to let the Google CLI advertise its available models.' end + return #offers>0 and ('Gemini models: '..table.concat(offers,'; ')) or 'No displayable Gemini models were advertised.' + end} + ext.on('session_ready',function() ready=true end) + ext.on('session_end',function() ready=false; offers=nil; stop() end) + ext.register_protocol{name='antigravity-acp',effort_levels=acp.effort_levels,close=stop,cancel_turn=release,reset_context=release,release_context=release,open=function(req) + local info=ext.session_info() + if not ready or not info or req.purpose~='turn' or info.session_id~=req.context then return terminal('Interactive primary thread required') end + local msgs=req.messages; local last=msgs[#msgs]; local b=last and last.blocks[1]; local s=active + if s and s.sid~=req.context then return terminal('Another thread owns this session') end + if req.tui_submission==true and last and last.role=='user' and #last.blocks==1 and b.type=='text' then + if s and s.pending then return terminal('An Antigravity turn is already pending') end + local cfg=ext.config.providers[req.provider]; validate(cfg); local by,list=catalog.catalog(req,cfg.tools) + local sig=('%016x'):format(digest(json.encode({'mcp-only-v1',uv.cwd(),req.provider,req.model,req.system_prompt or '',list}))) + local prior=msgs[#msgs-1]; local tag=prior and prior.metadata and prior.metadata.antigravity_acp + local key='antigravity_acp.checkpoint.'..req.context + if prior or s then + local reply=''; for _,v in ipairs(prior and prior.blocks or {}) do if v.type=='text' then reply=reply..v.text else reply=nil; break end end + if not (tag and tag.thread==req.context and tag.signature==sig and tag.history==history(msgs,#msgs-2) and reply and tag.response==('%016x'):format(digest(reply)) and + ((s and s.last==tag.turn) or (not s and cfg.save_session==true and tag.session and ext.state.get(key)==tag.turn))) then + stop(); return terminal('No matching Antigravity history checkpoint. Start a new Panto thread; nothing was replayed.') + end + end + if not s then + local ok,value=pcall(start,req,by,list,sig,cfg.save_session==true); if not ok then stop(); return terminal(tostring(value)) end; s=value + if tag and s.save and ext.state.get(key)~=tag.turn then stop(); return terminal('Saved Antigravity checkpoint changed') end + end + if s.resolve then + local wire,why=s.resolve(req.effort); if not wire then return terminal(why) end + end + s.effort=req.effort + if s.save then local ok,err=ext.state.set(key,nil); if not ok then stop(); return terminal(tostring(err)) end end + s.pending=true; s.notify=req.notify; s.buffer=''; s.response=digest(''); s.prefix=history(msgs,#msgs) + s.delta=function(text) + assert(type(text)=='string' and #s.buffer+#text<=4<<20,'Invalid ACP text'); s.buffer=s.buffer..text; s.notify() + end + -- Only an authenticated direct turn is allowed to request a quota read. + s.offered=function(models) offers=models end + s.refresh=refresh and cfg.usage_footer~=false and refresh or nil + s.complete=function(reason) + assert(not s.call,'Prompt ended with an outstanding MCP call'); s.last=s.dir..':'..tostring(s.turn); s.finished=reason; s.notify() + end + s.turn=(s.turn or 0)+1 + local ok,err=pcall(function() if s.submit then s.submit(b.text) else acp.launch(s,b.text,tag and tag.session) end end); if not ok then s.fail(err) end + elseif s and s.pending and s.call and s.call.sent and last and last.role=='user' and #last.blocks==1 and b.type=='tool_result' and b.tool_use_id==s.call.tag then + s.prefix=history(msgs,#msgs); s.response=digest('') + local parts=json.array({}); local failed=b.is_error + for _,v in ipairs(b.content) do + if v.type=='text' then parts[#parts+1]={type='text',text=v.text} + elseif v.type=='media' and v.media_type:match('^image/') then parts[#parts+1]={type='image',mimeType=v.media_type,data=v.data} + else failed=true; parts[#parts+1]={type='text',text='Unsupported tool result content'} end + end + send(s.peer,{id=s.call.id,result={isError=failed,content=parts}}); s.call=nil + else + if s and s.pending then s.fail('Unexpected Panto continuation') end + return terminal('Antigravity requires direct TUI input on a provenance-aware Panto build. No subscription request sent.') + end + s.notify=req.notify + return {next=function() + if s.error then return {type='error',kind='terminal',message=s.error} end + if active~=s then return {type='error',kind='terminal',message='Antigravity session closed'} end + if s.buffer~='' then local text=s.buffer; s.buffer=''; s.response=digest(text,s.response); return {type='text_delta',text=text} end + if s.finished then + local reason=s.finished; s.finished=nil; s.pending=false + if s.refresh then pcall(s.refresh) end + if s.save then assert(ext.state.set(s.key,s.last)) end + return {type='done',termination={reason=reason},metadata={antigravity_acp={thread=s.sid,session=s.save and s.session or nil,turn=s.last,signature=s.signature,history=s.prefix,response=('%016x'):format(s.response)}}} + end + local call=s.call; if not call then return nil end + if call.sent then return {type='done',termination={reason='tool_use'}} end + call.sent=true; return {type='tool_call',id=call.tag,name=call.name,input_json=call.input} + end} + end} +end} diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..376a6fe --- /dev/null +++ b/mise.toml @@ -0,0 +1,10 @@ +[tasks.check] +description = "Offline Antigravity provider acceptance check (macOS, fake account and CLI)" +run = ''' +set -eu +bin="${PANTO:-$(command -v panto)}" +luarocks lint panto-antigravity-scm-1.rockspec +"$bin" lua _quota_selfcheck.lua +"$bin" lua check.lua +PANTO_CHECK_ROCK=1 "$bin" lua check.lua +''' diff --git a/quota.lua b/quota.lua new file mode 100644 index 0000000..a71369d --- /dev/null +++ b/quota.lua @@ -0,0 +1,163 @@ +local uv = require('luv') +local M = {} +local key = 'panto-antigravity:private-profile' -- all configured aliases share ACP's one private profile +local max_bytes, refresh_ms, stale_s = 32768, 60000, 300 + +local function name(s) + return #s <= 100 and not s:find('[^ -~]') and s:find('%S') +end + +-- agy 1.5.18 bundled changelog and static inspection of printmode.quotaRows, +-- bucketRemaining, bucketReset and headless.writeRows: piped /usage emits +-- group name, bucket name, remaining (%.0f%%, %d or disabled), UTC RFC3339 or empty. +-- There is no header; integer amounts do not establish a denominator. +function M.parse(body, reset_time) + if type(body) ~= 'string' or #body > max_bytes then return nil end + local windows, seen, count = {}, {}, 0 + if body == '' then return windows end + if body:sub(-1) ~= '\n' then return nil end -- the writer terminates every record + for line in body:gmatch('([^\n]*)\n') do + local group, bucket, remaining, reset = line:match('^([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)$') + if not group or (group ~= '' and not name(group)) or not name(bucket) then return nil end + local id = group .. '\t' .. bucket + count = count + 1 + if count > 64 or seen[id] then return nil end + seen[id] = true + local pct = tonumber(remaining:match('^(%d%d?%d?)%%$')) + local at + if reset ~= '' then + if not reset:match('^%d%d%d%d%-%d%d%-%d%dT%d%d:%d%d:%d%dZ$') then return nil end + at = reset_time(reset) + if not at or at < 0 then return nil end + end + if pct then + if pct > 100 or tostring(pct) .. '%' ~= remaining then return nil end + elseif remaining == 'disabled' then + if at then return nil end + elseif not remaining:match('^%-?%d+$') then + return nil + end + if pct or at then + local label = group ~= '' and group ~= bucket and (group .. ' / ' .. bucket) or bucket + windows[#windows + 1] = { + label = pct and label:gsub(' Limit Remaining$', ' Limit Used') or label, + used_percent = pct and 100 - pct or nil, + resets_at = at, + } + end + end + return windows +end + +local function close(handle) + if handle and not handle:is_closing() then handle:close() end +end + +function M.activate(ext, footer, acp) + local state = footer.install(ext) + if not state or state.closed then return function() end end + if state.antigravity_refresh then return state.antigravity_refresh end + local alive, pending, next_run = true, nil, 0 + + local function publish(windows) + if not alive then return end + local function section(rows, why) + return footer.section(ext, 'antigravity', rows, { status = why }) + end + local render + if windows and #windows > 0 then + local expires = os.time() + stale_s + local stale = section({}, 'stale') + local cached, deadline = nil, 0 + render = function(now) + if now >= expires then return stale(now) end + if not cached or now >= deadline then + local current = {} + deadline = expires + for _, w in ipairs(windows) do + if not w.resets_at or w.resets_at > now then + current[#current + 1] = w + if w.resets_at then deadline = math.min(deadline, w.resets_at) end + end + end + cached = section(current, #current < #windows and 'stale' or nil) + end + return cached(now) + end + else + render = section({}, windows and 'unknown' or 'unavailable') + end + state.sections[key] = nil -- never leave a previous snapshot on a failed publication + pcall(footer.publish, ext, key, render) + end + + -- The caller supplies direct-turn provenance. A rendered footer also gates + -- headless use. Drop duplicate calls in flight or inside the cooldown; no polling. + local function refresh() + if not alive or not state.handle or pending then return end + local now = uv.hrtime() / 1000000 + if now < next_run then return end + next_run = now + refresh_ms + local req, chunks, bytes = {}, {}, 0 + pending = req + local function finish(windows) + if req.done then return end + req.done, chunks = true, nil + if req.cancel then pcall(req.cancel); req.cancel = nil end + close(req.timer); close(req.stdout) + if not windows and req.pid then pcall(uv.kill, -req.pid, 'sigkill') end + if not req.child then pending = nil end -- don't launch over a child awaiting reap + publish(windows) + end + req.stop = function() finish(nil) end + local function complete() + if not req.done and req.eof and req.exited then + finish(M.parse(table.concat(chunks), footer.reset_time)) + end + end + local ok = pcall(function() + req.timer = assert(uv.new_timer()) + local cancel = acp.probe(function(bin, profile, env) + if req.done or req.stdout then return end + req.cancel = nil -- verification has completed + assert(req.timer:start(15000, 0, req.stop)) + req.stdout = assert(uv.new_pipe(false)) + -- Detached (no controlling tty) + closed input. The CLI's + -- print-mode auth path returns without interactive login in this case. + req.child, req.pid = uv.spawn(bin, { + args = {'--gemini_dir', profile, '--sandbox', '-p', '/usage'}, + cwd = profile, env = env, detached = true, stdio = {nil, req.stdout, nil}, + }, function(code, sig) + close(req.child); req.child, req.pid = nil, nil + if req.done then pending = nil; return end + if code ~= 0 or sig ~= 0 then req.stop(); return end + req.exited = true + complete() + end) + if not req.child then req.pid = nil; req.stop(); return end + assert(req.stdout:read_start(function(err, data) + if req.done then return end + if err then req.stop(); return end + if not data then req.eof = true; close(req.stdout); complete(); return end + bytes = bytes + #data + if bytes > max_bytes then req.stop(); return end + chunks[#chunks + 1] = data + end)) + end, req.stop) + if not req.done and not req.stdout then req.cancel = cancel end + end) + if not ok then req.stop() end + end + -- Install the row immediately without touching the account. Only the human + -- turn callback below may replace the placeholder with an actual reading. + pcall(footer.publish,ext,key,footer.section(ext,'antigravity',{}, {status='awaiting first turn'})) + state.antigravity_refresh = refresh + ext.on('session_end', function() + alive = false + if pending then pending.stop() end + state.antigravity_refresh, state.sections[key] = nil, nil + end) + return refresh +end + +return M diff --git a/tests/fake-agy.lua b/tests/fake-agy.lua new file mode 100644 index 0000000..cd4f460 --- /dev/null +++ b/tests/fake-agy.lua @@ -0,0 +1,111 @@ +-- Offline agy fixture. check.lua installs this with Panto's embedded Lua shebang. +local uv, json = require('luv'), require('panto').ext.json +local home = assert(os.getenv('HOME')) +if arg[1] == '--version' then error('unexpected version check') end +if arg[1] ~= 'acp' then + assert(json.encode({table.unpack(arg)}) == json.encode({ + '--gemini_dir', home, '--sandbox', '-p', '/usage', + }), 'unrecognized fake CLI invocation') + if uv.fs_stat(home .. '/usage-failure') then os.exit(3) end + assert(uv.cwd() == home and home:match('/google$') and uv.guess_handle(0) ~= 'tty') + print('Gemini\tWeekly\t73%\t2099-02-03T12:00:00Z'); return +end + +local function read() return json.decode(assert(io.read('l'), 'ACP input closed')) end +local function send(msg) + msg.jsonrpc = '2.0'; assert(io.write(json.encode(msg), '\n')); assert(io.flush()) +end +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 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) + return q +end +local function finish(q, text) + send({method='session/update', params={sessionId='test-session', update={ + sessionUpdate='agent_message_chunk', content={type='text', text=text}, + }}}) + reply(q, {stopReason='end_turn'}) +end + +local q = request('initialize') +reply(q, {protocolVersion=1, authMethods={{id='oauth-personal'}}, agentCapabilities={ + sessionCapabilities={resume={}}, _meta={antigravity={systemPrompt={append=true}}}, +}}) +q = request('authenticate'); assert(json.encode(q.params) == '{"methodId":"oauth-personal"}'); reply(q) +q = read() +local setup, resumed = q.params, q.method == 'session/resume' +assert(#setup.mcpServers == 1 and setup.mcpServers[1].name=='pantograph' and setup._meta.disableBuiltInTools == true) +local settings=home..'/antigravity-cli/settings.json' +local f=assert(io.open(settings,'r')); local policy=json.decode(f:read('a')); f:close() +if resumed or uv.fs_stat(home..'/usage-failure') then + assert(policy.permissions.ask[1]=='mcp(pantograph/*)', 'existing settings replaced') +else + assert(json.encode(policy)=='{"permissions":{"allow":["mcp(pantograph/*)"]}}', 'missing scoped agy default') + f=assert(io.open(settings,'w')); assert(f:write('{"permissions":{"ask":["mcp(pantograph/*)"]}}')); assert(f:close()) +end +if resumed then assert(setup.sessionId == 'test-session' and not setup._meta.antigravity) +else assert(q.method == 'session/new' and setup._meta.antigravity.systemPrompt.append:find('Short answers', 1, true)) end +if resumed then -- Older ACP pickers may expose suffixed models instead. + reply(q, {sessionId='test-session', configOptions={{id='model', options={{name='Gemini test', value='gemini-test-high'}}}}}) + q=request('session/set_config_option'); assert(q.params.configId=='model' and q.params.value=='gemini-test-high') + reply(q, {configOptions={{id='model', currentValue=q.params.value}}}) +end +local function split(model, level, levels) + local choices={}; for _,v in ipairs(levels) do choices[#choices+1]={value=v,name=v} end + return {{id='model', currentValue=model, options={{value='gemini-test',name='Gemini test'}}}, + {id='thought_level', currentValue=level, options=choices}} +end +local function set_level(value) + local req=request('session/set_config_option'); assert(req.params.configId=='thought_level' and req.params.value==value) + local opts=split('gemini-test',value,{'low','high'}) + send({method='session/update',params={sessionId='test-session',update={sessionUpdate='config_option_update',configOptions=opts}}}) + reply(req,{configOptions=opts}) +end +if not resumed then + reply(q,{sessionId='test-session',configOptions=split('gemini-other','high',{'high','xhigh'})}) + q=request('session/set_config_option'); assert(q.params.configId=='model' and q.params.value=='gemini-test') + reply(q,{configOptions=split('gemini-test','high',{'low','high'})}) + set_level('low') +end + +local function check_relay(server) + local input, output = assert(uv.pipe()), assert(uv.pipe()) + local proc = assert(uv.spawn(server.command, {args=server.args, stdio={input.read, output.write, 2}}, function() end)) + uv.fs_close(input.read); uv.fs_close(output.write) + local function rpc(id, method, params) + local line = json.encode({jsonrpc='2.0', id=id, method=method, params=params or {}}) .. '\n' + assert(uv.fs_write(input.write, line, -1) == #line) + local buf = '' + repeat + local chunk = assert(uv.fs_read(output.read, 4096, -1)); assert(chunk ~= '', 'relay closed'); buf = buf .. chunk + until buf:sub(-1) == '\n' + local r = json.decode(buf); assert(r.id == id); return r + end + assert(rpc(1, 'initialize').result.serverInfo.name == 'pantograph') + local tools = rpc(2, 'tools/list').result.tools + local schemas={}; for _,t in ipairs(tools) do schemas[t.name]=t.inputSchema end + assert(schemas.std__read and schemas.std__edit and schemas.fixture__echo.properties.rows.items.required[1]=='value') + assert(rpc(3, 'tools/call', {name='not_exported', arguments={}}).error.code == -32602) + assert(rpc(5, 'tools/call', {name='fixture__echo', arguments={rows={{value='bad'}}}}).error.code == -32602) + local echo=rpc(6, 'tools/call', {name='fixture__echo', arguments={rows={{value=42}}}}).result + assert(echo.isError==false and echo.content[1].text=='42') + local r = rpc(4, 'tools/call', {name='std__read', arguments={path=uv.cwd() .. '/.panto/SYSTEM.md'}}).result + assert(r.isError == false and r.content[1].text:find('Short answers', 1, true)) + proc:kill('sigkill'); uv.fs_close(input.write); uv.fs_close(output.read); uv.run(); proc:close() +end + +if resumed then finish(prompt('resume'), 'resumed-ok') else + q = prompt('hello') + send({id='perm', method='session/request_permission', params={sessionId='test-session', + toolCall={title='Read local file'}, options={{kind='allow_once', optionId='once'}}, + }}) + assert(json.encode(read().result.outcome) == '{"outcome":"cancelled"}') + check_relay(setup.mcpServers[1]); finish(q, 'primary-tool-ok') + set_level('high') + finish(prompt('again'), 'same-session-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 new file mode 100644 index 0000000..4f79c31 --- /dev/null +++ b/tests/tui.exp @@ -0,0 +1,46 @@ +set timeout 12 +log_user 0 +log_file -a $env(QUOTA_LOG) +match_max 32000 +spawn -noecho $env(PANTO) -m antigravity:fast -r low +proc see {pattern} {expect { + -re $pattern {} + timeout {puts stderr "timeout awaiting $pattern: $expect_out(buffer)"; exit 1} + eof {puts stderr "early exit: $expect_out(buffer)"; exit 1} +}} +see {antigravity:} +foreach {prompt answer} {hello primary-tool-ok again same-session-ok} { + send -- $prompt; see $prompt; send -- "\r" + if {$prompt == "hello"} { + set reply 0; set quota 0 + while {!$reply || !$quota} { + expect { + -exact "primary-tool-ok" {set reply 1} + -exact "27%" {set quota 1} + timeout {puts stderr "first turn: reply=$reply quota=$quota"; exit 1} + eof {exit 1} + } + } + send -- "/reasoning high"; see {/reasoning high}; send -- "\r"; see {reasoning -> high} + } else {see $answer} +} +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 +see {antigravity:}; send -- "resume"; see {resume}; send -- "\r" +set reply 0; set quota 0 +while {!$reply || !$quota} { + expect { + -exact "resumed-ok" {set reply 1} + -exact "unavailable" {set quota 1} + timeout {puts stderr "resume: reply=$reply quota=$quota"; exit 1} + eof {exit 1} + } +} +send -- "\003"; expect eof; wait + +# xhigh exists before switching models, but not on gemini-test. +spawn -noecho $env(PANTO) --incognito -m antigravity:fast -r xhigh +see {antigravity:}; send -- "unsupported"; see {unsupported}; send -- "\r" +see {reasoning level xhigh} +send -- "\003"; expect eof; wait |
