Repository navigation
Upgrade TanStack AI to 0.69 and move tool approval to interrupts - #5
Merged
Merged
Conversation
- Bump @tanstack/ai 0.69.0, ai-react 0.30.4, ai-client 0.39.3, ai-openrouter 0.22.0, ai-event-client 0.13.1, react-ai-devtools 0.2.71. - Tool approval (02.03+) now reads `interrupts` from useChat and calls `resolveInterrupt(true | false)`. addToolApprovalResponse is deprecated. - Chat routes with client tools (02.02+) forward runId, parentRunId, and resume, so chat() can continue a paused run. - Move reasoning from modelOptions to the `reasoning` option on chat(). - Render text parts with TextPart from @tanstack/ai-react/ui and remove react-markdown. - OpenRouter removed openai/gpt-oss-120b:free. Use nvidia/nemotron-3-super-120b-a12b:free (free, tools, reasoning, structured output). - Update the READMEs and refresh the tracked lockfiles.
Example apps and a fresh playground had no prisma/data.db, so the home page failed with "The table main.Category does not exist". Each app now has a `predev` script that runs prisma/ensure-db.js. On the first start, it copies .env.example to .env if .env is missing. If prisma/data.db is missing, it applies the migrations and runs the seed. After that, it does nothing.
The app creates an empty prisma/data.db when it starts without a database. The playground then saves and restores that empty file, so the file check skipped the setup. ensure-db.js now uses node:sqlite to check for the Category table.
Lockfiles are not committed since 33d78eb, so `npm ci` fails with EUSAGE. The test job on main has been red since that commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review the 02.03 approval step first: it now uses the TanStack AI interrupts API. This PR upgrades TanStack AI from 0.22 to 0.69 in all exercises. It also replaces the OpenRouter model, because OpenRouter removed
openai/gpt-oss-120b:free. Without the new model, the chat fails onmaintoday.What changed
interruptsfromuseChatand callsapproval.resolveInterrupt(true | false).addToolApprovalResponseis deprecated. In the 02.03 problem, the learner wires the two buttons, the same task as before.api.chat.tsxforwardsrunId,parentRunId, andresumetochat()for this. The 02.02 problem has this code already, with a 🦉 note.modelOptions: { reasoning: { effort: 'medium' } }is nowreasoning: 'medium'onchat().TextPartfrom@tanstack/ai-react/ui.react-markdownis removed.nvidia/nemotron-3-super-120b-a12b:free. It is free and supports tools, reasoning, and structured output.Database on first start. Example apps and a fresh playground had no
prisma/data.db. The home page failed with "The tablemain.Categorydoes not exist". Each app now has apredevscript that runsprisma/ensure-db.js:.envis missing, it copies.env.exampleto.env.prisma/data.dbhas no tables, it applies the migrations and runs the seed (about 15 seconds, one time only). It checks for theCategorytable with the built-innode:sqlite, because the app creates an emptydata.dbwhen it starts without a database.The READMEs for 01.x, 01.03, 02.02, and 02.03 explain the new APIs. The tracked
package-lock.jsonfiles are regenerated. The old ones were stale, so the diff is large.Testing
Commands run
npm run typecheckin all 10 solution apps: pass. The only error is inapp/epicshop.tsx. That error is also onmainand comes from@epic-web/workshop-utils.npm run lint: pass. The warnings are old, in problem stub files.ChatClientagainst the dev servers of 02.03 and 03.03, with the real tool definitions:addToCartran, and the model confirmed the add.addToCartdid not run,approval.approvedwasfalse, and the model answered the rejection.navigateTo: the client tool ran, and the run finished./api/compare: the structured output was valid with the new model.npm run predevin a fresh 02.03 solution createdprisma/data.dband seeded it. On a playground with an empty 0-bytedata.db, it created the tables and seeded them. A second run did nothing (0.5 seconds). The home page then loaded with categories.npm run start, so thepredevscript does not run there.Manual test
How this PR makes testing easy
There are no new automated tests. The manual steps above use the existing solution apps.
Risk / rollback
gpt-oss-120b. If its quality is too low, change the model string in each route.npm installagain.predevscript changes the database only when theCategorytable is missing. It does not touch a database that has data.