Public: anyone can read this; the crew can change it.
Revert "Front page and /pricing: no vendor recommended, no stale anchor, no "not on sale yet"" #14296
Check · Review · Land · Live — It conflicts with its base.
revert-14292 → main 1 commit
This pull asks to reach lab--forge-trevato-apps.open-platform.sh. Its preview and check reach what main reaches; the new host opens when the pull lands.
9 files
changed +31
−65
src/actions/order.ts +1 −1
| @@ -34,7 +34,7 @@ export interface Refusal { | ||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | const ADDRESS = /^[^\s<>@,;:"\\]{1,64}@[^\s<>@,;:"\\]{1,190}$/; |
| 37 | export const NO_PROVIDER = "Checkout is not connected on this forge: ask the operator."; | |
| 37 | export const NO_PROVIDER = "Paid plans are not on sale here yet: ask the operator."; | |
| 38 | 38 | /** A spawn that stays `spawning` this long is taken as lost and may be retried. */ |
| 39 | 39 | const STALE_MS = 5 * 60_000; |
| 40 | 40 | /** A claim link is mailed again at most once a day per order: a stranger cannot make it a mail-bomb. */ |
src/tui/screens/pricing.ts +1 −1
| @@ -146,7 +146,7 @@ export function pricingScreen(f: Session, ctx: Ctx): Screen { | ||
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | const selling = checkoutOf(f.app) !== undefined; |
| 149 | line(selling ? `${priceLine(plans())}. Pick a plan, name it, pay. Free: use Start my forge.` : "Plans. Checkout is not connected here: ask the operator.", c.mutedFg); | |
| 149 | line(selling ? `${priceLine(plans())}. Pick a plan, name it, pay. Free: use Start my forge.` : "Plans. Paid plans are not on sale here yet: ask the operator.", c.mutedFg); | |
| 150 | 150 | y++; |
| 151 | 151 | const list = paid(); |
| 152 | 152 | for (const p of plans()) { |
src/web/pages/pricing.ts +6 −16
| @@ -2,15 +2,14 @@ | ||
| 2 | 2 | * `/pricing` (#11138): the sale. A visitor with no account picks a plan, names |
| 3 | 3 | * the forge, gives an email and pays at the provider's checkout; a minute |
| 4 | 4 | * later `/pricing/done` shows the claim link, once. The free plan goes on to |
| 5 | * `/forges/new`. With no provider connected a paid plan with a buy link set | |
| 6 | * (`settings/billing.ts`) carries the same "Get <plan>" link the home shows, and | |
| 7 | * one without says whom to ask. The rules are in `actions/order.ts`. | |
| 5 | * `/forges/new`. With no provider connected the paid plans show their size and | |
| 6 | * say "ask the operator". The rules are in `actions/order.ts`. | |
| 8 | 7 | */ |
| 9 | 8 | |
| 10 | 9 | import { setCookie } from "../../auth/cookies.ts"; |
| 11 | 10 | import { deliverLink, mayView, NO_PROVIDER, placeOrder, reconcileOrder, resendLink, type Refusal } from "../../actions/order.ts"; |
| 12 | 11 | import { lapseRule, lapseRuleWords } from "../../billing/lapse_rule.ts"; |
| 13 | import { AFTER_PAYMENT_STEPS, planWords, priceLine } from "../../billing/plan_words.ts"; | |
| 12 | import { AFTER_PAYMENT_STEPS, priceLine } from "../../billing/plan_words.ts"; | |
| 14 | 13 | import { checkoutOf } from "../../billing/checkout.ts"; |
| 15 | 14 | import { notePhase, takeSessionTime } from "../../core/route_timing.ts"; |
| 16 | 15 | import { cookieValue, type Ctx } from "../../http/context.ts"; |
| @@ -19,7 +18,6 @@ import { clientBucket } from "../../http/peer.ts"; | ||
| 19 | 18 | import { takeDoor } from "../../http/strangers.ts"; |
| 20 | 19 | import { FREE, getPlans, type Plan } from "../../settings/plans.ts"; |
| 21 | 20 | import { sizeWords } from "../../settings/billing.ts"; |
| 22 | import { getDoorSettings } from "../../settings/door.ts"; | |
| 23 | 21 | import { childHost } from "../../spawn/door.ts"; |
| 24 | 22 | import { notFoundPage, pageHead } from "../chrome.ts"; |
| 25 | 23 | import { field, readForm } from "../form.ts"; |
| @@ -48,24 +46,16 @@ function plansView(ctx: Ctx, values: Values, errors: Partial<Record<Refusal["fie | ||
| 48 | 46 | const held = (cookieValue(ctx.request, COOKIE) ?? "").split(".")[0] ?? ""; |
| 49 | 47 | const ordered = /^ord_[0-9a-f]{32}$/.test(held) ? held : undefined; |
| 50 | 48 | const selling = checkoutOf(ctx.app) !== undefined; |
| 51 | // The plans and the home's buy links in one statement (`settings/door.ts`); without a provider, | |
| 52 | // those links (one source, `planWords`) are how a paid plan is bought. | |
| 53 | const door = getDoorSettings(ctx.app.db); | |
| 54 | const plans = door.plans; | |
| 49 | const plans = getPlans(ctx.app.db); | |
| 55 | 50 | const rule = lapseRule(ctx.app.db); |
| 56 | const links = selling ? {} : door.links; | |
| 57 | const buyable = selling || plans.some((p) => planWords(p, links).buy !== undefined); | |
| 58 | 51 | const rows = plans.map((p: Plan) => { |
| 59 | 52 | const free = p.key === FREE; |
| 60 | 53 | const paid = !free && selling; |
| 61 | const buy = planWords(p, links).buy; | |
| 62 | 54 | const price = free |
| 63 | 55 | ? html`<span data-price>Free</span>` |
| 64 | 56 | : paid |
| 65 | 57 | ? html`<span data-price>$${p.priceUsd} a month</span>` |
| 66 | : buy !== undefined | |
| 67 | ? html`<span data-price>$${p.priceUsd} a month</span> <a href="${buy}" data-buy rel="noopener noreferrer" target="_blank">Get ${p.name}</a>` | |
| 68 | : html`<span data-price>$${p.priceUsd} a month</span> <span class="muted">ask the operator · for organizations, <a href="https://www.espodev.com">EspoDev</a></span>`; | |
| 58 | : html`<span data-price>$${p.priceUsd} a month</span> <span class="muted">not on sale yet · ask the operator</span>`; | |
| 69 | 59 | const act = free ? btn(START_BUTTON, { formaction: "/forges/start" }) : paid ? btn(`Get ${p.name}`, { name: "plan", value: p.key, variant: "primary" }) : null; |
| 70 | 60 | const credit = `${p.creditUsd > 0 ? ` $${p.creditUsd} of crew credit each month.` : ""} Up to ${p.forges} ${p.forges === 1 ? "forge" : "forges"}.`; |
| 71 | 61 | return planOfferRow({ key: p.key, name: p.name, says: `${sizeWords(p.size)}. ${p.says}${credit}`, price, action: act }); |
| @@ -96,7 +86,7 @@ function plansView(ctx: Ctx, values: Values, errors: Partial<Record<Refusal["fie | ||
| 96 | 86 | <dl class="status-rows">${rows}</dl> |
| 97 | 87 | </form> |
| 98 | 88 | <div class="muted small" data-after-pay> |
| 99 | <p>${buyable ? "After you pay:" : "How a paid plan is set up:"}</p> | |
| 89 | <p>${selling ? "After you pay:" : "Once paid plans are on sale, this is what happens after you pay:"}</p> | |
| 100 | 90 | <ol>${AFTER_PAYMENT_STEPS.map((l) => html`<li>${l}</li>`)}</ol> |
| 101 | 91 | <p data-lapse="sleep" data-grace-days="${rule.graceDays}">${lapseRuleWords(rule)} <span data-legal><a href="/terms">Terms</a> · <a href="/privacy">Privacy</a></span></p> |
| 102 | 92 | </div> |
src/web/studio/home.ts +9 −6
| @@ -675,7 +675,7 @@ export function packPresses(all: readonly Pack[]): Html | null { | ||
| 675 | 675 | </div>`; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | /** The page the prompt sends an assistant to, and the door's "How assistants connect" link. */ | |
| 678 | /** The page the prompt and the Open in Claude, ChatGPT and Grok links send an assistant to. */ | |
| 679 | 679 | const AGENTS = "/agents"; |
| 680 | 680 | |
| 681 | 681 | /** |
| @@ -731,6 +731,7 @@ export function studioDoor(ctx: Ctx): Response { | ||
| 731 | 731 | // Closed is a door with nothing behind it; invite still lands an invite link's holder. |
| 732 | 732 | const origin = (ctx.app.config.url ?? ctx.url.origin).replace(/\/$/, ""); |
| 733 | 733 | const prompt = agentPrompt(origin); |
| 734 | const asked = encodeURIComponent(prompt); | |
| 734 | 735 | // A claimed hosted forge is someone's: its stranger is told whose, not sold the product (#13795). |
| 735 | 736 | const owner = visitor && ctx.url.pathname === "/" ? forgeOwner(ctx.app.db, ctx.app.config.dataDir) : undefined; |
| 736 | 737 | if (owner !== undefined) return claimedDoor(ctx, owner, tiles); |
| @@ -739,7 +740,7 @@ export function studioDoor(ctx: Ctx): Response { | ||
| 739 | 740 | <h1>Software for what you're building.<br /><span class="muted">Yours to keep.</span></h1> |
| 740 | 741 | <div class="door-under"> |
| 741 | 742 | <div class="door-lead"> |
| 742 | <p class="door-support">Your own workspace: say what you need and a private AI crew builds it, free to try.</p> | |
| 743 | <p class="door-support">Say what you need and an AI crew builds it in your own forge, free to try.</p> | |
| 743 | 744 | <form method="post" action="/forges/start" class="door-start" id="start-forge"> |
| 744 | 745 | ${refusal === undefined ? null : html`<p class="error" id="start-refused">${startRefusalWords(refusal, startWaitIn(ctx.url.searchParams))}</p>`} |
| 745 | 746 | <div class="field"> |
| @@ -752,9 +753,11 @@ export function studioDoor(ctx: Ctx): Response { | ||
| 752 | 753 | ${when(made.length > 0, () => html`<div class="bar">${btn("See what it built", { href: "#made", size: "lg" })}</div>`)} |
| 753 | 754 | <div class="door-agent"> |
| 754 | 755 | <p> |
| 755 | Connect your AI assistant: give it this message, or add <code>${origin}/mcp</code> as an MCP server | |
| 756 | <span class="muted">(after you sign in)</span>. | |
| 757 | <a href="${AGENTS}">How assistants connect</a> | |
| 756 | Have an AI assistant? Give it this: | |
| 757 | <a href="https://claude.ai/new?q=${asked}" rel="noopener">Open in Claude</a> <span class="muted">(recommended)</span> | |
| 758 | <a href="https://chatgpt.com/?q=${asked}" rel="noopener">Open in ChatGPT</a> | |
| 759 | <a href="https://grok.com/?q=${asked}" rel="noopener">Open in Grok</a> | |
| 760 | <span class="muted">(after you sign in)</span> | |
| 758 | 761 | </p> |
| 759 | 762 | ${copyField("door-prompt", prompt, "A message for any AI assistant", "Copy the message")} |
| 760 | 763 | </div> |
| @@ -854,7 +857,7 @@ bun run src/main.ts</code></pre> | ||
| 854 | 857 | </div> |
| 855 | 858 | </section> |
| 856 | 859 | <p class="door-org"> |
| 857 | For organizations: <a href="https://www.open-platform.sh/">Open Platform</a> runs on your own cloud, and | |
| 860 | Running this for a team? <a href="https://www.open-platform.sh/#platform">The Platform</a> runs on your own cloud, and | |
| 858 | 861 | <a href="https://www.espodev.com">EspoDev</a> delivers enterprise implementations. |
| 859 | 862 | </p> |
| 860 | 863 | ${when(admin, () => html`<div class="door-section front-admin">${frontControls(ctx, front)}</div>`)} |
test/pricing-after-pay.test.ts +1 −2
| @@ -47,8 +47,7 @@ test("under the form: three steps in order, after the form, then the lapse rule | ||
| 47 | 47 | test("with no provider the steps are said as what will happen, not as a promise", async () => { |
| 48 | 48 | useCheckout(app, undefined); |
| 49 | 49 | const body = await (await fetch(`${servers.url}/pricing`)).text(); |
| 50 | expect(body).toContain("How a paid plan is set up:"); | |
| 51 | expect(body).not.toContain("on sale"); | |
| 50 | expect(body).toContain("Once paid plans are on sale"); | |
| 52 | 51 | expect(body).not.toContain("<p>After you pay:</p>"); |
| 53 | 52 | for (const step of AFTER_PAYMENT_STEPS) expect(body).toContain(escapeHtml(step)); |
| 54 | 53 | }); |
test/pricing-order.test.ts +1 −3
| @@ -187,9 +187,7 @@ describe("/pricing", () => { | ||
| 187 | 187 | test("with no provider the paid plans say ask the operator and a post builds nothing", async () => { |
| 188 | 188 | useCheckout(app, undefined); |
| 189 | 189 | const text = await (await fetch(`${base}/pricing`)).text(); |
| 190 | expect(text).toContain("ask the operator · for organizations"); | |
| 191 | expect(text).toContain('href="https://www.espodev.com"'); | |
| 192 | expect(text).not.toContain("not on sale"); | |
| 190 | expect(text).toContain("not on sale yet · ask the operator"); | |
| 193 | 191 | expect(text).toContain("$19 a month"); |
| 194 | 192 | expect((await fetch(`${base}/pricing/order`, form({ name: "nope", plan: "small", email: "[email protected]" }))).status).toBe(409); |
| 195 | 193 | useCheckout(app, fake); |
test/pricing-plans-agree.test.ts +1 −28
| @@ -5,8 +5,6 @@ import { tmpdir } from "node:os"; | ||
| 5 | 5 | import { join } from "node:path"; |
| 6 | 6 | import { createApp, type App } from "../src/app.ts"; |
| 7 | 7 | import { serve, type Servers } from "../src/http/server.ts"; |
| 8 | import { setBillingLinks } from "../src/settings/billing.ts"; | |
| 9 | import { getPlans } from "../src/settings/plans.ts"; | |
| 10 | 8 | |
| 11 | 9 | let dir: string; |
| 12 | 10 | let app: App; |
| @@ -35,32 +33,7 @@ test("every plan's card shows the price, credit and forge count the API lists", | ||
| 35 | 33 | else expect(card).not.toContain("crew credit"); |
| 36 | 34 | expect(card).toContain(`Up to ${p.forges} ${p.forges === 1 ? "forge" : "forges"}`); |
| 37 | 35 | if (p.priceUsd > 0) { |
| 38 | expect(card).toContain("ask the operator"); | |
| 39 | expect(card).not.toContain("not on sale"); | |
| 36 | expect(card).toContain("not on sale yet · ask the operator"); | |
| 40 | 37 | } |
| 41 | 38 | } |
| 42 | 39 | }); |
| 43 | ||
| 44 | test("with no checkout, a plan's buy link on /pricing is the one the home carries", async () => { | |
| 45 | const links = { small: "https://buy.stripe.com/small-agree", medium: "https://buy.stripe.com/medium-agree" }; | |
| 46 | setBillingLinks(app.db, links, "test"); | |
| 47 | try { | |
| 48 | const pricing = await (await fetch(`${servers.url}/pricing`)).text(); | |
| 49 | const home = await (await fetch(`${servers.url}/`)).text(); | |
| 50 | for (const p of getPlans(app.db).filter((p) => p.priceUsd > 0)) { | |
| 51 | const link = links[p.size as keyof typeof links]; | |
| 52 | const start = pricing.indexOf(`data-plan="${p.key}"`); | |
| 53 | const card = pricing.slice(start, pricing.indexOf("</div>", start)); | |
| 54 | if (link === undefined) { | |
| 55 | expect(card).toContain("ask the operator"); | |
| 56 | continue; | |
| 57 | } | |
| 58 | expect(card).toContain(`href="${link}"`); | |
| 59 | expect(card).toContain(`>Get ${p.name}</a>`); | |
| 60 | expect(home).toContain(`href="${link}"`); | |
| 61 | } | |
| 62 | expect(pricing).toContain("<p>After you pay:</p>"); | |
| 63 | } finally { | |
| 64 | setBillingLinks(app.db, {}, "test"); | |
| 65 | } | |
| 66 | }); |
test/tui-pricing.test.ts +2 −3
| @@ -240,12 +240,11 @@ test("with no paid plan there is nothing to order, and the screen says so at onc | ||
| 240 | 240 | expect(pendingFrom(f.app.db, bucketOf("203.0.113.13"), Date.now())).toBe(0); |
| 241 | 241 | }); |
| 242 | 242 | |
| 243 | test("with no provider the form says checkout is not connected and refuses the order", async () => { | |
| 243 | test("with no provider the form says paid plans are not on sale and refuses the order", async () => { | |
| 244 | 244 | const f = await fixture({ sell: false }); |
| 245 | 245 | const h = f.open("203.0.113.14"); |
| 246 | 246 | await settleApp(h.tui); |
| 247 | expect(flat(h)).toContain("Checkout is not connected here"); | |
| 248 | expect(flat(h)).not.toContain("not on sale"); | |
| 247 | expect(flat(h)).toContain("not on sale here yet"); | |
| 249 | 248 | await f.press(h, "sunny-day\[email protected]\r"); |
| 250 | 249 | expect(flat(h)).toContain(NO_PROVIDER); |
| 251 | 250 | }); |
test/vendor-words.test.ts +9 −5
| @@ -24,6 +24,9 @@ const LINES: Record<string, { match: RegExp; why: string }[]> = { | ||
| 24 | 24 | const LITERALS = [ |
| 25 | 25 | /claudeInstall/g, /opencodeInstall/g, /FORGE_CLAUDE/g, /plugins\/claude-code/g, |
| 26 | 26 | /connect-claude(-install)?/g, /\bclaude --plugin-dir\b/g, /["'`]claude["'`]/g, |
| 27 | // The assistant picker on the front door: where a person picks, vendors may be named. | |
| 28 | /<a href="https:\/\/(chatgpt\.com|grok\.com|claude\.ai)[^\n]*<\/a>/g, | |
| 29 | /Open in Claude, ChatGPT and Grok/g, | |
| 27 | 30 | // Public docs filenames, not wording. |
| 28 | 31 | /CLAUDE\.md/g, /claude CLI/g, |
| 29 | 32 | ]; |
| @@ -52,10 +55,11 @@ test("pages and the terminal name no AI vendor outside the picker", () => { | ||
| 52 | 55 | expect(bad).toEqual([]); |
| 53 | 56 | }); |
| 54 | 57 | |
| 55 | test("the front door connects any AI assistant and recommends none", () => { | |
| 58 | test("the front-door assistant picker lists the recommended one first, marked", () => { | |
| 56 | 59 | const src = readFileSync("src/web/studio/home.ts", "utf8"); |
| 57 | expect(src).toContain("Connect your AI assistant"); | |
| 58 | expect(src).toContain("/mcp</code>"); | |
| 59 | expect(src).not.toContain("(recommended)"); | |
| 60 | expect(src).not.toMatch(/claude\.ai|chatgpt\.com|grok\.com/); | |
| 60 | const at = (s: string) => src.indexOf(s); | |
| 61 | expect(at("Open in Claude")).toBeGreaterThan(0); | |
| 62 | expect(at("Open in Claude")).toBeLessThan(at("Open in ChatGPT")); | |
| 63 | expect(at("Open in Claude")).toBeLessThan(at("Open in Grok")); | |
| 64 | expect(src).toContain("(recommended)"); | |
| 61 | 65 | }); |
new above
offline