chore: update llama-cpp to b7898 and opencode to v1.1.48

- Update llama-cpp from b7867 to b7898
- Update opencode from v1.1.12 to v1.1.48 with improved build process:
  - Replace custom bundle script with official script/build.ts
  - Add shell completion support
  - Add version check testing
  - Simplify node_modules handling
- Update llama-swap service config with new llama.cpp options
- Clarify opencode agent testing workflow in developer and reviewer configs
This commit is contained in:
2026-02-03 20:33:14 -05:00
parent 15259b5ec3
commit 7080727dce
8 changed files with 174 additions and 163 deletions

View File

@@ -28,7 +28,7 @@ You implement code. You're the only agent that modifies files.
1. Read the plan file 1. Read the plan file
2. Read the specific files/lines mentioned in context maps 2. Read the specific files/lines mentioned in context maps
3. Read incrementally if needed (imports, function definitions, etc.) 3. Read incrementally if needed (imports, function definitions, etc.)
4. Implement changes 4. Implement changes and accompanying tests
5. Commit: 5. Commit:
```bash ```bash
git add -A git add -A
@@ -36,6 +36,13 @@ You implement code. You're the only agent that modifies files.
``` ```
Types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore` Types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`
**Testing Requirements:**
- All tests must pass before committing
- Never ignore or skip failing tests
- If tests fail: either fix the code or fix the test
- Run tests after implementation to verify
**Rules:** **Rules:**
- Trust the plan - don't re-analyze or re-plan - Trust the plan - don't re-analyze or re-plan

View File

@@ -26,6 +26,7 @@ You review code implementations.
1. Check `git status` - if uncommitted changes, stop and tell @developer to commit 1. Check `git status` - if uncommitted changes, stop and tell @developer to commit
2. Review latest commit with `git show` 2. Review latest commit with `git show`
3. Read full files only if needed for context 3. Read full files only if needed for context
4. Do NOT run tests - you only review code
**Response format:** **Response format:**

View File

