@devlab.group/agent-commerce 1.6.1 → 2.0.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/LICENSE +187 -2
- package/README.md +6 -6
- package/dist/ap2.d.ts +2 -2
- package/dist/ap2.js +94 -28
- package/dist/ap2.js.map +1 -1
- package/dist/{chunk-V2V2E7HX.js → chunk-3LUJHVKX.js} +4 -4
- package/dist/{chunk-V2V2E7HX.js.map → chunk-3LUJHVKX.js.map} +1 -1
- package/dist/{chunk-N5KRK7YA.js → chunk-53WXXIPR.js} +3 -3
- package/dist/{chunk-N5KRK7YA.js.map → chunk-53WXXIPR.js.map} +1 -1
- package/dist/chunk-CKJRITWY.js +113 -0
- package/dist/chunk-CKJRITWY.js.map +1 -0
- package/dist/chunk-HOZA3IWP.js +115 -0
- package/dist/chunk-HOZA3IWP.js.map +1 -0
- package/dist/{chunk-JKEKKXRJ.js → chunk-RKBGCPCK.js} +78 -25
- package/dist/chunk-RKBGCPCK.js.map +1 -0
- package/dist/{chunk-VKDXMXHL.js → chunk-SYEGCNJZ.js} +3 -3
- package/dist/{chunk-VKDXMXHL.js.map → chunk-SYEGCNJZ.js.map} +1 -1
- package/dist/{chunk-CBJIT7QP.js → chunk-TWRUNWDR.js} +11 -4
- package/dist/chunk-TWRUNWDR.js.map +1 -0
- package/dist/cli/index.js +142 -33
- package/dist/cli/index.js.map +1 -1
- package/dist/{constants-Bkq04FRZ.d.ts → constants-BSBRlKRR.d.ts} +2 -2
- package/dist/index.d.ts +42 -22
- package/dist/index.js +1254 -377
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +247 -94
- package/dist/mcp.js.map +1 -1
- package/dist/mpp.d.ts +6 -2
- package/dist/mpp.js +65 -28
- package/dist/mpp.js.map +1 -1
- package/dist/{guardrails-71XwtXlT.d.ts → payment-flow-DCS882tR.d.ts} +9 -1
- package/dist/{protocol-adapter-DTkrXTev.d.ts → protocol-adapter-DonxfAwa.d.ts} +2 -0
- package/dist/{types-O6lg3Q5V.d.ts → types-CVw6Sf46.d.ts} +11 -0
- package/dist/x402.d.ts +11 -3
- package/dist/x402.js +4 -4
- package/package.json +16 -13
- package/dist/chunk-AFI2CEZS.js +0 -10
- package/dist/chunk-AFI2CEZS.js.map +0 -1
- package/dist/chunk-CBJIT7QP.js.map +0 -1
- package/dist/chunk-JKEKKXRJ.js.map +0 -1
|
@@ -18,12 +18,12 @@ declare const MPP_SPEC_REPOSITORY = "https://github.com/tempoxyz/mpp-specs";
|
|
|
18
18
|
declare const MPP_SPEC_COMMIT = "806fdb8b8c92cda5c84b8660558921b6bbeef7e0";
|
|
19
19
|
/** The core HTTP authentication draft, the `charge` intent, and its EVM method */
|
|
20
20
|
declare const MPP_SPEC_DRAFTS: {
|
|
21
|
-
readonly core: "draft-httpauth-payment-
|
|
21
|
+
readonly core: "draft-httpauth-payment-01";
|
|
22
22
|
readonly intent: "draft-payment-intent-charge-00";
|
|
23
23
|
readonly method: "draft-evm-charge-00";
|
|
24
24
|
};
|
|
25
25
|
/** Exact `mppx` release the rail is pinned to */
|
|
26
|
-
declare const MPPX_VERSION = "0.
|
|
26
|
+
declare const MPPX_VERSION = "0.13.1";
|
|
27
27
|
/**
|
|
28
28
|
* The pinned profile.
|
|
29
29
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { f as Ap2AuthorizationConfig } from './types-
|
|
1
|
+
import { f as Ap2AuthorizationConfig } from './types-CVw6Sf46.js';
|
|
2
2
|
import { I as IsoTimestamp, D as DecimalAmount, P as PaymentMethodName, a as CommerceResource, b as PaymentSubmission, B as BackendHandler, A as AdapterDescriptor, c as AdapterHealth, R as ResourceRegistry, d as PaymentProvider, L as Logger, C as Clock, e as IdGenerator } from './runtime-CiYbgGpi.js';
|
|
3
3
|
export { f as AuthorizationMethodName, g as BackendMethod, h as DEFAULT_BACKEND_TIMEOUT_MS, J as JsonSchema, N as NOOP_LOGGER, i as PAYMENT_METHOD_NAMES, j as PROTOCOL_NAMES, k as PaymentChallenge, l as PaymentContext, m as PaymentRequirement, n as PaymentResult, o as PaymentSettlementContext, p as PaymentVerificationContext, q as Pricing, r as ProtocolName, s as systemClock } from './runtime-CiYbgGpi.js';
|
|
4
|
-
import { M as MppNetwork } from './constants-
|
|
5
|
-
import { X as X402FacilitatorConfig } from './
|
|
4
|
+
import { M as MppNetwork } from './constants-BSBRlKRR.js';
|
|
5
|
+
import { X as X402PaymentFlow, a as X402FacilitatorConfig } from './payment-flow-DCS882tR.js';
|
|
6
6
|
import { a as AuthorizationRequirement, b as AuthorizationSubmission, A as AuthorizationProvider } from './authorization-BpbWGGrf.js';
|
|
7
7
|
export { c as AuthorizationFinalizeContext, d as AuthorizationRecord, e as AuthorizationVerification, f as AuthorizationVerificationContext } from './authorization-BpbWGGrf.js';
|
|
8
|
-
import { D as DeliveredOutcome, P as PaymentRequiredOutcome, C as CommerceEvent, a as PaymentAttempt, b as CommerceReceipt, E as ExecutionPipeline, c as ProtocolAdapter, H as HttpProtocolAdapter, A as AdapterHttpRoute, d as ProtocolAdapterContext } from './protocol-adapter-
|
|
9
|
-
export { e as COMMERCE_EVENT_TYPES, f as CanonicalRequest, g as CommerceEventType, h as EventSink, i as ExecutionOutcome, j as isHttpProtocolAdapter } from './protocol-adapter-
|
|
8
|
+
import { D as DeliveredOutcome, P as PaymentRequiredOutcome, C as CommerceEvent, a as PaymentAttempt, b as CommerceReceipt, E as ExecutionPipeline, c as ProtocolAdapter, H as HttpProtocolAdapter, A as AdapterHttpRoute, d as ProtocolAdapterContext } from './protocol-adapter-DonxfAwa.js';
|
|
9
|
+
export { e as COMMERCE_EVENT_TYPES, f as CanonicalRequest, g as CommerceEventType, h as EventSink, i as ExecutionOutcome, j as isHttpProtocolAdapter } from './protocol-adapter-DonxfAwa.js';
|
|
10
10
|
import { FastifyInstance } from 'fastify';
|
|
11
11
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
12
12
|
|
|
@@ -265,6 +265,12 @@ interface BackendRequest {
|
|
|
265
265
|
* when absent, the executor adds none.
|
|
266
266
|
*/
|
|
267
267
|
readonly idempotencyKey?: string;
|
|
268
|
+
/**
|
|
269
|
+
* Adapter-supplied headers for the backend. Configured and executor-set
|
|
270
|
+
* headers take precedence. The HTTP executor filters sensitive and transport
|
|
271
|
+
* headers and rejects invalid names or values with `INPUT_INVALID`.
|
|
272
|
+
*/
|
|
273
|
+
readonly backendHeaders?: Readonly<Record<string, string>>;
|
|
268
274
|
}
|
|
269
275
|
interface BackendResponse {
|
|
270
276
|
readonly status: number;
|
|
@@ -315,9 +321,10 @@ interface ReceiptStore {
|
|
|
315
321
|
/** Append a canonical event. Must not throw into the caller's flow */
|
|
316
322
|
appendEvent(event: CommerceEvent): Promise<void>;
|
|
317
323
|
/**
|
|
318
|
-
* Atomically
|
|
319
|
-
*
|
|
320
|
-
*
|
|
324
|
+
* Atomically reserve a payment authorization before settlement. If its
|
|
325
|
+
* `replayKey` is already reserved, throws `CommerceError('PAYMENT_REPLAYED')`
|
|
326
|
+
* with the existing attempt's `PaymentAttempt.status` in
|
|
327
|
+
* `details.attemptStatus` when available.
|
|
321
328
|
*/
|
|
322
329
|
reservePaymentAttempt(reservation: PaymentAttemptReservation): Promise<PaymentAttempt>;
|
|
323
330
|
updatePaymentAttempt(update: PaymentAttemptUpdate): Promise<void>;
|
|
@@ -417,6 +424,7 @@ type AcpProtocolConfig = {
|
|
|
417
424
|
readonly idempotency: {
|
|
418
425
|
readonly path: string;
|
|
419
426
|
readonly retentionHours: number;
|
|
427
|
+
readonly merchantIdempotent: boolean;
|
|
420
428
|
};
|
|
421
429
|
readonly checkout: {
|
|
422
430
|
readonly operations: Readonly<Record<AcpCheckoutOperation, string>>;
|
|
@@ -469,6 +477,10 @@ interface GatewayConfig {
|
|
|
469
477
|
readonly assetDecimals: number;
|
|
470
478
|
readonly payTo: string;
|
|
471
479
|
readonly maxTimeoutSeconds: number;
|
|
480
|
+
/** Defaults to `authorization`, the x402 default */
|
|
481
|
+
readonly paymentFlow?: X402PaymentFlow;
|
|
482
|
+
/** Resources whose `paymentFlow` overrides the rail's, by resource id */
|
|
483
|
+
readonly resourcePaymentFlows?: Readonly<Record<string, X402PaymentFlow>>;
|
|
472
484
|
readonly facilitator: X402FacilitatorConfig;
|
|
473
485
|
readonly allowMainnet?: boolean;
|
|
474
486
|
readonly allowUnauthenticatedFacilitator?: boolean;
|
|
@@ -484,6 +496,10 @@ interface GatewayConfig {
|
|
|
484
496
|
readonly realm: string;
|
|
485
497
|
readonly challengeSecret: string;
|
|
486
498
|
readonly challengeTtlSeconds?: number;
|
|
499
|
+
/** Defaults to `authorization`: settle after a successful backend call */
|
|
500
|
+
readonly paymentFlow?: X402PaymentFlow;
|
|
501
|
+
/** Resources whose `paymentFlow` overrides the rail's, by resource id */
|
|
502
|
+
readonly resourcePaymentFlows?: Readonly<Record<string, X402PaymentFlow>>;
|
|
487
503
|
readonly facilitator: X402FacilitatorConfig;
|
|
488
504
|
readonly allowMainnet?: boolean;
|
|
489
505
|
readonly allowUnauthenticatedFacilitator?: boolean;
|
|
@@ -528,18 +544,6 @@ interface GatewayInstance {
|
|
|
528
544
|
}
|
|
529
545
|
declare function createGateway(options: GatewayOptions): Promise<GatewayInstance>;
|
|
530
546
|
|
|
531
|
-
/**
|
|
532
|
-
* A2A (Agent2Agent) protocol adapter, experimental.
|
|
533
|
-
*
|
|
534
|
-
* Serves two paths: the configured mount (`/a2a`), where the JSON-RPC endpoint
|
|
535
|
-
* lives, and the specification-fixed `/.well-known/agent-card.json`, declared
|
|
536
|
-
* through `additionalHttpRoutes` so the gateway needs no A2A-specific routing.
|
|
537
|
-
*
|
|
538
|
-
* Only the synchronous `SendMessage` path is in scope; every other A2A method
|
|
539
|
-
* is listed in `descriptor.unsupported` rather than half-served. This file
|
|
540
|
-
* never calls a merchant backend and never inspects a payment object.
|
|
541
|
-
*/
|
|
542
|
-
|
|
543
547
|
interface A2aAdapterOptions {
|
|
544
548
|
readonly mountPath?: string;
|
|
545
549
|
/** Agent name published on the card */
|
|
@@ -560,6 +564,9 @@ declare class A2aProtocolAdapter implements HttpProtocolAdapter {
|
|
|
560
564
|
private started;
|
|
561
565
|
private skillsById;
|
|
562
566
|
private card;
|
|
567
|
+
private cardBody;
|
|
568
|
+
private cardEtag;
|
|
569
|
+
private pendingPayments;
|
|
563
570
|
constructor(options?: A2aAdapterOptions);
|
|
564
571
|
start(context: ProtocolAdapterContext): Promise<void>;
|
|
565
572
|
/** `GET /.well-known/agent-card.json` */
|
|
@@ -568,6 +575,14 @@ declare class A2aProtocolAdapter implements HttpProtocolAdapter {
|
|
|
568
575
|
handleHttp(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
569
576
|
private dispatch;
|
|
570
577
|
private execute;
|
|
578
|
+
/**
|
|
579
|
+
* A message on a task waiting for an x402 extension payment, recognized by
|
|
580
|
+
* its `taskId` whether or not the header activated the extension again. Any
|
|
581
|
+
* other task id falls through to `parseInvocation`, which answers
|
|
582
|
+
* TaskNotFoundError.
|
|
583
|
+
*/
|
|
584
|
+
private resumePayment;
|
|
585
|
+
private payPending;
|
|
571
586
|
private taskIdentity;
|
|
572
587
|
private taskResult;
|
|
573
588
|
health(): Promise<AdapterHealth>;
|
|
@@ -580,12 +595,12 @@ declare function createA2aAdapter(options?: A2aAdapterOptions): A2aProtocolAdapt
|
|
|
580
595
|
* A2A pins, kept in one place so nothing infers one version from another.
|
|
581
596
|
*
|
|
582
597
|
* The specification revision and the negotiation version look alike but
|
|
583
|
-
* differ: `1.0.
|
|
598
|
+
* differ: `1.0.1` names the document this adapter was written against, `1.0`
|
|
584
599
|
* is what a client negotiates on the wire. Neither is this package's version
|
|
585
600
|
* (`PACKAGE_VERSION`).
|
|
586
601
|
*/
|
|
587
602
|
/** A2A specification revision this adapter targets */
|
|
588
|
-
declare const A2A_SPEC_VERSION = "1.0.
|
|
603
|
+
declare const A2A_SPEC_VERSION = "1.0.1";
|
|
589
604
|
/** Protocol negotiation version carried on the wire */
|
|
590
605
|
declare const A2A_PROTOCOL_VERSION = "1.0";
|
|
591
606
|
/**
|
|
@@ -626,6 +641,11 @@ interface AcpAdapterOptions {
|
|
|
626
641
|
readonly idempotency: {
|
|
627
642
|
readonly path: string;
|
|
628
643
|
readonly retentionHours: number;
|
|
644
|
+
/**
|
|
645
|
+
* Declare that the merchant deduplicates by the derived `Idempotency-Key`.
|
|
646
|
+
* Allows a fresh retry after a 5xx. Defaults to false.
|
|
647
|
+
*/
|
|
648
|
+
readonly merchantIdempotent?: boolean;
|
|
629
649
|
};
|
|
630
650
|
readonly discovery?: AcpDiscoveryMetadata;
|
|
631
651
|
}
|