7 Commits

Author SHA1 Message Date
78728ef00e build: Paketbau für .deb und Arch-Paket vorbereiten
Some checks failed
release / deb (push) Failing after 4m33s
release / arch (push) Failing after 5m26s
Tauri-Bundle: .deb hängt von podman ab und installiert die Aufgaben nach
/usr/share/coding-bench/tasks. Die App findet diesen Ordner, wenn weder
Konfiguration noch Datenordner Aufgaben angeben. PKGBUILD, Desktop-Eintrag
und Gitea-Workflow (.deb und Arch-Paket, Start bei Tag v* oder manuell).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-07 12:03:05 +01:00
a968acf3ae docs: Plattform auf CachyOS korrigieren, README-Status prüfen
Pop!_OS war als Zielplattform eingetragen, geprüft wurde auf CachyOS. README
nennt jetzt die tatsächlich geprüften Versionen (CachyOS, Podman 6.1.4,
Node 24.21, Rust 1.99.1), beschreibt den Stand ehrlich und listet die
Anforderungen mit Ollama oder OpenAI-kompatiblem Endpunkt.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-07 11:58:53 +01:00
91a15baebc feat: Podman-Status im Setup und Schritt-Ansicht je Lauf
Setup zeigt, ob der Container-Befehl läuft (Version). Ergebnistabelle hat
eine Schritte-Ansicht: Nachrichten, Tool-Aufrufe und Tool-Antworten eines
Laufs aus der Datenbank. Store-Test grün, 53 Unit-Tests insgesamt.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-07 11:55:56 +01:00
668e690cda feat: Rangliste und Matrix für Batches
ranking.rs: Gesamtscore je Modell (gewichtet nach weight aus task.toml),
Median-Dauer und Completion-Tokens als Tie-Breaker, Matrix Modell × Aufgabe
mit Erfolgen und mittlerem Score. Befehl batch_ranking, Anzeige nach dem
Batch. 5 Unit-Tests grün, 47 insgesamt. Wilson-Intervalle folgen mit F-12.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-07 11:54:28 +01:00
bf3d8d8459 test: Aufgaben über strata bestanden, Testbericht
Alle sechs Aufgaben mit qwen3.8-flash-next-q2_0 über den OpenAI-Endpunkt
von strata: 6 von 6 bestanden, Score 1.00. Vergleich zum kleinen Modell
qwen3:0.6b (0 von 6). Der Lauf ist eine Wiederholung.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-06 22:49:29 +01:00
dce98d3d11 feat: API-Schlüssel für strata aus Umgebungsvariable
strata verlangt nach dem Start mit --access lan einen Schlüssel (HTTP 401).
Der Client liest ihn aus der Umgebungsvariable STRATA_API_KEY (Name in
config.toml änderbar) und sendet ihn als Bearer-Token. Der Schlüssel steht
weder in der Konfiguration noch im Repo.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-06 21:13:26 +01:00
f35b68ae1f feat: OpenAI-kompatibler Modell-Client für strata
Backend in config.toml wählbar (ollama oder openai), Standard-URL für
strata im LAN (192.168.12.4:8082). Nachrichten werden ins OpenAI-Format
umgeschrieben, Tool-Antworten bekommen die passende tool_call_id. Test
für die Umwandlung grün (42 Unit-Tests). Verbindung zu strata noch nicht
möglich: alle drei Adressen lehnen ab.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-06 21:06:29 +01:00
15 changed files with 889 additions and 21 deletions

View File

