Skip to content
93 linesCodeBlameRaw
1import { env } from "cloudflare:workers";
2
3import {
4 accountsClient,
5 actionsClient,
6 advisoriesClient,
7 agentSessionsClient,
8 agentsClient,
9 billingClient,
10 chatClient,
11 deploymentsClient,
12 docsClient,
13 foliosClient,
14 packagesClient,
15 projectsClient,
16 eventsClient,
17 guardrailsClient,
18 identityClient,
19 inboxClient,
20 integrationsClient,
21 reposClient,
22 searchClient,
23 securityClient,
24 securitySuiteClient,
25 webhooksClient,
26 workClient,
27} from "@g1t/contracts";
28import { telemetryClient } from "@g1t/contracts/telemetry";
29
30import { instrumented } from "./perf.server";
31
32/**
33 * Each binding the clients use, timed for `Server-Timing` and, for the
34 * services that read D1 with sessions, told where to read (lib/perf.ts).
35 */
36const IDENTITY = instrumented("identity", env.IDENTITY);
37const REPOS = instrumented("repos", env.REPOS);
38const WORK = instrumented("work", env.WORK);
39const BILLING = instrumented("billing", env.BILLING);
40const EVENTS = instrumented("events", env.EVENTS);
41const INTEGRATIONS = instrumented("integrations", env.INTEGRATIONS);
42const WEBHOOKS = instrumented("webhooks", env.WEBHOOKS);
43const ACTIONS = instrumented("actions", env.ACTIONS);
44const DEPLOYMENTS = instrumented("deployments", env.DEPLOYMENTS);
45const PROJECTS = instrumented("projects", env.PROJECTS);
46const SECURITY = instrumented("security", env.SECURITY);
47const SEARCH = instrumented("search", env.SEARCH);
48const PACKAGES = instrumented("packages", env.PACKAGES);
49const CHAT = instrumented("chat", env.CHAT);
50const ARTIFACTS = instrumented("artifacts", env.ARTIFACTS);
51const TELEMETRY = env.TELEMETRY ? instrumented("telemetry", env.TELEMETRY) : null;
52
53export const identity = identityClient(IDENTITY);
54/** A person's email addresses and account security: methods of identity. */
55export const accounts = accountsClient(IDENTITY);
56export const repos = reposClient(REPOS);
57export const work = workClient(WORK);
58export const billing = billingClient(BILLING);
59export const events = eventsClient(EVENTS);
60/** Each person's inbox, which the events service keeps. */
61export const inbox = inboxClient(EVENTS);
62export const integrations = integrationsClient(INTEGRATIONS);
63/** Sessions on a workspace's own Anthropic account: the integrations service's agent_sessions.rs. */
64export const agentSessions = agentSessionsClient(INTEGRATIONS);
65export const webhooks = webhooksClient(WEBHOOKS);
66export const actions = actionsClient(ACTIONS);
67export const deployments = deploymentsClient(DEPLOYMENTS);
68export const projects = projectsClient(PROJECTS);
69export const security = securityClient(SECURITY);
70/** The security suite: patterns, bypasses, code scanning, the dependency graph, settings. */
71export const securitySuite = securitySuiteClient(SECURITY);
72/** Security advisories and private vulnerability reports: methods of the security service. */
73export const advisories = advisoriesClient(SECURITY);
74/** Runs and pull request sessions: methods of the work service. */
75export const agents = agentsClient(WORK);
76/** The network a sandbox may reach: methods of the work service. */
77export const guardrails = guardrailsClient(WORK);
78/** Search across all of g1t, and Explore. */
79export const search = searchClient(SEARCH);
80/** The workspace's registries: container images, and more to come. */
81export const packages = packagesClient(PACKAGES);
82/** Channels, direct messages and threads, where people talk. */
83export const chat = chatClient(CHAT);
84/** The artifacts service's spaces (Artifacts' spaces) and projects' docs. Its old pages are no longer read. */
85export const docs = docsClient(ARTIFACTS);
86/** Artifacts (folios): docs, and later slides, designs and dashboards, kept by the artifacts service. */
87export const folios = foliosClient(ARTIFACTS);
88
89/**
90 * Observability (services/telemetry): a project's requests, logs, traces,
91 * metrics and errors. Null where it is not deployed; the pages say so.
92 */
93export const telemetry = TELEMETRY ? telemetryClient(TELEMETRY) : null;