context.dev 2.17.1 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +0 -4
  5. data/lib/context_dev/models/industry_retrieve_naics_params.rb +28 -1
  6. data/lib/context_dev/models/industry_retrieve_sic_params.rb +28 -1
  7. data/lib/context_dev/models/monitor_retrieve_run_params.rb +26 -0
  8. data/lib/context_dev/models/monitor_retrieve_run_response.rb +232 -0
  9. data/lib/context_dev/models/monitor_rotate_webhook_secret_params.rb +20 -0
  10. data/lib/context_dev/models/monitor_rotate_webhook_secret_response.rb +765 -0
  11. data/lib/context_dev/models/parse_handle_params.rb +8 -6
  12. data/lib/context_dev/models/person_enrich_params.rb +28 -1
  13. data/lib/context_dev/models/web_answers_params.rb +28 -1
  14. data/lib/context_dev/models/web_extract_competitors_params.rb +28 -1
  15. data/lib/context_dev/models/web_extract_styleguide_params.rb +30 -3
  16. data/lib/context_dev/models/{web_web_scrape_sitemap_params.rb → web_map_urls_params.rb} +22 -20
  17. data/lib/context_dev/models/web_map_urls_response.rb +123 -0
  18. data/lib/context_dev/models/web_scrape_params.rb +906 -0
  19. data/lib/context_dev/models/web_scrape_response.rb +659 -0
  20. data/lib/context_dev/models/web_screenshot_params.rb +25 -9
  21. data/lib/context_dev/models/web_screenshot_response.rb +3 -3
  22. data/lib/context_dev/models/web_search_params.rb +30 -3
  23. data/lib/context_dev/models.rb +8 -20
  24. data/lib/context_dev/resources/brand.rb +0 -36
  25. data/lib/context_dev/resources/industry.rb +6 -2
  26. data/lib/context_dev/resources/monitors.rb +47 -0
  27. data/lib/context_dev/resources/people.rb +3 -1
  28. data/lib/context_dev/resources/web.rb +116 -413
  29. data/lib/context_dev/version.rb +1 -1
  30. data/lib/context_dev.rb +8 -21
  31. data/rbi/context_dev/client.rbi +0 -3
  32. data/rbi/context_dev/models/industry_retrieve_naics_params.rbi +59 -0
  33. data/rbi/context_dev/models/industry_retrieve_sic_params.rbi +57 -0
  34. data/rbi/context_dev/models/monitor_retrieve_run_params.rbi +46 -0
  35. data/rbi/context_dev/models/monitor_retrieve_run_response.rbi +452 -0
  36. data/rbi/context_dev/models/monitor_rotate_webhook_secret_params.rbi +38 -0
  37. data/rbi/context_dev/models/monitor_rotate_webhook_secret_response.rbi +1367 -0
  38. data/rbi/context_dev/models/parse_handle_params.rbi +12 -9
  39. data/rbi/context_dev/models/person_enrich_params.rbi +45 -0
  40. data/rbi/context_dev/models/web_answers_params.rbi +45 -0
  41. data/rbi/context_dev/models/web_extract_competitors_params.rbi +59 -0
  42. data/rbi/context_dev/models/web_extract_styleguide_params.rbi +62 -3
  43. data/rbi/context_dev/models/{web_web_scrape_sitemap_params.rbi → web_map_urls_params.rbi} +35 -54
  44. data/rbi/context_dev/models/web_map_urls_response.rbi +226 -0
  45. data/rbi/context_dev/models/web_scrape_params.rbi +2000 -0
  46. data/rbi/context_dev/models/{web_web_scrape_html_response.rbi → web_scrape_response.rbi} +550 -418
  47. data/rbi/context_dev/models/web_screenshot_params.rbi +38 -12
  48. data/rbi/context_dev/models/web_screenshot_response.rbi +4 -4
  49. data/rbi/context_dev/models/web_search_params.rbi +48 -3
  50. data/rbi/context_dev/models.rbi +9 -21
  51. data/rbi/context_dev/resources/brand.rbi +0 -35
  52. data/rbi/context_dev/resources/industry.rbi +14 -0
  53. data/rbi/context_dev/resources/monitors.rbi +24 -0
  54. data/rbi/context_dev/resources/parse.rbi +4 -4
  55. data/rbi/context_dev/resources/people.rbi +7 -0
  56. data/rbi/context_dev/resources/web.rbi +166 -533
  57. data/sig/context_dev/client.rbs +0 -2
  58. data/sig/context_dev/models/industry_retrieve_naics_params.rbs +21 -1
  59. data/sig/context_dev/models/industry_retrieve_sic_params.rbs +21 -1
  60. data/sig/context_dev/models/monitor_retrieve_run_params.rbs +28 -0
  61. data/sig/context_dev/models/monitor_retrieve_run_response.rbs +182 -0
  62. data/sig/context_dev/models/monitor_rotate_webhook_secret_params.rbs +23 -0
  63. data/sig/context_dev/models/monitor_rotate_webhook_secret_response.rbs +545 -0
  64. data/sig/context_dev/models/person_enrich_params.rbs +21 -1
  65. data/sig/context_dev/models/web_answers_params.rbs +21 -1
  66. data/sig/context_dev/models/web_extract_competitors_params.rbs +21 -1
  67. data/sig/context_dev/models/web_extract_styleguide_params.rbs +21 -1
  68. data/sig/context_dev/models/{web_web_scrape_sitemap_params.rbs → web_map_urls_params.rbs} +22 -22
  69. data/sig/context_dev/models/web_map_urls_response.rbs +125 -0
  70. data/sig/context_dev/models/web_scrape_params.rbs +834 -0
  71. data/sig/context_dev/models/web_scrape_response.rbs +552 -0
  72. data/sig/context_dev/models/web_screenshot_params.rbs +7 -0
  73. data/sig/context_dev/models/web_search_params.rbs +21 -1
  74. data/sig/context_dev/models.rbs +8 -20
  75. data/sig/context_dev/resources/brand.rbs +0 -9
  76. data/sig/context_dev/resources/industry.rbs +2 -0
  77. data/sig/context_dev/resources/monitors.rbs +11 -0
  78. data/sig/context_dev/resources/people.rbs +1 -0
  79. data/sig/context_dev/resources/web.rbs +34 -108
  80. metadata +26 -65
  81. data/lib/context_dev/models/ai_extract_product_params.rb +0 -98
  82. data/lib/context_dev/models/ai_extract_product_response.rb +0 -352
  83. data/lib/context_dev/models/ai_extract_products_params.rb +0 -233
  84. data/lib/context_dev/models/ai_extract_products_response.rb +0 -320
  85. data/lib/context_dev/models/brand_retrieve_simplified_params.rb +0 -120
  86. data/lib/context_dev/models/brand_retrieve_simplified_response.rb +0 -441
  87. data/lib/context_dev/models/web_extract_fonts_params.rb +0 -114
  88. data/lib/context_dev/models/web_extract_fonts_response.rb +0 -291
  89. data/lib/context_dev/models/web_extract_params.rb +0 -392
  90. data/lib/context_dev/models/web_extract_response.rb +0 -287
  91. data/lib/context_dev/models/web_web_scrape_bytes_params.rb +0 -344
  92. data/lib/context_dev/models/web_web_scrape_bytes_response.rb +0 -135
  93. data/lib/context_dev/models/web_web_scrape_html_params.rb +0 -633
  94. data/lib/context_dev/models/web_web_scrape_html_response.rb +0 -588
  95. data/lib/context_dev/models/web_web_scrape_images_params.rb +0 -346
  96. data/lib/context_dev/models/web_web_scrape_images_response.rb +0 -409
  97. data/lib/context_dev/models/web_web_scrape_md_params.rb +0 -668
  98. data/lib/context_dev/models/web_web_scrape_md_response.rb +0 -567
  99. data/lib/context_dev/models/web_web_scrape_sitemap_response.rb +0 -144
  100. data/lib/context_dev/resources/ai.rb +0 -69
  101. data/rbi/context_dev/models/ai_extract_product_params.rbi +0 -199
  102. data/rbi/context_dev/models/ai_extract_product_response.rbi +0 -696
  103. data/rbi/context_dev/models/ai_extract_products_params.rbi +0 -490
  104. data/rbi/context_dev/models/ai_extract_products_response.rbi +0 -623
  105. data/rbi/context_dev/models/brand_retrieve_simplified_params.rbi +0 -256
  106. data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +0 -1040
  107. data/rbi/context_dev/models/web_extract_fonts_params.rbi +0 -223
  108. data/rbi/context_dev/models/web_extract_fonts_response.rbi +0 -563
  109. data/rbi/context_dev/models/web_extract_params.rbi +0 -736
  110. data/rbi/context_dev/models/web_extract_response.rbi +0 -512
  111. data/rbi/context_dev/models/web_web_scrape_bytes_params.rbi +0 -699
  112. data/rbi/context_dev/models/web_web_scrape_bytes_response.rbi +0 -238
  113. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +0 -1217
  114. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +0 -671
  115. data/rbi/context_dev/models/web_web_scrape_images_response.rbi +0 -910
  116. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +0 -1049
  117. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +0 -1088
  118. data/rbi/context_dev/models/web_web_scrape_sitemap_response.rbi +0 -258
  119. data/rbi/context_dev/resources/ai.rbi +0 -56
  120. data/sig/context_dev/models/ai_extract_product_params.rbs +0 -86
  121. data/sig/context_dev/models/ai_extract_product_response.rbs +0 -273
  122. data/sig/context_dev/models/ai_extract_products_params.rbs +0 -202
  123. data/sig/context_dev/models/ai_extract_products_response.rbs +0 -252
  124. data/sig/context_dev/models/brand_retrieve_simplified_params.rbs +0 -104
  125. data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +0 -413
  126. data/sig/context_dev/models/web_extract_fonts_params.rbs +0 -93
  127. data/sig/context_dev/models/web_extract_fonts_response.rbs +0 -230
  128. data/sig/context_dev/models/web_extract_params.rbs +0 -304
  129. data/sig/context_dev/models/web_extract_response.rbs +0 -239
  130. data/sig/context_dev/models/web_web_scrape_bytes_params.rbs +0 -531
  131. data/sig/context_dev/models/web_web_scrape_bytes_response.rbs +0 -108
  132. data/sig/context_dev/models/web_web_scrape_html_params.rbs +0 -730
  133. data/sig/context_dev/models/web_web_scrape_html_response.rbs +0 -495
  134. data/sig/context_dev/models/web_web_scrape_images_params.rbs +0 -261
  135. data/sig/context_dev/models/web_web_scrape_images_response.rbs +0 -371
  136. data/sig/context_dev/models/web_web_scrape_md_params.rbs +0 -758
  137. data/sig/context_dev/models/web_web_scrape_md_response.rbs +0 -465
  138. data/sig/context_dev/models/web_web_scrape_sitemap_response.rbs +0 -117
  139. data/sig/context_dev/resources/ai.rbs +0 -20
