@coreguard/agent-commerce 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/trust-card.mjs +0 -0
- package/mcp.mjs +35 -1
- package/package.json +9 -7
- package/server.json +3 -3
- package/wave4.mjs +593 -0
package/bin/trust-card.mjs
CHANGED
|
File without changes
|
package/mcp.mjs
CHANGED
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
} from "./machine-economy.mjs";
|
|
59
59
|
import { createIntent, issueReceipt, verifyReceipt as verifyCgcpReceipt, checkLimits, revokeConsent, auditTransaction, CGCP_MCP_BOUNDARY } from "./cgcp-mcp-tools.mjs";
|
|
60
60
|
import { WAVE3_TOOLS, WAVE3_HANDLERS, WAVE3_VALIDATORS, WAVE3_BOUNDARY } from "./wave3.mjs";
|
|
61
|
+
import { WAVE4_TOOLS, WAVE4_HANDLERS, WAVE4_VALIDATORS, WAVE4_BOUNDARY } from "./wave4.mjs";
|
|
61
62
|
|
|
62
63
|
const PROTOCOL_VERSION = "2025-06-18";
|
|
63
64
|
|
|
@@ -127,6 +128,31 @@ const TOOL_NAMES = Object.freeze([
|
|
|
127
128
|
"coreguard_translate_receipt",
|
|
128
129
|
"coreguard_emit_test_vectors",
|
|
129
130
|
"coreguard_describe_surface",
|
|
131
|
+
// Wave 4 (CG-W4/1) — cross-border/bank/chain/machine/loan evidence tools. Offline, caller-supplied evidence only.
|
|
132
|
+
"coreguard_parse_iso20022_payment",
|
|
133
|
+
"coreguard_verify_cross_border_instruction",
|
|
134
|
+
"coreguard_assess_fx_quote_risk",
|
|
135
|
+
"coreguard_verify_swift_remittance_evidence",
|
|
136
|
+
"coreguard_verify_bank_transfer_evidence",
|
|
137
|
+
"coreguard_assess_sanctions_screening_evidence",
|
|
138
|
+
"coreguard_verify_invoice_match",
|
|
139
|
+
"coreguard_generate_payment_compliance_packet",
|
|
140
|
+
"coreguard_verify_stellar_settlement_evidence",
|
|
141
|
+
"coreguard_verify_evm_settlement_evidence",
|
|
142
|
+
"coreguard_verify_coredao_settlement_evidence",
|
|
143
|
+
"coreguard_verify_pi_payment_evidence",
|
|
144
|
+
"coreguard_assess_bridge_risk",
|
|
145
|
+
"coreguard_assess_defi_position_risk",
|
|
146
|
+
"coreguard_verify_web3_signature_evidence",
|
|
147
|
+
"coreguard_verify_stablecoin_reserve_evidence",
|
|
148
|
+
"coreguard_create_robot_mission_receipt",
|
|
149
|
+
"coreguard_verify_robot_mission_evidence",
|
|
150
|
+
"coreguard_assess_machine_sla",
|
|
151
|
+
"coreguard_assess_loan_application",
|
|
152
|
+
"coreguard_verify_collateral_packet",
|
|
153
|
+
"coreguard_assess_credit_line_utilization",
|
|
154
|
+
"coreguard_verify_escrow_milestone",
|
|
155
|
+
"coreguard_create_incident_war_room",
|
|
130
156
|
]);
|
|
131
157
|
|
|
132
158
|
/**
|
|
@@ -181,6 +207,7 @@ function requireString(args, key) {
|
|
|
181
207
|
/** Per-tool input validation. Returns null when the arguments are usable. */
|
|
182
208
|
const VALIDATORS = Object.freeze({
|
|
183
209
|
...WAVE3_VALIDATORS,
|
|
210
|
+
...WAVE4_VALIDATORS,
|
|
184
211
|
coreguard_authorize(args) {
|
|
185
212
|
const missing = requireObjects(args, ["intent", "policy", "declaredTrace"]);
|
|
186
213
|
if (missing) return missing;
|
|
@@ -685,6 +712,7 @@ const TOOLS = Object.freeze([
|
|
|
685
712
|
outputSchema: { type: "object", description: "CGCP/1 audit report with chain status and optional filters.", properties: { type: { type: "string" }, spec: { type: "string" }, report: { type: "object" }, mapping: { type: "string" }, boundary: { type: "string" }, callerContext: { type: "object" } }, additionalProperties: true },
|
|
686
713
|
},
|
|
687
714
|
...WAVE3_TOOLS,
|
|
715
|
+
...WAVE4_TOOLS,
|
|
688
716
|
]);
|
|
689
717
|
|
|
690
718
|
function withCallerContext(value, args) {
|
|
@@ -776,6 +804,10 @@ async function callTool(name, args, { consumedSet } = {}) {
|
|
|
776
804
|
const ctx = { toolNames: TOOL_NAMES, version: PACKAGE.version, serverName: SERVER_INFO.name, protocolVersion: PROTOCOL_VERSION };
|
|
777
805
|
return success(withCallerContext(WAVE3_HANDLERS[name](a, ctx), a));
|
|
778
806
|
}
|
|
807
|
+
if (WAVE4_HANDLERS[name]) {
|
|
808
|
+
const ctx = { toolNames: TOOL_NAMES, version: PACKAGE.version, serverName: SERVER_INFO.name, protocolVersion: PROTOCOL_VERSION };
|
|
809
|
+
return success(withCallerContext(WAVE4_HANDLERS[name](a, ctx), a));
|
|
810
|
+
}
|
|
779
811
|
return failure(ERROR_CODES.UNKNOWN_TOOL, `unknown tool: ${String(name)}`);
|
|
780
812
|
} catch (err) {
|
|
781
813
|
return failure(ERROR_CODES.TOOL_ERROR, err?.message ?? String(err));
|
|
@@ -840,8 +872,10 @@ export function createMcpHandler({ write } = {}) {
|
|
|
840
872
|
|
|
841
873
|
export function selfCheck() {
|
|
842
874
|
return [
|
|
843
|
-
["tools exposed", TOOL_NAMES.length ===
|
|
875
|
+
["tools exposed", TOOL_NAMES.length === 70 && TOOL_NAMES[0] === "coreguard_authorize" && TOOL_NAMES[9] === "coreguard_consumption_status" && TOOL_NAMES[19] === "coreguard_verify_delegation_chain" && TOOL_NAMES[25] === "coreguard_audit_transaction" && TOOL_NAMES[45] === "coreguard_describe_surface" && TOOL_NAMES[69] === "coreguard_create_incident_war_room"],
|
|
844
876
|
["wave 3 declares schemas for every tool", WAVE3_TOOLS.length === 20 && WAVE3_TOOLS.every((t) => t.name.startsWith("coreguard_") && t.inputSchema?.required?.length > 0 && t.outputSchema?.type === "object" && WAVE3_HANDLERS[t.name])],
|
|
877
|
+
["wave 4 declares schemas for every tool", WAVE4_TOOLS.length === 24 && WAVE4_TOOLS.every((t) => t.name.startsWith("coreguard_") && t.inputSchema && t.outputSchema?.type === "object" && WAVE4_HANDLERS[t.name])],
|
|
878
|
+
["wave 4 boundary travels", WAVE4_BOUNDARY.includes("VERIFIED ≠ SAFE")],
|
|
845
879
|
["wave 3 boundary travels", WAVE3_BOUNDARY.includes("VERIFIED ≠ SAFE")],
|
|
846
880
|
["protocol version pinned", PROTOCOL_VERSION === "2025-06-18"],
|
|
847
881
|
["spec surfaced", CONSENT_SPEC === "CGCR/1" && AGENT_COMMERCE_VERSION === "AC-SDK/1"],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreguard/agent-commerce",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "CoreGuard Agent Commerce: consent receipts (CGCR/1) and fail-closed execution verification (AGR/1) for agentic purchases — SDK, REST surface, and a stdio MCP server (
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "CoreGuard Agent Commerce: consent receipts (CGCR/1) and fail-closed execution verification (AGR/1) for agentic purchases — SDK, REST surface, and a stdio MCP server (70 tools, JSON-RPC 2.0, offline, zero keys)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
|
7
7
|
"exports": {
|
|
@@ -36,17 +36,20 @@
|
|
|
36
36
|
"./prod/observability.mjs": "./prod/observability.mjs",
|
|
37
37
|
"./prod/kms-anchor.mjs": "./prod/kms-anchor.mjs",
|
|
38
38
|
"./machine-economy.mjs": "./machine-economy.mjs",
|
|
39
|
-
"./cgcp-mcp-tools.mjs": "./cgcp-mcp-tools.mjs"
|
|
39
|
+
"./cgcp-mcp-tools.mjs": "./cgcp-mcp-tools.mjs",
|
|
40
|
+
"./wave4.mjs": "./wave4.mjs"
|
|
40
41
|
},
|
|
41
42
|
"bin": {
|
|
42
43
|
"coreguard-agent-commerce-mcp": "./bin/mcp.mjs",
|
|
43
44
|
"coreguard-trust-card": "./bin/trust-card.mjs"
|
|
44
45
|
},
|
|
45
46
|
"files": [
|
|
47
|
+
"README.md",
|
|
46
48
|
"aer1.mjs",
|
|
47
49
|
"anchor.mjs",
|
|
48
50
|
"attest.mjs",
|
|
49
51
|
"bin/mcp.mjs",
|
|
52
|
+
"bin/trust-card.mjs",
|
|
50
53
|
"cgcp-mcp-tools.mjs",
|
|
51
54
|
"client.mjs",
|
|
52
55
|
"composition.mjs",
|
|
@@ -73,17 +76,16 @@
|
|
|
73
76
|
"prod/schema.mjs",
|
|
74
77
|
"prod/sqlite-storage.mjs",
|
|
75
78
|
"profile-ref.mjs",
|
|
76
|
-
"README.md",
|
|
77
79
|
"reference.mjs",
|
|
78
80
|
"risk-cli.mjs",
|
|
79
81
|
"risk.mjs",
|
|
80
82
|
"server.json",
|
|
81
83
|
"spend.mjs",
|
|
82
|
-
"trust.mjs",
|
|
83
84
|
"trust-card-cli.mjs",
|
|
84
85
|
"trust-card.mjs",
|
|
85
|
-
"
|
|
86
|
-
"wave3.mjs"
|
|
86
|
+
"trust.mjs",
|
|
87
|
+
"wave3.mjs",
|
|
88
|
+
"wave4.mjs"
|
|
87
89
|
],
|
|
88
90
|
"engines": {
|
|
89
91
|
"node": ">=18"
|
package/server.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
3
|
"name": "io.github.EslaM-X/coreguard-agent-commerce",
|
|
4
|
-
"description": "Fail-closed consent receipts and execution verification for agentic purchases.
|
|
4
|
+
"description": "Fail-closed consent receipts and execution verification for agentic purchases. 70 MCP tools.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/coreguard-global/CoreGuard",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.3.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@coreguard/agent-commerce",
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.3.0",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
}
|
package/wave4.mjs
ADDED
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CoreGuard Agent Commerce — Wave 4 (CG-W4/1)
|
|
3
|
+
*
|
|
4
|
+
* Deterministic, offline evidence/policy tools for cross-border payments,
|
|
5
|
+
* chain settlement evidence, machine/robot commerce, credit/loan evidence,
|
|
6
|
+
* and operations. All inputs are caller-supplied. No live network, no chain
|
|
7
|
+
* RPC, no bank/SWIFT/PI access, no custody, no compliance certification.
|
|
8
|
+
*
|
|
9
|
+
* VERIFIED ≠ SAFE. Findings are evidence for human decision, not truth,
|
|
10
|
+
* settlement finality, sanctions clearance, or regulatory approval.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
14
|
+
|
|
15
|
+
export const WAVE4_VERSION = "CG-W4/1";
|
|
16
|
+
export const WAVE4_BOUNDARY =
|
|
17
|
+
"Wave 4 is deterministic, offline verification over caller-supplied evidence. " +
|
|
18
|
+
"It does not contact SWIFT, banks, card networks, PI Network, Stellar, Ethereum, Core DAO, DeFi protocols, credit bureaus, or regulators. " +
|
|
19
|
+
"Outputs are evidence/risk signals only; VERIFIED ≠ SAFE; no settlement finality, sanctions clearance, KYC/AML approval, or compliance certification is claimed.";
|
|
20
|
+
|
|
21
|
+
const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
22
|
+
const arr = (v) => Array.isArray(v) ? v : [];
|
|
23
|
+
const str = (v) => typeof v === "string" ? v : "";
|
|
24
|
+
const num = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
25
|
+
const dec = (v) => { if (typeof v === "string" && /^-?[0-9]+(\.[0-9]+)?$/.test(v)) return v; if (Number.isInteger(v)) return String(v); return null; };
|
|
26
|
+
const decInt = (v) => { if (typeof v === "string" && /^[0-9]+$/.test(v)) return BigInt(v); if (Number.isInteger(v) && v >= 0) return BigInt(v); return null; };
|
|
27
|
+
const lower = (v) => str(v).toLowerCase();
|
|
28
|
+
const upper = (v) => str(v).toUpperCase();
|
|
29
|
+
|
|
30
|
+
export function canonicalJson(value) {
|
|
31
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value ?? null);
|
|
32
|
+
if (Array.isArray(value)) return "[" + value.map(canonicalJson).join(",") + "]";
|
|
33
|
+
return "{" + Object.keys(value).sort().map((k) => JSON.stringify(k) + ":" + canonicalJson(value[k])).join(",") + "}";
|
|
34
|
+
}
|
|
35
|
+
export function digestOf(value) { return "sha256:" + createHash("sha256").update(canonicalJson(value)).digest("hex"); }
|
|
36
|
+
|
|
37
|
+
function ok(type, fields) { return { type, spec: WAVE4_VERSION, status: "OK", ...fields, boundary: WAVE4_BOUNDARY }; }
|
|
38
|
+
function refusal(type, code, detail, fields={}) { return { type, spec: WAVE4_VERSION, status: "REFUSED", refusal: { code, detail }, ...fields, boundary: WAVE4_BOUNDARY }; }
|
|
39
|
+
function check(id, okv, severity, detail, evidence={}) { return { id, ok: !!okv, severity, detail, evidence }; }
|
|
40
|
+
|
|
41
|
+
function requireObj(args, key, type) {
|
|
42
|
+
const v = args[key];
|
|
43
|
+
if (!isObj(v)) return refusal(type, "INVALID_ARGUMENT", `${key} must be an object`, { field: key });
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
function requireStr(args, key, type) {
|
|
47
|
+
if (!str(args[key])) return refusal(type, "MISSING_ARGUMENT", `${key} is required`, { field: key });
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function summarizeChecks(checks) {
|
|
52
|
+
const failed = checks.filter(c => !c.ok);
|
|
53
|
+
const critical = failed.filter(c => c.severity === "CRITICAL");
|
|
54
|
+
const high = failed.filter(c => c.severity === "HIGH");
|
|
55
|
+
return {
|
|
56
|
+
verdict: critical.length ? "FAIL" : high.length ? "WARN" : failed.length ? "WARN" : "PASS",
|
|
57
|
+
checks,
|
|
58
|
+
failed: failed.map(c => c.id),
|
|
59
|
+
critical: critical.map(c => c.id),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 1) ISO20022-like payment parse/validate
|
|
64
|
+
export function parseIso20022Payment(args={}) {
|
|
65
|
+
const bad = requireObj(args, 'message', 'iso20022_payment_parse'); if (bad) return bad;
|
|
66
|
+
const msg = args.message;
|
|
67
|
+
const msgType = upper(str(msg.messageType || msg.type || msg.msgType));
|
|
68
|
+
const allowed = ['PAIN.001','PACS.008','PACS.009','CAMT.054','PAIN.002'];
|
|
69
|
+
const checks = [
|
|
70
|
+
check('MSG_TYPE', allowed.includes(msgType) || msgType.length > 0, 'HIGH', `messageType=${msgType||'missing'}`, {messageType: msgType}),
|
|
71
|
+
check('MSG_ID', !!str(msg.messageId || msg.msgId), 'HIGH', 'messageId present'),
|
|
72
|
+
check('CREATION_DT', !!str(msg.creationDateTime || msg.creationDt), 'MEDIUM', 'creationDateTime present'),
|
|
73
|
+
check('DEBTOR', isObj(msg.debtor) || !!str(msg.debtorName), 'HIGH', 'debtor present'),
|
|
74
|
+
check('CREDITOR', isObj(msg.creditor) || !!str(msg.creditorName), 'HIGH', 'creditor present'),
|
|
75
|
+
check('AMOUNT', dec(msg.amount || msg.instructedAmount?.value) !== null, 'CRITICAL', 'amount parseable'),
|
|
76
|
+
check('CURRENCY', !!upper(str(msg.currency || msg.instructedAmount?.currency)), 'HIGH', 'currency present'),
|
|
77
|
+
];
|
|
78
|
+
const amount = dec(msg.amount || msg.instructedAmount?.value);
|
|
79
|
+
const currency = upper(str(msg.currency || msg.instructedAmount?.currency));
|
|
80
|
+
const summary = summarizeChecks(checks);
|
|
81
|
+
return ok('iso20022_payment_parse', { messageType: msgType, messageId: str(msg.messageId||msg.msgId), amount, currency, digest: digestOf(msg), ...summary });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 2) cross-border instruction verification
|
|
85
|
+
export function verifyCrossBorderInstruction(args={}) {
|
|
86
|
+
const badI = requireObj(args,'instruction','cross_border_instruction_verification'); if (badI) return badI;
|
|
87
|
+
const badP = requireObj(args,'policy','cross_border_instruction_verification'); if (badP) return badP;
|
|
88
|
+
const i = args.instruction, p = args.policy;
|
|
89
|
+
const amount = decInt(i.amountMinor);
|
|
90
|
+
const max = decInt(p.maxAmountMinor);
|
|
91
|
+
const corridor = `${upper(str(i.sourceCountry))}->${upper(str(i.destinationCountry))}`;
|
|
92
|
+
const allowedCorridors = arr(p.allowedCorridors).map(x=>upper(str(x)));
|
|
93
|
+
const allowedCurrencies = arr(p.allowedCurrencies).map(x=>upper(str(x)));
|
|
94
|
+
const checks = [
|
|
95
|
+
check('AMOUNT_PARSE', amount !== null, 'CRITICAL', 'instruction.amountMinor parseable'),
|
|
96
|
+
check('MAX_AMOUNT', amount !== null && max !== null ? amount <= max : false, 'CRITICAL', `amount ${amount} <= max ${max}`),
|
|
97
|
+
check('CURRENCY', allowedCurrencies.length ? allowedCurrencies.includes(upper(str(i.currency))) : true, 'HIGH', 'currency allowed'),
|
|
98
|
+
check('CORRIDOR', allowedCorridors.length ? allowedCorridors.includes(corridor) : true, 'HIGH', `corridor ${corridor} allowed`),
|
|
99
|
+
check('PURPOSE', str(i.purposeCode || i.purpose).length > 0, 'MEDIUM', 'purpose present'),
|
|
100
|
+
check('CUTOFF', p.cutoffHourUtc === undefined ? true : (num(i.submissionHourUtc) !== null && num(i.submissionHourUtc) <= num(p.cutoffHourUtc)), 'MEDIUM', 'submission within cutoff'),
|
|
101
|
+
];
|
|
102
|
+
return ok('cross_border_instruction_verification', { corridor, amount: amount?.toString() ?? null, ...summarizeChecks(checks) });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 3) FX quote risk
|
|
106
|
+
export function assessFxQuoteRisk(args={}) {
|
|
107
|
+
const badQ = requireObj(args,'quote','fx_quote_risk'); if (badQ) return badQ;
|
|
108
|
+
const badP = requireObj(args,'policy','fx_quote_risk'); if (badP) return badP;
|
|
109
|
+
const q=args.quote, p=args.policy;
|
|
110
|
+
const now = decInt(args.nowSeconds);
|
|
111
|
+
const expires = decInt(q.expiresAtSeconds);
|
|
112
|
+
const spread = num(q.spreadBps);
|
|
113
|
+
const maxSpread = num(p.maxSpreadBps);
|
|
114
|
+
const providers = arr(p.allowedProviders).map(x=>str(x));
|
|
115
|
+
const checks = [
|
|
116
|
+
check('QUOTE_ID', !!str(q.quoteId), 'MEDIUM', 'quoteId present'),
|
|
117
|
+
check('PAIR', !!str(q.baseCurrency) && !!str(q.quoteCurrency), 'HIGH', 'currency pair present'),
|
|
118
|
+
check('RATE', dec(q.rate) !== null, 'CRITICAL', 'rate parseable'),
|
|
119
|
+
check('NOT_EXPIRED', now !== null && expires !== null ? expires >= now : false, 'CRITICAL', 'quote not expired at pinned nowSeconds'),
|
|
120
|
+
check('SPREAD', spread !== null && maxSpread !== null ? spread <= maxSpread : true, 'HIGH', 'spread within policy'),
|
|
121
|
+
check('PROVIDER', providers.length ? providers.includes(str(q.providerId)) : true, 'MEDIUM', 'provider allowed'),
|
|
122
|
+
];
|
|
123
|
+
return ok('fx_quote_risk', { quoteId: str(q.quoteId), expired: now!==null&&expires!==null?expires<now:null, ...summarizeChecks(checks) });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// 4) SWIFT remittance evidence verification
|
|
127
|
+
export function verifySwiftRemittanceEvidence(args={}) {
|
|
128
|
+
const badE = requireObj(args,'evidence','swift_remittance_evidence'); if (badE) return badE;
|
|
129
|
+
const badX = requireObj(args,'expected','swift_remittance_evidence'); if (badX) return badX;
|
|
130
|
+
const e=args.evidence, x=args.expected;
|
|
131
|
+
const checks = [
|
|
132
|
+
check('MSG_TYPE', !!str(e.messageType), 'MEDIUM', 'messageType present'),
|
|
133
|
+
check('UETR', !!str(e.uetr || e.reference), 'HIGH', 'reference/uetr present'),
|
|
134
|
+
check('AMOUNT_MATCH', dec(e.amountMinor) !== null && dec(e.amountMinor) === dec(x.amountMinor), 'CRITICAL', 'amount matches expected'),
|
|
135
|
+
check('CURRENCY_MATCH', upper(str(e.currency)) === upper(str(x.currency)), 'CRITICAL', 'currency matches expected'),
|
|
136
|
+
check('CREDITOR_MATCH', !str(x.creditorAccount) || str(e.creditorAccount) === str(x.creditorAccount), 'HIGH', 'creditor account matches when expected'),
|
|
137
|
+
check('DEBTOR_MATCH', !str(x.debtorAccount) || str(e.debtorAccount) === str(x.debtorAccount), 'MEDIUM', 'debtor account matches when expected'),
|
|
138
|
+
check('DIGEST', !str(x.digest) || str(e.digest) === str(x.digest), 'HIGH', 'digest matches when expected'),
|
|
139
|
+
];
|
|
140
|
+
return ok('swift_remittance_evidence', { reference: str(e.uetr||e.reference), ...summarizeChecks(checks) });
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// 5) bank transfer evidence
|
|
144
|
+
export function verifyBankTransferEvidence(args={}) {
|
|
145
|
+
const badE = requireObj(args,'evidence','bank_transfer_evidence'); if (badE) return badE;
|
|
146
|
+
const badX = requireObj(args,'expected','bank_transfer_evidence'); if (badX) return badX;
|
|
147
|
+
const e=args.evidence, x=args.expected;
|
|
148
|
+
const checks = [
|
|
149
|
+
check('STATUS', ['SETTLED','COMPLETED','ACCEPTED'].includes(upper(str(e.status))), 'HIGH', `status=${str(e.status)}`),
|
|
150
|
+
check('AMOUNT', dec(e.amountMinor) === dec(x.amountMinor), 'CRITICAL', 'amount matches'),
|
|
151
|
+
check('CURRENCY', upper(str(e.currency)) === upper(str(x.currency)), 'CRITICAL', 'currency matches'),
|
|
152
|
+
check('BENEFICIARY', !str(x.beneficiaryId) || str(e.beneficiaryId)===str(x.beneficiaryId), 'HIGH', 'beneficiary matches'),
|
|
153
|
+
check('REFERENCE', !!str(e.reference || e.transactionId), 'MEDIUM', 'reference present'),
|
|
154
|
+
];
|
|
155
|
+
return ok('bank_transfer_evidence', { reference: str(e.reference||e.transactionId), ...summarizeChecks(checks) });
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 6) sanctions screening evidence (no live screening)
|
|
159
|
+
export function assessSanctionsScreeningEvidence(args={}) {
|
|
160
|
+
const badE = requireObj(args,'evidence','sanctions_screening_evidence'); if (badE) return badE;
|
|
161
|
+
const badP = requireObj(args,'policy','sanctions_screening_evidence'); if (badP) return badP;
|
|
162
|
+
const e=args.evidence, p=args.policy;
|
|
163
|
+
const now = decInt(args.nowSeconds);
|
|
164
|
+
const checkedAt = decInt(e.checkedAtSeconds);
|
|
165
|
+
const maxAge = decInt(p.maxAgeSeconds);
|
|
166
|
+
const ageOk = now!==null && checkedAt!==null && maxAge!==null ? (now >= checkedAt && (now-checkedAt) <= maxAge) : false;
|
|
167
|
+
const result = upper(str(e.result));
|
|
168
|
+
const checks = [
|
|
169
|
+
check('RESULT_PRESENT', !!result, 'CRITICAL', 'screening result present'),
|
|
170
|
+
check('RESULT_CLEAR', result==='CLEAR' || result==='PASS' || result==='NO_MATCH', 'CRITICAL', `result=${result}`),
|
|
171
|
+
check('FRESH', ageOk, 'HIGH', 'screening evidence fresh at pinned nowSeconds'),
|
|
172
|
+
check('SUBJECT', !!str(e.subjectId || e.subjectDigest), 'HIGH', 'subject identifier/digest present'),
|
|
173
|
+
check('PROVIDER', !arr(p.allowedProviders).length || arr(p.allowedProviders).map(str).includes(str(e.providerId)), 'MEDIUM', 'provider allowed'),
|
|
174
|
+
];
|
|
175
|
+
return ok('sanctions_screening_evidence', { result, fresh: ageOk, ...summarizeChecks(checks) });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// 7) invoice match
|
|
179
|
+
export function verifyInvoiceMatch(args={}) {
|
|
180
|
+
const badInv = requireObj(args,'invoice','invoice_match'); if (badInv) return badInv;
|
|
181
|
+
const badPay = requireObj(args,'payment','invoice_match'); if (badPay) return badPay;
|
|
182
|
+
const inv=args.invoice, pay=args.payment;
|
|
183
|
+
const checks = [
|
|
184
|
+
check('INVOICE_ID', !!str(inv.invoiceId), 'MEDIUM', 'invoiceId present'),
|
|
185
|
+
check('AMOUNT', dec(inv.amountMinor) === dec(pay.amountMinor), 'CRITICAL', 'amount matches'),
|
|
186
|
+
check('CURRENCY', upper(str(inv.currency))===upper(str(pay.currency)), 'CRITICAL', 'currency matches'),
|
|
187
|
+
check('PAYEE', !str(inv.payeeId) || str(inv.payeeId)===str(pay.payeeId), 'HIGH', 'payee matches'),
|
|
188
|
+
check('REFERENCE', !str(inv.reference) || str(inv.reference)===str(pay.reference), 'MEDIUM', 'reference matches when present'),
|
|
189
|
+
];
|
|
190
|
+
return ok('invoice_match', { invoiceId: str(inv.invoiceId), ...summarizeChecks(checks) });
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// 8) payment compliance packet
|
|
194
|
+
export function generatePaymentCompliancePacket(args={}) {
|
|
195
|
+
const bad = requireObj(args,'payment','payment_compliance_packet'); if (bad) return bad;
|
|
196
|
+
const payment=args.payment;
|
|
197
|
+
const evidence = isObj(args.evidence) ? args.evidence : {};
|
|
198
|
+
const redactedFields = arr(args.redactFields).map(str).filter(Boolean);
|
|
199
|
+
const redacted = JSON.parse(JSON.stringify(payment));
|
|
200
|
+
for (const f of redactedFields) { if (f in redacted) redacted[f] = '[REDACTED]'; }
|
|
201
|
+
const packet = {
|
|
202
|
+
spec: WAVE4_VERSION,
|
|
203
|
+
packetType: 'payment_compliance_packet',
|
|
204
|
+
createdAtSeconds: decInt(args.nowSeconds)?.toString() ?? null,
|
|
205
|
+
paymentDigest: digestOf(payment),
|
|
206
|
+
evidenceDigest: digestOf(evidence),
|
|
207
|
+
redactedPayment: redacted,
|
|
208
|
+
evidence: evidence,
|
|
209
|
+
checks: arr(args.checks),
|
|
210
|
+
};
|
|
211
|
+
return ok('payment_compliance_packet', { packet, packetDigest: digestOf(packet), redactedFields });
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// 9) Stellar settlement evidence
|
|
215
|
+
export function verifyStellarSettlementEvidence(args={}) {
|
|
216
|
+
const badE=requireObj(args,'evidence','stellar_settlement_evidence'); if(badE) return badE;
|
|
217
|
+
const badX=requireObj(args,'expected','stellar_settlement_evidence'); if(badX) return badX;
|
|
218
|
+
const e=args.evidence,x=args.expected;
|
|
219
|
+
const checks=[
|
|
220
|
+
check('NETWORK', !str(x.network) || upper(str(e.network))===upper(str(x.network)), 'HIGH', 'network matches'),
|
|
221
|
+
check('TX_HASH', !!str(e.txHash), 'CRITICAL', 'txHash present'),
|
|
222
|
+
check('STATUS', ['SUCCESS','CONFIRMED'].includes(upper(str(e.status))), 'CRITICAL', `status=${str(e.status)}`),
|
|
223
|
+
check('AMOUNT', dec(e.amount)===dec(x.amount) || dec(e.amountMinor)===dec(x.amountMinor), 'CRITICAL', 'amount matches'),
|
|
224
|
+
check('ASSET', !str(x.asset) || upper(str(e.asset))===upper(str(x.asset)), 'HIGH', 'asset matches'),
|
|
225
|
+
check('DESTINATION', !str(x.destination) || str(e.destination)===str(x.destination), 'HIGH', 'destination matches'),
|
|
226
|
+
check('MEMO', !str(x.memo) || str(e.memo)===str(x.memo), 'MEDIUM', 'memo matches when expected'),
|
|
227
|
+
];
|
|
228
|
+
return ok('stellar_settlement_evidence', { txHash: str(e.txHash), ...summarizeChecks(checks) });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// 10) EVM settlement evidence
|
|
232
|
+
export function verifyEvmSettlementEvidence(args={}) {
|
|
233
|
+
const badE=requireObj(args,'evidence','evm_settlement_evidence'); if(badE) return badE;
|
|
234
|
+
const badX=requireObj(args,'expected','evm_settlement_evidence'); if(badX) return badX;
|
|
235
|
+
const e=args.evidence,x=args.expected;
|
|
236
|
+
const checks=[
|
|
237
|
+
check('CHAIN_ID', decInt(e.chainId)!==null && (!decInt(x.chainId) || decInt(e.chainId)===decInt(x.chainId)), 'HIGH', 'chainId present/matches'),
|
|
238
|
+
check('TX_HASH', /^0x[0-9a-fA-F]{64}$/.test(str(e.txHash)), 'CRITICAL', 'txHash format'),
|
|
239
|
+
check('STATUS', [1,'1','SUCCESS','0x1'].includes(e.status), 'CRITICAL', `status=${e.status}`),
|
|
240
|
+
check('TO', !str(x.to) || lower(str(e.to))===lower(str(x.to)), 'HIGH', 'to matches'),
|
|
241
|
+
check('AMOUNT', !dec(x.amountWei) || dec(e.amountWei)===dec(x.amountWei), 'CRITICAL', 'amountWei matches when expected'),
|
|
242
|
+
check('TOKEN', !str(x.tokenAddress) || lower(str(e.tokenAddress))===lower(str(x.tokenAddress)), 'HIGH', 'tokenAddress matches when expected'),
|
|
243
|
+
];
|
|
244
|
+
return ok('evm_settlement_evidence', { txHash: str(e.txHash), chainId: decInt(e.chainId)?.toString() ?? null, ...summarizeChecks(checks) });
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// 11) Core DAO settlement evidence (EVM profile)
|
|
248
|
+
export function verifyCoreDaoSettlementEvidence(args={}) {
|
|
249
|
+
const e = isObj(args.evidence) ? args.evidence : null;
|
|
250
|
+
if (!e) return refusal('coredao_settlement_evidence','INVALID_ARGUMENT','evidence must be an object',{field:'evidence'});
|
|
251
|
+
const expected = isObj(args.expected) ? args.expected : {};
|
|
252
|
+
const merged = { ...args, expected: { ...expected, chainId: expected.chainId ?? 1116 } };
|
|
253
|
+
const base = verifyEvmSettlementEvidence({ evidence: e, expected: merged.expected });
|
|
254
|
+
if (base.status === 'REFUSED') return { ...base, type:'coredao_settlement_evidence' };
|
|
255
|
+
const chainOk = decInt(e.chainId) === decInt(merged.expected.chainId);
|
|
256
|
+
const checks = [...base.checks, check('COREDAO_CHAIN', chainOk, 'CRITICAL', `chainId must be ${merged.expected.chainId}`)];
|
|
257
|
+
return ok('coredao_settlement_evidence', { txHash: base.txHash, chainId: base.chainId, ...summarizeChecks(checks) });
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// 12) Pi payment evidence (attested/mock boundary explicit)
|
|
261
|
+
export function verifyPiPaymentEvidence(args={}) {
|
|
262
|
+
const badE=requireObj(args,'evidence','pi_payment_evidence'); if(badE) return badE;
|
|
263
|
+
const badX=requireObj(args,'expected','pi_payment_evidence'); if(badX) return badX;
|
|
264
|
+
const e=args.evidence,x=args.expected;
|
|
265
|
+
const checks=[
|
|
266
|
+
check('PAYMENT_ID', !!str(e.paymentId), 'CRITICAL', 'paymentId present'),
|
|
267
|
+
check('STATUS', ['COMPLETED','SETTLED','VERIFIED'].includes(upper(str(e.status))), 'CRITICAL', `status=${str(e.status)}`),
|
|
268
|
+
check('AMOUNT', dec(e.amount)===dec(x.amount), 'CRITICAL', 'amount matches'),
|
|
269
|
+
check('CURRENCY', !str(x.currency) || upper(str(e.currency))===upper(str(x.currency)), 'HIGH', 'currency matches'),
|
|
270
|
+
check('PAYER', !str(x.payerId) || str(e.payerId)===str(x.payerId), 'MEDIUM', 'payer matches'),
|
|
271
|
+
check('PAYEE', !str(x.payeeId) || str(e.payeeId)===str(x.payeeId), 'MEDIUM', 'payee matches'),
|
|
272
|
+
check('ATTESTATION', !!str(e.attestationDigest) || isObj(e.attestation), 'MEDIUM', 'attestation digest/object present'),
|
|
273
|
+
];
|
|
274
|
+
const out = ok('pi_payment_evidence', { paymentId: str(e.paymentId), ...summarizeChecks(checks) });
|
|
275
|
+
out.boundary = WAVE4_BOUNDARY + ' Pi Network evidence is caller-supplied/attested; no live Pi network API or mainnet settlement verification is performed.';
|
|
276
|
+
return out;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// 13) bridge risk
|
|
280
|
+
export function assessBridgeRisk(args={}) {
|
|
281
|
+
const badR=requireObj(args,'route','bridge_risk'); if(badR) return badR;
|
|
282
|
+
const badP=requireObj(args,'policy','bridge_risk'); if(badP) return badP;
|
|
283
|
+
const r=args.route,p=args.policy;
|
|
284
|
+
const age = decInt(args.nowSeconds)!==null && decInt(r.quoteExpiresAtSeconds)!==null ? (decInt(args.nowSeconds)-decInt(r.quoteExpiresAtSeconds)) : null;
|
|
285
|
+
const checks=[
|
|
286
|
+
check('ROUTE_ID', !!str(r.routeId), 'MEDIUM', 'routeId present'),
|
|
287
|
+
check('CHAINS', !!str(r.sourceChain) && !!str(r.destinationChain), 'HIGH', 'source/destination chains present'),
|
|
288
|
+
check('ALLOW_CHAIN', !arr(p.allowedDestinationChains).length || arr(p.allowedDestinationChains).map(str).includes(str(r.destinationChain)), 'HIGH', 'destination chain allowed'),
|
|
289
|
+
check('QUOTE_FRESH', age===null ? false : age <= 0n, 'CRITICAL', 'quote not expired'),
|
|
290
|
+
check('SLIPPAGE', num(r.slippageBps)!==null && num(p.maxSlippageBps)!==null ? num(r.slippageBps)<=num(p.maxSlippageBps) : true, 'HIGH', 'slippage within policy'),
|
|
291
|
+
check('PROOF', !!str(r.proofDigest) || isObj(r.proof), 'MEDIUM', 'proof digest/object present'),
|
|
292
|
+
];
|
|
293
|
+
return ok('bridge_risk', { routeId: str(r.routeId), ...summarizeChecks(checks) });
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// 14) DeFi position risk
|
|
297
|
+
export function assessDefiPositionRisk(args={}) {
|
|
298
|
+
const badPos=requireObj(args,'position','defi_position_risk'); if(badPos) return badPos;
|
|
299
|
+
const badPol=requireObj(args,'policy','defi_position_risk'); if(badPol) return badPol;
|
|
300
|
+
const pos=args.position, pol=args.policy;
|
|
301
|
+
const hf = num(pos.healthFactor);
|
|
302
|
+
const minHf = num(pol.minHealthFactor);
|
|
303
|
+
const ltv = num(pos.ltvPct);
|
|
304
|
+
const maxLtv = num(pol.maxLtvPct);
|
|
305
|
+
const checks=[
|
|
306
|
+
check('POSITION_ID', !!str(pos.positionId), 'MEDIUM', 'positionId present'),
|
|
307
|
+
check('HEALTH_FACTOR', hf!==null && minHf!==null ? hf >= minHf : false, 'CRITICAL', `healthFactor ${hf} >= ${minHf}`),
|
|
308
|
+
check('LTV', ltv!==null && maxLtv!==null ? ltv <= maxLtv : true, 'HIGH', 'ltv within policy'),
|
|
309
|
+
check('ORACLE_AGE', decInt(args.nowSeconds)!==null && decInt(pos.oracleUpdatedAtSeconds)!==null && decInt(pol.maxOracleAgeSeconds)!==null ? (decInt(args.nowSeconds)-decInt(pos.oracleUpdatedAtSeconds))<=decInt(pol.maxOracleAgeSeconds) : true, 'HIGH', 'oracle fresh'),
|
|
310
|
+
];
|
|
311
|
+
return ok('defi_position_risk', { positionId: str(pos.positionId), healthFactor: hf, ...summarizeChecks(checks) });
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// 15) web3 signature evidence
|
|
315
|
+
export function verifyWeb3SignatureEvidence(args={}) {
|
|
316
|
+
const badE=requireObj(args,'evidence','web3_signature_evidence'); if(badE) return badE;
|
|
317
|
+
const e=args.evidence;
|
|
318
|
+
const checks=[
|
|
319
|
+
check('SCHEME', !!str(e.scheme), 'HIGH', 'signature scheme present'),
|
|
320
|
+
check('MESSAGE_DIGEST', /^sha256:[0-9a-f]{64}$/.test(str(e.messageDigest)) || !!str(e.messageDigest), 'HIGH', 'messageDigest present'),
|
|
321
|
+
check('SIGNATURE', !!str(e.signature), 'CRITICAL', 'signature present'),
|
|
322
|
+
check('CLAIMED_SIGNER', !!str(e.claimedSigner), 'HIGH', 'claimedSigner present'),
|
|
323
|
+
check('RECOVERED_MATCH', e.recoveredSigner ? lower(str(e.recoveredSigner))===lower(str(e.claimedSigner)) : false, 'CRITICAL', 'recoveredSigner matches claimedSigner'),
|
|
324
|
+
];
|
|
325
|
+
const out=ok('web3_signature_evidence', { claimedSigner: str(e.claimedSigner), ...summarizeChecks(checks) });
|
|
326
|
+
out.boundary = WAVE4_BOUNDARY + ' Signature evidence is caller-supplied; no onchain call or key custody is performed.';
|
|
327
|
+
return out;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// 16) stablecoin reserve evidence
|
|
331
|
+
export function verifyStablecoinReserveEvidence(args={}) {
|
|
332
|
+
const badE=requireObj(args,'evidence','stablecoin_reserve_evidence'); if(badE) return badE;
|
|
333
|
+
const badP=requireObj(args,'policy','stablecoin_reserve_evidence'); if(badP) return badP;
|
|
334
|
+
const e=args.evidence,p=args.policy;
|
|
335
|
+
const now=decInt(args.nowSeconds), asOf=decInt(e.asOfSeconds), maxAge=decInt(p.maxAgeSeconds);
|
|
336
|
+
const fresh = now!==null && asOf!==null && maxAge!==null ? (now>=asOf && now-asOf<=maxAge) : false;
|
|
337
|
+
const ratio = num(e.reserveRatioPct);
|
|
338
|
+
const minRatio = num(p.minReserveRatioPct);
|
|
339
|
+
const checks=[
|
|
340
|
+
check('ISSUER', !!str(e.issuer), 'MEDIUM', 'issuer present'),
|
|
341
|
+
check('ASSET', !!str(e.asset), 'MEDIUM', 'asset present'),
|
|
342
|
+
check('FRESH', fresh, 'HIGH', 'attestation fresh'),
|
|
343
|
+
check('RATIO', ratio!==null && minRatio!==null ? ratio>=minRatio : false, 'CRITICAL', 'reserve ratio meets policy'),
|
|
344
|
+
check('DIGEST', !!str(e.attestationDigest) || isObj(e.attestation), 'MEDIUM', 'attestation digest/object present'),
|
|
345
|
+
];
|
|
346
|
+
return ok('stablecoin_reserve_evidence', { asset: str(e.asset), reserveRatioPct: ratio, ...summarizeChecks(checks) });
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// 17) robot mission receipt
|
|
350
|
+
export function createRobotMissionReceipt(args={}) {
|
|
351
|
+
const badM=requireObj(args,'mission','robot_mission_receipt'); if(badM) return badM;
|
|
352
|
+
const badP=requireObj(args,'policy','robot_mission_receipt'); if(badP) return badP;
|
|
353
|
+
const m=args.mission,p=args.policy;
|
|
354
|
+
const now=decInt(args.nowSeconds);
|
|
355
|
+
const start=decInt(m.startAtSeconds), end=decInt(m.endAtSeconds);
|
|
356
|
+
const checks=[
|
|
357
|
+
check('MISSION_ID', !!str(m.missionId), 'CRITICAL', 'missionId present'),
|
|
358
|
+
check('ROBOT_ID', !!str(m.robotId || m.agentId), 'HIGH', 'robotId present'),
|
|
359
|
+
check('WINDOW', start!==null && end!==null ? end>=start : false, 'CRITICAL', 'valid time window'),
|
|
360
|
+
check('GEOFENCE', !arr(p.allowedZones).length || arr(p.allowedZones).map(str).includes(str(m.zoneId)), 'HIGH', 'zone allowed'),
|
|
361
|
+
check('BUDGET', decInt(m.maxSpendMinor)!==null && decInt(p.maxSpendMinor)!==null ? decInt(m.maxSpendMinor)<=decInt(p.maxSpendMinor) : true, 'HIGH', 'mission budget within policy'),
|
|
362
|
+
check('NOW', now!==null, 'MEDIUM', 'pinned nowSeconds provided'),
|
|
363
|
+
];
|
|
364
|
+
const receipt={ spec:WAVE4_VERSION, type:'robot_mission_receipt', mission:m, policyDigest:digestOf(p), createdAtSeconds: now?.toString()??null };
|
|
365
|
+
return ok('robot_mission_receipt', { receipt, receiptDigest:digestOf(receipt), ...summarizeChecks(checks) });
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// 18) robot mission evidence
|
|
369
|
+
export function verifyRobotMissionEvidence(args={}) {
|
|
370
|
+
const badR=requireObj(args,'receipt','robot_mission_evidence'); if(badR) return badR;
|
|
371
|
+
const badE=requireObj(args,'evidence','robot_mission_evidence'); if(badE) return badE;
|
|
372
|
+
const r=args.receipt,e=args.evidence;
|
|
373
|
+
const m=isObj(r.mission)?r.mission:{};
|
|
374
|
+
const checks=[
|
|
375
|
+
check('RECEIPT_DIGEST', !str(args.receiptDigest) || digestOf(r)===str(args.receiptDigest), 'CRITICAL', 'receipt digest matches when provided'),
|
|
376
|
+
check('MISSION_ID', str(e.missionId)===str(m.missionId), 'CRITICAL', 'missionId matches'),
|
|
377
|
+
check('ROBOT_ID', str(e.robotId||e.agentId)===str(m.robotId||m.agentId), 'HIGH', 'robotId matches'),
|
|
378
|
+
check('ZONE', !str(m.zoneId) || str(e.zoneId)===str(m.zoneId), 'HIGH', 'zone matches'),
|
|
379
|
+
check('SPEND', decInt(e.spendMinor)!==null && decInt(m.maxSpendMinor)!==null ? decInt(e.spendMinor)<=decInt(m.maxSpendMinor) : true, 'CRITICAL', 'spend within mission budget'),
|
|
380
|
+
check('STATUS', ['COMPLETED','SUCCESS'].includes(upper(str(e.status))), 'HIGH', `status=${str(e.status)}`),
|
|
381
|
+
];
|
|
382
|
+
return ok('robot_mission_evidence', { missionId: str(m.missionId), ...summarizeChecks(checks) });
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// 19) machine SLA assessment
|
|
386
|
+
export function assessMachineSla(args={}) {
|
|
387
|
+
const badE=requireObj(args,'events','machine_sla_assessment'); if(badE) return refusal('machine_sla_assessment','INVALID_ARGUMENT','events must be an array',{field:'events'});
|
|
388
|
+
const events = arr(args.events);
|
|
389
|
+
const policy = isObj(args.policy)?args.policy:{};
|
|
390
|
+
const maxDowntime = decInt(policy.maxDowntimeSeconds);
|
|
391
|
+
let downtime=0n;
|
|
392
|
+
for (const ev of events) {
|
|
393
|
+
if (!isObj(ev)) continue;
|
|
394
|
+
if (upper(str(ev.type))==='DOWNTIME') {
|
|
395
|
+
const d=decInt(ev.durationSeconds); if (d!==null) downtime += d;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
const checks=[
|
|
399
|
+
check('EVENTS', events.length>0, 'MEDIUM', 'events provided'),
|
|
400
|
+
check('DOWNTIME', maxDowntime!==null ? downtime <= maxDowntime : true, 'HIGH', `downtime ${downtime} <= ${maxDowntime}`),
|
|
401
|
+
];
|
|
402
|
+
return ok('machine_sla_assessment', { downtimeSeconds: downtime.toString(), ...summarizeChecks(checks) });
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// 20) loan application risk
|
|
406
|
+
export function assessLoanApplication(args={}) {
|
|
407
|
+
const badA=requireObj(args,'application','loan_application_assessment'); if(badA) return badA;
|
|
408
|
+
const badP=requireObj(args,'policy','loan_application_assessment'); if(badP) return badP;
|
|
409
|
+
const a=args.application,p=args.policy;
|
|
410
|
+
const income = decInt(a.monthlyIncomeMinor);
|
|
411
|
+
const debt = decInt(a.monthlyDebtMinor);
|
|
412
|
+
const requested = decInt(a.requestedAmountMinor);
|
|
413
|
+
const maxAmount = decInt(p.maxAmountMinor);
|
|
414
|
+
const dti = (income!==null && debt!==null && income>0n) ? Number(debt*10000n/income)/100 : null;
|
|
415
|
+
const maxDti = num(p.maxDtiPct);
|
|
416
|
+
const checks=[
|
|
417
|
+
check('APPLICANT', !!str(a.applicantId), 'HIGH', 'applicantId present'),
|
|
418
|
+
check('INCOME', income!==null && income>0n, 'CRITICAL', 'monthly income present'),
|
|
419
|
+
check('AMOUNT', requested!==null && maxAmount!==null ? requested<=maxAmount : true, 'CRITICAL', 'requested amount within policy'),
|
|
420
|
+
check('DTI', dti!==null && maxDti!==null ? dti<=maxDti : false, 'HIGH', `DTI ${dti} <= ${maxDti}`),
|
|
421
|
+
check('TENOR', decInt(a.tenorMonths)!==null && decInt(p.maxTenorMonths)!==null ? decInt(a.tenorMonths)<=decInt(p.maxTenorMonths) : true, 'MEDIUM', 'tenor within policy'),
|
|
422
|
+
];
|
|
423
|
+
const out=ok('loan_application_assessment', { applicantId:str(a.applicantId), dtiPct:dti, ...summarizeChecks(checks) });
|
|
424
|
+
out.boundary = WAVE4_BOUNDARY + ' Loan assessment is deterministic over caller-supplied data; no credit bureau, bank core, or regulatory decision is performed.';
|
|
425
|
+
return out;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// 21) collateral packet verification
|
|
429
|
+
export function verifyCollateralPacket(args={}) {
|
|
430
|
+
const badC=requireObj(args,'collateral','collateral_packet_verification'); if(badC) return badC;
|
|
431
|
+
const badP=requireObj(args,'policy','collateral_packet_verification'); if(badP) return badP;
|
|
432
|
+
const c=args.collateral,p=args.policy;
|
|
433
|
+
const now=decInt(args.nowSeconds), exp=decInt(c.expiresAtSeconds);
|
|
434
|
+
const value=decInt(c.valuationMinor), min=decInt(p.minValuationMinor);
|
|
435
|
+
const checks=[
|
|
436
|
+
check('COLLATERAL_ID', !!str(c.collateralId), 'HIGH', 'collateralId present'),
|
|
437
|
+
check('OWNER', !!str(c.ownerId), 'HIGH', 'ownerId present'),
|
|
438
|
+
check('VALUE', value!==null && min!==null ? value>=min : false, 'CRITICAL', 'valuation meets minimum'),
|
|
439
|
+
check('NOT_EXPIRED', now!==null && exp!==null ? exp>=now : true, 'HIGH', 'collateral not expired'),
|
|
440
|
+
check('DIGEST', !!str(c.evidenceDigest) || isObj(c.evidence), 'MEDIUM', 'evidence digest/object present'),
|
|
441
|
+
];
|
|
442
|
+
return ok('collateral_packet_verification', { collateralId:str(c.collateralId), ...summarizeChecks(checks) });
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// 22) credit line utilization
|
|
446
|
+
export function assessCreditLineUtilization(args={}) {
|
|
447
|
+
const badL=requireObj(args,'line','credit_line_utilization'); if(badL) return badL;
|
|
448
|
+
const l=args.line;
|
|
449
|
+
const limit=decInt(l.limitMinor), used=decInt(l.usedMinor);
|
|
450
|
+
const maxPct=num(l.maxUtilizationPct) ?? 80;
|
|
451
|
+
const pct = (limit!==null && used!==null && limit>0n) ? Number(used*10000n/limit)/100 : null;
|
|
452
|
+
const checks=[
|
|
453
|
+
check('LINE_ID', !!str(l.lineId), 'MEDIUM', 'lineId present'),
|
|
454
|
+
check('LIMIT', limit!==null && limit>0n, 'CRITICAL', 'limit present'),
|
|
455
|
+
check('USED', used!==null, 'CRITICAL', 'used present'),
|
|
456
|
+
check('UTILIZATION', pct!==null ? pct <= maxPct : false, 'HIGH', `utilization ${pct}% <= ${maxPct}%`),
|
|
457
|
+
];
|
|
458
|
+
return ok('credit_line_utilization', { lineId:str(l.lineId), utilizationPct:pct, ...summarizeChecks(checks) });
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// 23) escrow milestone verification
|
|
462
|
+
export function verifyEscrowMilestone(args={}) {
|
|
463
|
+
const badE=requireObj(args,'escrow','escrow_milestone_verification'); if(badE) return badE;
|
|
464
|
+
const badM=requireObj(args,'milestone','escrow_milestone_verification'); if(badM) return badM;
|
|
465
|
+
const e=args.escrow, m=args.milestone;
|
|
466
|
+
const checks=[
|
|
467
|
+
check('ESCROW_ID', !!str(e.escrowId), 'HIGH', 'escrowId present'),
|
|
468
|
+
check('MILESTONE_ID', !!str(m.milestoneId), 'HIGH', 'milestoneId present'),
|
|
469
|
+
check('APPROVALS', num(m.approvals)!==null && num(m.requiredApprovals)!==null ? num(m.approvals)>=num(m.requiredApprovals) : false, 'CRITICAL', 'required approvals met'),
|
|
470
|
+
check('EVIDENCE', !!str(m.evidenceDigest) || arr(m.evidence).length>0, 'HIGH', 'evidence present'),
|
|
471
|
+
check('AMOUNT', !dec(m.releaseAmountMinor) || (decInt(m.releaseAmountMinor)!==null && decInt(e.remainingMinor)!==null ? decInt(m.releaseAmountMinor)<=decInt(e.remainingMinor) : true), 'CRITICAL', 'release amount within remaining escrow'),
|
|
472
|
+
];
|
|
473
|
+
return ok('escrow_milestone_verification', { escrowId:str(e.escrowId), milestoneId:str(m.milestoneId), ...summarizeChecks(checks) });
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// 24) incident war room packet
|
|
477
|
+
export function createIncidentWarRoom(args={}) {
|
|
478
|
+
const incident = isObj(args.incident) ? args.incident : {};
|
|
479
|
+
const events = arr(args.events).filter(isObj);
|
|
480
|
+
const actions = arr(args.actions).filter(isObj);
|
|
481
|
+
const packet = {
|
|
482
|
+
spec: WAVE4_VERSION,
|
|
483
|
+
type: 'incident_war_room',
|
|
484
|
+
incidentId: str(incident.incidentId || 'incident-unknown'),
|
|
485
|
+
severity: upper(str(incident.severity || 'UNKNOWN')),
|
|
486
|
+
createdAtSeconds: decInt(args.nowSeconds)?.toString() ?? null,
|
|
487
|
+
summary: str(incident.summary),
|
|
488
|
+
events: events.map(e=>({ atSeconds: decInt(e.atSeconds)?.toString()??null, type: str(e.type), actor: str(e.actor), detail: str(e.detail), digest: digestOf(e) })),
|
|
489
|
+
actions: actions.map(a=>({ action: str(a.action), owner: str(a.owner), status: upper(str(a.status||'OPEN')) })),
|
|
490
|
+
};
|
|
491
|
+
const checks=[
|
|
492
|
+
check('INCIDENT_ID', !!str(incident.incidentId), 'MEDIUM', 'incidentId present'),
|
|
493
|
+
check('EVENTS', events.length>0, 'MEDIUM', 'events present'),
|
|
494
|
+
check('ACTIONS', actions.length>0, 'LOW', 'actions present'),
|
|
495
|
+
];
|
|
496
|
+
return ok('incident_war_room', { packet, packetDigest: digestOf(packet), ...summarizeChecks(checks) });
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
// ---------------------------------------------------------------------------
|
|
501
|
+
// MCP tool defs / handlers / validators
|
|
502
|
+
// ---------------------------------------------------------------------------
|
|
503
|
+
|
|
504
|
+
const CALLER_CONTEXT = { type: "object", description: "Optional caller context echoed in response (never a cryptographic input).", additionalProperties: true };
|
|
505
|
+
const schema = (properties, required, description) => ({
|
|
506
|
+
type: "object", description, additionalProperties: true,
|
|
507
|
+
properties: { ...properties, callerContext: CALLER_CONTEXT },
|
|
508
|
+
...(required ? { required } : {}),
|
|
509
|
+
});
|
|
510
|
+
const out = (description) => ({ type: "object", description: description.length >= 40 ? description : description + " (deterministic, caller-supplied evidence).", additionalProperties: true });
|
|
511
|
+
function reqString(args, key) { if (typeof args?.[key] !== "string" || !args[key]) throw new Error(`${key} is required`); }
|
|
512
|
+
function reqObject(args, key) { if (!isObj(args?.[key])) throw new Error(`${key} is required and must be an object`); }
|
|
513
|
+
|
|
514
|
+
export const WAVE4_TOOLS = Object.freeze([
|
|
515
|
+
{ name:"coreguard_parse_iso20022_payment", description:"Parse and validate a caller-supplied ISO 20022-like payment message (pain.001/pacs.008/camt.054 etc.) into deterministic checks and a digest. Offline; no SWIFT/bank network access.", inputSchema:schema({message:{type:"object",description:"ISO20022-like JSON message"}},["message"],"ISO 20022-like payment message to parse."), outputSchema:out("Parse verdict, normalized fields, digest, checks.") },
|
|
516
|
+
{ name:"coreguard_verify_cross_border_instruction", description:"Verify a cross-border payment instruction against corridor/currency/amount/cutoff policy. Deterministic policy evidence only; no live compliance or sanctions screening.", inputSchema:schema({instruction:{type:"object"},policy:{type:"object"}},["instruction","policy"],"Instruction and corridor policy."), outputSchema:out("Pass/warn/fail checks for the instruction.") },
|
|
517
|
+
{ name:"coreguard_assess_fx_quote_risk", description:"Assess FX quote evidence for expiry, spread, provider allowlist, and rate presence at a pinned nowSeconds. Offline; no market data feed.", inputSchema:schema({quote:{type:"object"},policy:{type:"object"},nowSeconds:{type:"string",pattern:"^[0-9]+$"}},["quote","policy","nowSeconds"],"FX quote, policy, pinned time."), outputSchema:out("FX quote risk verdict and checks.") },
|
|
518
|
+
{ name:"coreguard_verify_swift_remittance_evidence", description:"Verify caller-supplied SWIFT/remittance evidence against expected amount/currency/accounts/reference. Evidence only; no SWIFT network access or settlement finality claim.", inputSchema:schema({evidence:{type:"object"},expected:{type:"object"}},["evidence","expected"],"Remittance evidence and expected values."), outputSchema:out("Evidence match verdict and checks.") },
|
|
519
|
+
{ name:"coreguard_verify_bank_transfer_evidence", description:"Verify bank transfer evidence against expected instruction fields. Offline evidence check; no bank API call.", inputSchema:schema({evidence:{type:"object"},expected:{type:"object"}},["evidence","expected"],"Bank transfer evidence and expected values."), outputSchema:out("Bank transfer evidence verdict.") },
|
|
520
|
+
{ name:"coreguard_assess_sanctions_screening_evidence", description:"Assess a caller-supplied sanctions/screening result packet for freshness, provider allowlist, and clear/no-match result. No live sanctions screening; evidence only.", inputSchema:schema({evidence:{type:"object"},policy:{type:"object"},nowSeconds:{type:"string",pattern:"^[0-9]+$"}},["evidence","policy","nowSeconds"],"Screening evidence, policy, pinned time."), outputSchema:out("Screening evidence assessment.") },
|
|
521
|
+
{ name:"coreguard_verify_invoice_match", description:"Deterministic 3-way style match between invoice and payment evidence (amount, currency, payee, reference).", inputSchema:schema({invoice:{type:"object"},payment:{type:"object"}},["invoice","payment"],"Invoice and payment evidence."), outputSchema:out("Invoice match verdict.") },
|
|
522
|
+
{ name:"coreguard_generate_payment_compliance_packet", description:"Bundle payment evidence into a redacted, hashed compliance packet for review/export. Local only; no regulatory submission.", inputSchema:schema({payment:{type:"object"},evidence:{type:"object"},checks:{type:"array",items:{type:"object"}},redactFields:{type:"array",items:{type:"string"}},nowSeconds:{type:"string",pattern:"^[0-9]+$"}},["payment"],"Payment and supporting evidence."), outputSchema:out("Redacted compliance packet and digests.") },
|
|
523
|
+
{ name:"coreguard_verify_stellar_settlement_evidence", description:"Verify caller-supplied Stellar settlement evidence against expected payment fields. No Horizon/network call; evidence only.", inputSchema:schema({evidence:{type:"object"},expected:{type:"object"}},["evidence","expected"],"Stellar evidence and expected values."), outputSchema:out("Stellar evidence verification verdict.") },
|
|
524
|
+
{ name:"coreguard_verify_evm_settlement_evidence", description:"Verify caller-supplied EVM tx/receipt evidence against expected chain, recipient, token, and amount. No RPC call; evidence only.", inputSchema:schema({evidence:{type:"object"},expected:{type:"object"}},["evidence","expected"],"EVM evidence and expected values."), outputSchema:out("EVM evidence verification verdict.") },
|
|
525
|
+
{ name:"coreguard_verify_coredao_settlement_evidence", description:"Verify caller-supplied Core DAO EVM settlement evidence with Core DAO chain-id profile checks. No RPC call; evidence only.", inputSchema:schema({evidence:{type:"object"},expected:{type:"object"}},["evidence"],"Core DAO evidence and optional expected values."), outputSchema:out("Core DAO evidence verification verdict.") },
|
|
526
|
+
{ name:"coreguard_verify_pi_payment_evidence", description:"Verify caller-supplied Pi Network payment evidence packet against expected values. Explicit boundary: attested/mock evidence only, no live Pi API/mainnet verification.", inputSchema:schema({evidence:{type:"object"},expected:{type:"object"}},["evidence","expected"],"Pi payment evidence and expected values."), outputSchema:out("Pi payment evidence verdict with explicit boundary.") },
|
|
527
|
+
{ name:"coreguard_assess_bridge_risk", description:"Assess bridge transfer route risk from caller-supplied route/quote/proof/policy data. No bridge API call.", inputSchema:schema({route:{type:"object"},policy:{type:"object"},nowSeconds:{type:"string",pattern:"^[0-9]+$"}},["route","policy","nowSeconds"],"Bridge route, policy, pinned time."), outputSchema:out("Bridge risk verdict.") },
|
|
528
|
+
{ name:"coreguard_assess_defi_position_risk", description:"Assess DeFi position risk from caller-supplied snapshot (health factor, LTV, oracle age). No onchain/protocol call.", inputSchema:schema({position:{type:"object"},policy:{type:"object"},nowSeconds:{type:"string",pattern:"^[0-9]+$"}},["position","policy","nowSeconds"],"Position snapshot, policy, pinned time."), outputSchema:out("DeFi position risk verdict.") },
|
|
529
|
+
{ name:"coreguard_verify_web3_signature_evidence", description:"Verify caller-supplied Web3 signature evidence structure and recovered/claimed signer match. No key custody or onchain call.", inputSchema:schema({evidence:{type:"object"}},["evidence"],"Signature evidence packet."), outputSchema:out("Signature evidence verdict.") },
|
|
530
|
+
{ name:"coreguard_verify_stablecoin_reserve_evidence", description:"Assess caller-supplied stablecoin reserve/attestation evidence for freshness and reserve ratio policy. No issuer API call; evidence only.", inputSchema:schema({evidence:{type:"object"},policy:{type:"object"},nowSeconds:{type:"string",pattern:"^[0-9]+$"}},["evidence","policy","nowSeconds"],"Reserve evidence, policy, pinned time."), outputSchema:out("Reserve evidence verdict.") },
|
|
531
|
+
{ name:"coreguard_create_robot_mission_receipt", description:"Create a deterministic robot/agent mission receipt binding mission, zone, budget, and time window to a policy digest. Offline; no robot control.", inputSchema:schema({mission:{type:"object"},policy:{type:"object"},nowSeconds:{type:"string",pattern:"^[0-9]+$"}},["mission","policy","nowSeconds"],"Mission, policy, pinned time."), outputSchema:out("Robot mission receipt and digest.") },
|
|
532
|
+
{ name:"coreguard_verify_robot_mission_evidence", description:"Verify robot/agent mission execution evidence against a mission receipt. Offline evidence check.", inputSchema:schema({receipt:{type:"object"},evidence:{type:"object"},receiptDigest:{type:"string"}},["receipt","evidence"],"Mission receipt and execution evidence."), outputSchema:out("Mission evidence verdict.") },
|
|
533
|
+
{ name:"coreguard_assess_machine_sla", description:"Assess machine/agent SLA from caller-supplied downtime/events against policy thresholds. Deterministic, offline.", inputSchema:schema({events:{type:"array",items:{type:"object"}},policy:{type:"object"}},["events"],"Events and SLA policy."), outputSchema:out("SLA assessment verdict.") },
|
|
534
|
+
{ name:"coreguard_assess_loan_application", description:"Assess loan application risk from caller-supplied financial fields and policy (DTI, amount, tenor). No credit bureau/bank/regulatory decision.", inputSchema:schema({application:{type:"object"},policy:{type:"object"}},["application","policy"],"Loan application and policy."), outputSchema:out("Loan application risk assessment.") },
|
|
535
|
+
{ name:"coreguard_verify_collateral_packet", description:"Verify collateral evidence packet for valuation, expiry, owner, and evidence digest presence. No registry/custody verification.", inputSchema:schema({collateral:{type:"object"},policy:{type:"object"},nowSeconds:{type:"string",pattern:"^[0-9]+$"}},["collateral","policy","nowSeconds"],"Collateral packet, policy, pinned time."), outputSchema:out("Collateral packet verdict.") },
|
|
536
|
+
{ name:"coreguard_assess_credit_line_utilization", description:"Assess credit line utilization against a max utilization threshold. Deterministic arithmetic only.", inputSchema:schema({line:{type:"object"}},["line"],"Credit line with limitMinor/usedMinor."), outputSchema:out("Utilization assessment.") },
|
|
537
|
+
{ name:"coreguard_verify_escrow_milestone", description:"Verify escrow milestone release conditions: approvals, evidence, and release amount within remaining escrow. No custody/broadcast.", inputSchema:schema({escrow:{type:"object"},milestone:{type:"object"}},["escrow","milestone"],"Escrow state and milestone evidence."), outputSchema:out("Escrow milestone verdict.") },
|
|
538
|
+
{ name:"coreguard_create_incident_war_room", description:"Create a deterministic incident war-room packet from incident metadata, events, and actions. Local evidence packaging only.", inputSchema:schema({incident:{type:"object"},events:{type:"array",items:{type:"object"}},actions:{type:"array",items:{type:"object"}},nowSeconds:{type:"string",pattern:"^[0-9]+$"}},["incident"],"Incident metadata, events, actions."), outputSchema:out("Incident war-room packet and digest.") },
|
|
539
|
+
]);
|
|
540
|
+
|
|
541
|
+
export const WAVE4_HANDLERS = Object.freeze({
|
|
542
|
+
coreguard_parse_iso20022_payment: (a) => parseIso20022Payment(a),
|
|
543
|
+
coreguard_verify_cross_border_instruction: (a) => verifyCrossBorderInstruction(a),
|
|
544
|
+
coreguard_assess_fx_quote_risk: (a) => assessFxQuoteRisk(a),
|
|
545
|
+
coreguard_verify_swift_remittance_evidence: (a) => verifySwiftRemittanceEvidence(a),
|
|
546
|
+
coreguard_verify_bank_transfer_evidence: (a) => verifyBankTransferEvidence(a),
|
|
547
|
+
coreguard_assess_sanctions_screening_evidence: (a) => assessSanctionsScreeningEvidence(a),
|
|
548
|
+
coreguard_verify_invoice_match: (a) => verifyInvoiceMatch(a),
|
|
549
|
+
coreguard_generate_payment_compliance_packet: (a) => generatePaymentCompliancePacket(a),
|
|
550
|
+
coreguard_verify_stellar_settlement_evidence: (a) => verifyStellarSettlementEvidence(a),
|
|
551
|
+
coreguard_verify_evm_settlement_evidence: (a) => verifyEvmSettlementEvidence(a),
|
|
552
|
+
coreguard_verify_coredao_settlement_evidence: (a) => verifyCoreDaoSettlementEvidence(a),
|
|
553
|
+
coreguard_verify_pi_payment_evidence: (a) => verifyPiPaymentEvidence(a),
|
|
554
|
+
coreguard_assess_bridge_risk: (a) => assessBridgeRisk(a),
|
|
555
|
+
coreguard_assess_defi_position_risk: (a) => assessDefiPositionRisk(a),
|
|
556
|
+
coreguard_verify_web3_signature_evidence: (a) => verifyWeb3SignatureEvidence(a),
|
|
557
|
+
coreguard_verify_stablecoin_reserve_evidence: (a) => verifyStablecoinReserveEvidence(a),
|
|
558
|
+
coreguard_create_robot_mission_receipt: (a) => createRobotMissionReceipt(a),
|
|
559
|
+
coreguard_verify_robot_mission_evidence: (a) => verifyRobotMissionEvidence(a),
|
|
560
|
+
coreguard_assess_machine_sla: (a) => assessMachineSla(a),
|
|
561
|
+
coreguard_assess_loan_application: (a) => assessLoanApplication(a),
|
|
562
|
+
coreguard_verify_collateral_packet: (a) => verifyCollateralPacket(a),
|
|
563
|
+
coreguard_assess_credit_line_utilization: (a) => assessCreditLineUtilization(a),
|
|
564
|
+
coreguard_verify_escrow_milestone: (a) => verifyEscrowMilestone(a),
|
|
565
|
+
coreguard_create_incident_war_room: (a) => createIncidentWarRoom(a),
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
export const WAVE4_VALIDATORS = Object.freeze({
|
|
569
|
+
coreguard_parse_iso20022_payment: (a) => (isObj(a.message) ? null : { code: "MISSING_ARGUMENT", detail: "message is required and must be an object" }),
|
|
570
|
+
coreguard_verify_cross_border_instruction: (a) => (isObj(a.instruction) && isObj(a.policy) ? null : { code: "MISSING_ARGUMENT", detail: "instruction and policy are required objects" }),
|
|
571
|
+
coreguard_assess_fx_quote_risk: (a) => (isObj(a.quote) && isObj(a.policy) && typeof a.nowSeconds === "string" ? null : { code: "MISSING_ARGUMENT", detail: "quote, policy, nowSeconds required" }),
|
|
572
|
+
coreguard_verify_swift_remittance_evidence: (a) => (isObj(a.evidence) && isObj(a.expected) ? null : { code: "MISSING_ARGUMENT", detail: "evidence and expected are required objects" }),
|
|
573
|
+
coreguard_verify_bank_transfer_evidence: (a) => (isObj(a.evidence) && isObj(a.expected) ? null : { code: "MISSING_ARGUMENT", detail: "evidence and expected are required objects" }),
|
|
574
|
+
coreguard_assess_sanctions_screening_evidence: (a) => (isObj(a.evidence) && isObj(a.policy) && typeof a.nowSeconds === "string" ? null : { code: "MISSING_ARGUMENT", detail: "evidence, policy, nowSeconds required" }),
|
|
575
|
+
coreguard_verify_invoice_match: (a) => (isObj(a.invoice) && isObj(a.payment) ? null : { code: "MISSING_ARGUMENT", detail: "invoice and payment are required objects" }),
|
|
576
|
+
coreguard_generate_payment_compliance_packet: (a) => (isObj(a.payment) ? null : { code: "MISSING_ARGUMENT", detail: "payment is required and must be an object" }),
|
|
577
|
+
coreguard_verify_stellar_settlement_evidence: (a) => (isObj(a.evidence) && isObj(a.expected) ? null : { code: "MISSING_ARGUMENT", detail: "evidence and expected are required objects" }),
|
|
578
|
+
coreguard_verify_evm_settlement_evidence: (a) => (isObj(a.evidence) && isObj(a.expected) ? null : { code: "MISSING_ARGUMENT", detail: "evidence and expected are required objects" }),
|
|
579
|
+
coreguard_verify_coredao_settlement_evidence: (a) => (isObj(a.evidence) ? null : { code: "MISSING_ARGUMENT", detail: "evidence is required and must be an object" }),
|
|
580
|
+
coreguard_verify_pi_payment_evidence: (a) => (isObj(a.evidence) && isObj(a.expected) ? null : { code: "MISSING_ARGUMENT", detail: "evidence and expected are required objects" }),
|
|
581
|
+
coreguard_assess_bridge_risk: (a) => (isObj(a.route) && isObj(a.policy) && typeof a.nowSeconds === "string" ? null : { code: "MISSING_ARGUMENT", detail: "route, policy, nowSeconds required" }),
|
|
582
|
+
coreguard_assess_defi_position_risk: (a) => (isObj(a.position) && isObj(a.policy) && typeof a.nowSeconds === "string" ? null : { code: "MISSING_ARGUMENT", detail: "position, policy, nowSeconds required" }),
|
|
583
|
+
coreguard_verify_web3_signature_evidence: (a) => (isObj(a.evidence) ? null : { code: "MISSING_ARGUMENT", detail: "evidence is required and must be an object" }),
|
|
584
|
+
coreguard_verify_stablecoin_reserve_evidence: (a) => (isObj(a.evidence) && isObj(a.policy) && typeof a.nowSeconds === "string" ? null : { code: "MISSING_ARGUMENT", detail: "evidence, policy, nowSeconds required" }),
|
|
585
|
+
coreguard_create_robot_mission_receipt: (a) => (isObj(a.mission) && isObj(a.policy) && typeof a.nowSeconds === "string" ? null : { code: "MISSING_ARGUMENT", detail: "mission, policy, nowSeconds required" }),
|
|
586
|
+
coreguard_verify_robot_mission_evidence: (a) => (isObj(a.receipt) && isObj(a.evidence) ? null : { code: "MISSING_ARGUMENT", detail: "receipt and evidence are required objects" }),
|
|
587
|
+
coreguard_assess_machine_sla: (a) => (Array.isArray(a.events) ? null : { code: "MISSING_ARGUMENT", detail: "events is required and must be an array" }),
|
|
588
|
+
coreguard_assess_loan_application: (a) => (isObj(a.application) && isObj(a.policy) ? null : { code: "MISSING_ARGUMENT", detail: "application and policy are required objects" }),
|
|
589
|
+
coreguard_verify_collateral_packet: (a) => (isObj(a.collateral) && isObj(a.policy) && typeof a.nowSeconds === "string" ? null : { code: "MISSING_ARGUMENT", detail: "collateral, policy, nowSeconds required" }),
|
|
590
|
+
coreguard_assess_credit_line_utilization: (a) => (isObj(a.line) ? null : { code: "MISSING_ARGUMENT", detail: "line is required and must be an object" }),
|
|
591
|
+
coreguard_verify_escrow_milestone: (a) => (isObj(a.escrow) && isObj(a.milestone) ? null : { code: "MISSING_ARGUMENT", detail: "escrow and milestone are required objects" }),
|
|
592
|
+
coreguard_create_incident_war_room: (a) => (isObj(a.incident) ? null : { code: "MISSING_ARGUMENT", detail: "incident is required and must be an object" }),
|
|
593
|
+
});
|