diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | _quota_selfcheck.lua | 6 | ||||
| -rw-r--r-- | _usage_footer.lua | 8 | ||||
| -rw-r--r-- | quota.lua | 18 |
4 files changed, 24 insertions, 10 deletions
@@ -17,7 +17,7 @@ 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. +**Usage footer (TUI only):** 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. diff --git a/_quota_selfcheck.lua b/_quota_selfcheck.lua index 4d76bd4..510bddf 100644 --- a/_quota_selfcheck.lua +++ b/_quota_selfcheck.lua @@ -51,14 +51,20 @@ 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) +hooks.render_footer[1]({has_tui = false, get_component = function() error('footer wrapped in print mode') end}) local component hooks.render_footer[1]({ + has_tui = true, 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 +hooks.session_ready[1]({has_tui = false}) +refresh() +assert(rendered() == 'native footer' and probes == 0, 'headless quota read or placeholder') +hooks.session_ready[1]({has_tui = true}) 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) diff --git a/_usage_footer.lua b/_usage_footer.lua index 2c27e8b..421afd5 100644 --- a/_usage_footer.lua +++ b/_usage_footer.lua @@ -130,6 +130,7 @@ function M.install(ext) state = { sections = {} } package.loaded[slot] = state ext.on("render_footer", function(event) + if event.has_tui == false then return end local inner = event:get_component() state.handle = event:set_component({ render = function(_, width) @@ -147,6 +148,7 @@ function M.install(ext) return lines end, }) + if state.handle and next(state.sections) then start_clock(state) end end) ext.on("session_end", function() state.closed = true @@ -169,8 +171,10 @@ function M.publish(ext, key, section, windows, status, 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 + if state.handle then + start_clock(state) + state.handle:invalidate() + end return true end @@ -57,7 +57,7 @@ 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 alive, ready, pending, next_run = true, false, nil, 0 local function publish(windows) if not alive then return end @@ -91,10 +91,10 @@ function M.activate(ext, footer, acp) 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. + -- The caller supplies direct-turn provenance. Only a visible footer needs + -- a sample. 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 + if not alive or not ready 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 @@ -148,9 +148,13 @@ function M.activate(ext, footer, acp) 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'})) + ext.on('session_ready', function(event) + if not alive or ready or event.has_tui == false then return end + ready = true + -- Show a placeholder without touching the account; only a direct turn + -- may replace it with an actual reading. + pcall(footer.publish,ext,key,footer.section(ext,'antigravity',{}, {status='awaiting first turn'})) + end) state.antigravity_refresh = refresh ext.on('session_end', function() alive = false |
