mirror of
https://github.com/baketnk/frame-yap.git
synced 2026-10-06 01:00:04 +02:00
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>
44 lines
1.2 KiB
C++
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
|