@nevermined-io/payments 1.6.0 → 1.8.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.
Files changed (88) hide show
  1. package/dist/a2a/agent-card.d.ts +26 -0
  2. package/dist/a2a/agent-card.d.ts.map +1 -1
  3. package/dist/a2a/agent-card.js +36 -1
  4. package/dist/a2a/agent-card.js.map +1 -1
  5. package/dist/a2a/paymentsClient.d.ts +41 -1
  6. package/dist/a2a/paymentsClient.d.ts.map +1 -1
  7. package/dist/a2a/paymentsClient.js +120 -8
  8. package/dist/a2a/paymentsClient.js.map +1 -1
  9. package/dist/a2a/paymentsRequestHandler.d.ts +25 -2
  10. package/dist/a2a/paymentsRequestHandler.d.ts.map +1 -1
  11. package/dist/a2a/paymentsRequestHandler.js +240 -20
  12. package/dist/a2a/paymentsRequestHandler.js.map +1 -1
  13. package/dist/a2a/server.d.ts +2 -2
  14. package/dist/a2a/server.d.ts.map +1 -1
  15. package/dist/a2a/server.js +70 -20
  16. package/dist/a2a/server.js.map +1 -1
  17. package/dist/a2a/types.d.ts +31 -1
  18. package/dist/a2a/types.d.ts.map +1 -1
  19. package/dist/a2a/types.js.map +1 -1
  20. package/dist/a2a/x402-a2a.d.ts +142 -0
  21. package/dist/a2a/x402-a2a.d.ts.map +1 -0
  22. package/dist/a2a/x402-a2a.js +254 -0
  23. package/dist/a2a/x402-a2a.js.map +1 -0
  24. package/dist/api/agents-api.d.ts +19 -0
  25. package/dist/api/agents-api.d.ts.map +1 -1
  26. package/dist/api/agents-api.js +30 -3
  27. package/dist/api/agents-api.js.map +1 -1
  28. package/dist/api/base-payments.d.ts +6 -4
  29. package/dist/api/base-payments.d.ts.map +1 -1
  30. package/dist/api/base-payments.js +10 -0
  31. package/dist/api/base-payments.js.map +1 -1
  32. package/dist/api/contracts-api.js +1 -1
  33. package/dist/api/contracts-api.js.map +1 -1
  34. package/dist/api/nvm-api.d.ts +1 -0
  35. package/dist/api/nvm-api.d.ts.map +1 -1
  36. package/dist/api/nvm-api.js +4 -0
  37. package/dist/api/nvm-api.js.map +1 -1
  38. package/dist/api/plans-api.d.ts +12 -2
  39. package/dist/api/plans-api.d.ts.map +1 -1
  40. package/dist/api/plans-api.js +12 -12
  41. package/dist/api/plans-api.js.map +1 -1
  42. package/dist/common/api-version.d.ts +24 -0
  43. package/dist/common/api-version.d.ts.map +1 -0
  44. package/dist/common/api-version.js +24 -0
  45. package/dist/common/api-version.js.map +1 -0
  46. package/dist/common/types.d.ts +73 -18
  47. package/dist/common/types.d.ts.map +1 -1
  48. package/dist/common/types.js.map +1 -1
  49. package/dist/index.d.ts +3 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +4 -0
  52. package/dist/index.js.map +1 -1
  53. package/dist/mcp/core/auth.d.ts +14 -0
  54. package/dist/mcp/core/auth.d.ts.map +1 -1
  55. package/dist/mcp/core/auth.js +56 -23
  56. package/dist/mcp/core/auth.js.map +1 -1
  57. package/dist/mcp/core/paywall.d.ts +6 -0
  58. package/dist/mcp/core/paywall.d.ts.map +1 -1
  59. package/dist/mcp/core/paywall.js +170 -84
  60. package/dist/mcp/core/paywall.js.map +1 -1
  61. package/dist/mcp/utils/errors.d.ts +26 -0
  62. package/dist/mcp/utils/errors.d.ts.map +1 -1
  63. package/dist/mcp/utils/errors.js +32 -0
  64. package/dist/mcp/utils/errors.js.map +1 -1
  65. package/dist/mcp/utils/meta.d.ts +54 -0
  66. package/dist/mcp/utils/meta.d.ts.map +1 -0
  67. package/dist/mcp/utils/meta.js +72 -0
  68. package/dist/mcp/utils/meta.js.map +1 -0
  69. package/dist/payments.d.ts +4 -3
  70. package/dist/payments.d.ts.map +1 -1
  71. package/dist/payments.js +5 -3
  72. package/dist/payments.js.map +1 -1
  73. package/dist/utils.d.ts +27 -0
  74. package/dist/utils.d.ts.map +1 -1
  75. package/dist/utils.js +34 -0
  76. package/dist/utils.js.map +1 -1
  77. package/dist/x402/facilitator-api.d.ts +21 -0
  78. package/dist/x402/facilitator-api.d.ts.map +1 -1
  79. package/dist/x402/facilitator-api.js +39 -0
  80. package/dist/x402/facilitator-api.js.map +1 -1
  81. package/dist/x402/index.d.ts +1 -1
  82. package/dist/x402/index.d.ts.map +1 -1
  83. package/dist/x402/index.js.map +1 -1
  84. package/dist/x402/token.d.ts +13 -10
  85. package/dist/x402/token.d.ts.map +1 -1
  86. package/dist/x402/token.js +46 -16
  87. package/dist/x402/token.js.map +1 -1
  88. package/package.json +2 -2
@@ -133,12 +133,42 @@ export interface AgentOptions {
133
133
  }
134
134
  /**
135
135
  * HTTP context associated with a task or message (for internal request tracking).
136
+ *
137
+ * INVARIANT — exactly one of two mutually-exclusive states:
138
+ * - **payment-required**: a payment-gated request arrived with NO token, so only
139
+ * `paymentRequired` is set (`bearerToken`/`validation` are absent). The handler
140
+ * short-circuits to an `input-required` task instead of executing the agent.
141
+ * - **authorized**: a token was supplied (in band via `x402.payment.payload` when
142
+ * `inBand` is true, else the deprecated `payment-signature` header), so
143
+ * `bearerToken` + `validation` are set (`paymentRequired` is absent).
144
+ *
145
+ * A `mode`-discriminated union would enforce this at the type level (tracked as a
146
+ * follow-up); for now consumers guard the field they need — e.g. the settlement
147
+ * path asserts `bearerToken` + `validation` are present.
136
148
  */
137
149
  export type HttpRequestContext = {
150
+ /** Set only in the authorized state. */
138
151
  bearerToken?: string;
139
152
  urlRequested?: string;
140
153
  httpMethodRequested?: string;
141
- validation: StartAgentRequest;
154
+ /** The validated request — set only in the authorized state. */
155
+ validation?: StartAgentRequest;
156
+ /**
157
+ * x402 v2 A2A in-band transport: set by the server middleware when a
158
+ * payment-gated request arrives with NO token (neither in-band
159
+ * `x402.payment.payload` nor the deprecated `payment-signature` header). The
160
+ * handler short-circuits and returns an `input-required` task carrying this
161
+ * X402PaymentRequired object under `x402.payment.required`, instead of
162
+ * executing the agent. Set only in the payment-required state.
163
+ */
164
+ paymentRequired?: import('../x402/facilitator-api.js').X402PaymentRequired;
165
+ /**
166
+ * Whether the bearer token was supplied in band (via `x402.payment.payload`
167
+ * message metadata) rather than the deprecated `payment-signature` header.
168
+ * When true, settlement receipts are stamped into the task metadata under the
169
+ * spec-defined `x402.payment.*` keys.
170
+ */
171
+ inBand?: boolean;
142
172
  };
