Files
Robert KarlandClaude Fable 5.1 46c46ecfc1 Front end: image input through the model's vision encoder; engine child supervision; tests
Images: --mmproj PATH loads the Qwen3.8 Flash-Next projector through llama.cpp's mtmd
library and encodes image_url parts on the CPU (frontend/vision.hpp). The embeddings go to
the engine as a GENI request, its existing vision path, with the prompt's <|image_pad|>
runs standing in for each image. --vision-tokens caps the tokens per image. GET /v1/models
lists "image" under input_modalities when the encoder is loaded. Checked on an RTX 4090:
screenshots, photos, several images in one message, and pi's file attachments and
clipboard paste.

Engine process: the engine is started and watched from frontend/engine.hpp; when it exits
or its stall watchdog fires, the front end exits too, for a supervisor to restart. Stall
reports add the current stage and thread wait channels. Reasoning streams; content and
tool calls are sent once the whole message is parsed, so partial JSON never changes
arguments already sent.

Tests: make test-frontend (child exit, protocol, backpressure; no model needed) and
make test-chat-parser MODEL=<gguf> (template and tool-call parsing against the real GGUF).

The image path and the supervision were written by a Codex session; this commit finishes,
documents and checks them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-08 15:54:53 -07:00

23 lines
835 B
C++

#pragma once
#include <cerrno>
#include <cstring>
#include <string>
#include <sys/wait.h>
namespace strata_frontend {
// Called only by the supervisor, which is joined before Engine::quit().
// Reap dead children: kill(pid, 0) would report a zombie as still alive.
inline bool child_running(pid_t& pid, std::string& why) {
int status = 0;
const pid_t result = ::waitpid(pid, &status, WNOHANG);
if (result == 0 || (result < 0 && errno == EINTR)) return true;
if (result < 0) why = std::string("waitpid: ") + std::strerror(errno);
else if (WIFSIGNALED(status)) why = "engine killed by signal " + std::to_string(WTERMSIG(status));
else if (WIFEXITED(status)) why = "engine exited with code " + std::to_string(WEXITSTATUS(status));
else why = "engine exited unexpectedly";
pid = -1;
return false;
}
}