@edictum/core
v0.5.0
Published
Runtime rule enforcement for AI agent tool calls
Downloads
314
Maintainers
Readme
@edictum/core
Runtime rule enforcement for AI agent tool calls. One runtime dep (js-yaml).
Part of Edictum — runtime rule enforcement for AI agent tool calls.
Install
pnpm add @edictum/coreUsage
import { readFile } from 'node:fs/promises'
import { Edictum, EdictumDenied } from '@edictum/core'
const guard = Edictum.fromYaml('rules.yaml')
const governedReadFile = (args: Record<string, unknown>) => readFile(args.path as string, 'utf8')
try {
await guard.run('readFile', { path: '.env' }, governedReadFile)
} catch (e) {
if (e instanceof EdictumDenied) console.log(e.reason)
}Key Exports
Edictum— main guard class (fromYaml,fromYamlString,run,evaluate)EdictumDenied,EdictumConfigError,EdictumToolError— error typesCheckPipeline— pipeline implementation used by adaptersDecision— rule result builder (pass_(),fail(message))Session,MemoryBackend— session tracking and storageRedactionPolicy— sensitive field redaction for audit eventsCollectingAuditSink,StdoutAuditSink,FileAuditSink,CompositeSink— audit sinkscreateEnvelope,ToolCall,SideEffect— tool-call construction and metadataWorkflowRuntime,loadWorkflow,loadWorkflowString— stateful multi-stage gate evaluation and YAML loaderscomposeBundles,loadBundle,compileContracts— YAML engine helperscreateViolation,buildViolations,Violation— output-check violation helpers
