48 if (!handle || !count) {
72 if (!handle || !path || !result_json) {
77 std::ifstream file(path);
78 if (!file.is_open()) {
throw std::runtime_error(
"cannot open"); }
79 nlohmann::json arr = nlohmann::json::array();
81 while (std::getline(file, line)) {
82 if (line.empty()) {
continue; }
89 arr.push_back(nlohmann::json::parse(
90 entropic::mcp::sanitize_utf8(line)));
92 *result_json = strdup(arr.dump().c_str());
94 }
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.