summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmni Worker <bot@omni.agent>2025-11-22 05:14:49 -0500
committerOmni Worker <bot@omni.agent>2025-11-22 05:14:49 -0500
commitcf32eb4ea6e2f8594fea7895fee38c9c2a838042 (patch)
tree4673d93b7570ba858e651899ed2a01d87cf9dca2
parente4aaed813097dc880556ff8abc01af279b85f325 (diff)
fix: parse correct json fields from amp logs
Amp-Thread-ID: https://ampcode.com/threads/T-5a2ca80d-5cba-409f-a262-6b5c652c257d Co-authored-by: Amp <amp@ampcode.com>
-rw-r--r--.tasks/tasks.jsonl1
-rw-r--r--Omni/Agent/Worker.hs18
2 files changed, 9 insertions, 10 deletions
diff --git a/.tasks/tasks.jsonl b/.tasks/tasks.jsonl
index b730dde..413d2b5 100644
--- a/.tasks/tasks.jsonl
+++ b/.tasks/tasks.jsonl
@@ -174,3 +174,4 @@
{"taskCreatedAt":"2025-11-22T09:41:06.786529414Z","taskDependencies":[],"taskDescription":"Replace 'git rebase live' with 'git sync' (which maps to git-branchless sync) in Omni.Agent.Git.syncWithLive. This aligns with the branchless workflow and handles stack rebasing automatically.","taskId":"t-rWciiEsnZ","taskNamespace":"Omni/Agent/Git.hs","taskParent":null,"taskPriority":"P2","taskStatus":"Done","taskTitle":"Use 'git sync' instead of 'git rebase' in Agent","taskType":"WorkTask","taskUpdatedAt":"2025-11-22T09:42:37.875643446Z"}
{"taskCreatedAt":"2025-11-22T09:50:59.154884329Z","taskDependencies":[],"taskDescription":"1. Add Thread ID to the status bar (requires log parsing later, but add field now). 2. Make the status layout responsive or vertical (4 lines) to fit on small screens (iPhone). 3. Reserve more lines in init.","taskId":"t-rWciWJYsi","taskNamespace":"Omni/Agent/Log.hs","taskParent":null,"taskPriority":"P2","taskStatus":"Done","taskTitle":"Improve Agent Status UI for mobile & debugging","taskType":"WorkTask","taskUpdatedAt":"2025-11-22T09:52:36.176467065Z"}
{"taskCreatedAt":"2025-11-22T10:09:23.249166289Z","taskDependencies":[],"taskDescription":null,"taskId":"t-rWck9sDOA","taskNamespace":"Omni/Agent.hs","taskParent":null,"taskPriority":"P2","taskStatus":"Done","taskTitle":"Split Thread and Credits in Worker status bar","taskType":"WorkTask","taskUpdatedAt":"2025-11-22T10:10:17.800528662Z"}
+{"taskCreatedAt":"2025-11-22T10:12:35.129294132Z","taskDependencies":[{"depId":"t-rWck9sDOA","depType":"DiscoveredFrom"}],"taskDescription":null,"taskId":"t-rWckmrKBm","taskNamespace":null,"taskParent":null,"taskPriority":"P2","taskStatus":"Done","taskTitle":"Fix Worker status bar activity not updating","taskType":"WorkTask","taskUpdatedAt":"2025-11-22T10:14:43.612634394Z"}
diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs
index 86c9e8b..4ff9042 100644
--- a/Omni/Agent/Worker.hs
+++ b/Omni/Agent/Worker.hs
@@ -252,8 +252,8 @@ parseAndUpdate line = do
case maybeObj of
Nothing -> pure ()
Just obj -> do
- -- Extract msg
- case KM.lookup "msg" obj of
+ -- Extract message (was msg)
+ case KM.lookup "message" obj of
Just (Aeson.String m) -> unless (Text.null m) (AgentLog.updateActivity m)
_ -> pure ()
@@ -262,14 +262,12 @@ parseAndUpdate line = do
Just (Aeson.String tid) -> AgentLog.update (\s -> s {AgentLog.statusThreadId = Just tid})
_ -> pure ()
- -- Extract cost
- case KM.lookup "usage" obj of
- Just (Aeson.Object usage) ->
- case KM.lookup "cost" usage of
- Just (Aeson.Number n) ->
- let cost = Scientific.toRealFloat n
- in AgentLog.update (\s -> s {AgentLog.statusCredits = AgentLog.statusCredits s + cost})
- _ -> pure ()
+ -- Extract cost from usage-ledger:event
+ -- Pattern: {"addedCredits": 0.123, "message": "usage-ledger:event", ...}
+ case KM.lookup "addedCredits" obj of
+ Just (Aeson.Number n) ->
+ let cost = Scientific.toRealFloat n
+ in AgentLog.update (\s -> s {AgentLog.statusCredits = AgentLog.statusCredits s + cost})
_ -> pure ()
timeTicker :: IO ()