@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.
- package/AGENTS.md +75 -0
- package/CHANGELOG.md +1053 -0
- package/LICENSE +21 -0
- package/QUICKSTART.md +239 -0
- package/README.md +117 -2
- package/dist/adapters/express.d.ts +39 -0
- package/dist/adapters/express.js +106 -0
- package/dist/adapters/hono.d.ts +16 -0
- package/dist/adapters/hono.js +15 -0
- package/dist/adapters/next.d.ts +29 -0
- package/dist/adapters/next.js +38 -0
- package/dist/agent-card.d.ts +14 -0
- package/dist/agent-card.js +58 -0
- package/dist/agent-docs.d.ts +36 -0
- package/dist/agent-docs.js +78 -0
- package/dist/agent-hooks.d.ts +66 -0
- package/dist/agent-hooks.js +280 -0
- package/dist/agents.d.ts +24 -0
- package/dist/agents.js +120 -0
- package/dist/api-key.d.ts +6 -0
- package/dist/api-key.js +33 -0
- package/dist/cache.d.ts +46 -0
- package/dist/cache.js +86 -0
- package/dist/cart-tokens.d.ts +31 -0
- package/dist/cart-tokens.js +58 -0
- package/dist/cart-transfer.d.ts +95 -0
- package/dist/cart-transfer.js +387 -0
- package/dist/catalog-enrichment.d.ts +6 -0
- package/dist/catalog-enrichment.js +71 -0
- package/dist/catalog-reads.d.ts +126 -0
- package/dist/catalog-reads.js +104 -0
- package/dist/catalog.d.ts +78 -0
- package/dist/catalog.js +288 -0
- package/dist/charge-claims.d.ts +11 -0
- package/dist/charge-claims.js +47 -0
- package/dist/check.d.ts +44 -0
- package/dist/check.js +152 -0
- package/dist/checklist-manifest.d.ts +72 -0
- package/dist/checklist-manifest.js +341 -0
- package/dist/checkout.d.ts +222 -0
- package/dist/checkout.js +353 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +727 -0
- package/dist/confirmation.d.ts +78 -0
- package/dist/confirmation.js +124 -0
- package/dist/context.d.ts +81 -0
- package/dist/context.js +10 -0
- package/dist/discovery.d.ts +151 -0
- package/dist/discovery.js +346 -0
- package/dist/doctor-cart-transfer.d.ts +33 -0
- package/dist/doctor-cart-transfer.js +186 -0
- package/dist/doctor-catalog.d.ts +8 -0
- package/dist/doctor-catalog.js +47 -0
- package/dist/doctor-evidence.d.ts +22 -0
- package/dist/doctor-evidence.js +57 -0
- package/dist/doctor-merchant.d.ts +48 -0
- package/dist/doctor-merchant.js +74 -0
- package/dist/doctor-source.d.ts +5 -0
- package/dist/doctor-source.js +142 -0
- package/dist/doctor-variants.d.ts +70 -0
- package/dist/doctor-variants.js +102 -0
- package/dist/doctor.d.ts +215 -0
- package/dist/doctor.js +1689 -0
- package/dist/events.d.ts +95 -0
- package/dist/events.js +200 -0
- package/dist/feed-mapping.d.ts +114 -0
- package/dist/feed-mapping.js +152 -0
- package/dist/feed-values.d.ts +13 -0
- package/dist/feed-values.js +40 -0
- package/dist/feeds.d.ts +104 -0
- package/dist/feeds.js +366 -0
- package/dist/identify.d.ts +102 -0
- package/dist/identify.js +124 -0
- package/dist/identity.d.ts +37 -0
- package/dist/identity.js +54 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +41 -0
- package/dist/init.d.ts +157 -0
- package/dist/init.js +912 -0
- package/dist/kit-config.d.ts +19 -0
- package/dist/kit-config.js +43 -0
- package/dist/kit-environment.d.ts +20 -0
- package/dist/kit-environment.js +32 -0
- package/dist/kit-updates.d.ts +47 -0
- package/dist/kit-updates.js +77 -0
- package/dist/kit-version-project.d.ts +18 -0
- package/dist/kit-version-project.js +214 -0
- package/dist/kit-version.d.ts +37 -0
- package/dist/kit-version.js +162 -0
- package/dist/kit.d.ts +516 -0
- package/dist/kit.js +1309 -0
- package/dist/layers/pages.d.ts +3 -0
- package/dist/layers/pages.js +5 -0
- package/dist/layers/payments.d.ts +7 -0
- package/dist/layers/payments.js +9 -0
- package/dist/layers/products.d.ts +10 -0
- package/dist/layers/products.js +13 -0
- package/dist/live.d.ts +13 -0
- package/dist/live.js +52 -0
- package/dist/mcp.d.ts +270 -0
- package/dist/mcp.js +312 -0
- package/dist/next-steps.d.ts +101 -0
- package/dist/next-steps.js +257 -0
- package/dist/order-pending.d.ts +57 -0
- package/dist/order-pending.js +127 -0
- package/dist/orders.d.ts +12 -0
- package/dist/orders.js +21 -0
- package/dist/payments-init.d.ts +19 -0
- package/dist/payments-init.js +70 -0
- package/dist/payments-routes.d.ts +54 -0
- package/dist/payments-routes.js +123 -0
- package/dist/payments.d.ts +165 -0
- package/dist/payments.js +192 -0
- package/dist/pnpm-workspace.d.ts +58 -0
- package/dist/pnpm-workspace.js +250 -0
- package/dist/policies.d.ts +111 -0
- package/dist/policies.js +317 -0
- package/dist/preview-hosts.d.ts +64 -0
- package/dist/preview-hosts.js +175 -0
- package/dist/private-config.d.ts +169 -0
- package/dist/private-config.js +820 -0
- package/dist/progress.d.ts +54 -0
- package/dist/progress.js +153 -0
- package/dist/protocol-inputs.d.ts +22 -0
- package/dist/protocol-inputs.js +151 -0
- package/dist/public-origin.d.ts +50 -0
- package/dist/public-origin.js +180 -0
- package/dist/refusals.d.ts +86 -0
- package/dist/refusals.js +157 -0
- package/dist/relay.d.ts +107 -0
- package/dist/relay.js +655 -0
- package/dist/release-notes.d.ts +2 -0
- package/dist/release-notes.js +290 -0
- package/dist/relyon-cart-tokens.d.ts +101 -0
- package/dist/relyon-cart-tokens.js +521 -0
- package/dist/relyon.d.ts +141 -0
- package/dist/relyon.js +238 -0
- package/dist/robots.d.ts +27 -0
- package/dist/robots.js +127 -0
- package/dist/rules.d.ts +144 -0
- package/dist/rules.js +347 -0
- package/dist/sdk/generated/public-api.d.ts +4816 -0
- package/dist/sdk/generated/public-api.js +1 -0
- package/dist/sdk/index.d.ts +24 -0
- package/dist/sdk/index.js +34 -0
- package/dist/sdk/signatures.d.ts +17 -0
- package/dist/sdk/signatures.js +33 -0
- package/dist/setup.d.ts +37 -0
- package/dist/setup.js +94 -0
- package/dist/signatures.d.ts +112 -0
- package/dist/signatures.js +443 -0
- package/dist/state.d.ts +185 -0
- package/dist/state.js +96 -0
- package/dist/store-payments.d.ts +48 -0
- package/dist/store-payments.js +143 -0
- package/dist/structured-fields.d.ts +26 -0
- package/dist/structured-fields.js +200 -0
- package/dist/templates.d.ts +19 -0
- package/dist/templates.js +193 -0
- package/dist/test-checkout-command.d.ts +32 -0
- package/dist/test-checkout-command.js +161 -0
- package/dist/test-checkout.d.ts +88 -0
- package/dist/test-checkout.js +292 -0
- package/dist/types.d.ts +103 -0
- package/dist/types.js +18 -0
- package/dist/ucp-versions.d.ts +57 -0
- package/dist/ucp-versions.js +129 -0
- package/dist/util.d.ts +23 -0
- package/dist/util.js +68 -0
- package/dist/variants.d.ts +67 -0
- package/dist/variants.js +146 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.js +10 -0
- package/dist/waiting.d.ts +43 -0
- package/dist/waiting.js +57 -0
- package/dist/webhook-command.d.ts +48 -0
- package/dist/webhook-command.js +367 -0
- package/dist/webhook-registration.d.ts +47 -0
- package/dist/webhook-registration.js +69 -0
- package/dist/webmcp-schema.d.ts +14 -0
- package/dist/webmcp-schema.js +140 -0
- package/dist/webmcp-script.d.ts +3 -0
- package/dist/webmcp-script.js +176 -0
- package/dist/webmcp-store.d.ts +102 -0
- package/dist/webmcp-store.js +116 -0
- package/dist/webmcp.d.ts +242 -0
- package/dist/webmcp.js +866 -0
- package/dist/wire-names.d.ts +85 -0
- package/dist/wire-names.js +109 -0
- package/package.json +118 -4
- package/release-notes.json +290 -0
- package/scripts/install-notice.cjs +7 -0
- package/skills/relyon-agents/SKILL.md +327 -0
- package/skills/relyon-catalog/SKILL.md +499 -0
- package/skills/relyon-catalog/references/example-store.md +218 -0
- package/skills/relyon-checkout/SKILL.md +603 -0
- package/skills/relyon-checkout/references/checkout-flow.md +257 -0
- package/skills/relyon-checkout/references/checkout-page.md +315 -0
- package/skills/relyon-go-live/SKILL.md +344 -0
- package/skills/relyon-orders/SKILL.md +191 -0
- package/skills/relyon-orders/references/webhook-receiver.md +113 -0
- package/skills/relyon-payments/SKILL.md +117 -0
- package/skills/relyon-setup/SKILL.md +1061 -0
- package/skills/relyon-setup/references/QUICKSTART.md +239 -0
- package/skills/relyon-setup/references/durable-state.md +209 -0
- package/skills/relyon-setup/references/express-server.md +388 -0
- package/skills/relyon-setup/references/next-app-router.md +251 -0
- package/templates/common/STORE-README.md +67 -0
- package/templates/common/gitignore +8 -0
- package/templates/common/scripts/check-pricing.ts +22 -0
- package/templates/common/scripts/serve.mjs +13 -0
- package/templates/common/server/catalog.ts +79 -0
- package/templates/common/server/checkout-flow.d.ts +34 -0
- package/templates/common/server/pages.ts +184 -0
- package/templates/common/server/storage.ts +114 -0
- package/templates/common/server/store.ts +67 -0
- package/templates/express/server/express.ts +20 -0
- package/templates/express/tsconfig.build.json +6 -0
- package/templates/express/tsconfig.json +9 -0
- package/templates/next/app/[[...path]]/route.ts +24 -0
- package/templates/next/next.config.mjs +19 -0
- package/templates/next/tsconfig.json +12 -0
- package/templates/payments/express.ts +39 -0
- package/templates/payments/next.ts +38 -0
- package/templates/payments/node.ts +39 -0
package/dist/check.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { createHmac, randomBytes } from "node:crypto";
|
|
2
|
+
import { verifyEventSignature } from "./sdk/signatures.js";
|
|
3
|
+
import { usableApiKey, usableTestKey } from "./api-key.js";
|
|
4
|
+
import { DEFAULT_RELYON_BASE_URL, redactSecrets, terminalSafe } from "./doctor.js";
|
|
5
|
+
import { kitCommand } from "./identity.js";
|
|
6
|
+
import { RelyonPayments } from "./payments.js";
|
|
7
|
+
import { RelyonProblemError, RelyonUnavailableError } from "./relyon.js";
|
|
8
|
+
import { clientTokenProvider } from "./test-checkout.js";
|
|
9
|
+
// `npx @relyon/kit check`: the short check for a payments-only app (layer 1).
|
|
10
|
+
// Four steps, in order, each depending on the one before:
|
|
11
|
+
// 1. a Test key is present (from RELYON_API_KEY or init's private save);
|
|
12
|
+
// 2. Relyon creates a payment session with it;
|
|
13
|
+
// 3. a Test charge on Relyon's mock processor succeeds (the same opaque
|
|
14
|
+
// mock token test-checkout uses; no card data exists anywhere);
|
|
15
|
+
// 4. a webhook signature verifies with the kit's verifier (a correctly
|
|
16
|
+
// signed body passes and a tampered one fails).
|
|
17
|
+
// The first line is "DONE: payments verified in Test." or "NOT DONE: <n> of 4
|
|
18
|
+
// steps remain."; every failing step says what to fix. Keys and secrets are
|
|
19
|
+
// never printed. Test only: Live keys and RELYON_LIVE=true are refused.
|
|
20
|
+
// Exit codes: 0 DONE; 1 a step failed; 2 refused to run (Live, usage).
|
|
21
|
+
export const CHECK_STEPS = ["Test key", "Payment session", "Mock Test charge", "Webhook signature"];
|
|
22
|
+
export const CHECK_REFUSED_LIVE = "check is Test mode only: it never runs with RELYON_LIVE=true or a Live key, and never makes a Live charge.";
|
|
23
|
+
/** The amount of the mock Test charge, in minor units. */
|
|
24
|
+
export const CHECK_AMOUNT = 100;
|
|
25
|
+
/** The verdict, then one line per step (with its fix), redacted. */
|
|
26
|
+
export function formatCheck(steps) {
|
|
27
|
+
const remaining = steps.filter((step) => step.status !== "PASS").length + (CHECK_STEPS.length - steps.length);
|
|
28
|
+
const lines = [remaining === 0 ? "DONE: payments verified in Test." : `NOT DONE: ${remaining} of ${CHECK_STEPS.length} steps remain.`];
|
|
29
|
+
for (const [index, name] of CHECK_STEPS.entries()) {
|
|
30
|
+
const step = steps.find((item) => item.name === name);
|
|
31
|
+
if (!step) {
|
|
32
|
+
lines.push(`${index + 1}. NOT RUN ${name}: an earlier step must pass first.`);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
lines.push(`${index + 1}. ${step.status} ${name}: ${step.detail}`);
|
|
36
|
+
if (step.status !== "PASS" && step.fix)
|
|
37
|
+
lines.push(` Fix: ${step.fix}`);
|
|
38
|
+
}
|
|
39
|
+
return lines;
|
|
40
|
+
}
|
|
41
|
+
function describe(error) {
|
|
42
|
+
if (error instanceof RelyonProblemError)
|
|
43
|
+
return `Relyon refused it (${error.status} ${error.code}): ${error.message}`;
|
|
44
|
+
if (error instanceof RelyonUnavailableError)
|
|
45
|
+
return `Relyon could not be reached or answered unusably: ${error.message}`;
|
|
46
|
+
return error?.message ?? String(error);
|
|
47
|
+
}
|
|
48
|
+
/** Step 4 on its own: a signed body verifies, and a tampered or unsigned one doesn't. */
|
|
49
|
+
export function webhookSelfTest(secret, nowSeconds = Math.floor(Date.now() / 1000)) {
|
|
50
|
+
const body = JSON.stringify({ id: `evt_check_${randomBytes(6).toString("hex")}`, object: "event", type: "payment.succeeded", livemode: false });
|
|
51
|
+
const signature = `t=${nowSeconds},v1=${createHmac("sha256", secret).update(`${nowSeconds}.${body}`).digest("hex")}`;
|
|
52
|
+
const good = verifyEventSignature({ rawBody: body, signature, secret, nowSeconds });
|
|
53
|
+
const tampered = verifyEventSignature({ rawBody: `${body} `, signature, secret, nowSeconds });
|
|
54
|
+
const unsigned = verifyEventSignature({ rawBody: body, signature: undefined, secret, nowSeconds });
|
|
55
|
+
return good && !tampered && !unsigned;
|
|
56
|
+
}
|
|
57
|
+
/** Runs the four steps. Never throws; every line is terminal-safe and redacted. */
|
|
58
|
+
export async function runCheck(options) {
|
|
59
|
+
const envKey = usableApiKey(options.envKey);
|
|
60
|
+
const key = envKey ?? (options.live ? undefined : options.savedKey);
|
|
61
|
+
const secrets = [options.envKey, options.savedKey, key, options.webhookSecret];
|
|
62
|
+
const steps = [];
|
|
63
|
+
const command = kitCommand();
|
|
64
|
+
const finish = (exitCode, extra = [], paymentId) => ({
|
|
65
|
+
exitCode, steps,
|
|
66
|
+
lines: [...(exitCode === 2 ? [] : formatCheck(steps)), ...extra].map((line) => redactSecrets(terminalSafe(line), secrets)),
|
|
67
|
+
...(paymentId ? { paymentId } : {}),
|
|
68
|
+
});
|
|
69
|
+
if (options.live || (key && !usableTestKey(key) && key.startsWith("rly_live_")))
|
|
70
|
+
return finish(2, [CHECK_REFUSED_LIVE]);
|
|
71
|
+
// 1. A Test key.
|
|
72
|
+
const testKey = usableTestKey(key);
|
|
73
|
+
const baseUrl = options.baseUrl ?? DEFAULT_RELYON_BASE_URL;
|
|
74
|
+
if (!testKey) {
|
|
75
|
+
steps.push({ name: "Test key", status: "FAIL", detail: "no Test key (rly_test_…) in RELYON_API_KEY or saved by init.",
|
|
76
|
+
fix: `run \`${command} init --payments\` (it saves a Test key privately), or set RELYON_API_KEY to the Test key in the app's environment. Never paste the key into a command or chat.` });
|
|
77
|
+
return finish(1);
|
|
78
|
+
}
|
|
79
|
+
if (!envKey && baseUrl !== DEFAULT_RELYON_BASE_URL && !options.allowSavedKeyToBaseUrl) {
|
|
80
|
+
steps.push({ name: "Test key", status: "FAIL", detail: `the saved Test key goes only to ${DEFAULT_RELYON_BASE_URL}, not to the custom base URL.`,
|
|
81
|
+
fix: "set RELYON_API_KEY in the environment, or pass --allow-saved-key-to-base-url if you trust that base URL." });
|
|
82
|
+
return finish(1);
|
|
83
|
+
}
|
|
84
|
+
steps.push({ name: "Test key", status: "PASS", detail: envKey ? "found in RELYON_API_KEY (not printed)." : "found in init's private save (not printed)." });
|
|
85
|
+
const payments = new RelyonPayments({
|
|
86
|
+
apiKey: testKey, baseUrl, live: false, env: {},
|
|
87
|
+
...(options.projectSpace?.trim() ? { projectSpace: options.projectSpace.trim() } : {}),
|
|
88
|
+
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
89
|
+
...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
|
|
90
|
+
});
|
|
91
|
+
const run = randomBytes(9).toString("base64url").replace(/[^A-Za-z0-9]/g, "x");
|
|
92
|
+
const orderReference = `relyon-check-${run}`;
|
|
93
|
+
const currency = (options.currency ?? "USD").toUpperCase();
|
|
94
|
+
// 2. A payment session.
|
|
95
|
+
let session;
|
|
96
|
+
try {
|
|
97
|
+
session = await payments.createSession({ amount: CHECK_AMOUNT, currency, orderReference, idempotencyKey: `kit-check-ps-${run}` });
|
|
98
|
+
steps.push({ name: "Payment session", status: "PASS", detail: `Relyon created payment session ${session.id}.` });
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
const invalidKey = error instanceof RelyonProblemError && (error.status === 401 || error.code === "invalid_api_key");
|
|
102
|
+
steps.push({ name: "Payment session", status: "FAIL", detail: describe(error),
|
|
103
|
+
fix: invalidKey
|
|
104
|
+
? `the Test key was refused: get a fresh Test key from the Relyon dashboard and run \`${command} init --payments --key-from-stdin\`, or update RELYON_API_KEY.`
|
|
105
|
+
: error instanceof RelyonUnavailableError
|
|
106
|
+
? `check that this machine can reach ${baseUrl} (or RELYON_BASE_URL), then rerun \`${command} check\`.`
|
|
107
|
+
: `fix what Relyon named, then rerun \`${command} check\`.` });
|
|
108
|
+
return finish(1);
|
|
109
|
+
}
|
|
110
|
+
// 3. A mock Test charge.
|
|
111
|
+
const token = clientTokenProvider(session.client_token);
|
|
112
|
+
let paymentId;
|
|
113
|
+
if (!token || token.provider !== "mock") {
|
|
114
|
+
steps.push({ name: "Mock Test charge", status: "NOT RUN",
|
|
115
|
+
detail: `this workspace's Test payments use ${token ? `the ${token.provider} processor` : "a processor the kit can't read"}, not Relyon's Test mock processor, so check can't charge without a person entering a card. This step is not passed.`,
|
|
116
|
+
fix: "make one Test payment through your own checkout page with the processor's sandbox card, or switch the workspace's Test processor to Relyon's mock in the dashboard, then rerun check." });
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
try {
|
|
120
|
+
const payment = await payments.charge({
|
|
121
|
+
amount: CHECK_AMOUNT, currency, orderReference, description: "Relyon kit check (Test mock charge)",
|
|
122
|
+
// The Test mock processor's opaque token, exactly what Test card fields return. No card data.
|
|
123
|
+
paymentMethod: { type: "hosted_card", payment_session: token.paymentSession, encrypted_data: "mock-encrypted-card", key_id: "mock-key" },
|
|
124
|
+
});
|
|
125
|
+
paymentId = payment.id;
|
|
126
|
+
if (payment.status === "succeeded") {
|
|
127
|
+
steps.push({ name: "Mock Test charge", status: "PASS", detail: `Test payment ${payment.id} succeeded on the mock processor.` });
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const reason = typeof payment.failure_message === "string" ? payment.failure_message : typeof payment.failure_code === "string" ? payment.failure_code : "declined";
|
|
131
|
+
steps.push({ name: "Mock Test charge", status: "FAIL", detail: `Test payment ${payment.id} failed: ${reason}.`,
|
|
132
|
+
fix: `rerun \`${command} check\`; if it fails again, check the workspace's Test processor settings in the dashboard.` });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
steps.push({ name: "Mock Test charge", status: "FAIL", detail: describe(error),
|
|
137
|
+
fix: `rerun \`${command} check\` (a Test charge never moves money).` });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// 4. A webhook signature.
|
|
141
|
+
const secret = options.webhookSecret?.trim();
|
|
142
|
+
if (webhookSelfTest(secret || randomBytes(24).toString("base64url"))) {
|
|
143
|
+
steps.push({ name: "Webhook signature", status: "PASS", detail: secret
|
|
144
|
+
? "a body signed with RELYON_WEBHOOK_SECRET verifies, and a tampered one is refused."
|
|
145
|
+
: "the kit's verifier accepts a correctly signed body and refuses a tampered one. After you register your webhook endpoint, set RELYON_WEBHOOK_SECRET so the app verifies Relyon's deliveries." });
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
steps.push({ name: "Webhook signature", status: "FAIL", detail: "a correctly signed body did not verify.",
|
|
149
|
+
fix: "reinstall the kit with your package manager, then rerun check." });
|
|
150
|
+
}
|
|
151
|
+
return finish(steps.every((step) => step.status === "PASS") ? 0 : 1, [], paymentId);
|
|
152
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** Who a checklist step belongs to. */
|
|
2
|
+
export type KitChecklistActor =
|
|
3
|
+
/** The merchant's coding agent can complete and prove it. */
|
|
4
|
+
"agent"
|
|
5
|
+
/** The store owner must answer or publish something (the agent never invents it). */
|
|
6
|
+
| "owner"
|
|
7
|
+
/** Relyon staff act (for example approving Live). */
|
|
8
|
+
| "staff";
|
|
9
|
+
/** Whose observation proves a check done. */
|
|
10
|
+
export type KitChecklistVerifier =
|
|
11
|
+
/** The store kit's doctor, on the store itself (advisory self-report). */
|
|
12
|
+
"kit"
|
|
13
|
+
/** Relyon's own evidence (a doctor run's stored outcomes). */
|
|
14
|
+
| "server";
|
|
15
|
+
/** One check of the store readiness checklist. */
|
|
16
|
+
export interface KitChecklistCheck {
|
|
17
|
+
/** Stable id, never renamed; doctor runs and the dashboard match on it. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Short human title for the dashboard checklist. */
|
|
20
|
+
label: string;
|
|
21
|
+
/** The kit version that introduced the check (manifest tracking starts at 0.1.14). */
|
|
22
|
+
introducedIn: string;
|
|
23
|
+
/** Required checks gate readiness; recommended ones are improvements. */
|
|
24
|
+
level: "required" | "recommended";
|
|
25
|
+
/** Who acts on the step (manifest v2). */
|
|
26
|
+
actor: KitChecklistActor;
|
|
27
|
+
/** Whose observation proves the check done (manifest v2). */
|
|
28
|
+
verifiedBy: KitChecklistVerifier;
|
|
29
|
+
/** What "done" means, in one short sentence (manifest v2). */
|
|
30
|
+
check: string;
|
|
31
|
+
/**
|
|
32
|
+
* The step text: the copyable prompt a merchant hands their coding agent
|
|
33
|
+
* for agent steps; the owner or Relyon-staff action text otherwise.
|
|
34
|
+
*/
|
|
35
|
+
prompt: string;
|
|
36
|
+
/** A narrowly server-classified pending projection can belong to the owner. */
|
|
37
|
+
pendingAction?: {
|
|
38
|
+
actor: "owner";
|
|
39
|
+
prompt: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Absolute ISO date a required check starts to bind, when it must not bind
|
|
43
|
+
* immediately: the dashboard shows it as "needed by" and nothing enforces
|
|
44
|
+
* the check before the date. Absent when the check binds at once.
|
|
45
|
+
*/
|
|
46
|
+
requiredBy?: string;
|
|
47
|
+
}
|
|
48
|
+
/** The cumulative manifest. `manifestVersion` bumps on every addition. */
|
|
49
|
+
export interface KitChecklistManifest {
|
|
50
|
+
manifestVersion: number;
|
|
51
|
+
/** The kit version this manifest ships with. */
|
|
52
|
+
kitVersion: string;
|
|
53
|
+
checks: KitChecklistCheck[];
|
|
54
|
+
}
|
|
55
|
+
export declare const CHECKLIST_MANIFEST_VERSION = 4;
|
|
56
|
+
/** The cumulative checklist manifest this kit ships. */
|
|
57
|
+
export declare const KIT_CHECKLIST_MANIFEST: KitChecklistManifest;
|
|
58
|
+
/** Manifest ids Relyon verifies from its own evidence (a kit report cannot replace them). */
|
|
59
|
+
export declare const SERVER_VERIFIED_CHECK_IDS: ReadonlySet<string>;
|
|
60
|
+
/** Manifest ids only the store kit's doctor can verify, on the store itself. */
|
|
61
|
+
export declare const KIT_VERIFIED_CHECK_IDS: ReadonlySet<string>;
|
|
62
|
+
/**
|
|
63
|
+
* The manifest id of a doctor item by its printed name, or undefined when the
|
|
64
|
+
* name is not a checklist check. Dynamic names are mapped structurally: feed
|
|
65
|
+
* items by their path in STORE_FEED_PATHS, `Relyon doctor: <check>` items by
|
|
66
|
+
* the public check name.
|
|
67
|
+
*/
|
|
68
|
+
export declare function checkIdForItem(name: string): string | undefined;
|
|
69
|
+
/** Numeric x.y.z compare: positive when `a` is the newer kit version. */
|
|
70
|
+
export declare function compareKitVersions(a: string, b: string): number;
|
|
71
|
+
/** A "x.y.z" version string from server metadata, or undefined for anything else. */
|
|
72
|
+
export declare function parseKitVersion(value: string | null | undefined): string | undefined;
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { STORE_FEED_PATHS } from "./feeds.js";
|
|
2
|
+
import { KIT_VERSION } from "./version.js";
|
|
3
|
+
export const CHECKLIST_MANIFEST_VERSION = 4;
|
|
4
|
+
const RERUN = "then re-run npx @relyon/store-kit doctor.";
|
|
5
|
+
/** The four feed checks, one per feed format the kit can serve. */
|
|
6
|
+
const FEED_CHECKS = {
|
|
7
|
+
openai: {
|
|
8
|
+
id: "feed-openai", label: "OpenAI product feed",
|
|
9
|
+
check: "The OpenAI feed answers with one JSONL row per agent-visible product, each linking the store's origin.",
|
|
10
|
+
prompt: `Serve the OpenAI product feed at ${STORE_FEED_PATHS.openai} with one JSONL row per agent-visible product (item_id and a url on the store's own origin), ${RERUN}`,
|
|
11
|
+
},
|
|
12
|
+
openaiGzip: {
|
|
13
|
+
id: "feed-openai-gzip", label: "OpenAI product feed (gzip)",
|
|
14
|
+
check: "The gzipped OpenAI feed answers with one JSONL row per agent-visible product, each linking the store's origin.",
|
|
15
|
+
prompt: `Serve the gzipped OpenAI product feed at ${STORE_FEED_PATHS.openaiGzip} with one JSONL row per agent-visible product (item_id and a url on the store's own origin), ${RERUN}`,
|
|
16
|
+
},
|
|
17
|
+
google: {
|
|
18
|
+
id: "feed-google", label: "Google product feed",
|
|
19
|
+
check: "The Google RSS feed answers with one item per agent-visible product, each linking the store's origin.",
|
|
20
|
+
prompt: `Serve the Google RSS product feed at ${STORE_FEED_PATHS.google} with one item per agent-visible product (g:id and a g:link on the store's own origin), ${RERUN}`,
|
|
21
|
+
},
|
|
22
|
+
microsoft: {
|
|
23
|
+
id: "feed-microsoft", label: "Microsoft product feed",
|
|
24
|
+
check: "The Microsoft RSS feed answers with one item per agent-visible product, each linking the store's origin.",
|
|
25
|
+
prompt: `Serve the Microsoft RSS product feed at ${STORE_FEED_PATHS.microsoft} with one item per agent-visible product (g:id and a g:link on the store's own origin), ${RERUN}`,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const STATIC_CHECKS = [
|
|
29
|
+
{
|
|
30
|
+
id: "store-url", label: "Reachable store URL", introducedIn: "0.1.14", level: "required",
|
|
31
|
+
actor: "agent", verifiedBy: "kit",
|
|
32
|
+
check: "The store answers on its public origin.",
|
|
33
|
+
prompt: `Make the store answer on its public https origin and give the kit that origin as STORE_PUBLIC_URL, ${RERUN}`,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "relyon-key", label: "Relyon API key configured", introducedIn: "0.1.14", level: "required",
|
|
37
|
+
actor: "agent", verifiedBy: "kit",
|
|
38
|
+
check: "A usable Test or Live secret key is configured and reaches Relyon.",
|
|
39
|
+
prompt: "Set RELYON_API_KEY to the store's secret key (run npx @relyon/store-kit init to set up a Test key privately), restart the store's server, "
|
|
40
|
+
+ RERUN,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "ucp-profile", label: "UCP profile served", introducedIn: "0.1.14", level: "required",
|
|
44
|
+
actor: "agent", verifiedBy: "server",
|
|
45
|
+
check: "The store's UCP profile is served on its verified domain with shopping endpoints on that origin.",
|
|
46
|
+
prompt: "Serve the kit's /.well-known/ucp profile on the store's own origin, with every shopping endpoint on that same origin, " + RERUN,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "cart-transfer", label: "UCP cart transfer", introducedIn: "0.1.14", level: "recommended",
|
|
50
|
+
actor: "agent", verifiedBy: "kit",
|
|
51
|
+
check: "An agent's cart transfers into the store's own checkout with a prefilled link.",
|
|
52
|
+
prompt: "Let agents transfer a cart into the store's own checkout: the kit's POST /ucp/carts answers on the store's origin and hands the shopper a prefilled checkout link, "
|
|
53
|
+
+ RERUN,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "domain-verification", label: "Domain verification file", introducedIn: "0.1.14", level: "required",
|
|
57
|
+
actor: "agent", verifiedBy: "server",
|
|
58
|
+
check: "Relyon reports the matching hostname verified and its verification file serves the matching value.",
|
|
59
|
+
prompt: "Call kit.ensureDomain() and serve its verification value at /.well-known/relyon-verification, then call kit.verifyDomain(domain.hostname) using the returned domain's hostname (never its id), "
|
|
60
|
+
+ RERUN,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "llms-txt", label: "llms.txt discovery file", introducedIn: "0.1.14", level: "required",
|
|
64
|
+
actor: "agent", verifiedBy: "server",
|
|
65
|
+
check: "llms.txt links the UCP profile, MCP server and one product sitemap, all on the store's domain.",
|
|
66
|
+
prompt: "Serve /llms.txt linking the store's /.well-known/ucp, /mcp and exactly one product sitemap, all on the store's own origin, " + RERUN,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "product-sitemap", label: "Product sitemap", introducedIn: "0.1.14", level: "required",
|
|
70
|
+
actor: "agent", verifiedBy: "server",
|
|
71
|
+
check: "The product sitemap lists every agent-visible product page URL on the store's domain.",
|
|
72
|
+
prompt: "Serve the product sitemap XML listing every agent-visible product page URL on the store's own origin, " + RERUN,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "checkout-page", label: "Checkout page for shoppers", introducedIn: "0.1.14", level: "required",
|
|
76
|
+
actor: "agent", verifiedBy: "kit",
|
|
77
|
+
check: "The store's checkout page answers 200 and shows the kit's checkout marker.",
|
|
78
|
+
prompt: "Serve the store's own checkout page with a 200 at the kit's paths.checkout (default /checkout) and show the kit's checkout marker on it, " + RERUN,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "product-pages", label: "Product pages answer 200", introducedIn: "0.1.14", level: "required",
|
|
82
|
+
actor: "agent", verifiedBy: "kit",
|
|
83
|
+
check: "Each sampled product page answers 200 on the store's origin.",
|
|
84
|
+
prompt: "Serve each agent-visible product's page at its url with a 200 on the store's origin (or fix the product's url), " + RERUN,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "product-feeds", label: "Product feeds selected", introducedIn: "0.1.14", level: "required",
|
|
88
|
+
actor: "agent", verifiedBy: "server",
|
|
89
|
+
check: "At least one feed format is selected and the feeds answer on the store's domain.",
|
|
90
|
+
prompt: "Select at least one feed format in createStoreKit (for example feeds: { formats: [\"openai\", \"google\"] }) so llms.txt advertises the feeds, " + RERUN,
|
|
91
|
+
},
|
|
92
|
+
...Object.keys(FEED_CHECKS).map((format) => ({
|
|
93
|
+
id: FEED_CHECKS[format].id, label: FEED_CHECKS[format].label, introducedIn: "0.1.14",
|
|
94
|
+
level: "required", actor: "agent", verifiedBy: "kit",
|
|
95
|
+
check: FEED_CHECKS[format].check, prompt: FEED_CHECKS[format].prompt,
|
|
96
|
+
})),
|
|
97
|
+
{
|
|
98
|
+
id: "feeds-completeness", label: "Feeds list every product", introducedIn: "0.1.14", level: "recommended",
|
|
99
|
+
actor: "agent", verifiedBy: "kit",
|
|
100
|
+
check: "Every product page in the sitemap is listed in each selected feed.",
|
|
101
|
+
prompt: "List every agent-visible product in the selected feeds (see the feeds section of .agents/skills/relyon-catalog/SKILL.md and log feeds.onDiagnostic in createStoreKit to see what is omitted and why), "
|
|
102
|
+
+ RERUN,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "mcp-initialize", label: "MCP server answers initialize", introducedIn: "0.1.14", level: "required",
|
|
106
|
+
actor: "agent", verifiedBy: "server",
|
|
107
|
+
check: "The kit's MCP server answers initialize on the store's domain.",
|
|
108
|
+
prompt: "Mount the kit's /mcp server so it answers MCP initialize with a protocolVersion and serverInfo, " + RERUN,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "product-variants", label: "Product variants listed", introducedIn: "0.1.14", level: "recommended",
|
|
112
|
+
actor: "agent", verifiedBy: "kit",
|
|
113
|
+
check: "Products with options list each purchasable variant to agents.",
|
|
114
|
+
prompt: "List each purchasable variant of products with options in the kit's MCP search_products answers so agents can name a variant when they buy, " + RERUN,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "ucp-checkout", label: "UCP checkout route", introducedIn: "0.1.14", level: "required",
|
|
118
|
+
actor: "agent", verifiedBy: "kit",
|
|
119
|
+
check: "The kit itself answers UCP checkout at /ucp.",
|
|
120
|
+
prompt: "Mount the kit's UCP checkout route at /ucp (mount storeKitMiddleware, every kit route, before the app's own routes and any catch-all), " + RERUN,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "acp-checkout", label: "ACP checkout route", introducedIn: "0.1.14", level: "required",
|
|
124
|
+
actor: "agent", verifiedBy: "kit",
|
|
125
|
+
check: "The kit itself answers ACP checkout.",
|
|
126
|
+
prompt: "Mount the kit's ACP checkout route (default /acp) so the kit itself answers it, " + RERUN,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: "webhook-route", label: "Webhook route", introducedIn: "0.1.14", level: "required",
|
|
130
|
+
actor: "agent", verifiedBy: "server",
|
|
131
|
+
check: "The kit's webhook route answers, refuses unsigned events, and the running store proves its signing secret with a signed challenge.",
|
|
132
|
+
prompt: "Mount the kit's webhook route (default /relyon/webhooks) so Relyon can deliver order and rule events, and register it after publish with npx @relyon/store-kit webhook, "
|
|
133
|
+
+ RERUN,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "agent-card", label: "Agent card", introducedIn: "0.1.14", level: "recommended",
|
|
137
|
+
actor: "agent", verifiedBy: "kit",
|
|
138
|
+
check: "The agent card is served on the store's origin whenever llms.txt advertises it.",
|
|
139
|
+
prompt: "Serve the kit's agent card at /.well-known/agent-card.json on the store's origin when llms.txt advertises it (or leave it unadvertised), " + RERUN,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: "robots-txt", label: "robots.txt allows AI crawlers", introducedIn: "0.1.14", level: "recommended",
|
|
143
|
+
actor: "agent", verifiedBy: "server",
|
|
144
|
+
check: "robots.txt allows the AI discovery crawlers on the store's domain.",
|
|
145
|
+
prompt: "Allow the AI discovery crawlers in /robots.txt for /, /llms.txt, the product sitemap, /.well-known/ucp and /mcp (see mergeAiRobots in the kit README), " + RERUN,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "unknown-paths", label: "Unknown paths return 404", introducedIn: "0.1.14", level: "recommended",
|
|
149
|
+
actor: "agent", verifiedBy: "kit",
|
|
150
|
+
check: "A random unknown path does not answer 200.",
|
|
151
|
+
prompt: "Return 404 for unknown non-page paths so agents can tell what is missing; a catch-all that answers 200 hides missing kit routes, " + RERUN,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: "kit-mount", label: "Kit always mounted", introducedIn: "0.1.14", level: "recommended",
|
|
155
|
+
actor: "agent", verifiedBy: "kit",
|
|
156
|
+
check: "The kit is created and mounted unconditionally, not only when RELYON_API_KEY is set.",
|
|
157
|
+
prompt: "Create and mount the store kit unconditionally, not only when RELYON_API_KEY is set, so the discovery routes answer while the kit waits for a key, " + RERUN,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "relyon-doctor", label: "Relyon doctor passes", introducedIn: "0.1.14", level: "required",
|
|
161
|
+
actor: "agent", verifiedBy: "server",
|
|
162
|
+
check: "Relyon's integration doctor reports no agent-actionable failure for the store.",
|
|
163
|
+
prompt: `Run npx @relyon/store-kit doctor and resolve every failure its "Relyon doctor" items report, ${RERUN}`,
|
|
164
|
+
},
|
|
165
|
+
...["keys", "webhook", "catalog", "pricing", "checkout"].map((check) => ({
|
|
166
|
+
id: `relyon-doctor-${check}`,
|
|
167
|
+
label: `Relyon doctor: ${check} check`,
|
|
168
|
+
introducedIn: "0.1.14", level: "required",
|
|
169
|
+
actor: "agent", verifiedBy: "server",
|
|
170
|
+
check: `Relyon's ${check} check passes or is not applicable to this store.`,
|
|
171
|
+
prompt: `Resolve Relyon's ${check} check as the kit's doctor reports it (npx @relyon/store-kit doctor), ${RERUN}`,
|
|
172
|
+
...(check === "catalog" ? { pendingAction: { actor: "owner", prompt: "Answer the questions in Store policies complete below; this policy-only finding needs no technical catalog repair." } } : {}),
|
|
173
|
+
})),
|
|
174
|
+
{
|
|
175
|
+
id: "store-policies", label: "Store policies complete", introducedIn: "0.1.14", level: "required",
|
|
176
|
+
actor: "owner", verifiedBy: "server",
|
|
177
|
+
check: "The store's returns and support policies are recorded in Relyon.",
|
|
178
|
+
prompt: "What is your returns window? Who pays return shipping and what is the cost? What is your returns policy page URL? Which support email or support page should shoppers use? Your coding agent records only your confirmed answers with kit.syncStorePolicies and never invents them, "
|
|
179
|
+
+ RERUN,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: "policy-pages", label: "Policy pages exist", introducedIn: "0.1.14", level: "recommended",
|
|
183
|
+
actor: "owner", verifiedBy: "kit",
|
|
184
|
+
check: "Every policy page the store's policies link to answers on the store.",
|
|
185
|
+
prompt: "Publish the pages the store's policy links point at (or point each policy at the store's real page), " + RERUN,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: "live-readiness", label: "Live readiness", introducedIn: "0.1.14", level: "recommended",
|
|
189
|
+
actor: "staff", verifiedBy: "kit",
|
|
190
|
+
check: "The store is published on its verified domain and Relyon staff have approved Live.",
|
|
191
|
+
prompt: "Complete the go-live steps in the Relyon dashboard: publish the store on its verified domain and request Live (Relyon staff approve Live).",
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
id: "ai-agent-checkout", label: "AI-agent checkout", introducedIn: "0.1.28", level: "recommended",
|
|
195
|
+
actor: "agent", verifiedBy: "kit",
|
|
196
|
+
check: "Agent checkout tools are offered and agents are told an agent credential (agt_…) is required and where the merchant issues one.",
|
|
197
|
+
prompt: "Keep the kit's checkout tools discoverable with their credential guidance (tools/list, the agent card and llms.txt all state that an agent credential is required and that merchants issue one in the Relyon dashboard under AI agents → Credentials), " + RERUN,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "test-checkout-confirmed", label: "Test checkout confirmed by Relyon", introducedIn: "0.1.14", level: "required",
|
|
201
|
+
actor: "agent", verifiedBy: "kit",
|
|
202
|
+
check: "Relyon has recorded one completed Test checkout for the store.",
|
|
203
|
+
prompt: "Complete one Test checkout yourself with npx @relyon/store-kit test-checkout (one Test purchase through the store kit; no card data), so Relyon records it, then re-run npx @relyon/store-kit doctor.",
|
|
204
|
+
},
|
|
205
|
+
// Brief 84c dashboard-completeness checks: computed from Core's own records
|
|
206
|
+
// for the run's store and relayed by the kit — never kit-local verdicts.
|
|
207
|
+
{
|
|
208
|
+
id: "dashboard-workspace", label: "Store registered in this workspace", introducedIn: "0.1.37", level: "required",
|
|
209
|
+
actor: "agent", verifiedBy: "server",
|
|
210
|
+
check: "The store is a named store in the reporting workspace.",
|
|
211
|
+
prompt: "Create the store in the Relyon dashboard (or report for the workspace's default store), " + RERUN,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
id: "dashboard-webhook-receiving", label: "Webhook endpoint receiving deliveries", introducedIn: "0.1.37", level: "required",
|
|
215
|
+
actor: "agent", verifiedBy: "server",
|
|
216
|
+
check: "One active webhook endpoint for the store points at its current verified domain, has answered 2xx to a delivery, and has no signature refusals since the last secret change.",
|
|
217
|
+
prompt: "Register or fix the store's webhook with npx @relyon/store-kit webhook, " + RERUN,
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
id: "dashboard-orders-reconciled", label: "Store orders match Relyon's records", introducedIn: "0.1.37", level: "required",
|
|
221
|
+
actor: "agent", verifiedBy: "server",
|
|
222
|
+
check: "The kit-reported store_orders_summary equals Relyon's paid Test orders for the store.",
|
|
223
|
+
prompt: "Update @relyon/store-kit so the kit reports its store_orders_summary and make every paid Test checkout produce a store order, " + RERUN,
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
id: "dashboard-checkouts-recorded", label: "Test checkouts recorded", introducedIn: "0.1.37", level: "required",
|
|
227
|
+
actor: "agent", verifiedBy: "server",
|
|
228
|
+
check: "Relyon has recorded at least one Test checkout for the store, and at least as many checkouts as agent hand-offs opened.",
|
|
229
|
+
prompt: "Run a Test checkout on the store with the kit, " + RERUN,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: "dashboard-catalog-ready", label: "Catalog ready for agents", introducedIn: "0.1.37", level: "required",
|
|
233
|
+
actor: "owner", verifiedBy: "server",
|
|
234
|
+
check: "The store's catalog validates at 90% readiness or better with no error-severity issues.",
|
|
235
|
+
prompt: "Fix the catalog issues named by POST /v1/catalog/validate (or answer the store's policy questions), " + RERUN,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: "dashboard-visits", label: "Agent visits recorded", introducedIn: "0.1.37", level: "required",
|
|
239
|
+
actor: "agent", verifiedBy: "server",
|
|
240
|
+
check: "Relyon has recorded at least one genuine agent visit for the store.",
|
|
241
|
+
prompt: "Send genuine Test agent traffic through the store (a crawl, profile read or hand-off), " + RERUN,
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
id: "dashboard-complete", label: "Dashboard complete", introducedIn: "0.1.37", level: "required",
|
|
245
|
+
actor: "agent", verifiedBy: "server",
|
|
246
|
+
check: "Every required checklist and dashboard row passes for the store.",
|
|
247
|
+
prompt: "Complete the outstanding rows named in the doctor's dashboard section, " + RERUN,
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: "cart-page", label: "Cart page for shoppers", introducedIn: "0.1.50", level: "required",
|
|
251
|
+
actor: "agent", verifiedBy: "kit",
|
|
252
|
+
check: "The store serves a real cart page with a checkout link.",
|
|
253
|
+
prompt: "Serve a real /cart page that answers 200, lists the cart's lines and links to checkout (a drawer alone is not enough), then re-run npx @relyon/store-kit doctor.",
|
|
254
|
+
},
|
|
255
|
+
];
|
|
256
|
+
/** The cumulative checklist manifest this kit ships. */
|
|
257
|
+
export const KIT_CHECKLIST_MANIFEST = {
|
|
258
|
+
manifestVersion: CHECKLIST_MANIFEST_VERSION,
|
|
259
|
+
kitVersion: KIT_VERSION,
|
|
260
|
+
checks: STATIC_CHECKS,
|
|
261
|
+
};
|
|
262
|
+
/** Manifest ids Relyon verifies from its own evidence (a kit report cannot replace them). */
|
|
263
|
+
export const SERVER_VERIFIED_CHECK_IDS = new Set(KIT_CHECKLIST_MANIFEST.checks.filter((check) => check.verifiedBy === "server").map((check) => check.id));
|
|
264
|
+
/** Manifest ids only the store kit's doctor can verify, on the store itself. */
|
|
265
|
+
export const KIT_VERIFIED_CHECK_IDS = new Set(KIT_CHECKLIST_MANIFEST.checks.filter((check) => check.verifiedBy === "kit").map((check) => check.id));
|
|
266
|
+
const STATIC_ITEM_IDS = {
|
|
267
|
+
"store URL": "store-url",
|
|
268
|
+
"Relyon key": "relyon-key",
|
|
269
|
+
"/.well-known/ucp": "ucp-profile",
|
|
270
|
+
"cart transfer": "cart-transfer",
|
|
271
|
+
"relyon-verification": "domain-verification",
|
|
272
|
+
"llms.txt": "llms-txt",
|
|
273
|
+
"product sitemap": "product-sitemap",
|
|
274
|
+
"checkout page": "checkout-page",
|
|
275
|
+
"cart page": "cart-page",
|
|
276
|
+
"product pages": "product-pages",
|
|
277
|
+
"product feeds": "product-feeds",
|
|
278
|
+
"products missing from feeds": "feeds-completeness",
|
|
279
|
+
"/mcp initialize": "mcp-initialize",
|
|
280
|
+
"product variants": "product-variants",
|
|
281
|
+
"/ucp checkout": "ucp-checkout",
|
|
282
|
+
"/acp checkout": "acp-checkout",
|
|
283
|
+
"webhook route": "webhook-route",
|
|
284
|
+
"agent card": "agent-card",
|
|
285
|
+
"AI-agent checkout": "ai-agent-checkout",
|
|
286
|
+
"robots.txt": "robots-txt",
|
|
287
|
+
"unknown paths": "unknown-paths",
|
|
288
|
+
"kit mount": "kit-mount",
|
|
289
|
+
"Relyon doctor": "relyon-doctor",
|
|
290
|
+
"store policies": "store-policies",
|
|
291
|
+
"policy pages": "policy-pages",
|
|
292
|
+
"Live readiness": "live-readiness",
|
|
293
|
+
"Test checkout confirmed by Relyon": "test-checkout-confirmed",
|
|
294
|
+
// Brief 84c dashboard rows, printed by the kit relay under their manifest labels.
|
|
295
|
+
"Store registered in this workspace": "dashboard-workspace",
|
|
296
|
+
"Webhook endpoint receiving deliveries": "dashboard-webhook-receiving",
|
|
297
|
+
"Store orders match Relyon's records": "dashboard-orders-reconciled",
|
|
298
|
+
"Test checkouts recorded": "dashboard-checkouts-recorded",
|
|
299
|
+
"Catalog ready for agents": "dashboard-catalog-ready",
|
|
300
|
+
"Agent visits recorded": "dashboard-visits",
|
|
301
|
+
"Dashboard complete": "dashboard-complete",
|
|
302
|
+
};
|
|
303
|
+
const RELYON_DOCTOR_ITEM = /^Relyon doctor: (keys|webhook|catalog|pricing|checkout)$/;
|
|
304
|
+
/**
|
|
305
|
+
* The manifest id of a doctor item by its printed name, or undefined when the
|
|
306
|
+
* name is not a checklist check. Dynamic names are mapped structurally: feed
|
|
307
|
+
* items by their path in STORE_FEED_PATHS, `Relyon doctor: <check>` items by
|
|
308
|
+
* the public check name.
|
|
309
|
+
*/
|
|
310
|
+
export function checkIdForItem(name) {
|
|
311
|
+
const staticId = STATIC_ITEM_IDS[name];
|
|
312
|
+
if (staticId)
|
|
313
|
+
return staticId;
|
|
314
|
+
if (name.startsWith("feed ")) {
|
|
315
|
+
const path = name.slice("feed ".length);
|
|
316
|
+
for (const format of Object.keys(STORE_FEED_PATHS)) {
|
|
317
|
+
if (STORE_FEED_PATHS[format] === path)
|
|
318
|
+
return FEED_CHECKS[format].id;
|
|
319
|
+
}
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
const relyonCheck = RELYON_DOCTOR_ITEM.exec(name);
|
|
323
|
+
if (relyonCheck)
|
|
324
|
+
return `relyon-doctor-${relyonCheck[1]}`;
|
|
325
|
+
return undefined;
|
|
326
|
+
}
|
|
327
|
+
/** Numeric x.y.z compare: positive when `a` is the newer kit version. */
|
|
328
|
+
export function compareKitVersions(a, b) {
|
|
329
|
+
const pa = a.split(".").map(Number);
|
|
330
|
+
const pb = b.split(".").map(Number);
|
|
331
|
+
for (let i = 0; i < 3; i++) {
|
|
332
|
+
const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
|
|
333
|
+
if (diff)
|
|
334
|
+
return diff;
|
|
335
|
+
}
|
|
336
|
+
return 0;
|
|
337
|
+
}
|
|
338
|
+
/** A "x.y.z" version string from server metadata, or undefined for anything else. */
|
|
339
|
+
export function parseKitVersion(value) {
|
|
340
|
+
return value && /^\d+\.\d+\.\d+$/.test(value) ? value : undefined;
|
|
341
|
+
}
|