feat: implement PI core chat timeline

This commit is contained in:
2026-08-24 00:34:03 +08:00
parent 54d8bb2e4a
commit 612135f911
40 changed files with 3881 additions and 119 deletions

View File

@@ -65,6 +65,33 @@ describe('host-api', () => {
await expect(hostApiFetch('/api/test')).resolves.toBeUndefined();
});
it('returns authenticated binary IPC data without JSON or browser fallback', async () => {
const bytes = new Uint8Array([9, 8, 7]);
invokeIpcMock.mockResolvedValueOnce({
ok: true,
data: {
status: 200,
ok: true,
bytes,
contentType: 'image/webp',
},
});
const fetchMock = vi.fn();
vi.stubGlobal('fetch', fetchMock);
const { hostApiFetchBytes } = await import('@/lib/host-api');
await expect(hostApiFetchBytes('/api/coding/attachments/attachment-1/content'))
.resolves.toEqual({ bytes, contentType: 'image/webp' });
expect(invokeIpcMock).toHaveBeenCalledWith('hostapi:fetch', {
path: '/api/coding/attachments/attachment-1/content',
method: 'GET',
headers: { Accept: 'application/octet-stream' },
body: null,
});
expect(fetchMock).not.toHaveBeenCalled();
});
it('supports legacy proxy envelope response', async () => {
invokeIpcMock.mockResolvedValueOnce({
success: true,