diff options
Diffstat (limited to 'quota.lua')
| -rw-r--r-- | quota.lua | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -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 |
