fdd45323bf
Every new vendor token format has required a core PR appending to _PREFIX_PATTERNS in agent/redact.py (fw_, retaindb_, hsk-, mem0_, brv_ all landed that way; #58466/#58501 are the latest of the class). This adds an additive-only registry so provider plugins own their format: - agent/redact.py: register_redaction_patterns(patterns, source) — validates each pattern (must compile; must start with >=2 literal characters so the pre-screen substring gate keeps working and redact-everything patterns like `.*` are structurally impossible), dedupes against built-ins and prior registrations, then atomically rebuilds _PREFIX_RE and _PREFIX_SUBSTRINGS. Registered patterns get identical treatment to built-ins everywhere: same head/tail masking, same non-reusable «redacted:label…» sentinel on file_read, same security.redact_secrets operator opt-out. Additive-only by design — a plugin can extend masking, never weaken it. Includes a test/teardown reset helper. - hermes_cli/plugins.py: PluginContext.register_redaction_patterns() delegating with per-plugin attribution; warns and returns 0 on any failure so a broken plugin can never break startup. - Bundled reference plugin `nvapi-redaction` (opt-in): masks NVIDIA API keys (nvapi-, used by NIM / build.nvidia.com) — a real format missing from core, shipped as the one-liner plugin that previously would have been a one-line core PR. 13 new tests: baseline gap, masking + built-ins unaffected, invalid regex / no-literal-prefix / dedupe / non-string rejection, file_read sentinel labeling, reset semantics, PluginContext wiring incl. exception isolation, and a no-mocks end-to-end through the demo plugin. Existing redaction suites (tests/agent/test_redact.py, tests/tools/test_kanban_redaction.py) pass untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWMcB7RPSYUpsXDfBgwjzM