context.dev 2.21.0 → 2.22.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 (229) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +4 -9
  5. data/lib/context_dev/models/batch_cancel_params.rb +2 -2
  6. data/lib/context_dev/models/batch_cancel_response.rb +16 -21
  7. data/lib/context_dev/models/batch_delete_params.rb +2 -2
  8. data/lib/context_dev/models/batch_delete_response.rb +8 -8
  9. data/lib/context_dev/models/batch_get_results_params.rb +2 -2
  10. data/lib/context_dev/models/batch_get_results_response.rb +17 -22
  11. data/lib/context_dev/models/batch_list_response.rb +38 -47
  12. data/lib/context_dev/models/batch_retrieve_params.rb +2 -2
  13. data/lib/context_dev/models/batch_retrieve_response.rb +37 -46
  14. data/lib/context_dev/models/batch_submit_params.rb +80 -109
  15. data/lib/context_dev/models/batch_submit_response.rb +18 -28
  16. data/lib/context_dev/models/brand_retrieve_params.rb +90 -149
  17. data/lib/context_dev/models/brand_retrieve_response.rb +18 -22
  18. data/lib/context_dev/models/brand_search_params.rb +2 -3
  19. data/lib/context_dev/models/brand_search_response.rb +8 -8
  20. data/lib/context_dev/models/crawl_controls.rb +1 -2
  21. data/lib/context_dev/models/feedback_submit_params.rb +2 -2
  22. data/lib/context_dev/models/feedback_submit_response.rb +8 -8
  23. data/lib/context_dev/models/industry_retrieve_naics_params.rb +17 -32
  24. data/lib/context_dev/models/industry_retrieve_naics_response.rb +10 -10
  25. data/lib/context_dev/models/industry_retrieve_sic_params.rb +20 -39
  26. data/lib/context_dev/models/industry_retrieve_sic_response.rb +10 -10
  27. data/lib/context_dev/models/intake.rb +7 -13
  28. data/lib/context_dev/models/log_list_response.rb +14 -10
  29. data/lib/context_dev/models/log_retrieve_response.rb +15 -41
  30. data/lib/context_dev/models/monitor_create_params.rb +238 -72
  31. data/lib/context_dev/models/monitor_create_response.rb +364 -175
  32. data/lib/context_dev/models/monitor_delete_params.rb +3 -1
  33. data/lib/context_dev/models/monitor_delete_response.rb +44 -1
  34. data/lib/context_dev/models/monitor_get_credit_usage_response.rb +43 -1
  35. data/lib/context_dev/models/monitor_get_limits_response.rb +47 -7
  36. data/lib/context_dev/models/monitor_list_account_changes_response.rb +143 -20
  37. data/lib/context_dev/models/monitor_list_account_runs_response.rb +50 -8
  38. data/lib/context_dev/models/monitor_list_changes_params.rb +2 -1
  39. data/lib/context_dev/models/monitor_list_changes_response.rb +143 -20
  40. data/lib/context_dev/models/monitor_list_params.rb +3 -3
  41. data/lib/context_dev/models/monitor_list_response.rb +304 -106
  42. data/lib/context_dev/models/monitor_list_runs_params.rb +2 -1
  43. data/lib/context_dev/models/monitor_list_runs_response.rb +50 -8
  44. data/lib/context_dev/models/monitor_retrieve_change_params.rb +3 -1
  45. data/lib/context_dev/models/monitor_retrieve_change_response.rb +45 -15
  46. data/lib/context_dev/models/monitor_retrieve_params.rb +3 -1
  47. data/lib/context_dev/models/monitor_retrieve_response.rb +361 -171
  48. data/lib/context_dev/models/monitor_retrieve_run_params.rb +6 -2
  49. data/lib/context_dev/models/monitor_retrieve_run_response.rb +45 -8
  50. data/lib/context_dev/models/monitor_rotate_webhook_secret_params.rb +3 -1
  51. data/lib/context_dev/models/monitor_rotate_webhook_secret_response.rb +364 -172
  52. data/lib/context_dev/models/monitor_run_params.rb +3 -1
  53. data/lib/context_dev/models/monitor_run_response.rb +42 -4
  54. data/lib/context_dev/models/monitor_update_params.rb +239 -71
  55. data/lib/context_dev/models/monitor_update_response.rb +361 -171
  56. data/lib/context_dev/models/news_search_params.rb +10 -6
  57. data/lib/context_dev/models/news_search_response.rb +8 -8
  58. data/lib/context_dev/models/parse_handle_params.rb +9 -20
  59. data/lib/context_dev/models/parse_handle_response.rb +8 -8
  60. data/lib/context_dev/models/person_enrich_params.rb +76 -50
  61. data/lib/context_dev/models/person_enrich_response.rb +8 -8
  62. data/lib/context_dev/models/utility_prefetch_params.rb +15 -29
  63. data/lib/context_dev/models/utility_prefetch_response.rb +10 -10
  64. data/lib/context_dev/models/web_answers_params.rb +28 -47
  65. data/lib/context_dev/models/web_answers_response.rb +9 -8
  66. data/lib/context_dev/models/web_extract_competitors_params.rb +17 -32
  67. data/lib/context_dev/models/web_extract_competitors_response.rb +8 -8
  68. data/lib/context_dev/models/web_extract_styleguide_params.rb +22 -44
  69. data/lib/context_dev/models/web_extract_styleguide_response.rb +34 -44
  70. data/lib/context_dev/models/web_map_urls_params.rb +30 -51
  71. data/lib/context_dev/models/web_map_urls_response.rb +8 -8
  72. data/lib/context_dev/models/web_scrape_params.rb +193 -191
  73. data/lib/context_dev/models/web_scrape_response.rb +219 -95
  74. data/lib/context_dev/models/web_screenshot_params.rb +20 -39
  75. data/lib/context_dev/models/web_screenshot_response.rb +18 -28
  76. data/lib/context_dev/models/web_search_params.rb +76 -65
  77. data/lib/context_dev/models/web_search_response.rb +68 -27
  78. data/lib/context_dev/models/web_web_crawl_md_params.rb +41 -70
  79. data/lib/context_dev/models/web_web_crawl_md_response.rb +11 -15
  80. data/lib/context_dev/models/webhook_delivery.rb +3 -7
  81. data/lib/context_dev/models/webhooks/attempt.rb +3 -3
  82. data/lib/context_dev/models/webhooks/delivery.rb +16 -11
  83. data/lib/context_dev/models/webhooks/delivery_list_attempts_params.rb +2 -6
  84. data/lib/context_dev/models/webhooks/delivery_list_attempts_response.rb +8 -8
  85. data/lib/context_dev/models/webhooks/delivery_list_params.rb +4 -4
  86. data/lib/context_dev/models/webhooks/delivery_list_response.rb +8 -8
  87. data/lib/context_dev/models/webhooks/delivery_retrieve_params.rb +2 -6
  88. data/lib/context_dev/models/webhooks/delivery_retrieve_response.rb +8 -8
  89. data/lib/context_dev/models/webhooks/delivery_retry_params.rb +4 -4
  90. data/lib/context_dev/models/webhooks/delivery_retry_response.rb +8 -8
  91. data/lib/context_dev/models/webhooks/delivery_summary.rb +16 -11
  92. data/lib/context_dev/resources/batch.rb +17 -16
  93. data/lib/context_dev/resources/brand.rb +6 -8
  94. data/lib/context_dev/resources/feedback.rb +4 -5
  95. data/lib/context_dev/resources/industry.rb +9 -11
  96. data/lib/context_dev/resources/logs.rb +4 -5
  97. data/lib/context_dev/resources/monitors.rb +50 -53
  98. data/lib/context_dev/resources/news.rb +4 -8
  99. data/lib/context_dev/resources/parse.rb +4 -5
  100. data/lib/context_dev/resources/people.rb +11 -13
  101. data/lib/context_dev/resources/utility.rb +4 -11
  102. data/lib/context_dev/resources/web.rb +69 -94
  103. data/lib/context_dev/resources/webhooks/deliveries.rb +10 -18
  104. data/lib/context_dev/resources/webhooks.rb +1 -1
  105. data/lib/context_dev/version.rb +1 -1
  106. data/rbi/context_dev/client.rbi +4 -9
  107. data/rbi/context_dev/models/batch_cancel_params.rbi +2 -2
  108. data/rbi/context_dev/models/batch_cancel_response.rbi +17 -21
  109. data/rbi/context_dev/models/batch_delete_params.rbi +2 -2
  110. data/rbi/context_dev/models/batch_delete_response.rbi +9 -9
  111. data/rbi/context_dev/models/batch_get_results_params.rbi +2 -2
  112. data/rbi/context_dev/models/batch_get_results_response.rbi +18 -26
  113. data/rbi/context_dev/models/batch_list_response.rbi +41 -53
  114. data/rbi/context_dev/models/batch_retrieve_params.rbi +2 -2
  115. data/rbi/context_dev/models/batch_retrieve_response.rbi +40 -52
  116. data/rbi/context_dev/models/batch_submit_params.rbi +87 -147
  117. data/rbi/context_dev/models/batch_submit_response.rbi +19 -31
  118. data/rbi/context_dev/models/brand_retrieve_params.rbi +99 -190
  119. data/rbi/context_dev/models/brand_retrieve_response.rbi +19 -25
  120. data/rbi/context_dev/models/brand_search_params.rbi +2 -4
  121. data/rbi/context_dev/models/brand_search_response.rbi +9 -9
  122. data/rbi/context_dev/models/crawl_controls.rbi +1 -2
  123. data/rbi/context_dev/models/feedback_submit_params.rbi +2 -2
  124. data/rbi/context_dev/models/feedback_submit_response.rbi +9 -9
  125. data/rbi/context_dev/models/industry_retrieve_naics_params.rbi +19 -42
  126. data/rbi/context_dev/models/industry_retrieve_naics_response.rbi +11 -11
  127. data/rbi/context_dev/models/industry_retrieve_sic_params.rbi +22 -51
  128. data/rbi/context_dev/models/industry_retrieve_sic_response.rbi +11 -11
  129. data/rbi/context_dev/models/intake.rbi +7 -19
  130. data/rbi/context_dev/models/log_list_response.rbi +13 -11
  131. data/rbi/context_dev/models/log_retrieve_response.rbi +13 -76
  132. data/rbi/context_dev/models/monitor_create_params.rbi +418 -78
  133. data/rbi/context_dev/models/monitor_create_response.rbi +654 -287
  134. data/rbi/context_dev/models/monitor_delete_params.rbi +6 -1
  135. data/rbi/context_dev/models/monitor_delete_response.rbi +89 -3
  136. data/rbi/context_dev/models/monitor_get_credit_usage_response.rbi +77 -3
  137. data/rbi/context_dev/models/monitor_get_limits_response.rbi +83 -10
  138. data/rbi/context_dev/models/monitor_list_account_changes_response.rbi +236 -24
  139. data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +86 -12
  140. data/rbi/context_dev/models/monitor_list_changes_params.rbi +2 -0
  141. data/rbi/context_dev/models/monitor_list_changes_response.rbi +234 -24
  142. data/rbi/context_dev/models/monitor_list_params.rbi +4 -4
  143. data/rbi/context_dev/models/monitor_list_response.rbi +502 -130
  144. data/rbi/context_dev/models/monitor_list_runs_params.rbi +2 -0
  145. data/rbi/context_dev/models/monitor_list_runs_response.rbi +84 -12
  146. data/rbi/context_dev/models/monitor_retrieve_change_params.rbi +6 -1
  147. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +79 -15
  148. data/rbi/context_dev/models/monitor_retrieve_params.rbi +6 -1
  149. data/rbi/context_dev/models/monitor_retrieve_response.rbi +654 -283
  150. data/rbi/context_dev/models/monitor_retrieve_run_params.rbi +9 -1
  151. data/rbi/context_dev/models/monitor_retrieve_run_response.rbi +77 -9
  152. data/rbi/context_dev/models/monitor_rotate_webhook_secret_params.rbi +6 -1
  153. data/rbi/context_dev/models/monitor_rotate_webhook_secret_response.rbi +659 -288
  154. data/rbi/context_dev/models/monitor_run_params.rbi +6 -1
  155. data/rbi/context_dev/models/monitor_run_response.rbi +82 -9
  156. data/rbi/context_dev/models/monitor_update_params.rbi +420 -75
  157. data/rbi/context_dev/models/monitor_update_response.rbi +650 -281
  158. data/rbi/context_dev/models/news_search_params.rbi +10 -2
  159. data/rbi/context_dev/models/news_search_response.rbi +9 -9
  160. data/rbi/context_dev/models/parse_handle_params.rbi +10 -29
  161. data/rbi/context_dev/models/parse_handle_response.rbi +9 -9
  162. data/rbi/context_dev/models/person_enrich_params.rbi +86 -44
  163. data/rbi/context_dev/models/person_enrich_response.rbi +9 -9
  164. data/rbi/context_dev/models/utility_prefetch_params.rbi +15 -27
  165. data/rbi/context_dev/models/utility_prefetch_response.rbi +11 -11
  166. data/rbi/context_dev/models/web_answers_params.rbi +33 -63
  167. data/rbi/context_dev/models/web_answers_response.rbi +11 -9
  168. data/rbi/context_dev/models/web_extract_competitors_params.rbi +19 -42
  169. data/rbi/context_dev/models/web_extract_competitors_response.rbi +9 -9
  170. data/rbi/context_dev/models/web_extract_styleguide_params.rbi +25 -61
  171. data/rbi/context_dev/models/web_extract_styleguide_response.rbi +36 -51
  172. data/rbi/context_dev/models/web_map_urls_params.rbi +33 -68
  173. data/rbi/context_dev/models/web_map_urls_response.rbi +9 -9
  174. data/rbi/context_dev/models/web_scrape_params.rbi +212 -206
  175. data/rbi/context_dev/models/web_scrape_response.rbi +296 -120
  176. data/rbi/context_dev/models/web_screenshot_params.rbi +22 -51
  177. data/rbi/context_dev/models/web_screenshot_response.rbi +20 -35
  178. data/rbi/context_dev/models/web_search_params.rbi +114 -82
  179. data/rbi/context_dev/models/web_search_response.rbi +145 -33
  180. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +45 -95
  181. data/rbi/context_dev/models/web_web_crawl_md_response.rbi +12 -18
  182. data/rbi/context_dev/models/webhook_delivery.rbi +3 -9
  183. data/rbi/context_dev/models/webhooks/attempt.rbi +3 -3
  184. data/rbi/context_dev/models/webhooks/delivery.rbi +14 -11
  185. data/rbi/context_dev/models/webhooks/delivery_list_attempts_params.rbi +2 -4
  186. data/rbi/context_dev/models/webhooks/delivery_list_attempts_response.rbi +9 -9
  187. data/rbi/context_dev/models/webhooks/delivery_list_params.rbi +4 -4
  188. data/rbi/context_dev/models/webhooks/delivery_list_response.rbi +9 -9
  189. data/rbi/context_dev/models/webhooks/delivery_retrieve_params.rbi +2 -4
  190. data/rbi/context_dev/models/webhooks/delivery_retrieve_response.rbi +9 -9
  191. data/rbi/context_dev/models/webhooks/delivery_retry_params.rbi +4 -4
  192. data/rbi/context_dev/models/webhooks/delivery_retry_response.rbi +9 -9
  193. data/rbi/context_dev/models/webhooks/delivery_summary.rbi +14 -11
  194. data/rbi/context_dev/resources/batch.rbi +19 -18
  195. data/rbi/context_dev/resources/brand.rbi +6 -9
  196. data/rbi/context_dev/resources/feedback.rbi +4 -5
  197. data/rbi/context_dev/resources/industry.rbi +11 -27
  198. data/rbi/context_dev/resources/logs.rbi +4 -5
  199. data/rbi/context_dev/resources/monitors.rbi +71 -49
  200. data/rbi/context_dev/resources/news.rbi +4 -8
  201. data/rbi/context_dev/resources/parse.rbi +7 -14
  202. data/rbi/context_dev/resources/people.rbi +15 -13
  203. data/rbi/context_dev/resources/utility.rbi +4 -11
  204. data/rbi/context_dev/resources/web.rbi +89 -190
  205. data/rbi/context_dev/resources/webhooks/deliveries.rbi +10 -12
  206. data/rbi/context_dev/resources/webhooks.rbi +1 -1
  207. data/sig/context_dev/models/log_retrieve_response.rbs +0 -28
  208. data/sig/context_dev/models/monitor_create_params.rbs +113 -0
  209. data/sig/context_dev/models/monitor_create_response.rbs +203 -53
  210. data/sig/context_dev/models/monitor_delete_response.rbs +46 -3
  211. data/sig/context_dev/models/monitor_get_credit_usage_response.rbs +36 -3
  212. data/sig/context_dev/models/monitor_get_limits_response.rbs +36 -3
  213. data/sig/context_dev/models/monitor_list_account_changes_response.rbs +111 -8
  214. data/sig/context_dev/models/monitor_list_account_runs_response.rbs +36 -3
  215. data/sig/context_dev/models/monitor_list_changes_response.rbs +111 -8
  216. data/sig/context_dev/models/monitor_list_response.rbs +149 -3
  217. data/sig/context_dev/models/monitor_list_runs_response.rbs +36 -3
  218. data/sig/context_dev/models/monitor_retrieve_change_response.rbs +33 -0
  219. data/sig/context_dev/models/monitor_retrieve_response.rbs +203 -53
  220. data/sig/context_dev/models/monitor_retrieve_run_response.rbs +33 -0
  221. data/sig/context_dev/models/monitor_rotate_webhook_secret_response.rbs +203 -53
  222. data/sig/context_dev/models/monitor_run_response.rbs +48 -3
  223. data/sig/context_dev/models/monitor_update_params.rbs +113 -0
  224. data/sig/context_dev/models/monitor_update_response.rbs +203 -53
  225. data/sig/context_dev/models/web_scrape_response.rbs +204 -27
  226. data/sig/context_dev/models/web_search_params.rbs +25 -0
  227. data/sig/context_dev/models/web_search_response.rbs +48 -0
  228. data/sig/context_dev/resources/web.rbs +1 -0
  229. metadata +2 -2
