[Haik]: added unified shared/routes in the frontend, gonna start porting shit over to the new backend setup now

This commit is contained in:
haikdc
2026-04-17 23:59:44 -07:00
parent dbfa1a3c7d
commit c306a472d5
11 changed files with 114 additions and 5 deletions
-5
View File
@@ -1,5 +0,0 @@
const port = (window as any).__OPENSWARM_PORT__ || 8325;
const host = window.location.hostname || 'localhost';
export const API_BASE = `http://${host}:${port}/api`;
export const WS_BASE = `ws://${host}:${port}`;
+19
View File
@@ -0,0 +1,19 @@
import { API_BASE, WS_BASE } from '@/shared/routes/base';
const AGENTS_API: string = `${API_BASE}/agents`;
export const AGENTS_WS: string = `${WS_BASE}/api/agents/ws/dashboard`;
export const AGENTS_SESSIONS_API: string = `${AGENTS_API}/SESSIONS`;
export const AGENTS_SESSION_API: (sessionId: string) => string = (sessionId: string) => `${AGENTS_API}/sessions/${sessionId}`;
export const AGENTS_LAUNCH_API: string = `${AGENTS_API}/launch`;
export const AGENTS_UPDATE_SESSION_API: (sessionId: string) => string = (sessionId: string) => `${AGENTS_API}/SESSIONS/${sessionId}`;
export const AGENTS_MESSAGE_API: (sessionId: string) => string = (sessionId: string) => `${AGENTS_API}/SESSIONS/${sessionId}/message`;
export const AGENTS_STOP_API: (sessionId: string) => string = (sessionId: string) => `${AGENTS_API}/sessions/${sessionId}/stop`;
export const AGENTS_APPROVAL_API: string = `${AGENTS_API}/approval`;
export const AGENTS_EDIT_MESSAGE_API: (sessionId: string) => string = (sessionId: string) => `${AGENTS_API}/sessions/${sessionId}/edit_message`;
export const AGENTS_SWITCH_BRANCH_API: (sessionId: string) => string = (sessionId: string) => `${AGENTS_API}/SESSIONS/${sessionId}/switch_branch`;
export const AGENTS_CLOSE_API: (sessionId: string) => string = (sessionId: string) => `${AGENTS_API}/sessions/${sessionId}/close`;
export const AGENTS_RESUME_API: (sessionId: string) => string = (sessionId: string) => `${AGENTS_API}/SESSIONS/${sessionId}/resume`;
export const AGENTS_DUPLICATE_API: (sessionId: string) => string = (sessionId: string) => `${AGENTS_API}/SESSIONS/${sessionId}/duplicate`;
export const AGENTS_HISTORY_API: string = `${AGENTS_API}/history`;
+15
View File
@@ -0,0 +1,15 @@
import { API_BASE } from '@/shared/routes/base';
const APP_BUILDER_API: string = `${API_BASE}/app_builder`;
export const APP_BUILDER_SOURCE_FILE_API: (appId: string, filepath: string) => string = (appId: string, filepath: string) => `${APP_BUILDER_API}/app/${appId}/source_dir/${filepath}`;
export const APP_BUILDER_SERVE_API: (appId: string, filepath: string) => string = (appId: string, filepath: string) => `${APP_BUILDER_API}/${appId}/serve/${filepath}`;
export const APP_BUILDER_READ_APP_API: (appId: string) => string = (appId: string) => `${APP_BUILDER_API}/app/${appId}`;
export const APP_BUILDER_SEED_API: string = `${APP_BUILDER_API}/app/seed`;
export const APP_BUILDER_FILE_API: (appId: string, filepath: string) => string = (appId: string, filepath: string) => `${APP_BUILDER_API}/app/${appId}/file/${filepath}`;
export const APP_BUILDER_LIST_API: string = `${APP_BUILDER_API}/list`;
export const APP_BUILDER_GET_API: (appId: string) => string = (appId: string) => `${APP_BUILDER_API}/${appId}`;
export const APP_BUILDER_CREATE_API: string = `${APP_BUILDER_API}/create`;
export const APP_BUILDER_UPDATE_API: (appId: string) => string = (appId: string) => `${APP_BUILDER_API}/${appId}`;
export const APP_BUILDER_DELETE_API: (appId: string) => string = (appId: string) => `${APP_BUILDER_API}/${appId}`;
export const APP_BUILDER_EXECUTE_API: string = `${APP_BUILDER_API}/execute`;
+5
View File
@@ -0,0 +1,5 @@
const port: number = (window as any).__OPENSWARM_PORT__ || 8325;
const host: string = window.location.hostname || 'localhost';
export const API_BASE: string = `http://${host}:${port}/api`;
export const WS_BASE: string = `ws://${host}:${port}`;
+11
View File
@@ -0,0 +1,11 @@
import { API_BASE } from '@/shared/routes/base';
const DASHBOARDS_API: string = `${API_BASE}/dashboards`;
export const DASHBOARDS_LIST_API: string = `${DASHBOARDS_API}/list`;
export const DASHBOARDS_CREATE_API: string = `${DASHBOARDS_API}/create`;
export const DASHBOARDS_GET_API: (dashboardId: string) => string = (dashboardId: string) => `${DASHBOARDS_API}/${dashboardId}`;
export const DASHBOARDS_UPDATE_API: (dashboardId: string) => string = (dashboardId: string) => `${DASHBOARDS_API}/${dashboardId}`;
export const DASHBOARDS_DELETE_API: (dashboardId: string) => string = (dashboardId: string) => `${DASHBOARDS_API}/${dashboardId}`;
export const DASHBOARDS_DUPLICATE_API: (dashboardId: string) => string = (dashboardId: string) => `${DASHBOARDS_API}/${dashboardId}/duplicate`;
export const DASHBOARDS_GENERATE_NAME_API: (dashboardId: string) => string = (dashboardId: string) => `${DASHBOARDS_API}/${dashboardId}/generate-name`;
+5
View File
@@ -0,0 +1,5 @@
import { API_BASE } from '@/shared/routes/base';
const HEALTH_API: string = `${API_BASE}/health`;
export const HEALTH_CHECK_API: string = `${HEALTH_API}/check`;
+11
View File
@@ -0,0 +1,11 @@
import { API_BASE } from '@/shared/routes/base';
const MODES_API: string = `${API_BASE}/modes`;
export const MODES_LIST_API: string = `${MODES_API}/list`;
export const MODES_GET_API: (modeId: string) => string = (modeId: string) => `${MODES_API}/${modeId}`;
export const MODES_CREATE_API: string = `${MODES_API}/create`;
export const MODES_UPDATE_API: (modeId: string) => string = (modeId: string) => `${MODES_API}/${modeId}`;
export const MODES_RESET_API: (modeId: string) => string = (modeId: string) => `${MODES_API}/${modeId}/reset`;
export const MODES_DELETE_API: (modeId: string) => string = (modeId: string) => `${MODES_API}/${modeId}`;
export const MODES_GET_BY_ID_API: string = `${MODES_API}/get_mode_by_id`;
+7
View File
@@ -0,0 +1,7 @@
import { API_BASE } from '@/shared/routes/base';
const SETTINGS_API: string = `${API_BASE}/settings`;
export const SETTINGS_GET_API: string = SETTINGS_API;
export const SETTINGS_UPDATE_API: string = SETTINGS_API;
export const SETTINGS_RESET_SYSTEM_PROMPT_API: string = `${SETTINGS_API}/reset-system-prompt`;
+15
View File
@@ -0,0 +1,15 @@
import { API_BASE } from '@/shared/routes/base';
const SKILLS_API: string = `${API_BASE}/skills`;
export const SKILLS_LIST_API: string = `${SKILLS_API}/list`;
export const SKILLS_WORKSPACE_API: (workspaceId: string) => string = (workspaceId: string) => `${SKILLS_API}/workspace/${workspaceId}`;
export const SKILLS_WORKSPACE_SEED_API: string = `${SKILLS_API}/workspace/seed`;
export const SKILLS_DETAIL_API: (skillId: string) => string = (skillId: string) => `${SKILLS_API}/detail/${skillId}`;
export const SKILLS_CREATE_API: string = `${SKILLS_API}/create`;
export const SKILLS_UPDATE_API: (skillId: string) => string = (skillId: string) => `${SKILLS_API}/${skillId}`;
export const SKILLS_DELETE_API: (skillId: string) => string = (skillId: string) => `${SKILLS_API}/${skillId}`;
export const SKILLS_REGISTRY_STATS_API: string = `${SKILLS_API}/registry/stats`;
export const SKILLS_REGISTRY_SEARCH_API: string = `${SKILLS_API}/registry/search`;
export const SKILLS_REGISTRY_DETAIL_API: (skillName: string) => string = (skillName: string) => `${SKILLS_API}/registry/detail/${skillName}`;
@@ -0,0 +1,10 @@
import { API_BASE } from '@/shared/routes/base';
const SUBSCRIPTIONS_API: string = `${API_BASE}/subscriptions`;
export const SUBSCRIPTIONS_STATUS_API: string = `${SUBSCRIPTIONS_API}/status`;
export const SUBSCRIPTIONS_CONNECT_API: string = `${SUBSCRIPTIONS_API}/connect`;
export const SUBSCRIPTIONS_POLL_API: string = `${SUBSCRIPTIONS_API}/poll`;
export const SUBSCRIPTIONS_DISCONNECT_API: string = `${SUBSCRIPTIONS_API}/disconnect`;
export const SUBSCRIPTIONS_PENDING_API: (state: string) => string = (state: string) => `${SUBSCRIPTIONS_API}/pending/${state}`;
export const SUBSCRIPTIONS_CALLBACK_API: string = `${SUBSCRIPTIONS_API}/callback`;
+16
View File
@@ -0,0 +1,16 @@
import { API_BASE } from '@/shared/routes/base';
const TOOLS_API: string = `${API_BASE}/tools`;
export const TOOLS_BUILTIN_API: string = `${TOOLS_API}/builtin`;
export const TOOLS_BUILTIN_PERMISSIONS_API: string = `${TOOLS_API}/builtin/permissions`;
export const TOOLS_LIST_API: string = `${TOOLS_API}/list`;
export const TOOLS_CREATE_API: string = `${TOOLS_API}/create`;
export const TOOLS_GET_API: (toolId: string) => string = (toolId: string) => `${TOOLS_API}/${toolId}`;
export const TOOLS_UPDATE_API: (toolId: string) => string = (toolId: string) => `${TOOLS_API}/${toolId}`;
export const TOOLS_DELETE_API: (toolId: string) => string = (toolId: string) => `${TOOLS_API}/${toolId}`;
export const TOOLS_DISCOVER_API: (toolId: string) => string = (toolId: string) => `${TOOLS_API}/${toolId}/discover`;
export const TOOLS_LOAD_USER_TOOLKIT_API: string = `${TOOLS_API}/load_user_toolkit`;
export const TOOLS_OAUTH_CALLBACK_API: string = `${TOOLS_API}/oauth/callback`;
export const TOOLS_OAUTH_START_API: (toolId: string) => string = (toolId: string) => `${TOOLS_API}/${toolId}/oauth/start`;
export const TOOLS_OAUTH_DISCONNECT_API: (toolId: string) => string = (toolId: string) => `${TOOLS_API}/${toolId}/oauth/disconnect`;