Skip to content

[WIP] feat(ai-gemini): upgrade @google/genai to v2 + migrate Interactions API#781

Draft
jherr wants to merge 10 commits into
mainfrom
gemini-upgrade
Draft

[WIP] feat(ai-gemini): upgrade @google/genai to v2 + migrate Interactions API#781
jherr wants to merge 10 commits into
mainfrom
gemini-upgrade

Conversation

@jherr

@jherr jherr commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Status: WIP / draft. Opening early for visibility. See open items below before review.

Summary

Upgrades @tanstack/ai-gemini to the @google/genai v2 SDK and migrates the
stateful geminiTextInteractions adapter to the SDK 2.x Interactions event
protocol
(the May-2026 Interactions breaking changes):

  • response_mime_type + flat response_format → polymorphic
    response_format: { type, mime_type, schema }.
  • Event translation reworked to route by step index and consume
    step.start / step.delta / step.stop and
    interaction.created / interaction.completed, including streamed
    function-call arguments_delta fragments.

The existing geminiTextInteractions support is carried forward, not
removed — this PR builds on PR #502 and adapts it to the new SDK.

Verification

  • Unit: packages/ai-gemini — 201 passed, incl. all 25
    text-interactions-adapter tests (rewritten to emit SDK 2.x step.* events).
  • E2E (Gemini): chat, tools, multimodal, video-gen all pass under the v2
    SDK against aimock.
  • ⏸️ E2E (Gemini stateful-interactions): quarantined — see below.

Known open item — aimock lags SDK 2.x

The stateful-interactions e2e test is marked test.fixme (skipped, not
failing). Every published @copilotkit/aimock (≤ 1.31.0, latest as of
2026-06-17) still emits the SDK 1.x Interactions events
(content.* / interaction.start / interaction.complete), which the migrated
2.x adapter doesn't consume — so the mock can't exercise this path yet. This is a
mock/adapter format mismatch, not an adapter bug; 2.x behaviour is covered by
unit tests.

The exact event shapes aimock must emit to re-enable the test are documented in
testing/e2e/tests/stateful-interactions.AIMOCK-TODO.md.

TODO before un-drafting

  • Land an aimock release that emits SDK 2.x Interactions events, bump it, and
    un-fixme the e2e test.
  • Add a changeset.
  • Full pnpm test:pr pass.

🤖 Generated with Claude Code

jherr and others added 9 commits June 12, 2026 07:00
… API

Bump @google/genai from ^1.43.0 to ^2.8.0. The v2 SDK replaces the legacy
flat Interactions schema with the new step-based model, so migrate the
experimental text-interactions adapter to the renamed SSE events
(interaction.created / step.start / step.delta / step.stop /
interaction.completed) and the Step data model, switch structured output to
the polymorphic response_format, and drop the deprecated response_mime_type.
Update the 25 text-interactions tests to the new event/step schema and set
allowBuilds['@google/genai'] to false (its install scripts are no-ops for
consumers).

Co-authored-by: Cursor <cursoragent@cursor.com>
# Conflicts:
#	pnpm-workspace.yaml
… 2.x

The @google/genai v2 migration moved geminiTextInteractions onto the SDK 2.x
Interactions event protocol (step.start/step.delta/step.stop,
interaction.created/completed). All published @copilotkit/aimock versions
(≤1.31.0) still emit the SDK 1.x shapes (content.* / interaction.start /
interaction.complete), so the e2e mock and adapter no longer agree on the wire
format and the assistant message comes back empty.

Mark the test test.fixme (skipped, not failing) and document the exact event
shapes aimock must emit to re-enable it. SDK 2.x adapter behaviour stays covered
by unit tests in packages/ai-gemini/tests/text-interactions-adapter.test.ts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28027ce3-73ac-4c19-91a6-2a6f2432417c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gemini-upgrade

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

8 package(s) bumped directly, 24 bumped as dependents.

🟥 Major bumps

