|
14 | 14 | * @phpstan-import-type ModelShape from \Stagehand\Sessions\SessionExtractParams\Options\Model |
15 | 15 | * |
16 | 16 | * @phpstan-type OptionsShape = array{ |
17 | | - * model?: ModelShape|null, selector?: string|null, timeout?: float|null |
| 17 | + * ignoreSelectors?: list<string>|null, |
| 18 | + * model?: ModelShape|null, |
| 19 | + * selector?: string|null, |
| 20 | + * timeout?: float|null, |
18 | 21 | * } |
19 | 22 | */ |
20 | 23 | final class Options implements BaseModel |
21 | 24 | { |
22 | 25 | /** @use SdkModel<OptionsShape> */ |
23 | 26 | use SdkModel; |
24 | 27 |
|
| 28 | + /** |
| 29 | + * Selectors for elements and subtrees that should be excluded from extraction. |
| 30 | + * |
| 31 | + * @var list<string>|null $ignoreSelectors |
| 32 | + */ |
| 33 | + #[Optional(list: 'string')] |
| 34 | + public ?array $ignoreSelectors; |
| 35 | + |
25 | 36 | /** |
26 | 37 | * Model configuration object or model name string (e.g., 'openai/gpt-5-nano'). |
27 | 38 | * |
@@ -52,22 +63,38 @@ public function __construct() |
52 | 63 | * |
53 | 64 | * You must use named parameters to construct any parameters with a default value. |
54 | 65 | * |
| 66 | + * @param list<string>|null $ignoreSelectors |
55 | 67 | * @param ModelShape|null $model |
56 | 68 | */ |
57 | 69 | public static function with( |
| 70 | + ?array $ignoreSelectors = null, |
58 | 71 | string|ModelConfig|array|null $model = null, |
59 | 72 | ?string $selector = null, |
60 | 73 | ?float $timeout = null, |
61 | 74 | ): self { |
62 | 75 | $self = new self; |
63 | 76 |
|
| 77 | + null !== $ignoreSelectors && $self['ignoreSelectors'] = $ignoreSelectors; |
64 | 78 | null !== $model && $self['model'] = $model; |
65 | 79 | null !== $selector && $self['selector'] = $selector; |
66 | 80 | null !== $timeout && $self['timeout'] = $timeout; |
67 | 81 |
|
68 | 82 | return $self; |
69 | 83 | } |
70 | 84 |
|
| 85 | + /** |
| 86 | + * Selectors for elements and subtrees that should be excluded from extraction. |
| 87 | + * |
| 88 | + * @param list<string> $ignoreSelectors |
| 89 | + */ |
| 90 | + public function withIgnoreSelectors(array $ignoreSelectors): self |
| 91 | + { |
| 92 | + $self = clone $this; |
| 93 | + $self['ignoreSelectors'] = $ignoreSelectors; |
| 94 | + |
| 95 | + return $self; |
| 96 | + } |
| 97 | + |
71 | 98 | /** |
72 | 99 | * Model configuration object or model name string (e.g., 'openai/gpt-5-nano'). |
73 | 100 | * |
|
0 commit comments