Files
smom-dbis-138/packages/integration-foundation/dist/compliance/Volume13ComplianceDecisionEngine.js
defiQUG 11c97777d4
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m11s
CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 1m4s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 31s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 29s
Verify Deployment / Verify Deployment (push) Failing after 57s
feat(chain138): Monad CCIP, token aggregation OMNL gates, HYBX client, and PMM deploy updates.
Relay router, reserve system, oracle publisher, token-aggregation compliance middleware, and Monad deployment scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 00:11:33 -07:00

107 lines
4.6 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Volume13ComplianceDecisionEngine = void 0;
exports.createComplianceDecisionEngine = createComplianceDecisionEngine;
const ComplianceDecisionEngine_js_1 = require("./ComplianceDecisionEngine.js");
const node_fs_1 = __importDefault(require("node:fs"));
const node_path_1 = __importDefault(require("node:path"));
/**
* Production compliance engine: Volume 13 rules + internal sanctions list.
* Vendor adapter hook via COMPLIANCE_VENDOR env (worldcheck|chainalysis|internal).
*/
class Volume13ComplianceDecisionEngine {
mockFallback;
rules;
sanctions;
vendor;
auditCounter = 0;
constructor(options) {
const root = process.env.PROXMOX_ROOT || node_path_1.default.resolve(process.cwd(), '../..');
const rulesPath = options?.rulesPath ||
node_path_1.default.join(root, 'config/hybx-omnl-dbis/volume13-aml-decision-rules.v1.json');
const sanctionsPath = options?.sanctionsPath ||
node_path_1.default.join(root, 'config/compliance/internal-sanctions-list.v1.json');
this.mockFallback = new ComplianceDecisionEngine_js_1.MockComplianceDecisionEngine();
this.vendor = process.env.COMPLIANCE_VENDOR || 'internal';
this.rules = node_fs_1.default.existsSync(rulesPath)
? JSON.parse(node_fs_1.default.readFileSync(rulesPath, 'utf8')).rules ?? []
: [];
this.sanctions = node_fs_1.default.existsSync(sanctionsPath)
? JSON.parse(node_fs_1.default.readFileSync(sanctionsPath, 'utf8')).entries ?? []
: [];
}
nextAuditId() {
this.auditCounter += 1;
return `audit-v13-${this.vendor}-${this.auditCounter}`;
}
matchSanctions(entityId) {
const needle = entityId.toLowerCase();
return this.sanctions.some((e) => e.active !== false &&
(e.id.toLowerCase() === needle ||
(e.names ?? []).some((n) => needle.includes(n.toLowerCase()))));
}
async evaluateTransaction(input) {
const hints = input.riskHints ?? [];
if (this.matchSanctions(input.entityId) || hints.includes('sanctions_hit')) {
return {
decision: 'block',
risk_score: 100,
reason_codes: ['SANCTIONS_HIT', `VENDOR_${this.vendor.toUpperCase()}`],
evidence_refs: ['volume13-sanctions-screen'],
manual_review_required: true,
audit_event_id: this.nextAuditId(),
};
}
for (const rule of this.rules) {
const trigger = rule.trigger ?? {};
if (trigger.riskHints?.some((h) => hints.includes(h))) {
return {
decision: rule.decision ?? 'review',
risk_score: 80,
reason_codes: [rule.id],
evidence_refs: [`volume13-${rule.id}`],
manual_review_required: true,
audit_event_id: this.nextAuditId(),
};
}
if (trigger.amountGte != null && Number(input.amount) >= trigger.amountGte) {
return {
decision: rule.decision ?? 'hold',
risk_score: 65,
reason_codes: [rule.id, 'AMOUNT_THRESHOLD'],
evidence_refs: [`volume13-${rule.id}`],
manual_review_required: true,
audit_event_id: this.nextAuditId(),
};
}
}
return this.mockFallback.evaluateTransaction(input);
}
async evaluateEntity(entityId, tenantId) {
if (this.matchSanctions(entityId)) {
return {
decision: 'reject',
risk_score: 95,
reason_codes: ['ENTITY_SANCTIONS_MATCH'],
evidence_refs: [`sanctions-${entityId}`],
manual_review_required: true,
audit_event_id: this.nextAuditId(),
};
}
return this.mockFallback.evaluateEntity(entityId, tenantId);
}
async evaluateCounterparty(counterpartyId, tenantId) {
return this.evaluateEntity(counterpartyId, tenantId);
}
}
exports.Volume13ComplianceDecisionEngine = Volume13ComplianceDecisionEngine;
function createComplianceDecisionEngine() {
if (process.env.OMNL_COMPLIANCE_GATE !== '1') {
return new ComplianceDecisionEngine_js_1.MockComplianceDecisionEngine();
}
return new Volume13ComplianceDecisionEngine();
}