summaryrefslogtreecommitdiff
path: root/Omni/Agent/Log.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-11-30 00:36:51 -0500
committerBen Sima <ben@bensima.com>2025-11-30 00:36:51 -0500
commit5fbcd92ff85bc9cc0b752888f6d3498aafea0b2a (patch)
tree4bcae7c97bf81ecae696744cfcd84520e5db639d /Omni/Agent/Log.hs
parentd05ca4732710dd9cef7fffd998a03615ad2cb58c (diff)
Remove amp dependency entirely
The build and tests pass. Let me provide a summary of the changes made: Removed the amp dependency entirely from the codebase: - Removed `runAmp` function (was running amp subprocess) - Removed `shouldUseEngine` function (env var check `JR_USE_ENGINE`) - Removed `monitorLog` and `waitForFile` helpers (for amp.log parsing) - Removed unused imports: `System.IO`, `Data.Text.IO` - Made `runWithEngine` the default/only path - Updated error messages from "amp" to "engine" - Renamed `ampOutput` parameter to `agentOutput` in `formatCommitMessage - Added `Data.IORef` import for `newIORef`, `modifyIORef'`, `readIORef` - Removed amp.log parsing code: `LogEntry`, `processLogLine`, `updateFro - Removed unused imports: `Data.Aeson`, `Data.ByteString.Lazy`, `Data.Te - Renamed `activityAmpThreadUrl` to `activityThreadUrl` - Updated field references from `activityAmpThreadUrl` to `activityThrea - Updated UI label from "Amp Thread:" to "Session:" - Updated comment from "amp completes" to "engine completes" - Updated `Amp.execute` to `Engine.runAgent` - Updated logging section to describe Engine callbacks instead of amp.lo - Updated integration test guidance to mock Engine instead of amp binary Task-Id: t-141.6
Diffstat (limited to 'Omni/Agent/Log.hs')
-rw-r--r--Omni/Agent/Log.hs42
1 files changed, 0 insertions, 42 deletions
diff --git a/Omni/Agent/Log.hs b/Omni/Agent/Log.hs
index 55bc1e2..46ea009 100644
--- a/Omni/Agent/Log.hs
+++ b/Omni/Agent/Log.hs
@@ -6,12 +6,8 @@
module Omni.Agent.Log where
import Alpha
-import Data.Aeson ((.:), (.:?))
-import qualified Data.Aeson as Aeson
-import qualified Data.ByteString.Lazy as BL
import Data.IORef (IORef, modifyIORef', newIORef, readIORef, writeIORef)
import qualified Data.Text as Text
-import qualified Data.Text.Encoding as TE
import qualified Data.Text.IO as TIO
import Data.Time.Clock (NominalDiffTime, UTCTime, diffUTCTime, getCurrentTime)
import Data.Time.Format (defaultTimeLocale, parseTimeOrError)
@@ -146,44 +142,6 @@ render = do
ANSI.hCursorUp IO.stderr 4
IO.hFlush IO.stderr
--- | Log Entry from JSON
-data LogEntry = LogEntry
- { leMessage :: Text,
- leThreadId :: Maybe Text,
- leCredits :: Maybe Double,
- leTotalCredits :: Maybe Double,
- leTimestamp :: Maybe Text
- }
- deriving (Show, Eq)
-
-instance Aeson.FromJSON LogEntry where
- parseJSON =
- Aeson.withObject "LogEntry" <| \v ->
- (LogEntry </ (v .: "message"))
- <*> v
- .:? "threadId"
- <*> v
- .:? "credits"
- <*> v
- .:? "totalCredits"
- <*> v
- .:? "timestamp"
-
--- | Parse a log line and update status
-processLogLine :: Text -> IO ()
-processLogLine line = do
- let bs = BL.fromStrict <| TE.encodeUtf8 line
- case Aeson.decode bs of
- Just entry -> update (updateFromEntry entry)
- Nothing -> pure () -- Ignore invalid JSON
-
-updateFromEntry :: LogEntry -> Status -> Status
-updateFromEntry LogEntry {..} s =
- s
- { statusThread = leThreadId <|> statusThread s,
- statusCredits = maybe (statusCredits s) (/ 100.0) leTotalCredits -- Only update if totalCredits is present
- }
-
-- | Format elapsed time as MM:SS or HH:MM:SS
formatElapsed :: NominalDiffTime -> Text
formatElapsed elapsed =