Skip to content

Commit 49fa8e0

Browse files
feat: randomize region used for evals, split out pnpm and turbo cache, veri…
1 parent 6fbbf31 commit 49fa8e0

5 files changed

Lines changed: 212 additions & 44 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-8fbb3fa8f3a37c1c7408de427fe125aadec49f705e8e30d191601a9b69c4cc41.yml
3-
openapi_spec_hash: 8a36f79075102c63234ed06107deb8c9
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-5d0052068f044366d6d31570d9712922c9a80fdd6f9995af815e9afc075507ef.yml
3+
openapi_spec_hash: c0cb787da075d8cd2d938c05b36b5efa
44
config_hash: 4252fc025e947bc0fd6b2abd91a0cc8e

src/Sessions/SessionReplayResponse/Data.php

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,44 @@
55
namespace Stagehand\Sessions\SessionReplayResponse;
66

77
use Stagehand\Core\Attributes\Optional;
8+
use Stagehand\Core\Attributes\Required;
89
use Stagehand\Core\Concerns\SdkModel;
910
use Stagehand\Core\Contracts\BaseModel;
1011
use Stagehand\Sessions\SessionReplayResponse\Data\Page;
1112

1213
/**
1314
* @phpstan-import-type PageShape from \Stagehand\Sessions\SessionReplayResponse\Data\Page
1415
*
15-
* @phpstan-type DataShape = array{pages?: list<Page|PageShape>|null}
16+
* @phpstan-type DataShape = array{
17+
* pages: list<Page|PageShape>, clientLanguage?: string|null
18+
* }
1619
*/
1720
final class Data implements BaseModel
1821
{
1922
/** @use SdkModel<DataShape> */
2023
use SdkModel;
2124

22-
/** @var list<Page>|null $pages */
23-
#[Optional(list: Page::class)]
24-
public ?array $pages;
25+
/** @var list<Page> $pages */
26+
#[Required(list: Page::class)]
27+
public array $pages;
2528

29+
#[Optional]
30+
public ?string $clientLanguage;
31+
32+
/**
33+
* `new Data()` is missing required properties by the API.
34+
*
35+
* To enforce required parameters use
36+
* ```
37+
* Data::with(pages: ...)
38+
* ```
39+
*
40+
* Otherwise ensure the following setters are called
41+
*
42+
* ```
43+
* (new Data)->withPages(...)
44+
* ```
45+
*/
2646
public function __construct()
2747
{
2848
$this->initialize();
@@ -33,13 +53,17 @@ public function __construct()
3353
*
3454
* You must use named parameters to construct any parameters with a default value.
3555
*
36-
* @param list<Page|PageShape>|null $pages
56+
* @param list<Page|PageShape> $pages
3757
*/
38-
public static function with(?array $pages = null): self
39-
{
58+
public static function with(
59+
array $pages,
60+
?string $clientLanguage = null
61+
): self {
4062
$self = new self;
4163

42-
null !== $pages && $self['pages'] = $pages;
64+
$self['pages'] = $pages;
65+
66+
null !== $clientLanguage && $self['clientLanguage'] = $clientLanguage;
4367

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

5579
return $self;
5680
}
81+
82+
public function withClientLanguage(string $clientLanguage): self
83+
{
84+
$self = clone $this;
85+
$self['clientLanguage'] = $clientLanguage;
86+
87+
return $self;
88+
}
5789
}

src/Sessions/SessionReplayResponse/Data/Page.php

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,57 @@
44

55
namespace Stagehand\Sessions\SessionReplayResponse\Data;
66

7-
use Stagehand\Core\Attributes\Optional;
7+
use Stagehand\Core\Attributes\Required;
88
use Stagehand\Core\Concerns\SdkModel;
99
use Stagehand\Core\Contracts\BaseModel;
1010
use Stagehand\Sessions\SessionReplayResponse\Data\Page\Action;
1111

1212
/**
1313
* @phpstan-import-type ActionShape from \Stagehand\Sessions\SessionReplayResponse\Data\Page\Action
1414
*
15-
* @phpstan-type PageShape = array{actions?: list<Action|ActionShape>|null}
15+
* @phpstan-type PageShape = array{
16+
* actions: list<Action|ActionShape>,
17+
* duration: float,
18+
* timestamp: float,
19+
* url: string,
20+
* }
1621
*/
1722
final class Page implements BaseModel
1823
{
1924
/** @use SdkModel<PageShape> */
2025
use SdkModel;
2126

22-
/** @var list<Action>|null $actions */
23-
#[Optional(list: Action::class)]
24-
public ?array $actions;
27+
/** @var list<Action> $actions */
28+
#[Required(list: Action::class)]
29+
public array $actions;
2530

31+
#[Required]
32+
public float $duration;
33+
34+
#[Required]
35+
public float $timestamp;
36+
37+
#[Required]
38+
public string $url;
39+
40+
/**
41+
* `new Page()` is missing required properties by the API.
42+
*
43+
* To enforce required parameters use
44+
* ```
45+
* Page::with(actions: ..., duration: ..., timestamp: ..., url: ...)
46+
* ```
47+
*
48+
* Otherwise ensure the following setters are called
49+
*
50+
* ```
51+
* (new Page)
52+
* ->withActions(...)
53+
* ->withDuration(...)
54+
* ->withTimestamp(...)
55+
* ->withURL(...)
56+
* ```
57+
*/
2658
public function __construct()
2759
{
2860
$this->initialize();
@@ -33,13 +65,20 @@ public function __construct()
3365
*
3466
* You must use named parameters to construct any parameters with a default value.
3567
*
36-
* @param list<Action|ActionShape>|null $actions
68+
* @param list<Action|ActionShape> $actions
3769
*/
38-
public static function with(?array $actions = null): self
39-
{
70+
public static function with(
71+
array $actions,
72+
float $duration,
73+
float $timestamp,
74+
string $url
75+
): self {
4076
$self = new self;
4177

42-
null !== $actions && $self['actions'] = $actions;
78+
$self['actions'] = $actions;
79+
$self['duration'] = $duration;
80+
$self['timestamp'] = $timestamp;
81+
$self['url'] = $url;
4382

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

5594
return $self;
5695
}
96+
97+
public function withDuration(float $duration): self
98+
{
99+
$self = clone $this;
100+
$self['duration'] = $duration;
101+
102+
return $self;
103+
}
104+
105+
public function withTimestamp(float $timestamp): self
106+
{
107+
$self = clone $this;
108+
$self['timestamp'] = $timestamp;
109+
110+
return $self;
111+
}
112+
113+
public function withURL(string $url): self
114+
{
115+
$self = clone $this;
116+
$self['url'] = $url;
117+
118+
return $self;
119+
}
57120
}

src/Sessions/SessionReplayResponse/Data/Page/Action.php

Lines changed: 92 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Stagehand\Sessions\SessionReplayResponse\Data\Page;
66

77
use Stagehand\Core\Attributes\Optional;
8+
use Stagehand\Core\Attributes\Required;
89
use Stagehand\Core\Concerns\SdkModel;
910
use Stagehand\Core\Contracts\BaseModel;
1011
use Stagehand\Sessions\SessionReplayResponse\Data\Page\Action\TokenUsage;
@@ -13,20 +14,57 @@
1314
* @phpstan-import-type TokenUsageShape from \Stagehand\Sessions\SessionReplayResponse\Data\Page\Action\TokenUsage
1415
*
1516
* @phpstan-type ActionShape = array{
16-
* method?: string|null, tokenUsage?: null|TokenUsage|TokenUsageShape
17+
* method: string,
18+
* parameters: array<string,mixed>,
19+
* result: array<string,mixed>,
20+
* timestamp: float,
21+
* endTime?: float|null,
22+
* tokenUsage?: null|TokenUsage|TokenUsageShape,
1723
* }
1824
*/
1925
final class Action implements BaseModel
2026
{
2127
/** @use SdkModel<ActionShape> */
2228
use SdkModel;
2329

30+
#[Required]
31+
public string $method;
32+
33+
/** @var array<string,mixed> $parameters */
34+
#[Required(map: 'mixed')]
35+
public array $parameters;
36+
37+
/** @var array<string,mixed> $result */
38+
#[Required(map: 'mixed')]
39+
public array $result;
40+
41+
#[Required]
42+
public float $timestamp;
43+
2444
#[Optional]
25-
public ?string $method;
45+
public ?float $endTime;
2646

2747
#[Optional]
2848
public ?TokenUsage $tokenUsage;
2949

50+
/**
51+
* `new Action()` is missing required properties by the API.
52+
*
53+
* To enforce required parameters use
54+
* ```
55+
* Action::with(method: ..., parameters: ..., result: ..., timestamp: ...)
56+
* ```
57+
*
58+
* Otherwise ensure the following setters are called
59+
*
60+
* ```
61+
* (new Action)
62+
* ->withMethod(...)
63+
* ->withParameters(...)
64+
* ->withResult(...)
65+
* ->withTimestamp(...)
66+
* ```
67+
*/
3068
public function __construct()
3169
{
3270
$this->initialize();
@@ -37,15 +75,26 @@ public function __construct()
3775
*
3876
* You must use named parameters to construct any parameters with a default value.
3977
*
78+
* @param array<string,mixed> $parameters
79+
* @param array<string,mixed> $result
4080
* @param TokenUsage|TokenUsageShape|null $tokenUsage
4181
*/
4282
public static function with(
43-
?string $method = null,
44-
TokenUsage|array|null $tokenUsage = null
83+
string $method,
84+
array $parameters,
85+
array $result,
86+
float $timestamp,
87+
?float $endTime = null,
88+
TokenUsage|array|null $tokenUsage = null,
4589
): self {
4690
$self = new self;
4791

48-
null !== $method && $self['method'] = $method;
92+
$self['method'] = $method;
93+
$self['parameters'] = $parameters;
94+
$self['result'] = $result;
95+
$self['timestamp'] = $timestamp;
96+
97+
null !== $endTime && $self['endTime'] = $endTime;
4998
null !== $tokenUsage && $self['tokenUsage'] = $tokenUsage;
5099

51100
return $self;
@@ -59,6 +108,44 @@ public function withMethod(string $method): self
59108
return $self;
60109
}
61110

111+
/**
112+
* @param array<string,mixed> $parameters
113+
*/
114+
public function withParameters(array $parameters): self
115+
{
116+
$self = clone $this;
117+
$self['parameters'] = $parameters;
118+
119+
return $self;
120+
}
121+
122+
/**
123+
* @param array<string,mixed> $result
124+
*/
125+
public function withResult(array $result): self
126+
{
127+
$self = clone $this;
128+
$self['result'] = $result;
129+
130+
return $self;
131+
}
132+
133+
public function withTimestamp(float $timestamp): self
134+
{
135+
$self = clone $this;
136+
$self['timestamp'] = $timestamp;
137+
138+
return $self;
139+
}
140+
141+
public function withEndTime(float $endTime): self
142+
{
143+
$self = clone $this;
144+
$self['endTime'] = $endTime;
145+
146+
return $self;
147+
}
148+
62149
/**
63150
* @param TokenUsage|TokenUsageShape $tokenUsage
64151
*/

0 commit comments

Comments
 (0)