never executed always true always false
1 module PureClaw.Agent.Env
2 ( -- * Agent environment
3 AgentEnv (..)
4 ) where
5
6 import Data.IORef
7 import Data.Text (Text)
8
9 import PureClaw.Core.Types
10 import PureClaw.Handles.Channel
11 import PureClaw.Handles.Log
12 import PureClaw.Providers.Class
13 import PureClaw.Security.Vault
14 import PureClaw.Security.Vault.Plugin
15 import PureClaw.Tools.Registry
16
17 -- | All runtime dependencies for the agent loop, gathered into a single record.
18 -- This replaces the multi-parameter signature of 'runAgentLoop' and
19 -- 'executeSlashCommand', making it easy to add new capabilities (e.g.
20 -- 'VaultHandle') in later work units without touching call sites.
21 data AgentEnv = AgentEnv
22 { _env_provider :: IORef (Maybe SomeProvider)
23 -- ^ The LLM provider. 'Nothing' when no credentials are configured yet.
24 , _env_model :: IORef ModelId
25 -- ^ The model to use for completions. Mutable so slash commands
26 -- like @\/provider@ and @\/model@ can hot-swap it.
27 , _env_channel :: ChannelHandle
28 -- ^ The channel to read messages from and write responses to.
29 , _env_logger :: LogHandle
30 -- ^ Structured logger for diagnostic output.
31 , _env_systemPrompt :: Maybe Text
32 -- ^ Optional system prompt prepended to every conversation.
33 , _env_registry :: ToolRegistry
34 -- ^ All registered tools available for the agent to call.
35 , _env_vault :: IORef (Maybe VaultHandle)
36 -- ^ Optional secrets vault. 'Nothing' if no vault is configured.
37 , _env_pluginHandle :: PluginHandle
38 -- ^ Handle for detecting and generating age plugin identities.
39 }