primcli 1.7.0 → 1.9.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.
@@ -31,11 +31,15 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
31
31
  createAgentAccount: () => createAgentAccount,
32
32
  createAgentClaimLink: () => createAgentClaimLink,
33
33
  createChallenge: () => createChallenge,
34
+ createEmailChallenge: () => createEmailChallenge,
34
35
  createEndpoint: () => createEndpoint,
35
36
  createFilter: () => createFilter,
36
37
  createFunction: () => createFunction,
37
38
  createFunctionSecret: () => createFunctionSecret,
38
39
  createOrgSecret: () => createOrgSecret,
40
+ createRegistry: () => createRegistry,
41
+ decideRegistryRequest: () => decideRegistryRequest,
42
+ defineAgent: () => defineAgent,
39
43
  deleteDomain: () => deleteDomain,
40
44
  deleteEmail: () => deleteEmail,
41
45
  deleteEndpoint: () => deleteEndpoint,
@@ -48,6 +52,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
48
52
  downloadDomainZoneFile: () => downloadDomainZoneFile,
49
53
  downloadRawEmail: () => downloadRawEmail,
50
54
  getAccount: () => getAccount,
55
+ getAgent: () => getAgent,
51
56
  getChallenge: () => getChallenge,
52
57
  getConversation: () => getConversation,
53
58
  getEmail: () => getEmail,
@@ -56,6 +61,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
56
61
  getFunctionTestRunTrace: () => getFunctionTestRunTrace,
57
62
  getInboxStatus: () => getInboxStatus,
58
63
  getOrgRoutingTopology: () => getOrgRoutingTopology,
64
+ getRegistry: () => getRegistry,
59
65
  getSendPermissions: () => getSendPermissions,
60
66
  getSentEmail: () => getSentEmail,
61
67
  getSpendPolicy: () => getSpendPolicy,
@@ -73,15 +79,20 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
73
79
  listFunctions: () => listFunctions,
74
80
  listOrgSecrets: () => listOrgSecrets,
75
81
  listPayoutAddresses: () => listPayoutAddresses,
82
+ listRegistries: () => listRegistries,
83
+ listRegistryAgents: () => listRegistryAgents,
84
+ listRegistryRequests: () => listRegistryRequests,
76
85
  listSentEmails: () => listSentEmails,
77
86
  payChallenge: () => payChallenge,
78
87
  pollCliLogin: () => pollCliLogin,
88
+ publishAgent: () => publishAgent,
79
89
  registerPayoutAddress: () => registerPayoutAddress,
80
90
  replayDelivery: () => replayDelivery,
81
91
  replayEmailWebhooks: () => replayEmailWebhooks,
82
92
  replyToEmail: () => replyToEmail,
83
93
  resendAgentSignupVerification: () => resendAgentSignupVerification,
84
94
  resendCliSignupVerification: () => resendCliSignupVerification,
95
+ resolveRegistryHandle: () => resolveRegistryHandle,
85
96
  rotateWebhookSecret: () => rotateWebhookSecret,
86
97
  searchEmails: () => searchEmails,
87
98
  semanticSearch: () => semanticSearch,
@@ -95,12 +106,14 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
95
106
  startCliSignup: () => startCliSignup,
96
107
  testEndpoint: () => testEndpoint,
97
108
  testFunction: () => testFunction,
109
+ unpublishAgent: () => unpublishAgent,
98
110
  unsetFunctionRoute: () => unsetFunctionRoute,
99
111
  updateAccount: () => updateAccount,
100
112
  updateDomain: () => updateDomain,
101
113
  updateEndpoint: () => updateEndpoint,
102
114
  updateFilter: () => updateFilter,
103
115
  updateFunction: () => updateFunction,
116
+ updateRegistry: () => updateRegistry,
104
117
  updateSpendPolicy: () => updateSpendPolicy,
105
118
  verifyAgentClaim: () => verifyAgentClaim,
106
119
  verifyAgentSignup: () => verifyAgentSignup,
@@ -1671,6 +1684,34 @@ const registerPayoutAddress = (options) => (options.client ?? client).post({
1671
1684
  }
1672
1685
  });
1673
1686
  /**
1687
+ * Create an email-native payment challenge
1688
+ *
1689
+ * Issue an x402 payment challenge over a real email thread (the payee
1690
+ * side). Unlike `createChallenge` (which mints a synthetic challenge id),
1691
+ * this sends the challenge as an email from `from` to `to` and binds the
1692
+ * payment to that DKIM-authenticated thread. The `pay_to` address and the
1693
+ * token asset are resolved server-side from your registered default payout
1694
+ * address for the network, never from the request. The response carries
1695
+ * the thread's `interaction_id` plus the `challenge` (the
1696
+ * `payment_requirements`, the `nonce_binding`, and `expires_at`) the payer
1697
+ * needs to sign; the payer replies with a signed `payment` interaction
1698
+ * step. Amounts are in token base units (USDC has 6 decimals, so `"10000"`
1699
+ * is 0.01 USDC).
1700
+ *
1701
+ */
1702
+ const createEmailChallenge = (options) => (options.client ?? client).post({
1703
+ security: [{
1704
+ scheme: "bearer",
1705
+ type: "http"
1706
+ }],
1707
+ url: "/x402/email-challenges",
1708
+ ...options,
1709
+ headers: {
1710
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
1711
+ ...options.headers
1712
+ }
1713
+ });
1714
+ /**
1674
1715
  * Create a payment challenge
1675
1716
  *
1676
1717
  * Create an x402 payment challenge (the payee side of a payment). The
@@ -1790,6 +1831,142 @@ const listDeclinedPayments = (options) => (options?.client ?? client).get({
1790
1831
  url: "/x402/declined-payments",
1791
1832
  ...options
1792
1833
  });
1834
+ /**
1835
+ * List the registries you own
1836
+ */
1837
+ const listRegistries = (options) => (options?.client ?? client).get({
1838
+ security: [{
1839
+ scheme: "bearer",
1840
+ type: "http"
1841
+ }],
1842
+ url: "/registries",
1843
+ ...options
1844
+ });
1845
+ /**
1846
+ * Create a registry
1847
+ */
1848
+ const createRegistry = (options) => (options.client ?? client).post({
1849
+ security: [{
1850
+ scheme: "bearer",
1851
+ type: "http"
1852
+ }],
1853
+ url: "/registries",
1854
+ ...options,
1855
+ headers: {
1856
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
1857
+ ...options.headers
1858
+ }
1859
+ });
1860
+ /**
1861
+ * Get a public registry's metadata
1862
+ */
1863
+ const getRegistry = (options) => (options.client ?? client).get({
1864
+ url: "/registries/{slug}",
1865
+ ...options
1866
+ });
1867
+ /**
1868
+ * Update a registry you own
1869
+ */
1870
+ const updateRegistry = (options) => (options.client ?? client).patch({
1871
+ security: [{
1872
+ scheme: "bearer",
1873
+ type: "http"
1874
+ }],
1875
+ url: "/registries/{slug}",
1876
+ ...options,
1877
+ headers: {
1878
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
1879
+ ...options.headers
1880
+ }
1881
+ });
1882
+ /**
1883
+ * List agents in a registry
1884
+ */
1885
+ const listRegistryAgents = (options) => (options.client ?? client).get({
1886
+ url: "/registries/{slug}/agents",
1887
+ ...options
1888
+ });
1889
+ /**
1890
+ * Publish an agent into a registry
1891
+ */
1892
+ const publishAgent = (options) => (options.client ?? client).post({
1893
+ security: [{
1894
+ scheme: "bearer",
1895
+ type: "http"
1896
+ }],
1897
+ url: "/registries/{slug}/agents",
1898
+ ...options,
1899
+ headers: {
1900
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
1901
+ ...options.headers
1902
+ }
1903
+ });
1904
+ /**
1905
+ * Unpublish an agent from a registry
1906
+ */
1907
+ const unpublishAgent = (options) => (options.client ?? client).delete({
1908
+ security: [{
1909
+ scheme: "bearer",
1910
+ type: "http"
1911
+ }],
1912
+ url: "/registries/{slug}/agents/{handle}",
1913
+ ...options
1914
+ });
1915
+ /**
1916
+ * Resolve a registry handle to its agent
1917
+ */
1918
+ const resolveRegistryHandle = (options) => (options.client ?? client).get({
1919
+ url: "/registries/{slug}/agents/{handle}",
1920
+ ...options
1921
+ });
1922
+ /**
1923
+ * List pending publication requests
1924
+ */
1925
+ const listRegistryRequests = (options) => (options.client ?? client).get({
1926
+ security: [{
1927
+ scheme: "bearer",
1928
+ type: "http"
1929
+ }],
1930
+ url: "/registries/{slug}/requests",
1931
+ ...options
1932
+ });
1933
+ /**
1934
+ * Approve or reject a publication request
1935
+ */
1936
+ const decideRegistryRequest = (options) => (options.client ?? client).post({
1937
+ security: [{
1938
+ scheme: "bearer",
1939
+ type: "http"
1940
+ }],
1941
+ url: "/registries/{slug}/requests/{id}",
1942
+ ...options,
1943
+ headers: {
1944
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
1945
+ ...options.headers
1946
+ }
1947
+ });
1948
+ /**
1949
+ * Define an agent identity
1950
+ */
1951
+ const defineAgent = (options) => (options.client ?? client).post({
1952
+ security: [{
1953
+ scheme: "bearer",
1954
+ type: "http"
1955
+ }],
1956
+ url: "/agents",
1957
+ ...options,
1958
+ headers: {
1959
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
1960
+ ...options.headers
1961
+ }
1962
+ });
1963
+ /**
1964
+ * Get an agent's public profile by address
1965
+ */
1966
+ const getAgent = (options) => (options.client ?? client).get({
1967
+ url: "/agents/{address}",
1968
+ ...options
1969
+ });
1793
1970
  //#endregion
1794
1971
  //#region ../packages/api-core/src/openapi/openapi.generated.ts
