summaryrefslogtreecommitdiff
path: root/Omni/Jr.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-12-11 19:50:20 -0500
committerBen Sima <ben@bensima.com>2025-12-11 19:50:20 -0500
commit276a27f27aeff7781a25e13fad0d568f5455ce05 (patch)
tree6a7957986d14a9424f9e7f438dbd47a402b414fe /Omni/Jr.hs
parent225e5b7a24f0b30f6de1bd7418bf834ad345b0f3 (diff)
t-247: Add Provider abstraction for multi-backend LLM support
- Create Omni/Agent/Provider.hs with unified Provider interface - Support OpenRouter (cloud), Ollama (local), Amp (subprocess stub) - Add runAgentWithProvider to Engine.hs for Provider-based execution - Add EngineType to Core.hs (EngineOpenRouter, EngineOllama, EngineAmp) - Add --engine flag to 'jr work' command - Worker.hs dispatches to appropriate provider based on engine type Usage: jr work <task-id> # OpenRouter (default) jr work <task-id> --engine=ollama # Local Ollama jr work <task-id> --engine=amp # Amp CLI (stub)
Diffstat (limited to 'Omni/Jr.hs')
-rwxr-xr-xOmni/Jr.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/Omni/Jr.hs b/Omni/Jr.hs
index b60a029..48dbf90 100755
--- a/Omni/Jr.hs
+++ b/Omni/Jr.hs
@@ -53,7 +53,7 @@ jr
Usage:
jr task [<args>...]
- jr work [<task-id>]
+ jr work [<task-id>] [--engine=ENGINE]
jr prompt <task-id>
jr web [--port=PORT]
jr review [<task-id>] [--auto]
@@ -77,6 +77,7 @@ Commands:
Options:
-h --help Show this help
--port=PORT Port for web server [default: 8080]
+ --engine=ENGINE LLM engine: openrouter, ollama, amp [default: openrouter]
--auto Auto-review: accept if tests pass, reject if they fail
--delay=SECONDS Delay between loop iterations [default: 5]
--project=PROJECT Filter facts by project
@@ -119,13 +120,20 @@ move args
absPath <- Directory.getCurrentDirectory
let name = Text.pack (takeFileName absPath)
+ -- Parse engine flag
+ let engineType = case Cli.getArg args (Cli.longOption "engine") of
+ Just "ollama" -> AgentCore.EngineOllama
+ Just "amp" -> AgentCore.EngineAmp
+ _ -> AgentCore.EngineOpenRouter
+
let worker =
AgentCore.Worker
{ AgentCore.workerName = name,
AgentCore.workerPid = Nothing,
AgentCore.workerStatus = AgentCore.Idle,
AgentCore.workerPath = path,
- AgentCore.workerQuiet = False -- Show ANSI status bar for manual work
+ AgentCore.workerQuiet = False, -- Show ANSI status bar for manual work
+ AgentCore.workerEngine = engineType
}
let taskId = fmap Text.pack (Cli.getArg args (Cli.argument "task-id"))
@@ -183,7 +191,8 @@ runLoop delaySec = do
AgentCore.workerPid = Nothing,
AgentCore.workerStatus = AgentCore.Idle,
AgentCore.workerPath = ".",
- AgentCore.workerQuiet = True -- No ANSI status bar in loop mode
+ AgentCore.workerQuiet = True, -- No ANSI status bar in loop mode
+ AgentCore.workerEngine = AgentCore.EngineOpenRouter -- Default for loop
}
putText "[loop] Starting worker..."
AgentWorker.start worker (Just (TaskCore.taskId task))