mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
* Initial working version with tests.
* Updates to validate class data once instead of for each handler method. Also updated Diagnostics Ids to format of MAFGENWF{NUM}
* Formatting and trying to fix generation project pack.
* Another atempt at getting the genrators project to build.
* More attempts to fix generator build and pack.
* Fixing file encodings.
* Initail round of cleanup.
* Trying to fix packing.
* Still trying to fix pipeline pack.
* Remove obsolescence markers, sample updates, and docs from generator branch.
This commit separates the generator core functionality from the
deprecation of ReflectingExecutor. The removed changes will be
re-added in a dependent branch (wf-obsolete-reflector).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Mark ReflectingExecutor and IMessageHandler as obsolete.
This commit deprecates the reflection-based handler discovery approach
in favor of the new [MessageHandler] attribute with source generation.
Changes:
- Add [Obsolete] to ReflectingExecutor<T>, IMessageHandler<T>, IMessageHandler<T,R>
- Add #pragma to suppress warnings in internal reflection code
- Update Concurrent sample to use new [MessageHandler] pattern
- Add Directory.Build.props for samples to include generator
- Add documentation files explaining the migration
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Obsoleteing Reflector-based workflow code generation in favor of Source Generators and updating some samples to use new pattern.
This commit deprecates the reflection-based handler discovery approach
in favor of the new [MessageHandler] attribute with source generation.
Changes:
- Add [Obsolete] to ReflectingExecutor<T>, IMessageHandler<T>, IMessageHandler<T,R>
- Add #pragma to suppress warnings in internal reflection code
- Update Concurrent sample to use new [MessageHandler] pattern
- Add Directory.Build.props for samples to include generator
- Add documentation files explaining the migration
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Cleaning up temporary design and progress files.
---------
Co-authored-by: alliscode <bentho@microsoft.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
56 lines
2.6 KiB
C#
56 lines
2.6 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows.Reflection;
|
|
|
|
/// <summary>
|
|
/// A message handler interface for handling messages of type <typeparamref name="TMessage"/>.
|
|
/// </summary>
|
|
/// <typeparam name="TMessage"></typeparam>
|
|
/// <remarks>
|
|
/// This interface is obsolete. Use the <see cref="MessageHandlerAttribute"/> on methods in a partial class
|
|
/// deriving from <see cref="Executor"/> instead.
|
|
/// </remarks>
|
|
[Obsolete("Use [MessageHandler] attribute on methods in a partial class deriving from Executor. " +
|
|
"This interface will be removed in a future version.")]
|
|
public interface IMessageHandler<TMessage>
|
|
{
|
|
/// <summary>
|
|
/// Handles the incoming message asynchronously.
|
|
/// </summary>
|
|
/// <param name="message">The message to handle.</param>
|
|
/// <param name="context">The execution context.</param>
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests.
|
|
/// The default is <see cref="CancellationToken.None"/>.</param>
|
|
/// <returns>A task that represents the asynchronous operation.</returns>
|
|
ValueTask HandleAsync(TMessage message, IWorkflowContext context, CancellationToken cancellationToken = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// A message handler interface for handling messages of type <typeparamref name="TMessage"/> and
|
|
/// returning a result.
|
|
/// </summary>
|
|
/// <typeparam name="TMessage">The type of message to handle.</typeparam>
|
|
/// <typeparam name="TResult">The type of result returned after handling the message.</typeparam>
|
|
/// <remarks>
|
|
/// This interface is obsolete. Use the <see cref="MessageHandlerAttribute"/> on methods in a partial class
|
|
/// deriving from <see cref="Executor"/> instead.
|
|
/// </remarks>
|
|
[Obsolete("Use [MessageHandler] attribute on methods in a partial class deriving from Executor. " +
|
|
"This interface will be removed in a future version.")]
|
|
public interface IMessageHandler<TMessage, TResult>
|
|
{
|
|
/// <summary>
|
|
/// Handles the incoming message asynchronously.
|
|
/// </summary>
|
|
/// <param name="message">The message to handle.</param>
|
|
/// <param name="context">The execution context.</param>
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests.
|
|
/// The default is <see cref="CancellationToken.None"/>.</param>
|
|
/// <returns>A task that represents the asynchronous operation.</returns>
|
|
ValueTask<TResult> HandleAsync(TMessage message, IWorkflowContext context, CancellationToken cancellationToken = default);
|
|
}
|