1795
1972
  /**
@@ -1877,6 +2054,10 @@ const openapiDocument = {
1877
2054
  {
1878
2055
  "name": "Functions",
1879
2056
  "description": "Deploy JavaScript handlers that run on inbound mail. Each function\nis a single ESM module whose default export is an object with an\nasync `fetch(request, env)` method, in the shape of a Workers-style\nhandler. Primitive signs each delivery and forwards the\n`Primitive-Signature` header to the handler; verify the raw request\nbody with `PRIMITIVE_WEBHOOK_SECRET` before trusting the parsed event.\nThe `event` field is `email.received` for normal inbound mail, or a\nmachine-mail type (`email.bounced`, `email.tls_report`,\n`email.dmarc_report`, `email.dmarc_failure`) for bounces and reports;\nthe payload shape is otherwise identical. Code runs on\nPrimitive's edge runtime; there is no infrastructure to manage.\nSecrets land in `env` as encrypted bindings and are refreshed on\nevery redeploy.\n"
2057
+ },
2058
+ {
2059
+ "name": "Registries",
2060
+ "description": "The Agent Registry: ownable directories of agents, addressable by a\nregistry-scoped handle. A registry's publish policy (owner_only, request,\nor open) decides whether a publish lists immediately or pends owner\napproval. An agent is defined once with a globally unique,\nreachability-verified address, then published into any registry under a\nhandle. Discovery reads (list, resolve, get) are public for public\nregistries; managing a registry and moderating requests use the owner's\nAPI key.\n"
1880
2061
  }
1881
2062
  ],
1882
2063
  "paths": {
@@ -4172,6 +4353,40 @@ const openapiDocument = {
4172
4353
  }
4173
4354
  }
4174
4355
  },
4356
+ "/x402/email-challenges": { "post": {
4357
+ "operationId": "createEmailChallenge",
4358
+ "summary": "Create an email-native payment challenge",
4359
+ "description": "Issue an x402 payment challenge over a real email thread (the payee\nside). Unlike `createChallenge` (which mints a synthetic challenge id),\nthis sends the challenge as an email from `from` to `to` and binds the\npayment to that DKIM-authenticated thread. The `pay_to` address and the\ntoken asset are resolved server-side from your registered default payout\naddress for the network, never from the request. The response carries\nthe thread's `interaction_id` plus the `challenge` (the\n`payment_requirements`, the `nonce_binding`, and `expires_at`) the payer\nneeds to sign; the payer replies with a signed `payment` interaction\nstep. Amounts are in token base units (USDC has 6 decimals, so `\"10000\"`\nis 0.01 USDC).\n",
4360
+ "tags": ["Payments"],
4361
+ "security": [{ "BearerAuth": [] }],
4362
+ "parameters": [{ "$ref": "#/components/parameters/IdempotencyKey" }],
4363
+ "requestBody": {
4364
+ "required": true,
4365
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateEmailChallengeInput" } } }
4366
+ },
4367
+ "responses": {
4368
+ "200": {
4369
+ "description": "Idempotent replay: a request with a previously-used idempotency key\nreturns the original issued challenge without sending a second email.\n",
4370
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
4371
+ "type": "object",
4372
+ "properties": { "data": { "$ref": "#/components/schemas/X402EmailChallenge" } }
4373
+ }] } } }
4374
+ },
4375
+ "201": {
4376
+ "description": "Email challenge issued",
4377
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
4378
+ "type": "object",
4379
+ "properties": { "data": { "$ref": "#/components/schemas/X402EmailChallenge" } }
4380
+ }] } } }
4381
+ },
4382
+ "400": { "$ref": "#/components/responses/ValidationError" },
4383
+ "401": { "$ref": "#/components/responses/Unauthorized" },
4384
+ "403": { "$ref": "#/components/responses/Forbidden" },
4385
+ "409": { "$ref": "#/components/responses/Conflict" },
4386
+ "422": { "$ref": "#/components/responses/UnprocessableEntity" },
4387
+ "429": { "$ref": "#/components/responses/RateLimited" }
4388
+ }
4389
+ } },
4175
4390
  "/x402/challenges": { "post": {
4176
4391
  "operationId": "createChallenge",
4177
4392
  "summary": "Create a payment challenge",
@@ -4314,69 +4529,388 @@ const openapiDocument = {
4314
4529
  "403": { "$ref": "#/components/responses/Forbidden" },
4315
4530
  "429": { "$ref": "#/components/responses/RateLimited" }
4316
4531
  }
4317
- } }
4318
- },
4319
- "components": {
4320
- "securitySchemes": {
4321
- "BearerAuth": {
4322
- "type": "http",
4323
- "scheme": "bearer",
4324
- "description": "API key with `prim_` prefix: `Authorization: Bearer prim_<key>`"
4532
+ } },
4533
+ "/registries": {
4534
+ "get": {
4535
+ "operationId": "listRegistries",
4536
+ "summary": "List the registries you own",
4537
+ "tags": ["Registries"],
4538
+ "responses": {
4539
+ "200": {
4540
+ "description": "Registries owned by the caller",
4541
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": {
4542
+ "type": "array",
4543
+ "items": { "$ref": "#/components/schemas/Registry" }
4544
+ } } }] } } }
4545
+ },
4546
+ "401": { "$ref": "#/components/responses/Unauthorized" }
4547
+ }
4325
4548
  },
4326
- "DownloadToken": {
4327
- "type": "apiKey",
4328
- "in": "query",
4329
- "name": "token",
4330
- "description": "Signed download token provided in webhook payloads"
4549
+ "post": {
4550
+ "operationId": "createRegistry",
4551
+ "summary": "Create a registry",
4552
+ "tags": ["Registries"],
4553
+ "requestBody": {
4554
+ "required": true,
4555
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateRegistryInput" } } }
4556
+ },
4557
+ "responses": {
4558
+ "201": {
4559
+ "description": "Registry created",
4560
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": {
4561
+ "type": "object",
4562
+ "properties": {
4563
+ "id": {
4564
+ "type": "string",
4565
+ "format": "uuid"
4566
+ },
4567
+ "slug": { "type": "string" }
4568
+ },
4569
+ "required": ["id", "slug"]
4570
+ } } }] } } }
4571
+ },
4572
+ "401": { "$ref": "#/components/responses/Unauthorized" },
4573
+ "403": { "$ref": "#/components/responses/Forbidden" },
4574
+ "409": { "$ref": "#/components/responses/Conflict" },
4575
+ "422": { "$ref": "#/components/responses/ValidationError" }
4576
+ }
4331
4577
  }
4332
4578
  },
4333
- "parameters": {
4334
- "ResourceId": {
4335
- "name": "id",
4579
+ "/registries/{slug}": {
4580
+ "parameters": [{
4581
+ "name": "slug",
4336
4582
  "in": "path",
4337
4583
  "required": true,
4338
- "schema": {
4339
- "type": "string",
4340
- "format": "uuid"
4341
- },
4342
- "description": "Resource UUID"
4343
- },
4344
- "Cursor": {
4345
- "name": "cursor",
4346
- "in": "query",
4347
4584
  "schema": { "type": "string" },
4348
- "description": "Pagination cursor from a previous response's `meta.cursor` field.\nFormat: `{ISO-datetime}|{id}`\n"
4585
+ "description": "The registry slug"
4586
+ }],
4587
+ "get": {
4588
+ "operationId": "getRegistry",
4589
+ "summary": "Get a public registry's metadata",
4590
+ "tags": ["Registries"],
4591
+ "security": [],
4592
+ "responses": {
4593
+ "200": {
4594
+ "description": "Registry metadata",
4595
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": { "$ref": "#/components/schemas/Registry" } } }] } } }
4596
+ },
4597
+ "404": { "$ref": "#/components/responses/NotFound" }
4598
+ }
4349
4599
  },
4350
- "Limit": {
4351
- "name": "limit",
4352
- "in": "query",
4353
- "schema": {
4354
- "type": "integer",
4355
- "minimum": 1,
4356
- "maximum": 100,
4357
- "default": 50
4600
+ "patch": {
4601
+ "operationId": "updateRegistry",
4602
+ "summary": "Update a registry you own",
4603
+ "tags": ["Registries"],
4604
+ "requestBody": {
4605
+ "required": true,
4606
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateRegistryInput" } } }
4358
4607
  },
4359
- "description": "Number of results per page"
4608
+ "responses": {
4609
+ "200": {
4610
+ "description": "Registry updated",
4611
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": {
4612
+ "type": "object",
4613
+ "properties": { "id": {
4614
+ "type": "string",
4615
+ "format": "uuid"
4616
+ } },
4617
+ "required": ["id"]
4618
+ } } }] } } }
4619
+ },
4620
+ "401": { "$ref": "#/components/responses/Unauthorized" },
4621
+ "403": { "$ref": "#/components/responses/Forbidden" },
4622
+ "404": { "$ref": "#/components/responses/NotFound" },
4623
+ "422": { "$ref": "#/components/responses/ValidationError" }
4624
+ }
4360
4625
  }
4361
4626
  },
4362
- "responses": {
4363
- "Unauthorized": {
4364
- "description": "Invalid or missing API key",
4365
- "content": { "application/json": {
4366
- "schema": { "$ref": "#/components/schemas/ErrorResponse" },
4367
- "example": {
4368
- "success": false,
4369
- "error": {
4370
- "code": "unauthorized",
4371
- "message": "Invalid or missing API key"
4372
- }
4627
+ "/registries/{slug}/agents": {
4628
+ "parameters": [{
4629
+ "name": "slug",
4630
+ "in": "path",
4631
+ "required": true,
4632
+ "schema": { "type": "string" }
4633
+ }],
4634
+ "get": {
4635
+ "operationId": "listRegistryAgents",
4636
+ "summary": "List agents in a registry",
4637
+ "tags": ["Registries"],
4638
+ "security": [],
4639
+ "parameters": [{
4640
+ "name": "limit",
4641
+ "in": "query",
4642
+ "required": false,
4643
+ "schema": {
4644
+ "type": "integer",
4645
+ "minimum": 1,
4646
+ "maximum": 200
4373
4647
  }
4648
+ }, {
4649
+ "name": "cursor",
4650
+ "in": "query",
4651
+ "required": false,
4652
+ "schema": { "type": "string" },
4653
+ "description": "The address of the last agent from the previous page."
4654
+ }],
4655
+ "responses": { "200": {
4656
+ "description": "Approved, reachable agents. Empty for an unknown or private registry.",
4657
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/ListEnvelope" }, { "properties": { "data": {
4658
+ "type": "array",
4659
+ "items": { "$ref": "#/components/schemas/RegistryAgent" }
4660
+ } } }] } } }
4374
4661
  } }
4375
4662
  },
4376
- "Forbidden": {
4377
- "description": "Authenticated caller lacks permission for the operation",
4378
- "content": { "application/json": {
4379
- "schema": { "$ref": "#/components/schemas/ErrorResponse" },
4663
+ "post": {
4664
+ "operationId": "publishAgent",
4665
+ "summary": "Publish an agent into a registry",
4666
+ "tags": ["Registries"],
4667
+ "requestBody": {
4668
+ "required": true,
4669
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublishAgentInput" } } }
4670
+ },
4671
+ "responses": {
4672
+ "200": {
4673
+ "description": "Idempotent replay of an existing publication",
4674
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": { "$ref": "#/components/schemas/PublishAgentResult" } } }] } } }
4675
+ },
4676
+ "201": {
4677
+ "description": "Published (approved) or request created (requested)",
4678
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": { "$ref": "#/components/schemas/PublishAgentResult" } } }] } } }
4679
+ },
4680
+ "401": { "$ref": "#/components/responses/Unauthorized" },
4681
+ "403": { "$ref": "#/components/responses/Forbidden" },
4682
+ "404": { "$ref": "#/components/responses/NotFound" },
4683
+ "409": { "$ref": "#/components/responses/Conflict" },
4684
+ "422": { "$ref": "#/components/responses/ValidationError" }
4685
+ }
4686
+ }
4687
+ },
4688
+ "/registries/{slug}/agents/{handle}": {
4689
+ "parameters": [{
4690
+ "name": "slug",
4691
+ "in": "path",
4692
+ "required": true,
4693
+ "schema": { "type": "string" }
4694
+ }, {
4695
+ "name": "handle",
4696
+ "in": "path",
4697
+ "required": true,
4698
+ "schema": { "type": "string" }
4699
+ }],
4700
+ "get": {
4701
+ "operationId": "resolveRegistryHandle",
4702
+ "summary": "Resolve a registry handle to its agent",
4703
+ "tags": ["Registries"],
4704
+ "security": [],
4705
+ "responses": {
4706
+ "200": {
4707
+ "description": "The agent listing under the handle",
4708
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": { "$ref": "#/components/schemas/RegistryAgent" } } }] } } }
4709
+ },
4710
+ "404": { "$ref": "#/components/responses/NotFound" }
4711
+ }
4712
+ },
4713
+ "delete": {
4714
+ "operationId": "unpublishAgent",
4715
+ "summary": "Unpublish an agent from a registry",
4716
+ "tags": ["Registries"],
4717
+ "responses": {
4718
+ "200": { "$ref": "#/components/responses/Deleted" },
4719
+ "401": { "$ref": "#/components/responses/Unauthorized" },
4720
+ "404": { "$ref": "#/components/responses/NotFound" }
4721
+ }
4722
+ }
4723
+ },
4724
+ "/registries/{slug}/requests": {
4725
+ "parameters": [{
4726
+ "name": "slug",
4727
+ "in": "path",
4728
+ "required": true,
4729
+ "schema": { "type": "string" }
4730
+ }],
4731
+ "get": {
4732
+ "operationId": "listRegistryRequests",
4733
+ "summary": "List pending publication requests",
4734
+ "tags": ["Registries"],
4735
+ "parameters": [{
4736
+ "name": "limit",
4737
+ "in": "query",
4738
+ "required": false,
4739
+ "schema": {
4740
+ "type": "integer",
4741
+ "minimum": 1,
4742
+ "maximum": 200
4743
+ }
4744
+ }],
4745
+ "responses": {
4746
+ "200": {
4747
+ "description": "Pending requests for a registry you own",
4748
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": {
4749
+ "type": "array",
4750
+ "items": { "$ref": "#/components/schemas/RegistryRequest" }
4751
+ } } }] } } }
4752
+ },
4753
+ "401": { "$ref": "#/components/responses/Unauthorized" },
4754
+ "404": { "$ref": "#/components/responses/NotFound" }
4755
+ }
4756
+ }
4757
+ },
4758
+ "/registries/{slug}/requests/{id}": {
4759
+ "parameters": [{
4760
+ "name": "slug",
4761
+ "in": "path",
4762
+ "required": true,
4763
+ "schema": { "type": "string" }
4764
+ }, { "$ref": "#/components/parameters/ResourceId" }],
4765
+ "post": {
4766
+ "operationId": "decideRegistryRequest",
4767
+ "summary": "Approve or reject a publication request",
4768
+ "tags": ["Registries"],
4769
+ "requestBody": {
4770
+ "required": true,
4771
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DecideRegistryRequestInput" } } }
4772
+ },
4773
+ "responses": {
4774
+ "200": {
4775
+ "description": "Decision applied",
4776
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": {
4777
+ "type": "object",
4778
+ "properties": { "status": {
4779
+ "type": "string",
4780
+ "enum": ["approved", "rejected"]
4781
+ } },
4782
+ "required": ["status"]
4783
+ } } }] } } }
4784
+ },
4785
+ "401": { "$ref": "#/components/responses/Unauthorized" },
4786
+ "404": { "$ref": "#/components/responses/NotFound" },
4787
+ "409": { "$ref": "#/components/responses/Conflict" },
4788
+ "422": { "$ref": "#/components/responses/ValidationError" }
4789
+ }
4790
+ }
4791
+ },
4792
+ "/agents": { "post": {
4793
+ "operationId": "defineAgent",
4794
+ "summary": "Define an agent identity",
4795
+ "tags": ["Registries"],
4796
+ "requestBody": {
4797
+ "required": true,
4798
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DefineAgentInput" } } }
4799
+ },
4800
+ "responses": {
4801
+ "201": {
4802
+ "description": "Agent defined",
4803
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": {
4804
+ "type": "object",
4805
+ "properties": {
4806
+ "id": {
4807
+ "type": "string",
4808
+ "format": "uuid"
4809
+ },
4810
+ "address": { "type": "string" }
4811
+ },
4812
+ "required": ["id", "address"]
4813
+ } } }] } } }
4814
+ },
4815
+ "401": { "$ref": "#/components/responses/Unauthorized" },
4816
+ "409": { "$ref": "#/components/responses/Conflict" },
4817
+ "422": { "$ref": "#/components/responses/ValidationError" }
4818
+ }
4819
+ } },
4820
+ "/agents/{address}": {
4821
+ "parameters": [{
4822
+ "name": "address",
4823
+ "in": "path",
4824
+ "required": true,
4825
+ "schema": { "type": "string" },
4826
+ "description": "The agent's email address (URL-encoded)."
4827
+ }],
4828
+ "get": {
4829
+ "operationId": "getAgent",
4830
+ "summary": "Get an agent's public profile by address",
4831
+ "tags": ["Registries"],
4832
+ "security": [],
4833
+ "responses": {
4834
+ "200": {
4835
+ "description": "The agent's public profile",
4836
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, { "properties": { "data": { "$ref": "#/components/schemas/RegistryAgent" } } }] } } }
4837
+ },
4838
+ "404": { "$ref": "#/components/responses/NotFound" }
4839
+ }
4840
+ }
4841
+ }
4842
+ },
4843
+ "components": {
4844
+ "securitySchemes": {
4845
+ "BearerAuth": {
4846
+ "type": "http",
4847
+ "scheme": "bearer",
4848
+ "description": "API key with `prim_` prefix: `Authorization: Bearer prim_<key>`"
4849
+ },
4850
+ "DownloadToken": {
4851
+ "type": "apiKey",
4852
+ "in": "query",
4853
+ "name": "token",
4854
+ "description": "Signed download token provided in webhook payloads"
4855
+ }
4856
+ },
4857
+ "parameters": {
4858
+ "ResourceId": {
4859
+ "name": "id",
4860
+ "in": "path",
4861
+ "required": true,
4862
+ "schema": {
4863
+ "type": "string",
4864
+ "format": "uuid"
4865
+ },
4866
+ "description": "Resource UUID"
4867
+ },
4868
+ "IdempotencyKey": {
4869
+ "name": "idempotency-key",
4870
+ "in": "header",
4871
+ "required": false,
4872
+ "schema": {
4873
+ "type": "string",
4874
+ "maxLength": 255
4875
+ },
4876
+ "description": "Optional idempotency key. Retrying a request with the same key returns\nthe original result instead of repeating the side effect (for\n`createEmailChallenge`, re-sending the email).\n"
4877
+ },
4878
+ "Cursor": {
4879
+ "name": "cursor",
4880
+ "in": "query",
4881
+ "schema": { "type": "string" },
4882
+ "description": "Pagination cursor from a previous response's `meta.cursor` field.\nFormat: `{ISO-datetime}|{id}`\n"
4883
+ },
4884
+ "Limit": {
4885
+ "name": "limit",
4886
+ "in": "query",
4887
+ "schema": {
4888
+ "type": "integer",
4889
+ "minimum": 1,
4890
+ "maximum": 100,
4891
+ "default": 50
4892
+ },
4893
+ "description": "Number of results per page"
4894
+ }
4895
+ },
4896
+ "responses": {
4897
+ "Unauthorized": {
4898
+ "description": "Invalid or missing API key",
4899
+ "content": { "application/json": {
4900
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" },
4901
+ "example": {
4902
+ "success": false,
4903
+ "error": {
4904
+ "code": "unauthorized",
4905
+ "message": "Invalid or missing API key"
4906
+ }
4907
+ }
4908
+ } }
4909
+ },
4910
+ "Forbidden": {
4911
+ "description": "Authenticated caller lacks permission for the operation",
4912
+ "content": { "application/json": {
4913
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" },
4380
4914
  "example": {
4381
4915
  "success": false,
4382
4916
  "error": {
@@ -4523,69 +5057,75 @@ const openapiDocument = {
4523
5057
  }
4524
5058
  },
4525
5059
  "schemas": {
4526
- "RegisterPayoutAddressInput": {
5060
+ "PublishPolicy": {
5061
+ "type": "string",
5062
+ "enum": [
5063
+ "owner_only",
5064
+ "request",
5065
+ "open"
5066
+ ],
5067
+ "description": "Who may publish into a registry. owner_only: only the registry owner.\nrequest: anyone may request and the owner approves. open: anyone may\npublish and it lists immediately (no approval step).\n"
5068
+ },
5069
+ "Registry": {
4527
5070
  "type": "object",
4528
- "additionalProperties": false,
4529
5071
  "properties": {
4530
- "address": {
4531
- "type": "string",
4532
- "pattern": "^0x[0-9a-fA-F]{40}$",
4533
- "description": "The payout address (your signer's own EVM address), 0x-prefixed."
4534
- },
4535
- "network": {
4536
- "type": "string",
4537
- "enum": ["base", "base-sepolia"],
4538
- "description": "The chain the address receives on."
4539
- },
4540
- "signature": {
5072
+ "id": {
4541
5073
  "type": "string",
4542
- "pattern": "^0x[0-9a-fA-F]+$",
4543
- "description": "A `personal_sign` signature over the org-bound message produced by\nthe SDK helper `buildPayoutRegistrationMessage`. Recovered and\nchecked against `address`; the org id is bound into the signed bytes.\n"
5074
+ "format": "uuid"
4544
5075
  },
4545
- "issued_at": {
4546
- "type": "string",
4547
- "format": "date-time",
4548
- "description": "ISO-8601 timestamp embedded in the signed message. Must be within a\nshort freshness window (about 10 minutes) of server time.\n"
5076
+ "slug": { "type": "string" },
5077
+ "name": { "type": "string" },
5078
+ "description": { "type": ["string", "null"] },
5079
+ "is_public": { "type": "boolean" },
5080
+ "publish_policy": { "$ref": "#/components/schemas/PublishPolicy" }
5081
+ },
5082
+ "required": [
5083
+ "id",
5084
+ "slug",
5085
+ "name",
5086
+ "description",
5087
+ "is_public",
5088
+ "publish_policy"
5089
+ ]
5090
+ },
5091
+ "RegistryAgent": {
5092
+ "type": "object",
5093
+ "description": "An agent's public directory profile.",
5094
+ "properties": {
5095
+ "address": { "type": "string" },
5096
+ "display_name": { "type": "string" },
5097
+ "title": { "type": ["string", "null"] },
5098
+ "description": { "type": ["string", "null"] },
5099
+ "tags": {
5100
+ "type": "array",
5101
+ "items": { "type": "string" }
4549
5102
  },
4550
- "label": {
4551
- "type": "string",
4552
- "maxLength": 80,
4553
- "description": "Optional human-readable label."
5103
+ "handle": {
5104
+ "type": ["string", "null"],
5105
+ "description": "The registry-scoped name. Null on the global by-address read."
4554
5106
  }
4555
5107
  },
4556
5108
  "required": [
4557
5109
  "address",
4558
- "network",
4559
- "signature",
4560
- "issued_at"
5110
+ "display_name",
5111
+ "title",
5112
+ "description",
5113
+ "tags",
5114
+ "handle"
4561
5115
  ]
4562
5116
  },
4563
- "X402PayoutAddress": {
5117
+ "RegistryRequest": {
4564
5118
  "type": "object",
5119
+ "description": "A pending publication request, as the registry owner sees it.",
4565
5120
  "properties": {
4566
5121
  "id": {
4567
5122
  "type": "string",
4568
5123
  "format": "uuid"
4569
5124
  },
4570
- "address": {
4571
- "type": "string",
4572
- "description": "The checksummed payout address."
4573
- },
4574
- "network": {
4575
- "type": "string",
4576
- "enum": ["base", "base-sepolia"]
4577
- },
4578
- "label": { "type": ["string", "null"] },
4579
- "is_default": {
4580
- "type": "boolean",
4581
- "description": "Exactly one address per (org, network) is the default."
4582
- },
4583
- "verified_at": {
4584
- "type": "string",
4585
- "format": "date-time",
4586
- "description": "When ownership of the address was last proven."
4587
- },
4588
- "created_at": {
5125
+ "address": { "type": "string" },
5126
+ "display_name": { "type": "string" },
5127
+ "handle": { "type": ["string", "null"] },
5128
+ "requested_at": {
4589
5129
  "type": "string",
4590
5130
  "format": "date-time"
4591
5131
  }
@@ -4593,24 +5133,216 @@ const openapiDocument = {
4593
5133
  "required": [
4594
5134
  "id",
4595
5135
  "address",
4596
- "network",
4597
- "label",
4598
- "is_default",
4599
- "verified_at"
5136
+ "display_name",
5137
+ "handle",
5138
+ "requested_at"
4600
5139
  ]
4601
5140
  },
4602
- "CreateChallengeInput": {
5141
+ "CreateRegistryInput": {
4603
5142
  "type": "object",
4604
- "additionalProperties": false,
4605
5143
  "properties": {
4606
- "amount": {
5144
+ "slug": {
4607
5145
  "type": "string",
4608
- "pattern": "^[1-9][0-9]{0,38}$",
4609
- "description": "Amount to collect, in token base units. USDC has 6 decimals, so\n`\"10000\"` is 0.01 USDC.\n"
5146
+ "pattern": "^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$",
5147
+ "description": "Lowercase slug, unique across registries."
4610
5148
  },
4611
- "network": {
5149
+ "name": {
4612
5150
  "type": "string",
4613
- "enum": ["base", "base-sepolia"]
5151
+ "minLength": 1,
5152
+ "maxLength": 120
5153
+ },
5154
+ "description": {
5155
+ "type": ["string", "null"],
5156
+ "maxLength": 2e3
5157
+ },
5158
+ "is_public": { "type": "boolean" },
5159
+ "publish_policy": { "$ref": "#/components/schemas/PublishPolicy" }
5160
+ },
5161
+ "required": ["slug", "name"]
5162
+ },
5163
+ "UpdateRegistryInput": {
5164
+ "type": "object",
5165
+ "minProperties": 1,
5166
+ "properties": {
5167
+ "name": {
5168
+ "type": "string",
5169
+ "minLength": 1,
5170
+ "maxLength": 120
5171
+ },
5172
+ "description": {
5173
+ "type": ["string", "null"],
5174
+ "maxLength": 2e3
5175
+ },
5176
+ "is_public": { "type": "boolean" },
5177
+ "publish_policy": { "$ref": "#/components/schemas/PublishPolicy" }
5178
+ }
5179
+ },
5180
+ "DefineAgentInput": {
5181
+ "type": "object",
5182
+ "properties": {
5183
+ "address": {
5184
+ "type": "string",
5185
+ "description": "The agent's globally unique email address; must route to the endpoint."
5186
+ },
5187
+ "endpoint_id": {
5188
+ "type": "string",
5189
+ "format": "uuid"
5190
+ },
5191
+ "display_name": {
5192
+ "type": "string",
5193
+ "minLength": 1,
5194
+ "maxLength": 120
5195
+ },
5196
+ "title": {
5197
+ "type": ["string", "null"],
5198
+ "maxLength": 120
5199
+ },
5200
+ "description": {
5201
+ "type": ["string", "null"],
5202
+ "maxLength": 2e3
5203
+ },
5204
+ "tags": {
5205
+ "type": "array",
5206
+ "items": {
5207
+ "type": "string",
5208
+ "maxLength": 40
5209
+ },
5210
+ "maxItems": 20
5211
+ }
5212
+ },
5213
+ "required": [
5214
+ "address",
5215
+ "endpoint_id",
5216
+ "display_name"
5217
+ ]
5218
+ },
5219
+ "PublishAgentInput": {
5220
+ "type": "object",
5221
+ "properties": {
5222
+ "address": { "type": "string" },
5223
+ "handle": {
5224
+ "type": "string",
5225
+ "description": "The registry-scoped name to list the agent under."
5226
+ }
5227
+ },
5228
+ "required": ["address", "handle"]
5229
+ },
5230
+ "PublishAgentResult": {
5231
+ "type": "object",
5232
+ "properties": {
5233
+ "status": {
5234
+ "type": "string",
5235
+ "enum": ["approved", "requested"],
5236
+ "description": "approved lists immediately; requested pends owner approval."
5237
+ },
5238
+ "handle": { "type": "string" },
5239
+ "idempotent_replay": {
5240
+ "type": "boolean",
5241
+ "description": "True when the publish matched an existing identical publication."
5242
+ }
5243
+ },
5244
+ "required": [
5245
+ "status",
5246
+ "handle",
5247
+ "idempotent_replay"
5248
+ ]
5249
+ },
5250
+ "DecideRegistryRequestInput": {
5251
+ "type": "object",
5252
+ "properties": { "decision": {
5253
+ "type": "string",
5254
+ "enum": ["approved", "rejected"]
5255
+ } },
5256
+ "required": ["decision"]
5257
+ },
5258
+ "RegisterPayoutAddressInput": {
5259
+ "type": "object",
5260
+ "additionalProperties": false,
5261
+ "properties": {
5262
+ "address": {
5263
+ "type": "string",
5264
+ "pattern": "^0x[0-9a-fA-F]{40}$",
5265
+ "description": "The payout address (your signer's own EVM address), 0x-prefixed."
5266
+ },
5267
+ "network": {
5268
+ "type": "string",
5269
+ "enum": ["base", "base-sepolia"],
5270
+ "description": "The chain the address receives on."
5271
+ },
5272
+ "signature": {
5273
+ "type": "string",
5274
+ "pattern": "^0x[0-9a-fA-F]+$",
5275
+ "description": "A `personal_sign` signature over the org-bound message produced by\nthe SDK helper `buildPayoutRegistrationMessage`. Recovered and\nchecked against `address`; the org id is bound into the signed bytes.\n"
5276
+ },
5277
+ "issued_at": {
5278
+ "type": "string",
5279
+ "format": "date-time",
5280
+ "description": "ISO-8601 timestamp embedded in the signed message. Must be within a\nshort freshness window (about 10 minutes) of server time.\n"
5281
+ },
5282
+ "label": {
5283
+ "type": "string",
5284
+ "maxLength": 80,
5285
+ "description": "Optional human-readable label."
5286
+ }
5287
+ },
5288
+ "required": [
5289
+ "address",
5290
+ "network",
5291
+ "signature",
5292
+ "issued_at"
5293
+ ]
5294
+ },
5295
+ "X402PayoutAddress": {
5296
+ "type": "object",
5297
+ "properties": {
5298
+ "id": {
5299
+ "type": "string",
5300
+ "format": "uuid"
5301
+ },
5302
+ "address": {
5303
+ "type": "string",
5304
+ "description": "The checksummed payout address."
5305
+ },
5306
+ "network": {
5307
+ "type": "string",
5308
+ "enum": ["base", "base-sepolia"]
5309
+ },
5310
+ "label": { "type": ["string", "null"] },
5311
+ "is_default": {
5312
+ "type": "boolean",
5313
+ "description": "Exactly one address per (org, network) is the default."
5314
+ },
5315
+ "verified_at": {
5316
+ "type": "string",
5317
+ "format": "date-time",
5318
+ "description": "When ownership of the address was last proven."
5319
+ },
5320
+ "created_at": {
5321
+ "type": "string",
5322
+ "format": "date-time"
5323
+ }
5324
+ },
5325
+ "required": [
5326
+ "id",
5327
+ "address",
5328
+ "network",
5329
+ "label",
5330
+ "is_default",
5331
+ "verified_at"
5332
+ ]
5333
+ },
5334
+ "CreateChallengeInput": {
5335
+ "type": "object",
5336
+ "additionalProperties": false,
5337
+ "properties": {
5338
+ "amount": {
5339
+ "type": "string",
5340
+ "pattern": "^[1-9][0-9]{0,38}$",
5341
+ "description": "Amount to collect, in token base units. USDC has 6 decimals, so\n`\"10000\"` is 0.01 USDC.\n"
5342
+ },
5343
+ "network": {
5344
+ "type": "string",
5345
+ "enum": ["base", "base-sepolia"]
4614
5346
  },
4615
5347
  "payer_org": {
4616
5348
  "type": "string",
@@ -4781,6 +5513,94 @@ const openapiDocument = {
4781
5513
  "expires_at"
4782
5514
  ]
4783
5515
  },
5516
+ "CreateEmailChallengeInput": {
5517
+ "type": "object",
5518
+ "additionalProperties": false,
5519
+ "description": "Issue a payment challenge over an email thread. `from` is your sending\naddress (the funds receiver; ownership is enforced at send, exactly as\nfor outbound mail) and `to` is the payer's address. The `pay_to` payout\nwallet and the token asset are resolved server-side, never taken from\nthe request.\n",
5520
+ "properties": {
5521
+ "from": {
5522
+ "type": "string",
5523
+ "format": "email",
5524
+ "description": "Your sending address (the payee / funds receiver). Must be an\naddress your org is allowed to send from.\n"
5525
+ },
5526
+ "to": {
5527
+ "type": "string",
5528
+ "format": "email",
5529
+ "description": "The payer's email address the challenge is sent to."
5530
+ },
5531
+ "amount": {
5532
+ "type": "string",
5533
+ "pattern": "^[1-9][0-9]{0,38}$",
5534
+ "description": "Amount to collect, in token base units. USDC has 6 decimals, so\n`\"10000\"` is 0.01 USDC.\n"
5535
+ },
5536
+ "network": {
5537
+ "type": "string",
5538
+ "enum": ["base", "base-sepolia"]
5539
+ },
5540
+ "expires_in": {
5541
+ "type": "integer",
5542
+ "minimum": 60,
5543
+ "maximum": 86400,
5544
+ "description": "Seconds until the challenge expires. Defaults to 3600."
5545
+ },
5546
+ "resource": {
5547
+ "type": "string",
5548
+ "format": "uri",
5549
+ "maxLength": 2048,
5550
+ "description": "Optional URL identifying what is being paid for."
5551
+ },
5552
+ "description": {
5553
+ "type": "string",
5554
+ "maxLength": 512,
5555
+ "description": "Optional human-readable description of the payment."
5556
+ }
5557
+ },
5558
+ "required": [
5559
+ "from",
5560
+ "to",
5561
+ "amount",
5562
+ "network"
5563
+ ]
5564
+ },
5565
+ "X402EmailChallengeDetails": {
5566
+ "type": "object",
5567
+ "description": "The challenge the payer needs to sign and pay, carried inside an\nemail-native challenge response.\n",
5568
+ "properties": {
5569
+ "payment_requirements": { "$ref": "#/components/schemas/X402PaymentRequirements" },
5570
+ "nonce_binding": { "$ref": "#/components/schemas/X402NonceBinding" },
5571
+ "expires_at": {
5572
+ "type": "string",
5573
+ "format": "date-time",
5574
+ "description": "ISO-8601 expiry of the challenge."
5575
+ }
5576
+ },
5577
+ "required": [
5578
+ "payment_requirements",
5579
+ "nonce_binding",
5580
+ "expires_at"
5581
+ ]
5582
+ },
5583
+ "X402EmailChallenge": {
5584
+ "type": "object",
5585
+ "description": "The result of issuing an email-native payment challenge. `interaction_id`\nis the real email thread id (`uuid@domain`) the payment is bound to;\n`challenge_id` is the underlying challenge record. Hand the `challenge`\nto the payer, who replies with a signed `payment` interaction step (the\nSDK `payEmailChallenge` helper builds it).\n",
5586
+ "properties": {
5587
+ "interaction_id": {
5588
+ "type": "string",
5589
+ "description": "The email thread id (`uuid@domain`) the payment is bound to."
5590
+ },
5591
+ "challenge_id": {
5592
+ "type": "string",
5593
+ "format": "uuid",
5594
+ "description": "The underlying challenge record id."
5595
+ },
5596
+ "challenge": { "$ref": "#/components/schemas/X402EmailChallengeDetails" }
5597
+ },
5598
+ "required": [
5599
+ "interaction_id",
5600
+ "challenge_id",
5601
+ "challenge"
5602
+ ]
5603
+ },
4784
5604
  "X402PaymentPayload": {
4785
5605
  "type": "object",
4786
5606
  "description": "A signed x402 v1 `PaymentPayload`. The SDK `pay()` helper builds this;\ncallers rarely construct it by hand. Field names are x402-native.\n",
@@ -14631,28 +15451,200 @@ const operationManifest = [
14631
15451
  },
14632
15452
  {
14633
15453
  "binaryResponse": false,
14634
- "bodyRequired": false,
14635
- "command": "get-challenge",
14636
- "description": "Fetch a challenge you created, to poll its `status` and settlement\nreceipt (`settle_tx`). Scoped to the challenger org that created it.\n",
14637
- "hasJsonBody": false,
14638
- "method": "GET",
14639
- "operationId": "getChallenge",
14640
- "path": "/x402/challenges/{id}",
14641
- "pathParams": [{
14642
- "description": "Resource UUID",
14643
- "enum": null,
14644
- "name": "id",
14645
- "required": true,
14646
- "type": "string"
14647
- }],
15454
+ "bodyRequired": true,
15455
+ "command": "create-email-challenge",
15456
+ "description": "Issue an x402 payment challenge over a real email thread (the payee\nside). Unlike `createChallenge` (which mints a synthetic challenge id),\nthis sends the challenge as an email from `from` to `to` and binds the\npayment to that DKIM-authenticated thread. The `pay_to` address and the\ntoken asset are resolved server-side from your registered default payout\naddress for the network, never from the request. The response carries\nthe thread's `interaction_id` plus the `challenge` (the\n`payment_requirements`, the `nonce_binding`, and `expires_at`) the payer\nneeds to sign; the payer replies with a signed `payment` interaction\nstep. Amounts are in token base units (USDC has 6 decimals, so `\"10000\"`\nis 0.01 USDC).\n",
15457
+ "hasJsonBody": true,
15458
+ "method": "POST",
15459
+ "operationId": "createEmailChallenge",
15460
+ "path": "/x402/email-challenges",
15461
+ "pathParams": [],
14648
15462
  "queryParams": [],
14649
- "requestSchema": null,
14650
- "responseSchema": {
15463
+ "requestSchema": {
14651
15464
  "type": "object",
15465
+ "additionalProperties": false,
15466
+ "description": "Issue a payment challenge over an email thread. `from` is your sending\naddress (the funds receiver; ownership is enforced at send, exactly as\nfor outbound mail) and `to` is the payer's address. The `pay_to` payout\nwallet and the token asset are resolved server-side, never taken from\nthe request.\n",
14652
15467
  "properties": {
14653
- "id": {
15468
+ "from": {
14654
15469
  "type": "string",
14655
- "format": "uuid"
15470
+ "format": "email",
15471
+ "description": "Your sending address (the payee / funds receiver). Must be an\naddress your org is allowed to send from.\n"
15472
+ },
15473
+ "to": {
15474
+ "type": "string",
15475
+ "format": "email",
15476
+ "description": "The payer's email address the challenge is sent to."
15477
+ },
15478
+ "amount": {
15479
+ "type": "string",
15480
+ "pattern": "^[1-9][0-9]{0,38}$",
15481
+ "description": "Amount to collect, in token base units. USDC has 6 decimals, so\n`\"10000\"` is 0.01 USDC.\n"
15482
+ },
15483
+ "network": {
15484
+ "type": "string",
15485
+ "enum": ["base", "base-sepolia"]
15486
+ },
15487
+ "expires_in": {
15488
+ "type": "integer",
15489
+ "minimum": 60,
15490
+ "maximum": 86400,
15491
+ "description": "Seconds until the challenge expires. Defaults to 3600."
15492
+ },
15493
+ "resource": {
15494
+ "type": "string",
15495
+ "format": "uri",
15496
+ "maxLength": 2048,
15497
+ "description": "Optional URL identifying what is being paid for."
15498
+ },
15499
+ "description": {
15500
+ "type": "string",
15501
+ "maxLength": 512,
15502
+ "description": "Optional human-readable description of the payment."
15503
+ }
15504
+ },
15505
+ "required": [
15506
+ "from",
15507
+ "to",
15508
+ "amount",
15509
+ "network"
15510
+ ]
15511
+ },
15512
+ "responseSchema": {
15513
+ "type": "object",
15514
+ "description": "The result of issuing an email-native payment challenge. `interaction_id`\nis the real email thread id (`uuid@domain`) the payment is bound to;\n`challenge_id` is the underlying challenge record. Hand the `challenge`\nto the payer, who replies with a signed `payment` interaction step (the\nSDK `payEmailChallenge` helper builds it).\n",
15515
+ "properties": {
15516
+ "interaction_id": {
15517
+ "type": "string",
15518
+ "description": "The email thread id (`uuid@domain`) the payment is bound to."
15519
+ },
15520
+ "challenge_id": {
15521
+ "type": "string",
15522
+ "format": "uuid",
15523
+ "description": "The underlying challenge record id."
15524
+ },
15525
+ "challenge": {
15526
+ "type": "object",
15527
+ "description": "The challenge the payer needs to sign and pay, carried inside an\nemail-native challenge response.\n",
15528
+ "properties": {
15529
+ "payment_requirements": {
15530
+ "type": "object",
15531
+ "description": "The x402 `PaymentRequirements` the payer signs over. Field names are\nx402's native camelCase, preserved byte-for-byte.\n",
15532
+ "properties": {
15533
+ "scheme": {
15534
+ "type": "string",
15535
+ "description": "The x402 settlement scheme. Always `exact` for v1.",
15536
+ "example": "exact"
15537
+ },
15538
+ "network": {
15539
+ "type": "string",
15540
+ "enum": ["base", "base-sepolia"]
15541
+ },
15542
+ "maxAmountRequired": {
15543
+ "type": "string",
15544
+ "description": "Amount in token base units."
15545
+ },
15546
+ "payTo": {
15547
+ "type": "string",
15548
+ "description": "The payee's resolved payout address (checksummed)."
15549
+ },
15550
+ "asset": {
15551
+ "type": "string",
15552
+ "description": "The token contract address (checksummed). USDC."
15553
+ },
15554
+ "resource": { "type": "string" },
15555
+ "description": { "type": "string" },
15556
+ "maxTimeoutSeconds": { "type": "integer" },
15557
+ "extra": {
15558
+ "type": "object",
15559
+ "description": "The token's load-bearing EIP-712 domain params. `name` differs by\nchain (Base mainnet USDC is `USD Coin`, Base Sepolia is `USDC`); a\nwrong value produces a signature the verifier rejects.\n",
15560
+ "properties": {
15561
+ "name": { "type": "string" },
15562
+ "version": { "type": "string" }
15563
+ },
15564
+ "required": ["name", "version"]
15565
+ }
15566
+ },
15567
+ "required": [
15568
+ "scheme",
15569
+ "network",
15570
+ "maxAmountRequired",
15571
+ "payTo",
15572
+ "asset",
15573
+ "extra"
15574
+ ]
15575
+ },
15576
+ "nonce_binding": {
15577
+ "type": "object",
15578
+ "description": "The interaction binding the payer hashes into the EIP-3009 nonce\n(`deriveEip3009Nonce`). Pinning the nonce to this binding is what lets an\nx402 payment ride asynchronous transports safely: a replayed challenge\ncan't redirect funds and a signed payment can't settle twice.\n",
15579
+ "properties": {
15580
+ "interaction_id": {
15581
+ "type": "string",
15582
+ "description": "Interaction id, including its `@domain` part."
15583
+ },
15584
+ "challenge_step_id": {
15585
+ "type": "string",
15586
+ "format": "uuid"
15587
+ },
15588
+ "challenge_nonce": {
15589
+ "type": "string",
15590
+ "pattern": "^[0-9a-f]{64}$",
15591
+ "description": "32 random bytes as 64 lowercase hex chars."
15592
+ }
15593
+ },
15594
+ "required": [
15595
+ "interaction_id",
15596
+ "challenge_step_id",
15597
+ "challenge_nonce"
15598
+ ]
15599
+ },
15600
+ "expires_at": {
15601
+ "type": "string",
15602
+ "format": "date-time",
15603
+ "description": "ISO-8601 expiry of the challenge."
15604
+ }
15605
+ },
15606
+ "required": [
15607
+ "payment_requirements",
15608
+ "nonce_binding",
15609
+ "expires_at"
15610
+ ]
15611
+ }
15612
+ },
15613
+ "required": [
15614
+ "interaction_id",
15615
+ "challenge_id",
15616
+ "challenge"
15617
+ ]
15618
+ },
15619
+ "sdkName": "createEmailChallenge",
15620
+ "summary": "Create an email-native payment challenge",
15621
+ "tag": "Payments",
15622
+ "tagCommand": "payments"
15623
+ },
15624
+ {
15625
+ "binaryResponse": false,
15626
+ "bodyRequired": false,
15627
+ "command": "get-challenge",
15628
+ "description": "Fetch a challenge you created, to poll its `status` and settlement\nreceipt (`settle_tx`). Scoped to the challenger org that created it.\n",
15629
+ "hasJsonBody": false,
15630
+ "method": "GET",
15631
+ "operationId": "getChallenge",
15632
+ "path": "/x402/challenges/{id}",
15633
+ "pathParams": [{
15634
+ "description": "Resource UUID",
15635
+ "enum": null,
15636
+ "name": "id",
15637
+ "required": true,
15638
+ "type": "string"
15639
+ }],
15640
+ "queryParams": [],
15641
+ "requestSchema": null,
15642
+ "responseSchema": {
15643
+ "type": "object",
15644
+ "properties": {
15645
+ "id": {
15646
+ "type": "string",
15647
+ "format": "uuid"
14656
15648
  },
14657
15649
  "status": {
14658
15650
  "type": "string",
@@ -15142,96 +16134,732 @@ const operationManifest = [
15142
16134
  "format": "date-time",
15143
16135
  "description": "When ownership of the address was last proven."
15144
16136
  },
15145
- "created_at": {
15146
- "type": "string",
15147
- "format": "date-time"
16137
+ "created_at": {
16138
+ "type": "string",
16139
+ "format": "date-time"
16140
+ }
16141
+ },
16142
+ "required": [
16143
+ "id",
16144
+ "address",
16145
+ "network",
16146
+ "label",
16147
+ "is_default",
16148
+ "verified_at"
16149
+ ]
16150
+ },
16151
+ "sdkName": "registerPayoutAddress",
16152
+ "summary": "Register a payout address",
16153
+ "tag": "Payments",
16154
+ "tagCommand": "payments"
16155
+ },
16156
+ {
16157
+ "binaryResponse": false,
16158
+ "bodyRequired": true,
16159
+ "command": "update-spend-policy",
16160
+ "description": "Update your org's spend policy. Applied as a merge: only the fields you\ninclude change, and omitted fields keep their current value, so a partial\nupdate can't silently reset the kill-switch. Send an explicit `null` to\nclear a cap. Caps are in token base units.\n",
16161
+ "hasJsonBody": true,
16162
+ "method": "PUT",
16163
+ "operationId": "updateSpendPolicy",
16164
+ "path": "/x402/spend-policy",
16165
+ "pathParams": [],
16166
+ "queryParams": [],
16167
+ "requestSchema": {
16168
+ "type": "object",
16169
+ "additionalProperties": false,
16170
+ "description": "Merge update: only the fields you include change; omit a field to keep\nits current value; send `null` to clear a cap.\n",
16171
+ "properties": {
16172
+ "paused": { "type": "boolean" },
16173
+ "max_per_payment": {
16174
+ "type": ["string", "null"],
16175
+ "pattern": "^[1-9][0-9]{0,38}$"
16176
+ },
16177
+ "max_per_day": {
16178
+ "type": ["string", "null"],
16179
+ "pattern": "^[1-9][0-9]{0,38}$"
16180
+ },
16181
+ "allowlist": {
16182
+ "type": ["array", "null"],
16183
+ "maxItems": 1e3,
16184
+ "items": {
16185
+ "type": "string",
16186
+ "format": "uuid"
16187
+ }
16188
+ }
16189
+ }
16190
+ },
16191
+ "responseSchema": {
16192
+ "type": "object",
16193
+ "description": "The payer's outbound spend policy. Returned with defaults (not paused,\nno caps, any on-net payee) when none is set.\n",
16194
+ "properties": {
16195
+ "paused": {
16196
+ "type": "boolean",
16197
+ "description": "Kill-switch. When true, all outbound payments are refused."
16198
+ },
16199
+ "max_per_payment": {
16200
+ "type": ["string", "null"],
16201
+ "description": "Per-payment cap in token base units, or null for no cap."
16202
+ },
16203
+ "max_per_day": {
16204
+ "type": ["string", "null"],
16205
+ "description": "Rolling-day cap in token base units, or null for no cap."
16206
+ },
16207
+ "allowlist": {
16208
+ "type": ["array", "null"],
16209
+ "items": {
16210
+ "type": "string",
16211
+ "format": "uuid"
16212
+ },
16213
+ "description": "Allowed payee org ids. `null` allows any on-net payee; `[]` denies\nall.\n"
16214
+ }
16215
+ },
16216
+ "required": [
16217
+ "paused",
16218
+ "max_per_payment",
16219
+ "max_per_day",
16220
+ "allowlist"
16221
+ ]
16222
+ },
16223
+ "sdkName": "updateSpendPolicy",
16224
+ "summary": "Update your spend policy",
16225
+ "tag": "Payments",
16226
+ "tagCommand": "payments"
16227
+ },
16228
+ {
16229
+ "binaryResponse": false,
16230
+ "bodyRequired": true,
16231
+ "command": "create-registry",
16232
+ "description": null,
16233
+ "hasJsonBody": true,
16234
+ "method": "POST",
16235
+ "operationId": "createRegistry",
16236
+ "path": "/registries",
16237
+ "pathParams": [],
16238
+ "queryParams": [],
16239
+ "requestSchema": {
16240
+ "type": "object",
16241
+ "properties": {
16242
+ "slug": {
16243
+ "type": "string",
16244
+ "pattern": "^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$",
16245
+ "description": "Lowercase slug, unique across registries."
16246
+ },
16247
+ "name": {
16248
+ "type": "string",
16249
+ "minLength": 1,
16250
+ "maxLength": 120
16251
+ },
16252
+ "description": {
16253
+ "type": ["string", "null"],
16254
+ "maxLength": 2e3
16255
+ },
16256
+ "is_public": { "type": "boolean" },
16257
+ "publish_policy": {
16258
+ "type": "string",
16259
+ "enum": [
16260
+ "owner_only",
16261
+ "request",
16262
+ "open"
16263
+ ],
16264
+ "description": "Who may publish into a registry. owner_only: only the registry owner.\nrequest: anyone may request and the owner approves. open: anyone may\npublish and it lists immediately (no approval step).\n"
16265
+ }
16266
+ },
16267
+ "required": ["slug", "name"]
16268
+ },
16269
+ "responseSchema": {
16270
+ "type": "object",
16271
+ "properties": {
16272
+ "id": {
16273
+ "type": "string",
16274
+ "format": "uuid"
16275
+ },
16276
+ "slug": { "type": "string" }
16277
+ },
16278
+ "required": ["id", "slug"]
16279
+ },
16280
+ "sdkName": "createRegistry",
16281
+ "summary": "Create a registry",
16282
+ "tag": "Registries",
16283
+ "tagCommand": "registries"
16284
+ },
16285
+ {
16286
+ "binaryResponse": false,
16287
+ "bodyRequired": true,
16288
+ "command": "decide-registry-request",
16289
+ "description": null,
16290
+ "hasJsonBody": true,
16291
+ "method": "POST",
16292
+ "operationId": "decideRegistryRequest",
16293
+ "path": "/registries/{slug}/requests/{id}",
16294
+ "pathParams": [{
16295
+ "description": null,
16296
+ "enum": null,
16297
+ "name": "slug",
16298
+ "required": true,
16299
+ "type": "string"
16300
+ }, {
16301
+ "description": "Resource UUID",
16302
+ "enum": null,
16303
+ "name": "id",
16304
+ "required": true,
16305
+ "type": "string"
16306
+ }],
16307
+ "queryParams": [],
16308
+ "requestSchema": {
16309
+ "type": "object",
16310
+ "properties": { "decision": {
16311
+ "type": "string",
16312
+ "enum": ["approved", "rejected"]
16313
+ } },
16314
+ "required": ["decision"]
16315
+ },
16316
+ "responseSchema": {
16317
+ "type": "object",
16318
+ "properties": { "status": {
16319
+ "type": "string",
16320
+ "enum": ["approved", "rejected"]
16321
+ } },
16322
+ "required": ["status"]
16323
+ },
16324
+ "sdkName": "decideRegistryRequest",
16325
+ "summary": "Approve or reject a publication request",
16326
+ "tag": "Registries",
16327
+ "tagCommand": "registries"
16328
+ },
16329
+ {
16330
+ "binaryResponse": false,
16331
+ "bodyRequired": true,
16332
+ "command": "define-agent",
16333
+ "description": null,
16334
+ "hasJsonBody": true,
16335
+ "method": "POST",
16336
+ "operationId": "defineAgent",
16337
+ "path": "/agents",
16338
+ "pathParams": [],
16339
+ "queryParams": [],
16340
+ "requestSchema": {
16341
+ "type": "object",
16342
+ "properties": {
16343
+ "address": {
16344
+ "type": "string",
16345
+ "description": "The agent's globally unique email address; must route to the endpoint."
16346
+ },
16347
+ "endpoint_id": {
16348
+ "type": "string",
16349
+ "format": "uuid"
16350
+ },
16351
+ "display_name": {
16352
+ "type": "string",
16353
+ "minLength": 1,
16354
+ "maxLength": 120
16355
+ },
16356
+ "title": {
16357
+ "type": ["string", "null"],
16358
+ "maxLength": 120
16359
+ },
16360
+ "description": {
16361
+ "type": ["string", "null"],
16362
+ "maxLength": 2e3
16363
+ },
16364
+ "tags": {
16365
+ "type": "array",
16366
+ "items": {
16367
+ "type": "string",
16368
+ "maxLength": 40
16369
+ },
16370
+ "maxItems": 20
16371
+ }
16372
+ },
16373
+ "required": [
16374
+ "address",
16375
+ "endpoint_id",
16376
+ "display_name"
16377
+ ]
16378
+ },
16379
+ "responseSchema": {
16380
+ "type": "object",
16381
+ "properties": {
16382
+ "id": {
16383
+ "type": "string",
16384
+ "format": "uuid"
16385
+ },
16386
+ "address": { "type": "string" }
16387
+ },
16388
+ "required": ["id", "address"]
16389
+ },
16390
+ "sdkName": "defineAgent",
16391
+ "summary": "Define an agent identity",
16392
+ "tag": "Registries",
16393
+ "tagCommand": "registries"
16394
+ },
16395
+ {
16396
+ "binaryResponse": false,
16397
+ "bodyRequired": false,
16398
+ "command": "get-agent",
16399
+ "description": null,
16400
+ "hasJsonBody": false,
16401
+ "method": "GET",
16402
+ "operationId": "getAgent",
16403
+ "path": "/agents/{address}",
16404
+ "pathParams": [{
16405
+ "description": "The agent's email address (URL-encoded).",
16406
+ "enum": null,
16407
+ "name": "address",
16408
+ "required": true,
16409
+ "type": "string"
16410
+ }],
16411
+ "queryParams": [],
16412
+ "requestSchema": null,
16413
+ "responseSchema": {
16414
+ "type": "object",
16415
+ "description": "An agent's public directory profile.",
16416
+ "properties": {
16417
+ "address": { "type": "string" },
16418
+ "display_name": { "type": "string" },
16419
+ "title": { "type": ["string", "null"] },
16420
+ "description": { "type": ["string", "null"] },
16421
+ "tags": {
16422
+ "type": "array",
16423
+ "items": { "type": "string" }
16424
+ },
16425
+ "handle": {
16426
+ "type": ["string", "null"],
16427
+ "description": "The registry-scoped name. Null on the global by-address read."
16428
+ }
16429
+ },
16430
+ "required": [
16431
+ "address",
16432
+ "display_name",
16433
+ "title",
16434
+ "description",
16435
+ "tags",
16436
+ "handle"
16437
+ ]
16438
+ },
16439
+ "sdkName": "getAgent",
16440
+ "summary": "Get an agent's public profile by address",
16441
+ "tag": "Registries",
16442
+ "tagCommand": "registries"
16443
+ },
16444
+ {
16445
+ "binaryResponse": false,
16446
+ "bodyRequired": false,
16447
+ "command": "get-registry",
16448
+ "description": null,
16449
+ "hasJsonBody": false,
16450
+ "method": "GET",
16451
+ "operationId": "getRegistry",
16452
+ "path": "/registries/{slug}",
16453
+ "pathParams": [{
16454
+ "description": "The registry slug",
16455
+ "enum": null,
16456
+ "name": "slug",
16457
+ "required": true,
16458
+ "type": "string"
16459
+ }],
16460
+ "queryParams": [],
16461
+ "requestSchema": null,
16462
+ "responseSchema": {
16463
+ "type": "object",
16464
+ "properties": {
16465
+ "id": {
16466
+ "type": "string",
16467
+ "format": "uuid"
16468
+ },
16469
+ "slug": { "type": "string" },
16470
+ "name": { "type": "string" },
16471
+ "description": { "type": ["string", "null"] },
16472
+ "is_public": { "type": "boolean" },
16473
+ "publish_policy": {
16474
+ "type": "string",
16475
+ "enum": [
16476
+ "owner_only",
16477
+ "request",
16478
+ "open"
16479
+ ],
16480
+ "description": "Who may publish into a registry. owner_only: only the registry owner.\nrequest: anyone may request and the owner approves. open: anyone may\npublish and it lists immediately (no approval step).\n"
16481
+ }
16482
+ },
16483
+ "required": [
16484
+ "id",
16485
+ "slug",
16486
+ "name",
16487
+ "description",
16488
+ "is_public",
16489
+ "publish_policy"
16490
+ ]
16491
+ },
16492
+ "sdkName": "getRegistry",
16493
+ "summary": "Get a public registry's metadata",
16494
+ "tag": "Registries",
16495
+ "tagCommand": "registries"
16496
+ },
16497
+ {
16498
+ "binaryResponse": false,
16499
+ "bodyRequired": false,
16500
+ "command": "list-registries",
16501
+ "description": null,
16502
+ "hasJsonBody": false,
16503
+ "method": "GET",
16504
+ "operationId": "listRegistries",
16505
+ "path": "/registries",
16506
+ "pathParams": [],
16507
+ "queryParams": [],
16508
+ "requestSchema": null,
16509
+ "responseSchema": {
16510
+ "type": "array",
16511
+ "items": {
16512
+ "type": "object",
16513
+ "properties": {
16514
+ "id": {
16515
+ "type": "string",
16516
+ "format": "uuid"
16517
+ },
16518
+ "slug": { "type": "string" },
16519
+ "name": { "type": "string" },
16520
+ "description": { "type": ["string", "null"] },
16521
+ "is_public": { "type": "boolean" },
16522
+ "publish_policy": {
16523
+ "type": "string",
16524
+ "enum": [
16525
+ "owner_only",
16526
+ "request",
16527
+ "open"
16528
+ ],
16529
+ "description": "Who may publish into a registry. owner_only: only the registry owner.\nrequest: anyone may request and the owner approves. open: anyone may\npublish and it lists immediately (no approval step).\n"
16530
+ }
16531
+ },
16532
+ "required": [
16533
+ "id",
16534
+ "slug",
16535
+ "name",
16536
+ "description",
16537
+ "is_public",
16538
+ "publish_policy"
16539
+ ]
16540
+ }
16541
+ },
16542
+ "sdkName": "listRegistries",
16543
+ "summary": "List the registries you own",
16544
+ "tag": "Registries",
16545
+ "tagCommand": "registries"
16546
+ },
16547
+ {
16548
+ "binaryResponse": false,
16549
+ "bodyRequired": false,
16550
+ "command": "list-registry-agents",
16551
+ "description": null,
16552
+ "hasJsonBody": false,
16553
+ "method": "GET",
16554
+ "operationId": "listRegistryAgents",
16555
+ "path": "/registries/{slug}/agents",
16556
+ "pathParams": [{
16557
+ "description": null,
16558
+ "enum": null,
16559
+ "name": "slug",
16560
+ "required": true,
16561
+ "type": "string"
16562
+ }],
16563
+ "queryParams": [{
16564
+ "description": null,
16565
+ "enum": null,
16566
+ "maximum": 200,
16567
+ "minimum": 1,
16568
+ "name": "limit",
16569
+ "required": false,
16570
+ "type": "integer"
16571
+ }, {
16572
+ "description": "The address of the last agent from the previous page.",
16573
+ "enum": null,
16574
+ "name": "cursor",
16575
+ "required": false,
16576
+ "type": "string"
16577
+ }],
16578
+ "requestSchema": null,
16579
+ "responseSchema": {
16580
+ "type": "array",
16581
+ "items": {
16582
+ "type": "object",
16583
+ "description": "An agent's public directory profile.",
16584
+ "properties": {
16585
+ "address": { "type": "string" },
16586
+ "display_name": { "type": "string" },
16587
+ "title": { "type": ["string", "null"] },
16588
+ "description": { "type": ["string", "null"] },
16589
+ "tags": {
16590
+ "type": "array",
16591
+ "items": { "type": "string" }
16592
+ },
16593
+ "handle": {
16594
+ "type": ["string", "null"],
16595
+ "description": "The registry-scoped name. Null on the global by-address read."
16596
+ }
16597
+ },
16598
+ "required": [
16599
+ "address",
16600
+ "display_name",
16601
+ "title",
16602
+ "description",
16603
+ "tags",
16604
+ "handle"
16605
+ ]
16606
+ }
16607
+ },
16608
+ "sdkName": "listRegistryAgents",
16609
+ "summary": "List agents in a registry",
16610
+ "tag": "Registries",
16611
+ "tagCommand": "registries"
16612
+ },
16613
+ {
16614
+ "binaryResponse": false,
16615
+ "bodyRequired": false,
16616
+ "command": "list-registry-requests",
16617
+ "description": null,
16618
+ "hasJsonBody": false,
16619
+ "method": "GET",
16620
+ "operationId": "listRegistryRequests",
16621
+ "path": "/registries/{slug}/requests",
16622
+ "pathParams": [{
16623
+ "description": null,
16624
+ "enum": null,
16625
+ "name": "slug",
16626
+ "required": true,
16627
+ "type": "string"
16628
+ }],
16629
+ "queryParams": [{
16630
+ "description": null,
16631
+ "enum": null,
16632
+ "maximum": 200,
16633
+ "minimum": 1,
16634
+ "name": "limit",
16635
+ "required": false,
16636
+ "type": "integer"
16637
+ }],
16638
+ "requestSchema": null,
16639
+ "responseSchema": {
16640
+ "type": "array",
16641
+ "items": {
16642
+ "type": "object",
16643
+ "description": "A pending publication request, as the registry owner sees it.",
16644
+ "properties": {
16645
+ "id": {
16646
+ "type": "string",
16647
+ "format": "uuid"
16648
+ },
16649
+ "address": { "type": "string" },
16650
+ "display_name": { "type": "string" },
16651
+ "handle": { "type": ["string", "null"] },
16652
+ "requested_at": {
16653
+ "type": "string",
16654
+ "format": "date-time"
16655
+ }
16656
+ },
16657
+ "required": [
16658
+ "id",
16659
+ "address",
16660
+ "display_name",
16661
+ "handle",
16662
+ "requested_at"
16663
+ ]
16664
+ }
16665
+ },
16666
+ "sdkName": "listRegistryRequests",
16667
+ "summary": "List pending publication requests",
16668
+ "tag": "Registries",
16669
+ "tagCommand": "registries"
16670
+ },
16671
+ {
16672
+ "binaryResponse": false,
16673
+ "bodyRequired": true,
16674
+ "command": "publish-agent",
16675
+ "description": null,
16676
+ "hasJsonBody": true,
16677
+ "method": "POST",
16678
+ "operationId": "publishAgent",
16679
+ "path": "/registries/{slug}/agents",
16680
+ "pathParams": [{
16681
+ "description": null,
16682
+ "enum": null,
16683
+ "name": "slug",
16684
+ "required": true,
16685
+ "type": "string"
16686
+ }],
16687
+ "queryParams": [],
16688
+ "requestSchema": {
16689
+ "type": "object",
16690
+ "properties": {
16691
+ "address": { "type": "string" },
16692
+ "handle": {
16693
+ "type": "string",
16694
+ "description": "The registry-scoped name to list the agent under."
16695
+ }
16696
+ },
16697
+ "required": ["address", "handle"]
16698
+ },
16699
+ "responseSchema": {
16700
+ "type": "object",
16701
+ "properties": {
16702
+ "status": {
16703
+ "type": "string",
16704
+ "enum": ["approved", "requested"],
16705
+ "description": "approved lists immediately; requested pends owner approval."
16706
+ },
16707
+ "handle": { "type": "string" },
16708
+ "idempotent_replay": {
16709
+ "type": "boolean",
16710
+ "description": "True when the publish matched an existing identical publication."
16711
+ }
16712
+ },
16713
+ "required": [
16714
+ "status",
16715
+ "handle",
16716
+ "idempotent_replay"
16717
+ ]
16718
+ },
16719
+ "sdkName": "publishAgent",
16720
+ "summary": "Publish an agent into a registry",
16721
+ "tag": "Registries",
16722
+ "tagCommand": "registries"
16723
+ },
16724
+ {
16725
+ "binaryResponse": false,
16726
+ "bodyRequired": false,
16727
+ "command": "resolve-registry-handle",
16728
+ "description": null,
16729
+ "hasJsonBody": false,
16730
+ "method": "GET",
16731
+ "operationId": "resolveRegistryHandle",
16732
+ "path": "/registries/{slug}/agents/{handle}",
16733
+ "pathParams": [{
16734
+ "description": null,
16735
+ "enum": null,
16736
+ "name": "slug",
16737
+ "required": true,
16738
+ "type": "string"
16739
+ }, {
16740
+ "description": null,
16741
+ "enum": null,
16742
+ "name": "handle",
16743
+ "required": true,
16744
+ "type": "string"
16745
+ }],
16746
+ "queryParams": [],
16747
+ "requestSchema": null,
16748
+ "responseSchema": {
16749
+ "type": "object",
16750
+ "description": "An agent's public directory profile.",
16751
+ "properties": {
16752
+ "address": { "type": "string" },
16753
+ "display_name": { "type": "string" },
16754
+ "title": { "type": ["string", "null"] },
16755
+ "description": { "type": ["string", "null"] },
16756
+ "tags": {
16757
+ "type": "array",
16758
+ "items": { "type": "string" }
16759
+ },
16760
+ "handle": {
16761
+ "type": ["string", "null"],
16762
+ "description": "The registry-scoped name. Null on the global by-address read."
15148
16763
  }
15149
16764
  },
15150
16765
  "required": [
15151
- "id",
15152
16766
  "address",
15153
- "network",
15154
- "label",
15155
- "is_default",
15156
- "verified_at"
16767
+ "display_name",
16768
+ "title",
16769
+ "description",
16770
+ "tags",
16771
+ "handle"
15157
16772
  ]
15158
16773
  },
15159
- "sdkName": "registerPayoutAddress",
15160
- "summary": "Register a payout address",
15161
- "tag": "Payments",
15162
- "tagCommand": "payments"
16774
+ "sdkName": "resolveRegistryHandle",
16775
+ "summary": "Resolve a registry handle to its agent",
16776
+ "tag": "Registries",
16777
+ "tagCommand": "registries"
16778
+ },
16779
+ {
16780
+ "binaryResponse": false,
16781
+ "bodyRequired": false,
16782
+ "command": "unpublish-agent",
16783
+ "description": null,
16784
+ "hasJsonBody": false,
16785
+ "method": "DELETE",
16786
+ "operationId": "unpublishAgent",
16787
+ "path": "/registries/{slug}/agents/{handle}",
16788
+ "pathParams": [{
16789
+ "description": null,
16790
+ "enum": null,
16791
+ "name": "slug",
16792
+ "required": true,
16793
+ "type": "string"
16794
+ }, {
16795
+ "description": null,
16796
+ "enum": null,
16797
+ "name": "handle",
16798
+ "required": true,
16799
+ "type": "string"
16800
+ }],
16801
+ "queryParams": [],
16802
+ "requestSchema": null,
16803
+ "responseSchema": null,
16804
+ "sdkName": "unpublishAgent",
16805
+ "summary": "Unpublish an agent from a registry",
16806
+ "tag": "Registries",
16807
+ "tagCommand": "registries"
15163
16808
  },
15164
16809
  {
15165
16810
  "binaryResponse": false,
15166
16811
  "bodyRequired": true,
15167
- "command": "update-spend-policy",
15168
- "description": "Update your org's spend policy. Applied as a merge: only the fields you\ninclude change, and omitted fields keep their current value, so a partial\nupdate can't silently reset the kill-switch. Send an explicit `null` to\nclear a cap. Caps are in token base units.\n",
16812
+ "command": "update-registry",
16813
+ "description": null,
15169
16814
  "hasJsonBody": true,
15170
- "method": "PUT",
15171
- "operationId": "updateSpendPolicy",
15172
- "path": "/x402/spend-policy",
15173
- "pathParams": [],
16815
+ "method": "PATCH",
16816
+ "operationId": "updateRegistry",
16817
+ "path": "/registries/{slug}",
16818
+ "pathParams": [{
16819
+ "description": "The registry slug",
16820
+ "enum": null,
16821
+ "name": "slug",
16822
+ "required": true,
16823
+ "type": "string"
16824
+ }],
15174
16825
  "queryParams": [],
15175
16826
  "requestSchema": {
15176
16827
  "type": "object",
15177
- "additionalProperties": false,
15178
- "description": "Merge update: only the fields you include change; omit a field to keep\nits current value; send `null` to clear a cap.\n",
16828
+ "minProperties": 1,
15179
16829
  "properties": {
15180
- "paused": { "type": "boolean" },
15181
- "max_per_payment": {
15182
- "type": ["string", "null"],
15183
- "pattern": "^[1-9][0-9]{0,38}$"
16830
+ "name": {
16831
+ "type": "string",
16832
+ "minLength": 1,
16833
+ "maxLength": 120
15184
16834
  },
15185
- "max_per_day": {
16835
+ "description": {
15186
16836
  "type": ["string", "null"],
15187
- "pattern": "^[1-9][0-9]{0,38}$"
16837
+ "maxLength": 2e3
15188
16838
  },
15189
- "allowlist": {
15190
- "type": ["array", "null"],
15191
- "maxItems": 1e3,
15192
- "items": {
15193
- "type": "string",
15194
- "format": "uuid"
15195
- }
16839
+ "is_public": { "type": "boolean" },
16840
+ "publish_policy": {
16841
+ "type": "string",
16842
+ "enum": [
16843
+ "owner_only",
16844
+ "request",
16845
+ "open"
16846
+ ],
16847
+ "description": "Who may publish into a registry. owner_only: only the registry owner.\nrequest: anyone may request and the owner approves. open: anyone may\npublish and it lists immediately (no approval step).\n"
15196
16848
  }
15197
16849
  }
15198
16850
  },
15199
16851
  "responseSchema": {
15200
16852
  "type": "object",
15201
- "description": "The payer's outbound spend policy. Returned with defaults (not paused,\nno caps, any on-net payee) when none is set.\n",
15202
- "properties": {
15203
- "paused": {
15204
- "type": "boolean",
15205
- "description": "Kill-switch. When true, all outbound payments are refused."
15206
- },
15207
- "max_per_payment": {
15208
- "type": ["string", "null"],
15209
- "description": "Per-payment cap in token base units, or null for no cap."
15210
- },
15211
- "max_per_day": {
15212
- "type": ["string", "null"],
15213
- "description": "Rolling-day cap in token base units, or null for no cap."
15214
- },
15215
- "allowlist": {
15216
- "type": ["array", "null"],
15217
- "items": {
15218
- "type": "string",
15219
- "format": "uuid"
15220
- },
15221
- "description": "Allowed payee org ids. `null` allows any on-net payee; `[]` denies\nall.\n"
15222
- }
15223
- },
15224
- "required": [
15225
- "paused",
15226
- "max_per_payment",
15227
- "max_per_day",
15228
- "allowlist"
15229
- ]
16853
+ "properties": { "id": {
16854
+ "type": "string",
16855
+ "format": "uuid"
16856
+ } },
16857
+ "required": ["id"]
15230
16858
  },
15231
- "sdkName": "updateSpendPolicy",
15232
- "summary": "Update your spend policy",
15233
- "tag": "Payments",
15234
- "tagCommand": "payments"
16859
+ "sdkName": "updateRegistry",
16860
+ "summary": "Update a registry you own",
16861
+ "tag": "Registries",
16862
+ "tagCommand": "registries"
15235
16863
  },
15236
16864
  {
15237
16865
  "binaryResponse": false,
@@ -21020,8 +22648,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
21020
22648
  name: "Primitive Team",
21021
22649
  url: "https://primitive.dev"
21022
22650
  };
21023
- const SDK_VERSION_RANGE = "^1.7.0";
21024
- const CLI_VERSION_RANGE = "^1.7.0";
22651
+ const SDK_VERSION_RANGE = "^1.9.0";
22652
+ const CLI_VERSION_RANGE = "^1.9.0";
21025
22653
  const ESBUILD_VERSION_RANGE = "^0.27.0";
21026
22654
  function renderHandler() {
21027
22655
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
@@ -24509,6 +26137,43 @@ function buildPayoutRegistrationMessage(input) {
24509
26137
  `issued: ${input.issuedAt}`
24510
26138
  ].join("\n");
24511
26139
  }
26140
+ /**
26141
+ * The protocol the email-native payment interaction runs (`x402.payment/1`).
26142
+ * The payer's reply carries the `payment` step of this protocol.
26143
+ */
26144
+ const X402_INTERACTION_PROTOCOL = "x402.payment";
26145
+ /** A UUID (used for `interaction_id`'s local part and the step ids). */
26146
+ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
26147
+ /** An interaction id is `uuid@domain`. */
26148
+ const WIRE_ID_RE = new RegExp(`^${UUID_RE.source.slice(1, -1)}@[^\\s@]+$`, "i");
26149
+ /**
26150
+ * Build the section-2.3 interaction.json envelope for a `payment` step. Pure: no
26151
+ * I/O. `payment` is the signed exact-EVM payload (from
26152
+ * `buildExactEvmPaymentPayload`); `prevStepId` is the challenge step id this
26153
+ * payment answers, and `stepId` is a fresh UUID for the payment step. Returns
26154
+ * the envelope and its canonical JSON, so the bytes the platform reads back are
26155
+ * exactly the ones produced here.
26156
+ */
26157
+ function buildPaymentStepEnvelope(params) {
26158
+ if (!WIRE_ID_RE.test(params.interactionId)) throw new Error("buildPaymentStepEnvelope: interactionId must be uuid@domain");
26159
+ if (!UUID_RE.test(params.stepId)) throw new Error("buildPaymentStepEnvelope: stepId must be a uuid");
26160
+ if (!UUID_RE.test(params.prevStepId)) throw new Error("buildPaymentStepEnvelope: prevStepId must be a uuid");
26161
+ const envelope = {
26162
+ interaction_version: 1,
26163
+ interaction_id: params.interactionId,
26164
+ protocol: X402_INTERACTION_PROTOCOL,
26165
+ protocol_version: 1,
26166
+ step: "payment",
26167
+ step_id: params.stepId,
26168
+ prev_step_id: params.prevStepId,
26169
+ expires_at: params.expiresAt ?? null,
26170
+ payload: { payment: params.payment }
26171
+ };
26172
+ return {
26173
+ envelope,
26174
+ json: JSON.stringify(envelope)
26175
+ };
26176
+ }
24512
26177
  /** Assemble the wire payload from a signed authorization. */
