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

opened this

Check · Review · Land · Live — It conflicts with its base. Next: builder, it conflicts with its base.

Conflicts with main

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.

Review

Sign in to review this change.
9 files changed +31 −65
src/actions/order.ts +1 −1
@@ -34,7 +34,7 @@ export interface Refusal {
3434 }
3535
3636 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.";
3838 /** A spawn that stays `spawning` this long is taken as lost and may be retried. */
3939 const STALE_MS = 5 * 60_000;
4040 /** 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 {
146146 return;
147147 }
148148 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);
150150 y++;
151151 const list = paid();
152152 for (const p of plans()) {
src/web/pages/pricing.ts +6 −16
@@ -2,15 +2,14 @@
22 * `/pricing` (#11138): the sale. A visitor with no account picks a plan, names
33 * the forge, gives an email and pays at the provider's checkout; a minute
44 * 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`.
87 */
98
109 import { setCookie } from "../../auth/cookies.ts";
1110 import { deliverLink, mayView, NO_PROVIDER, placeOrder, reconcileOrder, resendLink, type Refusal } from "../../actions/order.ts";
1211 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";
1413 import { checkoutOf } from "../../billing/checkout.ts";
1514 import { notePhase, takeSessionTime } from "../../core/route_timing.ts";
1615 import { cookieValue, type Ctx } from "../../http/context.ts";
@@ -19,7 +18,6 @@ import { clientBucket } from "../../http/peer.ts";
1918 import { takeDoor } from "../../http/strangers.ts";
2019 import { FREE, getPlans, type Plan } from "../../settings/plans.ts";
2120 import { sizeWords } from "../../settings/billing.ts";
22 import { getDoorSettings } from "../../settings/door.ts";
2321 import { childHost } from "../../spawn/door.ts";
2422 import { notFoundPage, pageHead } from "../chrome.ts";
2523 import { field, readForm } from "../form.ts";
@@ -48,24 +46,16 @@ function plansView(ctx: Ctx, values: Values, errors: Partial<Record<Refusal["fie
4846 const held = (cookieValue(ctx.request, COOKIE) ?? "").split(".")[0] ?? "";
4947 const ordered = /^ord_[0-9a-f]{32}$/.test(held) ? held : undefined;
5048 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);
5550 const rule = lapseRule(ctx.app.db);
56 const links = selling ? {} : door.links;
57 const buyable = selling || plans.some((p) => planWords(p, links).buy !== undefined);
5851 const rows = plans.map((p: Plan) => {
5952 const free = p.key === FREE;
6053 const paid = !free && selling;
61 const buy = planWords(p, links).buy;
6254 const price = free
6355 ? html`<span data-price>Free</span>`
6456 : paid
6557 ? 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>`;
6959 const act = free ? btn(START_BUTTON, { formaction: "/forges/start" }) : paid ? btn(`Get ${p.name}`, { name: "plan", value: p.key, variant: "primary" }) : null;
7060 const credit = `${p.creditUsd > 0 ? ` $${p.creditUsd} of crew credit each month.` : ""} Up to ${p.forges} ${p.forges === 1 ? "forge" : "forges"}.`;
7161 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
9686 <dl class="status-rows">${rows}</dl>
9787 </form>
9888 <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>
10090 <ol>${AFTER_PAYMENT_STEPS.map((l) => html`<li>${l}</li>`)}</ol>
10191 <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>
10292 </div>
src/web/studio/home.ts +9 −6
@@ -675,7 +675,7 @@ export function packPresses(all: readonly Pack[]): Html | null {
675675 </div>`;
676676 }
677677
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. */
679679 const AGENTS = "/agents";
680680
681681 /**
@@ -731,6 +731,7 @@ export function studioDoor(ctx: Ctx): Response {
731731 // Closed is a door with nothing behind it; invite still lands an invite link's holder.
732732 const origin = (ctx.app.config.url ?? ctx.url.origin).replace(/\/$/, "");
733733 const prompt = agentPrompt(origin);
734 const asked = encodeURIComponent(prompt);
734735 // A claimed hosted forge is someone's: its stranger is told whose, not sold the product (#13795).
735736 const owner = visitor && ctx.url.pathname === "/" ? forgeOwner(ctx.app.db, ctx.app.config.dataDir) : undefined;
736737 if (owner !== undefined) return claimedDoor(ctx, owner, tiles);
@@ -739,7 +740,7 @@ export function studioDoor(ctx: Ctx): Response {
739740 <h1>Software for what you're building.<br /><span class="muted">Yours to keep.</span></h1>
740741 <div class="door-under">
741742 <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>
743744 <form method="post" action="/forges/start" class="door-start" id="start-forge">
744745 ${refusal === undefined ? null : html`<p class="error" id="start-refused">${startRefusalWords(refusal, startWaitIn(ctx.url.searchParams))}</p>`}
745746 <div class="field">
@@ -752,9 +753,11 @@ export function studioDoor(ctx: Ctx): Response {
752753 ${when(made.length > 0, () => html`<div class="bar">${btn("See what it built", { href: "#made", size: "lg" })}</div>`)}
753754 <div class="door-agent">
754755 <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>
758761 </p>
759762 ${copyField("door-prompt", prompt, "A message for any AI assistant", "Copy the message")}
760763 </div>
@@ -854,7 +857,7 @@ bun run src/main.ts</code></pre>
854857 </div>
855858 </section>
856859 <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
858861 <a href="https://www.espodev.com">EspoDev</a> delivers enterprise implementations.
859862 </p>
860863 ${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
4747 test("with no provider the steps are said as what will happen, not as a promise", async () => {
4848 useCheckout(app, undefined);
4949 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");
5251 expect(body).not.toContain("<p>After you pay:</p>");
5352 for (const step of AFTER_PAYMENT_STEPS) expect(body).toContain(escapeHtml(step));
5453 });
test/pricing-order.test.ts +1 −3
@@ -187,9 +187,7 @@ describe("/pricing", () => {
187187 test("with no provider the paid plans say ask the operator and a post builds nothing", async () => {
188188 useCheckout(app, undefined);
189189 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");
193191 expect(text).toContain("$19 a month");
194192 expect((await fetch(`${base}/pricing/order`, form({ name: "nope", plan: "small", email: "[email protected]" }))).status).toBe(409);
195193 useCheckout(app, fake);
test/pricing-plans-agree.test.ts +1 −28
@@ -5,8 +5,6 @@ import { tmpdir } from "node:os";
55 import { join } from "node:path";
66 import { createApp, type App } from "../src/app.ts";
77 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";
108
119 let dir: string;
1210 let app: App;
@@ -35,32 +33,7 @@ test("every plan's card shows the price, credit and forge count the API lists",
3533 else expect(card).not.toContain("crew credit");
3634 expect(card).toContain(`Up to ${p.forges} ${p.forges === 1 ? "forge" : "forges"}`);
3735 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");
4037 }
4138 }
4239 });
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
240240 expect(pendingFrom(f.app.db, bucketOf("203.0.113.13"), Date.now())).toBe(0);
241241 });
242242
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 () => {
244244 const f = await fixture({ sell: false });
245245 const h = f.open("203.0.113.14");
246246 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");
249248 await f.press(h, "sunny-day\[email protected]\r");
250249 expect(flat(h)).toContain(NO_PROVIDER);
251250 });
test/vendor-words.test.ts +9 −5
@@ -24,6 +24,9 @@ const LINES: Record<string, { match: RegExp; why: string }[]> = {
2424 const LITERALS = [
2525 /claudeInstall/g, /opencodeInstall/g, /FORGE_CLAUDE/g, /plugins\/claude-code/g,
2626 /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,
2730 // Public docs filenames, not wording.
2831 /CLAUDE\.md/g, /claude CLI/g,
2932 ];
@@ -52,10 +55,11 @@ test("pages and the terminal name no AI vendor outside the picker", () => {
5255 expect(bad).toEqual([]);
5356 });
5457
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", () => {
5659 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)");
6165 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs