From 122d73ac9d2472f91ed00965d03d1e761da72699 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 16 Dec 2025 08:20:54 -0500 Subject: refactor: Rename Bot to Ava, remove cost guardrail - Rename Omni/Bot.hs to Omni/Ava.hs - Delete Omni/Bot.scm (unused Guile version) - Remove cost limit (was 10 cents, now 0) - Increase max iterations from 10 to 50 --- Omni/Agent/Telegram.hs | 4 +-- Omni/Ava.hs | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ Omni/Bot.hs | 66 -------------------------------------------------- Omni/Bot.scm | 61 ---------------------------------------------- 4 files changed, 68 insertions(+), 129 deletions(-) create mode 100755 Omni/Ava.hs delete mode 100755 Omni/Bot.hs delete mode 100755 Omni/Bot.scm diff --git a/Omni/Agent/Telegram.hs b/Omni/Agent/Telegram.hs index 07c8e4b..a24c3b9 100644 --- a/Omni/Agent/Telegram.hs +++ b/Omni/Agent/Telegram.hs @@ -1012,10 +1012,10 @@ processEngagedMessage tgConfig provider engineCfg msg uid userName chatId userMe Engine.defaultAgentConfig { Engine.agentSystemPrompt = systemPrompt, Engine.agentTools = tools, - Engine.agentMaxIterations = 10, + Engine.agentMaxIterations = 50, Engine.agentGuardrails = Engine.defaultGuardrails - { Engine.guardrailMaxCostCents = 10.0, + { Engine.guardrailMaxCostCents = 1000.0, Engine.guardrailMaxDuplicateToolCalls = 10 } } diff --git a/Omni/Ava.hs b/Omni/Ava.hs new file mode 100755 index 0000000..2dfecb1 --- /dev/null +++ b/Omni/Ava.hs @@ -0,0 +1,66 @@ +#!/usr/bin/env run.sh +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE NoImplicitPrelude #-} + +-- | Ava - AI assistant via Telegram. +-- +-- Usage: +-- ava # Uses TELEGRAM_BOT_TOKEN env var +-- ava --token=XXX # Explicit token +-- ava --model=MODEL # Override LLM model +-- +-- : out ava +-- : dep aeson +-- : dep http-conduit +-- : dep stm +module Omni.Ava where + +import Alpha +import qualified Data.Text as Text +import qualified Omni.Agent.Telegram as Telegram +import qualified Omni.Cli as Cli +import qualified Omni.Test as Test +import qualified System.Console.Docopt as Docopt + +main :: IO () +main = Cli.main plan + +plan :: Cli.Plan () +plan = + Cli.Plan + { Cli.help = help, + Cli.move = move, + Cli.test = test, + Cli.tidy = \_ -> pure () + } + +help :: Cli.Docopt +help = + [Cli.docopt| +ava - AI assistant via Telegram + +Usage: + ava [--token=TOKEN] [--model=MODEL] + ava test + ava (-h | --help) + +Options: + -h --help Show this help + --token=TOKEN Telegram bot token (or use TELEGRAM_BOT_TOKEN env) + --model=MODEL LLM model to use [default: anthropic/claude-sonnet-4] +|] + +move :: Cli.Arguments -> IO () +move args = do + let maybeToken = fmap Text.pack (Cli.getArg args (Cli.longOption "token")) + Telegram.startBot maybeToken + +test :: Test.Tree +test = + Test.group + "Omni.Ava" + [ Test.unit "help is non-empty" <| do + let usage = str (Docopt.usage help) :: String + null usage Test.@=? False + ] diff --git a/Omni/Bot.hs b/Omni/Bot.hs deleted file mode 100755 index 77a0408..0000000 --- a/Omni/Bot.hs +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env run.sh -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE QuasiQuotes #-} -{-# LANGUAGE NoImplicitPrelude #-} - --- | Omni Bot - Family assistant via Telegram. --- --- Usage: --- bot # Uses TELEGRAM_BOT_TOKEN env var --- bot --token=XXX # Explicit token --- bot --model=MODEL # Override LLM model --- --- : out bot --- : dep aeson --- : dep http-conduit --- : dep stm -module Omni.Bot where - -import Alpha -import qualified Data.Text as Text -import qualified Omni.Agent.Telegram as Telegram -import qualified Omni.Cli as Cli -import qualified Omni.Test as Test -import qualified System.Console.Docopt as Docopt - -main :: IO () -main = Cli.main plan - -plan :: Cli.Plan () -plan = - Cli.Plan - { Cli.help = help, - Cli.move = move, - Cli.test = test, - Cli.tidy = \_ -> pure () - } - -help :: Cli.Docopt -help = - [Cli.docopt| -bot - Omni family assistant via Telegram - -Usage: - bot [--token=TOKEN] [--model=MODEL] - bot test - bot (-h | --help) - -Options: - -h --help Show this help - --token=TOKEN Telegram bot token (or use TELEGRAM_BOT_TOKEN env) - --model=MODEL LLM model to use [default: anthropic/claude-sonnet-4] -|] - -move :: Cli.Arguments -> IO () -move args = do - let maybeToken = fmap Text.pack (Cli.getArg args (Cli.longOption "token")) - Telegram.startBot maybeToken - -test :: Test.Tree -test = - Test.group - "Omni.Bot" - [ Test.unit "help is non-empty" <| do - let usage = str (Docopt.usage help) :: String - null usage Test.@=? False - ] diff --git a/Omni/Bot.scm b/Omni/Bot.scm deleted file mode 100755 index ff81c53..0000000 --- a/Omni/Bot.scm +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env run.sh -!# -;; : out omnibot -;; -;; Usage with ii: -;; -;; tail -f \#omni/out | guile -L $CODEROOT -s Omni/Bot.scm -;; -(define-module (Omni Bot) #:export (main)) - -(import (ice-9 rdelim)) -(import (ice-9 match)) -(import (ice-9 regex)) -(import (ice-9 receive)) -(import (bs core)) -(import (prefix (bs string) string.)) - -(define (log msg) - (display msg (current-error-port))) - -(define (is-command? msg) - (string.prefix? msg "omnibot:")) - -(define (parse-line line) - (if (eof-object? line) - (exit) - (let ([matches (regexp-exec - (make-regexp "<(\\S*)>(.*)" regexp/extended) - (string-drop line 11))]) - (if matches - `(user - ,(match:substring matches 1) - ,(string.lstrip (match:substring matches 2) #\space)) - `(system ,(string-drop line 11)))))) - -(define (dispatch user msg) - (let ([msg (-> msg - (string-drop (string-length "omnibot:")) - (string.lstrip #\space))]) - (cond - ((equal? msg "hi") - (display (fmt "~a: well, hello!" user))) - - (else - (display (fmt "command not understood: ~a" msg)))))) - -(define (main args) - (while #t - (match (parse-line (read-line)) - [('user user msg) - (if (is-command? msg) - (dispatch user msg) - (begin - (log (fmt "user: ~a " user)) - (log (fmt "message: ~a" msg))))] - - [('system msg) - (log (fmt "system: ~a" msg))]) - - (newline) - (force-output))) -- cgit v1.2.3