flagon-io/g1t

public

Git for AI scale: a forge for thousands of agents working on the same code at once.

g1t/apps/web/app/lib/trial.ts

23 lines1,013 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put1/**
2 * How the site speaks of a workspace's trial credit. Pure, so it can be
3 * tested.
4 */
5
6import type { Trial } from "@g1t/contracts";
7
8/** "November 1", in UTC, when new trials start again. */
9export function resumesOn(at: string): string {
10 return new Date(at).toLocaleDateString("en-US", { month: "long", day: "numeric", timeZone: "UTC" });
11}
12
13/** Why the trial cannot pay for anything now, in a sentence, or null when it can. */
14export function trialClosed(trial: Trial | null | undefined, workspace: string): string | null {
15 if (!trial || trial.open) return null;
16 if (trial.reason === "used") return `${workspace} has used its trial credit on g1t.`;
17 if (trial.reason === "pool")
18 return trial.waitsUntil
19 ? `This month's free trials are all given out; new ones start on ${resumesOn(trial.waitsUntil)}.`
20 : "This month's free trials are all given out; new ones start next month.";
21 if (trial.reason === "ended") return "The free allowance on g1t's models has ended.";
22 return null;
23}