24513
26178
  function toPaymentPayload(network, auth, signature) {
24514
26179
  return {
@@ -24586,6 +26251,15 @@ function buildExactEvmPaymentPayload(params) {
24586
26251
  if (!NONCE_HEX_RE.test(params.authorization.nonce)) throw new Error("buildExactEvmPaymentPayload: authorization.nonce must be a 0x-prefixed 32-byte (64 hex char) value");
24587
26252
  return toPaymentPayload(params.network, params.authorization, params.signature);
24588
26253
  }
26254
+ /**
26255
+ * x402 agent-to-agent payments.
26256
+ *
26257
+ * `charge()` (payee) asks for a payment; `pay()` (payer) signs and settles it
26258
+ * with the customer's own key. The signing is local and non-custodial; the key
26259
+ * never leaves the caller. The server resolves the real payee address, verifies
26260
+ * every signed field against its own records, and enforces the spend policy, so
26261
+ * the SDK's job is just: derive the bound authorization, sign, and submit.
26262
+ */
24589
26263
  const CHAIN_IDS = {
24590
26264
  "base-sepolia": 84532,
24591
26265
  base: 8453
@@ -24601,6 +26275,17 @@ const CHARGE_INPUT_KEYS = {
24601
26275
  expiresIn: true,
24602
26276
  idempotencyKey: true
24603
26277
  };
26278
+ const EMAIL_CHARGE_INPUT_KEYS = {
26279
+ from: true,
26280
+ to: true,
26281
+ amount: true,
26282
+ amountUsdc: true,
26283
+ network: true,
26284
+ description: true,
26285
+ resource: true,
26286
+ expiresIn: true,
26287
+ idempotencyKey: true
26288
+ };
24604
26289
  function usdcToBaseUnits$1(human) {
24605
26290
  const trimmed = human.trim();
24606
26291
  if (!/^\d+(\.\d+)?$/.test(trimmed)) return null;
@@ -24637,13 +26322,37 @@ function validateChallenge(c) {
24637
26322
  if (!c.expires_at) bad("expires_at");
24638
26323
  const nb = c.nonce_binding;
24639
26324
  if (!nb?.interaction_id || !nb.challenge_step_id || !nb.challenge_nonce) bad("nonce_binding");
24640
- const pr = c.payment_requirements;
26325
+ validatePaymentRequirements(c.payment_requirements, bad);
26326
+ }
26327
+ /** Validate the x402 PaymentRequirements shared by both challenge shapes. */
26328
+ function validatePaymentRequirements(pr, bad) {
24641
26329
  if (!pr) bad("payment_requirements");
24642
26330
  if (!/^[1-9][0-9]{0,38}$/.test(pr.maxAmountRequired ?? "")) bad("payment_requirements.maxAmountRequired (expected a positive integer string in token base units)");
24643
26331
  if (!/^0x[0-9a-fA-F]{40}$/.test(pr.payTo ?? "")) bad("payment_requirements.payTo (expected a 0x address)");
24644
26332
  if (!/^0x[0-9a-fA-F]{40}$/.test(pr.asset ?? "")) bad("payment_requirements.asset (expected a 0x address)");
24645
26333
  if (!pr.extra?.name || !pr.extra.version) bad("payment_requirements.extra (name/version)");
24646
26334
  }
26335
+ /**
26336
+ * Assert an email-native challenge is fully hydrated before signing, so a
26337
+ * missing field fails with a named X402Error instead of an opaque error
26338
+ * mid-sign. The interaction_id and the challenge step id (the nonce binding's
26339
+ * fields) drive both the bound nonce and the payment-step envelope, so they are
26340
+ * checked here.
26341
+ */
26342
+ function validateEmailChallenge(c) {
26343
+ const bad = (field) => {
26344
+ throw new X402Error(`email challenge is missing or malformed: ${field}`, 0);
26345
+ };
26346
+ if (!c || typeof c !== "object") bad("email challenge");
26347
+ if (!c.interaction_id) bad("interaction_id");
26348
+ const ch = c.challenge;
26349
+ if (!ch || typeof ch !== "object") bad("challenge");
26350
+ if (!ch.expires_at) bad("challenge.expires_at");
26351
+ const nb = ch.nonce_binding;
26352
+ if (!nb?.interaction_id || !nb.challenge_step_id || !nb.challenge_nonce) bad("challenge.nonce_binding");
26353
+ if (nb.interaction_id !== c.interaction_id) bad("interaction_id (mismatch with challenge.nonce_binding.interaction_id)");
26354
+ validatePaymentRequirements(ch.payment_requirements, bad);
26355
+ }
24647
26356
  var X402Client = class {
24648
26357
  #apiKey;
24649
26358
  #baseUrl;
@@ -24703,6 +26412,99 @@ var X402Client = class {
24703
26412
  return this.#request("POST", "/v1/x402/challenges", body, { headers: input.idempotencyKey ? { "idempotency-key": input.idempotencyKey } : void 0 });
24704
26413
  }
24705
26414
  /**
26415
+ * Issue a payment challenge over an email thread (payee side). Sends the
26416
+ * challenge as an email from `from` to `to` and binds the payment to that
26417
+ * thread. Returns the challenge (including the real `interaction_id`); deliver
26418
+ * it to the payer, who calls `payEmailChallenge` to build the signed payment.
26419
+ *
26420
+ * Provide exactly one of `amount` (base units) or `amountUsdc` (human USDC).
26421
+ */
26422
+ async createEmailChallenge(input) {
26423
+ for (const key of Object.keys(input)) if (!(key in EMAIL_CHARGE_INPUT_KEYS)) throw new X402Error(`unknown createEmailChallenge() option "${key}"; expected one of: ${Object.keys(EMAIL_CHARGE_INPUT_KEYS).join(", ")}`, 0);
26424
+ if (!input.from) throw new X402Error("createEmailChallenge() requires `from`", 0);
26425
+ if (!input.to) throw new X402Error("createEmailChallenge() requires `to`", 0);
26426
+ if (input.amount !== void 0 && input.amountUsdc !== void 0) throw new X402Error("createEmailChallenge() takes exactly one of `amount` (base units) or `amountUsdc` (human USDC), not both", 0);
26427
+ const amount = input.amountUsdc !== void 0 ? usdcToBaseUnits$1(input.amountUsdc) : input.amount ?? null;
26428
+ if (!amount || !/^[1-9][0-9]{0,38}$/.test(amount)) throw new X402Error("createEmailChallenge() requires `amount` as a positive integer string in token base units (e.g. \"10000\"), or `amountUsdc` as a positive USDC amount with at most 6 decimals (e.g. \"0.01\")", 0);
26429
+ const body = {
26430
+ from: input.from,
26431
+ to: input.to,
26432
+ amount,
26433
+ network: input.network ?? "base-sepolia"
26434
+ };
26435
+ if (input.description) body.description = input.description;
26436
+ if (input.resource) body.resource = input.resource;
26437
+ if (input.expiresIn !== void 0) body.expires_in = input.expiresIn;
26438
+ return this.#request("POST", "/v1/x402/email-challenges", body, { headers: input.idempotencyKey ? { "idempotency-key": input.idempotencyKey } : void 0 });
26439
+ }
26440
+ /**
26441
+ * Build the signed payment step for an email-native challenge (payer side).
26442
+ * Given a received `X402EmailChallenge` and the caller's signer, this derives
26443
+ * the interaction-bound authorization, signs it locally, and returns the
26444
+ * signed `interaction.json` payment-step envelope plus its canonical JSON
26445
+ * bytes. It does NOT send anything.
26446
+ *
26447
+ * The caller sends `result.json` back as an `interaction.json` attachment on a
26448
+ * reply to the challenge email (e.g. via the SDK's `send` / `reply`); the
26449
+ * platform reads the envelope from those exact bytes, re-derives the bound
26450
+ * nonce, and settles.
26451
+ */
26452
+ async payEmailChallenge(challenge, options) {
26453
+ if (!options?.signer?.address || typeof options.signer.signTypedData !== "function") throw new X402Error("payEmailChallenge() requires options.signer with { address, signTypedData } (e.g. a viem LocalAccount)", 0);
26454
+ validateEmailChallenge(challenge);
26455
+ const details = challenge.challenge;
26456
+ const pr = details.payment_requirements;
26457
+ const network = pr.network;
26458
+ const chainId = CHAIN_IDS[network];
26459
+ if (chainId === void 0) throw new X402Error(`unsupported network: ${network}`, 0);
26460
+ if (pr.scheme !== "exact") throw new X402Error(`unsupported payment scheme: ${pr.scheme}`, 0);
26461
+ const nowSec = Math.floor(Date.now() / 1e3);
26462
+ const expiresAtMs = Date.parse(details.expires_at);
26463
+ if (Number.isNaN(expiresAtMs)) throw new X402Error(`challenge has an invalid expires_at: ${details.expires_at}`, 0);
26464
+ const expiresAtSec = Math.floor(expiresAtMs / 1e3);
26465
+ if (expiresAtSec <= nowSec) throw new X402Error(`challenge has already expired (expires_at ${details.expires_at}); not signing`, 0);
26466
+ let validAfter;
26467
+ let validBefore;
26468
+ try {
26469
+ ({validAfter, validBefore} = computePaymentValidityWindow({
26470
+ challengeExpiresAtSec: expiresAtSec,
26471
+ nowSec
26472
+ }));
26473
+ } catch (cause) {
26474
+ throw new X402Error(cause instanceof Error ? cause.message : String(cause), 0, void 0, { cause });
26475
+ }
26476
+ const { authorization, signature } = await signInteractionPayment({
26477
+ sign: (typedData) => options.signer.signTypedData(typedData),
26478
+ payer: options.signer.address,
26479
+ domain: {
26480
+ name: pr.extra.name,
26481
+ version: pr.extra.version,
26482
+ chainId,
26483
+ verifyingContract: pr.asset
26484
+ },
26485
+ payTo: pr.payTo,
26486
+ amount: BigInt(pr.maxAmountRequired),
26487
+ nonceBinding: {
26488
+ interactionId: details.nonce_binding.interaction_id,
26489
+ challengeStepId: details.nonce_binding.challenge_step_id,
26490
+ challengeNonce: details.nonce_binding.challenge_nonce
26491
+ },
26492
+ validAfter,
26493
+ validBefore
26494
+ });
26495
+ const payment = buildExactEvmPaymentPayload({
26496
+ network,
26497
+ authorization,
26498
+ signature
26499
+ });
26500
+ return buildPaymentStepEnvelope({
26501
+ interactionId: challenge.interaction_id,
26502
+ stepId: randomUUID(),
26503
+ prevStepId: details.nonce_binding.challenge_step_id,
26504
+ payment
26505
+ });
26506
+ }
26507
+ /**
24706
26508
  * Pay a challenge (payer side). Derives the interaction-bound authorization,
24707
26509
  * signs it locally with the caller's key, and submits it for settlement.
24708
26510
  */
@@ -25122,6 +26924,116 @@ var PaymentsPayCommand = class PaymentsPayCommand extends Command {
25122
26924
  }
25123
26925
  };
25124
26926
  //#endregion
26927
+ //#region src/oclif/commands/payments-pay-email-step.ts
26928
+ function readEmailChallenge(input) {
26929
+ let raw;
26930
+ if (input.inline !== void 0) raw = input.inline;
26931
+ else if (input.file !== void 0) raw = readFileSync(input.file, "utf8");
26932
+ else {
26933
+ if (process.stdin.isTTY) process.stderr.write("Reading the email challenge JSON from stdin; paste it and press Ctrl-D (or use --challenge / --challenge-file).\n");
26934
+ raw = readFileSync(0, "utf8");
26935
+ }
26936
+ const trimmed = raw.trim();
26937
+ if (!trimmed) throw new Error("no challenge provided; pass --challenge '<json>', --challenge-file <path>, or pipe the email challenge JSON on stdin");
26938
+ let parsed;
26939
+ try {
26940
+ parsed = JSON.parse(trimmed);
26941
+ } catch {
26942
+ throw new Error("challenge is not valid JSON");
26943
+ }
26944
+ if (parsed && typeof parsed === "object" && "data" in parsed) {
26945
+ const data = parsed.data;
26946
+ if (!data || typeof data !== "object") throw new Error("challenge envelope has no `data` object; pass the email challenge JSON itself or a `{ \"data\": { ... } }` envelope");
26947
+ return data;
26948
+ }
26949
+ return parsed;
26950
+ }
26951
+ var PaymentsPayEmailStepCommand = class PaymentsPayEmailStepCommand extends Command {
26952
+ static description = `Sign an email-native x402 challenge into a payment-step interaction.json.
26953
+
26954
+ Reads the email challenge the payee issued (the JSON from
26955
+ \`payments create-email-challenge\`), derives and signs the interaction-bound
26956
+ EIP-3009 authorization locally with your wallet key (read from
26957
+ ${PRIVATE_KEY_ENV} by default), and prints the signed \`interaction.json\`
26958
+ payment-step envelope. The key never leaves your machine.
26959
+
26960
+ This command does NOT send the payment. Attach the printed envelope as the
26961
+ \`interaction.json\` part of your reply to the challenge email, for example:
26962
+ primitive payments pay-email-step --challenge-file challenge.json > interaction.json
26963
+ primitive reply --attachment interaction.json
26964
+
26965
+ Provide the challenge inline with --challenge, from a file with
26966
+ --challenge-file, or piped on stdin.`;
26967
+ static summary = "Sign an email x402 challenge into a payment-step envelope";
26968
+ static examples = [
26969
+ "<%= config.bin %> payments pay-email-step --challenge-file challenge.json > interaction.json",
26970
+ "<%= config.bin %> payments pay-email-step --challenge '{\"interaction_id\":\"...\",\"challenge\":{...}}'",
26971
+ "cat challenge.json | <%= config.bin %> payments pay-email-step"
26972
+ ];
26973
+ static flags = {
26974
+ "api-key": Flags.string({
26975
+ description: "Primitive API key override (defaults to PRIMITIVE_API_KEY or saved OAuth login credentials)",
26976
+ env: "PRIMITIVE_API_KEY"
26977
+ }),
26978
+ "api-base-url": Flags.string({
26979
+ description: API_BASE_URL_FLAG_DESCRIPTION,
26980
+ env: "PRIMITIVE_API_BASE_URL",
26981
+ hidden: true
26982
+ }),
26983
+ "private-key": Flags.string({
26984
+ description: PRIVATE_KEY_FLAG_DESCRIPTION,
26985
+ env: PRIVATE_KEY_ENV
26986
+ }),
26987
+ challenge: Flags.string({
26988
+ description: "The email challenge object as a JSON string.",
26989
+ exclusive: ["challenge-file"]
26990
+ }),
26991
+ "challenge-file": Flags.string({
26992
+ description: "Path to a file containing the email challenge JSON.",
26993
+ exclusive: ["challenge"]
26994
+ }),
26995
+ json: Flags.boolean({ description: "Print the full signed envelope object (default prints the interaction.json bytes)." }),
26996
+ time: Flags.boolean({ description: TIME_FLAG_DESCRIPTION })
26997
+ };
26998
+ async run() {
26999
+ const { flags } = await this.parse(PaymentsPayEmailStepCommand);
27000
+ const requestConfig = resolveCliApiRequestConfig({
27001
+ apiBaseUrl: flags["api-base-url"],
27002
+ configDir: this.config.configDir
27003
+ });
27004
+ const baseUrlOverridden = requestConfig.baseUrlOverridden;
27005
+ const auth = {
27006
+ apiKey: flags["api-key"],
27007
+ apiBaseUrl: requestConfig.resolvedApiBaseUrl,
27008
+ source: "none",
27009
+ credentials: null
27010
+ };
27011
+ await runWithTiming(flags.time, async () => {
27012
+ const client = createX402Client({
27013
+ apiKey: flags["api-key"] || void 0,
27014
+ baseUrl: x402BaseUrl(requestConfig.resolvedApiBaseUrl)
27015
+ });
27016
+ try {
27017
+ const challenge = readEmailChallenge({
27018
+ inline: flags.challenge,
27019
+ file: flags["challenge-file"]
27020
+ });
27021
+ const signer = signerFromPrivateKey(flags["private-key"] ?? "");
27022
+ const built = await client.payEmailChallenge(challenge, { signer });
27023
+ if (flags.json) this.log(JSON.stringify(built.envelope, null, 2));
27024
+ else this.log(built.json);
27025
+ } catch (error) {
27026
+ reportX402Error(error, {
27027
+ auth,
27028
+ baseUrlOverridden,
27029
+ configDir: this.config.configDir
27030
+ });
27031
+ process.exitCode = 1;
27032
+ }
27033
+ });
27034
+ }
27035
+ };
27036
+ //#endregion
25125
27037
  //#region src/oclif/commands/payments-register-payout-address.ts
25126
27038
  var PaymentsRegisterPayoutAddressCommand = class PaymentsRegisterPayoutAddressCommand extends Command {
25127
27039
  static description = `Register the default payout address your org receives x402 payments at.
@@ -26721,7 +28633,8 @@ const COMMANDS = {
26721
28633
  "payments:register-payout": PaymentsRegisterPayoutAddressCommand,
26722
28634
  "payments:charge": PaymentsChargeCommand,
26723
28635
  "payments:pay-challenge": PaymentsPayCommand,
26724
- "payments:pay": PaymentsPayCommand
28636
+ "payments:pay": PaymentsPayCommand,
28637
+ "payments:pay-email-step": PaymentsPayEmailStepCommand
26725
28638
  };
26726
28639
  //#endregion
26727
28640
  export { CANONICAL_OPERATION_ALIASES, COMMANDS, lookupOperation };