diff --git a/src/libs/CursorAgents/Generated/CursorAgents.AutoSDKHttpResponse.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..94bb4a8 --- /dev/null +++ b/src/libs/CursorAgents/Generated/CursorAgents.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace CursorAgents +{ + /// + /// Represents a successful HTTP response with status code and headers. + /// + public partial class AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri) + { + StatusCode = statusCode; + Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers)); + RequestUri = requestUri; + } + + /// + /// Gets the HTTP status code. + /// + public global::System.Net.HttpStatusCode StatusCode { get; } + /// + /// Gets the response headers. + /// + public global::System.Collections.Generic.Dictionary> Headers { get; } + /// + /// Gets the final request URI associated with the response. + /// + public global::System.Uri? RequestUri { get; } + + internal static global::System.Collections.Generic.Dictionary> CreateHeaders( + global::System.Net.Http.HttpResponseMessage response) + { + response = response ?? throw new global::System.ArgumentNullException(nameof(response)); + + var headers = global::System.Linq.Enumerable.ToDictionary( + response.Headers, + static header => header.Key, + static header => (global::System.Collections.Generic.IEnumerable)global::System.Linq.Enumerable.ToArray(header.Value), + global::System.StringComparer.OrdinalIgnoreCase); + + if (response.Content?.Headers == null) + { + return headers; + } + + foreach (var header in response.Content.Headers) + { + if (headers.TryGetValue(header.Key, out var existingValues)) + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray( + global::System.Linq.Enumerable.Concat(existingValues, header.Value)); + } + else + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray(header.Value); + } + } + + return headers; + } + } + + /// + /// Represents a successful HTTP response with status code, headers, and body. + /// + public partial class AutoSDKHttpResponse : AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + T body) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null, + body: body) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri, + T body) + : base(statusCode, headers, requestUri) + { + Body = body; + } + + /// + /// Gets the response body. + /// + public T Body { get; } + } +} \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ArchiveAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ArchiveAgent.g.cs index a7351a9..32a5305 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ArchiveAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ArchiveAgent.g.cs @@ -55,6 +55,29 @@ partial void ProcessArchiveAgentResponseContent( string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ArchiveAgentAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Archive an agent
+ /// Archive an agent. Archived agents remain readable but cannot accept new runs until unarchived. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ArchiveAgentAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -84,6 +107,7 @@ partial void ProcessArchiveAgentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}/archive", baseUri: HttpClient.BaseAddress); @@ -157,6 +181,8 @@ partial void ProcessArchiveAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +193,11 @@ partial void ProcessArchiveAgentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -184,6 +215,8 @@ partial void ProcessArchiveAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +226,7 @@ partial void ProcessArchiveAgentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +235,11 @@ partial void ProcessArchiveAgentResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -219,14 +256,15 @@ partial void ProcessArchiveAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +304,8 @@ partial void ProcessArchiveAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +326,8 @@ partial void ProcessArchiveAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -500,9 +542,13 @@ partial void ProcessArchiveAgentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.IdResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.IdResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -530,9 +576,13 @@ partial void ProcessArchiveAgentResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.IdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.IdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CancelRun.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CancelRun.g.cs index d80483b..abbbdfc 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CancelRun.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CancelRun.g.cs @@ -65,6 +65,38 @@ partial void ProcessCancelRunResponseContent( string runId, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CancelRunAsResponseAsync( + id: id, + runId: runId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Cancel a run
+ /// Cancel the active run for an agent. Cancellation is terminal —
+ /// the run transitions to `CANCELLED`. Cancelling a run that is
+ /// already terminal or was never active returns
+ /// `409 run_not_cancellable`. To continue the conversation,
+ /// create a new run on the same agent. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// + /// Example: run-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CancelRunAsResponseAsync( + string id, + string runId, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -95,6 +127,7 @@ partial void ProcessCancelRunResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}/runs/{runId}/cancel", baseUri: HttpClient.BaseAddress); @@ -169,6 +202,8 @@ partial void ProcessCancelRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +214,11 @@ partial void ProcessCancelRunResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -196,6 +236,8 @@ partial void ProcessCancelRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -205,8 +247,7 @@ partial void ProcessCancelRunResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -215,6 +256,11 @@ partial void ProcessCancelRunResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -231,14 +277,15 @@ partial void ProcessCancelRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -278,6 +325,8 @@ partial void ProcessCancelRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +347,8 @@ partial void ProcessCancelRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -550,9 +601,13 @@ partial void ProcessCancelRunResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.IdResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.IdResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -580,9 +635,13 @@ partial void ProcessCancelRunResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.IdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.IdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateAgent.g.cs index d47f225..9bd6d7f 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateAgent.g.cs @@ -53,6 +53,31 @@ partial void ProcessCreateAgentResponseContent( /// public async global::System.Threading.Tasks.Task CreateAgentAsync( + global::CursorAgents.CreateAgentRequest request, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateAgentAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create an agent
+ /// Create a Cloud Agent and immediately enqueue its initial run.
+ /// The response contains both the durable `agent` and the initial
+ /// `run`. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateAgentAsResponseAsync( + global::CursorAgents.CreateAgentRequest request, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -87,6 +112,7 @@ partial void ProcessCreateAgentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: "/v1/agents", baseUri: HttpClient.BaseAddress); @@ -166,6 +192,8 @@ partial void ProcessCreateAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -176,6 +204,11 @@ partial void ProcessCreateAgentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -193,6 +226,8 @@ partial void ProcessCreateAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -202,8 +237,7 @@ partial void ProcessCreateAgentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -212,6 +246,11 @@ partial void ProcessCreateAgentResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -228,14 +267,15 @@ partial void ProcessCreateAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -275,6 +315,8 @@ partial void ProcessCreateAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -295,6 +337,8 @@ partial void ProcessCreateAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error or malformed request body. @@ -509,9 +553,13 @@ partial void ProcessCreateAgentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.CreateAgentResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.CreateAgentResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -539,9 +587,13 @@ partial void ProcessCreateAgentResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.CreateAgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.CreateAgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateRun.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateRun.g.cs index 1e0cd35..b992767 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateRun.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateRun.g.cs @@ -59,6 +59,36 @@ partial void ProcessCreateRunResponseContent( public async global::System.Threading.Tasks.Task CreateRunAsync( string id, + global::CursorAgents.CreateRunRequest request, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateRunAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a run
+ /// Send a follow-up prompt to an existing active agent. The new
+ /// run uses the agent's current conversation and workspace state.
+ /// Only one run can be active per agent at a time. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateRunAsResponseAsync( + string id, + global::CursorAgents.CreateRunRequest request, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -94,6 +124,7 @@ partial void ProcessCreateRunResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}/runs", baseUri: HttpClient.BaseAddress); @@ -174,6 +205,8 @@ partial void ProcessCreateRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -184,6 +217,11 @@ partial void ProcessCreateRunResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -201,6 +239,8 @@ partial void ProcessCreateRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -210,8 +250,7 @@ partial void ProcessCreateRunResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -220,6 +259,11 @@ partial void ProcessCreateRunResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -236,14 +280,15 @@ partial void ProcessCreateRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -283,6 +328,8 @@ partial void ProcessCreateRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -303,6 +350,8 @@ partial void ProcessCreateRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error or malformed request body. @@ -593,9 +642,13 @@ partial void ProcessCreateRunResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.CreateRunResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.CreateRunResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -623,9 +676,13 @@ partial void ProcessCreateRunResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.CreateRunResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.CreateRunResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateSubToken.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateSubToken.g.cs index 90fce6b..9589d4d 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateSubToken.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.CreateSubToken.g.cs @@ -53,6 +53,31 @@ partial void ProcessCreateSubTokenResponseContent( /// public async global::System.Threading.Tasks.Task CreateSubTokenAsync( + global::CursorAgents.CreateSubTokenRequest request, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateSubTokenAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create A User-Scoped Worker Token
+ /// Create a one-hour user-scoped token for a My Machines worker to run as an
+ /// active team member. Requires an agent-scoped team service account
+ /// API key. User-scoped tokens can't mint other user-scoped tokens. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateSubTokenAsResponseAsync( + global::CursorAgents.CreateSubTokenRequest request, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -87,6 +112,7 @@ partial void ProcessCreateSubTokenResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: "/v1/sub-tokens", baseUri: HttpClient.BaseAddress); @@ -166,6 +192,8 @@ partial void ProcessCreateSubTokenResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -176,6 +204,11 @@ partial void ProcessCreateSubTokenResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -193,6 +226,8 @@ partial void ProcessCreateSubTokenResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -202,8 +237,7 @@ partial void ProcessCreateSubTokenResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -212,6 +246,11 @@ partial void ProcessCreateSubTokenResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -228,14 +267,15 @@ partial void ProcessCreateSubTokenResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -275,6 +315,8 @@ partial void ProcessCreateSubTokenResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -295,6 +337,8 @@ partial void ProcessCreateSubTokenResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error or malformed request body. @@ -547,9 +591,13 @@ partial void ProcessCreateSubTokenResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.CreateSubTokenResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.CreateSubTokenResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -577,9 +625,13 @@ partial void ProcessCreateSubTokenResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.CreateSubTokenResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.CreateSubTokenResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.DeleteAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.DeleteAgent.g.cs index fadbb39..db799d1 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.DeleteAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.DeleteAgent.g.cs @@ -55,6 +55,29 @@ partial void ProcessDeleteAgentResponseContent( string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteAgentAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete an agent permanently
+ /// Permanently delete an agent. This action is irreversible. Use POST /v1/agents/{id}/archive for reversible removal. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> DeleteAgentAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -84,6 +107,7 @@ partial void ProcessDeleteAgentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}", baseUri: HttpClient.BaseAddress); @@ -157,6 +181,8 @@ partial void ProcessDeleteAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +193,11 @@ partial void ProcessDeleteAgentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -184,6 +215,8 @@ partial void ProcessDeleteAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +226,7 @@ partial void ProcessDeleteAgentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +235,11 @@ partial void ProcessDeleteAgentResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -219,14 +256,15 @@ partial void ProcessDeleteAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +304,8 @@ partial void ProcessDeleteAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +326,8 @@ partial void ProcessDeleteAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -500,9 +542,13 @@ partial void ProcessDeleteAgentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.IdResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.IdResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -530,9 +576,13 @@ partial void ProcessDeleteAgentResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.IdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.IdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.DownloadArtifact.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.DownloadArtifact.g.cs index ee83664..48371cb 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.DownloadArtifact.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.DownloadArtifact.g.cs @@ -63,6 +63,36 @@ partial void ProcessDownloadArtifactResponseContent( string path, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DownloadArtifactAsResponseAsync( + id: id, + path: path, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Download an artifact
+ /// Retrieve a temporary 15-minute presigned S3 URL for an
+ /// artifact. The `path` query parameter must be a relative path
+ /// under `artifacts/` returned by GET /v1/agents/{id}/artifacts. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// + /// Example: artifacts/screenshot.png + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> DownloadArtifactAsResponseAsync( + string id, + string path, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -93,11 +123,12 @@ partial void ProcessDownloadArtifactResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}/artifacts/download", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("path", path) + .AddRequiredParameter("path", path) ; var __path = __pathBuilder.ToString(); __path = global::CursorAgents.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -170,6 +201,8 @@ partial void ProcessDownloadArtifactResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +213,11 @@ partial void ProcessDownloadArtifactResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +235,8 @@ partial void ProcessDownloadArtifactResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -206,8 +246,7 @@ partial void ProcessDownloadArtifactResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +255,11 @@ partial void ProcessDownloadArtifactResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +276,15 @@ partial void ProcessDownloadArtifactResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +324,8 @@ partial void ProcessDownloadArtifactResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +346,8 @@ partial void ProcessDownloadArtifactResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error or malformed request body. @@ -551,9 +600,13 @@ partial void ProcessDownloadArtifactResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.DownloadArtifactResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.DownloadArtifactResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -581,9 +634,13 @@ partial void ProcessDownloadArtifactResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.DownloadArtifactResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.DownloadArtifactResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetAgent.g.cs index 0e811fa..a961a07 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetAgent.g.cs @@ -55,6 +55,29 @@ partial void ProcessGetAgentResponseContent( string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAgentAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get an agent
+ /// Retrieve durable metadata for an agent. Execution status lives on runs. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetAgentAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -84,6 +107,7 @@ partial void ProcessGetAgentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}", baseUri: HttpClient.BaseAddress); @@ -157,6 +181,8 @@ partial void ProcessGetAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +193,11 @@ partial void ProcessGetAgentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -184,6 +215,8 @@ partial void ProcessGetAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +226,7 @@ partial void ProcessGetAgentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +235,11 @@ partial void ProcessGetAgentResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -219,14 +256,15 @@ partial void ProcessGetAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +304,8 @@ partial void ProcessGetAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +326,8 @@ partial void ProcessGetAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -500,9 +542,13 @@ partial void ProcessGetAgentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.Agent.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.Agent.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -530,9 +576,13 @@ partial void ProcessGetAgentResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.Agent.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.Agent.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetApiKeyInfo.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetApiKeyInfo.g.cs index f51ebe0..ff45724 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetApiKeyInfo.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetApiKeyInfo.g.cs @@ -49,6 +49,24 @@ partial void ProcessGetApiKeyInfoResponseContent( public async global::System.Threading.Tasks.Task GetApiKeyInfoAsync( global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetApiKeyInfoAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// API key info
+ /// Retrieve information about the API key being used for authentication. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetApiKeyInfoAsResponseAsync( + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +95,7 @@ partial void ProcessGetApiKeyInfoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: "/v1/me", baseUri: HttpClient.BaseAddress); @@ -149,6 +168,8 @@ partial void ProcessGetApiKeyInfoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -159,6 +180,11 @@ partial void ProcessGetApiKeyInfoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -176,6 +202,8 @@ partial void ProcessGetApiKeyInfoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -185,8 +213,7 @@ partial void ProcessGetApiKeyInfoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -195,6 +222,11 @@ partial void ProcessGetApiKeyInfoResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -211,14 +243,15 @@ partial void ProcessGetApiKeyInfoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -258,6 +291,8 @@ partial void ProcessGetApiKeyInfoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -278,6 +313,8 @@ partial void ProcessGetApiKeyInfoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -416,9 +453,13 @@ partial void ProcessGetApiKeyInfoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.ApiKeyInfo.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.ApiKeyInfo.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -446,9 +487,13 @@ partial void ProcessGetApiKeyInfoResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.ApiKeyInfo.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.ApiKeyInfo.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetRun.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetRun.g.cs index bcefff0..a8a2abf 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetRun.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.GetRun.g.cs @@ -61,6 +61,34 @@ partial void ProcessGetRunResponseContent( string runId, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetRunAsResponseAsync( + id: id, + runId: runId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a run
+ /// Retrieve status and timestamps for a specific run. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// + /// Example: run-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetRunAsResponseAsync( + string id, + string runId, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -91,6 +119,7 @@ partial void ProcessGetRunResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}/runs/{runId}", baseUri: HttpClient.BaseAddress); @@ -165,6 +194,8 @@ partial void ProcessGetRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -175,6 +206,11 @@ partial void ProcessGetRunResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -192,6 +228,8 @@ partial void ProcessGetRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -201,8 +239,7 @@ partial void ProcessGetRunResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -211,6 +248,11 @@ partial void ProcessGetRunResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -227,14 +269,15 @@ partial void ProcessGetRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -274,6 +317,8 @@ partial void ProcessGetRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -294,6 +339,8 @@ partial void ProcessGetRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -508,9 +555,13 @@ partial void ProcessGetRunResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.Run.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.Run.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -538,9 +589,13 @@ partial void ProcessGetRunResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.Run.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.Run.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListAgents.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListAgents.g.cs index 66f5436..2c15c8e 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListAgents.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListAgents.g.cs @@ -69,6 +69,40 @@ partial void ProcessListAgentsResponseContent( bool? includeArchived = default, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListAgentsAsResponseAsync( + limit: limit, + cursor: cursor, + prUrl: prUrl, + includeArchived: includeArchived, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List agents
+ /// List agents for the authenticated user, newest first. + ///
+ /// + /// Default Value: 20 + /// + /// + /// + /// + /// Default Value: true + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListAgentsAsResponseAsync( + int? limit = default, + string? cursor = default, + string? prUrl = default, + bool? includeArchived = default, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -101,14 +135,15 @@ partial void ProcessListAgentsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: "/v1/agents", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("cursor", cursor) .AddOptionalParameter("prUrl", prUrl) - .AddOptionalParameter("includeArchived", includeArchived?.ToString().ToLowerInvariant()) + .AddOptionalParameter("includeArchived", includeArchived?.ToString().ToLowerInvariant()) ; var __path = __pathBuilder.ToString(); __path = global::CursorAgents.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -183,6 +218,8 @@ partial void ProcessListAgentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -193,6 +230,11 @@ partial void ProcessListAgentsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -210,6 +252,8 @@ partial void ProcessListAgentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -219,8 +263,7 @@ partial void ProcessListAgentsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -229,6 +272,11 @@ partial void ProcessListAgentsResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -245,14 +293,15 @@ partial void ProcessListAgentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -292,6 +341,8 @@ partial void ProcessListAgentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -312,6 +363,8 @@ partial void ProcessListAgentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation error or malformed request body. @@ -526,9 +579,13 @@ partial void ProcessListAgentsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.ListAgentsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.ListAgentsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -556,9 +613,13 @@ partial void ProcessListAgentsResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.ListAgentsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.ListAgentsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListArtifacts.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListArtifacts.g.cs index 8835d32..efc934f 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListArtifacts.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListArtifacts.g.cs @@ -58,6 +58,32 @@ partial void ProcessListArtifactsResponseContent( string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListArtifactsAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List artifacts
+ /// List artifacts produced by an agent. Each artifact's `path` is
+ /// relative to the workspace's `artifacts/` directory. Pass that
+ /// `path` to GET /v1/agents/{id}/artifacts/download to obtain a
+ /// presigned download URL. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListArtifactsAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -87,6 +113,7 @@ partial void ProcessListArtifactsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}/artifacts", baseUri: HttpClient.BaseAddress); @@ -160,6 +187,8 @@ partial void ProcessListArtifactsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +199,11 @@ partial void ProcessListArtifactsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -187,6 +221,8 @@ partial void ProcessListArtifactsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -196,8 +232,7 @@ partial void ProcessListArtifactsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -206,6 +241,11 @@ partial void ProcessListArtifactsResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -222,14 +262,15 @@ partial void ProcessListArtifactsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -269,6 +310,8 @@ partial void ProcessListArtifactsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +332,8 @@ partial void ProcessListArtifactsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -503,9 +548,13 @@ partial void ProcessListArtifactsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.ListArtifactsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.ListArtifactsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -533,9 +582,13 @@ partial void ProcessListArtifactsResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.ListArtifactsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.ListArtifactsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListModels.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListModels.g.cs index 9e33c5b..8ae3b64 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListModels.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListModels.g.cs @@ -52,6 +52,27 @@ partial void ProcessListModelsResponseContent( public async global::System.Threading.Tasks.Task ListModelsAsync( global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListModelsAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List models
+ /// Returns a recommended set of explicit model IDs you can pass
+ /// to the `model.id` field on POST /v1/agents. To use the
+ /// configured default model, omit the `model` field from the
+ /// request body entirely. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListModelsAsResponseAsync( + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -80,6 +101,7 @@ partial void ProcessListModelsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: "/v1/models", baseUri: HttpClient.BaseAddress); @@ -152,6 +174,8 @@ partial void ProcessListModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -162,6 +186,11 @@ partial void ProcessListModelsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -179,6 +208,8 @@ partial void ProcessListModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -188,8 +219,7 @@ partial void ProcessListModelsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -198,6 +228,11 @@ partial void ProcessListModelsResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -214,14 +249,15 @@ partial void ProcessListModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -261,6 +297,8 @@ partial void ProcessListModelsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -281,6 +319,8 @@ partial void ProcessListModelsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -419,9 +459,13 @@ partial void ProcessListModelsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.ListModelsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.ListModelsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -449,9 +493,13 @@ partial void ProcessListModelsResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.ListModelsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.ListModelsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListRepositories.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListRepositories.g.cs index d47472b..7be5145 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListRepositories.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListRepositories.g.cs @@ -55,6 +55,30 @@ partial void ProcessListRepositoriesResponseContent( public async global::System.Threading.Tasks.Task ListRepositoriesAsync( global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListRepositoriesAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List GitHub repositories
+ /// List GitHub repositories accessible to the authenticated user
+ /// through Cursor's GitHub App installation. This endpoint has
+ /// very strict rate limits (1 request per user per minute, 30
+ /// per user per hour) and can take tens of seconds to respond
+ /// for users with access to many repositories. Cache responses
+ /// aggressively and handle this information not being available
+ /// gracefully. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListRepositoriesAsResponseAsync( + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +107,7 @@ partial void ProcessListRepositoriesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: "/v1/repositories", baseUri: HttpClient.BaseAddress); @@ -155,6 +180,8 @@ partial void ProcessListRepositoriesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +192,11 @@ partial void ProcessListRepositoriesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +214,8 @@ partial void ProcessListRepositoriesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +225,7 @@ partial void ProcessListRepositoriesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +234,11 @@ partial void ProcessListRepositoriesResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +255,15 @@ partial void ProcessListRepositoriesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +303,8 @@ partial void ProcessListRepositoriesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +325,8 @@ partial void ProcessListRepositoriesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -422,9 +465,13 @@ partial void ProcessListRepositoriesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.ListRepositoriesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.ListRepositoriesResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -452,9 +499,13 @@ partial void ProcessListRepositoriesResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.ListRepositoriesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.ListRepositoriesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListRuns.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListRuns.g.cs index 31db5be..64a57a7 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListRuns.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.ListRuns.g.cs @@ -65,6 +65,37 @@ partial void ProcessListRunsResponseContent( string? cursor = default, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListRunsAsResponseAsync( + id: id, + limit: limit, + cursor: cursor, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List runs
+ /// List runs for an agent, newest first. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// + /// Default Value: 20 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListRunsAsResponseAsync( + string id, + int? limit = default, + string? cursor = default, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -96,12 +127,13 @@ partial void ProcessListRunsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}/runs", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("cursor", cursor) + .AddOptionalParameter("cursor", cursor) ; var __path = __pathBuilder.ToString(); __path = global::CursorAgents.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -175,6 +207,8 @@ partial void ProcessListRunsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +219,11 @@ partial void ProcessListRunsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -202,6 +241,8 @@ partial void ProcessListRunsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -211,8 +252,7 @@ partial void ProcessListRunsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -221,6 +261,11 @@ partial void ProcessListRunsResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -237,14 +282,15 @@ partial void ProcessListRunsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -284,6 +330,8 @@ partial void ProcessListRunsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +352,8 @@ partial void ProcessListRunsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -518,9 +568,13 @@ partial void ProcessListRunsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.ListRunsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.ListRunsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -548,9 +602,13 @@ partial void ProcessListRunsResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.ListRunsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.ListRunsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.StreamRun.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.StreamRun.g.cs index 14403a4..3d3a9db 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.StreamRun.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.StreamRun.g.cs @@ -97,6 +97,7 @@ partial void ProcessStreamRunResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}/runs/{runId}/stream", baseUri: HttpClient.BaseAddress); @@ -178,6 +179,8 @@ partial void ProcessStreamRunResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -188,6 +191,11 @@ partial void ProcessStreamRunResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -205,6 +213,8 @@ partial void ProcessStreamRunResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -214,8 +224,7 @@ partial void ProcessStreamRunResponse( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -224,6 +233,11 @@ partial void ProcessStreamRunResponse( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -240,14 +254,15 @@ partial void ProcessStreamRunResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -287,6 +302,8 @@ partial void ProcessStreamRunResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -307,6 +324,8 @@ partial void ProcessStreamRunResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.UnarchiveAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.UnarchiveAgent.g.cs index 4a19905..354a2d8 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.UnarchiveAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.UnarchiveAgent.g.cs @@ -55,6 +55,29 @@ partial void ProcessUnarchiveAgentResponseContent( string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UnarchiveAgentAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Unarchive an agent
+ /// Unarchive an agent so it can accept new runs again. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UnarchiveAgentAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -84,6 +107,7 @@ partial void ProcessUnarchiveAgentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::CursorAgents.PathBuilder( path: $"/v1/agents/{id}/unarchive", baseUri: HttpClient.BaseAddress); @@ -157,6 +181,8 @@ partial void ProcessUnarchiveAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +193,11 @@ partial void ProcessUnarchiveAgentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -184,6 +215,8 @@ partial void ProcessUnarchiveAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +226,7 @@ partial void ProcessUnarchiveAgentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +235,11 @@ partial void ProcessUnarchiveAgentResponseContent( __attempt < __maxAttempts && global::CursorAgents.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::CursorAgents.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::CursorAgents.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::CursorAgents.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -219,14 +256,15 @@ partial void ProcessUnarchiveAgentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::CursorAgents.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +304,8 @@ partial void ProcessUnarchiveAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +326,8 @@ partial void ProcessUnarchiveAgentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Invalid or missing API key. @@ -500,9 +542,13 @@ partial void ProcessUnarchiveAgentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::CursorAgents.IdResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::CursorAgents.IdResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -530,9 +576,13 @@ partial void ProcessUnarchiveAgentResponseContent( #endif ).ConfigureAwait(false); - return - await global::CursorAgents.IdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::CursorAgents.IdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::CursorAgents.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::CursorAgents.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.g.cs index a5eca2f..d7984fc 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.CursorAgentsClient.g.cs @@ -76,10 +76,10 @@ public CursorAgentsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public CursorAgentsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::CursorAgents.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::CursorAgents.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ArchiveAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ArchiveAgent.g.cs index 35e256c..626b728 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ArchiveAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ArchiveAgent.g.cs @@ -18,5 +18,19 @@ public partial interface ICursorAgentsClient string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Archive an agent
+ /// Archive an agent. Archived agents remain readable but cannot accept new runs until unarchived. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ArchiveAgentAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CancelRun.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CancelRun.g.cs index a280d83..0ca3e43 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CancelRun.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CancelRun.g.cs @@ -26,5 +26,27 @@ public partial interface ICursorAgentsClient string runId, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Cancel a run
+ /// Cancel the active run for an agent. Cancellation is terminal —
+ /// the run transitions to `CANCELLED`. Cancelling a run that is
+ /// already terminal or was never active returns
+ /// `409 run_not_cancellable`. To continue the conversation,
+ /// create a new run on the same agent. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// + /// Example: run-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CancelRunAsResponseAsync( + string id, + string runId, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateAgent.g.cs index 028ffcc..656967c 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateAgent.g.cs @@ -25,6 +25,21 @@ public partial interface ICursorAgentsClient /// The response contains both the durable `agent` and the initial
/// `run`. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateAgentAsResponseAsync( + + global::CursorAgents.CreateAgentRequest request, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an agent
+ /// Create a Cloud Agent and immediately enqueue its initial run.
+ /// The response contains both the durable `agent` and the initial
+ /// `run`. + ///
/// /// /// diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateRun.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateRun.g.cs index e1b4d99..40e5580 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateRun.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateRun.g.cs @@ -32,6 +32,25 @@ public partial interface ICursorAgentsClient /// /// Example: bc-00000000-0000-0000-0000-000000000001 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateRunAsResponseAsync( + string id, + + global::CursorAgents.CreateRunRequest request, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a run
+ /// Send a follow-up prompt to an existing active agent. The new
+ /// run uses the agent's current conversation and workspace state.
+ /// Only one run can be active per agent at a time. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateSubToken.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateSubToken.g.cs index 33bf47a..023f99f 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateSubToken.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.CreateSubToken.g.cs @@ -25,6 +25,21 @@ public partial interface ICursorAgentsClient /// active team member. Requires an agent-scoped team service account
/// API key. User-scoped tokens can't mint other user-scoped tokens. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateSubTokenAsResponseAsync( + + global::CursorAgents.CreateSubTokenRequest request, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create A User-Scoped Worker Token
+ /// Create a one-hour user-scoped token for a My Machines worker to run as an
+ /// active team member. Requires an agent-scoped team service account
+ /// API key. User-scoped tokens can't mint other user-scoped tokens. + ///
/// /// Active team member email. Case-insensitive. Mutually exclusive with `forUserId`.
/// Example: alice@company.com diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.DeleteAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.DeleteAgent.g.cs index c7d0741..3fea8e5 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.DeleteAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.DeleteAgent.g.cs @@ -18,5 +18,19 @@ public partial interface ICursorAgentsClient string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete an agent permanently
+ /// Permanently delete an agent. This action is irreversible. Use POST /v1/agents/{id}/archive for reversible removal. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteAgentAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.DownloadArtifact.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.DownloadArtifact.g.cs index e2c65d3..851e7e5 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.DownloadArtifact.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.DownloadArtifact.g.cs @@ -24,5 +24,25 @@ public partial interface ICursorAgentsClient string path, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Download an artifact
+ /// Retrieve a temporary 15-minute presigned S3 URL for an
+ /// artifact. The `path` query parameter must be a relative path
+ /// under `artifacts/` returned by GET /v1/agents/{id}/artifacts. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// + /// Example: artifacts/screenshot.png + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DownloadArtifactAsResponseAsync( + string id, + string path, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetAgent.g.cs index cf32293..818c932 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetAgent.g.cs @@ -18,5 +18,19 @@ public partial interface ICursorAgentsClient string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get an agent
+ /// Retrieve durable metadata for an agent. Execution status lives on runs. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetAgentAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetApiKeyInfo.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetApiKeyInfo.g.cs index a56d410..721bde8 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetApiKeyInfo.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetApiKeyInfo.g.cs @@ -14,5 +14,15 @@ public partial interface ICursorAgentsClient global::System.Threading.Tasks.Task GetApiKeyInfoAsync( global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// API key info
+ /// Retrieve information about the API key being used for authentication. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetApiKeyInfoAsResponseAsync( + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetRun.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetRun.g.cs index 343e41b..f02fa50 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetRun.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.GetRun.g.cs @@ -22,5 +22,23 @@ public partial interface ICursorAgentsClient string runId, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a run
+ /// Retrieve status and timestamps for a specific run. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// + /// Example: run-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetRunAsResponseAsync( + string id, + string runId, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListAgents.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListAgents.g.cs index 67b4de9..bf98283 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListAgents.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListAgents.g.cs @@ -26,5 +26,27 @@ public partial interface ICursorAgentsClient bool? includeArchived = default, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List agents
+ /// List agents for the authenticated user, newest first. + ///
+ /// + /// Default Value: 20 + /// + /// + /// + /// + /// Default Value: true + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListAgentsAsResponseAsync( + int? limit = default, + string? cursor = default, + string? prUrl = default, + bool? includeArchived = default, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListArtifacts.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListArtifacts.g.cs index a194b88..2ecafd0 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListArtifacts.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListArtifacts.g.cs @@ -21,5 +21,22 @@ public partial interface ICursorAgentsClient string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List artifacts
+ /// List artifacts produced by an agent. Each artifact's `path` is
+ /// relative to the workspace's `artifacts/` directory. Pass that
+ /// `path` to GET /v1/agents/{id}/artifacts/download to obtain a
+ /// presigned download URL. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListArtifactsAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListModels.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListModels.g.cs index 9c42022..2f360e4 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListModels.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListModels.g.cs @@ -17,5 +17,18 @@ public partial interface ICursorAgentsClient global::System.Threading.Tasks.Task ListModelsAsync( global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List models
+ /// Returns a recommended set of explicit model IDs you can pass
+ /// to the `model.id` field on POST /v1/agents. To use the
+ /// configured default model, omit the `model` field from the
+ /// request body entirely. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListModelsAsResponseAsync( + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListRepositories.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListRepositories.g.cs index f0eca97..f6f6ca9 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListRepositories.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListRepositories.g.cs @@ -20,5 +20,21 @@ public partial interface ICursorAgentsClient global::System.Threading.Tasks.Task ListRepositoriesAsync( global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List GitHub repositories
+ /// List GitHub repositories accessible to the authenticated user
+ /// through Cursor's GitHub App installation. This endpoint has
+ /// very strict rate limits (1 request per user per minute, 30
+ /// per user per hour) and can take tens of seconds to respond
+ /// for users with access to many repositories. Cache responses
+ /// aggressively and handle this information not being available
+ /// gracefully. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListRepositoriesAsResponseAsync( + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListRuns.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListRuns.g.cs index 355236d..a95e886 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListRuns.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.ListRuns.g.cs @@ -24,5 +24,25 @@ public partial interface ICursorAgentsClient string? cursor = default, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List runs
+ /// List runs for an agent, newest first. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// + /// Default Value: 20 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListRunsAsResponseAsync( + string id, + int? limit = default, + string? cursor = default, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.UnarchiveAgent.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.UnarchiveAgent.g.cs index e0fee25..cf5ed04 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.UnarchiveAgent.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.ICursorAgentsClient.UnarchiveAgent.g.cs @@ -18,5 +18,19 @@ public partial interface ICursorAgentsClient string id, global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Unarchive an agent
+ /// Unarchive an agent so it can accept new runs again. + ///
+ /// + /// Example: bc-00000000-0000-0000-0000-000000000001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UnarchiveAgentAsResponseAsync( + string id, + global::CursorAgents.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/CursorAgents/Generated/CursorAgents.OptionsSupport.g.cs b/src/libs/CursorAgents/Generated/CursorAgents.OptionsSupport.g.cs index 4566f78..113656d 100644 --- a/src/libs/CursorAgents/Generated/CursorAgents.OptionsSupport.g.cs +++ b/src/libs/CursorAgents/Generated/CursorAgents.OptionsSupport.g.cs @@ -101,9 +101,45 @@ public sealed class AutoSDKRetryOptions public int MaxAttempts { get; set; } = 1; /// - /// Optional fixed delay between retry attempts. + /// Optional fixed delay between retry attempts. When set, this takes precedence over exponential backoff. /// public global::System.TimeSpan? Delay { get; set; } + + /// + /// Initial exponential backoff delay used when is not set. + /// + public global::System.TimeSpan InitialDelay { get; set; } = global::System.TimeSpan.FromSeconds(1); + + /// + /// Maximum retry delay after applying retry headers, backoff, and jitter. + /// + public global::System.TimeSpan MaxDelay { get; set; } = global::System.TimeSpan.FromSeconds(30); + + /// + /// Multiplier applied to exponential backoff after each failed attempt. + /// Values below 1 are normalized to 1. + /// + public double BackoffMultiplier { get; set; } = 2D; + + /// + /// Randomizes computed backoff by plus or minus this ratio. Values are clamped to 0..1. + /// + public double JitterRatio { get; set; } = 0.2D; + + /// + /// Whether Retry-After response headers should control retry delay when present. + /// + public bool UseRetryAfterHeader { get; set; } = true; + + /// + /// Whether a rate-limit reset response header should control retry delay when present. + /// + public bool UseRateLimitResetHeader { get; set; } + + /// + /// Optional provider-specific rate-limit reset header name. Values may be Unix seconds or an HTTP date. + /// + public string? RateLimitResetHeaderName { get; set; } = "X-RateLimit-Reset"; } @@ -231,6 +267,16 @@ public sealed class AutoSDKHookContext /// public bool WillRetry { get; set; } + /// + /// The computed retry delay when is true. + /// + public global::System.TimeSpan? RetryDelay { get; set; } + + /// + /// A short retry reason such as exception or status:429. + /// + public string RetryReason { get; set; } = string.Empty; + /// /// The effective cancellation token for the current request attempt. /// @@ -254,6 +300,8 @@ internal static class AutoSDKRequestOptionsSupport int attempt, int maxAttempts, bool willRetry, + global::System.TimeSpan? retryDelay, + string retryReason, global::System.Threading.CancellationToken cancellationToken) { return new global::CursorAgents.AutoSDKHookContext @@ -271,6 +319,8 @@ internal static class AutoSDKRequestOptionsSupport Attempt = attempt, MaxAttempts = maxAttempts, WillRetry = willRetry, + RetryDelay = retryDelay, + RetryReason = retryReason ?? string.Empty, CancellationToken = cancellationToken, }; } @@ -338,19 +388,188 @@ internal static int GetMaxAttempts( return maxAttempts < 1 ? 1 : maxAttempts; } - internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + internal static global::System.TimeSpan GetRetryDelay( global::CursorAgents.AutoSDKClientOptions clientOptions, global::CursorAgents.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::CursorAgents.AutoSDKRetryOptions(); + + if (retryOptions.UseRetryAfterHeader && + TryGetRetryAfterDelay(response, out var retryAfterDelay)) + { + return ClampRetryDelay(retryAfterDelay, retryOptions); + } + + if (retryOptions.UseRateLimitResetHeader && + TryGetRateLimitResetDelay(response, retryOptions.RateLimitResetHeaderName, out var rateLimitResetDelay)) + { + return ClampRetryDelay(rateLimitResetDelay, retryOptions); + } + + if (retryOptions.Delay.HasValue) + { + return ClampRetryDelay(retryOptions.Delay.Value, retryOptions); + } + + var initialDelay = retryOptions.InitialDelay; + if (initialDelay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var multiplier = retryOptions.BackoffMultiplier < 1D ? 1D : retryOptions.BackoffMultiplier; + var exponent = attempt <= 1 ? 0 : attempt - 1; + var delayMilliseconds = initialDelay.TotalMilliseconds * global::System.Math.Pow(multiplier, exponent); + if (double.IsNaN(delayMilliseconds) || double.IsInfinity(delayMilliseconds) || delayMilliseconds < 0D) + { + delayMilliseconds = 0D; + } + + var delay = global::System.TimeSpan.FromMilliseconds(delayMilliseconds); + delay = ApplyJitter(delay, retryOptions.JitterRatio); + return ClampRetryDelay(delay, retryOptions); + } + + internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + global::System.TimeSpan retryDelay, global::System.Threading.CancellationToken cancellationToken) { - var delay = requestOptions?.Retry?.Delay ?? - clientOptions.Retry?.Delay; - if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero) + if (retryDelay <= global::System.TimeSpan.Zero) { return; } - await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false); + await global::System.Threading.Tasks.Task.Delay(retryDelay, cancellationToken).ConfigureAwait(false); + } + + private static bool TryGetRetryAfterDelay( + global::System.Net.Http.HttpResponseMessage? response, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + var retryAfter = response?.Headers.RetryAfter; + if (retryAfter == null) + { + return false; + } + + if (retryAfter.Delta.HasValue) + { + delay = retryAfter.Delta.Value; + return delay > global::System.TimeSpan.Zero; + } + + if (retryAfter.Date.HasValue) + { + delay = retryAfter.Date.Value - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static bool TryGetRateLimitResetDelay( + global::System.Net.Http.HttpResponseMessage? response, + string? headerName, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + if (response == null || string.IsNullOrWhiteSpace(headerName)) + { + return false; + } + + if (!response.Headers.TryGetValues(headerName, out var values) && + (response.Content?.Headers == null || !response.Content.Headers.TryGetValues(headerName, out values))) + { + return false; + } + + var value = global::System.Linq.Enumerable.FirstOrDefault(values); + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + value = value.Trim(); + if (long.TryParse( + value, + global::System.Globalization.NumberStyles.Integer, + global::System.Globalization.CultureInfo.InvariantCulture, + out var unixSeconds)) + { + delay = global::System.DateTimeOffset.FromUnixTimeSeconds(unixSeconds) - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + if (global::System.DateTimeOffset.TryParse( + value, + global::System.Globalization.CultureInfo.InvariantCulture, + global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal, + out var resetAt)) + { + delay = resetAt - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static global::System.TimeSpan ApplyJitter( + global::System.TimeSpan delay, + double jitterRatio) + { + if (delay <= global::System.TimeSpan.Zero || jitterRatio <= 0D) + { + return delay; + } + + if (jitterRatio > 1D) + { + jitterRatio = 1D; + } + + var sample = NextJitterSample(); + var multiplier = 1D - jitterRatio + (sample * jitterRatio * 2D); + var milliseconds = delay.TotalMilliseconds * multiplier; + if (double.IsNaN(milliseconds) || double.IsInfinity(milliseconds) || milliseconds < 0D) + { + milliseconds = 0D; + } + + return global::System.TimeSpan.FromMilliseconds(milliseconds); + } + + private static double NextJitterSample() + { + var bytes = new byte[8]; + using (var randomNumberGenerator = global::System.Security.Cryptography.RandomNumberGenerator.Create()) + { + randomNumberGenerator.GetBytes(bytes); + } + + var value = global::System.BitConverter.ToUInt64(bytes, 0); + return value / (double)ulong.MaxValue; + } + + private static global::System.TimeSpan ClampRetryDelay( + global::System.TimeSpan delay, + global::CursorAgents.AutoSDKRetryOptions retryOptions) + { + if (delay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var maxDelay = retryOptions.MaxDelay; + if (maxDelay > global::System.TimeSpan.Zero && delay > maxDelay) + { + return maxDelay; + } + + return delay; } internal static bool ShouldRetryStatusCode(