From 5109e725b890147cb97362f2031ab9ace137c40a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 8 Jul 2026 22:04:47 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../AgentRunsStopCommandApiCommand.g.cs | 64 +++ .../Commands/DefaultApiGroupCommand.g.cs | 1 + ...rbase.BrowserbaseClient.AgentRunsStop.g.cs | 426 ++++++++++++++++++ ...base.IBrowserbaseClient.AgentRunsStop.g.cs | 32 ++ src/libs/Browserbase/openapi.yaml | 24 + 5 files changed, 547 insertions(+) create mode 100644 src/cli/Browserbase.CLI/Commands/AgentRunsStopCommandApiCommand.g.cs create mode 100644 src/libs/Browserbase/Generated/Browserbase.BrowserbaseClient.AgentRunsStop.g.cs create mode 100644 src/libs/Browserbase/Generated/Browserbase.IBrowserbaseClient.AgentRunsStop.g.cs diff --git a/src/cli/Browserbase.CLI/Commands/AgentRunsStopCommandApiCommand.g.cs b/src/cli/Browserbase.CLI/Commands/AgentRunsStopCommandApiCommand.g.cs new file mode 100644 index 0000000..8943a18 --- /dev/null +++ b/src/cli/Browserbase.CLI/Commands/AgentRunsStopCommandApiCommand.g.cs @@ -0,0 +1,64 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Browserbase.CLI.Commands; + +internal static partial class AgentRunsStopCommandApiCommand +{ + private static Argument RunId { get; } = new( + name: @"run-id") + { + Description = @"The run ID.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Browserbase.AgentRun value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Browserbase.AgentRun value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + public static Command Create() + { + var command = new Command(@"agent-runs-stop", @"Stop a Run +Request that an in-progress run stop. The run winds down and transitions to `STOPPED`. Stopping a run that has already finished returns a conflict."); + command.Arguments.Add(RunId); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var runId = parseResult.GetRequiredValue(RunId); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.AgentRunsStopAsync( + runId: runId, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Browserbase.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false)); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Browserbase.CLI/Commands/DefaultApiGroupCommand.g.cs b/src/cli/Browserbase.CLI/Commands/DefaultApiGroupCommand.g.cs index ccdf472..f605e44 100644 --- a/src/cli/Browserbase.CLI/Commands/DefaultApiGroupCommand.g.cs +++ b/src/cli/Browserbase.CLI/Commands/DefaultApiGroupCommand.g.cs @@ -13,6 +13,7 @@ public static Command Create() command.Subcommands.Add(AgentRunsGetCommandApiCommand.Create()); command.Subcommands.Add(AgentRunsListCommandApiCommand.Create()); command.Subcommands.Add(AgentRunsMessagesCommandApiCommand.Create()); + command.Subcommands.Add(AgentRunsStopCommandApiCommand.Create()); command.Subcommands.Add(AgentsCreateCommandApiCommand.Create()); command.Subcommands.Add(AgentsDeleteCommandApiCommand.Create()); command.Subcommands.Add(AgentsGetCommandApiCommand.Create()); diff --git a/src/libs/Browserbase/Generated/Browserbase.BrowserbaseClient.AgentRunsStop.g.cs b/src/libs/Browserbase/Generated/Browserbase.BrowserbaseClient.AgentRunsStop.g.cs new file mode 100644 index 0000000..efdd440 --- /dev/null +++ b/src/libs/Browserbase/Generated/Browserbase.BrowserbaseClient.AgentRunsStop.g.cs @@ -0,0 +1,426 @@ + +#nullable enable + +namespace Browserbase +{ + public partial class BrowserbaseClient + { + + + private static readonly global::Browserbase.EndPointSecurityRequirement s_AgentRunsStopSecurityRequirement0 = + new global::Browserbase.EndPointSecurityRequirement + { + Authorizations = new global::Browserbase.EndPointAuthorizationRequirement[] + { new global::Browserbase.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Browserbase.EndPointSecurityRequirement[] s_AgentRunsStopSecurityRequirements = + new global::Browserbase.EndPointSecurityRequirement[] + { s_AgentRunsStopSecurityRequirement0, + }; + partial void PrepareAgentRunsStopArguments( + global::System.Net.Http.HttpClient httpClient, + ref string runId); + partial void PrepareAgentRunsStopRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string runId); + partial void ProcessAgentRunsStopResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessAgentRunsStopResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Stop a Run
+ /// Request that an in-progress run stop. The run winds down and transitions to `STOPPED`. Stopping a run that has already finished returns a conflict. + ///
+ /// + /// 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 AgentRunsStopAsync( + string runId, + global::Browserbase.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AgentRunsStopAsResponseAsync( + runId: runId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Stop a Run
+ /// Request that an in-progress run stop. The run winds down and transitions to `STOPPED`. Stopping a run that has already finished returns a conflict. + ///
+ /// + /// 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> AgentRunsStopAsResponseAsync( + string runId, + global::Browserbase.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareAgentRunsStopArguments( + httpClient: HttpClient, + runId: ref runId); + + + var __authorizations = global::Browserbase.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_AgentRunsStopSecurityRequirements, + operationName: "AgentRunsStopAsync"); + + using var __timeoutCancellationTokenSource = global::Browserbase.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Browserbase.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Browserbase.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Browserbase.PathBuilder( + path: $"/v1/agents/runs/{runId}/stop", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Browserbase.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::Browserbase.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareAgentRunsStopRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + runId: runId!); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Browserbase.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Browserbase.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgentRunsStop", + methodName: "AgentRunsStopAsync", + pathTemplate: "$\"/v1/agents/runs/{runId}/stop\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Browserbase.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Browserbase.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Browserbase.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgentRunsStop", + methodName: "AgentRunsStopAsync", + pathTemplate: "$\"/v1/agents/runs/{runId}/stop\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Browserbase.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Browserbase.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Browserbase.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Browserbase.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Browserbase.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgentRunsStop", + methodName: "AgentRunsStopAsync", + pathTemplate: "$\"/v1/agents/runs/{runId}/stop\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + 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::Browserbase.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessAgentRunsStopResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Browserbase.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Browserbase.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgentRunsStop", + methodName: "AgentRunsStopAsync", + pathTemplate: "$\"/v1/agents/runs/{runId}/stop\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Browserbase.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Browserbase.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgentRunsStop", + methodName: "AgentRunsStopAsync", + pathTemplate: "$\"/v1/agents/runs/{runId}/stop\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessAgentRunsStopResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Browserbase.AgentRun.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Browserbase.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Browserbase.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Browserbase.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Browserbase.AgentRun.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Browserbase.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Browserbase.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Browserbase.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Browserbase/Generated/Browserbase.IBrowserbaseClient.AgentRunsStop.g.cs b/src/libs/Browserbase/Generated/Browserbase.IBrowserbaseClient.AgentRunsStop.g.cs new file mode 100644 index 0000000..b3fabcb --- /dev/null +++ b/src/libs/Browserbase/Generated/Browserbase.IBrowserbaseClient.AgentRunsStop.g.cs @@ -0,0 +1,32 @@ +#nullable enable + +namespace Browserbase +{ + public partial interface IBrowserbaseClient + { + /// + /// Stop a Run
+ /// Request that an in-progress run stop. The run winds down and transitions to `STOPPED`. Stopping a run that has already finished returns a conflict. + ///
+ /// + /// 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 AgentRunsStopAsync( + string runId, + global::Browserbase.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Stop a Run
+ /// Request that an in-progress run stop. The run winds down and transitions to `STOPPED`. Stopping a run that has already finished returns a conflict. + ///
+ /// + /// 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> AgentRunsStopAsResponseAsync( + string runId, + global::Browserbase.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Browserbase/openapi.yaml b/src/libs/Browserbase/openapi.yaml index ae039a8..27e2986 100644 --- a/src/libs/Browserbase/openapi.yaml +++ b/src/libs/Browserbase/openapi.yaml @@ -476,6 +476,30 @@ paths: required: - data - nextSince + /v1/agents/runs/{runId}/stop: + post: + operationId: AgentRuns_stop + summary: Stop a Run + description: >- + Request that an in-progress run stop. The run winds down and transitions + to `STOPPED`. Stopping a run that has already finished returns a + conflict. + parameters: + - name: runId + in: path + description: The run ID. + required: true + schema: + type: string + responses: + '202': + description: >- + The stop has been requested. Poll the run until its status is + `STOPPED` to confirm it wound down. + content: + application/json: + schema: + $ref: '#/components/schemas/AgentRun' /v1/agents/{agentId}: get: operationId: Agents_get