Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Remove proxying
Tomas Valentaf2f7ad7f2c23
diff --git a/apps/dashboard/api-client/api/index.ts b/apps/dashboard/api-client/api/index.tsdeleted file mode 100644index 9693f2472..000000000--- a/apps/dashboard/api-client/api/index.ts+++ /dev/null@@ -1,28 +0,0 @@-import 'cross-fetch/polyfill'-import { Fetcher } from 'openapi-typescript-fetch'--import type { components, paths } from './schema.gen'-import { localURL } from 'db/credentials'--export const baseUrl = process.env.NEXT_PUBLIC_PROXY- ? `${localURL}/api/service`- : process.env.NEXT_PUBLIC_API_URL--const client = Fetcher.for<paths>()--client.configure({- baseUrl,- init: {- headers: {- // Add token to all requests if it's set (server-side only)- ...process.env.SECRET_TOKEN && {- 'Authorization': `Bearer ${process.env.SECRET_TOKEN}`,- },- },- },-})--type ClientType = typeof client--export default client-export type { components, paths, ClientType }diff --git a/apps/dashboard/api-client/api/schema.gen.ts b/apps/dashboard/api-client/api/schema.gen.tsdeleted file mode 100644index 891186e94..000000000--- a/apps/dashboard/api-client/api/schema.gen.ts+++ /dev/null@@ -1,179 +0,0 @@-/**- * This file was auto-generated by openapi-typescript.- * Do not make direct changes to the file.- */---export interface paths {- "/deployments": {- /** Create Agent Deployment */- put: operations["create_agent_deployment_deployments_put"];- };- "/deployments/{id}": {- /** Get Agent Deployment */- get: operations["get_agent_deployment_deployments__id__get"];- /** Delete Agent Deployment */- delete: operations["delete_agent_deployment_deployments__id__delete"];- };- "/deployments/{id}/interactions": {- /** Interact With Agent Deployment */- post: operations["interact_with_agent_deployment_deployments__id__interactions_post"];- };- "/health": {- /** Health */- get: operations["health_health_get"];- };-}--export type webhooks = Record<string, never>;--export interface components {- schemas: {- /** AgentInteraction */- AgentInteraction: {- /** Data */- data?: Record<string, never>;- /** Interaction Id */- interaction_id?: string;- /** Type */- type: string;- };- /** CreateDeploymentBody */- CreateDeploymentBody: {- /** Config */- config?: Record<string, never>;- /** Secrets */- secrets?: Record<string, never>;- };- /** HTTPValidationError */- HTTPValidationError: {- /** Detail */- detail?: (components["schemas"]["ValidationError"])[];- };- /** ValidationError */- ValidationError: {- /** Location */- loc: (string | number)[];- /** Message */- msg: string;- /** Error Type */- type: string;- };- };- responses: never;- parameters: never;- requestBodies: never;- headers: never;- pathItems: never;-}--export type external = Record<string, never>;--export interface operations {-- /** Create Agent Deployment */- create_agent_deployment_deployments_put: {- parameters: {- query: {- project_id: string;- };- };- requestBody: {- content: {- "application/json": components["schemas"]["CreateDeploymentBody"];- };- };- responses: {- /** @description Successful Response */- 200: {- content: {- "application/json": Record<string, never>;- };- };- /** @description Validation Error */- 422: {- content: {- "application/json": components["schemas"]["HTTPValidationError"];- };- };- };- };- /** Get Agent Deployment */- get_agent_deployment_deployments__id__get: {- parameters: {- path: {- id: string;- };- };- responses: {- /** @description Successful Response */- 200: {- content: {- "application/json": Record<string, never>;- };- };- /** @description Validation Error */- 422: {- content: {- "application/json": components["schemas"]["HTTPValidationError"];- };- };- };- };- /** Delete Agent Deployment */- delete_agent_deployment_deployments__id__delete: {- parameters: {- path: {- id: string;- };- };- responses: {- /** @description Successful Response */- 204: never;- /** @description Validation Error */- 422: {- content: {- "application/json": components["schemas"]["HTTPValidationError"];- };- };- };- };- /** Interact With Agent Deployment */- interact_with_agent_deployment_deployments__id__interactions_post: {- parameters: {- path: {- id: string;- };- };- requestBody: {- content: {- "application/json": components["schemas"]["AgentInteraction"];- };- };- responses: {- /** @description Successful Response */- 200: {- content: {- "application/json": Record<string, never>;- };- };- /** @description Validation Error */- 422: {- content: {- "application/json": components["schemas"]["HTTPValidationError"];- };- };- };- };- /** Health */- health_health_get: {- responses: {- /** @description Successful Response */- 200: {- content: {- "application/json": Record<string, never>;- };- };- };- };-}diff --git a/apps/dashboard/pages/api/service/[...all].ts b/apps/dashboard/pages/api/service/[...all].tsdeleted file mode 100644index 22dd8e2ac..000000000--- a/apps/dashboard/pages/api/service/[...all].ts+++ /dev/null@@ -1,35 +0,0 @@-import { createProxyMiddleware } from 'http-proxy-middleware'-import type { NextApiRequest, NextApiResponse } from 'next'--export const config = {- api: {- responseLimit: false,- // Proxy middleware will handle requests itself, so Next.js should- // ignore that our handler doesn't directly return a response- externalResolver: true,- // Pass request bodies through unmodified so that the origin API server- // receives them in the intended format- bodyParser: false,- },-}--const pathPrefix = '/api/service'--const target = process.env.NEXT_PUBLIC_API_URL!-const isSecure = target.startsWith('https://')--const proxy = createProxyMiddleware<NextApiRequest, NextApiResponse>({- target,- ws: true,- secure: !isSecure,- changeOrigin: true,- pathRewrite: { [`^${pathPrefix}`]: '' }, // remove prefix-})--export default function handler(req: NextApiRequest, res: NextApiResponse) {- proxy(req, res, (result: unknown) => {- if (result instanceof Error) {- throw result- }- })-}