Spaces:
Sleeping
Sleeping
David Prince
fix: add all missing local module stubs (remote_mcp_registry, mcp_auth, mcp_transport, etc)
cce8120 | const BASE_URL = process.env.REACT_APP_API_URL || "http://localhost:8000"; | |
| export const api = { | |
| // File Explorer & Workspace | |
| async getFiles(path = "") { | |
| const res = await fetch(`${BASE_URL}/api/workspace/files?path=${encodeURIComponent(path)}`); | |
| return res.json(); | |
| }, | |
| async getFileContent(filepath) { | |
| const res = await fetch(`${BASE_URL}/api/workspace/file?path=${encodeURIComponent(filepath)}`); | |
| return res.text(); | |
| }, | |
| async saveFile(filepath, content) { | |
| const res = await fetch(`${BASE_URL}/api/workspace/file`, { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ path: filepath, content }) | |
| }); | |
| return res.json(); | |
| }, | |
| // AI Chat & Session Management | |
| async createSession(rootDir = ".") { | |
| const res = await fetch(`${BASE_URL}/api/workspace/session?root_dir=${encodeURIComponent(rootDir)}`, { method: "POST" }); | |
| return res.json(); | |
| }, | |
| async sendChatMessage(sessionId, role, content) { | |
| const res = await fetch(`${BASE_URL}/api/workspace/chat/message?session_id=${sessionId}&role=${role}&content=${encodeURIComponent(content)}`, { method: "POST" }); | |
| return res.json(); | |
| }, | |
| async getChatHistory(sessionId) { | |
| const res = await fetch(`${BASE_URL}/api/workspace/chat/history?session_id=${sessionId}`); | |
| return res.json(); | |
| }, | |
| // AI Generator / Builder | |
| async generateComponent(name, description, framework = "react") { | |
| const res = await fetch(`${BASE_URL}/api/builder/generate/component?name=${name}&description=${encodeURIComponent(description)}&framework=${framework}`, { method: "POST" }); | |
| return res.json(); | |
| }, | |
| // Builds & Deployments | |
| async startBuild(target = "static") { | |
| const res = await fetch(`${BASE_URL}/api/builds/start?target=${target}`, { method: "POST" }); | |
| return res.json(); | |
| }, | |
| async getBuildStatus(buildId) { | |
| const res = await fetch(`${BASE_URL}/api/builds/${buildId}/status`); | |
| return res.json(); | |
| } | |
| }; | |