ai_guardrails
On-device, provider-agnostic input/output safety for Dart & Flutter AI apps: PII redaction, prompt-injection and secret detection, output validation.
What this package is like to depend on
Last release 5 days ago
18 Aug 2026
Too new to tell
only 1 release windows
Nearly every release is documented
notes for 6 of 6 stable releases
Nothing withdrawn
no release was ever pulled
0 months old
6 releases · first in 2026
6 releases in the last 12 months
see the full history below
Release timeline
6 releases · Aug 2026 to Aug 2026Releases
latest 6-
0.6.018 Aug 2026Release notes
Open source →- International PII expansion — 6 new locales: Brazil (CPF, CNPJ), Mexico (CURP, RFC), Japan (My Number), South Korea (RRN), Canada (SIN with Luhn validation), Australia (TFN, Medicare). Each with country-specific phone patterns.
- EU country-specific phones — replaced the single generic EU phone regex with dedicated patterns for UK (+44), Germany (+49), France (+33), Italy (+39), and Spain (+34). Reduces false positives on partial matches.
- RTL text verification — verified all scanners produce correct offsets on Arabic and Hebrew text with embedded PII. Redaction preserves RTL structure.
PiiLocaleenum expanded — addedbrazil,mexico,japan,southKorea,canada,australia.fromConfigsupports all locale names.PiiPattern.luhnMinDigits— per-pattern Luhn minimum digit count (default 12 for credit cards, 9 for Canadian SIN).
-
0.5.018 Aug 2026Release notes
Open source →GuardLog: JSON-serializable audit record with text hashes (never raw
text), scanner chain results, finding types. Emitted via onScan callback.GuardMetrics: per-run timing snapshot (total/input/output duration),
block status, per-scanner finding counts. Emitted via onMetrics callback.AiGuard.fromConfig: build scanner chains from Map<String, dynamic>.
Supports all 13 scanner types. JSON via dart:convert, zero new deps.Release notes
Open source →GuardLog— structured, JSON-serializable audit record of every scan. Contains scanner chain results, findings, text hashes (never raw text), and timestamps. Wire to any logging backend viaAiGuard.onScancallback.GuardMetrics— per-run metrics snapshot: total/input/output duration, block status, finding counts, per-scanner breakdown. Wire to dashboards viaAiGuard.onMetricscallback.AiGuard.fromConfig()— build a completeAiGuardfrom aMap<String, dynamic>(JSON). Declare scanner chains, thresholds, and actions without code changes. Deploy policy updates without recompilation. Supports all 13 scanner types.
-
0.4.018 Aug 2026Release notes
Open source →StreamingAiGuard: wraps Stream from streaming LLM responses,
buffers chunks, scans at configurable boundaries (default newline),
yields GuardedChunk per segment. Terminates on block. PII rehydration
per-chunk. StageRun + runInputStage/runOutputStage exposed as public API.GroundingScanner: keyword-overlap heuristic checking LLM output against
source context. Extracts content words (non-stop-words), computes overlap
ratio, flags below threshold. Default action: warn.Release notes
Open source →StreamingAiGuard— streaming wrapper for chunked LLM responses. Buffers incoming chunks, splits at configurable boundaries (default: newline), runs output scanners on each segment, yieldsGuardedChunks. Terminates the stream on block. PII rehydration works per-chunk. Input scanning is identical toAiGuard. Scanners see each segment independently — useAiGuardfor full-output scanning (e.g.SchemaValidator) after the stream completes.GroundingScanner— checks whether LLM output is grounded in a provided source context via keyword-overlap heuristic. Extracts content words (non-stop- words), computes overlap ratio, flags text when grounding falls below threshold. Finding type:grounding.unsupported_claim. Default action:warn.StageRun— exposed as public API forStreamingAiGuardand advanced use cases.AiGuard.runInputStage()andAiGuard.runOutputStage()return full stage results including redaction maps.
-
0.3.018 Aug 2026Release notes
Open source →UrlScanner: IP-literal, data/JS URIs, phishing TLDs, shorteners,
punycode, embedded credentials. Configurable categories.LanguageScanner: Unicode script-ratio heuristic (Latin/Cyrillic/CJK/
Devanagari/Arabic/Greek/Hangul/Hiragana/Katakana/Thai). Catches
unexpected script switches.CodeExecutionScanner: shell (rm -rf, curl|sh, dd, chmod 777), SQL
(DROP TABLE, TRUNCATE, DELETE FROM), injection (eval, exec, os.system,
subprocess, Process.start), filesystem (shutil.rmtree, unlink).Release notes
Open source →UrlScanner— detects suspicious URLs: IP-literal hosts,data:/javascript:URIs, phishing TLDs (.tk,.buzz,.zip, etc.), URL shorteners, punycode (homograph attacks), and embedded credentials. Configurable categories viaUrlCategoryenum. Runs on input and output.LanguageScanner— script-detection heuristic using Unicode character-class ratios (Latin, Cyrillic, CJK, Devanagari, Arabic, Greek, Hangul, Hiragana, Katakana, Thai). Flags text when the expected-script fraction falls below a threshold. Catches cross-script prompt injection and unexpected language switches.CodeExecutionScanner— detects dangerous patterns in generated code: shell commands (rm -rf,curl|sh,dd,chmod 777), SQL destruction (DROP TABLE,TRUNCATE,DELETE FROM), code injection (eval,exec,os.system,subprocess,Process.start), and filesystem deletion (shutil.rmtree,unlink). Configurable categories viaCodeCategoryenum. Output-stage only.
-
0.2.018 Aug 2026Release notes
Open source →PII round-trip: AiGuard auto-rehydrates redacted placeholders in LLM
output. Numbered placeholders ([EMAIL_1], [EMAIL_2]) replace shared
[EMAIL]. ScanResult.redactionMap exposes token→original for any scanner.
GuardOutcome gains rawOutput + piiMap.RepetitionScanner: word-level n-gram frequency detector for degenerate
model output. Configurable ngramSize + threshold, output-stage only.Release notes
Open source →- PII round-trip rehydration —
AiGuard.run()now automatically restores redacted PII in the LLM output. Placeholders like[EMAIL_1]in the model response are replaced with the original values sooutcome.outputreads naturally.outcome.rawOutputpreserves the pre-rehydration text;outcome.piiMapexposes the placeholder→original map for manual control. - Numbered redaction placeholders —
PiiScannernow produces unique tokens per occurrence ([EMAIL_1],[EMAIL_2]) instead of a shared[EMAIL]. Hash-mode placeholders ([EMAIL:a1b2c3]) are unchanged (already unique). ScanResult.redactionMap— any scanner that transforms text can now populate aMap<String, String>of token→original.AiGuardmerges maps across chained scanners.RepetitionScanner— detects degenerate model output (looping / repeated phrases) via word-level n-gram frequency analysis. Configurable n-gram size and threshold; output-stage only.
- PII round-trip rehydration —
-
0.1.014 Aug 2026Release notes
Open source →Initial release.
AiGuardorchestrator with chained input/output pipelines: redacting scanners chain (each sees the previous scanner's transformed text) and the pipeline stops at the first scanner that blocks.- Eight scanners:
PiiScanner— PII detection/redaction across US/EU/India locales, with a Luhn check on credit-card matches.SecretScanner— API keys, tokens, and private-key blocks.PromptInjectionScanner— heuristic weighted scoring of injection signals.BannedTopicScanner— word-boundary topic matching.BannedPatternScanner— arbitraryPattern/RegExpmatching.TokenLimitScanner— approximate token-count ceiling.InvisibleTextScanner— zero-width, bidi, soft-hyphen, and tag-char removal.SchemaValidator— minimal JSON-Schema-subset validation of model output.
- Pure Dart, on-device, zero runtime dependencies.