context.dev 1.36.0 → 2.1.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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +16 -9
  4. data/lib/context_dev/client.rb +7 -0
  5. data/lib/context_dev/models/brand_retrieve_params.rb +1079 -174
  6. data/lib/context_dev/models/monitor_create_params.rb +364 -0
  7. data/lib/context_dev/models/monitor_create_response.rb +608 -0
  8. data/lib/context_dev/models/monitor_delete_params.rb +20 -0
  9. data/lib/context_dev/models/monitor_delete_response.rb +22 -0
  10. data/lib/context_dev/models/monitor_list_account_changes_params.rb +93 -0
  11. data/lib/context_dev/models/monitor_list_account_changes_response.rb +199 -0
  12. data/lib/context_dev/models/monitor_list_account_runs_params.rb +55 -0
  13. data/lib/context_dev/models/monitor_list_account_runs_response.rb +227 -0
  14. data/lib/context_dev/models/monitor_list_changes_params.rb +57 -0
  15. data/lib/context_dev/models/monitor_list_changes_response.rb +198 -0
  16. data/lib/context_dev/models/monitor_list_params.rb +161 -0
  17. data/lib/context_dev/models/monitor_list_response.rb +631 -0
  18. data/lib/context_dev/models/monitor_list_runs_params.rb +62 -0
  19. data/lib/context_dev/models/monitor_list_runs_response.rb +227 -0
  20. data/lib/context_dev/models/monitor_retrieve_change_params.rb +20 -0
  21. data/lib/context_dev/models/monitor_retrieve_change_response.rb +264 -0
  22. data/lib/context_dev/models/monitor_retrieve_params.rb +20 -0
  23. data/lib/context_dev/models/monitor_retrieve_response.rb +608 -0
  24. data/lib/context_dev/models/monitor_run_params.rb +20 -0
  25. data/lib/context_dev/models/monitor_run_response.rb +35 -0
  26. data/lib/context_dev/models/monitor_update_params.rb +371 -0
  27. data/lib/context_dev/models/monitor_update_response.rb +608 -0
  28. data/lib/context_dev/models/utility_prefetch_params.rb +70 -6
  29. data/lib/context_dev/models/utility_prefetch_response.rb +23 -1
  30. data/lib/context_dev/models/web_extract_response.rb +17 -1
  31. data/lib/context_dev/models/web_web_crawl_md_params.rb +11 -1
  32. data/lib/context_dev/models/web_web_scrape_html_params.rb +11 -1
  33. data/lib/context_dev/models/web_web_scrape_html_response.rb +10 -2
  34. data/lib/context_dev/models/web_web_scrape_images_params.rb +12 -1
  35. data/lib/context_dev/models/web_web_scrape_md_params.rb +11 -1
  36. data/lib/context_dev/models.rb +20 -12
  37. data/lib/context_dev/resources/ai.rb +0 -33
  38. data/lib/context_dev/resources/brand.rb +9 -204
  39. data/lib/context_dev/resources/monitors.rb +352 -0
  40. data/lib/context_dev/resources/utility.rb +9 -35
  41. data/lib/context_dev/resources/web.rb +14 -4
  42. data/lib/context_dev/version.rb +1 -1
  43. data/lib/context_dev.rb +23 -14
  44. data/rbi/context_dev/client.rbi +6 -0
  45. data/rbi/context_dev/models/brand_retrieve_params.rbi +3858 -678
  46. data/rbi/context_dev/models/monitor_create_params.rbi +641 -0
  47. data/rbi/context_dev/models/monitor_create_response.rbi +1020 -0
  48. data/rbi/context_dev/models/monitor_delete_params.rbi +35 -0
  49. data/rbi/context_dev/models/monitor_delete_response.rbi +29 -0
  50. data/rbi/context_dev/models/monitor_list_account_changes_params.rbi +211 -0
  51. data/rbi/context_dev/models/monitor_list_account_changes_response.rbi +376 -0
  52. data/rbi/context_dev/models/monitor_list_account_runs_params.rbi +125 -0
  53. data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +464 -0
  54. data/rbi/context_dev/models/monitor_list_changes_params.rbi +91 -0
  55. data/rbi/context_dev/models/monitor_list_changes_response.rbi +372 -0
  56. data/rbi/context_dev/models/monitor_list_params.rbi +335 -0
  57. data/rbi/context_dev/models/monitor_list_response.rbi +1089 -0
  58. data/rbi/context_dev/models/monitor_list_runs_params.rbi +125 -0
  59. data/rbi/context_dev/models/monitor_list_runs_response.rbi +455 -0
  60. data/rbi/context_dev/models/monitor_retrieve_change_params.rbi +38 -0
  61. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +469 -0
  62. data/rbi/context_dev/models/monitor_retrieve_params.rbi +38 -0
  63. data/rbi/context_dev/models/monitor_retrieve_response.rbi +1028 -0
  64. data/rbi/context_dev/models/monitor_run_params.rbi +35 -0
  65. data/rbi/context_dev/models/monitor_run_response.rbi +48 -0
  66. data/rbi/context_dev/models/monitor_update_params.rbi +681 -0
  67. data/rbi/context_dev/models/monitor_update_response.rbi +1020 -0
  68. data/rbi/context_dev/models/utility_prefetch_params.rbi +129 -7
  69. data/rbi/context_dev/models/utility_prefetch_response.rbi +55 -3
  70. data/rbi/context_dev/models/web_extract_response.rbi +10 -0
  71. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +15 -0
  72. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +15 -0
  73. data/rbi/context_dev/models/web_web_scrape_html_response.rbi +29 -3
  74. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +17 -0
  75. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +15 -0
  76. data/rbi/context_dev/models.rbi +23 -15
  77. data/rbi/context_dev/resources/ai.rbi +0 -28
  78. data/rbi/context_dev/resources/brand.rbi +16 -228
  79. data/rbi/context_dev/resources/monitors.rbi +286 -0
  80. data/rbi/context_dev/resources/utility.rbi +14 -29
  81. data/rbi/context_dev/resources/web.rbi +21 -0
  82. data/sig/context_dev/client.rbs +2 -0
  83. data/sig/context_dev/models/brand_retrieve_params.rbs +1586 -281
  84. data/sig/context_dev/models/monitor_create_params.rbs +301 -0
  85. data/sig/context_dev/models/monitor_create_response.rbs +433 -0
  86. data/sig/context_dev/models/monitor_delete_params.rbs +23 -0
  87. data/sig/context_dev/models/monitor_delete_response.rbs +15 -0
  88. data/sig/context_dev/models/monitor_list_account_changes_params.rbs +104 -0
  89. data/sig/context_dev/models/monitor_list_account_changes_response.rbs +176 -0
  90. data/sig/context_dev/models/monitor_list_account_runs_params.rbs +58 -0
  91. data/sig/context_dev/models/monitor_list_account_runs_response.rbs +184 -0
  92. data/sig/context_dev/models/monitor_list_changes_params.rbs +61 -0
  93. data/sig/context_dev/models/monitor_list_changes_response.rbs +176 -0
  94. data/sig/context_dev/models/monitor_list_params.rbs +160 -0
  95. data/sig/context_dev/models/monitor_list_response.rbs +460 -0
  96. data/sig/context_dev/models/monitor_list_runs_params.rbs +63 -0
  97. data/sig/context_dev/models/monitor_list_runs_response.rbs +184 -0
  98. data/sig/context_dev/models/monitor_retrieve_change_params.rbs +23 -0
  99. data/sig/context_dev/models/monitor_retrieve_change_response.rbs +221 -0
  100. data/sig/context_dev/models/monitor_retrieve_params.rbs +23 -0
  101. data/sig/context_dev/models/monitor_retrieve_response.rbs +433 -0
  102. data/sig/context_dev/models/monitor_run_params.rbs +23 -0
  103. data/sig/context_dev/models/monitor_run_response.rbs +18 -0
  104. data/sig/context_dev/models/monitor_update_params.rbs +321 -0
  105. data/sig/context_dev/models/monitor_update_response.rbs +433 -0
  106. data/sig/context_dev/models/utility_prefetch_params.rbs +52 -4
  107. data/sig/context_dev/models/utility_prefetch_response.rbs +22 -3
  108. data/sig/context_dev/models/web_extract_response.rbs +5 -0
  109. data/sig/context_dev/models/web_web_crawl_md_params.rbs +7 -0
  110. data/sig/context_dev/models/web_web_scrape_html_params.rbs +7 -0
  111. data/sig/context_dev/models/web_web_scrape_html_response.rbs +8 -0
  112. data/sig/context_dev/models/web_web_scrape_images_params.rbs +7 -0
  113. data/sig/context_dev/models/web_web_scrape_md_params.rbs +7 -0
  114. data/sig/context_dev/models.rbs +20 -12
  115. data/sig/context_dev/resources/ai.rbs +0 -8
  116. data/sig/context_dev/resources/brand.rbs +1 -56
  117. data/sig/context_dev/resources/monitors.rbs +101 -0
  118. data/sig/context_dev/resources/utility.rbs +2 -7
  119. data/sig/context_dev/resources/web.rbs +4 -0
  120. metadata +71 -44
  121. data/lib/context_dev/models/ai_ai_query_params.rb +0 -235
  122. data/lib/context_dev/models/ai_ai_query_response.rb +0 -133
  123. data/lib/context_dev/models/brand_identify_from_transaction_params.rb +0 -474
  124. data/lib/context_dev/models/brand_identify_from_transaction_response.rb +0 -1074
  125. data/lib/context_dev/models/brand_retrieve_by_email_params.rb +0 -195
  126. data/lib/context_dev/models/brand_retrieve_by_email_response.rb +0 -1071
  127. data/lib/context_dev/models/brand_retrieve_by_isin_params.rb +0 -195
  128. data/lib/context_dev/models/brand_retrieve_by_isin_response.rb +0 -1070
  129. data/lib/context_dev/models/brand_retrieve_by_name_params.rb +0 -452
  130. data/lib/context_dev/models/brand_retrieve_by_name_response.rb +0 -1070
  131. data/lib/context_dev/models/brand_retrieve_by_ticker_params.rb +0 -283
  132. data/lib/context_dev/models/brand_retrieve_by_ticker_response.rb +0 -1072
  133. data/lib/context_dev/models/utility_prefetch_by_email_params.rb +0 -37
  134. data/lib/context_dev/models/utility_prefetch_by_email_response.rb +0 -68
  135. data/rbi/context_dev/models/ai_ai_query_params.rbi +0 -504
  136. data/rbi/context_dev/models/ai_ai_query_response.rbi +0 -267
  137. data/rbi/context_dev/models/brand_identify_from_transaction_params.rbi +0 -2020
  138. data/rbi/context_dev/models/brand_identify_from_transaction_response.rbi +0 -3515
  139. data/rbi/context_dev/models/brand_retrieve_by_email_params.rbi +0 -743
  140. data/rbi/context_dev/models/brand_retrieve_by_email_response.rbi +0 -3511
  141. data/rbi/context_dev/models/brand_retrieve_by_isin_params.rbi +0 -743
  142. data/rbi/context_dev/models/brand_retrieve_by_isin_response.rbi +0 -3510
  143. data/rbi/context_dev/models/brand_retrieve_by_name_params.rbi +0 -1982
  144. data/rbi/context_dev/models/brand_retrieve_by_name_response.rbi +0 -3510
  145. data/rbi/context_dev/models/brand_retrieve_by_ticker_params.rbi +0 -1153
  146. data/rbi/context_dev/models/brand_retrieve_by_ticker_response.rbi +0 -3512
  147. data/rbi/context_dev/models/utility_prefetch_by_email_params.rbi +0 -65
  148. data/rbi/context_dev/models/utility_prefetch_by_email_response.rbi +0 -132
  149. data/sig/context_dev/models/ai_ai_query_params.rbs +0 -218
  150. data/sig/context_dev/models/ai_ai_query_response.rbs +0 -121
  151. data/sig/context_dev/models/brand_identify_from_transaction_params.rbs +0 -822
  152. data/sig/context_dev/models/brand_identify_from_transaction_response.rbs +0 -1441
  153. data/sig/context_dev/models/brand_retrieve_by_email_params.rbs +0 -305
  154. data/sig/context_dev/models/brand_retrieve_by_email_response.rbs +0 -1441
  155. data/sig/context_dev/models/brand_retrieve_by_isin_params.rbs +0 -305
  156. data/sig/context_dev/models/brand_retrieve_by_isin_response.rbs +0 -1441
  157. data/sig/context_dev/models/brand_retrieve_by_name_params.rbs +0 -801
  158. data/sig/context_dev/models/brand_retrieve_by_name_response.rbs +0 -1441
  159. data/sig/context_dev/models/brand_retrieve_by_ticker_params.rbs +0 -467
  160. data/sig/context_dev/models/brand_retrieve_by_ticker_response.rbs +0 -1441
  161. data/sig/context_dev/models/utility_prefetch_by_email_params.rbs +0 -30
  162. data/sig/context_dev/models/utility_prefetch_by_email_response.rbs +0 -64
