@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,1061 @@
1
+ ---
2
+ name: relyon-setup
3
+ description: Shopping pages · install the optional kit on your Express, Next.js or Hono server, with a Test secret key, durable state and the bundled skills.
4
+ ---
5
+
6
+ # Relyon setup
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. Read [the quick start](references/QUICKSTART.md) first.
79
+ Open only the section a numbered quick-start step names.
80
+
81
+ ## Recommended build order
82
+
83
+ First ask which integration the user wants. Payments only follows
84
+ https://core.getrelyon.com/docs/payments-quickstart and `relyon-payments`, without
85
+ a catalog, kit, shopping pages or /cart. Products and agent selling is optional
86
+ layer 2. The page requirements and kit stages below apply only to layer 3,
87
+ when the user has chosen kit-built shopping pages.
88
+
89
+ Required storefront pages: /, /products/<id>, /cart, /checkout and the policy pages. /cart is a real server-rendered or routed page that answers 200, lists the cart's line items (or an empty state) and links to /checkout. A drawer may also exist but does not replace /cart.
90
+
91
+ Run `npx @relyon/store-kit@latest init` first, then read `relyon/QUICKSTART.md`.
92
+ Open a skill only when a numbered quick-start step names its section, not all
93
+ six full files in sequence. The package and public repository also carry
94
+ `QUICKSTART.md`; CLI-only installations carry the same guide in
95
+ `relyon-setup/references/QUICKSTART.md`.
96
+
97
+ Follow its eight stages: init, mount, catalog, checkout, webhook after publish,
98
+ doctor, Test purchase, handover. Verify dependencies before exercising
99
+ purchases; missing credentials
100
+ defer credential-dependent checks, not local building. Pending is not passed.
101
+ Agents never approve Live; after staff approval they activate it only at the merchant's explicit instruction. No particular task tool is required.
102
+
103
+ ## Domain verification is an agent step
104
+
105
+ Before hand-over, run `kit.ensureDomain()` and serve its verification value,
106
+ then `kit.verifyDomain(domain.hostname)` yourself, then re-run the doctor. Do
107
+ not hand domain verification to the owner; only a custom domain the owner has
108
+ not bought yet is an owner step.
109
+
110
+ ## On Replit
111
+
112
+ Get your Test key from the Relyon dashboard and add RELYON_API_KEY in Replit Secrets before setup; never paste keys in chat.
113
+
114
+ ## Facts at a glance
115
+
116
+ ### Advisory kit-version evidence
117
+
118
+ Doctor JSON always includes `kit_version`: `installed`, `declared`, `latest`,
119
+ `status`, `install_command`, `package_manager`, `checked_at`, and `hold`, plus safe
120
+ `messages` explaining unavailable or mismatched evidence. Unavailable values are
121
+ `null`; they never mean up to date. Local/unsupported declarations are reported
122
+ as unavailable declared-range evidence, not printed as URLs or guessed ranges.
123
+ `checked_at` is the registry observation time (also for a cached result, valid for
124
+ one hour), not the doctor's start time. `hold` is null unless a known publication
125
+ time proves an active minimumReleaseAge hold; otherwise it contains `minutes`,
126
+ `source_file`, and `installable_at`. Never invent a hold deadline.
127
+
128
+ Statuses are `up_to_date`, `update_available`, `ahead`, `mismatch`, or `unknown`.
129
+ An ahead installation never gets an install command, even with a mismatched
130
+ declaration. Installation/declaration mismatches remain visible when the registry
131
+ is unavailable. `newer_kit_version` remains an optional string, derived from this
132
+ same installed-versus-latest evidence only. Version advice never changes checklist
133
+ completion, strict mode, or exit codes. An unavailable lookup says
134
+ "Couldn't check for a newer kit version (offline?)"; retry rather than guessing.
135
+
136
+ **Relyon's API base URL** is `https://core.getrelyon.com/api`. Every
137
+ operation path is appended to it (`/v1/payments` is
138
+ `https://core.getrelyon.com/api/v1/payments`).
139
+
140
+ - The kit has no built-in default: the app passes the base as
141
+ `relyon.baseUrl` when it creates the kit. The examples read
142
+ `RELYON_API_BASE_URL` and fall back to `https://core.getrelyon.com/api`.
143
+ - The kit's doctor (`npx @relyon/store-kit doctor`) takes `--base-url` or
144
+ `RELYON_BASE_URL`, with the same API base as its default.
145
+ - The optional `relyon` CLI also reads `RELYON_BASE_URL`, but there it is the
146
+ service origin `https://core.getrelyon.com`, without `/api`.
147
+ - Override any of them only with another operator-confirmed Relyon
148
+ deployment. None of them is ever the store's own URL.
149
+
150
+ **Every setting the kit and the CLI read.** The kit library reads no
151
+ environment variables itself; the app reads them and passes options. These are
152
+ all the names involved:
153
+
154
+ | Name | Read by | Secret | What it is |
155
+ | --- | --- | --- | --- |
156
+ | `RELYON_API_KEY` | the app (`relyon.apiKey`), the kit's doctor, the `relyon` CLI | yes | The sandbox's `restrictedKey` (`rly_test_…`). Example env files show it blank (`RELYON_API_KEY=`): init fills it. A placeholder value counts as no key. |
157
+ | `RELYON_PRIVATE_DIR` | init, the Node server-config loader, the kit's doctor | private path | Optional. An existing owner-only 0700 POSIX directory outside the app and every git tree. Default: the first usable of `$XDG_CONFIG_HOME/relyon/<project>` and `~/.config/relyon/<project>`; a candidate inside the app or a git tree is skipped before anything is created. |
158
+ | `RELYON_WEBHOOK_SECRET` | the app (`rules.webhookSecret`) | yes | Optional override: the one-time `secret` from registering the store's webhook endpoint. Unset in Test, the kit resolves it at runtime from `RELYON_API_KEY`. |
159
+ | `RELYON_CART_TOKEN_SECRET` | the app (`cartTokens.secret`) | yes | A store-generated secret for hand-off cart tokens; stable across processes and key rotation. |
160
+ | `DATABASE_URL` | the app (durable state, orders) | yes | The store's database connection string. |
161
+ | `RELYON_API_BASE_URL` | the app (`relyon.baseUrl`) | no | Relyon's API base (above). |
162
+ | `RELYON_LIVE` | the app (`relyon.live`), the kit's doctor (`--live`) | no | `true` only after Relyon staff approved Live (`relyon-go-live`). With it set, no saved Test key is read. |
163
+ | `RELYON_AUTO_TEST_KEY` | init (`--auto-test-key`) | no | Accepted for scripts; init never creates sandboxes, so it changes nothing. |
164
+ | `STORE_HOSTNAMES`, `STORE_HOSTNAME` | the app (`store.hostnames`) | no | The store's own hostnames, primary first. |
165
+ | `STORE_PUBLIC_URL` | the app (`store.publicUrl`), the kit's doctor (`--url`) | no | The store's public HTTPS origin. When set, every agent-facing link uses it; otherwise links use the store's own hostname the request arrived on. |
166
+ | `PORT` | the app | no | The port the host gives the server. |
167
+ | `RELYON_BASE_URL` | the kit's doctor (`--base-url`), the `relyon` CLI | no | Relyon's API base (doctor) or service origin (CLI). The doctor sends the saved Test key only to Relyon's official https API unless `--allow-saved-key-to-base-url`. |
168
+ | `RELYON_FEEDS` | the kit's doctor (`--feeds`) | no | Which store feeds the doctor checks, comma-separated. |
169
+ | `RELYON_API_VERSION` | the `relyon` CLI | no | Pins the API version the CLI sends. |
170
+ | `RELYON_SKILLS_SOURCE` | the `relyon` CLI | no | Where the CLI copies skills from, instead of its bundled copy. |
171
+ | `RELYON_NO_UPDATE_CHECK` | the `relyon` CLI | no | `1` turns off its new-version notice. |
172
+ | `XDG_CACHE_HOME` | the `relyon` CLI | no | Where it caches that new-version check (the usual cache folder by default). |
173
+
174
+ `npx @relyon/store-kit init` preserves an existing `RELYON_API_KEY`. It never
175
+ creates sandboxes: with no usable key (unset, blank or a placeholder such as
176
+ `your_key_here`, `rly_test_xxx` or `changeme`), it prints the hosted key page
177
+ (https://core.getrelyon.com/get-sandbox-key) and the `init --key-from-stdin`
178
+ command. `RELYON_LIVE=true` keeps init off the saved Test key. A key is saved
179
+ on Node/POSIX:
180
+
181
+ - The key is saved in an owner-only (0700) private folder outside the app and
182
+ every git tree: `RELYON_PRIVATE_DIR` when set, otherwise the first usable of
183
+ `$XDG_CONFIG_HOME/relyon/<project>` and `~/.config/relyon/<project>`. The key
184
+ file is 0600.
185
+ - If `RELYON_API_KEY` is in the environment, init uses it and writes no key file.
186
+ Only when it is missing does the local-development flow run.
187
+ - For local development, init sets `RELYON_API_KEY` in the project's `.env` (0600), first making
188
+ sure `.gitignore` lists `.env`, and refuses (saying why) when `.env` is
189
+ tracked by git. A deploy that doesn't carry the home folder still gets the
190
+ key from `.env` or the host's secret settings. When the project has a
191
+ `.dockerignore`, init makes sure it lists `.env` too.
192
+ - Before publishing, add `RELYON_API_KEY` in the host's environment settings.
193
+ Doctor warns on every host when the key comes only from a saved file,
194
+ including `.env.local` and `.env.production`. This is advisory, not a FAIL.
195
+ In Test the kit resolves the webhook signing secret itself at runtime.
196
+ - With an environment API key, `webhook` and init's best-effort registration
197
+ write no file, including after `--rotate`. Only a local file key saves
198
+ `RELYON_WEBHOOK_SECRET` to gitignored `.env` (0600, never printed).
199
+ An environment `RELYON_WEBHOOK_SECRET` is an optional explicit override;
200
+ unset or update it after rotation to use the new signing secret.
201
+ - After publishing, run `npx @relyon/store-kit webhook --url <published https origin>`,
202
+ then rerun doctor against that origin. The same steps apply on every host.
203
+ - The `.env` Test key is readable by any coding agent working in the project,
204
+ and remixes, forks and exports of the project carry `.env` with them. Tell the
205
+ merchant; a Test key moves no money, but treat it as private and rotate it
206
+ from the dashboard if a copy is shared.
207
+ - Unattended runs (`CI` set, or no terminal) behave like any other: init never
208
+ creates a sandbox. `RELYON_AUTO_TEST_KEY` and `init --auto-test-key` are
209
+ accepted for scripts and change nothing.
210
+ - **Never read, open, print or paste the private key file**: it is the
211
+ merchant's.
212
+ - It prints only what happened, never the key, a webhook secret or the claim
213
+ token, and removes every `RELYON_*` variable from the package manager
214
+ environment. No platform secret-manager service is assumed.
215
+ When init can't set a key (no key yet, or `RELYON_LIVE=true`), it prints
216
+ exactly one URL and one command:
217
+
218
+ ```text
219
+ 1) Get a free Test key: https://core.getrelyon.com/get-sandbox-key
220
+ 2) Then run: npx @relyon/store-kit init --key-from-stdin
221
+ ```
222
+
223
+ Keep building keylessly, and get the key yourself: open that page, then run
224
+ that command and paste the key into it (it is read from stdin or a hidden
225
+ prompt, never an argument), checked to be a Test key, saved the same way and
226
+ never echoed. The owner is needed only for policies, the support contact and
227
+ Live approval.
228
+
229
+ **pnpm workspaces.** In a pnpm workspace (a `pnpm-workspace.yaml`
230
+ at or above the app), the kit belongs in the package that runs the store's
231
+ server, never the workspace root. Run `init` from the project root: when the
232
+ workspace has exactly one server package it installs there; otherwise it
233
+ skips the install and prints the exact command to run, such as
234
+ `pnpm --filter <server package> add --save-exact @relyon/store-kit@0.1.52`.
235
+ It still copies the skills to the project root. Running `init` inside the
236
+ server package installs into that package.
237
+
238
+ **A brand-new kit version may be held back.** If the package manager refuses
239
+ the pinned version because of a minimum release age policy (pnpm's
240
+ `minimumReleaseAge`, for example), either wait until the version is old
241
+ enough, or exempt only `@relyon/store-kit` from that policy. Don't turn the
242
+ policy off for every package and don't install an older kit version instead.
243
+
244
+ **Why `init` refuses to replace a file.** It never overwrites a file that
245
+ differs from what it would write: a skill copy someone added or edited by
246
+ hand, an older copy from another channel, or a `relyon-store-brief.md` with
247
+ other text. If any file conflicts, it writes nothing at all and exits with an
248
+ error that names the file. Compare the file with the bundled skill first.
249
+ Use `--force` only when the differing copies are older or hand-made copies
250
+ of these same skills and nothing in them needs to be kept.
251
+
252
+ - An `AGENTS.md` or `CLAUDE.md` without the marked Relyon block (for example
253
+ one a framework generator wrote) gets the block appended; every other line
254
+ stays as it is. No `--force` needed.
255
+ - Init also keeps a second marked block, `relyon-done` ("Relyon Core:
256
+ definition of done"), in `AGENTS.md`, `CLAUDE.md` and `replit.md`: it
257
+ creates a missing file, appends the block to a file without it and updates
258
+ only the block itself. Rerunning init leaves the files byte-identical. The
259
+ same symlink, UTF-8 and marker rules apply.
260
+ - `--force` replaces the six skills' files in `.agents/skills`,
261
+ `.claude/skills` and `.cursor/skills`, the store brief, and only the marked
262
+ Relyon block in `AGENTS.md` and `CLAUDE.md`.
263
+ - It never touches anything outside that block, other skills, or extra files
264
+ in a skill folder that the pack doesn't have.
265
+ - It still refuses a symlink, a file that isn't UTF-8 text, or a damaged,
266
+ repeated or nested Relyon block; fix those by hand.
267
+
268
+ ## Start here: from the store idea to a working Test store
269
+
270
+ Required storefront pages: /, /products/<id>, /cart, /checkout and the policy pages. /cart is a real server-rendered or routed page that answers 200, lists the cart's line items (or an empty state) and links to /checkout. A drawer may also exist but does not replace /cart.
271
+
272
+ Run `npx @relyon/store-kit@latest init` first, then read the copied
273
+ `relyon/QUICKSTART.md`. For CLI/plugin-only installations read
274
+ [the same quick start](references/QUICKSTART.md). Open a skill only when a
275
+ numbered step names its section; do not read all six full files in sequence.
276
+ The shared rules above own Test defaults and ask-versus-proceed decisions.
277
+ Missing credentials defer credential-dependent verification, never local
278
+ building. Never expose unfinished checkout or synchronize placeholder policies.
279
+
280
+ UCP Test checkout is implemented. ACP Test integration is implemented with
281
+ merchant-domain forwarding, ChatGPT credentials, application and channel prerequisites.
282
+ Store-hosted MCP checkout works in Test by handing off to the store page;
283
+ Live returns `protocol_not_available`. Separate Commerce MCP supports checkout-link handoff, not direct charging.
284
+ No platform approval is promised.
285
+
286
+ ### Done means doctor prints DONE
287
+
288
+ Setup is not finished until `npx @relyon/store-kit doctor` prints
289
+ `DONE: Test integration verified by Relyon.` and exits 0. That needs a Test
290
+ key, no `FAIL`, one completed Test checkout that Relyon has confirmed
291
+ ("Test checkout confirmed by Relyon"), and every selected feed live. Until
292
+ then the first line is `NOT DONE: <n> of <m> required steps remain.` and a
293
+ numbered "Do this next" list follows: do the steps in order, then rerun the
294
+ doctor. `doctor --json` prints the same verdict as one JSON object (`status`,
295
+ `version`, `checks`, `next_steps`, `confirmed`) with the same exit codes.
296
+ While a step remains, no summary line says "No failures": the footer reads
297
+ `NOT DONE yet (see the steps above): …`. The checkout row is `NOT DONE` when
298
+ Relyon answered and has no completed Test checkout, and `UNVERIFIED` only when
299
+ Relyon couldn't be asked.
300
+
301
+ ### Complete one Test checkout yourself
302
+
303
+ The coding agent completes the Test checkout; it is not a step for a person.
304
+ With the store's server running (with its Test key), run:
305
+
306
+ ```sh
307
+ npx @relyon/store-kit test-checkout --url <store URL>
308
+ ```
309
+
310
+ It makes exactly one Test purchase through the kit's Test-only route on the
311
+ store (`POST /relyon/test-checkout`): the kit picks one agent-purchasable
312
+ product without options, prices it with the store's own `priceCart`, opens a
313
+ Relyon payment session and pays it with the Test mock processor's opaque token,
314
+ so the store's `createOrder` runs as for any checkout. No card number exists
315
+ anywhere. The command signs its request with a short-lived proof made from the
316
+ Test key; the key itself never goes to the store. A resend with the same
317
+ `--idempotency-key` (the command prints it when the outcome is unclear) never
318
+ pays twice. Then it asks Relyon for the confirmation and says to rerun doctor.
319
+
320
+ It refuses (exit 2) with a Live key or `RELYON_LIVE=true`, and in Live the route
321
+ doesn't exist. If the sandbox's Test payments use hosted card fields (for
322
+ example a TRX sandbox account) instead of the mock processor, it says so: then
323
+ follow "Test purchases, end to end" in `relyon-checkout`. Test amounts ending
324
+ in 02, 19, 65 or 99 cents decline on purpose; if `priceCart` returns one, pick
325
+ another product with `--product <id>`.
326
+
327
+ **Optional stop hooks.** `npx @relyon/store-kit init --agent-hooks` (off by
328
+ default) adds one Relyon stop hook to `.claude/settings.json` (Claude Code
329
+ `Stop`), `.cursor/hooks.json` (Cursor `stop`) and `.github/hooks/relyon.json`
330
+ (Copilot `agentStop`). It keeps every other entry, never adds a second Relyon
331
+ entry, and writes nothing if a file isn't valid JSON. When the agent tries to
332
+ stop while doctor says NOT DONE, the hook sends the steps back, at most 3 times
333
+ per session; it allows the stop on any internal error and never prints a key.
334
+
335
+ Codex CLI: init writes no Codex configuration. To add the hook by hand, put a
336
+ `Stop` entry in the project's `.codex/hooks.json` (or `~/.codex/hooks.json`),
337
+ then review and trust it with `/hooks`:
338
+
339
+ ```json
340
+ {
341
+ "hooks": {
342
+ "Stop": [
343
+ { "hooks": [{ "type": "command", "command": "npx --no-install @relyon/store-kit doctor --agent-hook claude", "timeout": 30 }] }
344
+ ]
345
+ }
346
+ }
347
+ ```
348
+
349
+ Codex's `Stop` hook uses the same answer format (`decision: "block"` with a
350
+ `reason`, and `stop_hook_active`), so the `claude` mode serves it. Merge this
351
+ entry into an existing file by hand; don't replace other hooks.
352
+
353
+ ### Doctor merchant questions are not technical failures
354
+
355
+ In Test, the kit doctor labels missing merchant return terms, a confirmed returns
356
+ page and support contact as `PENDING merchant`. An exact missing-webhook finding
357
+ is pending only with positive preview or loopback evidence. These are questions
358
+ for the merchant, not permission to invent a window, return cost, email or address.
359
+ List them separately from technical `FAIL` items in the hand-over. Agent checkout
360
+ remains unavailable until the merchant confirms the facts and policies are set;
361
+ the server still enforces every checkout gate.
362
+
363
+ Doctor exit codes: **0 only when it prints `DONE`**, 2 when it prints
364
+ `NOT DONE` without any `FAIL` (pending merchant items, `UNVERIFIED` checks, no
365
+ confirmed Test checkout or feeds not live yet: the work is incomplete), 1 on any
366
+ `FAIL`. Usage errors keep exit code 2. Use `doctor --strict` to treat pending
367
+ merchant requirements as failures. Every Live run keeps them as failures without
368
+ needing `--strict`. Fix technical failures
369
+ normally; never hide mixed catalog blockers or an ordinary public-store webhook fault.
370
+
371
+ Policy pages may visibly say **"to confirm with the merchant"** while answers are
372
+ missing. Keep this display copy separate from kit policy options, synchronization,
373
+ feeds, JSON-LD and API payloads. Never synchronize placeholder text or pretend that
374
+ a page containing it is a confirmed policy. Only synchronize real merchant-approved
375
+ facts; an absent answer stays absent. Do not submit the Merchant to-do questions as data.
376
+
377
+ **Your final chat message lists the owner's to-dos.** End the task with a
378
+ message to the owner (not only a README or a file) that lists what they must
379
+ still do: confirm the store policies (the returns policy, plus any shipping,
380
+ privacy or terms pages; a
381
+ policy link to a page that doesn't exist is an "Owner to fill in" item), give a
382
+ support contact, connect their own domain, and get Live keys. Never tell the
383
+ owner shoppers can pay until checkout is live; in Test, say
384
+ “Test mode: no real money moves”. Never say shoppers can buy or pay for real.
385
+
386
+ ## After you deploy: reachable, images, then the scan
387
+
388
+ Do these after every publish, on the public address (not the preview):
389
+
390
+ 1. **Publicly reachable.** Some hosts publish privately or invite-only by
391
+ default, or put a login in front of the app. From a shell with no cookies,
392
+ `curl -sS -o /dev/null -w '%{http_code}\n' https://<host>/` must answer
393
+ `200` with the store's own page, not a sign-in page; check `/llms.txt`
394
+ and `/.well-known/ucp` the same way. If not, ask the merchant to make the
395
+ deployment public in their host's settings. Agents and the scan can't
396
+ read a private store.
397
+ 2. **Images load from the public address.** Open a product page and fetch
398
+ each `image` URL from its Product data and from `/feeds/google.xml`: each
399
+ must answer `200` with an image type, on the store's public hostname. A
400
+ localhost, preview or dev-only image URL means the catalog stored an
401
+ address from build time: store image paths on the store's own hostname
402
+ (the kit moves those onto the public address) and serve the files from
403
+ the deployed app.
404
+ 3. **The free scan.** Run it on the public URL and read every check:
405
+
406
+ ```sh
407
+ curl -sS -X POST https://core.getrelyon.com/api/scan \
408
+ -H 'Content-Type: application/json' -d '{"url":"https://<host>"}'
409
+ ```
410
+
411
+ It is also at `https://core.getrelyon.com/scan`. It reads only public
412
+ pages, needs no key and can't reach `localhost` or a private address.
413
+ Fix every check the store's own code or content fails, publish again
414
+ and rerun it. Record checks only the merchant or Relyon can fix as open
415
+ items in the hand-over.
416
+
417
+ **Avoid a page reload loop.** A storefront that keeps reloading itself on a
418
+ preview or tunnel is almost always the dev server's live reload: its
419
+ websocket can't connect through the host's front end, so the client reloads to
420
+ retry, forever. Run the built app (production mode, for example
421
+ `NODE_ENV=production node main.js`) for agent and scan testing, or turn live
422
+ reload off for the preview. The store's own pages must never reload
423
+ themselves either: the checkout page polls `/checkout/confirm` with `fetch`
424
+ and stops on a final answer, and the status page never sends the browser
425
+ back to itself.
426
+
427
+ **Done, blocked or open.** A step is done only when its check passed. Fix every
428
+ failure the store's own code, content or setup causes. A failure only Relyon or
429
+ the merchant can resolve (a staff-only setting, a contracted operation that
430
+ answers 404, 405 or 501, the scan being unavailable, a fact the merchant hasn't
431
+ given yet) is an open item: record the step as blocked, with the code or
432
+ message, in the `relyon-go-live` hand-over. Never describe a blocked step as
433
+ passed.
434
+
435
+ ## Platform notes
436
+
437
+ - **Claude Code.** `init` writes `.claude/skills` and `CLAUDE.md`, which Claude
438
+ Code reads. Or install the plugin:
439
+ `/plugin marketplace add relyon-payments/relyon-core`, then
440
+ `/plugin install relyon@relyon`. Put keys in the shell environment or the
441
+ host's secret store, never in `CLAUDE.md` or chat.
442
+ - **Codex.** Reads `.agents/skills` and `AGENTS.md` at the project root.
443
+ - **Cursor.** Reads `.cursor/skills`, and `AGENTS.md` at the project root.
444
+ - **OpenCode.** Reads `.agents/skills` (also `.opencode/skills`) and
445
+ `AGENTS.md` at the project root.
446
+ - **Any other platform or host** (Bolt, Vercel, Netlify, Codespaces, a
447
+ local machine and others): keys go in your platform's secrets or
448
+ environment settings, never in a committed file or chat. For Test agent
449
+ checkout on the preview address, set `RELYON_PREVIEW_HOSTS` to the app's
450
+ preview hostname or tunnel when the kit doesn't pick it up itself (see
451
+ [Test agent checkout on the preview address](#test-agent-checkout-on-the-preview-address)).
452
+ - **Lovable and Base44** don't load skill folders or run `init`; use the
453
+ Relyon Core repository's paste blocks for those platforms.
454
+
455
+ ## The six Relyon skills
456
+
457
+ | Skill | Use it for |
458
+ | --- | --- |
459
+ | `relyon-setup` (this one) | The shopping-pages flow, Test secret key, installing and mounting the kit, durable state, policies, diagnostics |
460
+ | `relyon-catalog` | The app's own product data and importer, `catalog.source`, JSON-LD, `llms.txt`, the sitemap and feeds |
461
+ | `relyon-checkout` | `priceCart`, the checkout page on the store's domain, card fields and `createPayment` |
462
+ | `relyon-agents` | The UCP, ACP and MCP routes the kit serves, agent rules and agent activity reporting |
463
+ | `relyon-orders` | `createOrder`, fulfillment updates and verifying Relyon webhooks |
464
+ | `relyon-go-live` | What Test proves, domain verification and the hand-over to Relyon staff for Live |
465
+
466
+ **Reference lookup only.** Open only the section named by the quick start:
467
+
468
+ | Stage | Open |
469
+ | --- | --- |
470
+ | Install the kit, the Test key, durable state, policies, the doctor | `relyon-setup` |
471
+ | Products, variants, prices, stock, images, product pages, `llms.txt`, sitemaps, feeds | `relyon-catalog` |
472
+ | Cart pricing, the store's checkout page, card fields, Test payment | `relyon-checkout` |
473
+ | UCP, ACP and MCP routes, hand-off links, agent rules, crawler rules, Test agent checkout on the preview address | `relyon-agents` |
474
+ | Saving orders exactly once, fulfillment updates, Relyon webhooks | `relyon-orders` |
475
+ | Publishing, verifying the domain, final checks and the Live hand-over | `relyon-go-live` |
476
+
477
+ ## Test agent checkout on the preview address
478
+
479
+ With a Test key (`rly_test_…`), agent checkout works on the app's preview
480
+ address right away, before the store is published or its domain verified,
481
+ on any coding platform or host: Replit, Lovable, Bolt, Vercel, Netlify,
482
+ Cursor, Codespaces, a tunnel, a local machine and others. Relyon keeps no
483
+ list of platforms: with a Test key it accepts any https address (a DNS name,
484
+ not an IP address) and `localhost` or a loopback IP as the key's own Test
485
+ store, without a verified domain.
486
+
487
+ - In Test mode the kit answers on these hostnames as well as on
488
+ `store.hostnames`:
489
+ - `localhost`, `127.0.0.1` and `[::1]`;
490
+ - every address listed in `RELYON_PREVIEW_HOSTS` (comma separated
491
+ hostnames or URLs), set in your platform's secrets or environment
492
+ settings: the way to name a tunnel or any preview URL, on any platform;
493
+ - `store.previewHosts`, when you pass a list of hostnames;
494
+ - the app's own address when its platform names it in a well-known
495
+ variable (Replit, Vercel, Netlify, Codespaces, Render and Railway do).
496
+ That is only a shortcut for setting `RELYON_PREVIEW_HOSTS`.
497
+
498
+ Any other host header is still refused, so a forged Host can't make the
499
+ store answer for an address it was never given. Set
500
+ `store.previewHosts: false` to turn all of this off. Live mode never adds
501
+ them.
502
+ - On a preview address the store serves `/.well-known/ucp`, the UCP and ACP
503
+ checkout routes, `/mcp` browsing and `llms.txt` as the key's own Test
504
+ store. An agent can quote, hand off to the store's checkout page on that
505
+ same address, pay with Test payment methods and get a Test order.
506
+ Everything is marked Test (`livemode: false`); no real money moves.
507
+ Store-hosted MCP checkout works in Test: it hands the shopper off to the
508
+ store's checkout page (`continue_url`), the payment happens there and the
509
+ order gets Relyon's `ord_…` ID. In Live it still answers
510
+ `protocol_not_available`.
511
+ - Plain `http` and a port work only for loopback (`localhost` on port 3000, for example).
512
+ Every other preview address is `https` on the default port.
513
+ - The preview address belongs to the key's own Relyon account only. Another
514
+ account using the same address gets its own Test data, never this store's.
515
+ A store may use up to 20 preview addresses; one unused for a day makes
516
+ room for a new one.
517
+ - The kit's doctor reports such a store as **Test on preview address**, not
518
+ as a failure. Channel setup (Google, Merchant Center, ChatGPT) still
519
+ needs a verified domain.
520
+
521
+ **Going live later.** A Live key is refused on any preview or unverified
522
+ address. The steps, in order:
523
+
524
+ 1. Publish the app on your platform.
525
+ 2. Add its domain in Relyon and verify it (`kit.ensureDomain()`,
526
+ `kit.verifyDomain(domain.hostname)` using the returned hostname; see `relyon-go-live`).
527
+ 3. Switch to a Live key, only with the merchant's approval. Relyon staff
528
+ enable Live; agents never ask for a Live key or set `relyon.live`.
529
+
530
+ The approved public Relyon v1 contract is dated **2026-10-30**. It is published,
531
+ without authentication, at `https://core.getrelyon.com/v1/openapi.yaml` (for
532
+ another deployment, `<service origin>/v1/openapi.yaml`). It is not the Relyon
533
+ dashboard's API. The kit already speaks it; read it only to check an error
534
+ code or a field.
535
+
536
+ The canonical API base is `https://core.getrelyon.com/api`; append operation
537
+ paths such as `/v1/products` to get `https://core.getrelyon.com/api/v1/products`.
538
+ The OpenAPI download above uses the service origin, not this API base. For
539
+ another deployment, retain its operator-confirmed API base.
540
+
541
+ ## Get a Test sandbox
542
+
543
+ If the key is already in the environment, init uses it without writing a key
544
+ file. Otherwise init never creates one: keep building, then get a key yourself —
545
+ open https://core.getrelyon.com/get-sandbox-key (signed in) and run
546
+ `npx @relyon/store-kit init --key-from-stdin`, pasting the key into its
547
+ prompt. The owner is needed only for policies, the support contact and Live
548
+ approval.
549
+ A key created from the hosted page belongs to the merchant's account from the
550
+ start; there is nothing to claim and it never lapses unclaimed.
551
+ After setting a real Test key, restart the server and resume pending verification
552
+ without rebuilding. Never create a second sandbox for the same store.
553
+
554
+ The sandbox record the hosted page creates (both keys are shown once, on
555
+ creation only):
556
+
557
+ ```json
558
+ {
559
+ "object": "sandbox",
560
+ "id": "org_…",
561
+ "name": "Example shop",
562
+ "livemode": false,
563
+ "publishableKey": "pk_test_…",
564
+ "restrictedKey": "rly_test_…",
565
+ "expiresAt": "2026-10-31T12:00:00.000Z"
566
+ }
567
+ ```
568
+
569
+ Start in **Test**. Sandbox creation is authenticated and lives on the hosted key
570
+ page: open https://core.getrelyon.com/get-sandbox-key in a browser (signed in) to
571
+ create a sandbox named for the store and copy its Test key. When you cannot run
572
+ init yourself, give the merchant this command to run in their own interactive
573
+ shell (not through your tools, so the key never reaches the conversation):
574
+
575
+ ```sh
576
+ npx @relyon/store-kit init --key-from-stdin
577
+ ```
578
+
579
+ The command reads the key from stdin or a hidden prompt and saves it privately.
580
+
581
+ - Keys are shown once. Display them only in the merchant's interactive **Shell**,
582
+ never in chat, captured logs, source control or browser code. The merchant
583
+ transfers the key directly to the **Secrets pane**; do not read it back or ask
584
+ the merchant to send it in chat.
585
+ - Save only the Test secret key (`rly_test_…`, server-side) as
586
+ `RELYON_API_KEY`, using the platform's secret tooling. It carries every
587
+ merchant scope the kit needs, including creating sandboxes for the store's own
588
+ account. Restricted keys (`rly_test_…`, `rly_live_…`) stay server-side.
589
+ - By default the kit refuses `rly_live_…` keys: Live needs both a Live key and
590
+ `relyon.live: true`, an https `STORE_PUBLIC_URL`, and Relyon staff approval.
591
+ Never ask for a Live key or set that option (see `relyon-go-live`).
592
+
593
+ ## Install the kit
594
+
595
+ `npx @relyon/store-kit init` (see [Start here](#start-here-from-the-store-idea-to-a-working-test-store))
596
+ installs the pinned kit and these skills in one step. The manual way follows.
597
+
598
+ ### Install the public skills manually
599
+
600
+ Use the public GitHub **relyon-core** repository, not a private workspace or
601
+ copied kit source. From the app's project root in a terminal:
602
+
603
+ ```sh
604
+ git clone --depth 1 https://github.com/relyon-payments/relyon-core.git /tmp/relyon-core
605
+ mkdir -p .agents/skills
606
+ cp -R /tmp/relyon-core/skills/* .agents/skills/
607
+ npm install @relyon/store-kit@0.1.52
608
+ ```
609
+
610
+ In channels without a repository URL in the clone command, set
611
+ `RELYON_CORE_REPOSITORY` to the confirmed public GitHub relyon-core URL from
612
+ its README; do not guess an owner. The public repository copy includes the
613
+ clone URL directly. The CLI below is optional; these public skills and the
614
+ pinned npm kit are enough.
615
+
616
+ Use **Node.js 20 or newer**, ES modules (`"type": "module"` in package.json),
617
+ and a server on the store's own domain, not static-only hosting. The Express
618
+ example also needs `npm install express@5`; the Postgres example needs
619
+ `npm install pg`. Extract the named JavaScript files from the references,
620
+ put browser `checkout.js` in `public/checkout.js`, and run `node main.js`.
621
+ Serve the app's real product images at the URLs in its catalog.
622
+
623
+ Add the dependency with the project's package manager: `npm install @relyon/store-kit@0.1.52`
624
+ (or the pnpm/yarn/bun equivalent, with the same pinned version). This is the intended install path. If the
625
+ registry can't find the package, stop and tell the merchant. Don't recreate the
626
+ kit by hand, copy its source into the app, or call Relyon's agent routes
627
+ directly in its place.
628
+
629
+ ### Server environment
630
+
631
+ Set credentials using the host's environment settings, never by pasting values
632
+ into chat, source files, logs or browser code. Non-secret settings can use the
633
+ server environment too.
634
+
635
+ | Setting | Required use and provenance |
636
+ | --- | --- |
637
+ | `RELYON_API_KEY` | Optional during build; required for credential-dependent operations. A Test key from https://core.getrelyon.com/get-sandbox-key, saved by `npx @relyon/store-kit init --key-from-stdin`, stored server-only. Not the publishable key. |
638
+ | `STORE_HOSTNAMES` | Comma-separated bare hostnames, primary first; no scheme, port or path. For example `shop.example.com,store.example.com`. It takes precedence over `STORE_HOSTNAME`. |
639
+ | `STORE_HOSTNAME` | Compatibility setting for a single hostname when `STORE_HOSTNAMES` is absent. The example defaults to `localhost` for local development only; set the real hostname before anything public. |
640
+ | `STORE_PUBLIC_URL` | Optional explicit HTTPS store origin, with no path. Its hostname must match the primary configured hostname; the catalog example otherwise derives its origin from that primary hostname. |
641
+ | `PORT` | The listening port supplied by the host. The example defaults to 3000 locally and listens on `0.0.0.0`. |
642
+ | `RELYON_WEBHOOK_SECRET` | Optional explicit override, set when the kit must use exactly this endpoint's secret. It is the one-time `secret` returned by registering this store's `/relyon/webhooks` endpoint through `POST /v1/webhook_endpoints` (see `relyon-agents`). Unset in Test, the kit resolves the secret at runtime with `RELYON_API_KEY` and still answers signed webhooks; with neither, the kit refuses webhook deliveries. Do not generate it yourself or reuse another endpoint's secret. |
643
+ | `RELYON_CART_TOKEN_SECRET` | Optional for local Test; required as a stable store-managed server-only secret before shared/restarted deployments. Generate it securely with the host's secret tooling, share it across server processes, and retain it across API-key rotation. Without it, kit tokens derive from the API key. |
644
+ | `RELYON_API_BASE_URL` | Optional. Defaults to `https://core.getrelyon.com/api`; use only another operator-confirmed API base. This is Relyon's API origin/path, never the store URL. |
645
+ | `DATABASE_URL` | Required for the Postgres durable adapters and durable orders/checkouts in a deployed store. Obtain it from the store's database provider via secret tooling. A connection string alone does not install adapters or migrations. Local in-memory Test needs no database. |
646
+
647
+ An example env file (`.env.example`) shows the key blank, never a placeholder:
648
+
649
+ ```sh
650
+ # Filled by `npx @relyon/store-kit init --key-from-stdin` (Test key, saved privately).
651
+ RELYON_API_KEY=
652
+ ```
653
+
654
+ **Loading the key.** Next.js loads `.env` itself. A plain Node/Express server
655
+ does not: load it with
656
+ `const { apiKey, webhookSecret } = await loadTestConfig({ project: process.cwd() })` from
657
+ `@relyon/store-kit/server-config` (it also finds the key init saved privately),
658
+ or with `dotenv`. Never `cat` or print `.env`, and never paste the key into a
659
+ command or a chat. Pass `apiKey` to `relyon.apiKey` and `webhookSecret` to
660
+ `rules.webhookSecret`. Resolve both independently: a private or environment key
661
+ must not hide a webhook secret saved in `.env`. Restart after running `webhook`.
662
+
663
+ The runnable starter deliberately uses memory; it is not a durable deployed
664
+ store. Wire in the database adapters below, migrate once before serving,
665
+ and replace the example orders map with a transactional database table unique
666
+ on payment ID. Do not reset checkout attempts or order claims on restart.
667
+
668
+ ### Hosting and hostname rotation
669
+
670
+ Use always-on serving, or a deployment with **Postgres-backed
671
+ state** that restores state across process restarts; always-on serving alone does not
672
+ make memory or deployment files durable. Wire the adapters in the
673
+ [durable-state reference](references/durable-state.md) for checkout attempts,
674
+ order claims and agent events. Published files can reset on republish.
675
+
676
+ Verify ownership on the actual published host (or the custom
677
+ domain), not a sleeping/changing development URL. Confirm the published host
678
+ serves the kit routes over HTTPS before requesting verification.
679
+ Relyon schedules daily ownership rechecks using wall time. The often-described
680
+ **three-failed-daily-recheck rule** applies only to consecutive lookup failures:
681
+ a missing or mismatched proof fails immediately. Inconclusive lookup failures
682
+ leave the domain due, so retries can occur sooner than three separate days;
683
+ a successful proof resets the counter.
684
+
685
+ Rotation checklist, **dev → published-host → custom-domain**:
686
+
687
+ 1. Use development hosts for Test only (Test agent checkout works there); never advertise them as durable public URLs.
688
+ 2. Publish, set `STORE_HOSTNAMES` to the confirmed published hostname first,
689
+ update `STORE_PUBLIC_URL` if set, restart the store, then add and verify that hostname.
690
+ 3. Connect the custom domain, put it first in `STORE_HOSTNAMES`, retaining the
691
+ published hostname only while it still serves the store. Update `STORE_PUBLIC_URL`
692
+ and product, policy and webhook URLs to the new primary origin.
693
+ 4. Add and verify the custom hostname, check discovery and a Test checkout, then
694
+ retire old links/proofs only after migration. Domain ownership never changes traffic routing.
695
+
696
+ ## Create the kit on the server
697
+
698
+ Create one kit per server process, in a server-only module. The full working
699
+ example is in [the Express server reference](references/express-server.md);
700
+ the core is:
701
+
702
+ ```js relyon.js
703
+ // Server-only module. The kit is the only code that talks to Relyon.
704
+ import { createStoreKit } from "@relyon/store-kit";
705
+ import { priceCart, createOrder, catalogSource } from "./store.js";
706
+
707
+ export function createRelyonKit({ env = process.env, fetch, state, events, catalog,
708
+ source = catalogSource, formats = ["openai", "openaiGzip", "google", "microsoft"],
709
+ cacheSeconds = 60, onDiagnostic, robots } = {}) {
710
+ const hostnames = (env.STORE_HOSTNAMES ?? env.STORE_HOSTNAME ?? "localhost")
711
+ .split(",").map(host => host.trim()).filter(Boolean);
712
+ return createStoreKit({
713
+ relyon: {
714
+ baseUrl: env.RELYON_API_BASE_URL ?? "https://core.getrelyon.com/api",
715
+ apiKey: env.RELYON_API_KEY, // rly_test_… from the server environment
716
+ waitingForSandboxKey: true, // Test-only local build; a real key activates normal operation
717
+ ...(fetch ? { fetch } : {}),
718
+ },
719
+ store: {
720
+ name: "Example Candle Co",
721
+ description: "Hand-poured soy candles.",
722
+ hostnames, // primary first; STORE_HOSTNAME is the single-host compatibility fallback
723
+ // Optional. Without it, links use the store's own hostname the request came in on.
724
+ ...(env.STORE_PUBLIC_URL ? { publicUrl: env.STORE_PUBLIC_URL } : {}),
725
+ },
726
+ // The policy pages the homepage footer links to (server.js). Returns are
727
+ // added only with the merchant's confirmed terms (Store policies, below).
728
+ policies: {
729
+ shippingUrl: `https://${hostnames[0]}/shipping`,
730
+ privacyUrl: `https://${hostnames[0]}/privacy`,
731
+ termsUrl: `https://${hostnames[0]}/terms`,
732
+ },
733
+ // The app's own functions (relyon-checkout, relyon-orders).
734
+ priceCart,
735
+ createOrder,
736
+ // Signed agent_rules.updated webhooks refresh rules right away (relyon-agents). Unset in
737
+ // Test, the kit resolves the webhook secret itself at runtime from RELYON_API_KEY.
738
+ rules: { webhookSecret: env.RELYON_WEBHOOK_SECRET },
739
+ // Production: shared, durable stores (references/durable-state.md).
740
+ ...(state ? { state } : {}),
741
+ ...(events ? { events: { store: events } } : {}),
742
+ catalog: { source, ...(catalog ? { persistence: catalog } : {}) },
743
+ feeds: { formats, cacheSeconds, ...(onDiagnostic ? { onDiagnostic } : {}) },
744
+ // robots.txt is served by default (AI search crawlers allowed). An app with
745
+ // its own robots policy passes { existing } (its original text); false opts out.
746
+ ...(robots !== undefined ? { robots } : {}),
747
+ ...(env.RELYON_CART_TOKEN_SECRET ? { cartTokens: { secret: env.RELYON_CART_TOKEN_SECRET } } : {}),
748
+ });
749
+ }
750
+ ```
751
+
752
+ - `await kit.start()` once at boot: it restores the saved catalog, reads the
753
+ agent rules and starts the event reporting timer. Calling it again is safe.
754
+ - Automatic storage users: on the Node server only, import `loadTestConfig`
755
+ from `@relyon/store-kit/server-config`, then load with
756
+ `await loadTestConfig({ project: process.cwd() })` and pass its `apiKey`
757
+ and `webhookSecret` into `createRelyonKit`'s server environment as
758
+ `RELYON_API_KEY` and `RELYON_WEBHOOK_SECRET`. Never return either to a client.
759
+ Without a key, the explicit waiting mode starts store-owned discovery without
760
+ API calls, and `kit.checkoutStatus` is `"waiting for sandbox key"`.
761
+ Show that status on checkout and disable Pay/card fields. Add a real Test key
762
+ through server-only configuration and restart; resume checks, do not rebuild.
763
+ - `await kit.stop()` on shutdown (for example on `SIGTERM`): it stops the
764
+ timers and flushes queued agent events. Don't call it per request.
765
+ - `store.hostnames` lists the store's own public hostnames, the first being
766
+ the primary one.
767
+ - **The public address.** Every agent-facing link (llms.txt, the UCP
768
+ profile, the MCP link, both sitemaps, Product data, product and image
769
+ links, feeds and the agent card) uses one origin per request,
770
+ `kit.publicOrigin(request)`: `STORE_PUBLIC_URL` when set, otherwise the
771
+ store's own or Test preview hostname the request arrived on. Any other Host
772
+ header is refused, never trusted. Catalog URLs on the store's own
773
+ hostnames (including loopback and preview addresses) are moved onto that
774
+ origin, so an address from build or dev time never leaks into what agents
775
+ read. Pass the page's request to `kit.renderProductJsonLd(product, request)`
776
+ and `kit.renderProductListJsonLd(products, request)` for the same result.
777
+
778
+ ## Mount it on the app's server
779
+
780
+ The kit answers its own paths and passes everything else to the app.
781
+ **Mount the kit always; it waits safely without a key.** Never wrap
782
+ `createStoreKit` or the middleware in a check on `RELYON_API_KEY`: the app's
783
+ catch-all page would then answer the kit's paths, and the doctor FAILs that.
784
+ Mount it before any SPA catch-all or static fallback.
785
+
786
+ - **Express:** `app.use(storeKitMiddleware(kit))` from
787
+ `@relyon/store-kit/express`, **before** `express.json()` or any other body
788
+ parser. The kit needs the raw request body to relay signed agent requests,
789
+ and the middleware throws if a parser ran first.
790
+ - **Next.js App Router:** `storeKitRouteHandlers(kit)` from
791
+ `@relyon/store-kit/next` returns `GET`, `POST`, `PUT`, `PATCH`, `DELETE` and
792
+ `HEAD`. Export them from a route file for each kit path:
793
+ `app/.well-known/ucp/route.js`, `app/.well-known/relyon-verification/route.js`,
794
+ `app/ucp/[...path]/route.js`, `app/acp/[...path]/route.js`,
795
+ `app/mcp/route.js`, `app/llms.txt/route.js`,
796
+ `app/sitemap-products.xml/route.js`, `app/feeds/[file]/route.js` for selected
797
+ feeds, `app/robots.txt/route.js` (unless `robots: false`) and
798
+ `app/relyon/[...path]/route.js` (webhooks and the Test checkout), each
799
+ containing only `export const { GET, POST, PUT, PATCH, DELETE, HEAD } = storeKitRouteHandlers(kit);`.
800
+ Add no route segment config (`export const runtime`, `dynamic`,
801
+ `revalidate`): route handlers already run on Node.js, and Next.js 16 with
802
+ `cacheComponents` refuses that config. Import `kit` from one shared
803
+ server module so every route uses the same instance. `storeKitFetch(kit)`
804
+ returns `Response | null` for code that routes Web requests itself. Full
805
+ files, for Next.js 15 and 16: [the App Router reference](references/next-app-router.md).
806
+ - **Hono:** `app.use(storeKitMiddleware(kit))` from
807
+ `@relyon/store-kit/hono`, before the app's routes. On Node, serve it with
808
+ `@hono/node-server`.
809
+
810
+ Paths the kit serves by default: `/.well-known/ucp`,
811
+ `/.well-known/relyon-verification`, `/.well-known/agent-card.json`, `/ucp/*`,
812
+ `/acp/*`, `/mcp`, `/llms.txt`, `/sitemap-products.xml`, the root sitemap
813
+ `/sitemap.xml`, `/robots.txt` (unless `robots: false`), `/relyon/webhooks`
814
+ and, in Test only, `/relyon/test-checkout` (see "Complete one Test checkout
815
+ yourself" above). `/checkout` is the app's own
816
+ page (see `relyon-checkout`); the kit only uses its path in agent links. Change
817
+ paths with the `paths` option only if they clash with the app's routes.
818
+ Configured feeds additionally claim `/feeds/openai.jsonl`,
819
+ `/feeds/openai.jsonl.gz`, `/feeds/google.xml` and `/feeds/microsoft.xml`;
820
+ unselected feed paths pass to the app. Express and Hono middleware handle these selected
821
+ paths automatically; Next.js needs the route files listed above (plus
822
+ `app/sitemap.xml/route.js` for the root sitemap and
823
+ `app/.well-known/agent-card.json/route.js` for the agent card).
824
+
825
+ The root `/sitemap.xml` is a urlset that lists the product pages, so crawlers
826
+ that only look at `/sitemap.xml` find the products. If the app already serves
827
+ its own `/sitemap.xml`, pass `sitemapIndex: false` to the kit and list
828
+ `/sitemap-products.xml` in the app's own sitemap index instead. The kit's
829
+ robots.txt (served by default) adds a `Sitemap:` line for each:
830
+
831
+ ```text
832
+ Sitemap: https://shop.example.com/sitemap.xml
833
+ Sitemap: https://shop.example.com/sitemap-products.xml
834
+ ```
835
+
836
+ ## Production: durable state
837
+
838
+ The defaults keep checkout state, agent events and the catalog **in memory, in
839
+ one process**. That is fine for a local Test run, not for production or for
840
+ more than one server process. Before the store takes real traffic, plug in:
841
+
842
+ - `state`: a `CheckoutStateStore` (`get`, `byAgentCheckoutId`, `put`,
843
+ `claimOrder`, `releaseOrder`). `claimOrder` must be an atomic insert, so
844
+ `createOrder` runs once per payment across every process.
845
+ - `events.store`: an `AgentEventStore` (`append`, `peek`, `remove`, `size`), so
846
+ queued agent events survive a restart instead of being lost.
847
+ - `catalog.persistence`: `{ load, save }` for the synced index (agent checkout's product list).
848
+ Source-backed feeds/discovery read `catalog.source`, not that snapshot;
849
+ the app's product database must itself be durable and available.
850
+ - `cartTokens: { secret }`: the app's own secret for hand-off links, so links
851
+ keep working when the API key is rotated.
852
+
853
+ A Postgres example of the first two is in
854
+ [the durable state reference](references/durable-state.md).
855
+
856
+ ### Before a key exists: `waiting_for_sandbox_key`
857
+
858
+ With no usable key (Test only; a Live kit refuses to start without its Live
859
+ key), every kit path still answers from the kit, never with a 404, a 500 or the
860
+ app's page, and nothing advertises a checkout capability or reveals the kit's
861
+ configuration:
862
+
863
+ | Path | Answer while waiting |
864
+ | --- | --- |
865
+ | `/.well-known/ucp`, `/.well-known/relyon-verification`, `/.well-known/agent-card.json`, `/ucp/*`, `/acp/*`, `/relyon/webhooks` | `503`, `Retry-After: 300`, `{"status":"waiting_for_sandbox_key","code":"sandbox_key_pending","message":"…"}` |
866
+ | `/mcp` | A normal MCP server: `initialize` names `waiting_for_sandbox_key` in its instructions and `_meta`; `tools/list` has only the browse tools. |
867
+ | `/llms.txt` | `200`, with a line saying checkout waits for a Test secret key. |
868
+ | `/sitemap-products.xml`, `/sitemap.xml`, `/feeds/google.xml`, `/feeds/microsoft.xml` | `200`, with an XML comment `relyon: waiting_for_sandbox_key`. Products stay listed for discovery; none is marked checkout-eligible. |
869
+ | `/feeds/openai.jsonl(.gz)` | `200`, the same products, with the status in the header. |
870
+ | `/robots.txt` (unless `robots: false`) | `200`, starting with `# Relyon store kit: waiting_for_sandbox_key`. |
871
+ | `/relyon/test-checkout` | `503` with the waiting status; nothing is bought. |
872
+
873
+ Every waiting discovery answer carries the header
874
+ `x-relyon-status: waiting_for_sandbox_key`. Restart the server once a key is
875
+ saved; the same paths then answer normally.
876
+
877
+ ## Store policies: explicit synchronization
878
+
879
+ For a print-on-demand store, configure defects/damage-only returns truthfully.
880
+ These local options affect discovery and supported checkout links; creating the
881
+ kit or reading discovery never saves policy information to Relyon.
882
+
883
+ ```js
884
+ // The store's own origin; required (no example default).
885
+ const ORIGIN = process.env.STORE_PUBLIC_URL;
886
+ if (!ORIGIN) throw new Error("Set STORE_PUBLIC_URL to the store's origin");
887
+ const policies = {
888
+ shippingUrl: `${ORIGIN}/shipping`,
889
+ privacyUrl: `${ORIGIN}/privacy`,
890
+ termsUrl: `${ORIGIN}/terms`,
891
+ contactUrl: `${ORIGIN}/contact`,
892
+ returns: {
893
+ windowDays: 30,
894
+ scope: "defective_only",
895
+ policyUrl: `${ORIGIN}/returns`,
896
+ conditions: "Made to order. Only items arriving defective or damaged qualify. Report damage with a photograph.",
897
+ },
898
+ };
899
+ const kit = createStoreKit({
900
+ relyon: { baseUrl: process.env.RELYON_API_BASE_URL, apiKey: process.env.RELYON_API_KEY },
901
+ store: { name: "Example Print Shop", hostnames: [new URL(ORIGIN).hostname], publicUrl: ORIGIN },
902
+ policies,
903
+ priceCart, createOrder,
904
+ });
905
+
906
+ // An explicit setup action, never a constructor or read-request side effect.
907
+ await kit.replaceStorePolicies({
908
+ returns: { window_days: 30, cost: "buyer_pays" },
909
+ support: { email: "help@example.com", phone: "+16145550142" },
910
+ consumer_notices: [{ text: "Items are made to order." }],
911
+ });
912
+ const saved = await kit.storePolicies();
913
+ // Check saved.complete and saved.missing; do not assume completeness.
914
+ ```
915
+
916
+ **Policy URLs.** Use https URLs on the store's own domain. In Test only,
917
+ plain http on the loopback host (`localhost`, `127.0.0.1` or `[::1]`, any
918
+ port) is accepted too, so a local build can keep its policies; the kit sends
919
+ them to Relyon on the store's https public address. Live requires https on the
920
+ published domain, and the doctor and `relyon-go-live` say so.
921
+
922
+ **Keep the pages and Relyon's store policies in sync.** Checkout fails closed
923
+ while Relyon's store policies are incomplete or don't match what the store's
924
+ pages promise, and the kit's doctor names the exact field and the fix (for
925
+ example `returns.cost` or `support.email`). `kit.syncStorePolicies()` compares
926
+ the `policies` option with what Relyon has stored and returns a plan without
927
+ changing anything: `changes` (each field it would set, old and new) and
928
+ `needs` (facts only the merchant can supply, such as the return window or who
929
+ pays return shipping). Show the plan to the merchant. Only after they
930
+ confirm, apply exactly that:
931
+
932
+ ```js
933
+ const plan = await kit.syncStorePolicies(); // read-only
934
+ // Show plan.changes and plan.needs to the merchant; wait for their answer.
935
+ await kit.syncStorePolicies({ confirm: true, returns: { window_days: 30, cost: "buyer_pays" } });
936
+ // No contact page? Pass the support email the merchant gave you:
937
+ // syncStorePolicies({ confirm: true, ..., support: { email: "help@example.com" } })
938
+ ```
939
+
940
+ It never infers free returns or a return cost: `returns.cost` comes only from
941
+ the merchant's answer or a value Relyon already stores. Run it again whenever
942
+ a policy page changes, so the page and Relyon say the same thing.
943
+
944
+ Choose `cost` from the store's actual terms, never from this example by default.
945
+ Use `free` only when the store pays; `fixed` requires the actual minor-unit
946
+ `cost_amount`. A local return option contains no cost, so explicit replacement
947
+ requires caller-supplied `returns.window_days` and `returns.cost`. Caller values
948
+ win; support email/phone, notices and fixed costs are not cleared by the mapping.
949
+ Local contact maps to existing `support.url`, not a duplicate contact field.
950
+ The three page links map to `shipping_policy_url`, `privacy_policy_url`, `terms_url`.
951
+ Scope, conditions and the return policy URL fill omitted return fields.
952
+
953
+ `defective_only` qualifies both the reporting window and cost to defective or
954
+ damaged items only. Never call this "30-day returns" or "30-day free returns".
955
+ `none` requires zero days and accepts no returns. Zero-day `defective_only`
956
+ promises no reporting period: refer to conditions and the linked policy.
957
+ The API still accepts legacy documents without scope; zero days still means no
958
+ returns. The local `all` option retains its existing 1–365 day range.
959
+ Conditions are plain text of at most 2000 characters; links are absolute HTTPS,
960
+ without credentials, at most 4096 characters. No markup or scripts.
961
+
962
+ Replacement clears fields absent from both the explicit input and local options.
963
+ Without local options, the existing `replaceStorePolicies(input)` sends the
964
+ contract input unchanged. No new fields are required; completeness still checks
965
+ only returns, its policy URL and support email or URL. Do not synchronize from a
966
+ constructor, product read, checkout read or discovery request.
967
+
968
+ ## Keys, scopes and requests
969
+
970
+ - Only the server uses `RELYON_API_KEY`. Never put it in a URL, a frontend
971
+ bundle, an agent prompt, an example or telemetry.
972
+ - Test and Live have separate keys, resources, webhook secrets and idempotency
973
+ records. Check `livemode: false` on what Relyon returns.
974
+ - The kit sends `Relyon-Version: 2026-10-30`, Bearer authentication and its
975
+ own `Idempotency-Key` values. Don't add a second client beside it for the
976
+ same calls.
977
+ - Never put card numbers, CVV/CVC, expiry dates or raw card payloads in
978
+ product data, metadata, logs or requests. If Relyon answers
979
+ `card_data_rejected`, remove the field; never rename or encode it to get
980
+ past the check.
981
+
982
+ ## Install these skills and the CLI
983
+
984
+ `npx @relyon/store-kit init` installs the kit and these skills for Codex,
985
+ Replit Agent and OpenCode (`.agents/skills`), Claude Code (`.claude/skills`)
986
+ and Cursor (`.cursor/skills`); it needs nothing else. The optional `relyon`
987
+ CLI is served by Relyon, not the npm registry: `npm install -g https://core.getrelyon.com/cli/relyon.tgz` (or project-local
988
+ `npm i -D <that URL>` and `npx relyon …`). One-shot:
989
+ `npx -y https://core.getrelyon.com/cli/relyon.tgz agent setup`. The SHA-256 is
990
+ at `https://core.getrelyon.com/cli/relyon.tgz.sha256`. Commands use
991
+ `https://core.getrelyon.com`, the CLI's default base URL. Set
992
+ `RELYON_BASE_URL` (or `--base-url`) only for another deployment its operator
993
+ confirmed.
994
+
995
+ `relyon agent setup` installs the six bundled skills offline, with no key, for
996
+ Claude Code (`.claude/skills`), Cursor (`.cursor/skills`), Codex and Replit
997
+ Agent (`.agents/skills`) and OpenCode (`.opencode/skills`). Claude Code users
998
+ can install the Relyon plugin instead.
999
+
1000
+ ## Diagnose without overclaiming
1001
+
1002
+ Run the kit's doctor against the published store, with `RELYON_API_KEY`
1003
+ already in the server environment from the secrets tool (never on the command
1004
+ line):
1005
+
1006
+ ```sh
1007
+ STORE_PUBLIC_URL=https://shop.example.com npx @relyon/store-kit doctor
1008
+ ```
1009
+
1010
+ It checks what agents see on the store's public URL (the UCP profile, the
1011
+ verification file, `llms.txt`, the product sitemap, selected feeds, MCP and
1012
+ `robots.txt`), then runs Relyon's integration doctor (`GET /v1/doctor`). It
1013
+ prints PASS, FAIL, WARN, N/A or UNVERIFIED per item and never prints the key.
1014
+ Run it with or without a key. Even without one it FAILs:
1015
+
1016
+ - a kit path answered by HTML or a body that isn't the kit's: "Your server's
1017
+ catch-all route answers this path. Mount storeKitMiddleware before the
1018
+ catch-all."
1019
+ - a random unknown path answering 200: "Your server answers 200 for unknown
1020
+ paths, so agents can't tell what is missing. Return 404 for unknown
1021
+ non-page paths."
1022
+
1023
+ It WARNs when the project's source creates or mounts the kit only when
1024
+ `RELYON_API_KEY` is set: "Mount the kit always; it waits safely without a
1025
+ key." It never creates a shopper checkout or submits
1026
+ a payment; Relyon's server diagnostic may create and clean up one temporary
1027
+ system-owned checkout and sends one webhook challenge.
1028
+ `--feeds openai,google` names the selected feeds. It checks Test unless given
1029
+ `--live` (or `RELYON_LIVE=true`) with a Live key; never pass either (see
1030
+ `relyon-go-live`).
1031
+
1032
+ `relyon doctor` (the CLI) runs only `GET /v1/doctor`. HTTP 200 can still
1033
+ contain `status: fail`; read every failure. For a store-first app, only these
1034
+ checks are goals:
1035
+
1036
+ - `keys`: a Test secret key exists and has the scopes it needs.
1037
+ - `catalog`: with store-owned `catalog.source` callbacks, Relyon doesn't need
1038
+ its index; once it has observed the store's own discovery, an empty mirror
1039
+ is not a failure. Relyon counts the app as store-first when the store's
1040
+ domain is verified (within step 1) and it has seen the kit's UCP profile, MCP or
1041
+ `llms.txt` on that domain, or received the kit's agent events; run the
1042
+ doctor again after setup's domain verification. If the store's own discovery passes and
1043
+ `catalog` still fails only because the index is empty, run
1044
+ `kit.syncCatalog`: agent checkout needs the products there anyway. Without `catalog.source`, it
1045
+ passes once at least one valid, in-stock product is published to the index.
1046
+ - `webhook`: Relyon challenges one active webhook endpoint. The kit's
1047
+ `/relyon/webhooks` route answers the challenge itself once it has the
1048
+ endpoint's secret — set as `RELYON_WEBHOOK_SECRET` or, in Test, resolved at
1049
+ runtime from `RELYON_API_KEY`. Any other endpoint the
1050
+ app registers must answer it too (see `relyon-orders`).
1051
+
1052
+ The doctor's `pricing` and `checkout` checks test an older Relyon-side flow
1053
+ that store-first apps don't use. The kit's doctor shows them as N/A when, in
1054
+ Test, the same run saw the store's UCP profile, verification file, `llms.txt`
1055
+ and MCP on its domain; `relyon doctor` may still list them. Don't build
1056
+ anything to make them pass. A store-first blocker Relyon reports under those
1057
+ checks (its explanation says "Observed blocker" or "Unverified") stays a FAIL:
1058
+ fix it.
1059
+
1060
+ A contracted operation that answers 404, 405 or 501 is not available on that
1061
+ deployment. Report it; never call an internal or dashboard route instead.