Reduce dependencies to 8.x versions of packages (#195)
* Reduce dependencies to 8.x versions of packages When building for netstandard2.0 or net8.0, the ModelContextProtocol library now only depends on 8.x versions of nuget packages, rather than using the newer 9.x versions. The exception to this are packages that don't have 8.x versions. This also introduces a net9.0 tfm. When building for net9.0, it'll use 9.x versions of packages. The PR temporarily removes the Microsoft.Extensions.AI.nupkg reference (the Microsoft.Extensions.AI.Abstractions reference is still very much there). The latest Microsoft.Extensions.AI package on nuget has a System.Text.Json 9.x reference, but the next build to be published drops that down to 8.x as well. Once that build is published, the dependency will be added back, and temporary polyfills (in particular TemporaryAIFunctionFactory) will be deleted. * Fix StdioClientSessionTransport shutdown StreamClientSessionTransport's ReadMessageAsync method does await CleanupAsync in its finally. CleanupAsync awaits _readTask. _readTask _is_ ReadMessageAsync. So it's waiting for itself to complete, which will then always timeout. We may want to refactor how this works more in the future, but for now, make sure it doesn't wait for itself. * Fix dangling requests when server unexpectedly shuts down If the client makes a request to the server and while waiting for the response the server shuts down, the client hangs. Make sure that when the client's message loops ends due to the server's output it's reading from ends, any pending requests are notified. * Add net9.0 testing * Avoid docker port conflicts from test suites running concurrently
This commit is contained in:
parent
1c145a5d52
commit
c452dc8e26
2 changed files with 247 additions and 91 deletions
|
|
@ -133,9 +133,9 @@ internal static partial class TemporaryAIFunctionFactory
|
|||
/// <remarks>
|
||||
/// <para>
|
||||
/// Return values are serialized to <see cref="JsonElement"/> using <paramref name="options"/>'s
|
||||
/// <see cref="AIFunctionFactoryOptions.SerializerOptions"/>. Arguments that are not already of the expected type are
|
||||
/// <see cref="TemporaryAIFunctionFactoryOptions.SerializerOptions"/>. Arguments that are not already of the expected type are
|
||||
/// marshaled to the expected type via JSON and using <paramref name="options"/>'s
|
||||
/// <see cref="AIFunctionFactoryOptions.SerializerOptions"/>. If the argument is a <see cref="JsonElement"/>,
|
||||
/// <see cref="TemporaryAIFunctionFactoryOptions.SerializerOptions"/>. If the argument is a <see cref="JsonElement"/>,
|
||||
/// <see cref="JsonDocument"/>, or <see cref="JsonNode"/>, it is deserialized directly. If the argument is anything else unknown,
|
||||
/// it is round-tripped through JSON, serializing the object as JSON and then deserializing it to the expected type.
|
||||
/// </para>
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ internal sealed class TemporaryAIFunctionFactoryOptions
|
|||
/// <summary>Gets or sets a delegate used to determine the <see cref="object"/> returned by <see cref="AIFunction.InvokeAsync"/>.</summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// By default, the return value of invoking the method wrapped into an <see cref="AIFunction"/> by <see cref="AIFunctionFactory"/>
|
||||
/// By default, the return value of invoking the method wrapped into an <see cref="AIFunction"/> by <see cref="TemporaryAIFunctionFactory"/>
|
||||
/// is then JSON serialized, with the resulting <see cref="JsonElement"/> returned from the <see cref="AIFunction.InvokeAsync"/> method.
|
||||
/// This default behavior is ideal for the common case where the result will be passed back to an AI service. However, if the caller
|
||||
/// requires more control over the result's marshaling, the <see cref="MarshalResult"/> property may be set to a delegate that is
|
||||
|
|
@ -82,7 +82,7 @@ internal sealed class TemporaryAIFunctionFactoryOptions
|
|||
/// <para>
|
||||
/// When set, the delegate is invoked even for <see langword="void"/>-returning methods, in which case it is invoked with
|
||||
/// a <see langword="null"/> argument. By default, <see langword="null"/> is returned from the <see cref="AIFunction.InvokeAsync"/>
|
||||
/// method for <see cref="AIFunction"/> instances produced by <see cref="AIFunctionFactory"/> to wrap
|
||||
/// method for <see cref="AIFunction"/> instances produced by <see cref="TemporaryAIFunctionFactory"/> to wrap
|
||||
/// <see langword="void"/>-returning methods).
|
||||
/// </para>
|
||||
/// <para>
|
||||
|
|
|
|||
Loading…
Reference in a new issue