@@ -0,0 +1,1367 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Models
5
+ class MonitorRotateWebhookSecretResponse < ContextDev::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ ContextDev::Models::MonitorRotateWebhookSecretResponse,
10
+ ContextDev::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :id
16
+
17
+ # Discriminated union describing how changes are detected.
18
+ sig do
19
+ returns(
20
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::ChangeDetection::Variants
21
+ )
22
+ end
23
+ attr_accessor :change_detection
24
+
25
+ sig { returns(Time) }
26
+ attr_accessor :created_at
27
+
28
+ # Top-level monitor category. Always `web` today; the concrete behavior is
29
+ # described by `target` and `change_detection`.
30
+ sig do
31
+ returns(
32
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Mode::TaggedSymbol
33
+ )
34
+ end
35
+ attr_accessor :mode
36
+
37
+ sig { returns(String) }
38
+ attr_accessor :name
39
+
40
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
41
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
42
+ # between 10 minutes and 1 year.
43
+ sig do
44
+ returns(
45
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule
46
+ )
47
+ end
48
+ attr_reader :schedule
49
+
50
+ sig do
51
+ params(
52
+ schedule:
53
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::OrHash
54
+ ).void
55
+ end
56
+ attr_writer :schedule
57
+
58
+ # Monitor lifecycle status. `failed` means the most recent run failed (see the
59
+ # monitor's `last_error`); failed monitors keep running on schedule and flip back
60
+ # to `active` on the next successful run. Monitors are auto-`paused` after
61
+ # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
62
+ # status to `active`.
63
+ sig do
64
+ returns(
65
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Status::TaggedSymbol
66
+ )
67
+ end
68
+ attr_accessor :status
69
+
70
+ # Discriminated union describing what the monitor watches.
71
+ sig do
72
+ returns(
73
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Variants
74
+ )
75
+ end
76
+ attr_accessor :target
77
+
78
+ sig { returns(Time) }
79
+ attr_accessor :updated_at
80
+
81
+ # Current baseline: the last observed value the monitor compares new snapshots
82
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
83
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
84
+ # after a target or change_detection update, which resets the baseline).
85
+ sig do
86
+ returns(
87
+ T.nilable(
88
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::Variants
89
+ )
90
+ )
91
+ end
92
+ attr_accessor :baseline
93
+
94
+ sig { returns(T.nilable(Time)) }
95
+ attr_accessor :last_change_at
96
+
97
+ # Error from the most recent failed run; null when the last run succeeded.
98
+ sig do
99
+ returns(
100
+ T.nilable(
101
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::LastError
102
+ )
103
+ )
104
+ end
105
+ attr_reader :last_error
106
+
107
+ sig do
108
+ params(
109
+ last_error:
110
+ T.nilable(
111
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::LastError::OrHash
112
+ )
113
+ ).void
114
+ end
115
+ attr_writer :last_error
116
+
117
+ sig { returns(T.nilable(Time)) }
118
+ attr_accessor :last_run_at
119
+
120
+ # When the next scheduled run is due.
121
+ sig { returns(T.nilable(Time)) }
122
+ attr_accessor :next_run_at
123
+
124
+ # User-defined tags for grouping and filtering monitors and their changes.
125
+ # Duplicates are removed.
126
+ sig { returns(T.nilable(T::Array[String])) }
127
+ attr_reader :tags
128
+
129
+ sig { params(tags: T::Array[String]).void }
130
+ attr_writer :tags
131
+
132
+ sig do
133
+ returns(
134
+ T.nilable(
135
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook
136
+ )
137
+ )
138
+ end
139
+ attr_reader :webhook
140
+
141
+ sig do
142
+ params(
143
+ webhook:
144
+ T.nilable(
145
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::OrHash
146
+ )
147
+ ).void
148
+ end
149
+ attr_writer :webhook
150
+
151
+ # Present while webhook deliveries are failing consecutively; null when deliveries
152
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
153
+ # and when the webhook URL changes.
154
+ sig do
155
+ returns(
156
+ T.nilable(
157
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure
158
+ )
159
+ )
160
+ end
161
+ attr_reader :webhook_failure
162
+
163
+ sig do
164
+ params(
165
+ webhook_failure:
166
+ T.nilable(
167
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::OrHash
168
+ )
169
+ ).void
170
+ end
171
+ attr_writer :webhook_failure
172
+
173
+ # A web monitor. `mode` is the constant `web`; behavior is described by `target`
174
+ # (page/sitemap/extract) and `change_detection` (exact/semantic).
175
+ sig do
176
+ params(
177
+ id: String,
178
+ change_detection:
179
+ T.any(
180
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::ChangeDetection::Exact::OrHash,
181
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::ChangeDetection::Semantic::OrHash
182
+ ),
183
+ created_at: Time,
184
+ mode:
185
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Mode::OrSymbol,
186
+ name: String,
187
+ schedule:
188
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::OrHash,
189
+ status:
190
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Status::OrSymbol,
191
+ target:
192
+ T.any(
193
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Page::OrHash,
194
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Sitemap::OrHash,
195
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Extract::OrHash
196
+ ),
197
+ updated_at: Time,
198
+ baseline:
199
+ T.nilable(
200
+ T.any(
201
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::MonitorsPageBaseline::OrHash,
202
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::MonitorsSitemapBaseline::OrHash,
203
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::MonitorsExtractBaseline::OrHash
204
+ )
205
+ ),
206
+ last_change_at: T.nilable(Time),
207
+ last_error:
208
+ T.nilable(
209
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::LastError::OrHash
210
+ ),
211
+ last_run_at: T.nilable(Time),
212
+ next_run_at: T.nilable(Time),
213
+ tags: T::Array[String],
214
+ webhook:
215
+ T.nilable(
216
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::OrHash
217
+ ),
218
+ webhook_failure:
219
+ T.nilable(
220
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::OrHash
221
+ )
222
+ ).returns(T.attached_class)
223
+ end
224
+ def self.new(
225
+ id:,
226
+ # Discriminated union describing how changes are detected.
227
+ change_detection:,
228
+ created_at:,
229
+ # Top-level monitor category. Always `web` today; the concrete behavior is
230
+ # described by `target` and `change_detection`.
231
+ mode:,
232
+ name:,
233
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
234
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
235
+ # between 10 minutes and 1 year.
236
+ schedule:,
237
+ # Monitor lifecycle status. `failed` means the most recent run failed (see the
238
+ # monitor's `last_error`); failed monitors keep running on schedule and flip back
239
+ # to `active` on the next successful run. Monitors are auto-`paused` after
240
+ # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
241
+ # status to `active`.
242
+ status:,
243
+ # Discriminated union describing what the monitor watches.
244
+ target:,
245
+ updated_at:,
246
+ # Current baseline: the last observed value the monitor compares new snapshots
247
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
248
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
249
+ # after a target or change_detection update, which resets the baseline).
250
+ baseline: nil,
251
+ last_change_at: nil,
252
+ # Error from the most recent failed run; null when the last run succeeded.
253
+ last_error: nil,
254
+ last_run_at: nil,
255
+ # When the next scheduled run is due.
256
+ next_run_at: nil,
257
+ # User-defined tags for grouping and filtering monitors and their changes.
258
+ # Duplicates are removed.
259
+ tags: nil,
260
+ webhook: nil,
261
+ # Present while webhook deliveries are failing consecutively; null when deliveries
262
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
263
+ # and when the webhook URL changes.
264
+ webhook_failure: nil
265
+ )
266
+ end
267
+
268
+ sig do
269
+ override.returns(
270
+ {
271
+ id: String,
272
+ change_detection:
273
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::ChangeDetection::Variants,
274
+ created_at: Time,
275
+ mode:
276
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Mode::TaggedSymbol,
277
+ name: String,
278
+ schedule:
279
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule,
280
+ status:
281
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Status::TaggedSymbol,
282
+ target:
283
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Variants,
284
+ updated_at: Time,
285
+ baseline:
286
+ T.nilable(
287
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::Variants
288
+ ),
289
+ last_change_at: T.nilable(Time),
290
+ last_error:
291
+ T.nilable(
292
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::LastError
293
+ ),
294
+ last_run_at: T.nilable(Time),
295
+ next_run_at: T.nilable(Time),
296
+ tags: T::Array[String],
297
+ webhook:
298
+ T.nilable(
299
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook
300
+ ),
301
+ webhook_failure:
302
+ T.nilable(
303
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure
304
+ )
305
+ }
306
+ )
307
+ end
308
+ def to_hash
309
+ end
310
+
311
+ # Discriminated union describing how changes are detected.
312
+ module ChangeDetection
313
+ extend ContextDev::Internal::Type::Union
314
+
315
+ Variants =
316
+ T.type_alias do
317
+ T.any(
318
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::ChangeDetection::Exact,
319
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::ChangeDetection::Semantic
320
+ )
321
+ end
322
+
323
+ class Exact < ContextDev::Internal::Type::BaseModel
324
+ OrHash =
325
+ T.type_alias do
326
+ T.any(
327
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::ChangeDetection::Exact,
328
+ ContextDev::Internal::AnyHash
329
+ )
330
+ end
331
+
332
+ sig { returns(Symbol) }
333
+ attr_accessor :type
334
+
335
+ # Detect exact changes. For page targets, this means visible text diffs. For
336
+ # sitemap targets, this means URL additions and removals.
337
+ sig { params(type: Symbol).returns(T.attached_class) }
338
+ def self.new(type: :exact)
339
+ end
340
+
341
+ sig { override.returns({ type: Symbol }) }
342
+ def to_hash
343
+ end
344
+ end
345
+
346
+ class Semantic < ContextDev::Internal::Type::BaseModel
347
+ OrHash =
348
+ T.type_alias do
349
+ T.any(
350
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::ChangeDetection::Semantic,
351
+ ContextDev::Internal::AnyHash
352
+ )
353
+ end
354
+
355
+ sig { returns(Symbol) }
356
+ attr_accessor :type
357
+
358
+ sig { returns(T.nilable(Float)) }
359
+ attr_reader :confidence_threshold
360
+
361
+ sig { params(confidence_threshold: Float).void }
362
+ attr_writer :confidence_threshold
363
+
364
+ # Detect meaning-level changes to page content, ignoring cosmetic or
365
+ # instruction-irrelevant differences. Which changes are meaningful is judged
366
+ # against the page or extract target's `instructions` (and an extract target's
367
+ # `schema`, when provided).
368
+ sig do
369
+ params(confidence_threshold: Float, type: Symbol).returns(
370
+ T.attached_class
371
+ )
372
+ end
373
+ def self.new(confidence_threshold: nil, type: :semantic)
374
+ end
375
+
376
+ sig do
377
+ override.returns({ type: Symbol, confidence_threshold: Float })
378
+ end
379
+ def to_hash
380
+ end
381
+ end
382
+
383
+ sig do
384
+ override.returns(
385
+ T::Array[
386
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::ChangeDetection::Variants
387
+ ]
388
+ )
389
+ end
390
+ def self.variants
391
+ end
392
+ end
393
+
394
+ # Top-level monitor category. Always `web` today; the concrete behavior is
395
+ # described by `target` and `change_detection`.
396
+ module Mode
397
+ extend ContextDev::Internal::Type::Enum
398
+
399
+ TaggedSymbol =
400
+ T.type_alias do
401
+ T.all(
402
+ Symbol,
403
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Mode
404
+ )
405
+ end
406
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
407
+
408
+ WEB =
409
+ T.let(
410
+ :web,
411
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Mode::TaggedSymbol
412
+ )
413
+
414
+ sig do
415
+ override.returns(
416
+ T::Array[
417
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Mode::TaggedSymbol
418
+ ]
419
+ )
420
+ end
421
+ def self.values
422
+ end
423
+ end
424
+
425
+ class Schedule < ContextDev::Internal::Type::BaseModel
426
+ OrHash =
427
+ T.type_alias do
428
+ T.any(
429
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule,
430
+ ContextDev::Internal::AnyHash
431
+ )
432
+ end
433
+
434
+ # Number of units between runs. The resulting interval (frequency × unit) must be
435
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
436
+ # maximum 365 when unit is days).
437
+ sig { returns(Integer) }
438
+ attr_accessor :frequency
439
+
440
+ sig do
441
+ returns(
442
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Type::TaggedSymbol
443
+ )
444
+ end
445
+ attr_accessor :type
446
+
447
+ sig do
448
+ returns(
449
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Unit::TaggedSymbol
450
+ )
451
+ end
452
+ attr_accessor :unit
453
+
454
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
455
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
456
+ # between 10 minutes and 1 year.
457
+ sig do
458
+ params(
459
+ frequency: Integer,
460
+ type:
461
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Type::OrSymbol,
462
+ unit:
463
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Unit::OrSymbol
464
+ ).returns(T.attached_class)
465
+ end
466
+ def self.new(
467
+ # Number of units between runs. The resulting interval (frequency × unit) must be
468
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
469
+ # maximum 365 when unit is days).
470
+ frequency:,
471
+ type:,
472
+ unit:
473
+ )
474
+ end
475
+
476
+ sig do
477
+ override.returns(
478
+ {
479
+ frequency: Integer,
480
+ type:
481
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Type::TaggedSymbol,
482
+ unit:
483
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Unit::TaggedSymbol
484
+ }
485
+ )
486
+ end
487
+ def to_hash
488
+ end
489
+
490
+ module Type
491
+ extend ContextDev::Internal::Type::Enum
492
+
493
+ TaggedSymbol =
494
+ T.type_alias do
495
+ T.all(
496
+ Symbol,
497
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Type
498
+ )
499
+ end
500
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
501
+
502
+ INTERVAL =
503
+ T.let(
504
+ :interval,
505
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Type::TaggedSymbol
506
+ )
507
+
508
+ sig do
509
+ override.returns(
510
+ T::Array[
511
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Type::TaggedSymbol
512
+ ]
513
+ )
514
+ end
515
+ def self.values
516
+ end
517
+ end
518
+
519
+ module Unit
520
+ extend ContextDev::Internal::Type::Enum
521
+
522
+ TaggedSymbol =
523
+ T.type_alias do
524
+ T.all(
525
+ Symbol,
526
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Unit
527
+ )
528
+ end
529
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
530
+
531
+ MINUTES =
532
+ T.let(
533
+ :minutes,
534
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Unit::TaggedSymbol
535
+ )
536
+ HOURS =
537
+ T.let(
538
+ :hours,
539
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Unit::TaggedSymbol
540
+ )
541
+ DAYS =
542
+ T.let(
543
+ :days,
544
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Unit::TaggedSymbol
545
+ )
546
+
547
+ sig do
548
+ override.returns(
549
+ T::Array[
550
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Schedule::Unit::TaggedSymbol
551
+ ]
552
+ )
553
+ end
554
+ def self.values
555
+ end
556
+ end
557
+ end
558
+
559
+ # Monitor lifecycle status. `failed` means the most recent run failed (see the
560
+ # monitor's `last_error`); failed monitors keep running on schedule and flip back
561
+ # to `active` on the next successful run. Monitors are auto-`paused` after
562
+ # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
563
+ # status to `active`.
564
+ module Status
565
+ extend ContextDev::Internal::Type::Enum
566
+
567
+ TaggedSymbol =
568
+ T.type_alias do
569
+ T.all(
570
+ Symbol,
571
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Status
572
+ )
573
+ end
574
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
575
+
576
+ ACTIVE =
577
+ T.let(
578
+ :active,
579
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Status::TaggedSymbol
580
+ )
581
+ PAUSED =
582
+ T.let(
583
+ :paused,
584
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Status::TaggedSymbol
585
+ )
586
+ FAILED =
587
+ T.let(
588
+ :failed,
589
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Status::TaggedSymbol
590
+ )
591
+
592
+ sig do
593
+ override.returns(
594
+ T::Array[
595
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Status::TaggedSymbol
596
+ ]
597
+ )
598
+ end
599
+ def self.values
600
+ end
601
+ end
602
+
603
+ # Discriminated union describing what the monitor watches.
604
+ module Target
605
+ extend ContextDev::Internal::Type::Union
606
+
607
+ Variants =
608
+ T.type_alias do
609
+ T.any(
610
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Page,
611
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Sitemap,
612
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Extract
613
+ )
614
+ end
615
+
616
+ class Page < ContextDev::Internal::Type::BaseModel
617
+ OrHash =
618
+ T.type_alias do
619
+ T.any(
620
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Page,
621
+ ContextDev::Internal::AnyHash
622
+ )
623
+ end
624
+
625
+ sig { returns(Symbol) }
626
+ attr_accessor :type
627
+
628
+ sig { returns(String) }
629
+ attr_accessor :url
630
+
631
+ # CSS selectors for HTML regions to remove before text extraction. Applied after
632
+ # include_selectors; exclusion takes precedence when an element matches both. Omit
633
+ # or pass an empty array to apply no explicit exclusions. Changing these selectors
634
+ # creates a new baseline.
635
+ sig { returns(T.nilable(T::Array[String])) }
636
+ attr_reader :exclude_selectors
637
+
638
+ sig { params(exclude_selectors: T::Array[String]).void }
639
+ attr_writer :exclude_selectors
640
+
641
+ # CSS selectors defining the HTML regions to monitor. Matching subtrees are
642
+ # combined in document order before text extraction, instead of automatic
643
+ # main-content selection. Omit or pass an empty array to use automatic
644
+ # main-content extraction. If the filtered page has no usable text, the run fails
645
+ # without replacing the baseline. Changing these selectors creates a new baseline.
646
+ sig { returns(T.nilable(T::Array[String])) }
647
+ attr_reader :include_selectors
648
+
649
+ sig { params(include_selectors: T::Array[String]).void }
650
+ attr_writer :include_selectors
651
+
652
+ # Plain-language goal describing which page changes matter. When provided without
653
+ # change_detection, semantic detection is inferred.
654
+ sig { returns(T.nilable(String)) }
655
+ attr_reader :instructions
656
+
657
+ sig { params(instructions: String).void }
658
+ attr_writer :instructions
659
+
660
+ # Normalize whitespace before comparing or analyzing text.
661
+ sig { returns(T.nilable(T::Boolean)) }
662
+ attr_reader :normalize_whitespace
663
+
664
+ sig { params(normalize_whitespace: T::Boolean).void }
665
+ attr_writer :normalize_whitespace
666
+
667
+ # Watch a single web page. Exact detection reports visible-text diffs; semantic
668
+ # detection judges confirmed stable diffs against `instructions`.
669
+ sig do
670
+ params(
671
+ url: String,
672
+ exclude_selectors: T::Array[String],
673
+ include_selectors: T::Array[String],
674
+ instructions: String,
675
+ normalize_whitespace: T::Boolean,
676
+ type: Symbol
677
+ ).returns(T.attached_class)
678
+ end
679
+ def self.new(
680
+ url:,
681
+ # CSS selectors for HTML regions to remove before text extraction. Applied after
682
+ # include_selectors; exclusion takes precedence when an element matches both. Omit
683
+ # or pass an empty array to apply no explicit exclusions. Changing these selectors
684
+ # creates a new baseline.
685
+ exclude_selectors: nil,
686
+ # CSS selectors defining the HTML regions to monitor. Matching subtrees are
687
+ # combined in document order before text extraction, instead of automatic
688
+ # main-content selection. Omit or pass an empty array to use automatic
689
+ # main-content extraction. If the filtered page has no usable text, the run fails
690
+ # without replacing the baseline. Changing these selectors creates a new baseline.
691
+ include_selectors: nil,
692
+ # Plain-language goal describing which page changes matter. When provided without
693
+ # change_detection, semantic detection is inferred.
694
+ instructions: nil,
695
+ # Normalize whitespace before comparing or analyzing text.
696
+ normalize_whitespace: nil,
697
+ type: :page
698
+ )
699
+ end
700
+
701
+ sig do
702
+ override.returns(
703
+ {
704
+ type: Symbol,
705
+ url: String,
706
+ exclude_selectors: T::Array[String],
707
+ include_selectors: T::Array[String],
708
+ instructions: String,
709
+ normalize_whitespace: T::Boolean
710
+ }
711
+ )
712
+ end
713
+ def to_hash
714
+ end
715
+ end
716
+
717
+ class Sitemap < ContextDev::Internal::Type::BaseModel
718
+ OrHash =
719
+ T.type_alias do
720
+ T.any(
721
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Sitemap,
722
+ ContextDev::Internal::AnyHash
723
+ )
724
+ end
725
+
726
+ sig { returns(Symbol) }
727
+ attr_accessor :type
728
+
729
+ # Sitemap URL to monitor.
730
+ sig { returns(String) }
731
+ attr_accessor :url
732
+
733
+ # URL path patterns to exclude (max 50).
734
+ sig { returns(T.nilable(T::Array[String])) }
735
+ attr_reader :exclude
736
+
737
+ sig { params(exclude: T::Array[String]).void }
738
+ attr_writer :exclude
739
+
740
+ # URL path patterns to include (max 50).
741
+ sig { returns(T.nilable(T::Array[String])) }
742
+ attr_reader :include
743
+
744
+ sig { params(include: T::Array[String]).void }
745
+ attr_writer :include
746
+
747
+ # Maximum number of sitemap URLs to track (capped at 10,000).
748
+ sig { returns(T.nilable(Integer)) }
749
+ attr_reader :max_urls
750
+
751
+ sig { params(max_urls: Integer).void }
752
+ attr_writer :max_urls
753
+
754
+ # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
755
+ # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
756
+ # and its subdomains before comparison. On a detected difference the sitemap is
757
+ # re-fetched within the same run and only URLs both observations agree on are
758
+ # reported, suppressing transient crawl flaps.
759
+ sig do
760
+ params(
761
+ url: String,
762
+ exclude: T::Array[String],
763
+ include: T::Array[String],
764
+ max_urls: Integer,
765
+ type: Symbol
766
+ ).returns(T.attached_class)
767
+ end
768
+ def self.new(
769
+ # Sitemap URL to monitor.
770
+ url:,
771
+ # URL path patterns to exclude (max 50).
772
+ exclude: nil,
773
+ # URL path patterns to include (max 50).
774
+ include: nil,
775
+ # Maximum number of sitemap URLs to track (capped at 10,000).
776
+ max_urls: nil,
777
+ type: :sitemap
778
+ )
779
+ end
780
+
781
+ sig do
782
+ override.returns(
783
+ {
784
+ type: Symbol,
785
+ url: String,
786
+ exclude: T::Array[String],
787
+ include: T::Array[String],
788
+ max_urls: Integer
789
+ }
790
+ )
791
+ end
792
+ def to_hash
793
+ end
794
+ end
795
+
796
+ class Extract < ContextDev::Internal::Type::BaseModel
797
+ OrHash =
798
+ T.type_alias do
799
+ T.any(
800
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Extract,
801
+ ContextDev::Internal::AnyHash
802
+ )
803
+ end
804
+
805
+ # Natural-language instructions guiding which pages and facts to track and which
806
+ # changes to report.
807
+ sig { returns(String) }
808
+ attr_accessor :instructions
809
+
810
+ sig { returns(Symbol) }
811
+ attr_accessor :type
812
+
813
+ # Root URL to extract structured data from.
814
+ sig { returns(String) }
815
+ attr_accessor :url
816
+
817
+ sig { returns(T.nilable(T::Boolean)) }
818
+ attr_reader :follow_subdomains
819
+
820
+ sig { params(follow_subdomains: T::Boolean).void }
821
+ attr_writer :follow_subdomains
822
+
823
+ # Optional maximum link depth from the starting URL (0 = only the starting page).
824
+ sig { returns(T.nilable(Integer)) }
825
+ attr_reader :max_depth
826
+
827
+ sig { params(max_depth: Integer).void }
828
+ attr_writer :max_depth
829
+
830
+ # Maximum number of pages to track.
831
+ sig { returns(T.nilable(Integer)) }
832
+ attr_reader :max_pages
833
+
834
+ sig { params(max_pages: Integer).void }
835
+ attr_writer :max_pages
836
+
837
+ # JSON Schema describing the data you care about. It is used three ways: it guides
838
+ # which pages are selected for tracking, it gives the change judge extra context
839
+ # on which changes matter (alongside `instructions`), and it defines the shape of
840
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
841
+ # about once a day). It is not a response format for changes: change events and
842
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
843
+ # data in this schema's shape. If omitted, a default summary + key-points schema
844
+ # is used.
845
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
846
+ attr_reader :schema
847
+
848
+ sig { params(schema: T::Hash[Symbol, T.anything]).void }
849
+ attr_writer :schema
850
+
851
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
852
+ # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
853
+ # track; each run re-checks exactly those pages, and confirmed content changes are
854
+ # judged for relevance against the monitor's `instructions` (and `schema`, when
855
+ # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
856
+ sig do
857
+ params(
858
+ instructions: String,
859
+ url: String,
860
+ follow_subdomains: T::Boolean,
861
+ max_depth: Integer,
862
+ max_pages: Integer,
863
+ schema: T::Hash[Symbol, T.anything],
864
+ type: Symbol
865
+ ).returns(T.attached_class)
866
+ end
867
+ def self.new(
868
+ # Natural-language instructions guiding which pages and facts to track and which
869
+ # changes to report.
870
+ instructions:,
871
+ # Root URL to extract structured data from.
872
+ url:,
873
+ follow_subdomains: nil,
874
+ # Optional maximum link depth from the starting URL (0 = only the starting page).
875
+ max_depth: nil,
876
+ # Maximum number of pages to track.
877
+ max_pages: nil,
878
+ # JSON Schema describing the data you care about. It is used three ways: it guides
879
+ # which pages are selected for tracking, it gives the change judge extra context
880
+ # on which changes matter (alongside `instructions`), and it defines the shape of
881
+ # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
882
+ # about once a day). It is not a response format for changes: change events and
883
+ # webhook payloads always contain diffs, summaries, and evidence excerpts — never
884
+ # data in this schema's shape. If omitted, a default summary + key-points schema
885
+ # is used.
886
+ schema: nil,
887
+ type: :extract
888
+ )
889
+ end
890
+
891
+ sig do
892
+ override.returns(
893
+ {
894
+ instructions: String,
895
+ type: Symbol,
896
+ url: String,
897
+ follow_subdomains: T::Boolean,
898
+ max_depth: Integer,
899
+ max_pages: Integer,
900
+ schema: T::Hash[Symbol, T.anything]
901
+ }
902
+ )
903
+ end
904
+ def to_hash
905
+ end
906
+ end
907
+
908
+ sig do
909
+ override.returns(
910
+ T::Array[
911
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Target::Variants
912
+ ]
913
+ )
914
+ end
915
+ def self.variants
916
+ end
917
+ end
918
+
919
+ # Current baseline: the last observed value the monitor compares new snapshots
920
+ # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
921
+ # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
922
+ # after a target or change_detection update, which resets the baseline).
923
+ module Baseline
924
+ extend ContextDev::Internal::Type::Union
925
+
926
+ Variants =
927
+ T.type_alias do
928
+ T.any(
929
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::MonitorsPageBaseline,
930
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::MonitorsSitemapBaseline,
931
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::MonitorsExtractBaseline
932
+ )
933
+ end
934
+
935
+ class MonitorsPageBaseline < ContextDev::Internal::Type::BaseModel
936
+ OrHash =
937
+ T.type_alias do
938
+ T.any(
939
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::MonitorsPageBaseline,
940
+ ContextDev::Internal::AnyHash
941
+ )
942
+ end
943
+
944
+ # When this baseline was last captured or replaced.
945
+ sig { returns(Time) }
946
+ attr_accessor :captured_at
947
+
948
+ # The page's visible text as last observed.
949
+ sig { returns(String) }
950
+ attr_accessor :text
951
+
952
+ # Current baseline of a `page` monitor: the visible page text as last observed.
953
+ sig do
954
+ params(captured_at: Time, text: String).returns(T.attached_class)
955
+ end
956
+ def self.new(
957
+ # When this baseline was last captured or replaced.
958
+ captured_at:,
959
+ # The page's visible text as last observed.
960
+ text:
961
+ )
962
+ end
963
+
964
+ sig { override.returns({ captured_at: Time, text: String }) }
965
+ def to_hash
966
+ end
967
+ end
968
+
969
+ class MonitorsSitemapBaseline < ContextDev::Internal::Type::BaseModel
970
+ OrHash =
971
+ T.type_alias do
972
+ T.any(
973
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::MonitorsSitemapBaseline,
974
+ ContextDev::Internal::AnyHash
975
+ )
976
+ end
977
+
978
+ # When this baseline was last captured or replaced.
979
+ sig { returns(Time) }
980
+ attr_accessor :captured_at
981
+
982
+ # Number of URLs in the baseline.
983
+ sig { returns(Integer) }
984
+ attr_accessor :url_count
985
+
986
+ # The sitemap URLs as last observed (sorted, normalized).
987
+ sig { returns(T::Array[String]) }
988
+ attr_accessor :urls
989
+
990
+ # Current baseline of a `sitemap` monitor: the normalized URL set as last
991
+ # observed.
992
+ sig do
993
+ params(
994
+ captured_at: Time,
995
+ url_count: Integer,
996
+ urls: T::Array[String]
997
+ ).returns(T.attached_class)
998
+ end
999
+ def self.new(
1000
+ # When this baseline was last captured or replaced.
1001
+ captured_at:,
1002
+ # Number of URLs in the baseline.
1003
+ url_count:,
1004
+ # The sitemap URLs as last observed (sorted, normalized).
1005
+ urls:
1006
+ )
1007
+ end
1008
+
1009
+ sig do
1010
+ override.returns(
1011
+ { captured_at: Time, url_count: Integer, urls: T::Array[String] }
1012
+ )
1013
+ end
1014
+ def to_hash
1015
+ end
1016
+ end
1017
+
1018
+ class MonitorsExtractBaseline < ContextDev::Internal::Type::BaseModel
1019
+ OrHash =
1020
+ T.type_alias do
1021
+ T.any(
1022
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::MonitorsExtractBaseline,
1023
+ ContextDev::Internal::AnyHash
1024
+ )
1025
+ end
1026
+
1027
+ # When this baseline was last captured or replaced.
1028
+ sig { returns(Time) }
1029
+ attr_accessor :captured_at
1030
+
1031
+ # The extracted structured data, matching the monitor's extraction schema (same
1032
+ # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
1033
+ # re-discovers its page set (at most about once a day); `null` when no extraction
1034
+ # has been captured yet.
1035
+ sig { returns(T.anything) }
1036
+ attr_accessor :data
1037
+
1038
+ # The page URLs the monitor tracks and analyzes for changes.
1039
+ sig { returns(T::Array[String]) }
1040
+ attr_accessor :urls_analyzed
1041
+
1042
+ # Current baseline of an `extract` monitor: the pages it tracks and the structured
1043
+ # data as last extracted.
1044
+ sig do
1045
+ params(
1046
+ captured_at: Time,
1047
+ data: T.anything,
1048
+ urls_analyzed: T::Array[String]
1049
+ ).returns(T.attached_class)
1050
+ end
1051
+ def self.new(
1052
+ # When this baseline was last captured or replaced.
1053
+ captured_at:,
1054
+ # The extracted structured data, matching the monitor's extraction schema (same
1055
+ # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
1056
+ # re-discovers its page set (at most about once a day); `null` when no extraction
1057
+ # has been captured yet.
1058
+ data:,
1059
+ # The page URLs the monitor tracks and analyzes for changes.
1060
+ urls_analyzed:
1061
+ )
1062
+ end
1063
+
1064
+ sig do
1065
+ override.returns(
1066
+ {
1067
+ captured_at: Time,
1068
+ data: T.anything,
1069
+ urls_analyzed: T::Array[String]
1070
+ }
1071
+ )
1072
+ end
1073
+ def to_hash
1074
+ end
1075
+ end
1076
+
1077
+ sig do
1078
+ override.returns(
1079
+ T::Array[
1080
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Baseline::Variants
1081
+ ]
1082
+ )
1083
+ end
1084
+ def self.variants
1085
+ end
1086
+ end
1087
+
1088
+ class LastError < ContextDev::Internal::Type::BaseModel
1089
+ OrHash =
1090
+ T.type_alias do
1091
+ T.any(
1092
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::LastError,
1093
+ ContextDev::Internal::AnyHash
1094
+ )
1095
+ end
1096
+
1097
+ sig { returns(String) }
1098
+ attr_accessor :code
1099
+
1100
+ sig { returns(String) }
1101
+ attr_accessor :message
1102
+
1103
+ # Error from the most recent failed run; null when the last run succeeded.
1104
+ sig { params(code: String, message: String).returns(T.attached_class) }
1105
+ def self.new(code:, message:)
1106
+ end
1107
+
1108
+ sig { override.returns({ code: String, message: String }) }
1109
+ def to_hash
1110
+ end
1111
+ end
1112
+
1113
+ class Webhook < ContextDev::Internal::Type::BaseModel
1114
+ OrHash =
1115
+ T.type_alias do
1116
+ T.any(
1117
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook,
1118
+ ContextDev::Internal::AnyHash
1119
+ )
1120
+ end
1121
+
1122
+ # Webhook URL events are delivered to. Slack incoming webhook URLs are
1123
+ # automatically formatted as Slack messages.
1124
+ sig { returns(String) }
1125
+ attr_accessor :url
1126
+
1127
+ # Events delivered to this endpoint. `change.detected` fires only when a run
1128
+ # detects a change; `run.completed` fires on every completed run — including runs
1129
+ # that detected no change — and embeds the change when one was detected. Defaults
1130
+ # to `["change.detected"]` when omitted.
1131
+ sig do
1132
+ returns(
1133
+ T.nilable(
1134
+ T::Array[
1135
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::Event::TaggedSymbol
1136
+ ]
1137
+ )
1138
+ )
1139
+ end
1140
+ attr_reader :events
1141
+
1142
+ sig do
1143
+ params(
1144
+ events:
1145
+ T::Array[
1146
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::Event::OrSymbol
1147
+ ]
1148
+ ).void
1149
+ end
1150
+ attr_writer :events
1151
+
1152
+ # Webhook retry settings. Use {} for the default schedule.
1153
+ sig { returns(T.nilable(ContextDev::RetryConfig)) }
1154
+ attr_reader :retry_
1155
+
1156
+ sig { params(retry_: ContextDev::RetryConfig::OrHash).void }
1157
+ attr_writer :retry_
1158
+
1159
+ # Signing secret used to verify webhook authenticity. Omitted unless the API key
1160
+ # has monitors:write permission or full access. Each delivery includes an
1161
+ # `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
1162
+ # `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
1163
+ # compare and reject stale timestamps to prevent replay. Generated by the API;
1164
+ # cannot be set by clients.
1165
+ sig { returns(T.nilable(String)) }
1166
+ attr_reader :secret
1167
+
1168
+ sig { params(secret: String).void }
1169
+ attr_writer :secret
1170
+
1171
+ sig do
1172
+ params(
1173
+ url: String,
1174
+ events:
1175
+ T::Array[
1176
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::Event::OrSymbol
1177
+ ],
1178
+ retry_: ContextDev::RetryConfig::OrHash,
1179
+ secret: String
1180
+ ).returns(T.attached_class)
1181
+ end
1182
+ def self.new(
1183
+ # Webhook URL events are delivered to. Slack incoming webhook URLs are
1184
+ # automatically formatted as Slack messages.
1185
+ url:,
1186
+ # Events delivered to this endpoint. `change.detected` fires only when a run
1187
+ # detects a change; `run.completed` fires on every completed run — including runs
1188
+ # that detected no change — and embeds the change when one was detected. Defaults
1189
+ # to `["change.detected"]` when omitted.
1190
+ events: nil,
1191
+ # Webhook retry settings. Use {} for the default schedule.
1192
+ retry_: nil,
1193
+ # Signing secret used to verify webhook authenticity. Omitted unless the API key
1194
+ # has monitors:write permission or full access. Each delivery includes an
1195
+ # `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
1196
+ # `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
1197
+ # compare and reject stale timestamps to prevent replay. Generated by the API;
1198
+ # cannot be set by clients.
1199
+ secret: nil
1200
+ )
1201
+ end
1202
+
1203
+ sig do
1204
+ override.returns(
1205
+ {
1206
+ url: String,
1207
+ events:
1208
+ T::Array[
1209
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::Event::TaggedSymbol
1210
+ ],
1211
+ retry_: ContextDev::RetryConfig,
1212
+ secret: String
1213
+ }
1214
+ )
1215
+ end
1216
+ def to_hash
1217
+ end
1218
+
1219
+ module Event
1220
+ extend ContextDev::Internal::Type::Enum
1221
+
1222
+ TaggedSymbol =
1223
+ T.type_alias do
1224
+ T.all(
1225
+ Symbol,
1226
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::Event
1227
+ )
1228
+ end
1229
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1230
+
1231
+ CHANGE_DETECTED =
1232
+ T.let(
1233
+ :"change.detected",
1234
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::Event::TaggedSymbol
1235
+ )
1236
+ RUN_COMPLETED =
1237
+ T.let(
1238
+ :"run.completed",
1239
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::Event::TaggedSymbol
1240
+ )
1241
+
1242
+ sig do
1243
+ override.returns(
1244
+ T::Array[
1245
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::Webhook::Event::TaggedSymbol
1246
+ ]
1247
+ )
1248
+ end
1249
+ def self.values
1250
+ end
1251
+ end
1252
+ end
1253
+
1254
+ class WebhookFailure < ContextDev::Internal::Type::BaseModel
1255
+ OrHash =
1256
+ T.type_alias do
1257
+ T.any(
1258
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure,
1259
+ ContextDev::Internal::AnyHash
1260
+ )
1261
+ end
1262
+
1263
+ # Number of consecutive delivery attempts that did not succeed.
1264
+ sig { returns(Integer) }
1265
+ attr_accessor :consecutive_failures
1266
+
1267
+ sig { returns(Time) }
1268
+ attr_accessor :last_failed_at
1269
+
1270
+ # Human-readable description of the most recent failure.
1271
+ sig { returns(String) }
1272
+ attr_accessor :last_message
1273
+
1274
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
1275
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
1276
+ # failed the public-endpoint safety check.
1277
+ sig do
1278
+ returns(
1279
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::LastStatus::TaggedSymbol
1280
+ )
1281
+ end
1282
+ attr_accessor :last_status
1283
+
1284
+ # Present while webhook deliveries are failing consecutively; null when deliveries
1285
+ # are healthy or no webhook is configured. Cleared on the next successful delivery
1286
+ # and when the webhook URL changes.
1287
+ sig do
1288
+ params(
1289
+ consecutive_failures: Integer,
1290
+ last_failed_at: Time,
1291
+ last_message: String,
1292
+ last_status:
1293
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::LastStatus::OrSymbol
1294
+ ).returns(T.attached_class)
1295
+ end
1296
+ def self.new(
1297
+ # Number of consecutive delivery attempts that did not succeed.
1298
+ consecutive_failures:,
1299
+ last_failed_at:,
1300
+ # Human-readable description of the most recent failure.
1301
+ last_message:,
1302
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
1303
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
1304
+ # failed the public-endpoint safety check.
1305
+ last_status:
1306
+ )
1307
+ end
1308
+
1309
+ sig do
1310
+ override.returns(
1311
+ {
1312
+ consecutive_failures: Integer,
1313
+ last_failed_at: Time,
1314
+ last_message: String,
1315
+ last_status:
1316
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::LastStatus::TaggedSymbol
1317
+ }
1318
+ )
1319
+ end
1320
+ def to_hash
1321
+ end
1322
+
1323
+ # Outcome of the most recent failed delivery. rejected means a non-2xx response;
1324
+ # failed means no HTTP response was received; skipped_unsafe_url means the URL
1325
+ # failed the public-endpoint safety check.
1326
+ module LastStatus
1327
+ extend ContextDev::Internal::Type::Enum
1328
+
1329
+ TaggedSymbol =
1330
+ T.type_alias do
1331
+ T.all(
1332
+ Symbol,
1333
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::LastStatus
1334
+ )
1335
+ end
1336
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1337
+
1338
+ REJECTED =
1339
+ T.let(
1340
+ :rejected,
1341
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::LastStatus::TaggedSymbol
1342
+ )
1343
+ FAILED =
1344
+ T.let(
1345
+ :failed,
1346
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::LastStatus::TaggedSymbol
1347
+ )
1348
+ SKIPPED_UNSAFE_URL =
1349
+ T.let(
1350
+ :skipped_unsafe_url,
1351
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::LastStatus::TaggedSymbol
1352
+ )
1353
+
1354
+ sig do
1355
+ override.returns(
1356
+ T::Array[
1357
+ ContextDev::Models::MonitorRotateWebhookSecretResponse::WebhookFailure::LastStatus::TaggedSymbol
1358
+ ]
1359
+ )
1360
+ end
1361
+ def self.values
1362
+ end
1363
+ end
1364
+ end
1365
+ end
1366
+ end
1367
+ end