mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
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:
1 parent
bdbcc60716
commit
485ab940aa
49 files changed
+2631
-1753
No files matched your search
@@ -383,6 +383,8 @@ describe('ChangeWalkthroughService', () => {
|
||||
expect(state.walkthrough).toBeNull()
|
||||
expect(state.stale).toBe(false)
|
||||
expect(state.currentDiffHash).toBe(computeChangesHash(threeHunks))
|
||||
expect(state.generating).toBe(false)
|
||||
expect(state.error).toBeNull()
|
||||
})
|
||||
|
||||
it('reports stale when the changes differ from the stored hash', async () => {
|
||||
@@ -526,6 +528,79 @@ describe('ChangeWalkthroughService', () => {
|
||||
await expect(service.generate('ses_missing', {})).rejects.toMatchObject({ status: 404 })
|
||||
})
|
||||
|
||||
describe('startGeneration', () => {
|
||||
const coveringReply = modelReply([{ title: 'A', explanation: 'x', hunkIds: ['f0h0', 'f0h1', 'f1h0'] }])
|
||||
|
||||
it('reports generating while the model call is pending, then the stored walkthrough', async () => {
|
||||
let resolveGenerate: (text: string) => void = () => {}
|
||||
fake.setGenerateImpl(() => new Promise<string>((resolve) => {
|
||||
resolveGenerate = resolve
|
||||
}))
|
||||
|
||||
const state = await service.startGeneration(SESSION_ID, {})
|
||||
expect(state.generating).toBe(true)
|
||||
expect(state.walkthrough).toBeNull()
|
||||
expect(state.error).toBeNull()
|
||||
|
||||
resolveGenerate(coveringReply)
|
||||
|
||||
await vi.waitFor(async () => {
|
||||
const settled = await service.getState(SESSION_ID)
|
||||
expect(settled.generating).toBe(false)
|
||||
expect(settled.walkthrough).not.toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
it('rejects with 409 when the session has no changes', async () => {
|
||||
sessions[SESSION_ID]!.changes = []
|
||||
|
||||
await expect(service.startGeneration(SESSION_ID, {})).rejects.toMatchObject({
|
||||
status: 409,
|
||||
code: 'WALKTHROUGH_NO_CHANGES',
|
||||
})
|
||||
sessions[SESSION_ID]!.changes = threeHunks
|
||||
expect((await service.getState(SESSION_ID)).error).toBeNull()
|
||||
})
|
||||
|
||||
it('records an unparseable model failure on the state', async () => {
|
||||
fake.setGenerateImpl(async () => 'not json')
|
||||
|
||||
await service.startGeneration(SESSION_ID, {})
|
||||
|
||||
await vi.waitFor(async () => {
|
||||
const settled = await service.getState(SESSION_ID)
|
||||
expect(settled.generating).toBe(false)
|
||||
expect(settled.error).toMatchObject({ code: 'WALKTHROUGH_UNPARSEABLE' })
|
||||
})
|
||||
})
|
||||
|
||||
it('clears a previous error when a new generation starts', async () => {
|
||||
fake.setGenerateImpl(async () => 'not json')
|
||||
await service.startGeneration(SESSION_ID, {})
|
||||
await vi.waitFor(async () => {
|
||||
expect((await service.getState(SESSION_ID)).error).not.toBeNull()
|
||||
})
|
||||
|
||||
fake.setGenerateImpl(() => new Promise<string>(() => {}))
|
||||
const state = await service.startGeneration(SESSION_ID, { regenerate: true })
|
||||
|
||||
expect(state.generating).toBe(true)
|
||||
expect(state.error).toBeNull()
|
||||
})
|
||||
|
||||
it('clears the recorded error when the session is deleted', async () => {
|
||||
fake.setGenerateImpl(async () => 'not json')
|
||||
await service.startGeneration(SESSION_ID, {})
|
||||
await vi.waitFor(async () => {
|
||||
expect((await service.getState(SESSION_ID)).error).not.toBeNull()
|
||||
})
|
||||
|
||||
service.handleEvent(sessionEvent('session.deleted', SESSION_ID))
|
||||
|
||||
expect((await service.getState(SESSION_ID)).error).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('handleEvent', () => {
|
||||
const coveringReply = modelReply([{ title: 'A', explanation: 'x', hunkIds: ['f0h0', 'f0h1', 'f1h0'] }])
|
||||
|
||||
|
||||
Reference in new issue
Block a user