Implements the AWS Comprehend PII redaction utility requested in #290 for the JavaScript SDK.

/claim #290

What changed

  • Added AwsComprehendRedactor under the AI package.
  • Uses Amazon Comprehend DetectPiiEntities to detect PII spans.
  • Redacts prompts using stable AWS offsets, including Unicode-safe code point offset conversion for JavaScript strings.
  • Supports filtering by entity type and confidence score.
  • Adds helpers for prompt strings and chat message arrays.
  • Exports the redactor from @arakoodev/edgechains.js/ai.
  • Adds mocked unit tests for offset redaction, filtering, chat message handling and emoji/code-point offsets.
  • Adds a working example under examples/aws-comprehend-redaction.

Verification

npx jest src/ai/src/tests/awsComprehendRedactor.test.ts --runInBand
npx tsc -p tsconfig.json --noEmit
npx tsc -b

Results locally:

  • awsComprehendRedactor.test.ts: 6 tests passed.
  • tsc --noEmit: passed.
  • tsc -b: passed.
  • GitHub Actions js: passed.
  • GitHub Actions CLAAssistant: passed.
  • npm run build: not run successfully on Windows because the existing script uses Unix rm -rf.

Note

The real AWS call requires AWS credentials and region configured in the environment. Tests mock the Comprehend client so CI does not need AWS credentials.

Claim

Total prize pool $75
Total paid $0
Status Pending
Submitted May 28, 2026
Last updated May 28, 2026

Contributors

JA

Jaison Velasco

@GaruBrothers

100%

Sponsors

AR

Arakoo.ai

@arakoodev

$25
GI

gittare

@gittare

$50