context.dev 2.5.0 → 2.6.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 (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +4 -0
  5. data/lib/context_dev/models/batch_cancel_params.rb +22 -0
  6. data/lib/context_dev/models/batch_cancel_response.rb +354 -0
  7. data/lib/context_dev/models/batch_get_results_params.rb +42 -0
  8. data/lib/context_dev/models/batch_get_results_response.rb +463 -0
  9. data/lib/context_dev/models/batch_list_params.rb +94 -0
  10. data/lib/context_dev/models/batch_list_response.rb +388 -0
  11. data/lib/context_dev/models/batch_retrieve_params.rb +22 -0
  12. data/lib/context_dev/models/batch_retrieve_response.rb +390 -0
  13. data/lib/context_dev/models/batch_submit_params.rb +56 -0
  14. data/lib/context_dev/models/batch_submit_response.rb +614 -0
  15. data/lib/context_dev/models/error.rb +26 -0
  16. data/lib/context_dev/models/error_count.rb +26 -0
  17. data/lib/context_dev/models/monitor_create_params.rb +141 -127
  18. data/lib/context_dev/models/monitor_create_response.rb +34 -10
  19. data/lib/context_dev/models/monitor_list_response.rb +21 -7
  20. data/lib/context_dev/models/monitor_retrieve_response.rb +21 -7
  21. data/lib/context_dev/models/monitor_update_params.rb +21 -7
  22. data/lib/context_dev/models/monitor_update_response.rb +21 -7
  23. data/lib/context_dev/models/web_web_scrape_html_response.rb +93 -1
  24. data/lib/context_dev/models/web_web_scrape_md_response.rb +93 -1
  25. data/lib/context_dev/models.rb +14 -0
  26. data/lib/context_dev/resources/batch.rb +155 -0
  27. data/lib/context_dev/resources/monitors.rb +5 -5
  28. data/lib/context_dev/version.rb +1 -1
  29. data/lib/context_dev.rb +13 -0
  30. data/rbi/context_dev/client.rbi +3 -0
  31. data/rbi/context_dev/models/batch_cancel_params.rbi +40 -0
  32. data/rbi/context_dev/models/batch_cancel_response.rbi +642 -0
  33. data/rbi/context_dev/models/batch_get_results_params.rbi +70 -0
  34. data/rbi/context_dev/models/batch_get_results_response.rbi +848 -0
  35. data/rbi/context_dev/models/batch_list_params.rbi +166 -0
  36. data/rbi/context_dev/models/batch_list_response.rbi +738 -0
  37. data/rbi/context_dev/models/batch_retrieve_params.rbi +40 -0
  38. data/rbi/context_dev/models/batch_retrieve_response.rbi +707 -0
  39. data/rbi/context_dev/models/batch_submit_params.rbi +105 -0
  40. data/rbi/context_dev/models/batch_submit_response.rbi +1330 -0
  41. data/rbi/context_dev/models/error.rbi +32 -0
  42. data/rbi/context_dev/models/error_count.rbi +34 -0
  43. data/rbi/context_dev/models/monitor_create_params.rbi +274 -242
  44. data/rbi/context_dev/models/monitor_create_response.rbi +38 -7
  45. data/rbi/context_dev/models/monitor_list_response.rbi +24 -5
  46. data/rbi/context_dev/models/monitor_retrieve_response.rbi +24 -5
  47. data/rbi/context_dev/models/monitor_update_params.rbi +24 -5
  48. data/rbi/context_dev/models/monitor_update_response.rbi +24 -5
  49. data/rbi/context_dev/models/web_web_scrape_html_response.rbi +182 -0
  50. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +180 -0
  51. data/rbi/context_dev/models.rbi +14 -0
  52. data/rbi/context_dev/resources/batch.rbi +120 -0
  53. data/rbi/context_dev/resources/monitors.rbi +12 -12
  54. data/sig/context_dev/client.rbs +2 -0
  55. data/sig/context_dev/models/batch_cancel_params.rbs +23 -0
  56. data/sig/context_dev/models/batch_cancel_response.rbs +266 -0
  57. data/sig/context_dev/models/batch_get_results_params.rbs +36 -0
  58. data/sig/context_dev/models/batch_get_results_response.rbs +399 -0
  59. data/sig/context_dev/models/batch_list_params.rbs +94 -0
  60. data/sig/context_dev/models/batch_list_response.rbs +304 -0
  61. data/sig/context_dev/models/batch_retrieve_params.rbs +23 -0
  62. data/sig/context_dev/models/batch_retrieve_response.rbs +290 -0
  63. data/sig/context_dev/models/batch_submit_params.rbs +52 -0
  64. data/sig/context_dev/models/batch_submit_response.rbs +542 -0
  65. data/sig/context_dev/models/error.rbs +15 -0
  66. data/sig/context_dev/models/error_count.rbs +15 -0
  67. data/sig/context_dev/models/monitor_create_params.rbs +117 -97
  68. data/sig/context_dev/models/monitor_create_response.rbs +18 -1
  69. data/sig/context_dev/models/monitor_list_response.rbs +13 -1
  70. data/sig/context_dev/models/monitor_retrieve_response.rbs +13 -1
  71. data/sig/context_dev/models/monitor_update_params.rbs +13 -1
  72. data/sig/context_dev/models/monitor_update_response.rbs +13 -1
  73. data/sig/context_dev/models/web_web_scrape_html_response.rbs +85 -0
  74. data/sig/context_dev/models/web_web_scrape_md_response.rbs +85 -0
  75. data/sig/context_dev/models.rbs +14 -0
  76. data/sig/context_dev/resources/batch.rbs +41 -0
  77. data/sig/context_dev/resources/monitors.rbs +2 -2
  78. metadata +41 -2
@@ -0,0 +1,32 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Models
5
+ class Error < ContextDev::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias { T.any(ContextDev::Error, ContextDev::Internal::AnyHash) }
8
+
9
+ # Batch error code.
10
+ sig { returns(String) }
11
+ attr_accessor :code
12
+
13
+ # Batch error message.
14
+ sig { returns(String) }
15
+ attr_accessor :message
16
+
17
+ # Why the batch failed.
18
+ sig { params(code: String, message: String).returns(T.attached_class) }
19
+ def self.new(
20
+ # Batch error code.
21
+ code:,
22
+ # Batch error message.
23
+ message:
24
+ )
25
+ end
26
+
27
+ sig { override.returns({ code: String, message: String }) }
28
+ def to_hash
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,34 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Models
5
+ class ErrorCount < ContextDev::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(ContextDev::ErrorCount, ContextDev::Internal::AnyHash)
9
+ end
10
+
11
+ # Error code for these failures.
12
+ sig { returns(String) }
13
+ attr_accessor :code
14
+
15
+ # Pages that failed with this code.
16
+ sig { returns(Integer) }
17
+ attr_accessor :count
18
+
19
+ # Page failures sharing one error code.
20
+ sig { params(code: String, count: Integer).returns(T.attached_class) }
21
+ def self.new(
22
+ # Error code for these failures.
23
+ code:,
24
+ # Pages that failed with this code.
25
+ count:
26
+ )
27
+ end
28
+
29
+ sig { override.returns({ code: String, count: Integer }) }
30
+ def to_hash
31
+ end
32
+ end
33
+ end
34
+ end
@@ -11,31 +11,9 @@ module ContextDev
11
11
  T.any(ContextDev::MonitorCreateParams, ContextDev::Internal::AnyHash)
12
12
  end
13
13
 
14
- # Discriminated union describing how changes are detected.
15
- sig do
16
- returns(
17
- T.any(
18
- ContextDev::MonitorCreateParams::ChangeDetection::Exact,
19
- ContextDev::MonitorCreateParams::ChangeDetection::Semantic
20
- )
21
- )
22
- end
23
- attr_accessor :change_detection
24
-
25
14
  sig { returns(String) }
26
15
  attr_accessor :name
27
16
 
28
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
29
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
30
- # between 10 minutes and 1 year.
31
- sig { returns(ContextDev::MonitorCreateParams::Schedule) }
32
- attr_reader :schedule
33
-
34
- sig do
35
- params(schedule: ContextDev::MonitorCreateParams::Schedule::OrHash).void
36
- end
37
- attr_writer :schedule
38
-
39
17
  # Discriminated union describing what the monitor watches.
40
18
  sig do
41
19
  returns(
@@ -48,6 +26,30 @@ module ContextDev
48
26
  end
49
27
  attr_accessor :target
50
28
 
29
+ # Discriminated union describing how changes are detected.
30
+ sig do
31
+ returns(
32
+ T.nilable(
33
+ T.any(
34
+ ContextDev::MonitorCreateParams::ChangeDetection::Exact,
35
+ ContextDev::MonitorCreateParams::ChangeDetection::Semantic
36
+ )
37
+ )
38
+ )
39
+ end
40
+ attr_reader :change_detection
41
+
42
+ sig do
43
+ params(
44
+ change_detection:
45
+ T.any(
46
+ ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash,
47
+ ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash
48
+ )
49
+ ).void
50
+ end
51
+ attr_writer :change_detection
52
+
51
53
  # Top-level monitor category. Always `web` today; the concrete behavior is
52
54
  # described by `target` and `change_detection`.
53
55
  sig do
@@ -58,6 +60,17 @@ module ContextDev
58
60
  sig { params(mode: ContextDev::MonitorCreateParams::Mode::OrSymbol).void }
59
61
  attr_writer :mode
60
62
 
63
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
64
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
65
+ # between 10 minutes and 1 year.
66
+ sig { returns(T.nilable(ContextDev::MonitorCreateParams::Schedule)) }
67
+ attr_reader :schedule
68
+
69
+ sig do
70
+ params(schedule: ContextDev::MonitorCreateParams::Schedule::OrHash).void
71
+ end
72
+ attr_writer :schedule
73
+
61
74
  # User-defined tags for grouping and filtering monitors and their changes.
62
75
  # Duplicates are removed.
63
76
  sig { returns(T.nilable(T::Array[String])) }
@@ -78,38 +91,38 @@ module ContextDev
78
91
 
79
92
  sig do
80
93
  params(
81
- change_detection:
82
- T.any(
83
- ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash,
84
- ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash
85
- ),
86
94
  name: String,
87
- schedule: ContextDev::MonitorCreateParams::Schedule::OrHash,
88
95
  target:
89
96
  T.any(
90
97
  ContextDev::MonitorCreateParams::Target::Page::OrHash,
91
98
  ContextDev::MonitorCreateParams::Target::Sitemap::OrHash,
92
99
  ContextDev::MonitorCreateParams::Target::Extract::OrHash
93
100
  ),
101
+ change_detection:
102
+ T.any(
103
+ ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash,
104
+ ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash
105
+ ),
94
106
  mode: ContextDev::MonitorCreateParams::Mode::OrSymbol,
107
+ schedule: ContextDev::MonitorCreateParams::Schedule::OrHash,
95
108
  tags: T::Array[String],
96
109
  webhook: T.nilable(ContextDev::MonitorCreateParams::Webhook::OrHash),
97
110
  request_options: ContextDev::RequestOptions::OrHash
98
111
  ).returns(T.attached_class)
99
112
  end
100
113
  def self.new(
101
- # Discriminated union describing how changes are detected.
102
- change_detection:,
103
114
  name:,
104
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
105
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
106
- # between 10 minutes and 1 year.
107
- schedule:,
108
115
  # Discriminated union describing what the monitor watches.
109
116
  target:,
117
+ # Discriminated union describing how changes are detected.
118
+ change_detection: nil,
110
119
  # Top-level monitor category. Always `web` today; the concrete behavior is
111
120
  # described by `target` and `change_detection`.
112
121
  mode: nil,
122
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
123
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
124
+ # between 10 minutes and 1 year.
125
+ schedule: nil,
113
126
  # User-defined tags for grouping and filtering monitors and their changes.
114
127
  # Duplicates are removed.
115
128
  tags: nil,
@@ -121,20 +134,20 @@ module ContextDev
121
134
  sig do
122
135
  override.returns(
123
136
  {
124
- change_detection:
125
- T.any(
126
- ContextDev::MonitorCreateParams::ChangeDetection::Exact,
127
- ContextDev::MonitorCreateParams::ChangeDetection::Semantic
128
- ),
129
137
  name: String,
130
- schedule: ContextDev::MonitorCreateParams::Schedule,
131
138
  target:
132
139
  T.any(
133
140
  ContextDev::MonitorCreateParams::Target::Page,
134
141
  ContextDev::MonitorCreateParams::Target::Sitemap,
135
142
  ContextDev::MonitorCreateParams::Target::Extract
136
143
  ),
144
+ change_detection:
145
+ T.any(
146
+ ContextDev::MonitorCreateParams::ChangeDetection::Exact,
147
+ ContextDev::MonitorCreateParams::ChangeDetection::Semantic
148
+ ),
137
149
  mode: ContextDev::MonitorCreateParams::Mode::OrSymbol,
150
+ schedule: ContextDev::MonitorCreateParams::Schedule,
138
151
  tags: T::Array[String],
139
152
  webhook: T.nilable(ContextDev::MonitorCreateParams::Webhook),
140
153
  request_options: ContextDev::RequestOptions
@@ -144,206 +157,6 @@ module ContextDev
144
157
  def to_hash
145
158
  end
146
159
 
147
- # Discriminated union describing how changes are detected.
148
- module ChangeDetection
149
- extend ContextDev::Internal::Type::Union
150
-
151
- Variants =
152
- T.type_alias do
153
- T.any(
154
- ContextDev::MonitorCreateParams::ChangeDetection::Exact,
155
- ContextDev::MonitorCreateParams::ChangeDetection::Semantic
156
- )
157
- end
158
-
159
- class Exact < ContextDev::Internal::Type::BaseModel
160
- OrHash =
161
- T.type_alias do
162
- T.any(
163
- ContextDev::MonitorCreateParams::ChangeDetection::Exact,
164
- ContextDev::Internal::AnyHash
165
- )
166
- end
167
-
168
- sig { returns(Symbol) }
169
- attr_accessor :type
170
-
171
- # Detect exact changes. For page targets, this means visible text diffs. For
172
- # sitemap targets, this means URL additions and removals.
173
- sig { params(type: Symbol).returns(T.attached_class) }
174
- def self.new(type: :exact)
175
- end
176
-
177
- sig { override.returns({ type: Symbol }) }
178
- def to_hash
179
- end
180
- end
181
-
182
- class Semantic < ContextDev::Internal::Type::BaseModel
183
- OrHash =
184
- T.type_alias do
185
- T.any(
186
- ContextDev::MonitorCreateParams::ChangeDetection::Semantic,
187
- ContextDev::Internal::AnyHash
188
- )
189
- end
190
-
191
- sig { returns(Symbol) }
192
- attr_accessor :type
193
-
194
- sig { returns(T.nilable(Float)) }
195
- attr_reader :confidence_threshold
196
-
197
- sig { params(confidence_threshold: Float).void }
198
- attr_writer :confidence_threshold
199
-
200
- # Detect meaning-level changes to tracked page content, ignoring cosmetic or
201
- # paraphrase-only differences. Which changes are meaningful is judged against the
202
- # extract target's `instructions` (and `schema`, when provided).
203
- sig do
204
- params(confidence_threshold: Float, type: Symbol).returns(
205
- T.attached_class
206
- )
207
- end
208
- def self.new(confidence_threshold: nil, type: :semantic)
209
- end
210
-
211
- sig do
212
- override.returns({ type: Symbol, confidence_threshold: Float })
213
- end
214
- def to_hash
215
- end
216
- end
217
-
218
- sig do
219
- override.returns(
220
- T::Array[ContextDev::MonitorCreateParams::ChangeDetection::Variants]
221
- )
222
- end
223
- def self.variants
224
- end
225
- end
226
-
227
- class Schedule < ContextDev::Internal::Type::BaseModel
228
- OrHash =
229
- T.type_alias do
230
- T.any(
231
- ContextDev::MonitorCreateParams::Schedule,
232
- ContextDev::Internal::AnyHash
233
- )
234
- end
235
-
236
- # Number of units between runs. The resulting interval (frequency × unit) must be
237
- # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
238
- # maximum 365 when unit is days).
239
- sig { returns(Integer) }
240
- attr_accessor :frequency
241
-
242
- sig do
243
- returns(ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol)
244
- end
245
- attr_accessor :type
246
-
247
- sig do
248
- returns(ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol)
249
- end
250
- attr_accessor :unit
251
-
252
- # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
253
- # every 6 hours or every 2 days. The total interval (frequency × unit) must be
254
- # between 10 minutes and 1 year.
255
- sig do
256
- params(
257
- frequency: Integer,
258
- type: ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol,
259
- unit: ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol
260
- ).returns(T.attached_class)
261
- end
262
- def self.new(
263
- # Number of units between runs. The resulting interval (frequency × unit) must be
264
- # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
265
- # maximum 365 when unit is days).
266
- frequency:,
267
- type:,
268
- unit:
269
- )
270
- end
271
-
272
- sig do
273
- override.returns(
274
- {
275
- frequency: Integer,
276
- type: ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol,
277
- unit: ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol
278
- }
279
- )
280
- end
281
- def to_hash
282
- end
283
-
284
- module Type
285
- extend ContextDev::Internal::Type::Enum
286
-
287
- TaggedSymbol =
288
- T.type_alias do
289
- T.all(Symbol, ContextDev::MonitorCreateParams::Schedule::Type)
290
- end
291
- OrSymbol = T.type_alias { T.any(Symbol, String) }
292
-
293
- INTERVAL =
294
- T.let(
295
- :interval,
296
- ContextDev::MonitorCreateParams::Schedule::Type::TaggedSymbol
297
- )
298
-
299
- sig do
300
- override.returns(
301
- T::Array[
302
- ContextDev::MonitorCreateParams::Schedule::Type::TaggedSymbol
303
- ]
304
- )
305
- end
306
- def self.values
307
- end
308
- end
309
-
310
- module Unit
311
- extend ContextDev::Internal::Type::Enum
312
-
313
- TaggedSymbol =
314
- T.type_alias do
315
- T.all(Symbol, ContextDev::MonitorCreateParams::Schedule::Unit)
316
- end
317
- OrSymbol = T.type_alias { T.any(Symbol, String) }
318
-
319
- MINUTES =
320
- T.let(
321
- :minutes,
322
- ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol
323
- )
324
- HOURS =
325
- T.let(
326
- :hours,
327
- ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol
328
- )
329
- DAYS =
330
- T.let(
331
- :days,
332
- ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol
333
- )
334
-
335
- sig do
336
- override.returns(
337
- T::Array[
338
- ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol
339
- ]
340
- )
341
- end
342
- def self.values
343
- end
344
- end
345
- end
346
-
347
160
  # Discriminated union describing what the monitor watches.
348
161
  module Target
349
162
  extend ContextDev::Internal::Type::Union
@@ -372,6 +185,14 @@ module ContextDev
372
185
  sig { returns(String) }
373
186
  attr_accessor :url
374
187
 
188
+ # Plain-language goal describing which page changes matter. When provided without
189
+ # change_detection, semantic detection is inferred.
190
+ sig { returns(T.nilable(String)) }
191
+ attr_reader :instructions
192
+
193
+ sig { params(instructions: String).void }
194
+ attr_writer :instructions
195
+
375
196
  # Normalize whitespace before comparing or analyzing text.
376
197
  sig { returns(T.nilable(T::Boolean)) }
377
198
  attr_reader :normalize_whitespace
@@ -379,16 +200,21 @@ module ContextDev
379
200
  sig { params(normalize_whitespace: T::Boolean).void }
380
201
  attr_writer :normalize_whitespace
381
202
 
382
- # Watch a single web page.
203
+ # Watch a single web page. Exact detection reports visible-text diffs; semantic
204
+ # detection judges confirmed stable diffs against `instructions`.
383
205
  sig do
384
206
  params(
385
207
  url: String,
208
+ instructions: String,
386
209
  normalize_whitespace: T::Boolean,
387
210
  type: Symbol
388
211
  ).returns(T.attached_class)
389
212
  end
390
213
  def self.new(
391
214
  url:,
215
+ # Plain-language goal describing which page changes matter. When provided without
216
+ # change_detection, semantic detection is inferred.
217
+ instructions: nil,
392
218
  # Normalize whitespace before comparing or analyzing text.
393
219
  normalize_whitespace: nil,
394
220
  type: :page
@@ -397,7 +223,12 @@ module ContextDev
397
223
 
398
224
  sig do
399
225
  override.returns(
400
- { type: Symbol, url: String, normalize_whitespace: T::Boolean }
226
+ {
227
+ type: Symbol,
228
+ url: String,
229
+ instructions: String,
230
+ normalize_whitespace: T::Boolean
231
+ }
401
232
  )
402
233
  end
403
234
  def to_hash
@@ -604,6 +435,87 @@ module ContextDev
604
435
  end
605
436
  end
606
437
 
438
+ # Discriminated union describing how changes are detected.
439
+ module ChangeDetection
440
+ extend ContextDev::Internal::Type::Union
441
+
442
+ Variants =
443
+ T.type_alias do
444
+ T.any(
445
+ ContextDev::MonitorCreateParams::ChangeDetection::Exact,
446
+ ContextDev::MonitorCreateParams::ChangeDetection::Semantic
447
+ )
448
+ end
449
+
450
+ class Exact < ContextDev::Internal::Type::BaseModel
451
+ OrHash =
452
+ T.type_alias do
453
+ T.any(
454
+ ContextDev::MonitorCreateParams::ChangeDetection::Exact,
455
+ ContextDev::Internal::AnyHash
456
+ )
457
+ end
458
+
459
+ sig { returns(Symbol) }
460
+ attr_accessor :type
461
+
462
+ # Detect exact changes. For page targets, this means visible text diffs. For
463
+ # sitemap targets, this means URL additions and removals.
464
+ sig { params(type: Symbol).returns(T.attached_class) }
465
+ def self.new(type: :exact)
466
+ end
467
+
468
+ sig { override.returns({ type: Symbol }) }
469
+ def to_hash
470
+ end
471
+ end
472
+
473
+ class Semantic < ContextDev::Internal::Type::BaseModel
474
+ OrHash =
475
+ T.type_alias do
476
+ T.any(
477
+ ContextDev::MonitorCreateParams::ChangeDetection::Semantic,
478
+ ContextDev::Internal::AnyHash
479
+ )
480
+ end
481
+
482
+ sig { returns(Symbol) }
483
+ attr_accessor :type
484
+
485
+ sig { returns(T.nilable(Float)) }
486
+ attr_reader :confidence_threshold
487
+
488
+ sig { params(confidence_threshold: Float).void }
489
+ attr_writer :confidence_threshold
490
+
491
+ # Detect meaning-level changes to page content, ignoring cosmetic or
492
+ # instruction-irrelevant differences. Which changes are meaningful is judged
493
+ # against the page or extract target's `instructions` (and an extract target's
494
+ # `schema`, when provided).
495
+ sig do
496
+ params(confidence_threshold: Float, type: Symbol).returns(
497
+ T.attached_class
498
+ )
499
+ end
500
+ def self.new(confidence_threshold: nil, type: :semantic)
501
+ end
502
+
503
+ sig do
504
+ override.returns({ type: Symbol, confidence_threshold: Float })
505
+ end
506
+ def to_hash
507
+ end
508
+ end
509
+
510
+ sig do
511
+ override.returns(
512
+ T::Array[ContextDev::MonitorCreateParams::ChangeDetection::Variants]
513
+ )
514
+ end
515
+ def self.variants
516
+ end
517
+ end
518
+
607
519
  # Top-level monitor category. Always `web` today; the concrete behavior is
608
520
  # described by `target` and `change_detection`.
609
521
  module Mode
@@ -624,6 +536,126 @@ module ContextDev
624
536
  end
625
537
  end
626
538
 
539
+ class Schedule < ContextDev::Internal::Type::BaseModel
540
+ OrHash =
541
+ T.type_alias do
542
+ T.any(
543
+ ContextDev::MonitorCreateParams::Schedule,
544
+ ContextDev::Internal::AnyHash
545
+ )
546
+ end
547
+
548
+ # Number of units between runs. The resulting interval (frequency × unit) must be
549
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
550
+ # maximum 365 when unit is days).
551
+ sig { returns(Integer) }
552
+ attr_accessor :frequency
553
+
554
+ sig do
555
+ returns(ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol)
556
+ end
557
+ attr_accessor :type
558
+
559
+ sig do
560
+ returns(ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol)
561
+ end
562
+ attr_accessor :unit
563
+
564
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
565
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
566
+ # between 10 minutes and 1 year.
567
+ sig do
568
+ params(
569
+ frequency: Integer,
570
+ type: ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol,
571
+ unit: ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol
572
+ ).returns(T.attached_class)
573
+ end
574
+ def self.new(
575
+ # Number of units between runs. The resulting interval (frequency × unit) must be
576
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
577
+ # maximum 365 when unit is days).
578
+ frequency:,
579
+ type:,
580
+ unit:
581
+ )
582
+ end
583
+
584
+ sig do
585
+ override.returns(
586
+ {
587
+ frequency: Integer,
588
+ type: ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol,
589
+ unit: ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol
590
+ }
591
+ )
592
+ end
593
+ def to_hash
594
+ end
595
+
596
+ module Type
597
+ extend ContextDev::Internal::Type::Enum
598
+
599
+ TaggedSymbol =
600
+ T.type_alias do
601
+ T.all(Symbol, ContextDev::MonitorCreateParams::Schedule::Type)
602
+ end
603
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
604
+
605
+ INTERVAL =
606
+ T.let(
607
+ :interval,
608
+ ContextDev::MonitorCreateParams::Schedule::Type::TaggedSymbol
609
+ )
610
+
611
+ sig do
612
+ override.returns(
613
+ T::Array[
614
+ ContextDev::MonitorCreateParams::Schedule::Type::TaggedSymbol
615
+ ]
616
+ )
617
+ end
618
+ def self.values
619
+ end
620
+ end
621
+
622
+ module Unit
623
+ extend ContextDev::Internal::Type::Enum
624
+
625
+ TaggedSymbol =
626
+ T.type_alias do
627
+ T.all(Symbol, ContextDev::MonitorCreateParams::Schedule::Unit)
628
+ end
629
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
630
+
631
+ MINUTES =
632
+ T.let(
633
+ :minutes,
634
+ ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol
635
+ )
636
+ HOURS =
637
+ T.let(
638
+ :hours,
639
+ ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol
640
+ )
641
+ DAYS =
642
+ T.let(
643
+ :days,
644
+ ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol
645
+ )
646
+
647
+ sig do
648
+ override.returns(
649
+ T::Array[
650
+ ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol
651
+ ]
652
+ )
653
+ end
654
+ def self.values
655
+ end
656
+ end
657
+ end
658
+
627
659
  class Webhook < ContextDev::Internal::Type::BaseModel
628
660
  OrHash =
629
661
  T.type_alias do