@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,327 @@
1
+ ---
2
+ name: relyon-agents
3
+ description: Serve AI shopping agents on the store's own domain with @relyon/store-kit - the UCP, ACP and MCP routes, /.well-known/ucp, hand-off links, agent rules refreshed through the kit's webhook route, recordCrawlerVisit on the app's pages, and agent activity reporting that always stays on.
4
+ ---
5
+
6
+ # Relyon agents
7
+
8
+ <!-- BEGIN relyon-store-first-rules (generated from the shared rules source; edit it there) -->
9
+ Before building, ask the user: 'Do you want to (1) accept card payments in your own app — no Relyon product catalog or shopping pages; (2) also list products so AI shopping agents can find and buy them; or (3) also have Relyon's kit build the shopping pages for you?' Don't choose for them. Then follow the matching quickstart.
10
+
11
+ ## Choose the integration before applying kit guidance
12
+
13
+ Payments: https://core.getrelyon.com/docs/payments-quickstart and `relyon-payments`.
14
+ Products and agent selling: https://core.getrelyon.com/docs (catalog,
15
+ agent checkout and AI visibility are optional additions).
16
+ Shopping pages: https://core.getrelyon.com/docs/quickstart and `relyon-setup`.
17
+ Never install the kit or build catalog, /cart or shopping pages for payments only.
18
+ The kit-specific rules below apply only after the user chooses shopping pages.
19
+ Live payments support human buyers and agents in every integration after staff
20
+ approval and processor onboarding, with existing payment safety checks intact.
21
+ Keep the secret key server-side as RELYON_API_KEY; only the publishable key is public.
22
+
23
+ When using the optional kit and uncertain about its version, run `npm view @relyon/store-kit version`.
24
+ Compare it with the store project's actually installed version; never downgrade.
25
+ Install the exact returned version with the project's package manager (npm install
26
+ --save-exact, pnpm add --save-exact, yarn add --exact, or bun add --exact), then run
27
+ `npx @relyon/store-kit doctor` afterward. If the lookup fails, say it is unavailable;
28
+ do not guess a latest version. Respect package-age holds without changing settings.
29
+
30
+ ## Test setup and hand-over
31
+
32
+ - Start the store as a separate detached background process, using the host's
33
+ process manager or `setsid nohup npm run start >store.log 2>&1 < /dev/null &`.
34
+ Never run it in the agent's own foreground session. Stop a recorded PID;
35
+ never use a `pkill` pattern that can match the shell issuing it.
36
+ - On a public Test URL, call `kit.ensureDomain(hostname)` and then
37
+ `kit.verifyDomain(domain.hostname)` after the verification route is reachable.
38
+ Domain verification is not only for Live.
39
+ - Say exactly “Test mode: no real money moves” when handing over a Test store.
40
+ Never say shoppers can buy or pay for real while the store is in Test.
41
+ - Server-only `loadTestConfig` supplies both `apiKey` and `webhookSecret`.
42
+ Wire them into `relyon.apiKey` and `rules.webhookSecret`; never expose either
43
+ in browser code or agent prompts.
44
+ - With an environment API key, `webhook` never writes a secret file.
45
+ A set `RELYON_WEBHOOK_SECRET` in environment or dotenv overrides key-only
46
+ runtime recovery. Unset it, or update it in host settings, then restart.
47
+ Rotation exits 1 if an override differs from the current secret. Do not
48
+ treat that exit as a failed rotation: the endpoint may already be rotated.
49
+ Never read or print the override value; never ask for it in an agent prompt.
50
+
51
+ ## Relyon store-first rules
52
+
53
+ These seven kit rules are identical in every Relyon skill. They apply only to the shopping-pages integration, never to payments-only apps.
54
+
55
+ 1. Install `@relyon/store-kit@0.1.52` from npm and mount its handlers on the app's own server (Express `@relyon/store-kit/express`, Next.js `@relyon/store-kit/next`, Hono `@relyon/store-kit/hono`).
56
+ 2. Catalog, cart and pricing stay in the app: the app owns `listProducts`, `getProduct`, `priceCart` and `createOrder`. Relyon never prices a cart. It charges exactly the final amount the store sends.
57
+ 3. Checkout runs on the store's own domain. The only Relyon element in the shopper's browser is the card fields component. Card numbers never touch the app's code, server or logs.
58
+ 4. The app calls Relyon only from its server, and only for payment, agent verification, fraud and limits, and recording.
59
+ 5. Agent activity reporting stays on: never stub, disable or throttle-to-zero the kit's event reporting.
60
+ 6. Start in Test. Live is enabled by Relyon staff, never approved by the agent; after staff approval, the agent activates it at the merchant's explicit instruction (set the env vars by name, redeploy, run the Live doctor for shopping pages) and never asks for or pastes a Live secret key. Build before requesting keys: missing credentials defer credential-dependent verification, never the local build. Show checkout as **waiting for a Test secret key**, record pending checks honestly, and resume them after configuring a real Test secret key without rebuilding. Never fabricate a credential, payment or order.
61
+ 7. No Relyon-hosted checkout, redirect to a Relyon page, CNAME, proxy, forwarding Worker or `quote.request`/pricing endpoint.
62
+
63
+ ### Test defaults — not merchant policy
64
+
65
+ | Item | Test default |
66
+ | --- | --- |
67
+ | Brand | Store name, unless the merchant supplies another brand. |
68
+ | MPN | SKU, unless the merchant supplies another MPN. |
69
+ | Stock | Available unless told otherwise; no invented inventory count. |
70
+ | Returns/support | Pending merchant items. Never invent them or submit placeholders as real policy data. |
71
+
72
+ Explicit merchant facts override these Test defaults. Proceed with local Test
73
+ building; ask before asserting missing merchant promises or syncing policies.
74
+ Never invent supplier claims, GTINs, tax treatment or policy terms. Pending
75
+ merchant information blocks only the checks that require it, not the build.
76
+ <!-- END relyon-store-first-rules -->
77
+
78
+ Reference only. Open a section when the quick start names it; no whole-skill prerequisite.
79
+
80
+ Contract: the approved public v1 contract dated **2026-10-30**, at
81
+ `https://core.getrelyon.com/v1/openapi.yaml` (another deployment:
82
+ `<service origin>/v1/openapi.yaml`). The kit calls Relyon's agent operations for the
83
+ app; the app never calls them itself.
84
+
85
+ The canonical API base is `https://core.getrelyon.com/api`; `/v1/agent_events`
86
+ therefore means `https://core.getrelyon.com/api/v1/agent_events`. The download
87
+ URL above and merchant-domain `/ucp`, `/acp` and `/mcp` routes are separate.
88
+ Retain operator-confirmed API base overrides for other deployments.
89
+
90
+ For the quick start's agent integration, check protocol routes,
91
+ hand-off landing, crawler-visit reporting and rule refresh in detail; retain
92
+ the existing webhook secret and keep event reporting on.
93
+
94
+ ## Storefronts that render only in the browser
95
+
96
+ Many app builders produce a single-page app: every URL answers the same
97
+ HTML shell (an empty `<div id="root">` and a script bundle), and the product
98
+ appears only after the browser runs JavaScript.
99
+
100
+ - **Why product pages should be rendered on the server.** Shopping agents,
101
+ AI crawlers and search crawlers mostly read the HTML the server sends and
102
+ don't run the app's JavaScript. To them a browser-only product page has no
103
+ title, description, price, availability, images or JSON-LD, even though
104
+ the store's sitemap and `llms.txt` list it.
105
+ - **Recommended setup.** Keep the cart, account and checkout UI as they are,
106
+ but have the store's server answer each product URL with HTML that already
107
+ holds the product: its `<title>`, a short visible summary (title,
108
+ description, price, availability, an image) and
109
+ `kit.renderProductJsonLd(product, request)`, all from the app's own
110
+ `getProduct` (the request moves its links onto the public address).
111
+ Use the framework's server rendering or static generation where it has one
112
+ (Next.js server components, for example). With Vite plus an Express server,
113
+ add a server route for `/products/:id` that fills those into the built
114
+ `index.html` shell before sending it; the browser app then starts as usual.
115
+ The product route in `relyon-setup` (`references/express-server.md`) shows
116
+ the HTML and JSON-LD.
117
+ - **If product pages must stay browser-only for now**, still report visits
118
+ from the server: the route that sends the HTML shell for a product URL
119
+ calls `kit.recordCrawlerVisit(request, status, { ip })`, with 404 when the
120
+ product doesn't exist. Never call it from browser code: crawlers don't run
121
+ it, and the kit is server-only. Put the JSON-LD tag in that shell too when
122
+ the server can look the product up.
123
+
124
+ ```js
125
+ // Vite + Express: one server route for product URLs, before the static files.
126
+ app.get("/products/:id", async (req, res) => {
127
+ const product = await getProduct(req.params.id);
128
+ kit.recordCrawlerVisit(webRequest(req), product ? 200 : 404, { ip: req.ip });
129
+ const shell = await readFile("dist/index.html", "utf8"); // the built app shell
130
+ if (!product) return res.status(404).type("html").send(shell);
131
+ const head = `<title>${escape(product.title)}</title>\n${kit.renderProductJsonLd(product, webRequest(req))}`;
132
+ const summary = `<h1>${escape(product.title)}</h1><p>${escape(product.description)}</p>`;
133
+ res.type("html").send(shell.replace(/<title>[\s\S]*?<\/title>/, "") // escape() as in the Express example
134
+ .replace("</head>", `${head}</head>`).replace('<div id="root"></div>', `<div id="root">${summary}</div>`));
135
+ });
136
+ ```
137
+
138
+ ## What the kit serves on the store's domain
139
+
140
+ Every link in these answers uses the store's public address for the request
141
+ (`kit.publicOrigin(request)`): `STORE_PUBLIC_URL` when set, otherwise the
142
+ store's own or Test preview hostname the request arrived on. llms.txt lists
143
+ the UCP profile, the MCP server, the ACP checkout endpoint, the agent card,
144
+ the sitemaps, the selected feeds and the policy pages. Put
145
+ `kit.renderDiscoveryLinks(request)` in the homepage `<head>` so agents and the
146
+ free scan find the same endpoints there (`relyon-setup`'s Express reference
147
+ does).
148
+
149
+ Once the kit is mounted (see `relyon-setup`), agents reach the store at its
150
+ own hostnames:
151
+
152
+ | Path | What happens |
153
+ | --- | --- |
154
+ | `/.well-known/ucp` | The store's UCP profile, read from Relyon for this hostname. Cached, and served from cache if Relyon is briefly down. Needs a verified domain (see `relyon-go-live`), except in Test on a preview address (below). |
155
+ | `/ucp/*` | UCP Test checkout is implemented (Google's agents). The kit rebuilds the agent's exact request, prices it with `priceCart` and sends it to Relyon, which verifies the agent and applies the store's rules and limits. The answer goes back unchanged. |
156
+ | `/acp/*` | ACP Test integration is implemented with merchant-domain forwarding, ChatGPT credentials, application and channel prerequisites. This is not unrestricted native ChatGPT availability; Live is refused. |
157
+ | `/mcp` | Browse and search use catalog.source when configured, otherwise the index mirror. Store-hosted MCP checkout works in Test: the agent gets a `continue_url` to the store's checkout page, the shopper pays there and the order gets Relyon's `ord_…` ID. In Live it returns `protocol_not_available`. Separate Commerce MCP supports checkout-link handoff, not direct charging. |
158
+ | `/llms.txt`, `/sitemap-products.xml` | Use the same source visibility boundary when configured; only legacy no-source discovery reads the published mirror (see `relyon-catalog`). |
159
+ | `/sitemap.xml` | The root sitemap: a urlset listing the product pages (the same entries as `/sitemap-products.xml`). `sitemapIndex: false` turns it off when the app serves its own `/sitemap.xml`. |
160
+ | `/.well-known/agent-card.json` | A JSON agent card naming the store's UCP, ACP and MCP endpoints and Relyon payments. It advertises AP2 mandates as an optional extension (UCP checkout verifies a presented AP2 checkout mandate) and claims nothing more: no A2A message endpoint, and MCP checkout only in Test. `agentCard: false` turns it off. |
161
+ | `/feeds/openai.jsonl`, `/feeds/openai.jsonl.gz`, `/feeds/google.xml`, `/feeds/microsoft.xml` | Only explicitly selected feed formats (the starter selects all three); source-backed, never index fallbacks. Export does not activate a destination or grant payment permission. llms.txt and `kit.renderDiscoveryLinks(request)` advertise each selected feed. |
162
+ | `/robots.txt` | Served by default (AI search and shopping crawlers allowed); `robots: { existing }` merges into the merchant's own policy and conflicts preserve it; `robots: false` opts out. |
163
+ | `/relyon/test-checkout` | Test only: one signed Test purchase for `npx @relyon/store-kit test-checkout --url <store>`. Absent in Live. |
164
+ | `/relyon/webhooks` | Signed Relyon webhooks; `agent_rules.updated` refreshes the rules right away, and the doctor's challenge is answered. |
165
+ | `/.well-known/relyon-verification` | The domain verification value (see `relyon-go-live`). |
166
+
167
+ - On a paid agent checkout, the kit calls `createOrder` once, exactly as for
168
+ the store's own checkout (see `relyon-orders`).
169
+ - Paid-but-unsaved is order pending, not completed: show exactly
170
+ "Your payment went through. Your order is still being placed". Preserve the
171
+ original attempt and payment evidence; recover with the same reference and
172
+ Idempotency-Key, never a second charge. Do not claim fulfillment or a
173
+ completed order before the store order is saved. Unknown payment outcomes
174
+ use cautious confirmation wording instead; replay the same attempt without
175
+ telling the shopper nothing was charged.
176
+ - Don't add the app's own routes at these paths, and don't put a cache or
177
+ auth layer in front of them that changes request bodies or headers: agents
178
+ sign their requests, and the kit relays them byte for byte.
179
+ - The app never decides whether an agent is genuine. Relyon verifies every
180
+ agent on every checkout step; the kit has no user-agent heuristics,
181
+ challenges or rate limits of its own.
182
+
183
+ ## Test agent checkout on the preview address
184
+
185
+ Agents can check out in Test on the store's preview address as soon as the
186
+ Test key is set, before the store is published or its domain verified, on
187
+ any coding platform or host (Replit, Lovable, Bolt, Vercel, Netlify,
188
+ Cursor, Codespaces, a tunnel or a local machine).
189
+
190
+ - With a Test key Relyon accepts any https address (a DNS name, not an IP
191
+ address) and `localhost` or a loopback IP; no platform list decides it.
192
+ Only loopback may use plain `http` and a port (`localhost` on port 3000,
193
+ for example); the rest are `https` only.
194
+ - In Test the kit answers on loopback, on the addresses in
195
+ `RELYON_PREVIEW_HOSTS` (set in your platform's secrets or environment
196
+ settings) or a `store.previewHosts` list, and on the app's own address
197
+ when its platform names it in a well-known variable, as well as
198
+ `store.hostnames`; other host headers are refused. Live configuration is
199
+ unchanged.
200
+ - There, `/.well-known/ucp`, the UCP and ACP checkout routes, `/mcp`
201
+ browsing and `llms.txt` work for the key's own Test store. A full Test
202
+ checkout works: the quote, the hand-off link back to the store's checkout
203
+ page on the same preview address, the Test payment and the order. All of
204
+ it is Test (`livemode: false`, `environment: "test"`); no real money moves.
205
+ Store-hosted MCP checkout works the same way in Test (hand-off to the
206
+ store's checkout page, payment there, an `ord_…` order); in Live it still
207
+ answers `protocol_not_available`.
208
+ - A preview address is never exclusive: another Relyon account using the
209
+ same address only ever sees its own Test data, and a hand-off link made
210
+ for another store doesn't land as this store's.
211
+ - The domain-hosted Commerce MCP and channel setup (Google, Merchant
212
+ Center, ChatGPT) still need a verified domain.
213
+
214
+ **Going live.** A Live key is refused on a preview or unverified address. To
215
+ take agent checkout live: publish the app on your platform, add its domain
216
+ in Relyon and verify it, then switch to a Live key, only with the merchant's approval
217
+ (`relyon-go-live`). Agents never ask for a Live key.
218
+
219
+ ## Hand-off links
220
+
221
+ When an agent can't finish payment itself, the shopper finishes on the store's
222
+ own checkout page. `await kit.handoffUrl(protocol, sessionId)` returns a signed,
223
+ expiring link to the store's checkout path with `?relyon_cart=…` (or `null` if
224
+ the kit doesn't know that checkout). The checkout page reads it with
225
+ `kit.landing(request)` (see `relyon-checkout`). Set `cartTokens: { secret }`
226
+ so links survive an API key rotation.
227
+
228
+ ## Agent rules
229
+
230
+ The merchant sets which agents may buy, per-agent limits and paused channels
231
+ in Relyon. The kit applies the rules it can at the store's edge:
232
+
233
+ - refuses agents the rules block (matched on what the agent claims to be;
234
+ Relyon still verifies identity on every decision),
235
+ - refuses agent checkout while the store or that agent's channel is paused,
236
+ - refuses in each protocol's own error format.
237
+
238
+ Rules are read with `getAgentRules`, cached and refreshed every
239
+ `refresh_seconds`. To apply a change right away:
240
+
241
+ 1. Register the kit's route as a webhook endpoint, once per URL. The answer
242
+ holds the endpoint's one-time secret, so it must reach only the merchant.
243
+ Run the kit's webhook command yourself, after the store is published (and
244
+ re-run it after each publish if the public URL changed):
245
+
246
+ ```sh
247
+ npx @relyon/store-kit webhook
248
+ ```
249
+
250
+ It registers `<STORE_PUBLIC_URL>/relyon/webhooks` for the
251
+ `agent_rules.updated` event, idempotently: a second run reuses the active
252
+ endpoint and never registers a duplicate, replaying the original
253
+ registration to recover the one-time secret (a Test registration replays
254
+ for its key without expiry). With `RELYON_API_KEY` from the environment,
255
+ neither the command nor init's best-effort registration writes a file:
256
+ the kit resolves the webhook signing secret itself at runtime from the API key.
257
+ Only with a local file key does it save `RELYON_WEBHOOK_SECRET` in the
258
+ project's gitignored `.env` (0600, never printed). The same rule applies
259
+ on every host. `RELYON_WEBHOOK_SECRET` set in the environment stays an
260
+ optional explicit override. `--rotate` rotates the endpoint's secret in
261
+ place (same endpoint, no duplicate); with an environment API key it saves
262
+ nothing and runtime resolution picks up the new secret. Unset or update
263
+ an explicit override in the host's environment settings after rotation.
264
+ Live works the same way once Relyon staff approved it: the store's Live key
265
+ in the host's environment settings, a public https store URL, no file.
266
+ If a Live key leaks: revoke it, then run the webhook command with `--rotate` using the replacement key.
267
+
268
+ The request body it sends, for reference:
269
+
270
+ ```json
271
+ { "url": "https://shop.example.com/relyon/webhooks", "events": ["agent_rules.updated"] }
272
+ ```
273
+
274
+ 2. The command never prints the endpoint's secret. Only local file-key
275
+ development saves it as `RELYON_WEBHOOK_SECRET`; an environment API key
276
+ writes no file. An explicit environment override is read as
277
+ `rules.webhookSecret`. When unset the kit resolves the
278
+ secret itself at runtime with the store's key, in Test and Live. Never log it.
279
+ 3. The kit verifies `Relyon-Signature` (or `X-Relyon-Signature`) over the raw
280
+ body before acting. Without a secret it refuses every webhook, and the
281
+ rules still refresh on the timer.
282
+ 4. With the secret set (or resolved at runtime), the same route
283
+ answers Relyon's doctor challenge, so the doctor's `webhook` check passes
284
+ (see `relyon-orders`). Restart the server after adding the secret.
285
+
286
+ ## Report visits to the app's own pages
287
+
288
+ The kit records agent activity on its own routes. For pages the app serves
289
+ itself (product pages, collection pages), call:
290
+
291
+ ```js
292
+ kit.recordCrawlerVisit(request, status, { ip });
293
+ ```
294
+
295
+ with the Web `Request` (the Express example in `relyon-setup` builds one with
296
+ `webRequest(req)`), the HTTP status the app answered and the client IP. Call it
297
+ on every product page response, including 404s. It never blocks the response.
298
+
299
+ ## Agent activity reporting stays on
300
+
301
+ Every agent interaction the kit sees is queued with a stable event ID and
302
+ sent to Relyon in batches. Merchants rely on it to see what agents do, and
303
+ Relyon relies on it for fraud checks and limits.
304
+
305
+ - Never stub, wrap or disable the kit's event reporting. Never set
306
+ `events.flushIntervalMs` to `0`, shrink `events.maxQueued` or
307
+ `events.maxBatch` to starve it, or replace `events.store` with a store that
308
+ drops events.
309
+ - Failed batches are retried with backoff; Relyon dedupes by event ID. In
310
+ production use a durable `events.store` (see `relyon-setup`).
311
+ - On short-lived servers (serverless functions), call
312
+ `await kit.events.flush({ force: true })` before the function returns so
313
+ queued events are sent.
314
+
315
+ ## When Relyon is unreachable: fail closed
316
+
317
+ - Agent checkout steps answer `503` in the protocol's format. Card fields
318
+ throw `PaymentUnavailableError`, and a charge whose answer was lost throws
319
+ `PaymentOutcomeUnknownError` (it may have charged; replay the same attempt,
320
+ see `relyon-checkout`). Nothing runs without Relyon's decision.
321
+ - The UCP profile can use its cache; source-backed llms, sitemap, feeds and
322
+ MCP browse depend on the store's source, not Relyon's mirror. A source
323
+ failure is not permission to fall back to stale index products. Events stay
324
+ queued until Relyon is back.
325
+ - Never add a fallback that lets an agent check out, or pays without the
326
+ kit, while Relyon is down. Never retry an agent's request as a different
327
+ agent or without its mandate after `agent_refused` or `mandate_required`.