Remove console.log debug statements and cleanup debug code

This commit is contained in:
Chris Scott committed 2025-12-25 10:38:01 -05:00
1 parent ce2630936d
commit ac188c953b
20 files changed
+462 -220

No files matched your search

+60
View File
@@ -124,4 +124,64 @@ export const mcpApi = {
}
return response.json()
},
async getStatusFor(directory: string): Promise<McpStatusMap> {
const response = await fetch(`${API_BASE}/api/opencode/mcp?directory=${encodeURIComponent(directory)}`)
if (!response.ok) {
throw new Error(`Failed to get MCP status for directory: ${response.statusText}`)
}
return response.json()
},
async connectDirectory(name: string, directory: string): Promise<boolean> {
const response = await fetch(`${API_BASE}/api/settings/mcp/${encodeURIComponent(name)}/connectdirectory`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ directory }),
})
if (!response.ok) {
const error = await response.json().catch(() => ({ error: response.statusText }))
throw new Error(error.error || `Failed to connect MCP server for directory: ${response.statusText}`)
}
return response.json()
},
async disconnectDirectory(name: string, directory: string): Promise<boolean> {
const response = await fetch(`${API_BASE}/api/settings/mcp/${encodeURIComponent(name)}/disconnectdirectory`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ directory }),
})
if (!response.ok) {
const error = await response.json().catch(() => ({ error: response.statusText }))
throw new Error(error.error || `Failed to disconnect MCP server for directory: ${response.statusText}`)
}
return response.json()
},
async authenticateDirectory(name: string, directory: string): Promise<McpStatus> {
const response = await fetch(`${API_BASE}/api/settings/mcp/${encodeURIComponent(name)}/authdirectedir`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ directory }),
})
if (!response.ok) {
const error = await response.json().catch(() => ({ error: response.statusText }))
throw new Error(error.error || `Failed to authenticate MCP server for directory: ${response.statusText}`)
}
return response.json()
},
async removeAuthDirectory(name: string, directory: string): Promise<{ success: true }> {
const response = await fetch(`${API_BASE}/api/settings/mcp/${encodeURIComponent(name)}/authdir`, {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ directory }),
})
if (!response.ok) {
const error = await response.json().catch(() => ({ error: response.statusText }))
throw new Error(error.error || `Failed to remove MCP auth for directory: ${response.statusText}`)
}
return response.json()
},
}
+5
View File
@@ -145,6 +145,11 @@ export class OpenCodeClient {
return response.data
}
async getSessionStatuses() {
const response = await this.client.get<Record<string, { type: 'idle' } | { type: 'busy' } | { type: 'retry'; attempt: number; message: string; next: number }>>('/session/status')
return response.data
}
getEventSourceURL() {
const base = this.baseURL.startsWith('http')
? this.baseURL
+18
View File
@@ -123,6 +123,23 @@ export interface SSESessionIdleEvent {
}
}
export interface SSESessionStatusEvent {
type: 'session.status'
properties: {
sessionID: string
status: {
type: 'idle'
} | {
type: 'busy'
} | {
type: 'retry'
attempt: number
message: string
next: number
}
}
}
export type SSEEvent =
| SSEMessagePartUpdatedEvent
| SSEMessageUpdatedEvent
@@ -132,6 +149,7 @@ export type SSEEvent =
| SSESessionDeletedEvent
| SSESessionCompactedEvent
| SSESessionIdleEvent
| SSESessionStatusEvent
| SSETodoUpdatedEvent
| SSEPermissionUpdatedEvent
| SSEPermissionRepliedEvent