@ -0,0 +1,57 @@
# Release-Pakete: .deb (Ubuntu/Debian) und Arch-Paket (CachyOS/Arch).
# Startet bei einem Tag v* oder manuell (workflow_dispatch). Die Artefakte hängen am Lauf.
name: release
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
deb:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Systemabhängigkeiten
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file \
libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev patchelf
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: dtolnay/rust-toolchain@stable
- run: npm ci
- run: npm run tauri build -- --bundles deb
- uses: actions/upload-artifact@v4
with:
name: coding-bench-deb
path: src-tauri/target/release/bundle/deb/*.deb
arch:
runs-on: ubuntu-24.04
container: archlinux:latest
steps:
- name: Pakete für Arch
run: |
pacman -Syu --noconfirm --needed base-devel git nodejs npm rust \
webkit2gtk-4.1 gtk3 librsvg libayatana-appindicator podman sudo
useradd -m builder
echo "builder ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/builder
- uses: actions/checkout@v4
with:
path: src
- name: Quellarchiv und Paket bauen
run: |
cd src
VERSION=$(sed -n 's/^pkgver=//p' packaging/arch/PKGBUILD)
git archive --prefix=coding-bench-$VERSION/ -o /tmp/coding-bench-$VERSION.tar.gz HEAD
mkdir -p /home/builder/pkg
cp packaging/arch/PKGBUILD /tmp/coding-bench-$VERSION.tar.gz /home/builder/pkg/
chown -R builder:builder /home/builder/pkg
su builder -c "cd /home/builder/pkg && makepkg -s --noconfirm -f"
cp /home/builder/pkg/*.pkg.tar.zst src/
- uses: actions/upload-artifact@v4
with:
name: coding-bench-arch
path: src/*.pkg.tar.zst

View File

@ -10,9 +10,9 @@ Fehlerberichte und Feature-Wünsche sind als Issues willkommen. Pull Requests we
## Status
Version: noch keine (Release 0.1.0 ist geplant, siehe `ROADMAP.md`). Es gibt bisher **keinen lauffähigen Code**. Dieses Dokument beschreibt das Ziel aus der `SPEC.md`.
Version: noch keine (Release 0.1.0 in Arbeit, siehe `ROADMAP.md`). Der Code ist gebaut und die Kernfunktionen sind getestet, die Oberfläche ist noch nicht im Fenster abgenommen.
Getestet auf: nichts. Die Zielplattform ist Linux (Pop!_OS), dort ist noch nichts gebaut oder geprüft.
Getestet auf: CachyOS (Kernel 7.3.1), Podman 6.1.4, Node.js 24.21, Rust 1.99.1. Geprüft sind Build, Unit-Tests, ein Ende-zu-Ende-Lauf gegen Ollama (`qwen3:0.6b`) und ein Lauf aller sechs Aufgaben über einen OpenAI-kompatiblen Endpunkt (`qwen3.8-flash-next-q2_0`). Andere Systeme sind nicht geprüft.
## Before you use it
@ -32,10 +32,10 @@ Noch nicht verfügbar. Installationshinweise folgen mit dem ersten Release.
## Requirements
* Linux (Pop!_OS als Zielplattform)
* Podman (rootless)
* Rust-Toolchain und Node.js (für den Build, Details folgen)
* Ollama mit Modellen, die Tool-Calling unterstützen
* Linux (geprüft auf CachyOS)
* Podman, rootless, mit Netzwerk-Unterstützung für Images beim ersten Bauen
* Rust-Toolchain (Rust 1.99.1 geprüft) und Node.js (24.21 geprüft), dazu die Tauri-Systemvoraussetzungen (WebKitGTK 4.1)
* Ein Modell-Endpunkt mit Tool-Calling: Ollama (`/api/chat`) oder ein OpenAI-kompatibler Server (z. B. strata, `/v1/chat/completions`)
## Build and run

View File

@ -9,7 +9,7 @@ Zeichen: ✓ fertig · ◐ teilweise · ✗ offen · ? nicht geprüft.
- **Sandbox:** Jeder Lauf in einem frischen Podman-Container mit `--network none`. Der Agent arbeitet nur unter `/work`.
- **Sequentiell:** Modelle laufen nacheinander, weil ein Modell die GPU belegt. Parallelität nur, wenn du `parallel > 1` setzt.
- **Versionierung:** System-Prompt und Limits werden pro Batch in `config_json` mitgespeichert, damit Läufe vergleichbar bleiben.
- **Plattform und Stack:** Linux (Pop!_OS) zuerst. Tauri 2, Rust-Backend, Svelte mit TypeScript fürs Frontend, SQLite für Ergebnisse.
- **Plattform und Stack:** Linux (CachyOS) zuerst. Tauri 2, Rust-Backend, Svelte mit TypeScript fürs Frontend, SQLite für Ergebnisse.
- **Nicht-Ziele v1:** verteiltes Ausführen auf mehreren Rechnern, Nutzerverwaltung, Veröffentlichen von Ergebnissen.
- **Git:** Repo auf deinem Gitea. Nicht pushen ohne dein ausdrückliches Wort.
- **Klicktests:** Eine neue Funktion gilt erst als fertig, wenn ihre Klicktests aus `KLICKTESTS.md` mindestens einmal ✓ haben. Das Todo nennt die zugehörigen Tests. Du darfst die Regel für einen Block aufweichen, wenn du ihn bewusst erledigen willst; das steht dann im Todo.
@ -24,9 +24,9 @@ Zeichen: ✓ fertig · ◐ teilweise · ✗ offen · ? nicht geprüft.
| #1004 | F-04 Podman-Sandbox pro Lauf | SPEC 6, 12 | ◐ | Modul `sandbox.rs` steht: Start ohne Netz, Limits, Kopieren nach `/work`, `exec` mit Timeout, Export, Entfernen. Limits und Runtime kommen aus `config.toml`. Echter Lauf gegen Podman mit Image `cb-python:latest` bestanden (ignorierter Test). Noch nicht an den Runner angebunden (#1022); Klicktests `lauf2sandbox.1–.2` manuell offen (→ #1020) |
| #1005 | F-05 Runner mit Wiederholungen, Abbruch, Fortsetzen | SPEC 7, 12 | ◐ | `runner.rs`: Plan, Warm-up je Modell, Sandbox pro Lauf, `check.sh`, Abbruch, Fortsetzen über die DB. Ende-zu-Ende gegen srv04 mit `qwen3:0.6b` grün (2 Läufe, dann Fortsetzen überspringt beide). Abbruch im Lauf nicht real getestet. Über Tauri-Befehle `start_batch`, `cancel_batch` angebunden, Ereignisse `batch-event` (→ #1022) |
| #1006 | F-06 SQLite inkl. Schritt-Log | SPEC 8, 12 | ◐ | `store.rs`: Tabellen `batch`, `run`, `step` nach SPEC 8, Lauf und Schritte in einer Transaktion. Datei `coding-bench.sqlite` im Datenordner, wird beim Start angelegt. Lesen über `batch_results`. Getestet in-memory und im Batch (→ #1023) |
| #1007 | F-07 Tests a-01 bis a-03 und b-04 bis b-06 | SPEC 11, 12 | ◐ | Aufgaben liegen unter `tasks/`, gültig geladen (Test `repo_aufgaben_sind_gueltig`). Musterlösungen bestehen alle Checks, leere Lösung scheitert. Echter Lauf mit `qwen3:0.6b`: 0 von 6 bestanden (a-01 falsche Zahl, a-02/a-03/b-05/b-06 Prüfung rot, b-04 Zeitlimit 480 s). Nur ein kleines Modell getestet (→ #1024) |
| #1007 | F-07 Tests a-01 bis a-03 und b-04 bis b-06 | SPEC 11, 12 | ◐ | Aufgaben liegen unter `tasks/`, gültig geladen (Test `repo_aufgaben_sind_gueltig`). Musterlösungen bestehen alle Checks, leere Lösung scheitert. Mit `qwen3:0.6b` 0 von 6 bestanden. Mit `qwen3.8-flash-next-q2_0` über strata (OpenAI-Format, LAN) 6 von 6 bestanden, Score 1.00 (Testbericht `testberichte/2026-11-06-strata-lauf.md`) (→ #1024) |
| #1008 | F-08 GUI: Setup, Batch starten, Live-Fortschritt | SPEC 10, 12 | ◐ | Setup zeigt Pfade und Aufgaben, Batch-Start mit Modellen, Wiederholungen, Abbrechen, Fortschritt und Ergebnistabelle gebaut. `svelte-check` 0 Fehler. Nicht im Fenster geprüft; Klicktests `batch2fortsetzen.1–.2` offen (→ #1025) |
| #1009 | F-09 Rangliste und Matrix | SPEC 9, 10, 12 | ✗ | noch nicht begonnen (→ #1026) |
| #1009 | F-09 Rangliste und Matrix | SPEC 9, 10, 12 | ◐ | `ranking.rs`: Gesamtscore (gewichtet), Median-Dauer, Tie-Breaker, Matrix Modell × Aufgabe. 5 Unit-Tests grün. Oberfläche zeigt beides nach dem Batch. Ohne Intervall und Kategorie-Ranking (F-12). Klicktest `ergebnis2detail.1` manuell offen (→ #1026) |
| #1010 | F-10 Tests c-07 bis c-09 | SPEC 11, 12 | ✗ | Phase 2 (→ #1027) |
| #1011 | F-11 Adapter Aider-Polyglot-Teilmenge | SPEC 12 | ✗ | Phase 2 (→ #1028) |
| #1012 | F-12 Kategorie-Ranking, Wilson-Intervalle, Markierung | SPEC 9, 12 | ✗ | Phase 2 (→ #1029) |
@ -50,9 +50,9 @@ Zeichen: ✓ fertig · ◐ teilweise · ✗ offen · ? nicht geprüft.
- [#1021] **Agent-Loop gegen Ollama.** Umgesetzt in `src-tauri/src/agent.rs`: fünf Tools, Pfade auf `/work`, Fehlerklassen, Schleifenerkennung, Metriken, Ollama-Client (`/api/chat`, ohne Streaming, Temperatur 0). Offen: echter Lauf gegen Ollama (Dienst starten, Modell laden), Klicktests `lauf2ergebnis.1–.3`. Tests `lauf2ergebnis.1–.3`. → #1003
- [#1022] **Runner.** Umgesetzt in `src-tauri/src/runner.rs`, über `start_batch` und `cancel_batch` an die Oberfläche angebunden. Offen: Abbruch in der App real prüfen, Modelle mit eigenem Endpunkt in der Config (Phase 1 hat einen gemeinsamen `ollama_url`). Tests `batch2fortsetzen.1–.2`. → #1005
- [#1023] **SQLite-Speicher.** Umgesetzt in `src-tauri/src/store.rs`, Schema nach SPEC 8. Datei-Datenbank im Datenordner angebunden. Offen: Klicktest `lauf2ergebnis.2` mit Schritt-Ansicht (noch keine Oberfläche dafür). Tests `lauf2ergebnis.2`. → #1006
- [#1024] **Aufgaben a-01 bis a-03, b-04 bis b-06 schreiben.** Geschrieben unter `tasks/`. b-06 mit Mutationstest; ein Fehler im Check (veralteter Bytecode bei Mutanten) ist behoben. Offen: Tests als Berichte in `testberichte/` festhalten, größeres Modell für einen aussagekräftigen Lauf, Zeitlimit von b-04 prüfen. → #1007
- [#1025] **GUI Setup und Batch.** Gebaut: Pfade, Aufgabenauswahl, Modelle, Wiederholungen, Start, Abbrechen, Live-Log, Ergebnistabelle. Offen: Podman-Status im Setup, Schritt-Log in der Oberfläche, Klicktest `batch2fortsetzen.1` manuell. → #1008
- [#1026] **Rangliste und Matrix.** Gesamtscore mit Intervall, Matrix Modell × Test nach Erfolgsquote, Lauf-Detail. Tests `ergebnis2detail.1`. → #1009
- [#1024] **Aufgaben a-01 bis a-03, b-04 bis b-06 schreiben.** Geschrieben unter `tasks/`. b-06 mit Mutationstest; ein Fehler im Check (veralteter Bytecode bei Mutanten) ist behoben. Ergebnis: mit `qwen3.8-flash-next-q2_0` über strata 6 von 6 bestanden. Bericht in `testberichte/`. Offen: Zeitlimit von b-04 bei langsamen Modellen prüfen. → #1007
- [#1025] **GUI Setup und Batch.** Gebaut: Pfade, Container-Status (Podman-Version im Setup), Aufgabenauswahl, Modelle, Wiederholungen, Start, Abbrechen, Live-Log, Ergebnistabelle, Rangliste und Matrix, Schritt-Ansicht je Lauf. Offen: Klicktests `batch2fortsetzen.1` und `lauf2ergebnis.2` manuell, Oberfläche im Fenster ansehen. → #1008
- [#1026] **Rangliste und Matrix.** Gebaut: Gesamtscore (gewichtet nach `weight`), Median-Dauer als Tie-Breaker, Matrix Modell × Aufgabe mit Erfolgen und Farbe nach Score. Offen: Wilson-Intervall und „nicht unterscheidbar“ (F-12, Phase 2), Lauf-Detail mit Schrittliste, Klicktest `ergebnis2detail.1` manuell. Tests `ergebnis2detail.1`. → #1009
**P2 – danach (Release 0.2.0, Referenz und Tiefe)**
- [#1027] **Tests c-07 bis c-09.** Neuer CLI-Parameter, Refactoring, Stacktrace-Fehler. → #1010

View File

@ -219,5 +219,5 @@ Jede Anforderung hat eine feste ID.
- Ollama läuft lokal oder im Netz und unterstützt Tool-Calling für die getesteten Modelle. Modelle ohne Tool-Support werden als `endpoint_error` markiert und übersprungen.
- Vergleichbarkeit mit veröffentlichten Benchmarkzahlen hängt vom Harness ab (Prompt, Tools, Limits). Der System-Prompt und die Limits sind deshalb versioniert und werden im Batch mitgespeichert (`config_json`).
- Betriebssystem: Linux (Pop!_OS) zuerst, andere Plattformen nicht Teil von v1.
- Betriebssystem: Linux (CachyOS) zuerst, andere Plattformen nicht Teil von v1.
- Entscheidung offen: Svelte oder React fürs Frontend. Der Entwickler wählt, was er schneller liefert.

31
packaging/arch/PKGBUILD Normal file
View File

@ -0,0 +1,31 @@
# Maintainer: wlkns-dev
# Paket aus dem Quellarchiv des Git-Tags. Das Archiv erzeugt der Release-Workflow
# (git archive) bzw. man lokal mit: git archive --prefix=coding-bench-$pkgver/ -o coding-bench-$pkgver.tar.gz HEAD
pkgname=coding-bench
pkgver=0.1.0
pkgrel=1
pkgdesc="Benchmark für lokale LLMs als Coding-Agent: Aufgaben lösen lassen, Ranking erstellen"
arch=('x86_64')
url="https://git.wlkns.org/wlkns-dev/coding-bench"
license=('custom:none')
depends=('webkit2gtk-4.1' 'gtk3' 'librsvg' 'libayatana-appindicator' 'podman')
makedepends=('rust' 'nodejs' 'npm')
source=("$pkgname-$pkgver.tar.gz")
sha256sums=('SKIP')
options=('!debug')
build() {
cd "$srcdir/$pkgname-$pkgver"
npm ci
npm run tauri build -- --no-bundle
}
package() {
cd "$srcdir/$pkgname-$pkgver"
install -Dm755 "src-tauri/target/release/coding-bench" "$pkgdir/usr/bin/coding-bench"
install -Dm644 "packaging/coding-bench.desktop" "$pkgdir/usr/share/applications/coding-bench.desktop"
install -Dm644 "src-tauri/icons/128x128.png" "$pkgdir/usr/share/icons/hicolor/128x128/apps/coding-bench.png"
install -Dm644 "src-tauri/icons/32x32.png" "$pkgdir/usr/share/icons/hicolor/32x32/apps/coding-bench.png"
install -dm755 "$pkgdir/usr/share/coding-bench"
cp -r tasks "$pkgdir/usr/share/coding-bench/tasks"
}

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=coding-bench
GenericName=Benchmark für lokale LLM-Agenten
Comment=Lokale LLMs als Coding-Agent gegen Aufgaben testen und vergleichen
Exec=coding-bench
Icon=coding-bench
Terminal=false
Categories=Development;Utility;

View File

@ -553,6 +553,176 @@ impl ModelClient for OllamaClient {
}
}
/// Modell über einen OpenAI-kompatiblen Endpunkt (`/v1/chat/completions`), z. B. strata.
/// Die internen Nachrichten werden ins OpenAI-Format umgeschrieben: Argumente als Text,
/// jeder Tool-Call mit ID, Tool-Antworten mit passender `tool_call_id`.
pub struct OpenAiClient {
pub url: String,
pub model: String,
api_key: Option<String>,
http: reqwest::blocking::Client,
}
#[derive(Deserialize)]
struct OpenAiResponse {
choices: Vec<OpenAiChoice>,
#[serde(default)]
usage: Option<OpenAiUsage>,
}
#[derive(Deserialize)]
struct OpenAiChoice {
message: OpenAiMessage,
}
#[derive(Deserialize)]
struct OpenAiMessage {
#[serde(default)]
content: Option<String>,
#[serde(default)]
tool_calls: Vec<OpenAiToolCall>,
}
#[derive(Deserialize)]
struct OpenAiToolCall {
function: OpenAiFunction,
}
#[derive(Deserialize)]
struct OpenAiFunction {
name: String,
#[serde(default)]
arguments: String,
}
#[derive(Deserialize)]
struct OpenAiUsage {
#[serde(default)]
prompt_tokens: u32,
#[serde(default)]
completion_tokens: u32,
}
/// Wandelt den Verlauf ins OpenAI-Format um. Jeder Tool-Call bekommt eine ID; eine
/// Tool-Antwort erhält die ID des nächsten offenen Calls mit gleichem Namen.
pub fn to_openai_messages(messages: &[Message]) -> Vec<Value> {
let mut out = Vec::new();
// Offene Calls: (id, name)
let mut open: Vec<(String, String)> = Vec::new();
let mut counter = 0usize;
for m in messages {
match m.role.as_str() {
"assistant" if !m.tool_calls.is_empty() => {
let mut calls = Vec::new();
for c in &m.tool_calls {
counter += 1;
let id = format!("call_{counter}");
let args = match &c.function.arguments {
Value::String(s) => s.clone(),
other => other.to_string(),
};
calls.push(json!({
"id": id,
"type": "function",
"function": { "name": c.function.name, "arguments": args }
}));
open.push((id, c.function.name.clone()));
}
out.push(json!({ "role": "assistant", "content": m.content, "tool_calls": calls }));
}
"tool" => {
let name = m.tool_name.clone().unwrap_or_default();
let id = match open.iter().position(|(_, n)| *n == name) {
Some(i) => open.remove(i).0,
None => format!("call_orphan_{counter}"),
};
out.push(json!({ "role": "tool", "tool_call_id": id, "content": m.content }));
}
role => out.push(json!({ "role": role, "content": m.content })),
}
}
out
}
impl OpenAiClient {
pub fn new(url: &str, model: &str, api_key: Option<String>) -> Result<OpenAiClient, String> {
let http = reqwest::blocking::Client::builder()
.build()
.map_err(|e| format!("HTTP-Client nicht baubar: {e}"))?;
Ok(OpenAiClient {
url: url.trim_end_matches('/').into(),
model: model.into(),
api_key,
http,
})
}
}
impl ModelClient for OpenAiClient {
fn chat(&self, messages: &[Message], tools: &Value, timeout: Duration)
-> Result<ChatResponse, ModelError>
{
let body = json!({
"model": self.model,
"messages": to_openai_messages(messages),
"tools": tools,
"stream": false,
"temperature": 0,
});
let mut req = self.http.post(&self.url).timeout(timeout).json(&body);
if let Some(key) = &self.api_key {
req = req.bearer_auth(key);
}
let resp = req
.send()
.map_err(|e| {
if e.is_timeout() {
ModelError::Timeout
} else {
ModelError::Endpoint(e.to_string())
}
})?;
if !resp.status().is_success() {
let status = resp.status();
let text = resp.text().unwrap_or_default();
return Err(ModelError::Endpoint(format!("HTTP {status}: {text}")));
}
let parsed: OpenAiResponse = resp
.json()
.map_err(|e| ModelError::Endpoint(format!("Antwort nicht lesbar: {e}")))?;
let choice = parsed
.choices
.into_iter()
.next()
.ok_or_else(|| ModelError::Endpoint("Antwort ohne choices".into()))?;
let tool_calls = choice
.message
.tool_calls
.into_iter()
.map(|c| {
// Argumente kommen als JSON-Text. Ungültiges JSON bleibt als Text,
// der Agent meldet es dann als invalid_tool_json.
let arguments = serde_json::from_str::<Value>(&c.function.arguments)
.unwrap_or(Value::String(c.function.arguments.clone()));
ToolCall {
function: FunctionCall { name: c.function.name, arguments },
}
})
.collect();
let usage = parsed.usage.unwrap_or(OpenAiUsage { prompt_tokens: 0, completion_tokens: 0 });
Ok(ChatResponse {
message: Message {
role: "assistant".into(),
content: choice.message.content.unwrap_or_default(),
tool_calls,
tool_name: None,
},
prompt_tokens: usage.prompt_tokens,
completion_tokens: usage.completion_tokens,
})
}
}
#[cfg(test)]
mod tests {
use super::*;
@ -816,6 +986,35 @@ Rufe danach das Werkzeug done auf.";
assert_eq!(content.trim(), "hallo", "out.txt: {content:?}");
}
#[test]
fn openai_format_ordnet_tool_antworten_zu() {
let msgs = vec![
Message::new("system", "s"),
Message::new("user", "u"),
Message {
role: "assistant".into(),
content: String::new(),
tool_calls: vec![ToolCall {
function: FunctionCall { name: "read_file".into(), arguments: json!({"path": "a"}) },
}],
tool_name: None,
},
Message {
role: "tool".into(),
content: "inhalt".into(),
tool_calls: vec![],
tool_name: Some("read_file".into()),
},
];
let out = to_openai_messages(&msgs);
assert_eq!(out.len(), 4);
let call = &out[2]["tool_calls"][0];
assert_eq!(call["type"], "function");
assert_eq!(call["function"]["arguments"], "{\"path\":\"a\"}");
assert_eq!(out[3]["role"], "tool");
assert_eq!(out[3]["tool_call_id"], call["id"]);
}
#[test]
fn sh_quote_maskiert_apostrophe() {
assert_eq!(sh_quote("a'b"), "'a'\\''b'");

View File

@ -10,6 +10,8 @@ use std::fs;
use std::path::{Path, PathBuf};
pub const CONFIG_FILE_NAME: &str = "config.toml";
/// Aufgaben, die ein Paket installiert. Gilt, wenn weder die Konfiguration noch der Datenordner Aufgaben angeben.
pub const SYSTEM_TASKS_DIR: &str = "/usr/share/coding-bench/tasks";
/// Rohe Konfiguration, so wie sie in der Datei steht.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
@ -21,8 +23,14 @@ pub struct Config {
pub tasks_dir: Option<PathBuf>,
/// Container-Programm für die Sandbox (Podman-CLI).
pub container_runtime: String,
/// Modell-Backend: `ollama` oder `openai` (OpenAI-kompatibel, z. B. strata).
pub backend: String,
/// Ollama-Endpunkt für alle Modelle (Phase 1).
pub ollama_url: String,
/// OpenAI-kompatibler Endpunkt, vollständige URL inkl. `/v1/chat/completions`.
pub openai_url: String,
/// Name der Umgebungsvariable mit dem API-Schlüssel. Der Schlüssel selbst steht nicht in der Datei.
pub openai_api_key_env: String,
/// Speicherlimit pro Lauf, Podman-Schreibweise.
pub sandbox_memory: String,
/// CPU-Anteil pro Lauf.
@ -36,7 +44,10 @@ impl Default for Config {
data_dir: None,
tasks_dir: None,
container_runtime: "podman".into(),
backend: "ollama".into(),
ollama_url: "http://127.0.0.1:11434".into(),
openai_url: "http://192.168.12.4:8082/v1/chat/completions".into(),
openai_api_key_env: "STRATA_API_KEY".into(),
sandbox_memory: limits.memory,
sandbox_cpus: limits.cpus,
}
@ -57,6 +68,15 @@ impl Config {
toml::from_str(text).map_err(|e| format!("config.toml ist ungültig: {e}"))
}
/// Endpunkt des gewählten Backends.
pub fn endpoint_url(&self) -> String {
if self.backend == "openai" {
self.openai_url.clone()
} else {
self.ollama_url.clone()
}
}
/// Ressourcenlimits der Sandbox aus der Konfiguration.
pub fn sandbox_limits(&self) -> Limits {
Limits {
@ -103,7 +123,10 @@ pub fn load_or_create(config_dir: &Path, default_data_dir: &Path) -> Result<(Pat
defaults
};
let paths = config.resolve(&config_file, default_data_dir);
let mut paths = config.resolve(&config_file, default_data_dir);
if config.tasks_dir.is_none() && !paths.tasks_dir.is_dir() && Path::new(SYSTEM_TASKS_DIR).is_dir() {
paths.tasks_dir = PathBuf::from(SYSTEM_TASKS_DIR);
}
fs::create_dir_all(&paths.data_dir)
.map_err(|e| format!("Datenordner {} nicht anlegbar: {e}", paths.data_dir.display()))?;
Ok((paths, config))

View File

@ -1,5 +1,6 @@
mod agent;
mod config;
mod ranking;
mod runner;
mod sandbox;
mod store;
@ -73,7 +74,9 @@ async fn start_batch(
let jobs = runner::plan(&models, &selected, repeats);
let run_cfg = RunConfig {
runtime: cfg.container_runtime.clone(),
endpoint_url: cfg.ollama_url.clone(),
backend: cfg.backend.clone(),
endpoint_url: cfg.endpoint_url(),
api_key: std::env::var(&cfg.openai_api_key_env).ok().filter(|k| !k.is_empty()),
data_dir: paths.0.data_dir.clone(),
limits: cfg.sandbox_limits(),
};
@ -118,6 +121,62 @@ fn batch_results(paths: State<'_, AppPaths>, batch_id: i64) -> Result<Vec<RunRec
store.runs_for_batch(batch_id)
}
/// Schritte eines einzelnen Laufs für die Detailansicht.
#[tauri::command]
fn run_steps(
paths: State<'_, AppPaths>,
batch_id: i64,
model: String,
task_id: String,
repeat_idx: u32,
) -> Result<Vec<store::StepRow>, String> {
let store = Store::open(&paths.0.data_dir.join(DB_FILE))?;
store.steps_for_run(batch_id, &model, &task_id, repeat_idx)
}
/// Zustand der Container-Laufzeit (Podman) für das Setup.
#[derive(serde::Serialize)]
pub struct RuntimeStatus {
pub program: String,
pub available: bool,
pub detail: String,
}
#[tauri::command]
fn runtime_status(cfg: State<'_, Config>) -> RuntimeStatus {
let program = cfg.container_runtime.clone();
match std::process::Command::new(&program).args(["version", "--format", "{{.Client.Version}}"]).output() {
Ok(out) if out.status.success() => RuntimeStatus {
program,
available: true,
detail: format!("Version {}", String::from_utf8_lossy(&out.stdout).trim()),
},
Ok(out) => RuntimeStatus {
program,
available: false,
detail: String::from_utf8_lossy(&out.stderr).trim().to_string(),
},
Err(e) => RuntimeStatus {
program,
available: false,
detail: format!("nicht startbar: {e}"),
},
}
}
/// Rangliste und Matrix eines Batches. Gewichte kommen aus den Aufgaben.
#[tauri::command]
fn batch_ranking(paths: State<'_, AppPaths>, batch_id: i64) -> Result<ranking::Ranking, String> {
let store = Store::open(&paths.0.data_dir.join(DB_FILE))?;
let runs = store.runs_for_batch(batch_id)?;
let weights: std::collections::BTreeMap<String, f64> = tasks::load_all(&paths.0.tasks_dir)
.tasks
.into_iter()
.map(|t| (t.meta.id, t.meta.weight))
.collect();
Ok(ranking::compute(batch_id, &runs, &weights))
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
@ -147,7 +206,10 @@ pub fn run() {
load_tasks,
start_batch,
cancel_batch,
batch_results
batch_results,
batch_ranking,
run_steps,
runtime_status
])
.run(tauri::generate_context!())
.expect("error while running tauri application");

225
src-tauri/src/ranking.rs Normal file
View File

@ -0,0 +1,225 @@
//! Rangliste und Matrix aus den Läufen eines Batches (F-09, SPEC Abschnitt 9).
//!
//! Gesamtscore je Modell: gewichteter Mittelwert der Aufgaben-Scores (`weight` aus
//! `task.toml`). Erfolgsquote je (Modell, Aufgabe): Anteil der Läufe mit Klasse `ok`.
//! Tie-Breaker: Median der Dauer, dann mittlere Completion-Tokens. Wilson-Intervalle
//! und Kategorie-Ranking folgen mit F-12 (Phase 2).
use crate::agent::ErrorClass;
use crate::store::RunRecord;
use serde::Serialize;
use std::collections::BTreeMap;
#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct ModelRank {
pub rank: usize,
pub model: String,
/// Gewichteter Mittelwert der Aufgaben-Scores, 0.0 bis 1.0.
pub total_score: f64,
pub runs: usize,
pub successes: usize,
pub median_duration_ms: u128,
pub mean_completion_tokens: f64,
}
#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct MatrixCell {
pub model: String,
pub task_id: String,
pub runs: usize,
pub successes: usize,
/// Mittlerer Score über die Wiederholungen.
pub mean_score: f64,
}
#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct Ranking {
pub batch_id: i64,
pub models: Vec<ModelRank>,
pub cells: Vec<MatrixCell>,
pub tasks: Vec<String>,
}
/// Berechnet Rangliste und Matrix. `weights` ordnet jeder Aufgaben-ID ihr Gewicht zu;
/// fehlt eine ID, zählt das Gewicht 1.0.
pub fn compute(batch_id: i64, runs: &[RunRecord], weights: &BTreeMap<String, f64>) -> Ranking {
let weight_of = |task: &str| weights.get(task).copied().unwrap_or(1.0);
// Pro Modell: Liste der Läufe.
let mut by_model: BTreeMap<&str, Vec<&RunRecord>> = BTreeMap::new();
for r in runs {
by_model.entry(r.model.as_str()).or_default().push(r);
}
let mut models: Vec<ModelRank> = by_model
.iter()
.map(|(model, rs)| {
// Mittelwert je Aufgabe, dann gewichtet über die Aufgaben.
let mut per_task: BTreeMap<&str, (f64, usize)> = BTreeMap::new();
for r in rs {
let e = per_task.entry(r.task_id.as_str()).or_insert((0.0, 0));
e.0 += r.score;
e.1 += 1;
}
let (mut wsum, mut wtotal) = (0.0, 0.0);
for (task, (sum, n)) in &per_task {
let w = weight_of(task);
wsum += w * (sum / *n as f64);
wtotal += w;
}
let total_score = if wtotal > 0.0 { wsum / wtotal } else { 0.0 };
let mut durations: Vec<u128> = rs.iter().map(|r| r.duration_ms).collect();
durations.sort_unstable();
let median = median_u128(&durations);
let mean_tokens = rs.iter().map(|r| r.completion_tokens as f64).sum::<f64>() / rs.len() as f64;
let successes = rs.iter().filter(|r| r.error_class == ErrorClass::Ok).count();
ModelRank {
rank: 0,
model: model.to_string(),
total_score,
runs: rs.len(),
successes,
median_duration_ms: median,
mean_completion_tokens: mean_tokens,
}
})
.collect();
// Absteigend nach Score, dann Median-Dauer, dann mittlere Completion-Tokens.
models.sort_by(|a, b| {
b.total_score
.partial_cmp(&a.total_score)
.unwrap_or(std::cmp::Ordering::Equal)
.then(a.median_duration_ms.cmp(&b.median_duration_ms))
.then(
a.mean_completion_tokens
.partial_cmp(&b.mean_completion_tokens)
.unwrap_or(std::cmp::Ordering::Equal),
)
});
for (i, m) in models.iter_mut().enumerate() {
m.rank = i + 1;
}
// Matrix Modell × Aufgabe.
let mut cell_map: BTreeMap<(&str, &str), Vec<&RunRecord>> = BTreeMap::new();
let mut task_set: BTreeMap<&str, ()> = BTreeMap::new();
for r in runs {
cell_map
.entry((r.model.as_str(), r.task_id.as_str()))
.or_default()
.push(r);
task_set.insert(r.task_id.as_str(), ());
}
let cells = cell_map
.iter()
.map(|((model, task), rs)| MatrixCell {
model: model.to_string(),
task_id: task.to_string(),
runs: rs.len(),
successes: rs.iter().filter(|r| r.error_class == ErrorClass::Ok).count(),
mean_score: rs.iter().map(|r| r.score).sum::<f64>() / rs.len() as f64,
})
.collect();
Ranking {
batch_id,
models,
cells,
tasks: task_set.keys().map(|t| t.to_string()).collect(),
}
}
fn median_u128(sorted: &[u128]) -> u128 {
match sorted.len() {
0 => 0,
n if n % 2 == 1 => sorted[n / 2],
n => (sorted[n / 2 - 1] + sorted[n / 2]) / 2,
}
}
#[cfg(test)]
mod tests {
use super::*;
fn run(model: &str, task: &str, score: f64, class: ErrorClass, dur: u128, tokens: u32) -> RunRecord {
RunRecord {
batch_id: 1,
model: model.into(),
task_id: task.into(),
repeat_idx: 1,
error_class: class,
score,
steps: 3,
prompt_tokens: 0,
completion_tokens: tokens,
duration_ms: dur,
tps: None,
ttft_tool_ms: None,
artifact_path: None,
summary: None,
check_output: String::new(),
}
}
#[test]
fn gewichteter_score_und_rang() {
let runs = vec![
run("A", "t1", 1.0, ErrorClass::Ok, 1000, 10),
run("A", "t2", 0.0, ErrorClass::CheckFailed, 1000, 10),
run("B", "t1", 1.0, ErrorClass::Ok, 1000, 10),
run("B", "t2", 1.0, ErrorClass::Ok, 1000, 10),
];
let mut w = BTreeMap::new();
w.insert("t1".to_string(), 1.0);
w.insert("t2".to_string(), 3.0);
let r = compute(1, &runs, &w);
assert_eq!(r.models[0].model, "B");
assert_eq!(r.models[0].rank, 1);
assert!((r.models[0].total_score - 1.0).abs() < 1e-9);
// A: (1*1 + 3*0) / 4 = 0.25
assert!((r.models[1].total_score - 0.25).abs() < 1e-9);
}
#[test]
fn gleichstand_nach_median_dauer() {
let runs = vec![
run("slow", "t1", 1.0, ErrorClass::Ok, 9000, 10),
run("fast", "t1", 1.0, ErrorClass::Ok, 2000, 10),
];
let r = compute(1, &runs, &BTreeMap::new());
assert_eq!(r.models[0].model, "fast");
}
#[test]
fn matrix_zaehlt_erfolge_und_mittelwert() {
let runs = vec![
run("A", "t1", 1.0, ErrorClass::Ok, 1, 1),
run("A", "t1", 0.5, ErrorClass::CheckFailed, 1, 1),
run("A", "t1", 0.0, ErrorClass::MaxSteps, 1, 1),
];
let r = compute(1, &runs, &BTreeMap::new());
assert_eq!(r.cells.len(), 1);
assert_eq!(r.cells[0].runs, 3);
assert_eq!(r.cells[0].successes, 1);
assert!((r.cells[0].mean_score - 0.5).abs() < 1e-9);
assert_eq!(r.tasks, vec!["t1".to_string()]);
}
#[test]
fn median_gerade_und_ungerade() {
assert_eq!(median_u128(&[1, 2, 3]), 2);
assert_eq!(median_u128(&[1, 2, 3, 4]), 2);
assert_eq!(median_u128(&[]), 0);
}
#[test]
fn leerer_batch_ergibt_leere_rangliste() {
let r = compute(7, &[], &BTreeMap::new());
assert!(r.models.is_empty() && r.cells.is_empty() && r.tasks.is_empty());
assert_eq!(r.batch_id, 7);
}
}

View File

@ -7,7 +7,7 @@
use crate::agent::{
run_agent_cancellable, AgentLimits, ErrorClass, Message, ModelClient, ModelError,
OllamaClient, SandboxWorkspace,
OllamaClient, OpenAiClient, SandboxWorkspace,
};
use crate::sandbox::{container_name, remove_by_name, Limits, Sandbox};
use crate::store::{RunRecord, Store};
@ -33,7 +33,11 @@ pub struct Job {
#[derive(Debug, Clone)]
pub struct RunConfig {
pub runtime: String,
/// `ollama` oder `openai`.
pub backend: String,
pub endpoint_url: String,
/// Schlüssel für den OpenAI-Endpunkt, wird nicht gespeichert.
pub api_key: Option<String>,
pub data_dir: PathBuf,
pub limits: Limits,
}
@ -119,6 +123,7 @@ pub fn run_batch(
) -> Result<BatchSummary, String> {
let config_json = json!({
"runtime": cfg.runtime,
"backend": cfg.backend,
"endpoint": cfg.endpoint_url,
"limits": { "memory": cfg.limits.memory, "cpus": cfg.limits.cpus },
"system_prompt": crate::agent::SYSTEM_PROMPT,
@ -150,7 +155,7 @@ pub fn run_batch(
}
'models: for model in &models {
let client = OllamaClient::new(&cfg.endpoint_url, model)?;
let client = make_client(cfg, model)?;
let warm = client.chat(
&[Message::new("user", "ping")],
&json!([]),
@ -211,7 +216,7 @@ pub fn run_batch(
},
transcript: vec![],
},
None => match execute_job(cfg, batch_id, i, job, &client, cancel)? {
None => match execute_job(cfg, batch_id, i, job, &*client, cancel)? {
JobResult::Cancelled => {
summary.cancelled = true;
break 'models;
@ -250,12 +255,21 @@ enum JobResult {
Cancelled,
}
/// Baut den Modell-Client für das gewählte Backend.
pub fn make_client(cfg: &RunConfig, model: &str) -> Result<Box<dyn ModelClient>, String> {
match cfg.backend.as_str() {
"ollama" => Ok(Box::new(OllamaClient::new(&cfg.endpoint_url, model)?)),
"openai" => Ok(Box::new(OpenAiClient::new(&cfg.endpoint_url, model, cfg.api_key.clone())?)),
other => Err(format!("Unbekanntes Backend: {other} (erlaubt: ollama, openai)")),
}
}
fn execute_job(
cfg: &RunConfig,
batch_id: i64,
seq: usize,
job: &Job,
client: &OllamaClient,
client: &dyn ModelClient,
cancel: &AtomicBool,
) -> Result<JobResult, String> {
let meta = &job.task.meta;
@ -442,7 +456,9 @@ mod tests {
let jobs = plan(&[model.clone()], &tasks, 2);
let cfg = RunConfig {
runtime: "podman".into(),
backend: "ollama".into(),
endpoint_url: url,
api_key: None,
data_dir: base.join("data"),
limits: Limits::default(),
};
@ -474,7 +490,14 @@ mod tests {
#[test]
#[ignore]
fn repo_aufgaben_mit_modell() {
let url = std::env::var("CB_OLLAMA_URL").expect("CB_OLLAMA_URL setzen");
// Backend wählbar: CB_BACKEND=openai mit CB_OPENAI_URL (Standard: ollama mit CB_OLLAMA_URL).
let backend = std::env::var("CB_BACKEND").unwrap_or_else(|_| "ollama".into());
let url = if backend == "openai" {
std::env::var("CB_OPENAI_URL").expect("CB_OPENAI_URL setzen")
} else {
std::env::var("CB_OLLAMA_URL").expect("CB_OLLAMA_URL setzen")
};
let api_key = std::env::var("STRATA_API_KEY").ok().filter(|k| !k.is_empty());
let model = std::env::var("CB_OLLAMA_MODEL").expect("CB_OLLAMA_MODEL setzen");
let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("..").join("tasks");
let tasks = crate::tasks::load_all(&dir).tasks;
@ -484,7 +507,9 @@ mod tests {
let jobs = plan(&[model.clone()], &tasks, 1);
let cfg = RunConfig {
runtime: "podman".into(),
backend,
endpoint_url: url,
api_key,
data_dir: data.clone(),
limits: Limits::default(),
};

View File

@ -50,6 +50,17 @@ CREATE TABLE IF NOT EXISTS step (
";
/// Ein abgeschlossener Lauf, so wie er gespeichert wird.
/// Ein Schritt eines Laufs, für die Anzeige.
#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct StepRow {
pub idx: i64,
pub role: String,
pub content: String,
pub tool_name: Option<String>,
pub tool_args_json: Option<String>,
pub tool_result: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct RunRecord {
pub batch_id: i64,
@ -217,6 +228,38 @@ impl Store {
rows.collect::<Result<Vec<_>, _>>().map_err(|e| e.to_string())
}
/// Schritte eines Laufs, identifiziert über Batch, Modell, Aufgabe und Wiederholung.
pub fn steps_for_run(
&self,
batch_id: i64,
model: &str,
task_id: &str,
repeat_idx: u32,
) -> Result<Vec<StepRow>, String> {
let mut stmt = self
.conn
.prepare(
"SELECT s.idx, s.role, s.content, s.tool_name, s.tool_args_json, s.tool_result
FROM step s JOIN run r ON s.run_id = r.id
WHERE r.batch_id = ?1 AND r.model = ?2 AND r.task_id = ?3 AND r.repeat_idx = ?4
ORDER BY s.idx",
)
.map_err(|e| e.to_string())?;
let rows = stmt
.query_map(params![batch_id, model, task_id, repeat_idx], |r| {
Ok(StepRow {
idx: r.get(0)?,
role: r.get(1)?,
content: r.get(2)?,
tool_name: r.get(3)?,
tool_args_json: r.get(4)?,
tool_result: r.get(5)?,
})
})
.map_err(|e| e.to_string())?;
rows.collect::<Result<Vec<_>, _>>().map_err(|e| e.to_string())
}
pub fn run_count(&self, batch_id: i64) -> Result<i64, String> {
self.conn
.query_row("SELECT COUNT(*) FROM run WHERE batch_id = ?1", params![batch_id], |r| r.get(0))
@ -301,6 +344,19 @@ mod tests {
assert!(s.runs_for_batch(99).unwrap().is_empty());
}
#[test]
fn schritte_eines_laufs_werden_gefunden() {
let mut s = Store::open_in_memory().unwrap();
let b = s.create_batch("", 1, "{}").unwrap();
let transcript = vec![Message::new("user", "Aufgabe"), Message::new("assistant", "ok")];
s.insert_run(&rec(b, "m1", "a-01", 1), &transcript).unwrap();
let steps = s.steps_for_run(b, "m1", "a-01", 1).unwrap();
assert_eq!(steps.len(), 2);
assert_eq!(steps[0].role, "user");
assert_eq!(steps[1].content, "ok");
assert!(s.steps_for_run(b, "m1", "a-01", 2).unwrap().is_empty());
}
#[test]
fn unbekannter_batch_existiert_nicht() {
let s = Store::open_in_memory().unwrap();

View File

@ -24,6 +24,14 @@
"bundle": {
"active": true,
"targets": "all",
"linux": {
"deb": {
"depends": ["podman"],
"files": {
"/usr/share/coding-bench/tasks": "../tasks"
}
}
},
"icon": [
"icons/32x32.png",
"icons/128x128.png",

View File

@ -44,6 +44,29 @@
let progress = $state<{ done: number; total: number } | null>(null);
let batchId = $state<number | null>(null);
let rows = $state<RunRow[]>([]);
type ModelRank = {
rank: number;
model: string;
total_score: number;
runs: number;
successes: number;
median_duration_ms: number;
mean_completion_tokens: number;
};
type MatrixCell = { model: string; task_id: string; runs: number; successes: number; mean_score: number };
type Ranking = { batch_id: number; models: ModelRank[]; cells: MatrixCell[]; tasks: string[] };
let ranking = $state<Ranking | null>(null);
type RuntimeStatus = { program: string; available: boolean; detail: string };
type StepRow = {
idx: number;
role: string;
content: string;
tool_name: string | null;
tool_args_json: string | null;
tool_result: string | null;
};
let runtime = $state<RuntimeStatus | null>(null);
let detail = $state<{ model: string; task_id: string; repeat_idx: number; steps: StepRow[] } | null>(null);
let batchError = $state("");
let unlisten: UnlistenFn | null = null;
@ -54,6 +77,11 @@
} catch (e) {
error = String(e);
}
try {
runtime = await invoke<RuntimeStatus>("runtime_status");
} catch (e) {
runtime = { program: "?", available: false, detail: String(e) };
}
try {
report = await invoke<LoadReport>("load_tasks");
} catch (e) {
@ -98,6 +126,7 @@
async function start() {
batchError = "";
rows = [];
ranking = null;
log = [];
progress = null;
batchId = null;
@ -111,6 +140,7 @@
});
batchId = summary.batch_id;
rows = await invoke<RunRow[]>("batch_results", { batchId: summary.batch_id });
ranking = await invoke<Ranking>("batch_ranking", { batchId: summary.batch_id });
if (summary.cancelled) log = [...log, "Batch abgebrochen."];
} catch (e) {
batchError = String(e);
@ -119,6 +149,17 @@
}
}
async function showSteps(r: RunRow) {
if (batchId === null) return;
const steps = await invoke<StepRow[]>("run_steps", {
batchId,
model: r.model,
taskId: r.task_id,
repeatIdx: r.repeat_idx,
});
detail = { model: r.model, task_id: r.task_id, repeat_idx: r.repeat_idx, steps };
}
async function cancel() {
await invoke<boolean>("cancel_batch");
}
@ -139,6 +180,18 @@
<dd><code>{paths.data_dir}</code></dd>
<dt>Aufgabenordner</dt>
<dd><code>{paths.tasks_dir}</code></dd>
<dt>Container</dt>
<dd>
{#if runtime}
{#if runtime.available}
<span class="ok">{runtime.program} verfügbar, {runtime.detail}</span>
{:else}
<span class="fehler">{runtime.program} nicht nutzbar: {runtime.detail}</span>
{/if}
{:else}
Prüfe …
{/if}
</dd>
</dl>
{:else}
<p>Lade Pfade …</p>
@ -211,6 +264,65 @@
{/if}
</section>
{#if ranking && ranking.models.length > 0}
<section>
<h2>Rangliste, Batch {ranking.batch_id}</h2>
<table>
<thead>
<tr>
<th>Rang</th>
<th>Modell</th>
<th>Score</th>
<th>Erfolge</th>
<th>Median-Dauer</th>
<th>Ø Completion-Tokens</th>
</tr>
</thead>
<tbody>
{#each ranking.models as m (m.model)}
<tr>
<td>{m.rank}</td>
<td>{m.model}</td>
<td>{m.total_score.toFixed(2)}</td>
<td>{m.successes} / {m.runs}</td>
<td>{(m.median_duration_ms / 1000).toFixed(1)} s</td>
<td>{m.mean_completion_tokens.toFixed(0)}</td>
</tr>
{/each}
</tbody>
</table>
<h3>Matrix: Erfolge je Aufgabe</h3>
<table class="matrix">
<thead>
<tr>
<th>Modell</th>
{#each ranking.tasks as t (t)}
<th>{t}</th>
{/each}
</tr>
</thead>
<tbody>
{#each ranking.models as m (m.model)}
<tr>
<td>{m.model}</td>
{#each ranking.tasks as t (t)}
{@const cell = ranking.cells.find((c) => c.model === m.model && c.task_id === t)}
<td
class="zelle"
style={cell ? `background: color-mix(in srgb, #2e7d32 ${Math.round(cell.mean_score * 100)}%, transparent)` : ""}
title={cell ? `Score ${cell.mean_score.toFixed(2)}` : "keine Läufe"}
>
{cell ? `${cell.successes}/${cell.runs}` : "–"}
</td>
{/each}
</tr>
{/each}
</tbody>
</table>
</section>
{/if}
{#if batchId !== null && rows.length > 0}
<section>
<h2>Ergebnisse, Batch {batchId}</h2>
@ -224,6 +336,7 @@
<th>Score</th>
<th>Schritte</th>
<th>Dauer</th>
<th></th>
</tr>
</thead>
<tbody>
@ -236,10 +349,31 @@
<td>{r.score.toFixed(2)}</td>
<td>{r.steps}</td>
<td>{(r.duration_ms / 1000).toFixed(1)} s</td>
<td><button onclick={() => showSteps(r)}>Schritte</button></td>
</tr>
{/each}
</tbody>
</table>
{#if detail}
<h3>Schritte: {detail.model} · {detail.task_id} · Wdh. {detail.repeat_idx}</h3>
<ol class="schritte">
{#each detail.steps as st (st.idx)}
<li>
<strong>{st.role}</strong>
{#if st.tool_name}
· Tool <code>{st.tool_name}</code> <code>{st.tool_args_json ?? ""}</code>
{/if}
{#if st.content}
<pre>{st.content}</pre>
{/if}
{#if st.tool_result}
<pre class="ergebnis">{st.tool_result}</pre>
{/if}
</li>
{/each}
</ol>
{/if}
</section>
{/if}
</main>
@ -326,4 +460,24 @@
.fehler {
color: #c62828;
}
.ok {
color: #2e7d32;
}
.schritte pre {
white-space: pre-wrap;
overflow-wrap: anywhere;
max-height: 12rem;
overflow-y: auto;
background: #8881;
padding: 0.4rem;
margin: 0.3rem 0;
font-size: 0.85rem;
}
.matrix .zelle {
text-align: center;
font-variant-numeric: tabular-nums;
}
</style>

View File

@ -0,0 +1,19 @@
---
test: a-01 bis b-06
zeit: 2026-11-06T21:00
commit: dce98d3
art: auto-lauf
ergebnis: ✓
---
Lauf aller sechs Aufgaben über den OpenAI-kompatiblen Endpunkt von strata (`http://192.168.12.4:8082/v1/chat/completions`, ohne Schlüssel, Modell `qwen3.8-flash-next-q2_0`), eine Wiederholung, Sandbox `cb-python:latest`.
- a-01: ✓ score 1.00, 5 Schritte, 12 s
- a-02: ✓ score 1.00, 5 Schritte, 13 s
- a-03: ✓ score 1.00, 5 Schritte, 11 s
- b-04: ✓ score 1.00, 4 Schritte, 21 s
- b-05: ✓ score 1.00, 5 Schritte, 15 s
- b-06: ✓ score 1.00, 4 Schritte, 31 s
Vergleich: Mit dem kleinen Modell `qwen3:0.6b` auf srv04 (Ollama) hatte keine Aufgabe bestanden. Das Ergebnis hängt also stark am Modell.
Nicht geprüft: Klicktests im Fenster (manuell offen), Wiederholungen (nur einmal gelaufen), Abbruch während des Laufs.