Commit Graph

16 Commits

  • .NET: fix: avoid AGUI tool result message id collisions (#5800)
    * fix: avoid AGUI tool result message id collisions
    
    * fix: split mixed tool result message ids
  • .NET: Support reasoning events in AGUI (#4953)
    * Support reasoning
    
    * MEAI gives the same MessageId for reasoning and text content because they are part of the same logical model response. Create a new GUID for reasoning messages to be consistent with AGUI protocol and establish no link between reasoning and text messages
    
    * When a frontend AG-UI client sends conversation history back in a subsequent POST, any accumulated role: "reasoning" messages fail deserialization in AGUIMessageJsonConverter because the role wasn't handled - causing the request to fail.
    
    This adds AGUIReasoningMessage with Content and EncryptedValue properties, registers it in the JSON converter and serializer context, and converts it to TextReasoningContent (with ProtectedData) in AsChatMessages.
    
    * Added MapReasoningMessage - converts a ChatMessage containing TextReasoningContent to AGUIReasoningMessage for c# client
    
    * review
    
    * Support reasoning
    
    * MEAI gives the same MessageId for reasoning and text content because they are part of the same logical model response. Create a new GUID for reasoning messages to be consistent with AGUI protocol and establish no link between reasoning and text messages
    
    * When a frontend AG-UI client sends conversation history back in a subsequent POST, any accumulated role: "reasoning" messages fail deserialization in AGUIMessageJsonConverter because the role wasn't handled - causing the request to fail.
    
    This adds AGUIReasoningMessage with Content and EncryptedValue properties, registers it in the JSON converter and serializer context, and converts it to TextReasoningContent (with ProtectedData) in AsChatMessages.
    
    * Added MapReasoningMessage - converts a ChatMessage containing TextReasoningContent to AGUIReasoningMessage for c# client
    
    * review
    
    * dotnet format
    
    * Replace hardcoded string with constant
    
    Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
    Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
  • .NET: BugFix #3433 ChatClientAgent streaming responses missing messageid (#4615)
    * Changes
    
    * Fix ChatClientAgent streaming responses missing MessageId
    
    Generate fallback MessageId in ChatClientAgent.RunCoreStreamingAsync when
    the underlying LLM provider does not set ChatResponseUpdate.MessageId.
    Without a MessageId the AGUI converter's null==null check silently drops
    all text content, causing CopilotKit Zod validation errors.
    
    Changes:
    - ChatClientAgent: generate msg_{Guid} fallback via ??= in streaming loop
    - AgentResponseExtensions: sync wrapper MessageId back to RawRepresentation
      in AsChatResponseUpdate() so downstream consumers see the value
    - Add unit tests for both fixes and AGUI streaming MessageId scenarios
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #4615 review comments
    
    - Fix MessageId seeding: use first-seen provider MessageId (or generate
      fallback) and apply consistently to all chunks in the stream, preventing
      message splitting when providers set MessageId only on the first chunk
    - Add test for mixed MessageId scenario (first chunk only)
    - Fix skipped TextStreaming test: assert Empty (not NotEmpty) to match
      actual null==null behavior
    - Fix skipped ToolCalls test: assert empty ParentMessageId to match
      actual empty-string passthrough behavior
    
    * Handle empty MessageId in AsChatResponseUpdate sync
    
    Treat empty/whitespace MessageId the same as null when syncing from
    the AgentResponseUpdate wrapper back to RawRepresentation. Providers
    that return empty string MessageId (e.g. tool call responses) now get
    the wrapper value recovered correctly.
    
    Add test for empty string MessageId recovery scenario.
    
    * Move MessageId fallback generation to AGUI layer
    
    Move fallback MessageId generation from ChatClientAgent to
    AsAGUIEventStreamAsync, addressing the architectural concern that
    MessageId is nullable in the AIAgent abstraction and the requirement
    for non-null values is specific to the AGUI protocol.
    
    The AGUI layer now generates a fallback MessageId for null or
    empty/whitespace values, covering all agent types (not just
    ChatClientAgent) including external implementations.
    
    Changes:
    - Revert MessageId generation from ChatClientAgent.RunCoreStreamingAsync
    - Add fallback MessageId generation in AsAGUIEventStreamAsync for
      null/empty MessageId values (handles both null and whitespace)
    - Unskip and update AGUI tests to verify fallback generation
    - Update ChatClientAgent tests to reflect passthrough behavior
    
    * Revert AsChatResponseUpdate MessageId sync-back
    
    Remove the MessageId sync-back logic from AsChatResponseUpdate() as it
    is no longer needed. With fallback generation moved to the AGUI layer,
    the abstraction layer should not mutate the RawRepresentation object.
    
    Revert to the original passthrough behavior for AsChatResponseUpdate()
    and update tests accordingly.
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: [BREAKING] Change SerializeSession to be Async (#3879)
    * Change SerializeSession to be Async
    
    * Update Changelog
  • .NET: [BREAKING] Move AgentSession.Serialize to AIAgent (#3650)
    * Move AgentSession.Serialize to AIAgent
    
    * Address PR comments.
    
    * Improve code and fix unit test
    
    * Update test agents to return a default json element instead of throwing where the the result of the serialization is never used.
    
    * Update further tests to actually serialize the session
  • .NET: [BREAKING] Rename GetNewSession to CreateSession (#3501)
    * Rename GetNewSession to CreateSession
    
    * Address copilot feedback
    
    * Suppress warning
    
    * Suppress warning
    
    * Fix further warnings.
  • .NET: [BREAKING] Rename AgentThread to AgentSession (#3430)
    * Rename AgentThread to AgentSession
    
    * Add more renames
    
    * Update readme files
    
    * Revert nullable variable change and further fixes.
    
    * Revert change in header name
    
    * Fix some comments and tests
    
    * Update changelog.
    
    * Address PR feedback.
    
    * Fixing code review comments.
    
    * Fix new errors after merging latest code.
  • .NET: [BREAKING] Renamed CreateAIAgent/GetAIAgent to AsAIAgent (#3222)
    * Renamed chat client extension method
    
    * Additional renaming
    
    * Updated documentation
    
    * Fixed tests
    
    * Small fix
    
    * Small fix
  • .NET: [Breaking] RenameAgentRunResponse and AgentRunResponseUpdate classes (#3197)
    * rename AgentRunResponse and AgentRunResponseUpdate classes - part1
    
    * rename varialbles, parameters, methods and tests
    
    * rollback unnecessary changes
  • .NET: [BREAKING] Change GetNewThread and DeserializeThread to async (#3152)
    * Change GetNewThread and DeserializeThread plus ChatMessageStore and AIContextProvider Factories to async
    
    * Merge fixes
  • .NET: Upgrade to .NET 10 (#2128)
    * Upgrade to .NET 10
    
    - Require .NET 10 SDK
    - Include net10.0 assets in all assemblies
    - Move net9.0-only targets to net10.0
    - Update LangVersion to latest
    - Remove complicated distinctions between debug target TFMs and release target TFMs
    - Remove unnecessary package dependencies when built into netcoreapp
    - Clean up some ifdefs
    - Clean up some analyzer warnings
    
    * Fix CI
  • .NET [AG-UI]: Adds support for shared state. (#1996)
    * Product changes
    
    * Tests
    
    * Dojo project
    
    * Cleanups
  • .NET: AG-UI support for .NET: Support for tool calling (#1896)
    * Initial implementation
    
    * tmp
    
    * Replace function calling with a FunctionInvokingChatClient
    
    * Cleanups
    
    * Remove custom thread
    
    * Fixing function calling server and client
    
    * Cleanup
    
    * Cleanup serialization
    
    * Run dotnet format
    
    * Pass logger factory
    
    * Populate message properties
    
    * Remove files
    
    * Cleanups
    
    * cleanup
    
    * Cleanups
    
    * More cleanup
    
    * Simplify things
    
    * Cleanup
    
    * Clean up json serialization
    
    * Additional tests
    
    * Add service collection extensions for serialization
    
    * Combine options in AGUIChatClient
    
    * Additional tests
    
    * Include tool calling in the sample, fix mixed server and client tool calls
    
    * Fix tests
    
    * More cleanups
    
    * Fix tests
    
    * Cleanups
    
    * Dojo project and fixes
    
    * Fix build
    
    * Remove dojo
    
    * Cleanup
    
    * Address feedback
    
    * address feedback
    
    * Additional feedback
    
    * Fix build
    
    * Fix build
    
    * Make packages packable
  • .NET: AG-UI support for .NET (#1776)
    * Initial plan
    
    * Infrastructure setup
    
    * Plan for minimal client
    
    * Plan update
    
    * Basic agentic chat
    
    * cleanup
    
    * Cleanups
    
    * More cleanups
    
    * Cleanups
    
    * More cleanups
    
    * Test plan
    
    * Sample
    
    * Fix streaming and error handling
    
    * Fix notifications
    
    * Cleanups
    
    * cleanup sample
    
    * Additional tests
    
    * Additional tests
    
    * Run dotnet format
    
    * Remove unnecessary files
    
    * Mark packages as non packable
    
    * Fix build
    
    * Address feedback
    
    * Fix build
    
    * Fix remaining warnings
    
    * Feedback
    
    * Feedback and cleanup
    
    * Cleanup
    
    * Cleanups
    
    * Cleanups
    
    * Cleanups
    
    * Retrieve existing messages from the store to send them along the way and update the sample client
    
    * Run dotnet format
    
    * Add ADR for AG-UI
    
    * Switch to use the SG and use a convention for run ids
    
    * Cleanup MapAGUI API
    
    * Fix formatting
    
    * Fix solution
    
    * Fix solution