PackageTrack
Sign in Get early access

ai_guardrails

On-device, provider-agnostic input/output safety for Dart & Flutter AI apps: PII redaction, prompt-injection and secret detection, output validation.

0.6.0 GhagSagar23/ai_guardrails

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 2026
Release Pre-release

Releases

latest 6
  1. 0.6.0 18 Aug 2026
    Release notes

    feat: 0.6.0 — international PII (BR/MX/JP/KR/CA/AU), EU phones, RTL v…

    Open source →
    Release notes
    • 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.
    • PiiLocale enum expanded — added brazil, mexico, japan, southKorea, canada, australia. fromConfig supports all locale names.
    • PiiPattern.luhnMinDigits — per-pattern Luhn minimum digit count (default 12 for credit cards, 9 for Canadian SIN).
    Open source →
  2. 0.5.0 18 Aug 2026
    Release notes

    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.

    Open source →
    Release notes
    • 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 via AiGuard.onScan callback.
    • GuardMetrics — per-run metrics snapshot: total/input/output duration, block status, finding counts, per-scanner breakdown. Wire to dashboards via AiGuard.onMetrics callback.
    • AiGuard.fromConfig() — build a complete AiGuard from a Map<String, dynamic> (JSON). Declare scanner chains, thresholds, and actions without code changes. Deploy policy updates without recompilation. Supports all 13 scanner types.
    Open source →
  3. 0.4.0 18 Aug 2026
    Release notes

    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.

    Open source →
    Release notes
    • StreamingAiGuard — streaming wrapper for chunked LLM responses. Buffers incoming chunks, splits at configurable boundaries (default: newline), runs output scanners on each segment, yields GuardedChunks. Terminates the stream on block. PII rehydration works per-chunk. Input scanning is identical to AiGuard. Scanners see each segment independently — use AiGuard for 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 for StreamingAiGuard and advanced use cases. AiGuard.runInputStage() and AiGuard.runOutputStage() return full stage results including redaction maps.
    Open source →
  4. 0.3.0 18 Aug 2026
    Release notes

    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).

    Open source →
    Release notes
    • 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 via UrlCategory enum. 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 via CodeCategory enum. Output-stage only.
    Open source →
  5. 0.2.0 18 Aug 2026
    Release notes

    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.

    Open source →
    Release notes
    • PII round-trip rehydrationAiGuard.run() now automatically restores redacted PII in the LLM output. Placeholders like [EMAIL_1] in the model response are replaced with the original values so outcome.output reads naturally. outcome.rawOutput preserves the pre-rehydration text; outcome.piiMap exposes the placeholder→original map for manual control.
    • Numbered redaction placeholdersPiiScanner now 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 a Map<String, String> of token→original. AiGuard merges 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.
    Open source →
  6. 0.1.0 14 Aug 2026
    Release notes

    Initial release.

    • AiGuard orchestrator 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 — arbitrary Pattern/RegExp matching.
      • 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.
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive