diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 75e8a66..4336a6c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.14.0" + ".": "3.15.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 9738f87..27548de 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a900c0..bed625a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 8d748e7..f6147b6 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ The REST API documentation can be found on [docs.stagehand.dev](https://docs.sta ``` -composer require "browserbase/stagehand 3.14.0" +composer require "browserbase/stagehand 3.15.0" ``` diff --git a/src/Sessions/SessionReplayResponse/Data.php b/src/Sessions/SessionReplayResponse/Data.php index 2a1a640..22acf98 100644 --- a/src/Sessions/SessionReplayResponse/Data.php +++ b/src/Sessions/SessionReplayResponse/Data.php @@ -5,6 +5,7 @@ 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; @@ -12,17 +13,36 @@ /** * @phpstan-import-type PageShape from \Stagehand\Sessions\SessionReplayResponse\Data\Page * - * @phpstan-type DataShape = array{pages?: list|null} + * @phpstan-type DataShape = array{ + * pages: list, clientLanguage?: string|null + * } */ final class Data implements BaseModel { /** @use SdkModel */ use SdkModel; - /** @var list|null $pages */ - #[Optional(list: Page::class)] - public ?array $pages; + /** @var list $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(); @@ -33,13 +53,17 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $pages + * @param list $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; } @@ -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; + } } diff --git a/src/Sessions/SessionReplayResponse/Data/Page.php b/src/Sessions/SessionReplayResponse/Data/Page.php index 46a4c66..f48ac7e 100644 --- a/src/Sessions/SessionReplayResponse/Data/Page.php +++ b/src/Sessions/SessionReplayResponse/Data/Page.php @@ -4,7 +4,7 @@ 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; @@ -12,17 +12,49 @@ /** * @phpstan-import-type ActionShape from \Stagehand\Sessions\SessionReplayResponse\Data\Page\Action * - * @phpstan-type PageShape = array{actions?: list|null} + * @phpstan-type PageShape = array{ + * actions: list, + * duration: float, + * timestamp: float, + * url: string, + * } */ final class Page implements BaseModel { /** @use SdkModel */ use SdkModel; - /** @var list|null $actions */ - #[Optional(list: Action::class)] - public ?array $actions; + /** @var list $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(); @@ -33,13 +65,20 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list|null $actions + * @param list $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; } @@ -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; + } } diff --git a/src/Sessions/SessionReplayResponse/Data/Page/Action.php b/src/Sessions/SessionReplayResponse/Data/Page/Action.php index 052e9fb..79c630f 100644 --- a/src/Sessions/SessionReplayResponse/Data/Page/Action.php +++ b/src/Sessions/SessionReplayResponse/Data/Page/Action.php @@ -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; @@ -13,7 +14,12 @@ * @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, + * result: array, + * timestamp: float, + * endTime?: float|null, + * tokenUsage?: null|TokenUsage|TokenUsageShape, * } */ final class Action implements BaseModel @@ -21,12 +27,44 @@ final class Action implements BaseModel /** @use SdkModel */ use SdkModel; + #[Required] + public string $method; + + /** @var array $parameters */ + #[Required(map: 'mixed')] + public array $parameters; + + /** @var array $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(); @@ -37,15 +75,26 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param array $parameters + * @param array $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; @@ -59,6 +108,44 @@ public function withMethod(string $method): self return $self; } + /** + * @param array $parameters + */ + public function withParameters(array $parameters): self + { + $self = clone $this; + $self['parameters'] = $parameters; + + return $self; + } + + /** + * @param array $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 */ diff --git a/src/Sessions/SessionReplayResponse/Data/Page/Action/TokenUsage.php b/src/Sessions/SessionReplayResponse/Data/Page/Action/TokenUsage.php index 577ceff..9cc2cdb 100644 --- a/src/Sessions/SessionReplayResponse/Data/Page/Action/TokenUsage.php +++ b/src/Sessions/SessionReplayResponse/Data/Page/Action/TokenUsage.php @@ -10,10 +10,9 @@ /** * @phpstan-type TokenUsageShape = array{ - * cachedInputTokens?: float|null, + * cost?: float|null, * inputTokens?: float|null, * outputTokens?: float|null, - * reasoningTokens?: float|null, * timeMs?: float|null, * } */ @@ -23,7 +22,7 @@ final class TokenUsage implements BaseModel use SdkModel; #[Optional] - public ?float $cachedInputTokens; + public ?float $cost; #[Optional] public ?float $inputTokens; @@ -31,9 +30,6 @@ final class TokenUsage implements BaseModel #[Optional] public ?float $outputTokens; - #[Optional] - public ?float $reasoningTokens; - #[Optional] public ?float $timeMs; @@ -48,27 +44,25 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. */ public static function with( - ?float $cachedInputTokens = null, + ?float $cost = null, ?float $inputTokens = null, ?float $outputTokens = null, - ?float $reasoningTokens = null, ?float $timeMs = null, ): self { $self = new self; - null !== $cachedInputTokens && $self['cachedInputTokens'] = $cachedInputTokens; + null !== $cost && $self['cost'] = $cost; null !== $inputTokens && $self['inputTokens'] = $inputTokens; null !== $outputTokens && $self['outputTokens'] = $outputTokens; - null !== $reasoningTokens && $self['reasoningTokens'] = $reasoningTokens; null !== $timeMs && $self['timeMs'] = $timeMs; return $self; } - public function withCachedInputTokens(float $cachedInputTokens): self + public function withCost(float $cost): self { $self = clone $this; - $self['cachedInputTokens'] = $cachedInputTokens; + $self['cost'] = $cost; return $self; } @@ -89,14 +83,6 @@ public function withOutputTokens(float $outputTokens): self return $self; } - public function withReasoningTokens(float $reasoningTokens): self - { - $self = clone $this; - $self['reasoningTokens'] = $reasoningTokens; - - return $self; - } - public function withTimeMs(float $timeMs): self { $self = clone $this; diff --git a/src/Version.php b/src/Version.php index 6df3c37..e076d54 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace Stagehand; // x-release-please-start-version -const VERSION = '3.14.0'; +const VERSION = '3.15.0'; // x-release-please-end