Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0"
".": "0.2.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 7
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-2c88c6d890406ff8a5f1bca692264fb9af4bc4fe64df0986e06d3386fc6d6fcb.yml
openapi_spec_hash: dc6ea17f8152708dc0a390c7f86b1a5d
config_hash: a17b6052ac65237b7b8e145f4f692d3c
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-705638ac8966569986bd9ebb7c9761bf0016909e9f2753e77ceabb12c8049511.yml
openapi_spec_hash: a8fbbcaa38e91c7f97313620b42d8d62
config_hash: a35b56eb05306a0f02e83c11d57f975f
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.2.0 (2025-12-16)

Full Changelog: [v0.1.0...v0.2.0](https://github.com/browserbase/stagehand-java/compare/v0.1.0...v0.2.0)

### Features

* **api:** manual updates ([a5a66d6](https://github.com/browserbase/stagehand-java/commit/a5a66d64628b1f18f987d1d2b96d529d4a623f27))
* **api:** manual updates ([2b8487b](https://github.com/browserbase/stagehand-java/commit/2b8487b08f12aca78e9b8e252779be34c06ffe11))

## 0.1.0 (2025-12-16)

Full Changelog: [v0.0.1...v0.1.0](https://github.com/browserbase/stagehand-java/compare/v0.0.1...v0.1.0)
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.browserbase.api/stagehand-java)](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/0.1.0)
[![javadoc](https://javadoc.io/badge2/com.browserbase.api/stagehand-java/0.1.0/javadoc.svg)](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.1.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.browserbase.api/stagehand-java)](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/0.2.0)
[![javadoc](https://javadoc.io/badge2/com.browserbase.api/stagehand-java/0.2.0/javadoc.svg)](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.2.0)

<!-- x-release-please-end -->

Expand All @@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/).

<!-- x-release-please-start-version -->

The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.1.0).
The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.2.0).

<!-- x-release-please-end -->

Expand All @@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.stagehand.dev](https://docs.sta
### Gradle

```kotlin
implementation("com.browserbase.api:stagehand-java:0.1.0")
implementation("com.browserbase.api:stagehand-java:0.2.0")
```

### Maven
Expand All @@ -33,7 +33,7 @@ implementation("com.browserbase.api:stagehand-java:0.1.0")
<dependency>
<groupId>com.browserbase.api</groupId>
<artifactId>stagehand-java</artifactId>
<version>0.1.0</version>
<version>0.2.0</version>
</dependency>
```

Expand Down Expand Up @@ -203,8 +203,8 @@ import com.browserbase.api.models.sessions.SessionStartParams;
import com.browserbase.api.models.sessions.SessionStartResponse;

SessionStartParams params = SessionStartParams.builder()
.browserbaseApiKey("<your API key here>")
.browserbaseProjectId("<your project ID here>")
.browserbaseApiKey("your Browserbase API key")
.browserbaseProjectId("your Browserbase Project ID")
.build();
HttpResponseFor<SessionStartResponse> response = client.sessions().withRawResponse().start(params);

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {

allprojects {
group = "com.browserbase.api"
version = "0.1.0" // x-release-please-version
version = "0.2.0" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import com.browserbase.api.core.ExcludeMissing
import com.browserbase.api.core.JsonField
import com.browserbase.api.core.JsonMissing
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkKnown
import com.browserbase.api.core.toImmutable
import com.browserbase.api.errors.StagehandInvalidDataException
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
Expand All @@ -16,21 +14,18 @@ import com.fasterxml.jackson.annotation.JsonProperty
import java.util.Collections
import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

class SessionExecuteAgentResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val message: JsonField<String>,
private val steps: JsonField<List<JsonValue>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {

@JsonCreator
private constructor(
@JsonProperty("message") @ExcludeMissing message: JsonField<String> = JsonMissing.of(),
@JsonProperty("steps") @ExcludeMissing steps: JsonField<List<JsonValue>> = JsonMissing.of(),
) : this(message, steps, mutableMapOf())
@JsonProperty("message") @ExcludeMissing message: JsonField<String> = JsonMissing.of()
) : this(message, mutableMapOf())

/**
* Final message from the agent
Expand All @@ -40,28 +35,13 @@ private constructor(
*/
fun message(): Optional<String> = message.getOptional("message")

/**
* Steps taken by the agent
*
* @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun steps(): Optional<List<JsonValue>> = steps.getOptional("steps")

/**
* Returns the raw JSON value of [message].
*
* Unlike [message], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("message") @ExcludeMissing fun _message(): JsonField<String> = message

/**
* Returns the raw JSON value of [steps].
*
* Unlike [steps], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("steps") @ExcludeMissing fun _steps(): JsonField<List<JsonValue>> = steps

@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
Expand All @@ -86,13 +66,11 @@ private constructor(
class Builder internal constructor() {

private var message: JsonField<String> = JsonMissing.of()
private var steps: JsonField<MutableList<JsonValue>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(sessionExecuteAgentResponse: SessionExecuteAgentResponse) = apply {
message = sessionExecuteAgentResponse.message
steps = sessionExecuteAgentResponse.steps.map { it.toMutableList() }
additionalProperties = sessionExecuteAgentResponse.additionalProperties.toMutableMap()
}

Expand All @@ -107,30 +85,6 @@ private constructor(
*/
fun message(message: JsonField<String>) = apply { this.message = message }

/** Steps taken by the agent */
fun steps(steps: List<JsonValue>) = steps(JsonField.of(steps))

/**
* Sets [Builder.steps] to an arbitrary JSON value.
*
* You should usually call [Builder.steps] with a well-typed `List<JsonValue>` value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun steps(steps: JsonField<List<JsonValue>>) = apply {
this.steps = steps.map { it.toMutableList() }
}

/**
* Adds a single [JsonValue] to [steps].
*
* @throws IllegalStateException if the field was previously set to a non-list.
*/
fun addStep(step: JsonValue) = apply {
steps =
(steps ?: JsonField.of(mutableListOf())).also { checkKnown("steps", it).add(step) }
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
Expand All @@ -156,11 +110,7 @@ private constructor(
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): SessionExecuteAgentResponse =
SessionExecuteAgentResponse(
message,
(steps ?: JsonMissing.of()).map { it.toImmutable() },
additionalProperties.toMutableMap(),
)
SessionExecuteAgentResponse(message, additionalProperties.toMutableMap())
}

private var validated: Boolean = false
Expand All @@ -171,7 +121,6 @@ private constructor(
}

message()
steps()
validated = true
}

Expand All @@ -188,9 +137,7 @@ private constructor(
*
* Used for best match union deserialization.
*/
@JvmSynthetic
internal fun validity(): Int =
(if (message.asKnown().isPresent) 1 else 0) + (steps.asKnown().getOrNull()?.size ?: 0)
@JvmSynthetic internal fun validity(): Int = (if (message.asKnown().isPresent) 1 else 0)

override fun equals(other: Any?): Boolean {
if (this === other) {
Expand All @@ -199,14 +146,13 @@ private constructor(

return other is SessionExecuteAgentResponse &&
message == other.message &&
steps == other.steps &&
additionalProperties == other.additionalProperties
}

private val hashCode: Int by lazy { Objects.hash(message, steps, additionalProperties) }
private val hashCode: Int by lazy { Objects.hash(message, additionalProperties) }

override fun hashCode(): Int = hashCode

override fun toString() =
"SessionExecuteAgentResponse{message=$message, steps=$steps, additionalProperties=$additionalProperties}"
"SessionExecuteAgentResponse{message=$message, additionalProperties=$additionalProperties}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

package com.browserbase.api.models.sessions

import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.jsonMapper
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import kotlin.jvm.optionals.getOrNull
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

Expand All @@ -14,24 +12,16 @@ internal class SessionExecuteAgentResponseTest {
@Test
fun create() {
val sessionExecuteAgentResponse =
SessionExecuteAgentResponse.builder()
.message("message")
.addStep(JsonValue.from(mapOf<String, Any>()))
.build()
SessionExecuteAgentResponse.builder().message("message").build()

assertThat(sessionExecuteAgentResponse.message()).contains("message")
assertThat(sessionExecuteAgentResponse.steps().getOrNull())
.containsExactly(JsonValue.from(mapOf<String, Any>()))
}

@Test
fun roundtrip() {
val jsonMapper = jsonMapper()
val sessionExecuteAgentResponse =
SessionExecuteAgentResponse.builder()
.message("message")
.addStep(JsonValue.from(mapOf<String, Any>()))
.build()
SessionExecuteAgentResponse.builder().message("message").build()

val roundtrippedSessionExecuteAgentResponse =
jsonMapper.readValue(
Expand Down
Loading