A-gent 0.11.0.10 → 0.11.0.11
raw patch · 6 files changed
+54/−47 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Agent.LLM: files :: Files -> [FilePath]
- Agent.IO.Effects: llmCodeSeq :: LlmCodeRead m => Maybe Filter -> m (Either [String] Files)
+ Agent.IO.Effects: llmCodeSeq :: LlmCodeRead m => Maybe Filter -> m (Either [String] FilePaths)
- Agent.IO.Effects: llmPlanSeq :: LlmPlanRead m => Maybe Filter -> m (Either [String] Files)
+ Agent.IO.Effects: llmPlanSeq :: LlmPlanRead m => Maybe Filter -> m (Either [String] FilePaths)
- Agent.IO.Restricted: llmCodeSeq :: LlmCodeRead m => Maybe Filter -> m (Either [String] Files)
+ Agent.IO.Restricted: llmCodeSeq :: LlmCodeRead m => Maybe Filter -> m (Either [String] FilePaths)
- Agent.IO.Restricted: llmPlanSeq :: LlmPlanRead m => Maybe Filter -> m (Either [String] Files)
+ Agent.IO.Restricted: llmPlanSeq :: LlmPlanRead m => Maybe Filter -> m (Either [String] FilePaths)
- Agent.LLM: Context :: !Exit -> !Maybe Root -> !Mode -> !Load a -> !History -> !Maybe Filter -> !Maybe Files -> !Maybe File -> Context a
+ Agent.LLM: Context :: !Exit -> !Maybe Root -> !Mode -> !Load a -> !History -> !Maybe Filter -> !Maybe FilePaths -> !Maybe File -> Context a
- Agent.LLM: [pile] :: Context a -> !Maybe Files
+ Agent.LLM: [pile] :: Context a -> !Maybe FilePaths
- Agent.LLM: combineFiles :: Files -> Files -> Files
+ Agent.LLM: combineFiles :: FilePaths -> FilePaths -> FilePaths
Files
- A-gent.cabal +1/−1
- CHANGELOG.md +11/−0
- src/Agent/IO/Effects.hs +2/−2
- src/Agent/LLM.hs +14/−17
- src/Internal/LLM.hs +17/−20
- src/Internal/RIO.hs +9/−7
A-gent.cabal view
@@ -9,7 +9,7 @@ build-type: Simple name: A-gent-version: 0.11.0.10+version: 0.11.0.11 synopsis: Polite & well educated LLM agent with excellent manners that always behaves well description: Polite and well educated LLM agent with excellent manners that always behaves well
CHANGELOG.md view
@@ -1,5 +1,16 @@ # Revision history for Λ-gent +## 0.11.0.11 -- 2026-04-19++* Fixed a few misspells.++* Refactored `Files` to `FilePaths`.++* Refactored `Document(s)` to already existing `File(s)` for simplicity++* Excluding non-files (symbolic links) from search as this could bypass the+ limitation of the current working directory+ ## 0.11.0.10 -- 2026-04-17 * Minor bug fixes and misspells.
src/Agent/IO/Effects.hs view
@@ -99,7 +99,7 @@ where llmCodeSeq :: Maybe LLM.Filter- -> m (Either [String] LLM.Files)+ -> m (Either [String] LLM.FilePaths) llmCodeGet :: String -> m (Either String LLM.File)@@ -147,7 +147,7 @@ where llmPlanSeq :: Maybe LLM.Filter- -> m (Either [String] LLM.Files)+ -> m (Either [String] LLM.FilePaths) llmPlanGet :: String -> m (Either String LLM.File)
src/Agent/LLM.hs view
@@ -27,7 +27,6 @@ , Load , History(..) , Context(..)- , INT.files -- * Paramenters , Eval -- * Methods@@ -100,7 +99,7 @@ , load :: !(Load a) , hist :: !INT.History , list :: !(Maybe INT.Filter)- , pile :: !(Maybe INT.Files)+ , pile :: !(Maybe INT.FilePaths) , file :: !(Maybe INT.File) } @@ -157,7 +156,7 @@ , chat = [] } , list = Nothing- , pile = Just $ INT.Files [] -- Nothing+ , pile = Just $ INT.FilePaths [] , file = Nothing } @@ -166,11 +165,11 @@ -- HELPERS (public) combineFiles- :: INT.Files- -> INT.Files- -> INT.Files-combineFiles (INT.Files xs) (INT.Files ys) =- INT.Files $ xs ++ ys+ :: INT.FilePaths+ -> INT.FilePaths+ -> INT.FilePaths+combineFiles (INT.FilePaths xs) (INT.FilePaths ys) =+ INT.FilePaths $ xs ++ ys getFile :: INT.File@@ -223,7 +222,7 @@ COM.files [] True . -- NOTE: Show relative paths map (drop (length cwd)) .- concatMap INT.files .+ concatMap INT.filePaths . pile ) upd >> loop (upd { list = Nothing }) eval@@ -278,7 +277,7 @@ { purpose = txt , instructions = [] , examples = []- , documents = []+ , files = [] } xml = INT.tpl2xml tpl where@@ -326,13 +325,12 @@ pds = ( mapM ( \ fap ->- INT.Document . INT.File . (,) (drop (length cwd) fap) . lines <$> readFileStrict fap ) .- concatMap INT.files .+ concatMap INT.filePaths . pile ) ctx @@ -350,21 +348,20 @@ case JSON.decode x :: Either JSON.DecodeError [String] of Right xs -> xs Left __ -> []- tpl ds is =+ tpl fs is = Template { purpose = msg , instructions = is , examples = -- TODO: Look in {root}/tpl/{mode}_examples_*.md []- , documents = ds+ , files = fs } xml xs ys = INT.tpl2xml $ tpl xs ys caseFile txt midx nums = ( case idx of Just i ->- -- TODO: Test with empty list/pile if 0 <= i && i < length pfs then let cwd =@@ -403,7 +400,7 @@ loop (nxt txt ctx Nothing) eval ) where- pfs = concatMap INT.files $ pile ctx+ pfs = concatMap INT.filePaths $ pile ctx idx = case midx of [ ] -> Nothing@@ -429,7 +426,7 @@ COM.files [] True . -- NOTE: Show relative paths map (drop (length cwd)) .- concatMap INT.files .+ concatMap INT.filePaths . pile ) ctx >> loop (nxt txt ctx Nothing) eval
src/Internal/LLM.hs view
@@ -25,8 +25,7 @@ , Mask (..) , File (..) , FileLine- , Files (..)- , Document (..)+ , FilePaths (..) , Template (..) , modes , tpl2xml@@ -80,18 +79,16 @@ type FileLine = String -newtype File = File { file :: (FilePath, [FileLine]) }--newtype Files = Files { files :: [FilePath] }+newtype File = File (FilePath, [FileLine]) -newtype Document = Document { document :: File }+newtype FilePaths = FilePaths { filePaths :: [FilePath] } data Template = Template { purpose :: !String , instructions :: ![String] , examples :: ![Markdown]- , documents :: ![Document]+ , files :: ![File] } --------------------------------------------------------------------------------@@ -104,7 +101,7 @@ :: Template -> String tpl2xml tpl =- ( if eis && ees && eds then+ ( if eis && ees && efs then pur else "<purpose>" ++ pur ++ "</purpose>"@@ -123,12 +120,12 @@ tes ++ "</examples>" ) ++- ( if eds then+ ( if efs then [] else- "<documents>" ++- concatMap aux tds ++- "</documents>"+ "<files>" +++ concatMap aux tfs +++ "</files>" ) where pur =@@ -136,30 +133,30 @@ ( if eis then [] else- ". Follow the specififed `instructions`"+ ". Follow the specified `instructions`" ) ++ ( if ees then [] else ". Output MUST match provided `examples`" ) ++- ( if eds then+ ( if efs then [] else- ". List of provided `documents`"+ ". List of provided `files` for context" ) eis = null tis ees = null tes- eds = null tds+ efs = null tfs tis = concatMap (\ x -> "<instruction>" ++ x ++ "</instruction>") $ instructions tpl tes = concatMap (\ x -> "<example>" ++ x ++ "</example>") $ examples tpl- tds = zip [0 :: Int ..] $ documents tpl- aux (i, Document (File (src, ls))) =- "<document index=\"" ++ show i ++ "\">" +++ tfs = zip [0 :: Int ..] $ files tpl+ aux (i, File (src, ls)) =+ "<file index=\"" ++ show i ++ "\">" ++ "<source>" ++ src ++ "</source>" ++ "<content>" ++ unlines ls ++ "</content>" ++- "</document>"+ "</file>"
src/Internal/RIO.hs view
@@ -770,7 +770,7 @@ where llmCodeSeq :: Maybe LLM.Filter- -> m (Either [String] LLM.Files)+ -> m (Either [String] LLM.FilePaths) llmCodeGet :: String -> m (Either String LLM.File)@@ -793,8 +793,8 @@ -- TODO: DRY Right fap -> ( \ case- ([], rs) -> Right $ LLM.Files $ concat rs- (ls, __) -> Left ls+ ([], rs) -> Right $ LLM.FilePaths $ concat rs+ (ls, __) -> Left ls ) . partitionEithers <$> mapM (\ msk -> findFiles fap ("*" ++ fil ++ "*" ++ msk)) cmsk@@ -878,7 +878,7 @@ where llmPlanSeq :: Maybe LLM.Filter- -> m (Either [String] LLM.Files)+ -> m (Either [String] LLM.FilePaths) llmPlanGet :: String -> m (Either String LLM.File)@@ -902,8 +902,8 @@ -- TODO: DRY Right fap -> ( \ case- ([], rs) -> Right $ LLM.Files $ concat rs- (ls, __) -> Left ls+ ([], rs) -> Right $ LLM.FilePaths $ concat rs+ (ls, __) -> Left ls ) . partitionEithers <$> mapM (\ msk -> findFiles fap ("*" ++ fil ++ "*" ++ msk)) pmsk@@ -1024,7 +1024,9 @@ [ path , "-path" , mask- -- NOTE: Exclude dot files and tmp Emacs files (.*#)+ -- NOTE: Limit to files, excluding symbolic links+ , "-type", "f"+ -- NOTE: Exclude dot files and hereby tmp Emacs files (.*#) , "-not" , "-name" , ".*"