Skip to content
25 linesCodeBlameRaw

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.

Stripe's webhook secret is a Worker secret, STRIPE_WEBHOOK_SECRET, from a destination made in Stripe's dashboard1/**
2 * Who may use g1t's hosted models. Pure, so it is tested on its own.
3 *
4 * While billing takes no real money (no card processor, or one with a test
5 * key), a card check proves nothing: test cards pass it. So until billing
6 * is live, hosted models are open only to the workspaces g1t lists
7 * (`HOSTED_AGENT_WORKSPACES`), and no trial opens them; every other
8 * workspace uses its own model provider. Once billing is live they are open
9 * to every workspace, paid from its trial credit or its account.
10 */
11
12/** The workspaces `HOSTED_AGENT_WORKSPACES` names, lowercased; `*` is every one. */
13export function listedWorkspaces(setting: string): string[] {
14 return setting
15 .split(",")
16 .map((name) => name.trim().toLowerCase())
17 .filter(Boolean);
18}
19
20/** Whether g1t's hosted models are open to `namespace`. */
21export function hostedOpen(namespace: string, setting: string, billing: { enabled: boolean; live: boolean }): boolean {
22 if (billing.enabled && billing.live) return true;
23 const listed = listedWorkspaces(setting);
24 return listed.includes("*") || listed.includes(namespace.toLowerCase());
25}

This file's history is long; its oldest lines are credited to the oldest commit read.