Skip to content

chore: Upgrade genai-rs from 0.6.0 to 0.7.2 - #267

Merged
evansenter merged 14 commits into
mainfrom
feat/255-phase3-streaming
Jan 17, 2026
Merged

evansenter merged 14 commits into
mainfrom
feat/255-phase3-streaming

Conversation

@evansenter

Copy link
Copy Markdown
Owner

Summary

  • Upgrades genai-rs dependency from 0.6.0 to 0.7.2
  • Adapts all code to breaking API changes in genai-rs 0.7.x

API Changes Applied

  • function_result_content() → Content::function_result()
  • InteractionContent → Content
  • response.text() → response.as_text()
  • .with_functions() → .add_functions()
  • .with_turns() → .with_history()
  • InteractionBuilder typestate removed (no more generic S param)
  • OwnedFunctionCallInfo.thought_signature field removed

Test plan

  • make check passes (fmt, clippy, 846 tests)

🤖 Generated with Claude Code

evansenter and others added 14 commits January 11, 2026 23:32
Remove LlmRequest abstraction completely and add streaming to agents.

## LlmRequest Removal
- Delete gemicro-core/src/llm/request.rs (465 lines removed)
- Update LlmClient to accept InteractionBuilder directly
- Change TrajectoryStep.request to serde_json::Value for flexibility
- Update all agents to use InteractionBuilder pattern
- Simplify mock_llm to work with built requests

## Streaming Support
- DeepResearchAgent: Stream synthesis phase with synthesis_chunk events
- ReactAgent: Stream web_search tool execution with web_search_chunk events
- Both use generate_stream_with_cancellation() with deadline checking

## Benefits
- ~600 lines removed (net -596 lines)
- Direct use of genai-rs types eliminates translation layer
- Real-time streaming output for long-running operations
- Simpler API surface

Closes #255

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The tests need to explicitly specify the model since LlmRequest
(which applied defaults) was removed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rate limits from the Gemini API come through as GenaiError which
already has is_retryable() and retry_after() methods. The RateLimit
variant was never constructed anywhere in the codebase.

AgentError::is_retriable() now delegates to LlmError::is_retryable()
which handles all transient errors including rate limits from genai-rs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Doc examples were using the old .user_text() API and not specifying
a model. Now use:
- .with_model(MODEL) - required since LlmRequest removal
- .with_text() - current genai-rs API
- .build()? - handle the Result properly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename crate directories: gemicro-{X} → gemicro-{X}-agent
- Rename config structs: {X}Config → {X}AgentConfig
- Update all imports and documentation references
- Optimize Makefile: clippy uses --profile test for cache sharing

Agent renames:
- gemicro-prompt → gemicro-prompt-agent, PromptConfig → PromptAgentConfig
- gemicro-developer → gemicro-developer-agent, DeveloperConfig → DeveloperAgentConfig
- gemicro-deep-research → gemicro-deep-research-agent, ResearchConfig → DeepResearchAgentConfig
- gemicro-react → gemicro-react-agent, ReactConfig → ReactAgentConfig
- gemicro-critique → gemicro-critique-agent, CritiqueConfig → CritiqueAgentConfig
- gemicro-echo → gemicro-echo-agent

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix incorrect genai-rs method names in docs (with_* prefix)
- Add token count trade-off note to deep-research-agent docs
- Fix doctests in deep-research-agent (use simplified error handling)
- Add model field to ReactAgentConfig with with_model() builder
- Add model field to CritiqueAgentConfig with with_model() builder

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use simplified error handling (.build()?) instead of explicit AgentError
mapping which requires importing the type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use simplified error handling (.build()?) instead of explicit AgentError
mapping which requires importing the type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use simplified error handling (.build()?) instead of explicit AgentError
mapping which requires importing the type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use simplified error handling (.build()?) instead of explicit AgentError
mapping which requires importing the type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adapt to breaking API changes in genai-rs 0.7.x:
- function_result_content() → Content::function_result()
- InteractionContent → Content
- response.text() → response.as_text()
- .with_functions() → .add_functions()
- .with_turns() → .with_history()
- InteractionBuilder typestate removed (no more generic S param)
- OwnedFunctionCallInfo.thought_signature field removed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract minimal streaming event types (AgentUpdate, FinalResult,
ResultMetadata, EVENT_FINAL_RESULT) into standalone crate with only
serde dependencies.

This enables external projects like clemini to consume agent streams
without pulling in the full gemicro dependency tree (genai-rs, tokio,
etc.).

- Create gemicro-streaming-events/ with all event types and tests
- Update gemicro-core to re-export from new crate
- All 847 tests pass

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflicts from main merging:
- #255 LlmRequest removal
- #259 --model flag
- #262 genai-rs 0.7.0
- #263 interaction chaining
- #265 audit findings

Key resolutions:
- Keep genai-rs 0.7.2 (this branch's upgrade)
- Use main's registry pattern for CLI
- Use main's multi-turn support with previous_interaction_id
- Use .add_functions() API (main's pattern)
- Remove generic S parameter from stream functions (not in 0.7.2)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@claude

claude Bot commented Jan 17, 2026

Copy link
Copy Markdown

Prompt: evansenter/dotfiles/.../claude-review.md

Code Review

Summary

This PR upgrades genai-rs from 0.6.0 to 0.7.2, adapts all code to breaking API changes in genai-rs 0.7.x, and extracts streaming event types into a new gemicro-streaming-events crate for minimal-dependency external consumption.

Issues Found

Critical

None

Important

None

Suggestions

  • Cargo.toml:4 - The new gemicro-streaming-events crate is listed first in workspace members, before gemicro-core. Consider alphabetizing workspace members or grouping by type (core → utilities → tools/hooks/agents) for consistency with the existing ordering pattern.

Verdict

REQUEST_CHANGES - One minor organizational suggestion for workspace member ordering.


Automated review by Claude Code

@evansenter

Copy link
Copy Markdown
Owner Author

Feedback Addressed

Skipped

  • [Suggestion] Workspace member ordering - No functional impact; ordering reflects chronological addition rather than strict alphabetization

@evansenter
evansenter merged commit 7229538 into main Jan 17, 2026
13 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