Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
prompt_log_util.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
29#pragma once
30
31#include <cstdlib>
32#include <string>
33#include <unordered_set>
34
35namespace entropic {
36
47public:
58 bool note(size_t content_hash) {
59 return seen_.insert(content_hash).second;
60 }
61
71 void reset() { seen_.clear(); }
72
79 size_t shown() const { return seen_.size(); }
80
81private:
82 std::unordered_set<size_t> seen_;
83};
84
96inline bool prompt_log_unabridged() {
97 const char* v = std::getenv("ENTROPIC_LOG_FULL_PROMPT");
98 return v != nullptr && v[0] == '1';
99}
100
116inline std::string prompt_log_reference(size_t index,
117 const std::string& role,
118 size_t size_chars,
119 size_t content_hash) {
120 char buf[160];
121 int n = std::snprintf(
122 buf, sizeof(buf),
123 "[%zu] role=%s [shown above, %zu chars, hash=%016zx]",
124 index, role.c_str(), size_chars, content_hash);
125 return std::string(buf, n > 0 ? static_cast<size_t>(n) : 0U);
126}
127
128} // namespace entropic
Remembers which message bodies a session's log has already shown.
size_t shown() const
How many distinct bodies have been shown.
bool note(size_t content_hash)
Record a message body and say whether to log it in full.
void reset()
Forget everything, so the next turn logs in full again.
Activate model on GPU (WARM → ACTIVE).
bool prompt_log_unabridged()
Whether the operator has demanded unabridged prompt logs.
@ optional
optional: every escape asks the host's path approver
std::string prompt_log_reference(size_t index, const std::string &role, size_t size_chars, size_t content_hash)
The one-line stand-in for a body already shown earlier in the log.