x402-trust-layer 5.1.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/CHANGELOG.md +55 -0
- package/DEPLOY.md +53 -0
- package/Dockerfile +30 -0
- package/LICENSE +21 -0
- package/README.md +294 -0
- package/dist/agents/a2a-payment.d.ts +37 -0
- package/dist/agents/a2a-payment.js +105 -0
- package/dist/agents/agent-escrow.d.ts +30 -0
- package/dist/agents/agent-escrow.js +23 -0
- package/dist/agents/agent-verify.d.ts +15 -0
- package/dist/agents/agent-verify.js +112 -0
- package/dist/agents/api-router.d.ts +32 -0
- package/dist/agents/api-router.js +228 -0
- package/dist/agents/attestation-registry.d.ts +35 -0
- package/dist/agents/attestation-registry.js +76 -0
- package/dist/agents/audition-coach.d.ts +45 -0
- package/dist/agents/audition-coach.js +257 -0
- package/dist/agents/bedrock-bridge.d.ts +3 -0
- package/dist/agents/bedrock-bridge.js +60 -0
- package/dist/agents/budget-allocator.d.ts +24 -0
- package/dist/agents/budget-allocator.js +31 -0
- package/dist/agents/compliance-ledger.d.ts +66 -0
- package/dist/agents/compliance-ledger.js +80 -0
- package/dist/agents/dispute-resolver.d.ts +62 -0
- package/dist/agents/dispute-resolver.js +124 -0
- package/dist/agents/evidence-locker.d.ts +30 -0
- package/dist/agents/evidence-locker.js +47 -0
- package/dist/agents/facilitator-failover.d.ts +15 -0
- package/dist/agents/facilitator-failover.js +18 -0
- package/dist/agents/identity-gate.d.ts +20 -0
- package/dist/agents/identity-gate.js +79 -0
- package/dist/agents/mandate-compiler.d.ts +51 -0
- package/dist/agents/mandate-compiler.js +73 -0
- package/dist/agents/mandate-diff.d.ts +41 -0
- package/dist/agents/mandate-diff.js +170 -0
- package/dist/agents/market-buy-advisor.d.ts +65 -0
- package/dist/agents/market-buy-advisor.js +234 -0
- package/dist/agents/merchant-trust.d.ts +38 -0
- package/dist/agents/merchant-trust.js +171 -0
- package/dist/agents/mpp-session-broker.d.ts +27 -0
- package/dist/agents/mpp-session-broker.js +29 -0
- package/dist/agents/mpp-session-v2.d.ts +76 -0
- package/dist/agents/mpp-session-v2.js +269 -0
- package/dist/agents/payment-intent-compiler.d.ts +21 -0
- package/dist/agents/payment-intent-compiler.js +45 -0
- package/dist/agents/pipeline-execute.d.ts +40 -0
- package/dist/agents/pipeline-execute.js +100 -0
- package/dist/agents/pipeline-trust-v2.d.ts +31 -0
- package/dist/agents/pipeline-trust-v2.js +111 -0
- package/dist/agents/pre-x402-guard.d.ts +35 -0
- package/dist/agents/pre-x402-guard.js +84 -0
- package/dist/agents/quality-escrow-semantic.d.ts +88 -0
- package/dist/agents/quality-escrow-semantic.js +137 -0
- package/dist/agents/quality-escrow.d.ts +65 -0
- package/dist/agents/quality-escrow.js +104 -0
- package/dist/agents/quality-monitor.d.ts +32 -0
- package/dist/agents/quality-monitor.js +77 -0
- package/dist/agents/rail-optimizer.d.ts +33 -0
- package/dist/agents/rail-optimizer.js +133 -0
- package/dist/agents/receipt-auditor.d.ts +14 -0
- package/dist/agents/receipt-auditor.js +145 -0
- package/dist/agents/refund-arbiter.d.ts +24 -0
- package/dist/agents/refund-arbiter.js +70 -0
- package/dist/agents/research-brief.d.ts +14 -0
- package/dist/agents/research-brief.js +66 -0
- package/dist/agents/risk-gate.d.ts +11 -0
- package/dist/agents/risk-gate.js +78 -0
- package/dist/agents/settlement-graph.d.ts +16 -0
- package/dist/agents/settlement-graph.js +38 -0
- package/dist/agents/spend-governor.d.ts +2 -0
- package/dist/agents/spend-governor.js +70 -0
- package/dist/agents/trust-network.d.ts +138 -0
- package/dist/agents/trust-network.js +244 -0
- package/dist/agents/x402-proxy.d.ts +32 -0
- package/dist/agents/x402-proxy.js +90 -0
- package/dist/client/demo-alchemy-live.d.ts +1 -0
- package/dist/client/demo-alchemy-live.js +226 -0
- package/dist/client/demo-tail.d.ts +1 -0
- package/dist/client/demo-tail.js +100 -0
- package/dist/client/demo.d.ts +1 -0
- package/dist/client/demo.js +293 -0
- package/dist/config.d.ts +94 -0
- package/dist/config.js +223 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +389 -0
- package/dist/lib/agent-response.d.ts +14 -0
- package/dist/lib/agent-response.js +13 -0
- package/dist/lib/agentic-gateways.d.ts +5 -0
- package/dist/lib/agentic-gateways.js +15 -0
- package/dist/lib/agentic-probes.d.ts +10 -0
- package/dist/lib/agentic-probes.js +49 -0
- package/dist/lib/alchemy-x402-fetch.d.ts +16 -0
- package/dist/lib/alchemy-x402-fetch.js +95 -0
- package/dist/lib/apply-verifier-body.d.ts +7 -0
- package/dist/lib/apply-verifier-body.js +179 -0
- package/dist/lib/attestation.d.ts +30 -0
- package/dist/lib/attestation.js +107 -0
- package/dist/lib/bazaar-extension.d.ts +15 -0
- package/dist/lib/bazaar-extension.js +265 -0
- package/dist/lib/bazaar.d.ts +100 -0
- package/dist/lib/bazaar.js +341 -0
- package/dist/lib/certified-sellers.d.ts +41 -0
- package/dist/lib/certified-sellers.js +129 -0
- package/dist/lib/chains.d.ts +20 -0
- package/dist/lib/chains.js +78 -0
- package/dist/lib/db-persistence.d.ts +7 -0
- package/dist/lib/db-persistence.js +65 -0
- package/dist/lib/db.d.ts +5 -0
- package/dist/lib/db.js +113 -0
- package/dist/lib/discovery-page.d.ts +2 -0
- package/dist/lib/discovery-page.js +71 -0
- package/dist/lib/ecosystem-telemetry.d.ts +20 -0
- package/dist/lib/ecosystem-telemetry.js +80 -0
- package/dist/lib/erc8004/agent-card.d.ts +34 -0
- package/dist/lib/erc8004/agent-card.js +151 -0
- package/dist/lib/erc8004/cache.d.ts +3 -0
- package/dist/lib/erc8004/cache.js +17 -0
- package/dist/lib/erc8004/constants.d.ts +22 -0
- package/dist/lib/erc8004/constants.js +35 -0
- package/dist/lib/erc8004/registry.d.ts +19 -0
- package/dist/lib/erc8004/registry.js +171 -0
- package/dist/lib/erc8004/resolve-agent.d.ts +7 -0
- package/dist/lib/erc8004/resolve-agent.js +70 -0
- package/dist/lib/erc8004/trust-score.d.ts +33 -0
- package/dist/lib/erc8004/trust-score.js +136 -0
- package/dist/lib/escrow-ledger.d.ts +14 -0
- package/dist/lib/escrow-ledger.js +54 -0
- package/dist/lib/escrow-unified.d.ts +15 -0
- package/dist/lib/escrow-unified.js +28 -0
- package/dist/lib/facilitator-extra.d.ts +13 -0
- package/dist/lib/facilitator-extra.js +52 -0
- package/dist/lib/facilitators.d.ts +20 -0
- package/dist/lib/facilitators.js +89 -0
- package/dist/lib/host-policy.d.ts +4 -0
- package/dist/lib/host-policy.js +20 -0
- package/dist/lib/idempotency.d.ts +4 -0
- package/dist/lib/idempotency.js +120 -0
- package/dist/lib/ledger.d.ts +2 -0
- package/dist/lib/ledger.js +17 -0
- package/dist/lib/logger.d.ts +6 -0
- package/dist/lib/logger.js +24 -0
- package/dist/lib/mandate-vc.d.ts +20 -0
- package/dist/lib/mandate-vc.js +25 -0
- package/dist/lib/mandate.d.ts +44 -0
- package/dist/lib/mandate.js +190 -0
- package/dist/lib/marketplace.d.ts +7 -0
- package/dist/lib/marketplace.js +127 -0
- package/dist/lib/migrations.d.ts +2 -0
- package/dist/lib/migrations.js +130 -0
- package/dist/lib/nonce-store.d.ts +6 -0
- package/dist/lib/nonce-store.js +109 -0
- package/dist/lib/openapi-agentcash.d.ts +5 -0
- package/dist/lib/openapi-agentcash.js +288 -0
- package/dist/lib/openapi-meta.d.ts +5 -0
- package/dist/lib/openapi-meta.js +235 -0
- package/dist/lib/otel.d.ts +2 -0
- package/dist/lib/otel.js +25 -0
- package/dist/lib/paid-resource-url.d.ts +6 -0
- package/dist/lib/paid-resource-url.js +47 -0
- package/dist/lib/parse-with-verifier-fallback.d.ts +3 -0
- package/dist/lib/parse-with-verifier-fallback.js +13 -0
- package/dist/lib/payment-request-context.d.ts +10 -0
- package/dist/lib/payment-request-context.js +5 -0
- package/dist/lib/payment-response.d.ts +13 -0
- package/dist/lib/payment-response.js +39 -0
- package/dist/lib/payto-guard.d.ts +10 -0
- package/dist/lib/payto-guard.js +20 -0
- package/dist/lib/probe.d.ts +29 -0
- package/dist/lib/probe.js +157 -0
- package/dist/lib/problem-detail.d.ts +10 -0
- package/dist/lib/problem-detail.js +14 -0
- package/dist/lib/rate-limit.d.ts +12 -0
- package/dist/lib/rate-limit.js +126 -0
- package/dist/lib/replay-middleware.d.ts +3 -0
- package/dist/lib/replay-middleware.js +27 -0
- package/dist/lib/response-guard.d.ts +5 -0
- package/dist/lib/response-guard.js +40 -0
- package/dist/lib/safe-fetch.d.ts +5 -0
- package/dist/lib/safe-fetch.js +19 -0
- package/dist/lib/security.d.ts +13 -0
- package/dist/lib/security.js +61 -0
- package/dist/lib/semantic-judge.d.ts +14 -0
- package/dist/lib/semantic-judge.js +107 -0
- package/dist/lib/semantic-judge.test.d.ts +1 -0
- package/dist/lib/semantic-judge.test.js +11 -0
- package/dist/lib/ssrf.d.ts +10 -0
- package/dist/lib/ssrf.js +130 -0
- package/dist/lib/ssrf.test.d.ts +1 -0
- package/dist/lib/ssrf.test.js +16 -0
- package/dist/lib/suite-catalog.d.ts +83 -0
- package/dist/lib/suite-catalog.js +131 -0
- package/dist/lib/telemetry.d.ts +5 -0
- package/dist/lib/telemetry.js +37 -0
- package/dist/lib/verifier-fast-path.d.ts +10 -0
- package/dist/lib/verifier-fast-path.js +44 -0
- package/dist/lib/verifier-probe-protocol.d.ts +7 -0
- package/dist/lib/verifier-probe-protocol.js +115 -0
- package/dist/lib/verify-examples.d.ts +2 -0
- package/dist/lib/verify-examples.js +438 -0
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.js +2 -0
- package/dist/lib/webhook-auth.d.ts +3 -0
- package/dist/lib/webhook-auth.js +34 -0
- package/dist/lib/webhook-routes.d.ts +2 -0
- package/dist/lib/webhook-routes.js +112 -0
- package/dist/lib/webhooks.d.ts +23 -0
- package/dist/lib/webhooks.js +123 -0
- package/dist/lib/webhooks.test.d.ts +1 -0
- package/dist/lib/webhooks.test.js +16 -0
- package/dist/lib/x402-client-options.d.ts +28 -0
- package/dist/lib/x402-client-options.js +138 -0
- package/dist/lib/x402-headers.d.ts +10 -0
- package/dist/lib/x402-headers.js +27 -0
- package/dist/lib/x402-paid.d.ts +5 -0
- package/dist/lib/x402-paid.js +252 -0
- package/dist/lib/x402-payment-replay.d.ts +22 -0
- package/dist/lib/x402-payment-replay.js +57 -0
- package/dist/lib/x402gle-host-verify.d.ts +3 -0
- package/dist/lib/x402gle-host-verify.js +27 -0
- package/dist/protocol/agent-passport.d.ts +34 -0
- package/dist/protocol/agent-passport.js +44 -0
- package/dist/protocol/compliance-v2.d.ts +21 -0
- package/dist/protocol/compliance-v2.js +19 -0
- package/dist/protocol/credit-bureau.d.ts +18 -0
- package/dist/protocol/credit-bureau.js +44 -0
- package/dist/protocol/crypto.d.ts +6 -0
- package/dist/protocol/crypto.js +41 -0
- package/dist/protocol/escrow-fsm.d.ts +33 -0
- package/dist/protocol/escrow-fsm.js +99 -0
- package/dist/protocol/fraud-engine.d.ts +28 -0
- package/dist/protocol/fraud-engine.js +77 -0
- package/dist/protocol/observability.d.ts +14 -0
- package/dist/protocol/observability.js +21 -0
- package/dist/protocol/pipeline-full-trust.d.ts +40 -0
- package/dist/protocol/pipeline-full-trust.js +96 -0
- package/dist/protocol/proof-of-execution.d.ts +36 -0
- package/dist/protocol/proof-of-execution.js +48 -0
- package/dist/protocol/reasoning-audit.d.ts +27 -0
- package/dist/protocol/reasoning-audit.js +51 -0
- package/dist/protocol/replay-guard.d.ts +28 -0
- package/dist/protocol/replay-guard.js +76 -0
- package/dist/protocol/replay-guard.test.d.ts +1 -0
- package/dist/protocol/replay-guard.test.js +10 -0
- package/dist/protocol/security-audit.d.ts +18 -0
- package/dist/protocol/security-audit.js +45 -0
- package/dist/protocol/store.d.ts +5 -0
- package/dist/protocol/store.js +59 -0
- package/dist/protocol/threat-catalog.d.ts +13 -0
- package/dist/protocol/threat-catalog.js +75 -0
- package/dist/protocol/trust-oracle.d.ts +23 -0
- package/dist/protocol/trust-oracle.js +30 -0
- package/dist/protocol/trust-score-v2.d.ts +33 -0
- package/dist/protocol/trust-score-v2.js +78 -0
- package/dist/protocol/zk-proofs.d.ts +24 -0
- package/dist/protocol/zk-proofs.js +32 -0
- package/dist/routes/a2a-agent-card.d.ts +3 -0
- package/dist/routes/a2a-agent-card.js +28 -0
- package/dist/routes/catalog.d.ts +5 -0
- package/dist/routes/catalog.js +47 -0
- package/dist/routes/register-all.d.ts +3 -0
- package/dist/routes/register-all.js +1240 -0
- package/dist/routes/schemas.d.ts +83 -0
- package/dist/routes/schemas.js +38 -0
- package/dist/routes/shared.d.ts +16 -0
- package/dist/routes/shared.js +27 -0
- package/dist/routes-protocol.d.ts +10 -0
- package/dist/routes-protocol.js +322 -0
- package/dist/routes.d.ts +2 -0
- package/dist/routes.js +2 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.js +1 -0
- package/openapi.json +7940 -0
- package/package.json +124 -0
- package/public/.well-known/ai-plugin.json +12 -0
- package/public/assets/aegis-logo-blue.png +0 -0
- package/public/assets/aegis-logo-gold.png +0 -0
- package/public/assets/aegis-logo-green.png +0 -0
- package/public/assets/aegis-logo-purple.png +0 -0
- package/public/assets/aegis-logo-red.png +0 -0
- package/public/assets/aegis-logo-white.png +0 -0
- package/public/assets/aegis-logo.png +0 -0
- package/public/assets/x402-trustlayer-logo.png +0 -0
- package/public/assets/x402-trustlayer-logo.svg +5 -0
- package/public/data/agents.json +1528 -0
- package/public/index.html +198 -0
- package/public/landing.css +342 -0
- package/public/landing.js +405 -0
- package/public/llms-full.txt +582 -0
- package/public/llms.txt +132 -0
- package/public/skill.md +135 -0
- package/railway.toml +9 -0
- package/scripts/docker-entrypoint.sh +7 -0
- package/scripts/patch-facilitator-timeout.mjs +61 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export type SuiteStep = {
|
|
2
|
+
step: number;
|
|
3
|
+
agent: string;
|
|
4
|
+
method: string;
|
|
5
|
+
path: string;
|
|
6
|
+
priceUsdc: number;
|
|
7
|
+
purpose: string;
|
|
8
|
+
};
|
|
9
|
+
/** Buyer onboarding — only these three in README / INTEGRATE lead */
|
|
10
|
+
export declare const PRIMARY_ENTRYPOINTS: readonly [{
|
|
11
|
+
readonly path: "/api/x402/proxy";
|
|
12
|
+
readonly method: "POST";
|
|
13
|
+
readonly priceUsdc: 0.08;
|
|
14
|
+
readonly label: "Default preflight (guard + probe + optional attestation)";
|
|
15
|
+
}, {
|
|
16
|
+
readonly path: "/api/guard/pre-x402";
|
|
17
|
+
readonly method: "POST";
|
|
18
|
+
readonly priceUsdc: 0.05;
|
|
19
|
+
readonly label: "Lightweight bundle (spend + identity + risk)";
|
|
20
|
+
}, {
|
|
21
|
+
readonly path: "/api/pipeline/execute";
|
|
22
|
+
readonly method: "POST";
|
|
23
|
+
readonly priceUsdc: 0.25;
|
|
24
|
+
readonly label: "Full orchestration for multi-step tasks";
|
|
25
|
+
}];
|
|
26
|
+
/** Seller / marketplace growth */
|
|
27
|
+
export declare const KILLER_SELLER_ENDPOINTS: readonly [{
|
|
28
|
+
readonly path: "/api/market/buy-advisor";
|
|
29
|
+
readonly method: "POST";
|
|
30
|
+
readonly priceUsdc: 0.08;
|
|
31
|
+
readonly label: "Rank paid APIs before you spend (Jupiter-style quote)";
|
|
32
|
+
}, {
|
|
33
|
+
readonly path: "/api/seller/audition-coach";
|
|
34
|
+
readonly method: "POST";
|
|
35
|
+
readonly priceUsdc: 0.06;
|
|
36
|
+
readonly label: "Pre-audition fix list before Dexter ingest";
|
|
37
|
+
}];
|
|
38
|
+
export declare const SUITE_PRICES: {
|
|
39
|
+
readonly spendGovernor: 0.03;
|
|
40
|
+
readonly receiptAuditor: 0.05;
|
|
41
|
+
readonly riskGate: 0.08;
|
|
42
|
+
readonly apiRouter: 0.02;
|
|
43
|
+
readonly researchBrief: 0.2;
|
|
44
|
+
readonly paymentCompiler: 0.15;
|
|
45
|
+
readonly facilitatorFailover: 0.05;
|
|
46
|
+
readonly mppBroker: 0.02;
|
|
47
|
+
readonly refundArbiter: 0.08;
|
|
48
|
+
readonly budgetAllocator: 0.03;
|
|
49
|
+
readonly settlementGraph: 0.02;
|
|
50
|
+
readonly qualityMonitor: 0.03;
|
|
51
|
+
readonly identityGate: 0.05;
|
|
52
|
+
readonly evidenceLocker: 0.1;
|
|
53
|
+
readonly agentEscrow: 0.12;
|
|
54
|
+
readonly preX402Guard: 0.05;
|
|
55
|
+
readonly pipelineExecute: 0.25;
|
|
56
|
+
readonly x402Proxy: 0.08;
|
|
57
|
+
readonly mppSessionV2: 0.03;
|
|
58
|
+
readonly attestationIssue: 0.04;
|
|
59
|
+
readonly attestationVerify: 0.02;
|
|
60
|
+
readonly trustRegistry: 0.02;
|
|
61
|
+
readonly marketBuyAdvisor: 0.08;
|
|
62
|
+
readonly auditionCoach: 0.06;
|
|
63
|
+
readonly agentVerify: 0.04;
|
|
64
|
+
readonly merchantTrust: 0.06;
|
|
65
|
+
readonly mandateCompile: 0.08;
|
|
66
|
+
readonly mandateVerify: 0.02;
|
|
67
|
+
readonly railOptimizer: 0.04;
|
|
68
|
+
readonly complianceLedger: 0.12;
|
|
69
|
+
readonly disputeResolve: 0.1;
|
|
70
|
+
readonly qualityEscrow: 0.1;
|
|
71
|
+
readonly mandateDiff: 0.04;
|
|
72
|
+
readonly qualityEscrowSemantic: 0.12;
|
|
73
|
+
readonly merchantCertify: 0.15;
|
|
74
|
+
readonly buyerGate: 0.03;
|
|
75
|
+
readonly pipelineTrustV2: 0.35;
|
|
76
|
+
readonly bondSlash: 0.03;
|
|
77
|
+
};
|
|
78
|
+
export declare function suiteUrl(path: string): string;
|
|
79
|
+
export declare function buildDefaultPipeline(options: {
|
|
80
|
+
includeResearch: boolean;
|
|
81
|
+
includeRouter: boolean;
|
|
82
|
+
externalCallEstimateUsdc: number;
|
|
83
|
+
}): SuiteStep[];
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { config } from "../config.js";
|
|
2
|
+
/** Buyer onboarding — only these three in README / INTEGRATE lead */
|
|
3
|
+
export const PRIMARY_ENTRYPOINTS = [
|
|
4
|
+
{
|
|
5
|
+
path: "/api/x402/proxy",
|
|
6
|
+
method: "POST",
|
|
7
|
+
priceUsdc: 0.08,
|
|
8
|
+
label: "Default preflight (guard + probe + optional attestation)",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
path: "/api/guard/pre-x402",
|
|
12
|
+
method: "POST",
|
|
13
|
+
priceUsdc: 0.05,
|
|
14
|
+
label: "Lightweight bundle (spend + identity + risk)",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
path: "/api/pipeline/execute",
|
|
18
|
+
method: "POST",
|
|
19
|
+
priceUsdc: 0.25,
|
|
20
|
+
label: "Full orchestration for multi-step tasks",
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
/** Seller / marketplace growth */
|
|
24
|
+
export const KILLER_SELLER_ENDPOINTS = [
|
|
25
|
+
{
|
|
26
|
+
path: "/api/market/buy-advisor",
|
|
27
|
+
method: "POST",
|
|
28
|
+
priceUsdc: 0.08,
|
|
29
|
+
label: "Rank paid APIs before you spend (Jupiter-style quote)",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
path: "/api/seller/audition-coach",
|
|
33
|
+
method: "POST",
|
|
34
|
+
priceUsdc: 0.06,
|
|
35
|
+
label: "Pre-audition fix list before Dexter ingest",
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
export const SUITE_PRICES = {
|
|
39
|
+
spendGovernor: 0.03,
|
|
40
|
+
receiptAuditor: 0.05,
|
|
41
|
+
riskGate: 0.08,
|
|
42
|
+
apiRouter: 0.02,
|
|
43
|
+
researchBrief: 0.2,
|
|
44
|
+
paymentCompiler: 0.15,
|
|
45
|
+
facilitatorFailover: 0.05,
|
|
46
|
+
mppBroker: 0.02,
|
|
47
|
+
refundArbiter: 0.08,
|
|
48
|
+
budgetAllocator: 0.03,
|
|
49
|
+
settlementGraph: 0.02,
|
|
50
|
+
qualityMonitor: 0.03,
|
|
51
|
+
identityGate: 0.05,
|
|
52
|
+
evidenceLocker: 0.1,
|
|
53
|
+
agentEscrow: 0.12,
|
|
54
|
+
preX402Guard: 0.05,
|
|
55
|
+
pipelineExecute: 0.25,
|
|
56
|
+
x402Proxy: 0.08,
|
|
57
|
+
mppSessionV2: 0.03,
|
|
58
|
+
attestationIssue: 0.04,
|
|
59
|
+
attestationVerify: 0.02,
|
|
60
|
+
trustRegistry: 0.02,
|
|
61
|
+
marketBuyAdvisor: 0.08,
|
|
62
|
+
auditionCoach: 0.06,
|
|
63
|
+
agentVerify: 0.04,
|
|
64
|
+
merchantTrust: 0.06,
|
|
65
|
+
mandateCompile: 0.08,
|
|
66
|
+
mandateVerify: 0.02,
|
|
67
|
+
railOptimizer: 0.04,
|
|
68
|
+
complianceLedger: 0.12,
|
|
69
|
+
disputeResolve: 0.1,
|
|
70
|
+
qualityEscrow: 0.1,
|
|
71
|
+
mandateDiff: 0.04,
|
|
72
|
+
qualityEscrowSemantic: 0.12,
|
|
73
|
+
merchantCertify: 0.15,
|
|
74
|
+
buyerGate: 0.03,
|
|
75
|
+
pipelineTrustV2: 0.35,
|
|
76
|
+
bondSlash: 0.03,
|
|
77
|
+
};
|
|
78
|
+
export function suiteUrl(path) {
|
|
79
|
+
return `${config.publicBaseUrl}${path}`;
|
|
80
|
+
}
|
|
81
|
+
export function buildDefaultPipeline(options) {
|
|
82
|
+
const steps = [
|
|
83
|
+
{
|
|
84
|
+
step: 1,
|
|
85
|
+
agent: "pre-x402-guard",
|
|
86
|
+
method: "POST",
|
|
87
|
+
path: "/api/guard/pre-x402",
|
|
88
|
+
priceUsdc: SUITE_PRICES.preX402Guard,
|
|
89
|
+
purpose: "Single call: spend + identity + risk before any x402 payment",
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
if (options.includeRouter) {
|
|
93
|
+
steps.push({
|
|
94
|
+
step: steps.length + 1,
|
|
95
|
+
agent: "api-router",
|
|
96
|
+
method: "POST",
|
|
97
|
+
path: "/api/router/route",
|
|
98
|
+
priceUsdc: SUITE_PRICES.apiRouter,
|
|
99
|
+
purpose: "Select best marketplace API for capability",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (options.externalCallEstimateUsdc > 0) {
|
|
103
|
+
steps.push({
|
|
104
|
+
step: steps.length + 1,
|
|
105
|
+
agent: "external-x402",
|
|
106
|
+
method: "POST",
|
|
107
|
+
path: "(marketplace-selected-url)",
|
|
108
|
+
priceUsdc: options.externalCallEstimateUsdc,
|
|
109
|
+
purpose: "Execute downstream paid API call",
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (options.includeResearch) {
|
|
113
|
+
steps.push({
|
|
114
|
+
step: steps.length + 1,
|
|
115
|
+
agent: "research-brief",
|
|
116
|
+
method: "POST",
|
|
117
|
+
path: "/api/research/brief",
|
|
118
|
+
priceUsdc: SUITE_PRICES.researchBrief,
|
|
119
|
+
purpose: "Build research pipeline and cost estimate",
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
steps.push({
|
|
123
|
+
step: steps.length + 1,
|
|
124
|
+
agent: "receipt-auditor",
|
|
125
|
+
method: "POST",
|
|
126
|
+
path: "/api/receipt-auditor/verify",
|
|
127
|
+
priceUsdc: SUITE_PRICES.receiptAuditor,
|
|
128
|
+
purpose: "Verify settlement receipt on-chain",
|
|
129
|
+
});
|
|
130
|
+
return steps;
|
|
131
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type CounterName = "http_requests" | "x402_settlements" | "x402_settlement_failures" | "replay_blocked" | "idempotency_replay";
|
|
2
|
+
export declare function incCounter(name: CounterName, delta?: number): void;
|
|
3
|
+
export declare function telemetryMiddleware(_req: import("express").Request, _res: import("express").Response, next: import("express").NextFunction): void;
|
|
4
|
+
export declare function metricsPayload(): Record<string, unknown>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { db } from "./db.js";
|
|
2
|
+
const incStmt = db.prepare(`
|
|
3
|
+
INSERT INTO telemetry_counters(name, value) VALUES(?, ?)
|
|
4
|
+
ON CONFLICT(name) DO UPDATE SET value = value + ?, updated_at = unixepoch()
|
|
5
|
+
`);
|
|
6
|
+
const startedAt = Date.now();
|
|
7
|
+
export function incCounter(name, delta = 1) {
|
|
8
|
+
incStmt.run(name, delta, delta);
|
|
9
|
+
}
|
|
10
|
+
export function telemetryMiddleware(_req, _res, next) {
|
|
11
|
+
incCounter("http_requests");
|
|
12
|
+
next();
|
|
13
|
+
}
|
|
14
|
+
export function metricsPayload() {
|
|
15
|
+
const rows = db
|
|
16
|
+
.prepare("SELECT name, value FROM telemetry_counters")
|
|
17
|
+
.all();
|
|
18
|
+
const counters = {
|
|
19
|
+
http_requests: 0,
|
|
20
|
+
x402_settlements: 0,
|
|
21
|
+
x402_settlement_failures: 0,
|
|
22
|
+
replay_blocked: 0,
|
|
23
|
+
idempotency_replay: 0,
|
|
24
|
+
};
|
|
25
|
+
for (const r of rows)
|
|
26
|
+
counters[r.name] = r.value;
|
|
27
|
+
return {
|
|
28
|
+
service: "x402-trust-layer",
|
|
29
|
+
uptimeSec: Math.floor((Date.now() - startedAt) / 1000),
|
|
30
|
+
counters,
|
|
31
|
+
nonceBackend: process.env.REDIS_URL
|
|
32
|
+
? "redis"
|
|
33
|
+
: process.env.UPSTASH_REDIS_REST_URL
|
|
34
|
+
? "upstash-rest"
|
|
35
|
+
: "sqlite",
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProbeResult } from "./probe.js";
|
|
2
|
+
/** Canonical agent id injected by applyVerifierExampleBody for x402gle / Dexter audits */
|
|
3
|
+
export declare const VERIFIER_AGENT_ID = "dexter-verifier-probe";
|
|
4
|
+
/**
|
|
5
|
+
* Synthetic probe fast path — only when explicitly enabled (ALLOW_VERIFIER_PROBE_IDS=1)
|
|
6
|
+
* or a matching X-Verifier-Fast-Path-Secret header is sent (VERIFIER_FAST_PATH_SECRET).
|
|
7
|
+
*/
|
|
8
|
+
export declare function isVerifierAgentId(agentId?: string, reqHeaders?: Record<string, unknown>): boolean;
|
|
9
|
+
/** Synthetic x402 probe — avoids slow outbound calls during marketplace verification. */
|
|
10
|
+
export declare function syntheticPaidProbe(targetUrl: string): ProbeResult;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { config } from "../config.js";
|
|
2
|
+
/** Canonical agent id injected by applyVerifierExampleBody for x402gle / Dexter audits */
|
|
3
|
+
export const VERIFIER_AGENT_ID = "dexter-verifier-probe";
|
|
4
|
+
const VERIFIER_HEADER = "x-verifier-fast-path-secret";
|
|
5
|
+
function headerSecretMatches(reqHeaders) {
|
|
6
|
+
const expected = config.verifierFastPathSecret;
|
|
7
|
+
if (!expected)
|
|
8
|
+
return false;
|
|
9
|
+
const raw = reqHeaders?.[VERIFIER_HEADER] ?? reqHeaders?.[VERIFIER_HEADER.toUpperCase()];
|
|
10
|
+
const provided = Array.isArray(raw) ? raw[0] : raw;
|
|
11
|
+
return typeof provided === "string" && provided.length > 0 && provided === expected;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Synthetic probe fast path — only when explicitly enabled (ALLOW_VERIFIER_PROBE_IDS=1)
|
|
15
|
+
* or a matching X-Verifier-Fast-Path-Secret header is sent (VERIFIER_FAST_PATH_SECRET).
|
|
16
|
+
*/
|
|
17
|
+
export function isVerifierAgentId(agentId, reqHeaders) {
|
|
18
|
+
if (agentId !== VERIFIER_AGENT_ID)
|
|
19
|
+
return false;
|
|
20
|
+
if (headerSecretMatches(reqHeaders))
|
|
21
|
+
return true;
|
|
22
|
+
return config.allowVerifierProbeIds;
|
|
23
|
+
}
|
|
24
|
+
/** Synthetic x402 probe — avoids slow outbound calls during marketplace verification. */
|
|
25
|
+
export function syntheticPaidProbe(targetUrl) {
|
|
26
|
+
return {
|
|
27
|
+
url: targetUrl,
|
|
28
|
+
status: 402,
|
|
29
|
+
requiresPayment: true,
|
|
30
|
+
authMode: "paid",
|
|
31
|
+
priceUsdc: 0.05,
|
|
32
|
+
network: "eip155:8453",
|
|
33
|
+
payTo: null,
|
|
34
|
+
paymentOptions: [
|
|
35
|
+
{
|
|
36
|
+
priceUsdc: 0.05,
|
|
37
|
+
network: "eip155:8453",
|
|
38
|
+
payTo: null,
|
|
39
|
+
scheme: "exact",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
warnings: ["synthetic_probe:verifier_fast_path"],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const VERIFIER_PROBE_PASSPORT_DID = "did:agent:dexter_verifier_probe:0000000000000001";
|
|
2
|
+
export declare const VERIFIER_PROBE_RECEIPT_ID = "poe_verifier_probe_example";
|
|
3
|
+
export declare const VERIFIER_PROBE_AUDIT_ID = "aud_verifier_probe_example";
|
|
4
|
+
export declare const VERIFIER_PROBE_ESCROW_ID = "00000000-0000-4000-8000-000000000001";
|
|
5
|
+
export declare const VERIFIER_PROBE_BINDING_ID = "rb_verifier_probe_example";
|
|
6
|
+
/** Stable protocol artifacts for x402gle verify-* paid probes. */
|
|
7
|
+
export declare function ensureVerifierProbeProtocol(): Promise<void>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { VERIFY_EXAMPLES } from "./verify-examples.js";
|
|
2
|
+
import { hmacSign } from "../protocol/crypto.js";
|
|
3
|
+
import { readProtocolStore, writeProtocolStore } from "../protocol/store.js";
|
|
4
|
+
export const VERIFIER_PROBE_PASSPORT_DID = "did:agent:dexter_verifier_probe:0000000000000001";
|
|
5
|
+
export const VERIFIER_PROBE_RECEIPT_ID = "poe_verifier_probe_example";
|
|
6
|
+
export const VERIFIER_PROBE_AUDIT_ID = "aud_verifier_probe_example";
|
|
7
|
+
export const VERIFIER_PROBE_ESCROW_ID = "00000000-0000-4000-8000-000000000001";
|
|
8
|
+
export const VERIFIER_PROBE_BINDING_ID = "rb_verifier_probe_example";
|
|
9
|
+
async function seedPassport() {
|
|
10
|
+
const store = await readProtocolStore("passports", {});
|
|
11
|
+
if (store[VERIFIER_PROBE_PASSPORT_DID])
|
|
12
|
+
return;
|
|
13
|
+
const payload = {
|
|
14
|
+
did: VERIFIER_PROBE_PASSPORT_DID,
|
|
15
|
+
agentId: "dexter-verifier-probe",
|
|
16
|
+
publicKey: "probe_public_key",
|
|
17
|
+
ownerIdentity: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
|
|
18
|
+
capabilities: ["x402.pay", "x402.preflight", "tool.invoke"],
|
|
19
|
+
permissions: ["spend:usdc", "attest:issue"],
|
|
20
|
+
metadata: { probe: true },
|
|
21
|
+
riskTier: "LOW",
|
|
22
|
+
reputationProfileId: "verifier_probe",
|
|
23
|
+
issuedAt: new Date().toISOString(),
|
|
24
|
+
credentialType: "AgentPassportVC",
|
|
25
|
+
};
|
|
26
|
+
const signature = hmacSign(JSON.stringify(payload));
|
|
27
|
+
store[VERIFIER_PROBE_PASSPORT_DID] = { ...payload, signature };
|
|
28
|
+
await writeProtocolStore("passports", store);
|
|
29
|
+
}
|
|
30
|
+
async function seedExecutionReceipt() {
|
|
31
|
+
const store = await readProtocolStore("execution-receipts", {});
|
|
32
|
+
if (store[VERIFIER_PROBE_RECEIPT_ID])
|
|
33
|
+
return;
|
|
34
|
+
const receipt = {
|
|
35
|
+
receiptId: VERIFIER_PROBE_RECEIPT_ID,
|
|
36
|
+
taskId: "verifier_probe_task",
|
|
37
|
+
executionHash: "exec_verifier_probe_hash",
|
|
38
|
+
toolTraceHash: "tool_verifier_probe_hash",
|
|
39
|
+
decisionTraceHash: "decision_verifier_probe_hash",
|
|
40
|
+
verificationProof: hmacSign(`${VERIFIER_PROBE_RECEIPT_ID}:exec_verifier_probe_hash:tool_verifier_probe_hash:decision_verifier_probe_hash`),
|
|
41
|
+
settlementProof: null,
|
|
42
|
+
issuedAt: new Date().toISOString(),
|
|
43
|
+
thirdPartyVerifyUrl: "https://x402trustlayer.xyz/api/protocol/execution/verify",
|
|
44
|
+
};
|
|
45
|
+
const payload = JSON.stringify(receipt);
|
|
46
|
+
store[VERIFIER_PROBE_RECEIPT_ID] = {
|
|
47
|
+
...receipt,
|
|
48
|
+
signature: hmacSign(payload),
|
|
49
|
+
payload,
|
|
50
|
+
};
|
|
51
|
+
await writeProtocolStore("execution-receipts", store);
|
|
52
|
+
}
|
|
53
|
+
async function seedReasoningAudit() {
|
|
54
|
+
const store = await readProtocolStore("reasoning-audits", {});
|
|
55
|
+
if (store[VERIFIER_PROBE_AUDIT_ID])
|
|
56
|
+
return;
|
|
57
|
+
const root = hmacSign("verifier_probe_merkle_root");
|
|
58
|
+
store[VERIFIER_PROBE_AUDIT_ID] = {
|
|
59
|
+
merkleRoot: root,
|
|
60
|
+
leaves: ["leaf_verifier_probe_0", "leaf_verifier_probe_1"],
|
|
61
|
+
agentId: "dexter-verifier-probe",
|
|
62
|
+
committedAt: new Date().toISOString(),
|
|
63
|
+
signature: hmacSign(`${VERIFIER_PROBE_AUDIT_ID}:${root}`),
|
|
64
|
+
};
|
|
65
|
+
await writeProtocolStore("reasoning-audits", store);
|
|
66
|
+
}
|
|
67
|
+
async function seedEscrow() {
|
|
68
|
+
const store = await readProtocolStore("escrow-fsm", {});
|
|
69
|
+
if (store[VERIFIER_PROBE_ESCROW_ID])
|
|
70
|
+
return;
|
|
71
|
+
const ex = VERIFY_EXAMPLES["/api/protocol/escrow/create"];
|
|
72
|
+
const now = new Date().toISOString();
|
|
73
|
+
store[VERIFIER_PROBE_ESCROW_ID] = {
|
|
74
|
+
escrowId: VERIFIER_PROBE_ESCROW_ID,
|
|
75
|
+
payerAgentId: String(ex.payerAgentId ?? "dexter-verifier-probe"),
|
|
76
|
+
payeeMerchant: String(ex.payeeMerchant ?? "api.myceliasignal.com"),
|
|
77
|
+
amountUsdc: Number(ex.amountUsdc ?? 0.05),
|
|
78
|
+
state: "CREATED",
|
|
79
|
+
resourceHash: String(ex.resourceHash ?? "res_verifier_probe"),
|
|
80
|
+
history: [{ state: "CREATED", at: now }],
|
|
81
|
+
createdAt: now,
|
|
82
|
+
updatedAt: now,
|
|
83
|
+
stateProof: hmacSign(`${VERIFIER_PROBE_ESCROW_ID}:CREATED:${now}`),
|
|
84
|
+
};
|
|
85
|
+
await writeProtocolStore("escrow-fsm", store);
|
|
86
|
+
}
|
|
87
|
+
async function seedReplayBinding() {
|
|
88
|
+
const store = await readProtocolStore("replay-bindings", {});
|
|
89
|
+
if (store[VERIFIER_PROBE_BINDING_ID])
|
|
90
|
+
return;
|
|
91
|
+
const ex = VERIFY_EXAMPLES["/api/protocol/replay/bind"];
|
|
92
|
+
const expiresAt = new Date(Date.now() + 3600_000).toISOString();
|
|
93
|
+
const payload = {
|
|
94
|
+
bindingId: VERIFIER_PROBE_BINDING_ID,
|
|
95
|
+
nonce: "nonce_verifier_probe",
|
|
96
|
+
resourceHash: hmacSign(`POST:${String(ex.resourceUrl ?? "")}`),
|
|
97
|
+
requestHash: hmacSign(JSON.stringify(ex.requestBody ?? {})),
|
|
98
|
+
agentId: String(ex.agentId ?? "dexter-verifier-probe"),
|
|
99
|
+
sessionId: "sess_verifier_probe",
|
|
100
|
+
expiresAt,
|
|
101
|
+
};
|
|
102
|
+
store[VERIFIER_PROBE_BINDING_ID] = {
|
|
103
|
+
...payload,
|
|
104
|
+
signature: hmacSign(JSON.stringify(payload)),
|
|
105
|
+
};
|
|
106
|
+
await writeProtocolStore("replay-bindings", store);
|
|
107
|
+
}
|
|
108
|
+
/** Stable protocol artifacts for x402gle verify-* paid probes. */
|
|
109
|
+
export async function ensureVerifierProbeProtocol() {
|
|
110
|
+
await seedPassport();
|
|
111
|
+
await seedExecutionReceipt();
|
|
112
|
+
await seedReasoningAudit();
|
|
113
|
+
await seedEscrow();
|
|
114
|
+
await seedReplayBinding();
|
|
115
|
+
}
|