@fengrru/valid8
v0.1.0
Published
Multi-layer AI output validation syntax, semantic, runtime, security with LLM reviewer and external scanner support
Maintainers
Readme
@fengrru/valid8
4-layer output validation for AI agents: syntax, semantic, runtime, security.
Install
npm install @fengrru/valid8
# Optional: npm install typescript (for AST-based syntax validation)Quick Start
import { ValidationNetwork } from "@fengrru/valid8"
const validator = new ValidationNetwork()
const result = await validator.validate({
content: fileContent,
filePath: "src/index.ts",
riskLevel: 1,
})
console.log(result.passed) // boolean
console.log(result.confidence) // 0-1
console.log(result.layers) // [{ name: "syntax", passed: true, ... }]Validation Layers
| Layer | Risk Gate | Description | |-------|-----------|-------------| | Syntax | minRisk=0 | TypeScript AST + regex fallback | | Semantic | minRisk=2 | LLM review or keyword fallback | | Runtime | minRisk=0 | Compilation + test execution | | Security | minRisk=1 | 40+ dangerous pattern detection |
Features
- Data-driven:
VALIDATION_LAYERSarray, not hardcoded - Confidence scoring: weighted average across layers
- Retry logic: configurable threshold and max retries
- Permission rules: bash blocked by default,可配置
Documentation
- API Reference — TypeDoc-generated API docs
- Source Code
- Examples
License
MIT
