Entropic 2.11.1
Local-first agentic inference engine
Loading...
Searching...
No Matches
delegate_hook_payload.h File Reference

Testable free function extracted from fire_delegate_complete_hook. More...

#include <string>
Include dependency graph for delegate_hook_payload.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  entropic
 Activate model on GPU (WARM → ACTIVE).
 

Functions

std::string entropic::detail::build_delegate_complete_json (const std::string &target, bool success, const std::string &summary)
 Build and dump the ON_DELEGATE_COMPLETE hook JSON payload.
 

Detailed Description

Testable free function extracted from fire_delegate_complete_hook.

fire_delegate_complete_hook builds a JSON payload and calls j.dump() before dispatching to hooks_.fire_post. The dump is the only site that can throw nlohmann::json::type_error.316 — if summary contains invalid UTF-8 the exception propagates out of the private method and up through run_loop, which is the gh#113 crash mode.

Extracting the build+dump step here lets unit tests drive it directly with a bad-UTF8 summary (simulating storage-loaded context, gh#112 interaction) and confirm RED on unfixed code, GREEN on the v2.9.9 sink-guard fix.

@dg_internal Not part of the public API.

Version
2.9.9

Definition in file delegate_hook_payload.h.

Function Documentation

◆ build_delegate_complete_json()

std::string entropic::detail::build_delegate_complete_json ( const std::string &  target,
bool  success,
const std::string &  summary 
)

Build and dump the ON_DELEGATE_COMPLETE hook JSON payload.

Mirrors the JSON structure produced by fire_delegate_complete_hook: {"target_tier":"<target>","success":<bool>,"result_kind":"ok"|"delegation_failed","summary":"<summary>"}

Parameters
targetTarget tier name (e.g. "researcher").
successWhether delegation succeeded.
summaryDelegation summary string — MAY contain invalid UTF-8 when sourced from storage-loaded context (gh#112 interaction). The caller is responsible for sanitizing before passing here, OR this function sanitizes internally (v2.9.9 fix).
Returns
Compact JSON string.
Exceptions
nlohmann::json::type_error(316) if summary contains invalid UTF-8 and no sanitization is applied. The v2.9.9 fix eliminates this.
Version
2.9.9