Package Version Reason
@tanstack/ai-event-client 0.6.2 → 1.0.0 Changeset
@tanstack/ai-fal 0.8.2 → 1.0.0 Changeset
@tanstack/ai-gemini 0.16.2 → 1.0.0 Changeset
@tanstack/ai-grok 0.11.5 → 1.0.0 Changeset
@tanstack/ai-openai 0.14.4 → 1.0.0 Changeset
@tanstack/ai-openrouter 0.13.4 → 1.0.0 Changeset
@tanstack/ai-angular 0.1.3 → 1.0.0 Dependent
@tanstack/ai-anthropic 0.15.4 → 1.0.0 Dependent
@tanstack/ai-code-mode 0.2.8 → 1.0.0 Dependent
@tanstack/ai-code-mode-skills 0.2.8 → 1.0.0 Dependent
@tanstack/ai-elevenlabs 0.2.23 → 1.0.0 Dependent
@tanstack/ai-groq 0.4.5 → 1.0.0 Dependent
@tanstack/ai-isolate-node 0.1.33 → 1.0.0 Dependent
@tanstack/ai-isolate-quickjs 0.1.33 → 1.0.0 Dependent
@tanstack/ai-ollama 0.8.4 → 1.0.0 Dependent
@tanstack/ai-preact 0.9.8 → 1.0.0 Dependent
@tanstack/ai-react 0.15.8 → 1.0.0 Dependent
@tanstack/ai-react-ui 0.8.8 → 1.0.0 Dependent
@tanstack/ai-solid 0.13.8 → 1.0.0 Dependent
@tanstack/ai-solid-ui 0.7.8 → 1.0.0 Dependent
@tanstack/ai-svelte 0.13.8 → 1.0.0 Dependent
@tanstack/ai-vue 0.13.8 → 1.0.0 Dependent
@tanstack/openai-base 0.8.4 → 1.0.0 Dependent

🟨 Minor bumps

Package Version Reason
@tanstack/ai 0.31.0 → 0.32.0 Changeset
@tanstack/ai-client 0.17.3 → 0.18.0 Changeset

🟩 Patch bumps

Package Version Reason
@tanstack/ai-devtools-core 0.4.11 → 0.4.12 Dependent
@tanstack/ai-isolate-cloudflare 0.2.24 → 0.2.25 Dependent
@tanstack/ai-mcp 0.1.3 → 0.1.4 Dependent
@tanstack/ai-vue-ui 0.2.20 → 0.2.21 Dependent
@tanstack/preact-ai-devtools 0.1.54 → 0.1.55 Dependent
@tanstack/react-ai-devtools 0.2.54 → 0.2.55 Dependent
@tanstack/solid-ai-devtools 0.2.54 → 0.2.55 Dependent

@socket-security

socket-security Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​google/​genai@​2.8.09410010098100

View full report

@nx-cloud

nx-cloud Bot commented Jun 17, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 396b731

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 5m 36s View ↗
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 1m 31s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-17 17:22:34 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/@tanstack/ai@781

@tanstack/ai-angular

npm i https://pkg.pr.new/@tanstack/ai-angular@781

@tanstack/ai-anthropic

npm i https://pkg.pr.new/@tanstack/ai-anthropic@781

@tanstack/ai-client

npm i https://pkg.pr.new/@tanstack/ai-client@781

@tanstack/ai-code-mode

npm i https://pkg.pr.new/@tanstack/ai-code-mode@781

@tanstack/ai-code-mode-skills

npm i https://pkg.pr.new/@tanstack/ai-code-mode-skills@781

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/@tanstack/ai-devtools-core@781

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@781

@tanstack/ai-event-client

npm i https://pkg.pr.new/@tanstack/ai-event-client@781

@tanstack/ai-fal

npm i https://pkg.pr.new/@tanstack/ai-fal@781

@tanstack/ai-gemini

npm i https://pkg.pr.new/@tanstack/ai-gemini@781

@tanstack/ai-grok

npm i https://pkg.pr.new/@tanstack/ai-grok@781

@tanstack/ai-groq

npm i https://pkg.pr.new/@tanstack/ai-groq@781

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@781

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/@tanstack/ai-isolate-node@781

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@781

@tanstack/ai-mcp

npm i https://pkg.pr.new/@tanstack/ai-mcp@781

@tanstack/ai-ollama

npm i https://pkg.pr.new/@tanstack/ai-ollama@781

@tanstack/ai-openai

npm i https://pkg.pr.new/@tanstack/ai-openai@781

@tanstack/ai-openrouter

npm i https://pkg.pr.new/@tanstack/ai-openrouter@781

@tanstack/ai-preact

npm i https://pkg.pr.new/@tanstack/ai-preact@781

@tanstack/ai-react

npm i https://pkg.pr.new/@tanstack/ai-react@781

@tanstack/ai-react-ui

npm i https://pkg.pr.new/@tanstack/ai-react-ui@781

@tanstack/ai-solid

npm i https://pkg.pr.new/@tanstack/ai-solid@781

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/@tanstack/ai-solid-ui@781

@tanstack/ai-svelte

npm i https://pkg.pr.new/@tanstack/ai-svelte@781

@tanstack/ai-utils

npm i https://pkg.pr.new/@tanstack/ai-utils@781

@tanstack/ai-vue

npm i https://pkg.pr.new/@tanstack/ai-vue@781

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/@tanstack/ai-vue-ui@781

@tanstack/openai-base

npm i https://pkg.pr.new/@tanstack/openai-base@781

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@781

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/@tanstack/react-ai-devtools@781

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@781

commit: 396b731

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