@quetra/core
v0.3.1
Published
Types, rule engine, and Ed25519 signing for QuetraAI mandate governance
Maintainers
Readme
@quetra/core
Types, policy evaluation engine, and Ed25519 mandate signing for QuetraAI — the programmable mandate layer for AI agent spending.
Install
npm install @quetra/coreWhat's Inside
Types
All core interfaces for the QuetraAI governance model:
Organization,Agent,Mandate,MandateBudget,OnChainConfigMandateRule— union of 7 rule types (category, vendor allowlist/blocklist, time window, rate limit, approval threshold, custom JSONLogic)MandateToken,TransactionRecord,EvaluationContext,EvaluationResult,RuleEvaluationWebhookEventType,WebhookEvent
Rule Engine
Evaluate payment requests against mandate policies. All rules use AND logic — every rule must pass for approval.
import { evaluateMandate } from '@quetra/core';
const result = evaluateMandate(mandate, {
amount: 500, // $5.00 in cents
currency: 'USDC',
vendor: 'api.datavendor.com',
category: 'research',
timestamp: new Date(),
recentTransactionCount: 3,
});
console.log(result.decision); // 'approved' | 'rejected'
console.log(result.evaluations); // per-rule resultsRule types: category, vendor_allowlist, vendor_blocklist, time_window, rate_limit, approval_threshold, custom (JSONLogic).
Cryptographic Signing
Ed25519 key generation, mandate signing, and token verification via @noble/ed25519.
import { generateKeyPair, signMandate, createMandateToken, verifyMandateToken } from '@quetra/core';
// Generate org key pair
const { publicKey, privateKey } = await generateKeyPair();
// Sign a mandate
const signature = await signMandate(mandate, privateKey);
// Create a portable token (agent carries this)
const token = await createMandateToken(mandate, privateKey);
// Verify token authenticity
const verified = await verifyMandateToken(token, publicKey);Requirements
- Node.js >= 20
- ESM only (
"type": "module")
Related Packages
@quetra/sdk— Client SDK for AI agents@quetra/mcp— MCP server for Claude and other MCP-compatible agents
License
MIT
