summaryrefslogtreecommitdiff
path: root/Omni/Agent/Paths.hs
blob: d8def78eed88ca30b3aea78026acded0cf4bcd94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}

-- | Configurable paths for Ava data directories.
--
-- In development, uses default paths under @_/var/ava/@.
-- In production, set @AVA_DATA_ROOT@ to @/home/ava@ to use the dedicated workspace.
module Omni.Agent.Paths
  ( avaDataRoot,
    skillsDir,
    promptsDir,
    outreachDir,
    userScratchRoot,
    userScratchDir,
    logsDir,
    avaLogsDir,
    subagentLogsDir,
  )
where

import Alpha
import qualified Data.Text as Text
import System.Environment (lookupEnv)
import System.FilePath ((</>))
import System.IO.Unsafe (unsafePerformIO)

avaDataRoot :: FilePath
avaDataRoot =
  unsafePerformIO <| do
    m <- lookupEnv "AVA_DATA_ROOT"
    pure (fromMaybe "_/var/ava" m)
{-# NOINLINE avaDataRoot #-}

skillsDir :: FilePath
skillsDir = avaDataRoot </> "skills"

promptsDir :: FilePath
promptsDir = avaDataRoot </> "prompts"

outreachDir :: FilePath
outreachDir = avaDataRoot </> "outreach"

userScratchRoot :: FilePath
userScratchRoot = avaDataRoot </> "users"

userScratchDir :: Text -> FilePath
userScratchDir user = userScratchRoot </> Text.unpack user

logsDir :: FilePath
logsDir = avaDataRoot </> "logs"

avaLogsDir :: FilePath
avaLogsDir = logsDir </> "ava"

subagentLogsDir :: FilePath
subagentLogsDir = logsDir </> "subagents"