From beeeae53ae6bf19f35df14f0c7df6e3587766050 Mon Sep 17 00:00:00 2001 From: iKoles-dev <59211303+iKoles-dev@users.noreply.github.com> Date: Tue, 12 May 2026 02:57:40 +0300 Subject: [PATCH] Migrate chat to AI SDK v5 --- package.json | 28 +- pnpm-lock.yaml | 438 +++++++++--------- src/ai/language/generate.ts | 4 +- src/app/(general)/_components/chat/index.tsx | 47 +- .../_components/chat/input/index.tsx | 40 +- .../chat/messages/message-actions.tsx | 17 +- .../chat/messages/message-editor.tsx | 22 +- .../chat/messages/message-tool.tsx | 69 ++- .../_components/chat/messages/message.tsx | 47 +- .../_components/chat/preview-attachment.tsx | 8 +- .../_components/chat/starter-prompts.tsx | 7 +- src/app/(general)/_contexts/chat-context.tsx | 218 +++++---- src/app/(general)/_hooks/use-auto-resume.tsx | 18 +- src/app/(general)/_hooks/use-messages.tsx | 3 +- src/app/(general)/_types/chat.ts | 61 +++ src/app/api/chat/route.ts | 397 +++++++--------- src/app/api/chat/schema.ts | 35 +- src/server/api/routers/messages.ts | 45 +- src/server/api/routers/sync.ts | 12 +- .../toolkits/image/tools/generate/server.ts | 6 +- src/toolkits/types.ts | 4 +- 21 files changed, 749 insertions(+), 777 deletions(-) create mode 100644 src/app/(general)/_types/chat.ts diff --git a/package.json b/package.json index 5616cf0b..bc9dbe8e 100644 --- a/package.json +++ b/package.json @@ -25,16 +25,16 @@ "shiki:generate": "pnpm dlx tsx src/components/ui/code/codegen.ts && pnpm format:write" }, "dependencies": { - "@ai-sdk/anthropic": "^1.2.12", - "@ai-sdk/fal": "^0.1.12", - "@ai-sdk/fireworks": "^0.2.16", - "@ai-sdk/google": "^1.2.19", - "@ai-sdk/groq": "^1.2.9", - "@ai-sdk/luma": "^0.1.8", - "@ai-sdk/openai": "^1.3.22", - "@ai-sdk/perplexity": "^1.1.9", - "@ai-sdk/react": "^1.2.12", - "@ai-sdk/xai": "^1.2.16", + "@ai-sdk/anthropic": "^2.0.79", + "@ai-sdk/fal": "^1.0.32", + "@ai-sdk/fireworks": "^1.0.40", + "@ai-sdk/google": "^2.0.72", + "@ai-sdk/groq": "^2.0.40", + "@ai-sdk/luma": "^1.0.27", + "@ai-sdk/openai": "^2.0.106", + "@ai-sdk/perplexity": "^2.0.30", + "@ai-sdk/react": "^2.0.188", + "@ai-sdk/xai": "^2.0.72", "@auth/prisma-adapter": "^2.7.2", "@discordjs/rest": "^2.5.1", "@e2b/code-interpreter": "^1.5.1", @@ -45,7 +45,7 @@ "@llm-ui/react": "^0.13.3", "@modelcontextprotocol/sdk": "^1.12.0", "@notionhq/client": "^3.1.3", - "@openrouter/ai-sdk-provider": "^0.7.2", + "@openrouter/ai-sdk-provider": "^1.5.4", "@prisma/client": "^6.13.0", "@radix-ui/react-accordion": "^1.2.11", "@radix-ui/react-alert-dialog": "^1.1.14", @@ -76,14 +76,14 @@ "@vercel/mcp-adapter": "^0.11.1", "@vercel/speed-insights": "^1.2.0", "@xyflow/react": "^12.8.2", - "ai": "^4.3.16", + "ai": "^5.0.186", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "cookies-next": "^6.0.0", "date-fns": "^4.1.0", - "etsy-ts": "^4.2.0", "discord-api-types": "^0.38.17", + "etsy-ts": "^4.2.0", "exa-js": "^1.8.8", "fast-deep-equal": "^3.1.3", "googleapis": "^150.0.1", @@ -118,7 +118,7 @@ "usehooks-ts": "^3.1.1", "uuid": "^11.1.0", "vaul": "^1.1.2", - "zod": "^3.25.56" + "zod": "^3.25.76" }, "devDependencies": { "@eslint/eslintrc": "^3.3.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9cafcd36..66f9f658 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,35 +9,35 @@ importers: .: dependencies: '@ai-sdk/anthropic': - specifier: ^1.2.12 - version: 1.2.12(zod@3.25.56) + specifier: ^2.0.79 + version: 2.0.79(zod@3.25.76) '@ai-sdk/fal': - specifier: ^0.1.12 - version: 0.1.12(zod@3.25.56) + specifier: ^1.0.32 + version: 1.0.32(zod@3.25.76) '@ai-sdk/fireworks': - specifier: ^0.2.16 - version: 0.2.16(zod@3.25.56) + specifier: ^1.0.40 + version: 1.0.40(zod@3.25.76) '@ai-sdk/google': - specifier: ^1.2.19 - version: 1.2.19(zod@3.25.56) + specifier: ^2.0.72 + version: 2.0.72(zod@3.25.76) '@ai-sdk/groq': - specifier: ^1.2.9 - version: 1.2.9(zod@3.25.56) + specifier: ^2.0.40 + version: 2.0.40(zod@3.25.76) '@ai-sdk/luma': - specifier: ^0.1.8 - version: 0.1.8(zod@3.25.56) + specifier: ^1.0.27 + version: 1.0.27(zod@3.25.76) '@ai-sdk/openai': - specifier: ^1.3.22 - version: 1.3.22(zod@3.25.56) + specifier: ^2.0.106 + version: 2.0.106(zod@3.25.76) '@ai-sdk/perplexity': - specifier: ^1.1.9 - version: 1.1.9(zod@3.25.56) + specifier: ^2.0.30 + version: 2.0.30(zod@3.25.76) '@ai-sdk/react': - specifier: ^1.2.12 - version: 1.2.12(react@19.1.0)(zod@3.25.56) + specifier: ^2.0.188 + version: 2.0.188(react@19.1.0)(zod@3.25.76) '@ai-sdk/xai': - specifier: ^1.2.16 - version: 1.2.16(zod@3.25.56) + specifier: ^2.0.72 + version: 2.0.72(zod@3.25.76) '@auth/prisma-adapter': specifier: ^2.7.2 version: 2.9.1(@prisma/client@6.13.0(prisma@6.9.0(typescript@5.8.3))(typescript@5.8.3)) @@ -69,8 +69,8 @@ importers: specifier: ^3.1.3 version: 3.1.3 '@openrouter/ai-sdk-provider': - specifier: ^0.7.2 - version: 0.7.2(ai@4.3.16(react@19.1.0)(zod@3.25.56))(zod@3.25.56) + specifier: ^1.5.4 + version: 1.5.4(ai@5.0.186(zod@3.25.76))(zod@3.25.76) '@prisma/client': specifier: ^6.13.0 version: 6.13.0(prisma@6.9.0(typescript@5.8.3))(typescript@5.8.3) @@ -130,7 +130,7 @@ importers: version: 1.2.0 '@t3-oss/env-nextjs': specifier: ^0.12.0 - version: 0.12.0(typescript@5.8.3)(zod@3.25.56) + version: 0.12.0(typescript@5.8.3)(zod@3.25.76) '@tanstack/react-query': specifier: ^5.69.0 version: 5.80.6(react@19.1.0) @@ -162,8 +162,8 @@ importers: specifier: ^12.8.2 version: 12.8.2(@types/react@19.1.6)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) ai: - specifier: ^4.3.16 - version: 4.3.16(react@19.1.0)(zod@3.25.56) + specifier: ^5.0.186 + version: 5.0.186(zod@3.25.76) class-variance-authority: specifier: ^0.7.1 version: 0.7.1 @@ -179,15 +179,15 @@ importers: date-fns: specifier: ^4.1.0 version: 4.1.0 - etsy-ts: - specifier: ^4.2.0 - version: 4.2.0 discord-api-types: specifier: ^0.38.17 version: 0.38.18 + etsy-ts: + specifier: ^4.2.0 + version: 4.2.0 exa-js: specifier: ^1.8.8 - version: 1.8.8(encoding@0.1.13)(ws@8.18.3)(zod@3.25.56) + version: 1.8.8(encoding@0.1.13)(ws@8.18.3)(zod@3.25.76) fast-deep-equal: specifier: ^3.1.3 version: 3.1.3 @@ -211,7 +211,7 @@ importers: version: 1.16.0(encoding@0.1.13) mem0ai: specifier: ^2.1.30 - version: 2.1.30(@anthropic-ai/sdk@0.40.1(encoding@0.1.13))(@cloudflare/workers-types@4.20250614.0)(@google/genai@1.5.1(@modelcontextprotocol/sdk@1.12.2)(encoding@0.1.13))(@langchain/core@0.3.58(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.56)))(@mistralai/mistralai@1.7.2(zod@3.25.56))(@qdrant/js-client-rest@1.13.0(typescript@5.8.3))(@supabase/supabase-js@2.50.0)(@types/jest@29.5.14)(@types/pg@8.11.0)(@types/sqlite3@3.1.11)(cloudflare@4.3.0(encoding@0.1.13))(encoding@0.1.13)(groq-sdk@0.3.0(encoding@0.1.13))(neo4j-driver@5.28.1)(ollama@0.5.16)(pg@8.11.3)(redis@5.5.6)(sqlite3@5.1.7)(ws@8.18.3) + version: 2.1.30(@anthropic-ai/sdk@0.40.1(encoding@0.1.13))(@cloudflare/workers-types@4.20250614.0)(@google/genai@1.5.1(@modelcontextprotocol/sdk@1.12.2)(encoding@0.1.13))(@langchain/core@0.3.58(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.76)))(@mistralai/mistralai@1.7.2(zod@3.25.76))(@qdrant/js-client-rest@1.13.0(typescript@5.8.3))(@supabase/supabase-js@2.50.0)(@types/jest@29.5.14)(@types/pg@8.11.0)(@types/sqlite3@3.1.11)(cloudflare@4.3.0(encoding@0.1.13))(encoding@0.1.13)(groq-sdk@0.3.0(encoding@0.1.13))(neo4j-driver@5.28.1)(ollama@0.5.16)(pg@8.11.3)(redis@5.5.6)(sqlite3@5.1.7)(ws@8.18.3) motion: specifier: ^12.16.0 version: 12.16.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0) @@ -288,8 +288,8 @@ importers: specifier: ^1.1.2 version: 1.1.2(@types/react-dom@19.1.6(@types/react@19.1.6))(@types/react@19.1.6)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) zod: - specifier: ^3.25.56 - version: 3.25.56 + specifier: ^3.25.76 + version: 3.25.76 devDependencies: '@eslint/eslintrc': specifier: ^3.3.1 @@ -348,97 +348,91 @@ importers: packages: - '@ai-sdk/anthropic@1.2.12': - resolution: {integrity: sha512-YSzjlko7JvuiyQFmI9RN1tNZdEiZxc+6xld/0tq/VkJaHpEzGAb1yiNxxvmYVcjvfu/PcvCxAAYXmTYQQ63IHQ==} + '@ai-sdk/anthropic@2.0.79': + resolution: {integrity: sha512-K0U09FPDO1kmLPjRLXFcNSvmnKHJBMARCb8r3Ulw7wU6/+Zh9djWcFDiPPNsklg6yAezcdLTcYPszgWJJ6iOTA==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/fal@0.1.12': - resolution: {integrity: sha512-Z0pUUR3qwLTj4HXgGJSes5fwjUbSowsMiKbpYKGl6V51sQeUk2EjZctdN4+a+GBuDNCP6Y32Wi8ejM54OMee+w==} + '@ai-sdk/fal@1.0.32': + resolution: {integrity: sha512-0tt/PWlW2lejMWCoN5aZmb0hk08DnPipKRoB8AxiqVVkAEbkSU7BYD+oSWjc1+NnDM72VTYJTQKs6DHICcHenw==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/fireworks@0.2.16': - resolution: {integrity: sha512-YHUqW9QHMNjEg5vF0cmhnlAQJCMljWVWNAAFmKCPX31Dj4JaoCjOrIInrNEFerFRaO64hEffhlhuC1EmuO2Lyg==} + '@ai-sdk/fireworks@1.0.40': + resolution: {integrity: sha512-mYSdY/kBLuR6mxD5TcIknjVmnWNoDDy67kqr6663j6sCkkYI08Fjgi/L2pzwRvebF8dB7xvib4QTsFR/BjL7iA==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/google@1.2.19': - resolution: {integrity: sha512-Xgl6eftIRQ4srUdCzxM112JuewVMij5q4JLcNmHcB68Bxn9dpr3MVUSPlJwmameuiQuISIA8lMB+iRiRbFsaqA==} + '@ai-sdk/gateway@2.0.88': + resolution: {integrity: sha512-H62l0gxr4K0rdR2WHbvck2wOKMsocAjdZg41Exsj9Qf5/TyAuHzcNt9jKNv5t2vRFXFZaCpbC5uCCxgUC/GiaA==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/groq@1.2.9': - resolution: {integrity: sha512-7MoDaxm8yWtiRbD1LipYZG0kBl+Xe0sv/EeyxnHnGPZappXdlgtdOgTZVjjXkT3nWP30jjZi9A45zoVrBMb3Xg==} + '@ai-sdk/google@2.0.72': + resolution: {integrity: sha512-BjDY6l+rV4CmHKjZe4H0uRXW3M2o+g7PaYM8oFpW+9PP1qKNEybnJ6//Si7BSf6DT+86dKARrtEl09lxSSaMaA==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/luma@0.1.8': - resolution: {integrity: sha512-6FmUOwZKKldzbTYzS+dNq4LuNb+27gTb/7XQZak46OIUSbBD8FHJm4W/OcUmubuuZ//VHanyyb/QWElipZ/O9w==} + '@ai-sdk/groq@2.0.40': + resolution: {integrity: sha512-1EL8D1tyjOKjCFUt8XspDoA6zxDcalMsLR2O56ji8QklWsAPaf4TuMJAvf5x5KDrkuJaSAjk94KvPH5hOX+VNQ==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/openai-compatible@0.2.14': - resolution: {integrity: sha512-icjObfMCHKSIbywijaoLdZ1nSnuRnWgMEMLgwoxPJgxsUHMx0aVORnsLUid4SPtdhHI3X2masrt6iaEQLvOSFw==} + '@ai-sdk/luma@1.0.27': + resolution: {integrity: sha512-9VTENEhxnVdabZ9aAsdVz53t0Ve9HhtWY462NqR6e6jk920ziNsm5hou3Uvu6uBXAgE2z0/8NyRV00dT3P2VeQ==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/openai-compatible@0.2.16': - resolution: {integrity: sha512-LkvfcM8slJedRyJa/MiMiaOzcMjV1zNDwzTHEGz7aAsgsQV0maLfmJRi/nuSwf5jmp0EouC+JXXDUj2l94HgQw==} + '@ai-sdk/openai-compatible@1.0.39': + resolution: {integrity: sha512-001hdQPPXxYBWrz5d+eAmBVYmwzsB+guIey1DFXi1ZEE5H3j7fRrhPpX55MdM9Fle2DS7WZ8b3qkumCIWE92YQ==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/openai@1.3.22': - resolution: {integrity: sha512-QwA+2EkG0QyjVR+7h6FE7iOu2ivNqAVMm9UJZkVxxTk5OIq5fFJDTEI/zICEMuHImTTXR2JjsL6EirJ28Jc4cw==} + '@ai-sdk/openai@2.0.106': + resolution: {integrity: sha512-EFC0rpo1wfe4HIz5KZCE72edP2J7fOeR7wPXzjCDljaTRB1wectKDIKRLowpU4F0mbcJ+XScAsoYNPK/Z20aVQ==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/perplexity@1.1.9': - resolution: {integrity: sha512-Ytolh/v2XupXbTvjE18EFBrHLoNMH0Ueji3lfSPhCoRUfkwrgZ2D9jlNxvCNCCRiGJG5kfinSHvzrH5vGDklYA==} + '@ai-sdk/perplexity@2.0.30': + resolution: {integrity: sha512-ymXWoItR4tRCIQlJcpn0zk4jBUU+j4SDnliz/z1f5U6rWxNY1ttxFCk4uZ+6Zt9e3VjQTpA9FK6cOJt18JRrKQ==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/provider-utils@2.2.8': - resolution: {integrity: sha512-fqhG+4sCVv8x7nFzYnFo19ryhAa3w096Kmc3hWxMQfW/TubPOmt3A6tYZhl4mUfQWWQMsuSkLrtjlWuXBVSGQA==} + '@ai-sdk/provider-utils@3.0.25': + resolution: {integrity: sha512-CvsRu+32Y8a167s+lrIBtsybvgTHp8j9y+6BeTvLeoW3Q+okw/b4CnNUFOLIXsRaKHQKAH+IHNJPYWywfpw0LA==} engines: {node: '>=18'} peerDependencies: - zod: ^3.23.8 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/provider@1.1.3': - resolution: {integrity: sha512-qZMxYJ0qqX/RfnuIaab+zp8UAeJn/ygXXAffR5I4N0n1IrvA6qBsjc8hXLmBiMV2zoXlifkacF7sEFnYnjBcqg==} + '@ai-sdk/provider@2.0.3': + resolution: {integrity: sha512-h88OPkavHTiN9tMn2l5awAznGB0lXzjcLhgR1/rvjB2zlLprsNxbM2tt6OJsHUxduLC3klq0/eqaSf6fX5XVww==} engines: {node: '>=18'} - '@ai-sdk/react@1.2.12': - resolution: {integrity: sha512-jK1IZZ22evPZoQW3vlkZ7wvjYGYF+tRBKXtrcolduIkQ/m/sOAVcVeVDUDvh1T91xCnWCdUGCPZg2avZ90mv3g==} + '@ai-sdk/react@2.0.188': + resolution: {integrity: sha512-TDJBuC0KE90mdsdmdYOV/5CWj31P9+r1sIJYdeseC218qQRuPkcH+bTjr9PZwPBaxXDOzUQDjosVLVM2lM1TyA==} engines: {node: '>=18'} peerDependencies: - react: ^18 || ^19 || ^19.0.0-rc - zod: ^3.23.8 + react: ^18 || ~19.0.1 || ~19.1.2 || ^19.2.1 + zod: ^3.25.76 || ^4.1.8 peerDependenciesMeta: zod: optional: true - '@ai-sdk/ui-utils@1.2.11': - resolution: {integrity: sha512-3zcwCc8ezzFlwp3ZD15wAPjf2Au4s3vAbKsXQVyhxODHcmu0iyPO2Eua6D/vicq/AUm/BAo60r97O6HU+EI0+w==} - engines: {node: '>=18'} - peerDependencies: - zod: ^3.23.8 - - '@ai-sdk/xai@1.2.16': - resolution: {integrity: sha512-UOZT8td9PWwMi2dF9a0U44t/Oltmf6QmIJdSvrOcLG4mvpRc1UJn6YJaR0HtXs3YnW6SvY1zRdIDrW4GFpv4NA==} + '@ai-sdk/xai@2.0.72': + resolution: {integrity: sha512-RXpfCTliybesXOmc+jGB7NhobJzzZc2rr7gSy7kGj0eHDYXkCmoo4/llpE8yKIUJMwU098DP1cBGdltPezNRiw==} engines: {node: '>=18'} peerDependencies: - zod: ^3.0.0 + zod: ^3.25.76 || ^4.1.8 '@alloc/quick-lru@5.2.0': resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} @@ -1164,12 +1158,15 @@ packages: resolution: {integrity: sha512-16TtZXNOfH8RaRsV+iag5dTYeJvdOdZDBcpEPCULdKS3eTRJqAYxBNZPFaDJ3cx3WNyvbaQ0IxsPpnaR/tgGFA==} engines: {node: '>= 20'} - '@openrouter/ai-sdk-provider@0.7.2': - resolution: {integrity: sha512-Fry2mV7uGGJRmP9JntTZRc8ElESIk7AJNTacLbF6Syoeb5k8d7HPGkcK9rTXDlqBb8HgU1hOKtz23HojesTmnw==} + '@openrouter/ai-sdk-provider@1.5.4': + resolution: {integrity: sha512-xrSQPUIH8n9zuyYZR0XK7Ba0h2KsjJcMkxnwaYfmv13pKs3sDkjPzVPPhlhzqBGddHb5cFEwJ9VFuFeDcxCDSw==} engines: {node: '>=18'} peerDependencies: - ai: ^4.3.16 - zod: ^3.25.34 + ai: ^5.0.0 + zod: ^3.24.1 || ^v4 + + '@openrouter/sdk@0.1.27': + resolution: {integrity: sha512-RH//L10bSmc81q25zAZudiI4kNkLgxF2E+WU42vghp3N6TEvZ6F0jK7uT3tOxkEn91gzmMw9YVmDENy7SJsajQ==} '@opentelemetry/api@1.9.0': resolution: {integrity: sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==} @@ -1801,6 +1798,9 @@ packages: '@spotify/web-api-ts-sdk@1.2.0': resolution: {integrity: sha512-JUaebva3Ohwo5I5tuTqyW/FKGOMbb40YevJMySAOINRxP7qQ/AMjBzfJx0zeO6yS+wAPfQSoGNsZaUggHw8vsA==} + '@standard-schema/spec@1.1.0': + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + '@standard-schema/utils@0.3.0': resolution: {integrity: sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==} @@ -2043,9 +2043,6 @@ packages: '@types/debug@4.1.12': resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} - '@types/diff-match-patch@1.0.36': - resolution: {integrity: sha512-xFdR6tkm0MWvBfO8xXCSsinYxHcqkQUlcHeSpMC2ukzOb6lwQAfDmW+Qt0AvlGd8HpsS28qKsB+oPeJn9I39jg==} - '@types/estree-jsx@1.0.5': resolution: {integrity: sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==} @@ -2328,6 +2325,10 @@ packages: next: optional: true + '@vercel/oidc@3.1.0': + resolution: {integrity: sha512-Fw28YZpRnA3cAHHDlkt7xQHiJ0fcL+NRcIqsocZQUSmbzeIKRpwttJjik5ZGanXP+vlA4SbTg+AbA3bP363l+w==} + engines: {node: '>= 20'} + '@vercel/speed-insights@1.2.0': resolution: {integrity: sha512-y9GVzrUJ2xmgtQlzFP2KhVRoCglwfRQgjyfY607aU0hh0Un6d0OUyrJkjuAlsV18qR4zfoFPs/BiIj9YDS6Wzw==} peerDependencies: @@ -2401,15 +2402,11 @@ packages: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} engines: {node: '>=8'} - ai@4.3.16: - resolution: {integrity: sha512-KUDwlThJ5tr2Vw0A1ZkbDKNME3wzWhuVfAOwIvFUzl1TPVDFAXDFTXio3p+jaKneB+dKNCvFFlolYmmgHttG1g==} + ai@5.0.186: + resolution: {integrity: sha512-0HVwYO9k/x5eSNggqya/75uirBLjkZoL5QdNp9ftjOCl/IXWSzqys/SzsL3ifWBz603a0KbW+EZyYVtmbFJrTQ==} engines: {node: '>=18'} peerDependencies: - react: ^18 || ^19 || ^19.0.0-rc - zod: ^3.23.8 - peerDependenciesMeta: - react: - optional: true + zod: ^3.25.76 || ^4.1.8 ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -2925,9 +2922,6 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} - diff-match-patch@1.0.5: - resolution: {integrity: sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==} - diff-sequences@29.6.3: resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -3208,6 +3202,10 @@ packages: resolution: {integrity: sha512-6RxOBZ/cYgd8usLwsEl+EC09Au/9BcmCKYF2/xbml6DNczf7nv0MQb+7BA2F+li6//I+28VNlQR37XfQtcAJuA==} engines: {node: '>=18.0.0'} + eventsource-parser@3.0.8: + resolution: {integrity: sha512-70QWGkr4snxr0OXLRWsFLeRBIRPuQOvt4s8QYjmUlmlkyTZkRqS7EDVRZtzU3TiyDbXSzaOeF0XUKy8PchzukQ==} + engines: {node: '>=18.0.0'} + eventsource@3.0.7: resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==} engines: {node: '>=18.0.0'} @@ -3437,7 +3435,7 @@ packages: glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me globals@14.0.0: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} @@ -3879,11 +3877,6 @@ packages: resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} hasBin: true - jsondiffpatch@0.6.0: - resolution: {integrity: sha512-3QItJOXp2AP1uv7waBkao5nCvhEv+QmJAd38Ybq7wNI74Q+BBmnLn4EDKz6yI9xGAIQoUF87qHt+kc1IVxB4zQ==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - jsx-ast-utils@3.3.5: resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==} engines: {node: '>=4.0'} @@ -4743,6 +4736,7 @@ packages: prebuild-install@7.1.3: resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==} engines: {node: '>=10'} + deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available. hasBin: true prelude-ls@1.2.1: @@ -5080,9 +5074,6 @@ packages: scheduler@0.26.0: resolution: {integrity: sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==} - secure-json-parse@2.7.0: - resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==} - semver@6.3.1: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true @@ -5346,6 +5337,7 @@ packages: tar@6.2.1: resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} engines: {node: '>=10'} + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me tar@7.4.3: resolution: {integrity: sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==} @@ -5552,6 +5544,7 @@ packages: uuid@10.0.0: resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). hasBin: true uuid@11.1.0: @@ -5672,12 +5665,12 @@ packages: peerDependencies: zod: ^3.24.1 - zod@3.25.56: - resolution: {integrity: sha512-rd6eEF3BTNvQnR2e2wwolfTmUTnp70aUTqr0oaGbHifzC3BKJsoV+Gat8vxUMR1hwOKBs6El+qWehrHbCpW6SQ==} - zod@3.25.76: resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==} + zod@4.4.3: + resolution: {integrity: sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==} + zustand@4.5.7: resolution: {integrity: sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==} engines: {node: '>=12.7.0'} @@ -5698,101 +5691,95 @@ packages: snapshots: - '@ai-sdk/anthropic@1.2.12(zod@3.25.56)': + '@ai-sdk/anthropic@2.0.79(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 - '@ai-sdk/fal@0.1.12(zod@3.25.56)': + '@ai-sdk/fal@1.0.32(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 - '@ai-sdk/fireworks@0.2.16(zod@3.25.56)': + '@ai-sdk/fireworks@1.0.40(zod@3.25.76)': dependencies: - '@ai-sdk/openai-compatible': 0.2.16(zod@3.25.56) - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/openai-compatible': 1.0.39(zod@3.25.76) + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 - '@ai-sdk/google@1.2.19(zod@3.25.56)': + '@ai-sdk/gateway@2.0.88(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + '@vercel/oidc': 3.1.0 + zod: 3.25.76 - '@ai-sdk/groq@1.2.9(zod@3.25.56)': + '@ai-sdk/google@2.0.72(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 - '@ai-sdk/luma@0.1.8(zod@3.25.56)': + '@ai-sdk/groq@2.0.40(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 - '@ai-sdk/openai-compatible@0.2.14(zod@3.25.56)': + '@ai-sdk/luma@1.0.27(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 - '@ai-sdk/openai-compatible@0.2.16(zod@3.25.56)': + '@ai-sdk/openai-compatible@1.0.39(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 - '@ai-sdk/openai@1.3.22(zod@3.25.56)': + '@ai-sdk/openai@2.0.106(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 - '@ai-sdk/perplexity@1.1.9(zod@3.25.56)': + '@ai-sdk/perplexity@2.0.30(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 - '@ai-sdk/provider-utils@2.2.8(zod@3.25.56)': + '@ai-sdk/provider-utils@3.0.25(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - nanoid: 3.3.11 - secure-json-parse: 2.7.0 - zod: 3.25.56 + '@ai-sdk/provider': 2.0.3 + '@standard-schema/spec': 1.1.0 + eventsource-parser: 3.0.8 + zod: 3.25.76 - '@ai-sdk/provider@1.1.3': + '@ai-sdk/provider@2.0.3': dependencies: json-schema: 0.4.0 - '@ai-sdk/react@1.2.12(react@19.1.0)(zod@3.25.56)': + '@ai-sdk/react@2.0.188(react@19.1.0)(zod@3.25.76)': dependencies: - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - '@ai-sdk/ui-utils': 1.2.11(zod@3.25.56) + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + ai: 5.0.186(zod@3.25.76) react: 19.1.0 swr: 2.3.3(react@19.1.0) throttleit: 2.1.0 optionalDependencies: - zod: 3.25.56 - - '@ai-sdk/ui-utils@1.2.11(zod@3.25.56)': - dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 - zod-to-json-schema: 3.24.5(zod@3.25.56) + zod: 3.25.76 - '@ai-sdk/xai@1.2.16(zod@3.25.56)': + '@ai-sdk/xai@2.0.72(zod@3.25.76)': dependencies: - '@ai-sdk/openai-compatible': 0.2.14(zod@3.25.56) - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - zod: 3.25.56 + '@ai-sdk/openai-compatible': 1.0.39(zod@3.25.76) + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) + zod: 3.25.76 '@alloc/quick-lru@5.2.0': {} @@ -6197,14 +6184,14 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@langchain/core@0.3.58(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.56))': + '@langchain/core@0.3.58(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.76))': dependencies: '@cfworker/json-schema': 4.1.1 ansi-styles: 5.2.0 camelcase: 6.3.0 decamelize: 1.2.0 js-tiktoken: 1.0.20 - langsmith: 0.3.50(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.56)) + langsmith: 0.3.50(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.76)) mustache: 4.2.0 p-queue: 6.6.2 p-retry: 4.6.2 @@ -6248,10 +6235,10 @@ snapshots: transitivePeerDependencies: - react - '@mistralai/mistralai@1.7.2(zod@3.25.56)': + '@mistralai/mistralai@1.7.2(zod@3.25.76)': dependencies: - zod: 3.25.56 - zod-to-json-schema: 3.24.6(zod@3.25.56) + zod: 3.25.76 + zod-to-json-schema: 3.24.6(zod@3.25.76) '@modelcontextprotocol/sdk@1.12.2': dependencies: @@ -6264,8 +6251,8 @@ snapshots: express-rate-limit: 7.5.0(express@5.1.0) pkce-challenge: 5.0.0 raw-body: 3.0.0 - zod: 3.25.56 - zod-to-json-schema: 3.24.5(zod@3.25.56) + zod: 3.25.76 + zod-to-json-schema: 3.24.5(zod@3.25.76) transitivePeerDependencies: - supports-color @@ -6481,12 +6468,15 @@ snapshots: '@octokit/request-error': 7.0.0 '@octokit/webhooks-methods': 6.0.0 - '@openrouter/ai-sdk-provider@0.7.2(ai@4.3.16(react@19.1.0)(zod@3.25.56))(zod@3.25.56)': + '@openrouter/ai-sdk-provider@1.5.4(ai@5.0.186(zod@3.25.76))(zod@3.25.76)': dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - ai: 4.3.16(react@19.1.0)(zod@3.25.56) - zod: 3.25.56 + '@openrouter/sdk': 0.1.27 + ai: 5.0.186(zod@3.25.76) + zod: 3.25.76 + + '@openrouter/sdk@0.1.27': + dependencies: + zod: 4.4.3 '@opentelemetry/api@1.9.0': {} @@ -7114,6 +7104,8 @@ snapshots: '@spotify/web-api-ts-sdk@1.2.0': {} + '@standard-schema/spec@1.1.0': {} + '@standard-schema/utils@0.3.0': {} '@supabase/auth-js@2.70.0': @@ -7164,17 +7156,17 @@ snapshots: dependencies: tslib: 2.8.1 - '@t3-oss/env-core@0.12.0(typescript@5.8.3)(zod@3.25.56)': + '@t3-oss/env-core@0.12.0(typescript@5.8.3)(zod@3.25.76)': optionalDependencies: typescript: 5.8.3 - zod: 3.25.56 + zod: 3.25.76 - '@t3-oss/env-nextjs@0.12.0(typescript@5.8.3)(zod@3.25.56)': + '@t3-oss/env-nextjs@0.12.0(typescript@5.8.3)(zod@3.25.76)': dependencies: - '@t3-oss/env-core': 0.12.0(typescript@5.8.3)(zod@3.25.56) + '@t3-oss/env-core': 0.12.0(typescript@5.8.3)(zod@3.25.76) optionalDependencies: typescript: 5.8.3 - zod: 3.25.56 + zod: 3.25.76 '@tailwindcss/node@4.1.8': dependencies: @@ -7336,8 +7328,6 @@ snapshots: dependencies: '@types/ms': 2.1.0 - '@types/diff-match-patch@1.0.36': {} - '@types/estree-jsx@1.0.5': dependencies: '@types/estree': 1.0.8 @@ -7610,6 +7600,8 @@ snapshots: optionalDependencies: next: 15.3.3(@opentelemetry/api@1.9.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + '@vercel/oidc@3.1.0': {} + '@vercel/speed-insights@1.2.0(next@15.3.3(@opentelemetry/api@1.9.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react@19.1.0)': optionalDependencies: next: 15.3.3(@opentelemetry/api@1.9.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) @@ -7677,17 +7669,13 @@ snapshots: indent-string: 4.0.0 optional: true - ai@4.3.16(react@19.1.0)(zod@3.25.56): + ai@5.0.186(zod@3.25.76): dependencies: - '@ai-sdk/provider': 1.1.3 - '@ai-sdk/provider-utils': 2.2.8(zod@3.25.56) - '@ai-sdk/react': 1.2.12(react@19.1.0)(zod@3.25.56) - '@ai-sdk/ui-utils': 1.2.11(zod@3.25.56) + '@ai-sdk/gateway': 2.0.88(zod@3.25.76) + '@ai-sdk/provider': 2.0.3 + '@ai-sdk/provider-utils': 3.0.25(zod@3.25.76) '@opentelemetry/api': 1.9.0 - jsondiffpatch: 0.6.0 - zod: 3.25.56 - optionalDependencies: - react: 19.1.0 + zod: 3.25.76 ajv@6.12.6: dependencies: @@ -8231,8 +8219,6 @@ snapshots: dependencies: dequal: 2.0.3 - diff-match-patch@1.0.5: {} - diff-sequences@29.6.3: {} digest-fetch@1.3.0: @@ -8685,15 +8671,17 @@ snapshots: eventsource-parser@3.0.2: {} + eventsource-parser@3.0.8: {} + eventsource@3.0.7: dependencies: eventsource-parser: 3.0.2 - exa-js@1.8.8(encoding@0.1.13)(ws@8.18.3)(zod@3.25.56): + exa-js@1.8.8(encoding@0.1.13)(ws@8.18.3)(zod@3.25.76): dependencies: cross-fetch: 4.1.0(encoding@0.1.13) dotenv: 16.4.7 - openai: 5.3.0(ws@8.18.3)(zod@3.25.56) + openai: 5.3.0(ws@8.18.3)(zod@3.25.76) transitivePeerDependencies: - encoding - ws @@ -9542,12 +9530,6 @@ snapshots: dependencies: minimist: 1.2.8 - jsondiffpatch@0.6.0: - dependencies: - '@types/diff-match-patch': 1.0.36 - chalk: 5.4.1 - diff-match-patch: 1.0.5 - jsx-ast-utils@3.3.5: dependencies: array-includes: 3.1.9 @@ -9574,7 +9556,7 @@ snapshots: dependencies: json-buffer: 3.0.1 - langsmith@0.3.50(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.56)): + langsmith@0.3.50(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.76)): dependencies: '@types/uuid': 10.0.0 chalk: 4.1.2 @@ -9585,7 +9567,7 @@ snapshots: uuid: 10.0.0 optionalDependencies: '@opentelemetry/api': 1.9.0 - openai: 5.3.0(ws@8.18.3)(zod@3.25.56) + openai: 5.3.0(ws@8.18.3)(zod@3.25.76) language-subtag-registry@0.3.23: {} @@ -9894,13 +9876,13 @@ snapshots: media-typer@1.1.0: {} - mem0ai@2.1.30(@anthropic-ai/sdk@0.40.1(encoding@0.1.13))(@cloudflare/workers-types@4.20250614.0)(@google/genai@1.5.1(@modelcontextprotocol/sdk@1.12.2)(encoding@0.1.13))(@langchain/core@0.3.58(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.56)))(@mistralai/mistralai@1.7.2(zod@3.25.56))(@qdrant/js-client-rest@1.13.0(typescript@5.8.3))(@supabase/supabase-js@2.50.0)(@types/jest@29.5.14)(@types/pg@8.11.0)(@types/sqlite3@3.1.11)(cloudflare@4.3.0(encoding@0.1.13))(encoding@0.1.13)(groq-sdk@0.3.0(encoding@0.1.13))(neo4j-driver@5.28.1)(ollama@0.5.16)(pg@8.11.3)(redis@5.5.6)(sqlite3@5.1.7)(ws@8.18.3): + mem0ai@2.1.30(@anthropic-ai/sdk@0.40.1(encoding@0.1.13))(@cloudflare/workers-types@4.20250614.0)(@google/genai@1.5.1(@modelcontextprotocol/sdk@1.12.2)(encoding@0.1.13))(@langchain/core@0.3.58(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.76)))(@mistralai/mistralai@1.7.2(zod@3.25.76))(@qdrant/js-client-rest@1.13.0(typescript@5.8.3))(@supabase/supabase-js@2.50.0)(@types/jest@29.5.14)(@types/pg@8.11.0)(@types/sqlite3@3.1.11)(cloudflare@4.3.0(encoding@0.1.13))(encoding@0.1.13)(groq-sdk@0.3.0(encoding@0.1.13))(neo4j-driver@5.28.1)(ollama@0.5.16)(pg@8.11.3)(redis@5.5.6)(sqlite3@5.1.7)(ws@8.18.3): dependencies: '@anthropic-ai/sdk': 0.40.1(encoding@0.1.13) '@cloudflare/workers-types': 4.20250614.0 '@google/genai': 1.5.1(@modelcontextprotocol/sdk@1.12.2)(encoding@0.1.13) - '@langchain/core': 0.3.58(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.56)) - '@mistralai/mistralai': 1.7.2(zod@3.25.56) + '@langchain/core': 0.3.58(@opentelemetry/api@1.9.0)(openai@5.3.0(ws@8.18.3)(zod@3.25.76)) + '@mistralai/mistralai': 1.7.2(zod@3.25.76) '@qdrant/js-client-rest': 1.13.0(typescript@5.8.3) '@supabase/supabase-js': 2.50.0 '@types/jest': 29.5.14 @@ -9911,12 +9893,12 @@ snapshots: groq-sdk: 0.3.0(encoding@0.1.13) neo4j-driver: 5.28.1 ollama: 0.5.16 - openai: 4.104.0(encoding@0.1.13)(ws@8.18.3)(zod@3.25.56) + openai: 4.104.0(encoding@0.1.13)(ws@8.18.3)(zod@3.25.76) pg: 8.11.3 redis: 5.5.6 sqlite3: 5.1.7 uuid: 9.0.1 - zod: 3.25.56 + zod: 3.25.76 transitivePeerDependencies: - debug - encoding @@ -10424,7 +10406,7 @@ snapshots: regex: 6.0.1 regex-recursion: 6.0.2 - openai@4.104.0(encoding@0.1.13)(ws@8.18.3)(zod@3.25.56): + openai@4.104.0(encoding@0.1.13)(ws@8.18.3)(zod@3.25.76): dependencies: '@types/node': 18.19.111 '@types/node-fetch': 2.6.12 @@ -10435,14 +10417,14 @@ snapshots: node-fetch: 2.7.0(encoding@0.1.13) optionalDependencies: ws: 8.18.3 - zod: 3.25.56 + zod: 3.25.76 transitivePeerDependencies: - encoding - openai@5.3.0(ws@8.18.3)(zod@3.25.56): + openai@5.3.0(ws@8.18.3)(zod@3.25.76): optionalDependencies: ws: 8.18.3 - zod: 3.25.56 + zod: 3.25.76 openapi-fetch@0.9.8: dependencies: @@ -11005,8 +10987,6 @@ snapshots: scheduler@0.26.0: {} - secure-json-parse@2.7.0: {} - semver@6.3.1: {} semver@7.7.2: {} @@ -11749,22 +11729,18 @@ snapshots: yocto-queue@0.1.0: {} - zod-to-json-schema@3.24.5(zod@3.25.56): + zod-to-json-schema@3.24.5(zod@3.25.76): dependencies: - zod: 3.25.56 - - zod-to-json-schema@3.24.6(zod@3.25.56): - dependencies: - zod: 3.25.56 + zod: 3.25.76 zod-to-json-schema@3.24.6(zod@3.25.76): dependencies: zod: 3.25.76 - zod@3.25.56: {} - zod@3.25.76: {} + zod@4.4.3: {} + zustand@4.5.7(@types/react@19.1.6)(react@19.1.0): dependencies: use-sync-external-store: 1.5.0(react@19.1.0) diff --git a/src/ai/language/generate.ts b/src/ai/language/generate.ts index 89b0b494..98047fb4 100644 --- a/src/ai/language/generate.ts +++ b/src/ai/language/generate.ts @@ -9,7 +9,7 @@ export const generateText = ( return generateTextAi({ model: openrouter(model), ...params, - }); + } as Parameters[0]); }; export const streamText = ( @@ -19,5 +19,5 @@ export const streamText = ( return streamTextAi({ model: openrouter(model), ...params, - }); + } as Parameters[0]); }; diff --git a/src/app/(general)/_components/chat/index.tsx b/src/app/(general)/_components/chat/index.tsx index e617820a..c5b00e61 100644 --- a/src/app/(general)/_components/chat/index.tsx +++ b/src/app/(general)/_components/chat/index.tsx @@ -2,7 +2,6 @@ import { db } from "@/server/db"; import { ChatProvider } from "@/app/(general)/_contexts/chat-context"; import type { Message, Workbench } from "@prisma/client"; import { ChatLayout } from "./layout"; -import type { Attachment, UIMessage } from "ai"; import { languageModels } from "@/ai/language"; import { ChatContent } from "./chat"; import { serverCookieUtils } from "@/lib/cookies/server"; @@ -10,6 +9,11 @@ import { clientToolkits } from "@/toolkits/toolkits/client"; import type { ClientToolkit } from "@/toolkits/types"; import type { z } from "zod"; import type { PersistedToolkit } from "@/lib/cookies/types"; +import { + attachmentToFilePart, + type AppUIMessage, + type ChatAttachment, +} from "@/app/(general)/_types/chat"; interface Props { id: string; @@ -68,20 +72,25 @@ export const Chat = async ({ ), }; - const convertToUIMessages = (messages: Array): Array => { - return messages.map((message) => ({ - id: message.id, - parts: message.parts as UIMessage["parts"], - role: message.role as UIMessage["role"], - // Note: content will soon be deprecated in @ai-sdk/react - content: "", - createdAt: message.createdAt, - experimental_attachments: - (message.attachments as unknown as Array) ?? [], - annotations: message.modelId - ? [ - { - type: "model", + const convertToUIMessages = ( + messages: Array, + ): Array => { + return messages.map((message) => { + const parts = (message.parts as AppUIMessage["parts"]) ?? []; + const hasFileParts = parts.some((part) => part.type === "file"); + const attachments = ( + (message.attachments as unknown as Array) ?? [] + ) + .filter((attachment) => attachment.url) + .map(attachmentToFilePart); + + return { + id: message.id, + parts: [...parts, ...(hasFileParts ? [] : attachments)], + role: message.role as AppUIMessage["role"], + createdAt: message.createdAt, + metadata: message.modelId + ? { model: (() => { const [provider, modelId] = message.modelId.split("/"); const model = languageModels.find( @@ -98,10 +107,10 @@ export const Chat = async ({ } ); })(), - }, - ] - : undefined, - })); + } + : undefined, + }; + }); }; return ( diff --git a/src/app/(general)/_components/chat/input/index.tsx b/src/app/(general)/_components/chat/input/index.tsx index 29428372..bea21250 100644 --- a/src/app/(general)/_components/chat/input/index.tsx +++ b/src/app/(general)/_components/chat/input/index.tsx @@ -28,17 +28,18 @@ import { cn } from "@/lib/utils"; import { ModelSelect } from "./model-select"; import { useChatContext } from "@/app/(general)/_contexts/chat-context"; -import type { Attachment } from "ai"; import type { UseChatHelpers } from "@ai-sdk/react"; import { ToolsSelect } from "./tools"; import type { File as DbFile } from "@prisma/client"; import { LanguageModelCapability } from "@/ai/language/types"; +import { attachmentToFilePart } from "@/app/(general)/_types/chat"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; +import type { AppUIMessage, ChatAttachment } from "@/app/(general)/_types/chat"; interface Props { chatId: string; @@ -60,7 +61,7 @@ const PureMultimodalInput: React.FC = ({ attachments, setAttachments, setMessages, - handleSubmit, + sendMessage, selectedChatModel, workbench, } = useChatContext(); @@ -175,11 +176,13 @@ const PureMultimodalInput: React.FC = ({ window.history.replaceState({}, "", `/${chatId}`); } - handleSubmit(undefined, { - experimental_attachments: attachments, + void sendMessage({ + text: input, + files: attachments.map(attachmentToFilePart), }); setAttachments([]); + setInput(""); setLocalStorageInput(""); resetHeight(); @@ -190,7 +193,9 @@ const PureMultimodalInput: React.FC = ({ selectedChatModel, submitDisabledString, attachments, - handleSubmit, + sendMessage, + input, + setInput, setAttachments, setLocalStorageInput, width, @@ -199,7 +204,7 @@ const PureMultimodalInput: React.FC = ({ ]); const uploadFile = useCallback( - async (file: File): Promise => { + async (file: File): Promise => { const formData = new FormData(); formData.append("file", file); @@ -217,7 +222,7 @@ const PureMultimodalInput: React.FC = ({ return { url, name, - contentType, + contentType: contentType as ChatAttachment["contentType"], }; } const { error } = (await response.json()) as { error: string }; @@ -242,10 +247,11 @@ const PureMultimodalInput: React.FC = ({ const uploadPromises = files.map((file) => uploadFile(file)); const uploadedAttachments = await Promise.all(uploadPromises); const successfullyUploadedAttachments = uploadedAttachments.filter( - (attachment): attachment is Attachment => attachment !== undefined, + (attachment): attachment is ChatAttachment => + attachment !== undefined, ); - setAttachments((currentAttachments: Attachment[]) => [ + setAttachments((currentAttachments: ChatAttachment[]) => [ ...currentAttachments, ...successfullyUploadedAttachments, ]); @@ -265,8 +271,8 @@ const PureMultimodalInput: React.FC = ({ }, [status, scrollToBottom]); const removeAttachment = useCallback( - (attachmentToRemove: Attachment) => { - setAttachments((currentAttachments: Attachment[]) => + (attachmentToRemove: ChatAttachment) => { + setAttachments((currentAttachments: ChatAttachment[]) => currentAttachments.filter( (attachment) => attachment.url !== attachmentToRemove.url, ), @@ -308,11 +314,11 @@ const PureMultimodalInput: React.FC = ({ Promise.all(imageFiles.map((file) => uploadFile(file))) .then((uploadedAttachments) => { const successfullyUploadedAttachments = uploadedAttachments.filter( - (attachment): attachment is Attachment => + (attachment): attachment is ChatAttachment => attachment !== undefined, ); - setAttachments((currentAttachments: Attachment[]) => [ + setAttachments((currentAttachments: ChatAttachment[]) => [ ...currentAttachments, ...successfullyUploadedAttachments, ]); @@ -508,7 +514,7 @@ function PureAttachmentsButton({ disabledString, }: { fileInputRef: React.MutableRefObject; - status: UseChatHelpers["status"]; + status: UseChatHelpers["status"]; disabledString: string; }) { const button = ( @@ -553,8 +559,8 @@ function PureStopButton({ stop, setMessages, }: { - stop: () => void; - setMessages: UseChatHelpers["setMessages"]; + stop: UseChatHelpers["stop"]; + setMessages: UseChatHelpers["setMessages"]; }) { return (