Skip to content

Commit 6f3b353

Browse files
jherrcursoragentclaudeautofix-ci[bot]tombeckenham
authored
feat(ai-gemini): upgrade @google/genai to v2 + migrate Interactions API (#781)
* chore: update project agent configuration * chore: update project agent configuration * chore: update project agent configuration * feat(ai-gemini): upgrade @google/genai to v2 and migrate Interactions 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> * chore: update project agent configuration * chore: update project agent configuration * chore: update project agent configuration * test(e2e): quarantine gemini stateful-interactions pending aimock SDK 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> * ci: apply automated fixes * fix(ai-gemini): address review feedback on Interactions v2 migration - Stream function-call args via partial-json instead of strict JSON.parse: incomplete `arguments_delta` fragments no longer log a parse error each, and a truncated buffer keeps the last good args instead of resetting to {} (tombeckenham, CodeRabbit). - Drop the unnecessary `as Record<string, unknown>` cast on step.arguments; FunctionCallStep.arguments is already an index-signature object (tombeckenham). - Remove accidentally-committed `.agentsroom/` tooling (incl. a personal claudeSessionId), unrelated to this change (CodeRabbit). - Add unit tests: multi-fragment arguments_delta accumulation, args-stream truncation preserving last good args, and thought_summary -> REASONING_*. - Add changeset for the @google/genai v2 upgrade. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ci: apply automated fixes * test(ai-gemini): enable stateful-interactions e2e on aimock 1.34.0 aimock 1.34.0 emits the SDK 2.x Gemini Interactions event format (interaction.created/completed, step.start/delta/stop, arguments_delta), so the migrated geminiTextInteractions adapter can now be exercised end-to-end. Bump @copilotkit/aimock to ^1.34.0, un-fixme the two-turn stateful-interactions spec, and drop the now-obsolete AIMOCK-TODO doc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Exlcuding aimock from minimum age restrictions --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com>
1 parent 037e15a commit 6f3b353

10 files changed

Lines changed: 696 additions & 250 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/ai-gemini': minor
3+
---
4+
5+
Upgrade `@google/genai` to v2 and migrate the experimental text-interactions adapter to the SDK 2.x step-based streaming API (`step.start` / `step.delta` / `step.stop`), replacing the prior `content.*` events. Streamed function-call arguments are now accumulated from `arguments_delta` fragments and parsed leniently with `partial-json`, so an incomplete or truncated buffer keeps the last good arguments instead of resetting them and no longer logs a parse error per fragment. Exported built-in-tool CUSTOM event payloads now carry `Interactions.*Step` values, and structured output uses the polymorphic `response_format` request shape.

packages/ai-gemini/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@
6464
"text-to-speech"
6565
],
6666
"dependencies": {
67-
"@google/genai": "^1.43.0",
68-
"@tanstack/ai-utils": "workspace:*"
67+
"@google/genai": "^2.8.0",
68+
"@tanstack/ai-utils": "workspace:*",
69+
"partial-json": "^0.1.7"
6970
},
7071
"peerDependencies": {
7172
"@tanstack/ai": "workspace:^"

0 commit comments

Comments
 (0)