143
173
  /**
144
174
  * Authentication result for A2A requests (equivalent to MCP AuthResult)
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/a2a/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,qCAAqC,EACrC,YAAY,EACZ,qCAAqC,EACtC,MAAM,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,IAAI,GAAG,qBAAqB,GAAG,uBAAuB,CAAA;AAE7F;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,WAAW;IAC1B,gEAAgE;IAChE,WAAW,EAAE,OAAO,CAAA;IACpB,gEAAgE;IAChE,YAAY,CAAC,EAAE,IAAI,CAAA;IACnB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACrC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ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E;IAChE,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,mDAAmD;IACnD,cAAc,CAAC,EAAE,IAAI,EAAE,CAAA;IACvB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACrC,gEAAgE;IAChE,YAAY,CAAC,EAAE,IAAI,CAAA;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,cAAc,EAAE,sBAAsB,EAAE,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3F,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvE;AAGD,YAAY,EACV,SAAS,EACT,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,qCAAqC,EACrC,YAAY,EACZ,qCAAqC,EACrC,iBAAiB,EACjB,aAAa,GACd,CAAA;AAGD,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/a2a/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG","sourcesContent":["/**\n * Types and interfaces for the A2A payments integration.\n *\n * This module defines the core types and interfaces used throughout the A2A\n * payments integration. It provides:\n * - Task context structures for user executors\n * - Handler result definitions\n * - Payment metadata interfaces\n * - Re-exports of A2A SDK types for convenience\n *\n * These types ensure type safety and provide clear contracts between\n * the user's executor implementation and the payments system.\n */\n\nimport type {\n AgentCard,\n Task,\n Message,\n Artifact,\n TaskState,\n Part,\n TaskStatusUpdateEvent,\n TaskArtifactUpdateEvent,\n PushNotificationConfig,\n MessageSendParams,\n SendMessageResponse,\n TaskQueryParams,\n GetTaskResponse,\n TaskPushNotificationConfig,\n SetTaskPushNotificationConfigResponse,\n TaskIdParams,\n GetTaskPushNotificationConfigResponse,\n} from '@a2a-js/sdk'\n\nimport type { ExecutionEventBus, AgentExecutor } from '@a2a-js/sdk/server'\nimport type { StartAgentRequest } from '../common/types.ts'\nimport type { Payments } from '../payments.ts'\n\n/**\n * Union type for A2A streaming events\n *\n * This type represents all possible events that can be yielded by A2A streaming methods.\n * It includes messages, tasks, status updates, and artifact updates.\n */\nexport type A2AStreamEvent = Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent\n\n/**\n * Context provided to the user's task handler.\n *\n * This interface contains all the information available to the user's\n * executor when handling an A2A task. It includes:\n * - The original user message\n * - Any existing task state (for continuation)\n * - Authentication information\n * - Request metadata\n *\n * The context is created by the PaymentsA2AAdapter and passed to the\n * user's handleTask method.\n */\nexport interface TaskContext {\n /** The original message from the user containing the request */\n userMessage: Message\n /** Any existing task state (for task continuation scenarios) */\n existingTask?: Task\n /** Bearer token for authentication and payment validation */\n bearerToken?: string\n /** Additional metadata from the original request */\n requestMetadata?: Record<string, any>\n /**\n * Emit a streaming event to the client (SSE, WebSocket, etc.) during task execution.\n * This function allows the executor to send intermediate messages or progress updates.\n *\n * @param parts - Array of message parts (text, etc.) to send as a streaming event\n * @param metadata - Optional metadata to include with the event\n */\n emitStreamingEvent?: (parts: Part[], metadata?: Record<string, any>) => void\n}\n\n/**\n * Result returned by the user's task handler.\n *\n * This interface defines the structure that user executors must return\n * from their handleTask method. The result includes:\n * - Parts that will be converted to A2A Message or Artifact objects\n * - Optional metadata for payment tracking and other purposes\n * - Task state information\n *\n * The result is processed by the PaymentsA2AAdapter to create the\n * appropriate A2A protocol objects and handle payment operations.\n */\nexport interface TaskHandlerResult {\n /** Parts that will be converted to A2A Message or Artifact objects */\n parts: Part[]\n /** Optional metadata including payment information and custom data */\n metadata?: PaymentMetadata & Record<string, any>\n /** The final state of the task */\n state?: TaskState\n}\n\n/**\n * Configuration for credit redemption behavior\n *\n * This interface defines how credits should be redeemed for a specific agent.\n * The configuration is set at the server level and cannot be manipulated by clients.\n */\nexport interface PaymentRedemptionConfig {\n /** Whether to use batch processing for redemptions */\n useBatch?: boolean\n /** Whether to use margin-based redemptions (if false, uses fixed credits) */\n useMargin?: boolean\n /** Margin percentage (0-100) when using margin-based redemptions */\n marginPercent?: number\n}\n\n/**\n * Metadata for payment/credits information to be included in A2A objects.\n *\n * This interface defines the payment-related metadata that can be included\n * in task handler results. This metadata is used for:\n * - Credit tracking and validation\n * - Payment processing\n * - Cost reporting\n * - Plan management\n *\n * The metadata is embedded in A2A Message objects and can be used by\n * clients to understand the cost of operations.\n */\nexport interface PaymentMetadata {\n /** Number of credits used for this operation */\n creditsUsed?: number\n /** ID of the payment plan associated with this operation */\n planId?: string\n /** Type of payment model used */\n paymentType?: 'fixed' | 'dynamic'\n /** Human-readable description of the cost */\n costDescription?: string\n /** Agent ID for payment tracking */\n agentId?: string\n /** Configuration for credit redemption behavior */\n redemptionConfig?: PaymentRedemptionConfig\n}\n\n/**\n * Options required to register or retrieve a client in the registry.\n */\nexport interface ClientRegistryOptions {\n agentBaseUrl: string\n agentId: string\n planId: string\n agentCardPath?: string\n delegationConfig?: import('../common/types.js').DelegationConfig\n}\n\n/**\n * Options for agent interaction methods (used by PaymentsClient).\n */\nexport interface AgentOptions {\n agentId: string\n planId?: string\n}\n\n/**\n * HTTP context associated with a task or message (for internal request tracking).\n */\nexport type HttpRequestContext = {\n bearerToken?: string\n urlRequested?: string\n httpMethodRequested?: string\n validation: StartAgentRequest\n}\n\n/**\n * Authentication result for A2A requests (equivalent to MCP AuthResult)\n */\nexport interface A2AAuthResult {\n /** The agent request ID for tracking */\n requestId: string\n /** The bearer token for authentication */\n token: string\n /** The agent ID */\n agentId: string\n /** The agent request data */\n agentRequest: StartAgentRequest\n}\n\n/**\n * Agent request context provided to A2A AgentExecutors\n *\n * This context contains all the payment-related data that an AgentExecutor needs\n * to process requests with payment integration. The agent is responsible for\n * calculating and specifying credits in its final response.\n */\nexport interface AgentRequestContext {\n /** Authentication result with request metadata */\n authResult: A2AAuthResult\n /** The HTTP context with request details */\n httpContext: HttpRequestContext\n /** The payments service instance for observability and other operations */\n paymentsService: Payments\n}\n\n/**\n * Base RequestContext interface (local definition based on actual usage)\n *\n * This defines the structure that the A2A SDK RequestContext actually has\n * based on how it's used in PaymentsRequestHandler.\n */\nexport interface RequestContext {\n /** The original message from the user containing the request */\n userMessage: Message\n /** Unique identifier for the task */\n taskId: string\n /** Unique identifier for the context/conversation */\n contextId: string\n /** Any existing task state (for task continuation scenarios) */\n task?: Task\n /** Reference tasks for multi-turn conversations */\n referenceTasks?: Task[]\n /** Additional metadata from the original request */\n requestMetadata?: Record<string, any>\n /** Any existing task state (for task continuation scenarios) */\n existingTask?: Task\n}\n\n/**\n * Extended RequestContext with agent request data injection\n *\n * This extends the standard A2A RequestContext to include agent request context\n * while maintaining compatibility with the A2A protocol.\n */\nexport interface PaymentsRequestContext extends RequestContext {\n /** Agent request context injection (following MCP pattern) */\n payments?: AgentRequestContext\n}\n\n/**\n * Payments-specific AgentExecutor that uses PaymentsRequestContext\n */\nexport interface PaymentsAgentExecutor {\n execute(requestContext: PaymentsRequestContext, eventBus: ExecutionEventBus): Promise<void>\n cancelTask(taskId: string, eventBus: ExecutionEventBus): Promise<void>\n}\n\n// Re-export A2A SDK types for convenience\nexport type {\n AgentCard,\n Task,\n Message,\n Artifact,\n TaskState,\n Part,\n TaskStatusUpdateEvent,\n PushNotificationConfig,\n MessageSendParams,\n SendMessageResponse,\n TaskQueryParams,\n GetTaskResponse,\n TaskPushNotificationConfig,\n SetTaskPushNotificationConfigResponse,\n TaskIdParams,\n GetTaskPushNotificationConfigResponse,\n ExecutionEventBus,\n AgentExecutor,\n}\n\n// Re-export server options type for convenience\nexport type { PaymentsA2AServerOptions } from './server.ts'\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/a2a/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG","sourcesContent":["/**\n * Types and interfaces for the A2A payments integration.\n *\n * This module defines the core types and interfaces used throughout the A2A\n * payments integration. It provides:\n * - Task context structures for user executors\n * - Handler result definitions\n * - Payment metadata interfaces\n * - Re-exports of A2A SDK types for convenience\n *\n * These types ensure type safety and provide clear contracts between\n * the user's executor implementation and the payments system.\n */\n\nimport type {\n AgentCard,\n Task,\n Message,\n Artifact,\n TaskState,\n Part,\n TaskStatusUpdateEvent,\n TaskArtifactUpdateEvent,\n PushNotificationConfig,\n MessageSendParams,\n SendMessageResponse,\n TaskQueryParams,\n GetTaskResponse,\n TaskPushNotificationConfig,\n SetTaskPushNotificationConfigResponse,\n TaskIdParams,\n GetTaskPushNotificationConfigResponse,\n} from '@a2a-js/sdk'\n\nimport type { ExecutionEventBus, AgentExecutor } from '@a2a-js/sdk/server'\nimport type { StartAgentRequest } from '../common/types.ts'\nimport type { Payments } from '../payments.ts'\n\n/**\n * Union type for A2A streaming events\n *\n * This type represents all possible events that can be yielded by A2A streaming methods.\n * It includes messages, tasks, status updates, and artifact updates.\n */\nexport type A2AStreamEvent = Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent\n\n/**\n * Context provided to the user's task handler.\n *\n * This interface contains all the information available to the user's\n * executor when handling an A2A task. It includes:\n * - The original user message\n * - Any existing task state (for continuation)\n * - Authentication information\n * - Request metadata\n *\n * The context is created by the PaymentsA2AAdapter and passed to the\n * user's handleTask method.\n */\nexport interface TaskContext {\n /** The original message from the user containing the request */\n userMessage: Message\n /** Any existing task state (for task continuation scenarios) */\n existingTask?: Task\n /** Bearer token for authentication and payment validation */\n bearerToken?: string\n /** Additional metadata from the original request */\n requestMetadata?: Record<string, any>\n /**\n * Emit a streaming event to the client (SSE, WebSocket, etc.) during task execution.\n * This function allows the executor to send intermediate messages or progress updates.\n *\n * @param parts - Array of message parts (text, etc.) to send as a streaming event\n * @param metadata - Optional metadata to include with the event\n */\n emitStreamingEvent?: (parts: Part[], metadata?: Record<string, any>) => void\n}\n\n/**\n * Result returned by the user's task handler.\n *\n * This interface defines the structure that user executors must return\n * from their handleTask method. The result includes:\n * - Parts that will be converted to A2A Message or Artifact objects\n * - Optional metadata for payment tracking and other purposes\n * - Task state information\n *\n * The result is processed by the PaymentsA2AAdapter to create the\n * appropriate A2A protocol objects and handle payment operations.\n */\nexport interface TaskHandlerResult {\n /** Parts that will be converted to A2A Message or Artifact objects */\n parts: Part[]\n /** Optional metadata including payment information and custom data */\n metadata?: PaymentMetadata & Record<string, any>\n /** The final state of the task */\n state?: TaskState\n}\n\n/**\n * Configuration for credit redemption behavior\n *\n * This interface defines how credits should be redeemed for a specific agent.\n * The configuration is set at the server level and cannot be manipulated by clients.\n */\nexport interface PaymentRedemptionConfig {\n /** Whether to use batch processing for redemptions */\n useBatch?: boolean\n /** Whether to use margin-based redemptions (if false, uses fixed credits) */\n useMargin?: boolean\n /** Margin percentage (0-100) when using margin-based redemptions */\n marginPercent?: number\n}\n\n/**\n * Metadata for payment/credits information to be included in A2A objects.\n *\n * This interface defines the payment-related metadata that can be included\n * in task handler results. This metadata is used for:\n * - Credit tracking and validation\n * - Payment processing\n * - Cost reporting\n * - Plan management\n *\n * The metadata is embedded in A2A Message objects and can be used by\n * clients to understand the cost of operations.\n */\nexport interface PaymentMetadata {\n /** Number of credits used for this operation */\n creditsUsed?: number\n /** ID of the payment plan associated with this operation */\n planId?: string\n /** Type of payment model used */\n paymentType?: 'fixed' | 'dynamic'\n /** Human-readable description of the cost */\n costDescription?: string\n /** Agent ID for payment tracking */\n agentId?: string\n /** Configuration for credit redemption behavior */\n redemptionConfig?: PaymentRedemptionConfig\n}\n\n/**\n * Options required to register or retrieve a client in the registry.\n */\nexport interface ClientRegistryOptions {\n agentBaseUrl: string\n agentId: string\n planId: string\n agentCardPath?: string\n delegationConfig?: import('../common/types.js').DelegationConfig\n}\n\n/**\n * Options for agent interaction methods (used by PaymentsClient).\n */\nexport interface AgentOptions {\n agentId: string\n planId?: string\n}\n\n/**\n * HTTP context associated with a task or message (for internal request tracking).\n *\n * INVARIANT — exactly one of two mutually-exclusive states:\n * - **payment-required**: a payment-gated request arrived with NO token, so only\n * `paymentRequired` is set (`bearerToken`/`validation` are absent). The handler\n * short-circuits to an `input-required` task instead of executing the agent.\n * - **authorized**: a token was supplied (in band via `x402.payment.payload` when\n * `inBand` is true, else the deprecated `payment-signature` header), so\n * `bearerToken` + `validation` are set (`paymentRequired` is absent).\n *\n * A `mode`-discriminated union would enforce this at the type level (tracked as a\n * follow-up); for now consumers guard the field they need — e.g. the settlement\n * path asserts `bearerToken` + `validation` are present.\n */\nexport type HttpRequestContext = {\n /** Set only in the authorized state. */\n bearerToken?: string\n urlRequested?: string\n httpMethodRequested?: string\n /** The validated request — set only in the authorized state. */\n validation?: StartAgentRequest\n /**\n * x402 v2 A2A in-band transport: set by the server middleware when a\n * payment-gated request arrives with NO token (neither in-band\n * `x402.payment.payload` nor the deprecated `payment-signature` header). The\n * handler short-circuits and returns an `input-required` task carrying this\n * X402PaymentRequired object under `x402.payment.required`, instead of\n * executing the agent. Set only in the payment-required state.\n */\n paymentRequired?: import('../x402/facilitator-api.js').X402PaymentRequired\n /**\n * Whether the bearer token was supplied in band (via `x402.payment.payload`\n * message metadata) rather than the deprecated `payment-signature` header.\n * When true, settlement receipts are stamped into the task metadata under the\n * spec-defined `x402.payment.*` keys.\n */\n inBand?: boolean\n}\n\n/**\n * Authentication result for A2A requests (equivalent to MCP AuthResult)\n */\nexport interface A2AAuthResult {\n /** The agent request ID for tracking */\n requestId: string\n /** The bearer token for authentication */\n token: string\n /** The agent ID */\n agentId: string\n /** The agent request data */\n agentRequest: StartAgentRequest\n}\n\n/**\n * Agent request context provided to A2A AgentExecutors\n *\n * This context contains all the payment-related data that an AgentExecutor needs\n * to process requests with payment integration. The agent is responsible for\n * calculating and specifying credits in its final response.\n */\nexport interface AgentRequestContext {\n /** Authentication result with request metadata */\n authResult: A2AAuthResult\n /** The HTTP context with request details */\n httpContext: HttpRequestContext\n /** The payments service instance for observability and other operations */\n paymentsService: Payments\n}\n\n/**\n * Base RequestContext interface (local definition based on actual usage)\n *\n * This defines the structure that the A2A SDK RequestContext actually has\n * based on how it's used in PaymentsRequestHandler.\n */\nexport interface RequestContext {\n /** The original message from the user containing the request */\n userMessage: Message\n /** Unique identifier for the task */\n taskId: string\n /** Unique identifier for the context/conversation */\n contextId: string\n /** Any existing task state (for task continuation scenarios) */\n task?: Task\n /** Reference tasks for multi-turn conversations */\n referenceTasks?: Task[]\n /** Additional metadata from the original request */\n requestMetadata?: Record<string, any>\n /** Any existing task state (for task continuation scenarios) */\n existingTask?: Task\n}\n\n/**\n * Extended RequestContext with agent request data injection\n *\n * This extends the standard A2A RequestContext to include agent request context\n * while maintaining compatibility with the A2A protocol.\n */\nexport interface PaymentsRequestContext extends RequestContext {\n /** Agent request context injection (following MCP pattern) */\n payments?: AgentRequestContext\n}\n\n/**\n * Payments-specific AgentExecutor that uses PaymentsRequestContext\n */\nexport interface PaymentsAgentExecutor {\n execute(requestContext: PaymentsRequestContext, eventBus: ExecutionEventBus): Promise<void>\n cancelTask(taskId: string, eventBus: ExecutionEventBus): Promise<void>\n}\n\n// Re-export A2A SDK types for convenience\nexport type {\n AgentCard,\n Task,\n Message,\n Artifact,\n TaskState,\n Part,\n TaskStatusUpdateEvent,\n PushNotificationConfig,\n MessageSendParams,\n SendMessageResponse,\n TaskQueryParams,\n GetTaskResponse,\n TaskPushNotificationConfig,\n SetTaskPushNotificationConfigResponse,\n TaskIdParams,\n GetTaskPushNotificationConfigResponse,\n ExecutionEventBus,\n AgentExecutor,\n}\n\n// Re-export server options type for convenience\nexport type { PaymentsA2AServerOptions } from './server.ts'\n"]}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * x402 + A2A in-band integration utilities (x402 v2 A2A transport).
3
+ *
4
+ * Port of the Python SDK's `payments_py/x402/a2a.py` `X402A2AUtils`. These
5
+ * helpers bridge the x402 payment protocol with the A2A (Agent-to-Agent)
6
+ * protocol, signalling payment state *in band* through A2A Task / Message
7
+ * metadata instead of HTTP status codes and headers.
8
+ *
9
+ * The A2A transport equivalent of the MCP transport's `_meta["x402/payment"]`
10
+ * keys is the A2A **task / message metadata** under the spec-defined
11
+ * `x402.payment.*` keys (see {@link X402A2AMetadata}). The wire shapes are
12
+ * defined by:
13
+ * - Coinbase x402 v2 A2A transport: specs/transports-v2/a2a.md
14
+ * - A2A x402 extension: https://github.com/google-agentic-commerce/a2a-x402
15
+ *
16
+ * These constants/keys are part of the specification and MUST NOT be changed.
17
+ */
18
+ import type { Message, Task } from '@a2a-js/sdk';
19
+ import type { SettlePermissionsResult, X402PaymentRequired } from '../x402/facilitator-api.js';
20
+ /**
21
+ * Protocol-defined payment states for the A2A x402 flow.
22
+ *
23
+ * Tracked in the `x402.payment.status` metadata field. Values are part of the
24
+ * A2A x402 specification (Section 6: State Management) and must not be changed.
25
+ */
26
+ export declare enum PaymentStatus {
27
+ /** Payment requirements sent to client (task state `input-required`). */
28
+ PAYMENT_REQUIRED = "payment-required",
29
+ /** Payment payload received by server. */
30
+ PAYMENT_SUBMITTED = "payment-submitted",
31
+ /** Payment payload verified by the facilitator. */
32
+ PAYMENT_VERIFIED = "payment-verified",
33
+ /** Payment requirements rejected by the client. */
34
+ PAYMENT_REJECTED = "payment-rejected",
35
+ /** Payment settled on-chain successfully (task state `completed`). */
36
+ PAYMENT_COMPLETED = "payment-completed",
37
+ /** Payment verification or settlement failed (task state `failed`). */
38
+ PAYMENT_FAILED = "payment-failed"
39
+ }
40
+ /**
41
+ * Spec-defined A2A task / message metadata keys for the x402 protocol.
42
+ *
43
+ * As defined in the A2A x402 specification (Section 6: State Management). These
44
+ * keys are part of the specification and must not be changed. Note these are
45
+ * NOT the MCP `_meta["x402/payment"]` keys — A2A signals payment state through
46
+ * Task / Message `metadata` instead.
47
+ */
48
+ export declare const X402A2AMetadata: {
49
+ /** Current payment flow stage. */
50
+ readonly STATUS_KEY: "x402.payment.status";
51
+ /** X402PaymentRequired object. */
52
+ readonly REQUIRED_KEY: "x402.payment.required";
53
+ /** PaymentPayload object (client → server). */
54
+ readonly PAYLOAD_KEY: "x402.payment.payload";
55
+ /** Array of SettleResponse receipts (server → client). */
56
+ readonly RECEIPTS_KEY: "x402.payment.receipts";
57
+ /** Error code on failure. */
58
+ readonly ERROR_KEY: "x402.payment.error";
59
+ };
60
+ /**
61
+ * Nevermined-specific (non-core-spec) marker set alongside `payment-verified`
62
+ * when on-chain settlement is **deferred** to a batch process this handler does
63
+ * not confirm. Lets a client distinguish "verified, will be charged out-of-band"
64
+ * from a plain verify; spec-only clients ignore the unknown key. Value: `'deferred'`.
65
+ */
66
+ export declare const X402_SETTLEMENT_DEFERRED_KEY = "x402.payment.settlement";
67
+ /**
68
+ * Utilities for managing x402 payment state in A2A messages and tasks.
69
+ *
70
+ * Provides methods to extract payment status / requirements / payload from
71
+ * incoming A2A messages and tasks, and to stamp payment-required, verified,
72
+ * completed and failed state onto outgoing tasks — all via the spec-defined
73
+ * `x402.payment.*` metadata keys.
74
+ */
75
+ export declare class X402A2AUtils {
76
+ static readonly STATUS_KEY: "x402.payment.status";
77
+ static readonly REQUIRED_KEY: "x402.payment.required";
78
+ static readonly PAYLOAD_KEY: "x402.payment.payload";
79
+ static readonly RECEIPTS_KEY: "x402.payment.receipts";
80
+ static readonly ERROR_KEY: "x402.payment.error";
81
+ /** Extract the payment status from a Message's metadata, or `undefined`. */
82
+ getPaymentStatusFromMessage(message?: Message | null): string | undefined;
83
+ /** Extract the payment status from a Task's status message metadata, or `undefined`. */
84
+ getPaymentStatus(task?: Task | null): string | undefined;
85
+ /**
86
+ * Extract the X402PaymentRequired object from a Message's metadata.
87
+ *
88
+ * Returns the raw object (already spec-shaped JSON). Returns `undefined` when
89
+ * absent or not a plain object.
90
+ */
91
+ getPaymentRequirementsFromMessage(message?: Message | null): X402PaymentRequired | undefined;
92
+ /** Extract the X402PaymentRequired object from a Task's status message metadata. */
93
+ getPaymentRequirements(task?: Task | null): X402PaymentRequired | undefined;
94
+ /**
95
+ * Extract the in-band PaymentPayload object from a Message's metadata.
96
+ *
97
+ * The payload is untrusted client input that the server re-encodes into an
98
+ * access token, so this rejects null, arrays and oversized payloads
99
+ * (defense-in-depth, parity with the MCP `readPaymentPayload`).
100
+ *
101
+ * @returns The PaymentPayload object, or `undefined` when absent/invalid.
102
+ */
103
+ getPaymentPayloadFromMessage(message?: Message | null): Record<string, any> | undefined;
104
+ /** Extract the in-band PaymentPayload object from a Task's status message metadata. */
105
+ getPaymentPayload(task?: Task | null): Record<string, any> | undefined;
106
+ /**
107
+ * Set a Task to the payment-required state (`input-required`) with the
108
+ * X402PaymentRequired object in `x402.payment.required` metadata.
109
+ *
110
+ * Mutates and returns `task` (in place), per the x402 v2 A2A transport.
111
+ */
112
+ createPaymentRequiredTask(task: Task, paymentRequired: X402PaymentRequired): Task;
113
+ /**
114
+ * Record payment verification on a Task: sets the `x402.payment.status`
115
+ * metadata to `payment-verified`. Task state is left to the caller (the spec
116
+ * keeps it `working`).
117
+ */
118
+ recordPaymentVerified(task: Task): Task;
119
+ /**
120
+ * Record a deferred (batch) settlement on a Task: the payload was verified but
121
+ * on-chain settlement is deferred out-of-band (the handler never confirms it).
122
+ * Sets `payment-verified` PLUS the Nevermined `x402.payment.settlement: 'deferred'`
123
+ * marker, so a client can tell it will be charged out-of-band — distinct from a
124
+ * plain verify where nothing is owed.
125
+ */
126
+ recordPaymentDeferred(task: Task): Task;
127
+ /**
128
+ * Record a successful settlement on a Task: sets the `x402.payment.status`
129
+ * metadata to `payment-completed` and stores the SettleResponse receipt under
130
+ * `x402.payment.receipts` (an array, per the spec).
131
+ */
132
+ recordPaymentSuccess(task: Task, settleResponse?: SettlePermissionsResult): Task;
133
+ /**
134
+ * Record a payment failure on a Task: `x402.payment.status = payment-failed`,
135
+ * the error code under `x402.payment.error`, and (when available) the failed
136
+ * SettleResponse under `x402.payment.receipts`.
137
+ */
138
+ recordPaymentFailure(task: Task, errorCode: string, errorResponse?: SettlePermissionsResult): Task;
139
+ }
140
+ /** Shared singleton, matching the Python `X402A2AUtils()` usage pattern. */
141
+ export declare const x402A2AUtils: X402A2AUtils;
142
+ //# sourceMappingURL=x402-a2a.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x402-a2a.d.ts","sourceRoot":"","sources":["../../src/a2a/x402-a2a.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAc,MAAM,aAAa,CAAA;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAE9F;;;;;GAKG;AACH,oBAAY,aAAa;IACvB,yEAAyE;IACzE,gBAAgB,qBAAqB;IACrC,0CAA0C;IAC1C,iBAAiB,sBAAsB;IACvC,mDAAmD;IACnD,gBAAgB,qBAAqB;IACrC,mDAAmD;IACnD,gBAAgB,qBAAqB;IACrC,sEAAsE;IACtE,iBAAiB,sBAAsB;IACvC,uEAAuE;IACvE,cAAc,mBAAmB;CAClC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;IAC1B,kCAAkC;;IAElC,kCAAkC;;IAElC,+CAA+C;;IAE/C,0DAA0D;;IAE1D,6BAA6B;;CAErB,CAAA;AAEV;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,4BAA4B,CAAA;AAiDrE;;;;;;;GAOG;AACH,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,UAAU,wBAA6B;IACvD,MAAM,CAAC,QAAQ,CAAC,YAAY,0BAA+B;IAC3D,MAAM,CAAC,QAAQ,CAAC,WAAW,yBAA8B;IACzD,MAAM,CAAC,QAAQ,CAAC,YAAY,0BAA+B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
2
+ * x402 + A2A in-band integration utilities (x402 v2 A2A transport).
3
+ *
4
+ * Port of the Python SDK's `payments_py/x402/a2a.py` `X402A2AUtils`. These
5
+ * helpers bridge the x402 payment protocol with the A2A (Agent-to-Agent)
6
+ * protocol, signalling payment state *in band* through A2A Task / Message
7
+ * metadata instead of HTTP status codes and headers.
8
+ *
9
+ * The A2A transport equivalent of the MCP transport's `_meta["x402/payment"]`
10
+ * keys is the A2A **task / message metadata** under the spec-defined
11
+ * `x402.payment.*` keys (see {@link X402A2AMetadata}). The wire shapes are
12
+ * defined by:
13
+ * - Coinbase x402 v2 A2A transport: specs/transports-v2/a2a.md
14
+ * - A2A x402 extension: https://github.com/google-agentic-commerce/a2a-x402
15
+ *
16
+ * These constants/keys are part of the specification and MUST NOT be changed.
17
+ */
18
+ /**
19
+ * Protocol-defined payment states for the A2A x402 flow.
20
+ *
21
+ * Tracked in the `x402.payment.status` metadata field. Values are part of the
22
+ * A2A x402 specification (Section 6: State Management) and must not be changed.
23
+ */
24
+ export var PaymentStatus;
25
+ (function (PaymentStatus) {
26
+ /** Payment requirements sent to client (task state `input-required`). */
27
+ PaymentStatus["PAYMENT_REQUIRED"] = "payment-required";
28
+ /** Payment payload received by server. */
29
+ PaymentStatus["PAYMENT_SUBMITTED"] = "payment-submitted";
30
+ /** Payment payload verified by the facilitator. */
31
+ PaymentStatus["PAYMENT_VERIFIED"] = "payment-verified";
32
+ /** Payment requirements rejected by the client. */
33
+ PaymentStatus["PAYMENT_REJECTED"] = "payment-rejected";
34
+ /** Payment settled on-chain successfully (task state `completed`). */
35
+ PaymentStatus["PAYMENT_COMPLETED"] = "payment-completed";
36
+ /** Payment verification or settlement failed (task state `failed`). */
37
+ PaymentStatus["PAYMENT_FAILED"] = "payment-failed";
38
+ })(PaymentStatus || (PaymentStatus = {}));
39
+ /**
40
+ * Spec-defined A2A task / message metadata keys for the x402 protocol.
41
+ *
42
+ * As defined in the A2A x402 specification (Section 6: State Management). These
43
+ * keys are part of the specification and must not be changed. Note these are
44
+ * NOT the MCP `_meta["x402/payment"]` keys — A2A signals payment state through
45
+ * Task / Message `metadata` instead.
46
+ */
47
+ export const X402A2AMetadata = {
48
+ /** Current payment flow stage. */
49
+ STATUS_KEY: 'x402.payment.status',
50
+ /** X402PaymentRequired object. */
51
+ REQUIRED_KEY: 'x402.payment.required',
52
+ /** PaymentPayload object (client → server). */
53
+ PAYLOAD_KEY: 'x402.payment.payload',
54
+ /** Array of SettleResponse receipts (server → client). */
55
+ RECEIPTS_KEY: 'x402.payment.receipts',
56
+ /** Error code on failure. */
57
+ ERROR_KEY: 'x402.payment.error',
58
+ };
59
+ /**
60
+ * Nevermined-specific (non-core-spec) marker set alongside `payment-verified`
61
+ * when on-chain settlement is **deferred** to a batch process this handler does
62
+ * not confirm. Lets a client distinguish "verified, will be charged out-of-band"
63
+ * from a plain verify; spec-only clients ignore the unknown key. Value: `'deferred'`.
64
+ */
65
+ export const X402_SETTLEMENT_DEFERRED_KEY = 'x402.payment.settlement';
66
+ /**
67
+ * Upper bound on the serialized size of an in-band payment payload. The payload
68
+ * is untrusted client input that gets re-encoded into a token, so cap it as
69
+ * defense-in-depth (parity with the MCP `readPaymentPayload` and the Python
70
+ * sibling's `len(json.dumps(value))` guard).
71
+ */
72
+ const MAX_INBAND_PAYMENT_PAYLOAD_LEN = 64 * 1024;
73
+ /** Type guard: a plain (non-null, non-array) object, mirroring `isinstance(value, dict)`. */
74
+ function isPlainObject(value) {
75
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
76
+ }
77
+ /**
78
+ * Read x402 payment metadata from a Message's `metadata`, ignoring non-object values.
79
+ */
80
+ function metaOf(message) {
81
+ const metadata = message?.metadata;
82
+ return isPlainObject(metadata) ? metadata : undefined;
83
+ }
84
+ /**
85
+ * Ensure a Task has a status with a status message carrying a `metadata` object,
86
+ * returning that metadata object for mutation by the record* helpers.
87
+ *
88
+ * The task is mutated in place (the A2A SDK's ResultManager / event flow operate
89
+ * on task objects by reference), mirroring the Python `X402A2AUtils` behavior.
90
+ */
91
+ function ensureStatusMetadata(task, defaultText) {
92
+ if (!task.status) {
93
+ task.status = { state: 'working' };
94
+ }
95
+ if (!task.status.message) {
96
+ task.status.message = {
97
+ kind: 'message',
98
+ messageId: `${task.id}-status`,
99
+ role: 'agent',
100
+ parts: [{ kind: 'text', text: defaultText }],
101
+ metadata: {},
102
+ };
103
+ }
104
+ if (!isPlainObject(task.status.message.metadata)) {
105
+ task.status.message.metadata = {};
106
+ }
107
+ return task.status.message.metadata;
108
+ }
109
+ /**
110
+ * Utilities for managing x402 payment state in A2A messages and tasks.
111
+ *
112
+ * Provides methods to extract payment status / requirements / payload from
113
+ * incoming A2A messages and tasks, and to stamp payment-required, verified,
114
+ * completed and failed state onto outgoing tasks — all via the spec-defined
115
+ * `x402.payment.*` metadata keys.
116
+ */
117
+ export class X402A2AUtils {
118
+ // ---- Extraction (client/server reads) ------------------------------------
119
+ /** Extract the payment status from a Message's metadata, or `undefined`. */
120
+ getPaymentStatusFromMessage(message) {
121
+ const meta = metaOf(message);
122
+ const value = meta?.[X402A2AUtils.STATUS_KEY];
123
+ return typeof value === 'string' ? value : undefined;
124
+ }
125
+ /** Extract the payment status from a Task's status message metadata, or `undefined`. */
126
+ getPaymentStatus(task) {
127
+ return this.getPaymentStatusFromMessage(task?.status?.message);
128
+ }
129
+ /**
130
+ * Extract the X402PaymentRequired object from a Message's metadata.
131
+ *
132
+ * Returns the raw object (already spec-shaped JSON). Returns `undefined` when
133
+ * absent or not a plain object.
134
+ */
135
+ getPaymentRequirementsFromMessage(message) {
136
+ const meta = metaOf(message);
137
+ const value = meta?.[X402A2AUtils.REQUIRED_KEY];
138
+ // Structural guard before asserting the typed shape: a valid
139
+ // X402PaymentRequired is a plain object carrying a numeric `x402Version` and
140
+ // an `accepts` array. Anything else is treated as absent (never assert the
141
+ // rich interface over arbitrary, unvalidated metadata).
142
+ if (!isPlainObject(value) ||
143
+ typeof value.x402Version !== 'number' ||
144
+ !Array.isArray(value.accepts)) {
145
+ return undefined;
146
+ }
147
+ return value;
148
+ }
149
+ /** Extract the X402PaymentRequired object from a Task's status message metadata. */
150
+ getPaymentRequirements(task) {
151
+ return this.getPaymentRequirementsFromMessage(task?.status?.message);
152
+ }
153
+ /**
154
+ * Extract the in-band PaymentPayload object from a Message's metadata.
155
+ *
156
+ * The payload is untrusted client input that the server re-encodes into an
157
+ * access token, so this rejects null, arrays and oversized payloads
158
+ * (defense-in-depth, parity with the MCP `readPaymentPayload`).
159
+ *
160
+ * @returns The PaymentPayload object, or `undefined` when absent/invalid.
161
+ */
162
+ getPaymentPayloadFromMessage(message) {
163
+ const meta = metaOf(message);
164
+ const value = meta?.[X402A2AUtils.PAYLOAD_KEY];
165
+ if (!isPlainObject(value)) {
166
+ return undefined;
167
+ }
168
+ if (JSON.stringify(value).length > MAX_INBAND_PAYMENT_PAYLOAD_LEN) {
169
+ return undefined;
170
+ }
171
+ return value;
172
+ }
173
+ /** Extract the in-band PaymentPayload object from a Task's status message metadata. */
174
+ getPaymentPayload(task) {
175
+ return this.getPaymentPayloadFromMessage(task?.status?.message);
176
+ }
177
+ // ---- Stamping (server writes) --------------------------------------------
178
+ /**
179
+ * Set a Task to the payment-required state (`input-required`) with the
180
+ * X402PaymentRequired object in `x402.payment.required` metadata.
181
+ *
182
+ * Mutates and returns `task` (in place), per the x402 v2 A2A transport.
183
+ */
184
+ createPaymentRequiredTask(task, paymentRequired) {
185
+ if (!task.status) {
186
+ task.status = { state: 'input-required' };
187
+ }
188
+ else {
189
+ task.status.state = 'input-required';
190
+ }
191
+ const meta = ensureStatusMetadata(task, 'Payment is required for this service.');
192
+ meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_REQUIRED;
193
+ meta[X402A2AUtils.REQUIRED_KEY] = paymentRequired;
194
+ return task;
195
+ }
196
+ /**
197
+ * Record payment verification on a Task: sets the `x402.payment.status`
198
+ * metadata to `payment-verified`. Task state is left to the caller (the spec
199
+ * keeps it `working`).
200
+ */
201
+ recordPaymentVerified(task) {
202
+ const meta = ensureStatusMetadata(task, 'Payment verification recorded.');
203
+ meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_VERIFIED;
204
+ return task;
205
+ }
206
+ /**
207
+ * Record a deferred (batch) settlement on a Task: the payload was verified but
208
+ * on-chain settlement is deferred out-of-band (the handler never confirms it).
209
+ * Sets `payment-verified` PLUS the Nevermined `x402.payment.settlement: 'deferred'`
210
+ * marker, so a client can tell it will be charged out-of-band — distinct from a
211
+ * plain verify where nothing is owed.
212
+ */
213
+ recordPaymentDeferred(task) {
214
+ const meta = ensureStatusMetadata(task, 'Payment verified; settlement deferred.');
215
+ meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_VERIFIED;
216
+ meta[X402_SETTLEMENT_DEFERRED_KEY] = 'deferred';
217
+ return task;
218
+ }
219
+ /**
220
+ * Record a successful settlement on a Task: sets the `x402.payment.status`
221
+ * metadata to `payment-completed` and stores the SettleResponse receipt under
222
+ * `x402.payment.receipts` (an array, per the spec).
223
+ */
224
+ recordPaymentSuccess(task, settleResponse) {
225
+ const meta = ensureStatusMetadata(task, 'Payment completed successfully.');
226
+ meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_COMPLETED;
227
+ if (settleResponse) {
228
+ meta[X402A2AUtils.RECEIPTS_KEY] = [settleResponse];
229
+ }
230
+ return task;
231
+ }
232
+ /**
233
+ * Record a payment failure on a Task: `x402.payment.status = payment-failed`,
234
+ * the error code under `x402.payment.error`, and (when available) the failed
235
+ * SettleResponse under `x402.payment.receipts`.
236
+ */
237
+ recordPaymentFailure(task, errorCode, errorResponse) {
238
+ const meta = ensureStatusMetadata(task, 'Payment failed.');
239
+ meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_FAILED;
240
+ meta[X402A2AUtils.ERROR_KEY] = errorCode;
241
+ if (errorResponse) {
242
+ meta[X402A2AUtils.RECEIPTS_KEY] = [errorResponse];
243
+ }
244
+ return task;
245
+ }
246
+ }
247
+ X402A2AUtils.STATUS_KEY = X402A2AMetadata.STATUS_KEY;
248
+ X402A2AUtils.REQUIRED_KEY = X402A2AMetadata.REQUIRED_KEY;
249
+ X402A2AUtils.PAYLOAD_KEY = X402A2AMetadata.PAYLOAD_KEY;
250
+ X402A2AUtils.RECEIPTS_KEY = X402A2AMetadata.RECEIPTS_KEY;
251
+ X402A2AUtils.ERROR_KEY = X402A2AMetadata.ERROR_KEY;
252
+ /** Shared singleton, matching the Python `X402A2AUtils()` usage pattern. */
253
+ export const x402A2AUtils = new X402A2AUtils();
254
+ //# sourceMappingURL=x402-a2a.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x402-a2a.js","sourceRoot":"","sources":["../../src/a2a/x402-a2a.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;;;GAKG;AACH,MAAM,CAAN,IAAY,aAaX;AAbD,WAAY,aAAa;IACvB,yEAAyE;IACzE,sDAAqC,CAAA;IACrC,0CAA0C;IAC1C,wDAAuC,CAAA;IACvC,mDAAmD;IACnD,sDAAqC,CAAA;IACrC,mDAAmD;IACnD,sDAAqC,CAAA;IACrC,sEAAsE;IACtE,wDAAuC,CAAA;IACvC,uEAAuE;IACvE,kDAAiC,CAAA;AACnC,CAAC,EAbW,aAAa,KAAb,aAAa,QAaxB;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,kCAAkC;IAClC,UAAU,EAAE,qBAAqB;IACjC,kCAAkC;IAClC,YAAY,EAAE,uBAAuB;IACrC,+CAA+C;IAC/C,WAAW,EAAE,sBAAsB;IACnC,0DAA0D;IAC1D,YAAY,EAAE,uBAAuB;IACrC,6BAA6B;IAC7B,SAAS,EAAE,oBAAoB;CACvB,CAAA;AAEV;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,yBAAyB,CAAA;AAErE;;;;;GAKG;AACH,MAAM,8BAA8B,GAAG,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python SDK's `payments_py/x402/a2a.py` `X402A2AUtils`. These\n * helpers bridge the x402 payment protocol with the A2A (Agent-to-Agent)\n * protocol, signalling payment state *in band* through A2A Task / Message\n * metadata instead of HTTP status codes and headers.\n *\n * The A2A transport equivalent of the MCP transport's `_meta[\"x402/payment\"]`\n * keys is the A2A **task / message metadata** under the spec-defined\n * `x402.payment.*` keys (see {@link X402A2AMetadata}). The wire shapes are\n * defined by:\n * - Coinbase x402 v2 A2A transport: specs/transports-v2/a2a.md\n * - A2A x402 extension: https://github.com/google-agentic-commerce/a2a-x402\n *\n * These constants/keys are part of the specification and MUST NOT be changed.\n */\n\nimport type { Message, Task, TaskStatus } from '@a2a-js/sdk'\nimport type { SettlePermissionsResult, X402PaymentRequired } from '../x402/facilitator-api.js'\n\n/**\n * Protocol-defined payment states for the A2A x402 flow.\n *\n * Tracked in the `x402.payment.status` metadata field. Values are part of the\n * A2A x402 specification (Section 6: State Management) and must not be changed.\n */\nexport enum PaymentStatus {\n /** Payment requirements sent to client (task state `input-required`). */\n PAYMENT_REQUIRED = 'payment-required',\n /** Payment payload received by server. */\n PAYMENT_SUBMITTED = 'payment-submitted',\n /** Payment payload verified by the facilitator. */\n PAYMENT_VERIFIED = 'payment-verified',\n /** Payment requirements rejected by the client. */\n PAYMENT_REJECTED = 'payment-rejected',\n /** Payment settled on-chain successfully (task state `completed`). */\n PAYMENT_COMPLETED = 'payment-completed',\n /** Payment verification or settlement failed (task state `failed`). */\n PAYMENT_FAILED = 'payment-failed',\n}\n\n/**\n * Spec-defined A2A task / message metadata keys for the x402 protocol.\n *\n * As defined in the A2A x402 specification (Section 6: State Management). These\n * keys are part of the specification and must not be changed. Note these are\n * NOT the MCP `_meta[\"x402/payment\"]` keys — A2A signals payment state through\n * Task / Message `metadata` instead.\n */\nexport const X402A2AMetadata = {\n /** Current payment flow stage. */\n STATUS_KEY: 'x402.payment.status',\n /** X402PaymentRequired object. */\n REQUIRED_KEY: 'x402.payment.required',\n /** PaymentPayload object (client → server). */\n PAYLOAD_KEY: 'x402.payment.payload',\n /** Array of SettleResponse receipts (server → client). */\n RECEIPTS_KEY: 'x402.payment.receipts',\n /** Error code on failure. */\n ERROR_KEY: 'x402.payment.error',\n} as const\n\n/**\n * Nevermined-specific (non-core-spec) marker set alongside `payment-verified`\n * when on-chain settlement is **deferred** to a batch process this handler does\n * not confirm. Lets a client distinguish \"verified, will be charged out-of-band\"\n * from a plain verify; spec-only clients ignore the unknown key. Value: `'deferred'`.\n */\nexport const X402_SETTLEMENT_DEFERRED_KEY = 'x402.payment.settlement'\n\n/**\n * Upper bound on the serialized size of an in-band payment payload. The payload\n * is untrusted client input that gets re-encoded into a token, so cap it as\n * defense-in-depth (parity with the MCP `readPaymentPayload` and the Python\n * sibling's `len(json.dumps(value))` guard).\n */\nconst MAX_INBAND_PAYMENT_PAYLOAD_LEN = 64 * 1024\n\n/** Type guard: a plain (non-null, non-array) object, mirroring `isinstance(value, dict)`. */\nfunction isPlainObject(value: unknown): value is Record<string, any> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\n/**\n * Read x402 payment metadata from a Message's `metadata`, ignoring non-object values.\n */\nfunction metaOf(message?: Message | null): Record<string, any> | undefined {\n const metadata = message?.metadata\n return isPlainObject(metadata) ? metadata : undefined\n}\n\n/**\n * Ensure a Task has a status with a status message carrying a `metadata` object,\n * returning that metadata object for mutation by the record* helpers.\n *\n * The task is mutated in place (the A2A SDK's ResultManager / event flow operate\n * on task objects by reference), mirroring the Python `X402A2AUtils` behavior.\n */\nfunction ensureStatusMetadata(task: Task, defaultText: string): Record<string, any> {\n if (!task.status) {\n task.status = { state: 'working' } as TaskStatus\n }\n if (!task.status.message) {\n task.status.message = {\n kind: 'message',\n messageId: `${task.id}-status`,\n role: 'agent',\n parts: [{ kind: 'text', text: defaultText }],\n metadata: {},\n }\n }\n if (!isPlainObject(task.status.message.metadata)) {\n task.status.message.metadata = {}\n }\n return task.status.message.metadata as Record<string, any>\n}\n\n/**\n * Utilities for managing x402 payment state in A2A messages and tasks.\n *\n * Provides methods to extract payment status / requirements / payload from\n * incoming A2A messages and tasks, and to stamp payment-required, verified,\n * completed and failed state onto outgoing tasks — all via the spec-defined\n * `x402.payment.*` metadata keys.\n */\nexport class X402A2AUtils {\n static readonly STATUS_KEY = X402A2AMetadata.STATUS_KEY\n static readonly REQUIRED_KEY = X402A2AMetadata.REQUIRED_KEY\n static readonly PAYLOAD_KEY = X402A2AMetadata.PAYLOAD_KEY\n static readonly RECEIPTS_KEY = X402A2AMetadata.RECEIPTS_KEY\n static readonly ERROR_KEY = X402A2AMetadata.ERROR_KEY\n\n // ---- Extraction (client/server reads) ------------------------------------\n\n /** Extract the payment status from a Message's metadata, or `undefined`. */\n getPaymentStatusFromMessage(message?: Message | null): string | undefined {\n const meta = metaOf(message)\n const value = meta?.[X402A2AUtils.STATUS_KEY]\n return typeof value === 'string' ? value : undefined\n }\n\n /** Extract the payment status from a Task's status message metadata, or `undefined`. */\n getPaymentStatus(task?: Task | null): string | undefined {\n return this.getPaymentStatusFromMessage(task?.status?.message)\n }\n\n /**\n * Extract the X402PaymentRequired object from a Message's metadata.\n *\n * Returns the raw object (already spec-shaped JSON). Returns `undefined` when\n * absent or not a plain object.\n */\n getPaymentRequirementsFromMessage(message?: Message | null): X402PaymentRequired | undefined {\n const meta = metaOf(message)\n const value = meta?.[X402A2AUtils.REQUIRED_KEY]\n // Structural guard before asserting the typed shape: a valid\n // X402PaymentRequired is a plain object carrying a numeric `x402Version` and\n // an `accepts` array. Anything else is treated as absent (never assert the\n // rich interface over arbitrary, unvalidated metadata).\n if (\n !isPlainObject(value) ||\n typeof (value as Record<string, unknown>).x402Version !== 'number' ||\n !Array.isArray((value as Record<string, unknown>).accepts)\n ) {\n return undefined\n }\n return value as unknown as X402PaymentRequired\n }\n\n /** Extract the X402PaymentRequired object from a Task's status message metadata. */\n getPaymentRequirements(task?: Task | null): X402PaymentRequired | undefined {\n return this.getPaymentRequirementsFromMessage(task?.status?.message)\n }\n\n /**\n * Extract the in-band PaymentPayload object from a Message's metadata.\n *\n * The payload is untrusted client input that the server re-encodes into an\n * access token, so this rejects null, arrays and oversized payloads\n * (defense-in-depth, parity with the MCP `readPaymentPayload`).\n *\n * @returns The PaymentPayload object, or `undefined` when absent/invalid.\n */\n getPaymentPayloadFromMessage(message?: Message | null): Record<string, any> | undefined {\n const meta = metaOf(message)\n const value = meta?.[X402A2AUtils.PAYLOAD_KEY]\n if (!isPlainObject(value)) {\n return undefined\n }\n if (JSON.stringify(value).length > MAX_INBAND_PAYMENT_PAYLOAD_LEN) {\n return undefined\n }\n return value\n }\n\n /** Extract the in-band PaymentPayload object from a Task's status message metadata. */\n getPaymentPayload(task?: Task | null): Record<string, any> | undefined {\n return this.getPaymentPayloadFromMessage(task?.status?.message)\n }\n\n // ---- Stamping (server writes) --------------------------------------------\n\n /**\n * Set a Task to the payment-required state (`input-required`) with the\n * X402PaymentRequired object in `x402.payment.required` metadata.\n *\n * Mutates and returns `task` (in place), per the x402 v2 A2A transport.\n */\n createPaymentRequiredTask(task: Task, paymentRequired: X402PaymentRequired): Task {\n if (!task.status) {\n task.status = { state: 'input-required' } as TaskStatus\n } else {\n task.status.state = 'input-required'\n }\n const meta = ensureStatusMetadata(task, 'Payment is required for this service.')\n meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_REQUIRED\n meta[X402A2AUtils.REQUIRED_KEY] = paymentRequired\n return task\n }\n\n /**\n * Record payment verification on a Task: sets the `x402.payment.status`\n * metadata to `payment-verified`. Task state is left to the caller (the spec\n * keeps it `working`).\n */\n recordPaymentVerified(task: Task): Task {\n const meta = ensureStatusMetadata(task, 'Payment verification recorded.')\n meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_VERIFIED\n return task\n }\n\n /**\n * Record a deferred (batch) settlement on a Task: the payload was verified but\n * on-chain settlement is deferred out-of-band (the handler never confirms it).\n * Sets `payment-verified` PLUS the Nevermined `x402.payment.settlement: 'deferred'`\n * marker, so a client can tell it will be charged out-of-band — distinct from a\n * plain verify where nothing is owed.\n */\n recordPaymentDeferred(task: Task): Task {\n const meta = ensureStatusMetadata(task, 'Payment verified; settlement deferred.')\n meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_VERIFIED\n meta[X402_SETTLEMENT_DEFERRED_KEY] = 'deferred'\n return task\n }\n\n /**\n * Record a successful settlement on a Task: sets the `x402.payment.status`\n * metadata to `payment-completed` and stores the SettleResponse receipt under\n * `x402.payment.receipts` (an array, per the spec).\n */\n recordPaymentSuccess(task: Task, settleResponse?: SettlePermissionsResult): Task {\n const meta = ensureStatusMetadata(task, 'Payment completed successfully.')\n meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_COMPLETED\n if (settleResponse) {\n meta[X402A2AUtils.RECEIPTS_KEY] = [settleResponse]\n }\n return task\n }\n\n /**\n * Record a payment failure on a Task: `x402.payment.status = payment-failed`,\n * the error code under `x402.payment.error`, and (when available) the failed\n * SettleResponse under `x402.payment.receipts`.\n */\n recordPaymentFailure(\n task: Task,\n errorCode: string,\n errorResponse?: SettlePermissionsResult,\n ): Task {\n const meta = ensureStatusMetadata(task, 'Payment failed.')\n meta[X402A2AUtils.STATUS_KEY] = PaymentStatus.PAYMENT_FAILED\n meta[X402A2AUtils.ERROR_KEY] = errorCode\n if (errorResponse) {\n meta[X402A2AUtils.RECEIPTS_KEY] = [errorResponse]\n }\n return task\n }\n}\n\n/** Shared singleton, matching the Python `X402A2AUtils()` usage pattern. */\nexport const x402A2AUtils = new X402A2AUtils()\n"]}
@@ -132,6 +132,25 @@ export declare class AgentsAPI extends BasePaymentsAPI {
132
132
  * ```
133
133
  */
134
134
  getAgentPlans(agentId: string, pagination?: PaginationOptions): Promise<any>;
135
+ /**
136
+ * Lists the AI agents **you** published (the authenticated caller's own
137
+ * agents). This is account management, not a marketplace search — it never
138
+ * returns other users' agents.
139
+ *
140
+ * @param page - The page number to retrieve.
141
+ * @param offset - The number of items per page.
142
+ * @param sortBy - The field to sort the results by.
143
+ * @param sortOrder - The order in which to sort the results.
144
+ * @param orgId - Optional organization id. When set, returns every agent in
145
+ * that organization (requires active membership) instead of the caller's.
146
+ * @returns A promise that resolves to the paginated list of your agents.
147
+ */
148
+ getAgents(page?: number, offset?: number, sortBy?: string, sortOrder?: 'asc' | 'desc', orgId?: string): Promise<{
149
+ total: number;
150
+ page: number;
151
+ offset: number;
152
+ agents: any[];
153
+ }>;
135
154
  /**
136
155
  * Adds an existing Payment Plan to an AI Agent.
137
156
  * After this operation, users with access to the Payment Plan will be able to access the AI Agent.
@@ -1 +1 @@
1
- {"version":3,"file":"agents-api.d.ts","sourceRoot":"","sources":["../../src/api/agents-api.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAA6B,MAAM,oBAAoB,CAAA;AAWnG,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE5D;;GAEG;AACH,qBAAa,SAAU,SAAQ,eAAe;IAC5C;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS;IAItD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACU,aAAa,CACxB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,kBAAkB,EAC5B,YAAY,EAAE,MAAM,EAAE,EACtB,kBAAkB,CAAC,EAAE,kBAAkB,GACtC,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAsB/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACU,oBAAoB,CAC/B,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,kBAAkB,EAC5B,YAAY,EAAE,YAAY,EAC1B,WAAW,E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