| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Free.Agent.Host
Description
Synopsis
- data BodyMode
- data Host = Host {}
- data BareConfig = BareConfig {}
- mkHost :: Text -> ([Text] -> IO [Text]) -> Host
- hostShard :: Host -> AgentShard [Post Text] [Post Text]
- processHost :: Text -> FilePath -> [String] -> Host
- cliHost :: Text -> Cli -> Host
- hermesHost :: Text -> Text -> Maybe Text -> Maybe Text -> Bool -> FilePath -> Maybe (IORef Int, FilePath) -> Host
- hermesHostBatch :: Text -> Text -> Maybe Text -> Maybe Text -> Bool -> FilePath -> Maybe (IORef Int, FilePath) -> Host
- hermesCli :: Maybe Text -> Maybe Text -> Bool -> FilePath -> Maybe (IORef Int, FilePath) -> Cli
- kimiHost :: Text -> Maybe Text -> Maybe Text -> FilePath -> Maybe (IORef Int, FilePath) -> Host
- bareHost :: BareConfig -> Text -> Host
- defaultBareConfig :: BareConfig
Documentation
How to turn a post body into arguments for hostRun.
A one-shot host seat.
The host receives arguments derived from the body of an incoming post and
produces output lines. The caller decides how to turn those lines back into
posts; hostShard uses the default mapping (reply to sender).
data BareConfig Source #
Connection configuration for a direct API host.
Constructors
| BareConfig | |
Instances
| Eq BareConfig Source # | |
Defined in Free.Agent.Host | |
| Show BareConfig Source # | |
Defined in Free.Agent.Host Methods showsPrec :: Int -> BareConfig -> ShowS # show :: BareConfig -> String # showList :: [BareConfig] -> ShowS # | |
mkHost :: Text -> ([Text] -> IO [Text]) -> Host Source #
Smart constructor with the default BodyWords mode.
hostShard :: Host -> AgentShard [Post Text] [Post Text] Source #
Turn a host into a stateful shard that consumes every committed post.
The shard remembers the committed posts in its state. On emit it runs the
host on each post's body (prepared by hostBodyMode), in order, and emits
one reply post per output line per input post. Each reply is addressed back
to the sender of its input post.
Note: a generic host has no access to stamped log ids, so emitted replies carry no thread edge. Callers that need provenance should thread by id outside the host.
A host backed by an external process.
The command receives the fixed args followed by the prepared post body
(one argument when BodyWhole, whitespace-split words by default). Output
lines become reply posts. Uses readProcess.
Arguments
| :: Text | Host name (used as the |
| -> Text | System prompt text prepended to every body. |
| -> Maybe Text | Model name passed to |
| -> Maybe Text | Provider passed to |
| -> Bool | Pass |
| -> FilePath | Session file for cross-call context. |
| -> Maybe (IORef Int, FilePath) | Optional transcript sink. |
| -> Host |
Hermes host on the shared Cli seat.
Runs hermes chat -q per body, prepending the supplied system prompt to
the body in the query. The optional model and provider override the CLI
defaults; Nothing keeps the hermes CLI default. yolo controls whether
--yolo -Q is passed to hermes.
Sessions persist across calls via sessionFile; a stale session falls
back to fresh.
When mTranscript is Just, one JSONL transcript record is appended to
the given file per invocation. The caller writes the post id to the
IORef before each call; see cliQuery for details.
The caller is responsible for building the system prompt; this function knows nothing about design documents, protocol cards, or magic wording.
Arguments
| :: Text | Host name (used as the |
| -> Text | System prompt text prepended to every body. |
| -> Maybe Text | Model name passed to |
| -> Maybe Text | Provider passed to |
| -> Bool | Pass |
| -> FilePath | Session file for cross-call context. |
| -> Maybe (IORef Int, FilePath) | Optional transcript sink. |
| -> Host |
Batch variant of hermesHost. Joins all post bodies into a single user
message and makes one hermes chat -q call, returning one reply. Use when
multiple posts may arrive in a single wake cycle and the agent should see
them as a combined conversation turn.
hermesCli :: Maybe Text -> Maybe Text -> Bool -> FilePath -> Maybe (IORef Int, FilePath) -> Cli Source #
Shared CLI recipe for hermes backends.
When cliTranscript is Just, one JSONL record is appended per invocation.
Arguments
| :: Text | Host name (used as the |
| -> Maybe Text | Model name passed to |
| -> Maybe Text | Provider passed to |
| -> FilePath | Session file for cross-call context. |
| -> Maybe (IORef Int, FilePath) | Optional transcript sink. |
| -> Host |
Kimi host on the shared Cli seat.
Runs kimi -p per body (see kimiCli), with optional -m model,
--provider provider, and session resume via sessionFile. A stale
session falls back to fresh.
When mTranscript is Just, one JSONL transcript record is appended to
the given file per invocation. The caller writes the post id to the
IORef before each call; see cliQuery for details.
Arguments
| :: BareConfig | Connection configuration. |
| -> Text | System prompt. |
| -> Host |
A host backed by a direct OpenAI-compatible chat completions API call.
The caller supplies the system prompt; the post body becomes the user message. There is no tooling, memory, or context-file injection.
defaultBareConfig :: BareConfig Source #
Sensible defaults for an OpenAI-compatible DeepSeek host.