Files
ECC/scripts/lib/hooks/recovery-hints.js
T
huangpz6andTRAE cdb8a93819 fix(hooks): share one recovery-hint parser and cover default denials (#3864)
Move ECC_SHOW_RECOVERY_HINTS parsing into scripts/lib/hooks/recovery-hints.js so every hook trims and accepts the same truthy values. Add default-off and opt-in assertions for the condensed GateGuard denial, config-protection (protected and truncated payloads) and the fail-closed truncation wrapper.

Co-Authored-By: TRAE <noreply@trae.ai>
2026-11-04 21:36:43 +08:00

13 lines
515 B
JavaScript

'use strict';
// Denial text is tool output the guarded agent reads. Naming the env vars that
// disable a hook hands it a bypass, so recovery instructions are opt-in for
// human operators (#3844). Every hook must parse the switch the same way.
const ENABLE_VALUES = new Set(['1', 'true', 'on', 'enabled', 'enable', 'yes']);
function showRecoveryHints(value = process.env.ECC_SHOW_RECOVERY_HINTS) {
return ENABLE_VALUES.has(String(value || '').trim().toLowerCase());
}
module.exports = { showRecoveryHints };