MCPcopy Create free account
hub / github.com/RunanywhereAI/RCLI / RCLIEngine

Class RCLIEngine

src/api/rcli_api.cpp:49–128  ·  view source on GitHub ↗

Internal engine state behind the opaque handle

Source from the content-addressed store, hash-verified

47
48// Internal engine state behind the opaque handle
49struct RCLIEngine {
50 Orchestrator pipeline;
51 std::string models_dir;
52
53 rcli::ActionRegistry actions;
54
55 // Config overrides from rcli_create() config_json
56 std::string config_system_prompt;
57 std::string config_engine_override; // "metalrt", "llamacpp", or "" (use preference file)
58 int config_gpu_layers = -1;
59 int config_ctx_size = -1;
60
61 // Personality
62 std::string personality_key = "default";
63
64 // Which offline STT backend is active
65 bool using_parakeet = false;
66 std::string llm_model_name = "Qwen3 0.6B";
67 std::string tts_model_name = "Piper Lessac";
68 std::string stt_model_name = "Whisper base.en";
69
70 // RAG subsystem
71 std::unique_ptr<EmbeddingEngine> rag_embedding;
72 std::unique_ptr<HybridRetriever> rag_retriever;
73 std::string rag_index_path;
74 bool rag_ready = false;
75 std::string last_rag_result;
76
77 // TTS playback PID (for interruption via afplay)
78 std::atomic<pid_t> tts_pid{0};
79
80 // Streaming TTS cancellation flag
81 std::atomic<bool> streaming_cancelled{false};
82
83 // Response buffers (owned by engine, returned to callers)
84 std::string last_transcript;
85 std::string last_response;
86 std::string last_action_result;
87 std::string last_action_list;
88 std::string last_info;
89
90 // Callbacks
91 RCLITranscriptCallback transcript_cb = nullptr;
92 void* transcript_ud = nullptr;
93 RCLIStateCallback state_cb = nullptr;
94 void* state_ud = nullptr;
95 RCLIActionCallback action_cb = nullptr;
96 void* action_ud = nullptr;
97 // Tool trace callback — separate from action_cb because action_cb only fires
98 // for ActionRegistry actions, while trace covers both actions and built-in tools
99 // (get_current_time, calculate), giving a complete picture of tool dispatch.
100 RCLIToolTraceCallback tool_trace_cb = nullptr;
101 void* tool_trace_ud = nullptr;
102
103 std::atomic<float> audio_rms{0.0f};
104
105 // Conversation memory (session-scoped, for multi-turn chat)
106 std::vector<std::pair<std::string, std::string>> conversation_history;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected