@relyon/kit 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/AGENTS.md +75 -0
  2. package/CHANGELOG.md +1053 -0
  3. package/LICENSE +21 -0
  4. package/QUICKSTART.md +239 -0
  5. package/README.md +117 -2
  6. package/dist/adapters/express.d.ts +39 -0
  7. package/dist/adapters/express.js +106 -0
  8. package/dist/adapters/hono.d.ts +16 -0
  9. package/dist/adapters/hono.js +15 -0
  10. package/dist/adapters/next.d.ts +29 -0
  11. package/dist/adapters/next.js +38 -0
  12. package/dist/agent-card.d.ts +14 -0
  13. package/dist/agent-card.js +58 -0
  14. package/dist/agent-docs.d.ts +36 -0
  15. package/dist/agent-docs.js +78 -0
  16. package/dist/agent-hooks.d.ts +66 -0
  17. package/dist/agent-hooks.js +280 -0
  18. package/dist/agents.d.ts +24 -0
  19. package/dist/agents.js +120 -0
  20. package/dist/api-key.d.ts +6 -0
  21. package/dist/api-key.js +33 -0
  22. package/dist/cache.d.ts +46 -0
  23. package/dist/cache.js +86 -0
  24. package/dist/cart-tokens.d.ts +31 -0
  25. package/dist/cart-tokens.js +58 -0
  26. package/dist/cart-transfer.d.ts +95 -0
  27. package/dist/cart-transfer.js +387 -0
  28. package/dist/catalog-enrichment.d.ts +6 -0
  29. package/dist/catalog-enrichment.js +71 -0
  30. package/dist/catalog-reads.d.ts +126 -0
  31. package/dist/catalog-reads.js +104 -0
  32. package/dist/catalog.d.ts +78 -0
  33. package/dist/catalog.js +288 -0
  34. package/dist/charge-claims.d.ts +11 -0
  35. package/dist/charge-claims.js +47 -0
  36. package/dist/check.d.ts +44 -0
  37. package/dist/check.js +152 -0
  38. package/dist/checklist-manifest.d.ts +72 -0
  39. package/dist/checklist-manifest.js +341 -0
  40. package/dist/checkout.d.ts +222 -0
  41. package/dist/checkout.js +353 -0
  42. package/dist/cli.d.ts +2 -0
  43. package/dist/cli.js +727 -0
  44. package/dist/confirmation.d.ts +78 -0
  45. package/dist/confirmation.js +124 -0
  46. package/dist/context.d.ts +81 -0
  47. package/dist/context.js +10 -0
  48. package/dist/discovery.d.ts +151 -0
  49. package/dist/discovery.js +346 -0
  50. package/dist/doctor-cart-transfer.d.ts +33 -0
  51. package/dist/doctor-cart-transfer.js +186 -0
  52. package/dist/doctor-catalog.d.ts +8 -0
  53. package/dist/doctor-catalog.js +47 -0
  54. package/dist/doctor-evidence.d.ts +22 -0
  55. package/dist/doctor-evidence.js +57 -0
  56. package/dist/doctor-merchant.d.ts +48 -0
  57. package/dist/doctor-merchant.js +74 -0
  58. package/dist/doctor-source.d.ts +5 -0
  59. package/dist/doctor-source.js +142 -0
  60. package/dist/doctor-variants.d.ts +70 -0
  61. package/dist/doctor-variants.js +102 -0
  62. package/dist/doctor.d.ts +215 -0
  63. package/dist/doctor.js +1689 -0
  64. package/dist/events.d.ts +95 -0
  65. package/dist/events.js +200 -0
  66. package/dist/feed-mapping.d.ts +114 -0
  67. package/dist/feed-mapping.js +152 -0
  68. package/dist/feed-values.d.ts +13 -0
  69. package/dist/feed-values.js +40 -0
  70. package/dist/feeds.d.ts +104 -0
  71. package/dist/feeds.js +366 -0
  72. package/dist/identify.d.ts +102 -0
  73. package/dist/identify.js +124 -0
  74. package/dist/identity.d.ts +37 -0
  75. package/dist/identity.js +54 -0
  76. package/dist/index.d.ts +42 -0
  77. package/dist/index.js +41 -0
  78. package/dist/init.d.ts +157 -0
  79. package/dist/init.js +912 -0
  80. package/dist/kit-config.d.ts +19 -0
  81. package/dist/kit-config.js +43 -0
  82. package/dist/kit-environment.d.ts +20 -0
  83. package/dist/kit-environment.js +32 -0
  84. package/dist/kit-updates.d.ts +47 -0
  85. package/dist/kit-updates.js +77 -0
  86. package/dist/kit-version-project.d.ts +18 -0
  87. package/dist/kit-version-project.js +214 -0
  88. package/dist/kit-version.d.ts +37 -0
  89. package/dist/kit-version.js +162 -0
  90. package/dist/kit.d.ts +516 -0
  91. package/dist/kit.js +1309 -0
  92. package/dist/layers/pages.d.ts +3 -0
  93. package/dist/layers/pages.js +5 -0
  94. package/dist/layers/payments.d.ts +7 -0
  95. package/dist/layers/payments.js +9 -0
  96. package/dist/layers/products.d.ts +10 -0
  97. package/dist/layers/products.js +13 -0
  98. package/dist/live.d.ts +13 -0
  99. package/dist/live.js +52 -0
  100. package/dist/mcp.d.ts +270 -0
  101. package/dist/mcp.js +312 -0
  102. package/dist/next-steps.d.ts +101 -0
  103. package/dist/next-steps.js +257 -0
  104. package/dist/order-pending.d.ts +57 -0
  105. package/dist/order-pending.js +127 -0
  106. package/dist/orders.d.ts +12 -0
  107. package/dist/orders.js +21 -0
  108. package/dist/payments-init.d.ts +19 -0
  109. package/dist/payments-init.js +70 -0
  110. package/dist/payments-routes.d.ts +54 -0
  111. package/dist/payments-routes.js +123 -0
  112. package/dist/payments.d.ts +165 -0
  113. package/dist/payments.js +192 -0
  114. package/dist/pnpm-workspace.d.ts +58 -0
  115. package/dist/pnpm-workspace.js +250 -0
  116. package/dist/policies.d.ts +111 -0
  117. package/dist/policies.js +317 -0
  118. package/dist/preview-hosts.d.ts +64 -0
  119. package/dist/preview-hosts.js +175 -0
  120. package/dist/private-config.d.ts +169 -0
  121. package/dist/private-config.js +820 -0
  122. package/dist/progress.d.ts +54 -0
  123. package/dist/progress.js +153 -0
  124. package/dist/protocol-inputs.d.ts +22 -0
  125. package/dist/protocol-inputs.js +151 -0
  126. package/dist/public-origin.d.ts +50 -0
  127. package/dist/public-origin.js +180 -0
  128. package/dist/refusals.d.ts +86 -0
  129. package/dist/refusals.js +157 -0
  130. package/dist/relay.d.ts +107 -0
  131. package/dist/relay.js +655 -0
  132. package/dist/release-notes.d.ts +2 -0
  133. package/dist/release-notes.js +290 -0
  134. package/dist/relyon-cart-tokens.d.ts +101 -0
  135. package/dist/relyon-cart-tokens.js +521 -0
  136. package/dist/relyon.d.ts +141 -0
  137. package/dist/relyon.js +238 -0
  138. package/dist/robots.d.ts +27 -0
  139. package/dist/robots.js +127 -0
  140. package/dist/rules.d.ts +144 -0
  141. package/dist/rules.js +347 -0
  142. package/dist/sdk/generated/public-api.d.ts +4816 -0
  143. package/dist/sdk/generated/public-api.js +1 -0
  144. package/dist/sdk/index.d.ts +24 -0
  145. package/dist/sdk/index.js +34 -0
  146. package/dist/sdk/signatures.d.ts +17 -0
  147. package/dist/sdk/signatures.js +33 -0
  148. package/dist/setup.d.ts +37 -0
  149. package/dist/setup.js +94 -0
  150. package/dist/signatures.d.ts +112 -0
  151. package/dist/signatures.js +443 -0
  152. package/dist/state.d.ts +185 -0
  153. package/dist/state.js +96 -0
  154. package/dist/store-payments.d.ts +48 -0
  155. package/dist/store-payments.js +143 -0
  156. package/dist/structured-fields.d.ts +26 -0
  157. package/dist/structured-fields.js +200 -0
  158. package/dist/templates.d.ts +19 -0
  159. package/dist/templates.js +193 -0
  160. package/dist/test-checkout-command.d.ts +32 -0
  161. package/dist/test-checkout-command.js +161 -0
  162. package/dist/test-checkout.d.ts +88 -0
  163. package/dist/test-checkout.js +292 -0
  164. package/dist/types.d.ts +103 -0
  165. package/dist/types.js +18 -0
  166. package/dist/ucp-versions.d.ts +57 -0
  167. package/dist/ucp-versions.js +129 -0
  168. package/dist/util.d.ts +23 -0
  169. package/dist/util.js +68 -0
  170. package/dist/variants.d.ts +67 -0
  171. package/dist/variants.js +146 -0
  172. package/dist/version.d.ts +9 -0
  173. package/dist/version.js +10 -0
  174. package/dist/waiting.d.ts +43 -0
  175. package/dist/waiting.js +57 -0
  176. package/dist/webhook-command.d.ts +48 -0
  177. package/dist/webhook-command.js +367 -0
  178. package/dist/webhook-registration.d.ts +47 -0
  179. package/dist/webhook-registration.js +69 -0
  180. package/dist/webmcp-schema.d.ts +14 -0
  181. package/dist/webmcp-schema.js +140 -0
  182. package/dist/webmcp-script.d.ts +3 -0
  183. package/dist/webmcp-script.js +176 -0
  184. package/dist/webmcp-store.d.ts +102 -0
  185. package/dist/webmcp-store.js +116 -0
  186. package/dist/webmcp.d.ts +242 -0
  187. package/dist/webmcp.js +866 -0
  188. package/dist/wire-names.d.ts +85 -0
  189. package/dist/wire-names.js +109 -0
  190. package/package.json +118 -4
  191. package/release-notes.json +290 -0
  192. package/scripts/install-notice.cjs +7 -0
  193. package/skills/relyon-agents/SKILL.md +327 -0
  194. package/skills/relyon-catalog/SKILL.md +499 -0
  195. package/skills/relyon-catalog/references/example-store.md +218 -0
  196. package/skills/relyon-checkout/SKILL.md +603 -0
  197. package/skills/relyon-checkout/references/checkout-flow.md +257 -0
  198. package/skills/relyon-checkout/references/checkout-page.md +315 -0
  199. package/skills/relyon-go-live/SKILL.md +344 -0
  200. package/skills/relyon-orders/SKILL.md +191 -0
  201. package/skills/relyon-orders/references/webhook-receiver.md +113 -0
  202. package/skills/relyon-payments/SKILL.md +117 -0
  203. package/skills/relyon-setup/SKILL.md +1061 -0
  204. package/skills/relyon-setup/references/QUICKSTART.md +239 -0
  205. package/skills/relyon-setup/references/durable-state.md +209 -0
  206. package/skills/relyon-setup/references/express-server.md +388 -0
  207. package/skills/relyon-setup/references/next-app-router.md +251 -0
  208. package/templates/common/STORE-README.md +67 -0
  209. package/templates/common/gitignore +8 -0
  210. package/templates/common/scripts/check-pricing.ts +22 -0
  211. package/templates/common/scripts/serve.mjs +13 -0
  212. package/templates/common/server/catalog.ts +79 -0
  213. package/templates/common/server/checkout-flow.d.ts +34 -0
  214. package/templates/common/server/pages.ts +184 -0
  215. package/templates/common/server/storage.ts +114 -0
  216. package/templates/common/server/store.ts +67 -0
  217. package/templates/express/server/express.ts +20 -0
  218. package/templates/express/tsconfig.build.json +6 -0
  219. package/templates/express/tsconfig.json +9 -0
  220. package/templates/next/app/[[...path]]/route.ts +24 -0
  221. package/templates/next/next.config.mjs +19 -0
  222. package/templates/next/tsconfig.json +12 -0
  223. package/templates/payments/express.ts +39 -0
  224. package/templates/payments/next.ts +38 -0
  225. package/templates/payments/node.ts +39 -0
@@ -0,0 +1,3 @@
1
+ export { TEMPLATE_VERSIONS, TEMPLATE_QUICKSTART, renderTemplate, templateInstructions, templateCatalog, type StoreTemplate } from "../templates.js";
2
+ export { orderConfirmation, orderRefusal, renderOrderConfirmation, renderOrderRefusal } from "../confirmation.js";
3
+ export { CHECKOUT_CART_ITEMS_ATTRIBUTE, cartItemCount } from "../checkout.js";
@@ -0,0 +1,5 @@
1
+ // Layer 3, shopping pages: Relyon-built shopping pages (the Next.js and
2
+ // Express templates, with a real /cart page) on top of layers 1 and 2.
3
+ export { TEMPLATE_VERSIONS, TEMPLATE_QUICKSTART, renderTemplate, templateInstructions, templateCatalog } from "../templates.js";
4
+ export { orderConfirmation, orderRefusal, renderOrderConfirmation, renderOrderRefusal } from "../confirmation.js";
5
+ export { CHECKOUT_CART_ITEMS_ATTRIBUTE, cartItemCount } from "../checkout.js";
@@ -0,0 +1,7 @@
1
+ export { RelyonPayments, createPayments, chargeIdempotencyKey, PaymentOutcomeUnknown, DEFAULT_PAYMENTS_BASE_URL, WEBHOOK_SIGNATURE_HEADER, type PaymentsOptions, type PaymentSessionInput, type PaymentCardFieldsInput, type PaymentCardFields, type HostedCardPaymentMethod, type ChargeInput, type ChargeResult, type RefundInput, type RefundResult, type WebhookInput, } from "../payments.js";
2
+ export { kitEnvironment, publicUrlFromEnv, projectSpaceFromEnv, type KitEnvironment } from "../kit-environment.js";
3
+ export { RelyonProblemError, RelyonUnavailableError, RelyonAccountNotReadyError, cardFieldsScriptUrl } from "../relyon.js";
4
+ export type { PaymentSession } from "../types.js";
5
+ export { PaymentRoutes, createPaymentRoutes, DEFAULT_PAYMENT_ROUTES, type PaymentRoutesOptions, type PaymentRoutePaths, type OrderAmount, } from "../payments-routes.js";
6
+ export { paymentsMiddleware, paymentsNodeHandler, type FetchRoutes } from "../adapters/express.js";
7
+ export { paymentsRouteHandlers } from "../adapters/next.js";
@@ -0,0 +1,9 @@
1
+ // Layer 1, payments: card payments in your own app. Payment sessions, the
2
+ // hosted card fields, charges, refunds and webhook signature checks; no
3
+ // catalog, feeds, cart page or store hostnames.
4
+ export { RelyonPayments, createPayments, chargeIdempotencyKey, PaymentOutcomeUnknown, DEFAULT_PAYMENTS_BASE_URL, WEBHOOK_SIGNATURE_HEADER, } from "../payments.js";
5
+ export { kitEnvironment, publicUrlFromEnv, projectSpaceFromEnv } from "../kit-environment.js";
6
+ export { RelyonProblemError, RelyonUnavailableError, RelyonAccountNotReadyError, cardFieldsScriptUrl } from "../relyon.js";
7
+ export { PaymentRoutes, createPaymentRoutes, DEFAULT_PAYMENT_ROUTES, } from "../payments-routes.js";
8
+ export { paymentsMiddleware, paymentsNodeHandler } from "../adapters/express.js";
9
+ export { paymentsRouteHandlers } from "../adapters/next.js";
@@ -0,0 +1,10 @@
1
+ export { createKit, createStoreKit, StoreKit, BodyTooLargeError, DEFAULT_ORDER_CLAIM_LEASE_MS, type Kit, type KitOptions, type StoreKitOptions, } from "../kit.js";
2
+ export { CatalogHolder, CatalogSyncError, type CatalogPersistence, type CatalogSyncResult } from "../catalog.js";
3
+ export * from "../feeds.js";
4
+ export * from "../feed-values.js";
5
+ export * from "../feed-mapping.js";
6
+ export { llmsTxt, productSitemap, productJsonLd, renderProductJsonLd, productListJsonLd, renderProductListJsonLd } from "../discovery.js";
7
+ export { kitMiddleware, storeKitMiddleware } from "../adapters/express.js";
8
+ export { kitRouteHandlers, kitFetch, storeKitRouteHandlers, storeKitFetch } from "../adapters/next.js";
9
+ export { kitMiddleware as kitHonoMiddleware, storeKitMiddleware as storeKitHonoMiddleware } from "../adapters/hono.js";
10
+ export { readKitConfig, KIT_LAYERS, KIT_CONFIG_FILE, type KitLayer, type KitConfig } from "../kit-config.js";
@@ -0,0 +1,13 @@
1
+ // Layer 2, products and agents: the kit that lists the project space's
2
+ // products so AI shopping agents can find and buy them (catalog, feeds,
3
+ // discovery, agent checkout and agent rules), plus the framework adapters.
4
+ export { createKit, createStoreKit, StoreKit, BodyTooLargeError, DEFAULT_ORDER_CLAIM_LEASE_MS, } from "../kit.js";
5
+ export { CatalogHolder, CatalogSyncError } from "../catalog.js";
6
+ export * from "../feeds.js";
7
+ export * from "../feed-values.js";
8
+ export * from "../feed-mapping.js";
9
+ export { llmsTxt, productSitemap, productJsonLd, renderProductJsonLd, productListJsonLd, renderProductListJsonLd } from "../discovery.js";
10
+ export { kitMiddleware, storeKitMiddleware } from "../adapters/express.js";
11
+ export { kitRouteHandlers, kitFetch, storeKitRouteHandlers, storeKitFetch } from "../adapters/next.js";
12
+ export { kitMiddleware as kitHonoMiddleware, storeKitMiddleware as storeKitHonoMiddleware } from "../adapters/hono.js";
13
+ export { readKitConfig, KIT_LAYERS, KIT_CONFIG_FILE } from "../kit-config.js";
package/dist/live.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Hostnames that can never be a Live store: local names, IP literals and
3
+ * development preview domains. A Live store is reached by shoppers and
4
+ * agents on its own public HTTPS hostname.
5
+ */
6
+ export declare function nonPublicStoreHost(hostname: string): string | null;
7
+ /**
8
+ * Live mode's store URL rules, checked when the kit is created:
9
+ * `store.publicUrl` (the app's `STORE_PUBLIC_URL`) is required, must be an
10
+ * `https` origin with no path, query or credentials, and must name one of
11
+ * `store.hostnames`; no hostname may be local, an IP literal or `*.replit.dev`.
12
+ */
13
+ export declare function assertLiveStoreUrls(hostnames: readonly string[], publicUrl: string | undefined): void;
package/dist/live.js ADDED
@@ -0,0 +1,52 @@
1
+ import { isIP } from "node:net";
2
+ /**
3
+ * Hostnames that can never be a Live store: local names, IP literals and
4
+ * development preview domains. A Live store is reached by shoppers and
5
+ * agents on its own public HTTPS hostname.
6
+ */
7
+ export function nonPublicStoreHost(hostname) {
8
+ const host = hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
9
+ if (host === "")
10
+ return "it is empty";
11
+ if (host === "localhost" || host.endsWith(".localhost"))
12
+ return "it is a local hostname";
13
+ if (isIP(host) !== 0)
14
+ return "it is an IP address";
15
+ if (host === "replit.dev" || host.endsWith(".replit.dev"))
16
+ return "it is a development preview domain (*.replit.dev)";
17
+ if (!host.includes("."))
18
+ return "it is not a public domain name";
19
+ return null;
20
+ }
21
+ /**
22
+ * Live mode's store URL rules, checked when the kit is created:
23
+ * `store.publicUrl` (the app's `STORE_PUBLIC_URL`) is required, must be an
24
+ * `https` origin with no path, query or credentials, and must name one of
25
+ * `store.hostnames`; no hostname may be local, an IP literal or `*.replit.dev`.
26
+ */
27
+ export function assertLiveStoreUrls(hostnames, publicUrl) {
28
+ if (publicUrl === undefined || publicUrl === "") {
29
+ throw new TypeError("Live mode needs store.publicUrl (the store's STORE_PUBLIC_URL, such as https://shop.example.com).");
30
+ }
31
+ let url;
32
+ try {
33
+ url = new URL(publicUrl);
34
+ }
35
+ catch {
36
+ throw new TypeError("store.publicUrl is not a valid URL.");
37
+ }
38
+ if (url.protocol !== "https:")
39
+ throw new TypeError("Live mode needs an https store.publicUrl (STORE_PUBLIC_URL).");
40
+ if (url.username || url.password || url.search || url.hash || (url.pathname !== "/" && url.pathname !== "")) {
41
+ throw new TypeError("store.publicUrl must be the store's origin only, such as https://shop.example.com, with no path, query or credentials.");
42
+ }
43
+ const host = url.hostname.toLowerCase();
44
+ if (!hostnames.includes(host)) {
45
+ throw new TypeError("store.publicUrl's hostname must be one of store.hostnames.");
46
+ }
47
+ for (const hostname of [host, ...hostnames]) {
48
+ const reason = nonPublicStoreHost(hostname);
49
+ if (reason)
50
+ throw new TypeError(`Live mode refuses the store hostname ${JSON.stringify(hostname)}: ${reason}.`);
51
+ }
52
+ }
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,270 @@
1
+ import type { KitContext } from "./context.js";
2
+ import { type StoreInfo } from "./discovery.js";
3
+ import type { RequestInfo } from "./types.js";
4
+ export declare const MCP_TOOLS: readonly [{
5
+ readonly name: "search_products";
6
+ readonly title: "Search products";
7
+ readonly description: "Search this store's catalog. Prices are display prices; the checkout prices the cart.";
8
+ readonly inputSchema: {
9
+ readonly type: "object";
10
+ readonly required: readonly ["query"];
11
+ readonly properties: {
12
+ readonly query: {
13
+ readonly type: "string";
14
+ };
15
+ readonly limit: {
16
+ readonly type: "integer";
17
+ readonly minimum: 1;
18
+ readonly maximum: 50;
19
+ };
20
+ };
21
+ };
22
+ readonly annotations: {
23
+ readonly readOnlyHint: true;
24
+ };
25
+ }, {
26
+ readonly name: "get_product";
27
+ readonly title: "Get product";
28
+ readonly description: "One product from this store's catalog.";
29
+ readonly inputSchema: {
30
+ readonly type: "object";
31
+ readonly required: readonly ["product_id"];
32
+ readonly properties: {
33
+ readonly product_id: {
34
+ readonly type: "string";
35
+ };
36
+ };
37
+ };
38
+ readonly annotations: {
39
+ readonly readOnlyHint: true;
40
+ };
41
+ }, {
42
+ readonly name: "create_checkout";
43
+ readonly title: "Create checkout";
44
+ readonly description: "Start a checkout; the store prices the cart. Checkout tools need this store's agent credential (Authorization: Bearer agt_…), issued by the merchant in the Relyon dashboard under AI agents → Credentials. A product option with only one value never has to be named.";
45
+ readonly inputSchema: {
46
+ readonly type: "object";
47
+ readonly required: readonly ["lines"];
48
+ readonly properties: {
49
+ readonly lines: {
50
+ type: string;
51
+ minItems: number;
52
+ maxItems: number;
53
+ items: {
54
+ type: string;
55
+ required: string[];
56
+ additionalProperties: boolean;
57
+ properties: {
58
+ product_id: {
59
+ type: string;
60
+ };
61
+ quantity: {
62
+ type: string;
63
+ minimum: number;
64
+ };
65
+ options: {
66
+ type: string;
67
+ description: string;
68
+ };
69
+ };
70
+ };
71
+ };
72
+ readonly shipping_address: {
73
+ type: string;
74
+ required: string[];
75
+ properties: {
76
+ name: {
77
+ type: string;
78
+ };
79
+ line1: {
80
+ type: string;
81
+ };
82
+ line2: {
83
+ type: string;
84
+ };
85
+ city: {
86
+ type: string;
87
+ };
88
+ region: {
89
+ type: string;
90
+ };
91
+ postal_code: {
92
+ type: string;
93
+ };
94
+ country: {
95
+ type: string;
96
+ description: string;
97
+ };
98
+ };
99
+ };
100
+ readonly shipping_option_id: {
101
+ readonly type: "string";
102
+ };
103
+ readonly coupons: {
104
+ readonly type: "array";
105
+ readonly items: {
106
+ readonly type: "string";
107
+ };
108
+ };
109
+ };
110
+ };
111
+ }, {
112
+ readonly name: "update_checkout";
113
+ readonly title: "Update checkout";
114
+ readonly description: "Change the lines, address, shipping option or coupons.";
115
+ readonly inputSchema: {
116
+ readonly type: "object";
117
+ readonly required: readonly ["checkout_id"];
118
+ readonly properties: {
119
+ readonly lines: {
120
+ type: string;
121
+ minItems: number;
122
+ maxItems: number;
123
+ items: {
124
+ type: string;
125
+ required: string[];
126
+ additionalProperties: boolean;
127
+ properties: {
128
+ product_id: {
129
+ type: string;
130
+ };
131
+ quantity: {
132
+ type: string;
133
+ minimum: number;
134
+ };
135
+ options: {
136
+ type: string;
137
+ description: string;
138
+ };
139
+ };
140
+ };
141
+ };
142
+ readonly shipping_address: {
143
+ type: string;
144
+ required: string[];
145
+ properties: {
146
+ name: {
147
+ type: string;
148
+ };
149
+ line1: {
150
+ type: string;
151
+ };
152
+ line2: {
153
+ type: string;
154
+ };
155
+ city: {
156
+ type: string;
157
+ };
158
+ region: {
159
+ type: string;
160
+ };
161
+ postal_code: {
162
+ type: string;
163
+ };
164
+ country: {
165
+ type: string;
166
+ description: string;
167
+ };
168
+ };
169
+ };
170
+ readonly shipping_option_id: {
171
+ readonly type: "string";
172
+ };
173
+ readonly coupons: {
174
+ readonly type: "array";
175
+ readonly items: {
176
+ readonly type: "string";
177
+ };
178
+ };
179
+ readonly checkout_id: {
180
+ type: string;
181
+ description: string;
182
+ };
183
+ };
184
+ };
185
+ }, {
186
+ readonly name: "get_checkout";
187
+ readonly title: "Get checkout";
188
+ readonly description: "Read a checkout.";
189
+ readonly inputSchema: {
190
+ readonly type: "object";
191
+ readonly required: readonly ["checkout_id"];
192
+ readonly properties: {
193
+ checkout_id: {
194
+ type: string;
195
+ description: string;
196
+ };
197
+ };
198
+ };
199
+ readonly annotations: {
200
+ readonly readOnlyHint: true;
201
+ };
202
+ }, {
203
+ readonly name: "complete_checkout";
204
+ readonly title: "Complete checkout";
205
+ readonly description: "Finish the checkout as shown.";
206
+ readonly inputSchema: {
207
+ readonly type: "object";
208
+ readonly required: readonly ["checkout_id"];
209
+ readonly properties: {
210
+ checkout_id: {
211
+ type: string;
212
+ description: string;
213
+ };
214
+ };
215
+ };
216
+ }, {
217
+ readonly name: "cancel_checkout";
218
+ readonly title: "Cancel checkout";
219
+ readonly description: "Cancel a checkout.";
220
+ readonly inputSchema: {
221
+ readonly type: "object";
222
+ readonly required: readonly ["checkout_id"];
223
+ readonly properties: {
224
+ checkout_id: {
225
+ type: string;
226
+ description: string;
227
+ };
228
+ };
229
+ };
230
+ }];
231
+ export interface McpHooks {
232
+ /** Refuses a checkout tool call when agent checkout is paused for MCP; null to go ahead. */
233
+ checkoutRefusal(): Promise<{
234
+ code: string;
235
+ message?: string;
236
+ } | null>;
237
+ }
238
+ /**
239
+ * The store's MCP endpoint (Streamable HTTP, JSON responses). Browse tools
240
+ * answer from the store's last good catalog; checkout tools relay to Relyon
241
+ * with `protocol=mcp`. Tool refusals are in-band JSON-RPC errors (HTTP 200)
242
+ * with `data.error`.
243
+ */
244
+ export declare class McpEndpoint {
245
+ private readonly ctx;
246
+ private readonly store;
247
+ private readonly hooks;
248
+ private readonly clients;
249
+ constructor(ctx: KitContext, store: StoreInfo, hooks: McpHooks);
250
+ /** The MCP client a session announced in `initialize`, if any. */
251
+ clientFor(request: Request): {
252
+ name: string;
253
+ version?: string;
254
+ } | undefined;
255
+ handle(request: Request, rawBody: string, info: RequestInfo): Promise<Response>;
256
+ private report;
257
+ private callTool;
258
+ private checkoutTool;
259
+ }
260
+ /**
261
+ * The kit's own MCP refusal of a checkout tool call: `order_pending` when the
262
+ * named checkout is paid with its order not created, a charge-neutral message
263
+ * when it names any other existing checkout, the default message on create.
264
+ */
265
+ export declare function mcpRefusal(ctx: KitContext, id: unknown, sessionId: string | null, code: string, message?: string): Promise<Response>;
266
+ /** The checkout tool call a JSON-RPC message makes, or null when it isn't one. */
267
+ export declare function mcpCheckoutCall(message: unknown): {
268
+ id: unknown;
269
+ sessionId: string | null;
270
+ } | null;