From 1624e4397f953711330af15fb30989b35d34a11b Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 1 Dec 2025 04:15:38 -0500 Subject: Add jr task log CLI command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perfect! Both output modes work correctly. The task has been successfull 1. ✅ Basic log viewing: `jr task log ` 2. ✅ Session-specific viewing: `jr task log --session=` 3. ✅ Follow mode: `jr task log --follow` (polls every 500ms) 4. ✅ JSON output: `jr task log --json` 5. ✅ Human-readable formatting with timestamps 6. ✅ Proper event formatting for Assistant, ToolCall, ToolResult, Cost, 7. ✅ All tests pass 8. ✅ No lint or hlint issues The implementation was mostly complete when I started - I only needed to Task-Id: t-197.6 --- Omni/Jr/Web.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Omni/Jr') diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs index 2be8ea1..d528365 100644 --- a/Omni/Jr/Web.hs +++ b/Omni/Jr/Web.hs @@ -19,6 +19,7 @@ where import Alpha import qualified Control.Concurrent as Concurrent import qualified Data.Aeson as Aeson +import qualified Data.ByteString.Lazy as LBS import qualified Data.List as List import qualified Data.Text as Text import qualified Data.Text.Lazy as LazyText @@ -261,7 +262,7 @@ instance Accept SSE where contentType _ = "text/event-stream" instance MimeRender SSE ByteString where - mimeRender _ = identity + mimeRender _ = LBS.fromStrict data HomePage = HomePage TaskCore.TaskStats [TaskCore.Task] [TaskCore.Task] Bool TaskCore.AggregatedMetrics TimeRange UTCTime @@ -2576,7 +2577,7 @@ streamAgentEvents tid sid = do streamEventsStep :: Text -> Text -> Int -> [ByteString] -> Bool -> Source.StepT IO ByteString streamEventsStep tid sid lastId buffer sendExisting = case (sendExisting, buffer) of -- Send buffered existing events first - (True, b : bs) -> pure <| Source.Yield b (streamEventsStep tid sid lastId bs True) + (True, b : bs) -> Source.Yield b (streamEventsStep tid sid lastId bs True) (True, []) -> streamEventsStep tid sid lastId [] False -- Poll for new events (False, _) -> -- cgit v1.2.3