include/entropic/core/delegate_hook_payload.h¶
include/entropic/core/delegate_hook_payload.h
entropic::detail
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
target— Target tier name (e.g. "researcher").success— Whether delegation succeeded.summary— Delegation 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.
- Throws
nlohmann::json::type_error— (316) if summary contains invalid UTF-8 and no sanitization is applied. The v2.9.9 fix eliminates this.