g1t/apps/web/app/lib/services.server.ts
| 1 | import { env } from "cloudflare:workers"; |
| 2 | |
| 3 | import { |
| 4 | accountsClient, |
| 5 | actionsClient, |
| 6 | agentsClient, |
| 7 | billingClient, |
| 8 | contextClient, |
| 9 | deploymentsClient, |
| 10 | memoryReviewClient, |
| 11 | projectsClient, |
| 12 | eventsClient, |
| 13 | guardrailsClient, |
| 14 | identityClient, |
| 15 | integrationsClient, |
| 16 | reposClient, |
| 17 | searchClient, |
| 18 | securityClient, |
| 19 | webhooksClient, |
| 20 | workClient, |
| 21 | } from "@g1t/contracts"; |
| 22 | |
| 23 | import { instrumented } from "./perf.server"; |
| 24 | |
| 25 | /** |
| 26 | * Each binding the clients use, timed for `Server-Timing` and, for the |
| 27 | * services that read D1 with sessions, told where to read (lib/perf.ts). |
| 28 | */ |
| 29 | const IDENTITY = instrumented("identity", env.IDENTITY); |
| 30 | const REPOS = instrumented("repos", env.REPOS); |
| 31 | const WORK = instrumented("work", env.WORK); |
| 32 | const BILLING = instrumented("billing", env.BILLING); |
| 33 | const EVENTS = instrumented("events", env.EVENTS); |
| 34 | const INTEGRATIONS = instrumented("integrations", env.INTEGRATIONS); |
| 35 | const WEBHOOKS = instrumented("webhooks", env.WEBHOOKS); |
| 36 | const ACTIONS = instrumented("actions", env.ACTIONS); |
| 37 | const DEPLOYMENTS = instrumented("deployments", env.DEPLOYMENTS); |
| 38 | const PROJECTS = instrumented("projects", env.PROJECTS); |
| 39 | const SECURITY = instrumented("security", env.SECURITY); |
| 40 | const CONTEXT = instrumented("context", env.CONTEXT); |
| 41 | const SEARCH = instrumented("search", env.SEARCH); |
| 42 | |
| 43 | export const identity = identityClient(IDENTITY); |
| 44 | /** A person's email addresses and account security: methods of identity. */ |
| 45 | export const accounts = accountsClient(IDENTITY); |
| 46 | export const repos = reposClient(REPOS); |
| 47 | export const work = workClient(WORK); |
| 48 | export const billing = billingClient(BILLING); |
| 49 | export const events = eventsClient(EVENTS); |
| 50 | export const integrations = integrationsClient(INTEGRATIONS); |
| 51 | export const webhooks = webhooksClient(WEBHOOKS); |
| 52 | export const actions = actionsClient(ACTIONS); |
| 53 | export const deployments = deploymentsClient(DEPLOYMENTS); |
| 54 | export const projects = projectsClient(PROJECTS); |
| 55 | export const security = securityClient(SECURITY); |
| 56 | /** Agent runs, sessions and memory: methods of the work service. */ |
| 57 | export const agents = agentsClient(WORK); |
| 58 | /** What agents may do in a sandbox: methods of the work service. */ |
| 59 | export const guardrails = guardrailsClient(WORK); |
| 60 | /** The context hub: catalog, search and scorecards. */ |
| 61 | export const context = contextClient(CONTEXT); |
| 62 | /** Search across all of g1t, and Explore. */ |
| 63 | export const search = searchClient(SEARCH); |
| 64 | /** Memory candidates and their review: methods of the work service. */ |
| 65 | export const memoryReview = memoryReviewClient(WORK); |