redactSecrets (agent/redact-secrets.ts)

agent-afk · src/agent/redact-secrets.ts · typescript · Apache-2.0
auth

Pure secret-redaction function covering bearer tokens, API keys, JWTs, AWS IDs, Slack/Telegram tokens, and generic high-entropy strings with path/git-sha guards.

// Source: https://github.com/griffinwork40/agent-afk | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Pure secret-redaction helper for text that is about to leave the local
 * process or be written to durable storage.
 *
 * Extracted from `background-summarizer.ts` (which redacts transcript tails
 * before shipping them to a third-party Haiku call) so that lightweight
 * externalization sinks can reuse the exact same patterns without importing
 * the summarizer's provider-call dependency graph. Current consumers:
 *   - `background-summarizer.ts` — transcript tail → Haiku (network egress)
 *   - `session-ledger.ts`        — tool-input summary → events.jsonl (at-rest)
 *   -

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key