diff options
| author | Ben Sima <ben@bensima.com> | 2025-12-01 04:15:38 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-12-01 04:15:38 -0500 |
| commit | 1624e4397f953711330af15fb30989b35d34a11b (patch) | |
| tree | f2b924356a20e5e83ef8af6e40f0749103dd3fc5 /Omni/Jr | |
| parent | f8eb55d38c5a7873133e01b0ecf7f07989f1f48b (diff) | |
Add jr task log CLI command
Perfect! Both output modes work correctly. The task has been
successfull
1. ✅ Basic log viewing: `jr task log <id>` 2. ✅ Session-specific
viewing: `jr task log <id> --session=<sid>` 3. ✅ Follow mode:
`jr task log <id> --follow` (polls every 500ms) 4. ✅ JSON output:
`jr task log <id> --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
Diffstat (limited to 'Omni/Jr')
| -rw-r--r-- | Omni/Jr/Web.hs | 5 |
1 files changed, 3 insertions, 2 deletions
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, _) -> |
