feat(ui): dock repo and session tools in a desktop side panel

Add a docked desktop tool panel with an icon rail, driven by the shared panel URL param, and keep the mobile dialogs and drawers. Extract dialog bodies into reusable content components, rename the walkthrough dialog to a sheet, and make walkthrough generation asynchronous with client polling.
This commit is contained in:
Chris Scott committed 2026-10-07 23:58:56 -04:00
1 parent bdbcc60716
commit 485ab940aa
49 files changed
+2631 -1753

No files matched your search

+11 -15
View File
@@ -1,29 +1,25 @@
import { fetchWrapper } from './fetchWrapper'
import { API_BASE_URL } from '@/config'
import type {
ChangeWalkthrough,
ChangeWalkthroughState,
GenerateChangeWalkthroughRequest,
} from '@opencode-manager/shared/schemas'
function walkthroughUrl(sessionId: string): string {
return `${API_BASE_URL}/api/change-walkthroughs/${encodeURIComponent(sessionId)}`
}
export async function getChangeWalkthrough(sessionId: string): Promise<ChangeWalkthroughState> {
return fetchWrapper<ChangeWalkthroughState>(
`${API_BASE_URL}/api/change-walkthroughs/${encodeURIComponent(sessionId)}`,
)
return fetchWrapper<ChangeWalkthroughState>(walkthroughUrl(sessionId))
}
export async function generateChangeWalkthrough(
sessionId: string,
request: GenerateChangeWalkthroughRequest,
): Promise<ChangeWalkthrough> {
const res = await fetchWrapper<{ walkthrough: ChangeWalkthrough }>(
`${API_BASE_URL}/api/change-walkthroughs/${encodeURIComponent(sessionId)}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(request),
timeout: 150_000,
},
)
return res.walkthrough
): Promise<ChangeWalkthroughState> {
return fetchWrapper<ChangeWalkthroughState>(walkthroughUrl(sessionId), {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(request),
})
}
+32
View File
@@ -0,0 +1,32 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { FetchError, fetchWrapper } from './fetchWrapper'
function respondWith(body: string, status: number) {
vi.stubGlobal('fetch', vi.fn(async () => new Response(body, { status })))
}
describe('fetchWrapper error bodies', () => {
afterEach(() => {
vi.unstubAllGlobals()
})
it('uses the JSON error message', async () => {
respondWith(JSON.stringify({ error: 'Session not found', code: 'NOT_FOUND' }), 404)
await expect(fetchWrapper('/api/x')).rejects.toMatchObject({ message: 'Session not found', statusCode: 404, code: 'NOT_FOUND' })
})
it('keeps a plain-text error body', async () => {
respondWith('upstream unavailable', 502)
await expect(fetchWrapper('/api/x')).rejects.toMatchObject({ message: 'upstream unavailable' })
})
it('replaces an HTML error page with a status message', async () => {
respondWith('<!DOCTYPE html><html><body>A timeout occurred</body></html>', 524)
const error = await fetchWrapper('/api/x').catch((caught: unknown) => caught)
expect(error).toBeInstanceOf(FetchError)
expect((error as FetchError).message).toBe('Request failed with status 524')
})
})
+1 -1
View File
@@ -36,7 +36,7 @@ async function handleResponse(response: Response): Promise<never> {
try {
return JSON.parse(text) as ApiErrorResponse
} catch {
return { error: text }
return { error: /^\s*</.test(text) ? `Request failed with status ${response.status}` : text }
}
})()
const errorData = data as ApiErrorResponse & { message?: string; data?: { message?: unknown } }