Cap injected context so a single hook can't blow the model's context window.
(text: string)
| 344 | |
| 345 | /** Cap injected context so a single hook can't blow the model's context window. */ |
| 346 | function capContext(text: string): string { |
| 347 | if (text.length <= MAX_CONTEXT_CHARS) return text |
| 348 | return text.slice(0, MAX_CONTEXT_CHARS) + "\n[…truncated by OrbCode hook context cap…]" |
| 349 | } |
| 350 | |
| 351 | /** Keys always stripped from the hook environment (OrbCode credentials/config). */ |
| 352 | const HOOK_ENV_REDACT_EXACT = new Set([ |