Files
baketnk--frame-yap/src/worker.hpp
T
baketnkandClaude Opus 5.5 045cd4f45f Add opt-in delivery-debug.log for paced text delivery
Advanced debugging now also records paced-delivery metadata (byte
offsets, lease/send errors, finish results and the exact focus-guard
check that failed) to an owner-private delivery-debug.log. No transcript
text is logged. Diagnoses later chunks being dropped after the first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 22:41:44 -04:00

44 lines
1.2 KiB
C++

#pragma once
#include <cstdint>
#include <chrono>
#include <memory>
#include <optional>
#include <string>
#include <vector>
namespace frameyap {
struct WorkerReply {
uint64_t id;
std::string text;
std::string error;
};
// Opens (rotating `previous`) an owner-private 0600 file in the FrameYap state
// directory, or throws. Used only for opt-in advanced debugging.
int open_private_debug_log(const char* name, const char* previous);
class Worker {
public:
explicit Worker(std::chrono::milliseconds warmup_timeout = std::chrono::seconds(120),
std::chrono::milliseconds request_timeout = std::chrono::seconds(60));
~Worker();
Worker(const Worker&) = delete;
Worker& operator=(const Worker&) = delete;
void start(const std::string& python, const std::string& script,
const std::string& model, int threads = 2, bool advanced_debug = false,
const std::string& backend = {}, const std::string& manifest_dir = {},
const std::string& root = {});
bool ready() const;
void submit(uint64_t id, const std::vector<float>& pcm);
std::optional<WorkerReply> poll();
void stop();
private:
struct State;
std::unique_ptr<State> state_;
};
} // namespace frameyap