diff --git a/configs/desktop.nix b/configs/desktop.nix index ddcdb86..a477cb0 100644 --- a/configs/desktop.nix +++ b/configs/desktop.nix @@ -6,5 +6,6 @@ ./desktop-light.nix ./desktop-packages-light.nix ./desktop-packages-full.nix + ./opencode.nix ]; } diff --git a/configs/opencode.nix b/configs/opencode.nix new file mode 100644 index 0000000..2bd036d --- /dev/null +++ b/configs/opencode.nix @@ -0,0 +1,67 @@ +# OpenCode pointed at straylight's llama.cpp OpenAI-compatible API. +# Managed config lives in /etc/opencode/ (highest OpenCode precedence on Linux). +# llama-server is on straylight:11434; MagicDNS resolves that to loopback here. + +{ pkgs, lib, ... }: +let + llamaBase = "http://straylight:11434/v1"; + limit = { context = 131072; output = 32768; }; + text = name: { + inherit name limit; + modalities = { input = [ "text" ]; output = [ "text" ]; }; + }; + vision = name: { + inherit name limit; + modalities = { input = [ "text" "image" ]; output = [ "text" ]; }; + }; + cfg = { + "$schema" = "https://opencode.ai/config.json"; + enabled_providers = [ "llama.cpp" ]; + model = "llama.cpp/laguna-s-2.1"; + small_model = "llama.cpp/ornith-1.5-9b-uncensored"; + provider = { + "llama.cpp" = { + npm = "@ai-sdk/openai-compatible"; + name = "llama.cpp (straylight)"; + options = { + baseURL = llamaBase; + apiKey = "none"; + }; + models = { + "laguna-s-2.1" = text "Laguna S 2.1"; + "qwen3.6-35b-a3b-abliterated" = text "Qwen3.6 35B A3B"; + "gemma4-26b-a4b-abliterated" = text "Gemma 4 26B A4B"; + "ornith-1.0-35b" = text "Ornith 1.0 35B"; + "ornith-1.5-9b-uncensored" = text "Ornith 1.5 9B"; + "ornith-1.5-35b-a3b" = text "Ornith 1.5 35B MoE"; + "qwen3.8-27b-uncensored" = text "Qwen3.8 27B"; + "qwen3-vl-8b-abliterated" = vision "Qwen3-VL 8B"; + }; + }; + }; + agent = { + vision = { + description = "Look at images, screenshots, diagrams, UI captures, and other visual artifacts. Use whenever the task needs to see a picture rather than guess from a filename or OCR text."; + mode = "subagent"; + model = "llama.cpp/qwen3-vl-8b-abliterated"; + color = "accent"; + permission = { + edit = "deny"; + }; + prompt = '' + You are a vision specialist running on Qwen3-VL-8B (abliterated) via llama.cpp. + + You receive image paths and/or attached images. Describe what is actually in the image. + Transcribe visible text. Answer the caller's question about the image. Do not invent UI + that is not there. If the image cannot be read, say so and what you would need instead. + + You may read files (including images) and run read-only shell commands. Do not edit the + workspace; report findings back to the parent agent. + ''; + }; + }; + }; +in +{ + environment.etc."opencode/opencode.json".text = builtins.toJSON cfg; +}