@@ -0,0 +1,681 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Models
5
+ class MonitorUpdateParams < ContextDev::Internal::Type::BaseModel
6
+ extend ContextDev::Internal::Type::RequestParameters::Converter
7
+ include ContextDev::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(ContextDev::MonitorUpdateParams, ContextDev::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :monitor_id
16
+
17
+ # Discriminated union describing how changes are detected.
18
+ sig do
19
+ returns(
20
+ T.nilable(
21
+ T.any(
22
+ ContextDev::MonitorUpdateParams::ChangeDetection::Exact,
23
+ ContextDev::MonitorUpdateParams::ChangeDetection::Semantic
24
+ )
25
+ )
26
+ )
27
+ end
28
+ attr_reader :change_detection
29
+
30
+ sig do
31
+ params(
32
+ change_detection:
33
+ T.any(
34
+ ContextDev::MonitorUpdateParams::ChangeDetection::Exact::OrHash,
35
+ ContextDev::MonitorUpdateParams::ChangeDetection::Semantic::OrHash
36
+ )
37
+ ).void
38
+ end
39
+ attr_writer :change_detection
40
+
41
+ sig { returns(T.nilable(String)) }
42
+ attr_reader :name
43
+
44
+ sig { params(name: String).void }
45
+ attr_writer :name
46
+
47
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
48
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
49
+ # between 10 minutes and 1 year.
50
+ sig { returns(T.nilable(ContextDev::MonitorUpdateParams::Schedule)) }
51
+ attr_reader :schedule
52
+
53
+ sig do
54
+ params(schedule: ContextDev::MonitorUpdateParams::Schedule::OrHash).void
55
+ end
56
+ attr_writer :schedule
57
+
58
+ sig do
59
+ returns(T.nilable(ContextDev::MonitorUpdateParams::Status::OrSymbol))
60
+ end
61
+ attr_reader :status
62
+
63
+ sig do
64
+ params(status: ContextDev::MonitorUpdateParams::Status::OrSymbol).void
65
+ end
66
+ attr_writer :status
67
+
68
+ # User-defined tags for grouping and filtering monitors and their changes.
69
+ sig { returns(T.nilable(T::Array[String])) }
70
+ attr_reader :tags
71
+
72
+ sig { params(tags: T::Array[String]).void }
73
+ attr_writer :tags
74
+
75
+ # Discriminated union describing what the monitor watches.
76
+ sig do
77
+ returns(
78
+ T.nilable(
79
+ T.any(
80
+ ContextDev::MonitorUpdateParams::Target::Page,
81
+ ContextDev::MonitorUpdateParams::Target::Sitemap,
82
+ ContextDev::MonitorUpdateParams::Target::Extract
83
+ )
84
+ )
85
+ )
86
+ end
87
+ attr_reader :target
88
+
89
+ sig do
90
+ params(
91
+ target:
92
+ T.any(
93
+ ContextDev::MonitorUpdateParams::Target::Page::OrHash,
94
+ ContextDev::MonitorUpdateParams::Target::Sitemap::OrHash,
95
+ ContextDev::MonitorUpdateParams::Target::Extract::OrHash
96
+ )
97
+ ).void
98
+ end
99
+ attr_writer :target
100
+
101
+ # Set to null to remove the webhook.
102
+ sig { returns(T.nilable(ContextDev::MonitorUpdateParams::Webhook)) }
103
+ attr_reader :webhook
104
+
105
+ sig do
106
+ params(
107
+ webhook: T.nilable(ContextDev::MonitorUpdateParams::Webhook::OrHash)
108
+ ).void
109
+ end
110
+ attr_writer :webhook
111
+
112
+ sig do
113
+ params(
114
+ monitor_id: String,
115
+ change_detection:
116
+ T.any(
117
+ ContextDev::MonitorUpdateParams::ChangeDetection::Exact::OrHash,
118
+ ContextDev::MonitorUpdateParams::ChangeDetection::Semantic::OrHash
119
+ ),
120
+ name: String,
121
+ schedule: ContextDev::MonitorUpdateParams::Schedule::OrHash,
122
+ status: ContextDev::MonitorUpdateParams::Status::OrSymbol,
123
+ tags: T::Array[String],
124
+ target:
125
+ T.any(
126
+ ContextDev::MonitorUpdateParams::Target::Page::OrHash,
127
+ ContextDev::MonitorUpdateParams::Target::Sitemap::OrHash,
128
+ ContextDev::MonitorUpdateParams::Target::Extract::OrHash
129
+ ),
130
+ webhook: T.nilable(ContextDev::MonitorUpdateParams::Webhook::OrHash),
131
+ request_options: ContextDev::RequestOptions::OrHash
132
+ ).returns(T.attached_class)
133
+ end
134
+ def self.new(
135
+ monitor_id:,
136
+ # Discriminated union describing how changes are detected.
137
+ change_detection: nil,
138
+ name: nil,
139
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
140
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
141
+ # between 10 minutes and 1 year.
142
+ schedule: nil,
143
+ status: nil,
144
+ # User-defined tags for grouping and filtering monitors and their changes.
145
+ tags: nil,
146
+ # Discriminated union describing what the monitor watches.
147
+ target: nil,
148
+ # Set to null to remove the webhook.
149
+ webhook: nil,
150
+ request_options: {}
151
+ )
152
+ end
153
+
154
+ sig do
155
+ override.returns(
156
+ {
157
+ monitor_id: String,
158
+ change_detection:
159
+ T.any(
160
+ ContextDev::MonitorUpdateParams::ChangeDetection::Exact,
161
+ ContextDev::MonitorUpdateParams::ChangeDetection::Semantic
162
+ ),
163
+ name: String,
164
+ schedule: ContextDev::MonitorUpdateParams::Schedule,
165
+ status: ContextDev::MonitorUpdateParams::Status::OrSymbol,
166
+ tags: T::Array[String],
167
+ target:
168
+ T.any(
169
+ ContextDev::MonitorUpdateParams::Target::Page,
170
+ ContextDev::MonitorUpdateParams::Target::Sitemap,
171
+ ContextDev::MonitorUpdateParams::Target::Extract
172
+ ),
173
+ webhook: T.nilable(ContextDev::MonitorUpdateParams::Webhook),
174
+ request_options: ContextDev::RequestOptions
175
+ }
176
+ )
177
+ end
178
+ def to_hash
179
+ end
180
+
181
+ # Discriminated union describing how changes are detected.
182
+ module ChangeDetection
183
+ extend ContextDev::Internal::Type::Union
184
+
185
+ Variants =
186
+ T.type_alias do
187
+ T.any(
188
+ ContextDev::MonitorUpdateParams::ChangeDetection::Exact,
189
+ ContextDev::MonitorUpdateParams::ChangeDetection::Semantic
190
+ )
191
+ end
192
+
193
+ class Exact < ContextDev::Internal::Type::BaseModel
194
+ OrHash =
195
+ T.type_alias do
196
+ T.any(
197
+ ContextDev::MonitorUpdateParams::ChangeDetection::Exact,
198
+ ContextDev::Internal::AnyHash
199
+ )
200
+ end
201
+
202
+ sig { returns(Symbol) }
203
+ attr_accessor :type
204
+
205
+ # Detect exact changes. For page targets, this means visible text diffs. For
206
+ # sitemap targets, this means URL additions and removals.
207
+ sig { params(type: Symbol).returns(T.attached_class) }
208
+ def self.new(type: :exact)
209
+ end
210
+
211
+ sig { override.returns({ type: Symbol }) }
212
+ def to_hash
213
+ end
214
+ end
215
+
216
+ class Semantic < ContextDev::Internal::Type::BaseModel
217
+ OrHash =
218
+ T.type_alias do
219
+ T.any(
220
+ ContextDev::MonitorUpdateParams::ChangeDetection::Semantic,
221
+ ContextDev::Internal::AnyHash
222
+ )
223
+ end
224
+
225
+ sig { returns(Symbol) }
226
+ attr_accessor :type
227
+
228
+ sig { returns(T.nilable(Float)) }
229
+ attr_reader :confidence_threshold
230
+
231
+ sig { params(confidence_threshold: Float).void }
232
+ attr_writer :confidence_threshold
233
+
234
+ # Detect meaning-level changes to the extracted data, ignoring cosmetic or
235
+ # paraphrase-only differences. What is watched is determined by the extract
236
+ # target's `schema` and `instructions`.
237
+ sig do
238
+ params(confidence_threshold: Float, type: Symbol).returns(
239
+ T.attached_class
240
+ )
241
+ end
242
+ def self.new(confidence_threshold: nil, type: :semantic)
243
+ end
244
+
245
+ sig do
246
+ override.returns({ type: Symbol, confidence_threshold: Float })
247
+ end
248
+ def to_hash
249
+ end
250
+ end
251
+
252
+ sig do
253
+ override.returns(
254
+ T::Array[ContextDev::MonitorUpdateParams::ChangeDetection::Variants]
255
+ )
256
+ end
257
+ def self.variants
258
+ end
259
+ end
260
+
261
+ class Schedule < ContextDev::Internal::Type::BaseModel
262
+ OrHash =
263
+ T.type_alias do
264
+ T.any(
265
+ ContextDev::MonitorUpdateParams::Schedule,
266
+ ContextDev::Internal::AnyHash
267
+ )
268
+ end
269
+
270
+ # Number of units between runs. The resulting interval (frequency × unit) must be
271
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
272
+ # maximum 365 when unit is days).
273
+ sig { returns(Integer) }
274
+ attr_accessor :frequency
275
+
276
+ sig do
277
+ returns(ContextDev::MonitorUpdateParams::Schedule::Type::OrSymbol)
278
+ end
279
+ attr_accessor :type
280
+
281
+ sig do
282
+ returns(ContextDev::MonitorUpdateParams::Schedule::Unit::OrSymbol)
283
+ end
284
+ attr_accessor :unit
285
+
286
+ # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
287
+ # every 6 hours or every 2 days. The total interval (frequency × unit) must be
288
+ # between 10 minutes and 1 year.
289
+ sig do
290
+ params(
291
+ frequency: Integer,
292
+ type: ContextDev::MonitorUpdateParams::Schedule::Type::OrSymbol,
293
+ unit: ContextDev::MonitorUpdateParams::Schedule::Unit::OrSymbol
294
+ ).returns(T.attached_class)
295
+ end
296
+ def self.new(
297
+ # Number of units between runs. The resulting interval (frequency × unit) must be
298
+ # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
299
+ # maximum 365 when unit is days).
300
+ frequency:,
301
+ type:,
302
+ unit:
303
+ )
304
+ end
305
+
306
+ sig do
307
+ override.returns(
308
+ {
309
+ frequency: Integer,
310
+ type: ContextDev::MonitorUpdateParams::Schedule::Type::OrSymbol,
311
+ unit: ContextDev::MonitorUpdateParams::Schedule::Unit::OrSymbol
312
+ }
313
+ )
314
+ end
315
+ def to_hash
316
+ end
317
+
318
+ module Type
319
+ extend ContextDev::Internal::Type::Enum
320
+
321
+ TaggedSymbol =
322
+ T.type_alias do
323
+ T.all(Symbol, ContextDev::MonitorUpdateParams::Schedule::Type)
324
+ end
325
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
326
+
327
+ INTERVAL =
328
+ T.let(
329
+ :interval,
330
+ ContextDev::MonitorUpdateParams::Schedule::Type::TaggedSymbol
331
+ )
332
+
333
+ sig do
334
+ override.returns(
335
+ T::Array[
336
+ ContextDev::MonitorUpdateParams::Schedule::Type::TaggedSymbol
337
+ ]
338
+ )
339
+ end
340
+ def self.values
341
+ end
342
+ end
343
+
344
+ module Unit
345
+ extend ContextDev::Internal::Type::Enum
346
+
347
+ TaggedSymbol =
348
+ T.type_alias do
349
+ T.all(Symbol, ContextDev::MonitorUpdateParams::Schedule::Unit)
350
+ end
351
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
352
+
353
+ MINUTES =
354
+ T.let(
355
+ :minutes,
356
+ ContextDev::MonitorUpdateParams::Schedule::Unit::TaggedSymbol
357
+ )
358
+ HOURS =
359
+ T.let(
360
+ :hours,
361
+ ContextDev::MonitorUpdateParams::Schedule::Unit::TaggedSymbol
362
+ )
363
+ DAYS =
364
+ T.let(
365
+ :days,
366
+ ContextDev::MonitorUpdateParams::Schedule::Unit::TaggedSymbol
367
+ )
368
+
369
+ sig do
370
+ override.returns(
371
+ T::Array[
372
+ ContextDev::MonitorUpdateParams::Schedule::Unit::TaggedSymbol
373
+ ]
374
+ )
375
+ end
376
+ def self.values
377
+ end
378
+ end
379
+ end
380
+
381
+ module Status
382
+ extend ContextDev::Internal::Type::Enum
383
+
384
+ TaggedSymbol =
385
+ T.type_alias do
386
+ T.all(Symbol, ContextDev::MonitorUpdateParams::Status)
387
+ end
388
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
389
+
390
+ ACTIVE =
391
+ T.let(:active, ContextDev::MonitorUpdateParams::Status::TaggedSymbol)
392
+ PAUSED =
393
+ T.let(:paused, ContextDev::MonitorUpdateParams::Status::TaggedSymbol)
394
+
395
+ sig do
396
+ override.returns(
397
+ T::Array[ContextDev::MonitorUpdateParams::Status::TaggedSymbol]
398
+ )
399
+ end
400
+ def self.values
401
+ end
402
+ end
403
+
404
+ # Discriminated union describing what the monitor watches.
405
+ module Target
406
+ extend ContextDev::Internal::Type::Union
407
+
408
+ Variants =
409
+ T.type_alias do
410
+ T.any(
411
+ ContextDev::MonitorUpdateParams::Target::Page,
412
+ ContextDev::MonitorUpdateParams::Target::Sitemap,
413
+ ContextDev::MonitorUpdateParams::Target::Extract
414
+ )
415
+ end
416
+
417
+ class Page < ContextDev::Internal::Type::BaseModel
418
+ OrHash =
419
+ T.type_alias do
420
+ T.any(
421
+ ContextDev::MonitorUpdateParams::Target::Page,
422
+ ContextDev::Internal::AnyHash
423
+ )
424
+ end
425
+
426
+ sig { returns(Symbol) }
427
+ attr_accessor :type
428
+
429
+ sig { returns(String) }
430
+ attr_accessor :url
431
+
432
+ # Normalize whitespace before comparing or analyzing text.
433
+ sig { returns(T.nilable(T::Boolean)) }
434
+ attr_reader :normalize_whitespace
435
+
436
+ sig { params(normalize_whitespace: T::Boolean).void }
437
+ attr_writer :normalize_whitespace
438
+
439
+ # Watch a single web page.
440
+ sig do
441
+ params(
442
+ url: String,
443
+ normalize_whitespace: T::Boolean,
444
+ type: Symbol
445
+ ).returns(T.attached_class)
446
+ end
447
+ def self.new(
448
+ url:,
449
+ # Normalize whitespace before comparing or analyzing text.
450
+ normalize_whitespace: nil,
451
+ type: :page
452
+ )
453
+ end
454
+
455
+ sig do
456
+ override.returns(
457
+ { type: Symbol, url: String, normalize_whitespace: T::Boolean }
458
+ )
459
+ end
460
+ def to_hash
461
+ end
462
+ end
463
+
464
+ class Sitemap < ContextDev::Internal::Type::BaseModel
465
+ OrHash =
466
+ T.type_alias do
467
+ T.any(
468
+ ContextDev::MonitorUpdateParams::Target::Sitemap,
469
+ ContextDev::Internal::AnyHash
470
+ )
471
+ end
472
+
473
+ sig { returns(Symbol) }
474
+ attr_accessor :type
475
+
476
+ # Sitemap URL to monitor.
477
+ sig { returns(String) }
478
+ attr_accessor :url
479
+
480
+ # URL path patterns to exclude.
481
+ sig { returns(T.nilable(T::Array[String])) }
482
+ attr_reader :exclude
483
+
484
+ sig { params(exclude: T::Array[String]).void }
485
+ attr_writer :exclude
486
+
487
+ # URL path patterns to include.
488
+ sig { returns(T.nilable(T::Array[String])) }
489
+ attr_reader :include
490
+
491
+ sig { params(include: T::Array[String]).void }
492
+ attr_writer :include
493
+
494
+ # Maximum number of sitemap URLs to track (capped at 10,000).
495
+ sig { returns(T.nilable(Integer)) }
496
+ attr_reader :max_urls
497
+
498
+ sig { params(max_urls: Integer).void }
499
+ attr_writer :max_urls
500
+
501
+ # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
502
+ # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
503
+ # and its subdomains before comparison. On a detected difference the sitemap is
504
+ # re-fetched within the same run and only URLs both observations agree on are
505
+ # reported, suppressing transient crawl flaps.
506
+ sig do
507
+ params(
508
+ url: String,
509
+ exclude: T::Array[String],
510
+ include: T::Array[String],
511
+ max_urls: Integer,
512
+ type: Symbol
513
+ ).returns(T.attached_class)
514
+ end
515
+ def self.new(
516
+ # Sitemap URL to monitor.
517
+ url:,
518
+ # URL path patterns to exclude.
519
+ exclude: nil,
520
+ # URL path patterns to include.
521
+ include: nil,
522
+ # Maximum number of sitemap URLs to track (capped at 10,000).
523
+ max_urls: nil,
524
+ type: :sitemap
525
+ )
526
+ end
527
+
528
+ sig do
529
+ override.returns(
530
+ {
531
+ type: Symbol,
532
+ url: String,
533
+ exclude: T::Array[String],
534
+ include: T::Array[String],
535
+ max_urls: Integer
536
+ }
537
+ )
538
+ end
539
+ def to_hash
540
+ end
541
+ end
542
+
543
+ class Extract < ContextDev::Internal::Type::BaseModel
544
+ OrHash =
545
+ T.type_alias do
546
+ T.any(
547
+ ContextDev::MonitorUpdateParams::Target::Extract,
548
+ ContextDev::Internal::AnyHash
549
+ )
550
+ end
551
+
552
+ # Natural-language instructions guiding which pages and facts to track and which
553
+ # changes to report.
554
+ sig { returns(String) }
555
+ attr_accessor :instructions
556
+
557
+ sig { returns(Symbol) }
558
+ attr_accessor :type
559
+
560
+ # Root URL to extract structured data from.
561
+ sig { returns(String) }
562
+ attr_accessor :url
563
+
564
+ sig { returns(T.nilable(T::Boolean)) }
565
+ attr_reader :follow_subdomains
566
+
567
+ sig { params(follow_subdomains: T::Boolean).void }
568
+ attr_writer :follow_subdomains
569
+
570
+ # Optional maximum link depth from the starting URL (0 = only the starting page).
571
+ sig { returns(T.nilable(Integer)) }
572
+ attr_reader :max_depth
573
+
574
+ sig { params(max_depth: Integer).void }
575
+ attr_writer :max_depth
576
+
577
+ # Maximum number of pages to track.
578
+ sig { returns(T.nilable(Integer)) }
579
+ attr_reader :max_pages
580
+
581
+ sig { params(max_pages: Integer).void }
582
+ attr_writer :max_pages
583
+
584
+ # JSON Schema describing the data you care about. It guides which pages are
585
+ # selected for tracking and gives the change judge context on what matters. If
586
+ # omitted, a default summary + key-points schema is used.
587
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
588
+ attr_reader :schema
589
+
590
+ sig { params(schema: T::Hash[Symbol, T.anything]).void }
591
+ attr_writer :schema
592
+
593
+ # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
594
+ # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
595
+ # track; each run re-checks exactly those pages, and confirmed content changes are
596
+ # judged against the monitor's instructions. The tracked page set is refreshed by
597
+ # a periodic re-discovery crawl.
598
+ sig do
599
+ params(
600
+ instructions: String,
601
+ url: String,
602
+ follow_subdomains: T::Boolean,
603
+ max_depth: Integer,
604
+ max_pages: Integer,
605
+ schema: T::Hash[Symbol, T.anything],
606
+ type: Symbol
607
+ ).returns(T.attached_class)
608
+ end
609
+ def self.new(
610
+ # Natural-language instructions guiding which pages and facts to track and which
611
+ # changes to report.
612
+ instructions:,
613
+ # Root URL to extract structured data from.
614
+ url:,
615
+ follow_subdomains: nil,
616
+ # Optional maximum link depth from the starting URL (0 = only the starting page).
617
+ max_depth: nil,
618
+ # Maximum number of pages to track.
619
+ max_pages: nil,
620
+ # JSON Schema describing the data you care about. It guides which pages are
621
+ # selected for tracking and gives the change judge context on what matters. If
622
+ # omitted, a default summary + key-points schema is used.
623
+ schema: nil,
624
+ type: :extract
625
+ )
626
+ end
627
+
628
+ sig do
629
+ override.returns(
630
+ {
631
+ instructions: String,
632
+ type: Symbol,
633
+ url: String,
634
+ follow_subdomains: T::Boolean,
635
+ max_depth: Integer,
636
+ max_pages: Integer,
637
+ schema: T::Hash[Symbol, T.anything]
638
+ }
639
+ )
640
+ end
641
+ def to_hash
642
+ end
643
+ end
644
+
645
+ sig do
646
+ override.returns(
647
+ T::Array[ContextDev::MonitorUpdateParams::Target::Variants]
648
+ )
649
+ end
650
+ def self.variants
651
+ end
652
+ end
653
+
654
+ class Webhook < ContextDev::Internal::Type::BaseModel
655
+ OrHash =
656
+ T.type_alias do
657
+ T.any(
658
+ ContextDev::MonitorUpdateParams::Webhook,
659
+ ContextDev::Internal::AnyHash
660
+ )
661
+ end
662
+
663
+ # Webhook URL called when a change is detected.
664
+ sig { returns(String) }
665
+ attr_accessor :url
666
+
667
+ # Set to null to remove the webhook.
668
+ sig { params(url: String).returns(T.attached_class) }
669
+ def self.new(
670
+ # Webhook URL called when a change is detected.
671
+ url:
672
+ )
673
+ end
674
+
675
+ sig { override.returns({ url: String, secret: String }) }
676
+ def to_hash
677
+ end
678
+ end
679
+ end
680
+ end
681
+ end