@@ -19,8 +19,8 @@ in
--port ''${PORT} \ --port ''${PORT} \
-m /mnt/ssd/Models/GLM/GLM-4.7-Flash-UD-Q4_K_XL.gguf \ -m /mnt/ssd/Models/GLM/GLM-4.7-Flash-UD-Q4_K_XL.gguf \
-c ''${ctx} \ -c ''${ctx} \
-ctk q8_0 \
--jinja \ --jinja \
--threads -1 \
--temp 0.7 \ --temp 0.7 \
--top-p 1.0 \ --top-p 1.0 \
--min-p 0.01 \ --min-p 0.01 \
@@ -34,6 +34,11 @@ in
env = [ "GGML_CUDA_ENABLE_UNIFIED_MEMORY=1" ]; env = [ "GGML_CUDA_ENABLE_UNIFIED_MEMORY=1" ];
}; };
# --spec-type ngram-mod \
# --spec-ngram-size-n 24 \
# --draft-min 48 \
# --draft-max 64 \
# https://huggingface.co/unsloth/Devstral-Small-2-24B-Instruct-2512-GGUF/tree/main # https://huggingface.co/unsloth/Devstral-Small-2-24B-Instruct-2512-GGUF/tree/main
"devstral-small-2-instruct" = { "devstral-small-2-instruct" = {
name = "Devstral Small 2 (24B) - Instruct"; name = "Devstral Small 2 (24B) - Instruct";

View File

@@ -7,12 +7,12 @@
vulkanSupport = true; vulkanSupport = true;
}).overrideAttrs }).overrideAttrs
(oldAttrs: rec { (oldAttrs: rec {
version = "7867"; version = "7898";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "ggml-org"; owner = "ggml-org";
repo = "llama.cpp"; repo = "llama.cpp";
tag = "b${version}"; tag = "b${version}";
hash = "sha256-uAsIObuU6BboNatK58XL/YDVLmJsgU3Z6gI2vvFG+pw="; hash = "sha256-ST7hhE5lWOm46WS+k9lkHJqVQpz8squwHZWE2/XG6MY=";
leaveDotGit = true; leaveDotGit = true;
postFetch = '' postFetch = ''
git -C "$out" rev-parse --short HEAD > $out/COMMIT git -C "$out" rev-parse --short HEAD > $out/COMMIT

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env bun
import solidPlugin from "./node_modules/@opentui/solid/scripts/solid-plugin";
import fs from "fs";
const version = process.env.OPENCODE_VERSION!;
const channel = process.env.OPENCODE_CHANNEL!;
const result = await Bun.build({
target: "bun",
outdir: "./dist",
entrypoints: ["./src/index.ts", "./src/cli/cmd/tui/worker.ts"],
plugins: [solidPlugin],
naming: {
entry: "[dir]/[name].js",
},
define: {
OPENCODE_VERSION: JSON.stringify(version),
OPENCODE_CHANNEL: JSON.stringify(channel),
},
external: ["@opentui/core-*"],
});
if (!result.success) {
console.error("Bundle failed:", result.logs);
process.exit(1);
}
// Move worker file to worker.ts at the dist root so the code can find it
if (fs.existsSync("./dist/cli/cmd/tui/worker.js")) {
fs.renameSync("./dist/cli/cmd/tui/worker.js", "./dist/worker.ts");
fs.rmdirSync("./dist/cli/cmd/tui", { recursive: true });
}

View File

@@ -7,23 +7,24 @@
, models-dev , models-dev
, nix-update-script , nix-update-script
, ripgrep , ripgrep
, testers , installShellFiles
, versionCheckHook
, writableTmpDirAsHomeHook , writableTmpDirAsHomeHook
, ,
}: }:
let stdenvNoCC.mkDerivation (finalAttrs: {
pname = "opencode"; pname = "opencode";
version = "1.1.12"; version = "1.1.48";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "anomalyco"; owner = "anomalyco";
repo = "opencode"; repo = "opencode";
tag = "v${version}"; tag = "v${finalAttrs.version}";
hash = "sha256-k6wRBtWFwyLWJ6R0el3dY/nBlg2t+XkTpsuEseLXp+E="; hash = "sha256-zKkeJSsxEuhucQkWBHxLR7tCTu86q2p6neRST2g/1hA="; # "sha256-RTj64yrVLTFNpVc8MvPAJISOlBo/j2MnuL5jo4VtKWM=";
}; };
node_modules = stdenvNoCC.mkDerivation { node_modules = stdenvNoCC.mkDerivation {
pname = "${pname}-node_modules"; pname = "${finalAttrs.pname}-node_modules";
inherit version src; inherit (finalAttrs) version src;
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [ impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND" "GIT_PROXY_COMMAND"
@@ -40,20 +41,17 @@ let
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
bun install \ bun install \
--cpu="*" \ --cpu="*" \
--filter=./packages/opencode \
--force \
--frozen-lockfile \ --frozen-lockfile \
--filter ./packages/opencode \
--filter ./packages/desktop \
--ignore-scripts \ --ignore-scripts \
--no-progress \ --no-progress \
--os="*" \ --os="*"
--production
bun run ./nix/scripts/canonicalize-node-modules.ts bun --bun ./nix/scripts/canonicalize-node-modules.ts
bun run ./nix/scripts/normalize-bun-binaries.ts bun --bun ./nix/scripts/normalize-bun-binaries.ts
runHook postBuild runHook postBuild
''; '';
@@ -62,12 +60,7 @@ let
runHook preInstall runHook preInstall
mkdir -p $out mkdir -p $out
while IFS= read -r dir; do find . -type d -name node_modules -exec cp -R --parents {} $out \;
rel="''${dir#./}"
dest="$out/$rel"
mkdir -p "$(dirname "$dest")"
cp -R "$dir" "$dest"
done < <(find . -type d -name node_modules -prune | sort)
runHook postInstall runHook postInstall
''; '';
@@ -75,34 +68,35 @@ let
# NOTE: Required else we get errors that our fixed-output derivation references store paths # NOTE: Required else we get errors that our fixed-output derivation references store paths
dontFixup = true; dontFixup = true;
outputHash = "sha256-vRIWQt02VljcoYG3mwJy8uCihSTB/OLypyw+vt8LuL8="; outputHash = "sha256-aQScGeakRanvH1LxizXrWA17YOmJJfRuypX4Jau4zQw="; # "sha256-37pmIiJzPEWeA7+5u5lz39vlFPI+N13Qw9weHrAaGW4=";
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
}; };
in
stdenvNoCC.mkDerivation (finalAttrs: {
inherit
pname
version
src
node_modules
;
nativeBuildInputs = [ nativeBuildInputs = [
bun bun
installShellFiles
makeBinaryWrapper makeBinaryWrapper
models-dev models-dev
writableTmpDirAsHomeHook
]; ];
patches = [ patches = [
./relax-bun-version-check.patch # NOTE: Relax Bun version check to be a warning instead of an error ./remove-special-and-windows-build-targets.patch # NOTE: Remove special and windows build targes
./root_fix.patch # https://github.com/anomalyco/opencode/pull/7691 ./root_fix.patch # https://github.com/anomalyco/opencode/pull/7691
]; ];
postPatch = ''
# NOTE: Relax Bun version check to be a warning instead of an error
substituteInPlace packages/script/src/index.ts \
--replace-fail 'throw new Error(`This script requires bun@''${expectedBunVersionRange}' \
'console.warn(`Warning: This script requires bun@''${expectedBunVersionRange}'
'';
configurePhase = '' configurePhase = ''
runHook preConfigure runHook preConfigure
cp -R ${node_modules}/. . cp -R ${finalAttrs.node_modules}/. .
runHook postConfigure runHook postConfigure
''; '';
@@ -113,13 +107,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
preBuild = '' preBuild = ''
chmod -R u+w ./packages/opencode/node_modules chmod -R u+w ./packages/opencode/node_modules
pushd ./packages/opencode/node_modules/@parcel/
for pkg in ../../../../node_modules/.bun/@parcel+watcher-*; do
linkName=$(basename "$pkg" | sed 's/@.*+\(.*\)@.*/\1/')
ln -sf "$pkg/node_modules/@parcel/$linkName" "$linkName"
done
popd
pushd ./packages/opencode/node_modules/@opentui/ pushd ./packages/opencode/node_modules/@opentui/
for pkg in ../../../../node_modules/.bun/@opentui+core-*; do for pkg in ../../../../node_modules/.bun/@opentui+core-*; do
linkName=$(basename "$pkg" | sed 's/@.*+\(.*\)@.*/\1/') linkName=$(basename "$pkg" | sed 's/@.*+\(.*\)@.*/\1/')
@@ -131,74 +118,47 @@ stdenvNoCC.mkDerivation (finalAttrs: {
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
cd ./packages/opencode cd ./packages/opencode
cp ${./bundle.ts} ./bundle.ts bun --bun ./script/build.ts --single --skip-install
bun run ./bundle.ts bun --bun ./script/schema.ts schema.json
runHook postBuild runHook postBuild
''; '';
dontStrip = true;
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/lib/opencode install -Dm755 dist/opencode-*/bin/opencode $out/bin/opencode
# Copy the bundled dist directory install -Dm644 schema.json $out/share/opencode/schema.json
cp -r dist $out/lib/opencode/
# Fix WASM paths in worker.ts - use absolute paths to the installed location runHook postInstall
# Main wasm is tree-sitter-<hash>.wasm, language wasms are tree-sitter-<lang>-<hash>.wasm '';
main_wasm=$(find "$out/lib/opencode/dist" -maxdepth 1 -name 'tree-sitter-[a-z0-9]*.wasm' -print -quit)
substituteInPlace $out/lib/opencode/dist/worker.ts \ postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) ''
--replace-fail 'module2.exports = "../../../tree-sitter-' 'module2.exports = "'"$out"'/lib/opencode/dist/tree-sitter-' \ installShellCompletion --cmd opencode \
--replace-fail 'new URL("tree-sitter.wasm", import.meta.url).href' "\"$main_wasm\"" --bash <($out/bin/opencode completion)
'';
# Copy only the native modules we need (marked as external in bundle.ts) postFixup = ''
mkdir -p $out/lib/opencode/node_modules/.bun wrapProgram $out/bin/opencode \
mkdir -p $out/lib/opencode/node_modules/@opentui
# Copy @opentui/core platform-specific packages
for pkg in ../../node_modules/.bun/@opentui+core-*; do
if [ -d "$pkg" ]; then
cp -r "$pkg" $out/lib/opencode/node_modules/.bun/$(basename "$pkg")
fi
done
mkdir -p $out/bin
makeWrapper ${lib.getExe bun} $out/bin/opencode \
--add-flags "run" \
--add-flags "$out/lib/opencode/dist/index.js" \
--prefix PATH : ${ --prefix PATH : ${
lib.makeBinPath [ lib.makeBinPath [
fzf fzf
ripgrep ripgrep
] ]
} \ }
--argv0 opencode
runHook postInstall
''; '';
postInstall = '' nativeInstallCheckInputs = [
# Add symlinks for platform-specific native modules versionCheckHook
for pkg in $out/lib/opencode/node_modules/.bun/@opentui+core-*; do writableTmpDirAsHomeHook
if [ -d "$pkg" ]; then ];
pkgName=$(basename "$pkg" | sed 's/@opentui+\(core-[^@]*\)@.*/\1/') doInstallCheck = true;
ln -sf ../.bun/$(basename "$pkg")/node_modules/@opentui/$pkgName \ versionCheckKeepEnvironment = [ "HOME" ];
$out/lib/opencode/node_modules/@opentui/$pkgName versionCheckProgramArg = "--version";
fi
done
'';
passthru = { passthru = {
tests.version = testers.testVersion { jsonschema = "${placeholder "out"}/share/opencode/schema.json";
package = finalAttrs.finalPackage;
command = "HOME=$(mktemp -d) opencode --version";
inherit (finalAttrs) version;
};
updateScript = nix-update-script { updateScript = nix-update-script {
extraArgs = [ extraArgs = [
"--subpackage" "--subpackage"
@@ -209,13 +169,13 @@ stdenvNoCC.mkDerivation (finalAttrs: {
meta = { meta = {
description = "AI coding agent built for the terminal"; description = "AI coding agent built for the terminal";
longDescription = '' homepage = "https://github.com/anomalyco/opencode";
OpenCode is a terminal-based agent that can build anything.
It combines a TypeScript/JavaScript core with a Go-based TUI
to provide an interactive AI coding experience.
'';
homepage = "https://github.com/sst/opencode";
license = lib.licenses.mit; license = lib.licenses.mit;
maintainers = with lib.maintainers; [
delafthi
graham33
];
sourceProvenance = with lib.sourceTypes; [ fromSource ];
platforms = [ platforms = [
"aarch64-linux" "aarch64-linux"
"x86_64-linux" "x86_64-linux"

View File

@@ -1,28 +0,0 @@
From 0e07ea8225f5667e39c6aa59eea726266f0afab0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Thu, 13 Nov 2025 10:16:31 +0100
Subject: [PATCH] Change Bun version check from error to warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
packages/script/src/index.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/script/src/index.ts b/packages/script/src/index.ts
index 141d2b75..de06d0dc 100644
--- a/packages/script/src/index.ts
+++ b/packages/script/src/index.ts
@@ -10,7 +10,7 @@ if (!expectedBunVersion) {
}
if (process.versions.bun !== expectedBunVersion) {
- throw new Error(`This script requires bun@${expectedBunVersion}, but you are using bun@${process.versions.bun}`)
+ console.warn(`Warning: This script expects bun@${expectedBunVersion}, but you are using bun@${process.versions.bun}`)
}
const CHANNEL = process.env["OPENCODE_CHANNEL"] ?? (await $`git branch --show-current`.text().then((x) => x.trim()))
--
2.51.0

View File

@@ -0,0 +1,99 @@
From 4d0a82e8f3cf8bf011e2592677db4aa31b6b290b Mon Sep 17 00:00:00 2001
From: Thierry Delafontaine <delafthi@pm.me>
Date: Sun, 4 Jan 2026 20:55:49 +0100
Subject: [PATCH] Remove special and windows build targets
---
packages/opencode/script/build.ts | 70 +++++++++++++++----------------
1 file changed, 35 insertions(+), 35 deletions(-)
diff --git a/packages/opencode/script/build.ts b/packages/opencode/script/build.ts
index f51cb2924..ee3c0e863 100755
--- a/packages/opencode/script/build.ts
+++ b/packages/opencode/script/build.ts
@@ -33,27 +33,27 @@ const allTargets: {
os: "linux",
arch: "x64",
},
- {
- os: "linux",
- arch: "x64",
- avx2: false,
- },
- {
- os: "linux",
- arch: "arm64",
- abi: "musl",
- },
- {
- os: "linux",
- arch: "x64",
- abi: "musl",
- },
- {
- os: "linux",
- arch: "x64",
- abi: "musl",
- avx2: false,
- },
+ // {
+ // os: "linux",
+ // arch: "x64",
+ // avx2: false,
+ // },
+ // {
+ // os: "linux",
+ // arch: "arm64",
+ // abi: "musl",
+ // },
+ // {
+ // os: "linux",
+ // arch: "x64",
+ // abi: "musl",
+ // },
+ // {
+ // os: "linux",
+ // arch: "x64",
+ // abi: "musl",
+ // avx2: false,
+ // },
{
os: "darwin",
arch: "arm64",
@@ -62,20 +62,20 @@ const allTargets: {
os: "darwin",
arch: "x64",
},
- {
- os: "darwin",
- arch: "x64",
- avx2: false,
- },
- {
- os: "win32",
- arch: "x64",
- },
- {
- os: "win32",
- arch: "x64",
- avx2: false,
- },
+ // {
+ // os: "darwin",
+ // arch: "x64",
+ // avx2: false,
+ // },
+ // {
+ // os: "win32",
+ // arch: "x64",
+ // },
+ // {
+ // os: "win32",
+ // arch: "x64",
+ // avx2: false,
+ // },
]
const targets = singleFlag
--
2.52.0