summaryrefslogtreecommitdiff
path: root/Omni
diff options
context:
space:
mode:
authorOmni Worker <bot@omni.agent>2025-11-22 05:10:23 -0500
committerOmni Worker <bot@omni.agent>2025-11-22 05:10:23 -0500
commite4aaed813097dc880556ff8abc01af279b85f325 (patch)
treebf4b0b68315819ee7f63ad5793266a2fd0fda2c4 /Omni
parent9bfabda73f3a65b0353670733a269963d335cf7e (diff)
feat: split thread and credits lines in worker status bar
Amp-Thread-ID: https://ampcode.com/threads/T-5a2ca80d-5cba-409f-a262-6b5c652c257d Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Omni')
-rw-r--r--Omni/Agent/Log.hs28
1 files changed, 18 insertions, 10 deletions
diff --git a/Omni/Agent/Log.hs b/Omni/Agent/Log.hs
index 084052b..2e26272 100644
--- a/Omni/Agent/Log.hs
+++ b/Omni/Agent/Log.hs
@@ -46,9 +46,9 @@ init :: Text -> IO ()
init workerName = do
IO.hSetBuffering IO.stderr IO.LineBuffering
writeIORef currentStatus (emptyStatus workerName)
- -- Reserve 4 lines at bottom
- replicateM_ 4 (IO.hPutStrLn IO.stderr "")
- ANSI.hCursorUp IO.stderr 4
+ -- Reserve 5 lines at bottom
+ replicateM_ 5 (IO.hPutStrLn IO.stderr "")
+ ANSI.hCursorUp IO.stderr 5
-- | Update the status
update :: (Status -> Status) -> IO ()
@@ -63,7 +63,9 @@ updateActivity msg = update (\s -> s {statusActivity = msg})
-- | Log a scrolling message (appears above status bars)
log :: Text -> IO ()
log msg = do
- -- Clear status bars (4 lines)
+ -- Clear status bars (5 lines)
+ ANSI.hClearLine IO.stderr
+ ANSI.hCursorDown IO.stderr 1
ANSI.hClearLine IO.stderr
ANSI.hCursorDown IO.stderr 1
ANSI.hClearLine IO.stderr
@@ -71,7 +73,7 @@ log msg = do
ANSI.hClearLine IO.stderr
ANSI.hCursorDown IO.stderr 1
ANSI.hClearLine IO.stderr
- ANSI.hCursorUp IO.stderr 3
+ ANSI.hCursorUp IO.stderr 4
-- Print message (scrolls screen)
TIO.hPutStrLn IO.stderr msg
@@ -80,7 +82,7 @@ log msg = do
-- (Since we scrolled, we are now on the line above where the first status line should be)
render
--- | Render the 4 status lines (Vertical Layout)
+-- | Render the 5 status lines (Vertical Layout)
render :: IO ()
render = do
Status {..} <- readIORef currentStatus
@@ -99,18 +101,24 @@ render = do
ANSI.hClearLine IO.stderr
TIO.hPutStr IO.stderr <| "Task: " <> taskStr
- -- Line 3: Thread + Credits
+ -- Line 3: Thread
ANSI.hCursorDown IO.stderr 1
ANSI.hSetCursorColumn IO.stderr 0
ANSI.hClearLine IO.stderr
- TIO.hPutStr IO.stderr <| "Thread: " <> threadStr <> " | Credits: $" <> tshow statusCredits
+ TIO.hPutStr IO.stderr <| "Thread: " <> threadStr
- -- Line 4: Activity
+ -- Line 4: Credits
+ ANSI.hCursorDown IO.stderr 1
+ ANSI.hSetCursorColumn IO.stderr 0
+ ANSI.hClearLine IO.stderr
+ TIO.hPutStr IO.stderr <| "Credits: $" <> tshow statusCredits
+
+ -- Line 5: Activity
ANSI.hCursorDown IO.stderr 1
ANSI.hSetCursorColumn IO.stderr 0
ANSI.hClearLine IO.stderr
TIO.hPutStr IO.stderr ("> " <> statusActivity)
-- Return cursor to Line 1
- ANSI.hCursorUp IO.stderr 3
+ ANSI.hCursorUp IO.stderr 4
IO.hFlush IO.stderr