palladius / palladius/antigravity-ruby-sdk

Refactor step-log TUI into lib/antigravity/tui.rb

Open
#17 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Ruby
Stars
0
Forks
0
Avg merge
4m
Merged PRs (30d)
1

Description

Summary

The hooks-based step-log TUI pattern (permanent lines for tool calls, dynamic status line with timer, colored states, tool elapsed time) is currently duplicated in:

  • examples/08_e2e_telegram_bot.rb
  • examples/09_e2e_nanobanana.rb

It should live in the SDK as a reusable module.

Proposed API

# Option A: constructor flag
agent = Antigravity::Agent.new(tui: :step_log)

# Option B: explicit attachment
Antigravity::TUI::StepLog.attach(agent)

# Option C: block-based
agent.with_tui(:step_log) do
  agent.ask("hello")
end

What the TUI does

  1. Step log -- permanent lines for significant WS events (tool calls, state changes, errors, first text delta)
  2. Dynamic status line -- overwrites in-place with \r\e[K, shows: 🏃 running 🔧 tool_name 42s 💭💭 ⏳45s 7↕
  3. Tool elapsed time -- tracks per-tool start time, logs ⏱️ run_command(...) [67s] on completion
  4. Colored state -- green=running, gray=idle, red=error/cancel
  5. Background ticker -- Thread ticks every 1s so timer updates even without WS traffic
  6. ensure cleanup -- deactivates ticker and clears status line after ask returns

Files to create

  • lib/antigravity/tui.rb -- Antigravity::TUI::StepLog class
  • lib/antigravity/tui/step_log.rb -- if we want a directory structure
  • Extract from examples/09_e2e_nanobanana.rb (the reference implementation)

Dependencies

  • Requires the hooks system (Antigravity::Hooks with on/emit)
  • Uses :ws_message event from conversation.rb

Priority

P3 -- nice to have, current examples work fine with inline code.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reference implementation in examples/09_e2e_nanobanana.rb, then compare the duplicated pattern in examples/08_e2e_telegram_bot.rb. Read the Antigravity::Hooks on/emit system and the :ws_message flow in conversation.rb before choosing among the proposed APIs. Done means the behavior lives in lib/antigravity/tui.rb or lib/antigravity/tui/step_log.rb and both examples can use the reusable TUI with ticker cleanup after ask returns.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.