Separate transport from backend: --backend ollama with interactive model picker#2
Open
wisbech wants to merge 10 commits into
Open
Separate transport from backend: --backend ollama with interactive model picker#2wisbech wants to merge 10 commits into
wisbech wants to merge 10 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new --backend concept (starting with ollama) distinct from the selected CLI “transport”, and adds an interactive Ollama model picker that can persist the chosen backend + model into the saved Sentinel configuration.
Changes:
- Add
backendtoSentinelConfigand implementlistOllamaModels()+formatSize()to discover and present Ollama models. - Extend
farm launchto parse--backendand, for--backend ollama, run an interactive model picker and save the selected model/backend. - Fix
createInvoke()to avoid constructing the transport twice and update help text to document the backend option.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/index.ts | Parses --backend, adds interactive Ollama model selection, persists backend in config output, and fixes createInvoke() binding. |
| src/config.ts | Adds backend to config schema and adds Ollama model discovery + size formatting helpers; removes Ollama from the transport list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+240
to
+243
| if (options.backend === "ollama") { | ||
| const models = await listOllamaModels(); | ||
| if (models.length === 0) { | ||
| console.log("Ollama not reachable or no models found.\nStart Ollama and pull a model: ollama pull llama3.1"); |
|
|
||
| if (overflow > 0) console.log(`\n ... and ${overflow} more models`); | ||
|
|
||
| const choice = await askOptional("Select [1-${displayModels.length}, Enter for default]"); |
Comment on lines
309
to
314
| const arg = args[i]; | ||
| if (known.includes(arg as TransportType)) transport = arg as TransportType; | ||
| else if (arg === "--model" || arg === "-m") options.model = args[++i]; | ||
| else if (arg === "--backend" || arg === "-b" || arg === "--back") options.backend = args[++i] || "ollama"; | ||
| else if (arg === "--api-key" || arg === "-k") options.apiKey = args[++i]; | ||
| else if (arg === "--base-url" || arg === "--url") options.baseUrl = args[++i]; |
…gate, Enter zooms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Separates the concept of transport (CLI agent: pi, opencode, claude, etc.) from backend (where models live: ollama, anthropic API, openai API).
How it works
--backend ollamaqueriesGET /api/tagsmodified_at(most recent first)[default — latest]— press Enter to accept~/.sentinel/config.jsonChanges
src/config.ts: +backend field on SentinelConfig, +listOllamaModels(), +formatSize(), ollama removed from transports listsrc/index.ts: --backend flag parsing, pickOllamaModelInteractive() picker, createInvoke dedup fix, help text updated with BACKENDS section