@@ -20,14 +20,45 @@ module ContextDev
20
20
  sig { returns(T.nilable(String)) }
21
21
  attr_accessor :next_cursor
22
22
 
23
+ # Unique ID of this request, also in `X-Request-Id`. Include it when contacting
24
+ # support.
25
+ sig { returns(String) }
26
+ attr_accessor :request_id
27
+
28
+ # Credits this request used and your remaining balance.
29
+ sig do
30
+ returns(T.nilable(ContextDev::Models::MonitorListResponse::KeyMetadata))
31
+ end
32
+ attr_reader :key_metadata
33
+
34
+ sig do
35
+ params(
36
+ key_metadata:
37
+ ContextDev::Models::MonitorListResponse::KeyMetadata::OrHash
38
+ ).void
39
+ end
40
+ attr_writer :key_metadata
41
+
23
42
  sig do
24
43
  params(
25
44
  data: T::Array[ContextDev::Models::MonitorListResponse::Data::OrHash],
26
45
  has_more: T::Boolean,
27
- next_cursor: T.nilable(String)
46
+ next_cursor: T.nilable(String),
47
+ request_id: String,
48
+ key_metadata:
49
+ ContextDev::Models::MonitorListResponse::KeyMetadata::OrHash
28
50
  ).returns(T.attached_class)
