flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/services/runner/src/hosted.ts

25 lines1,117 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.

Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily1/**
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}