Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
test(web-app): pin that the thread route passes generation to callTool
Akarshan Biswas79f03c760860
diff --git a/web-app/src/routes/threads/__tests__/$threadId.test.tsx b/web-app/src/routes/threads/__tests__/$threadId.test.tsxindex 594eca997..c47e82904 100644--- a/web-app/src/routes/threads/__tests__/$threadId.test.tsx+++ b/web-app/src/routes/threads/__tests__/$threadId.test.tsx@@ -58,6 +58,7 @@ const h = vi.hoisted(() => {extensionId: stringname: stringserver: string+ generation?: number}>,setOomError: vi.fn(),setBackendError: vi.fn(),@@ -2975,6 +2976,37 @@ describe('ThreadDetail route', () => {)})+ // The host refuses a call approved for a replaced handler binding, so+ // the route must hand it the generation the tool was advertised with.+ it('passes the advertised binding generation to callTool for an approved tool', async () => {+ h.appStateState.extensionTools = [+ {+ wireName,+ extensionId: 'acme.one',+ name: 'echo',+ server: 'ext:acme.one',+ generation: 7,+ },+ ]+ extensionHost.callTool.mockResolvedValue({+ content: [{ type: 'text', text: 'HI' }],+ })+ renderComponent()+ await act(async () => {+ await (h as any).capturedOnToolCall(extToolCall('te7'))+ })+ await act(async () => {+ await finishWithToolCalls()+ })+ expect(extensionHost.callTool).toHaveBeenCalledTimes(1)+ expect(extensionHost.callTool).toHaveBeenCalledWith(+ 'acme.one',+ 'echo',+ { text: 'hi' },+ expect.objectContaining({ generation: 7 })+ )+ })+it('does not run a denied extension tool', async () => {h.toolApprovalState.requestApproval = vi.fn().mockResolvedValue(false)renderComponent()