a45e358e83
Introduce persistent generationStatus to work summaries (puzzle & match3d) and propagate generation recovery rules across docs and frontend/backends so "generating" is restored from server-side work summary rather than ephemeral front-end notices. Update API server image/asset handling (improve match3d material sheet green/alpha decontamination and promote generatedItemAssets background fields) and add runtime improvements: alpha-based hotspot hit-testing, tray insertion/three-match animation behavior, and session re-read on client-side VectorEngine timeouts/lock-screen interruptions. Many docs, tests and related frontend modules updated/added to reflect these contract and behavior changes.
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { beforeEach, expect, test, vi } from 'vitest';
|
|
|
|
const { requestJsonMock } = vi.hoisted(() => ({
|
|
requestJsonMock: vi.fn(),
|
|
}));
|
|
|
|
vi.mock('../apiClient', () => ({
|
|
fetchWithApiAuth: vi.fn(),
|
|
requestJson: requestJsonMock,
|
|
}));
|
|
|
|
import { createCreationAgentClient } from './creationAgentClientFactory';
|
|
|
|
beforeEach(() => {
|
|
requestJsonMock.mockReset();
|
|
requestJsonMock.mockResolvedValue({ session: { sessionId: 'session-1' } });
|
|
});
|
|
|
|
test('creation agent action requests are not auto-retried by default', async () => {
|
|
const client = createCreationAgentClient<
|
|
Record<string, never>,
|
|
{ session: { sessionId: string } },
|
|
{ session: { sessionId: string } },
|
|
{ sessionId: string },
|
|
{ text: string },
|
|
{ session: { sessionId: string } },
|
|
{ action: string },
|
|
{ session: { sessionId: string } }
|
|
>({
|
|
apiBase: '/api/runtime/puzzle/agent/sessions',
|
|
messages: {
|
|
createSession: '创建失败',
|
|
getSession: '读取失败',
|
|
sendMessage: '发送失败',
|
|
streamIncomplete: '流式结果不完整',
|
|
executeAction: '执行失败',
|
|
},
|
|
});
|
|
|
|
await client.executeAction('session-1', { action: 'compile_puzzle_draft' });
|
|
|
|
expect(requestJsonMock).toHaveBeenCalledWith(
|
|
'/api/runtime/puzzle/agent/sessions/session-1/actions',
|
|
expect.objectContaining({ method: 'POST' }),
|
|
'执行失败',
|
|
expect.objectContaining({
|
|
retry: expect.objectContaining({ maxRetries: 0 }),
|
|
timeoutMs: 1_000_000,
|
|
}),
|
|
);
|
|
});
|