From 276a27f27aeff7781a25e13fad0d568f5455ce05 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 11 Dec 2025 19:50:20 -0500 Subject: 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 # OpenRouter (default) jr work --engine=ollama # Local Ollama jr work --engine=amp # Amp CLI (stub) --- Omni/Jr.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Omni/Jr.hs') 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 [...] - jr work [] + jr work [] [--engine=ENGINE] jr prompt jr web [--port=PORT] jr review [] [--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)) -- cgit v1.2.3