29
51
  end
30
- def self.new(data:, has_more:, next_cursor:)
52
+ def self.new(
53
+ data:,
54
+ has_more:,
55
+ next_cursor:,
56
+ # Unique ID of this request, also in `X-Request-Id`. Include it when contacting
57
+ # support.
58
+ request_id:,
59
+ # Credits this request used and your remaining balance.
60
+ key_metadata: nil
61
+ )
31
62
  end
32
63
 
33
64
  sig do
@@ -35,7 +66,9 @@ module ContextDev
35
66
  {
36
67
  data: T::Array[ContextDev::Models::MonitorListResponse::Data],
37
68
  has_more: T::Boolean,
38
- next_cursor: T.nilable(String)
69
+ next_cursor: T.nilable(String),
70
+ request_id: String,
71
+ key_metadata: ContextDev::Models::MonitorListResponse::KeyMetadata
39
72
  }
40
73
  )
41
74
  end
@@ -54,7 +87,8 @@ module ContextDev
54
87
  sig { returns(String) }
55
88
  attr_accessor :id
56
89
 
57
- # Discriminated union describing how changes are detected.
90
+ # How changes are judged. Defaults to `semantic` for extract targets and page
91
+ # targets with `instructions`, otherwise `exact`.
58
92
  sig do
59
93
  returns(
60
94
  ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Variants
@@ -65,8 +99,7 @@ module ContextDev
65
99
  sig { returns(Time) }
66
100
  attr_accessor :created_at
67
101
 
68
- # Top-level monitor category. Always `web` today; the concrete behavior is
69
- # described by `target` and `change_detection`.
102
+ # Always `web`. Optional.
70
103
  sig do
71
104
  returns(
72
105
  ContextDev::Models::MonitorListResponse::Data::Mode::TaggedSymbol
@@ -91,11 +124,8 @@ module ContextDev
91
124
  end
92
125
  attr_writer :schedule
93
126
 
94
- # Monitor lifecycle status. `failed` means the most recent run failed (see the
95
- # monitor's `last_error`); failed monitors keep running on schedule and flip back
96
- # to `active` on the next successful run. Monitors are auto-`paused` after
97
- # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
98
- # status to `active`.
127
+ # Current state. Failed monitors keep running; paused monitors must be resumed
128
+ # with `status: "active"`.
99
129
  sig do
100
130
  returns(
101
131
  ContextDev::Models::MonitorListResponse::Data::Status::TaggedSymbol
@@ -103,7 +133,7 @@ module ContextDev
103
133
  end
104
134
  attr_accessor :status
105
135
 
106
- # Discriminated union describing what the monitor watches.
136
+ # What to watch: a page, a sitemap, or data extracted from a site.
107
137
  sig do
108
138
  returns(
109
139
  ContextDev::Models::MonitorListResponse::Data::Target::Variants
@@ -114,10 +144,8 @@ module ContextDev
114
144
  sig { returns(Time) }
115
145
  attr_accessor :updated_at
116
146
 
117
- # Current baseline: the last observed value the monitor compares new snapshots
118
- # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
119
- # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
120
- # after a target or change_detection update, which resets the baseline).
147
+ # Comparison baseline, included on Retrieve. Null until capture completes or after
148
+ # target changes.
121
149
  sig do
122
150
  returns(
123
151
  T.nilable(
@@ -151,18 +179,18 @@ module ContextDev
151
179
  sig { returns(T.nilable(Time)) }
152
180
  attr_accessor :last_run_at
153
181
 
154
- # When the next scheduled run is due.
182
+ # When the next scheduled run is due; null while paused.
155
183
  sig { returns(T.nilable(Time)) }
156
184
  attr_accessor :next_run_at
157
185
 
158
- # User-defined tags for grouping and filtering monitors and their changes.
159
- # Duplicates are removed.
186
+ # Labels for filtering monitors, their changes, and their usage.
160
187
  sig { returns(T.nilable(T::Array[String])) }
161
188
  attr_reader :tags
162
189
 
163
190
  sig { params(tags: T::Array[String]).void }
164
191
  attr_writer :tags
165
192
 
193
+ # Webhook destination and delivery settings. Null means no webhook is configured.
166
194
  sig do
167
195
  returns(
168
196
  T.nilable(ContextDev::Models::MonitorListResponse::Data::Webhook)
@@ -254,40 +282,35 @@ module ContextDev
254
282
  end
255
283
  def self.new(
256
284
  id:,
257
- # Discriminated union describing how changes are detected.
285
+ # How changes are judged. Defaults to `semantic` for extract targets and page
286
+ # targets with `instructions`, otherwise `exact`.
258
287
  change_detection:,
259
288
  created_at:,
260
- # Top-level monitor category. Always `web` today; the concrete behavior is
261
- # described by `target` and `change_detection`.
289
+ # Always `web`. Optional.
262
290
  mode:,
263
291
  name:,
264
292
  # Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
265
293
  # every 6 hours or every 2 days. The total interval (frequency × unit) must be
266
294
  # between 10 minutes and 1 year.
267
295
  schedule:,
268
- # Monitor lifecycle status. `failed` means the most recent run failed (see the
269
- # monitor's `last_error`); failed monitors keep running on schedule and flip back
270
- # to `active` on the next successful run. Monitors are auto-`paused` after
271
- # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
272
- # status to `active`.
296
+ # Current state. Failed monitors keep running; paused monitors must be resumed
297
+ # with `status: "active"`.
273
298
  status:,
274
- # Discriminated union describing what the monitor watches.
299
+ # What to watch: a page, a sitemap, or data extracted from a site.
275
300
  target:,
276
301
  updated_at:,
277
- # Current baseline: the last observed value the monitor compares new snapshots
278
- # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
279
- # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
280
- # after a target or change_detection update, which resets the baseline).
302
+ # Comparison baseline, included on Retrieve. Null until capture completes or after
303
+ # target changes.
281
304
  baseline: nil,
282
305
  last_change_at: nil,
283
306
  # Error from the most recent failed run; null when the last run succeeded.
284
307
  last_error: nil,
285
308
  last_run_at: nil,
286
- # When the next scheduled run is due.
309
+ # When the next scheduled run is due; null while paused.
287
310
  next_run_at: nil,
288
- # User-defined tags for grouping and filtering monitors and their changes.
289
- # Duplicates are removed.
311
+ # Labels for filtering monitors, their changes, and their usage.
290
312
  tags: nil,
313
+ # Webhook destination and delivery settings. Null means no webhook is configured.
291
314
  webhook: nil,
292
315
  # Present while webhook deliveries are failing consecutively; null when deliveries
293
316
  # are healthy or no webhook is configured. Cleared on the next successful delivery
@@ -338,7 +361,8 @@ module ContextDev
338
361
  def to_hash
339
362
  end
340
363
 
341
- # Discriminated union describing how changes are detected.
364
+ # How changes are judged. Defaults to `semantic` for extract targets and page
365
+ # targets with `instructions`, otherwise `exact`.
342
366
  module ChangeDetection
343
367
  extend ContextDev::Internal::Type::Union
344
368
 
@@ -359,13 +383,17 @@ module ContextDev
359
383
  )
360
384
  end
361
385
 
386
+ # Use `exact` to compare visible text or sitemap URLs.
362
387
  sig { returns(Symbol) }
363
388
  attr_accessor :type
364
389
 
365
390
  # Detect exact changes. For page targets, this means visible text diffs. For
366
391
  # sitemap targets, this means URL additions and removals.
367
392
  sig { params(type: Symbol).returns(T.attached_class) }
368
- def self.new(type: :exact)
393
+ def self.new(
394
+ # Use `exact` to compare visible text or sitemap URLs.
395
+ type: :exact
396
+ )
369
397
  end
370
398
 
371
399
  sig { override.returns({ type: Symbol }) }
@@ -382,25 +410,30 @@ module ContextDev
382
410
  )
383
411
  end
384
412
 
413
+ # Use `semantic` to judge changes against the target instructions.
385
414
  sig { returns(Symbol) }
386
415
  attr_accessor :type
387
416
 
417
+ # Minimum confidence required to report a meaningful change, from 0 to 1.
388
418
  sig { returns(T.nilable(Float)) }
389
419
  attr_reader :confidence_threshold
390
420
 
391
421
  sig { params(confidence_threshold: Float).void }
392
422
  attr_writer :confidence_threshold
393
423
 
394
- # Detect meaning-level changes to page content, ignoring cosmetic or
395
- # instruction-irrelevant differences. Which changes are meaningful is judged
396
- # against the page or extract target's `instructions` (and an extract target's
397
- # `schema`, when provided).
424
+ # Detect meaningful content changes using the target’s instructions and optional
425
+ # schema.
398
426
  sig do
399
427
  params(confidence_threshold: Float, type: Symbol).returns(
400
428
  T.attached_class
401
429
  )
402
430
  end
403
- def self.new(confidence_threshold: nil, type: :semantic)
431
+ def self.new(
432
+ # Minimum confidence required to report a meaningful change, from 0 to 1.
433
+ confidence_threshold: nil,
434
+ # Use `semantic` to judge changes against the target instructions.
435
+ type: :semantic
436
+ )
404
437
  end
405
438
 
406
439
  sig do
@@ -421,8 +454,7 @@ module ContextDev
421
454
  end
422
455
  end
423
456
 
424
- # Top-level monitor category. Always `web` today; the concrete behavior is
425
- # described by `target` and `change_detection`.
457
+ # Always `web`. Optional.
426
458
  module Mode
427
459
  extend ContextDev::Internal::Type::Enum
428
460
 
@@ -464,6 +496,7 @@ module ContextDev
464
496
  sig { returns(Integer) }
465
497
  attr_accessor :frequency
466
498
 
499
+ # Use `interval` to run on a repeating schedule.
467
500
  sig do
468
501
  returns(
469
502
  ContextDev::Models::MonitorListResponse::Data::Schedule::Type::TaggedSymbol
@@ -471,6 +504,7 @@ module ContextDev
471
504
  end
472
505
  attr_accessor :type
473
506
 
507
+ # Time unit used with `frequency` to set the run interval.
474
508
  sig do
475
509
  returns(
476
510
  ContextDev::Models::MonitorListResponse::Data::Schedule::Unit::TaggedSymbol
@@ -495,7 +529,9 @@ module ContextDev
495
529
  # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
496
530
  # maximum 365 when unit is days).
497
531
  frequency:,
532
+ # Use `interval` to run on a repeating schedule.
498
533
  type:,
534
+ # Time unit used with `frequency` to set the run interval.
499
535
  unit:
500
536
  )
501
537
  end
@@ -514,6 +550,7 @@ module ContextDev
514
550
  def to_hash
515
551
  end
516
552
 
553
+ # Use `interval` to run on a repeating schedule.
517
554
  module Type
518
555
  extend ContextDev::Internal::Type::Enum
519
556
 
@@ -543,6 +580,7 @@ module ContextDev
543
580
  end
544
581
  end
545
582
 
583
+ # Time unit used with `frequency` to set the run interval.
546
584
  module Unit
547
585
  extend ContextDev::Internal::Type::Enum
548
586
 
@@ -583,11 +621,8 @@ module ContextDev
583
621
  end
584
622
  end
585
623
 
586
- # Monitor lifecycle status. `failed` means the most recent run failed (see the
587
- # monitor's `last_error`); failed monitors keep running on schedule and flip back
588
- # to `active` on the next successful run. Monitors are auto-`paused` after
589
- # repeated consecutive failures or insufficient-credit skips; resume by PATCHing
590
- # status to `active`.
624
+ # Current state. Failed monitors keep running; paused monitors must be resumed
625
+ # with `status: "active"`.
591
626
  module Status
592
627
  extend ContextDev::Internal::Type::Enum
593
628
 
@@ -627,7 +662,7 @@ module ContextDev
627
662
  end
628
663
  end
629
664
 
630
- # Discriminated union describing what the monitor watches.
665
+ # What to watch: a page, a sitemap, or data extracted from a site.
631
666
  module Target
632
667
  extend ContextDev::Internal::Type::Union
633
668
 
@@ -649,27 +684,37 @@ module ContextDev
649
684
  )
650
685
  end
651
686
 
687
+ # Use `page` to watch one web page.
652
688
  sig { returns(Symbol) }
653
689
  attr_accessor :type
654
690
 
691
+ # Public HTTP(S) page URL to monitor.
655
692
  sig { returns(String) }
656
693
  attr_accessor :url
657
694
 
658
- # CSS selectors for HTML regions to remove before text extraction. Applied after
659
- # include_selectors; exclusion takes precedence when an element matches both. Omit
660
- # or pass an empty array to apply no explicit exclusions. Changing these selectors
661
- # creates a new baseline.
695
+ # Optional browser actions executed in array order after the page loads, before
696
+ # content is captured, on every run. Requires a paid plan. Maximum: 5 actions.
697
+ # Changes create a new baseline.
698
+ sig do
699
+ returns(
700
+ T.nilable(
701
+ T::Array[
702
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Variants
703
+ ]
704
+ )
705
+ )
706
+ end
707
+ attr_accessor :actions
708
+
709
+ # Remove matching regions after inclusions. Changes create a new baseline.
662
710
  sig { returns(T.nilable(T::Array[String])) }
663
711
  attr_reader :exclude_selectors
664
712
 
665
713
  sig { params(exclude_selectors: T::Array[String]).void }
666
714
  attr_writer :exclude_selectors
667
715
 
668
- # CSS selectors defining the HTML regions to monitor. Matching subtrees are
669
- # combined in document order before text extraction, instead of automatic
670
- # main-content selection. Omit or pass an empty array to use automatic
671
- # main-content extraction. If the filtered page has no usable text, the run fails
672
- # without replacing the baseline. Changing these selectors creates a new baseline.
716
+ # Monitor these CSS-selected regions. Empty or omitted uses main content. Changes
717
+ # create a new baseline.
673
718
  sig { returns(T.nilable(T::Array[String])) }
674
719
  attr_reader :include_selectors
675
720
 
@@ -696,6 +741,16 @@ module ContextDev
696
741
  sig do
697
742
  params(
698
743
  url: String,
744
+ actions:
745
+ T.nilable(
746
+ T::Array[
747
+ T.any(
748
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Wait::OrHash,
749
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Perform::OrHash,
750
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::OrHash
751
+ )
752
+ ]
753
+ ),
699
754
  exclude_selectors: T::Array[String],
700
755
  include_selectors: T::Array[String],
701
756
  instructions: String,
@@ -704,23 +759,23 @@ module ContextDev
704
759
  ).returns(T.attached_class)
705
760
  end
706
761
  def self.new(
762
+ # Public HTTP(S) page URL to monitor.
707
763
  url:,
708
- # CSS selectors for HTML regions to remove before text extraction. Applied after
709
- # include_selectors; exclusion takes precedence when an element matches both. Omit
710
- # or pass an empty array to apply no explicit exclusions. Changing these selectors
711
- # creates a new baseline.
764
+ # Optional browser actions executed in array order after the page loads, before
765
+ # content is captured, on every run. Requires a paid plan. Maximum: 5 actions.
766
+ # Changes create a new baseline.
767
+ actions: nil,
768
+ # Remove matching regions after inclusions. Changes create a new baseline.
712
769
  exclude_selectors: nil,
713
- # CSS selectors defining the HTML regions to monitor. Matching subtrees are
714
- # combined in document order before text extraction, instead of automatic
715
- # main-content selection. Omit or pass an empty array to use automatic
716
- # main-content extraction. If the filtered page has no usable text, the run fails
717
- # without replacing the baseline. Changing these selectors creates a new baseline.
770
+ # Monitor these CSS-selected regions. Empty or omitted uses main content. Changes
771
+ # create a new baseline.
718
772
  include_selectors: nil,
719
773
  # Plain-language goal describing which page changes matter. When provided without
720
774
  # change_detection, semantic detection is inferred.
721
775
  instructions: nil,
722
776
  # Normalize whitespace before comparing or analyzing text.
723
777
  normalize_whitespace: nil,
778
+ # Use `page` to watch one web page.
724
779
  type: :page
725
780
  )
726
781
  end
@@ -730,6 +785,12 @@ module ContextDev
730
785
  {
731
786
  type: Symbol,
732
787
  url: String,
788
+ actions:
789
+ T.nilable(
790
+ T::Array[
791
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Variants
792
+ ]
793
+ ),
733
794
  exclude_selectors: T::Array[String],
734
795
  include_selectors: T::Array[String],
735
796
  instructions: String,
@@ -739,6 +800,307 @@ module ContextDev
739
800
  end
740
801
  def to_hash
741
802
  end
803
+
804
+ # Browser action discriminated by `do`. Each variant exposes only its applicable
805
+ # fields.
806
+ module Action
807
+ extend ContextDev::Internal::Type::Union
808
+
809
+ Variants =
810
+ T.type_alias do
811
+ T.any(
812
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Wait,
813
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Perform,
814
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll
815
+ )
816
+ end
817
+
818
+ class Wait < ContextDev::Internal::Type::BaseModel
819
+ OrHash =
820
+ T.type_alias do
821
+ T.any(
822
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Wait,
823
+ ContextDev::Internal::AnyHash
824
+ )
825
+ end
826
+
827
+ # Use `wait` to pause for a fixed duration.
828
+ sig { returns(Symbol) }
829
+ attr_accessor :do_
830
+
831
+ # Time to pause in milliseconds before the next action.
832
+ sig { returns(Integer) }
833
+ attr_accessor :time_ms
834
+
835
+ # Pause for a fixed number of milliseconds before continuing to the next action.
836
+ sig do
837
+ params(time_ms: Integer, do_: Symbol).returns(
838
+ T.attached_class
839
+ )
840
+ end
841
+ def self.new(
842
+ # Time to pause in milliseconds before the next action.
843
+ time_ms:,
844
+ # Use `wait` to pause for a fixed duration.
845
+ do_: :wait
846
+ )
847
+ end
848
+
849
+ sig { override.returns({ do_: Symbol, time_ms: Integer }) }
850
+ def to_hash
851
+ end
852
+ end
853
+
854
+ class Perform < ContextDev::Internal::Type::BaseModel
855
+ OrHash =
856
+ T.type_alias do
857
+ T.any(
858
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Perform,
859
+ ContextDev::Internal::AnyHash
860
+ )
861
+ end
862
+
863
+ # One browser instruction, such as clicking a button or entering text.
864
+ sig { returns(String) }
865
+ attr_accessor :action
866
+
867
+ # Use `perform` for a plain-language browser instruction.
868
+ sig { returns(Symbol) }
869
+ attr_accessor :do_
870
+
871
+ # Resolve and perform one natural-language browser action.
872
+ sig do
873
+ params(action: String, do_: Symbol).returns(T.attached_class)
874
+ end
875
+ def self.new(
876
+ # One browser instruction, such as clicking a button or entering text.
877
+ action:,
878
+ # Use `perform` for a plain-language browser instruction.
879
+ do_: :perform
880
+ )
881
+ end
882
+
883
+ sig { override.returns({ action: String, do_: Symbol }) }
884
+ def to_hash
885
+ end
886
+ end
887
+
888
+ class Scroll < ContextDev::Internal::Type::BaseModel
889
+ OrHash =
890
+ T.type_alias do
891
+ T.any(
892
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll,
893
+ ContextDev::Internal::AnyHash
894
+ )
895
+ end
896
+
897
+ # Use `scroll` to move through the page or a container.
898
+ sig { returns(Symbol) }
899
+ attr_accessor :do_
900
+
901
+ # Pixels per scroll, one visible viewport, or the current scroll boundary.
902
+ # Defaults to viewport.
903
+ sig do
904
+ returns(
905
+ T.nilable(
906
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Amount::Variants
907
+ )
908
+ )
909
+ end
910
+ attr_reader :amount
911
+
912
+ sig do
913
+ params(
914
+ amount:
915
+ T.any(
916
+ Integer,
917
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Amount::OrSymbol
918
+ )
919
+ ).void
920
+ end
921
+ attr_writer :amount
922
+
923
+ # CSS selector for the first matching scroll container. Defaults to the page.
924
+ sig { returns(T.nilable(String)) }
925
+ attr_reader :container
926
+
927
+ sig { params(container: String).void }
928
+ attr_writer :container
929
+
930
+ # Direction to scroll. Defaults to down.
931
+ sig do
932
+ returns(
933
+ T.nilable(
934
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction::TaggedSymbol
935
+ )
936
+ )
937
+ end
938
+ attr_reader :direction
939
+
940
+ sig do
941
+ params(
942
+ direction:
943
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction::OrSymbol
944
+ ).void
945
+ end
946
+ attr_writer :direction
947
+
948
+ # Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
949
+ # changing. Defaults to 1.
950
+ sig { returns(T.nilable(Integer)) }
951
+ attr_reader :max_scrolls
952
+
953
+ sig { params(max_scrolls: Integer).void }
954
+ attr_writer :max_scrolls
955
+
956
+ # Scroll the page or a selected scrollable container, waiting adaptively for
957
+ # content and dimensions to settle after each iteration.
958
+ sig do
959
+ params(
960
+ amount:
961
+ T.any(
962
+ Integer,
963
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Amount::OrSymbol
964
+ ),
965
+ container: String,
966
+ direction:
967
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction::OrSymbol,
968
+ max_scrolls: Integer,
969
+ do_: Symbol
970
+ ).returns(T.attached_class)
971
+ end
972
+ def self.new(
973
+ # Pixels per scroll, one visible viewport, or the current scroll boundary.
974
+ # Defaults to viewport.
975
+ amount: nil,
976
+ # CSS selector for the first matching scroll container. Defaults to the page.
977
+ container: nil,
978
+ # Direction to scroll. Defaults to down.
979
+ direction: nil,
980
+ # Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
981
+ # changing. Defaults to 1.
982
+ max_scrolls: nil,
983
+ # Use `scroll` to move through the page or a container.
984
+ do_: :scroll
985
+ )
986
+ end
987
+
988
+ sig do
989
+ override.returns(
990
+ {
991
+ do_: Symbol,
992
+ amount:
993
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Amount::Variants,
994
+ container: String,
995
+ direction:
996
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction::TaggedSymbol,
997
+ max_scrolls: Integer
998
+ }
999
+ )
1000
+ end
1001
+ def to_hash
1002
+ end
1003
+
1004
+ # Pixels per scroll, one visible viewport, or the current scroll boundary.
1005
+ # Defaults to viewport.
1006
+ module Amount
1007
+ extend ContextDev::Internal::Type::Union
1008
+
1009
+ Variants =
1010
+ T.type_alias do
1011
+ T.any(
1012
+ Integer,
1013
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Amount::TaggedSymbol
1014
+ )
1015
+ end
1016
+
1017
+ sig do
1018
+ override.returns(
1019
+ T::Array[
1020
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Amount::Variants
1021
+ ]
1022
+ )
1023
+ end
1024
+ def self.variants
1025
+ end
1026
+
1027
+ TaggedSymbol =
1028
+ T.type_alias do
1029
+ T.all(
1030
+ Symbol,
1031
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Amount
1032
+ )
1033
+ end
1034
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1035
+
1036
+ VIEWPORT =
1037
+ T.let(
1038
+ :viewport,
1039
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Amount::TaggedSymbol
1040
+ )
1041
+ MAX =
1042
+ T.let(
1043
+ :max,
1044
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Amount::TaggedSymbol
1045
+ )
1046
+ end
1047
+
1048
+ # Direction to scroll. Defaults to down.
1049
+ module Direction
1050
+ extend ContextDev::Internal::Type::Enum
1051
+
1052
+ TaggedSymbol =
1053
+ T.type_alias do
1054
+ T.all(
1055
+ Symbol,
1056
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction
1057
+ )
1058
+ end
1059
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1060
+
1061
+ UP =
1062
+ T.let(
1063
+ :up,
1064
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction::TaggedSymbol
1065
+ )
1066
+ DOWN =
1067
+ T.let(
1068
+ :down,
1069
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction::TaggedSymbol
1070
+ )
1071
+ LEFT =
1072
+ T.let(
1073
+ :left,
1074
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction::TaggedSymbol
1075
+ )
1076
+ RIGHT =
1077
+ T.let(
1078
+ :right,
1079
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction::TaggedSymbol
1080
+ )
1081
+
1082
+ sig do
1083
+ override.returns(
1084
+ T::Array[
1085
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Scroll::Direction::TaggedSymbol
1086
+ ]
1087
+ )
1088
+ end
1089
+ def self.values
1090
+ end
1091
+ end
1092
+ end
1093
+
1094
+ sig do
1095
+ override.returns(
1096
+ T::Array[
1097
+ ContextDev::Models::MonitorListResponse::Data::Target::Page::Action::Variants
1098
+ ]
1099
+ )
1100
+ end
1101
+ def self.variants
1102
+ end
1103
+ end
742
1104
  end
743
1105
 
744
1106
  class Sitemap < ContextDev::Internal::Type::BaseModel
@@ -750,6 +1112,7 @@ module ContextDev
750
1112
  )
751
1113
  end
752
1114
 
1115
+ # Use `sitemap` to watch a site for added or removed URLs.
753
1116
  sig { returns(Symbol) }
754
1117
  attr_accessor :type
755
1118
 
@@ -778,11 +1141,7 @@ module ContextDev
778
1141
  sig { params(max_urls: Integer).void }
779
1142
  attr_writer :max_urls
780
1143
 
781
- # Watch a sitemap for URL additions and removals. Crawled URLs are normalized
782
- # (lowercased host, no trailing slash/fragment) and scoped to the monitored site
783
- # and its subdomains before comparison. On a detected difference the sitemap is
784
- # re-fetched within the same run and only URLs both observations agree on are
785
- # reported, suppressing transient crawl flaps.
1144
+ # Watch a site’s URL inventory for confirmed additions and removals.
786
1145
  sig do
787
1146
  params(
788
1147
  url: String,
@@ -801,6 +1160,7 @@ module ContextDev
801
1160
  include: nil,
802
1161
  # Maximum number of sitemap URLs to track (capped at 10,000).
803
1162
  max_urls: nil,
1163
+ # Use `sitemap` to watch a site for added or removed URLs.
804
1164
  type: :sitemap
805
1165
  )
806
1166
  end
@@ -834,6 +1194,7 @@ module ContextDev
834
1194
  sig { returns(String) }
835
1195
  attr_accessor :instructions
836
1196
 
1197
+ # Use `extract` to watch structured data across selected pages.
837
1198
  sig { returns(Symbol) }
838
1199
  attr_accessor :type
839
1200
 
@@ -841,6 +1202,7 @@ module ContextDev
841
1202
  sig { returns(String) }
842
1203
  attr_accessor :url
843
1204
 
1205
+ # Allow page discovery on subdomains of the target site.
844
1206
  sig { returns(T.nilable(T::Boolean)) }
845
1207
  attr_reader :follow_subdomains
846
1208
 
@@ -861,25 +1223,16 @@ module ContextDev
861
1223
  sig { params(max_pages: Integer).void }
862
1224
  attr_writer :max_pages
863
1225
 
864
- # JSON Schema describing the data you care about. It is used three ways: it guides
865
- # which pages are selected for tracking, it gives the change judge extra context
866
- # on which changes matter (alongside `instructions`), and it defines the shape of
867
- # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
868
- # about once a day). It is not a response format for changes: change events and
869
- # webhook payloads always contain diffs, summaries, and evidence excerpts — never
870
- # data in this schema's shape. If omitted, a default summary + key-points schema
871
- # is used.
1226
+ # JSON Schema for page selection and the baseline snapshot. Changes return diffs
1227
+ # and evidence.
872
1228
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
873
1229
  attr_reader :schema
874
1230
 
875
1231
  sig { params(schema: T::Hash[Symbol, T.anything]).void }
876
1232
  attr_writer :schema
877
1233
 
878
- # Watch the monitor-relevant pages of a site for meaningful changes. A crawl
879
- # guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
880
- # track; each run re-checks exactly those pages, and confirmed content changes are
881
- # judged for relevance against the monitor's `instructions` (and `schema`, when
882
- # provided). The tracked page set is refreshed by a periodic re-discovery crawl.
1234
+ # Track relevant pages selected by `schema` and `instructions`; refresh the page
1235
+ # set periodically.
883
1236
  sig do
884
1237
  params(
885
1238
  instructions: String,
@@ -897,20 +1250,16 @@ module ContextDev
897
1250
  instructions:,
898
1251
  # Root URL to extract structured data from.
899
1252
  url:,
1253
+ # Allow page discovery on subdomains of the target site.
900
1254
  follow_subdomains: nil,
901
1255
  # Optional maximum link depth from the starting URL (0 = only the starting page).
902
1256
  max_depth: nil,
903
1257
  # Maximum number of pages to track.
904
1258
  max_pages: nil,
905
- # JSON Schema describing the data you care about. It is used three ways: it guides
906
- # which pages are selected for tracking, it gives the change judge extra context
907
- # on which changes matter (alongside `instructions`), and it defines the shape of
908
- # the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
909
- # about once a day). It is not a response format for changes: change events and
910
- # webhook payloads always contain diffs, summaries, and evidence excerpts — never
911
- # data in this schema's shape. If omitted, a default summary + key-points schema
912
- # is used.
1259
+ # JSON Schema for page selection and the baseline snapshot. Changes return diffs
1260
+ # and evidence.
913
1261
  schema: nil,
1262
+ # Use `extract` to watch structured data across selected pages.
914
1263
  type: :extract
915
1264
  )
916
1265
  end
@@ -943,10 +1292,8 @@ module ContextDev
943
1292
  end
944
1293
  end
945
1294
 
946
- # Current baseline: the last observed value the monitor compares new snapshots
947
- # against. Its shape follows `target.type` (page/sitemap/extract). Only populated
948
- # on GET /monitors/{monitor_id}; null until the first baseline run completes (and
949
- # after a target or change_detection update, which resets the baseline).
1295
+ # Comparison baseline, included on Retrieve. Null until capture completes or after
1296
+ # target changes.
950
1297
  module Baseline
951
1298
  extend ContextDev::Internal::Type::Union
952
1299
 
@@ -1059,10 +1406,8 @@ module ContextDev
1059
1406
  sig { returns(Time) }
1060
1407
  attr_accessor :captured_at
1061
1408
 
1062
- # The extracted structured data, matching the monitor's extraction schema (same
1063
- # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
1064
- # re-discovers its page set (at most about once a day); `null` when no extraction
1065
- # has been captured yet.
1409
+ # Latest structured snapshot matching the extraction schema, refreshed at most
1410
+ # daily; `null` before capture.
1066
1411
  sig { returns(T.anything) }
1067
1412
  attr_accessor :data
1068
1413
 
@@ -1082,10 +1427,8 @@ module ContextDev
1082
1427
  def self.new(
1083
1428
  # When this baseline was last captured or replaced.
1084
1429
  captured_at:,
1085
- # The extracted structured data, matching the monitor's extraction schema (same
1086
- # shape as the /web/extract endpoint's `data`). Refreshed when the monitor
1087
- # re-discovers its page set (at most about once a day); `null` when no extraction
1088
- # has been captured yet.
1430
+ # Latest structured snapshot matching the extraction schema, refreshed at most
1431
+ # daily; `null` before capture.
1089
1432
  data:,
1090
1433
  # The page URLs the monitor tracks and analyzes for changes.
1091
1434
  urls_analyzed:
@@ -1152,15 +1495,13 @@ module ContextDev
1152
1495
  )
1153
1496
  end
1154
1497
 
1155
- # Webhook URL events are delivered to. Slack incoming webhook URLs are
1156
- # automatically formatted as Slack messages.
1498
+ # Public HTTP(S) URL that receives events. Slack and GovSlack URLs get formatted
1499
+ # messages.
1157
1500
  sig { returns(String) }
1158
1501
  attr_accessor :url
1159
1502
 
1160
- # Events delivered to this endpoint. `change.detected` fires only when a run
1161
- # detects a change; `run.completed` fires on every completed run — including runs
1162
- # that detected no change — and embeds the change when one was detected. Defaults
1163
- # to `["change.detected"]` when omitted.
1503
+ # Events to deliver. Defaults to `change.detected`; `run.completed` also includes
1504
+ # unchanged runs.
1164
1505
  sig do
1165
1506
  returns(
1166
1507
  T.nilable(
@@ -1189,18 +1530,15 @@ module ContextDev
1189
1530
  sig { params(retry_: ContextDev::RetryConfig::OrHash).void }
1190
1531
  attr_writer :retry_
1191
1532
 
1192
- # Signing secret used to verify webhook authenticity. Omitted unless the API key
1193
- # has monitors:write permission or full access. Each delivery includes an
1194
- # `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
1195
- # `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
1196
- # compare and reject stale timestamps to prevent replay. Generated by the API;
1197
- # cannot be set by clients.
1533
+ # API-generated signing secret. Visible only with full access or `monitors:write`
1534
+ # permission.
1198
1535
  sig { returns(T.nilable(String)) }
1199
1536
  attr_reader :secret
1200
1537
 
1201
1538
  sig { params(secret: String).void }
1202
1539
  attr_writer :secret
1203
1540
 
1541
+ # Webhook destination and delivery settings. Null means no webhook is configured.
1204
1542
  sig do
1205
1543
  params(
1206
1544
  url: String,
@@ -1213,22 +1551,16 @@ module ContextDev
1213
1551
  ).returns(T.attached_class)
1214
1552
  end
1215
1553
  def self.new(
1216
- # Webhook URL events are delivered to. Slack incoming webhook URLs are
1217
- # automatically formatted as Slack messages.
1554
+ # Public HTTP(S) URL that receives events. Slack and GovSlack URLs get formatted
1555
+ # messages.
1218
1556
  url:,
1219
- # Events delivered to this endpoint. `change.detected` fires only when a run
1220
- # detects a change; `run.completed` fires on every completed run — including runs
1221
- # that detected no change — and embeds the change when one was detected. Defaults
1222
- # to `["change.detected"]` when omitted.
1557
+ # Events to deliver. Defaults to `change.detected`; `run.completed` also includes
1558
+ # unchanged runs.
1223
1559
  events: nil,
1224
1560
  # Webhook retry settings. Use {} for the default schedule.
1225
1561
  retry_: nil,
1226
- # Signing secret used to verify webhook authenticity. Omitted unless the API key
1227
- # has monitors:write permission or full access. Each delivery includes an
1228
- # `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
1229
- # `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
1230
- # compare and reject stale timestamps to prevent replay. Generated by the API;
1231
- # cannot be set by clients.
1562
+ # API-generated signing secret. Visible only with full access or `monitors:write`
1563
+ # permission.
1232
1564
  secret: nil
1233
1565
  )
1234
1566
  end
@@ -1396,6 +1728,46 @@ module ContextDev
1396
1728
  end
1397
1729
  end
1398
1730
  end
1731
+
1732
+ class KeyMetadata < ContextDev::Internal::Type::BaseModel
1733
+ OrHash =
1734
+ T.type_alias do
1735
+ T.any(
1736
+ ContextDev::Models::MonitorListResponse::KeyMetadata,
1737
+ ContextDev::Internal::AnyHash
1738
+ )
1739
+ end
1740
+
1741
+ # Credits charged for this request.
1742
+ sig { returns(Integer) }
1743
+ attr_accessor :credits_consumed
1744
+
1745
+ # Credits remaining for your organization.
1746
+ sig { returns(Integer) }
1747
+ attr_accessor :credits_remaining
1748
+
1749
+ # Credits this request used and your remaining balance.
1750
+ sig do
1751
+ params(credits_consumed: Integer, credits_remaining: Integer).returns(
1752
+ T.attached_class
1753
+ )
1754
+ end
1755
+ def self.new(
1756
+ # Credits charged for this request.
1757
+ credits_consumed:,
1758
+ # Credits remaining for your organization.
1759
+ credits_remaining:
1760
+ )
1761
+ end
1762
+
1763
+ sig do
1764
+ override.returns(
1765
+ { credits_consumed: Integer, credits_remaining: Integer }
1766
+ )
1767
+ end
1768
+ def to_hash
1769
+ end
1770
+ end
1399
1771
  end
1400
1772
  end
1401
1773
  end