Skip to content

Upgrade TanStack AI to 0.69 and move tool approval to interrupts - #5

Merged
AlemTuzlak merged 4 commits into
mainfrom
feat/tanstack-ai-0.69
Oct 15, 2026
Merged

AlemTuzlak merged 4 commits into
mainfrom
feat/tanstack-ai-0.69

Conversation

@AlemTuzlak

@AlemTuzlak AlemTuzlak commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

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 on main today.

What changed

  1. Tool approval (02.03 onward). The approval card reads interrupts from useChat and calls approval.resolveInterrupt(true | false). addToolApprovalResponse is deprecated. In the 02.03 problem, the learner wires the two buttons, the same task as before.
  2. Run forwarding (02.02 onward). Client tools and approvals now pause the run. The browser continues the run with a second request. api.chat.tsx forwards runId, parentRunId, and resume to chat() for this. The 02.02 problem has this code already, with a 🦉 note.
  3. Reasoning (01.03 onward). modelOptions: { reasoning: { effort: 'medium' } } is now reasoning: 'medium' on chat().
  4. Markdown. Text parts render with TextPart from @tanstack/ai-react/ui. react-markdown is removed.
  5. Model. All routes use 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 table main.Category does not exist". Each app now has a predev script that runs prisma/ensure-db.js:

  • If .env is missing, it copies .env.example to .env.
  • If prisma/data.db has no tables, it applies the migrations and runs the seed (about 15 seconds, one time only). It checks for the Category table with the built-in node:sqlite, because the app creates an empty data.db when it starts without a database.
  • If the setup fails, it removes the half-made database, so the next start tries again.

The READMEs for 01.x, 01.03, 02.02, and 02.03 explain the new APIs. The tracked package-lock.json files are regenerated. The old ones were stale, so the diff is large.

Testing

Commands run

  • npm run typecheck in all 10 solution apps: pass. The only error is in app/epicshop.tsx. That error is also on main and comes from @epic-web/workshop-utils.
  • npm run lint: pass. The warnings are old, in problem stub files.
  • A Node script ran the real ChatClient against the dev servers of 02.03 and 03.03, with the real tool definitions:
    • Approve: the approval appeared, addToCart ran, and the model confirmed the add.
    • Reject: addToCart did not run, approval.approved was false, 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 predev in a fresh 02.03 solution created prisma/data.db and seeded it. On a playground with an empty 0-byte data.db, it created the tables and seeded them. A second run did nothing (0.5 seconds). The home page then loaded with categories.
  • Not run: Playwright e2e. CI runs it. CI uses npm run start, so the predev script does not run there.

Manual test

  1. Open the workshop app and start the 02.03 solution app. The first start creates and seeds the database. The home page loads.
  2. Open a product page, then open the chat.
  3. Send "Add this to my cart, size 10, color Black".
  4. Click Yes, add it. The card changes to "✅ Added to your cart", and the cart count goes up.
  5. Repeat step 3 and click No, cancel. The card shows "❌ Cancelled — not added".

How this PR makes testing easy

There are no new automated tests. The manual steps above use the existing solution apps.

Risk / rollback

  • The new free model can answer differently from gpt-oss-120b. If its quality is too low, change the model string in each route.
  • A learner with an old install must run npm install again.
  • The predev script changes the database only when the Category table is missing. It does not touch a database that has data.
  • To roll back, revert this PR.

- 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.
@AlemTuzlak
AlemTuzlak merged commit c5acf81 into main Oct 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant