mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 23:58:45 +01:00
* feat(plans): CHF 15 / 40 / 90 with a monthly AI allowance, reservable until payments open The founder set the prices on 2026-10-17. Payments stay off until Loki's company is registered, so everything up to the moment of paying works and nothing is charged: - config/plans.ts: Personal 15, Pro 40, Team 90 a month; each states its monthly allowance. The billing note says payments are not open and that a plan can be reserved with nothing charged. - lib/plan.ts: PLAN_LIMITS.aiAnswersMonthly (1,000 / 3,000 / 8,000 at 8,000 tokens an answer — about $0.002 each on a paid open model, a fraction of the price). - lib/ai-budget/plan-allowance.ts + gate: past the daily free share, a paid plan's month still admits the turn. Read only after the share refused, so a free turn never pays for it; a failed read leaves the refusal standing; a lapsed or past-due plan has none. - /pricing: four priced cards. A paid plan's button opens /pricing/<plan>, which reserves it (plan_reservations, one row per person, grants nothing) — and reads "Pay in Bitcoin" the day its OrangeCat pass exists. - The out-of-answers refusal and the budget screen offer the plans beside the person's own key; Settings shows a plan's allowance left this month. - Settings → Billing links each plan's reserve page; System → Revenue shows who is waiting on which plan, and counts only plans a settled pass pays for (a hand grant is "granted", not revenue). - docs/architecture/models-and-money.md follows the decision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CG9dupSVqoXCCqKfBCfd9B * test(ai-budget-gate): answer the plan read without a database The gate now asks a paid plan's allowance after the share refuses. The existing gate tests did not inject it, so where CI has a real Postgres the default read opened a pool that kept the process alive and the runner timed the file out. Every call now passes `planAllowance`, as the file already does for the ledger and the capacity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CG9dupSVqoXCCqKfBCfd9B --------- Co-authored-by: Claude <noreply@anthropic.com>
99 lines
3.5 KiB
TypeScript
99 lines
3.5 KiB
TypeScript
/**
|
|
* /pricing must not promise what the product does not do.
|
|
*
|
|
* Three lines in src/config/plans.ts were false by 2026-10-01:
|
|
* - "Local-first execution on your laptop or your own always-on box" — the
|
|
* always-on box is Loki's shared cloud builder, for eligible accounts only;
|
|
* - "Cross-model verification" — the cross-model judge was removed on
|
|
* 2026-09-25 (src/lib/orchestration/dod-gate.ts);
|
|
* - OpenClaw in the agent list — a system gateway (switchable: false), not an
|
|
* agent anyone picks — while Antigravity, which people do pick, was missing.
|
|
* And Pro carried a "Recommended" badge on a tier with no price and no
|
|
* difference but the project ceiling.
|
|
*
|
|
* Run: npx tsx scripts/test/plans-copy-truth.ts
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { PRICING_PLANS, PRICING_INCLUDED, PRICING_BILLING_NOTE } from "@/config/plans";
|
|
import { AGENT_IDS } from "@/lib/agent-registry";
|
|
import { AGENT_LABELS } from "@/lib/agent-labels";
|
|
|
|
const source = readFileSync(new URL("../../src/config/plans.ts", import.meta.url), "utf8");
|
|
// Comments may NAME the retired lines (that is how the next reader learns
|
|
// why they are gone); only the strings that reach the page are checked.
|
|
const shipped = [
|
|
...PRICING_INCLUDED,
|
|
PRICING_BILLING_NOTE,
|
|
...PRICING_PLANS.flatMap((p) => [p.name, p.tagline, p.cta, ...p.highlights]),
|
|
].join("\n");
|
|
|
|
let failures = 0;
|
|
function check(name: string, fn: () => void) {
|
|
try {
|
|
fn();
|
|
console.log(` ✓ ${name}`);
|
|
} catch (err) {
|
|
failures++;
|
|
console.log(` ✗ ${name}\n ${err instanceof Error ? err.message : String(err)}`);
|
|
}
|
|
}
|
|
|
|
console.log("plans-copy-truth:");
|
|
|
|
for (const banned of [
|
|
/local-first/i,
|
|
/cross-model verification/i,
|
|
/openclaw/i,
|
|
/your own (always-on )?box/i,
|
|
]) {
|
|
check(`no shipped pricing copy matches ${banned}`, () => {
|
|
assert.ok(!banned.test(shipped), `found ${banned} in /pricing copy`);
|
|
});
|
|
}
|
|
|
|
check("plans.ts code (outside comments) never reintroduces them", () => {
|
|
const code = source
|
|
.replace(/\/\*[\s\S]*?\*\//g, "")
|
|
.split("\n")
|
|
.filter((l) => !l.trim().startsWith("//"))
|
|
.join("\n");
|
|
for (const banned of [/Local-first/i, /Cross-model verification/i, /OpenClaw/i]) {
|
|
assert.ok(!banned.test(code), `plans.ts code contains ${banned}`);
|
|
}
|
|
});
|
|
|
|
check("the agent list names every agent a user can pick", () => {
|
|
const line = PRICING_INCLUDED.find((l) => /Claude/.test(l)) ?? "";
|
|
for (const id of AGENT_IDS) {
|
|
const label = AGENT_LABELS[id];
|
|
assert.ok(line.includes(label), `missing ${label} in: ${line}`);
|
|
}
|
|
assert.ok(!/Gemini/.test(line), "the agent is called Antigravity, not Gemini");
|
|
});
|
|
|
|
check("no paid tier is drawn louder while prices are unannounced", () => {
|
|
const loud = PRICING_PLANS.filter((p) => p.featured && p.priceMonthly !== 0);
|
|
assert.deepEqual(
|
|
loud.map((p) => p.name),
|
|
[],
|
|
"a tier nobody can buy cannot be the recommended one",
|
|
);
|
|
});
|
|
|
|
check("while unpriced, the note says Loki is free", () => {
|
|
if (PRICING_PLANS.every((p) => p.priceMonthly === null || p.priceMonthly === 0)) {
|
|
assert.match(PRICING_BILLING_NOTE, /free/i);
|
|
}
|
|
});
|
|
|
|
check("once priced, the note says payments are not open and nothing is charged", () => {
|
|
if (PRICING_PLANS.some((p) => p.priceMonthly !== null && p.priceMonthly > 0)) {
|
|
assert.match(PRICING_BILLING_NOTE, /nothing is charged/i);
|
|
assert.match(PRICING_BILLING_NOTE, /reserve/i);
|
|
}
|
|
});
|
|
|
|
console.log(failures === 0 ? "\nall passed" : `\n${failures} failed`);
|
|
process.exit(failures === 0 ? 0 : 1);
|