chore: stabilize Zhinian pilot delivery

This commit is contained in:
inman
2026-05-12 19:44:44 +08:00
parent 45389855e1
commit 20b5aff4ad
174 changed files with 41428 additions and 784 deletions

View File

@@ -165,4 +165,31 @@ describe('gateway store event wiring', () => {
expect(chatStateMock.state.activeRunId).toBeNull();
expect(chatStateMock.state.pendingFinal).toBe(false);
});
it('does not clear sending state for terminal notifications from a different active run', async () => {
hostApiFetchMock.mockResolvedValueOnce({ state: 'running', port: 18789 });
const handlers = new Map<string, (payload: unknown) => void>();
subscribeHostEventMock.mockImplementation((eventName: string, handler: (payload: unknown) => void) => {
handlers.set(eventName, handler);
return () => {};
});
const { useGatewayStore } = await import('@/stores/gateway');
await useGatewayStore.getState().init();
handlers.get('gateway:notification')?.({
method: 'agent',
params: {
phase: 'completed',
runId: 'stale-run',
sessionKey: 'session-1',
},
});
await new Promise((resolve) => setTimeout(resolve, 0));
expect(chatStateMock.state.sending).toBe(true);
expect(chatStateMock.state.activeRunId).toBe('run-1');
expect(chatStateMock.state.pendingFinal).toBe(true);
});
});