diff --git a/packages/sdk-typescript/test/unit/DaemonClient.test.ts b/packages/sdk-typescript/test/unit/DaemonClient.test.ts index 0047fad2618..dc2a83e5a0b 100644 --- a/packages/sdk-typescript/test/unit/DaemonClient.test.ts +++ b/packages/sdk-typescript/test/unit/DaemonClient.test.ts @@ -1340,6 +1340,27 @@ describe('DaemonClient', () => { }); }); + it('encodes a before-record transcript boundary', async () => { + const { fetch, calls } = recordingFetch(() => + jsonResponse(200, { + v: 1, + sessionId: 'with/slash', + events: [], + hasMore: false, + }), + ); + const client = new DaemonClient({ baseUrl: 'http://daemon', fetch }); + + await client.getSessionTranscriptPage('with/slash', { + beforeRecordId: 'record/1', + limit: 2, + }); + + expect(calls[0]?.url).toBe( + 'http://daemon/session/with%2Fslash/transcript?beforeRecordId=record%2F1&limit=2', + ); + }); + it('uses direct REST fetch even when an ACP transport is configured', async () => { const { fetch, calls } = recordingFetch(() => jsonResponse(200, { diff --git a/packages/webui/src/daemon/session/DaemonSessionProvider.test.tsx b/packages/webui/src/daemon/session/DaemonSessionProvider.test.tsx index 79d74be95c6..e541b71b158 100644 --- a/packages/webui/src/daemon/session/DaemonSessionProvider.test.tsx +++ b/packages/webui/src/daemon/session/DaemonSessionProvider.test.tsx @@ -9096,6 +9096,24 @@ describe('DaemonSessionProvider', () => { }); expect(sdkMocks.getSessionTranscriptPage).toHaveBeenCalledTimes(2); + expect(sdkMocks.getSessionTranscriptPage).toHaveBeenNthCalledWith( + 1, + session.sessionId, + { + beforeRecordId: 'record-2', + limit: 25, + clientId: session.clientId, + }, + ); + expect(sdkMocks.getSessionTranscriptPage).toHaveBeenNthCalledWith( + 2, + session.sessionId, + { + beforeRecordId: 'record-2', + limit: 25, + clientId: session.clientId, + }, + ); expect( blocks.map((block) => ('text' in block ? block.text : undefined)), ).toEqual(['older prompt', 'recent prompt']);