50 if (!handle || !count) {
77 if (!handle || !path || !result_json) {
82 std::ifstream file(path);
83 if (!file.is_open()) {
throw std::runtime_error(
"cannot open"); }
84 nlohmann::json arr = nlohmann::json::array();
86 while (std::getline(file, line)) {
87 if (line.empty()) {
continue; }
94 arr.push_back(nlohmann::json::parse(
95 entropic::mcp::sanitize_utf8(line)));
97 *result_json = strdup(arr.dump().c_str());
99 }
catch (
const std::exception& e) {
Private definition of the entropic_engine struct.
Public C API for the Entropic inference engine.
ENTROPIC_EXPORT entropic_error_t entropic_audit_flush(entropic_handle_t handle)
Flush the audit logger to disk.
ENTROPIC_EXPORT entropic_error_t entropic_audit_read(entropic_handle_t handle, const char *path, const char *, char **result_json)
Read audit log entries from a JSONL file.
ENTROPIC_EXPORT entropic_error_t entropic_audit_count(entropic_handle_t handle, size_t *count)
Get the number of audit log entries this session.
entropic_error_t
Error codes returned by all C API functions.
@ ENTROPIC_ERROR_INVALID_ARGUMENT
NULL pointer, empty string, out-of-range value.
@ ENTROPIC_ERROR_INVALID_HANDLE
NULL or destroyed handle (v1.8.9)
@ ENTROPIC_ERROR_IO
File/network I/O error.
JSON serialization helpers for the facade.
spdlog initialization and logger access.
ENTROPIC_EXPORT std::shared_ptr< spdlog::logger > get(const std::string &name)
Get or create a named logger.
Engine handle struct — owns all subsystems.
std::unique_ptr< entropic::AuditLogger > audit_logger
Audit log.
std::string last_error
Per-handle error message.
UTF-8 validation + replacement at every system boundary where bytes change ownership.