Skip to content

Add dependency-free AWS Comprehend PII redactor#545

Open
robin081412108-coder wants to merge 2 commits into
arakoodev:tsfrom
robin081412108-coder:codex/aws-comprehend-redactor-290
Open

Add dependency-free AWS Comprehend PII redactor#545
robin081412108-coder wants to merge 2 commits into
arakoodev:tsfrom
robin081412108-coder:codex/aws-comprehend-redactor-290

Conversation

@robin081412108-coder
Copy link
Copy Markdown

@robin081412108-coder robin081412108-coder commented May 23, 2026

Summary

  • Add AWSComprehendRedactor to the JS AI package with direct PII detection/redaction through AWS Comprehend.
  • Keep runtime dependency-free by signing Comprehend REST requests with Node built-ins instead of adding the AWS SDK.
  • Support injectable mock clients, direct text redaction, prompt/message redaction before endpoint chat() calls, and Observable-style chaining via redactText$ / redactTextOperator().
  • Export the redactor and types from @arakoodev/edgechains.js/ai.
  • Add mocked Vitest coverage and a runnable example under JS/edgechains/examples/aws-comprehend-redaction.

Demo

Demo video/GIF:

AWS Comprehend redaction demo

The example can be run without AWS credentials using its offline mock client:

cd JS/edgechains/examples/aws-comprehend-redaction
npm install
npm start

Expected demo output is documented in JS/edgechains/examples/aws-comprehend-redaction/README.md and shows direct redaction plus chainEndpoint() forwarding a sanitized prompt.

Validation

  • C:\Users\robin\Documents\Codex\2026-05-23\github-50\tooldeps-ts\node_modules\.bin\vitest.cmd run JS/edgechains/arakoodev/src/ai/src/tests/awsComprehendRedactor.test.ts -> 5 passed
  • C:\Users\robin\Documents\Codex\2026-05-23\github-50\tooldeps-ts\node_modules\.bin\tsc.cmd --noEmit --target ES2022 --module NodeNext --moduleResolution NodeNext --strict --skipLibCheck --esModuleInterop --typeRoots C:\Users\robin\Documents\Codex\2026-05-23\github-50\tooldeps-ts\node_modules\@types --types node JS/edgechains/arakoodev/src/ai/src/lib/aws-comprehend/awsComprehendRedactor.ts JS/edgechains/arakoodev/src/ai/src/lib/aws-comprehend/index.ts -> passed
  • npm start from JS/edgechains/examples/aws-comprehend-redaction -> passed
  • git diff --cached --check -> passed before commit

/claim #290

Closes #290

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 23, 2026

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@robin081412108-coder
Copy link
Copy Markdown
Author

I have read the Arakoo CLA Document and I hereby sign the CLA

Copy link
Copy Markdown
Author

recheck

Copy link
Copy Markdown
Author

Added a short demo GIF to the PR description:

https://raw.githubusercontent.com/robin081412108-coder/EdgeChains/demo-assets/aws-comprehend-redaction-545/aws-comprehend-redaction-demo.gif

I also pushed a follow-up commit to make the example runnable from a local checkout with:

cd JS/edgechains/examples/aws-comprehend-redaction
npm install
npm start

Validation completed:

  • npm start from JS/edgechains/examples/aws-comprehend-redaction passes
  • vitest run JS/edgechains/arakoodev/src/ai/src/tests/awsComprehendRedactor.test.ts passes with 5 tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BOUNTY: integrate AWS Comprehend as a utility to redact data

1 participant