Add local model catalog and optional bundled 0.5B GGUF - #150
Draft
bernoussama wants to merge 7 commits into
Draft
Conversation
Offer curated Ollama/LM Studio models, download a checksummed Qwen2.5-Coder 0.5B GGUF on first-run Yes/No, and fall back to llama-server when Ollama is not running.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Groq retired llama-3.3-70b-versatile and qwen-qwq-32b. Point defaults and LLM judges at openai/gpt-oss-120b and openai/gpt-oss-20b.
Downloads the checksummed Qwen2.5-Coder 0.5B GGUF if needed, starts llama-server, and scores the CI command prompts with expected tokens plus optional Groq LLM judges.
Importing the eval module no longer requires GROQ_API_KEY, so eval:bundled can score locally with ExpectedToken only.
ExpectedToken scored 66.7% on the six CI prompts. The eval process now shuts down the local server so the run can exit.
Small models were echoing hardware-prompt noise and markdown. Give them few-shot command-only instructions, cap tokens, and unwrap fenced output so evals get pwd, uname, ls, mkdir, find, and df.
All six CI prompts now emit pwd, uname, ls, mkdir, find, and df.
bernoussama
commented
Sep 4, 2026
bernoussama
left a comment
Owner
Author
There was a problem hiding this comment.
Solid PR overall — checksum-pinned GGUF and llama.cpp runtime downloads, no shell interpolation in spawn, and the compact-prompt + extractCommand plumbing is a sensible way to tame a 0.5B model. A few things worth addressing:
Bugs / correctness
src/lib/ai.ts—hasCloudApiKey()checksMISTRAL_API_KEY, butenvProvider()'s map has no['MISTRAL_API_KEY', 'mistral']entry. A Mistral-only user hits "No API key found…" fromgetDefaultModelAsync()with a valid key set, andresolveInitialProvider()disagrees withenvProvider(). Add mistral to the map (or drop MISTRAL fromhasCloudApiKey).src/lib/bundled-model.tsensureBundledServer()— the "already running" probe only checks thathttp://127.0.0.1:18765/healthreturns ok. Any unrelated local service with a/healthroute on that port makes LazyShell point its OpenAI-compatible client at it. Verify viaGET /v1/modelscontainingBUNDLED_MODEL.idbefore trusting the port.src/lib/bundled-model.ts— ifwaitForServer()times out, the spawnedllama-serveris left running whileserverReadyis cleared; killserverProcesson the failure path. Related: nothing stops the server when the CLI exits (stopBundledServeris only called fromremove/eval), sollama-serversilently outlives every run and holds RAM. Document it as a resident daemon, add an exit hook, or providelazyshell model stop.src/lib/bundled-model.tsdownloadFile()— a mid-download failure leaves the ~469 MB.partialfile behind (onlyremoveBundledModelcleans it), and there's no resume, so a dropped connection restarts from byte 0.rmthe temp file in a catch.
Code quality / nits
eslint.config.jsturnsno-floating-promisesoff repo-wide — that's masking, not fixing. Scope the override or fix the call sites.isBundledModelInstalled()SHA-256s 469 MB and runs 3–4× per startup (resolveInitialProvider→initializeConfig→prepareLocalRuntime→ensureBundledServer). Memoize per-process or short-circuit on a size+mtime match.src/commands/config.tseditProvider()starts a 469 MB download with no confirmation when switching to the bundled provider — confirm first, like the first-run prompt does.- The committed
eval-results/*.jsonfiles are generated artifacts (and the first one documents a failing 0.67 run) — gitignoreeval-results/and drop them from the PR. src/commands/model.tsformatMb()divides by 1,000,000, so the UI shows "491 MB" while the README/first-run copy say ~469 MB (MiB). Pick one unit.generateCommandStruct()appliesgenerationLimits().temperaturetogenerateObjectbut dropsmaxTokens: 64— harmless today since the schema constrains output, but the intent leaks.
Small README typo too: "offers a catalog plus Custom…:".
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
LazyShell can now recommend local Ollama/LM Studio models and optionally download a ~469 MB bundled GGUF for offline use. Weights are not in the npm package.
Local catalog
When the provider is Ollama or LM Studio, config setup offers a catalog plus Custom…:
qwen2.5-coder:0.5b,qwen2.5-coder:1.5b(new default),hf.co/AryaYT/nl2shell-0.8bqwen2.5-coder:3b,qwen2.5-coder:7b,westenfelder/NL2SHLM Studio default is
qwen2.5-coder-1.5b-instruct.Bundled model (opt-in / opt-out)
~/.lazyshell/models/with SHA-256 verification.--skip-bundled-modelorLSH_SKIP_BUNDLED_MODEL=1(persisted asskipped).lazyshell model install/lazyshell model remove.llama-serverand uses the existing OpenAI-compatible path.Small local models use a compact few-shot prompt and a command extractor (strip markdown, take the command line) so they do not echo hardware-prompt noise.
Groq evals
CI evals failed because Groq decommissioned
llama-3.3-70b-versatileandqwen-qwq-32b. Defaults/judges now useopenai/gpt-oss-120bandopenai/gpt-oss-20b.Bundled model eval
bun run eval:bundled— ExpectedToken 100% (6/6). Results:eval-results/eval-bundled-1788483267742.jsonls -lapwdmkdir test-projectfind . -type f -name '*.js'uname -adf -h