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 @@
{
".": "3.14.0"
".": "3.15.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: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-8fbb3fa8f3a37c1c7408de427fe125aadec49f705e8e30d191601a9b69c4cc41.yml
openapi_spec_hash: 48b4dfac35a842d7fb0d228caf87544e
config_hash: 7386d24e2f03a3b2a89b3f6881446348
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-5d0052068f044366d6d31570d9712922c9a80fdd6f9995af815e9afc075507ef.yml
openapi_spec_hash: c0cb787da075d8cd2d938c05b36b5efa
config_hash: 4252fc025e947bc0fd6b2abd91a0cc8e
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 3.15.0 (2026-02-18)

Full Changelog: [v3.14.0...v3.15.0](https://github.com/browserbase/stagehand-php/compare/v3.14.0...v3.15.0)

### Features

* randomize region used for evals, split out pnpm and turbo cache, veri… ([49fa8e0](https://github.com/browserbase/stagehand-php/commit/49fa8e0ab9a8f5ff331a9858e5a6f1b76e3aff4c))

## 3.14.0 (2026-02-03)

Full Changelog: [v3.13.1...v3.14.0](https://github.com/browserbase/stagehand-php/compare/v3.13.1...v3.14.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The REST API documentation can be found on [docs.stagehand.dev](https://docs.sta
<!-- x-release-please-start-version -->

```
composer require "browserbase/stagehand 3.14.0"
composer require "browserbase/stagehand 3.15.0"
```

<!-- x-release-please-end -->
Expand Down
48 changes: 40 additions & 8 deletions src/Sessions/SessionReplayResponse/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,44 @@
namespace Stagehand\Sessions\SessionReplayResponse;

use Stagehand\Core\Attributes\Optional;
use Stagehand\Core\Attributes\Required;
use Stagehand\Core\Concerns\SdkModel;
use Stagehand\Core\Contracts\BaseModel;
use Stagehand\Sessions\SessionReplayResponse\Data\Page;

/**
* @phpstan-import-type PageShape from \Stagehand\Sessions\SessionReplayResponse\Data\Page
*
* @phpstan-type DataShape = array{pages?: list<Page|PageShape>|null}
* @phpstan-type DataShape = array{
* pages: list<Page|PageShape>, clientLanguage?: string|null
* }
*/
final class Data implements BaseModel
{
/** @use SdkModel<DataShape> */
use SdkModel;

/** @var list<Page>|null $pages */
#[Optional(list: Page::class)]
public ?array $pages;
/** @var list<Page> $pages */
#[Required(list: Page::class)]
public array $pages;

#[Optional]
public ?string $clientLanguage;

/**
* `new Data()` is missing required properties by the API.
*
* To enforce required parameters use
* ```
* Data::with(pages: ...)
* ```
*
* Otherwise ensure the following setters are called
*
* ```
* (new Data)->withPages(...)
* ```
*/
public function __construct()
{
$this->initialize();
Expand All @@ -33,13 +53,17 @@ public function __construct()
*
* You must use named parameters to construct any parameters with a default value.
*
* @param list<Page|PageShape>|null $pages
* @param list<Page|PageShape> $pages
*/
public static function with(?array $pages = null): self
{
public static function with(
array $pages,
?string $clientLanguage = null
): self {
$self = new self;

null !== $pages && $self['pages'] = $pages;
$self['pages'] = $pages;

null !== $clientLanguage && $self['clientLanguage'] = $clientLanguage;

return $self;
}
Expand All @@ -54,4 +78,12 @@ public function withPages(array $pages): self

return $self;
}

public function withClientLanguage(string $clientLanguage): self
{
$self = clone $this;
$self['clientLanguage'] = $clientLanguage;

return $self;
}
}
81 changes: 72 additions & 9 deletions src/Sessions/SessionReplayResponse/Data/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,57 @@

namespace Stagehand\Sessions\SessionReplayResponse\Data;

use Stagehand\Core\Attributes\Optional;
use Stagehand\Core\Attributes\Required;
use Stagehand\Core\Concerns\SdkModel;
use Stagehand\Core\Contracts\BaseModel;
use Stagehand\Sessions\SessionReplayResponse\Data\Page\Action;

/**
* @phpstan-import-type ActionShape from \Stagehand\Sessions\SessionReplayResponse\Data\Page\Action
*
* @phpstan-type PageShape = array{actions?: list<Action|ActionShape>|null}
* @phpstan-type PageShape = array{
* actions: list<Action|ActionShape>,
* duration: float,
* timestamp: float,
* url: string,
* }
*/
final class Page implements BaseModel
{
/** @use SdkModel<PageShape> */
use SdkModel;

/** @var list<Action>|null $actions */
#[Optional(list: Action::class)]
public ?array $actions;
/** @var list<Action> $actions */
#[Required(list: Action::class)]
public array $actions;

#[Required]
public float $duration;

#[Required]
public float $timestamp;

#[Required]
public string $url;

/**
* `new Page()` is missing required properties by the API.
*
* To enforce required parameters use
* ```
* Page::with(actions: ..., duration: ..., timestamp: ..., url: ...)
* ```
*
* Otherwise ensure the following setters are called
*
* ```
* (new Page)
* ->withActions(...)
* ->withDuration(...)
* ->withTimestamp(...)
* ->withURL(...)
* ```
*/
public function __construct()
{
$this->initialize();
Expand All @@ -33,13 +65,20 @@ public function __construct()
*
* You must use named parameters to construct any parameters with a default value.
*
* @param list<Action|ActionShape>|null $actions
* @param list<Action|ActionShape> $actions
*/
public static function with(?array $actions = null): self
{
public static function with(
array $actions,
float $duration,
float $timestamp,
string $url
): self {
$self = new self;

null !== $actions && $self['actions'] = $actions;
$self['actions'] = $actions;
$self['duration'] = $duration;
$self['timestamp'] = $timestamp;
$self['url'] = $url;

return $self;
}
Expand All @@ -54,4 +93,28 @@ public function withActions(array $actions): self

return $self;
}

public function withDuration(float $duration): self
{
$self = clone $this;
$self['duration'] = $duration;

return $self;
}

public function withTimestamp(float $timestamp): self
{
$self = clone $this;
$self['timestamp'] = $timestamp;

return $self;
}

public function withURL(string $url): self
{
$self = clone $this;
$self['url'] = $url;

return $self;
}
}
97 changes: 92 additions & 5 deletions src/Sessions/SessionReplayResponse/Data/Page/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Stagehand\Sessions\SessionReplayResponse\Data\Page;

use Stagehand\Core\Attributes\Optional;
use Stagehand\Core\Attributes\Required;
use Stagehand\Core\Concerns\SdkModel;
use Stagehand\Core\Contracts\BaseModel;
use Stagehand\Sessions\SessionReplayResponse\Data\Page\Action\TokenUsage;
Expand All @@ -13,20 +14,57 @@
* @phpstan-import-type TokenUsageShape from \Stagehand\Sessions\SessionReplayResponse\Data\Page\Action\TokenUsage
*
* @phpstan-type ActionShape = array{
* method?: string|null, tokenUsage?: null|TokenUsage|TokenUsageShape
* method: string,
* parameters: array<string,mixed>,
* result: array<string,mixed>,
* timestamp: float,
* endTime?: float|null,
* tokenUsage?: null|TokenUsage|TokenUsageShape,
* }
*/
final class Action implements BaseModel
{
/** @use SdkModel<ActionShape> */
use SdkModel;

#[Required]
public string $method;

/** @var array<string,mixed> $parameters */
#[Required(map: 'mixed')]
public array $parameters;

/** @var array<string,mixed> $result */
#[Required(map: 'mixed')]
public array $result;

#[Required]
public float $timestamp;

#[Optional]
public ?string $method;
public ?float $endTime;

#[Optional]
public ?TokenUsage $tokenUsage;

/**
* `new Action()` is missing required properties by the API.
*
* To enforce required parameters use
* ```
* Action::with(method: ..., parameters: ..., result: ..., timestamp: ...)
* ```
*
* Otherwise ensure the following setters are called
*
* ```
* (new Action)
* ->withMethod(...)
* ->withParameters(...)
* ->withResult(...)
* ->withTimestamp(...)
* ```
*/
public function __construct()
{
$this->initialize();
Expand All @@ -37,15 +75,26 @@ public function __construct()
*
* You must use named parameters to construct any parameters with a default value.
*
* @param array<string,mixed> $parameters
* @param array<string,mixed> $result
* @param TokenUsage|TokenUsageShape|null $tokenUsage
*/
public static function with(
?string $method = null,
TokenUsage|array|null $tokenUsage = null
string $method,
array $parameters,
array $result,
float $timestamp,
?float $endTime = null,
TokenUsage|array|null $tokenUsage = null,
): self {
$self = new self;

null !== $method && $self['method'] = $method;
$self['method'] = $method;
$self['parameters'] = $parameters;
$self['result'] = $result;
$self['timestamp'] = $timestamp;

null !== $endTime && $self['endTime'] = $endTime;
null !== $tokenUsage && $self['tokenUsage'] = $tokenUsage;

return $self;
Expand All @@ -59,6 +108,44 @@ public function withMethod(string $method): self
return $self;
}

/**
* @param array<string,mixed> $parameters
*/
public function withParameters(array $parameters): self
{
$self = clone $this;
$self['parameters'] = $parameters;

return $self;
}

/**
* @param array<string,mixed> $result
*/
public function withResult(array $result): self
{
$self = clone $this;
$self['result'] = $result;

return $self;
}

public function withTimestamp(float $timestamp): self
{
$self = clone $this;
$self['timestamp'] = $timestamp;

return $self;
}

public function withEndTime(float $endTime): self
{
$self = clone $this;
$self['endTime'] = $endTime;

return $self;
}

/**
* @param TokenUsage|TokenUsageShape $tokenUsage
*/
Expand Down
Loading