diff options
| author | t <t@tjp.lol> | 2026-12-01 16:31:43 -0700 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-12-04 13:53:47 -0700 |
| commit | 8c1c5786ebfe8dda40a70571f332e876b184ad4d (patch) | |
| tree | 1116068ae630c45c1218b17fabb3d253bb8003d9 /_quota_selfcheck.lua | |
| parent | f7a1e30c1dfbe5fddcbfe38e89a0c5efef9fbeab (diff) | |
Isolate ACP via custom agent and add steering, usage, reseed, and footer updates
Replace the osascript permission dialog and settings.json permission seed with
a per-thread generated custom main agent (excludeDefaultComponents, tools: [],
no inherited customizations or MCP) launched with --agent,
--include-default-customizations=false, and --dangerously-skip-permissions.
Keep HOME unchanged (isolating via --gemini-dir only) so macOS finds the login
Keychain, mark exported tools with antigravity/alwaysLoad, and require the
relay to serve tools/list before the first prompt.
Add ACP turn steering for queued user and workflow text at tool boundaries,
preserve agent_thought_chunk thinking blocks with block-aware checkpoint
hashing, report live usage_update context snapshots and deduplicated final plus
steering token usage, and mount a live above-input native tool activity
component for up to six non-MCP ACP calls.
Support reseeding a new ACP session from history_transcript after /tree or cold
resume, allow direct submissions to take over an idle session from another
thread, and let extension follow-ups continue a matching warm session. Update
the usage footer with startup and three-minute timer refreshes, 1w/5h labels,
per-letter antigravity colors, and expired-bucket handling.
Diffstat (limited to '_quota_selfcheck.lua')
| -rw-r--r-- | _quota_selfcheck.lua | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/_quota_selfcheck.lua b/_quota_selfcheck.lua index 510bddf..488f1d2 100644 --- a/_quota_selfcheck.lua +++ b/_quota_selfcheck.lua @@ -6,15 +6,16 @@ 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' + .. 'Inactive\tLegacy\t100%\t1970-01-01T00:00:00Z\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) +assert(limits[1].label == '1w' and limits[1].used_percent == 27) +assert(limits[2].label == '5h' 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 == 5 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(rows[5].used_percent == nil and rows[5].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', @@ -64,15 +65,23 @@ end hooks.session_ready[1]({has_tui = false}) refresh() assert(rendered() == 'native footer' and probes == 0, 'headless quota read or placeholder') +local model = 'other:test' +ext.config={providers={alias={protocol='antigravity-acp'}}}; ext.session_info=function() return {model=model} end +local new_timer, clock = uv.new_timer +uv.new_timer=function() clock=new_timer(); return clock end hooks.session_ready[1]({has_tui = true}) +uv.new_timer=new_timer +assert(clock:get_repeat()==180000) 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) +assert(table.concat(component:render(132), '\n'):find('\27[34ma\27[31mn\27[33mt\27[34mi\27[32mg\27[31mr\27[34ma\27[31mv\27[33mi\27[34mt\27[32my',1,true), 'missing per-letter footer colors') +assert(rendered():find('antigravity usage: loading',1,true) and rendered():find('peer usage footer',1,true) and probes == 1) 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(not line:find('Legacy',1,true) and not line:find('stale',1,true),'expired CLI buckets tainted a fresh sample') assert(select(2, line:gsub('antigravity usage:', '')) == 1) wall = wall + 60 line = rendered() @@ -81,6 +90,11 @@ wall = wall + 240 assert(rendered():find('antigravity usage: stale', 1, true)) assert(not rendered():find('Flash', 1, true)) +-- Exercise the actual timer callback, without waiting three minutes or sending a turn. +advance=advance+180*10^9 +clock:set_repeat(1); clock:again(); clock:ref(); uv.sleep(3); uv.run('nowait'); assert(probes==1) +model='alias:neon'; uv.sleep(3); uv.run('nowait'); clock:stop(); assert(probes==2) +verified('/fake-agy',profile,env); uv.run(); assert(spawns==2 and rendered():find('Flash 0%',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() @@ -94,9 +108,9 @@ 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) +refresh(); assert(probes == 7 and spawns == 6) 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(cancelled == 1 and spawns == 6 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') |
