@belticlabs/agent-risk-sdk 0.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.
@@ -0,0 +1,40 @@
1
+ import { x402ResourceServer, x402HTTPResourceServer, PaywallConfig, RoutesConfig } from '@x402/core/server';
2
+ import { B as Beltic } from './client-CVx9LgJC.js';
3
+ import { Decision } from './api.js';
4
+ import { c as SessionBorn, S as Session } from './session-BMNB1N1g.js';
5
+
6
+ interface CorrelationContext {
7
+ path: string;
8
+ method: string;
9
+ header: (name: string) => string | undefined;
10
+ }
11
+ interface AttachOptions {
12
+ /** A key the merchant will see again at verify time, for delegated flows (GAP-31). */
13
+ correlate?: ((ctx: CorrelationContext) => string | null) | undefined;
14
+ /** Called with every decision; the default logs nothing. */
15
+ onDecision?: ((d: {
16
+ sessionId: string;
17
+ decision: Decision;
18
+ reasonCodes: string[];
19
+ born: SessionBorn;
20
+ }) => void) | undefined;
21
+ }
22
+ interface AttachedX402 {
23
+ /** Sessions resolved at verify time, keyed by payment digest — for tests and settle hooks. */
24
+ readonly inFlight: ReadonlyMap<string, Session>;
25
+ }
26
+ declare function attachX402(beltic: Beltic, server: x402ResourceServer, http?: x402HTTPResourceServer, opts?: AttachOptions): AttachedX402;
27
+
28
+ /**
29
+ * The seller half as one middleware: the framework's `@x402/*` payment
30
+ * middleware over an `x402HTTPResourceServer` with the Beltic hooks
31
+ * attached. `@belticlabs/agent-risk-sdk/hono` and `@belticlabs/agent-risk-sdk/express` differ only in
32
+ * which `paymentMiddlewareFromHTTPServer` they hand in.
33
+ */
34
+
35
+ type GuardedMiddlewareOptions = AttachOptions & {
36
+ paywall?: PaywallConfig | undefined;
37
+ };
38
+ declare function guardedPaymentMiddleware<M>(fromHTTPServer: (http: x402HTTPResourceServer, paywall?: PaywallConfig) => M, beltic: Beltic, routes: RoutesConfig, server: x402ResourceServer, opts?: GuardedMiddlewareOptions): M;
39
+
40
+ export { type AttachOptions as A, type CorrelationContext as C, type GuardedMiddlewareOptions as G, attachX402 as a, type AttachedX402 as b, guardedPaymentMiddleware as g };
@@ -0,0 +1,32 @@
1
+ import { B as Beltic } from '../client-CVx9LgJC.js';
2
+ import './api.js';
3
+ import '../session-BMNB1N1g.js';
4
+ import './base58.js';
5
+
6
+ interface PaymentRiskContext {
7
+ wallet: string;
8
+ resource: string;
9
+ amountAtomic: string;
10
+ asset: string;
11
+ network: string;
12
+ paymentIdentifier?: string;
13
+ /** Not in the platform port yet — pass it when you have it. */
14
+ sessionId?: string;
15
+ payTo?: string;
16
+ }
17
+ type RiskDecision = {
18
+ allow: true;
19
+ } | {
20
+ allow: false;
21
+ reason: string;
22
+ };
23
+ interface AntiFraudGateway {
24
+ assess(context: PaymentRiskContext): Promise<RiskDecision>;
25
+ }
26
+ declare class BelticAntiFraudGateway implements AntiFraudGateway {
27
+ private readonly beltic;
28
+ constructor(beltic: Beltic);
29
+ assess(ctx: PaymentRiskContext): Promise<RiskDecision>;
30
+ }
31
+
32
+ export { type AntiFraudGateway, BelticAntiFraudGateway, type PaymentRiskContext, type RiskDecision };
@@ -0,0 +1,39 @@
1
+ import {
2
+ x402Currency
3
+ } from "../chunk-U5Z5Z2BQ.js";
4
+ import {
5
+ presentedFrom
6
+ } from "../chunk-7G5EHNVW.js";
7
+ import "../chunk-FQDHFTVR.js";
8
+ import {
9
+ Verdict
10
+ } from "../chunk-GCKCAKHA.js";
11
+
12
+ // src/seller/anti-fraud-gateway.ts
13
+ var BelticAntiFraudGateway = class {
14
+ constructor(beltic) {
15
+ this.beltic = beltic;
16
+ }
17
+ async assess(ctx) {
18
+ const session = await this.beltic.sessions.ensure(ctx.sessionId ?? null);
19
+ const payment = {
20
+ protocol: "x402",
21
+ payee: ctx.payTo ?? ctx.resource,
22
+ amount: { value: ctx.amountAtomic, currency: x402Currency(ctx.network, ctx.asset) },
23
+ payer: ctx.wallet.toLowerCase()
24
+ };
25
+ await session.emit(
26
+ "payment.presented",
27
+ presentedFrom(payment, {
28
+ resource: ctx.resource,
29
+ ...ctx.paymentIdentifier ? { paymentIdentifier: ctx.paymentIdentifier } : {}
30
+ })
31
+ );
32
+ const out = await this.beltic.evaluate(session.id, payment);
33
+ const verdict = Verdict.of(out.decision);
34
+ return verdict.blocks(this.beltic.onReview) ? { allow: false, reason: `${out.decision}:${out.reasonCodes.join(",")}` } : { allow: true };
35
+ }
36
+ };
37
+ export {
38
+ BelticAntiFraudGateway
39
+ };
@@ -0,0 +1,184 @@
1
+ import { Signer } from './base58.js';
2
+ import { EvidenceAck, EventResult, EvidenceEvent, EvidenceSource, WireEvidenceKind, JsonObject, ChainHead, PayloadByKind, SessionClosePayload, DeclaredIntent } from './api.js';
3
+
4
+ interface ApiClientOptions {
5
+ baseUrl: string;
6
+ apiKey: string;
7
+ fetch?: typeof globalThis.fetch;
8
+ timeoutMs?: number;
9
+ userAgent?: string;
10
+ }
11
+ declare class BelticApiError extends Error {
12
+ readonly status: number;
13
+ readonly code: string;
14
+ readonly details?: unknown | undefined;
15
+ readonly requestId?: string | undefined;
16
+ constructor(status: number, code: string, message: string, details?: unknown | undefined, requestId?: string | undefined);
17
+ /** 5xx and network failures are retried by the transport; 4xx are not. */
18
+ get retryable(): boolean;
19
+ }
20
+ declare class ApiClient {
21
+ private readonly baseUrl;
22
+ private readonly fetchImpl;
23
+ private readonly timeoutMs;
24
+ private readonly headers;
25
+ constructor(opts: ApiClientOptions);
26
+ post<T>(path: string, body: unknown, headers?: Record<string, string>): Promise<T>;
27
+ get<T>(path: string, query?: Record<string, string | undefined>): Promise<T>;
28
+ private request;
29
+ }
30
+
31
+ interface AgentIdentity {
32
+ did: string;
33
+ signer: Signer;
34
+ /** Opaque credential presented at session start (stored, not verified this phase). */
35
+ credential?: string;
36
+ }
37
+ declare function identityFromSeed(seed: Uint8Array, credential?: string): AgentIdentity;
38
+ declare function ephemeralIdentity(credential?: string): AgentIdentity;
39
+ /** A JSON keystore on disk: `{ "seed": "<64 hex>" }`, created 0600 when missing. */
40
+ declare function fileIdentity(path: string, credential?: string): AgentIdentity;
41
+
42
+ /**
43
+ * Transport (Fraud SDK RFC › Modules: "buffering, batching, chained delivery
44
+ * to the Collector"). Contract as assumed in GAP-18/38: one FIFO per
45
+ * chain; at most one batch in flight per chain, so order is preserved;
46
+ * exponential backoff on network / 5xx; a `fork` or `rejected` ack halts
47
+ * the chain and surfaces `ChainRejectedError` — an SDK must not silently
48
+ * keep chaining onto a head the platform never accepted.
49
+ */
50
+
51
+ interface TransportOptions {
52
+ maxBatch: number;
53
+ flushMs: number;
54
+ /** Total buffered events across chains; beyond this new events are dropped (GAP-38). */
55
+ maxBuffered: number;
56
+ backoff: {
57
+ baseMs: number;
58
+ maxMs: number;
59
+ maxAttempts: number;
60
+ };
61
+ onAck?: (ack: EvidenceAck) => void;
62
+ onError?: (err: Error) => void;
63
+ onChainHalted?: (err: ChainRejectedError) => void;
64
+ setTimeout?: typeof globalThis.setTimeout;
65
+ clearTimeout?: typeof globalThis.clearTimeout;
66
+ }
67
+ declare const DEFAULT_TRANSPORT: TransportOptions;
68
+ declare class ChainRejectedError extends Error {
69
+ readonly sessionId: string;
70
+ readonly source: string;
71
+ readonly result: EventResult;
72
+ constructor(sessionId: string, source: string, result: EventResult);
73
+ }
74
+ declare class TransportClosedError extends Error {
75
+ constructor();
76
+ }
77
+ declare class Transport {
78
+ private readonly api;
79
+ private readonly opts;
80
+ private readonly chains;
81
+ private buffered;
82
+ private timer;
83
+ private closed;
84
+ private inFlightCount;
85
+ private drainWaiters;
86
+ constructor(api: ApiClient, opts?: Partial<TransportOptions>);
87
+ get size(): number;
88
+ hasRoom(): boolean;
89
+ haltedError(sessionId: string, source: string): ChainRejectedError | null;
90
+ /** Callers check `hasRoom()` first and assign `seq` only then (GAP-38). */
91
+ enqueue(ev: EvidenceEvent): void;
92
+ /** Send everything pending and wait for every in-flight batch to settle (ack or halt). */
93
+ flush(): Promise<void>;
94
+ close(): Promise<void>;
95
+ private schedule;
96
+ private unschedule;
97
+ private drained;
98
+ private settleWaiters;
99
+ private flushChain;
100
+ private send;
101
+ }
102
+
103
+ /**
104
+ * A risk session as the SDK sees it: one chain per (sessionId, source),
105
+ * built at the edge (Fraud SDK RFC › Wire contract). The buyer half opens
106
+ * AGENT_TRACE sessions and announces them with `session.open` (seq 0) and
107
+ * `intent.declared` (seq 1; GAP-23/60); the seller half attaches to a bound
108
+ * session or opens its own INTERNAL_NETWORK session (GAP-13).
109
+ *
110
+ * `seq` is handed out only when the transport has room for the event
111
+ * (GAP-38): a dropped event never leaves a hole — the next accepted event
112
+ * is preceded by a `transport.gap` that counts the drops. `redact` is off
113
+ * by default (GAP-33).
114
+ */
115
+
116
+ type RedactFn = (kind: WireEvidenceKind, payload: JsonObject) => JsonObject;
117
+ /** Who created the session — the seller half treats a bound session as buyer-born. */
118
+ type SessionBorn = 'buyer' | 'seller';
119
+ interface SessionDeps {
120
+ transport: Transport;
121
+ signer?: Signer | undefined;
122
+ redact?: RedactFn | undefined;
123
+ now?: (() => Date) | undefined;
124
+ /** Called once the session closed, so the registry can forget it. */
125
+ onClosed?: ((session: Session) => void) | undefined;
126
+ }
127
+ declare class Session {
128
+ private readonly deps;
129
+ readonly id: string;
130
+ readonly source: EvidenceSource;
131
+ readonly expiresAt: string | null;
132
+ readonly born: SessionBorn;
133
+ private chain;
134
+ private building;
135
+ private dropped;
136
+ private droppedFirstTs;
137
+ private droppedLastTs;
138
+ private closed;
139
+ private readonly now;
140
+ constructor(deps: SessionDeps, id: string, source: EvidenceSource, expiresAt: string | null, born: SessionBorn);
141
+ get head(): ChainHead | null;
142
+ get droppedCount(): number;
143
+ /** Resolves once the event is sequenced and buffered — not once it is acknowledged. */
144
+ emit<K extends WireEvidenceKind>(kind: K, payload: PayloadByKind[K]): Promise<boolean>;
145
+ close(reason?: SessionClosePayload['reason'], extra?: JsonObject): Promise<void>;
146
+ /** Read-your-writes: the platform must hold the evidence before anyone judges it (GAP-16/66). */
147
+ flush(): Promise<void>;
148
+ /** Serialized: two concurrent emits get consecutive seqs, never the same one. */
149
+ private next;
150
+ }
151
+ interface StartSessionInput {
152
+ intent?: DeclaredIntent;
153
+ runtime?: {
154
+ framework?: string;
155
+ model?: string;
156
+ };
157
+ attestations?: JsonObject;
158
+ }
159
+ interface SessionsDeps {
160
+ api: ApiClient;
161
+ transport: Transport;
162
+ identity?: AgentIdentity | undefined;
163
+ redact?: RedactFn | undefined;
164
+ now?: (() => Date) | undefined;
165
+ sdkVersion: string;
166
+ }
167
+ declare class Sessions {
168
+ private readonly deps;
169
+ /**
170
+ * One session object per (session, source) per process: a chain's head
171
+ * lives in it, so two objects for the same chain would both start at
172
+ * seq 0 and fork it. Closed sessions are forgotten; a process restart
173
+ * mid-session still loses the head (GAP-67).
174
+ */
175
+ private readonly attached;
176
+ constructor(deps: SessionsDeps);
177
+ /** Buyer half: create an AGENT_TRACE session bound to the agent identity, then announce it on the chain. */
178
+ start(input?: StartSessionInput): Promise<Session>;
179
+ /** Seller half: emit INTERNAL_NETWORK evidence into a session the buyer bound, or open a seller-born one. */
180
+ ensure(sessionId?: string | null): Promise<Session>;
181
+ private attach;
182
+ }
183
+
184
+ export { type AgentIdentity as A, BelticApiError as B, ChainRejectedError as C, DEFAULT_TRANSPORT as D, type RedactFn as R, Session as S, Transport as T, ApiClient as a, type ApiClientOptions as b, type SessionBorn as c, Sessions as d, type StartSessionInput as e, TransportClosedError as f, type TransportOptions as g, ephemeralIdentity as h, fileIdentity as i, identityFromSeed as j };
@@ -0,0 +1,14 @@
1
+ import { RoutesConfig, x402ResourceServer } from '@x402/core/server';
2
+ import { RequestHandler } from 'express';
3
+ import { B as Beltic } from '../client-CVx9LgJC.js';
4
+ import { G as GuardedMiddlewareOptions } from '../middleware-_DSwvNIx.js';
5
+ export { a as attachX402 } from '../middleware-_DSwvNIx.js';
6
+ import './api.js';
7
+ import '../session-BMNB1N1g.js';
8
+ import './base58.js';
9
+
10
+ /** Seller half for express: `@x402/express`'s payment middleware with the Beltic hooks attached. */
11
+
12
+ declare function belticPaymentMiddleware(beltic: Beltic, routes: RoutesConfig, server: x402ResourceServer, opts?: GuardedMiddlewareOptions): RequestHandler;
13
+
14
+ export { belticPaymentMiddleware };
@@ -0,0 +1,26 @@
1
+ import {
2
+ attachX402,
3
+ guardedPaymentMiddleware
4
+ } from "../chunk-YVMJ5CZX.js";
5
+ import "../chunk-VM7MK43J.js";
6
+ import "../chunk-SFGM7KOG.js";
7
+ import "../chunk-U5Z5Z2BQ.js";
8
+ import "../chunk-7G5EHNVW.js";
9
+ import "../chunk-FQDHFTVR.js";
10
+ import "../chunk-GCKCAKHA.js";
11
+
12
+ // src/x402/express.ts
13
+ import { paymentMiddlewareFromHTTPServer } from "@x402/express";
14
+ function belticPaymentMiddleware(beltic, routes, server, opts) {
15
+ return guardedPaymentMiddleware(
16
+ paymentMiddlewareFromHTTPServer,
17
+ beltic,
18
+ routes,
19
+ server,
20
+ opts
21
+ );
22
+ }
23
+ export {
24
+ attachX402,
25
+ belticPaymentMiddleware
26
+ };
@@ -0,0 +1,14 @@
1
+ import { RoutesConfig, x402ResourceServer } from '@x402/core/server';
2
+ import { MiddlewareHandler } from 'hono';
3
+ import { B as Beltic } from '../client-CVx9LgJC.js';
4
+ import { G as GuardedMiddlewareOptions } from '../middleware-_DSwvNIx.js';
5
+ export { a as attachX402 } from '../middleware-_DSwvNIx.js';
6
+ import './api.js';
7
+ import '../session-BMNB1N1g.js';
8
+ import './base58.js';
9
+
10
+ /** Seller half for hono: `@x402/hono`'s payment middleware with the Beltic hooks attached. */
11
+
12
+ declare function belticPaymentMiddleware(beltic: Beltic, routes: RoutesConfig, server: x402ResourceServer, opts?: GuardedMiddlewareOptions): MiddlewareHandler;
13
+
14
+ export { belticPaymentMiddleware };
@@ -0,0 +1,20 @@
1
+ import {
2
+ attachX402,
3
+ guardedPaymentMiddleware
4
+ } from "../chunk-YVMJ5CZX.js";
5
+ import "../chunk-VM7MK43J.js";
6
+ import "../chunk-SFGM7KOG.js";
7
+ import "../chunk-U5Z5Z2BQ.js";
8
+ import "../chunk-7G5EHNVW.js";
9
+ import "../chunk-FQDHFTVR.js";
10
+ import "../chunk-GCKCAKHA.js";
11
+
12
+ // src/x402/hono.ts
13
+ import { paymentMiddlewareFromHTTPServer } from "@x402/hono";
14
+ function belticPaymentMiddleware(beltic, routes, server, opts) {
15
+ return guardedPaymentMiddleware(paymentMiddlewareFromHTTPServer, beltic, routes, server, opts);
16
+ }
17
+ export {
18
+ attachX402,
19
+ belticPaymentMiddleware
20
+ };
@@ -0,0 +1,54 @@
1
+ export { A as AttachOptions, b as AttachedX402, C as CorrelationContext, G as GuardedMiddlewareOptions, a as attachX402, g as guardedPaymentMiddleware } from '../middleware-_DSwvNIx.js';
2
+ import { S as Session } from '../session-BMNB1N1g.js';
3
+ import { PaymentMomentPayload, JsonObject } from './api.js';
4
+ import { PaymentPayload, PaymentRequired, PaymentRequirements } from '@x402/core/types';
5
+ import '@x402/core/server';
6
+ import '../client-CVx9LgJC.js';
7
+ import './base58.js';
8
+
9
+ /**
10
+ * Session binding on the x402 rail (Fraud SDK RFC › Protocol Adapter — x402:
11
+ * "`PAYMENT-SIGNATURE` extension `beltic.sessionId`"). Where exactly it
12
+ * lives is GAP-30; that it is outside the wallet-signed payload is GAP-56.
13
+ */
14
+ declare const SESSION_EXTENSION = "beltic.sessionId";
15
+ declare const SESSION_HEADER = "Beltic-Session-Id";
16
+ declare function sessionIdOf(extensions: Readonly<Record<string, unknown>> | undefined): string | null;
17
+
18
+ declare function belticFetch(session: Session, inner?: typeof globalThis.fetch): typeof globalThis.fetch;
19
+
20
+ /**
21
+ * x402 artifacts → protocol moments (Fraud SDK RFC › Protocol Adapter —
22
+ * x402). The moment is normalized (payee, amount, payer) so both sides of
23
+ * a purchase compare; the artifact travels whole in `raw`. For x402 the
24
+ * currency is `<network>/<asset>` (GAP-49) and the value is the atomic
25
+ * amount as the protocol carries it.
26
+ */
27
+
28
+ type Readonlyish<T> = {
29
+ readonly [K in keyof T]: Readonlyish<T[K]>;
30
+ } | T;
31
+ declare function x402Currency(network: string, asset: string): string;
32
+ /** The minimum an `accepts` entry needs to become a moment; unknown parts are named, never dropped. */
33
+ interface AcceptsLike {
34
+ payTo?: string | undefined;
35
+ amount?: string | undefined;
36
+ network?: string | undefined;
37
+ asset?: string | undefined;
38
+ }
39
+ /** The payer is scheme-specific; the common EVM shapes are read, anything else stays in `raw`. */
40
+ declare function payerOf(payload: Readonlyish<PaymentPayload>): string | undefined;
41
+ declare const x402Moments: {
42
+ /** The 402 challenge as the buyer saw it. */
43
+ required(required: Readonlyish<PaymentRequired>): PaymentMomentPayload;
44
+ /** The requirements the seller's resource server resolved for a request. */
45
+ requirements(req: Readonlyish<PaymentRequirements>): PaymentMomentPayload;
46
+ /** A route's static `accepts` config, before any payment header exists. */
47
+ route(route: unknown, raw: JsonObject): PaymentMomentPayload;
48
+ /** An in-band ask (MRTR `input_required` or a `_meta` envelope) carrying an x402-style `accepts`. */
49
+ ask(first: AcceptsLike, raw: JsonObject): PaymentMomentPayload;
50
+ /** The signed payment the buyer presented. */
51
+ payload(payload: Readonlyish<PaymentPayload>): PaymentMomentPayload;
52
+ };
53
+
54
+ export { type AcceptsLike, SESSION_EXTENSION, SESSION_HEADER, belticFetch, payerOf, sessionIdOf, x402Currency, x402Moments };
@@ -0,0 +1,67 @@
1
+ import {
2
+ attachX402,
3
+ guardedPaymentMiddleware
4
+ } from "../chunk-YVMJ5CZX.js";
5
+ import {
6
+ SESSION_EXTENSION,
7
+ SESSION_HEADER,
8
+ sessionIdOf
9
+ } from "../chunk-VM7MK43J.js";
10
+ import "../chunk-SFGM7KOG.js";
11
+ import {
12
+ payerOf,
13
+ x402Currency,
14
+ x402Moments
15
+ } from "../chunk-U5Z5Z2BQ.js";
16
+ import "../chunk-7G5EHNVW.js";
17
+ import "../chunk-FQDHFTVR.js";
18
+ import "../chunk-GCKCAKHA.js";
19
+
20
+ // src/x402/fetch.ts
21
+ import {
22
+ decodePaymentRequiredHeader,
23
+ decodePaymentSignatureHeader,
24
+ encodePaymentSignatureHeader
25
+ } from "@x402/core/http";
26
+ function belticFetch(session, inner = globalThis.fetch) {
27
+ return async (input, init) => {
28
+ const headers = new Headers(
29
+ init?.headers ?? (input instanceof Request ? input.headers : void 0)
30
+ );
31
+ headers.set(SESSION_HEADER, session.id);
32
+ const sigHeader = headers.get("PAYMENT-SIGNATURE");
33
+ if (sigHeader) {
34
+ try {
35
+ const payload = decodePaymentSignatureHeader(sigHeader);
36
+ payload.extensions = { ...payload.extensions ?? {}, [SESSION_EXTENSION]: session.id };
37
+ headers.set("PAYMENT-SIGNATURE", encodePaymentSignatureHeader(payload));
38
+ await session.emit("payment.presented", x402Moments.payload(payload));
39
+ await session.flush();
40
+ } catch {
41
+ }
42
+ }
43
+ const res = await inner(input, { ...init, headers });
44
+ const required = res.status === 402 ? res.headers.get("PAYMENT-REQUIRED") : null;
45
+ if (required) {
46
+ try {
47
+ await session.emit(
48
+ "payment.requested",
49
+ x402Moments.required(decodePaymentRequiredHeader(required))
50
+ );
51
+ } catch {
52
+ }
53
+ }
54
+ return res;
55
+ };
56
+ }
57
+ export {
58
+ SESSION_EXTENSION,
59
+ SESSION_HEADER,
60
+ attachX402,
61
+ belticFetch,
62
+ guardedPaymentMiddleware,
63
+ payerOf,
64
+ sessionIdOf,
65
+ x402Currency,
66
+ x402Moments
67
+ };
package/package.json ADDED
@@ -0,0 +1,106 @@
1
+ {
2
+ "name": "@belticlabs/agent-risk-sdk",
3
+ "version": "0.1.0",
4
+ "description": "The Beltic Agent Risk SDK — one client, two halves: instrument the buyer agent (AI SDK, x402 fetch, MCP client) and guard the seller boundary (x402, MCP server, evaluate).",
5
+ "license": "UNLICENSED",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/belticlabs/agent-risk-platform.git",
9
+ "directory": "packages/sdk"
10
+ },
11
+ "type": "module",
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./ai": {
20
+ "types": "./dist/ai/index.d.ts",
21
+ "default": "./dist/ai/index.js"
22
+ },
23
+ "./x402": {
24
+ "types": "./dist/x402/index.d.ts",
25
+ "default": "./dist/x402/index.js"
26
+ },
27
+ "./hono": {
28
+ "types": "./dist/x402/hono.d.ts",
29
+ "default": "./dist/x402/hono.js"
30
+ },
31
+ "./express": {
32
+ "types": "./dist/x402/express.d.ts",
33
+ "default": "./dist/x402/express.js"
34
+ },
35
+ "./mcp": {
36
+ "types": "./dist/mcp/index.d.ts",
37
+ "default": "./dist/mcp/index.js"
38
+ },
39
+ "./platform-adapter": {
40
+ "types": "./dist/seller/anti-fraud-gateway.d.ts",
41
+ "default": "./dist/seller/anti-fraud-gateway.js"
42
+ },
43
+ "./package.json": "./package.json"
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "!dist/**/*.map"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "dependencies": {
53
+ "zod": "^4.6.5"
54
+ },
55
+ "peerDependencies": {
56
+ "@modelcontextprotocol/sdk": "^1.30.0",
57
+ "@x402/core": "^2.25.0",
58
+ "@x402/express": "^2.25.0",
59
+ "@x402/hono": "^2.25.0",
60
+ "ai": "^7.0.0",
61
+ "express": "^5.0.0",
62
+ "hono": "^4.0.0"
63
+ },
64
+ "peerDependenciesMeta": {
65
+ "@modelcontextprotocol/sdk": {
66
+ "optional": true
67
+ },
68
+ "@x402/core": {
69
+ "optional": true
70
+ },
71
+ "@x402/express": {
72
+ "optional": true
73
+ },
74
+ "@x402/hono": {
75
+ "optional": true
76
+ },
77
+ "ai": {
78
+ "optional": true
79
+ },
80
+ "express": {
81
+ "optional": true
82
+ },
83
+ "hono": {
84
+ "optional": true
85
+ }
86
+ },
87
+ "devDependencies": {
88
+ "@modelcontextprotocol/sdk": "^1.30.0",
89
+ "@types/express": "^5.0.6",
90
+ "@x402/core": "^2.25.0",
91
+ "@x402/express": "^2.25.0",
92
+ "@x402/hono": "^2.25.0",
93
+ "ai": "^7.0.100",
94
+ "express": "^5.2.1",
95
+ "hono": "^4.13.7",
96
+ "tsup": "8.5.1",
97
+ "typescript": "5.9.3",
98
+ "@belticlabs/canon": "0.0.0",
99
+ "@belticlabs/protocol": "0.0.0"
100
+ },
101
+ "scripts": {
102
+ "build": "tsup",
103
+ "check-types": "tsc --noEmit -p tsconfig.json",
104
+ "clean": "rm -rf dist"
105
+ }
106
+ }